2.29.12
[platform/upstream/glib.git] / configure.ac
index 5a4f229..8cddd49 100644 (file)
@@ -27,7 +27,7 @@ m4_define(glib_configure_ac)
 
 m4_define([glib_major_version], [2])
 m4_define([glib_minor_version], [29])
-m4_define([glib_micro_version], [2])
+m4_define([glib_micro_version], [12])
 m4_define([glib_interface_age], [0])
 m4_define([glib_binary_age],
           [m4_eval(100 * glib_minor_version + glib_micro_version)])
@@ -59,12 +59,13 @@ AC_CONFIG_MACRO_DIR([m4macros])
 # Save this value here, since automake will set cflags later
 cflags_set=${CFLAGS+set}
 
-AM_INIT_AUTOMAKE([1.10 no-define])
+AM_INIT_AUTOMAKE([1.11 no-define no-dist-gzip dist-xz tar-ustar])
+AM_MAINTAINER_MODE([enable])
 
-# Support silent build rules, requires at least automake-1.11. Disable
+# Support silent build rules. Disable
 # by either passing --disable-silent-rules to configure or passing V=1
 # to make
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+AM_SILENT_RULES([yes])
 
 GLIB_MAJOR_VERSION=glib_major_version
 GLIB_MINOR_VERSION=glib_minor_version
@@ -103,9 +104,6 @@ AC_SUBST(LT_REVISION)
 AC_SUBST(LT_AGE)
 AC_SUBST(LT_CURRENT_MINUS_AGE)
 
-dnl Initialize maintainer mode
-AM_MAINTAINER_MODE
-
 dnl Checks for programs.
 AC_PROG_CC
 AC_PROG_CPP
@@ -206,6 +204,10 @@ if test "x$glib_have_carbon" = "xyes"; then
   LDFLAGS="$LDFLAGS -framework Carbon"
 fi
 
