X-Git-Url: http://git.jankratochvil.net/?p=mdsms.git;a=blobdiff_plain;f=configure.in;h=0777284c7784686d3d557110f1fae8ba3955c392;hp=979a4637d3b55784c5cf370b5ef719c1eacefeb8;hb=3b127365dbbc640bc1a0813b24baa925b99f5079;hpb=024c037ad5868decb5d300355ccd6220848ee220 diff --git a/configure.in b/configure.in index 979a463..0777284 100644 --- a/configure.in +++ b/configure.in @@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(mdsms.c) -AM_INIT_AUTOMAKE(mdsms, 1.3) +AM_INIT_AUTOMAKE(mdsms, 1.5.0) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE @@ -98,6 +98,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)) ) @@ -107,26 +111,52 @@ AC_CHECK_FUNC(MIN, AC_DEFINE(HAVE_MIN) , ) AC_MSG_CHECKING([for LINE_MAX]) -AC_TRY_COMPILE([#include ], [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([#include ], [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([#include ], [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 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([#include ],[char untest $unx;], + AC_TRY_COMPILE([ +#ifdef HAVE_STDDEF_H +#include +#endif],[char untest $unx;], AC_DEFINE_UNQUOTED(ATTR_UNUSED, $unx) AC_MSG_RESULT($un) uns=false) @@ -134,35 +164,92 @@ 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 +#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 -AC_REPLACE_FUNCS(strdup) -dnl AC_MSG_CHECKING([for strdup]) -dnl AC_TRY_COMPILE([#include ], [strdup("");], -dnl AC_DEFINE(HAVE_STRDUP) AC_MSG_RESULT(yes), -dnl LIBOBJS="$LIBOBJS strdup.o" AC_MSG_RESULT(no)) - -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, [#include ]) -GCC_NEED_DECLARATION(kill, [#include -#include ]) -GCC_NEED_DECLARATION(snprintf, [#include ]) -GCC_NEED_DECLARATION(vsnprintf, [#include -#include ]) -GCC_NEED_DECLARATION(strdup, [#include ]) -GCC_NEED_DECLARATION(usleep, [#include ]) +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)