Bug 547637 – unconditional #include of sys/statfs.h in configure impedes
[platform/upstream/glib.git] / configure.in
index 5860a6c..a2a43e9 100644 (file)
@@ -22,9 +22,9 @@ 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], [14])
-m4_define([glib_micro_version], [4])
-m4_define([glib_interface_age], [4])
+m4_define([glib_minor_version], [17])
+m4_define([glib_micro_version], [7])
+m4_define([glib_interface_age], [0])
 m4_define([glib_binary_age],
           [m4_eval(100 * glib_minor_version + glib_micro_version)])
 m4_define([glib_version],
@@ -115,23 +115,29 @@ AC_MSG_RESULT([$glib_native_beos])
 dnl
 
 AC_MSG_CHECKING([for Win32])
+LIB_EXE_MACHINE_FLAG=X86
 case "$host" in
   *-*-mingw*)
     glib_native_win32=yes
-    GLIB_DEF=glib.def
-    GMODULE_DEF=gmodule.def
-    GOBJECT_DEF=gobject.def
-    GTHREAD_DEF=gthread.def
-    TESTGMODULE_EXP=testgmodule.exp
     glib_pid_type='void *'
+    glib_cv_stack_grows=no
+    # Unfortunately the mingw implementations of C99-style snprintf and vsnprintf
+    # don't seem to be quite good enough, at least not in mingw-runtime-3.14.
+    # (Sorry, I don't know exactly what is the problem, but it is related to
+    # floating point formatting and decimal point vs. comma.)
+    # The simple tests in AC_FUNC_VSNPRINTF_C99 and AC_FUNC_SNPRINTF_C99 aren't
+    # rigorous enough to notice, though.
+    # So preset the autoconf cache variables.
+    ac_cv_func_vsnprintf_c99=no
+    ac_cv_func_snprintf_c99=no
+    case "$host" in
+    x86_64-*-*)
+      LIB_EXE_MACHINE_FLAG=X64
+      ;;
+    esac
     ;;
   *)
     glib_native_win32=no
-    GLIB_DEF=
-    GMODULE_DEF=
-    GOBJECT_DEF=
-    GTHREAD_DEF=
-    TESTGMODULE_EXP=
     glib_pid_type=int
     ;;
 esac
@@ -143,6 +149,8 @@ esac
 
 AC_MSG_RESULT([$glib_native_win32])
 
+AC_SUBST(LIB_EXE_MACHINE_FLAG)
+
 glib_have_carbon=no
 AC_MSG_CHECKING([for Mac OS X Carbon support])
 AC_TRY_CPP([
@@ -153,14 +161,10 @@ AC_TRY_CPP([
 AC_MSG_RESULT([$glib_have_carbon])
 
 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"])
-AC_SUBST(GLIB_DEF)
-AC_SUBST(GMODULE_DEF)
-AC_SUBST(GOBJECT_DEF)
-AC_SUBST(GTHREAD_DEF)
-AC_SUBST(TESTGMODULE_EXP)
 
 if test "$glib_native_win32" = "yes"; then
   AC_CHECK_TOOL(WINDRES, windres, no)
@@ -241,17 +245,6 @@ else
   AC_MSG_RESULT([yes])
 fi
 
-if test "$glib_native_win32" = "yes"; then
-  if test x$enable_static = xyes -o x$enable_static = x; then
-    AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
-    enable_static=no
-  fi
-  if test x$enable_shared = xno; then
-    AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
-  fi
-  enable_shared=yes
-fi
-
 dnl Checks for programs.
 AC_PROG_CC
 
@@ -338,6 +331,8 @@ if test x"$glib_native_win32" = xyes; then
     fi
   fi
 fi
+GLIB_EXTRA_CFLAGS="${msnative_struct}"
+AC_SUBST(GLIB_EXTRA_CFLAGS)
 
 AC_EXEEXT
 
@@ -366,47 +361,57 @@ if test "x$PERL_PATH" = x ; then
 fi
 AC_SUBST(PERL_PATH)
 
+# Need suitable python path for greport
+AM_PATH_PYTHON(2.4,,PYTHON="/usr/bin/env python2.4")
+
+
 dnl ***********************
 dnl *** Tests for iconv ***
 dnl ***********************
 dnl
 dnl We do this before the gettext checks, to avoid distortion
 
-AC_ARG_WITH(libiconv,
-            [AC_HELP_STRING([--with-libiconv=@<:@no/gnu/native@:>@],
-                            [use the libiconv library])],,
-           [with_libiconv=maybe])
+dnl On Windows we use a native implementation
 
-found_iconv=no
-case $with_libiconv in
-  maybe)
-    # Check in the C library first
-    AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
-    # Check if we have GNU libiconv
-    if test $found_iconv = "no"; then
+if test x"$glib_native_win32" = xyes; then
+  with_libiconv=native
+else
+  AC_ARG_WITH(libiconv,
+             [AC_HELP_STRING([--with-libiconv=@<:@no/gnu/native@:>@],
+                             [use the libiconv library])],,
+             [with_libiconv=maybe])
+
+  found_iconv=no
+  case $with_libiconv in
+    maybe)
+      # Check in the C library first
+      AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
+      # Check if we have GNU libiconv
+      if test $found_iconv = "no"; then
+       AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
+      fi
+      # Check if we have a iconv in -liconv, possibly from vendor
+      if test $found_iconv = "no"; then
+       AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
+      fi
+      ;;
+    no)
+      AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
+      ;;
+    gnu|yes)
       AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
