# $Id$ dnl Process this file with autoconf to produce a configure script. AC_INIT(mdsms.c) AM_INIT_AUTOMAKE(mdsms, 1.5.0) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE dnl Configuration switches. AC_MSG_CHECKING([whether debugging is requested]) AC_ARG_ENABLE(debug, [ --enable-debug enable debugging output to stderr], enable_debug=$enableval, enable_debug=no) AC_MSG_RESULT($enable_debug) AC_MSG_CHECKING([whether included getopt is requested]) AC_ARG_WITH(included-getopt, [ --with-included-getopt use included getopt(3)], with_getopt=$withval, with_getopt=no) AC_MSG_RESULT($with_getopt) AC_MSG_CHECKING([for user-specified lock directory]) AC_ARG_WITH(lock-directory, [ --with-lock-directory override default search for modem lock directory], with_lock_directory=$withval, with_lock_directory=) AC_MSG_RESULT($with_lock_directory) AC_ARG_WITH(efence, [ --without-efence disable use of Electric Fence in maintainer-mode], efence=$withval, efence=yes) dnl Checks for programs. AC_PROG_CC if test "$USE_MAINTAINER_MODE" = yes;then if test "$GCC" = yes;then CFLAGS="$CFLAGS -Wall -ansi -pedantic -ggdb3" if test x$efence != xno;then AC_CHECK_LIB(efence, EF_Exit) fi fi else LDFLAGS="-s" AC_DEFINE(NDEBUG) fi AC_PROG_CPP dnl Checks for pathnames. ALL_LINGUAS="cs" AM_GNU_GETTEXT AC_CHECK_HEADERS(libintl.h) AC_MSG_CHECKING([for modem lock directory]) dirx="" if test "$with_lock_directory" = no;then AC_MSG_RESULT([user disabled]) else if test yes = "$with_lock_directory" \ -o -z "$with_lock_directory";then for dira in /usr /var ;do for dirb in /spool "" ;do for dirc in /uucp /locks /lock;do dir="${dira}${dirb}${dirc}" if test -d "$dir";then dirx="$dir";fi done;done;done if test -z "$dirx";then AC_MSG_RESULT([none found, disabled]) else AC_MSG_RESULT([$dirx]) fi else dirx="$with_lock_directory" if test -d "$dirx";then AC_MSG_RESULT([$dirx]) else AC_MSG_RESULT([warning - directory doesn't exist: $dirx]) fi fi fi if test -z "$dirx";then AC_DEFINE(DEF_LOCKFILE,[""]) else AC_DEFINE_UNQUOTED(DEF_LOCKFILE,"${dirx}/LCK..%s") fi dnl Checks for libraries. dnl Checks for header files. AC_HEADER_STDC dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_C_INLINE dnl Checks for library functions. if test "$with_getopt" = no;then AC_CHECK_FUNCS(getopt_long) fi if test "$enable_debug" = yes;then AC_DEFINE(DEBUG) fi AC_MSG_CHECKING(whether to use included getopt) if test "$with_getopt" = yes -o "$ac_cv_func_getopt_long" != yes ;then LIBOBJS="$LIBOBJS getopt1.o getopt.o" AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi AC_CHECK_HEADERS(assert.h ctype.h errno.h fcntl.h limits.h signal.h stdarg.h) AC_CHECK_HEADERS(stdio.h stdlib.h string.h sys/poll.h sys/stat.h sys/time.h) AC_CHECK_HEADERS(sys/types.h termios.h time.h unistd.h) AC_CHECK_FUNC(MAX, AC_DEFINE(HAVE_MAX) , AC_CHECK_FUNC(max, AC_DEFINE(MAX, max) AC_DEFINE(HAVE_MAX)) ) AC_CHECK_FUNC(MIN, AC_DEFINE(HAVE_MIN) , AC_CHECK_FUNC(min, AC_DEFINE(MIN, min) AC_DEFINE(HAVE_MIN)) ) AC_MSG_CHECKING([for LINE_MAX]) AC_TRY_COMPILE([ #ifdef HAVE_LIMITS_H #include #endif], [LINE_MAX;], AC_DEFINE(HAVE_LINE_MAX) AC_MSG_RESULT(yes), AC_DEFINE(LINE_MAX, 4096) AC_MSG_RESULT(no)) AC_MSG_CHECKING([for CBAUD]) AC_TRY_COMPILE([ #ifdef HAVE_TERMIOS_H #include #endif], [CBAUD;], AC_DEFINE(HAVE_CBAUD) AC_MSG_RESULT(yes), AC_DEFINE(CBAUD, 0) AC_MSG_RESULT(no)) AC_MSG_CHECKING([for CBAUDEX]) AC_TRY_COMPILE([ #ifdef HAVE_TERMIOS_H #include #endif], [CBAUDEX;], AC_DEFINE(HAVE_CBAUDEX) AC_MSG_RESULT(yes), AC_DEFINE(CBAUDEX, 0) AC_MSG_RESULT(no)) AC_MSG_CHECKING([for CRTSCTS]) AC_TRY_COMPILE([ #ifdef HAVE_TERMIOS_H #include #endif], [CRTSCTS;], AC_DEFINE(HAVE_CRTSCTS) AC_MSG_RESULT(yes),[ if test "$USE_MAINTAINER_MODE" = yes ;then AC_DEFINE(HAVE_CRTSCTS) AC_MSG_RESULT(faked for maintainer) # from "RedHat: glibc-devel-2.2-5/bits/termios.h" AC_DEFINE(CRTSCTS, 020000000000) else AC_DEFINE(CRTSCTS, 0) AC_MSG_RESULT(no) fi ]) AC_MSG_CHECKING([for FD_SETSIZE]) AC_TRY_COMPILE([ #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_UNISTD_H #include #endif], [FD_SETSIZE;], AC_DEFINE(HAVE_FD_SETSIZE) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) AC_MSG_CHECKING([for unused attribute]) uns=true for un in __unused__ unused;do if $uns;then unx="__attribute__ (($un))" AC_TRY_COMPILE([ #ifdef HAVE_STDDEF_H #include #endif],[char untest $unx;], AC_DEFINE_UNQUOTED(ATTR_UNUSED, $unx) AC_MSG_RESULT($un) uns=false) fi done if $uns;then AC_DEFINE(ATTR_UNUSED,) AC_MSG_RESULT(no);fi AC_MSG_CHECKING([for printf style attribute]) AC_TRY_COMPILE([ #ifdef HAVE_STDDEF_H #include #endif void testf(char *fmt,...) __attribute__((format(printf,1,2))); void testf(char *fmt,...) {}], [testf("%d",1);], AC_DEFINE(HAVE_PRINTFORMAT) AC_MSG_RESULT(yes), AC_MSG_RESULT(no) ) AC_MSG_CHECKING([for offsetof macro]) AC_TRY_COMPILE([ #ifdef HAVE_STDDEF_H #include #endif struct x { int a; };], [return(offsetof(struct x,a));], AC_DEFINE(HAVE_OFFSETOF) AC_MSG_RESULT(yes), AC_MSG_RESULT(no) ) AC_CHECK_FUNC(snprintf, AC_DEFINE(HAVE_SNPRINTF)) AC_CHECK_FUNC(vsnprintf, AC_DEFINE(HAVE_VSNPRINTF)) dnl FIXME: select(3) missing here but what to do anyway AC_CHECK_FUNCS(siginterrupt strerror strchr strrchr memmove atexit strcasecmp poll) AC_TYPE_SIGNAL AC_TYPE_PID_T dnl FIXME: mktime(3) missing here AC_REPLACE_FUNCS(strdup usleep) GCC_NEED_DECLARATION(gethostname,[ #ifdef HAVE_UNISTD_H #include #endif]) GCC_NEED_DECLARATION(kill,[ #ifdef HAVE_SYS_TYPES_H #include #endif #ifdef HAVE_SIGNAL_H #include #endif]) GCC_NEED_DECLARATION(snprintf,[ #ifdef HAVE_STDIO_H #include #endif]) GCC_NEED_DECLARATION(vsnprintf,[ #ifdef HAVE_STDIO_H #include #endif #ifdef HAVE_STDARG_H #include #endif]) GCC_NEED_DECLARATION(strdup,[ #ifdef HAVE_STRING_H #include #endif]) GCC_NEED_DECLARATION(usleep,[ #ifdef HAVE_UNISTD_H #include #endif]) GCC_NEED_DECLARATION(strcasecmp,[ #ifdef HAVE_STRING_H #include #endif]) GCC_NEED_DECLARATION(siginterrupt,[ #ifdef HAVE_SIGNAL_H #include #endif]) GCC_NEED_DECLARATION(popen,[ #ifdef HAVE_STDIO_H #include #endif]) GCC_NEED_DECLARATION(pclose,[ #ifdef HAVE_STDIO_H #include #endif]) # Final output. if test "$ACLOCAL" = "aclocal";then ACLOCAL="$ACLOCAL -I ." fi AC_SUBST(LIBOBJS) AC_OUTPUT([Makefile mdsms.spec po/Makefile.in intl/Makefile],[sed -e "/POTFILES =/r po/POTFILES" -e "s/ ChangeLog / /" po/Makefile.in > po/Makefile])