dnl $Id: configure.in,v 1.2 2005/10/01 08:34:27 jpinto Exp $ dnl Process this file with autoconf to produce a configure script. dnl AC_INIT(include/class.h) <- what is this ? -TimeMr14C AC_INIT AC_CONFIG_AUX_DIR(autoconf) AC_CONFIG_HEADER(include/setup.h) AC_PREFIX_DEFAULT($HOME/services) PACKAGE=libirservice VERSION=`grep '#define.PATCHLEVEL' include/patchlevel.h|awk '{print $3}'|tr -d \"` AC_SUBST(PACKAGE) AC_SUBST(VERSION) OLD_CFLAGS="$CFLAGS" dnl Checks for programs. AC_PROG_CC dnl Make sure autoconf doesnt interfere with cflags -jmallett CFLAGS="$CFLAGS -Wall" if test "x$GCC" = "xyes"; then # Use this for development.. # MAIN_CFLAGS="-O2 -g -Wunused -Wall -Wshadow -Wmissing-declarations" MAIN_CFLAGS="-O2 -g " fi dnl cc on HPUX 11.00 does not produce any output on cc -V dnl Therefore I will use the following hack to discover HPUX dnl -TimeMr14C case `uname -s` in HP-UX*) AC_MSG_RESULT(HP-UX found - Assuming HPUX C compiler cc) MAIN_CFLAGS="$MAIN_CFLAGS +e" HPUX=yes ;; OSF*) OSF=yes ;; *) ;; esac AC_MSG_CHECKING(how to generate dependancy info) if test "$HPUX" = "yes"; then AC_MSG_RESULT(HP-UX C Compiler using makedepend) MKDEP="makedepend" fi if test "x$MKDEP" = "x"; then AC_MSG_RESULT(assuming $CC -MM) MKDEP="$CC -MM" fi AC_SUBST(MKDEP) dnl jdc -- If CFLAGS is defined, best use it everywhere... dnl NOTE: jv says it must be added to the *END*, because things like dnl "gcc -O9 -O2" will result in -O2 getting preference. How stupid. if test "x$CFLAGS" != "x"; then MAIN_CFLAGS="$MAIN_CFLAGS $CPPFLAGS" fi AC_ARG_ENABLE(develop, [ --enable-develop Enable development support. --disable-develop Disable development support. ], [ case "$enableval" in yes) echo "Enabling development support." CFLAGS="-g -Wunused -Wall -Wshadow -Wmissing-declarations -ansi" ;; no) echo "Disabling development support." CFLAGS="$CFLAGS" ;; esac ]) AC_ISC_POSIX AC_PROG_MAKE_SET AC_PATH_PROG(RM, rm) AC_PATH_PROG(CP, cp) AC_PATH_PROG(MV, mv) AC_PATH_PROG(LN, ln) AC_PATH_PROG(SED, sed) AC_PATH_PROG(AR, ar) AC_PATH_PROG(LD, ld) AC_PROG_INSTALL AC_PROG_RANLIB AC_C_INLINE dnl use directory structure of cached as default (hack) if test "$libexecdir" = '${exec_prefix}/libexec' && test "$localstatedir" = '${prefix}/var'; then libexecdir='${bindir}' localstatedir='${prefix}' fi dnl Checks for libraries. AC_CHECK_LIB(socket, socket) dnl jdc -- Checks Solaris for libresolv and nsl; needed on Solaris 2.x dnl AC_CHECK_LIB(resolv, main) dnl AC_CHECK_LIB(nsl, main) dnl AC_CHECK_LIB(bottle, beer, , AC_MSG_WARN(I have no more beer)) dnl Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS(inttypes.h sys/param.h unistd.h errno.h string.h strings.h stdlib.h stddef.h) dnl See whether we can include both string.h and strings.h. AC_DEFUN(GCC_HEADER_STRING, [AC_CACHE_CHECK([whether string.h and strings.h may both be included], gcc_cv_header_string, [AC_TRY_COMPILE([#include #include ], , gcc_cv_header_string=yes, gcc_cv_header_string=no)]) if test $gcc_cv_header_string = yes; then AC_DEFINE(STRING_WITH_STRINGS,,"string with strings") fi ]) GCC_HEADER_STRING dnl Check for stdarg.h - if we can't find it, halt configure AC_CHECK_HEADER(stdarg.h, , AC_MSG_ERROR(** stdarg.h could not be found - ircd-hybrid will not compile without it **)) dnl check for gethostbyname AC_CHECK_FUNCS(gethostbyname gettimeofday) dnl check for snprintf AC_CHECK_FUNCS(snprintf, [have_snprintf=1]) dnl check for vsnprintf AC_CHECK_FUNCS(vsnprintf, [have_vsnprintf=1]) dnl Tell src/Makefile.in if we need its snprintf.c if test -z "$have_snprintf"; then SNPRINTF_C="snprintf.c" fi if test -z "$have_vsnprintf"; then SNPRINTF_C="snprintf.c" fi AC_SUBST(SNPRINTF_C) dnl taken from ircd's Config script AC_MSG_CHECKING(for non-blocking socket implementation) AC_TRY_RUN( [ #include #include #include #include #include #include alarmed() { exit(1); } int main() { #if defined(O_NONBLOCK) char b[12], x[32]; int f, l = sizeof(x); f = socket(AF_INET, SOCK_DGRAM, 0); if (f >= 0 && !(fcntl(f, F_SETFL, O_NONBLOCK))) { signal(SIGALRM, alarmed); alarm(3); recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l); alarm(0); exit(0); } #endif exit(1); } ], AC_DEFINE(NBLOCK_POSIX,,"POSIX") AC_MSG_RESULT( O_NONBLOCK ),, AC_MSG_RESULT( cross compiling )) AC_TRY_RUN( [ #include #include #include #include #include #include alarmed() { exit(1); } int main() { #if defined( O_NDELAY ) && !defined( NBLOCK_POSIX ) char b[12], x[32]; int f, l = sizeof(x); f = socket(AF_INET, SOCK_DGRAM, 0); if (f >= 0 && !(fcntl(f, F_SETFL, O_NDELAY))) { signal(SIGALRM, alarmed); alarm(3); recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l); alarm(0); exit(0); } #endif exit(1); } ], AC_DEFINE(NBLOCK_BSD,,"BSD") AC_MSG_RESULT( O_NDELAY ),, AC_MSG_RESULT(unable to test)) AC_TRY_RUN( [ #include #include #include #include #include #include alarmed() { exit(1); } int main() { #if !defined(NBLOCK_BSD) && !defined(NBLOCK_POSIX) && defined(FIONBIO) char b[12], x[32]; int f, l = sizeof(x); f = socket(AF_INET, SOCK_DGRAM, 0); if (f >= 0 && !(fcntl(f, F_SETFL, FIONBIO))) { signal(SIGALRM, alarmed); alarm(3); recvfrom(f, b, 12, 0, (struct sockaddr *)x, &l); alarm(0); exit(0); } #endif /* !NBLOCK_POSIX && !NBLOCK_BSD && FIONBIO */ exit(1); } ], AC_DEFINE(NBLOCK_SYSV,,"SYSV") AC_MSG_RESULT(FIONBIO),, AC_MSG_RESULT(unable to test)) AC_MSG_CHECKING(if you want to do a profile build) AC_ARG_ENABLE(profile, [ --enable-profile Enable profiling. --disable-profile Disable profiling(default). ], [ case "$enableval" in yes) ac_cv_profile="yes" MAIN_CFLAGS="$MAIN_CFLAGS -pg -static" ;; no) ac_cv_profile="no" ;; esac ]) AC_MSG_RESULT($ac_cv_profile) dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_CHECK_TYPE(u_int32_t, unsigned int) AC_CHECK_TYPE(uintptr_t) AC_CHECK_TYPE(u_short) rm -f conftest conftest.f AC_SUBST(LDFLAGS) AC_SUBST(MAIN_CFLAGS) AC_OUTPUT( \ Makefile \ src/Makefile \ samples/Makefile \ ) echo " ircservice lib version: ${VERSION} Compiler options: ${CC} ${CFLAGS} "