Updated for features RPM-4.0 (NOT backward compatible)
[mdsms.git] / configure.in
index 9fe174b..b935eb1 100644 (file)
@@ -1,13 +1,8 @@
 # $Id$
-#
-# $Log$
-# Revision 1.1.1.1  1999/05/26 13:06:26  short
-# First alpha release.
-#
 
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(mdsms.c)
-AM_INIT_AUTOMAKE(mdsms, 1.0)
+AM_INIT_AUTOMAKE(mdsms, 1.5.0)
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
 
@@ -31,22 +26,32 @@ AC_ARG_WITH(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="-Wall -ansi -pedantic -ggdb"
-               LDFLAGS="$LDFLAGS -lefence"
+       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_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
@@ -103,6 +108,10 @@ if test "$with_getopt" = yes -o "$ac_cv_func_getopt_long" != yes ;then
 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))
        )
@@ -112,26 +121,67 @@ AC_CHECK_FUNC(MIN, AC_DEFINE(HAVE_MIN) ,
        )
 
 AC_MSG_CHECKING([for LINE_MAX])
-AC_TRY_COMPILE([#include <limits.h>], [LINE_MAX;],
+AC_TRY_COMPILE([
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#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([#include <termios.h>], [CBAUD;],
+AC_TRY_COMPILE([
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+#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([#include <termios.h>], [CBAUDEX;],
+AC_TRY_COMPILE([
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+#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 <termios.h>
+#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 <sys/time.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#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([#include <stddef.h>],[char untest $unx;],
+               AC_TRY_COMPILE([
+#ifdef HAVE_STDDEF_H
+#include <stddef.h>
+#endif],[char untest $unx;],
                AC_DEFINE_UNQUOTED(ATTR_UNUSED, $unx)
                AC_MSG_RESULT($un)
                uns=false)
@@ -139,26 +189,95 @@ for un in __unused__ unused;do
        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 <stddef.h>
+#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 <stddef.h>
+#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
 
-AC_REPLACE_FUNCS(strdup)
-dnl AC_MSG_CHECKING([for strdup])
-dnl AC_TRY_COMPILE([#include <string.h>], [strdup("");],
-dnl    AC_DEFINE(HAVE_STRDUP)  AC_MSG_RESULT(yes),
-dnl    LIBOBJS="$LIBOBJS strdup.o" AC_MSG_RESULT(no))
+dnl FIXME: mktime(3) missing here
+AC_REPLACE_FUNCS(strdup usleep)
 
-AC_MSG_CHECKING([for working %m in printf])
-AC_TRY_RUN([int main() { char s[100];
-       sprintf(s,"%m");
-       return(!(strcmp(s,"m") && strcmp(s,"%m")));
-       }],AC_DEFINE(PRINTF_WORKS_PM) AC_MSG_RESULT(yes),AC_MSG_RESULT(no),AC_MSG_RESULT(avoiding))
+GCC_NEED_DECLARATION(gethostname,[
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif])
+GCC_NEED_DECLARATION(kill,[
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif])
+GCC_NEED_DECLARATION(snprintf,[
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif])
+GCC_NEED_DECLARATION(vsnprintf,[
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif])
+GCC_NEED_DECLARATION(strdup,[
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif])
+GCC_NEED_DECLARATION(usleep,[
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif])
+GCC_NEED_DECLARATION(strcasecmp,[
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif])
+GCC_NEED_DECLARATION(siginterrupt,[
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif])
+GCC_NEED_DECLARATION(popen,[
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif])
+GCC_NEED_DECLARATION(pclose,[
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif])
 
 # Final output.
 
+if test "$ACLOCAL" = "aclocal";then
+  ACLOCAL="$ACLOCAL -I ."
+fi
+
 AC_SUBST(LIBOBJS)
 
-AC_OUTPUT(Makefile)
+AC_OUTPUT([Makefile
+mdsms.spec
+po/Makefile.in
+intl/Makefile],[sed -e "/POTFILES =/r po/POTFILES" -e "s/ ChangeLog / /" po/Makefile.in > po/Makefile])