+gl_GLIBC21
+if test "x$GLIBC21" = "xyes"; then
+  AC_DEFINE([_GNU_SOURCE], 1, [Make all glibc extensions visible])
+fi
 
 dnl declare --enable-* args and collect ac_help strings
 AC_ARG_ENABLE(debug,
@@ -412,7 +414,6 @@ else
   fi
 fi
 
-gl_GLIBC21
 AC_ARG_ENABLE(iconv-cache, 
               [AC_HELP_STRING([--enable-iconv-cache=@<:@yes/no/auto@:>@],
                               [cache iconv descriptors [default=auto]])],,
@@ -577,45 +578,50 @@ AC_FUNC_VPRINTF
 AC_FUNC_ALLOCA
 AC_CHECK_FUNCS(mmap posix_memalign memalign valloc fsync pipe2)
 AC_CHECK_FUNCS(atexit on_exit timegm gmtime_r)
-# BSD has a qsort_r with wrong argument order
-AC_MSG_CHECKING([for qsort_r])
-AC_RUN_IFELSE([[
-#define _GNU_SOURCE
-#include <stdlib.h>
 
-static int
-cmp (const void *a, const void *b, void *c)
-{
-  const int *ia = a;
-  const int *ib = b;
+dnl don't use AC_CHECK_FUNCS here, otherwise HAVE_QSORT_R will
+dnl be automatically defined, which we don't want to do
+dnl until we have checked this function is actually usable
+AC_CHECK_FUNC([qsort_r])
 
-  if (*ia < *ib)
-    return -1;
-  else if (*ia > *ib)
-    return 1;
-  else
-    return 0;
-}
+# BSD has a qsort_r with wrong argument order
+if test x$ac_cv_func_qsort_r = xyes ; then
+  AC_CACHE_CHECK([if qsort_r uses glibc compatible argument order], glib_cv_have_qsort_r, [
+  AC_RUN_IFELSE([AC_LANG_SOURCE([[
+  #define _GNU_SOURCE
+  #include <stdlib.h>
+
+  static int
+  cmp (const void *a, const void *b, void *c)
+  {
+    const int *ia = a;
+    const int *ib = b;
+
+    if (*ia < *ib)
+      return -1;
+    else if (*ia > *ib)
+      return 1;
+    else
+      return 0;
+  }
 
-int
-main (int argc, char **argv)
-{
-  int arr[3] = { 1, 2, 0 };
-  int d = 3;
+  int
+  main (int argc, char **argv)
+  {
+    int arr[3] = { 1, 2, 0 };
+    int d = 3;
 
-  qsort_r (arr, 3, sizeof (int), cmp, &d);
+    qsort_r (arr, 3, sizeof (int), cmp, &d);
 
-  if (arr[0] == 0 && arr[1] == 1 && arr[2] == 2)
-    return 0;
-  else
-    return 1;
-}]],[have_qsort_r=yes],[have_qsort_r=no])
+    if (arr[0] == 0 && arr[1] == 1 && arr[2] == 2)
+      return 0;
+    else
+      return 1;
+  }]])],[glib_cv_have_qsort_r=yes],[glib_cv_have_qsort_r=no])])
+fi
 
-if test $have_qsort_r = yes ; then
-  AC_MSG_RESULT([yes])
-    AC_DEFINE(HAVE_QSORT_R, 1, [Define to 1 if you have the 'qsort_r' function])
-else
-  AC_MSG_RESULT([no])
+if test x$glib_cv_have_qsort_r = xyes ; then
+  AC_DEFINE(HAVE_QSORT_R, 1, [Define to 1 if you have the 'qsort_r' function])
 fi
 
 AC_CHECK_SIZEOF(char)
@@ -724,10 +730,10 @@ dnl AC_C_INLINE is useless to us since it bails out too early, we need to
 dnl truely know which ones of `inline', `__inline' and `__inline__' are
 dnl actually supported.
 AC_CACHE_CHECK([for __inline],glib_cv_has__inline,[
-        AC_COMPILE_IFELSE([
+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
        __inline int foo () { return 0; }
        int main () { return foo (); }
-               ],
+       ]])],
        glib_cv_has__inline=yes
         ,
        glib_cv_has__inline=no
@@ -737,10 +743,10 @@ case x$glib_cv_has__inline in
 xyes) AC_DEFINE(G_HAVE___INLINE,1,[Have __inline keyword])
 esac
 AC_CACHE_CHECK([for __inline__],glib_cv_has__inline__,[
-        AC_COMPILE_IFELSE([
+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
        __inline__ int foo () { return 0; }
        int main () { return foo (); }
-               ],
+       ]])],
        glib_cv_has__inline__=yes
         ,
        glib_cv_has__inline__=no
@@ -750,11 +756,11 @@ case x$glib_cv_has__inline__ in
 xyes) AC_DEFINE(G_HAVE___INLINE__,1,[Have __inline__ keyword])
 esac
 AC_CACHE_CHECK([for inline], glib_cv_hasinline,[
-        AC_COMPILE_IFELSE([
+        AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
        #undef inline
        inline int foo () { return 0; }
        int main () { return foo (); }
-               ],
+       ]])],
        glib_cv_hasinline=yes
         ,
        glib_cv_hasinline=no
@@ -766,7 +772,7 @@ esac
 
 # if we can use inline functions in headers
 AC_MSG_CHECKING(if inline functions in headers work)
-AC_LINK_IFELSE([
+AC_LINK_IFELSE([AC_LANG_SOURCE([[
 #if defined (G_HAVE_INLINE) && defined (__GNUC__) && defined (__STRICT_ANSI__)
 #  undef inline
 #  define inline __inline__
@@ -789,7 +795,7 @@ glib_test_func1 (void) {
 int
 main (void) {
   int i = 1;
-}],[g_can_inline=yes],[g_can_inline=no])
+}]])],[g_can_inline=yes],[g_can_inline=no])
 AC_MSG_RESULT($g_can_inline)
 
 dnl *** check for working do while(0) macros ***
@@ -841,7 +847,7 @@ AC_MSG_RESULT($g_have_gnuc_varargs)
 
 # check for GNUC visibility support
 AC_MSG_CHECKING(for GNUC visibility attribute)
