Use -Bsymbolic-functions, drop g*alias PLT hackery
[platform/upstream/glib.git] / configure.in
index 8221911..6b83c97 100644 (file)
@@ -22,8 +22,8 @@ m4_define(glib_configure_in)
 # set glib_binary_age _and_ glib_interface_age to 0.
 #
 m4_define([glib_major_version], [2])
-m4_define([glib_minor_version], [23])
-m4_define([glib_micro_version], [2])
+m4_define([glib_minor_version], [25])
+m4_define([glib_micro_version], [10])
 m4_define([glib_interface_age], [0])
 m4_define([glib_binary_age],
           [m4_eval(100 * glib_minor_version + glib_micro_version)])
@@ -875,7 +875,7 @@ fi
 # check for header files
 AC_CHECK_HEADERS([dirent.h float.h limits.h pwd.h grp.h sys/param.h sys/poll.h sys/resource.h])
 AC_CHECK_HEADERS([sys/time.h sys/times.h sys/wait.h unistd.h values.h])
-AC_CHECK_HEADERS([sys/select.h sys/types.h stdint.h sched.h malloc.h])
+AC_CHECK_HEADERS([sys/select.h sys/types.h stdint.h inttypes.h sched.h malloc.h])
 AC_CHECK_HEADERS([sys/vfs.h sys/mount.h sys/vmount.h sys/statfs.h sys/statvfs.h])
 AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h sys/sysctl.h fstab.h])
 AC_CHECK_HEADERS([sys/uio.h])
@@ -964,11 +964,12 @@ 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)
+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(getmntent_r setmntent endmntent hasmntopt getmntinfo)
 # Check for high-resolution sleep functions
 AC_CHECK_FUNCS(nanosleep nsleep)
+AC_CHECK_FUNCS(splice)
 
 AC_CHECK_HEADERS(crt_externs.h)
 AC_CHECK_FUNCS(_NSGetEnviron)
@@ -1012,23 +1013,31 @@ AC_CHECK_HEADERS([netdb.h wspiapi.h])
 if test $glib_native_win32 = no; then
   AC_CHECK_FUNCS(strndup setresuid setreuid)
   AC_CHECK_HEADERS(sys/prctl.h arpa/nameser_compat.h)
