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
14 test/bookloupe/Makefile
17 AM_INIT_AUTOMAKE([no-define 1.11])
18 AM_SILENT_RULES([yes])
21 ##################################################
22 # Checks for programs.
23 ##################################################
26 # Libtool supports a --disable-shared option to tell it to avoid
27 # building shared versions of libraries. We don't have any libraries
28 # but we do want to support building static versions of our executables.
29 # Libtool can do this (under the right circumstances) so we overload
30 # this switch for this purpose.
32 # The libtool option that we use (-static-libtool-libs) means to use
33 # static linking with libraries that supply a .la file and which
34 # include a non-empty value for "old_library". If the library doesn't
35 # include a .la file (they are deleted by some distributions), then
36 # this option will have no effect and likewise if old_library is set
37 # to '' (eg., if the library was build with --disable-static) then
38 # again -static-libtool-libs will have no effect.
40 # If old_library is set to a non-empty value, then specifying
41 # -static-libtool-libs will cause the link to fail if the old library
42 # cannot be found (libtool will not fallback to a shared library
43 # in these circumstances). This can happen with Fedora, for example,
44 # if a main mingw32 library package is installed but not the
45 # coresponding static sub-package. The solution is to either
46 # install the relevant static sub-packages or don't use --disable-shared.
47 AS_IF([test "$enable_shared" = no],[
48 LDFLAGS="$LDFLAGS -static-libtool-libs"
51 ac_compile="./libtool --mode=compile --tag=CC $ac_compile"
52 ac_link="./libtool --mode=link --tag=CC $ac_link"
55 ##################################################
56 # Checks for header files.
57 ##################################################
59 ##################################################
60 # Checks for typedefs, structures, and compiler characteristics.
61 ##################################################
63 ##################################################
64 # Checks for libraries.
65 ##################################################
66 PKG_CHECK_MODULES([GLIB],[glib-2.0 >= 2.18])
68 # Glib 2.30 (at least) doesn't include "-framework Carbon" in Libs.private
69 # which causes link to fail for static glib on Mac (gnome bug #668152).
70 # Test for this problem and implement a workaround.
71 AC_MSG_CHECKING([for Mac OS X Carbon support])
73 #include <Carbon/Carbon.h>
74 #include <CoreServices/CoreServices.h>
75 ],[have_carbon=yes],[have_carbon=no])
76 AC_MSG_RESULT([$have_carbon])
77 AS_IF([test "$have_glib" != no -a "$have_carbon" = yes],[
78 AC_MSG_CHECKING([whether -framework Carbon is needed])
86 return !g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP);
87 ],[framework_carbon=no],[framework_carbon=yes])
90 AC_MSG_RESULT([$framework_carbon])
91 AS_IF([test "$framework_carbon" = yes],[
92 GLIB_LIBS="$GLIB_LIBS -framework Carbon"
96 # If we are using a static version of glib then we should define
97 # GLIB_STATIC_COMPILATION. This isn't needed when glib is built
98 # only for static use (in which case glibconfig.h will already
99 # define GLIB_STATIC_COMPILATION).
100 AS_IF([test "$enable_shared" = no],[
101 AC_MSG_CHECKING([whether GLIB_STATIC_COMPILATION needs to be defined])
102 save_CFLAGS="$CFLAGS"
104 CFLAGS="$GLIB_CFLAGS"
109 return glib_major_version!=2;
110 ],[static_compilation=no],[static_compilation=yes])
111 CFLAGS="$save_CFLAGS"
113 AC_MSG_RESULT([$static_compilation])
114 AS_IF([test "$static_compilation" = yes],[
115 GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_STATIC_COMPILATION"
119 ##################################################
120 # Checks for library functions.
121 ##################################################
122 save_CFLAGS="$CFLAGS"
124 CFLAGS="$GLIB_CFLAGS"
126 AC_CHECK_FUNCS([g_mkdtemp mkdtemp],[break])
127 CFLAGS="$save_CFLAGS"
130 ##################################################
131 # Checks for processor independent files.
132 ##################################################
134 ##################################################
135 # Generate the various configured files
136 ##################################################