1 dnl Process this file with autoconf to produce a configure script.
4 AC_INIT(razor, 0.1, krh@redhat.com)
5 AM_INIT_AUTOMAKE(razor, 0.1)
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])
35 AC_MSG_CHECKING([for Microsoft Windows native API])
37 *mingw*) AC_DEFINE([MSWIN_API], 1,
38 [Define to 1 to use Microsoft Windows native API.])
39 EXTRA_LIBS='-lshell32 -lws2_32'
43 AC_MSG_RESULT([$mswin_api])
44 AM_CONDITIONAL(MSWIN_API, test "$mswin_api" = "yes")
48 AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
49 AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
51 if test "${enable_verbose_mode}" != no; then
52 # To get -rdynamic you pass -export-dynamic to libtool.
53 AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
54 R_DYNAMIC_LDFLAG=-export-dynamic
58 AC_SUBST(R_DYNAMIC_LDFLAG)
60 #### gcc warning flags
62 if test "x$GCC" = "xyes"; then
65 *[\ \ ]-Wall[\ \ ]*) ;;
66 *) CFLAGS="$CFLAGS -Wall" ;;
70 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
71 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
75 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
76 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
80 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
81 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
85 *[\ \ ]-Wcast-align[\ \ ]*) ;;
86 *) CFLAGS="$CFLAGS -Wcast-align" ;;
90 *[\ \ ]-Wformat[\ \ ]*) ;;
91 *) CFLAGS="$CFLAGS -Wformat" ;;
95 *[\ \ ]-Wformat-security[\ \ ]*) ;;
96 *) CFLAGS="$CFLAGS -Wformat-security" ;;
99 if test "x$enable_ansi" = "xyes"; then
101 *[\ \ ]-ansi[\ \ ]*) ;;
102 *) CFLAGS="$CFLAGS -ansi" ;;
106 *[\ \ ]-D_POSIX_C_SOURCE*) ;;
107 *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
111 *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
112 *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
116 *[\ \ ]-pedantic[\ \ ]*) ;;
117 *) CFLAGS="$CFLAGS -pedantic" ;;
124 # gcc default visibility stuff
127 AC_MSG_CHECKING(for -fvisibility)
129 #if defined(__GNUC__) && (__GNUC__ >= 4)
131 #error Need GCC 4.0 for visibility
133 int main () { return 0; }
136 if test "x$have_gcc4" = "xyes"; then
137 CFLAGS="$CFLAGS -fvisibility=hidden"
139 AC_MSG_RESULT($have_gcc4)
143 [AS_HELP_STRING([--without-curl], [disable support for curl])],
149 AS_IF([test "x$with_curl" != xno],
150 [PKG_CHECK_MODULES(CURL, [libcurl])
151 REQUIREMENTS="$REQUIREMENTS libcurl"
152 AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
153 AC_SUBST(CURL_CFLAGS)
157 AC_ARG_WITH(zlib, [ --with-zlib=<dir> Use zlib from here],
160 CPPFLAGS="$CPPFLAGS -I$withval/include"
163 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
164 [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
165 save_ldflags="$LDFLAGS"
166 LDFLAGS="$LDFLAGS -L$zlib/lib"
167 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-L$zlib/lib -lz"],
168 [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
169 LDFLAGS="$save_ldflags"
173 AC_ARG_WITH(expat, [ --with-expat=<dir> Use expat from here],
176 CPPFLAGS="$CPPFLAGS -I$withval/include"
179 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)],
180 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
181 save_ldflags="$LDFLAGS"
182 LDFLAGS="$LDFLAGS -L$expat/lib"
183 AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-L$expat/lib -lexpat"],
184 [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
185 LDFLAGS="$save_ldflags"
189 AC_ARG_WITH(rpm, [ --with-rpm=<dir> Use rpm from here])
191 AS_IF([test "$with_rpm" != no],
192 [if test "$with_rpm" != yes; then
193 CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
195 AC_CHECK_HEADERS(rpm/rpmlib.h, [],
196 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
197 save_ldflags="$LDFLAGS"
198 LDFLAGS="$LDFLAGS -L$with_rpm/lib"
199 AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-L$with_rpm/lib -lrpm"],
200 [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
201 LDFLAGS="$save_ldflags"
202 AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
204 AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
205 AC_SUBST(REQUIREMENTS)
207 if test "x$GCC" = "xyes"; then
208 LDFLAGS="-Wl,--as-needed $LDFLAGS"
211 # *****************************
212 # Make available to Makefile.am
213 # *****************************
214 AC_SUBST(SYSCONFDIR, $sysconfdir)
216 # ********************
217 # Internationalisation
218 # ********************
220 IT_PROG_INTLTOOL([0.35.0])
221 GETTEXT_PACKAGE=razor
222 AC_SUBST([GETTEXT_PACKAGE])
224 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
240 dnl ==========================================================================
247 libexecdir: ${libexecdir}
251 sysconfdir: ${sysconfdir}
252 localstatedir: ${localstatedir}
257 Maintainer mode: ${USE_MAINTAINER_MODE}
258 Building verbose mode: ${enable_verbose_mode}
259 Building gtk-doc: ${enable_gtk_doc}