ad dnl Process this file with autoconf to produce a configure script. dnl The ONLY thing this is used for is to configure for different dnl linux architectures and configurations, it is not used to make the dnl code more portable dnl You MUST have an environment that has all the POSIX functions and dnl some of the more populare bsd/sysv ones (like select). You'll also dnl need a C++ compiler that is semi-standard conformant, exceptions are dnl not used but STL is. dnl 'make -f Makefile startup' will generate the configure file from dnl configure.in correctly and can be run at any time AC_PREREQ(2.50) AC_INIT(configure.in) AC_CONFIG_AUX_DIR(buildlib) AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in) dnl -- SET THIS TO THE RELEASE VERSION -- AC_DEFINE_UNQUOTED(VERSION,"0.7.3") PACKAGE="apt" AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE") AC_SUBST(PACKAGE) dnl Check the archs, we want the target type. AC_CANONICAL_SYSTEM dnl Check our C compiler AC_CHECK_TOOL_PREFIX AC_PROG_CC AC_ISC_POSIX dnl Check for other programs AC_PROG_CXX AC_PROG_CPP AC_PROG_RANLIB AC_CHECK_TOOL(AR,ar,"ar") dnl Checks for sockets SAVE_LIBS="$LIBS" LIBS="" AC_SEARCH_LIBS(gethostbyname,nsl) AC_SEARCH_LIBS(connect,socket) SOCKETLIBS="$LIBS" AC_SUBST(SOCKETLIBS) LIBS="$SAVE_LIBS" dnl Checks for pthread -- disabled due to glibc bugs jgg dnl AC_CHECK_LIB(pthread, pthread_create,[AC_DEFINE(HAVE_PTHREAD) PTHREADLIB="-lpthread"]) AC_SUBST(PTHREADLIB) dnl if test "$PTHREADLIB" != "-lpthread"; then dnl AC_MSG_ERROR(failed: I need posix threads, pthread) dnl fi dnl Check for BDB saveLIBS="$LIBS" LIBS="$LIBS -ldb" AC_CHECK_HEADER(db.h, [AC_MSG_CHECKING(if we can link against BerkeleyDB) AC_LINK_IFELSE( [AC_LANG_PROGRAM( [#include ], [int r, s, t; db_version(&r, &s, &t);] )], [AC_DEFINE(HAVE_BDB) BDBLIB="-ldb" AC_MSG_RESULT(yes)], [BDBLIB="" AC_MSG_RESULT(no)] )] ) LIBS="$saveLIBS" AC_SUBST(BDBLIB) dnl Converts the ARCH to be something singular for this general CPU family dnl This is often the dpkg architecture string. dnl First check against the full canonical canoncial-system-type in $target dnl and if that fails, just look for the cpu AC_MSG_CHECKING(system architecture) archset="`awk \" ! /^#|^\\\$/ { if(match(\\\"$target\\\",\\\"^\\\"\\\$1\\\"\\\$\\\")) {print \\\$2; exit}}\" $srcdir/buildlib/systemtable`" if test "x$archset" = "x"; then archset="`awk \" ! /^#|^\\\$/ { if(match(\\\"$target_cpu\\\",\\\"^\\\"\\\$1\\\"\\\$\\\")) {print \\\$2; exit}}\" $srcdir/buildlib/archtable`" if test "x$archset" = "x"; then AC_MSG_ERROR(failed: use --host= or check buildlib/archtable) fi fi AC_MSG_RESULT($archset) AC_DEFINE_UNQUOTED(COMMON_CPU,"$archset") dnl Get a common name for the host OS - this is primarily only for HURD and is dnl non fatal if it fails AC_MSG_CHECKING(system OS) osset="`awk \" ! /^#|^\\\$/ {if (match(\\\"$target_vendor-$target_os\\\",\\\$1)) {print \\\$2; exit}}\" $srcdir/buildlib/ostable`" AC_MSG_RESULT($osset) AC_DEFINE_UNQUOTED(COMMON_OS,"$osset") dnl We use C99 types if at all possible AC_CACHE_CHECK([for C99 integer types],c9x_ints,[ AC_TRY_COMPILE([#include ], [uint8_t Foo1;uint16_t Foo2;uint32_t Foo3;], c9x_ints=yes,c9x_ints=no)]) dnl Single Unix Spec statvfs AC_CHECK_FUNC(statvfs,[HAVE_STATVFS=yes]) AC_SUBST(HAVE_STATVFS) dnl Arg, linux and bsd put their statfs function in different places if test x"$HAVE_STATVFS" != x"yes"; then AC_EGREP_HEADER(statfs,sys/vfs.h,[AC_DEFINE(HAVE_VFS_H)],[ AC_EGREP_HEADER(statfs,sys/mount.h,[AC_DEFINE(HAVE_MOUNT_H)],[AC_MSG_ERROR(failed: Need statvfs)]) ]) fi dnl We should use the real timegm function if we have it. AC_CHECK_FUNC(timegm,AC_DEFINE(HAVE_TIMEGM)) AC_SUBST(HAVE_TIMEGM) dnl Check the sizes etc. of the architecture dnl This is stupid, it should just use the AC macros like it does below dnl Cross compilers can either get a real C library or preload the cache dnl with their size values. changequote(,) archline="`awk \" ! /^#|^\\\$/ {if (match(\\\"$archset\\\",\\\$1)) {print; exit}}\" $srcdir/buildlib/sizetable | cut -f 2- -d ' '`" if test "x$archline" != "x"; then changequote([,]) set $archline if test "$1" = "little"; then ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes fi size_char=$2 size_int=$3 size_short=$4 size_long=$5 fi dnl I wonder what AC_C_BIGENDIAN does if you cross compile... dnl This is probably bogus, as above we only care if we have to build our own dnl C9x types. if test "$cross_compiling" = "yes" -a "x$archline" = "x"; then AC_MSG_ERROR(When cross compiling, architecture must be present in sizetable) fi AC_C_BIGENDIAN dnl We do not need this if we have inttypes! HAVE_C9X=yes if test x"$c9x_ints" = x"no"; then AC_CHECK_SIZEOF(char,$size_char) AC_CHECK_SIZEOF(int,$size_int) AC_CHECK_SIZEOF(short,$size_short) AC_CHECK_SIZEOF(long,$size_long) HAVE_C9X= AC_SUBST(HAVE_C9X) fi dnl HP-UX sux.. AC_MSG_CHECKING(for missing socklen_t) AC_EGREP_HEADER(socklen_t, sys/socket.h,[AC_MSG_RESULT(no)],[ AC_DEFINE(NEED_SOCKLEN_T_DEFINE) NEED_SOCKLEN_T_DEFINE=yes AC_MSG_RESULT(missing.)]) AC_SUBST(NEED_SOCKLEN_T_DEFINE) dnl HP-UX needs -d_XOPEN_SOURCE_EXTENDED for h_errno AC_MSG_CHECKING(for h_errno) AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(normal)], [CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" AC_EGREP_HEADER(h_errno, netdb.h, [AC_MSG_RESULT(needs _XOPEN_SOURCE_EXTENDED)], [AC_MSG_ERROR("not found.")]) ]) dnl Check for debiandoc AC_PATH_PROG(DEBIANDOC_HTML,debiandoc2html) AC_PATH_PROG(DEBIANDOC_TEXT,debiandoc2text) dnl Check for doxygen AC_PATH_PROG(DOXYGEN, doxygen) dnl Check for the SGML tools needed to build man pages AC_PATH_PROG(DOCBOOK2MAN,docbook2man) dnl Check for the XML tools needed to build man pages AC_PATH_PROG(XMLTO,xmlto) dnl Check for graphviz AC_CHECK_PROG([HAVE_DOT], [dot], [YES], [NO]) AC_PATH_PROG([DOT], [dot], []) DOTDIR=$(dirname $DOT) AC_SUBST(DOTDIR) dnl Check for YODL dnl AC_CHECK_PROG(YODL_MAN,yodl2man,"yes","") ah_NUM_PROCS rc_GLIBC_VER rc_LIBSTDCPP_VER ah_GCC3DEP dnl It used to be that the user could select translations and that could get dnl passed to the makefiles, but now that can only work if you use special dnl gettext approved makefiles, so this feature is unsupported by this. ALL_LINGUAS="bg bs ca cs cy da de dz el en_GB es eu fi fr gl hu it ja ko ku nb nl nn pl pt_BR pt ro ru sk sl sv tl uk vi zn_CN zh_TW" AM_GNU_GETTEXT(external) if test x"$USE_NLS" = "xyes"; then AC_DEFINE(USE_NLS) fi AC_SUBST(USE_NLS) AC_PATH_PROG(BASH, bash) AC_OUTPUT(environment.mak:buildlib/environment.mak.in makefile:buildlib/makefile.in doc/Doxyfile,make -s dirs)