Readd docs for G_PARAM_STATIC_NICK and add docs for new
[platform/upstream/glib.git] / configure.in
index a02083c..86e09d7 100644 (file)
@@ -26,7 +26,7 @@ m4_include(m4macros/glib-gettext.m4)dnl
 # set glib_binary_age _and_ glib_interface_age to 0.
 #
 m4_define([glib_major_version], [2])
-m4_define([glib_minor_version], [9])
+m4_define([glib_minor_version], [13])
 m4_define([glib_micro_version], [0])
 m4_define([glib_interface_age], [0])
 m4_define([glib_binary_age],
@@ -217,8 +217,7 @@ AC_DEFINE_UNQUOTED(G_COMPILED_WITH_DEBUGGING, ["${enable_debug}"],
 
 AC_MSG_CHECKING([whether to enable garbage collector friendliness])
 if test "x$enable_gc_friendly" = "xyes"; then
-  AC_DEFINE(ENABLE_GC_FRIENDLY, 1, [Whether to enable GC friendliness])
-  AC_SUBST(ENABLE_GC_FRIENDLY)
+  AC_DEFINE(ENABLE_GC_FRIENDLY_DEFAULT, 1, [Whether to enable GC friendliness by default])
   AC_MSG_RESULT([yes])
 else
   AC_MSG_RESULT([no])
@@ -428,7 +427,7 @@ dnl
 dnl gettext support
 dnl
 
-ALL_LINGUAS="am ar az be bg bn bs ca cs cy da de el en_CA en_GB eo es et eu fa fi fr ga gl gu he hi hr hu id is it ja ko lt lv mk mn ms nb ne nl nn no or pa pl pt pt_BR ro ru rw sk sl sq sr sr@ije sr@Latn sv ta te th tl tr uk vi wa xh yi zh_CN zh_TW"
+ALL_LINGUAS="am ar az be be@latin bg bn bn_IN bs ca cs cy da de dz el en_CA en_GB eo es et eu fa fi fr ga gl gu he hi hr hu hy id is it ja ka ko ku lt lv mg mk ml mn ms nb ne nl nn or pa pl pt pt_BR ro ru rw sk sl sq sr sr@Latn sr@ije sv ta te th tl tr tt uk vi wa xh yi zh_CN zh_HK zh_TW"
 GLIB_GNU_GETTEXT
 
 if test "$gt_cv_have_gettext" != "yes" ; then
@@ -523,9 +522,14 @@ AC_HEADER_STDC
 AC_FUNC_VPRINTF
 AC_FUNC_MMAP
 AC_FUNC_ALLOCA
+AC_CHECK_FUNCS(posix_memalign)
+AC_CHECK_FUNCS(memalign)
+AC_CHECK_FUNCS(valloc)
 
 AC_CHECK_FUNCS(atexit on_exit)
 
+AC_CHECK_FUNCS(timegm)
+
 AC_CHECK_SIZEOF(char)
 AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(long)
@@ -700,6 +704,21 @@ main (void) {
 }],[g_can_inline=yes],[g_can_inline=no])
 AC_MSG_RESULT($g_can_inline)
 
+dnl *** check for working do while(0) macros ***
+AC_CACHE_CHECK([for working do while(0) macros], g_support_dowhile_macros, [
+       AC_TRY_COMPILE([],[
+       #define STMT_START do
+       #define STMT_END while(0)
+       #define STMT_TEST STMT_START { i = 0; } STMT_END
+       int main(void) { int i = 1; STMT_TEST; return i; }],
+       [g_support_dowhile_macros=yes],
+       [g_support_dowhile_macros=no],
+       [g_support_dowhile_macros=yes])
+])
+if test x$g_support_dowhile_macros = xyes; then
+  AC_DEFINE(HAVE_DOWHILE_MACROS, 1, [define for working do while(0) macros])
+fi
+
 # check for flavours of varargs macros
 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
 AC_TRY_COMPILE([],[
@@ -767,12 +786,22 @@ int main (int argc, char **argv)
 AC_MSG_RESULT($g_have_gnuc_visibility)
 AM_CONDITIONAL(HAVE_GNUC_VISIBILITY, [test x$g_have_gnuc_visibility = xyes])
 
+AC_MSG_CHECKING([whether using Sun Studio C compiler])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__SUNPRO_C) || (__SUNPRO_C >= 0x550)
+#else
+# include "error: this is not Sun Studio."
+#endif
+]], [[]])], [ g_have_sunstudio_visibility=yes ], [ g_have_sunstudio_visibility=no ])
+AC_MSG_RESULT($g_have_sunstudio_visibility)
+AM_CONDITIONAL(HAVE_SUNSTUDIO_VISIBILITY, [test x$g_have_sunstudio_visibility = xyes])
+
 # check for bytesex stuff
 AC_C_BIGENDIAN
 
 # check for header files