-GLIB_CHECK_COMPILE_WARNINGS([
+GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
 void
 __attribute__ ((visibility ("hidden")))
      f_hidden (void)
@@ -870,7 +876,7 @@ int main (int argc, char **argv)
        f_default();
        return 0;
 }
-],g_have_gnuc_visibility=yes,g_have_gnuc_visibility=no)
+]])],g_have_gnuc_visibility=yes,g_have_gnuc_visibility=no)
 AC_MSG_RESULT($g_have_gnuc_visibility)
 AM_CONDITIONAL(HAVE_GNUC_VISIBILITY, [test x$g_have_gnuc_visibility = xyes])
 
@@ -929,7 +935,6 @@ AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[#include <time.
 
 # Checks for libcharset
 AM_LANGINFO_CODESET
-gl_GLIBC21
 AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
 AC_CHECK_FUNCS(setlocale)
 
@@ -965,7 +970,7 @@ dnl on AIX with xlc)
 dnl
 if test $ac_cv_sizeof_size_t = $ac_cv_sizeof_int &&
    test $ac_cv_sizeof_size_t = $ac_cv_sizeof_long ; then
-  GLIB_CHECK_COMPILE_WARNINGS([
+  GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
 #if defined(_AIX) && !defined(__GNUC__)
 #pragma options langlvl=stdc89
 #endif
@@ -976,8 +981,8 @@ int main ()
   unsigned int *size_int = &s;
   return (int)*size_int;
 }
-    ],glib_size_type=int,
-      [GLIB_CHECK_COMPILE_WARNINGS([
+    ]])],glib_size_type=int,
+      [GLIB_CHECK_COMPILE_WARNINGS([AC_LANG_SOURCE([[
 #if defined(_AIX) && !defined(__GNUC__)
 #pragma options langlvl=stdc89
 #endif
@@ -988,18 +993,46 @@ int main ()
    unsigned long *size_long = &s;
    return (int)*size_long;
 }
-        ],glib_size_type=long)])
+        ]])],glib_size_type=long)])
 fi
 
 AC_MSG_RESULT(unsigned $glib_size_type)
 
 # Check for some functions
 AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk memmem)
-AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link statvfs statfs utimes getgrgid getpwuid)
+AC_CHECK_FUNCS(chown lchmod lchown fchmod fchown link utimes getgrgid getpwuid)
 AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getmntinfo)
 # Check for high-resolution sleep functions
 AC_CHECK_FUNCS(splice)
 
+# To avoid finding a compatibility unusable statfs, which typically
+# successfully compiles, but warns to use the newer statvfs interface:
+AS_IF([test $ac_cv_header_sys_statvfs_h = yes], [AC_CHECK_FUNCS([statvfs])])
+AS_IF([test $ac_cv_header_sys_statfs_h  = yes], [AC_CHECK_FUNCS([statfs])])
+
+AC_MSG_CHECKING([whether to use statfs or statvfs])
+# Some systems have both statfs and statvfs, pick the most "native" for these
+AS_IF([test x$ac_cv_func_statfs = xyes && test x$ac_cv_func_statvfs = yes],
+   [
+   # on solaris and irix, statfs doesn't even have the f_bavail field
+   AS_IF([test $ac_cv_member_struct_statfs_f_bavail = yes],
+      [ac_cv_func_statfs=no],
+   # else, at least on linux, statfs is the actual syscall
+      [ac_cv_func_statvfs=no])
+   ])
+
+AS_IF([test x$ac_cv_func_statfs = xyes],
+      [
+         AC_DEFINE([USE_STATFS], [1], [Define to use statfs()])
+         AC_MSG_RESULT([statfs])
+      ],
+      [test x$ac_cv_func_statvfs = xyes],
+      [
+         AC_DEFINE([USE_STATVFS], [1], [Define to use statvfs()])
+         AC_MSG_RESULT([statvfs])
+      ],
+      [  AC_MSG_RESULT([neither])])
+
 AC_CHECK_HEADERS(crt_externs.h)
 AC_CHECK_FUNCS(_NSGetEnviron)
 
