dnl Process this file with autoconf to produce a configure script. dnl dnl $Id: configure.in,v 1.7 2004/07/20 00:14:53 johntabularasa Exp $ dnl dnl --------------------------------------------------------------- dnl - Initialization dnl --------------------------------------------------------------- AC_INIT(libgutenfetch, 1.2, johntabularasa@users.sf.net) AC_PREREQ(2.53) AM_INIT_AUTOMAKE(libgutenfetch, 1.2) AC_CANONICAL_BUILD AC_CANONICAL_HOST AC_CANONICAL_TARGET AM_CONFIG_HEADER(config.h) dnl --------------------------------------------------------------- dnl - Check for system types characteristics dnl --------------------------------------------------------------- AC_AIX AC_MINIX AC_PROG_CC AC_ISC_POSIX dnl --------------------------------------------------------------- dnl - Check for programs dnl --------------------------------------------------------------- AM_PROG_CC_STDC AC_PROG_INSTALL AM_PROG_LIBTOOL AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT_VERSION(0.13.1) dnl --------------------------------------------------------------- dnl - Checks for typedefs, structures and compiler characteristics. dnl --------------------------------------------------------------- AC_C_CONST AC_ALLOCA AC_TYPE_SIZE_T AC_FUNC_CLOSEDIR_VOID dnl --------------------------------------------------------------- dnl - Check for headers dnl --------------------------------------------------------------- AC_HEADER_STDC AC_CHECK_HEADERS([ \ stdio.h \ stdlib.h \ assert.h \ stdarg.h \ unistd.h \ fcntl.h \ time.h \ sys/types.h \ sys/stat.h \ sys/uio.h \ string.h \ strings.h \ unixlib.h \ pthread.h \ regex.h \ gnuregex.h \ errno.h]) dnl --------------------------------------------------------------- dnl - Check for functions which may or may not be part of dnl - the standard C library. dnl - strsep and mergesort replacements are in util.c dnl --------------------------------------------------------------- AC_CHECK_FUNCS([strsep], [have_strsep="yes"], [have_strsep="no"]) AC_CHECK_FUNCS([mergesort], [have_mergesort="yes"], [have_mergesort="no"]) dnl --------------------------------------------------------------- dnl - look for regexec in libc dnl - if it isn't there, look for libgnuregex dnl - if that too isn't found, build the replacement. dnl - gnuregex replacement is found in gnuregex.(c|h) dnl --------------------------------------------------------------- AC_CHECK_FUNC(regexec, [have_c_regex="yes" have_libgnuregex="no" AC_DEFINE(USE_C_REGEX, 1, ["Define if we are using C regex."])], [have_c_regex="no" AC_DEFINE(USE_C_REGEX, 0, ["Define if we are using C regex."]) AC_CHECK_LIB(gnuregex, regexec, [have_libgnuregex="yes" AC_DEFINE(USE_LIBGNUREGEX, 1, ["Use libgnuregex."]) PACKAGE_LIBS="$PACKAGE_LIBS -lgnuregex" AC_SUBST(REGEX_LIBS)], [have_libgnuregex="no" AC_DEFINE(USE_LIBGNUREGEX, 0, ["Use libgnuregex."])])]) AM_CONDITIONAL(MISSING_C_REGEX, test "$have_c_regex" = "no") AM_CONDITIONAL(MISSING_GNUREGEX, test "$have_libgnuregex" = "no") dnl --------------------------------------------------------------- dnl - check for windows dnl - not sure if this is completly correct, someone with dnl - more experience please contact me - RPF dnl --------------------------------------------------------------- AC_CHECK_HEADER(windows.h,[ WINDOWS="yes" PACKAGE_LIBS="$PACKAGE_LIBS -lwinmm -lws2_32 -lwsock32"]) dnl --------------------------------------------------------------- dnl - Configure options dnl --------------------------------------------------------------- AC_ARG_ENABLE(debug, [ --enable-debug compile with debugging support],,enable_debug=no) if test "$enable_debug" = yes ; then AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.]) PACKAGE_CFLAGS="$PACKAGE_CFLAGS -Wall -g3 -O0" fi dnl --------------------------------------------------------------- dnl - Test for presence of libcurl dnl --------------------------------------------------------------- AC_CHECK_HEADERS(curl/curl.h, AC_CHECK_PROG(have_curl_config, curl-config, "yes", "no"), AC_ERROR(["*** You must have curl.h to compile."])) if test "$have_curl_config" = yes ; then AC_CHECK_LIB(curl, curl_global_init, [AC_DEFINE(HAVE_CURL_GLOBAL_INIT, 1, [libcurl has curl_global_init.])], [AC_DEFINE(HAVE_CURL_GLOBAL_INIT, 0, [libcurl has curl_global_init.])]) HAVE_CURLLIB="yes" USE_LIBCURL="yes" PACKAGE_LIBS="$PACKAGE_LIBS `curl-config --libs`" PACKAGE_CFLAGS="$PACKAGE_CFLAGS `curl-config --cflags`" AC_DEFINE(HAVE_CURLLIB, [], [Do we have libcurl]) else AC_ERROR(["*** Unable to find curl-config utility"]) fi dnl --------------------------------------------------------------- dnl - Test for threading capabilities dnl --------------------------------------------------------------- ACX_PTHREAD( [ have_pthread=yes PACKAGE_CFLAGS="$PACKAGE_CFLAGS $PTHREAD_CFLAGS" PACKAGE_LIBS="$PTHREAD_LIBS $PACKAGE_LIBS" CC="$PTHREAD_CC" AC_DEFINE(HAVE_PTHREAD, 1, [thread-safe library]) ], [ have_pthread=no AC_DEFINE(HAVE_PTHREAD, 0, [thread-safe library]) ] ) dnl --------------------------------------------------------------- dnl - we are done with tests ... dnl --------------------------------------------------------------- AC_SUBST(PACKAGE_CFLAGS) AC_SUBST(PACKAGE_LIBS) dnl --------------------------------------------------------------- dnl - Set gettext information dnl --------------------------------------------------------------- AC_DEFINE([GETTEXT_PACKAGE],[libgutenfetch],[The package name.]) AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE") ALL_LINGUAS="" dnl --------------------------------------------------------------- dnl - Output our makefiles. dnl --------------------------------------------------------------- AC_CONFIG_FILES([ Makefile src/Makefile doc/Makefile data/Makefile po/Makefile.in]) AC_OUTPUT echo echo "$PACKAGE $VERSION" echo "----------------------------------------------------------" echo "- " echo "- Enable debug ..................... : $enable_debug" echo "- Enable threading ................. : $have_pthread" echo "- " echo "- Have libcurl ..................... : $USE_LIBCURL" echo "- " echo "- Found system regexec() ........... : $have_c_regex" echo "- Found system strsep() ............ : $have_strsep" echo "- Found system mergesort() ......... : $have_mergesort" echo "- " echo "----------------------------------------------------------" eval eval echo $PACKAGE will be installed in $bindir. echo "configure complete, now type 'make'." echo