From c4db344da5d363eb1cbbcc5aefa32aed0c409f6e Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Mon, 31 Jul 2023 17:27:14 -0600 Subject: [PATCH] Regenerate Configure from latest metaconfig This includes the LC_ALL notation unit, not yet merged in metaconfig. It turns out that in order to get quite a few elements from being dropped, I had to add them to metaconfig.h --- Configure | 977 ++++++++++++++++++++------------- Cross/config.sh-arm-linux | 5 + Cross/config.sh-arm-linux-n770 | 5 + Porting/config.sh | 5 + config_h.SH | 44 +- configure.com | 6 + metaconfig.h | 110 +++- plan9/config_sh.sample | 5 + win32/config.gc | 5 + win32/config.vc | 5 + 10 files changed, 784 insertions(+), 383 deletions(-) diff --git a/Configure b/Configure index 99033fe3e3a4..180109c5f05e 100755 --- a/Configure +++ b/Configure @@ -707,7 +707,6 @@ d_nexttoward='' d_nice='' d_nl_langinfo='' d_nl_langinfo_l='' -d_thread_safe_nl_langinfo_l='' d_off64_t='' d_open3='' d_fpathconf='' @@ -954,6 +953,11 @@ d_wcsxfrm='' d_wctomb='' d_writev='' default_inc_excludes_dot='' +d_perl_lc_all_category_positions_init='' +d_perl_lc_all_separator='' +d_perl_lc_all_uses_name_value_pairs='' +perl_lc_all_category_positions_init='' +perl_lc_all_separator='' dlext='' bin_ELF='' cccdlflags='' @@ -16691,102 +16695,11 @@ eval $inlibc set langinfo.h i_langinfo eval $inhdr -: see if nl_langinfo exists +: see if nl_langinfo and/or nl_langinfo_l exist set nl_langinfo d_nl_langinfo eval $inlibc - -: see if locale.h is available -set locale.h i_locale -eval $inhdr - -: check for nl_langinfo_l item -$cat <try.c < -#endif -#include -#$i_langinfo I_LANGINFO -#ifdef I_LANGINFO -# include -#endif -#$i_pthread I_PTHREAD -#ifdef I_PTHREAD -# include -#endif -#$i_locale I_LOCALE -#ifdef I_LOCALE -# include -#endif - -void * -thread_start(void * arg) -{ - nl_langinfo(RADIXCHAR); -} - -int main() { - char * main_buffer; - char save_main_buffer[1000]; - pthread_t subthread; - pthread_attr_t attr; - - main_buffer = nl_langinfo_l(CODESET, newlocale(LC_ALL_MASK, "C", 0)); - - /* If too large for our generous allowance, just assume we don't have - * it. */ - if (strlen(main_buffer) >= sizeof(save_main_buffer)) { - exit(1); - } - - strcpy(save_main_buffer, main_buffer); - - if (pthread_attr_init(&attr) != 0) { - exit(1); - } - - if (pthread_create(&subthread, &attr, thread_start, NULL) != 0) { - exit(1); - } - - if (pthread_join(subthread, NULL) != 0) { - exit(1); - } - - exit(! (strcmp(main_buffer, save_main_buffer) == 0)); -} -EOCP -case "$usethreads" in - define) - set try - if eval $compile; then - echo "Your system has nl_langinfo_l()..." >&4 - d_nl_langinfo_l="$define" - echo "$d_nl_langinfo_l" >&4 - if $run ./try; then - echo "and it is thread-safe (just as I'd hoped)." >&4 - d_thread_safe_nl_langinfo_l="$define" - echo "$d_thread_safe_nl_langinfo_l" >&4 - else - echo "but it isn't thread-safe." >&4 - fi - else - echo "your system does not have nl_langinfo_l()" >&4 - fi - ;; - *) echo "Since threads aren't selected, we won't bother looking for nl_langinfo_l()" >&4 -esac -if test X"$d_nl_langinfo_l" = X; then - d_nl_langinfo_l="$undef" -fi -if test X"$d_thread_safe_nl_langinfo_l" = X; then - d_thread_safe_nl_langinfo_l="$undef" -fi -$rm_try +set nl_langinfo_l d_nl_langinfo_l +eval $inlibc : Look for non 'int'-sized bitfields case "$d_non_int_bitfields" in @@ -17338,56 +17251,602 @@ if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then int main() { int detachstate = JOINABLE; } -EOCP - set try -DJOINABLE=PTHREAD_CREATE_JOINABLE - if eval $compile; then - echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4 - val="$undef" # Yes, undef. - set d_old_pthread_create_joinable - eval $setvar - val="" - set old_pthread_create_joinable - eval $setvar - else - set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED - if eval $compile; then - echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4 - val="$define" - set d_old_pthread_create_joinable - eval $setvar - val=PTHREAD_CREATE_UNDETACHED - set old_pthread_create_joinable - eval $setvar - else - set try -DJOINABLE=__UNDETACHED - if eval $compile; then - echo "You seem to use __UNDETACHED." >&4 - val="$define" - set d_old_pthread_create_joinable - eval $setvar - val=__UNDETACHED - set old_pthread_create_joinable - eval $setvar - else - echo "Egads, nothing obvious found. Guessing that you use 0." >&4 - val="$define" - set d_old_pthread_create_joinable - eval $setvar - val=0 - set old_pthread_create_joinable - eval $setvar - fi - fi - fi - $rm_try -else - d_old_pthread_create_joinable="$undef" - old_pthread_create_joinable="" -fi +EOCP + set try -DJOINABLE=PTHREAD_CREATE_JOINABLE + if eval $compile; then + echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4 + val="$undef" # Yes, undef. + set d_old_pthread_create_joinable + eval $setvar + val="" + set old_pthread_create_joinable + eval $setvar + else + set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED + if eval $compile; then + echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4 + val="$define" + set d_old_pthread_create_joinable + eval $setvar + val=PTHREAD_CREATE_UNDETACHED + set old_pthread_create_joinable + eval $setvar + else + set try -DJOINABLE=__UNDETACHED + if eval $compile; then + echo "You seem to use __UNDETACHED." >&4 + val="$define" + set d_old_pthread_create_joinable + eval $setvar + val=__UNDETACHED + set old_pthread_create_joinable + eval $setvar + else + echo "Egads, nothing obvious found. Guessing that you use 0." >&4 + val="$define" + set d_old_pthread_create_joinable + eval $setvar + val=0 + set old_pthread_create_joinable + eval $setvar + fi + fi + fi + $rm_try +else + d_old_pthread_create_joinable="$undef" + old_pthread_create_joinable="" +fi + +: see if pause exists +set pause d_pause +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 +case "$d_setlocale" in +'') +$cat >&4 <try.c < +#include +#$i_locale I_LOCALE +#ifdef I_LOCALE +# include +#endif +#$i_wctype I_WCTYPE +#ifdef I_WCTYPE +# include +#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 + + } + + exit( 0 /* (separator - min_separator) << 3 + | uses_name_value_pair_names << 2 + */ + | has_C_UTF8 << 1 + | accepts_any_locale_name); + +} +EOCP +val= +set d_setlocale +eval $setvar +case $d_setlocale in + $undef) d_setlocale_accepts_any_locale_name="$undef" + d_has_C_UTF8="false" + ;; + *) set try + if eval $compile; then + echo "Your system has setlocale()..." >&4 + $run ./try + case $? in + 0) echo "and it seems sane; you don't have a C.UTF-8 locale" >&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; you have a C.UTF-8 locale" >&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 +esac +$rm_try +;; +*) val="$d_setlocale" + set d_setlocale + eval $setvar + case "$d_setlocale" in + $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4 + ;; + esac + rp="Does your system have the C.UTF-8 locale?" + dflt=n + . ./myread + case "$ans" in + [Yy]*) d_has_C_UTF8="true" + c_utf8_locale=" or C.UTF-8" + ;; + *) d_has_C_UTF8="false" + c_utf8_locale="" + ;; + esac + case "$d_setlocale" in + $define) + rp="When you set your locale to something besides C$c_utf8_locale, does it do so, or just pretend to?" >&4 + dflt=n + . ./myread + case "$ans" in + true|[Yy]*) + d_setlocale_accepts_any_locale_name="$undef" + ;; + *) d_setlocale_accepts_any_locale_name="$define" + ;; + esac + ;; + *) d_setlocale_accepts_any_locale_name="$undef" + ;; + esac +esac + +: Check the syntax of LC_ALL when categories are set to different locales +echo " " +$echo "Checking the syntax of LC_ALL when categories are set to different locales..." >&4 + +case $d_setlocale in + $define) +$rm -f try try.* +$cat >try.c < +#include +#include +#include +#include + +#ifndef LC_ALL + +int +main (const int argc, const char ** argv) +{ +} + +#else +# define C_ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0])) +# define strEQ(s1,s2) (strcmp(s1,s2) == 0) +# define strNE(s1,s2) (strcmp(s1,s2) != 0) +# define Copy(s,d,n,t) (void)memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)) +# define memEQ(s1,s2,l) (memcmp(((const void *) (s1)), ((const void *) (s2)), l) == 0) +# define memNE(s1,s2,l) (! memEQ(s1,s2,l)) + +int +main (const int argc, const char ** argv) +{ + + int debug = 0; + + /* All categories Perl knows about on any system. If any are missing, this + * won't work for that system, and they must be added here and in perl.h, + * locale.c */ + const int categories[] = { + +# ifdef LC_CTYPE + LC_CTYPE, +# endif +# ifdef LC_NUMERIC + LC_NUMERIC, +# endif +# ifdef LC_COLLATE + LC_COLLATE, +# endif +# ifdef LC_TIME + LC_TIME, +# endif +# ifdef LC_MESSAGES + LC_MESSAGES, +# endif +# ifdef LC_MONETARY + LC_MONETARY, +# endif +# ifdef LC_ADDRESS + LC_ADDRESS, +# endif +# ifdef LC_IDENTIFICATION + LC_IDENTIFICATION, +# endif +# ifdef LC_MEASUREMENT + LC_MEASUREMENT, +# endif +# ifdef LC_PAPER + LC_PAPER, +# endif +# ifdef LC_TELEPHONE + LC_TELEPHONE, +# endif +# ifdef LC_NAME + LC_NAME, +# endif +# ifdef LC_SYNTAX + LC_SYNTAX, +# endif +# ifdef LC_TOD + LC_TOD +# endif + + }; + + const char * category_names[] = { + +# ifdef LC_CTYPE + "LC_CTYPE", +# endif +# ifdef LC_NUMERIC + "LC_NUMERIC", +# endif +# ifdef LC_COLLATE + "LC_COLLATE", +# endif +# ifdef LC_TIME + "LC_TIME", +# endif +# ifdef LC_MESSAGES + "LC_MESSAGES", +# endif +# ifdef LC_MONETARY + "LC_MONETARY", +# endif +# ifdef LC_ADDRESS + "LC_ADDRESS", +# endif +# ifdef LC_IDENTIFICATION + "LC_IDENTIFICATION", +# endif +# ifdef LC_MEASUREMENT + "LC_MEASUREMENT", +# endif +# ifdef LC_PAPER + "LC_PAPER", +# endif +# ifdef LC_TELEPHONE + "LC_TELEPHONE", +# endif +# ifdef LC_NAME + "LC_NAME", +# endif +# ifdef LC_SYNTAX + "LC_SYNTAX", +# endif +# ifdef LC_TOD + "LC_TOD" +# endif + + }; + + char alternate[1024] = { '\0' } ; + + /* This is a list of locales that are likely to be found on any machine + * (Windows and non-Windows) */ + const char * candidates[] = { + "POSIX", + "C.UTF-8", + "en_US", + "en_US.UTF-8", + "American", + "English" + }; + char separator[1024]; + size_t separator_len = 0; + unsigned int distincts_count = 0; + + /* We look through the candidates for one which returns the same non-C + * locale for every category */ + for (unsigned int i = 0; i < C_ARRAY_LENGTH(candidates); i++) { + const char * candidate = candidates[i]; + distincts_count = 0; + alternate[0] = '\0'; + + for (unsigned int j = 0; j < C_ARRAY_LENGTH(categories); j++) { + const int category = categories[j]; + const char * locale_name = setlocale(category, candidate); + + if (locale_name == NULL) { /* Not on this system */ + break; + } + + if (debug) fprintf(stderr, + "i=%d,j=%d;" + " Return of setlocale(%d=%s, '%s') is '%s'\n", + i, j, + category, category_names[j], + candidate, locale_name); + + /* If the candidate is indistinguishable from C, break to try the + * next candidate */ + if (strEQ(locale_name, "C")) { + break; + } + + /* Save the name the first time through, and on subsequent ones */ + /* make sure the name is the same as before, so the code below can + * be assured of finding it when searching */ + if (j == 0) { + strncpy(alternate, locale_name, sizeof(alternate)); + } + else if (strNE(alternate, locale_name)) { + break; + } + + distincts_count++; + } + + /* Done with this candidate. If every category returned the same non-C + * name, this candidate works. It not, loop to try the next candidate + * */ + if (distincts_count == C_ARRAY_LENGTH(categories)) { + break; + } + } + + /* Here, either found a suitable candidate, or exhausted the possibilities. + * In the latter case, give up */ + if (distincts_count < C_ARRAY_LENGTH(categories)) { + fprintf(stderr, "Couldn't find a locale distinguishable from C\n"); + return 1; + } + + /* An example syntax, from cygwin, is: + * LC_COLLATE/LC_CTYPE/LC_MONETARY/LC_NUMERIC/LC_TIME/LC_MESSAGES + * The locales for a given category are always in the same position, + * indicated above, with a slash separating them */ + + int map_LC_ALL_position_to_category[C_ARRAY_LENGTH(categories)]; + + /* Initialize */ + for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) { + map_LC_ALL_position_to_category[i] = INT_MAX; + } + + const char * lc_all = NULL; + + /* We need to find the category that goes in each position */ + for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories); i++) { + + /* First set everything to 'C' */ + if (! setlocale(LC_ALL, "C")) { + fprintf(stderr, "Failed to set LC_ALL to C\n"); + return 1; + } + + /* Then set this category to the alternate */ + if (! setlocale(categories[i], alternate)) { + fprintf(stderr, "Failed to set %d to to '%s'\n", + categories[i], alternate); + return 1; + } + + /* Then find what the system says LC_ALL looks like with just this one + * category not set to 'C' */ + lc_all = setlocale(LC_ALL, NULL); + if (! lc_all) { + fprintf(stderr, "Failed to retrieve LC_ALL\n"); + return 1; + } + + if (debug) fprintf(stderr, "LC_ALL is '%s'\n", lc_all); + + /* Assume is name=value pairs if the result contains both an equals and + * a semi-colon. */ + if (strchr(lc_all, '=') && strchr(lc_all, ';')) { + fprintf(stdout, "\"=;\"\n\n"); + return 0; + } + + /* Here isn't name=value pairs. Find the position of the alternate */ + const char * alt_pos = strstr(lc_all, alternate); + if (! alt_pos) { + fprintf(stderr, "Couldn't find '%s' in '%'s\n", alternate, lc_all); + return 1; + } + + /* Parse the LC_ALL string from the beginning up to where the alternate + * locale is */ + const char * s = lc_all; + int count = 0; + while (s < alt_pos) { + + /* Count the 'C' locales before the non-C one. (Note the letter + * 'C' can only occur as the entire 'C' locale, since all of them + * are that locale before 'alt_pos') */ + const char * next_C = (const char *) memchr(s, 'C', alt_pos - s); + if (next_C) { + count++; + s = next_C + 1; + continue; + } + + /* Here, there is no 'C' between 's' and the alternate locale, so + * 'count' gives the total number of occurrences of 'C' in that + * span. If count is 0, this is the first category in an LC_ALL + * string, and we know its position, but not the separator. */ + if (count == 0) { + break; + } + + /* When 'count' isn't 0, 's' points to one past the previous 'C'. + * The separator starts here, ending just before the non-C locale. + */ + + const char * new_sep = s; + unsigned int new_sep_len = alt_pos - s; + + /* If we don't already have a separator saved, save this as it */ + if (separator_len == 0) { + separator_len = new_sep_len; + Copy(s, separator, separator_len, char); + separator[separator_len] = '\0'; + } + else { /* Otherwise make sure it's the same string as previously + * calculated */ + if ( new_sep_len != separator_len + || memNE(separator, new_sep, separator_len)) + { + fprintf(stderr, "Unexpectedly got distinct separators" + " '%s' vs '%s\n", separator, new_sep); + return 1; + } + } + + /* Here, we have found the position of category[i] in LC_ALL. */ + break; + + } /* End of loop parsing the LC_ALL string */ + + if (map_LC_ALL_position_to_category[count] != INT_MAX) { + fprintf(stderr, "Categories %d and %d both appear to occupy" + " position %d in LC_ALL; there is something" + " wrong with the calculation\n", + categories[count], categories[i], + count); + return 1; + } + + /* Save the position of this category */ + map_LC_ALL_position_to_category[count] = categories[i]; + + } /* End of loop through all the categories */ + + fprintf(stdout, "\"%s\"\n{", separator); + for (unsigned int i = 0; i < C_ARRAY_LENGTH(categories) - 1; i++) { + fprintf(stdout, " %d,", map_LC_ALL_position_to_category[i]); + } + fprintf(stdout, " %d }\n", map_LC_ALL_position_to_category[ + C_ARRAY_LENGTH(categories) - 1]); + return 0; + +} -: see if pause exists -set pause d_pause -eval $inlibc +#endif +EOF +set try +if eval $compile_ok; then + output=`$run ./try 2>/dev/null` + echo "'$output'" >&4 + separator=`echo "$output" | $sed 1q` + echo "'$separator'" >&4 + case $separator in + "\"=;\"") + d_perl_lc_all_uses_name_value_pairs="$define" + d_perl_lc_all_separator="$undef" + perl_lc_all_separator= + d_perl_lc_all_category_positions_init="$undef" + perl_lc_all_category_positions_init= + ;; + "") d_perl_lc_all_uses_name_value_pairs="$undef" + d_perl_lc_all_separator="$undef" + perl_lc_all_separator= + d_perl_lc_all_category_positions_init="$undef" + perl_lc_all_category_positions_init= + ;; + *) d_perl_lc_all_uses_name_value_pairs="$undef" + d_perl_lc_all_separator="$define" + perl_lc_all_separator="$separator" + d_perl_lc_all_category_positions_init="$undef" + perl_lc_all_category_positions_init=`echo "$output" | sed -n 2p` + ;; + esac + +fi +$rm -f try try.* +;; +*) d_perl_lc_all_separator="$undef" + perl_lc_all_separator= + d_perl_lc_all_category_positions_init="$undef" + perl_lc_all_category_positions_init= + + # No setlocale(), but using this default allows our code to compile + # and run without having to have a bunch more #ifdef's + d_perl_lc_all_uses_name_value_pairs="$define" +;; +esac : see if pipe2 exists set pipe2 d_pipe2 @@ -18224,230 +18683,6 @@ eval $inlibc set setlinebuf d_setlinebuf eval $inlibc -: 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 -case "$d_setlocale" in -'') -$cat >&4 <try.c < -#include -#$i_locale I_LOCALE -#ifdef I_LOCALE -# include -#endif -#$i_wctype I_WCTYPE -#ifdef I_WCTYPE -# include -#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 -val= -set d_setlocale -eval $setvar -case $d_setlocale in - $undef) d_setlocale_accepts_any_locale_name="$undef" - d_has_C_UTF8="false" - ;; - *) set try - if eval $compile; then - echo "Your system has setlocale()..." >&4 - $run ./try - case $? in - 0) echo "and it seems sane; you don't have a C.UTF-8 locale" >&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; you have a C.UTF-8 locale" >&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 -esac -$rm_try -;; -*) val="$d_setlocale" - set d_setlocale - eval $setvar - case "$d_setlocale" in - $undef) echo "There may be other ways to set the locale on your system, so we need to ask:" >&4 - ;; - esac - rp="Does your system have the C.UTF-8 locale?" - dflt=n - . ./myread - case "$ans" in - [Yy]*) d_has_C_UTF8="true" - c_utf8_locale=" or C.UTF-8" - ;; - *) d_has_C_UTF8="false" - c_utf8_locale="" - ;; - esac - case "$d_setlocale" in - $define) - rp="When you set your locale to something besides C$c_utf8_locale, does it do so, or just pretend to?" >&4 - dflt=n - . ./myread - case "$ans" in - true|[Yy]*) - d_setlocale_accepts_any_locale_name="$undef" - ;; - *) d_setlocale_accepts_any_locale_name="$define" - ;; - esac - ;; - *) d_setlocale_accepts_any_locale_name="$undef" - ;; - esac -esac - : see if setlocale_r exists set setlocale_r d_setlocale_r eval $inlibc @@ -25022,6 +25257,9 @@ d_open3='$d_open3' d_openat='$d_openat' d_pathconf='$d_pathconf' d_pause='$d_pause' +d_perl_lc_all_category_positions_init='$d_perl_lc_all_category_positions_init' +d_perl_lc_all_separator='$d_perl_lc_all_separator' +d_perl_lc_all_uses_name_value_pairs='$d_perl_lc_all_uses_name_value_pairs' d_perl_otherlibdirs='$d_perl_otherlibdirs' d_phostname='$d_phostname' d_pipe2='$d_pipe2' @@ -25195,7 +25433,6 @@ d_telldir='$d_telldir' d_telldirproto='$d_telldirproto' d_tgamma='$d_tgamma' d_thread_local='$d_thread_local' -d_thread_safe_nl_langinfo_l='$d_thread_safe_nl_langinfo_l' d_time='$d_time' d_timegm='$d_timegm' d_times='$d_times' @@ -25570,6 +25807,8 @@ patchlevel='$patchlevel' path_sep='$path_sep' perl5='$perl5' perl='$perl' +perl_lc_all_category_positions_init='$perl_lc_all_category_positions_init' +perl_lc_all_separator='$perl_lc_all_separator' perl_patchlevel='$perl_patchlevel' perl_static_inline='$perl_static_inline' perl_thread_local='$perl_thread_local' diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux index b090e8dd88c1..1120bf2c2d25 100644 --- a/Cross/config.sh-arm-linux +++ b/Cross/config.sh-arm-linux @@ -433,6 +433,9 @@ d_open3='define' d_openat='undef' d_pathconf='define' d_pause='define' +d_perl_lc_all_category_positions_init='define' +d_perl_lc_all_separator='define' +d_perl_lc_all_uses_name_value_pairs='define' d_perl_otherlibdirs='undef' d_phostname='undef' d_pipe2='undef' @@ -970,6 +973,8 @@ patchlevel='9' path_sep=':' perl5='/usr/bin/perl' perl='' +perl_lc_all_category_positions_init='define' +perl_lc_all_separator='define' perl_patchlevel='' perl_static_inline='static' perl_thread_local='' diff --git a/Cross/config.sh-arm-linux-n770 b/Cross/config.sh-arm-linux-n770 index 002c0e76a2a3..09f074deabc8 100644 --- a/Cross/config.sh-arm-linux-n770 +++ b/Cross/config.sh-arm-linux-n770 @@ -432,6 +432,9 @@ d_open3='define' d_openat='undef' d_pathconf='define' d_pause='define' +d_perl_lc_all_category_positions_init='define' +d_perl_lc_all_separator='define' +d_perl_lc_all_uses_name_value_pairs='define' d_perl_otherlibdirs='undef' d_phostname='undef' d_pipe2='undef' @@ -968,6 +971,8 @@ patchlevel='11' path_sep=':' perl5='/usr/bin/perl' perl='' +perl_lc_all_category_positions_init='define' +perl_lc_all_separator='define' perl_patchlevel='' perl_static_inline='static' perl_thread_local='' diff --git a/Porting/config.sh b/Porting/config.sh index 3e274ca9d2a6..15b327695d1a 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -446,6 +446,9 @@ d_open3='define' d_openat='define' d_pathconf='define' d_pause='define' +d_perl_lc_all_category_positions_init='define' +d_perl_lc_all_separator='define' +d_perl_lc_all_uses_name_value_pairs='define' d_perl_otherlibdirs='undef' d_phostname='undef' d_pipe2='define' @@ -994,6 +997,8 @@ patchlevel='37' path_sep=':' perl5='/pro/bin/perl' perl='perl' +perl_lc_all_category_positions_init='define' +perl_lc_all_separator='define' perl_patchlevel='' perl_static_inline='static __inline__' perl_thread_local='_Thread_local' diff --git a/config_h.SH b/config_h.SH index 5880dc532de8..da0f2dbcd7b7 100755 --- a/config_h.SH +++ b/config_h.SH @@ -3178,10 +3178,16 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un /* HAS_NL_LANGINFO: * This symbol, if defined, indicates that the nl_langinfo routine is - * available to return local data. You will also need + * available to return locale data. You will also need + * and therefore I_LANGINFO. + */ +/* HAS_NL_LANGINFO_L: + * This symbol, if defined, indicates that the nl_langinfo_l routine is + * available to return locale data. You will also need * and therefore I_LANGINFO. */ #$d_nl_langinfo HAS_NL_LANGINFO /**/ +#$d_nl_langinfo_l HAS_NL_LANGINFO_L /**/ /* HAS_OFF64_T: * This symbol will be defined if the C compiler supports off64_t. @@ -3645,6 +3651,31 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ #$default_inc_excludes_dot DEFAULT_INC_EXCLUDES_DOT /**/ +/* PERL_LC_ALL_USES_NAME_VALUE_PAIRS: + * This symbol, if defined, indicates to the C program that the string + * returned by setlocale(LC_ALL, NULL) uses 'name=value;' pairs to + * indicate what each category's locale is when they aren't all set to the + * same locale. For example, "LC_NUMERIC=C;LC_CTYPE=de_DE;..." + * When not defined, the system uses positional notation. + */ +/* PERL_LC_ALL_SEPARATOR: + * This symbol, if defined, gives the string returned by + * setlocale(LC_ALL, NULL) to separate categories that are in different + * locales on systems that use a positional notation as opposed to + * 'name=value' pairs. An example on some platforms could be the '/' in + * "C/de_DE/C/en_UK/C/C" + */ +/* PERL_LC_ALL_CATEGORY_POSITIONS_INIT: + * This symbol, when defined, gives the C initializer for an array whose + * element [0] is the first category in the string returned by + * setlocale(LC_ALL, NULL) when not all categories are the same, on + * systems that use a positional notation. After element [0] is + * LC_ALL_SEPARATOR, then the category given by element [1] and so on. + */ +#$d_perl_lc_all_uses_name_value_pairs PERL_LC_ALL_USES_NAME_VALUE_PAIRS /**/ +#$d_perl_lc_all_separator PERL_LC_ALL_SEPARATOR $perl_lc_all_separator /**/ +#$d_perl_lc_all_category_positions_init PERL_LC_ALL_CATEGORY_POSITIONS_INIT $perl_lc_all_category_positions_init /**/ + /* USE_DYNAMIC_LOADING: * This symbol, if defined, indicates that dynamic loading of * some sort is available. @@ -4991,17 +5022,6 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ #$d_mbrtowc HAS_MBRTOWC /**/ -/* HAS_NL_LANGINFO_L: - * This symbol, when defined, indicates presence of the nl_langinfo_l() - * function - */ -/* HAS_THREAD_SAFE_NL_LANGINFO_L: - * This symbol, when defined, indicates presence of the nl_langinfo_l() - * function, and that it is thread-safe. - */ -#$d_nl_langinfo_l HAS_NL_LANGINFO_L /**/ -#$d_thread_safe_nl_langinfo_l HAS_THREAD_SAFE_NL_LANGINFO_L /**/ - /* OLD_PTHREAD_CREATE_JOINABLE: * This symbol, if defined, indicates how to create pthread * in joinable (aka undetached) state. NOTE: not defined diff --git a/configure.com b/configure.com index 9b43ca65a0e3..935439da39f3 100644 --- a/configure.com +++ b/configure.com @@ -1,3 +1,4 @@ + $! OpenVMS configuration procedure for Perl -- do not attempt to run under DOS $ sav_ver = 'F$VERIFY(0)' $ on control_y then goto clean_up @@ -6215,6 +6216,9 @@ $ WC "d_oldpthreads='" + d_oldpthreads + "'" $ WC "d_oldsock='undef'" $ WC "d_open3='define'" $ WC "d_openat='undef'" +$ WC "d_perl_lc_all_category_positions_init='undef'" +$ WC "d_perl_lc_all_separator='undef'" +$ WC "d_perl_lc_all_uses_name_value_pairs='undef'" $ WC "d_unlinkat='undef'" $ WC "d_renameat='undef'" $ WC "d_linkat='undef'" @@ -6679,6 +6683,8 @@ $ WC "package='" + package + "'" $ WC "pager='" + pager + "'" $ WC "patchlevel='" + patchlevel + "'" $ WC "path_sep='|'" +$ WC "perl_lc_all_category_positions_init='undef'" +$ WC "perl_lc_all_separator='undef'" $ WC "perl_root='" + perl_root + "'" ! VMS specific $trnlnm() $ WC "perladmin='" + perladmin + "'" $ WC "perllibs='" + perllibs + "'" diff --git a/metaconfig.h b/metaconfig.h index c2a4650d12e4..b5aa78f9a3ba 100644 --- a/metaconfig.h +++ b/metaconfig.h @@ -13,6 +13,112 @@ * Symbols should only be here temporarily. Once they are actually used, * they should be removed from here. * - * HAS_NON_INT_BITFIELDS - * + * BIN + * CASTI32 + * CASTNEGFLOAT + * CPPLAST + * CPPMINUS + * CPPRUN + * CPPSTDIN + * DOSUID + * DOUBLE_HAS_NEGATIVE_ZERO + * DOUBLE_HAS_SUBNORMALS + * DOUBLEMANTBITS + * DOUBLE_STYLE_CRAY + * DOUBLE_STYLE_IBM + * DOUBLE_STYLE_IEEE + * DOUBLE_STYLE_VAX + * DRAND48_R_PROTO + * Gid_t_f + * HAS_ASCTIME64 + * HAS_ATOLF + * HAS_BUILTIN_ADD_OVERFLOW + * HAS_BUILTIN_MUL_OVERFLOW + * HAS_BUILTIN_SUB_OVERFLOW + * HAS_CSH + * HAS_CTERMID + * HAS_CTIME64 + * HAS_DIFFTIME64 + * HAS_DRAND48_PROTO + * HAS_DRAND48_R + * HAS_FD_SET + * HAS_FFS + * HAS_FFSL + * HAS_GETMNT + * HAS_GMTIME64 + * HAS_GNULIBC + * HAS_INT64_T + * HAS_IPV6_MREQ_SOURCE + * HAS_ISLESS + * HAS_ISNORMAL + * HAS_LGAMMA_R + * HAS_LOCALECONV_L + * HAS_LOCALTIME64 + * HAS_LSEEK_PROTO + * HAS_MKTIME64 + * HAS_NANOSLEEP + * HAS_OPEN3 + * HAS_OPENAT + * HAS_PRCTL + * HAS_PSEUDOFORK + * HAS_RANDOM_R + * HAS_SIGINFO_SI_VALUE + * HAS_SIGSETJMP + * HAS_SRAND48_R + * HAS_SRANDOM_R + * HAS_STRTOD_L + * HAS_STRTOLD_L + * HAS_STRUCT_FS_DATA + * HAS_STRUCT_STATFS + * HAS_STRUCT_STATFS_F_FLAGS + * HAS_TIME + * HAS_USTAT + * HAS_VFORK + * HAS_WCSCMP + * HAS_WCSXFRM + * I16SIZE + * I32SIZE + * I64SIZE + * I8SIZE + * I_GDBM + * INSTALL_USR_BIN_PERL + * I_STDBOOL + * I_SYS_MOUNT + * I_SYS_STATFS + * I_SYS_STATVFS + * I_SYS_VFS + * I_TIME + * I_USTAT + * I_VFORK + * I_XLOCALE + * LOCALTIME_R_NEEDS_TZSET + * LOC_SED + * LONGDBLMANTBITS + * LONG_DOUBLE_STYLE_IEEE + * LONG_DOUBLE_STYLE_IEEE_DOUBLEDOUBLE + * LONG_DOUBLE_STYLE_IEEE_EXTENDED + * LONG_DOUBLE_STYLE_IEEE_STD + * LONG_DOUBLE_STYLE_VAX + * OSVERS + * PERL_LC_ALL_CATEGORY_POSITIONS_INIT + * PERL_LC_ALL_SEPARATOR + * PERL_LC_ALL_USES_NAME_VALUE_PAIRS + * PERL_PRIeldbl + * PERL_SCNfldbl + * PERL_TARGETARCH + * PERL_VENDORARCH + * RANDOM_R_PROTO + * SRAND48_R_PROTO + * SRANDOM_R_PROTO + * STARTPERL + * ST_INO_SIGN + * ST_INO_SIZE + * U32_ALIGNMENT_REQUIRED + * U32of + * U32xf + * U32Xf + * U8SIZE + * Uid_t_f + * USE_CROSS_COMPILE + * USE_MORE_BITS */ diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample index 80eacfb6b831..2eefb865170a 100644 --- a/plan9/config_sh.sample +++ b/plan9/config_sh.sample @@ -433,6 +433,9 @@ d_open3='define' d_openat='undef' d_pathconf='define' d_pause='define' +d_perl_lc_all_category_positions_init='define' +d_perl_lc_all_separator='define' +d_perl_lc_all_uses_name_value_pairs='define' d_perl_otherlibdirs='undef' d_phostname='undef' d_pipe2='undef' @@ -951,6 +954,8 @@ patchlevel='8' path_sep=':' perl5='' perl='' +perl_lc_all_category_positions_init='define' +perl_lc_all_separator='define' perl_patchlevel='' perl_static_inline='static' perl_thread_local='' diff --git a/win32/config.gc b/win32/config.gc index 3de8b72e7322..57560ca25ae8 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -422,6 +422,9 @@ d_open3='undef' d_openat='undef' d_pathconf='undef' d_pause='define' +d_perl_lc_all_category_positions_init='define' +d_perl_lc_all_separator='define' +d_perl_lc_all_uses_name_value_pairs='define' d_perl_otherlibdirs='undef' d_phostname='undef' d_pipe2='undef' @@ -964,6 +967,8 @@ patchlevel='~PERL_VERSION~' path_sep=';' perl5='' perl='perl' +perl_lc_all_category_positions_init='define' +perl_lc_all_separator='define' perl_patchlevel='~PERL_PATCHLEVEL~' perl_static_inline='static __inline__' perl_thread_local='' diff --git a/win32/config.vc b/win32/config.vc index 934e78f3bd76..a73a6e085369 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -422,6 +422,9 @@ d_open3='undef' d_openat='undef' d_pathconf='undef' d_pause='define' +d_perl_lc_all_category_positions_init='define' +d_perl_lc_all_separator='define' +d_perl_lc_all_uses_name_value_pairs='define' d_perl_otherlibdirs='undef' d_phostname='undef' d_pipe2='undef' @@ -963,6 +966,8 @@ patchlevel='~PERL_VERSION~' path_sep=';' perl5='' perl='perl' +perl_lc_all_category_positions_init='define' +perl_lc_all_separator='define' perl_patchlevel='~PERL_PATCHLEVEL~' perl_static_inline='static __inline' perl_thread_local=''