configure.ac
author ali <ali@juiblex.co.uk>
Fri Jan 27 10:30:16 2012 +0000 (2012-01-27)
changeset 5 f600b0d1fc5d
parent 4 218904410231
child 6 faab25d520dd
permissions -rw-r--r--
Rename to bookloupe
     1 #                                               -*- Autoconf -*-
     2 # Process this file with autoconf to produce a configure script.
     3 
     4 AC_INIT([bookloupe],[1.50],[ali@juiblex.co.uk])
     5 AC_PREREQ(2.59)
     6 AC_CONFIG_AUX_DIR([config])
     7 AC_CONFIG_SRCDIR([bookloupe/bookloupe.c])
     8 AC_CONFIG_FILES([Makefile
     9 bl/Makefile
    10 bookloupe/Makefile
    11 test/Makefile
    12 test/harness/Makefile
    13 test/compatibility/Makefile
    14 doc/Makefile
    15 ])
    16 AM_INIT_AUTOMAKE(no-define)
    17 AC_CANONICAL_HOST
    18 
    19 ##################################################
    20 # Checks for programs.
    21 ##################################################
    22 AC_PROG_CC
    23 LT_INIT
    24 # Libtool supports a --disable-shared option to tell it to avoid
    25 # building shared versions of libraries. We don't have any libraries
    26 # but we do want to support building static versions of our executables.
    27 # Libtool can do this (under the right circumstances) so we overload
    28 # this switch for this purpose.
    29 #
    30 # The libtool option that we use (-static-libtool-libs) means to use
    31 # static linking with libraries that supply a .la file and which
    32 # include a non-empty value for "old_library". If the library doesn't
    33 # include a .la file (they are deleted by some distributions), then
    34 # this option will have no effect and likewise if old_library is set
    35 # to '' (eg., if the library was build with --disable-static) then
    36 # again -static-libtool-libs will have no effect.
    37 #
    38 # If old_library is set to a non-empty value, then specifying
    39 # -static-libtool-libs will cause the link to fail if the old library
    40 # cannot be found (libtool will not fallback to a shared library
    41 # in these circumstances). This can happen with Fedora, for example,
    42 # if a main mingw32 library package is installed but not the
    43 # coresponding static sub-package. The solution is to either
    44 # install the relevant static sub-packages or don't use --disable-shared.
    45 AS_IF([test "$enable_shared" = no],[
    46   LDFLAGS="$LDFLAGS -static-libtool-libs"
    47 ])
    48 PKG_PROG_PKG_CONFIG
    49 
    50 ##################################################
    51 # Checks for header files.
    52 ##################################################
    53 
    54 ##################################################
    55 # Checks for typedefs, structures, and compiler characteristics.
    56 ##################################################
    57 
    58 ##################################################
    59 # Checks for libraries.
    60 ##################################################
    61 AC_MSG_CHECKING([whether to use glib])
    62 AC_ARG_WITH([glib],[AS_HELP_STRING([--without-glib],
    63   [use internal re-invented wheel rather than glib2])])
    64 AS_IF([test "$with_glib" != no],[
    65   AC_MSG_RESULT([yes])
    66   PKG_CHECK_MODULES([GLIB],[glib-2.0])
    67   AC_DEFINE([HAVE_GLIB],[1],[Define if you have glib version 2.x])
    68 ],[
    69   AC_MSG_RESULT([no])
    70 ])
    71 AM_CONDITIONAL([HAVE_GLIB],[test "$with_glib" != no])
    72 
    73 # NOTE: If we are using a static version of glib then we
    74 # should define GLIB_STATIC_COMPILATION. This isn't needed
    75 # when glib is built only for static use (in which case
    76 # glibconfig.h will already define GLIB_STATIC_COMPILATION).
    77 # It's not easy to tell if libtool will actually link with
    78 # a static glib but luckily we don't currently need to;
    79 # this pre-processor define only affects the behaviour of
    80 # libraries which use glib and we don't have any.
    81 
    82 # Glib 2.30 (at least) doesn't include "-framework Carbon" in Libs.private
    83 # which causes link to fail for static glib on Mac (gnome bug #668152).
    84 # Test for this problem and implement a workaround.
    85 AC_MSG_CHECKING([for Mac OS X Carbon support])
    86 AC_TRY_CPP([
    87 #include <Carbon/Carbon.h>
    88 #include <CoreServices/CoreServices.h>
    89 ],[have_carbon=yes],[have_carbon=no])
    90 AC_MSG_RESULT([$have_carbon])
    91 AS_IF([test "$have_glib" != no -a "$have_carbon" = yes],[
    92   AC_MSG_CHECKING([whether -framework Carbon is needed])
    93   save_CFLAGS="$CFLAGS"
    94   save_LIBS="$LIBS"
    95   CFLAGS="$GLIB_CFLAGS"
    96   LIBS="$GLIB_LIBS"
    97   AC_TRY_LINK([
    98   #include <glib.h>
    99   ],[
   100   return !g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP);
   101   ],[framework_carbon=no],[framework_carbon=yes])
   102   CFLAGS="$save_CFLAGS"
   103   LIBS="$save_LIBS"
   104   AC_MSG_RESULT([$framework_carbon])
   105   AS_IF([test "$framework_carbon" = yes],[
   106     GLIB_LIBS="$GLIB_LIBS -framework Carbon"
   107   ])
   108 ])
   109 
   110 ##################################################
   111 # Checks for library functions.
   112 ##################################################
   113 AC_CHECK_FUNCS_ONCE([mkstemp])
   114 
   115 ##################################################
   116 # Checks for processor independent files.
   117 ##################################################
   118 
   119 ##################################################
   120 # Generate the various configured files
   121 ##################################################
   122 AC_OUTPUT