-AC_CHECK_HEADERS([dirent.h float.h limits.h pwd.h sys/param.h sys/poll.h sys/select.h sys/types.h])
-AC_CHECK_HEADERS([sys/time.h sys/times.h sys/wait.h unistd.h values.h stdint.h sched.h])
+AC_CHECK_HEADERS([dirent.h float.h limits.h pwd.h sys/param.h sys/poll.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])
 
 # Checks for libcharset
 jm_LANGINFO_CODESET
@@ -835,7 +864,9 @@ fi
 AC_MSG_RESULT(unsigned $glib_size_type)
 
 # Check for some functions
-AC_CHECK_FUNCS(lstat strerror strsignal memmove mkstemp vsnprintf stpcpy strcasecmp strncasecmp poll getcwd nanosleep vasprintf setenv unsetenv getc_unlocked readlink symlink)
+AC_CHECK_FUNCS(lstat strerror strsignal memmove vsnprintf stpcpy strcasecmp strncasecmp poll getcwd vasprintf setenv unsetenv getc_unlocked readlink symlink fdwalk)
+# Check for high-resolution sleep functions
+AC_CHECK_FUNCS(nanosleep nsleep)
 
 AC_CHECK_HEADERS(crt_externs.h)
 AC_CHECK_FUNCS(_NSGetEnviron)
@@ -895,7 +926,7 @@ gt_TYPE_WINT_T
 AC_TYPE_SIZE_T
 AC_CHECK_TYPES(ptrdiff_t)
 jm_AC_TYPE_INTMAX_T
-AC_CHECK_FUNCS(snprintf)
+AC_CHECK_FUNCS([snprintf wcslen])
 AC_FUNC_SNPRINTF_C99
 
 # Check if bcopy can be used for overlapping copies, if memmove isn't found.
@@ -991,14 +1022,56 @@ if test x$glib_cv_sane_realloc = xyes; then
 fi
 
 dnl Check for nl_langinfo and CODESET
