sethostent_r_proto=''
d_setitimer=''
d_setlinebuf=''
+d_has_C_UTF8=''
d_setlocale=''
+d_setlocale_accepts_any_locale_name=''
d_setlocale_r=''
setlocale_r_proto=''
d_setnent=''
d_times=''
d_tmpnam_r=''
tmpnam_r_proto=''
+d_towlower=''
+d_towupper=''
d_trunc=''
d_truncate=''
d_truncl=''
i_utime=''
i_vfork=''
i_wchar=''
+i_wctype=''
d_inc_version_list=''
inc_version_list=''
inc_version_list_init=''
: determine root of directory hierarchy where package will be installed.
case "$prefix" in
-'')
- dflt=`./loc . /usr/local /usr/local /local /opt /usr`
- ;;
-*?/)
- dflt=`echo "$prefix" | sed 's/.$//'`
+'') dflt=`./loc . /usr/local /usr/local /local /opt /usr`
;;
-*)
- dflt="$prefix"
+*) dflt="$prefix"
;;
esac
$cat <<EOM
. ./getfile
oldprefix=''
case "$prefix" in
-'') ;;
-*)
- case "$ans" in
+'') ;;
+*) case "$ans" in
"$prefix") ;;
*) oldprefix="$prefix";;
esac
;;
esac
-prefix="$ans"
-prefixexp="$ansexp"
+
+case "$ans" in
+*?/) prefix=`echo "$ans" | sed 's/.$//'`
+ ;;
+*) prefix="$ans"
+esac
+
+case "$ansexp" in
+*?/) prefixexp=`echo "$ansexp" | sed 's/.$//'`
+ ;;
+*) prefixexp="$ansexp"
+esac
: allow them to override the AFS root
case "$afsroot" in
$define|true|[yY]*)
dflt='y'
;;
+ $undef|false|[nN]*)
+ dflt='n'
+ dflt_dtrace=""
+ ;;
?*)
dflt='y'
dflt_dtrace=$usedtrace
esac
: see if memrchr exists
-set memrchr d_memrchr
-eval $inlibc
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_memrchr_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='# define _GNU_SOURCE'
+xx4='#endif'
+set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_memrchr_proto" in
+ define) # see if memrchr exists
+ set memrchr d_memrchr
+ eval $inlibc
+ ;;
+ *) val=$undef
+ set d_memrchr
+ eval $setvar
+ ;;
+esac
: see if mkdir exists
set mkdir d_mkdir
set setlinebuf d_setlinebuf
eval $inlibc
-: see if setlocale exists
-set setlocale d_setlocale
-eval $inlibc
-
: see if locale.h is available
set locale.h i_locale
eval $inhdr
+: see if this system has wctype.h
+set wctype.h i_wctype
+eval $inhdr
+
+: see if towupper exists
+set towupper d_towupper
+eval $inlibc
+
+: check for setlocale function and behavior
+$cat <<EOM
+
+Checking to see if you have setlocale() and its behavior
+EOM
+$cat >try.c <<EOCP
+#include <stdlib.h>
+#include <string.h>
+#$i_locale I_LOCALE
+#ifdef I_LOCALE
+# include <locale.h>
+#endif
+#$i_wctype I_WCTYPE
+#ifdef I_WCTYPE
+# include <wctype.h>
+#endif
+
+int main() {
+ const char * invalid_name = "\a"; /* This is really invalid! */
+ int accepts_any_locale_name = 0;
+ int has_C_UTF8 = 0;
+ unsigned char bad_setlocale = 255;
+
+ /* If LC_CTYPE isn't defined the compilation will fail, and locales will be
+ * disabled. It's hard to imagine an instance where meaningful locale
+ * handling could be done without LC_CTYPE */
+ const char * name = setlocale(LC_CTYPE, "C");
+
+ if (name == NULL || strcmp(name, "C") != 0) {
+ exit(bad_setlocale);
+ }
+
+ name = setlocale(LC_CTYPE, invalid_name);
+ if (name != NULL) {
+
+ /* Let it pass if it accepts the name but gives back one of the C
+ * locales */
+ if (strcmp(name, "C") != 0 && strcmp(name, "C.UTF-8") != 0) {
+ accepts_any_locale_name = 1;
+ }
+ }
+
+ name = setlocale(LC_CTYPE, "C.UTF-8");
+ if (name != NULL) {
+ unsigned char y_with_diaeresis = ('A' == 193) ? 0xDF : 0xFF;
+
+#$d_towupper HAS_TOWUPPER
+#ifdef HAS_TOWUPPER
+
+ /* We assume that if the machine doesn't have the C99 towupper, it
+ * doesn't have C.UTF-8, even if we successfully changed locales to
+ * include it. This seems safer even on platforms that didn't accept
+ * the really invalid name */
+
+ if (towupper(y_with_diaeresis) == 0x178) {
+ has_C_UTF8 = 1;
+ }
+
+#endif
+
+ }
+
+#if 0
+
+ /* Currently unused code to determine if LC_ALL with disparate values uses
+ * category = value pairs or positional, and to determine the separator
+ * between the categories. We could add code so that if the separator were
+ * > '9', we subtract 10; similarly for 'Z' and 'z', and then just about
+ * every possible ASCII separator would fit in the 5 bits available in the
+ * exit code. This would not be true in EBCDIC. And then if LC_ALL is
+ * positional, we probably would want to know the order of the categories.
+ * Using a file between the C program and the shell script would really be
+ * require to do that */
+#ifdef LC_ALL
+
+ unsigned char min_separator = ' ' - 1;
+ unsigned char separator = min_separator;
+ int uses_name_value_pair_names = 0;
+
+ name = setlocale(LC_ALL, "C");
+ if (name == NULL || strcmp(name, "C") != 0) {
+ exit(bad_setlocale);
+ }
+
+ if (has_C_UTF8) {
+ char * pos;
+
+ name = setlocale(LC_CTYPE, "C.UTF-8");
+ if (name == NULL) {
+ exit(bad_setlocale);
+ }
+ name = setlocale(LC_ALL, NULL);
+ if (name == NULL) {
+ exit(bad_setlocale);
+ }
+
+ pos = strstr(name, "LC_CTYPE" "=C.UTF-8");
+ if (pos != NULL) {
+ uses_name_value_pair_names = 1;
+ if (pos == name) {
+ separator = name[sizeof("LC_CTYPE=C.UTF-8") - 1];
+ }
+ else {
+ separator = *(pos - 1);
+ }
+ }
+ else {
+ pos = strstr(name, "C.UTF-8");
+ if (pos == NULL) {
+ /* bad */
+ }
+ else if (pos == name) {
+ separator = name[sizeof("C.UTF-8") - 1];
+ }
+ else {
+ separator = *(pos - 1);
+ }
+ }
+ }
+
+#endif
+#endif
+
+ exit( 0 /* (separator - min_separator) << 3
+ | uses_name_value_pair_names << 2
+ */
+ | has_C_UTF8 << 1
+ | accepts_any_locale_name);
+
+}
+EOCP
+set try
+if eval $compile; then
+ echo "Your system has setlocale()..." >&4
+ $run ./try
+ case $? in
+ 0) echo "and it seems sane" >&4
+ d_setlocale="$define"
+ d_setlocale_accepts_any_locale_name="$undef"
+ d_has_C_UTF8="false"
+ ;;
+ 1) echo "and it seems sane, but accepts any locale name as valid" >&4
+ d_setlocale="$define"
+ d_setlocale_accepts_any_locale_name="$define"
+ d_has_C_UTF8="false"
+ ;;
+ 2) echo "and it seems sane" >&4
+ d_setlocale="$define"
+ d_setlocale_accepts_any_locale_name="$undef"
+ d_has_C_UTF8="true"
+ ;;
+ 3) echo "and it seems sane, but accepts any locale name as valid" >&4
+ d_setlocale="$define"
+ d_setlocale_accepts_any_locale_name="$define"
+ d_has_C_UTF8="true"
+ ;;
+ *) echo "but it doesn't seem to work, so we won't use it." >&4
+ d_setlocale="$undef"
+ d_setlocale_accepts_any_locale_name="$undef"
+ d_has_C_UTF8="false"
+ ;;
+ esac
+else
+ echo "your system does not have setlocale()" >&4
+ d_setlocale="$undef"
+ d_setlocale_accepts_any_locale_name="$undef"
+ d_has_C_UTF8="false"
+fi
+$rm_try
+
: see if setlocale_r exists
set setlocale_r d_setlocale_r
eval $inlibc
eval $inlibc
: see if strlcat exists
-set strlcat d_strlcat
-eval $inlibc
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_strlcat_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='# define _GNU_SOURCE'
+xx4='#endif'
+set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_strlcat_proto" in
+ define) # see if strlcat exists
+ set strlcat d_strlcat
+ eval $inlibc
+ ;;
+ *) val=$undef
+ set d_strlcat
+ eval $setvar
+ ;;
+esac
: see if strlcpy exists
-set strlcpy d_strlcpy
-eval $inlibc
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_strlcpy_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='# define _GNU_SOURCE'
+xx4='#endif'
+set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_strlcpy_proto" in
+ define) # see if strlcpy exists
+ set strlcpy d_strlcpy
+ eval $inlibc
+ ;;
+ *) val=$undef
+ set d_strlcpy
+ eval $setvar
+ ;;
+esac
: see if strnlen exists
set strnlen d_strnlen
;;
esac
+: see if towlower exists
+set towlower d_towlower
+eval $inlibc
+
: see if trunc exists
set trunc d_trunc
eval $inlibc
MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
-MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
+MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola MSDOS
MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
d_gmtime_r='$d_gmtime_r'
d_gnulibc='$d_gnulibc'
d_grpasswd='$d_grpasswd'
+d_has_C_UTF8='$d_has_C_UTF8'
d_hasmntopt='$d_hasmntopt'
d_htonl='$d_htonl'
d_hypot='$d_hypot'
d_setitimer='$d_setitimer'
d_setlinebuf='$d_setlinebuf'
d_setlocale='$d_setlocale'
+d_setlocale_accepts_any_locale_name='$d_setlocale_accepts_any_locale_name'
d_setlocale_r='$d_setlocale_r'
d_setnent='$d_setnent'
d_setnetent_r='$d_setnetent_r'
d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
d_tm_tm_zone='$d_tm_tm_zone'
d_tmpnam_r='$d_tmpnam_r'
+d_towlower='$d_towlower'
+d_towupper='$d_towupper'
d_trunc='$d_trunc'
d_truncate='$d_truncate'
d_truncl='$d_truncl'
i_utime='$i_utime'
i_vfork='$i_vfork'
i_wchar='$i_wchar'
+i_wctype='$i_wctype'
i_xlocale='$i_xlocale'
ignore_versioned_solibs='$ignore_versioned_solibs'
inc_version_list='$inc_version_list'