Add AC_C_BIGENDIAN check for <ac/socket.h>. Code should be rewritten

not to require knowledge of byte order such that this check can be removed.
This commit is contained in:
Kurt Zeilenga 1998-11-17 19:44:59 +00:00
parent 5413a9598a
commit a240efce5c
3 changed files with 138 additions and 33 deletions

161
configure vendored
View file

@ -6385,9 +6385,104 @@ EOF
fi fi
if test $cross_compiling = yes ; then
echo "configure: warning: Assuming BYTE_ORDER is defined" 1>&2
else
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
echo "configure:6393: checking whether byte ordering is bigendian" >&5
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_bigendian=unknown
# See if sys/param.h defines the BYTE_ORDER macro.
cat > conftest.$ac_ext <<EOF
#line 6400 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
int main() {
#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
bogus endian macros
#endif
; return 0; }
EOF
if { (eval echo configure:6411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
# It does; now see whether it defined to BIG_ENDIAN or not.
cat > conftest.$ac_ext <<EOF
#line 6415 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/param.h>
int main() {
#if BYTE_ORDER != BIG_ENDIAN
not big endian
#endif
; return 0; }
EOF
if { (eval echo configure:6426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_bigendian=yes
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
ac_cv_c_bigendian=no
fi
rm -f conftest*
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
rm -f conftest*
if test $ac_cv_c_bigendian = unknown; then
if test "$cross_compiling" = yes; then
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
#line 6446 "configure"
#include "confdefs.h"
main () {
/* Are we little or big endian? From Harbison&Steele. */
union
{
long l;
char c[sizeof (long)];
} u;
u.l = 1;
exit (u.c[sizeof (long) - 1] == 1);
}
EOF
if { (eval echo configure:6459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_bigendian=no
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
ac_cv_c_bigendian=yes
fi
rm -fr conftest*
fi
fi
fi
echo "$ac_t""$ac_cv_c_bigendian" 1>&6
if test $ac_cv_c_bigendian = yes; then
cat >> confdefs.h <<\EOF
#define WORDS_BIGENDIAN 1
EOF
fi
fi
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
echo "configure:6391: checking for 8-bit clean memcmp" >&5 echo "configure:6486: checking for 8-bit clean memcmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -6395,7 +6490,7 @@ else
ac_cv_func_memcmp_clean=no ac_cv_func_memcmp_clean=no
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6399 "configure" #line 6494 "configure"
#include "confdefs.h" #include "confdefs.h"
main() main()
@ -6405,7 +6500,7 @@ main()
} }
EOF EOF
if { (eval echo configure:6409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null if { (eval echo configure:6504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then then
ac_cv_func_memcmp_clean=yes ac_cv_func_memcmp_clean=yes
else else
@ -6423,12 +6518,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o" test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o"
echo $ac_n "checking for strftime""... $ac_c" 1>&6 echo $ac_n "checking for strftime""... $ac_c" 1>&6
echo "configure:6427: checking for strftime" >&5 echo "configure:6522: checking for strftime" >&5
if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6432 "configure" #line 6527 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char strftime(); below. */ which can conflict with char strftime(); below. */
@ -6451,7 +6546,7 @@ strftime();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:6550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_strftime=yes" eval "ac_cv_func_strftime=yes"
else else
@ -6473,7 +6568,7 @@ else
echo "$ac_t""no" 1>&6 echo "$ac_t""no" 1>&6
# strftime is in -lintl on SCO UNIX. # strftime is in -lintl on SCO UNIX.
echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6 echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6
echo "configure:6477: checking for strftime in -lintl" >&5 echo "configure:6572: checking for strftime in -lintl" >&5
ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'` ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
@ -6481,7 +6576,7 @@ else
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS" LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6485 "configure" #line 6580 "configure"
#include "confdefs.h" #include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */ /* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2 /* We use char because int might match the return type of a gcc2
@ -6492,7 +6587,7 @@ int main() {
strftime() strftime()
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:6591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes" eval "ac_cv_lib_$ac_lib_var=yes"
else else
@ -6519,12 +6614,12 @@ fi
fi fi
echo $ac_n "checking for vprintf""... $ac_c" 1>&6 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
echo "configure:6523: checking for vprintf" >&5 echo "configure:6618: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6528 "configure" #line 6623 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */ which can conflict with char vprintf(); below. */
@ -6547,7 +6642,7 @@ vprintf();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6551: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:6646: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_vprintf=yes" eval "ac_cv_func_vprintf=yes"
else else
@ -6571,12 +6666,12 @@ fi
if test "$ac_cv_func_vprintf" != yes; then if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
echo "configure:6575: checking for _doprnt" >&5 echo "configure:6670: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6580 "configure" #line 6675 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */ which can conflict with char _doprnt(); below. */
@ -6599,7 +6694,7 @@ _doprnt();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:6698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func__doprnt=yes" eval "ac_cv_func__doprnt=yes"
else else
@ -6628,12 +6723,12 @@ if test $ac_cv_func_vprintf = yes ; then
for ac_func in vsnprintf for ac_func in vsnprintf
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6632: checking for $ac_func" >&5 echo "configure:6727: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6637 "configure" #line 6732 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -6656,7 +6751,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:6755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -6683,7 +6778,7 @@ done
fi fi
echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6 echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6
echo "configure:6687: checking for wait3 that fills in rusage" >&5 echo "configure:6782: checking for wait3 that fills in rusage" >&5
if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
@ -6691,7 +6786,7 @@ else
ac_cv_func_wait3_rusage=no ac_cv_func_wait3_rusage=no
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6695 "configure" #line 6790 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
@ -6722,7 +6817,7 @@ main() {
} }
} }
EOF EOF
if { (eval echo configure:6726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null if { (eval echo configure:6821: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then then
ac_cv_func_wait3_rusage=yes ac_cv_func_wait3_rusage=yes
else else
@ -6779,12 +6874,12 @@ for ac_func in \
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6783: checking for $ac_func" >&5 echo "configure:6878: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6788 "configure" #line 6883 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -6807,7 +6902,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6811: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:6906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -6835,12 +6930,12 @@ done
for ac_func in getopt strdup tempnam for ac_func in getopt strdup tempnam
do do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:6839: checking for $ac_func" >&5 echo "configure:6934: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6844 "configure" #line 6939 "configure"
#include "confdefs.h" #include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes, /* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */ which can conflict with char $ac_func(); below. */
@ -6863,7 +6958,7 @@ $ac_func();
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:6962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
eval "ac_cv_func_$ac_func=yes" eval "ac_cv_func_$ac_func=yes"
else else
@ -6893,13 +6988,13 @@ done
# Check Configuration # Check Configuration
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6 echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
echo "configure:6897: checking declaration of sys_errlist" >&5 echo "configure:6992: checking declaration of sys_errlist" >&5
if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6903 "configure" #line 6998 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <stdio.h> #include <stdio.h>
@ -6909,7 +7004,7 @@ int main() {
char *c = (char *) *sys_errlist char *c = (char *) *sys_errlist
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6913: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then if { (eval echo configure:7008: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest* rm -rf conftest*
ol_cv_dcl_sys_errlist=yes ol_cv_dcl_sys_errlist=yes
else else
@ -6930,20 +7025,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then
EOF EOF
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6 echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
echo "configure:6934: checking existence of sys_errlist" >&5 echo "configure:7029: checking existence of sys_errlist" >&5
if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6 echo $ac_n "(cached) $ac_c" 1>&6
else else
cat > conftest.$ac_ext <<EOF cat > conftest.$ac_ext <<EOF
#line 6940 "configure" #line 7035 "configure"
#include "confdefs.h" #include "confdefs.h"
#include <errno.h> #include <errno.h>
int main() { int main() {
char *c = (char *) *sys_errlist char *c = (char *) *sys_errlist
; return 0; } ; return 0; }
EOF EOF
if { (eval echo configure:6947: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then if { (eval echo configure:7042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest* rm -rf conftest*
ol_cv_have_sys_errlist=yes ol_cv_have_sys_errlist=yes
else else

View file

@ -948,6 +948,12 @@ AC_STRUCT_TM
OL_C_UPPER_LOWER OL_C_UPPER_LOWER
AC_C_CONST AC_C_CONST
if test $cross_compiling = yes ; then
AC_MSG_WARN([Assuming BYTE_ORDER is defined])
else
AC_C_BIGENDIAN
fi
dnl AC_CHECK_SIZEOF(short) dnl AC_CHECK_SIZEOF(short)
dnl AC_CHECK_SIZEOF(int) dnl AC_CHECK_SIZEOF(int)
dnl AC_CHECK_SIZEOF(long) dnl AC_CHECK_SIZEOF(long)

View file

@ -106,6 +106,10 @@ is provided ``as is'' without express or implied warranty.
/* Define to `int' if <sys/types.h> doesn't define. */ /* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t #undef uid_t
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* define this if needed to get reentrant functions */ /* define this if needed to get reentrant functions */
#undef _REENTRANT #undef _REENTRANT