-    fi
-    # Check if we have a iconv in -liconv, possibly from vendor
-    if test $found_iconv = "no"; then
+      ;;
+    native)
       AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
-    fi
-    ;;
-  no)
-    AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
-    ;;
-  gnu|yes)
-    AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
-    ;;
-  native)
-    AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
-    ;;
-esac
+      ;;
+  esac
 
-if test "x$found_iconv" = "xno" ; then
-   AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv])
+  if test "x$found_iconv" = "xno" ; then
+     AC_MSG_ERROR([*** No iconv() implementation found in C library or libiconv])
+  fi
 fi
 
-jm_GLIBC21
+gl_GLIBC21
 AC_ARG_ENABLE(iconv-cache, 
               [AC_HELP_STRING([--enable-iconv-cache=@<:@yes/no/auto@:>@],
                               [cache iconv descriptors [default=auto]])],,
@@ -438,7 +443,8 @@ dnl
 dnl gettext support
 dnl
 
-ALL_LINGUAS="am ar as 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 kn ko ku lt lv mg mk ml mn ms nb ne nl nn oc 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"
+ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
+AC_SUBST([CONFIG_STATUS_DEPENDENCIES],['$(top_srcdir)/po/LINGUAS'])
 GLIB_GNU_GETTEXT
 
 if test "$gt_cv_have_gettext" != "yes" ; then
@@ -461,11 +467,13 @@ dnl
 dnl Now we are done with gettext checks, figure out ICONV_LIBS
 dnl
 
-if test x$with_libiconv != xno ; then
-  case " $INTLLIBS " in
-  *[[\ \       ]]-liconv[[\ \  ]]*) ;;
-  *) ICONV_LIBS="-liconv" ;;
-  esac
+if test x"$glib_native_win32" != xyes; then
+  if test x$with_libiconv != xno ; then
+    case " $INTLLIBS " in
+    *[[\ \     ]]-liconv[[\ \  ]]*) ;;
+    *) ICONV_LIBS="-liconv" ;;
+    esac
+  fi
 fi
 AC_SUBST(ICONV_LIBS)
 
@@ -490,6 +498,21 @@ if test "x$GCC" = "xyes"; then
   esac
 fi
 
