dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.53) AC_INIT(nget,0.27.1) AC_CONFIG_SRCDIR(nget.cc) AC_CONFIG_HEADER(config.h) AH_TOP([#ifndef _NGET_CONFIG_H_ #define _NGET_CONFIG_H_ ]) AH_BOTTOM([ /* tests for some features that depend on other features */ #include "_subconf.h" #endif /* _NGET_CONFIG_H_ */ ]) AC_LANG_CPLUSPLUS dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_RANLIB AC_CHECK_TOOL(AR, ar) AC_CHECK_TOOL(STRIP, strip) AC_PROG_INSTALL dnl AC_PROG_MAKE_SET MY_CHECK_FOMIT_FRAME_POINTER MY_CHECK_EXCEPTIONS dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h sstream limits regex.h term.h inttypes.h winsock.h winsock2.h ws2tcpip.h sys/socket.h process.h windows.h) AC_CHECK_HEADERS(stdio.h endian.h) MY_CHECK_HASH_MAP dnl due to windows' linking methods, you need the correct prototype to find some funcs, eg LockFile MY_SEARCH_LIBS(LockFile,[#include ], [LockFile(0,0,0,0,0);], [kernel32], [library containing LockFile]) dnl SunOS/win32 needs seperate libs for network stuff. MY_CHECK_SOCKET AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(hstrerror, resolv) dnl Checks for libraries needed by both nget and ngetlite AC_donut_CHECK_PACKAGE(pcre, pcre_compile, pcre, pcreposix.h, AC_CHECK_LIB(pcreposix,main)) dnl All the libraries we check for after this point are not needed by ngetlite, so save its LIBS now. LITELIBS="$LIBS" AC_SUBST(LITELIBS) dnl Checks for libraries only needed by nget. MY_CHECK_TERMSTUFF AC_donut_CHECK_PACKAGE_DEF(lockfile, lockfile_create, lockfile, lockfile.h) AC_donut_CHECK_PACKAGE_DEF(zlib, gzopen, z, zlib.h) AC_donut_CHECK_PACKAGE_DEF(popt, poptGetContext, popt, popt.h, MY_CHECK_POPT_CONST, [AC_donut_SEARCH_PACKAGE_DEF(gnugetopt, getopt_long, gnugetopt, getopt.h)] ) dnl check for uulib. We need a bit of special handling to support the dnl nget+uulib source. AC_ARG_WITH(uulib, [AC_HELP_STRING([--with-uulib(=DIR)], [look in DIR for uulib])], with_uulib=$withval , if test -d uulib; then with_uulib=no else with_uulib=yes fi ) AC_donut_CHECK_PACKAGE_sub(uulib, UUInitialize, uu, uudeview.h) if test "$with_uulib" = no; then UUDIR=uulib UUINC=-I$UUDIR UULIB=$UUDIR/libuu.a AC_DEFINE(HAVE_LIBUU) dnl AC_DEFINE(HAVE_PKG_UULIB) else NOUU=# fi AC_SUBST(NOUU) AC_SUBST(UUINC) AC_SUBST(UUDIR) AC_SUBST(UULIB) AC_ARG_ENABLE(checksum, [ --enable-checksum=method Set which method to use for comparing headers and for short-tempnames. Either crc32 or adler32. default is crc32, as it seems to get less repeated values, however adler32 is said to be faster. It probably doesn't make much difference. --disable-checksum Disable usage of checksums for comparing headers as well as for short-tempnames, uses STL hash function instead.], if test "$enableval" != "no"; then if test "$enableval" != "yes"; then AC_DEFINE_UNQUOTED(CHECKSUM,$enableval,[checksum method to use]) else AC_DEFINE(CHECKSUM,crc32) fi fi , AC_DEFINE(CHECKSUM,crc32) ) nget_ndebug=yes nget_noopt=no nget_coverage=no AC_ARG_ENABLE(debug, [ --enable-debug Enable debug code, asserts, etc and disable optimization.], if test "$enableval" != "no"; then nget_noopt=yes nget_ndebug=no fi ) AC_ARG_ENABLE(maintainer-mode, [ --enable-maintainer-mode Enable debug code, asserts, etc..], if test "$enableval" != "no"; then nget_ndebug=no fi ) AC_ARG_ENABLE(coverage, [ --enable-coverage Enable compiler flags for coverage testing.], if test "$enableval" != "no"; then nget_noopt=yes nget_coverage=yes fi ) if test "$nget_noopt" = "yes"; then MY_DISABLE_OPT fi if test "$nget_coverage" = "yes"; then CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage" fi if test "$nget_ndebug" = "yes"; then AC_DEFINE(NDEBUG,1,[debug mode?]) fi nget_ipv6=yes AC_ARG_ENABLE(ipv6, [ --disable-ipv6 Do not try to use IPv6 capable netcode.], nget_ipv6="$enableval" ) dnl AC_ARG_ENABLE(debug_cache, dnl [ --enable-debug_cache Enable consistancy checks when loading and saving header cache], dnl if test "$enableval" != "no"; then dnl AC_DEFINE(DEBUG_CACHE,,[check consistancy ]) dnl fi dnl ) dnl checks for socklen_t SOCK_CHECK_TYPE(socklen_t, int) AC_CHECK_TYPES([long long, int_fast64_t, uint_fast64_t, int32_t, uint32_t, int64_t, uint64_t, intptr_t, uintptr_t]) AC_CHECK_SIZEOF(int_fast64_t) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) dnl checks for ulong AC_CHECK_TYPE(ulong, unsigned long) dnl checks for uchar AC_CHECK_TYPE(uchar, unsigned char) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_BIGENDIAN AC_TYPE_SIZE_T AC_CHECK_TYPE(ssize_t, int) AC_HEADER_TIME AC_STRUCT_TM dnl Checks for library functions. AC_TYPE_SIGNAL AC_FUNC_STRFTIME dnl AC_FUNC_VPRINTF AC_CHECK_FUNCS(stricmp strcasecmp) AC_CHECK_FUNCS(strchr memcpy) dnl again, due to windows' linking methods, you need the correct prototype to find some funcs.. AC_DEFUN([MY_CHECK_SOCKFUNCS],[MY_CHECK_FUNCS([$1],[$2],,,[#include "compat/socketheaders.h"])]) MY_CHECK_SOCKFUNCS([hstrerror],[0]) MY_CHECK_SOCKFUNCS([inet_aton],[NULL,NULL]) MY_CHECK_SOCKFUNCS([gethostbyname],[NULL]) MY_CHECK_SOCKFUNCS([gethostbyaddr],[NULL,0,0]) if test "$nget_ipv6" != "no"; then MY_CHECK_SOCKFUNCS([gai_strerror],[0]) MY_CHECK_SOCKFUNCS([getaddrinfo],[NULL,NULL,NULL,NULL]) MY_CHECK_SOCKFUNCS([freeaddrinfo],[NULL]) MY_CHECK_SOCKFUNCS([getnameinfo],[NULL,0,NULL,0,NULL,0,0]) AC_CHECK_TYPES([struct addrinfo],,,[#include "compat/socketheaders.h"]) fi AC_CHECK_FUNCS(mktime regcomp strerror atoul asprintf vsnprintf vasprintf timegm gmtime_r localtime_r getopt_long flock setlinebuf fcntl fsync getpid) AC_PROTOTYPE_RECV AC_FUNC_MKDIR dnl enable warnings and automatic dependancies if using gcc if test "$GXX" = "yes"; then CXXFLAGS="$CXXFLAGS -Wall -MMD" AC_MSG_CHECKING(if $CXX accepts -MP) if $CXX -MP 2>&1 | grep -- -MP ; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) CXXFLAGS="$CXXFLAGS -MP" fi fi if test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Wall -MMD" AC_MSG_CHECKING(if $CC accepts -MP) if $CC -MP 2>&1 | grep -- -MP ; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes) CFLAGS="$CFLAGS -MP" fi fi AC_OUTPUT(Makefile test/Makefile compat/Makefile par2/Makefile nget.spec,[echo timestamp > stamp-h])