Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
224 lines (188 sloc) 5.91 KB
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59c)
AC_INIT(razor, 0.1, krh@redhat.com)
AM_INIT_AUTOMAKE(razor, 0.1)
AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE
# libtool versioning - this applies to all libraries in this package
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
#
LT_CURRENT=1
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
AC_SUBST(LT_AGE)
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
AM_PROG_LIBTOOL
AC_PROG_MAKE_SET
AC_PROG_LN_S
AC_SYS_LARGEFILE
AM_PROG_CC_C_O
# Taken from dbus
AC_ARG_ENABLE(ansi, [ --enable-ansi enable -ansi -pedantic gcc flags],enable_ansi=$enableval,enable_ansi=no)
AC_ARG_ENABLE(verbose-mode, [ --enable-verbose-mode support verbose debug mode],enable_verbose_mode=$enableval,enable_verbose_mode=$USE_MAINTAINER_MODE)
if test "${enable_verbose_mode}" != no; then
# To get -rdynamic you pass -export-dynamic to libtool.
AC_DEFINE(BUILT_R_DYNAMIC,1,[whether -export-dynamic was passed to libtool])
R_DYNAMIC_LDFLAG=-export-dynamic
else
R_DYNAMIC_LDFLAG=
fi
AC_SUBST(R_DYNAMIC_LDFLAG)
#### gcc warning flags
if test "x$GCC" = "xyes"; then
changequote(,)dnl
case " $CFLAGS " in
*[\ \ ]-Wall[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wall" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wchar-subscripts[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wchar-subscripts" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wmissing-declarations[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wmissing-declarations" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wnested-externs[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wnested-externs" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wcast-align[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wcast-align" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wformat[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wformat" ;;
esac
case " $CFLAGS " in
*[\ \ ]-Wformat-security[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -Wformat-security" ;;
esac
if test "x$enable_ansi" = "xyes"; then
case " $CFLAGS " in
*[\ \ ]-ansi[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -ansi" ;;
esac
case " $CFLAGS " in
*[\ \ ]-D_POSIX_C_SOURCE*) ;;
*) CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=199309L" ;;
esac
case " $CFLAGS " in
*[\ \ ]-D_BSD_SOURCE[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -D_BSD_SOURCE" ;;
esac
case " $CFLAGS " in
*[\ \ ]-pedantic[\ \ ]*) ;;
*) CFLAGS="$CFLAGS -pedantic" ;;
esac
fi
changequote([,])dnl
fi
# gcc default visibility stuff
have_gcc4=no
AC_MSG_CHECKING(for -fvisibility)
AC_COMPILE_IFELSE([
#if defined(__GNUC__) && (__GNUC__ >= 4)
#else
#error Need GCC 4.0 for visibility
#endif
int main () { return 0; }
], have_gcc4=yes)
if test "x$have_gcc4" = "xyes"; then
CFLAGS="$CFLAGS -fvisibility=hidden"
fi
AC_MSG_RESULT($have_gcc4)
PKG_CHECK_MODULES(CURL, [libcurl])
AC_SUBST(CURL_CFLAGS)
AC_SUBST(CURL_LIBS)
ZLIB_LIBS=""
AC_ARG_WITH(zlib, [ --with-zlib=<dir> Use zlib from here],
[
zlib=$withval
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
]
)
AC_CHECK_HEADERS(zlib.h, [AC_DEFINE(HAVE_ZLIB_H)],
[AC_MSG_ERROR([Can't find zlib.h. Please install zlib.])])
AC_CHECK_LIB(z, inflate, [ZLIB_LIBS="-lz"],
[AC_MSG_ERROR([Can't find zlib library. Please install zlib.])])
AC_SUBST(ZLIB_LIBS)
EXPAT_LIB=""
AC_ARG_WITH(expat, [ --with-expat=<dir> Use expat from here],
[
expat=$withval
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
]
)
AC_CHECK_HEADERS(expat.h, [AC_DEFINE(HAVE_EXPAT_H)],
[AC_MSG_ERROR([Can't find expat.h. Please install expat.])])
AC_CHECK_LIB(expat, XML_ParserCreate, [EXPAT_LIBS="-lexpat"],
[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
AC_SUBST(EXPAT_LIBS)
RPM_LIB=""
AC_ARG_WITH(rpm, [ --with-rpm=<dir> Use rpm from here],
[
rpm=$withval
CPPFLAGS="$CPPFLAGS -I$withval/include"
LDFLAGS="$LDFLAGS -L$withval/lib"
]
)
AC_CHECK_HEADERS(rpm/rpmlib.h, [],
[AC_MSG_ERROR([Can't find rpm/rpmlib.h. Please install rpm-devel.])])
AC_CHECK_LIB(rpm,rpmdbOpen,[RPM_LIBS="-lrpm"],
[AC_MSG_ERROR([Can't find rpm library. Please install rpm-devel.])])
AC_SUBST(RPM_LIBS)
if test "x$GCC" = "xyes"; then
LDFLAGS="-Wl,--as-needed $LDFLAGS"
fi
# *****************************
# Make available to Makefile.am
# *****************************
AC_SUBST(SYSCONFDIR, $sysconfdir)
# ********************
# Internationalisation
# ********************
IT_PROG_INTLTOOL([0.36.0])
GETTEXT_PACKAGE=razor
AC_SUBST([GETTEXT_PACKAGE])
AM_GLIB_GNU_GETTEXT
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[gettext domain])
GTK_DOC_CHECK([1.9])
AC_OUTPUT([
Makefile
data/razor.pc
data/Makefile
librazor/Makefile
src/Makefile
docs/Makefile
docs/version.xml
po/Makefile.in
])
dnl ==========================================================================
echo "
razor $VERSION
=================
prefix: ${prefix}
libdir: ${libdir}
libexecdir: ${libexecdir}
bindir: ${bindir}
sbindir: ${sbindir}
datadir: ${datadir}
sysconfdir: ${sysconfdir}
localstatedir: ${localstatedir}
docdir: ${docdir}
compiler: ${CC}
cflags: ${CFLAGS}
Maintainer mode: ${USE_MAINTAINER_MODE}
Building verbose mode: ${enable_verbose_mode}
Building gtk-doc: ${enable_gtk_doc}
"