+CPPFLAGS="$CPPFLAGS -DG_DISABLE_SINGLE_INCLUDES"
+
+if test "$glib_native_win32" = "yes"; then
+  if test x$enable_static = xyes -a x$enable_shared = xyes; then
+    AC_MSG_ERROR([Can not build both shared and static at the same time on Windows.])
+  fi
+  if test x$enable_static = xyes; then
+    glib_win32_static_compilation=yes
+    GLIB_WIN32_STATIC_COMPILATION_DEFINE="#define GLIB_STATIC_COMPILATION 1
+#define GOBJECT_STATIC_COMPILATION 1"
+    AC_SUBST(GLIB_WIN32_STATIC_COMPILATION_DEFINE)
+  fi
+fi
+AM_CONDITIONAL(OS_WIN32_AND_DLL_COMPILATION, [test x$glib_native_win32 = xyes -a x$glib_win32_static_compilation != xyes])
+
 dnl
 dnl DU4 native cc currently needs -std1 for ANSI mode (instead of K&R)
 dnl
@@ -539,7 +562,7 @@ AC_CHECK_FUNCS(valloc)
 
 AC_CHECK_FUNCS(atexit on_exit)
 
-AC_CHECK_FUNCS(timegm)
+AC_CHECK_FUNCS(timegm gmtime_r)
 
 AC_CHECK_SIZEOF(char)
 AC_CHECK_SIZEOF(short)
@@ -716,17 +739,17 @@ main (void) {
 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_CACHE_CHECK([for working do while(0) macros], g_cv_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])
+       [g_cv_support_dowhile_macros=yes],
+       [g_cv_support_dowhile_macros=no],
+       [g_cv_support_dowhile_macros=yes])
 ])
-if test x$g_support_dowhile_macros = xyes; then
+if test x$g_cv_support_dowhile_macros = xyes; then
   AC_DEFINE(HAVE_DOWHILE_MACROS, 1, [define for working do while(0) macros])
 fi
 
