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
25 AC_CHECK_HEADERS([sys/mman.h])
27 AC_CHECK_FUNCS([symlink])
35 AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
36 AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
38 if test "${enable_verbose_mode}" != no; then
39 # To get -rdynamic you pass -export-dynamic to libtool.
40 AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
41 R_DYNAMIC_LDFLAG=-export-dynamic
45 AC_SUBST(R_DYNAMIC_LDFLAG)
47 #### gcc warning flags
49 if test "x$GCC" = "xyes"; then
52 *[\ \ ]-Wall[\ \ ]*) ;;
53 *) CFLAGS="$CFLAGS -Wall" ;;
57 *[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
58 *) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
62 *[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
63 *) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
67 *[\ \ ]-Wnested-externs[\ \ ]*) ;;
68 *) CFLAGS="$CFLAGS -Wnested-externs" ;;
72 *[\ \ ]-Wcast-align[\ \ ]*) ;;
73 *) CFLAGS="$CFLAGS -Wcast-align" ;;
77 *[\ \ ]-Wformat[\ \ ]*) ;;
78 *) CFLAGS="$CFLAGS -Wformat" ;;
82 *[\ \ ]-Wformat-security[\ \ ]*) ;;
83 *) CFLAGS="$CFLAGS -Wformat-security" ;;
86 if test "x$enable_ansi" = "xyes"; then
88 *[\ \ ]-ansi[\ \ ]*) ;;
89 *) CFLAGS="$CFLAGS -ansi" ;;
93 *[\ \ ]-D_POSIX_C_SOURCE*) ;;
94 *) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
98 *[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
99 *) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
103 *[\ \ ]-pedantic[\ \ ]*) ;;
104 *) CFLAGS="$CFLAGS -pedantic" ;;
111 # gcc default visibility stuff
114 AC_MSG_CHECKING(for -fvisibility)
116 #if defined(__GNUC__) && (__GNUC__ >= 4)
118 #error Need GCC 4.0 for visibility
120 int main () { return 0; }
123 if test "x$have_gcc4" = "xyes"; then
124 CFLAGS="$CFLAGS -fvisibility=hidden"
126 AC_MSG_RESULT($have_gcc4)
130 [AS_HELP_STRING([--without-curl], [disable support for curl])],
136 AS_IF([test "x$with_curl" != xno],
137 [PKG_CHECK_MODULES(CURL, [libcurl])
138 AC_DEFINE([HAVE_CURL], [1], [Define if you have curl])])
139 AC_SUBST(CURL_CFLAGS)
143 AC_ARG_WITH(zlib, [ --with-zlib=<dir> Use zlib from here],
146 CPPFLAGS="$CPPFLAGS -I$withval/include"
147 LDFLAGS="$LDFLAGS -L$withval/lib"
150 AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
151 [AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
152 AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-lz"],
153 [AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
157 AC_ARG_WITH(expat, [ --with-expat=<dir> Use expat from here],
160 CPPFLAGS="$CPPFLAGS -I$withval/include"
161 LDFLAGS="$LDFLAGS -L$withval/lib"
164 AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)],
165 [AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
166 AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-lexpat"],
167 [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
171 AC_ARG_WITH(rpm, [ --with-rpm=<dir> Use rpm from here])
173 AS_IF([test "$with_rpm" != no],
174 [if test "$with_rpm" != yes; then
175 CPPFLAGS="$CPPFLAGS -I$with_rpm/include"
176 LDFLAGS="$LDFLAGS -L$with_rpm/lib"
178 AC_CHECK_HEADERS(rpm/rpmlib.h, [],
179 [AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel or use --without-rpm.])])
180 AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-lrpm"],
181 [AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel or use --without-rpm.])])
182 AC_DEFINE([HAVE_RPMLIB], [1], [Define if you have librpm])])
184 AM_CONDITIONAL([HAVE_RPMLIB], [test -n "$RPM_LIBS"])
186 if test "x$GCC" = "xyes"; then
187 LDFLAGS="-Wl,--as-needed $LDFLAGS"
190 # *****************************
191 # Make available to Makefile.am
192 # *****************************
193 AC_SUBST(SYSCONFDIR, $sysconfdir)
195 # ********************
196 # Internationalisation
197 # ********************
199 IT_PROG_INTLTOOL([0.35.0])
200 GETTEXT_PACKAGE=razor
201 AC_SUBST([GETTEXT_PACKAGE])
203 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
219 dnl ==========================================================================
226 libexecdir: ${libexecdir}
230 sysconfdir: ${sysconfdir}
231 localstatedir: ${localstatedir}
236 Maintainer mode: ${USE_MAINTAINER_MODE}
237 Building verbose mode: ${enable_verbose_mode}
238 Building gtk-doc: ${enable_gtk_doc}