dnl $Id: configure.in,v 1.8 2005/10/31 21:29:16 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 SB=`./shtool echo -n -e %B` EB=`./shtool echo -n -e %b` AC_DEFUN(BOLD_MESSAGE,[ AC_MSG_RESULT() AC_MSG_RESULT(${SB}$1${EB}) AC_MSG_RESULT() ]) PACKAGE=ptlink-services VERSION=`grep '#define.svs_version' include/patchlevel.h|awk '{print $3}'|tr -d \"` BOLD_MESSAGE(Configuring ${VERSION} ...) AC_CONFIG_AUX_DIR(autoconf) AC_CONFIG_HEADER(include/setup.h) AC_PREFIX_DEFAULT($HOME/ircsvs) 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="$OLD_CFLAGS" dnl Check for various compilers. -jmallett SGS=no AC_MSG_CHECKING(if we are using TenDRA or MIPSpro) case `$CC -version 2>&1` in *TenDRA*) AC_MSG_RESULT(success! We will be using TenDRA.) TenDRA=yes SGS=yes ;; *MIPSpro*) AC_MSG_RESULT(success! We will be using MIPSpro.) MIPSpro=yes SGS=yes ;; *) AC_MSG_RESULT(no) TenDRA=no MIPSpro=no ;; esac AC_MSG_CHECKING(if we are using Sun WorkShop/Forte) case `$CC -V 2>&1` in *Sun*WorkShop*) AC_MSG_RESULT(success! We are using Sun WorkShop/Forte.) SunWorkShop=yes SGS=yes ;; *Forte*Developer*) AC_MSG_RESULT(success! We are using Sun WorkShop/Forte.) SunWorkShop=yes SGS=yes ;; *) AC_MSG_RESULT(no) SunWorkShop=no ;; esac AC_MSG_CHECKING(if we are using Apple GCC) case `$CC -v 2>&1 | tail -1` in *Apple*) AC_MSG_RESULT(success! We are using GCC from Apple.) AppleGCC=yes ;; *) AC_MSG_RESULT(no) AppleGCC=no ;; esac dnl SVR4 SGS based on what we know about the compiler -jmallett AC_MSG_CHECKING(if your compiler supports the SVR4 Software Generation System interfaces) if test "$SGS" = "yes"; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi dnl XXX This could be consecutive 'if' statements, and then check dnl for a zero "$CFLAGS" (but what should we use for TenDRA??) dnl and then do the check for whether -g works... Hrrm. -jmallett if test "x$GCC" = "xyes"; then # Use this for development.. # CFLAGS="-O2 -g -Wunused -Wall -Wshadow -Wmissing-declarations" CFLAGS="-Wall -g " else if test "x$TenDRA" = "xyes"; then dnl CPPFLAGS here is really CFLAGS but autoconf does silly dnl things with the wrong variables, so this works. -jmallett CFLAGS="" CPPFLAGS="$CPPFLAGS -Ylonglong -Yansi -I/usr/include" else if test "x$SunWorkShop" = "xyes"; then CFLAGS="-fast -g -xinline=dlinkAdd,dlinkAddBefore,dlinkAddTail,dlinkDelete,dlink_list_length,dlink_node,dlinkMoveList,_MyMalloc,_MyRealloc,_MyFree,_DupString" else if test "x$MIPSpro" = "xyes"; then CFLAGS="-g" else if test "x$ac_cv_prog_cc_g" = "xyes"; then CFLAGS="-g" else CFLAGS="" fi fi fi fi 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) CFLAGS="$CFLAGS +e" HPUX=yes ;; OSF*) OSF=yes ;; *) ;; esac AC_MSG_CHECKING(how to generate dependancy info) if test "$SunWorkShop" = "yes"; then AC_MSG_RESULT(Sun WorkShop/Forte using $CC -xM) MKDEP="$CC -xM" fi 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 CFLAGS="$CFLAGS $CPPFLAGS" fi 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 check if sendmail was found if test -f /usr/sbin/sendmail ; then AC_DEFINE(SENDMAIL,"/usr/sbin/sendmail", [sendmail path]) echo "sendmail found at /usr/sbin/sendmail" else AC_PATH_PROG(SENDMAIL, sendmail) fi 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. dnl Check for zlib support (-lz) by looking for deflate(). Then check dnl for zlib 1.0.2 or higher by looking for zlibVersion(). AC_CHECK_LIB(z, deflate) mysql_support="yes" default_directory="/usr /usr/local" AC_DEFUN(FAIL_MESSAGE,[ echo echo echo "**********************************************" echo " ERROR: unable to find" $1 echo " checked in the following places" for i in `echo $2`; do echo " $i" done echo "**********************************************" echo exit ]) # Keep the previous state to check later OLIBS=$LIBS AC_ARG_WITH(mysql, [ --with-mysql=DIR support for mysql], [ with_mysql="$withval" ], [ with_mysql=yes ]) if test "$with_mysql" != "no"; then if test "$with_mysql" = "yes"; then mysql_directory="$default_directory"; mysql_fail="yes" elif test -d $withval; then mysql_directory="$withval" mysql_fail="no" elif test "$with_mysql" = ""; then mysql_directory="$default_directory"; mysql_fail="no" fi AC_MSG_CHECKING(for mysql) for i in $mysql_directory; do if test -r $i/include/mysql/mysql.h; then MYSQL_DIR=$i MYSQL_INC_DIR=$i/include/mysql elif test -r $i/include/mysql.h; then MYSQL_DIR=$i MYSQL_INC_DIR=$i/include fi done if test -z "$MYSQL_DIR"; then if test "$mysql_fail" != "no"; then tmp="" for i in $mysql_directory; do tmp="$tmp $i/include $i/include/mysql" done FAIL_MESSAGE("mysql headers (mysql.h)", $tmp) else AC_MSG_RESULT(no) fi else for i in lib lib/mysql; do str="$MYSQL_DIR/$i/libmysqlclient.*" for j in `echo $str`; do if test -r $j; then MYSQL_LIB_DIR="$MYSQL_DIR/$i" break 2 fi done done if test -z "$MYSQL_LIB_DIR"; then if test "$mysql_fail" != "no"; then FAIL_MESSAGE("mysqlclient library", "$MYSQL_DIR/lib $MYSQL_DIR/lib/mysql") else AC_MSG_RESULT(no) fi else AC_MSG_RESULT(yes) mysql_support="yes" LDFLAGS="${LDFLAGS} -L${MYSQL_LIB_DIR}" CPPFLAGS="${CPPFLAGS} -I${MYSQL_INC_DIR}" AC_DEFINE(HAVE_MYSQL, 1, [Define if you have mysql development libraries]) MYSQL_DEPENDENT="\${MYSQL_DEP_SRCS}" dnl AC_CHECK_LIB(z, compress) LIBS="${LIBS} -lmysqlclient" fi fi fi 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/resource.h sys/param.h unistd.h errno.h string.h strings.h stdlib.h stddef.h getopt.h mysql/mysql.h libgen.h termios.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 setenv AC_CHECK_FUNCS(setenv gettimeofday) dnl CPPFLAGS="$cpp_flags_backup" dnl unset cpp_flags_backup dnl Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_CHECK_TYPE(u_int32_t, unsigned int) AC_CHECK_TYPE(uintptr_t) rm -f conftest conftest.f dnl Magic which checks whether we are forcing a type of comm loop we dnl are actually going to (ab)use dnl Actually do the define magic now dnl mostly ripped from squid-commloops, thanks to adrian and benno dnl Here are two helper functions to discover the dnl implemented way in the OS that shared module support dnl has to use. -TimeMr14C AC_DEFUN(CHECK_DLOPEN_LD, [ AC_CHECK_FUNC(shl_load, [ AC_DEFINE(HAVE_SHL_LOAD,,[Have shl_load]) ac_cv_have_shl_load='yes' ], AC_CHECK_LIB(dld, shl_load, AC_DEFINE(HAVE_SHL_LOAD), [ ac_cv_have_shl_load='no' echo "shl_load could not be found" ])) ]) AC_DEFUN(CHECK_DLOPEN_DL, [ AC_CHECK_FUNC(dlopen, [ ac_cv_have_dlopen='yes' ], AC_CHECK_LIB(dl, dlopen, [ ac_cv_have_dlopen='yes' ], [ ac_cv_have_dlopen='no' ])) ]) dnl small-net AC_ARG_ENABLE(develop, [ --enable-develop Enable development compiler options. --disable-develop Disable development compiler options. ], [ case "$enableval" in yes) echo "Enabling development compiler options." CFLAGS="-g -Wshadow -Wunused -Wall -Wmissing-declarations -ansi" ;; no) echo "Disabling development compiler options." CFLAGS="$CFLAGS" ;; esac ]) AC_ARG_ENABLE(profile, [ --enable-profile Enable code profile options. --disable-profile Disable code profile options. ], [ case "$enableval" in yes) echo "Enabling code profile options." CFLAGS="-pg" ;; no) echo "Disabling code profile options." CFLAGS="$CFLAGS" ;; esac ]) AC_ARG_ENABLE(halfops, [ --enable-halfops Support halfops chanmode [default=no]],[ halfops_support=$enableval ],[ halfops_support=no ]) dnl check for halfops AC_MSG_CHECKING([whether to support halfops chanmode]) if test x"$halfops_support" = xyes ; then AC_MSG_RESULT([yes]) AC_DEFINE(HALFOPS,1,[halfops support]) dnl options="${options}utf-8 " else AC_MSG_RESULT([no]) fi echo "Checking for shared module support" MODULES_DEFINE="" MODULES_LIBS="" MOD_TARGET="shared_modules" SEDOBJ="-e s/.o:/.so:/" CHECK_DLOPEN_LD dnl if test "$ac_cv_have_shl_load" = "no"; then dnl AC_CHECK_HEADER([mach-o/dyld.h],, [CHECK_DLOPEN_DL]) dnl fi if test "$ac_cv_have_dlopen" = "no"; then AC_MSG_ERROR(shared module support could not be found - try running configure with --disable-shared-modules) fi dnl Without this, include/setup.h will not be set up right. AC_CHECK_LIB(dl, dlsym) AC_CHECK_FUNCS(dlopen) AC_CHECK_FUNCS(dlfunc) AC_CHECK_HEADERS(mach-o/dyld.h dlfcn.h) # The GNU linker requires the -export-dynamic option to make # all symbols visible in the dynamic symbol table. hold_ldflags=$LDFLAGS AC_MSG_CHECKING(for the ld -export-dynamic flag) LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" AC_TRY_LINK(, [int i;], found=yes, found=no) LDFLAGS=$hold_ldflags AC_MSG_RESULT($found) if test $found = yes; then LDFLAGS="${LDFLAGS} -Wl,-export-dynamic" fi AC_MSG_CHECKING(for compiler option to produce PIC) dnl The order should be here to check for groups of compilers, dnl then for odd compilers, then if no PICFLAGS were set up, dnl check for GCC and set defaults, or else error. -jmallett if test "$SGS" = "yes"; then AC_MSG_RESULT(SVR4 Software Generation System interfaces: -KPIC -DPIC -G) PICFLAGS="-KPIC -DPIC -G" fi if test "$AppleGCC" = "yes"; then AC_MSG_RESULT(Darwin or Mac OS X - Assuming you want to make Mach-O bundles: -fno-common -bundle -flat_namespace -undefined suppress) PICFLAGS="-fno-common -bundle -flat_namespace -undefined suppress" fi dnl Please note, that on HPUX two different stages of module compilation occurs, since dnl while compiling modules, the compiler does not allow you to give arguments dnl to the linker. (I did not design this) dnl So we need -c in the first stage of module compilation. dnl In the second stage, we link the modules via ld -b. dnl Additionally, HPUX does not like -export-dynamic, it likes -E instead. dnl -TimeMr14C if test "$HPUX" = "yes"; then AC_MSG_RESULT(HP-UX - Assuming HPUX C compiler cc: +z -r -q -n +ESfic) PICFLAGS="+z -r -q -n +ESfic -c" MOD_TARGET="hpux_shared" LDFLAGS="${LDFLAGS} -Wl,-E" fi if test -z "$PICFLAGS"; then if test "$ac_cv_prog_gcc" = "yes"; then AC_MSG_RESULT(gcc: -fPIC -DPIC -shared) PICFLAGS="-fPIC -DPIC -shared" if test "$OSF" = "yes"; then echo "OSF Discovered: Adding -Wl,-expect_unresolved -Wl,* to compiler flags" PICFLAGS="$PICFLAGS -Wl,-expect_unresolved -Wl,*" fi else AC_MSG_RESULT(no) AC_MSG_ERROR(could not find a way to produce position independent code. Try ./configure --disable-shared-modules) fi fi AC_SUBST(PICFLAGS) AC_ARG_WITH(pidfile, [ --with-pidfile=filename Specify the pathname of the pid file )], [ AC_DEFINE_UNQUOTED(PIDFILE,"$withval",[Pidfile]) pid_file="$withval" ] ,) AC_SUBST(MODULES_DEFINE) AC_SUBST(MODULES_LIBS) AC_SUBST(MOD_TARGET) AC_SUBST(INCDEP) AC_SUBST(SUBDIR_MESSAGES) AC_SUBST(LDFLAGS) AC_SUBST(MSGFMT) AC_SUBST(CFLAGS) AC_SUBST(SEDOBJ) AC_SUBST(MYSQL_DEPENDENT) AC_SUBST(WEB_DEPENDENT) AC_OUTPUT( \ Makefile \ libircservice/Makefile \ libircservice/src/Makefile \ src/Makefile \ modules/Makefile \ modules/sql/Makefile \ modules/etc/Makefile \ modules/compile.sh \ etc/Makefile \ utils/Makefile \ ) bpath=`eval echo ${bindir}` bpath=`eval echo ${bpath}` cpath=`eval echo ${sysconfdir}` lpath=`eval echo ${localstatedir}`/var dnl lets run libircservice configure here cd libircservice ./configure cd .. echo " PTlink IRC Services version: ${VERSION} Install path: ${prefix} Compiler options: ${CFLAGS} " # Web support: ${web_support} echo "#define BINPATH \"${bpath}\"" > include/path.h echo "#define ETCPATH \"${cpath}\"" >> include/path.h echo "#define VARPATH \"${lpath}\"" >> include/path.h echo "#define LOGPATH \"${lpath}/log\"" >> include/path.h echo "#define MODPATH \"${bpath}/modules\"" >> include/path.h echo "#define SQLPATH \"${lpath}/modules/sql\"" >> include/path.h echo "" > src/.depend echo "" > modules/.depend #vers=`echo $VERSION | sed "s/PTlinkServices//g" | sed "s/\./\\\./g"` #vers=`echo $vers | sed "s/\./\\\./g"` changes=`wc -l modules/etc/CHANGES | awk ' {print $1}'` if [[ ! $changes -eq 0 ]]; then echo "There are $changes configuration/modules change(s):" echo "---------------------------------------------------" cat modules/etc/CHANGES fi echo ""