# # Copyright (C) 1999 Rob Crittenden (rcrit@greyoak.com) # Copyright (C) 1999,2000 Ross Combs (rocombs@cs.nmsu.edu) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Process this file with autoconf to produce a configure script. AC_INIT(bnetd/handle_bnet.c) AC_CONFIG_HEADER(config.h) AUTOCONF_CONFIG_DIR="autoconf" AC_CONFIG_AUX_DIR(${AUTOCONF_CONFIG_DIR}) builtin(include,autoconf/ccstdc.m4) builtin(include,autoconf/mkdir.m4) AC_CANONICAL_SYSTEM # Checks for programs. AC_PROG_CC AC_PROG_INSTALL # Checks compiler. AC_PROG_CPP # Checks for systems. AC_AIX AC_ISC_POSIX AC_MINIX # Custom checks. zwarnflags="" AC_ARG_WITH(warn, [ --with-warn enable compiler warnings], [zwarnflags="-pedantic -Wall -W -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wunreachable-code -Winline -Wpacked -Wno-sign-compare"]) zlangflags="" AC_ARG_WITH(ansi, [ --with-ansi use ANSI C mode], [zlangflags="-ansi -pedantic"]) extra_include="" AC_ARG_WITH(includes, [ --with-includes=DIR search include DIR for header files], [ case "x$withval" in x/*|x.*) AC_MSG_RESULT([adding ${withval} to include search path]) if test ! -d ${withval}; then AC_MSG_RESULT([Warning: directory ${withval} does not exist]) fi extra_include="${extra_include} -I${withval}" ;; *) AC_MSG_RESULT([not adding any includes]) ;; esac]) extra_lib_dir="" AC_ARG_WITH(libraries, [ --with-libraries=DIR search library DIR for libraries], [ case "x${withval}" in x/*|x.*) AC_MSG_RESULT([adding ${withval} to library search path]) if test ! -d ${withval}; then AC_MSG_RESULT([Warning: directory ${withval} does not exist]) fi extra_lib_dir="${extra_lib_dir} -L${withval}" ;; *) AC_MSG_RESULT([not adding any libs]) ;; esac]) extra_lib="" AC_ARG_WITH(efence, [ --with-efence link with Electric Fence to find memory problems], [extra_lib="${extra_lib} -lefence"]) AC_ARG_WITH(mysql, [ --with-mysql include MySQL user accounts support]) AC_ARG_WITH(pgsql, [ --with-pgsql include PostgreSQL user accounts support]) AC_ARG_WITH(mssql, [ --with-mssql include MSSQL user accounts support (requires FreeTDS includes/libs)]) AC_ARG_WITH(sqlite3, [ --with-sqlite3 include SQLite3 user accounts support ]) AC_ARG_WITH(odbc, [ --with-odbc include ODBC user accounts support ]) extra_define="" dnl Enable poll() AC_ARG_ENABLE(poll, [ --enable-poll Enable poll() instead of select(). Normally poll is preferred over select, but configure knows poll is broken on some platforms. If you think you are smarter than the configure script, you may enable poll with this option. --disable-poll Disable the use of poll().], [ case "$enableval" in yes) echo "Forcing poll() to be enabled" ac_cv_func_poll='yes' ;; no) echo "Forcing poll() to be disabled" ac_cv_func_poll='no' ;; esac ]) dnl Shamesly stolen from squid 2.3 configure.in dnl This has to be before AC_CHECK_FUNCS # Disable poll() on certain platforms. Override by setting ac_cv_func_poll # when running configure. if test -z "$ac_cv_func_poll"; then case "$host" in [alpha-dec-osf3.*]) # John Kay (jkay@nlanr.net) 19970818 echo "disabling poll for $host..." ac_cv_func_poll='no' ;; [*-hp-hpux*.*]) # Duane Wessels echo "disabling poll for $host..." ac_cv_func_poll='no' ;; [*-linux-*]) # Henrik Nordstrom (hno@hem.passagen.se) 19980817 # poll is problematic on Linux. We disable it # by default until Linux gets it right. rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'` if test $rev -lt 002002; then echo "disabling poll for $host < 2.2..." ac_cv_func_poll='no' fi ;; [powerpc-ibm-aix4.1.*]) # Mike Laster (mlaster@metavillage.com) 19981021 echo "disabling poll for $host..." ac_cv_func_poll='no' ;; [*-pc-sco3.2*]) # Robert Side # Mon, 18 Jan 1999 17:48:00 GMT echo "disabling poll for $host..." ac_cv_func_poll='no' ;; esac fi # disable parts of the build process AC_ARG_ENABLE(bnetd, [ --enable-bnetd Enable building of bnetd server (default) --disable-bnetd Disable building of bnetd server]) AC_ARG_ENABLE(d2cs, [ --enable-d2cs Enable building of d2cs server (default) --disable-d2cs Disable building of d2cs server]) AC_ARG_ENABLE(d2dbs, [ --enable-d2dbs Enable building of d2dbs server (default) --disable-d2dbs Disable building of d2dbs server]) LDFLAGS="${LDFLAGS} ${extra_lib_dir}" LIBS="${LIBS} ${extra_lib}" CFLAGS="${CFLAGS} ${zlangflags} ${zwarnflags}" DEFINES="${DEFINES} ${extra_define}" CPPFLAGS="${CPPFLAGS} ${extra_include}" # This is our invention so we have to substitute it ourselves # autoconf uses DEFS AC_SUBST(DEFINES) AC_SUBST(enable_bnetd) AC_SUBST(enable_d2cs) AC_SUBST(enable_d2dbs) # Checks for compiler quirks. AC_PROG_GCC_TRADITIONAL AM_PROG_CC_STDC AC_C_CONST AC_C_INLINE #AC_EXEEXT # Checks for libraries. AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"]) AC_CHECK_LIB(z, compress, [LIBS="$LIBS -lz"]) mysql_include_path="" dnl Detecting mysql paths if test "$with_mysql" = "yes" ; then AC_MSG_CHECKING([for mysql include path]) mysql_try_includes="/usr/include /usr/include/mysql /usr/local/include /usr/local/include/mysql /usr/local/mysql/include /usr/local/mysql/include/mysql" for i in `echo ${mysql_try_includes}`; do if test -f "${i}/mysql.h" ; then CPPFLAGS="${CPPFLAGS} -I${i}" mysql_include_path=${i} break fi done if test -n "$mysql_include_path" ; then AC_MSG_RESULT([found in $mysql_include_path]) else AC_MSG_ERROR([not found, please install the MySQL headers]) fi fi mysql_lib_path="" if test "$with_mysql" = "yes" ; then AC_CHECK_LIB(mysqlclient, mysql_init , [DEFINES="${DEFINES} -DWITH_SQL_MYSQL" ; LIBS="${LIBS} -lmysqlclient"], [ AC_MSG_CHECKING([for mysql lib path]) mysql_try_libs="/usr/lib /usr/lib/mysql /usr/local/lib /usr/local/lib/mysql /usr/local/mysql/lib /usr/local/mysql/lib/mysql" found="" for i in `echo ${mysql_try_libs}`; do if test -f "${i}/libmysqlclient.so" -o -f "${i}/libmysqlclient.a" ; then save_ldflags="${LDFLAGS}" LDFLAGS="${LDFLAGS} -L${i}" AC_CHECK_LIB(mysqlclient, mysql_close , [DEFINES="${DEFINES} -DWITH_SQL_MYSQL" ; LIBS="${LIBS} -lmysqlclient" ; mysql_lib_path="${i}"], [LDFLAGS="${save_ldflags}"]) break fi done if test -n "$mysql_lib_path" ; then AC_MSG_RESULT([found in $mysql_lib_path]) else AC_MSG_ERROR([not found, please install the MySQL libraries]) fi ]) fi pgsql_include_path="" dnl Detecting pgsql paths if test "$with_pgsql" = "yes" ; then AC_MSG_CHECKING([for pgsql include path]) pgsql_try_includes="/usr/include /usr/include/pgsql /usr/local/include /usr/local/include/pgsql /usr/local/pgsql/include" for i in `echo ${pgsql_try_includes}`; do if test -f "${i}/libpq-fe.h" ; then CPPFLAGS="${CPPFLAGS} -I${i}" pgsql_include_path=${i} break fi done if test -n "$pgsql_include_path" ; then AC_MSG_RESULT([found in $pgsql_include_path]) else AC_MSG_ERROR([not found, please install the PostgreSQL includes]) fi fi pgsql_lib_path="" if test "$with_pgsql" = "yes" ; then AC_CHECK_LIB(pq, PQsetdbLogin , [DEFINES="${DEFINES} -DWITH_SQL_PGSQL" ; LIBS="${LIBS} -lpq"], [ AC_MSG_CHECKING([for pgsql lib path]) pgsql_try_libs="/usr/lib /usr/lib/pgsql /usr/local/lib /usr/local/lib/pgsql /usr/local/pgsql/lib" for i in `echo ${pgsql_try_libs}`; do if test -f "${i}/libpq.so" -o -f "${i}/libpq.a" ; then save_ldflags="${LDFLAGS}" LDFLAGS="${LDFLAGS} -L${i}" AC_CHECK_LIB(pq, PQfinish , [DEFINES="${DEFINES} -DWITH_SQL_PGSQL" ; LIBS="${LIBS} -lpq" ; pgsql_lib_path="${i}"], [LDFLAGS="${save_ldflags}"]) break fi done if test -n "$pgsql_lib_path" ; then AC_MSG_RESULT([found in $pgsql_lib_path]) else AC_MSG_ERROR([not found, please install the PostgreSQL libraries]) fi ]) fi mssql_include_path="" dnl Detecting mssql paths if test "$with_mssql" = "yes" ; then AC_MSG_CHECKING([for mssql/FreeTDS include path]) mssql_try_includes="/usr/include /usr/include/freetds /usr/local/include /usr/local/include/freetds /usr/local/freetds/include" for i in `echo ${mssql_try_includes}`; do if test -f "${i}/sqlfront.h" ; then CPPFLAGS="${CPPFLAGS} -I${i}" mssql_include_path=${i} break fi done if test -n "$mssql_include_path" ; then AC_MSG_RESULT([found in $mssql_include_path]) else AC_MSG_ERROR([not found, please install the FreeTDS includes]) fi fi mssql_lib_path="" if test "$with_mssql" = "yes" ; then AC_CHECK_LIB(sybdb, dbinit, [DEFINES="${DEFINES} -DWITH_SQL_MSSQL" ; LIBS="${LIBS} -lsybdb"], [ AC_MSG_CHECKING([for mssql/FreeTDS lib path]) mssql_try_libs="/usr/lib /usr/lib/freetds /usr/local/lib /usr/local/lib/freetds /usr/local/freetds/lib" for i in `echo ${mssql_try_libs}`; do if test -f "${i}/libsybdb.so" -o -f "${i}/libsybdb.a" ; then save_ldflags="${LDFLAGS}" LDFLAGS="${LDFLAGS} -L${i}" AC_CHECK_LIB(sybdb, dbclose, [DEFINES="${DEFINES} -DWITH_SQL_MSSQL" ; LIBS="${LIBS} -lsybdb" ; mssql_lib_path="${i}"], [LDFLAGS="${save_ldflags}"]) break fi done if test -n "$mssql_lib_path" ; then AC_MSG_RESULT([found in $mssql_lib_path]) else AC_MSG_ERROR([not found, please install the FreeTDS libraries]) fi ]) fi sqlite3_include_path="" dnl Detecting sqlite3 paths if test "$with_sqlite3" = "yes" ; then AC_MSG_CHECKING([for SQLite3 include path]) sqlite3_try_includes="/usr/include /usr/include/sqlite3 /usr/local/include /usr/local/include/sqlite3 /usr/local/sqlite3/include" for i in `echo ${sqlite3_try_includes}`; do if test -f "${i}/sqlite3.h" ; then CPPFLAGS="${CPPFLAGS} -I${i}" sqlite3_include_path=${i} break fi done if test -n "$sqlite3_include_path" ; then AC_MSG_RESULT([found in $sqlite3_include_path]) else AC_MSG_ERROR([not found, please install the SQLite3 includes]) fi fi sqlite3_lib_path="" if test "$with_sqlite3" = "yes" ; then AC_CHECK_LIB(sqlite3, sqlite3_open, [DEFINES="${DEFINES} -DWITH_SQL_SQLITE3" ; LIBS="${LIBS} -lsqlite3"], [ AC_MSG_CHECKING([for SQLite3 lib path]) sqlite3_try_libs="/usr/lib /usr/lib/sqlite3 /usr/local/lib /usr/local/lib/sqlite3 /usr/local/sqlite3/lib" for i in `echo ${sqlite3_try_libs}`; do if test -f "${i}/libsqlite3.so" -o -f "${i}/libsqlite3.a" ; then save_ldflags="${LDFLAGS}" LDFLAGS="${LDFLAGS} -L${i}" AC_CHECK_LIB(sqlite3, sqlite3_close, [DEFINES="${DEFINES} -DWITH_SQL_SQLITE3" ; LIBS="${LIBS} -lsqlite3" ; sqlite3_lib_path="${i}"], [LDFLAGS="${save_ldflags}"]) break fi done if test -n "$sqlite3_lib_path" ; then AC_MSG_RESULT([found in $sqlite3_lib_path]) else AC_MSG_ERROR([not found, please install the SQLite3 libraries]) fi ]) fi odbc_include_path="" dnl Detecting odbc paths if test "$with_odbc" = "yes" ; then AC_MSG_CHECKING([for odbc include path]) odbc_try_includes="/usr/include /usr/include/odbc /usr/local/include /usr/local/include/odbc /usr/local/odbc/include" for i in `echo ${odbc_try_includes}`; do if test -f "${i}/sqlext.h" ; then CPPFLAGS="${CPPFLAGS} -I${i}" odbc_include_path=${i} break fi done if test -n "$odbc_include_path" ; then AC_MSG_RESULT([found in $odbc_include_path]) else AC_MSG_ERROR([not found, please install the odbc includes]) fi fi odbc_lib_path="" if test "$with_odbc" = "yes" ; then AC_CHECK_LIB(odbc, SQLConnect, [DEFINES="${DEFINES} -DWITH_SQL_ODBC" ; LIBS="${LIBS} -lodbc"], [ AC_MSG_CHECKING([for odbc lib path]) odbc_try_libs="/usr/lib /usr/lib/odbc /usr/local/lib /usr/local/lib/odbc /usr/local/odbc/lib" for i in `echo ${odbc_try_libs}`; do if test -f "${i}/libodbc.so" -o -f "${i}/libodbc.a" ; then save_ldflags="${LDFLAGS}" LDFLAGS="${LDFLAGS} -L${i}" AC_CHECK_LIB(odbc, SQLDisconnect, [DEFINES="${DEFINES} -DWITH_SQL_ODBC" ; LIBS="${LIBS} -lodbc" ; odbc_lib_path="${i}"], [LDFLAGS="${save_ldflags}"]) break fi done if test -n "$odbc_lib_path" ; then AC_MSG_RESULT([found in $odbc_lib_path]) else AC_MSG_ERROR([not found, please install the odbc libraries]) fi ]) fi AC_CHECK_LIB(nsl, gethostbyname, [LIBS="$LIBS -lnsl"]) AC_CHECK_LIB(socket, socket, [LIBS="$LIBS -lsocket"]) AC_CHECK_LIB(resolv, inet_aton, [LIBS="$LIBS -lresolv"]) dnl BeOS BONE... AC_CHECK_LIB(bind, __inet_aton, [LIBS="$LIBS -lbind"]) case "$host" in [*-beos*]) if test "$ac_cv_lib_bind___inet_aton" = "yes"; then dnl force things, AC_CHECK_FUNC will never get the mangled versions anyway. echo "Forcing inet_aton() and inet_ntoa() to be enabled" ac_cv_func_inet_aton='yes' ac_cv_func_inet_ntoa='yes' fi ;; esac AC_CHECK_LIB(wsock32, _libwsock32_a_iname, [LIBS="$LIBS -lwsock32"]) # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_TIME AC_HEADER_STAT AC_CHECK_HEADERS([\ fcntl.h \ sys/time.h \ time.h \ sys/select.h \ string.h \ strings.h \ unistd.h \ stdarg.h \ varargs.h \ malloc.h \ sys/utsname.h \ sys/timeb.h \ sys/socket.h \ sys/param.h \ netinet/in.h \ arpa/inet.h \ netdb.h \ termios.h \ stddef.h \ memory.h \ sys/types.h \ sys/wait.h \ sys/ioctl.h \ stdint.h \ sys/file.h \ limits.h \ poll.h \ sys/poll.h \ stropts.h \ sys/stropts.h \ sys/stat.h \ pwd.h \ grp.h \ dir.h \ direct.h \ sys/mman.h \ sys/event.h \ sys/epoll.h \ sys/resource.h \ assert.h \ sqlite3.h \ ]) # Checks for typedefs and structures AC_STRUCT_TM AC_TYPE_PID_T AC_TYPE_SIGNAL AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_CHECK_SIZEOF(unsigned char, 1) AC_CHECK_SIZEOF(unsigned short, 2) AC_CHECK_SIZEOF(unsigned int, 4) AC_CHECK_SIZEOF(unsigned long, 4) AC_CHECK_SIZEOF(unsigned long long, 0) AC_CHECK_SIZEOF(signed char, 1) AC_CHECK_SIZEOF(signed short, 2) AC_CHECK_SIZEOF(signed int, 4) AC_CHECK_SIZEOF(signed long, 4) AC_CHECK_SIZEOF(signed long long, 0) # Checks for library functions. AC_FUNC_MMAP AC_FUNC_STRFTIME AC_FUNC_VPRINTF AC_FUNC_CLOSEDIR_VOID AC_FUNC_MKDIR_ARGS AC_CHECK_FUNCS(gethostname gettimeofday select socket strdup strtoul strerror inet_aton inet_ntoa uname recv send recvfrom sendto uname fork getpid sigaction sigprocmask sigaddset setpgid setpgrp ftime strcasecmp strncasecmp stricmp strnicmp chdir difftime strchr strrchr index rindex memcpy memset memmove bcopy wait waitpid pipe getenv ioctl setsid mktime poll gethostbyname getservbyname getlogin pow getpwnam getgrnam getuid getgid setuid setgid mkdir _mkdir strsep getopt kqueue setitimer epoll_create getrlimit vsnprintf _vsnprintf snprintf _snprintf) if test X$ac_cv_func_setpgrp = X"yes"; then AC_FUNC_SETPGRP fi if test X"${am_cv_prog_cc_stdc}" = X"no"; then COMPILEANSI1='${PREPROCESS} $< | sed '"'"'s/^# *\([0-9][0-9]*\) *\([^ ]*[a-z][^ ]*\) *.*$$/#line \1 \2/'"'"' | ${SRC_ACDIR}/ansi2knr > ${SRC_SRCDIR}/.ansi2knr_tmp.c' COMPILEANSI2='${COMPILE} ${SRC_SRCDIR}/.ansi2knr_tmp.c -o $@' COMPILEANSI3='@${RMF} ${SRC_SRCDIR}/.ansi2knr_tmp.c' ANSI2KNR_TMP='${SRC_SRCDIR}/.ansi2knr_tmp.c' ANSI2KNR_DEP='${SRC_ACDIR}/ansi2knr' else COMPILEANSI1='${COMPILE} $< -o $@' COMPILEANSI2='@:' COMPILEANSI3='@:' ANSI2KNR_TMP='' ANSI2KNR_DEP='' fi AC_SUBST(COMPILEANSI1) AC_SUBST(COMPILEANSI2) AC_SUBST(COMPILEANSI3) AC_SUBST(ANSI2KNR_TMP) AC_SUBST(ANSI2KNR_DEP) AC_OUTPUT(Makefile)