-  AC_CHECK_FUNC(res_query, ,
-    [AC_CHECK_LIB(resolv, res_query, [ LIBASYNCNS_LIBADD="-lresolv" ],
-      [ save_libs="$LIBS"
-        LIBS="-lresolv $LIBS"
-        AC_MSG_CHECKING([for res_query in -lresolv (alternate version)])
-        AC_LINK_IFELSE(
-          [AC_LANG_PROGRAM([[#include <resolv.h>]], [[res_query(0,0,0,0,0)]])],
-          [ AC_MSG_RESULT(yes)
-         LIBASYNCNS_LIBADD="-lresolv" ],
-          [ AC_MSG_RESULT(no)
-            AC_CHECK_LIB(bind, res_query,
-              [ LIBASYNCNS_LIBADD="-lbind" ],
-           [ AC_MSG_ERROR(res_query not found) ] ) ] )
-        LIBS="$save_libs"
-      ] )
-    ]
-  )
+
+  # We can't just use AC_CHECK_FUNC/AC_CHECK_LIB here. Bug 586150
+  AC_MSG_CHECKING([for res_query])
+  AC_TRY_LINK([#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>],
+              [res_query("test", 0, 0, (void *)0, 0);],
+              [AC_MSG_RESULT([yes])],
+              [save_libs="$LIBS"
+               LIBS="-lresolv $LIBS"
+               AC_TRY_LINK([#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>],
+                           [res_query("test", 0, 0, (void *)0, 0);],
+                           [AC_MSG_RESULT([in -lresolv])
+                            LIBASYNCNS_LIBADD="-lresolv"],
+                           [LIBS="-lbind $save_libs"
+                            AC_TRY_LINK([#include <resolv.h>],
+                                        [res_query("test", 0, 0, (void *)0, 0);],
+                                        [AC_MSG_RESULT([in -lbind])
+                                         LIBASYNCNS_LIBADD="-lbind"],
+                                        [AC_MSG_ERROR(not found)])])
+               LIBS="$save_libs"])
   AC_SUBST(LIBASYNCNS_LIBADD)
 fi
 
@@ -2349,6 +2358,7 @@ case $host in
     ;;
 esac
 
+AM_CONDITIONAL(HAVE_THREADS, [test "$have_threads" != "none"])
 AC_DEFINE_UNQUOTED(G_THREAD_SOURCE,"gthread-$have_threads.c",
                   [Source file containing theread implementation])
 AC_SUBST(G_THREAD_CFLAGS)
@@ -2535,6 +2545,32 @@ fi
 AM_CONDITIONAL(HAVE_GCC_BUILTINS_FOR_ATOMIC_OPERATIONS,
               [test $glib_cv_gcc_has_builtin_atomic_operations = yes])
 
+dnl ************************
+dnl ** Check for futex(2) **
+dnl ************************
+AC_MSG_CHECKING([for futex(2) system call])
+AC_COMPILE_IFELSE([ 
+#include <linux/futex.h>
+#include <syscall.h>
+#include <unistd.h>
+
+int
+main (void)
+{
+  /* it's not like this actually runs or anything... */
+  syscall (SYS_futex, NULL, FUTEX_WAKE, FUTEX_WAIT);
+  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)
+])
+
 dnl ****************************************
 dnl *** GLib POLL* compatibility defines ***
 dnl ****************************************
@@ -2695,22 +2731,9 @@ int error = EILSEQ;
 ], have_eilseq=yes, have_eilseq=no);
 AC_MSG_RESULT($have_eilseq)
 
-dnl **********************************************************************
-dnl *** Check whether glibc has global variable for assertion messages ***
-dnl **********************************************************************
-
-AC_MSG_CHECKING(if libc has __abort_msg)
-AC_LINK_IFELSE([
-extern char *__abort_msg;
-int main() { return __abort_msg == (char*) 0; }
-], [libc_has_abort_msg=yes], [libc_has_abort_msg=no])
-AC_MSG_RESULT($libc_has_abort_msg)
-if test "$libc_has_abort_msg" = "yes"; then
-    AC_DEFINE(HAVE_LIBC_ABORT_MSG,1,[Whether libc defines __abort_msg])
-fi
-
 dnl ******************************************************************
-dnl *** Look for glib-genmarshal in PATH if we are cross-compiling ***
+dnl *** If we are cross-compiling, look for glib-genmarshal and    ***
+dnl *** glib-compile-schemas in PATH                               ***
 dnl ******************************************************************
 
 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
@@ -2720,6 +2743,11 @@ if test $cross_compiling = yes; then
   if test x$GLIB_GENMARSHAL = xno; then
     AC_MSG_ERROR(Could not find a glib-genmarshal in your PATH)
   fi
+
+  AC_PATH_PROG(GLIB_COMPILE_SCHEMAS, glib-compile-schemas, no)
+  if test x$GLIB_COMPILE_SCHEMAS = xno; then
+    AC_MSG_ERROR(Could not find a glib-compile-schemas in your PATH)
+  fi
 fi
 
 dnl **************************
@@ -2751,6 +2779,127 @@ fi
 
 AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
 
+dnl
+dnl Tracing
+dnl
+
+AC_ARG_ENABLE([dtrace],
+             [AS_HELP_STRING([--enable-dtrace],
+                              [Enable inclusion of dtrace trace support])])
+have_dtrace=no
+AC_MSG_CHECKING([whether to include dtrace tracing support])
+if test "x$enable_dtrace" != xno; then
+  AC_MSG_RESULT([yes])
+  AC_CHECK_PROGS(DTRACE, dtrace)
+  if test -z "$DTRACE"; then
+    if test "x$enable_dtrace" = xyes; then
+      AC_MSG_ERROR([dtrace not found])
+    fi
+  fi
+  AC_CHECK_HEADER([sys/sdt.h],have_dtrace=yes,
+                  [if test "x$enable_dtrace" = xyes; then
+                     AC_MSG_ERROR([dtrace support needs sys/sdt.h header])
+                   fi])
+else
+  AC_MSG_RESULT([no])
+fi
+if test "x$have_dtrace" = xyes; then
+  AC_DEFINE([HAVE_DTRACE], [1], [Define to 1 if using dtrace probes.])
+fi
+AM_CONDITIONAL([ENABLE_DTRACE], [test x$have_dtrace = xyes ])
+
+AC_MSG_CHECKING([whether to include systemtap tracing support])
+AC_ARG_ENABLE([systemtap],
+             [AS_HELP_STRING([--enable-systemtap],
+                              [Enable inclusion of systemtap trace support])])
+have_systemtap=no
+if test "x$enable_systemtap" != xno -a "x$have_dtrace" = xyes; then
+  have_systemtap=yes
+fi
+AC_MSG_RESULT(${have_systemtap})
+
+AM_CONDITIONAL([ENABLE_SYSTEMTAP], [test x$have_systemtap = xyes])
+
+AC_ARG_WITH([tapset-install-dir],
+            [AS_HELP_STRING([--with-tapset-install-dir],
+            [The absolute path where the systemtap tapsets will be installed])],
+            [if test "x${withval}" = x; then
+              ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"
+            else
+              ABS_TAPSET_DIR="${withval}"
+             fi],
+           [ABS_TAPSET_DIR="\$(datadir)/systemtap/tapset"])
+AC_SUBST(ABS_TAPSET_DIR)
+
+dnl ************************************
+dnl *** Enable lcov coverage reports ***
+dnl ************************************
+
+AC_ARG_ENABLE(gcov,
+  AS_HELP_STRING([--enable-gcov],
+                [Enable gcov]),
+  [use_gcov=$enableval], [use_gcov=no])
+
+if test "x$use_gcov" = "xyes"; then
+  dnl we need gcc:
+  if test "$GCC" != "yes"; then
+    AC_MSG_ERROR([GCC is required for --enable-gcov])
+  fi
+
+  dnl Check if ccache is being used
+  AC_CHECK_PROG(SHTOOL, shtool, shtool)
+  case `$SHTOOL path $CC` in
+    *ccache*[)] gcc_ccache=yes;;
+    *[)] gcc_ccache=no;;
+  esac
+
+  if test "$gcc_ccache" = "yes" && (test -z "$CCACHE_DISABLE" || test "$CCACHE_DISABLE" != "1"); then
+    AC_MSG_ERROR([ccache must be disabled when --enable-gcov option is used. You can disable ccache by setting environment variable CCACHE_DISABLE=1.])
+  fi
+
+  ltp_version_list="1.6 1.7 1.8"
+  AC_CHECK_PROG(LTP, lcov, lcov)
+  AC_CHECK_PROG(LTP_GENHTML, genhtml, genhtml)
+
+  if test "$LTP"; then
+    AC_CACHE_CHECK([for ltp version], glib_cv_ltp_version, [
+      glib_cv_ltp_version=invalid
+      ltp_version=`$LTP -v 2>/dev/null | $SED -e 's/^.* //'`
+      for ltp_check_version in $ltp_version_list; do
+        if test "$ltp_version" = "$ltp_check_version"; then
+          glib_cv_ltp_version="$ltp_check_version (ok)"
+        fi
+      done
+    ])
+  else
+    ltp_msg="To enable code coverage reporting you must have one of the following LTP versions installed: $ltp_version_list"
+    AC_MSG_ERROR([$ltp_msg])
+  fi
+
+  case $glib_cv_ltp_version in
+    ""|invalid[)]
+      ltp_msg="You must have one of the following versions of LTP: $ltp_version_list (found: $ltp_version)."
+      AC_MSG_ERROR([$ltp_msg])
+      LTP="exit 0;"
+      ;;
+  esac
+
+  if test -z "$LTP_GENHTML"; then
+    AC_MSG_ERROR([Could not find genhtml from the LTP package])
+  fi
+
+  AC_DEFINE(HAVE_GCOV, 1, [Whether you have gcov])
+
+  dnl Remove all optimization flags from CFLAGS
+  changequote({,})
+  CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9]*//g'`
+  changequote([,])
+
+  dnl Add the special gcc flags
+  CFLAGS="$CFLAGS -O0 -fprofile-arcs -ftest-coverage"
+  LDFLAGS="$LDFLAGS -lgcov"
+fi
+
 dnl ******************************
 dnl *** output the whole stuff ***
 dnl ******************************
@@ -3474,6 +3623,32 @@ if test x$glib_win32_static_compilation = xyes; then
 fi
 ])
 