@@ -808,15 +831,48 @@ AM_CONDITIONAL(HAVE_SUNSTUDIO_VISIBILITY, [test x$g_have_sunstudio_visibility =
 
 # check for bytesex stuff
 AC_C_BIGENDIAN
+if test x$ac_cv_c_bigendian = xuniversal ; then
+AC_TRY_COMPILE([#include <endian.h>], [#if __BYTE_ORDER == __BIG_ENDIAN
+#else
+#error Not a big endian. 
+#endif],
+    ac_cv_c_bigendian=yes
+    ,AC_TRY_COMPILE([#include <endian.h>], [#if __BYTE_ORDER == __LITTLE_ENDIAN
+#else
+#error Not a little endian. 
+#endif],
+    ac_cv_c_bigendian=no
+    ,AC_MSG_WARN([Could not determine endianness.])))
+fi
+
 
 # check for header files
-AC_CHECK_HEADERS([dirent.h float.h limits.h pwd.h sys/param.h sys/poll.h sys/resource.h])
+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/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])
+
+# check for structure fields
+AC_CHECK_MEMBERS([struct stat.st_mtimensec, struct stat.st_mtim.tv_nsec, struct stat.st_atimensec, struct stat.st_atim.tv_nsec, struct stat.st_ctimensec, struct stat.st_ctim.tv_nsec])
+AC_CHECK_MEMBERS([struct stat.st_blksize, struct stat.st_blocks, struct statfs.f_fstypename, struct statfs.f_bavail],,, [#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#ifdef HAVE_SYS_STATFS_H
+#include <sys/statfs.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif])
+# struct statvfs.f_basetype is available on Solaris but not for Linux. 
+AC_CHECK_MEMBERS([struct statvfs.f_basetype],,, [#include <sys/statvfs.h>])
 
 # Checks for libcharset
-jm_LANGINFO_CODESET
-jm_GLIBC21
+AM_LANGINFO_CODESET
+gl_GLIBC21
 AC_CHECK_HEADERS([stddef.h stdlib.h string.h])
 AC_CHECK_FUNCS(setlocale)
 
@@ -836,6 +892,12 @@ case $ac_cv_sizeof_size_t in
   $ac_cv_sizeof_long) 
       glib_size_type=long
       ;;
+  $ac_cv_sizeof_long_long)
+      glib_size_type='long long'
+      ;;
+  $ac_cv_sizeof__int64)
+      glib_size_type='__int64'
+      ;;
   *)  AC_MSG_ERROR([No type matching size_t in size])
       ;;
 esac
@@ -876,6 +938,8 @@ 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(chown 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)
 
@@ -885,6 +949,47 @@ AC_CHECK_FUNCS(_NSGetEnviron)
 AC_FUNC_VSNPRINTF_C99
 AC_FUNC_PRINTF_UNIX98
 
+dnl
+dnl if statfs() takes 2 arguments (Posix) or 4 (Solaris)
+dnl
+if test "$ac_cv_func_statfs" = yes ; then
+  AC_MSG_CHECKING([number of arguments to statfs()])
+  AC_TRY_COMPILE([#include <unistd.h>
+  #ifdef HAVE_SYS_PARAM_H
+  #include <sys/param.h>
+  #endif
+  #ifdef HAVE_SYS_VFS_H
+  #include <sys/vfs.h>
+  #endif
+  #ifdef HAVE_SYS_MOUNT_H
+  #include <sys/mount.h>
+  #endif
+  #ifdef HAVE_SYS_STATFS_H
+  #include <sys/statfs.h>
+  #endif], [struct statfs st;
+  statfs(NULL, &st);],[
+    AC_MSG_RESULT([2])
+    AC_DEFINE(STATFS_ARGS, 2, [Number of arguments to statfs()])],[
+    AC_TRY_COMPILE([#include <unistd.h>
+  #ifdef HAVE_SYS_PARAM_H
+  #include <sys/param.h>
+  #endif
+  #ifdef HAVE_SYS_VFS_H
+  #include <sys/vfs.h>
+  #endif
+  #ifdef HAVE_SYS_MOUNT_H
+  #include <sys/mount.h>
+  #endif
+  #ifdef HAVE_SYS_STATFS_H
+  #include <sys/statfs.h>
+  #endif], [struct statfs st;
+  statfs(NULL, &st, sizeof (st), 0);],[
+      AC_MSG_RESULT([4])
+      AC_DEFINE(STATFS_ARGS, 4, [Number of arguments to statfs()])],[
+      AC_MSG_RESULT(unknown)
+      AC_MSG_ERROR([unable to determine number of arguments to statfs()])])])
+fi
+
 #
 # Check whether to use an included printf
 #
@@ -1387,6 +1492,150 @@ esac
 AC_MSG_RESULT($GIO)
 AC_SUBST(GIO)
 
+dnl *********************************
+dnl *** Directory for GIO modules ***
+dnl *********************************
+
+AC_ARG_WITH(gio-module-dir,
+           [AC_HELP_STRING([--with-gio-module-dir=PATH],
+                           [Load gio modules from this directory [LIBDIR/gio/modules]])],
+           [],
+          [with_gio_module_dir='${libdir}/gio/modules'])
+GIO_MODULE_DIR=$with_gio_module_dir
+AC_SUBST(GIO_MODULE_DIR)
+
+dnl **********************************
+dnl *** Check for libselinux (GIO) ***
+dnl **********************************
+AC_ARG_ENABLE(selinux, [  --disable-selinux       build without selinux support])
+msg_selinux=no
+SELINUX_LIBS=
+if test "x$enable_selinux" != "xno"; then
+
+ AC_CHECK_LIB(selinux, is_selinux_enabled,
+   [AC_CHECK_HEADERS(selinux/selinux.h,
+     [AC_SEARCH_LIBS(lgetfilecon_raw, selinux, 
+       [AC_DEFINE(HAVE_SELINUX, 1, [Define to 1 if libselinux is available])
+        SELINUX_LIBS="-lselinux"
+        msg_selinux=yes])
+     ])
+   ])
+fi
+AC_SUBST(SELINUX_LIBS)
+
+dnl *****************************
+dnl ** Check for inotify (GIO) **
+dnl *****************************
+inotify_support=no
+AC_CHECK_HEADERS([sys/inotify.h],
+[
+       inotify_support=yes
+])
+
+AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])
+
+dnl *********************************
+dnl ** Check for Solaris FEN (GIO) **
+dnl *********************************
+fen_support=no
+AC_COMPILE_IFELSE([ 
+#include <port.h> 
+#ifndef PORT_SOURCE_FILE 
+#error "Please upgrade to Nevada 72 or above to suppoert FEN" 
+#endif 
+int main() { return 0; } ],
+[
+       fen_support=yes
+],)
+
+AM_CONDITIONAL(HAVE_FEN, [test "$fen_support" = "yes"])
+
+dnl ****************************
+dnl *** Checks for FAM (GIO) ***
+dnl ****************************
+
+should_disable_fam=no
+
+AC_ARG_ENABLE(fam, [  --disable-fam          build without enabling fam for file system monitoring],
+                         [
+                                if test "x$enable_fam" = "xno"; then
+                                        should_disable_fam=yes
+                                        echo "Not building FAM support"
+                                fi
+                         ]
+                         )
+fam_support=no
+FAM_LIBS=
+if test "x$should_disable_fam" = "xno"; then
+AC_CHECK_LIB(fam, FAMOpen,
+  [AC_CHECK_HEADERS(fam.h,
+    [AC_DEFINE(HAVE_FAM, [], [Define if we have FAM])
+     AC_CHECK_LIB(fam, FAMNoExists,
+                 AC_DEFINE(HAVE_FAM_NO_EXISTS, [], [Define if we have FAMNoExists in fam]))
+     FAM_LIBS="-lfam"]
+     fam_support=yes,
+    AC_MSG_WARN(*** FAM support will not be built (header files not found) ***))],
+  AC_MSG_WARN(*** FAM support will not be built (FAM library not found) ***))
+AC_SUBST(FAM_LIBS)
+fi
+AM_CONDITIONAL(HAVE_FAM, [test "$fam_support" = "yes"])
+
+
+dnl *****************************
+dnl *** Check for xattr (GIO) ***
+dnl *****************************
+AC_ARG_ENABLE(xattr, [  --disable-xattr           build without xattr support])
+msg_xattr=no
+XATTR_LIBS=
+if test "x$enable_xattr" != "xno"; then
+
+dnl either glibc or libattr can provide xattr support
+
+dnl for both of them, we check for getxattr being in
+dnl the library and a valid xattr header.
+
+dnl try glibc
+ AC_CHECK_LIB(c, getxattr,
+   [AC_CHECK_HEADERS(sys/xattr.h,
+     [AC_DEFINE(HAVE_XATTR, 1, [Define to 1 if xattr is available])
+      msg_xattr=yes])
+   ])
+
+  if test "x$msg_xattr" != "xyes"; then
+dnl   failure. try libattr
+   AC_CHECK_LIB(attr, getxattr,
+      [AC_CHECK_HEADERS(attr/xattr.h,
+       [AC_DEFINE(HAVE_XATTR, 1, [Define to 1 if xattr is available])
+        XATTR_LIBS="-lattr"
+        msg_xattr=yes])
+      ])
+  fi
+
+  if test "x$msg_xattr" = "xyes"; then
+    AC_MSG_CHECKING([for XATTR_NOFOLLOW])
+    AC_TRY_COMPILE([
+      #include <stdio.h>
+      #ifdef HAVE_SYS_TYPES_H
+      #include <sys/types.h>
+      #endif
+      #ifdef HAVE_SYS_XATTR_H
+      #include <sys/xattr.h>
+      #elif HAVE_ATTR_XATTR_H
+      #include <attr/xattr.h>
+      #endif
+    ],
+    [ssize_t len = getxattr("", "", NULL, 0, 0, XATTR_NOFOLLOW);],
+    [
+      AC_DEFINE([HAVE_XATTR_NOFOLLOW], [1], [Define to 1 if xattr API uses XATTR_NOFOLLOW])
+      AC_MSG_RESULT([yes])
+    ],
+    [AC_MSG_RESULT([no])]
+    )
+  fi
+
+fi
+AC_SUBST(XATTR_LIBS)
+
 dnl ****************************************
 dnl *** platform dependent source checks ***
 dnl ****************************************
