dnl Process this file with autoconf to produce a configure script. AC_INIT([qico], [0.49.10-p3], [cyrilm@users.sourceforge.net]) AM_INIT_AUTOMAKE([qico],[0.49.10-p3]) AC_PREREQ(2.53) AC_CONFIG_SRCDIR([src/main.c]) AM_CONFIG_HEADER([config.h]) AM_MAINTAINER_MODE dnl Checks for programs. AC_PROG_CC AC_PROG_AWK AC_PROG_INSTALL AM_PROG_LEX AC_PROG_YACC AC_LANG([C]) dnl Checks for libraries. dnl Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_TIOCGWINSZ AC_CHECK_HEADERS([arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h syslog.h termios.h unistd.h utime.h libutil.h libgen.h sys/param.h errno.h]) dnl FreeBSD 3.x have setproctitle(2) in libutil.h dnl FreeBSD 4.x have basename(2) in libgen.h dnl whether syslog.h and sys/syslog.h may both be included AC_CHECK_HEADER([sys/syslog.h],[AC_DEFINE(HAVE_SYSLOG_AND_SYS_SYSLOG,1,[Could and be included in one file])],,[#define SYSLOG_NAMES #include ]) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_HEADER_TIME AC_STRUCT_TM AC_CHECK_SIZEOF([char],[1]) AC_CHECK_SIZEOF([short],[2]) AC_CHECK_SIZEOF([int],[4]) AC_CHECK_SIZEOF([long],[4]) AC_C_BIGENDIAN AC_CHECK_MEMBER([struct tm.tm_gmtoff],[AC_DEFINE(TM_HAVE_GMTOFF,1,[Define to 1 if 'struct tm' have 'tm_gmtoff' field])],,) AC_CHECK_DECL([facilitynames],[AC_DEFINE(HAVE_SYSLOG_FAC_NAMES,1,[Define to 1 if 'facilitynames' defined in syslog headers])],,[#include #define SYSLOG_NAMES #include #ifdef HAVE_SYSLOG_AND_SYS_SYSLOG # include #endif]) AC_CHECK_DECL([prioritynames],[AC_DEFINE(HAVE_SYSLOG_PRI_NAMES,1,[Define to 1 if 'facilitynames' defined in syslog headers])],,[#include #define SYSLOG_NAMES #include #ifdef HAVE_SYSLOG_AND_SYS_SYSLOG # include #endif]) AC_CHECK_DECL([TIOCSCTTY],[AC_DEFINE(HAVE_TIOCSCTTY,1,[Define to 1 if system have 'TIOCSCTTY' ioctl()])],,[#include #include #include ]) AC_CHECK_DECL([EIDRM],AC_DEFINE(HAVE_EIDRM,1,[Define to 1 if system defines 'EIDRM' errno value]),,[#include #include ]) AC_CHECK_DECLS([STDIN_FILENO,STDOUT_FILENO,STDERR_FILENO],AC_DEFINE(HAVE_STDXXX_FILENO,1,[Define to 1 if system defines 'STDxxx_FILENO' constants]),,[#include ]) dnl Checks for library functions. AC_FUNC_FNMATCH AC_FUNC_FORK AC_PROG_GCC_TRADITIONAL AC_FUNC_MALLOC AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_STRFTIME AC_FUNC_UTIME_NULL AC_FUNC_VPRINTF AC_CHECK_FUNCS([alarm bzero dup2 getcwd memchr memmove memset mkdir rmdir select setlocale strcasecmp strchr strcspn strdup strerror strncasecmp strrchr strspn strstr strtol uname utime vsnprintf snprintf]) AC_REPLACE_FUNCS([strsep usleep getsid strcspn]) AC_CACHE_CHECK([for nonbroken basename implementation], ac_cv_func_basename_nonbroken, [AC_TRY_RUN([#if HAVE_LIBGEN_H # include #endif static char *fl = "/usr/local/bin/some.file"; int main(int argc, char **argv) { char *b = basename(fl); return ((*b != '/')?0:1); } ],[ac_cv_func_basename_nonbroken=yes], [ac_cv_func_basename_nonbroken=no], [ac_cv_func_basename_nonbroken=no])]) if test $ac_cv_func_basename_nonbroken = yes; then AC_DEFINE([HAVE_BASENAME],1,[Define to 1 if basename() is nonbroken]) else AC_LIBOBJ(basename) fi dnl Checking for FreeBSD setproctitle in libutil AC_CHECK_FUNC([setproctitle],[AC_DEFINE(HAVE_SETPROCTITLE,1,[Define to 1 if system have setproctitle() call])],[AC_CHECK_LIB(util,setproctitle,[AC_DEFINE(HAVE_SETPROCTITLE,1,[Define to 1 if system have setproctitle() call])])]) dnl Socket functions are in libnsl.a on SunOS 5.5 AC_CHECK_FUNCS([socket],,[AC_CHECK_LIB(socket,socket)]) AC_CHECK_FUNCS([getpeername],,[AC_CHECK_LIB(socket,getpeername)]) AC_CHECK_FUNCS([gethostbyname],,[AC_CHECK_LIB(nsl,gethostbyname)]) AC_CHECK_FUNCS([getservbyname],,[AC_CHECK_LIB(socket,getservbyname)]) AC_CHECK_FUNCS([inet_addr],,[AC_CHECK_LIB(nsl,inet_addr)]) AC_CHECK_FUNCS([inet_ntoa],,[AC_CHECK_LIB(nsl,inet_ntoa)]) AC_CHECK_FUNCS([shutdown]) AC_CHECK_FUNCS([connect],,[AC_CHECK_LIB(nsl,connect)]) AC_MSG_CHECKING([for config path]) AC_ARG_WITH([config],AC_HELP_STRING([--with-config=config],[specifies config path (default is \${prefix}/etc/qico.conf)]),,with_config=NONE) if test "x${with_config}" = "xNONE"; then if test "x${prefix}" = "xNONE"; then with_config="${ac_default_prefix}/etc/qico.conf" else with_config="${prefix}/etc/qico.conf" fi fi AC_MSG_RESULT($with_config) if test "x`expr "$with_config" : '/.*'`" != "x`expr "$with_config" : '.*'`"; then AC_MSG_ERROR([Parameter for --with-config must be absolute pathname]) fi dnl TCP Speed AC_MSG_CHECKING([for TCP connection speed]) AC_ARG_WITH(tcp-speed,AC_HELP_STRING([--with-tcp-speed],[specifies TCP connection speed (default is 115200)]),,with_tcp_speed=115200) AC_DEFINE_UNQUOTED(TCP_SPEED,$with_tcp_speed,[Speed for TCP connections in bps]) AC_MSG_RESULT($with_tcp_speed) changequote(,)dnl if test "x`expr "$with_tcp_speed" : '[0-9]*'`" != "x`expr "$with_tcp_speed" : '.*'`"; then changequote([,])dnl AC_MSG_ERROR([Parameter for --with-tcp-speed must be a number]) fi dnl Default Speed AC_MSG_CHECKING([for default port locking speed]) AC_ARG_WITH(default-speed,AC_HELP_STRING([--with-default-speed],[specifies default port locking speed (default is 9600)]),,with_default_speed=9600) AC_DEFINE_UNQUOTED(DEFAULT_SPEED,$with_default_speed,[Default speed for modem connections]) AC_MSG_RESULT($with_default_speed) changequote(,)dnl if test "x`expr "$with_default_speed" : '[0-9]*'`" != "x`expr "$with_default_speed" : '.*'`"; then changequote([,])dnl AC_MSG_ERROR([Parameter for --with-default-speed must be a number]) fi dnl Shell AC_MSG_CHECKING([for shell]) AC_ARG_WITH(shell,AC_HELP_STRING([--with-shell],[specifies shell (default is /bin/sh)]),,with_shell=/bin/sh) AC_DEFINE_UNQUOTED(SHELL,"$with_shell",[Path to system shell]) AC_MSG_RESULT($with_shell) if test "x`expr "$with_shell" : '/.*'`" != "x`expr "$with_shell" : '.*'`"; then AC_MSG_ERROR([Parameter for --with-shell must be absolute pathname]) fi if test ! \( -x "$with_shell" -a \( -f "$with_shell" -o -L "$with_shell" \) \); then AC_MSG_ERROR([Parameter for --with-shell must be name of executable file]) fi dnl Lock creation style AC_MSG_CHECKING([for lock creation style]) AC_ARG_WITH(lock-style,AC_HELP_STRING([--with-lock-style],[select lock creation style (open or link)]),,with_lock_style=LINK) case "$with_lock_style" in link | LINK | NFS | nfs ) AC_MSG_RESULT(link) ;; open | OPEN | VFAT | vfat ) AC_MSG_RESULT(open) AC_DEFINE(LOCKSTYLE_OPEN,1,[Create lock files with open(), not link()]) ;; *) AC_MSG_RESULT(unknown) AC_MSG_ERROR([Lock style '$with_lock_style' is unknown. Valid ones are 'link' or 'open]) ;; esac dnl Amiga4D-style outbound support AC_MSG_CHECKING([for outbound mode]) AC_ARG_ENABLE(aso,AC_HELP_STRING([--enable-aso],[enable Amiga-style 4D outbound]),,enable_aso=no) if test "${enable_aso}x" != "nox"; then AC_MSG_RESULT(aso) AC_DEFINE(AMIGA4D,1,[Use Amiga-style outbound]) else AC_MSG_RESULT(bso) fi dnl HYDRA8/16K support (disable by default) AC_MSG_CHECKING([for Hydra8k/16k support]) AC_ARG_ENABLE(hydra8k,AC_HELP_STRING([--enable-hydra8k],[enable buggy Hydra8k/16k protocols support]),,enable_hydra8k=no) if test "${enable_hydra8k}x" != "nox"; then AC_MSG_RESULT(yes) AC_DEFINE(HYDRA8K16K,1,[Allow Hydra-8K and Hydra-16K protocols]) else AC_MSG_RESULT(no) fi dnl qcc support AC_ARG_ENABLE(qcc,AC_HELP_STRING([--disable-qcc],[disable building of qcc and its support]),,enable_qcc=yes) if test "${enable_qcc}x" != "nox"; then AC_CHECK_LIB(ncurses,main,[AC_DEFINE(HAVE_LIBNCURSES,1,[Define to 1 if system have ncurses]) CURSES=ncurses],[AC_CHECK_LIB(curses,main,[AC_DEFINE(HAVE_LIBCURSES,1,[Define to 1 if system have curses]) CURSES=curses])]) if test $CURSES; then AC_CHECK_LIB($CURSES,mvvline,[AC_DEFINE(CURS_HAVE_MVVLINE,1,[Define to 1 if system (n)curses have mvvline()])]) AC_CHECK_LIB($CURSES,resizeterm,[AC_DEFINE(CURS_HAVE_RESIZETERM,1,[Define to 1 if system (n)curses have wresize()])]) QCC=qcc AC_DEFINE(QCC,1,[Build qcc (interface program)]) AC_CHECK_HEADERS(curses.h ncurses.h) QCCLIBS=-l$CURSES AC_MSG_CHECKING([for qcc support]) AC_MSG_RESULT(yes) else AC_MSG_WARN([there's no any curses library here]) AC_MSG_CHECKING([for qcc support]) AC_MSG_RESULT(no) QCC= fi else AC_MSG_CHECKING([for qcc support]) AC_MSG_RESULT(no) QCC= fi dnl Compile in debug messages AC_MSG_CHECKING([for debug logging]) AC_ARG_ENABLE(debug,AC_HELP_STRING([--disable-debug],[disable adding debug messages]),,enable_debug=yes) if test "${enable_debug}x" != "nox"; then AC_MSG_RESULT([yes, use loglevels in config to tune]) AC_DEFINE(NEED_DEBUG,1,[Build debug loglevels support]) NEED_DEBUG=1 else AC_MSG_RESULT([no, logleves in config is useless]) NEED_DEBUG=0 fi dnl Electric Fence malloc() debbuger support AC_MSG_CHECKING([for Electric Fence malloc() debbuger]) AC_ARG_ENABLE(efence,AC_HELP_STRING([--enable-efence],[enable linking with libefence malloc() debugger ]),,enable_efence=no) if test "${enable_efence}x" != "nox"; then AC_MSG_RESULT(yes) AC_CHECK_LIB(efence,malloc,[LIBS="${LIBS} -L/usr/local/lib -lefence"],enable_efence=no,["-L/usr/local/lib"]) if test "${enable_fence}x" = "nox"; then AC_MSG_WARN([No Electric Fence library found -- turn --enable-efence off]) fi else AC_MSG_RESULT(no) fi dnl My defines -- from acconfig.h, hack for new autoconf AC_DEFINE_UNQUOTED(MAX_PATH,256,[Maximum length of file path]) AC_DEFINE_UNQUOTED(MAX_STRING,256,[Maximum length of string on stack for log and some other places]) AC_DEFINE_UNQUOTED(MAX_NODELIST,32,[Maximum number of compiled nodelists]) dnl My substs AC_SUBST(QCCLIBS) AC_SUBST(QCC) AC_SUBST(TCP_SPEED) AC_SUBST(DEFAULT_SPEED) AC_SUBST(SHELL) dnl calculate real config -- prefix already known, so we could eval config with_config=`eval echo $with_config` AC_DEFINE_UNQUOTED(CONFIG,"$with_config",[Default path to config]) CONFIG=$with_config AC_SUBST(CONFIG) AC_CONFIG_FILES([src/ver.c qico.spec Makefile src/Makefile stuff/Makefile ]) AC_OUTPUT