Red Hat issue 1020203: configure checks fail with some compilers

This commit is contained in:
Gerhard Rieger 2014-03-26 16:10:41 +01:00
parent 622b6b22f4
commit 6e32a56bea
15 changed files with 307 additions and 89 deletions

View file

@ -144,6 +144,9 @@ corrections:
Thanks to Jim Zimmerman for reporting. Thanks to Jim Zimmerman for reporting.
porting: porting:
Red Hat issue 1020203: configure checks fail with some compilers.
Use case: clang
Performed changes for Fedora release 19 Performed changes for Fedora release 19
Adapted, improved test.sh script Adapted, improved test.sh script

View file

@ -63,13 +63,13 @@
#undef HAVE_SOCKET #undef HAVE_SOCKET
/* Define if you have the strdup function. */ /* Define if you have the strdup function. */
#undef HAVE_STRDUP #undef HAVE_PROTOTYPE_LIB_strdup
/* Define if you have the strerror function. */ /* Define if you have the strerror function. */
#undef HAVE_STRERROR #undef HAVE_PROTOTYPE_LIB_strerror
/* Define if you have the strstr function. */ /* Define if you have the strstr function. */
#undef HAVE_STRSTR #undef HAVE_PROTOTYPE_LIB_strstr
/* Define if you have the strtod function. */ /* Define if you have the strtod function. */
#undef HAVE_STRTOD #undef HAVE_STRTOD
@ -96,7 +96,7 @@
#undef HAVE_GETADDRINFO #undef HAVE_GETADDRINFO
/* Define if you have the getipnodebyname function. */ /* Define if you have the getipnodebyname function. */
#undef HAVE_GETIPNODEBYNAME #undef HAVE_PROTOTYPE_LIB_getipnodebyname
/* Define if you have the setgroups function. */ /* Define if you have the setgroups function. */
#undef HAVE_SETGROUPS #undef HAVE_SETGROUPS
@ -105,10 +105,10 @@
#undef HAVE_INET_ATON #undef HAVE_INET_ATON
/* Define if you have the memrchr function. */ /* Define if you have the memrchr function. */
#undef HAVE_MEMRCHR #undef HAVE_PROTOTYPE_LIB_memrchr
/* Define if you have the if_indextoname function. */ /* Define if you have the if_indextoname function. */
#undef HAVE_IF_INDEXTONAME #undef HAVE_PROTOTYPE_LIB_if_indextoname
/* Define if you have the sigaction function */ /* Define if you have the sigaction function */
#undef HAVE_SIGACTION #undef HAVE_SIGACTION
@ -376,6 +376,9 @@
/* define if your struct in_pktinfo has component ipi_spec_dst */ /* define if your struct in_pktinfo has component ipi_spec_dst */
#undef HAVE_PKTINFO_IPI_SPEC_DST #undef HAVE_PKTINFO_IPI_SPEC_DST
/* define if you have struct in6_pktinfo */
#undef HAVE_STRUCT_IN6_PKTINFO
/* define if your struct ip has ip_hl; otherwise assume ip_vhl */ /* define if your struct ip has ip_hl; otherwise assume ip_vhl */
#undef HAVE_STRUCT_IP_IP_HL #undef HAVE_STRUCT_IP_IP_HL
@ -404,7 +407,7 @@
#undef HAVE_UNLOCKPT #undef HAVE_UNLOCKPT
/* Define if you have the ptsname function */ /* Define if you have the ptsname function */
#undef HAVE_PTSNAME #undef HAVE_PROTOTYPE_LIB_ptsname
/* Define if you have the /dev/ptmx pseudo terminal multiplexer */ /* Define if you have the /dev/ptmx pseudo terminal multiplexer */
#undef HAVE_DEV_PTMX #undef HAVE_DEV_PTMX

View file