+AC_CACHE_CHECK([for nl_langinfo (CODESET)],glib_cv_langinfo_codeset,[
+        AC_TRY_COMPILE([#include <langinfo.h>],
+                [char *codeset = nl_langinfo (CODESET);],
+                [glib_cv_langinfo_codeset=yes],
+                [glib_cv_langinfo_codeset=no])])
+if test x$glib_cv_langinfo_codeset = xyes; then
+  AC_DEFINE(HAVE_CODESET,1,[Have nl_langinfo (CODESET)])
+fi
 
-AC_MSG_CHECKING([for nl_langinfo (CODESET)])
-AC_TRY_COMPILE([#include <langinfo.h>],
-       [char *codeset = nl_langinfo (CODESET);],
-   AC_DEFINE(HAVE_CODESET,1,[Have nl_langinfo (CODESET)])
-   have_codeset=yes,
-   have_codeset=no)
-AC_MSG_RESULT($have_codeset)
+dnl ****************************************
+dnl *** posix_memalign                   ***
+dnl ****************************************
+AC_MSG_CHECKING(for a compliant posix_memalign() implementation)
+AC_CACHE_VAL(glib_cv_compliant_posix_memalign,[
+    glib_cv_compliant_posix_memalign=0
+    if test "$ac_cv_func_posix_memalign" = "yes" ; then
+       AC_TRY_RUN([
+                #define _XOPEN_SOURCE 600
+                #include <stdlib.h> /* posix_memalign() should be defined here */
+                /* some systems break if #include <malloc.h> used */
+               static void test_memalign (size_t boundary, size_t size) {
+                   void *mem = 0;
+                   if (posix_memalign (&mem, boundary, size) != 0 || !mem)
+                       exit (1);
+                    else
+                      free (mem);
+               }
+               int main() {
+                   test_memalign (  128,   128 - 2 * sizeof (void*));
+                   test_memalign (  256,   256 - 2 * sizeof (void*));
+                   test_memalign (  512,   512 - 2 * sizeof (void*));
+                   test_memalign ( 1024,  1024 - 2 * sizeof (void*));
+                   test_memalign ( 2048,  2048 - 2 * sizeof (void*));
+                   test_memalign ( 4096,  4096 - 2 * sizeof (void*));
+                   test_memalign ( 8192,  8192 - 2 * sizeof (void*));
+                   test_memalign (16384, 16384 - 2 * sizeof (void*));
+                   test_memalign (32768, 32768 - 2 * sizeof (void*));
+                   exit (0); /* success */
+               }
+               ],
+           [glib_cv_compliant_posix_memalign=1], [], [:])
+      :
+    fi
+    ])
+if test "$glib_cv_compliant_posix_memalign" = "1"; then
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS, 1, [define if posix_memalign() can allocate any size])
+else
+    AC_MSG_RESULT(no)
+fi
 
 
 dnl ****************************************
@@ -1029,6 +1102,7 @@ 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>
+#include <stdlib.h>
        void f (int i, ...) {
        va_list args1, args2;
        va_start (args1, i);
@@ -1046,6 +1120,7 @@ AC_CACHE_CHECK([for an implementation of va_copy()],glib_cv_va_copy,[
 ])
 AC_CACHE_CHECK([for an implementation of __va_copy()],glib_cv___va_copy,[
        AC_LINK_IFELSE([#include <stdarg.h>
+#include <stdlib.h>
        void f (int i, ...) {
        va_list args1, args2;
        va_start (args1, i);
@@ -1075,6 +1150,7 @@ fi
 
 AC_CACHE_CHECK([whether va_lists can be copied by value],glib_cv_va_val_copy,[
        AC_TRY_RUN([#include <stdarg.h>
+#include <stdlib.h> 
        void f (int i, ...) {
        va_list args1, args2;
        va_start (args1, i);
@@ -1106,6 +1182,7 @@ if test x"$glib_native_win32" = xyes; then
   dnl No use for this on Win32
   G_MODULE_LDFLAGS=
 else
+  export SED
   G_MODULE_LDFLAGS=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
 fi
 dnl G_MODULE_IMPL= don't reset, so cmd-line can override
@@ -1244,21 +1321,17 @@ else
 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'
-    ;;
-  aix*)
-    glib_gmodule_suffix='a'
-    ;;
-  *)
-    glib_gmodule_suffix='so'    
-    ;;
-esac
+export SED
+shrext_cmds=`./libtool --config | grep '^shrext_cmds='`
+eval $shrext_cmds
+module=yes eval std_shrext=$shrext_cmds
+# chop the initial dot
+glib_gmodule_suffix=`echo $std_shrext | sed 's/^\.//'`
 AC_MSG_RESULT(.$glib_gmodule_suffix)
+# any reason it may fail?
+if test "x$glib_gmodule_suffix" = x; then
+       AC_MSG_ERROR(Cannot determine shared library suffix from libtool)
+fi
  
 AC_SUBST(G_MODULE_SUPPORTED)
 AC_SUBST(G_MODULE_IMPL)
@@ -1321,7 +1394,7 @@ AC_SUBST(PLATFORMDEP)
 
 AC_MSG_CHECKING([whether to compile timeloop])
 case "$host" in
-  *-*-cygwin*|*-*-mingw*)
+  *-*-cygwin*|*-*-mingw*|*-*-minix)
     enable_timeloop=no
     ;;
   *)
@@ -1348,7 +1421,7 @@ dnl *** g_thread checks ***
 dnl ***********************
 
 AC_ARG_WITH(threads,
-           [AC_HELP_STRING([--with-threads=@<:@none/posix/dce/solaris/win32@:>@],
+           [AC_HELP_STRING([--with-threads=@<:@none/posix/dce/win32@:>@],
                            [specify a thread implementation to use])],
            [if test "x$with_threads" = x; then
                want_threads=yes
@@ -1410,13 +1483,6 @@ dnl ***************************************
 # have_threads=none means no default thread implementation
 
 have_threads=no
-if test "x$want_threads" = xyes || test "x$want_threads" = xsolaris; then
-               case $host in
-                       *-*-solaris*)
-               AC_CHECK_LIB(thread, cond_init, have_threads=solaris)
-               ;;
-       esac
-fi
 if test "x$want_threads" = xyes || test "x$want_threads" = xposix \
                                || test "x$want_threads" = xdce; then
        # -D_POSIX4_DRAFT_SOURCE -D_POSIX4A_DRAFT10_SOURCE is for DG/UX
@@ -1484,7 +1550,7 @@ int main()
    void *ret;
    pthread_create (&t, $1, func, 0);
    pthread_join (t, &ret);
-   exit (check_me != 42 || ret != &check_me);
+   return (check_me != 42 || ret != &check_me);
 }])
 
 dnl
@@ -1507,9 +1573,16 @@ if test x"$have_threads" != xno; then
     # One of them does for most gcc versions and some other platforms/compilers
     # too and could be considered as the canonical way to go. 
     case $host in
-      *-*-cygwin*)
-         # skip cygwin -pthread or -pthreads test
+      *-*-cygwin*|*-*-darwin*)
+         # skip cygwin and darwin -pthread or -pthreads test
          ;;
+      *-solaris*)
+        # These compiler/linker flags work with both Sun Studio and gcc
+       # Sun Studio expands -mt to -D_REENTRANT and -lthread
+       # gcc expands -pthreads to -D_REENTRANT -D_PTHREADS -lpthread
+        G_THREAD_CFLAGS="-D_REENTRANT -D_PTHREADS"
+        G_THREAD_LIBS="-lpthread -lthread"
+        ;;
       *)
         for flag in pthread pthreads mt; do
           glib_save_CFLAGS="$CFLAGS"
@@ -1524,6 +1597,7 @@ if test x"$have_threads" != xno; then
           if test $glib_flag_works = yes ; then
              G_THREAD_CFLAGS=-$flag
             G_THREAD_LIBS=-$flag
+            break;
           fi
         done
          ;;
@@ -1562,16 +1636,6 @@ if test x"$have_threads" != xno; then
                G_THREAD_CFLAGS="-threads"
                G_THREAD_LIBS=$G_THREAD_CFLAGS
                ;;
-       *-solaris*)
-               if test x"$GCC" = xyes; then
-                  # We are using solaris threads. posix threads are 
-                  # already catched above.
-                       G_THREAD_CFLAGS="-threads"
-               else
-                       G_THREAD_CFLAGS="-mt"
-               fi
-               G_THREAD_LIBS=$G_THREAD_CFLAGS
-               ;;
        *-sysv5uw7*) # UnixWare 7 
                # We are not using gcc with -pthread. Catched above.
                G_THREAD_CFLAGS="-Kthread"
@@ -1709,13 +1773,6 @@ case $have_threads in
          AC_SUBST(GTHREAD_COMPILE_IMPL_DEFINES)
           CPPFLAGS="$glib_save_CPPFLAGS"
           ;;
-        solaris)
-           mutex_has_default=yes
-           mutex_default_type='mutex_t'
-          mutex_default_init="DEFAULTMUTEX"
-           mutex_header_file='thread.h'
-          g_threads_impl="SOLARIS"
-           ;;
        win32)
           g_threads_impl="WIN32"
           ;;
