Skip to content

Commit

Permalink
Fix autogen.sh with recent autoconf-2.71 and automake-1.16 (#1271)
Browse files Browse the repository at this point in the history
With a recent upgrade of a development system I have noticed the issues from #1249 and #1239. While both did not resolve the problems I encountered I was able to resolve the issues in the following way.

Starting from the work of @rdratlos I noticed that AM_INIT_AUTOMAKE was defined twice, this alone caused the direct breaking of autogen.sh with recent versions of automake and autoconf. Removing the second instance resolved the issue. While @neelpatel05 suggested to use AM_INIT_AUTOMAKE with "foreign subdir-objects" I have still not reproduced that using automake 1.16.5. Hence I have ignored this suggestion, but if someone can show how it breaks without it I'll obviously include it.

autoupdate-2.71 failed apply an update and terminated processing at an old AC_TRY_COMPILE code block of "Check of func and co.." I manually rewrote the AC_COMPILE_IFELSE. Applying autoupdate-2.71 to the rest of the m4 files in the repository allowed me to clean up all the remaining warnings.

Co-authored-by: Thomas Reim <[email protected]>
  • Loading branch information
skinkie and thor-sssd authored Oct 22, 2021
1 parent 77ddd63 commit e4d9675
Show file tree
Hide file tree
Showing 12 changed files with 259 additions and 372 deletions.
106 changes: 39 additions & 67 deletions acinclude.m4
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
AC_LANG([C])
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
Expand Down Expand Up @@ -104,11 +104,9 @@ for flag in $acx_pthread_flags; do
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ]])],[acx_pthread_ok=yes],[])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
Expand All @@ -133,13 +131,9 @@ if test "x$acx_pthread_ok" = xyes; then
# Detect AIX lossage: threads are created detached by default
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
AC_MSG_CHECKING([for joinable pthread attribute])
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;],
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[int attr=PTHREAD_CREATE_JOINABLE;]])],[ok=PTHREAD_CREATE_JOINABLE],[ok=unknown])
if test x"$ok" = xunknown; then
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;],
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]], [[int attr=PTHREAD_CREATE_UNDETACHED;]])],[ok=PTHREAD_CREATE_UNDETACHED],[ok=unknown])
fi
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
Expand Down Expand Up @@ -206,39 +200,33 @@ AC_ARG_WITH(sendfile-support,
case "$host_os" in
*linux*)
AC_CACHE_CHECK([for linux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
AC_TRY_LINK([#include <sys/sendfile.h>],
[\
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/sendfile.h>]], [[\
int tofd, fromfd;
off64_t offset;
size_t total;
ssize_t nwritten = sendfile64(tofd, fromfd, &offset, total);
],
samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
]])],[samba_cv_HAVE_SENDFILE64=yes],[samba_cv_HAVE_SENDFILE64=no])])
AC_CACHE_CHECK([for linux sendfile support],samba_cv_HAVE_SENDFILE,[
AC_TRY_LINK([#include <sys/sendfile.h>],
[\
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/sendfile.h>]], [[\
int tofd, fromfd;
off_t offset;
size_t total;
ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
],
samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
]])],[samba_cv_HAVE_SENDFILE=yes],[samba_cv_HAVE_SENDFILE=no])])
# Try and cope with broken Linux sendfile....
AC_CACHE_CHECK([for broken linux sendfile support],samba_cv_HAVE_BROKEN_LINUX_SENDFILE,[
AC_TRY_LINK([\
AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)
#undef _FILE_OFFSET_BITS
#endif
#include <sys/sendfile.h>],
[\
#include <sys/sendfile.h>]], [[\
int tofd, fromfd;
off_t offset;
size_t total;
ssize_t nwritten = sendfile(tofd, fromfd, &offset, total);
],
samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)])
]])],[samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes],[samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no])])
if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
AC_DEFINE(HAVE_SENDFILE64,1,[Whether 64-bit sendfile() is available])
Expand All @@ -258,12 +246,11 @@ samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)]
;;
*freebsd*)
AC_CACHE_CHECK([for freebsd sendfile support],samba_cv_HAVE_SENDFILE,[
AC_TRY_LINK([\
AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
#include <sys/types.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/uio.h>],
[\
#include <sys/uio.h>]], [[\
int fromfd, tofd, ret, total=0;
off_t offset, nwritten;
struct sf_hdtr hdr;
Expand All @@ -275,8 +262,7 @@ samba_cv_HAVE_BROKEN_LINUX_SENDFILE=yes,samba_cv_HAVE_BROKEN_LINUX_SENDFILE=no)]
hdtrl.iov_base = NULL;
hdtrl.iov_len = 0;
ret = sendfile(fromfd, tofd, offset, total, &hdr, &nwritten, 0);
],
samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
]])],[samba_cv_HAVE_SENDFILE=yes],[samba_cv_HAVE_SENDFILE=no])])
if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() support is available])
Expand All @@ -289,10 +275,9 @@ samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
*hpux*)
AC_CACHE_CHECK([for hpux sendfile64 support],samba_cv_HAVE_SENDFILE64,[
AC_TRY_LINK([\
AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
#include <sys/socket.h>
#include <sys/uio.h>],
[\
#include <sys/uio.h>]], [[\
int fromfd, tofd;
size_t total=0;
struct iovec hdtrl[2];
Expand All @@ -303,8 +288,7 @@ samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
hdtrl[0].iov_len = 0;
nwritten = sendfile64(tofd, fromfd, offset, total, &hdtrl[0], 0);
],
samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
]])],[samba_cv_HAVE_SENDFILE64=yes],[samba_cv_HAVE_SENDFILE64=no])])
if test x"$samba_cv_HAVE_SENDFILE64" = x"yes"; then
AC_DEFINE(HAVE_SENDFILE64,1,[Whether sendfile64() is available])
AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
Expand All @@ -314,10 +298,9 @@ samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
fi
AC_CACHE_CHECK([for hpux sendfile support],samba_cv_HAVE_SENDFILE,[
AC_TRY_LINK([\
AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
#include <sys/socket.h>
#include <sys/uio.h>],
[\
#include <sys/uio.h>]], [[\
int fromfd, tofd;
size_t total=0;
struct iovec hdtrl[2];
Expand All @@ -328,8 +311,7 @@ samba_cv_HAVE_SENDFILE64=yes,samba_cv_HAVE_SENDFILE64=no)])
hdtrl[0].iov_len = 0;
nwritten = sendfile(tofd, fromfd, offset, total, &hdtrl[0], 0);
],
samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
]])],[samba_cv_HAVE_SENDFILE=yes],[samba_cv_HAVE_SENDFILE=no])])
if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() is available])
AC_DEFINE(HPUX_SENDFILE_API,1,[Whether the hpux sendfile() API is available])
Expand All @@ -342,9 +324,8 @@ samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
*solaris*)
AC_CHECK_LIB(sendfile,sendfilev)
AC_CACHE_CHECK([for solaris sendfilev64 support],samba_cv_HAVE_SENDFILEV64,[
AC_TRY_LINK([\
#include <sys/sendfile.h>],
[\
AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
#include <sys/sendfile.h>]], [[\
int sfvcnt;
size_t xferred;
struct sendfilevec vec[2];
Expand All @@ -363,8 +344,7 @@ samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
vec[1].sfv_off = 0;
vec[1].sfv_len = 0;
nwritten = sendfilev64(tofd, vec, sfvcnt, &xferred);
],
samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)])
]])],[samba_cv_HAVE_SENDFILEV64=yes],[samba_cv_HAVE_SENDFILEV64=no])])
if test x"$samba_cv_HAVE_SENDFILEV64" = x"yes"; then
AC_DEFINE(HAVE_SENDFILEV64,1,[Whether sendfilev64() is available])
Expand All @@ -375,9 +355,8 @@ samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)])
fi
AC_CACHE_CHECK([for solaris sendfilev support],samba_cv_HAVE_SENDFILEV,[
AC_TRY_LINK([\
#include <sys/sendfile.h>],
[\
AC_LINK_IFELSE([AC_LANG_PROGRAM([[\
#include <sys/sendfile.h>]], [[\
int sfvcnt;
size_t xferred;
struct sendfilevec vec[2];
Expand All @@ -396,8 +375,7 @@ samba_cv_HAVE_SENDFILEV64=yes,samba_cv_HAVE_SENDFILEV64=no)])
vec[1].sfv_off = 0;
vec[1].sfv_len = 0;
nwritten = sendfilev(tofd, vec, sfvcnt, &xferred);
],
samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)])
]])],[samba_cv_HAVE_SENDFILEV=yes],[samba_cv_HAVE_SENDFILEV=no])])
if test x"$samba_cv_HAVE_SENDFILEV" = x"yes"; then
AC_DEFINE(HAVE_SENDFILEV,1,[Whether sendfilev() is available])
Expand Down Expand Up @@ -427,47 +405,41 @@ samba_cv_HAVE_SENDFILEV=yes,samba_cv_HAVE_SENDFILEV=no)])
AC_DEFUN([HYDRA_TCP_CORK], [
AC_MSG_CHECKING([whether TCP_CORK is a valid TCP socket option])
AC_TRY_COMPILE(
#include <sys/socket.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
,[
]], [[
int one = 1, fd;
if (setsockopt(fd, IPPROTO_TCP, TCP_CORK,
(void *) &one, sizeof (one)) == -1)
return -1;
return 0;
],
dnl *** FOUND
AC_DEFINE( HAVE_TCP_CORK, 1, [TCP_CORK was found and will be used])
AC_MSG_RESULT(yes),
dnl *** NOT FOUND
]])],[dnl *** FOUND
AC_DEFINE( HAVE_TCP_CORK, 1, TCP_CORK was found and will be used)
AC_MSG_RESULT(yes)],[dnl *** NOT FOUND
AC_MSG_RESULT(no)
)
])
])

