diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 534 |
1 files changed, 284 insertions, 250 deletions
diff --git a/configure.in b/configure.in index 2a0e64e2..c011b4a7 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_PREREQ(2.52) m4_define([dbus_major_version], [1]) m4_define([dbus_minor_version], [2]) -m4_define([dbus_micro_version], [14]) +m4_define([dbus_micro_version], [16]) m4_define([dbus_version], [dbus_major_version.dbus_minor_version.dbus_micro_version]) AC_INIT(dbus, [dbus_version]) @@ -130,249 +130,6 @@ if test x$enable_userdb_cache = xyes; then AC_DEFINE(DBUS_ENABLE_USERDB_CACHE,1,[Build with caching of user data]) fi -#### gcc warning flags - -cc_supports_flag() { - AC_MSG_CHECKING(whether $CC supports "$@") - Cfile=/tmp/foo${$} - touch ${Cfile}.c - $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1 - rc=$? - rm -f ${Cfile}.c ${Cfile}.o - case $rc in - 0) AC_MSG_RESULT(yes);; - *) AC_MSG_RESULT(no);; - esac - return $rc -} - -ld_supports_flag() { - AC_MSG_CHECKING([whether $LD supports "$@"]) - AC_TRY_LINK([ - int one(void) { return 1; } - int two(void) { return 2; } - ], [ two(); ] , [_ac_ld_flag_supported=yes], [_ac_ld_flag_supported=no]) - - if test "$_ac_ld_flag_supported" = "yes"; then - rm -f conftest.c - touch conftest.c - if $CC -c conftest.c; then - ld_out=`$LD $@ -o conftest conftest.o 2>&1` - ld_ret=$? - if test $ld_ret -ne 0 ; then - _ac_ld_flag_supported=no - elif echo "$ld_out" | egrep 'option ignored|^usage:|unrecognized option|illegal option' >/dev/null ; then - _ac_ld_flag_supported=no - fi - fi - rm -f conftest.c conftest.o conftest - fi - - AC_MSG_RESULT($_ac_ld_flag_supported) - if test "$_ac_ld_flag_supported" = "yes" ; then - return 0 - else - return 1 - fi -} - -if test x$USE_MAINTAINER_MODE = xyes; then - if cc_supports_flag "-Werror"; then - CFLAGS="$CFLAGS -Werror" - fi -fi - -if test "x$GCC" = "xyes"; then - changequote(,)dnl - case " $CFLAGS " in - *[\ \ ]-Wall[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wall" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wchar-subscripts[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wchar-subscripts" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wmissing-declarations[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wmissing-declarations" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wnested-externs[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wnested-externs" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wpointer-arith[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wpointer-arith" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wcast-align[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wcast-align" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wfloat-equal[\ \ ]*) ;; - *) if cc_supports_flag -Wfloat-equals; then - CFLAGS="$CFLAGS -Wfloat-equal" - fi - ;; - esac - - case " $CFLAGS " in - *[\ \ ]-Wdeclaration-after-statement[\ \ ]*) ;; - *) if cc_supports_flag -Wdeclaration-after-statement; then - CFLAGS="$CFLAGS -Wdeclaration-after-statement" - fi - ;; - esac - - case " $CFLAGS " in - *[\ \ ]-fno-common[\ \ ]*) ;; - *) if cc_supports_flag -fno-common; then - CFLAGS="$CFLAGS -fno-common" - fi - ;; - esac - - case " $CFLAGS " in - *[\ \ ]-fPIC[\ \ ]*) ;; - *) if cc_supports_flag -fPIC; then - PIC_CFLAGS="-fPIC" - if ld_supports_flag -z,relro; then - PIC_LDFLAGS="-Wl,-z,relro" - fi - fi - ;; - esac - - case " $CFLAGS " in - *[\ \ ]-fPIE[\ \ ]*) ;; - *) if cc_supports_flag -fPIE; then - PIE_CFLAGS="-fPIE" - if ld_supports_flag -z,relro; then - PIE_LDFLAGS="-pie -Wl,-z,relro" - else - PIE_LDFLAGS="-pie" - fi - fi - ;; - esac - - ### Disabled warnings, and compiler flag overrides - - # Let's just ignore unused for now - case " $CFLAGS " in - *[\ \ ]-Wno-unused[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wno-unused" ;; - esac - - # This group is for warnings we currently don't pass. - # We would like to, however. Please fix. - - # http://bugs.freedesktop.org/show_bug.cgi?id=17433 - case " $CFLAGS " in - *[\ \ ]-Wno-sign-compare[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wno-sign-compare" ;; - esac - case " $CFLAGS " in - *[\ \ ]-Wno-pointer-sign[\ \ ]*) ;; - *) if cc_supports_flag -Wno-pointer-sign; then - CFLAGS="$CFLAGS -Wno-pointer-sign" - fi - ;; - esac - - # http://bugs.freedesktop.org/show_bug.cgi?id=19195 - case " $CFLAGS " in - *[\ \ ]-Wno-format[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -Wno-format" ;; - esac - - # This one is special - it's not a warning override. - # http://bugs.freedesktop.org/show_bug.cgi?id=10599 - case " $CFLAGS " in - *[\ \ ]-fno-strict-aliasing[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -fno-strict-aliasing" ;; - esac - ### End disabled warnings - - if test "x$enable_ansi" = "xyes"; then - case " $CFLAGS " in - *[\ \ ]-ansi[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -ansi" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-D_POSIX_C_SOURCE*) ;; - *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;; - esac - - case " $CFLAGS " in - *[\ \ ]-pedantic[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -pedantic" ;; - esac - fi - if test x$enable_gcov = xyes; then - case " $CFLAGS " in - *[\ \ ]-fprofile-arcs[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -fprofile-arcs" ;; - esac - case " $CFLAGS " in - *[\ \ ]-ftest-coverage[\ \ ]*) ;; - *) CFLAGS="$CFLAGS -ftest-coverage" ;; - esac - - ## remove optimization - CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'` - fi - changequote([,])dnl -else - if test x$enable_gcov = xyes; then - AC_MSG_ERROR([--enable-gcov can only be used with gcc]) - fi -fi - -AC_SUBST(PIC_CFLAGS) -AC_SUBST(PIC_LDFLAGS) -AC_SUBST(PIE_CFLAGS) -AC_SUBST(PIE_LDFLAGS) - -if ld_supports_flag --gc-sections; then - SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" - CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" -fi -AC_SUBST(SECTION_FLAGS) -AC_SUBST(SECTION_LDFLAGS) -AC_MSG_RESULT($ac_gcsections) - -# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris -# -case $host_os in - solaris*) - CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;; -esac - -changequote(,)dnl -# compress spaces in flags -CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'` -CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'` -CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'` -changequote([,])dnl - if test x$enable_gcov = xyes; then ## so that config.h changes when you toggle gcov support AC_DEFINE_UNQUOTED(DBUS_GCOV_ENABLED, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing]) @@ -514,7 +271,8 @@ dnl we currently check for all three va_copy possibilities, so we get dnl all results in config.log for bug reports. AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[ AC_LINK_IFELSE([#include <stdarg.h> - void f (int i, ...) { +#include <stdlib.h> + static void f (int i, ...) { va_list args1, args2; va_start (args1, i); va_copy (args2, args1); @@ -531,7 +289,8 @@ AC_CACHE_CHECK([for an implementation of va_copy()],dbus_cv_va_copy,[ ]) AC_CACHE_CHECK([for an implementation of __va_copy()],dbus_cv___va_copy,[ AC_LINK_IFELSE([#include <stdarg.h> - void f (int i, ...) { +#include <stdlib.h> + static void f (int i, ...) { va_list args1, args2; va_start (args1, i); __va_copy (args2, args1); @@ -564,9 +323,10 @@ AC_CACHE_CHECK([whether va_lists can be copied by value], [AC_RUN_IFELSE([AC_LANG_PROGRAM( [[ #include <stdarg.h> + #include <stdlib.h> ]], [[ - void f (int i, ...) { + static void f (int i, ...) { va_list args1, args2; va_start (args1, i); args2 = args1; @@ -609,7 +369,7 @@ fi AC_DEFINE_UNQUOTED([DBUS_USE_SYNC], [$have_sync], [Use the gcc __sync extension]) #### Various functions -AC_CHECK_LIB(socket,socket) +AC_SEARCH_LIBS(socket,[socket network]) AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)]) AC_CHECK_FUNCS(vsnprintf vasprintf nanosleep usleep setenv clearenv unsetenv socketpair getgrouplist fpathconf setrlimit poll) @@ -683,6 +443,13 @@ AC_CHECK_HEADERS(byteswap.h) AC_CHECK_HEADERS(unistd.h) +# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris +# +case $host_os in + solaris*) + CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;; +esac + # checking for a posix version of getpwnam_r # if we are cross compiling and can not run the test # assume getpwnam_r is the posix version @@ -926,8 +693,31 @@ if $dbus_use_libxml; then fi # Thread lib detection -AC_CHECK_FUNC(pthread_cond_timedwait,,[AC_CHECK_LIB(pthread,pthread_cond_timedwait, +AC_CHECK_FUNC(pthread_cond_timedwait,[AC_CHECK_LIB(pthread,pthread_cond_timedwait, [THREAD_LIBS="-lpthread"])]) +save_libs="$LIBS" +LIBS="$LIBS $THREAD_LIBS" +AC_CHECK_FUNC(pthread_condattr_setclock,have_pthread_condattr_setclock=true,have_pthread_condattr_setclock=false) +if test x$have_pthread_condattr_setclock = xtrue; then + AC_SEARCH_LIBS([clock_getres],[rt],[THREAD_LIBS="$THREAD_LIBS -lrt"]) + AC_MSG_CHECKING([for CLOCK_MONOTONIC]) + AC_TRY_COMPILE([#include <time.h> +#include <pthread.h> +], [ +struct timespec monotonic_timer; +pthread_condattr_t attr; +pthread_condattr_init (&attr); +pthread_condattr_setclock (&attr, CLOCK_MONOTONIC); +clock_getres (CLOCK_MONOTONIC,&monotonic_timer); +], have_clock_monotonic=true, have_clock_monotonic=false) +if test x$have_clock_monotonic = xtrue; then + AC_MSG_RESULT([found]) + AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, [Define if we have CLOCK_MONOTONIC]) +else + AC_MSG_RESULT([not found]) +fi +fi +LIBS="$save_libs" # SELinux detection if test x$enable_selinux = xno ; then @@ -984,7 +774,7 @@ fi dnl check if inotify backend is enabled if test x$have_inotify = xyes; then AC_DEFINE(DBUS_BUS_ENABLE_INOTIFY,1,[Use inotify]) - + AC_CHECK_FUNCS(inotify_init1) fi AM_CONDITIONAL(DBUS_BUS_ENABLE_INOTIFY, test x$have_inotify = xyes) @@ -1138,6 +928,250 @@ fi AC_SUBST(DBUS_X_CFLAGS) AC_SUBST(DBUS_X_LIBS) + +#### gcc warning flags + +cc_supports_flag() { + AC_MSG_CHECKING(whether $CC supports "$@") + Cfile=/tmp/foo${$} + touch ${Cfile}.c + $CC -c "$@" ${Cfile}.c -o ${Cfile}.o >/dev/null 2>&1 + rc=$? + rm -f ${Cfile}.c ${Cfile}.o + case $rc in + 0) AC_MSG_RESULT(yes);; + *) AC_MSG_RESULT(no);; + esac + return $rc +} + +ld_supports_flag() { + AC_MSG_CHECKING([whether $LD supports "$@"]) + AC_TRY_LINK([ + int one(void) { return 1; } + int two(void) { return 2; } + ], [ two(); ] , [_ac_ld_flag_supported=yes], [_ac_ld_flag_supported=no]) + + if test "$_ac_ld_flag_supported" = "yes"; then + rm -f conftest.c + touch conftest.c + if $CC -c conftest.c; then + ld_out=`$LD $@ -o conftest conftest.o 2>&1` + ld_ret=$? + if test $ld_ret -ne 0 ; then + _ac_ld_flag_supported=no + elif echo "$ld_out" | egrep 'option ignored|^usage:|unrecognized option|illegal option' >/dev/null ; then + _ac_ld_flag_supported=no + fi + fi + rm -f conftest.c conftest.o conftest + fi + + AC_MSG_RESULT($_ac_ld_flag_supported) + if test "$_ac_ld_flag_supported" = "yes" ; then + return 0 + else + return 1 + fi +} + +if test x$USE_MAINTAINER_MODE = xyes; then + if cc_supports_flag "-Werror"; then + CFLAGS="$CFLAGS -Werror" + fi +fi + +if test "x$GCC" = "xyes"; then + changequote(,)dnl + case " $CFLAGS " in + *[\ \ ]-Wall[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wall" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wchar-subscripts[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wchar-subscripts" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wmissing-declarations[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wmissing-declarations" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wmissing-prototypes[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wmissing-prototypes" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wnested-externs[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wnested-externs" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wpointer-arith[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wpointer-arith" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wcast-align[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wcast-align" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wfloat-equal[\ \ ]*) ;; + *) if cc_supports_flag -Wfloat-equals; then + CFLAGS="$CFLAGS -Wfloat-equal" + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-Wdeclaration-after-statement[\ \ ]*) ;; + *) if cc_supports_flag -Wdeclaration-after-statement; then + CFLAGS="$CFLAGS -Wdeclaration-after-statement" + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-fno-common[\ \ ]*) ;; + *) if cc_supports_flag -fno-common; then + CFLAGS="$CFLAGS -fno-common" + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-fPIC[\ \ ]*) ;; + *) if cc_supports_flag -fPIC; then + PIC_CFLAGS="-fPIC" + if ld_supports_flag -z,relro; then + PIC_LDFLAGS="-Wl,-z,relro" + fi + fi + ;; + esac + + case " $CFLAGS " in + *[\ \ ]-fPIE[\ \ ]*) ;; + *) if cc_supports_flag -fPIE; then + PIE_CFLAGS="-fPIE" + if ld_supports_flag -z,relro; then + PIE_LDFLAGS="-pie -Wl,-z,relro" + else + PIE_LDFLAGS="-pie" + fi + fi + ;; + esac + + ### Disabled warnings, and compiler flag overrides + + # Let's just ignore unused for now + case " $CFLAGS " in + *[\ \ ]-Wno-unused[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wno-unused" ;; + esac + + # This group is for warnings we currently don't pass. + # We would like to, however. Please fix. + + # http://bugs.freedesktop.org/show_bug.cgi?id=17433 + case " $CFLAGS " in + *[\ \ ]-Wno-sign-compare[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wno-sign-compare" ;; + esac + case " $CFLAGS " in + *[\ \ ]-Wno-pointer-sign[\ \ ]*) ;; + *) if cc_supports_flag -Wno-pointer-sign; then + CFLAGS="$CFLAGS -Wno-pointer-sign" + fi + ;; + esac + + # http://bugs.freedesktop.org/show_bug.cgi?id=19195 + case " $CFLAGS " in + *[\ \ ]-Wno-format[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -Wno-format" ;; + esac + + # This one is special - it's not a warning override. + # http://bugs.freedesktop.org/show_bug.cgi?id=10599 + case " $CFLAGS " in + *[\ \ ]-fno-strict-aliasing[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -fno-strict-aliasing" ;; + esac + ### End disabled warnings + + if test "x$enable_ansi" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -ansi" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-D_POSIX_C_SOURCE*) ;; + *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;; + esac + + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -pedantic" ;; + esac + fi + if test x$enable_gcov = xyes; then + case " $CFLAGS " in + *[\ \ ]-fprofile-arcs[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -fprofile-arcs" ;; + esac + case " $CFLAGS " in + *[\ \ ]-ftest-coverage[\ \ ]*) ;; + *) CFLAGS="$CFLAGS -ftest-coverage" ;; + esac + + ## remove optimization + CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9]*//g'` + fi + changequote([,])dnl +else + if test x$enable_gcov = xyes; then + AC_MSG_ERROR([--enable-gcov can only be used with gcc]) + fi +fi + +AC_SUBST(PIC_CFLAGS) +AC_SUBST(PIC_LDFLAGS) +AC_SUBST(PIE_CFLAGS) +AC_SUBST(PIE_LDFLAGS) + +if ld_supports_flag --gc-sections; then + SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" + CFLAGS="-ffunction-sections -fdata-sections $CFLAGS" +fi +AC_SUBST(SECTION_FLAGS) +AC_SUBST(SECTION_LDFLAGS) +AC_MSG_RESULT($ac_gcsections) + +# Add -D_POSIX_PTHREAD_SEMANTICS if on Solaris +# +case $host_os in + solaris*) + CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS" ;; +esac + +changequote(,)dnl +# compress spaces in flags +CFLAGS=`echo "$CFLAGS" | sed -e 's/ +/ /g'` +CXXFLAGS=`echo "$CXXFLAGS" | sed -e 's/ +/ /g'` +CPPFLAGS=`echo "$CPPFLAGS" | sed -e 's/ +/ /g'` +changequote([,])dnl + ### Doxygen Documentation AC_PATH_PROG(DOXYGEN, doxygen, no) |