[libsoup/wip/meson: 45/93] Implement detecting of dependencies needed for tests
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/wip/meson: 45/93] Implement detecting of dependencies needed for tests
- Date: Wed, 11 Apr 2018 10:43:05 +0000 (UTC)
commit ba600cb4eddbe2d5a97ae4d8935aa57117af1fb7
Author: Tomas Popela <tpopela redhat com>
Date: Tue Oct 3 18:51:28 2017 +0200
Implement detecting of dependencies needed for tests
get-apache-module-dirs.sh | 31 +++++++++++++++++++++++
meson.build | 60 +++++++++++++++++++++++++++++++++++++++++++++
tests/meson.build | 3 ++
3 files changed, 94 insertions(+), 0 deletions(-)
---
diff --git a/get-apache-module-dirs.sh b/get-apache-module-dirs.sh
new file mode 100755
index 0000000..cddf7b7
--- /dev/null
+++ b/get-apache-module-dirs.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# Checks whether the required Apache modules are available and prints their path
+# to stdout - where values are separated by colons.
+#
+# Only one argument is required - path to the Apache httpd2 binary
+
+if [ -z $1 ]; then
+ exit 1
+fi
+
+apache_httpd=$1
+
+apache_prefix=$(dirname $(dirname $apache_httpd))
+mpm=$($apache_httpd -V -C "ServerName localhost" | sed -ne 's/^Server MPM: */-/p' | tr 'A-Z' 'a-z')
+# This only works with bash, but should fail harmlessly in sh
+apache_module_dirs=$(echo $apache_prefix/lib{64,}/{apache,apache2,http,http2,httpd}{$mpm,}{/modules,})
+
+for dir in $apache_module_dirs; do
+ if test -f $dir/mod_auth_digest.so; then
+ APACHE_MODULE_DIR="$dir"
+ fi
+ if test -f $dir/mod_ssl.so; then
+ APACHE_SSL_MODULE_DIR="$dir"
+ fi
+ if test -f $dir/libphp7.so; then
+ APACHE_PHP_MODULE_DIR="$dir"
+ fi
+done
+
+echo -n "$APACHE_MODULE_DIR:$APACHE_SSL_MODULE_DIR:$APACHE_PHP_MODULE_DIR"
diff --git a/meson.build b/meson.build
index 68d89d7..b088710 100644
--- a/meson.build
+++ b/meson.build
@@ -51,6 +51,65 @@ if enable_tls_check
endif
endif
+################################
+# Regresion tests dependencies #
+################################
+apache_httpd2 = find_program('httpd2', 'httpd', 'apache2', 'apache', required : false)
+have_apache=false
+apache_httpd2_version = ''
+if apache_httpd2.found()
+ apache_httpd2_version_raw = run_command(apache_httpd2.path(), '-v')
+ if apache_httpd2_version_raw.returncode() == 0
+ apache_httpd2_version = apache_httpd2_version_raw.stdout().split('\n')[0]
+ apache_httpd2_version = apache_httpd2_version.split('/')[1].split(' ')[0]
+ if apache_httpd2_version.version_compare('>=2.4')
+ have_apache = true
+ add_project_arguments('-DAPACHE_HTTPD=' + apache_httpd2_version, language : 'c')
+ else
+ message('Found ' + apache_httpd2_version + ', but at least 2.4 is needed - ignoring')
+ endif
+ endif
+endif
+
+if have_apache
+ apache_modules = run_command('sh', 'get-apache-module-dirs.sh', apache_httpd2.path())
+ if apache_modules.returncode() == 0
+ message('Apache module directory: ' + apache_modules.stdout().split(':')[0])
+ apache_module_dir = apache_modules.stdout().split(':')[0]
+ cdata.set('APACHE_MODULE_DIR', apache_module_dir)
+ apache_ssl_module_dir = apache_modules.stdout().split(':')[1]
+ cdata.set('APACHE_SSL_MODULE_DIR', apache_ssl_module_dir)
+ if apache_module_dir != '' and apache_ssl_module_dir != ''
+ have_apache = true
+ add_project_arguments('-DHAVE_APACHE=1', language : 'c')
+ endif
+ cdata.set('APACHE_PHP_MODULE_DIR', apache_modules.stdout().split(':')[2])
+ endif
+endif
+
+have_php = false
+if have_apache
+ php = find_program('php', required : false)
+ apache_php_module = run_command('test', '-d', cdata.get('APACHE_PHP_MODULE_DIR'))
+ if apache_php_module.returncode() == 0
+ have_php = true
+ php_xmlrpc = run_command(php, '--rf', 'xmlrpc_server_create')
+ if php_xmlrpc.returncode() == 0
+ message('php-xmlrpc found')
+ add_project_arguments('-DHAVE_PHP_XMLRPC=1', language : 'c')
+ else
+ message('php-xmlrpc not found')
+ endif
+ endif
+ cdata.set('IF_HAVE_PHP', have_php ? '' : '#')
+ apache_mod_unixd = run_command('test', '-d', cdata.get('APACHE_MODULE_DIR') + 'mod_unixd.so')
+ cdata.set('IF_HAVE_MOD_UNIXD', apache_mod_unixd.returncode() == 0 ? '' : '#')
+endif
+
+if find_program('curl', required : false).found()
+ add_project_arguments('-DHAVE_CURL=1', language : 'c')
+endif
+
##################
# GSSAPI support #
##################
@@ -130,3 +189,4 @@ configure_file(output : 'libsoup-2.4.pc',
subdir('libsoup')
subdir('examples')
+subdir('tests')
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..4025e53
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,3 @@
+configure_file(output : 'httpd.conf',
+ input : 'httpd.conf.in',
+ configuration : cdata)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]