build: Add --disable-modular-tests build option
[platform/upstream/glib.git] / configure.ac
index f5197ec..c93fcec 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], [31])
-m4_define([glib_micro_version], [21])
-m4_define([glib_interface_age], [0])
+m4_define([glib_minor_version], [32])
+m4_define([glib_micro_version], [2])
+m4_define([glib_interface_age], [2])
 m4_define([glib_binary_age],
           [m4_eval(100 * glib_minor_version + glib_micro_version)])
 m4_define([glib_version],
@@ -175,11 +175,20 @@ AC_TRY_CPP([
 
 AC_MSG_RESULT([$glib_have_carbon])
 
+glib_have_cocoa=no
+AC_MSG_CHECKING([for Mac OS X Cocoa support])
+AC_TRY_CPP([
+#include <Foundation/Foundation.h>
+], glib_have_cocoa=yes)
+
+AC_MSG_RESULT([$glib_have_cocoa])
+
 AM_CONDITIONAL(OS_WIN32, [test "$glib_native_win32" = "yes"])
 AM_CONDITIONAL(OS_WIN32_X64, [test "$LIB_EXE_MACHINE_FLAG" = "X64"])
 AM_CONDITIONAL(OS_UNIX, [test "$glib_native_win32" != "yes"])
 AM_CONDITIONAL(OS_LINUX, [test "$glib_os_linux" = "yes"])
 AM_CONDITIONAL(OS_CARBON, [test "$glib_have_carbon" = "yes"])
+AM_CONDITIONAL(OS_COCOA, [test "$glib_have_cocoa" = "yes"])
 
 if test "$glib_native_win32" = "yes"; then
   AC_CHECK_TOOL(WINDRES, windres, no)
@@ -210,6 +219,11 @@ if test "x$glib_have_carbon" = "xyes"; then
   LDFLAGS="$LDFLAGS -framework Carbon"
 fi
 
+if test "x$glib_have_cocoa" = "xyes"; then
+  AC_DEFINE(HAVE_COCOA, 1, [define to 1 if Cocoa is available])
+  LDFLAGS="$LDFLAGS -framework Foundation"
+fi
+
 gl_GLIBC21
 if test "x$GLIBC21" = "xyes"; then
   AC_DEFINE([_GNU_SOURCE], 1, [Make all glibc extensions visible])
@@ -233,6 +247,11 @@ AC_ARG_ENABLE(rebuilds,
               [AC_HELP_STRING([--disable-rebuilds],
                               [disable all source autogeneration rules])],,
               [enable_rebuilds=yes])
+AC_ARG_ENABLE(modular_tests,
+              AC_HELP_STRING([--disable-modular-tests],
+                             [Disable build of test programs (default: no)]),,
+              [enable_modular_tests=yes])
+AM_CONDITIONAL(BUILD_MODULAR_TESTS, test x$enable_modular_tests = xyes)
 
 AC_MSG_CHECKING([whether to enable garbage collector friendliness])
 if test "x$enable_gc_friendly" = "xyes"; then
@@ -1799,12 +1818,23 @@ dnl ************************
 dnl *** check for libelf ***
 dnl ************************
 
-AC_CHECK_LIB([elf], [elf_begin], have_libelf=yes, have_libelf=no)
+PKG_CHECK_MODULES([LIBELF], [libelf], [have_libelf=yes], [have_libelf=maybe])
+
+if test $have_libelf = maybe; then
+  AC_CHECK_LIB([elf], [elf_begin], , [have_libelf=no])
+  AC_CHECK_LIB([elf], [elf_getshdrstrndx], , [have_libelf=no])
+  AC_CHECK_LIB([elf], [elf_getshdrnum], , [have_libelf=no])
+  AC_CHECK_HEADER([libelf.h], , [have_libelf=no])
+
+  if test $have_libelf != no; then
+    LIBELF_LIBS=-lelf
+    have_libelf = yes
+  fi
+fi
+
 if test $have_libelf = yes; then
   AC_DEFINE(HAVE_LIBELF, 1, [Define if libelf is available])
-  ELF_LIBS=-lelf
 fi
-AC_SUBST(ELF_LIBS)
 
 dnl ****************************************
 dnl *** platform dependent source checks ***
@@ -3333,7 +3363,17 @@ g_pollhup=$glib_cv_value_POLLHUP
 g_pollerr=$glib_cv_value_POLLERR
 g_pollnval=$glib_cv_value_POLLNVAL
 
-g_af_unix=$glib_cv_value_AF_UNIX
+# If a family is not found on the system, define that family to
+# a negative value, picking a different one for each undefined
+# family (-1 for AF_UNIX, -2 for the next one, -3 ...)
+# This is needed because glib-mkenums doesn't handle optional
+# values in enums, and thus we have to have all existing values
+# defined in the enum.
+if test "x$glib_cv_value_AF_UNIX" != "x"; then
+  g_af_unix=$glib_cv_value_AF_UNIX
+else
+  g_af_unix=-1
+fi
 g_af_inet=$glib_cv_value_AF_INET
 g_af_inet6=$glib_cv_value_AF_INET6
 
@@ -3405,19 +3445,23 @@ $ac_cv_sizeof___int64)
   ;;
 esac
 
-AC_CHECK_ALIGNOF([guint32], [typedef unsigned $gint32 guint32;])
-AC_CHECK_ALIGNOF([guint64], typedef unsigned $gint64 guint64;)
+AC_CHECK_ALIGNOF([guint32], [AC_INCLUDES_DEFAULT
+typedef unsigned $gint32 guint32;])
+AC_CHECK_ALIGNOF([guint64], [AC_INCLUDES_DEFAULT
+typedef unsigned $gint64 guint64;])
 AC_CHECK_ALIGNOF([unsigned long])
 
 # Check for libdbus1 - Optional - is only used in the GDBus test cases
 #
 # 1.2.14 required for dbus_message_set_serial
-PKG_CHECK_MODULES(DBUS1,
-                  dbus-1 >= 1.2.14,
-                  [AC_DEFINE(HAVE_DBUS1, 1, [Define if dbus-1 is available]) have_dbus1=yes],
-                  have_dbus1=no)
-AC_SUBST(DBUS1_CFLAGS)
-AC_SUBST(DBUS1_LIBS)
+if test x$enable_modular_tests = xyes; then
+   PKG_CHECK_MODULES(DBUS1,
+                     dbus-1 >= 1.2.14,
+                     [AC_DEFINE(HAVE_DBUS1, 1, [Define if dbus-1 is available]) have_dbus1=yes],
+                     have_dbus1=no)
+   AC_SUBST(DBUS1_CFLAGS)
+   AC_SUBST(DBUS1_LIBS)
+fi
 AM_CONDITIONAL(HAVE_DBUS1, [test "x$have_dbus1" = "xyes"])
 
 dnl