+# 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)
+AM_CONDITIONAL(HAVE_DBUS1, [test "x$have_dbus1" = "xyes"])
+
+dnl
+dnl Check for -Bsymbolic-functions linker flag used to avoid
+dnl intra-library PLT jumps, if available.
+dnl
+SAVED_LDFLAGS="${LDFLAGS}"
+AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
+LDFLAGS=-Wl,-Bsymbolic-functions
+AC_TRY_LINK([], [int main (void) { return 0; }],
+            GLIB_LINK_FLAGS=-Wl[,]-Bsymbolic-functions
+            AC_MSG_RESULT(yes),
+            GLIB_LINK_FLAGS=
+            AC_MSG_RESULT(no))
+AC_SUBST(GLIB_LINK_FLAGS)
+LDFLAGS="${SAVED_LDFLAGS}"
+
 AC_CONFIG_FILES([
 glib-2.0.pc
 glib-2.0-uninstalled.pc
@@ -3488,6 +3663,7 @@ gobject-2.0.pc
 gobject-2.0-uninstalled.pc
 gio-2.0.pc
 gio-unix-2.0.pc
+gio-windows-2.0.pc
 gio-2.0-uninstalled.pc
 gio-unix-2.0-uninstalled.pc
 glib-zip
@@ -3496,9 +3672,9 @@ Makefile
 build/Makefile
 build/win32/Makefile
 build/win32/dirent/Makefile
-build/win32/vs8/Makefile
 build/win32/vs9/Makefile
 glib/Makefile
+glib/glib.stp
 glib/libcharset/Makefile
 glib/gnulib/Makefile
 glib/pcre/Makefile
@@ -3507,9 +3683,11 @@ glib/tests/Makefile
 gmodule/Makefile
 gmodule/gmoduleconf.h
 gobject/Makefile
+gobject/gobject.stp
 gobject/glib-mkenums
 gobject/tests/Makefile
 gthread/Makefile
+gthread/tests/Makefile
 gio/Makefile
 gio/xdgmime/Makefile
 gio/inotify/Makefile
@@ -3555,6 +3733,7 @@ if false; then
     gobject/gobject.rc
     gthread/makefile.msc
     gthread/gthread.rc
+    gio/gio.rc
     tests/makefile.msc
   ])
 fi