diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-09-20 18:14:40 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2011-09-20 18:14:40 +0100 |
commit | d02052596f03390bf66ad4e107115ff00eaa5daf (patch) | |
tree | 051cdaa37597cf0fc358ff61970ec8b6f90903f1 | |
parent | e767aaacd093329035df63380a7dd3878ec9d626 (diff) |
WiP: abstract socket checkwip-abstract-socket-check
-rw-r--r-- | configure.ac | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/configure.ac b/configure.ac index 10575df5..359d6263 100644 --- a/configure.ac +++ b/configure.ac @@ -128,7 +128,6 @@ AC_ARG_ENABLE(asserts, AS_HELP_STRING([--enable-asserts],[include assertion chec AC_ARG_ENABLE(checks, AS_HELP_STRING([--enable-checks],[include sanity checks on public API]),enable_checks=$enableval,enable_checks=yes) AC_ARG_ENABLE(xml-docs, AS_HELP_STRING([--enable-xml-docs],[build XML documentation (requires xmlto)]),enable_xml_docs=$enableval,enable_xml_docs=auto) AC_ARG_ENABLE(doxygen-docs, AS_HELP_STRING([--enable-doxygen-docs],[build DOXYGEN documentation (requires Doxygen)]),enable_doxygen_docs=$enableval,enable_doxygen_docs=auto) -AC_ARG_ENABLE(abstract-sockets, AS_HELP_STRING([--enable-abstract-sockets],[use abstract socket namespace (linux only)]),enable_abstract_sockets=$enableval,enable_abstract_sockets=auto) AC_ARG_ENABLE(selinux, AS_HELP_STRING([--enable-selinux],[build with SELinux support]),enable_selinux=$enableval,enable_selinux=auto) AC_ARG_ENABLE(libaudit,AS_HELP_STRING([--enable-libaudit],[build audit daemon support for SELinux]),enable_libaudit=$enableval,enable_libaudit=auto) AC_ARG_ENABLE(dnotify, AS_HELP_STRING([--enable-dnotify],[build with dnotify support (linux only)]),enable_dnotify=$enableval,enable_dnotify=auto) @@ -763,12 +762,18 @@ AC_CHECK_FUNCS(pipe2 accept4) #### Abstract sockets -if test x$enable_abstract_sockets = xauto; then -AC_LANG_PUSH(C) -warn_on_xcompile=no -AC_CACHE_CHECK([abstract socket namespace], - ac_cv_have_abstract_sockets, - [AC_RUN_IFELSE([AC_LANG_PROGRAM( +AC_ARG_ENABLE([abstract-sockets], + AS_HELP_STRING([--enable-abstract-sockets], + [use abstract socket namespace (Linux only)]), + [enable_abstract_sockets=$enableval], + [enable_abstract_sockets=auto]) + +if test "x$enable_abstract_sockets" != xno; then + AC_LANG_PUSH([C]) + + AC_CACHE_CHECK([abstract socket namespace], + [ac_cv_have_abstract_sockets], + [AC_RUN_IFELSE([AC_LANG_PROGRAM( [[ #include <sys/types.h> #include <stdlib.h> @@ -809,22 +814,30 @@ AC_CACHE_CHECK([abstract socket namespace], else exit (0); ]])], - [ac_cv_have_abstract_sockets=yes], - [ac_cv_have_abstract_sockets=no], - [ - ac_cv_have_abstract_sockets=no - warn_on_xcompile=yes - ] -)]) -if test x$warn_on_xcompile = xyes ; then - AC_MSG_WARN([Cannot check for abstract sockets when cross-compiling, please use --enable-abstract-sockets]) -fi -AC_LANG_POP(C) -fi + [ac_cv_have_abstract_sockets=yes], + [ac_cv_have_abstract_sockets=no], + [ac_cv_have_abstract_sockets=crosscompiling] + )]) + AC_LANG_POP([C]) +fi + +case "$enable_abstract_sockets/$ac_cv_have_abstract_sockets" in + (no/*) + enable_abstract_sockets=no + ;; + (yes/no) + AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.]) + ;; + (yes/crosscompiling) + AC_MSG_NOTICE([Cannot confirm that --enable-abstract-sockets will work, because cross-compiling]) + ;; + (*/crosscompiling) + AC_MSG_NOTICE([Cannot confirm whether abstract sockets work, because cross-compiling: please use --enable-abstract-sockets or --disable-abstract-sockets]) + ;; +esac -if test x$enable_abstract_sockets = xyes; then +if test "x$enable_abstract_sockets" = xyes; then if test x$ac_cv_have_abstract_sockets = xno; then - AC_MSG_ERROR([Abstract sockets explicitly required, and support not detected.]) fi fi |