2 # Process this file with autoconf to produce a configure script.
4 AC_INIT([bookloupe],[1.52],[ali@juiblex.co.uk])
6 AC_CONFIG_AUX_DIR([config])
7 AC_CONFIG_SRCDIR([bookloupe/bookloupe.c])
8 AC_CONFIG_FILES([Makefile
13 test/compatibility/Makefile
16 AM_INIT_AUTOMAKE(no-define,1.11)
17 AM_SILENT_RULES([yes])
20 ##################################################
21 # Checks for programs.
22 ##################################################
25 # Libtool supports a --disable-shared option to tell it to avoid
26 # building shared versions of libraries. We don't have any libraries
27 # but we do want to support building static versions of our executables.
28 # Libtool can do this (under the right circumstances) so we overload
29 # this switch for this purpose.
31 # The libtool option that we use (-static-libtool-libs) means to use
32 # static linking with libraries that supply a .la file and which
33 # include a non-empty value for "old_library". If the library doesn't
34 # include a .la file (they are deleted by some distributions), then
35 # this option will have no effect and likewise if old_library is set
36 # to '' (eg., if the library was build with --disable-static) then
37 # again -static-libtool-libs will have no effect.
39 # If old_library is set to a non-empty value, then specifying
40 # -static-libtool-libs will cause the link to fail if the old library
41 # cannot be found (libtool will not fallback to a shared library
42 # in these circumstances). This can happen with Fedora, for example,
43 # if a main mingw32 library package is installed but not the
44 # coresponding static sub-package. The solution is to either
45 # install the relevant static sub-packages or don't use --disable-shared.
46 AS_IF([test "$enable_shared" = no],[
47 LDFLAGS="$LDFLAGS -static-libtool-libs"
50 ac_compile="./libtool --mode=compile --tag=CC $ac_compile"
51 ac_link="./libtool --mode=link --tag=CC $ac_link"
54 ##################################################
55 # Checks for header files.
56 ##################################################
58 ##################################################
59 # Checks for typedefs, structures, and compiler characteristics.
60 ##################################################
62 ##################################################
63 # Checks for libraries.
64 ##################################################
65 PKG_CHECK_MODULES([GLIB],[glib-2.0 >= 2.18])
67 # Glib 2.30 (at least) doesn't include "-framework Carbon" in Libs.private
68 # which causes link to fail for static glib on Mac (gnome bug #668152).
69 # Test for this problem and implement a workaround.
70 AC_MSG_CHECKING([for Mac OS X Carbon support])
72 #include <Carbon/Carbon.h>
73 #include <CoreServices/CoreServices.h>
74 ],[have_carbon=yes],[have_carbon=no])
75 AC_MSG_RESULT([$have_carbon])
76 AS_IF([test "$have_glib" != no -a "$have_carbon" = yes],[
77 AC_MSG_CHECKING([whether -framework Carbon is needed])
85 return !g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP);
86 ],[framework_carbon=no],[framework_carbon=yes])
89 AC_MSG_RESULT([$framework_carbon])
90 AS_IF([test "$framework_carbon" = yes],[
91 GLIB_LIBS="$GLIB_LIBS -framework Carbon"
95 # If we are using a static version of glib then we should define
96 # GLIB_STATIC_COMPILATION. This isn't needed when glib is built
97 # only for static use (in which case glibconfig.h will already
98 # define GLIB_STATIC_COMPILATION).
99 AS_IF([test "$enable_shared" = no],[
100 AC_MSG_CHECKING([whether GLIB_STATIC_COMPILATION needs to be defined])
101 save_CFLAGS="$CFLAGS"
103 CFLAGS="$GLIB_CFLAGS"
108 return glib_major_version!=2;
109 ],[static_compilation=no],[static_compilation=yes])
110 CFLAGS="$save_CFLAGS"
112 AC_MSG_RESULT([$static_compilation])
113 AS_IF([test "$static_compilation" = yes],[
114 GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_STATIC_COMPILATION"
118 ##################################################
119 # Checks for library functions.
120 ##################################################
121 save_CFLAGS="$CFLAGS"
123 CFLAGS="$GLIB_CFLAGS"
125 AC_CHECK_FUNCS([g_mkdtemp mkdtemp],[break])
126 CFLAGS="$save_CFLAGS"
129 ##################################################
130 # Checks for processor independent files.
131 ##################################################
133 ##################################################
134 # Generate the various configured files
135 ##################################################