ICU-347 new configure tests to check for the existence of wchar.h

(use #if U_HAVE_WCHAR_H) and the size of wchar_t (use U_SIZEOF_WCHAR_T to get
the size). The new symbols appear in platform.h (and icucfg gets a HAVE_WCHAR_H too).

X-SVN-Rev: 1089
This commit is contained in:
Yves Arrouye 2000-04-06 23:36:17 +00:00
parent 7362589426
commit 12e6889366
4 changed files with 205 additions and 41 deletions

View file

@ -1,16 +1,14 @@
/*
*******************************************************************************
*
* Copyright (C) 1999, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
*/
/* common/icucfg.h.in. Generated automatically from configure.in by autoheader. */
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Copyright (c) 1999-2000, International Business Machines Corporation and
others. All Rights Reserved. */
/* Define to signed char if not in <sys/types.h> */
#undef int8_t
@ -32,9 +30,21 @@
/* Define to signed char if not in <sys/types.h> */
#undef bool_t
/* The number of bytes in a wchar_t. */
#undef SIZEOF_WCHAR_T
/* Define if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define if you have the cma library (-lcma). */
#undef HAVE_LIBCMA
/* Define if you have the dl library (-ldl). */
#undef HAVE_LIBDL
/* Define if you have the dld library (-ldld). */
#undef HAVE_LIBDLD
/* Define if you have the m library (-lm). */
#undef HAVE_LIBM
@ -43,3 +53,6 @@
/* Define if you have the pthreads library (-lpthreads). */
#undef HAVE_LIBPTHREADS
/* Define if you have the wcs library (-lwcs). */
#undef HAVE_LIBWCS

View file

@ -113,12 +113,14 @@ typedef unsigned short uint16_t;
#ifdef OS390
# define U_CHARSET_FAMILY 1
# define U_SIZEOF_WCHAR_T 2
#endif
#ifdef AIX
# define U_SIZEOF_WCHAR_T 2
#endif
/*===========================================================================*/
/* Information about wchar support */
/*===========================================================================*/
#define U_HAVE_WCHAR_H @U_HAVE_WCHAR_H@
#define U_SIZEOF_WCHAR_T @U_SIZEOF_WCHAR_T@
/*===========================================================================*/
/* Symbol import-export control */

151
icu4c/source/configure vendored
View file

