Call g_thread_impl_init(), as g_thread_init won't call it.
[platform/upstream/glib.git] / configure.in
index a08670c..b0144aa 100644 (file)
@@ -15,10 +15,10 @@ cflags_set=${CFLAGS+set}
 # we rewrite this file
 rm -f glibconfig-sysdefs.h
 
-GLIB_DIVERT_BEFORE_HELP([
+GLIB_AC_DIVERT_BEFORE_HELP([
 #
-# The following version number definitions apply to GLib, GModule, GObject and GThread
-# as a whole, so if changes occoured in any of them, they are all
+# The following version number definitions apply to GLib, GModule, GObject 
+# and GThread as a whole, so if changes occoured in any of them, they are all
 # treated with the same interface and binary age.
 #
 # Making releases:
@@ -91,47 +91,31 @@ AC_MSG_RESULT([$glib_native_beos])
 
 dnl
 
-GLIB_DIVERT_BEFORE_HELP([
+GLIB_AC_DIVERT_BEFORE_HELP([
 # figure debugging default, prior to $ac_help setup
-if test `expr $GLIB_MINOR_VERSION \% 2` = 1 ; then
-  debug_default=yes
-else
-  debug_default=minimum
-fi[]dnl
+case $GLIB_MINOR_VERSION in
+*[[13579]]) debug_default=yes ;;
+*)          debug_default=minimum ;;
+esac[]dnl
 ])
 
 dnl declare --enable-* args and collect ac_help strings
 AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
 AC_ARG_ENABLE(msg-prefix, [  --enable-msg-prefix     turn on program name and PID prefixing of messages and warnings],,enable_msg_prefix=no)
-AC_ARG_ENABLE(mem_check, [  --enable-mem-check      turn on malloc/free sanity checking [default=no]],,enable_mem_check=no)
-AC_ARG_ENABLE(mem_profile, [  --enable-mem-profile    turn on malloc profiling atexit [default=no]],,enable_mem_profile=no)
 AC_ARG_ENABLE(gc_friendly, [  --enable-gc-friendly    turn on garbage collector friendliness [default=no]],,enable_gc_friendly=no)
+AC_ARG_ENABLE(mem_pools, [  --disable-mem-pools     disable all glib memory pools],,disable_mem_pools=no)
 AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
                    , enable_ansi=no)
 AC_ARG_ENABLE(threads, [  --enable-threads        turn on basic thread support [default=yes]
                           ([=no] will override --with-threads)],,enable_threads=yes)
+AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)
 
 if test "x$enable_threads" != "xyes"; then
   enable_threads=no
 fi
 
-AC_MSG_CHECKING(whether to enable memory checking)
-if test "x$enable_mem_check" = "xyes"; then
-  AC_DEFINE(ENABLE_MEM_CHECK, 1, [Whether to enable memory checking])
-  AC_SUBST(ENABLE_MEM_CHECK)
-  AC_MSG_RESULT(yes)
-else
-  AC_MSG_RESULT(no)
-fi
-
-AC_MSG_CHECKING(whether to enable memory profiling)
-if test "x$enable_mem_profile" = "xyes"; then
-  AC_DEFINE(ENABLE_MEM_PROFILE, 1, [Whether to enable memory profiling])
-  AC_SUBST(ENABLE_MEM_PROFILE)
-  AC_MSG_RESULT(yes)
-else
-  AC_MSG_RESULT(no)
-fi
+AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}",
+       [Whether glib was compiled with debugging enabled])
 
 AC_MSG_CHECKING(whether to enable garbage collector friendliness)
 if test "x$enable_gc_friendly" = "xyes"; then
@@ -142,28 +126,75 @@ else
   AC_MSG_RESULT(no)
 fi
 
-if test "x$enable_debug" = "xyes"; then
-  test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
-  GLIB_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
+AC_MSG_CHECKING(whether to disable memory pools)
+if test "x$disable_mem_pools" = "xno"; then
+  AC_MSG_RESULT(no)
 else
-  if test "x$enable_debug" = "xno"; then
-    GLIB_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
-  fi
+  AC_DEFINE(DISABLE_MEM_POOLS, 1, [Whether to disable memory pools])
+  AC_SUBST(DISABLE_MEM_POOLS)
+  AC_MSG_RESULT(yes)
 fi
 
-AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, "${enable_debug}",
-       [Whether glib was compiled with debugging enabled])
-
 if test "x$enable_msg_prefix" = "xyes"; then
   AC_DEFINE_UNQUOTED(G_ENABLE_MSG_PREFIX, 1, 
                     [Enable prefixing of error messages with program names])
 fi
 
-# Checks for programs.
+dnl Checks for programs.
 AC_PROG_CC
+
 AM_PROG_CC_STDC
 AC_PROG_INSTALL
 