@@ -1346,7 +1379,7 @@ dnl **********************
 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()],glib_cv_va_copy,[
-       AC_LINK_IFELSE([#include <stdarg.h>
+       AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <stdarg.h>
 #include <stdlib.h>
        void f (int i, ...) {
        va_list args1, args2;
@@ -1359,12 +1392,12 @@ AC_CACHE_CHECK([for an implementation of va_copy()],glib_cv_va_copy,[
        int main() {
          f (0, 42);
          return 0;
-       }],
+       }]])],
        [glib_cv_va_copy=yes],
        [glib_cv_va_copy=no])
 ])
 AC_CACHE_CHECK([for an implementation of __va_copy()],glib_cv___va_copy,[
-       AC_LINK_IFELSE([#include <stdarg.h>
+       AC_LINK_IFELSE([AC_LANG_SOURCE([[#include <stdarg.h>
 #include <stdlib.h>
        void f (int i, ...) {
        va_list args1, args2;
@@ -1377,7 +1410,7 @@ AC_CACHE_CHECK([for an implementation of __va_copy()],glib_cv___va_copy,[
        int main() {
          f (0, 42);
          return 0;
-       }],
+       }]])],
        [glib_cv___va_copy=yes],
        [glib_cv___va_copy=no])
 ])
@@ -1668,12 +1701,12 @@ dnl *********************************
 dnl ** Check for Solaris FEN (GIO) **
 dnl *********************************
 fen_support=no
-AC_COMPILE_IFELSE([ 
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
 #include <port.h> 
 #ifndef PORT_SOURCE_FILE 
 #error "Please upgrade to Nevada 72 or above to suppoert FEN" 
 #endif 
-int main() { return 0; } ],
+int main() { return 0; } ]])],
 [
        fen_support=yes
 ],)
