dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.52) AC_INIT(shftool, 1.2.0, http://www.df.lth.se/~triad/krad/shftool/) AC_CONFIG_AUX_DIR(config) AC_CONFIG_SRCDIR(src/shftool.c) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) dnl Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET AC_PROG_INSTALL AM_PROG_LIBTOOL dnl AC_ARG_PROGRAM dnl Checks for libraries. LDFLAGS="" LIBS="" INCLUDES="" LIBLOC_LIST="/usr /usr/local /opt $HOME" dnl Checks to find Expat AC_MSG_CHECKING(for expat) for i in $LIBLOC_LIST; do dnl First check for old Expat, in order for the dnl new expat to override this path. if test -f $i/include/xmltok.h; then EXPAT_DIR=$i EXPAT_INC=include EXPAT_LIB=lib EXPAT_LINKFLAG="-lxmltok -lxmlparse" AC_DEFINE(HAVE_EXPAT_H, 0, [Wheter we have libexpat expat.h header]) fi if test -f $i/include/xmltok/xmltok.h; then EXPAT_DIR=$i EXPAT_INC=include/xmltok EXPAT_LIB=lib/xmltok EXPAT_LINKFLAG="-lxmltok -lxmlparse" AC_DEFINE(HAVE_EXPAT_H, 0, [Wheter we have libexpat expat.h header]) fi if test -f $i/recode/xmltok/xmltok.h; then EXPAT_DIR=$i/xmltok EXPAT_INC=include EXPAT_LIB=lib EXPAT_LINKFLAG="-lxmltok -lxmlparse" AC_DEFINE(HAVE_EXPAT_H, 0, [Wheter we have libexpat expat.h header]) fi dnl Check for Expat 2.0 if test -f $i/include/expat.h; then EXPAT_DIR=$i EXPAT_INC=include EXPAT_LIB=lib EXPAT_LINKFLAG=-lexpat AC_DEFINE(HAVE_EXPAT_H, 1, [Wheter we have libexpat expat.h header]) fi if test -f $i/include/expat/expat.h; then EXPAT_DIR=$i EXPAT_INC=include/expat EXPAT_LIB=lib/expat EXPAT_LINKFLAG=-lexpat AC_DEFINE(HAVE_EXPAT_H, 1, [Wheter we have libexpat expat.h header]) fi if test -f $i/recode/expat/expat.h; then EXPAT_DIR=$i/expat EXPAT_INC=include EXPAT_LIB=lib EXPAT_LINKFLAG=-lexpat AC_DEFINE(HAVE_EXPAT_H, 1, [Wheter we have libexpat expat.h header]) fi done if test "$EXPAT_DIR" = ""; then AC_MSG_RESULT(no) AC_MSG_ERROR(I cannot find expat.h nor xmltok.h anywhere below $LIBLOC_LIST. Is it installed?) else AC_MSG_RESULT(yes) fi LDFLAGS="$LDFLAGS -L$EXPAT_DIR/$EXPAT_LIB" LIBS="$LIBS $EXPAT_LINKFLAG" INCLUDES="$INCLUDES -I$EXPAT_DIR/$EXPAT_INC" dnl Test the library dnl AC_MSG_CHECKING(whether Expat library can be linked) dnl AC_TRY_LINK([char *program_name;],[XML_Parse();],[AC_MSG_RESULT(yes)],[AC_MSG_ERROR(I cannot link expat library (-L$EXPAT_DIR/$EXPAT_LIB $EXPAT_LINKFLAG). Is it installed?)]) echo "Found Expat XML parser library in $EXPAT_DIR/$EXPAT_LIB, header file in $EXPAT_DIR/$EXPAT_INC" dnl Tell the Makefiles.am to use these new flags AC_SUBST(LDFLAGS) AC_SUBST(LIBS) AC_SUBST(INCLUDES) dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS(malloc.h stdbool.h stdlib.h string.h sys/types.h getopt.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST dnl Checks for library functions. AC_FUNC_VPRINTF AC_SUBST(ac_aux_dir) AC_OUTPUT([ Makefile src/Makefile doc/Makefile test/Makefile ])