@@ -1866,8 +1923,6 @@ int main () {
        elif test x"$have_threads" = xwin32; then
                # It's a pointer to a private struct
                GLIB_SIZEOF(,struct _GThreadData *, system_thread)
-       elif test x"$have_threads" = xsolaris; then 
-               GLIB_SIZEOF([#include <thread.h>], thread_t, system_thread)
        fi
 
        LIBS="$glib_save_LIBS"
@@ -1935,6 +1990,30 @@ if test $mutex_has_default = yes ; then
        LIBS="$glib_save_LIBS"
 fi
 
+AC_CHECK_FUNCS(clock_gettime, [], [
+  AC_CHECK_LIB(rt, clock_gettime, [
+    AC_DEFINE(HAVE_CLOCK_GETTIME, 1)
+    G_THREAD_LIBS="$G_THREAD_LIBS -lrt"
+    G_THREAD_LIBS_FOR_GTHREAD="$G_THREAD_LIBS_FOR_GTHREAD -lrt"
+  ])
+])
+
+AC_CACHE_CHECK(for monotonic clocks,
+    glib_cv_monotonic_clock,AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <time.h>
+#include <unistd.h>
+int main() {
+#if !(defined(_POSIX_MONOTONIC_CLOCK) && _POSIX_MONOTONIC_CLOCK >= 0 && defined(CLOCK_MONOTONIC))
+        #error No monotonic clock
+#endif
+       return 0;
+}
+]])],glib_cv_monotonic_clock=yes,glib_cv_monotonic_clock=no))
+if test "$glib_cv_monotonic_clock" = "yes"; then
+  AC_DEFINE(HAVE_MONOTONIC_CLOCK,1,[Have a monotonic clock])
+fi
+
+
 dnl ********************************
 dnl *** g_atomic_* tests for gcc ***
 dnl ********************************
@@ -2041,6 +2120,32 @@ else
   glib_cv_value_POLLNVAL=32
 fi
 