@ -1093,8 +1093,6 @@ case "${host}" in
*-*-solaris*)
if test "$ac_cv_prog_gcc" = yes; then
icu_cv_host_frag=$srcdir/config/mh-solaris-gcc
elif test "$host_cpu" = sparcv9; then
icu_cv_host_frag=$srcdir/config/mh-solaris-sparcv9
else
icu_cv_host_frag=$srcdir/config/mh-solaris
fi ;;
@ -2114,13 +2112,108 @@ fi
ac_safe=`echo "wchar.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for wchar.h""... $ac_c" 1>&6
echo "configure:2119: checking for wchar.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2124 "configure"
#include "confdefs.h"
#include <wchar.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2129: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
eval "ac_cv_header_$ac_safe=yes"
else
echo "$ac_err" >&5
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
eval "ac_cv_header_$ac_safe=no"
fi
rm -f conftest*
fi
if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
echo "$ac_t""yes" 1>&6
:
else
echo "$ac_t""no" 1>&6
fi
if test "$ac_cv_header_wchar_h" = no
then
U_HAVE_WCHAR_H=0
else
cat >> confdefs.h <<\EOF
#define HAVE_WCHAR_H 1
EOF
U_HAVE_WCHAR_H=1
fi
ac_default_sizeof_wchar_t=4
echo $ac_n "checking size of wchar_t""... $ac_c" 1>&6
echo "configure:2164: checking size of wchar_t" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_wchar_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
if test "$cross_compiling" = yes; then
ac_cv_sizeof_wchar_t=$ac_default_sizeof_wchar_t
else
cat > conftest.$ac_ext <<EOF
#line 2172 "configure"
#include "confdefs.h"
#if STDC_HEADERS
#include <stddef.h>
#endif
#if HAVE_WCHAR_H
#include <wchar.h>
#endif
#include <stdio.h>
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof(wchar_t));
exit(0);
}
EOF
if { (eval echo configure:2189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_wchar_t=`cat conftestval`
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -fr conftest*
ac_cv_sizeof_wchar_t=0
fi
rm -fr conftest*
fi
fi
echo "$ac_t""$ac_cv_sizeof_wchar_t" 1>&6
cat >> confdefs.h <<EOF
#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t
EOF
U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
echo "configure:2117: checking for ANSI C header files" >&5
echo "configure:2212: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2122 "configure"
#line 2217 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@ -2128,7 +2221,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2130: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2225: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@ -2145,7 +2238,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 2147 "configure"
#line 2242 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@ -2163,7 +2256,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
#line 2165 "configure"
#line 2260 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@ -2184,7 +2277,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
#line 2186 "configure"
#line 2281 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@ -2195,7 +2288,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:2292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@ -2219,12 +2312,12 @@ EOF
fi
echo $ac_n "checking for int8_t""... $ac_c" 1>&6
echo "configure:2221: checking for int8_t" >&5
echo "configure:2316: checking for int8_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_int8_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2226 "configure"
#line 2321 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2252,12 +2345,12 @@ EOF
fi
echo $ac_n "checking for uint8_t""... $ac_c" 1>&6
echo "configure:2254: checking for uint8_t" >&5
echo "configure:2349: checking for uint8_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2259 "configure"
#line 2354 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2285,12 +2378,12 @@ EOF
fi
echo $ac_n "checking for int16_t""... $ac_c" 1>&6
echo "configure:2287: checking for int16_t" >&5
echo "configure:2382: checking for int16_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_int16_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2292 "configure"
#line 2387 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2318,12 +2411,12 @@ EOF
fi
echo $ac_n "checking for uint16_t""... $ac_c" 1>&6
echo "configure:2320: checking for uint16_t" >&5
echo "configure:2415: checking for uint16_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2325 "configure"
#line 2420 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2351,12 +2444,12 @@ EOF
fi
echo $ac_n "checking for int32_t""... $ac_c" 1>&6
echo "configure:2353: checking for int32_t" >&5
echo "configure:2448: checking for int32_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2358 "configure"
#line 2453 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2384,12 +2477,12 @@ EOF
fi
echo $ac_n "checking for uint32_t""... $ac_c" 1>&6
echo "configure:2386: checking for uint32_t" >&5
echo "configure:2481: checking for uint32_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2391 "configure"
#line 2486 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2417,12 +2510,12 @@ EOF
fi
echo $ac_n "checking for bool_t""... $ac_c" 1>&6
echo "configure:2419: checking for bool_t" >&5
echo "configure:2514: checking for bool_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_bool_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2424 "configure"
#line 2519 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@ -2769,7 +2862,7 @@ ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile \
common/Makefile common/unicode/platform.h config/Makefile i18n/Makefile \
common/Makefile config/Makefile i18n/Makefile \
extra/Makefile extra/ustdio/Makefile \
tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \
tools/genrb/Makefile tools/gencol/Makefile \
@ -2778,7 +2871,8 @@ trap 'rm -fr `echo "Makefile \
test/Makefile test/intltest/Makefile test/cintltst/Makefile \
test/ieeetest/Makefile \
samples/Makefile samples/date/Makefile samples/cal/Makefile \
samples/XMLConverter/Makefile common/icucfg.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
samples/XMLConverter/Makefile \
common/unicode/platform.h common/icucfg.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@ -2835,6 +2929,8 @@ s%@HAVE_DLOPEN@%$HAVE_DLOPEN%g
s%@CPP@%$CPP%g
s%@HAVE_INTTYPES_H@%$HAVE_INTTYPES_H%g
s%@U_IS_BIG_ENDIAN@%$U_IS_BIG_ENDIAN%g
s%@U_HAVE_WCHAR_H@%$U_HAVE_WCHAR_H%g
s%@U_SIZEOF_WCHAR_T@%$U_SIZEOF_WCHAR_T%g
s%@HAVE_INT8_T@%$HAVE_INT8_T%g
s%@HAVE_UINT8_T@%$HAVE_UINT8_T%g
s%@HAVE_INT16_T@%$HAVE_INT16_T%g
@ -2898,7 +2994,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile \
common/Makefile common/unicode/platform.h config/Makefile i18n/Makefile \
common/Makefile config/Makefile i18n/Makefile \
extra/Makefile extra/ustdio/Makefile \
tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \
tools/genrb/Makefile tools/gencol/Makefile \
@ -2907,7 +3003,8 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile \
test/Makefile test/intltest/Makefile test/cintltst/Makefile \
test/ieeetest/Makefile \
samples/Makefile samples/date/Makefile samples/cal/Makefile \
samples/XMLConverter/Makefile"}
samples/XMLConverter/Makefile \
common/unicode/platform.h"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then