@@ -1980,7 +2013,7 @@ if test x"$have_threads" != xno; then
           AC_TRY_RUN(glib_thread_test(0),
                      glib_flag_works=yes,
                      glib_flag_works=no,
-                     [AC_LINK_IFELSE(glib_thread_test(0),
+                     [AC_LINK_IFELSE([AC_LANG_SOURCE(glib_thread_test(0))],
                                      glib_flag_works=yes,
                                      glib_flag_works=no)])
           CFLAGS="$glib_save_CFLAGS"
@@ -2104,7 +2137,7 @@ case $have_threads in
                        AC_TRY_RUN(glib_thread_test($defattr),
                                    glib_result=yes,
                                    glib_result=no,
-                                   [AC_LINK_IFELSE(glib_thread_test($defattr),
+                                   [AC_LINK_IFELSE([AC_LANG_SOURCE(glib_thread_test($defattr))],
                                                    glib_result=yes,
                                                    glib_result=no)])
                         AC_MSG_RESULT($glib_result)
@@ -2137,7 +2170,7 @@ case $have_threads in
            AC_TRY_RUN(glib_sched_priority_test,
                        glib_result=yes,
                        glib_result=no,
-                       [AC_LINK_IFELSE(glib_sched_priority_test,
+                       [AC_LINK_IFELSE([AC_LANG_SOURCE(glib_sched_priority_test)],
                                        glib_result=yes,
                                        glib_result=no)])
            AC_MSG_RESULT($glib_result)
@@ -2466,9 +2499,6 @@ if test x"$GCC" = xyes; then
              [glib_cv_gcc_has_builtin_atomic_operations=no])
 
   AC_MSG_RESULT($glib_cv_gcc_has_builtin_atomic_operations)
-  if test $glib_cv_gcc_has_builtin_atomic_operations = yes; then
-    glib_memory_barrier_needed=yes
-  else
     case $host_cpu in
       i386)
         AC_MSG_RESULT([none])
@@ -2487,13 +2517,13 @@ if test x"$GCC" = xyes; then
                         operations much faster. The resulting code will not run
                         on very old sparcs though."
 
-        AC_LINK_IFELSE([[
+        AC_LINK_IFELSE([AC_LANG_SOURCE([[
           main ()
           {
             int tmp1, tmp2, tmp3;
             __asm__ __volatile__("casx [%2], %0, %1"
                                  : "=&r" (tmp1), "=&r" (tmp2) : "r" (&tmp3));
-          }]],
+          }]])],
           AC_MSG_RESULT([sparcv9])
           AC_DEFINE_UNQUOTED(G_ATOMIC_SPARCV9, 1,
                             [sparcv9 atomic implementation]),
@@ -2565,7 +2595,6 @@ if test x"$GCC" = xyes; then
         glib_memory_barrier_needed=yes
         ;;
     esac
-  fi
 else
   if test $glib_native_win32 = yes; then
     # For Windows but not using gcc. No barriers needed then either.
@@ -2579,28 +2608,39 @@ AM_CONDITIONAL(HAVE_GCC_BUILTINS_FOR_ATOMIC_OPERATIONS,
 dnl ************************
 dnl ** Check for futex(2) **
 dnl ************************
-AC_MSG_CHECKING([for futex(2) system call])
-AC_COMPILE_IFELSE([ 
+AC_CACHE_CHECK(for futex(2) system call,
+    glib_cv_futex,AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
 #include <linux/futex.h>
-#include <syscall.h>
+#include <sys/syscall.h>
 #include <unistd.h>
+],[
+int
+main (void)
+{
+  /* it is not like this actually runs or anything... */
+  syscall (__NR_futex, NULL, FUTEX_WAKE, FUTEX_WAIT);
+  return 0;
+}
+])],glib_cv_futex=yes,glib_cv_futex=no))
+if test x"$glib_cv_futex" = xyes; then
+  AC_DEFINE(HAVE_FUTEX, 1, [we have the futex(2) system call])
+fi
 
+AC_CACHE_CHECK(for eventfd(2) system call,
+    glib_cv_eventfd,AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+#include <sys/eventfd.h>
+#include <unistd.h>
+],[
 int
 main (void)
 {
-  /* it's not like this actually runs or anything... */
-  syscall (SYS_futex, NULL, FUTEX_WAKE, FUTEX_WAIT);
+  eventfd (0, EFD_CLOEXEC);
   return 0;
 }
-],
-[
-  AC_MSG_RESULT(yes)
-  AC_DEFINE(HAVE_FUTEX, [test "$have_futex" = "yes"],
-            [we have the futex(2) system call])
-],
-[
-  AC_MSG_RESULT(no)
-])
+])],glib_cv_eventfd=yes,glib_cv_eventfd=no))
+if test x"$glib_cv_eventfd" = x"yes"; then
+  AC_DEFINE(HAVE_EVENTFD, 1, [we have the eventfd(2) system call])
+fi
 
 dnl ****************************************
 dnl *** GLib POLL* compatibility defines ***
@@ -3254,7 +3294,10 @@ _______EOF
          echo >>$outfile
          echo "#define G_ATOMIC_OP_MEMORY_BARRIER_NEEDED 1" >>$outfile
        fi
-
+       if test x"$g_gcc_atomic_ops" != xno; then
+          echo >>$outfile
+          echo "#define G_ATOMIC_OP_USE_GCC_BUILTINS 1" >>$outfile
+        fi
        echo >>$outfile
        g_bit_sizes="16 32 64"
        for bits in $g_bit_sizes; do
@@ -3631,6 +3674,7 @@ g_system_thread_sizeof="$glib_cv_sizeof_system_thread"
 g_mutex_contents="$glib_cv_byte_contents_gmutex"
 
 g_memory_barrier_needed="$glib_memory_barrier_needed"
+g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations"
 
 g_module_suffix="$glib_gmodule_suffix"
 
@@ -3783,6 +3827,7 @@ gio/fen/Makefile
 gio/fam/Makefile
 gio/win32/Makefile
 gio/tests/Makefile
+gio/tests/gdbus-object-manager-example/Makefile
 po/Makefile.in
 docs/Makefile
 docs/reference/Makefile
@@ -3791,6 +3836,7 @@ docs/reference/glib/version.xml
 docs/reference/gobject/Makefile
 docs/reference/gobject/version.xml
 docs/reference/gio/Makefile
+docs/reference/gio/gdbus-object-manager-example/Makefile
 docs/reference/gio/version.xml
 tests/Makefile
 tests/gobject/Makefile