Commit 3a75671c authored by Tomas Popela's avatar Tomas Popela

meson: Adapt to the PHP changes in the httpd.conf.in

As there are more possible names of the PHP module (with or without
minor version) use a glob when looking for it.
parent 373dbc81
#!/usr/bin/env python3
#
# Copyright 2017 Tomas Popela <tpopela@redhat.com>
# Copyright 2017, 2018 Tomas Popela <tpopela@redhat.com>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
......@@ -25,6 +25,18 @@ import re
import subprocess
import sys
import os
import glob
def check_php_module(modules_path):
php_modules = glob.glob(os.path.join(modules_path, 'libphp7*.so'));
if len(php_modules):
# The last one in the sorted output will be the desired php module.
return sorted(php_modules)[-1];
def check_module(modules_path, module):
module_path = os.path.join(modules_path, module)
return os.path.isfile(module_path)
def main():
......@@ -55,25 +67,26 @@ def main():
apache_module_dir = ''
apache_ssl_module_dir = ''
apache_php_module_dir = ''
apache_php_module_file = ''
for lib_dir in ['lib', 'lib64']:
for httpd_dir in ['apache', 'apache2', 'http', 'http2', 'httpd']:
for mpm_suffix in ['', '-' + mpm]:
for modules_dir in ['', 'modules']:
modules_path = os.path.join(apache_prefix, lib_dir, httpd_dir + mpm_suffix, modules_dir)
if os.path.isfile(os.path.join(modules_path, 'mod_auth_digest.so')):
if check_module(modules_path, 'mod_auth_digest.so'):
apache_module_dir = modules_path
if os.path.isfile(os.path.join(modules_path, 'mod_ssl.so')):
if check_module(modules_path, 'mod_ssl.so'):
apache_ssl_module_dir = modules_path
if os.path.isfile(os.path.join(modules_path, 'libphp7.so')):
apache_php_module_dir = modules_path
php_module = check_php_module(modules_path)
if (php_module):
apache_php_module_file = php_module
# These two are mandatory for having properly configured Apache
if apache_module_dir == '' or apache_ssl_module_dir == '':
sys.exit(1)
print(apache_module_dir + ":" + apache_ssl_module_dir + ":" + apache_php_module_dir, end='')
print(apache_module_dir + ":" + apache_ssl_module_dir + ":" + apache_php_module_file, end='')
if __name__ == "__main__":
main()
......@@ -132,7 +132,7 @@ if have_apache
message('Apache module directory: ' + apache_module_dirs[0])
cdata.set('APACHE_MODULE_DIR', apache_module_dirs[0])
cdata.set('APACHE_SSL_MODULE_DIR', apache_module_dirs[1])
cdata.set('APACHE_PHP_MODULE_DIR', apache_module_dirs[2])
cdata.set('APACHE_PHP_MODULE_FILE', apache_module_dirs[2])
apache_mod_unixd = run_command('test', '-f', join_paths(apache_module_dirs[0], 'mod_unixd.so'))
cdata.set('IF_HAVE_MOD_UNIXD', apache_mod_unixd.returncode() == 0 ? '' : '#')
cdata.set('HAVE_APACHE', have_apache)
......@@ -143,7 +143,7 @@ have_php = false
have_php_xmlrpc = false
if have_apache
php = find_program('php', required : false)
apache_php_module = run_command('test', '-d', cdata.get('APACHE_PHP_MODULE_DIR'))
apache_php_module = run_command('test', '-f', cdata.get('APACHE_PHP_MODULE_FILE'))
if apache_php_module.returncode() == 0
have_php = true
php_xmlrpc = run_command(php, '-d', 'extension=xmlrpc', '-r', 'exit(function_exists("xmlrpc_server_create")?0:1);')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment