From: David MacKenzie Date: Wed, 20 Nov 1996 19:13:42 +0000 (+0000) Subject: bug fixes for quoting and locales X-Git-Tag: fsf-origin~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f989a49dedf4bcfd463896fd70f9513f2ee65fcb;p=thirdparty%2Fautoconf.git bug fixes for quoting and locales --- diff --git a/ChangeLog b/ChangeLog index 0127449a..a732e5b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Wed Nov 20 13:00:21 1996 David J MacKenzie + + * acgeneral.m4 (AC_TRY_LIB): Remove an erroneous dnl. + (AC_TRY_COMPILE): Make the final newline consistent with the + other AC_TRY_* macros. + + * acgeneral.m4 (AC_CACHE_SAVE): Handle cache variable values + correctly even if they contain single quote, or are quoted by + the shell. From Paul Eggert . + (AC_INIT_PREPARE): Set LC_MESSAGES to C if set. + From Hans Olsson . + Set LC_CTYPE to C if set. + From tom@vlsivie.tuwien.ac.AT (Thomas Winder). + * autoconf.sh, autoheader.sh: Likewise set LC_MESSAGES and LC_CTYPE. + Tue Nov 19 10:29:06 1996 David J MacKenzie * testsuite/autoconf.g/sizeof.exp: Use the v2 macro name. diff --git a/TODO b/TODO index 01f29b79..4a15fdd1 100644 --- a/TODO +++ b/TODO @@ -291,17 +291,6 @@ Make easy macros for checking for X functions and libraries, such as Motif. ------------------------------------------------------------------------------ -Testing for ANSI header files (AC_HEADER_STDC) fails under linux when -using the latest libraries (libc-4.6.30, at least libc-4.6.27 works -ok) when LC_CTYPE is set to ISO-8859-1. The islower/toupper test -reports errors. -Anyway, adding a line like -if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi -to the configure script can solve the problem. -From: tom@vlsivie.tuwien.ac.AT (Thomas Winder) - ------------------------------------------------------------------------------- - * Test suite: more things to test: ** That the shell scripts produce correct output on some simple data. ** Configuration header files. That autoheader does the right thing, @@ -537,18 +526,6 @@ Merge the two lex macros, AC_PROG_LEX and AC_DECL_YYTEXT? ------------------------------------------------------------------------------ -Modify the meaning of autoheader --localdir to add an additional -directory to look for acconfig.h instead of replacing the directory -containing configure.in. Also, autoreconf recurses on all -subdirectories containing a configure.in, not just those given by an -AC_CONFIG_SUBDIRS directive, so you can't have both directories that -are parts of a large package, and directories that are independent -packages. - -Marc Horowitz - ------------------------------------------------------------------------------- - in order to use the AC_CANONICAL_SYSTEM macro, I have to have install-sh somewhere nearby --- why is this? I have no real reason to distribute install-sh, other than that its absence breaks @@ -571,3 +548,32 @@ die if the compiler seemed to succeed--in which case it's not usable with autoconf scripts. ------------------------------------------------------------------------------ + +there is absolutely no guarantee that 'a' to 'z' are +contiguous, and the ISLOWER macro is not guaranteed to correctly +reproduce the result of islower. In all variants of ASCII however, it +will work correctly in the C locale. + +There is also no guarantee that toupper(i) - i is the same constant if +non-zero. TOUPPER, hence, is not correct either. But, in all variants +of ASCII in the C locale, it works. + +Tanmoy Bhattacharya (tanmoy@qcd.lanl.gov> + +------------------------------------------------------------------------------ + +Modify the meaning of autoheader --localdir to add an additional +directory to look for acconfig.h instead of replacing the directory +containing configure.in. You can't have both directories that are +parts of a large package, and directories that are independent +packages. (Also, autoreconf recurses on all subdirectories containing +a configure.in, not just those given by an AC_CONFIG_SUBDIRS +directive.) + +Marc Horowitz + +------------------------------------------------------------------------------ + +Rewrite AC_OUTPUT_COMMANDS to use diversions. + +------------------------------------------------------------------------------ diff --git a/acgeneral.m4 b/acgeneral.m4 index e9db16ff..4fd7d8ce 100644 --- a/acgeneral.m4 +++ b/acgeneral.m4 @@ -633,11 +633,14 @@ changequote([, ])dnl done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h @@ -1049,14 +1052,27 @@ define(AC_CACHE_SAVE, # --recheck option to rerun configure. # EOF -changequote(, )dnl dnl Allow a site initialization script to override cache values. +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -# HP-UX 10.01 sh prints single quotes around any value that contains spaces. +changequote(, )dnl (set) 2>&1 | -sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)='*\([^']*\)'*/\1=\${\1='\2'}/p"\ - >> confcache + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1=\2}/p' + ;; + esac >> confcache changequote([, ])dnl if cmp -s $cache_file confcache; then : @@ -1476,7 +1492,7 @@ char $2(); ]), [$2()], eval "ac_cv_lib_$ac_lib_var=yes", - eval "ac_cv_lib_$ac_lib_var=no")dnl + eval "ac_cv_lib_$ac_lib_var=no") LIBS="$ac_save_LIBS" ])dnl if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then @@ -1618,8 +1634,7 @@ ifelse([$4], , , [ rm -rf conftest* $4 ])dnl fi -rm -f conftest*] -) +rm -f conftest*]) dnl ### Examining libraries diff --git a/autoconf.in b/autoconf.in index ee64ca5d..4e667b93 100644 --- a/autoconf.in +++ b/autoconf.in @@ -26,11 +26,14 @@ Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir] [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. -# Only set `LANG' and `LC_ALL' to "C" if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi : ${AC_MACRODIR=@datadir@} : ${M4=@M4@} diff --git a/autoconf.sh b/autoconf.sh index ee64ca5d..4e667b93 100644 --- a/autoconf.sh +++ b/autoconf.sh @@ -26,11 +26,14 @@ Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir] [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. -# Only set `LANG' and `LC_ALL' to "C" if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi : ${AC_MACRODIR=@datadir@} : ${M4=@M4@} diff --git a/autoheader.in b/autoheader.in index 707195dd..92f9d63c 100644 --- a/autoheader.in +++ b/autoheader.in @@ -28,11 +28,14 @@ Usage: autoheader [-h] [--help] [-m dir] [--macrodir=dir] [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. -# Only set `LANG' and `LC_ALL' to "C" if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi test -z "${AC_MACRODIR}" && AC_MACRODIR=@datadir@ test -z "${M4}" && M4=@M4@ diff --git a/autoheader.sh b/autoheader.sh index 707195dd..92f9d63c 100644 --- a/autoheader.sh +++ b/autoheader.sh @@ -28,11 +28,14 @@ Usage: autoheader [-h] [--help] [-m dir] [--macrodir=dir] [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. -# Only set `LANG' and `LC_ALL' to "C" if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi test -z "${AC_MACRODIR}" && AC_MACRODIR=@datadir@ test -z "${M4}" && M4=@M4@ diff --git a/bin/autoconf.in b/bin/autoconf.in index ee64ca5d..4e667b93 100644 --- a/bin/autoconf.in +++ b/bin/autoconf.in @@ -26,11 +26,14 @@ Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir] [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. -# Only set `LANG' and `LC_ALL' to "C" if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi : ${AC_MACRODIR=@datadir@} : ${M4=@M4@} diff --git a/bin/autoheader.in b/bin/autoheader.in index 707195dd..92f9d63c 100644 --- a/bin/autoheader.in +++ b/bin/autoheader.in @@ -28,11 +28,14 @@ Usage: autoheader [-h] [--help] [-m dir] [--macrodir=dir] [-l dir] [--localdir=dir] [--version] [template-file]" # NLS nuisances. -# Only set `LANG' and `LC_ALL' to "C" if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi test -z "${AC_MACRODIR}" && AC_MACRODIR=@datadir@ test -z "${M4}" && M4=@M4@ diff --git a/configure b/configure index 79ef1dd9..a3f877ba 100755 --- a/configure +++ b/configure @@ -434,11 +434,14 @@ do done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h @@ -747,12 +750,25 @@ cat > confcache <<\EOF # --recheck option to rerun configure. # EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -# HP-UX 10.01 sh prints single quotes around any value that contains spaces. (set) 2>&1 | -sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)='*\([^']*\)'*/\1=\${\1='\2'}/p"\ - >> confcache + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1=\2}/p' + ;; + esac >> confcache if cmp -s $cache_file confcache; then : else diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4 index e9db16ff..4fd7d8ce 100644 --- a/lib/autoconf/general.m4 +++ b/lib/autoconf/general.m4 @@ -633,11 +633,14 @@ changequote([, ])dnl done # NLS nuisances. -# Only set LANG and LC_ALL to C if already set. -# These must not be set unconditionally because not all systems understand -# e.g. LANG=C (notably SCO). -if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h @@ -1049,14 +1052,27 @@ define(AC_CACHE_SAVE, # --recheck option to rerun configure. # EOF -changequote(, )dnl dnl Allow a site initialization script to override cache values. +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -# HP-UX 10.01 sh prints single quotes around any value that contains spaces. +changequote(, )dnl (set) 2>&1 | -sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)='*\([^']*\)'*/\1=\${\1='\2'}/p"\ - >> confcache + case `(ac_space=' '; set) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1=\2}/p' + ;; + esac >> confcache changequote([, ])dnl if cmp -s $cache_file confcache; then : @@ -1476,7 +1492,7 @@ char $2(); ]), [$2()], eval "ac_cv_lib_$ac_lib_var=yes", - eval "ac_cv_lib_$ac_lib_var=no")dnl + eval "ac_cv_lib_$ac_lib_var=no") LIBS="$ac_save_LIBS" ])dnl if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then @@ -1618,8 +1634,7 @@ ifelse([$4], , , [ rm -rf conftest* $4 ])dnl fi -rm -f conftest*] -) +rm -f conftest*]) dnl ### Examining libraries