+AC_MSG_CHECKING([for broken poll])
+AC_RUN_IFELSE([AC_LANG_SOURCE([[
+       #include <stdlib.h>
+       #include <fcntl.h>
+       #include <poll.h>
+       #ifdef HAVE_SYS_POLL_H
+       #include <sys/poll.h>
+       #endif
+       int main(void) {
+         struct pollfd fds[1];
+         int fd;
+         fd = open("/dev/null", 1);
+         fds[0].fd = fd;
+         fds[0].events = POLLIN;
+         fds[0].revents = 0;
+         if (poll(fds, 1, 0) < 0 || (fds[0].revents & POLLNVAL) != 0) {
+               exit(1);  /* Does not work for devices -- fail */
+         }
+         exit(0);
+       }]])],
+  [broken_poll=no],
+  [broken_poll=yes
+   AC_DEFINE(BROKEN_POLL,1,[poll doesn't work on devices])],
+  [broken_poll="no (cross compiling)"])
+AC_MSG_RESULT($broken_poll)
+
 dnl **********************
 dnl *** Win32 API libs ***
 dnl **********************
@@ -2206,6 +2311,7 @@ ${glib_extension}typedef signed $gint64 gint64;
 ${glib_extension}typedef unsigned $gint64 guint64;
 
 #define G_GINT64_CONSTANT(val) $gint64_constant
+#define G_GUINT64_CONSTANT(val)        $guint64_constant
 _______EOF
 
        if test x$gint64_format != x ; then
@@ -2336,13 +2442,23 @@ _______EOF
 
        if test x$g_have_gnuc_visibility = xyes ; then
                cat >>$outfile <<_______EOF
+#if __GNUC__ == 2 && __GNUC_MINOR__ == 95
+#define G_GNUC_INTERNAL
+#else
 #define G_HAVE_GNUC_VISIBILITY 1
 #define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
+#endif
 _______EOF
-       else
+        else
+          if test x$g_have_sunstudio_visibility = xyes ; then
+                cat >>$outfile <<_______EOF
+#define G_GNUC_INTERNAL __hidden
+_______EOF
+          else
                cat >>$outfile <<_______EOF
 #define G_GNUC_INTERNAL
 _______EOF
+         fi
        fi
 
 
@@ -2364,7 +2480,7 @@ struct _GStaticMutex
 };
 #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_thread_use_default_impl ? ((GMutex*) ((mutex)->static_mutex.pad)) : \\
    g_static_mutex_get_mutex_impl_shortcut (&((mutex)->runtime_mutex)))
 _______EOF
        else
@@ -2529,6 +2645,7 @@ $ac_cv_sizeof_int)
   guint64_format='"u"'
   glib_extension=
   gint64_constant='(val)'
+  guint64_constant='(val)'
   ;;
 $ac_cv_sizeof_long)
   gint64=long
@@ -2537,6 +2654,7 @@ $ac_cv_sizeof_long)
   guint64_format='"lu"'
   glib_extension=
   gint64_constant='(val##L)'
+  guint64_constant='(val##UL)'
   ;;
 $ac_cv_sizeof_long_long)
   gint64='long long'
@@ -2547,6 +2665,7 @@ $ac_cv_sizeof_long_long)
   fi
   glib_extension='G_GNUC_EXTENSION '
   gint64_constant='(G_GNUC_EXTENSION (val##LL))'
+  guint64_constant='(G_GNUC_EXTENSION (val##ULL))'
   ;;
 $ac_cv_sizeof___int64)
   gint64='__int64'
@@ -2557,6 +2676,7 @@ $ac_cv_sizeof___int64)
   fi
   glib_extension=
   gint64_constant='(val##i64)'
+  guint64_constant='(val##ui64)'
   ;;
 esac
 glib_size_t=$ac_cv_sizeof_size_t
@@ -2664,6 +2784,7 @@ g_have_iso_cxx_varargs=$g_have_iso_cxx_varargs
 
 g_can_inline=$g_can_inline
 g_have_gnuc_visibility=$g_have_gnuc_visibility
+g_have_sunstudio_visibility=$g_have_sunstudio_visibility
 
 case xyes in
 x$ac_cv_c_bigendian)
@@ -2740,9 +2861,6 @@ gobject-2.0-uninstalled.pc
 glib-zip
 glib-gettextize
 Makefile
-build/Makefile
-build/win32/Makefile
-build/win32/dirent/Makefile
 glib/Makefile
 glib/libcharset/Makefile
 glib/gnulib/Makefile