@@ -1820,7 +2069,7 @@ if test x"$have_threads" != xno; then
        # we are not doing the following for now, as this might require glib 
        # to always be linked with the thread libs on some platforms. 
        # LIBS="$LIBS $G_THREAD_LIBS"
-       AC_CHECK_FUNCS(localtime_r)
+       AC_CHECK_FUNCS(localtime_r gmtime_r)
        if test "$ac_cv_header_pwd_h" = "yes"; then
                AC_CACHE_CHECK([for posix getpwuid_r],
                        ac_cv_func_posix_getpwuid_r,
@@ -1860,6 +2109,45 @@ int main () {
                        fi
                fi
        fi
+       if test "$ac_cv_header_grp_h" = "yes"; then
+               AC_CACHE_CHECK([for posix getgrgid_r],
+                       ac_cv_func_posix_getgrgid_r,
+                       [AC_TRY_RUN([
+#include <errno.h>
+#include <grp.h>
+int main () { 
+    char buffer[10000];
+    struct group grp, *grpptr = &grp;
+    int error;
+    errno = 0;
+    error = getgrgid_r (0, &grp, buffer, 
+                        sizeof (buffer), &grpptr);
+   return (error < 0 && errno == ENOSYS) 
+          || error == ENOSYS; 
+}                              ],
+                              [ac_cv_func_posix_getgrgid_r=yes],
+                              [ac_cv_func_posix_getgrgid_r=no])])
+               GLIB_ASSERT_SET(ac_cv_func_posix_getgrgid_r)
+               if test "$ac_cv_func_posix_getgrgid_r" = yes; then
+                       AC_DEFINE(HAVE_POSIX_GETGRGID_R,1,
+                               [Have POSIX function getgrgid_r])
+               else
+                       AC_CACHE_CHECK([for nonposix getgrgid_r],
+                               ac_cv_func_nonposix_getgrgid_r,
+                               [AC_TRY_LINK([#include <grp.h>],
+                                               [char buffer[10000];
+                                       struct group grp;       
+                                       getgrgid_r (0, &grp, buffer, 
+                                               sizeof (buffer));],
+                               [ac_cv_func_nonposix_getgrgid_r=yes],
+                               [ac_cv_func_nonposix_getgrgid_r=no])])
+                       GLIB_ASSERT_SET(ac_cv_func_nonposix_getgrgid_r)
+                       if test "$ac_cv_func_nonposix_getgrgid_r" = yes; then
+                               AC_DEFINE(HAVE_NONPOSIX_GETGRGID_R,1,
+                                       [Have non-POSIX function getgrgid_r])
+                       fi
+               fi
+       fi
        LIBS="$G_THREAD_LIBS $LIBS"
        if test x"$have_threads" = xposix; then
                glib_save_CPPFLAGS="$CPPFLAGS"
@@ -2082,6 +2370,17 @@ if test x"$GCC" = xyes; then
       AC_DEFINE_UNQUOTED(G_ATOMIC_POWERPC, 1,
                         [powerpc atomic implementation])
       glib_memory_barrier_needed=yes
+      AC_MSG_CHECKING([whether asm supports numbered local labels])
+      AC_TRY_COMPILE(
+               ,[ 
+                       __asm__ __volatile__ ("1:       nop\n"
+                                             "         bne-    1b")
+               ],[
+                       AC_DEFINE_UNQUOTED(ASM_NUMERIC_LABELS, 1, [define if asm blocks can use numeric local labels])
+                       AC_MSG_RESULT([yes])
+               ],[
+                       AC_MSG_RESULT([no])
+               ])
       ;;       
     ia64)
       AC_MSG_RESULT([ia64])
@@ -2106,6 +2405,11 @@ if test x"$GCC" = xyes; then
       glib_memory_barrier_needed=yes
       ;;
   esac
+else
+  if test $glib_native_win32 = yes; then
+    # For Windows but not using gcc. No barriers needed then either.
+    glib_memory_barrier_needed=no
+  fi
 fi
 
 dnl ****************************************
@@ -2195,8 +2499,8 @@ if test x$enable_regex = xtrue; then
                       libpcre >= $PCRE_REQUIRED_VERSION)
     AC_CACHE_CHECK([for Unicode support in PCRE],glib_cv_pcre_has_unicode,[
                    glib_save_CFLAGS="$CFLAGS"
-                   glib_save_LDFLAGS="$LDFLAGS"
-                   CFLAGS="$CFLAGS $PCRE_CFLAGS" LDFLAGS="$LDFLAGS $PCRE_LIBS"
+                   glib_save_LIBS="$LIBS"
+                   CFLAGS="$CFLAGS $PCRE_CFLAGS" LIBS="$PCRE_LIBS"
                    AC_TRY_RUN([#include <pcre.h>
                                int main () {
                                  int support;
@@ -2212,7 +2516,7 @@ if test x$enable_regex = xtrue; then
                    glib_cv_pcre_has_unicode=no,
                    glib_cv_pcre_has_unicode=yes)
                    CFLAGS="$glib_save_CFLAGS"
-                   LDFLAGS="$glib_save_LDFLAGS"
+                   LIBS="$glib_save_LIBS"
        ])
     if test "$glib_cv_pcre_has_unicode" = "no"; then
       AC_MSG_ERROR([*** The system-supplied PCRE does not support Unicode properties or UTF-8.])
@@ -2284,7 +2588,7 @@ dnl **************************
 dnl *** Checks for gtk-doc ***
 dnl **************************
 
-GTK_DOC_CHECK([1.4])
+GTK_DOC_CHECK([1.8])
 
 AC_ARG_ENABLE(man,
               [AC_HELP_STRING([--enable-man],
@@ -2346,6 +2650,14 @@ _______EOF
        if test x$glib_sys_poll_h = xyes; then
          echo '#define GLIB_HAVE_SYS_POLL_H' >> $outfile
        fi
+       if test x$glib_included_printf != xyes; then
+          echo "
+/* Specifies that GLib's g_print*() functions wrap the
+ * system printf functions.  This is useful to know, for example,
+ * when using glibc's register_printf_function().
+ */" >> $outfile
+         echo '#define GLIB_USING_SYSTEM_PRINTF' >> $outfile
+       fi
 
        cat >> $outfile <<_______EOF
 
@@ -2453,6 +2765,9 @@ _______EOF
 
 #define GINT_TO_POINTER(i)     ((gpointer) ${glib_gpi_cast} (i))
 #define GUINT_TO_POINTER(u)    ((gpointer) ${glib_gpui_cast} (u))
+
+typedef signed $glib_intptr_type_define gintptr;
+typedef unsigned $glib_intptr_type_define guintptr;
 _______EOF
        else
          echo '#error SIZEOF_VOID_P unknown - This should never happen' >>$outfile
@@ -2465,6 +2780,7 @@ $glib_atexit
 $glib_memmove
 $glib_defines
 $glib_os
+$glib_static_compilation
 
 $glib_vacopy
 
@@ -2637,6 +2953,13 @@ _______EOF
 
 #define G_MODULE_SUFFIX "$g_module_suffix"
 
+/* A GPid is an abstraction for a process "handle". It is *not* an
+ * abstraction for a process identifier in general. GPid is used in
+ * GLib only for descendant processes spawned with the g_spawn*
+ * functions. On POSIX there is no "process handle" concept as such,
+ * but on Windows a GPid is a handle to a process, a kind of pointer,
+ * not a process identifier.
+ */
 typedef $g_pid_type GPid;
 
 G_END_DECLS
@@ -2696,6 +3019,10 @@ if test x$ac_cv_header_sys_poll_h = xyes ; then
   glib_sys_poll_h=yes
 fi
 
+if test x$enable_included_printf = xyes ; then
+  glib_included_printf=yes
+fi
+
 case 2 in
 $ac_cv_sizeof_short)           
   gint16=short
@@ -2773,11 +3100,11 @@ $ac_cv_sizeof___int64)
   ;;
 esac
 glib_size_t=$ac_cv_sizeof_size_t
-glib_size_type_define=$glib_size_type
-glib_void_p=$ac_cv_sizeof_long
-glib_long=$ac_cv_sizeof_void_p
+glib_size_type_define="$glib_size_type"
+glib_void_p=$ac_cv_sizeof_void_p
+glib_long=$ac_cv_sizeof_long
 
-case $glib_size_type in
+case "$glib_size_type" in
 short)
   gsize_modifier='"h"'
   gsize_format='"hu"'
@@ -2796,16 +3123,41 @@ long)
   gssize_format='"li"'
   glib_msize_type='LONG'
   ;;
+"long long"|__int64)
+  gsize_modifier='"I64"'
+  gsize_format='"I64u"'
+  gssize_format='"I64i"'
+  glib_msize_type='INT64'
+  ;;
 esac
 
 gintbits=`expr $ac_cv_sizeof_int \* 8`
 glongbits=`expr $ac_cv_sizeof_long \* 8`
 
-
 case $ac_cv_sizeof_void_p in
-$ac_cv_sizeof_int)     glib_gpi_cast=''        glib_gpui_cast=''         ;;
-$ac_cv_sizeof_long)    glib_gpi_cast='(glong)' glib_gpui_cast='(gulong)' ;;
-*)                     glib_unknown_void_p=yes ;;
+$ac_cv_sizeof_int)
+  glib_intptr_type_define=int
+  glib_gpi_cast=''
+  glib_gpui_cast=''
+  ;;
+$ac_cv_sizeof_long)
+  glib_intptr_type_define=long
+  glib_gpi_cast='(glong)'
+  glib_gpui_cast='(gulong)'
+  ;;
+$ac_cv_sizeof_long_long)
+  glib_intptr_type_define='long long'
+  glib_gpi_cast='(gint64)'
+  glib_gpui_cast='(guint64)'
+  ;;
+$ac_cv_sizeof___int64)
+  glib_intptr_type_define=__int64
+  glib_gpi_cast='(gint64)'
+  glib_gpui_cast='(guint64)'
+  ;;
+*)
+  glib_unknown_void_p=yes
+  ;;
 esac
 
 