@ -1,4 +1,4 @@
nl source: configure.in dnl source: configure.in
dnl Copyright Gerhard Rieger dnl Copyright Gerhard Rieger
dnl Published under the GNU General Public License V.2, see file COPYING dnl Published under the GNU General Public License V.2, see file COPYING
@ -41,12 +41,16 @@ AC_CHECK_PROG(AR, ar, ar, gar)
# fail # fail
AC_LANG_COMPILER_REQUIRE() AC_LANG_COMPILER_REQUIRE()
if test "$GCC" = yes; then if test "$CC" = "gcc"; then
CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wno-parentheses" CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wno-parentheses"
ERRONWARN="-Werror -O0" ERRONWARN="-Werror -O0"
elif test "$CC" = "clang"; then
CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wno-parentheses"
ERRONWARN="-Werror -O0"
#elif Sun Studio
# ERRONWARN="-errwarn"
else else
# Sun Studio? ERRONWARN=
ERRONWARN="-errwarn"
fi fi
export CFLAGS export CFLAGS
@ -95,6 +99,25 @@ AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
dnl Check for function prototype and in lib
dnl arg1: function name
dnl arg2: required include files beyond sysincludes.h
define(AC_CHECK_PROTOTYPE_LIB,[
AC_MSG_CHECKING(for $1 prototype)
AC_CACHE_VAL(sc_cv_have_prototype_lib_$1,
[CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN -Wall $CFLAGS1";
AC_TRY_LINK([#include "sysincludes.h"
$2],[return(&$1==(void *)&$1);],
[sc_cv_have_prototype_lib_$1=yes],
[sc_cv_have_prototype_lib_$1=no]);
CFLAGS="$CFLAGS1"])
if test $sc_cv_have_prototype_lib_$1 = yes; then
AC_DEFINE(HAVE_PROTOTYPE_LIB_$1)
fi
AC_MSG_RESULT($sc_cv_have_prototype_lib_$1)
])
dnl Check for hstrerror prototype dnl Check for hstrerror prototype
AC_MSG_CHECKING(for hstrerror prototype) AC_MSG_CHECKING(for hstrerror prototype)
AC_CACHE_VAL(sc_cv_have_prototype_hstrerror, AC_CACHE_VAL(sc_cv_have_prototype_hstrerror,
@ -576,7 +599,7 @@ if test -n "$WITH_FIPS"; then
fi fi
if test -n "$WITH_FIPS"; then if test -n "$WITH_FIPS"; then
AC_MSG_NOTICE(checking for components of OpenSSL FIPS) AC_MSG_CHECKING(for components of OpenSSL FIPS)
# first, we need to find the include file <openssl/fips.h> # first, we need to find the include file <openssl/fips.h>
AC_CACHE_VAL(sc_cv_have_openssl_fips_h, AC_CACHE_VAL(sc_cv_have_openssl_fips_h,
[AC_TRY_COMPILE([#define OPENSSL_FIPS [AC_TRY_COMPILE([#define OPENSSL_FIPS
@ -723,12 +746,26 @@ AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP AC_FUNC_MEMCMP
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_FUNC_STRFTIME AC_FUNC_STRFTIME
AC_CHECK_FUNCS(putenv select poll socket strdup strerror strstr strtod strtol) AC_CHECK_FUNCS(putenv select poll socket strtod strtol)
AC_CHECK_FUNCS(strtoul uname getpgid getsid getaddrinfo) AC_CHECK_FUNCS(strtoul uname getpgid getsid getaddrinfo)
AC_CHECK_FUNCS(getipnodebyname setgroups inet_aton memrchr) AC_CHECK_FUNCS(setgroups inet_aton)
AC_CHECK_FUNCS(if_indextoname) AC_CHECK_FUNCS()
AC_CHECK_FUNCS(grantpt unlockpt ptsname) AC_CHECK_FUNCS(grantpt unlockpt)
# GR AC_CHECK_FUNCS only checks linking, not prototype. This may lead to implicit
# function declarations and to SIGSEGV on systems with 32bit int and 64bit pointer
###################################
# check for prototype and existence of functions that return a pointer
# defines in config.h: HAVE_PROTOTYPE_LIB_$1
AC_CHECK_PROTOTYPE_LIB(strdup)
AC_CHECK_PROTOTYPE_LIB(strerror)
AC_CHECK_PROTOTYPE_LIB(strstr)
AC_CHECK_PROTOTYPE_LIB(getipnodebyname)
AC_CHECK_PROTOTYPE_LIB(memrchr)
AC_CHECK_PROTOTYPE_LIB(if_indextoname)
AC_CHECK_PROTOTYPE_LIB(ptsname)
AC_MSG_CHECKING(for long long) AC_MSG_CHECKING(for long long)
@ -921,10 +958,11 @@ AC_CACHE_VAL(ac_cv_ispeed_offset,
[conftestspeedoff="conftestspeedoff.out" [conftestspeedoff="conftestspeedoff.out"
AC_TRY_RUN([ AC_TRY_RUN([
#include <errno.h> #include <errno.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <termios.h> #include <termios.h>
#include <string.h> #include <string.h>
main(){ int main(){
struct termios t; struct termios t;
FILE *f; FILE *f;
if ((f=fopen("$conftestspeedoff","w"))==NULL){ if ((f=fopen("$conftestspeedoff","w"))==NULL){
@ -1218,6 +1256,18 @@ if test $sc_cv_struct_in_pktinfo = 'yes'; then
AC_MSG_RESULT($sc_cv_pktinfo_ipi_spec_dst) AC_MSG_RESULT($sc_cv_pktinfo_ipi_spec_dst)
fi fi
dnl check for struct in6_pktinfo
AC_MSG_CHECKING(for struct in6_pktinfo)
AC_CACHE_VAL(sc_cv_struct_in6_pktinfo,
[AC_TRY_COMPILE([#include "sysincludes.h"],
[struct in6_pktinfo s;],
[sc_cv_struct_in6_pktinfo=yes],
[sc_cv_struct_in6_pktinfo=no])])
if test $sc_cv_struct_in6_pktinfo = yes; then
AC_DEFINE(HAVE_STRUCT_IN6_PKTINFO)
fi
AC_MSG_RESULT($sc_cv_struct_in6_pktinfo)
dnl check for ip_hl in struct ip dnl check for ip_hl in struct ip
AC_MSG_CHECKING(for struct ip.ip_hl) AC_MSG_CHECKING(for struct ip.ip_hl)
AC_CACHE_VAL(sc_cv_struct_ip_ip_hl, AC_CACHE_VAL(sc_cv_struct_ip_ip_hl,
@ -1320,7 +1370,9 @@ AC_MSG_RESULT($ac_cv_have_c99_snprintf)
AC_MSG_CHECKING(if printf has Z modifier) AC_MSG_CHECKING(if printf has Z modifier)
AC_CACHE_VAL(ac_cv_have_z_modifier, AC_CACHE_VAL(ac_cv_have_z_modifier,
if test "$cc" = gcc; then
[AC_TRY_RUN([ [AC_TRY_RUN([
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
int main(){ int main(){
char s[16]; char s[16];
@ -1329,7 +1381,10 @@ exit(strcmp(s,"1"));
}], }],
[ac_cv_have_z_modifier=yes], [ac_cv_have_z_modifier=yes],
[ac_cv_have_z_modifier=no], [ac_cv_have_z_modifier=no],
[ac_cv_have_z_modifier=no])]) [ac_cv_have_z_modifier=no])]
else ac_cv_have_z_modifier=no
fi
)
if test $ac_cv_have_z_modifier = yes; then if test $ac_cv_have_z_modifier = yes; then
AC_DEFINE(HAVE_FORMAT_Z) AC_DEFINE(HAVE_FORMAT_Z)
fi fi
@ -1345,10 +1400,11 @@ AC_CACHE_CHECK(shift offset of $1, $2,
conftestoffset="conftestoffset.out" conftestoffset="conftestoffset.out"
AC_TRY_RUN([ AC_TRY_RUN([
#include <errno.h> #include <errno.h>
#include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <termios.h> #include <termios.h>
#include <string.h> #include <string.h>
main(){ int main(){
unsigned int i,n=$1; unsigned int i,n=$1;
FILE *f; FILE *f;
if ((f=fopen("$conftestoffset","w"))==NULL){ if ((f=fopen("$conftestoffset","w"))==NULL){
@ -1381,6 +1437,116 @@ AC_SHIFT_OFFSET(TABDLY, sc_cv_sys_tabdly_shift)
AC_SHIFT_OFFSET(CSIZE, sc_cv_sys_csize_shift) AC_SHIFT_OFFSET(CSIZE, sc_cv_sys_csize_shift)
dnl Find what physical type (basic C type) is equivalent to the given type.
dnl If possible we try to compile simple test code and get no warning only with
dnl the matching type.
dnl If this method does not seem to work we run test programs that print the
dnl length and signedness of the type.
dnl do we have a -Werror option?
dnl Does the test code compile with -Werror when types fit?
CHANCE_TO_TYPECHECK=1
CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')"
AC_TRY_COMPILE([#include <stdlib.h>],[int u; int v; exit(&u==&v);],,CHANCE_TO_TYPECHECK=0)
CFLAGS="$CFLAGS1"
dnl Does the test code compile without -Werror when types do not fit?
if test "$CHANCE_TO_TYPECHECK" -ne 0; then
AC_TRY_COMPILE([#include <stdlib.h>],[int u; unsigned int v; exit(&u==&v);],,CHANCE_TO_TYPECHECK=0)
fi
dnl Does the test code fail to compile with -Werror when types do not fit?
if test "$CHANCE_TO_TYPECHECK" -ne 0; then
CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')"
AC_TRY_COMPILE([#include <stdlib.h>],[int u; unsigned int v; exit(&u==&v);],CHANCE_TO_TYPECHECK=0,)
CFLAGS="$CFLAGS1"
fi
if test "$CHANCE_TO_TYPECHECK" -ne 0; then
AC_MSG_NOTICE(using compile -Werror method to find basic types)
else
AC_MSG_NOTICE(using code run method to find basic types)
fi
dnl see AC_BASIC_TYPE
define(AC_BASIC_TYPE_GCC,[
AC_CACHE_CHECK(for equivalent simple type of $2, $4,
[CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')"
dnl echo "echo: trying short for $2" >&2
AC_TRY_COMPILE([$1],[$2 u; short v; return(&u==&v);],
[$4="1 /* short */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned short v; return(&u==&v);],
[$4="2 /* unsigned short */"],
[AC_TRY_COMPILE([$1],[$2 u; int v; return(&u==&v);],
[$4="3 /* int */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned int v; return(&u==&v);],
[$4="4 /* unsigned int */"],
[AC_TRY_COMPILE([$1],[$2 u; long v; return(&u==&v);],
[$4="5 /* long */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned long v; return(&u==&v);],
[$4="6 /* unsigned long */"],
[AC_TRY_COMPILE([$1],[$2 u; long long v; return(&u==&v);],
[$4="7 /* long long */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned long long v; return(&u==&v);],
[$4="8 /* unsigned long long */"],
[$4="0 /* unknown, taking default */"
]) ]) ]) ]) ]) ]) ]) ])
CFLAGS="$CFLAGS1" ])
AC_DEFINE_UNQUOTED($3, ${$4})
])
dnl see AC_BASIC_TYPE
define(AC_BASIC_TYPE_OTHER,[
AC_CACHE_CHECK(for equivalent simple type of $2, $4,
[AC_TRY_RUN([
$1
int main() { return!(sizeof($2)==sizeof(short));}],
# same length as short
AC_TRY_RUN([
$1
int main() { $2 x=-1; return !(x<0);}],
[$4="1 /* short */"],
[$4="2 /* unsigned short */"]),
# length differs from short, try others
AC_TRY_RUN([
$1
int main() { return!(sizeof($2)==sizeof(int));}],
# same length as int
AC_TRY_RUN([
$1
int main() { $2 x=-1; return !(x<0);}],
[$4="3 /* int */"],
[$4="4 /* unsigned int */"]),
# length differs from int, try others
AC_TRY_RUN([
$1
int main() { return !(sizeof($2)==sizeof(long));}],
# same length as long
AC_TRY_RUN([
$1
int main() { $2 x=-1; return !(x<0);}],
[$4="5 /* long */"],
[$4="6 /* unsigned long */"] ),
# length differs from long, try others
AC_TRY_RUN([
$1
int main() { return !(sizeof($2)==sizeof(long long));}],
# same length as long long
AC_TRY_RUN([
$1
int main() { $2 x=-1; return !(x<0);}],
[$4="7 /* long long */"],
[$4="8 /* unsigned long long */"] ),
[$4="0 /* unknown */"]
)
)
)
)
])
AC_DEFINE_UNQUOTED($3, ${$4})
])
dnl find what physical type (basic C type) is equivalent to the given type. dnl find what physical type (basic C type) is equivalent to the given type.
dnl arg1: include file(s) dnl arg1: include file(s)
dnl arg2: type name dnl arg2: type name
@ -1389,28 +1555,91 @@ dnl arg4: cache variable (might be constructed automatically)
dnl output values: 1..short, 2..unsigned short, 3..int, 4..u-int, dnl output values: 1..short, 2..unsigned short, 3..int, 4..u-int,
dnl 5..long, 6..u-long; others not yet supported dnl 5..long, 6..u-long; others not yet supported
define(AC_BASIC_TYPE,[ define(AC_BASIC_TYPE,[
AC_CACHE_CHECK(for equivalent simple type of $2, $4, if test "$CHANCE_TO_TYPECHECK" -ne 0; then
AC_BASIC_TYPE_GCC([$1],[$2],[$3],[$4])
else
AC_BASIC_TYPE_OTHER([$1],[$2],[$3],[$4])
fi
])
dnl See AC_TYPEOF_COMPONENT
dnl This version is for compilers with -Werror or so: gcc, clang, Sun Studio?
define(AC_TYPEOF_COMPONENT_GCC,[
AC_CACHE_CHECK(for basic type of $2.$3, $5,
[CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')" [CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')"
AC_TRY_COMPILE([$1],[$2 u; short v; &u==&v;], AC_TRY_COMPILE([$1],[$2 u;short v; return(&u.$3==&v);],
[$4="1 /* short */"], [$5="1 /* short */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned short v; &u==&v;], [AC_TRY_COMPILE([$1],[$2 u; unsigned short v; return(&u.$3==&v);],
[$4="2 /* unsigned short */"], [$5="2 /* unsigned short */"],
[AC_TRY_COMPILE([$1],[$2 u; int v; &u==&v;], [AC_TRY_COMPILE([$1],[$2 u; int v; return(&u.$3==&v);],
[$4="3 /* int */"], [$5="3 /* int */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned int v; &u==&v;], [AC_TRY_COMPILE([$1],[$2 u; unsigned int v; return(&u.$3==&v);],
[$4="4 /* unsigned int */"], [$5="4 /* unsigned int */"],
[AC_TRY_COMPILE([$1],[$2 u; long v; &u==&v;], [AC_TRY_COMPILE([$1],[$2 u; long v; return(&u.$3==&v);],
[$4="5 /* long */"], [$5="5 /* long */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned long v; &u==&v;], [AC_TRY_COMPILE([$1],[$2 u; unsigned long v; return(&u.$3==&v);],
[$4="6 /* unsigned long */"], [$5="6 /* unsigned long */"],
[AC_TRY_COMPILE([$1],[$2 u; long long v; &u==&v;], [AC_TRY_COMPILE([$1],[$2 u; long long v; return(&u.$3==&v);],
[$4="7 /* long long */"], [$5="7 /* long long */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned long long v; &u==&v;], [AC_TRY_COMPILE([$1],[$2 u; unsigned long long v; return(&u.$3==&v);],
[$4="8 /* unsigned long long */"], [$5="8 /* unsigned long long */"],
[$4="0 /* unknown, taking default */" [$5="0 /* unknown, taking default */"
]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ]) ])
CFLAGS="$CFLAGS1" ]) CFLAGS="$CFLAGS1" ])
AC_DEFINE_UNQUOTED($3, ${$4}) AC_DEFINE_UNQUOTED($4, ${$5})
])
dnl See AC_TYPEOF_COMPONENT
dnl This version is for compilers with no -Werror or so
define(AC_TYPEOF_COMPONENT_OTHER,[
AC_CACHE_CHECK(for basic type of $2.$3, $5,
[AC_TRY_RUN([
$1
int main() { $2 x; return!(sizeof(x.$3)==sizeof(short));}],
# same length as short
AC_TRY_RUN([
$1
int main() { $2 x; x.$3=-1; return !(x.$3<0);}],
[$5="1 /* short */"],
[$5="2 /* unsigned short */"]),
# length differs from short, try others
AC_TRY_RUN([
$1
int main() { $2 x; return!(sizeof(x.$3)==sizeof(int));}],
# same length as int
AC_TRY_RUN([
$1
int main() { $2 x; x.$3=-1; return !(x.$3<0);}],
[$5="3 /* int */"],
[$5="4 /* unsigned int */"]),
# length differs from int, try others
AC_TRY_RUN([
$1
int main() { $2 x; return !(sizeof(x.$3)==sizeof(long));}],
# same length as long
AC_TRY_RUN([
$1
int main() { $2 x; x.$3=-1; return !(x.$3<0);}],
[$5="5 /* long */"],
[$5="6 /* unsigned long */"] ),
# length differs from long, try others
AC_TRY_RUN([
$1
int main() { $2 x; return !(sizeof(x.$3)==sizeof(long long));}],
# same length as long long
AC_TRY_RUN([
$1
int main() { x $2; x.$3=-1; return !(x.$3<0);}],
[$5="7 /* long long */"],
[$5="8 /* unsigned long long */"] ),
[$5="0 /* unknown */"]
)
)
)
)
])
AC_DEFINE_UNQUOTED($4, ${$5})
]) ])
dnl find what physical type (basic C type) describes the given struct or union dnl find what physical type (basic C type) describes the given struct or union
@ -1421,28 +1650,11 @@ dnl arg3: variable or component (e.g., "st_ino")
dnl arg4: output variable, values see AC_BASIC_TYPE dnl arg4: output variable, values see AC_BASIC_TYPE
dnl arg5: cache variable (might be constructed automatically) dnl arg5: cache variable (might be constructed automatically)
define(AC_TYPEOF_COMPONENT,[ define(AC_TYPEOF_COMPONENT,[
AC_CACHE_CHECK(for basic type of $2.$3, $5, if test "$CHANCE_TO_TYPECHECK" -ne 0; then
[CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')" AC_TYPEOF_COMPONENT_GCC([$1],[$2],[$3],[$4],[$5])
AC_TRY_COMPILE([$1],[$2 u;short v; &u.$3==&v;], else
[$5="1 /* short */"], AC_TYPEOF_COMPONENT_OTHER([$1],[$2],[$3],[$4],[$5])
[AC_TRY_COMPILE([$1],[$2 u; unsigned short v; &u.$3==&v;], fi
[$5="2 /* unsigned short */"],
[AC_TRY_COMPILE([$1],[$2 u; int v; &u.$3==&v;],
[$5="3 /* int */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned int v; &u.$3==&v;],
[$5="4 /* unsigned int */"],
[AC_TRY_COMPILE([$1],[$2 u; long v; &u.$3==&v;],
[$5="5 /* long */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned long v; &u.$3==&v;],
[$5="6 /* unsigned long */"],
[AC_TRY_COMPILE([$1],[$2 u; long long v; &u.$3==&v;],
[$5="7 /* long long */"],
[AC_TRY_COMPILE([$1],[$2 u; unsigned long long v; &u.$3==&v;],
[$5="8 /* unsigned long long */"],
[$5="0 /* unknown, taking default */"
]) ]) ]) ]) ]) ]) ]) ])
CFLAGS="$CFLAGS1" ])
AC_DEFINE_UNQUOTED($4, ${$5})
]) ])
AC_BASIC_TYPE([#include <stdlib.h>], size_t, HAVE_BASIC_SIZE_T, sc_cv_type_sizet_basic) AC_BASIC_TYPE([#include <stdlib.h>], size_t, HAVE_BASIC_SIZE_T, sc_cv_type_sizet_basic)
@ -1544,7 +1756,7 @@ AC_ARG_ENABLE(libwrap, [ --disable-libwrap disable libwrap support],
# #
# check if we find the components of libwrap ("tcpd" "tcpwrappers") # check if we find the components of libwrap ("tcpd" "tcpwrappers")
if test -n "$WITH_LIBWRAP"; then if test -n "$WITH_LIBWRAP"; then
AC_MSG_NOTICE(checking for components of libwrap) AC_MSG_CHECKING(for components of libwrap)
# first, we need to find the include file <tcpd.h> # first, we need to find the include file <tcpd.h>
AC_CACHE_VAL(sc_cv_have_tcpd_h, AC_CACHE_VAL(sc_cv_have_tcpd_h,
[AC_TRY_COMPILE([#include <sys/types.h> [AC_TRY_COMPILE([#include <sys/types.h>
@ -1612,7 +1824,7 @@ fi
# check of hosts_allow_table # check of hosts_allow_table
if test -n "$WITH_LIBWRAP"; then if test -n "$WITH_LIBWRAP"; then
AC_MSG_CHECKING(checking for hosts_allow_table) AC_MSG_CHECKING(for hosts_allow_table)
AC_CACHE_VAL(sc_cv_have_hosts_allow_table, AC_CACHE_VAL(sc_cv_have_hosts_allow_table,
[AC_TRY_COMPILE([#include <sys/types.h> [AC_TRY_COMPILE([#include <sys/types.h>
#include <tcpd.h>],[hosts_allow_table="";], #include <tcpd.h>],[hosts_allow_table="";],

View file

@ -264,7 +264,7 @@ int filan_stat(
if (filan_rawoutput) { if (filan_rawoutput) {
snprintf(stdevstr, 8, F_dev, buf->st_dev); snprintf(stdevstr, 8, F_dev, buf->st_dev);
} else { } else {
snprintf(stdevstr, 8, "%hu,%hu", (unsigned short)buf->st_dev>>8, (unsigned short)buf->st_dev&0xff); snprintf(stdevstr, 8, "%hu,%hu", (unsigned short)(buf->st_dev>>8), (unsigned short)(buf->st_dev&0xff));
} }
fprintf(outfile, "%4d: %s\t%s\t" fprintf(outfile, "%4d: %s\t%s\t"
#if HAVE_STAT64 #if HAVE_STAT64
@ -299,7 +299,7 @@ int filan_stat(
buf->st_mode, buf->st_nlink, buf->st_uid, buf->st_mode, buf->st_nlink, buf->st_uid,
buf->st_gid, buf->st_gid,
#if HAVE_ST_RDEV #if HAVE_ST_RDEV
(unsigned short)buf->st_rdev>>8, (unsigned short)buf->st_rdev&0xff, (unsigned short)(buf->st_rdev>>8), (unsigned short)(buf->st_rdev&0xff),
#endif #endif
buf->st_size buf->st_size
#if HAVE_ST_BLKSIZE #if HAVE_ST_BLKSIZE

View file

@ -1279,7 +1279,7 @@ int Getaddrinfo(const char *node, const char *service,
} }
#endif /* (_WITH_IP4 || _WITH_IP6) && HAVE_GETADDRINFO */ #endif /* (_WITH_IP4 || _WITH_IP6) && HAVE_GETADDRINFO */
#if (WITH_IP4 || WITH_IP6) && HAVE_GETIPNODEBYNAME #if (WITH_IP4 || WITH_IP6) && HAVE_PROTOTYPE_LIB_getipnodebyname
struct hostent *Getipnodebyname(const char *name, int af, int flags, struct hostent *Getipnodebyname(const char *name, int af, int flags,
int *error_num) { int *error_num) {
struct hostent *result; struct hostent *result;
@ -1294,7 +1294,7 @@ struct hostent *Getipnodebyname(const char *name, int af, int flags,
} }
return result; return result;
} }
#endif /* (WITH_IP4 || WITH_IP6) && HAVE_GETIPNODEBYNAME */ #endif /* (WITH_IP4 || WITH_IP6) && HAVE_PROTOTYPE_LIB_getipnodebyname */
void *Malloc(size_t size) { void *Malloc(size_t size) {
void *result; void *result;
@ -1436,7 +1436,7 @@ int Unlockpt(int fd) {
} }
#endif /* HAVE_UNLOCKPT */ #endif /* HAVE_UNLOCKPT */
#if HAVE_PTSNAME /* AIX, not Linux */ #if HAVE_PROTOTYPE_LIB_ptsname /* AIX, not Linux */
char *Ptsname(int fd) { char *Ptsname(int fd) {
char *result; char *result;
int _errno; int _errno;
@ -1450,7 +1450,7 @@ char *Ptsname(int fd) {
errno = _errno; errno = _errno;
return result; return result;
} }
#endif /* HAVE_PTSNAME */ #endif /* HAVE_PROTOTYPE_LIB_ptsname */
int Uname(struct utsname *buf) { int Uname(struct utsname *buf) {
int result, _errno; int result, _errno;

View file

@ -88,7 +88,7 @@
#if HAVE_SYS_FILE_H #if HAVE_SYS_FILE_H
#include <sys/file.h> /* LOCK_EX, on AIX directly included */ #include <sys/file.h> /* LOCK_EX, on AIX directly included */
#endif #endif
#if _WITH_SOCKET #if WITH_IP4 || WITH_IP6
# if HAVE_NETINET_IN_H # if HAVE_NETINET_IN_H
#include <netinet/in.h> /* struct sockaddr_in, htonl() */ #include <netinet/in.h> /* struct sockaddr_in, htonl() */
# endif # endif

View file

@ -12171,7 +12171,7 @@ esac
N=$((N+1)) N=$((N+1))
echo "summary: $((N-1)) tests, $((numOK+numFAILD+numCANT)) chosen; $numOK ok, $numFAIL failed, $numCANT could not be performed" echo "summary: $((N-1)) tests, $((numOK+numFAILD+numCANT)) selected; $numOK ok, $numFAIL failed, $numCANT could not be performed"
if [ "$numFAIL" -gt 0 ]; then if [ "$numFAIL" -gt 0 ]; then
echo "FAILED: $listFAIL" echo "FAILED: $listFAIL"

View file

@ -14,7 +14,7 @@
#include "utils.h" #include "utils.h"
#if !HAVE_MEMRCHR #if !HAVE_PROTOTYPE_LIB_memrchr
/* GNU extension, available since glibc 2.1.91 */ /* GNU extension, available since glibc 2.1.91 */
void *memrchr(const void *s, int c, size_t n) { void *memrchr(const void *s, int c, size_t n) {
const unsigned char *t = ((unsigned char *)s)+n; const unsigned char *t = ((unsigned char *)s)+n;
@ -25,7 +25,7 @@ void *memrchr(const void *s, int c, size_t n) {
return NULL; return NULL;
return (void *)t; return (void *)t;
} }
#endif /* !HAVE_MEMRCHR */ #endif /* !HAVE_PROTOTYPE_LIB_memrchr */
void *memdup(const void *src, size_t n) { void *memdup(const void *src, size_t n) {
void *dest; void *dest;

View file

@ -11,7 +11,7 @@ struct wordent {
void *desc; void *desc;
} ; } ;
#if !HAVE_MEMRCHR #if !HAVE_PROTOTYPE_LIB_memrchr
extern void *memrchr(const void *s, int c, size_t n); extern void *memrchr(const void *s, int c, size_t n);
#endif #endif
extern void *memdup(const void *src, size_t n); extern void *memdup(const void *src, size_t n);

View file

@ -129,7 +129,7 @@ int xiogetaddrinfo(const char *node, const char *service,
#if HAVE_GETADDRINFO #if HAVE_GETADDRINFO
struct addrinfo hints = {0}; struct addrinfo hints = {0};
struct addrinfo *res = NULL; struct addrinfo *res = NULL;
#else /* HAVE_GETIPNODEBYNAME || nothing */ #else /* HAVE_PROTOTYPE_LIB_getipnodebyname || nothing */
struct hostent *host; struct hostent *host;
#endif #endif
int error_num; int error_num;
@ -314,7 +314,7 @@ int xiogetaddrinfo(const char *node, const char *service,
} }
} }
#elif HAVE_GETIPNODEBYNAME /* !HAVE_GETADDRINFO */ #elif HAVE_PROTOTYPE_LIB_getipnodebyname /* !HAVE_GETADDRINFO */
if (node != NULL) { if (node != NULL) {
/* first fallback is getipnodebyname() */ /* first fallback is getipnodebyname() */
@ -362,7 +362,7 @@ int xiogetaddrinfo(const char *node, const char *service,
freehostent(host); freehostent(host);
} }
#else /* !HAVE_GETIPNODEBYNAME */ #else /* !HAVE_PROTOTYPE_LIB_getipnodebyname */
if (node != NULL) { if (node != NULL) {
/* this is not a typical IP6 resolver function - but Linux /* this is not a typical IP6 resolver function - but Linux

View file

@ -233,7 +233,7 @@ int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num,
msglen = cmsg->cmsg_len-((char *)CMSG_DATA(cmsg)-(char *)cmsg); msglen = cmsg->cmsg_len-((char *)CMSG_DATA(cmsg)-(char *)cmsg);
envbuff[0] = '\0'; envbuff[0] = '\0';
switch (cmsg->cmsg_type) { switch (cmsg->cmsg_type) {
#ifdef IPV6_PKTINFO #if defined(IPV6_PKTINFO) && HAVE_STRUCT_IN6_PKTINFO
case IPV6_PKTINFO: { case IPV6_PKTINFO: {
struct in6_pktinfo *pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg); struct in6_pktinfo *pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg);
*num = 2; *num = 2;
@ -245,7 +245,7 @@ int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num,
'\0', xiogetifname(pktinfo->ipi6_ifindex, scratch2, -1)); '\0', xiogetifname(pktinfo->ipi6_ifindex, scratch2, -1));
} }
return STAT_OK; return STAT_OK;
#endif /* defined(IPV6_PKTINFO) */ #endif /* defined(IPV6_PKTINFO) && HAVE_STRUCT_IN6_PKTINFO */
#ifdef IPV6_HOPLIMIT #ifdef IPV6_HOPLIMIT
case IPV6_HOPLIMIT: case IPV6_HOPLIMIT:
typbuff[0] = '\0'; strncat(typbuff, "IPV6_HOPLIMIT", typlen-1); typbuff[0] = '\0'; strncat(typbuff, "IPV6_HOPLIMIT", typlen-1);

View file

@ -133,16 +133,16 @@ static int xioopen_pty(const char *linkname, struct opt *opts, int xioflags, xio
Warn2("unlockpt(%d): %s", ptyfd, strerror(errno)); Warn2("unlockpt(%d): %s", ptyfd, strerror(errno));
} }
#endif /* HAVE_UNLOCKPT */ #endif /* HAVE_UNLOCKPT */
#if HAVE_PTSNAME /* AIX, not Linux */ #if HAVE_PROTOTYPE_LIB_ptsname /* AIX, not Linux */
if ((tn = Ptsname(ptyfd)) == NULL) { if ((tn = Ptsname(ptyfd)) == NULL) {
Warn2("ptsname(%d): %s", ptyfd, strerror(errno)); Warn2("ptsname(%d): %s", ptyfd, strerror(errno));
} else { } else {
Notice1("PTY is %s", tn); Notice1("PTY is %s", tn);
} }
#endif /* HAVE_PTSNAME */ #endif /* HAVE_PROTOTYPE_LIB_ptsname */
if (tn == NULL) { if (tn == NULL) {
if ((tn = Ttyname(ptyfd)) == NULL) { if ((tn = Ttyname(ptyfd)) == NULL) {
Warn2("ttyname(%d): %s", ptyfd, strerror(errno)); Error2("ttyname(%d): %s", ptyfd, strerror(errno));
} }
} }
ptyname[0] = '\0'; strncat(ptyname, tn, MAXPTYNAMELEN-1); ptyname[0] = '\0'; strncat(ptyname, tn, MAXPTYNAMELEN-1);

View file

@ -1954,7 +1954,7 @@ xiolog_ancillary_socket(struct cmsghdr *cmsg, int *num,
provide one in parameter ins to avoid creation of a dummy socket. ins must provide one in parameter ins to avoid creation of a dummy socket. ins must
be <0 if it does not specify a socket fd. */ be <0 if it does not specify a socket fd. */
char *xiogetifname(int ind, char *val, int ins) { char *xiogetifname(int ind, char *val, int ins) {
#if !HAVE_IF_INDEXTONAME #if !HAVE_PROTOTYPE_LIB_if_indextoname
int s; int s;
struct ifreq ifr; struct ifreq ifr;
@ -1988,9 +1988,9 @@ char *xiogetifname(int ind, char *val, int ins) {
if (ins < 0) Close(s); if (ins < 0) Close(s);
strcpy(val, ifr.ifr_name); strcpy(val, ifr.ifr_name);
return val; return val;
#else /* HAVE_IF_INDEXTONAME */ #else /* HAVE_PROTOTYPE_LIB_if_indextoname */
return if_indextoname(ind, val); return if_indextoname(ind, val);
#endif /* HAVE_IF_INDEXTONAME */ #endif /* HAVE_PROTOTYPE_LIB_if_indextoname */
} }

View file

@ -1,5 +1,5 @@
/* source: xioconfig.h */ /* source: xioconfig.h */
/* Copyright Gerhard Rieger 2001-2008 */ /* Copyright Gerhard Rieger */
/* Published under the GNU General Public License V.2, see file COPYING */ /* Published under the GNU General Public License V.2, see file COPYING */
#ifndef __xioconfig_h_included #ifndef __xioconfig_h_included
@ -101,12 +101,12 @@
#endif #endif
#if HAVE_DEV_PTMX && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_PTSNAME #if HAVE_DEV_PTMX && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_PROTOTYPE_LIB_ptsname
#else #else
# undef HAVE_DEV_PTMX # undef HAVE_DEV_PTMX
#endif #endif
#if HAVE_DEV_PTC /* && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_PTSNAME */ #if HAVE_DEV_PTC /* && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_PROTOTYPE_LIB_ptsname */
#else #else
# undef HAVE_DEV_PTC # undef HAVE_DEV_PTC
#endif #endif

View file

@ -47,13 +47,13 @@ int xiopty(int useptmx, int *ttyfdp, int *ptyfdp) {
Warn2("unlockpt(%d): %s", ptyfd, strerror(errno)); Warn2("unlockpt(%d): %s", ptyfd, strerror(errno));
} }
#endif /* HAVE_UNLOCKPT */ #endif /* HAVE_UNLOCKPT */
#if HAVE_PTSNAME /* AIX, not Linux */ #if HAVE_PROTOTYPE_LIB_ptsname /* AIX, not Linux */
if ((tn = Ptsname(ptyfd)) == NULL) { if ((tn = Ptsname(ptyfd)) == NULL) {
Warn2("ptsname(%d): %s", ptyfd, strerror(errno)); Warn2("ptsname(%d): %s", ptyfd, strerror(errno));
} else { } else {
Notice1("PTY is %s", tn); Notice1("PTY is %s", tn);
} }
#endif /* HAVE_PTSNAME */ #endif /* HAVE_PROTOTYPE_LIB_ptsname */
#if 0 #if 0
if (tn == NULL) { if (tn == NULL) {
/*! ttyname_r() */ /*! ttyname_r() */