1 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT([razor], [0.6.2], [ali@juiblex.co.uk])
6 AM_CONFIG_HEADER([config.h])
9 # libtool versioning - this applies to all libraries in this package
11 # See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
26 AC_CHECK_HEADERS([sys/mman.h])
28 AC_CHECK_FUNCS([symlink chroot])
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.
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.
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"
55 ac_compile="./libtool --mode=compile --tag=CC $ac_compile"
56 ac_link="./libtool --mode=link --tag=CC $ac_link"
62 AC_ARG_ENABLE([atomic],
63 [AS_HELP_STRING([--disable-atomic],
64 [disable atomic transactions])],
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'])
72 AC_SUBST([RAZOR_HAVE_ATOMIC_ROLLBACK],['#undef RAZOR_HAVE_ATOMIC_ROLLBACK'])
75 AC_ARG_ENABLE([tests],
76 [AS_HELP_STRING([--enable-tests],
77 [install test programs])],
80 AM_CONDITIONAL(INSTALL_TEST_PROGRAMS, test "$enable_tests" = "yes")
82 AC_MSG_CHECKING([for Microsoft Windows native API])
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'
90 AC_MSG_RESULT([$mswin_api])
91 AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
94 if test "$enable_atomic" = "yes" -a "$mswin_api" = "yes"; then
95 AC_MSG_CHECKING([for Microsoft Windows Kernel Transaction Manager])
98 AC_LINK_IFELSE([AC_LANG_PROGRAM([dnl
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"])
105 AC_MSG_RESULT([$have_windows_ktm])
107 have_windows_ktm="no"
109 if test "$have_windows_ktm" = "yes"; then
110 AC_DEFINE([HAVE_WINDOWS_KTM],[1],[Define if Windows KTM is available.])
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)
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
124 AC_SUBST(R_DYNAMIC_LDFLAG)
126 #### gcc warning flags
128 if test "x$GCC" = "xyes"; then
131 *[\ \ ]-Wall[\ \ ]*) ;;
132 *) CFLAGS="$CFLAGS -Wall -Wno-parentheses" ;;
136 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
137 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
141 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
142 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
146 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
147 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
151 *[\ \ ]-Wcast-align[\ \ ]*) ;;
152 *) CFLAGS="$CFLAGS -Wcast-align" ;;
156 *[\ \ ]-Wformat[\ \ ]*) ;;
157 *) CFLAGS="$CFLAGS -Wformat" ;;
161 *[\ \ ]-Wformat-security[\ \ ]*) ;;
162 *) CFLAGS="$CFLAGS -Wformat-security" ;;
165 if test "x$enable_ansi" = "xyes"; then
167 *[\ \ ]-ansi[\ \ ]*) ;;
168 *) CFLAGS="$CFLAGS -ansi" ;;
172 *[\ \ ]-D_POSIX_C_SOURCE*) ;;
173 *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
177 *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
178 *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
182 *[\ \ ]-pedantic[\ \ ]*) ;;
183 *) CFLAGS="$CFLAGS -pedantic" ;;
190 # gcc default visibility stuff
193 AC_MSG_CHECKING(for -fvisibility)
195 #if defined(__GNUC__) && (__GNUC__ >= 4)
197 #error Need GCC 4.0 for visibility
199 int main () { return 0; }
202 if test "x$have_gcc4" = "xyes"; then
203 CFLAGS="$CFLAGS -fvisibility=hidden"
205 AC_MSG_RESULT($have_gcc4)
209 [AS_HELP_STRING([--without-curl], [disable support for curl])],
215 AS_IF([test "x$with_curl" != xno],
216 [PKG_CHECK_MODULES(CURL, [libcurl])
217 AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
218 AC_SUBST(CURL_CFLAGS)
222 AC_ARG_WITH(zlib, [ --with-zlib=<dir> Use zlib from here],
225 CPPFLAGS="$CPPFLAGS -I$withval/include"
228 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
229 [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
230 save_ldflags="$LDFLAGS"
231 LDFLAGS="$LDFLAGS -L$zlib/lib"
232 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
233 [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
234 LDFLAGS="$save_ldflags"
238 PKG_CHECK_MODULES(EXPAT, [expat21],
239 [AC_DEFINE([HAVE_EXPAT_H])
240 CPPFLAGS="$CPPFLAGS $EXPAT_CFLAGS"],
241 [AC_ARG_WITH(expat, [ --with-expat=<dir> If expat 2.1 isn't available,
242 fallback to using legacy expat from here],
245 CPPFLAGS="$CPPFLAGS -I$withval/include"
248 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)],
249 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
250 save_ldflags="$LDFLAGS"
251 LDFLAGS="$LDFLAGS -L$expat/lib"
252 AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
253 [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
254 LDFLAGS="$save_ldflags"])
258 AC_ARG_WITH(rpm, [ --with-rpm=<dir> Use rpm from here])
260 AS_IF([test "$with_rpm" != no],
261 [if test "$with_rpm" != yes; then
262 CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
264 AC_CHECK_HEADERS(rpm/rpmlib.h, [],
265 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
266 save_ldflags="$LDFLAGS"
267 LDFLAGS="$LDFLAGS -L$with_rpm/lib"
268 AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
269 [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
270 LDFLAGS="$save_ldflags"
271 AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
273 AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
276 [AS_HELP_STRING([--without-lua], [disable support for lua])],
280 AS_IF([test "x$with_lua" != xno],
281 [PKG_CHECK_MODULES(LUA, [lua])
282 REQUIREMENTS="$REQUIREMENTS lua"
283 AC_DEFINE([HAVE_LUA], [1], [Define if you have lua])
284 AC_PATH_PROG(LUA, [lua], [no])
285 AS_IF([test "x$LUA" = xno],
286 [AC_MSG_ERROR([Can't find lua program. Please install lua-devel or use --without-lua.])])
287 AC_DEFINE_UNQUOTED([LUA_BINARY], ["$LUA"],
288 [Define to the location of the lua binary])])
291 AM_CONDITIONAL([HAVE_LUA], [test "x$with_lua" != xno])
293 AC_SUBST(REQUIREMENTS)
295 if test "x$GCC" = "xyes"; then
296 LDFLAGS="-Wl,--as-needed $LDFLAGS"
299 # *****************************
300 # Make available to Makefile.am
301 # *****************************
302 AC_SUBST(SYSCONFDIR, $sysconfdir)
304 # ********************
305 # Internationalisation
306 # ********************
308 IT_PROG_INTLTOOL([0.35.0])
309 GETTEXT_PACKAGE=razor
310 AC_SUBST([GETTEXT_PACKAGE])
312 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
322 librazor/types/Makefile
331 dnl ==========================================================================
338 libexecdir: ${libexecdir}
342 sysconfdir: ${sysconfdir}
343 localstatedir: ${localstatedir}
348 Maintainer mode: ${USE_MAINTAINER_MODE}
349 Building verbose mode: ${enable_verbose_mode}
350 Building gtk-doc: ${enable_gtk_doc}