configure.ac
author J. Ali Harlow <ali@juiblex.co.uk>
Mon Jul 11 13:54:54 2016 +0100 (2016-07-11)
changeset 488 7c6d932f291f
parent 486 53789690374c
child 490 9e2943af74fe
permissions -rw-r--r--
Release 0.6.3.104
     1 dnl Process this file with autoconf to produce a configure script.
     2 
     3 AC_PREREQ(2.59c)
     4 AC_INIT([razor], [0.6.3.104], [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 https://www.sourceware.org/autobook/autobook/autobook_61.html for details
    12 #
    13 LT_CURRENT=6
    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     AC_SUBST([RAZOR_HAVE_ATOMIC_ROLLBACK],
    70       ['#define RAZOR_HAVE_ATOMIC_ROLLBACK 1'])
    71 else
    72     AC_SUBST([RAZOR_HAVE_ATOMIC_ROLLBACK],['#undef RAZOR_HAVE_ATOMIC_ROLLBACK'])
    73 fi
    74 
    75 AC_ARG_ENABLE([tests],
    76 	      [AS_HELP_STRING([--enable-tests],
    77 	      		      [install test programs])],
    78 	      [],
    79 	      [enable_tests=no])
    80 AM_CONDITIONAL(INSTALL_TEST_PROGRAMS, test "$enable_tests" = "yes")
    81 
    82 AC_MSG_CHECKING([for Microsoft Windows native API])
    83 case $host_os in
    84     *mingw*)	AC_DEFINE([MSWIN_API], 1,
    85 		  [Define to 1 to use Microsoft Windows native API.])
    86 		EXTRA_LIBS='-lshlwapi -lshell32 -lws2_32 -lole32'
    87 		mswin_api=yes;;
    88     *)		mswin_api=no;;
    89 esac
    90 AC_MSG_RESULT([$mswin_api])
    91 AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
    92 AC_SUBST(EXTRA_LIBS)
    93 
    94 if test "$enable_atomic" = "yes" -a "$mswin_api" = "yes"; then
    95     AC_MSG_CHECKING([for Microsoft Windows Kernel Transaction Manager])
    96     save_LIBS="$LIBS"
    97     LIBS="-lktmw32 $LIBS"
    98     AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
    99 #include <windows.h>
   100 #include <ktmw32.h>
   101 ], [(void)CreateTransaction(NULL,0,0,0,0,0,NULL);])],
   102       [have_windows_ktm="yes"; EXTRA_LIBS="-lktmw32 $EXTRA_LIBS"],
   103       [have_windows_ktm="no"])
   104     LIBS="$save_LIBS"
   105     AC_MSG_RESULT([$have_windows_ktm])
   106 else
   107     have_windows_ktm="no"
   108 fi
   109 if test "$have_windows_ktm" = "yes"; then
   110     AC_DEFINE([HAVE_WINDOWS_KTM],[1],[Define if Windows KTM is available.])
   111 fi
   112 
   113 # Taken from dbus
   114 AC_ARG_ENABLE(ansi,             [  --enable-ansi           enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
   115 AC_ARG_ENABLE(verbose-mode,     [  --enable-verbose-mode   support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
   116 
   117 if test "${enable_verbose_mode}" != no; then
   118     # To get -rdynamic you pass -export-dynamic to libtool.
   119     AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
   120     R_DYNAMIC_LDFLAG=-export-dynamic
   121 else
   122     R_DYNAMIC_LDFLAG=
   123 fi
   124 AC_SUBST(R_DYNAMIC_LDFLAG)
   125 
   126 #### gcc warning flags
   127 
   128 if test "x$GCC" = "xyes"; then
   129   changequote(,)dnl
   130   case " $CFLAGS " in
   131   *[\ \	]-Wall[\ \	]*) ;;
   132   *) CFLAGS="$CFLAGS -Wall -Wno-parentheses" ;;
   133   esac
   134 
   135   case " $CFLAGS " in
   136   *[\ \	]-Wchar-subscripts[\ \	]*) ;;
   137   *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
   138   esac
   139 
   140   case " $CFLAGS " in
   141   *[\ \	]-Wmissing-declarations[\ \	]*) ;;
   142   *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
   143   esac
   144 
   145   case " $CFLAGS " in
   146   *[\ \	]-Wnested-externs[\ \	]*) ;;
   147   *) CFLAGS="$CFLAGS -Wnested-externs" ;;
   148   esac
   149 
   150   case " $CFLAGS " in
   151   *[\ \	]-Wcast-align[\ \	]*) ;;
   152   *) CFLAGS="$CFLAGS -Wcast-align" ;;
   153   esac
   154 
   155   case " $CFLAGS " in
   156   *[\ \	]-Wformat[\ \	]*) ;;
   157   *) CFLAGS="$CFLAGS -Wformat" ;;
   158   esac
   159 
   160   case " $CFLAGS " in
   161   *[\ \	]-Wformat-security[\ \	]*) ;;
   162   *) CFLAGS="$CFLAGS -Wformat-security" ;;
   163   esac
   164 
   165   if test "x$enable_ansi" = "xyes"; then
   166     case " $CFLAGS " in
   167     *[\ \	]-ansi[\ \	]*) ;;
   168     *) CFLAGS="$CFLAGS -ansi" ;;
   169     esac
   170 
   171     case " $CFLAGS " in
   172     *[\ \	]-D_POSIX_C_SOURCE*) ;;
   173     *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
   174     esac
   175 
   176     case " $CFLAGS " in
   177     *[\ \	]-D_BSD_SOURCE[\ \	]*) ;;
   178     *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
   179     esac
   180 
   181     case " $CFLAGS " in
   182     *[\ \	]-pedantic[\ \	]*) ;;
   183     *) CFLAGS="$CFLAGS -pedantic" ;;
   184     esac
   185   fi
   186   changequote([,])dnl
   187 fi
   188 
   189 
   190 # gcc default visibility stuff
   191 
   192 have_gcc4=no
   193 AC_MSG_CHECKING(for -fvisibility)
   194 AC_COMPILE_IFELSE([
   195 #if defined(__GNUC__) && (__GNUC__ >= 4)
   196 #else
   197 #error Need GCC 4.0 for visibility
   198 #endif
   199 int main () { return 0; } 
   200 ], have_gcc4=yes)
   201 
   202 if test "x$have_gcc4" = "xyes"; then
   203    CFLAGS="$CFLAGS -fvisibility=hidden"
   204 fi
   205 AC_MSG_RESULT($have_gcc4)
   206 
   207 REQUIREMENTS=""
   208 AC_ARG_WITH([libarchive],
   209             [AS_HELP_STRING([--without-libarchive],
   210 	        [disable support for libarchive])],
   211             [],
   212             [with_libarchive=yes])
   213           
   214 LIBARCHIVE_CFLAGS=
   215 LIBARCHIVE_LIBS=
   216 AS_IF([test "x$with_libarchive" != xno],
   217   [PKG_CHECK_MODULES(LIBARCHIVE, [libarchive])
   218    REQUIREMENTS="$REQUIREMENTS libarchive"
   219    AC_DEFINE([HAVE_LIBARCHIVE], [1], [Define if you have libarchive])])
   220 AC_SUBST(LIBARCHIVE_CFLAGS)
   221 AC_SUBST(LIBARCHIVE_LIBS)
   222 
   223 AS_IF([test "x$with_libarchive" != xno],
   224    [AC_PATH_PROG(ZIP, [zip], [])])
   225 AM_CONDITIONAL([HAVE_ZIP], [test -n "$ZIP"])
   226 
   227 AC_ARG_WITH([curl],
   228             [AS_HELP_STRING([--without-curl], [disable support for curl])],
   229             [],
   230             [with_curl=yes])
   231           
   232 CURL_CFLAGS=
   233 CURL_LIBS=
   234 AS_IF([test "x$with_curl" != xno],
   235   [PKG_CHECK_MODULES(CURL, [libcurl])
   236    AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
   237 AC_SUBST(CURL_CFLAGS)
   238 AC_SUBST(CURL_LIBS)
   239 AM_CONDITIONAL([HAVE_CURL], [test "x$with_curl" != xno])
   240 
   241 ZLIB_LIBS=""
   242 AC_ARG_WITH(zlib, [  --with-zlib=<dir>       Use zlib from here],
   243                       [
   244                       zlib=$withval
   245                       CPPFLAGS="$CPPFLAGS -I$withval/include"
   246                       ]
   247                       )
   248 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
   249                  [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
   250 save_ldflags="$LDFLAGS"
   251 LDFLAGS="$LDFLAGS -L$zlib/lib"
   252 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
   253 	     [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
   254 LDFLAGS="$save_ldflags"
   255 AC_SUBST(ZLIB_LIBS)
   256 
   257 EXPAT_LIB=""
   258 PKG_CHECK_MODULES(EXPAT, [expat21],
   259   [AC_DEFINE([HAVE_EXPAT_H])
   260    CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"],
   261   [AC_ARG_WITH(expat, [  --with-expat=<dir>      If expat 2.1 isn't available,
   262                           fallback to using legacy expat from here],
   263                         [
   264                         expat=$withval
   265                         CPPFLAGS="$CPPFLAGS -I$withval/include"
   266                         ]
   267                         )
   268   AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)], 
   269 		 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
   270   save_ldflags="$LDFLAGS"
   271   LDFLAGS="$LDFLAGS -L$expat/lib"
   272   AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
   273 	     [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
   274   LDFLAGS="$save_ldflags"])
   275 AC_SUBST(EXPAT_LIBS)
   276 
   277 RPM_LIBS=""
   278 AC_ARG_WITH(rpm, [  --with-rpm=<dir>      Use rpm from here])
   279 
   280 AS_IF([test "$with_rpm" != no],
   281       [if test "$with_rpm" != yes; then
   282 	    CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
   283        fi
   284        AC_CHECK_HEADERS(rpm/rpmlib.h, [], 
   285 		 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
   286        save_ldflags="$LDFLAGS"
   287        LDFLAGS="$LDFLAGS -L$with_rpm/lib"
   288        AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
   289 	     [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
   290        LDFLAGS="$save_ldflags"
   291        AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
   292 AC_SUBST(RPM_LIBS)
   293 AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
   294 
   295 AC_ARG_WITH([lua],
   296             [AS_HELP_STRING([--without-lua], [disable support for lua])],
   297             [],
   298             [with_lua=yes])
   299 
   300 AS_IF([test "x$with_lua" != xno],
   301   [PKG_CHECK_MODULES(LUA, [lua])
   302    REQUIREMENTS="$REQUIREMENTS lua"
   303    AC_DEFINE([HAVE_LUA], [1], [Define if you have lua])
   304    AC_PATH_PROG(LUA, [lua], [no])
   305    AS_IF([test "x$LUA" = xno],
   306      [AC_MSG_ERROR([Can't find lua program. Please install lua-devel or use --without-lua.])])
   307    AC_DEFINE_UNQUOTED([LUA_BINARY], ["$LUA"],
   308      [Define to the location of the lua binary])])
   309 AC_SUBST(LUA_CFLAGS)
   310 AC_SUBST(LUA_LIBS)
   311 AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" != xno])
   312 
   313 AC_SUBST(REQUIREMENTS)
   314 
   315 if test "x$GCC" = "xyes"; then
   316   LDFLAGS="-Wl,--as-needed $LDFLAGS"
   317 fi
   318 
   319 # *****************************
   320 # Make available to Makefile.am
   321 # *****************************
   322 AC_SUBST(SYSCONFDIR, $sysconfdir)
   323 
   324 # ********************
   325 # Internationalisation
   326 # ********************
   327 
   328 IT_PROG_INTLTOOL([0.35.0])
   329 GETTEXT_PACKAGE=razor
   330 AC_SUBST([GETTEXT_PACKAGE])
   331 AM_GLIB_GNU_GETTEXT
   332 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
   333 
   334 GTK_DOC_CHECK([1.9])
   335 
   336 AC_OUTPUT([
   337 Makefile
   338 data/razor.pc
   339 data/Makefile
   340 librazor/Makefile
   341 librazor/razor.h
   342 librazor/types/Makefile
   343 src/Makefile
   344 docs/Makefile
   345 docs/version.xml
   346 po/Makefile.in
   347 gl/Makefile
   348 test/Makefile
   349 ])
   350 
   351 dnl ==========================================================================
   352 echo "
   353                   razor $VERSION
   354                 =================
   355 
   356         prefix:                     ${prefix}
   357         libdir:                     ${libdir}
   358         libexecdir:                 ${libexecdir}
   359         bindir:                     ${bindir}
   360         sbindir:                    ${sbindir}
   361         datadir:                    ${datadir}
   362         sysconfdir:                 ${sysconfdir}
   363         localstatedir:              ${localstatedir}
   364         docdir:                     ${docdir}
   365 
   366         compiler:                   ${CC}
   367         cflags:                     ${CFLAGS}
   368         Maintainer mode:            ${USE_MAINTAINER_MODE}
   369         Building verbose mode:      ${enable_verbose_mode}
   370         Building gtk-doc:           ${enable_gtk_doc}
   371 "