configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Sat Aug 23 11:13:48 2014 +0100 (2014-08-23)
changeset 440 48204dea0b9f
parent 434 2c25dc58c6d2
child 442 c4bcba8023a9
permissions -rw-r--r--
Remove INTLLIBS from librazor_la_LIBADD.

This partially reverts 611c84a3f4b4538a65d186050608c17adbf17770.
It's not clear what motivated the initial inclusion of INTLLIBS
here since the net effect is only seen in librazor.la and not
in razor.pc and librazor.la is not normally packaged. Certainly
neither the static nor the dynamic versions of librazor currently
use libintl. At best this would cause the linker to search a
static libintl for undefined symbols without finding any; at worse
it causes a static build of plover using librazor.la to fail if
no static version of libintl is installed.
     1 dnl Process this file with autoconf to produce a configure script.
     2 
     3 AC_PREREQ(2.59c)
     4 AC_INIT([razor], [0.5.7], [ali@juiblex.co.uk])
     5 AM_INIT_AUTOMAKE([])
     6 AM_CONFIG_HEADER([config.h])
     7 AM_MAINTAINER_MODE
     8 
     9 # libtool versioning - this applies to all libraries in this package
    10 #
    11 # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
    12 #
    13 LT_CURRENT=4
    14 LT_REVISION=0
    15 LT_AGE=0
    16 AC_SUBST(LT_CURRENT)
    17 AC_SUBST(LT_REVISION)
    18 AC_SUBST(LT_AGE)
    19 
    20 AC_ISC_POSIX
    21 AC_PROG_CC
    22 gl_EARLY
    23 AM_PROG_CC_STDC
    24 AC_HEADER_STDC
    25 AC_HEADER_SYS_WAIT
    26 AC_CHECK_HEADERS([sys/mman.h])
    27 gl_INIT
    28 AC_CHECK_FUNCS([symlink chroot])
    29 LT_INIT([win32-dll])
    30 # Libtool supports a --disable-shared option to tell it to avoid
    31 # building shared versions of libraries. In addition to this,we want
    32 # to support building static versions of our executables. Libtool
    33 # can do this (under the right circumstances) so we overload this
    34 # switch for this purpose.
    35 #
    36 # The libtool option that we use (-static-libtool-libs) means to use
    37 # static linking with libraries that supply a .la file and which
    38 # include a non-empty value for "old_library". If the library doesn't
    39 # include a .la file (they are deleted by some distributions), then
    40 # this option will have no effect and likewise if old_library is set
    41 # to '' (eg., if the library was build with --disable-static) then
    42 # again -static-libtool-libs will have no effect.
    43 #
    44 # If old_library is set to a non-empty value, then specifying
    45 # -static-libtool-libs will cause the link to fail if the old library
    46 # cannot be found (libtool will not fallback to a shared library
    47 # in these circumstances). This can happen with Fedora, for example,
    48 # if a main mingw32 library package is installed but not the
    49 # coresponding static sub-package. The solution is to either
    50 # install the relevant static sub-packages or don't use --disable-shared.
    51 AS_IF([test "$enable_shared" = no],[
    52   LDFLAGS="$LDFLAGS -static-libtool-libs"
    53 ])
    54 LT_OUTPUT
    55 ac_compile="./libtool --mode=compile --tag=CC $ac_compile"
    56 ac_link="./libtool --mode=link --tag=CC $ac_link"
    57 AC_PROG_MAKE_SET
    58 AC_PROG_LN_S
    59 AC_SYS_LARGEFILE
    60 AM_PROG_CC_C_O
    61 
    62 AC_ARG_ENABLE([atomic],
    63 	      [AS_HELP_STRING([--disable-atomic],
    64 	      		      [disable atomic transactions])],
    65 	      [],
    66 	      [enable_atomic=yes])
    67 if test "$enable_atomic" = "yes"; then
    68     AC_DEFINE([ENABLE_ATOMIC],[1],[Define if atomic transactions are wanted.])
    69 fi
    70 
    71 AC_MSG_CHECKING([for Microsoft Windows native API])
    72 case $host_os in
    73     *mingw*)	AC_DEFINE([MSWIN_API], 1,
    74 		  [Define to 1 to use Microsoft Windows native API.])
    75 		EXTRA_LIBS='-lshell32 -lws2_32'
    76 		mswin_api=yes;;
    77     *)		mswin_api=no;;
    78 esac
    79 AC_MSG_RESULT([$mswin_api])
    80 AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
    81 AC_SUBST(EXTRA_LIBS)
    82 
    83 if test "$enable_atomic" = "yes" -a "$mswin_api" = "yes"; then
    84     AC_MSG_CHECKING([for Microsoft Windows Kernel Transaction Manager])
    85     save_LIBS="$LIBS"
    86     LIBS="-lktmw32 $LIBS"
    87     AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
    88 #include <windows.h>
    89 #include <ktmw32.h>
    90 ], [(void)CreateTransaction(NULL,0,0,0,0,0,NULL);])],
    91       [have_windows_ktm="yes"; EXTRA_LIBS="-lktmw32 $EXTRA_LIBS"],
    92       [have_windows_ktm="no"])
    93     LIBS="$save_LIBS"
    94     AC_MSG_RESULT([$have_windows_ktm])
    95 else
    96     have_windows_ktm="no"
    97 fi
    98 if test "$have_windows_ktm" = "yes"; then
    99     AC_DEFINE([HAVE_WINDOWS_KTM],[1],[Define if Windows KTM is available.])
   100 fi
   101 
   102 # Taken from dbus
   103 AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
   104 AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
   105 
   106 if test "${enable_verbose_mode}" != no; then
   107     # To get -rdynamic you pass -export-dynamic to libtool.
   108     AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
   109     R_DYNAMIC_LDFLAG=-export-dynamic
   110 else
   111     R_DYNAMIC_LDFLAG=
   112 fi
   113 AC_SUBST(R_DYNAMIC_LDFLAG)
   114 
   115 #### gcc warning flags
   116 
   117 if test "x$GCC" = "xyes"; then
   118   changequote(,)dnl
   119   case " $CFLAGS " in
   120   *[\ \	]-Wall[\ \	]*) ;;
   121   *) CFLAGS="$CFLAGS -Wall" ;;
   122   esac
   123 
   124   case " $CFLAGS " in
   125   *[\ \	]-Wchar-subscripts[\ \	]*) ;;
   126   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
   127   esac
   128 
   129   case " $CFLAGS " in
   130   *[\ \	]-Wmissing-declarations[\ \	]*) ;;
   131   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
   132   esac
   133 
   134   case " $CFLAGS " in
   135   *[\ \	]-Wnested-externs[\ \	]*) ;;
   136   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
   137   esac
   138 
   139   case " $CFLAGS " in
   140   *[\ \	]-Wcast-align[\ \	]*) ;;
   141   *) CFLAGS="$CFLAGS -Wcast-align" ;;
   142   esac
   143 
   144   case " $CFLAGS " in
   145   *[\ \	]-Wformat[\ \	]*) ;;
   146   *) CFLAGS="$CFLAGS -Wformat" ;;
   147   esac
   148 
   149   case " $CFLAGS " in
   150   *[\ \	]-Wformat-security[\ \	]*) ;;
   151   *) CFLAGS="$CFLAGS -Wformat-security" ;;
   152   esac
   153 
   154   if test "x$enable_ansi" = "xyes"; then
   155     case " $CFLAGS " in
   156     *[\ \	]-ansi[\ \	]*) ;;
   157     *) CFLAGS="$CFLAGS -ansi" ;;
   158     esac
   159 
   160     case " $CFLAGS " in
   161     *[\ \	]-D_POSIX_C_SOURCE*) ;;
   162     *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
   163     esac
   164 
   165     case " $CFLAGS " in
   166     *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
   167     *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
   168     esac
   169 
   170     case " $CFLAGS " in
   171     *[\ \	]-pedantic[\ \	]*) ;;
   172     *) CFLAGS="$CFLAGS -pedantic" ;;
   173     esac
   174   fi
   175   changequote([,])dnl
   176 fi
   177 
   178 
   179 # gcc default visibility stuff
   180 
   181 have_gcc4=no
   182 AC_MSG_CHECKING(for -fvisibility)
   183 AC_COMPILE_IFELSE([
   184 #if defined(__GNUC__) && (__GNUC__ >= 4)
   185 #else
   186 #error Need GCC 4.0 for visibility
   187 #endif
   188 int main () { return 0; } 
   189 ], have_gcc4=yes)
   190 
   191 if test "x$have_gcc4" = "xyes"; then
   192    CFLAGS="$CFLAGS -fvisibility=hidden"
   193 fi
   194 AC_MSG_RESULT($have_gcc4)
   195 
   196 REQUIREMENTS=""
   197 AC_ARG_WITH([curl],
   198             [AS_HELP_STRING([--without-curl], [disable support for curl])],
   199             [],
   200             [with_curl=yes])
   201           
   202 CURL_CFLAGS=
   203 CURL_LIBS=
   204 AS_IF([test "x$with_curl" != xno],
   205   [PKG_CHECK_MODULES(CURL, [libcurl])
   206    AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
   207 AC_SUBST(CURL_CFLAGS)
   208 AC_SUBST(CURL_LIBS)
   209 
   210 ZLIB_LIBS=""
   211 AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
   212                       [
   213                       zlib=$withval
   214                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   215                       ]
   216                       )
   217 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
   218                  [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
   219 save_ldflags="$LDFLAGS"
   220 LDFLAGS="$LDFLAGS -L$zlib/lib"
   221 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
   222 	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
   223 LDFLAGS="$save_ldflags"
   224 AC_SUBST(ZLIB_LIBS)
   225 
   226 EXPAT_LIB=""
   227 AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
   228                       [
   229                       expat=$withval
   230                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   231                       ]
   232                       )
   233 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
   234 		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
   235 save_ldflags="$LDFLAGS"
   236 LDFLAGS="$LDFLAGS -L$expat/lib"
   237 AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
   238 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
   239 LDFLAGS="$save_ldflags"
   240 AC_SUBST(EXPAT_LIBS)
   241 
   242 RPM_LIBS=""
   243 AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
   244 
   245 AS_IF([test "$with_rpm" != no],
   246       [if test "$with_rpm" != yes; then
   247 	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
   248        fi
   249        AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
   250 		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
   251        save_ldflags="$LDFLAGS"
   252        LDFLAGS="$LDFLAGS -L$with_rpm/lib"
   253        AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
   254 	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
   255        LDFLAGS="$save_ldflags"
   256        AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
   257 AC_SUBST(RPM_LIBS)
   258 AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
   259 
   260 AC_ARG_WITH([lua],
   261             [AS_HELP_STRING([--without-lua], [disable support for lua])],
   262             [],
   263             [with_lua=yes])
   264 
   265 AS_IF([test "x$with_lua" != xno],
   266   [PKG_CHECK_MODULES(LUA, [lua])
   267    REQUIREMENTS="$REQUIREMENTS lua"
   268    AC_DEFINE([HAVE_LUA], [1], [Define if you have lua])
   269    AC_PATH_PROG(LUA, [lua], [no])
   270    AS_IF([test "x$LUA" = xno],
   271      [AC_MSG_ERROR([Can't find lua program. Please install lua-devel or use --without-lua.])])
   272    AC_DEFINE_UNQUOTED([LUA_BINARY], ["$LUA"],
   273      [Define to the location of the lua binary])])
   274 AC_SUBST(LUA_CFLAGS)
   275 AC_SUBST(LUA_LIBS)
   276 AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" != xno])
   277 
   278 AC_SUBST(REQUIREMENTS)
   279 
   280 if test "x$GCC" = "xyes"; then
   281   LDFLAGS="-Wl,--as-needed $LDFLAGS"
   282 fi
   283 
   284 # *****************************
   285 # Make available to Makefile.am
   286 # *****************************
   287 AC_SUBST(SYSCONFDIR, $sysconfdir)
   288 
   289 # ********************
   290 # Internationalisation
   291 # ********************
   292 
   293 IT_PROG_INTLTOOL([0.35.0])
   294 GETTEXT_PACKAGE=razor
   295 AC_SUBST([GETTEXT_PACKAGE])
   296 AM_GLIB_GNU_GETTEXT
   297 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
   298 
   299 GTK_DOC_CHECK([1.9])
   300 
   301 AC_OUTPUT([
   302 Makefile
   303 data/razor.pc
   304 data/Makefile
   305 librazor/Makefile
   306 librazor/types/Makefile
   307 src/Makefile
   308 docs/Makefile
   309 docs/version.xml
   310 po/Makefile.in
   311 gl/Makefile
   312 test/Makefile
   313 ])
   314 
   315 dnl ==========================================================================
   316 echo "
   317                   razor $VERSION
   318                 =================
   319 
   320         prefix:                     ${prefix}
   321         libdir:                     ${libdir}
   322         libexecdir:                 ${libexecdir}
   323         bindir:                     ${bindir}
   324         sbindir:                    ${sbindir}
   325         datadir:                    ${datadir}
   326         sysconfdir:                 ${sysconfdir}
   327         localstatedir:              ${localstatedir}
   328         docdir:                     ${docdir}
   329 
   330         compiler:                   ${CC}
   331         cflags:                     ${CFLAGS}
   332         Maintainer mode:            ${USE_MAINTAINER_MODE}
   333         Building verbose mode:      ${enable_verbose_mode}
   334         Building gtk-doc:           ${enable_gtk_doc}
   335 "