+if test "x$enable_debug" = "xyes"; then
+  if test x$cflags_set != xset ; then
+      case " $CFLAGS " in
+      *[[\ \   ]]-g[[\ \       ]]*) ;;
+      *) CFLAGS="$CFLAGS -g" ;;
+      esac
+  fi
+       
+  GLIB_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
+else
+  if test "x$enable_debug" = "xno"; then
+    GLIB_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
+  fi
+fi
+
+# define a MAINT-like variable REBUILD which is set if Perl
+# and awk are found, so autogenerated sources can be rebuilt
+AC_PROG_AWK
+AC_CHECK_PROGS(PERL, perl5 perl)
+# We would like indent, but don't require it.
+AC_CHECK_PROG(INDENT, indent, indent)
+REBUILD=\#
+if test "x$enable_rebuilds" = "xyes" && \
+     test -n "$PERL" && \
+     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
+     test -n "$AWK" ; then
+  REBUILD=
+fi
+AC_SUBST(REBUILD)
+
+
+dnl
+dnl gettext support
+dnl
+
+ALL_LINGUAS="no uk"
+AM_GLIB_GNU_GETTEXT
+LIBS="$LIBS $INTLLIBS"
+
+GETTEXT_PACKAGE=glib20
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
+
+# AM_GLIB_GNU_GETTEXT above substs $DATADIRNAME
+# this is the directory where the *.{mo,gmo} files are installed
+GLIB_LOCALE_DIR="${prefix}/${DATADIRNAME}/locale"
+AC_DEFINE_UNQUOTED(GLIB_LOCALE_DIR,"$GLIB_LOCALE_DIR")
+
+
 dnl Initialize libtool
 AM_PROG_LIBTOOL
 
@@ -264,6 +295,33 @@ dnl long doubles were not used, and a portability problem
 dnl AC_C_LONG_DOUBLE
 AC_C_CONST
 
+dnl ok, here we try to check whether the systems prototypes for
+dnl malloc and friends actually match the prototypes provided
+dnl by gmem.h (keep in sync). i currently only know how to check
+dnl this reliably with gcc (-Werror), improvements for other
+dnl compilers are apprechiated.
+SANE_MALLOC_PROTOS=no
+AC_MSG_CHECKING([if malloc() and friends prototypes are gmem.h compatible])
+glib_save_CFLAGS=$CFLAGS
+if test "x$GCC" = "xyes"; then
+  CFLAGS="$CFLAGS -Werror"
+  AC_TRY_COMPILE([#include <stdlib.h>], [
+    void* (*my_calloc_p)  (size_t, size_t) = calloc;
+    void* (*my_malloc_p)  (size_t)         = malloc;
+    void  (*my_free_p)    (void*)          = free;
+    void* (*my_realloc_p) (void*, size_t)  = realloc;
+    my_calloc_p = 0;
+    my_malloc_p = 0;
+    my_free_p = 0;
+    my_realloc_p = 0;
+  ],
+    AC_DEFINE(SANE_MALLOC_PROTOS)
+    SANE_MALLOC_PROTOS=yes)
+fi
+AC_MSG_RESULT($SANE_MALLOC_PROTOS)
+CFLAGS=$glib_save_CFLAGS
+
+
 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.
@@ -418,7 +476,7 @@ AC_TRY_COMPILE([#include <sys/types.h>],
 if test $gtk_ok = yes; then
     AC_MSG_RESULT([yes, found in sys/types.h])
 else
-    AC_HEADER_EGREP(fd_set, sys/select.h, gtk_ok=yes)
+    AC_EGREP_HEADER(fd_set, sys/select.h, gtk_ok=yes)
     if test $gtk_ok = yes; then
        # *** FIXME: give it a different name
         AC_DEFINE(HAVE_SYS_SELECT_H,1,[found fd_set in sys/select.h])
@@ -654,6 +712,21 @@ dnl *** done, have e got an implementation?
 if test -z "$G_MODULE_IMPL"; then
        G_MODULE_IMPL=0
 fi
+
+AC_MSG_CHECKING(for the suffix of shared libraries)
+case "$host_os" in
+  hpux9* | hpux10* | hpux11*)  # taken from ltconfig
+    glib_gmodule_suffix='sl'
+    ;;
+  cygwin* | mingw*)
+    glib_gmodule_suffix='dll'
+    ;;
+  *)
+    glib_gmodule_suffix='so'    
+    ;;
+esac
+AC_MSG_RESULT(.$glib_gmodule_suffix)
 AC_SUBST(G_MODULE_IMPL)
 AC_SUBST(G_MODULE_LIBS)
 AC_SUBST(G_MODULE_LIBS_EXTRA)
@@ -990,9 +1063,8 @@ if test x"$have_threads" != xnone; then
        if test x"$have_threads" = xposix; then
                glib_save_CPPFLAGS="$CPPFLAGS"
                CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES"