View file

@ -191,6 +191,57 @@ U_IS_BIG_ENDIAN=1
fi
AC_SUBST(U_IS_BIG_ENDIAN)
dnl Define a sizeof checking macro that is a bit better than autoconf's
dnl builtin (and heavily based on it, of course). The new macro is
dnl AC_DO_CHECK_SIZEOF(TYPE [, CROSS_SIZE [, INCLUDES])
AC_DEFUN(AC_DO_CHECK_SIZEOF,
[changequote(<<, >>)dnl
dnl The name to #define.
define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
dnl The cache variable name.
define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
changequote([, ])dnl
AC_MSG_CHECKING(size of $1)
AC_CACHE_VAL(AC_CV_NAME,
[AC_TRY_RUN($3
[#include <stdio.h>
main()
{
FILE *f=fopen("conftestval", "w");
if (!f) exit(1);
fprintf(f, "%d\n", sizeof($1));
exit(0);
}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl
AC_MSG_RESULT($AC_CV_NAME)
AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
undefine([AC_TYPE_NAME])dnl
undefine([AC_CV_NAME])dnl
])
dnl Do various wchar_t related checks
AC_CHECK_HEADER(wchar.h)
if test "$ac_cv_header_wchar_h" = no
then
U_HAVE_WCHAR_H=0
else
AC_DEFINE(HAVE_WCHAR_H)
U_HAVE_WCHAR_H=1
fi
AC_SUBST(U_HAVE_WCHAR_H)
ac_default_sizeof_wchar_t=4
AC_DO_CHECK_SIZEOF(wchar_t,$ac_default_sizeof_wchar_t,[
#if STDC_HEADERS
#include <stddef.h>
#endif
#if HAVE_WCHAR_H
#include <wchar.h>
#endif])
dnl We could set ac_cv_sizeof_wchar_t to the default if the check returned
dnl 0 (unknown) but we'd rather do it in the headers, so we know we had no
dnl clue at configure time.
U_SIZEOF_WCHAR_T=$ac_cv_sizeof_wchar_t
AC_SUBST(U_SIZEOF_WCHAR_T)
dnl Checks for typedefs
AC_CHECK_TYPE(int8_t,signed char)
@ -385,7 +436,7 @@ fi
dnl output the Makefiles
AC_OUTPUT([Makefile \
common/Makefile common/unicode/platform.h config/Makefile i18n/Makefile \
common/Makefile config/Makefile i18n/Makefile \
extra/Makefile extra/ustdio/Makefile \
tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \
tools/genrb/Makefile tools/gencol/Makefile \
@ -394,7 +445,8 @@ AC_OUTPUT([Makefile \
test/Makefile test/intltest/Makefile test/cintltst/Makefile \
test/ieeetest/Makefile \
samples/Makefile samples/date/Makefile samples/cal/Makefile \
samples/XMLConverter/Makefile])
samples/XMLConverter/Makefile \
common/unicode/platform.h])
dnl create the data directory