configure.ac
author ali <ali@juiblex.co.uk>
Mon Feb 20 10:10:48 2012 +0000 (2012-02-20)
changeset 37 037942e1bc4f
parent 14 3c57a6fd0a13
child 69 1016349e619f
permissions -rw-r--r--
Add end of word scannos to testcase
     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 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 LT_OUTPUT
    49 ac_compile="./libtool --mode=compile --tag=CC $ac_compile"
    50 ac_link="./libtool --mode=link --tag=CC $ac_link"
    51 PKG_PROG_PKG_CONFIG
    52 
    53 ##################################################
    54 # Checks for header files.
    55 ##################################################
    56 
    57 ##################################################
    58 # Checks for typedefs, structures, and compiler characteristics.
    59 ##################################################
    60 
    61 ##################################################
    62 # Checks for libraries.
    63 ##################################################
    64 PKG_CHECK_MODULES([GLIB],[glib-2.0 >= 2.18])
    65 
    66 # Glib 2.30 (at least) doesn't include "-framework Carbon" in Libs.private
    67 # which causes link to fail for static glib on Mac (gnome bug #668152).
    68 # Test for this problem and implement a workaround.
    69 AC_MSG_CHECKING([for Mac OS X Carbon support])
    70 AC_TRY_CPP([
    71 #include <Carbon/Carbon.h>
    72 #include <CoreServices/CoreServices.h>
    73 ],[have_carbon=yes],[have_carbon=no])
    74 AC_MSG_RESULT([$have_carbon])
    75 AS_IF([test "$have_glib" != no -a "$have_carbon" = yes],[
    76   AC_MSG_CHECKING([whether -framework Carbon is needed])
    77   save_CFLAGS="$CFLAGS"
    78   save_LIBS="$LIBS"
    79   CFLAGS="$GLIB_CFLAGS"
    80   LIBS="$GLIB_LIBS"
    81   AC_TRY_LINK([
    82   #include <glib.h>
    83   ],[
    84   return !g_get_user_special_dir(G_USER_DIRECTORY_DESKTOP);
    85   ],[framework_carbon=no],[framework_carbon=yes])
    86   CFLAGS="$save_CFLAGS"
    87   LIBS="$save_LIBS"
    88   AC_MSG_RESULT([$framework_carbon])
    89   AS_IF([test "$framework_carbon" = yes],[
    90     GLIB_LIBS="$GLIB_LIBS -framework Carbon"
    91   ])
    92 ])
    93 
    94 # If we are using a static version of glib then we should define
    95 # GLIB_STATIC_COMPILATION. This isn't needed when glib is built
    96 # only for static use (in which case glibconfig.h will already
    97 # define GLIB_STATIC_COMPILATION).
    98 AS_IF([test "$enable_shared" = no],[
    99   AC_MSG_CHECKING([whether GLIB_STATIC_COMPILATION needs to be defined])
   100   save_CFLAGS="$CFLAGS"
   101   save_LIBS="$LIBS"
   102   CFLAGS="$GLIB_CFLAGS"
   103   LIBS="$GLIB_LIBS"
   104   AC_TRY_LINK([
   105   #include <glib.h>
   106   ],[
   107   return glib_major_version!=2;
   108   ],[static_compilation=no],[static_compilation=yes])
   109   CFLAGS="$save_CFLAGS"
   110   LIBS="$save_LIBS"
   111   AC_MSG_RESULT([$static_compilation])
   112   AS_IF([test "$static_compilation" = yes],[
   113     GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_STATIC_COMPILATION"
   114   ])
   115 ])
   116 
   117 ##################################################
   118 # Checks for library functions.
   119 ##################################################
   120 save_CFLAGS="$CFLAGS"
   121 save_LIBS="$LIBS"
   122 CFLAGS="$GLIB_CFLAGS"
   123 LIBS="$GLIB_LIBS"
   124 AC_CHECK_FUNCS([g_mkdtemp mkdtemp],[break])
   125 CFLAGS="$save_CFLAGS"
   126 LIBS="$save_LIBS"
   127 
   128 ##################################################
   129 # Checks for processor independent files.
   130 ##################################################
   131 
   132 ##################################################
   133 # Generate the various configured files
   134 ##################################################
   135 AC_OUTPUT