configure.ac
changeset 9 6a13fe0fc19e
parent 6 faab25d520dd
child 10 f28ad4577863
     1.1 --- a/configure.ac	Fri Jan 27 16:18:02 2012 +0000
     1.2 +++ b/configure.ac	Mon Jan 30 00:36:31 2012 +0000
     1.3 @@ -45,6 +45,9 @@
     1.4  AS_IF([test "$enable_shared" = no],[
     1.5    LDFLAGS="$LDFLAGS -static-libtool-libs"
     1.6  ])
     1.7 +LT_OUTPUT
     1.8 +ac_compile="./libtool --mode=compile --tag=CC $ac_compile"
     1.9 +ac_link="./libtool --mode=link --tag=CC $ac_link"
    1.10  PKG_PROG_PKG_CONFIG
    1.11  
    1.12  ##################################################
    1.13 @@ -60,15 +63,6 @@
    1.14  ##################################################
    1.15  PKG_CHECK_MODULES([GLIB],[glib-2.0])
    1.16  
    1.17 -# NOTE: If we are using a static version of glib then we
    1.18 -# should define GLIB_STATIC_COMPILATION. This isn't needed
    1.19 -# when glib is built only for static use (in which case
    1.20 -# glibconfig.h will already define GLIB_STATIC_COMPILATION).
    1.21 -# It's not easy to tell if libtool will actually link with
    1.22 -# a static glib but luckily we don't currently need to;
    1.23 -# this pre-processor define only affects the behaviour of
    1.24 -# libraries which use glib and we don't have any.
    1.25 -
    1.26  # Glib 2.30 (at least) doesn't include "-framework Carbon" in Libs.private
    1.27  # which causes link to fail for static glib on Mac (gnome bug #668152).
    1.28  # Test for this problem and implement a workaround.
    1.29 @@ -97,10 +91,39 @@
    1.30    ])
    1.31  ])
    1.32  
    1.33 +# If we are using a static version of glib then we should define
    1.34 +# GLIB_STATIC_COMPILATION. This isn't needed when glib is built
    1.35 +# only for static use (in which case glibconfig.h will already
    1.36 +# define GLIB_STATIC_COMPILATION).
    1.37 +AS_IF([test "$enable_shared" = no],[
    1.38 +  AC_MSG_CHECKING([whether GLIB_STATIC_COMPILATION needs to be defined])
    1.39 +  save_CFLAGS="$CFLAGS"
    1.40 +  save_LIBS="$LIBS"
    1.41 +  CFLAGS="$GLIB_CFLAGS"
    1.42 +  LIBS="$GLIB_LIBS"
    1.43 +  AC_TRY_LINK([
    1.44 +  #include <glib.h>
    1.45 +  ],[
    1.46 +  return glib_major_version!=2;
    1.47 +  ],[static_compilation=no],[static_compilation=yes])
    1.48 +  CFLAGS="$save_CFLAGS"
    1.49 +  LIBS="$save_LIBS"
    1.50 +  AC_MSG_RESULT([$static_compilation])
    1.51 +  AS_IF([test "$static_compilation" = yes],[
    1.52 +    GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_STATIC_COMPILATION"
    1.53 +  ])
    1.54 +])
    1.55 +
    1.56  ##################################################
    1.57  # Checks for library functions.
    1.58  ##################################################
    1.59 -AC_CHECK_FUNCS_ONCE([mkstemp])
    1.60 +save_CFLAGS="$CFLAGS"
    1.61 +save_LIBS="$LIBS"
    1.62 +CFLAGS="$GLIB_CFLAGS"
    1.63 +LIBS="$GLIB_LIBS"
    1.64 +AC_CHECK_FUNCS([g_mkdtemp mkdtemp],[break])
    1.65 +CFLAGS="$save_CFLAGS"
    1.66 +LIBS="$save_LIBS"
    1.67  
    1.68  ##################################################
    1.69  # Checks for processor independent files.