@@ -2879,18 +3231,15 @@ 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)
+if test x$ac_cv_c_bigendian = xyes; then
   g_byte_order=G_BIG_ENDIAN
   g_bs_native=BE
   g_bs_alien=LE
-  ;;
-*)
+else
   g_byte_order=G_LITTLE_ENDIAN
   g_bs_native=LE
   g_bs_alien=BE
-  ;;
-esac
+fi
 
 g_pollin=$glib_cv_value_POLLIN
 g_pollout=$glib_cv_value_POLLOUT
@@ -2937,6 +3286,11 @@ case $host in
     glib_os="#define G_OS_UNIX"
     ;;
 esac
+glib_static_compilation=""
+if test x$glib_win32_static_compilation = xyes; then
+  glib_static_compilation="#define GLIB_STATIC_COMPILATION 1
+#define GOBJECT_STATIC_COMPILATION 1"
+fi
 ])
 
 AC_CONFIG_FILES([
@@ -2951,6 +3305,10 @@ gthread-2.0.pc
 gthread-2.0-uninstalled.pc
 gobject-2.0.pc
 gobject-2.0-uninstalled.pc
+gio-2.0.pc
+gio-unix-2.0.pc
+gio-2.0-uninstalled.pc
+gio-unix-2.0-uninstalled.pc
 glib-zip
 glib-gettextize
 Makefile
@@ -2963,11 +3321,20 @@ glib/libcharset/Makefile
 glib/gnulib/Makefile
 glib/pcre/Makefile
 glib/update-pcre/Makefile
+glib/tests/Makefile
 gmodule/Makefile
 gmodule/gmoduleconf.h
 gobject/Makefile
 gobject/glib-mkenums
+gobject/tests/Makefile
 gthread/Makefile
+gio/Makefile
+gio/xdgmime/Makefile
+gio/inotify/Makefile
+gio/fen/Makefile
+gio/fam/Makefile
+gio/win32/Makefile
+gio/tests/Makefile
 po/Makefile.in
 docs/Makefile
 docs/reference/Makefile
@@ -2975,6 +3342,8 @@ docs/reference/glib/Makefile
 docs/reference/glib/version.xml
 docs/reference/gobject/Makefile
 docs/reference/gobject/version.xml
+docs/reference/gio/Makefile
+docs/reference/gio/version.xml
 tests/Makefile
 tests/gobject/Makefile
 tests/refcount/Makefile