AC_DEFUN([HYDRA_TCP_NOPUSH], [
AC_MSG_CHECKING([whether TCP_NOPUSH is a valid TCP socket option])
AC_TRY_COMPILE(
#include <sys/socket.h>
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
,[
]], [[
int one = 1, fd;
if (setsockopt(fd, IPPROTO_TCP, TCP_NOPUSH,
(void *) &one, sizeof (one)) == -1)
return -1;
return 0;
],
dnl *** FOUND
AC_DEFINE( HAVE_TCP_NOPUSH, 1, [TCP_NOPUSH was found and will be used])
AC_MSG_RESULT(yes),
dnl *** NOT FOUND
]])],[dnl *** FOUND
AC_DEFINE( HAVE_TCP_NOPUSH, 1, TCP_NOPUSH was found and will be used)
AC_MSG_RESULT(yes)],[dnl *** NOT FOUND
AC_MSG_RESULT(no)
)
])
])
12 changes: 5 additions & 7 deletions cherokee.m4
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dnl Now check if the installed CHEROKEE is sufficiently new. (Also sanity
dnl checks the results of cherokee-config to some extent
dnl
rm -f conf.cherokeetest
AC_TRY_RUN([
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -118,7 +118,7 @@ int main (int argc, char *argv[])
}
}
],, no_cherokee=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
]])],[],[no_cherokee=yes],[echo $ac_n "cross compiling; assumed OK... $ac_c"])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
Expand All @@ -140,20 +140,18 @@ int main (int argc, char *argv[])
echo "*** Could not run Cherokee test program, checking why..."
CFLAGS="$CFLAGS $CHEROKEE_CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $CHEROKEE_LIBS $SDL_LIBS"
AC_TRY_LINK([
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include "cherokee.h"
], [ return 0; ],
[ echo "*** The test program compiled, but did not run. This usually means"
]], [[ return 0; ]])],[ echo "*** The test program compiled, but did not run. This usually means"
echo "*** that the run-time linker is not finding Cherokee or finding the wrong"
echo "*** version of Cherokee. If it is not finding Cherokee, you'll need to set your"
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
echo "*** to the installed location Also, make sure you have run ldconfig if that"
echo "*** is required on your system"
echo "***"
echo "*** If you have an old version installed, it is best to remove it, although"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],
[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"],[ echo "*** The test program failed to compile or link. See the file config.log for the"
echo "*** exact error that occured. This usually means Cherokee was incorrectly installed"
echo "*** or that you have moved Cherokee since it was installed. In the latter case, you"
echo "*** may want to edit the cherokee-config script: $CHEROKEE_CONFIG" ])
Expand Down
Loading

0 comments on commit e4d9675

Please sign in to comment.