diff -r faab25d520dd -r 6a13fe0fc19e configure.ac --- a/configure.ac Fri Jan 27 16:18:02 2012 +0000 +++ b/configure.ac Mon Jan 30 00:36:31 2012 +0000 @@ -45,6 +45,9 @@ AS_IF([test "$enable_shared" = no],[ LDFLAGS="$LDFLAGS -static-libtool-libs" ]) +LT_OUTPUT +ac_compile="./libtool --mode=compile --tag=CC $ac_compile" +ac_link="./libtool --mode=link --tag=CC $ac_link" PKG_PROG_PKG_CONFIG ################################################## @@ -60,15 +63,6 @@ ################################################## PKG_CHECK_MODULES([GLIB],[glib-2.0]) -# NOTE: If we are using a static version of glib then we -# should define GLIB_STATIC_COMPILATION. This isn't needed -# when glib is built only for static use (in which case -# glibconfig.h will already define GLIB_STATIC_COMPILATION). -# It's not easy to tell if libtool will actually link with -# a static glib but luckily we don't currently need to; -# this pre-processor define only affects the behaviour of -# libraries which use glib and we don't have any. - # Glib 2.30 (at least) doesn't include "-framework Carbon" in Libs.private # which causes link to fail for static glib on Mac (gnome bug #668152). # Test for this problem and implement a workaround. @@ -97,10 +91,39 @@ ]) ]) +# If we are using a static version of glib then we should define +# GLIB_STATIC_COMPILATION. This isn't needed when glib is built +# only for static use (in which case glibconfig.h will already +# define GLIB_STATIC_COMPILATION). +AS_IF([test "$enable_shared" = no],[ + AC_MSG_CHECKING([whether GLIB_STATIC_COMPILATION needs to be defined]) + save_CFLAGS="$CFLAGS" + save_LIBS="$LIBS" + CFLAGS="$GLIB_CFLAGS" + LIBS="$GLIB_LIBS" + AC_TRY_LINK([ + #include + ],[ + return glib_major_version!=2; + ],[static_compilation=no],[static_compilation=yes]) + CFLAGS="$save_CFLAGS" + LIBS="$save_LIBS" + AC_MSG_RESULT([$static_compilation]) + AS_IF([test "$static_compilation" = yes],[ + GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_STATIC_COMPILATION" + ]) +]) + ################################################## # Checks for library functions. ################################################## -AC_CHECK_FUNCS_ONCE([mkstemp]) +save_CFLAGS="$CFLAGS" +save_LIBS="$LIBS" +CFLAGS="$GLIB_CFLAGS" +LIBS="$GLIB_LIBS" +AC_CHECK_FUNCS([g_mkdtemp mkdtemp],[break]) +CFLAGS="$save_CFLAGS" +LIBS="$save_LIBS" ################################################## # Checks for processor independent files.