Added kdbus as a valid transport type in gdbusaddress.c file
[platform/upstream/glib.git] / configure.ac
index 3414aa9..e61fd9e 100644 (file)
@@ -30,9 +30,9 @@ m4_define(glib_configure_ac)
 # <mclasen> on the unstable (ie master), interface age = 0
 
 m4_define([glib_major_version], [2])
-m4_define([glib_minor_version], [35])
-m4_define([glib_micro_version], [3])
-m4_define([glib_interface_age], [0])
+m4_define([glib_minor_version], [36])
+m4_define([glib_micro_version], [4])
+m4_define([glib_interface_age], [4])
 m4_define([glib_binary_age],
           [m4_eval(100 * glib_minor_version + glib_micro_version)])
 m4_define([glib_version],
@@ -56,14 +56,14 @@ m4_define([glib_debug_default],
 AC_INIT(glib, [glib_version],
         [http://bugzilla.gnome.org/enter_bug.cgi?product=glib])
 
-AC_CONFIG_HEADER([config.h])
+AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_SRCDIR([glib/glib.h])
 AC_CONFIG_MACRO_DIR([m4macros])
 
 # Save this value here, since automake will set cflags later
 cflags_set=${CFLAGS+set}
 
-AM_INIT_AUTOMAKE([1.11 no-define no-dist-gzip dist-xz tar-ustar])
+AM_INIT_AUTOMAKE([1.11 -Wno-portability no-define no-dist-gzip dist-xz tar-ustar])
 AM_MAINTAINER_MODE([enable])
 
 # Support silent build rules. Disable
@@ -210,16 +210,6 @@ AS_IF([test "$glib_native_win32" = "yes"], [
 ])
 AM_CONDITIONAL(MS_LIB_AVAILABLE, [test x$ms_librarian = xyes])
 
-if test "$glib_native_win32" != yes; then
-    # libtool option to control which symbols are exported
-    # right now, symbols starting with _ are not exported
-    LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^g.*"'
-else
-    # We currently use .def files on Windows
-    LIBTOOL_EXPORT_OPTIONS=
-fi
-AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
-
 AS_IF([test "x$glib_have_carbon" = "xyes"], [
   AC_DEFINE(HAVE_CARBON, 1, [define to 1 if Carbon is available])
   LDFLAGS="$LDFLAGS -Wl,-framework,Carbon"
@@ -294,7 +284,6 @@ AC_TRY_COMPILE(,[class a { int b; } c;], ,CXX=)
 AM_CONDITIONAL(HAVE_CXX, [test "$CXX" != ""])
 AC_LANG_RESTORE
 
-AM_PROG_CC_STDC
 AM_PROG_CC_C_O
 AC_PROG_INSTALL
 
@@ -382,7 +371,16 @@ if test "x$PERL_PATH" = x ; then
 fi
 AC_SUBST(PERL_PATH)
 
-# Need suitable python path for greport
+# option to specify python interpreter to use; this just sets $PYTHON, so that
+# we will fallback to reading $PYTHON if --with-python is not given, and
+# python.m4 will get the expected input
+AC_ARG_WITH(python,
+            AS_HELP_STRING([--with-python=PATH],
+                           [Path to Python interpreter; searches $PATH if only a program name is given; if not given, searches for a few standard names such as "python3" or "python2"]),
+            [PYTHON="$withval"], [])
+if test x"$PYTHON" = xyes; then
+  AC_MSG_ERROR([--with-python option requires a path or program argument])
+fi
 AM_PATH_PYTHON(2.5,,PYTHON="/usr/bin/env python2.5")
 
 
@@ -901,6 +899,7 @@ AC_CHECK_HEADERS([sys/mount.h sys/sysctl.h], [], [],
  #include <sys/param.h>
  #endif
 ])
+AC_CHECK_FUNCS(sysctlbyname)
 
 AC_CHECK_HEADERS([xlocale.h])
 
@@ -993,7 +992,7 @@ 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 utimes getgrgid getpwuid getresuid)
-AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat)
+AC_CHECK_FUNCS(getmntent_r setmntent endmntent hasmntopt getfsstat getvfsstat fallocate)
 # Check for high-resolution sleep functions
 AC_CHECK_FUNCS(splice)
 AC_CHECK_FUNCS(prlimit)
@@ -1073,10 +1072,12 @@ AS_IF([test $glib_native_win32 = yes], [
   AC_SUBST(WSPIAPI_INCLUDE)
 ], [
   AC_MSG_CHECKING([if arpa/nameser_compat.h is needed])
-  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <arpa/nameser.h>],
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
+                                      #include <arpa/nameser.h>],
                                      [int qclass = C_IN;])],
                     [AC_MSG_RESULT([no])],
-                    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <arpa/nameser.h>
+                    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
+                                                         #include <arpa/nameser.h>
                                                          #include <arpa/nameser_compat.h>],
                                                         [int qclass = C_IN;])],
                                        [AC_MSG_RESULT([yes])
@@ -2372,7 +2373,7 @@ dnl
 dnl We can currently support the atomic ops natively when building GLib
 dnl with recent versions of GCC or MSVC.  MSVC doesn't run ./configure,
 dnl so we skip that case here and define G_ATOMIC_LOCK_FREE exactly when
-dnl we are using GCC.
+dnl we are using GCC (and not mingw*).
 dnl
 dnl Note that the atomic ops are only available with GCC on x86 when
 dnl using -march=i486 or higher.  If we detect that the atomic ops are
@@ -2384,20 +2385,44 @@ dnl the user had the wrong build environment.
 dnl We may add other compilers here in the future...
 
 AC_CACHE_CHECK([for lock-free atomic intrinsics], glib_cv_g_atomic_lock_free, [
-  AC_TRY_COMPILE([],
-                 [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;],
-                 [glib_cv_g_atomic_lock_free=yes],
-                 [glib_cv_g_atomic_lock_free=no])])
-
-if test "$glib_cv_g_atomic_lock_free" = "no"; then
-  SAVE_CFLAGS="${CFLAGS}"
-  CFLAGS="-march=i486"
-  AC_TRY_COMPILE([],
-                 [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;],
-                 [AC_MSG_ERROR([GLib must be build with -march=i486 or later.])],
-                 [])
-  CFLAGS="${SAVE_CFLAGS}"
-fi
+  case $host in
+    *-*-mingw*)
+      glib_cv_g_atomic_lock_free=yes
+      ;;
+    *)
+      AC_TRY_COMPILE([],
+                     [volatile int atomic = 2;\
+                      __sync_bool_compare_and_swap (&atomic, 2, 3);],
+                     [glib_cv_g_atomic_lock_free=yes],
+                     [glib_cv_g_atomic_lock_free=no])
+      if test "$glib_cv_g_atomic_lock_free" = "no"; then
+        SAVE_CFLAGS="${CFLAGS}"
+        CFLAGS="-march=i486"
+        AC_TRY_COMPILE([],
+                       [volatile int atomic = 2;\
+                        __sync_bool_compare_and_swap (&atomic, 2, 3);],
+                       [AC_MSG_ERROR([GLib must be build with -march=i486 or later.])],
+                       [])
+        CFLAGS="${SAVE_CFLAGS}"
+      fi
+      ;;
+  esac])
+
+
+case $host in
+  *-*-mingw*)
+    ;;
+  *)
+    # Some compilers support atomic operations but do not define
+    # __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, like clang
+    if test x"$glib_cv_g_atomic_lock_free" = xyes; then
+      AC_TRY_COMPILE([],
+                     [__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4;],
+                     [],
+                     [AC_DEFINE(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4, 1, [ compiler supports atomic operations])])
+    fi
+    ;;
+ esac
 
 dnl We need a more robust approach here...
 case $host_cpu in
