mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 15:32:35 +00:00
Red Hat issue 1020203: configure checks fail with some compilers
This commit is contained in:
parent
622b6b22f4
commit
6e32a56bea
15 changed files with 307 additions and 89 deletions
3
CHANGES
3
CHANGES
|
@ -144,6 +144,9 @@ corrections:
|
|||
Thanks to Jim Zimmerman for reporting.
|
||||
|
||||
porting:
|
||||
Red Hat issue 1020203: configure checks fail with some compilers.
|
||||
Use case: clang
|
||||
|
||||
Performed changes for Fedora release 19
|
||||
|
||||
Adapted, improved test.sh script
|
||||
|
|
17
config.h.in
17
config.h.in
|
@ -63,13 +63,13 @@
|
|||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#undef HAVE_STRDUP
|
||||
#undef HAVE_PROTOTYPE_LIB_strdup
|
||||
|
||||
/* Define if you have the strerror function. */
|
||||
#undef HAVE_STRERROR
|
||||
#undef HAVE_PROTOTYPE_LIB_strerror
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#undef HAVE_STRSTR
|
||||
#undef HAVE_PROTOTYPE_LIB_strstr
|
||||
|
||||
/* Define if you have the strtod function. */
|
||||
#undef HAVE_STRTOD
|
||||
|
@ -96,7 +96,7 @@
|
|||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define if you have the getipnodebyname function. */
|
||||
#undef HAVE_GETIPNODEBYNAME
|
||||
#undef HAVE_PROTOTYPE_LIB_getipnodebyname
|
||||
|
||||
/* Define if you have the setgroups function. */
|
||||
#undef HAVE_SETGROUPS
|
||||
|
@ -105,10 +105,10 @@
|
|||
#undef HAVE_INET_ATON
|
||||
|
||||
/* Define if you have the memrchr function. */
|
||||
#undef HAVE_MEMRCHR
|
||||
#undef HAVE_PROTOTYPE_LIB_memrchr
|
||||
|
||||
/* 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 */
|
||||
#undef HAVE_SIGACTION
|
||||
|
@ -376,6 +376,9 @@
|
|||
/* define if your struct in_pktinfo has component 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 */
|
||||
#undef HAVE_STRUCT_IP_IP_HL
|
||||
|
||||
|
@ -404,7 +407,7 @@
|
|||
#undef HAVE_UNLOCKPT
|
||||
|
||||
/* 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 */
|
||||
#undef HAVE_DEV_PTMX
|
||||
|
|
322
configure.in
322
configure.in
|
@ -1,4 +1,4 @@
|
|||
nl source: configure.in
|
||||
dnl source: configure.in
|
||||
dnl Copyright Gerhard Rieger
|
||||
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
|
||||
AC_LANG_COMPILER_REQUIRE()
|
||||
|
||||
if test "$GCC" = yes; then
|
||||
if test "$CC" = "gcc"; then
|
||||
CFLAGS="$CFLAGS -D_GNU_SOURCE -Wall -Wno-parentheses"
|
||||
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
|
||||
# Sun Studio?
|
||||
ERRONWARN="-errwarn"
|
||||
ERRONWARN=
|
||||
fi
|
||||
export CFLAGS
|
||||
|
||||
|
@ -95,6 +99,25 @@ AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
|
|||
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
|
||||
AC_MSG_CHECKING(for hstrerror prototype)
|
||||
AC_CACHE_VAL(sc_cv_have_prototype_hstrerror,
|
||||
|
@ -576,7 +599,7 @@ if test -n "$WITH_FIPS"; then
|
|||
fi
|
||||
|
||||
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>
|
||||
AC_CACHE_VAL(sc_cv_have_openssl_fips_h,
|
||||
[AC_TRY_COMPILE([#define OPENSSL_FIPS
|
||||
|
@ -723,12 +746,26 @@ AC_PROG_GCC_TRADITIONAL
|
|||
AC_FUNC_MEMCMP
|
||||
AC_TYPE_SIGNAL
|
||||
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(getipnodebyname setgroups inet_aton memrchr)
|
||||
AC_CHECK_FUNCS(if_indextoname)
|
||||
AC_CHECK_FUNCS(setgroups inet_aton)
|
||||
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)
|
||||
|
@ -921,10 +958,11 @@ AC_CACHE_VAL(ac_cv_ispeed_offset,
|
|||
[conftestspeedoff="conftestspeedoff.out"
|
||||
AC_TRY_RUN([
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <termios.h>
|
||||
#include <string.h>
|
||||
main(){
|
||||
int main(){
|
||||
struct termios t;
|
||||
FILE *f;
|
||||
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)
|
||||
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
|
||||
AC_MSG_CHECKING(for 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_CACHE_VAL(ac_cv_have_z_modifier,
|
||||
if test "$cc" = gcc; then
|
||||
[AC_TRY_RUN([
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
int main(){
|
||||
char s[16];
|
||||
|
@ -1329,7 +1381,10 @@ exit(strcmp(s,"1"));
|
|||
}],
|
||||
[ac_cv_have_z_modifier=yes],
|
||||
[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
|
||||
AC_DEFINE(HAVE_FORMAT_Z)
|
||||
fi
|
||||
|
@ -1345,10 +1400,11 @@ AC_CACHE_CHECK(shift offset of $1, $2,
|
|||
conftestoffset="conftestoffset.out"
|
||||
AC_TRY_RUN([
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <termios.h>
|
||||
#include <string.h>
|
||||
main(){
|
||||
int main(){
|
||||
unsigned int i,n=$1;
|
||||
FILE *f;
|
||||
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)
|
||||
|
||||
|
||||
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 arg1: include file(s)
|
||||
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 5..long, 6..u-long; others not yet supported
|
||||
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')"
|
||||
AC_TRY_COMPILE([$1],[$2 u; short v; &u==&v;],
|
||||
[$4="1 /* short */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; unsigned short v; &u==&v;],
|
||||
[$4="2 /* unsigned short */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; int v; &u==&v;],
|
||||
[$4="3 /* int */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; unsigned int v; &u==&v;],
|
||||
[$4="4 /* unsigned int */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; long v; &u==&v;],
|
||||
[$4="5 /* long */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; unsigned long v; &u==&v;],
|
||||
[$4="6 /* unsigned long */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; long long v; &u==&v;],
|
||||
[$4="7 /* long long */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; unsigned long long v; &u==&v;],
|
||||
[$4="8 /* unsigned long long */"],
|
||||
[$4="0 /* unknown, taking default */"
|
||||
AC_TRY_COMPILE([$1],[$2 u;short v; return(&u.$3==&v);],
|
||||
[$5="1 /* short */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; unsigned short v; return(&u.$3==&v);],
|
||||
[$5="2 /* unsigned short */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; int v; return(&u.$3==&v);],
|
||||
[$5="3 /* int */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; unsigned int v; return(&u.$3==&v);],
|
||||
[$5="4 /* unsigned int */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; long v; return(&u.$3==&v);],
|
||||
[$5="5 /* long */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; unsigned long v; return(&u.$3==&v);],
|
||||
[$5="6 /* unsigned long */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; long long v; return(&u.$3==&v);],
|
||||
[$5="7 /* long long */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; unsigned long long v; return(&u.$3==&v);],
|
||||
[$5="8 /* unsigned long long */"],
|
||||
[$5="0 /* unknown, taking default */"
|
||||
]) ]) ]) ]) ]) ]) ]) ])
|
||||
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
|
||||
|
@ -1421,28 +1650,11 @@ dnl arg3: variable or component (e.g., "st_ino")
|
|||
dnl arg4: output variable, values see AC_BASIC_TYPE
|
||||
dnl arg5: cache variable (might be constructed automatically)
|
||||
define(AC_TYPEOF_COMPONENT,[
|
||||
AC_CACHE_CHECK(for basic type of $2.$3, $5,
|
||||
[CFLAGS1="$CFLAGS"; CFLAGS="$ERRONWARN $(echo "$CFLAGS1" | sed -e 's@-Wall@@g')"
|
||||
AC_TRY_COMPILE([$1],[$2 u;short v; &u.$3==&v;],
|
||||
[$5="1 /* short */"],
|
||||
[AC_TRY_COMPILE([$1],[$2 u; unsigned short v; &u.$3==&v;],
|
||||
[$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})
|
||||
if test "$CHANCE_TO_TYPECHECK" -ne 0; then
|
||||
AC_TYPEOF_COMPONENT_GCC([$1],[$2],[$3],[$4],[$5])
|
||||
else
|
||||
AC_TYPEOF_COMPONENT_OTHER([$1],[$2],[$3],[$4],[$5])
|
||||
fi
|
||||
])
|
||||
|
||||
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")
|
||||
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>
|
||||
AC_CACHE_VAL(sc_cv_have_tcpd_h,
|
||||
[AC_TRY_COMPILE([#include <sys/types.h>
|
||||
|
@ -1612,7 +1824,7 @@ fi
|
|||
|
||||
# check of hosts_allow_table
|
||||
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_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <tcpd.h>],[hosts_allow_table="";],
|
||||
|
|
4
filan.c
4
filan.c
|
@ -264,7 +264,7 @@ int filan_stat(
|
|||
if (filan_rawoutput) {
|
||||
snprintf(stdevstr, 8, F_dev, buf->st_dev);
|
||||
} 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"
|
||||
#if HAVE_STAT64
|
||||
|
@ -299,7 +299,7 @@ int filan_stat(
|
|||
buf->st_mode, buf->st_nlink, buf->st_uid,
|
||||
buf->st_gid,
|
||||
#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
|
||||
buf->st_size
|
||||
#if HAVE_ST_BLKSIZE
|
||||
|
|
8
sycls.c
8
sycls.c
|
@ -1279,7 +1279,7 @@ int Getaddrinfo(const char *node, const char *service,
|
|||
}
|
||||
#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,
|
||||
int *error_num) {
|
||||
struct hostent *result;
|
||||
|
@ -1294,7 +1294,7 @@ struct hostent *Getipnodebyname(const char *name, int af, int flags,
|
|||
}
|
||||
return result;
|
||||
}
|
||||
#endif /* (WITH_IP4 || WITH_IP6) && HAVE_GETIPNODEBYNAME */
|
||||
#endif /* (WITH_IP4 || WITH_IP6) && HAVE_PROTOTYPE_LIB_getipnodebyname */
|
||||
|
||||
void *Malloc(size_t size) {
|
||||
void *result;
|
||||
|
@ -1436,7 +1436,7 @@ int Unlockpt(int fd) {
|
|||
}
|
||||
#endif /* HAVE_UNLOCKPT */
|
||||
|
||||
#if HAVE_PTSNAME /* AIX, not Linux */
|
||||
#if HAVE_PROTOTYPE_LIB_ptsname /* AIX, not Linux */
|
||||
char *Ptsname(int fd) {
|
||||
char *result;
|
||||
int _errno;
|
||||
|
@ -1450,7 +1450,7 @@ char *Ptsname(int fd) {
|
|||
errno = _errno;
|
||||
return result;
|
||||
}
|
||||
#endif /* HAVE_PTSNAME */
|
||||
#endif /* HAVE_PROTOTYPE_LIB_ptsname */
|
||||
|
||||
int Uname(struct utsname *buf) {
|
||||
int result, _errno;
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
#if HAVE_SYS_FILE_H
|
||||
#include <sys/file.h> /* LOCK_EX, on AIX directly included */
|
||||
#endif
|
||||
#if _WITH_SOCKET
|
||||
#if WITH_IP4 || WITH_IP6
|
||||
# if HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h> /* struct sockaddr_in, htonl() */
|
||||
# endif
|
||||
|
|
2
test.sh
2
test.sh
|
@ -12171,7 +12171,7 @@ esac
|
|||
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
|
||||
echo "FAILED: $listFAIL"
|
||||
|
|
4
utils.c
4
utils.c
|
@ -14,7 +14,7 @@
|
|||
#include "utils.h"
|
||||
|
||||
|
||||
#if !HAVE_MEMRCHR
|
||||
#if !HAVE_PROTOTYPE_LIB_memrchr
|
||||
/* GNU extension, available since glibc 2.1.91 */
|
||||
void *memrchr(const void *s, int c, size_t 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 (void *)t;
|
||||
}
|
||||
#endif /* !HAVE_MEMRCHR */
|
||||
#endif /* !HAVE_PROTOTYPE_LIB_memrchr */
|
||||
|
||||
void *memdup(const void *src, size_t n) {
|
||||
void *dest;
|
||||
|
|
2
utils.h
2
utils.h
|
@ -11,7 +11,7 @@ struct wordent {
|
|||
void *desc;
|
||||
} ;
|
||||
|
||||
#if !HAVE_MEMRCHR
|
||||
#if !HAVE_PROTOTYPE_LIB_memrchr
|
||||
extern void *memrchr(const void *s, int c, size_t n);
|
||||
#endif
|
||||
extern void *memdup(const void *src, size_t n);
|
||||
|
|
6
xio-ip.c
6
xio-ip.c
|
@ -129,7 +129,7 @@ int xiogetaddrinfo(const char *node, const char *service,
|
|||
#if HAVE_GETADDRINFO
|
||||
struct addrinfo hints = {0};
|
||||
struct addrinfo *res = NULL;
|
||||
#else /* HAVE_GETIPNODEBYNAME || nothing */
|
||||
#else /* HAVE_PROTOTYPE_LIB_getipnodebyname || nothing */
|
||||
struct hostent *host;
|
||||
#endif
|
||||
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) {
|
||||
/* first fallback is getipnodebyname() */
|
||||
|
@ -362,7 +362,7 @@ int xiogetaddrinfo(const char *node, const char *service,
|
|||
freehostent(host);
|
||||
}
|
||||
|
||||
#else /* !HAVE_GETIPNODEBYNAME */
|
||||
#else /* !HAVE_PROTOTYPE_LIB_getipnodebyname */
|
||||
|
||||
if (node != NULL) {
|
||||
/* this is not a typical IP6 resolver function - but Linux
|
||||
|
|
|
@ -233,7 +233,7 @@ int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num,
|
|||
msglen = cmsg->cmsg_len-((char *)CMSG_DATA(cmsg)-(char *)cmsg);
|
||||
envbuff[0] = '\0';
|
||||
switch (cmsg->cmsg_type) {
|
||||
#ifdef IPV6_PKTINFO
|
||||
#if defined(IPV6_PKTINFO) && HAVE_STRUCT_IN6_PKTINFO
|
||||
case IPV6_PKTINFO: {
|
||||
struct in6_pktinfo *pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsg);
|
||||
*num = 2;
|
||||
|
@ -245,7 +245,7 @@ int xiolog_ancillary_ip6(struct cmsghdr *cmsg, int *num,
|
|||
'\0', xiogetifname(pktinfo->ipi6_ifindex, scratch2, -1));
|
||||
}
|
||||
return STAT_OK;
|
||||
#endif /* defined(IPV6_PKTINFO) */
|
||||
#endif /* defined(IPV6_PKTINFO) && HAVE_STRUCT_IN6_PKTINFO */
|
||||
#ifdef IPV6_HOPLIMIT
|
||||
case IPV6_HOPLIMIT:
|
||||
typbuff[0] = '\0'; strncat(typbuff, "IPV6_HOPLIMIT", typlen-1);
|
||||
|
|
|
@ -133,16 +133,16 @@ static int xioopen_pty(const char *linkname, struct opt *opts, int xioflags, xio
|
|||
Warn2("unlockpt(%d): %s", ptyfd, strerror(errno));
|
||||
}
|
||||
#endif /* HAVE_UNLOCKPT */
|
||||
#if HAVE_PTSNAME /* AIX, not Linux */
|
||||
#if HAVE_PROTOTYPE_LIB_ptsname /* AIX, not Linux */
|
||||
if ((tn = Ptsname(ptyfd)) == NULL) {
|
||||
Warn2("ptsname(%d): %s", ptyfd, strerror(errno));
|
||||
} else {
|
||||
Notice1("PTY is %s", tn);
|
||||
}
|
||||
#endif /* HAVE_PTSNAME */
|
||||
#endif /* HAVE_PROTOTYPE_LIB_ptsname */
|
||||
if (tn == 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);
|
||||
|
|
|
@ -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
|
||||
be <0 if it does not specify a socket fd. */
|
||||
char *xiogetifname(int ind, char *val, int ins) {
|
||||
#if !HAVE_IF_INDEXTONAME
|
||||
#if !HAVE_PROTOTYPE_LIB_if_indextoname
|
||||
int s;
|
||||
struct ifreq ifr;
|
||||
|
||||
|
@ -1988,9 +1988,9 @@ char *xiogetifname(int ind, char *val, int ins) {
|
|||
if (ins < 0) Close(s);
|
||||
strcpy(val, ifr.ifr_name);
|
||||
return val;
|
||||
#else /* HAVE_IF_INDEXTONAME */
|
||||
#else /* HAVE_PROTOTYPE_LIB_if_indextoname */
|
||||
return if_indextoname(ind, val);
|
||||
#endif /* HAVE_IF_INDEXTONAME */
|
||||
#endif /* HAVE_PROTOTYPE_LIB_if_indextoname */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* source: xioconfig.h */
|
||||
/* Copyright Gerhard Rieger 2001-2008 */
|
||||
/* Copyright Gerhard Rieger */
|
||||
/* Published under the GNU General Public License V.2, see file COPYING */
|
||||
|
||||
#ifndef __xioconfig_h_included
|
||||
|
@ -101,12 +101,12 @@
|
|||
#endif
|
||||
|
||||
|
||||
#if HAVE_DEV_PTMX && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_PTSNAME
|
||||
#if HAVE_DEV_PTMX && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_PROTOTYPE_LIB_ptsname
|
||||
#else
|
||||
# undef HAVE_DEV_PTMX
|
||||
#endif
|
||||
|
||||
#if HAVE_DEV_PTC /* && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_PTSNAME */
|
||||
#if HAVE_DEV_PTC /* && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_PROTOTYPE_LIB_ptsname */
|
||||
#else
|
||||
# undef HAVE_DEV_PTC
|
||||
#endif
|
||||
|
|
|
@ -47,13 +47,13 @@ int xiopty(int useptmx, int *ttyfdp, int *ptyfdp) {
|
|||
Warn2("unlockpt(%d): %s", ptyfd, strerror(errno));
|
||||
}
|
||||
#endif /* HAVE_UNLOCKPT */
|
||||
#if HAVE_PTSNAME /* AIX, not Linux */
|
||||
#if HAVE_PROTOTYPE_LIB_ptsname /* AIX, not Linux */
|
||||
if ((tn = Ptsname(ptyfd)) == NULL) {
|
||||
Warn2("ptsname(%d): %s", ptyfd, strerror(errno));
|
||||
} else {
|
||||
Notice1("PTY is %s", tn);
|
||||
}
|
||||
#endif /* HAVE_PTSNAME */
|
||||
#endif /* HAVE_PROTOTYPE_LIB_ptsname */
|
||||
#if 0
|
||||
if (tn == NULL) {
|
||||
/*! ttyname_r() */
|
||||
|
|
Loading…
Reference in a new issue