dnl ***********************************
dnl *** include special GLib macros ***
dnl ***********************************
+
+define(glib_configure_in)
builtin(include, acglib.m4)dnl
builtin(include, glib/libcharset/codeset.m4)dnl
builtin(include, glib/libcharset/glibc21.m4)dnl
+builtin(include, m4macros/glib-gettext.m4)dnl
-# require autoconf 2.52
-AC_PREREQ(2.52)
+# require autoconf 2.53
+AC_PREREQ(2.53)
# Process this file with autoconf to produce a configure script.
AC_INIT(glib/glib.h)
#
GLIB_MAJOR_VERSION=2
GLIB_MINOR_VERSION=1
-GLIB_MICRO_VERSION=3
-GLIB_INTERFACE_AGE=0
+GLIB_MICRO_VERSION=5
+GLIB_INTERFACE_AGE=2
GLIB_BINARY_AGE=`expr 100 '*' $GLIB_MINOR_VERSION + $GLIB_MICRO_VERSION`
GLIB_VERSION=$GLIB_MAJOR_VERSION.$GLIB_MINOR_VERSION.$GLIB_MICRO_VERSION
])dnl
dnl gettext support
dnl
-ALL_LINGUAS="az be bg ca cs da de el es eu fr gl hi ja ko ms nl nn no pl pt pt_BR ro ru sk sl sq sv ta tr uk vi zh_CN zh_TW"
-AM_GLIB_GNU_GETTEXT
+ALL_LINGUAS="az be bg ca cs da de el es eu fi fr gl hi ja ko ms nl nn no pl pt pt_BR ro ru sk sl sq sv ta tr uk vi zh_CN zh_TW"
+GLIB_GNU_GETTEXT
-if test "$gt_cv_func_dgettext_libc" = "yes" || test "$gt_cv_func_dgettext_libintl" = "yes"; then
- :
-else
+if test "$gt_cv_have_gettext" != "yes" ; then
AC_MSG_ERROR([
*** You must have either have gettext support in your C library, or use the
*** GNU gettext library. (http://www.gnu.org/software/gettext/gettext.html
])
fi
-LIBS="$LIBS $INTLLIBS"
+LIBS="$INTLLIBS $LIBS"
GETTEXT_PACKAGE=glib20
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",
[Define the gettext package to be used])
-# 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",
- [Define the location where the catalogs will be installed])
-
-AC_CHECK_FUNCS(bind_textdomain_codeset)
+GLIB_DEFINE_LOCALEDIR(GLIB_LOCALE_DIR)
dnl
dnl Now we are done with gettext checks, figure out ICONV_LIBS
exit (b!=a);
}
],
- glib_cv_long_long_format=${format}
- break)
+ [glib_cv_long_long_format=${format}
+ break],
+ [],[:])
done])
if test -n "$glib_cv_long_long_format"; then
AC_MSG_RESULT(%${glib_cv_long_long_format}u)
AC_ARG_ENABLE(included-printf, [ --enable-included-printf use included printf [default=auto]], enable_trio="$enableval")
-if test "$enable_trio" != "no" ; then
- if test "$ac_cv_func_vsnprintf_c99" != "yes" ; then
- enable_trio=yes
- fi
- if test "$ac_cv_func_printf_unix98" != "yes" ; then
- enable_trio=yes
- fi
+need_trio=no
+if test "x$enable_trio" = "xyes" ; then
+ need_trio=yes
+fi
+if test "$ac_cv_func_vsnprintf_c99" != "yes" ; then
+ need_trio=yes
+fi
+if test "$ac_cv_func_printf_unix98" != "yes" ; then
+ need_trio=yes
+fi
+if test "x$ac_cv_sizeof_long_long" = "x8" &&
+ test -z "$glib_cv_long_long_format" ; then
+ need_trio=yes
+fi
+
+if test "x$enable_trio" = "xno" &&
+ test "x$need_trio" = "xyes" ; then
+ AC_MSG_ERROR([
+*** Your C library's printf doesn't appear to have the features that
+*** GLib needs, but you specified --enable-included-printf=no.])
fi
+enable_trio=$need_trio
+
AM_CONDITIONAL(HAVE_GOOD_PRINTF, test "$enable_trio" != "yes")
if test "$enable_trio" != "yes" ; then
AC_DEFINE(HAVE_GOOD_PRINTF,1,[define to use system printf])
else
+ glib_cv_long_long_format="ll"
AC_DEFINE(HAVE_VASPRINTF,1)
AC_DEFINE(HAVE_C99_VSNPRINTF,1)
AC_DEFINE(HAVE_UNIX98_PRINTF,1)
+ TRIO_LIBS=-lm
fi
+AC_SUBST(TRIO_LIBS)
# Check if bcopy can be used for overlapping copies, if memmove isn't found.
# The check is borrowed from the PERL Configure script.
}
return(0);
}],glib_cv_working_bcopy=yes,glib_cv_working_bcopy=no)])
+
+ GLIB_ASSERT_SET(glib_cv_working_bcopy)
if test "$glib_cv_working_bcopy" = "yes"; then
AC_DEFINE(HAVE_WORKING_BCOPY,1,[Have a working bcopy])
fi
dnl *** check for sane realloc() ***
AC_CACHE_CHECK([whether realloc (NULL,) will work],glib_cv_sane_realloc,[
- AC_TRY_RUN([
- #include <stdlib.h>
+ AC_TRY_RUN([#include <stdlib.h>
int main() {
return realloc (0, sizeof (int)) == 0;
}],
[glib_cv_sane_realloc=yes],
[glib_cv_sane_realloc=no],
- [])
+ [glib_cv_sane_realloc=yes])
])
if test x$glib_cv_sane_realloc = xyes; then
AC_DEFINE(REALLOC_0_WORKS,1,[whether realloc (NULL,) works])
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_TRY_RUN([
- #include <stdarg.h>
+ AC_LINK_IFELSE([#include <stdarg.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
return 0;
}],
[glib_cv_va_copy=yes],
- [glib_cv_va_copy=no],
- [])
+ [glib_cv_va_copy=no])
])
AC_CACHE_CHECK([for an implementation of __va_copy()],glib_cv___va_copy,[
- AC_TRY_RUN([
- #include <stdarg.h>
+ AC_LINK_IFELSE([#include <stdarg.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
return 0;
}],
[glib_cv___va_copy=yes],
- [glib_cv___va_copy=no],
- [])
+ [glib_cv___va_copy=no])
])
if test "x$glib_cv_va_copy" = "xyes"; then
fi
AC_CACHE_CHECK([whether va_lists can be copied by value],glib_cv_va_val_copy,[
- AC_TRY_RUN([
- #include <stdarg.h>
+ AC_TRY_RUN([#include <stdarg.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
}],
[glib_cv_va_val_copy=yes],
[glib_cv_va_val_copy=no],
- [])
+ [glib_cv_va_val_copy=yes])
])
if test "x$glib_cv_va_val_copy" = "xno"; then
if test "$G_MODULE_IMPL" = "G_MODULE_IMPL_DL"; then
LIBS_orig="$LIBS"
LDFLAGS_orig="$LDFLAGS"
- LIBS="$LIBS $G_MODULE_LIBS"
+ LIBS="$G_MODULE_LIBS $LIBS"
LDFLAGS="$LDFLAGS $G_MODULE_LDFLAGS"
dnl *** check for OSF1/5.0 RTLD_GLOBAL brokenness
AC_CACHE_CHECK([for RTLD_GLOBAL brokenness],
glib_cv_rtldglobal_broken,[
AC_TRY_RUN([
- #include <dlfcn.h>
- #ifndef RTLD_GLOBAL
- #define RTLD_GLOBAL 0
- #endif
- #ifndef RTLD_LAZY
- #define RTLD_LAZY 0
- #endif
- int pthread_create;
- int main () {
- void *handle, *global, *local;
- global = &pthread_create;
- handle = dlopen ("libpthread.so", RTLD_GLOBAL | RTLD_LAZY);
- if (!handle) return 0;
- local = dlsym (handle, "pthread_create");
- return global == local;
- }],
+#include <dlfcn.h>
+#ifndef RTLD_GLOBAL
+# define RTLD_GLOBAL 0
+#endif
+#ifndef RTLD_LAZY
+# define RTLD_LAZY 0
+#endif
+int pthread_create;
+int main () {
+ void *handle, *global, *local;
+ global = &pthread_create;
+ handle = dlopen ("libpthread.so", RTLD_GLOBAL | RTLD_LAZY);
+ if (!handle) return 0;
+ local = dlsym (handle, "pthread_create");
+ return global == local;
+} ],
[glib_cv_rtldglobal_broken=no],
[glib_cv_rtldglobal_broken=yes],
- [])
+ [glib_cv_rtldglobal_broken=no])
rm -f plugin.c plugin.o plugin.lo
])
if test "x$glib_cv_rtldglobal_broken" = "xyes"; then
dnl *** check whether we need preceeding underscores
AC_CACHE_CHECK([for preceeding underscore in symbols],
glib_cv_uscore,[
- AC_TRY_RUN([
- #include <dlfcn.h>
+ AC_TRY_RUN([#include <dlfcn.h>
int glib_underscore_test (void) { return 42; }
int main() {
void *f1 = (void*)0, *f2 = (void*)0, *handle;
[])
rm -f plugin.c plugin.$ac_objext plugin.lo
])
+ GLIB_ASSERT_SET(glib_cv_uscore)
if test "x$glib_cv_uscore" = "xyes"; then
G_MODULE_NEED_USCORE=1
else
G_THREAD_LIBS_EXTRA=
G_THREAD_CFLAGS=
+dnl
+dnl Test program for basic POSIX threads functionality
+dnl
+m4_define([glib_thread_test],[
+#include <pthread.h>
+int check_me = 0;
+void* func(void* data) {return check_me = 42;}
+main()
+ { pthread_t t;
+ void *ret;
+ pthread_create (&t, 0, func, 0);
+ pthread_join (t, &ret);
+ exit (check_me != 42 || ret != 42);
+}])
+
+dnl
+dnl Test program for sched_get_priority_min()
+dnl
+m4_define([glib_sched_priority_test],[
+#include <sched.h>
+#include <errno.h>
+int main() {
+ errno = 0;
+ return sched_get_priority_min(SCHED_OTHER)==-1
+ && errno != 0;
+}])
+
if test x"$have_threads" != xno; then
if test x"$have_threads" = xposix; then
for flag in pthread pthreads; do
glib_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -$flag"
- AC_TRY_RUN([#include <pthread.h>
- int check_me = 0;
- void* func(void* data) {return check_me = 42;}
- main()
- { pthread_t t;
- void *ret;
- pthread_create (&t, 0, func, 0);
- pthread_join (t, &ret);
- exit (check_me != 42 || ret != 42);
- }],
- [G_THREAD_CFLAGS=-$flag
- G_THREAD_LIBS=-$flag])
+ AC_TRY_RUN(glib_thread_test,
+ glib_flag_works=yes,
+ glib_flag_works=no,
+ [AC_LINK_IFELSE(glib_thread_test,
+ glib_flag_works=yes,
+ glib_flag_works=no)])
CFLAGS="$glib_save_CFLAGS"
+ if test $glib_flag_works = yes ; then
+ G_THREAD_CFLAGS=-$flag
+ G_THREAD_LIBS=-$flag
+ fi
done
fi
defattr=pthread_attr_default
fi
- LIBS="$glib_save_LIBS $add_thread_lib"
+ LIBS="$add_thread_lib $glib_save_LIBS"
AC_MSG_CHECKING(for pthread_create/pthread_join$IN)
- AC_TRY_RUN([#include <pthread.h>
- int check_me = 0;
- void* func(void* data) {check_me = 42;}
- main()
- { pthread_t t;
- void *ret;
- pthread_create (&t, $defattr, func, 0);
- pthread_join (t, &ret);
- exit (check_me != 42);
- }],
- [AC_MSG_RESULT(yes)
- G_THREAD_LIBS="$add_thread_lib"
- break],
- [AC_MSG_RESULT(no)])
+ AC_TRY_RUN(glib_thread_test,
+ glib_result=yes,
+ glib_result=no,
+ [AC_LINK_IFELSE(glib_thread_test,
+ glib_result=yes,
+ glib_result=no)])
+ AC_MSG_RESULT($glib_result)
+
+ if test "$glib_result" = "yes" ; then
+ G_THREAD_LIBS="$add_thread_lib"
+ break
+ fi
done
if test "x$G_THREAD_LIBS" = xerror; then
AC_MSG_ERROR($LIBS_NOT_FOUND_1$have_threads$LIBS_NOT_FOUND_2)
add_thread_lib="-l$thread_lib"
IN=" in -l$thread_lib"
fi
- LIBS="$glib_save_LIBS $add_thread_lib"
-
+ LIBS="$add_thread_lib $glib_save_LIBS"
+
AC_MSG_CHECKING(for sched_get_priority_min$IN)
- AC_TRY_RUN([#include <sched.h>
- #include <errno.h>
- int main() {
- errno = 0;
- return sched_get_priority_min(SCHED_OTHER)==-1
- && errno != 0;}],
- [AC_MSG_RESULT(yes)
- G_THREAD_LIBS="$G_THREAD_LIBS $add_thread_lib"
- posix_priority_min="sched_get_priority_min(SCHED_OTHER)"
- posix_priority_max="sched_get_priority_max(SCHED_OTHER)"
- break],
- [AC_MSG_RESULT(no)])
+ AC_TRY_RUN(glib_sched_priority_test,
+ glib_result=yes,
+ glib_result=no,
+ [AC_LINK_IFELSE(glib_sched_priority_test,
+ glib_result=yes,
+ glib_result=no)])
+ AC_MSG_RESULT($glib_result)
+
+ if test "$glib_result" = "yes" ; then
+ G_THREAD_LIBS="$G_THREAD_LIBS $add_thread_lib"
+ posix_priority_min="sched_get_priority_min(SCHED_OTHER)"
+ posix_priority_max="sched_get_priority_max(SCHED_OTHER)"
+ break
+ fi
done
LIBS="$glib_save_LIBS"
mutex_has_default=yes
if test "$ac_cv_header_pwd_h" = "yes"; then
AC_CACHE_CHECK([for posix getpwuid_r],
ac_cv_func_posix_getpwuid_r,
- [AC_TRY_RUN([#include <errno.h>
- #include <pwd.h>
- int main () { char buffer[10000];
- struct passwd pwd, *pwptr = &pwd;
- int error;
- errno = 0;
- error = getpwuid_r (0, &pwd, buffer,
- sizeof (buffer), &pwptr);
- return (error < 0 && errno == ENOSYS)
- || error == ENOSYS; }],
+ [AC_TRY_RUN([
+#include <errno.h>
+#include <pwd.h>
+int main () {
+ char buffer[10000];
+ struct passwd pwd, *pwptr = &pwd;
+ int error;
+ errno = 0;
+ error = getpwuid_r (0, &pwd, buffer,
+ sizeof (buffer), &pwptr);
+ return (error < 0 && errno == ENOSYS)
+ || error == ENOSYS;
+} ],
[ac_cv_func_posix_getpwuid_r=yes],
[ac_cv_func_posix_getpwuid_r=no])])
+ GLIB_ASSERT_SET(ac_cv_func_posix_getpwuid_r)
if test "$ac_cv_func_posix_getpwuid_r" = yes; then
AC_DEFINE(HAVE_POSIX_GETPWUID_R,1,
[Have POSIX function getpwuid_r])
sizeof (buffer));],
[ac_cv_func_nonposix_getpwuid_r=yes],
[ac_cv_func_nonposix_getpwuid_r=no])])
+ GLIB_ASSERT_SET(ac_cv_func_nonposix_getpwuid_r)
if test "$ac_cv_func_nonposix_getpwuid_r" = yes; then
AC_DEFINE(HAVE_NONPOSIX_GETPWUID_R,1,
[Have non-POSIX function getpwuid_r])
fi
fi
fi
- LIBS="$LIBS $G_THREAD_LIBS"
+ LIBS="$G_THREAD_LIBS $LIBS"
if test x"$have_threads" = xposix; then
glib_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES"
AC_DEFINE_UNQUOTED(POSIX_YIELD_FUNC,$posix_yield_func,[The POSIX RT yield function])
CPPFLAGS="$glib_save_CPPFLAGS"
- AC_MSG_CHECKING(whether to use the PID niceness surrogate for thread priorities)
- AC_TRY_RUN([#include <pthread.h>
- #include <sys/types.h>
- #include <unistd.h>
- pid_t other_pid = 0;
-
- void* func(void* data) {other_pid = getpid();}
- main()
- { pthread_t t;
- void *ret;
- pthread_create (&t, $defattr, func, NULL);
- pthread_join (t, &ret);
- exit (getpid()==other_pid ||
- $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])
- ],
- [AC_MSG_RESULT(no)])
+ AC_CACHE_CHECK([whether to use the PID niceness surrogate for thread priorities],
+ glib_cv_use_pid_surrogate,
+ [AC_TRY_RUN([
+#include <pthread.h>
+#include <sys/types.h>
+#include <unistd.h>
+pid_t other_pid = 0;
+
+void* func(void* data) {other_pid = getpid();}
+main()
+{ pthread_t t;
+ void *ret;
+ pthread_create (&t, 0, func, NULL);
+ pthread_join (t, &ret);
+ exit (getpid()==other_pid ||
+ $posix_priority_min != $posix_priority_max);
+} ],
+ [glib_cv_use_pid_surrogate=yes],
+ [glib_cv_use_pid_surrogate=no],
+ [])])
+ GLIB_ASSERT_SET(glib_cv_use_pid_surrogate)
+ if test "$glib_cv_use_pid_surrogate" = "yes" ; then
+ AC_DEFINE(G_THREAD_USE_PID_SURROGATE, 1,
+ [whether to use the PID niceness surrogate for thread priorities])
+ fi
+
elif test x"$have_threads" = xwin32; then
# It's a pointer to a private struct
GLIB_SIZEOF(,struct _GThreadData *, system_thread)
GLIB_SIZEOF(,void *, system_thread)
fi
+#
+# Hack to deal with:
+#
+# a) GCC < 3.3 for Linux doesn't include -lpthread when
+# building shared libraries with linux.
+# b) libtool doesn't recognize -pthread as a library dependency.
+#
+case $host in
+ *-*-linux*)
+ G_THREAD_LIBS_FOR_GTHREAD="`echo $G_THREAD_LIBS | sed s/-pthread/-lpthread/`"
+ ;;
+ *)
+ G_THREAD_LIBS_FOR_GTHREAD="`echo $G_THREAD_LIBS | sed s/-pthread/-Wc,-pthread/`"
+ ;;
+esac
+
AC_DEFINE_UNQUOTED(G_THREAD_SOURCE,"gthread-$have_threads.c",
[Source file containing theread implementation])
AC_SUBST(G_THREAD_CFLAGS)
AC_SUBST(G_THREAD_LIBS)
+AC_SUBST(G_THREAD_LIBS_FOR_GTHREAD)
AC_SUBST(G_THREAD_LIBS_EXTRA)
dnl **********************************************
if test $mutex_has_default = yes ; then
glib_save_CPPFLAGS="$CPPFLAGS"
glib_save_LIBS="$LIBS"
- LIBS="$LIBS $G_THREAD_LIBS"
+ LIBS="$G_THREAD_LIBS $LIBS"
CPPFLAGS="$CPPFLAGS $GTHREAD_COMPILE_IMPL_DEFINES"
GLIB_SIZEOF([#include <$mutex_header_file>],
$mutex_default_type,
docs/reference/gobject/version.xml
tests/Makefile
m4macros/Makefile
+],[
+chmod 0755 glib-zip
+chmod 0755 glib-gettextize
+chmod 0755 gobject/glib-mkenums
])