-               GLIB_SIZEOF([#include <pthread.h>],
-                       pthread_t,
-                       system_thread)
+               dnl we might grow sizeof(pthread_t) later on, so use a dummy name here
+               GLIB_SIZEOF([#include <pthread.h>], pthread_t, core_system_thread)
                # This is not AC_CHECK_FUNC to also work with function
                # name mangling in header files.
                AC_MSG_CHECKING(for pthread_attr_setstacksize)
@@ -1046,6 +1118,7 @@ if test x"$have_threads" != xnone; then
                CPPFLAGS="$glib_save_CPPFLAGS"
 
                AC_MSG_CHECKING(whether to use the PID niceness surrogate for thread priorities)
+               glib_system_thread_size_growth=0
                AC_TRY_RUN([#include <pthread.h> 
                        #include <sys/types.h>
                        #include <unistd.h>
@@ -1061,16 +1134,15 @@ if test x"$have_threads" != xnone; then
                                $posix_priority_min != $posix_priority_max);
                        }],
                        [AC_MSG_RESULT(yes),
-                        AC_DEFINE(G_THREAD_USE_PID_SURROGATE, 1,
-                               [whether to use the PID niceness surrogate for thread priorities])
-
-                        glib_cv_sizeof_system_thread=`expr $glib_cv_sizeof_system_thread + $ac_cv_sizeof_long`],
+                         AC_DEFINE(G_THREAD_USE_PID_SURROGATE, 1, [whether to use the PID niceness surrogate for thread priorities])
+                          glib_system_thread_size_growth=$ac_cv_sizeof_long
+                        ],
                        [AC_MSG_RESULT(no)])
-          
+                dnl make sure both glib_cv_sizeof_system_thread and GLIB_SIZEOF_SYSTEM_THREAD are setup
+                glib_cv_sizeof_system_thread=`expr $glib_cv_sizeof_core_system_thread + $glib_system_thread_size_growth`
+                AC_DEFINE_UNQUOTED(GLIB_SIZEOF_SYSTEM_THREAD, $glib_cv_sizeof_system_thread)
        else # solaris threads
-               GLIB_SIZEOF([#include <thread.h>],
-                       thread_t,
-                       system_thread)
+               GLIB_SIZEOF([#include <thread.h>], thread_t, system_thread)
        fi
 
        LIBS="$glib_save_LIBS"
@@ -1333,6 +1405,13 @@ _______EOF
                fi
        fi
 
+        cat >>$outfile <<_______EOF
+
+#define GLIB_SIZEOF_VOID_P $glib_void_p
+#define GLIB_SIZEOF_LONG   $glib_long
+
+_______EOF
+
        case x$glib_size_t in
         x2) echo "typedef gint16  gssize;" >> $outfile
             echo "typedef guint16 gsize;"  >> $outfile
@@ -1400,17 +1479,14 @@ typedef struct _GStaticMutex GStaticMutex;
 struct _GStaticMutex
 {
   struct _GMutex *runtime_mutex;
-  struct {
-    union {
-      char   pad[$g_mutex_sizeof];
-      double dummy_double;
-      void  *dummy_pointer;
-      long   dummy_long;
-    } mutex;
-    void *debug_info;
+  union {
+    char   pad[$g_mutex_sizeof];
+    double dummy_double;
+    void  *dummy_pointer;
+    long   dummy_long;
   } static_mutex;
 };
-#define        G_STATIC_MUTEX_INIT     { NULL, { { { $g_mutex_contents} }, NULL } }
+#define        G_STATIC_MUTEX_INIT     { NULL, { { $g_mutex_contents} } }
 #define        g_static_mutex_get_mutex(mutex) \
   (g_thread_use_default_impl ? ((GMutex*) &((mutex)->static_mutex)) : \
    g_static_mutex_get_mutex_impl (&((mutex)->runtime_mutex)))
@@ -1473,6 +1549,8 @@ _______EOF
 
        cat >>$outfile <<_______EOF
 
+#define G_MODULE_SUFFIX "$g_module_suffix"
+
 G_END_DECLS
 
 #endif /* GLIBCONFIG_H */
@@ -1582,6 +1660,8 @@ $ac_cv_sizeof_long_long)
   ;;
 esac
 glib_size_t=$glib_cv_sizeof_size_t
+glib_void_p=$ac_cv_sizeof_long
+glib_long=$ac_cv_sizeof_void_p
 
 gintbits=`expr $ac_cv_sizeof_int \* 8`
 glongbits=`expr $ac_cv_sizeof_long \* 8`
@@ -1683,6 +1763,8 @@ g_mutex_sizeof="$glib_cv_sizeof_gmutex"
 g_system_thread_sizeof="$glib_cv_sizeof_system_thread"
 g_mutex_contents="$glib_cv_byte_contents_gmutex"
 
+g_module_suffix="$glib_gmodule_suffix"
+
 case $host in
   *-*-beos*)
     glib_os="#define G_OS_BEOS"
@@ -1690,7 +1772,10 @@ case $host in
   *-*-cygwin*)
     glib_os="#define G_OS_UNIX
 #define G_WITH_CYGWIN"
-v    ;;
+    ;;
+  *-*-mingw*)
+    glib_os="#define G_OS_WIN32"
+    ;;
   *)
     glib_os="#define G_OS_UNIX"
     ;;
@@ -1704,13 +1789,13 @@ gthread-2.0.pc
 gobject-2.0.pc
 glib.spec
 Makefile
-glib-config-2.0
 build/Makefile
 build/win32/Makefile
 gmodule/gmoduleconf.h
 gmodule/Makefile
 gobject/Makefile
 gthread/Makefile
+po/Makefile.in
 docs/Makefile
 docs/glib-config.1
 docs/reference/Makefile