configure.ac
author ali <ali@juiblex.co.uk>
Thu May 30 18:33:44 2013 +0100 (2013-05-30)
changeset 72 52d4a7f926b4
parent 71 82d3cc398b54
child 74 411867e8e20b
permissions -rw-r--r--
Support WINDOWS-1252 characters encoded as UTF-8
     1 #                                               -*- Autoconf -*-
     2 # Process this file with autoconf to produce a configure script.
     3 
     4 AC_INIT([bookloupe],[1.52],[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 test/bookloupe/Makefile
    15 doc/Makefile
    16 ])
    17 AM_INIT_AUTOMAKE([no-define 1.11])
    18 AM_SILENT_RULES([yes])
    19 AC_CANONICAL_HOST
    20 
    21 ##################################################
    22 # Checks for programs.
    23 ##################################################
    24 AC_PROG_CC
    25 LT_INIT
    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.
    31 #
    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.
    39 #
    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"
    49 ])
    50 LT_OUTPUT
    51 ac_compile="./libtool --mode=compile --tag=CC $ac_compile"
    52 ac_link="./libtool --mode=link --tag=CC $ac_link"
    53 PKG_PROG_PKG_CONFIG
    54 
    55 ##################################################
    56 # Checks for header files.
    57 ##################################################
    58 
    59 ##################################################
    60 # Checks for typedefs, structures, and compiler characteristics.
    61 ##################################################
    62 
    63 ##################################################
    64 # Checks for libraries.
    65 ##################################################
    66 PKG_CHECK_MODULES([GLIB],[glib-2.0 >= 2.18])
    67 
    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])
    72 AC_TRY_CPP([
    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])
    79   save_CFLAGS="$CFLAGS"
    80   save_LIBS="$LIBS"
    81   CFLAGS="$GLIB_CFLAGS"
    82   LIBS="$GLIB_LIBS"
    83   AC_TRY_LINK([
    84   #include <glib.h>
    85   ],[
    86   return !g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP);
    87   ],[framework_carbon=no],[framework_carbon=yes])
    88   CFLAGS="$save_CFLAGS"
    89   LIBS="$save_LIBS"
    90   AC_MSG_RESULT([$framework_carbon])
    91   AS_IF([test "$framework_carbon" = yes],[
    92     GLIB_LIBS="$GLIB_LIBS -framework Carbon"
    93   ])
    94 ])
    95 
    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"
   103   save_LIBS="$LIBS"
   104   CFLAGS="$GLIB_CFLAGS"
   105   LIBS="$GLIB_LIBS"
   106   AC_TRY_LINK([
   107   #include <glib.h>
   108   ],[
   109   return glib_major_version!=2;
   110   ],[static_compilation=no],[static_compilation=yes])
   111   CFLAGS="$save_CFLAGS"
   112   LIBS="$save_LIBS"
   113   AC_MSG_RESULT([$static_compilation])
   114   AS_IF([test "$static_compilation" = yes],[
   115     GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_STATIC_COMPILATION"
   116   ])
   117 ])
   118 
   119 ##################################################
   120 # Checks for library functions.
   121 ##################################################
   122 save_CFLAGS="$CFLAGS"
   123 save_LIBS="$LIBS"
   124 CFLAGS="$GLIB_CFLAGS"
   125 LIBS="$GLIB_LIBS"
   126 AC_CHECK_FUNCS([g_mkdtemp mkdtemp],[break])
   127 CFLAGS="$save_CFLAGS"
   128 LIBS="$save_LIBS"
   129 
   130 ##################################################
   131 # Checks for processor independent files.
   132 ##################################################
   133 
   134 ##################################################
   135 # Generate the various configured files
   136 ##################################################
   137 AC_OUTPUT