@@ -3556,14 +3581,53 @@ fi
 
 AC_SUBST(GLIB_LINK_FLAGS)
 
+dnl
+dnl Check for -fvisibility=hidden to determine if we can do GNU-style
+dnl visibility attributes for symbol export control
+dnl
+GLIB_HIDDEN_VISIBILITY_CFLAGS=""
+case "$host" in
+  *-*-mingw*)
+    dnl on mingw32 we do -fvisibility=hidden and __declspec(dllexport)
+    AC_DEFINE([_GLIB_EXTERN], [__attribute__((visibility("default"))) __declspec(dllexport) extern],
+              [defines how to decorate public symbols while building])
+    CFLAGS="${CFLAGS} -fvisibility=hidden"
+    ;;
+  *)
+    dnl on other compilers, check if we can do -fvisibility=hidden
+    SAVED_CFLAGS="${CFLAGS}"
+    CFLAGS="-fvisibility=hidden"
+    AC_MSG_CHECKING([for -fvisibility=hidden compiler flag])
+    AC_TRY_COMPILE([], [int main (void) { return 0; }],
+                   AC_MSG_RESULT(yes)
+                   enable_fvisibility_hidden=yes,
+                   AC_MSG_RESULT(no)
+                   enable_fvisibility_hidden=no)
+    CFLAGS="${SAVED_CFLAGS}"
+
+    AS_IF([test "${enable_fvisibility_hidden}" = "yes"], [
+      AC_DEFINE([_GLIB_EXTERN], [__attribute__((visibility("default"))) extern],
+                [defines how to decorate public symbols while building])
+      GLIB_HIDDEN_VISIBILITY_CFLAGS="-fvisibility=hidden"
+    ])
+    ;;
+esac
+AC_SUBST(GLIB_HIDDEN_VISIBILITY_CFLAGS)
+
 dnl Compiler flags; macro originates from systemd
 dnl See https://bugzilla.gnome.org/show_bug.cgi?id=608953
-CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
+AC_ARG_ENABLE(compile-warnings,
+              [AS_HELP_STRING([--disable-compile-warnings],
+                              [Don't use builtin compiler warnings])],,
+                             enable_compile_warnings=yes)
+AS_IF([test "x$enable_compile_warnings" = xyes], [
+  CC_CHECK_FLAGS_APPEND([GLIB_WARN_CFLAGS], [CFLAGS], [\
    -Wall -Wstrict-prototypes -Werror=declaration-after-statement \
    -Werror=missing-prototypes -Werror=implicit-function-declaration \
    -Werror=pointer-arith -Werror=init-self -Werror=format-security \
    -Werror=format=2 -Werror=missing-include-dirs])
-CFLAGS="$CFLAGS $with_cflags"
+])
+AC_SUBST(GLIB_WARN_CFLAGS)
 
 #
 # Define variables corresponding to the correct include paths to use for
@@ -3644,6 +3708,8 @@ gio/fam/Makefile
 gio/win32/Makefile
 gio/tests/Makefile
 gio/tests/gdbus-object-manager-example/Makefile
+gio/tests/services/Makefile
+gio/tests/services/org.gtk.GDBus.Examples.ObjectManager.service
 po/Makefile.in
 docs/Makefile
 docs/reference/Makefile