#!/bin/sh
-# Copyright (C) 1992, 1993, 1994 Free Software Foundation
+# Copyright (C) 1992, 1993, 1994, 1997, 1998, 1999, 2000 Free Software Foundation
#
# This file is part of the GNU IO Library. This library is free
# software; you can redistribute it and/or modify it under the
# This program is used to test if the compiler prepends '_' before identifiers.
# It is also used to check the g++ uses '$' or '.' various places.
-if test -z "${NAMES_HAVE_UNDERSCORE}" -o -z "${DOLLAR_IN_LABEL}" \
- -o -z "${VTABLE_LABEL_PREFIX}"; then
+if test -z "${NAMES_HAVE_UNDERSCORE}" \
+ || test -z "${DOLLAR_IN_LABEL}" \
+ || test -z "${VTABLE_LABEL_PREFIX}"; then
cat >dummy.h <<!EOF!
#ifdef __GNUG__
#pragma interface
>>dummy.out
# Now we get rid of the <>, and any other junk on the nm output line.
# (We get rid of <filebuf> in case nm included debugging output for
- # class filebuf itself.) Finally, we select the first line of
- # the result, and hope that's what we wanted!
- vtab_name=`${SED} -n -e '/<filebuf>/d' -e 's/^.*<\(.*\)>.*$/\1/p' \
+ # class filebuf itself.) On windows32, we also need to delete the
+ # unique sections (.data$_vt$*), otherwise we get the wrong result.
+ # Finally, we select the first line of the result, and hope that's
+ # what we wanted!
+ vtab_name=`${SED} -n -e '/<filebuf>/d' \
+ -e '/\.data[$_.]<_vt\$7filebuf>/d' \
+ -e 's/^.*<\(.*\)>.*$/\1/p' \
<dummy.out | ${SED} -n -e '1p'`
case "${vtab_name}" in
*7filebuf) echo "#define ${macro_prefix}VTABLE_LABEL_HAS_LENGTH 1" ;;
echo "#define ${macro_prefix}HAVE_ST_BLKSIZE 0"
fi
+# A little test program to check if there is an O_APPEND.
+cat >dummy.c <<!EOF!
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+int foo()
+{
+ return O_APPEND;
+}
+!EOF!
+
+if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ :
+else
+ echo "#define O_APPEND 0"
+fi
+
+# A little test program to check if there is an O_EXCL.
+cat >dummy.c <<!EOF!
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+int foo()
+{
+ return O_EXCL;
+}
+!EOF!
+
+if ${CC} -c dummy.c >/dev/null 2>&1 ; then
+ :
+else
+ echo "#define O_EXCL 0"
+fi
+
# A little test program to check if the name 'clog' is defined in libm,
# as it is under DEC UNIX.
cat >dummy.c <<!EOF!
tr ' ' ' ' <TMP >dummy.out
for TYPE in dev_t clock_t fpos_t gid_t ino_t mode_t nlink_t off_t pid_t ptrdiff_t sigset_t size_t ssize_t time_t uid_t va_list wchar_t wint_t int16_t uint16_t int32_t uint_32_t u_int16_t u_int32_t; do
- IMPORTED=`eval 'echo $'"$TYPE"`
+ eval IMPORTED=\$$TYPE
if [ -n "${IMPORTED}" ] ; then
eval "$TYPE='$IMPORTED'"
else
# Search dummy.out for a typedef for X*$t.
sed_script="
s/unsigned long long int/_G_ullong/g
- s/long long int/_G_llong/g
+ s/long long int /_G_llong /g
s/unsigned long long/_G_ullong/g
s/long long/_G_llong/g
/.*typedef *\\(.*[^ ]\\) *X*$t *;.*/{s||\1|;p;q;}
# Look for some standard macros.
for NAME in BUFSIZ FOPEN_MAX FILENAME_MAX NULL; do
- IMPORTED=`eval 'echo $'"$NAME"`
+ eval IMPORTED=\$$NAME
if [ -n "${IMPORTED}" ] ; then
- eval "$NAME='$IMPORTED /* specified */"
+ eval "$NAME='$IMPORTED /* specified */'"
else
rm -f TMP
${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\(.*\);|\1|w TMP" \
# These macros must be numerical constants; strip any trailing 'L's.
for NAME in SHRT_MAX INT_MAX LONG_MAX LONG_LONG_MAX; do
- IMPORTED=`eval 'echo $'"$NAME"`
+ eval IMPORTED=\$$NAME
if [ -n "${IMPORTED}" ] ; then
- eval "$NAME='$IMPORTED /* specified */"
+ eval "$NAME='$IMPORTED /* specified */'"
else
rm -f TMP
${SED} -n -e 's| *;|;|g' -e "s|long X${NAME}= *\([0-9]*\)L* *;|\1|w TMP" \
echo "#define ${macro_prefix}USE_INT32_FLAGS 1"
fi
-# A little test program to check if __printf_fp is available.
-cat >dummy.c <<EOF
+if test -n "$HAVE_PRINTF_FP"; then
+ echo "#define ${macro_prefix}HAVE_PRINTF_FP $HAVE_PRINTF_FP"
+ echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO $HAVE_LONG_DOUBLE_IO"
+else
+ # A little test program to check if __printf_fp is available.
+ cat >dummy.c <<EOF
int main()
{
return __printf_fp ();
}
EOF
-if ${CC} dummy.c >/dev/null 2>&1 ; then
- echo "#define ${macro_prefix}HAVE_PRINTF_FP 1"
- echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 1"
-else
- echo "#define ${macro_prefix}HAVE_PRINTF_FP 0"
- echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 0"
+ if ${CC} dummy.c >/dev/null 2>&1 ; then
+ echo "#define ${macro_prefix}HAVE_PRINTF_FP 1"
+ echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 1"
+ else
+ echo "#define ${macro_prefix}HAVE_PRINTF_FP 0"
+ echo "#define ${macro_prefix}HAVE_LONG_DOUBLE_IO 0"
+ fi
fi
# Uncomment the following line if you don't have working templates.