Upgrade autoconf (after upgrading minimum required to 2.67)

- AC_PROG_SED
- AC_USE_SYSTEM_EXTENSIONS
- AC_TRY_COMPILE -> AC_COMPILE_IFELSE
- AC_TRY_RUN -> AC_RUN_IFELSE
...

Also use:
- AC_CONFIG_AUX_DIR

Refs: #870
Fixes: 3f09e923 ("Change the minimum version of automake to 1.13 and autoconf to 2.67")
(cherry picked from commit 13b8fc39fd4000de2c836b0acdc52ae5b4c757c7)
This commit is contained in:
yuangongji 2019-08-30 10:21:07 +08:00 committed by Azat Khuzhin
parent 71f5c0d349
commit 45da7d9d44

View File

@ -10,25 +10,18 @@ AC_PREREQ(2.67)
AC_CONFIG_SRCDIR(event.c)
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE
dnl AM_SILENT_RULES req. automake 1.11. [no] defaults V=1
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AM_SILENT_RULES([yes])
AC_CONFIG_HEADERS(config.h evconfig-private.h:evconfig-private.h.in)
AC_DEFINE(NUMERIC_VERSION, 0x02010b00, [Numeric representation of the version])
dnl Initialize prefix.
if test "$prefix" = "NONE"; then
prefix="/usr/local"
fi
AC_PREFIX_DEFAULT([/usr/local])
dnl Try and get a full POSIX environment on obscure systems
ifdef([AC_USE_SYSTEM_EXTENSIONS], [
AC_USE_SYSTEM_EXTENSIONS
], [
AC_AIX
AC_GNU_SOURCE
AC_MINIX
])
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
@ -48,11 +41,7 @@ AC_PROG_INSTALL
AC_PROG_LN_S
# AC_PROG_MKDIR_P - $(MKDIR_P) should be defined by AM_INIT_AUTOMAKE
# AC_PROG_SED is only available in Autoconf >= 2.59b; workaround for older
# versions
ifdef([AC_PROG_SED], [AC_PROG_SED], [
AC_CHECK_PROGS(SED, [gsed sed])
])
AC_PROG_SED
AC_PROG_GCC_TRADITIONAL
@ -151,40 +140,46 @@ AC_SEARCH_LIBS([sendfile], [sendfile])
dnl - check if the macro _WIN32 is defined on this compiler.
dnl - (this is how we check for a windows compiler)
AC_MSG_CHECKING(for WIN32)
AC_TRY_COMPILE(,
[
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],
[
#ifndef _WIN32
die horribly
#endif
],
bwin32=true; AC_MSG_RESULT(yes),
bwin32=false; AC_MSG_RESULT(no),
]
)],
[bwin32=true; AC_MSG_RESULT(yes)],
[bwin32=false; AC_MSG_RESULT(no)]
)
dnl - check if the macro __midipix__ is defined on this compiler.
dnl - (this is how we check for a midipix version of GCC)
AC_MSG_CHECKING(for MIDIPIX)
AC_TRY_COMPILE(,
[
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],
[
#ifndef __midipix__
die horribly
#endif
],
midipix=true; AC_MSG_RESULT(yes),
midipix=false; AC_MSG_RESULT(no),
]
)],
[midipix=true; AC_MSG_RESULT(yes)],
[midipix=false; AC_MSG_RESULT(no)]
)
dnl - check if the macro __CYGWIN__ is defined on this compiler.
dnl - (this is how we check for a cygwin version of GCC)
AC_MSG_CHECKING(for CYGWIN)
AC_TRY_COMPILE(,
[
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],
[
#ifndef __CYGWIN__
die horribly
#endif
],
cygwin=true; AC_MSG_RESULT(yes),
cygwin=false; AC_MSG_RESULT(no),
]
)],
[cygwin=true; AC_MSG_RESULT(yes)],
[cygwin=false; AC_MSG_RESULT(no)]
)
AC_CHECK_HEADERS([zlib.h])
@ -442,27 +437,27 @@ AC_CHECK_FUNC(gethostbyname_r, [
[Define this if gethostbyname_r takes 6 arguments])
AC_MSG_RESULT(6)
], [
AC_TRY_COMPILE([
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <netdb.h>
], [
char *cp1, *cp2;
struct hostent *h1;
int i1, i2;
(void)gethostbyname_r(cp1,h1,cp2,i1,&i2);
], [
])], [
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5_ARG, 1,
[Define this if gethostbyname_r takes 5 arguments])
AC_MSG_RESULT(5)
], [
AC_TRY_COMPILE([
], [
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <netdb.h>
], [
char *cp1;
struct hostent *h1;
struct hostent_data hd;
(void) gethostbyname_r(cp1,h1,&hd);
], [
])], [
AC_DEFINE(HAVE_GETHOSTBYNAME_R)
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3_ARG, 1,
[Define this if gethostbyname_r takes 3 arguments])
@ -518,7 +513,8 @@ if test "x$ac_cv_header_sys_event_h" = "xyes"; then
AC_CHECK_FUNCS(kqueue, [havekqueue=yes], )
if test "x$havekqueue" = "xyes" ; then
AC_MSG_CHECKING(for working kqueue)
AC_TRY_RUN(
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
@ -531,50 +527,50 @@ if test "x$ac_cv_header_sys_event_h" = "xyes"; then
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int
main(int argc, char **argv)
{
], [[
int kq;
int n;
int fd[[2]];
int fd[2];
struct kevent ev;
struct timespec ts;
char buf[[80000]];
char buf[80000];
if (pipe(fd) == -1)
exit(1);
if (fcntl(fd[[1]], F_SETFL, O_NONBLOCK) == -1)
exit(1);
return 1;
if (fcntl(fd[1], F_SETFL, O_NONBLOCK) == -1)
return 1;
while ((n = write(fd[[1]], buf, sizeof(buf))) == sizeof(buf))
while ((n = write(fd[1], buf, sizeof(buf))) == sizeof(buf))
;
if ((kq = kqueue()) == -1)
exit(1);
if ((kq = kqueue()) == -1)
return 1;
memset(&ev, 0, sizeof(ev));
ev.ident = fd[[1]];
ev.ident = fd[1];
ev.filter = EVFILT_WRITE;
ev.flags = EV_ADD | EV_ENABLE;
n = kevent(kq, &ev, 1, NULL, 0, NULL);
if (n == -1)
exit(1);
return 1;
read(fd[[0]], buf, sizeof(buf));
read(fd[0], buf, sizeof(buf));
ts.tv_sec = 0;
ts.tv_nsec = 0;
n = kevent(kq, NULL, 0, &ev, 1, &ts);
if (n == -1 || n == 0)
exit(1);
return 1;
exit(0);
}, [AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WORKING_KQUEUE, 1,
[Define if kqueue works correctly with pipes])
havekqueue=yes
], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
return 0;
]]
)],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_WORKING_KQUEUE, 1,
[Define if kqueue works correctly with pipes])
havekqueue=yes
], [AC_MSG_RESULT(no)], [AC_MSG_RESULT(no)]
)
fi
fi
AM_CONDITIONAL(KQUEUE_BACKEND, [test "x$havekqueue" = "xyes"])
@ -590,7 +586,8 @@ fi
if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then
if test "x$haveepoll" = "xno" ; then
AC_MSG_CHECKING(for epoll system call)
AC_TRY_RUN(
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([[
#include <stdint.h>
#include <sys/param.h>
#include <sys/types.h>
@ -603,21 +600,21 @@ epoll_create(int size)
{
return (syscall(__NR_epoll_create, size));
}
int
main(int argc, char **argv)
{
]],[[
int epfd;
epfd = epoll_create(256);
exit (epfd == -1 ? 1 : 0);
}, [AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_EPOLL, 1,
[Define if your system supports the epoll system calls])
needsignal=yes
have_epoll=yes
AC_LIBOBJ(epoll_sub)
], AC_MSG_RESULT(no), AC_MSG_RESULT(no))
return (epfd == -1 ? 1 : 0);
]]
)],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_EPOLL, 1,
[Define if your system supports the epoll system calls])
needsignal=yes
have_epoll=yes
AC_LIBOBJ(epoll_sub)
], [AC_MSG_RESULT(no)], [AC_MSG_RESULT(no)]
)
fi
fi
AM_CONDITIONAL(EPOLL_BACKEND, [test "x$haveepoll" = "xyes"])
@ -730,36 +727,42 @@ AC_CHECK_TYPES([struct linger],,,
])
AC_MSG_CHECKING([for socklen_t])
AC_TRY_COMPILE([
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([
#include <sys/types.h>
#ifdef _WIN32
#include <ws2tcpip.h>
#else
#include <sys/socket.h>
#endif],
[socklen_t x;],
AC_MSG_RESULT([yes]),
#endif
],[socklen_t x;]
)],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_DEFINE(socklen_t, unsigned int,
[Define to unsigned int if you dont have it])]
[Define to unsigned int if you dont have it])]
)
# __func__/__FUNCTION__ is not a macros in general
AC_MSG_CHECKING([whether our compiler supports __func__])
AC_TRY_COMPILE([],
[ const char *cp = __func__; ],
[ AC_DEFINE(HAVE___func__, 1, [Define to 1 if compiler have __func__])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],
[ const char *cp = __func__; ]
)],
[ AC_DEFINE(HAVE___func__, 1, [Define to 1 if compiler have __func__])
AC_MSG_RESULT([yes])
],
AC_MSG_RESULT([no])
[AC_MSG_RESULT([no])]
)
AC_MSG_CHECKING([whether our compiler supports __FUNCTION__])
AC_TRY_COMPILE([],
[ const char *cp = __FUNCTION__; ],
[ AC_DEFINE(HAVE___FUNCTION__, 1, [Define to 1 if compiler have __FUNCTION__])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],
[ const char *cp = __FUNCTION__; ]
)],
[ AC_DEFINE(HAVE___FUNCTION__, 1, [Define to 1 if compiler have __FUNCTION__])
AC_MSG_RESULT([yes])
],
AC_MSG_RESULT([no])
[AC_MSG_RESULT([no])]
)
# check if we can compile with pthreads
@ -795,6 +798,7 @@ if test x$enable_debug_mode = xno; then
AC_DEFINE(DISABLE_DEBUG_MODE, 1,
[Define if libevent should build without support for a debug mode])
fi
# check if we should enable verbose debugging
if test x$enable_verbose_debug = xyes; then
CFLAGS="$CFLAGS -DUSE_DEBUG"