diff -Nru nano-4.5/aclocal.m4 nano-4.8/aclocal.m4 --- nano-4.5/aclocal.m4 2019-10-04 10:05:56.000000000 +0000 +++ nano-4.8/aclocal.m4 2020-02-07 10:20:01.000000000 +0000 @@ -1523,11 +1523,11 @@ m4_include([m4/glob_h.m4]) m4_include([m4/gnulib-common.m4]) m4_include([m4/gnulib-comp.m4]) -m4_include([m4/host-cpu-c-abi.m4]) m4_include([m4/iconv.m4]) m4_include([m4/include_next.m4]) m4_include([m4/intlmacosx.m4]) m4_include([m4/intmax_t.m4]) +m4_include([m4/inttypes.m4]) m4_include([m4/inttypes_h.m4]) m4_include([m4/isblank.m4]) m4_include([m4/isnand.m4]) @@ -1550,7 +1550,6 @@ m4_include([m4/localeconv.m4]) m4_include([m4/localtime-buffer.m4]) m4_include([m4/lock.m4]) -m4_include([m4/longlong.m4]) m4_include([m4/lstat.m4]) m4_include([m4/malloc.m4]) m4_include([m4/malloca.m4]) @@ -1581,6 +1580,7 @@ m4_include([m4/raise.m4]) m4_include([m4/readdir.m4]) m4_include([m4/regex.m4]) +m4_include([m4/setlocale_null.m4]) m4_include([m4/sigaction.m4]) m4_include([m4/signal_h.m4]) m4_include([m4/signalblocking.m4]) @@ -1618,6 +1618,7 @@ m4_include([m4/utimens.m4]) m4_include([m4/utimes.m4]) m4_include([m4/vasnprintf.m4]) +m4_include([m4/visibility.m4]) m4_include([m4/vsnprintf-posix.m4]) m4_include([m4/vsnprintf.m4]) m4_include([m4/warn-on-use.m4]) @@ -1628,3 +1629,4 @@ m4_include([m4/wcwidth.m4]) m4_include([m4/wint_t.m4]) m4_include([m4/xsize.m4]) +m4_include([m4/zzgnulib.m4]) diff -Nru nano-4.5/ChangeLog nano-4.8/ChangeLog --- nano-4.5/ChangeLog 2019-10-04 09:59:23.000000000 +0000 +++ nano-4.8/ChangeLog 2020-02-07 10:10:15.000000000 +0000 @@ -1,3 +1,361 @@ +Changes between v4.7 and v4.8: +------------------------------ + +Benno Schulenberg (166): + bindings: allow to bind shifted Meta+letter combinations with Sh-M-X + bindings: allow to rebind also ^`, although it is synonymous with ^Space + bindings: do not show the Full-Justify keystroke when in View mode + bindings: force the first letter in a key name to uppercase + build: exclude bracketed pasting from the tiny version + build: exclude option '-g' when configured without browser and help + build: exclude the escape sequences for F13...F16 from the tiny version + build: fix compilation for --enable-{tiny,help,multibuffer} + build: restrict the use of --with-slang to together with --enable-tiny + bump version numbers and add a news item for the 4.8 release + copyright: update the years for significantly changed files + copyright: update the years for the FSF + display: adjust line and column count upon a resize also when using Slang + display: clear the help lines before a briefly shown warning + display: don't let a message write over the second help line + display: ensure the guiding stripe can be shown when not softwrapping + display: exclude a bit of feedback from the tiny version + display: show the cursor during suspension also when built with Slang + display: skip zero-width characters on a Linux console, to avoid a mess + docs: add a FAQ item about a self-compiled nano not reading /etc/nanorc + docs: document the new -f/--rcfile option + docs: document the new Sh-M-X format for binding + docs: for the alternative bindings, rebind ^C only in the main menu + docs: improve the description of which rc-files are read during startup + docs: mention in the FAQ that auto-indentation is suppressed when pasting + docs: mention that -D/--boldtext gets overridden by some nanorc options + docs: put the three new behaviors in a bulletted list, to catch the eye + docs: stop saying that 'set fill' enables hard-wrapping -- it does not + docs: use more generally available arrows in the cheatsheet + feedback: ask a clearer question when a valid lock file is encountered + feedback: report Ctrl+Alt keystrokes as unbindable + feedback: restore a message that can occur in help viewer or file browser + files: alert the user afterward when an overwritten file is being edited + files: revert the previous commit, as the extra warning is annoying + files: warn doubly when the user is about to overwrite an existing file + files: write a lock file also for a new file and when the name changed + gnulib: update to its current upstream state + help: don't waste the last column in the help viewer on narrow terminals + help: increase the minimum help-text width from 24 to 32 columns + help: prevent double spaces from protruding across the right edge + help: when a key description wraps, indent its wrapped part + input: consume and ignore the raw escape sequences for F17 to F24 + input: correct the escape sequence for PageUp/PageDown on Eterm/Urxvt + input: Ctrl+arrow is "Esc O x" on Eterm, as on rxvt -- not "Esc o x" + input: discard partial sequences that Slang produces for F17 to F24 + input: do not auto-indent when something is pasted into nano from outside + input: don't discard the first keystroke after a resize when using Slang + input: filter out Ctrl+Meta keystrokes, as they can never be shortcuts + input: ignore bracketed pastes in help viewer and file browser + input: ignore modifiers on a VT while executing a macro or a string bind + input: prevent unintentional marking of text for shifted Meta keystrokes + input: read in an external paste in one go, to allow undoing with one M-U + input: recognize the raw escape sequences for F13 to F16 on xterm too + locking: accept a minimal amount of data, enough for PID plus username + locking: avoid crashing when there is a problem writing the lock file + locking: check two magic bytes, to verify that it is a lock file + locking: do not write a lock file when in view mode + locking: when a lock file is unreadable, open the file itself anyway + locking: when finding a lock file at startup, quit when user cancels + new feature: allow specifying a custom nanorc file on the command line + pasting: retain the mark's position when it was set at the cursor + prompt: for a Yes-No-All, accept the first character of an external paste + rcfile: do set the meta flag for plain combinations + rcfile: require "bright", "start=", and "end=" to be in lowercase too + rcfile: unbind keys by their key code instead of by their key string + softwrap: suppress the guiding stripe on unaffected chunks + speller: avoid messing up the screen when an unknown locale is used + suspension: put in an extra terminal-initialization call for Slang + syntax: nanohelp, nanorc: colorize the Sh-M-X format as a valid key name + syntax: nanorc: colorize all-lowercase Meta key binds as valid too + tweaks: add a little change that was overlooked in the previous commit + tweaks: add an error message for something that should never occur + tweaks: adjust or reword a few items in the FAQ + tweaks: adjust the indentation after the previous change + tweaks: allocate the lock data only when ready to write them + tweaks: avoid analyzing the key string when the target key code is known + tweaks: avoid determining the key code from the key string twice + tweaks: avoid fiddling with the keybuffer when it's not needed + tweaks: comment fully, so that all handled escape sequences are findable + tweaks: condense a fragment of code + tweaks: condense five more fragments of repetitious code + tweaks: condense three comments to one, and do the masking more directly + tweaks: condense three fragments of repetitious code + tweaks: condense two comments, and reshuffle an #endif + tweaks: correct a comment + tweaks: correct a couple of comments about escape sequences + tweaks: correct the description of what nano writes into the lock file + tweaks: delete some fragments of code that have become irrelevant + tweaks: do not leak a file descriptor when fdopen() fails + tweaks: don't bother including Haiku escape sequences in the tiny version + tweaks: don't enable bracketed pasting when not handling such pastes + tweaks: drop a message that will never be seen + tweaks: drop an unneeded call of keypad() -- we never read from topwin + tweaks: drop a pointless suffix from two function names + tweaks: elide a function that has become too small for its two calls + tweaks: elide a helper function, in preparation for an improvement + tweaks: elide an 'if', by moving the relevant code to a better place + tweaks: elide a small function, as it's in fact needed just once + tweaks: elide a somewhat costly call by remembering some state + tweaks: elide a variable, and rename its sister + tweaks: elide three checks of a shortcut's meta flag + tweaks: ensure that editor name and user name are NUL terminated + tweaks: exclude an unneeded fragment of code from the tiny version + tweaks: exclude two unneeded fragments of code from the tiny version + tweaks: free two strings as soon as they are no longer needed + tweaks: frob a couple of indentations and white lines + tweaks: fuse two nearly identical functions into a single one + tweaks: gather four calls that are always done together into a function + tweaks: harmonize the amount of lock data that we read and write + tweaks: improve a comment by indirectly referring to the ncurses docs + tweaks: in comments, reword "titlebar" and "statusbar" to two words each + tweaks: initialize three booleans straightaway, when they are declared + tweaks: initialize three more booleans straightaway, at declaration + tweaks: judge from the key code itself whether it is a Meta keystroke + tweaks: make a couple of comments more precise + tweaks: move a function to after the one that it calls + tweaks: move a function to be before the ones that call it + tweaks: move a function to before the one that calls it + tweaks: move a function to related ones, and after one that it calls + tweaks: move a function to right before the one that calls it + tweaks: move another function to after the one that it calls + tweaks: move another function to before the one that calls it + tweaks: move another function, to group the deleting ones together + tweaks: move three functions to the file where they are mainly used + tweaks: rearrange a few global variables, to group things better + tweaks: recompute the wrapping point just once + tweaks: reduce the scope of a variable, and reshuffle a declaration + tweaks: reduce the scope of two constants and of four variables + tweaks: reformat a comment, and resuffle a line to match byte order + tweaks: remove a feedback message that is never shown + tweaks: remove a redundant call, as there is nothing to free there + tweaks: remove a superfluous check + tweaks: remove some superfluous conditions for rewriting a lock file + tweaks: remove the now-unneeded code related to bracketed pasting + tweaks: remove the now-unused meta flag from 'keystruct' + tweaks: remove two superfluous assignments, and rename a variable + tweaks: rename a function and its parameter, to be more fitting + tweaks: rename a function, to be a bit more expressive + tweaks: rename a function, to make it not contain the name of another + tweaks: rename a parameter and invert its logic, and correct a comment + tweaks: rename five variables, away from a single letter + tweaks: rename two functions, to make more sense + tweaks: rename two parameters, to be more general and to sound shorter + tweaks: rename two variables, to make more sense + tweaks: renumber some FAQ items in preparation for adding another + tweaks: reorder two symbols + tweaks: reshuffle some assignments for a return value + tweaks: reshuffle some declarations + tweaks: reshuffle some declarations, and expand a few variable names + tweaks: reshuffle some lines, to avoid tallying the menus when not needed + tweaks: reshuffle some lines, to group all ignored keystrokes together + tweaks: reshuffle three lines, to make the grouping tighther + tweaks: reshuffle two lines, to do the linking first, then the content + tweaks: reword two comments, and rewrap another + tweaks: rewrap a comment and a line, and reshuffle a fragment of code + tweaks: rewrap two lines, for consistency with similar lines + tweaks: rewrite the same file name into the lock file as the first time + tweaks: slightly condense a function by conflating case + tweaks: stop recognizing escape sequences for a key without meaning + tweaks: suggest a few more alternative key bindings and unbindings + tweaks: take just one shot at reading the lock file, and correct a type + tweaks: trim some excessive error checking and key-name frobbing + tweaks: tumble three conditions, for consistency in comparisons + tweaks: unabbreviate "argument" in the documentation + tweaks: use a simple subtraction instead of a function call + usage: improve the description of --restricted and --quickblank + +Brand Huntsman (2): + input: beep when invalid key is pressed at yesno prompt or in linter menu + input: recognize the start and stop sequences of a bracketed paste + + +Changes between v4.6 and v4.7: +------------------------------ + +Benno Schulenberg (39): + build: add the uploading of PDF and cheatsheet to the release script + build: avoid three compiler warnings when using gcc-9.2 or newer + build: fix compilation for --enable-tiny --enable-wrapping + build: fix compilation on macOS, where 'st_mtim' is unknown + build: fix compilation when configured with --disable-justify + bump version numbers and add a news item for the 4.7 release + display: don't color the space that separates line numbers from text + docs: add or improve the 'description' meta tag in the two HTML pages + docs: add the 'lang' attribute in the right place to the two HTML pages + docs: mention that all keywords in a nanorc file should be in lowercase + docs: mention that a negative number after "+" counts from the end + gnulib: update to its current upstream state + input: make indent only when mark and cursor are on different lines + justify: distinguish between tabs and spaces when comparing indentation + justify: treat consecutive indentations that look the same as the same + linter: beep when trying to go beyond first or last message + rcfile: accept also function names and menu names only in lowercase + rcfile: accept only keywords in all lowercase, for speed of comparison + rcfile: demand that function 'exit' is bound in the file browser + syntax: nanohelp: colorize also ^/ as a possible keystroke + syntax: sh: recognize shell rc files also in dedicated directories + tweaks: avoid using strlen() where it is not needed + tweaks: drop M-Space and ^Space from the browser's key list + tweaks: improve two comments and the ordering of some operands + tweaks: move three functions to the file where they are used + tweaks: optimize the trimming of trailing whitespace + tweaks: remove a stray space + tweaks: rename a function, to get out of the way for another rename + tweaks: rename a function, to get rid of a useless suffix + tweaks: reshuffle a few lines, for brevity or speed or consistency + tweaks: reshuffle a few lines, for symmetry with the preceding function + tweaks: reshuffle a fragment of code, for efficiency + tweaks: reshuffle and rename a few things, to elide duplication + tweaks: reshuffle an item, to avoid a lone 'else' + tweaks: reshuffle two declarations, for compactness + tweaks: slightly streamline the search for a possible wrapping point + tweaks: trim or adjust some whitespace in HTML, and add two keywords + tweaks: unwrap a few lines, and move some strings to among their peers + wrapping: never break in the quoting part nor in the indentation part + + +Changes between v4.5 and v4.6: +------------------------------ + +Benno Schulenberg (128): + bindings: allow to rebind ^/, even though it is synonymous with ^_ + bindings: don't hard-bind ^H in the help viewer or the file browser + bindings: the 'all' keyword should encompass the browser menu too + bindings: the 'all' keyword should include the browser menu always + build: fix compilation for --enable-tiny --enable-histories + build: fix compilation when configured with --disable-color + build: slightly speed up the compilation of the tiny version + bump version numbers and add a news item for the 4.6 release + chars: add a faster version of the character-parsing function + commands: rename 'fixer' to 'formatter', to be less misleading + cutting: do nothing when trying to chop a word leftward at start of file + display: do refresh the edit window when exiting from the help viewer + docs: add a note saying that rebinding ^M or ^I is not advisable + docs: add the M-F and M-N keystrokes to the cheatsheet + docs: adjust the compilation instructions to two-digit version numbers + docs: correct the description of the 'spell' menu + docs: document the 'fixer' command, a per-syntax content arranger + docs: mention that color rules are applied in the order they are listed + docs: mention that 'hunspell' is now the first default spelling program + docs: mention that the 'nopauses' option is obsolete + docs: remove some excessive detail from the sample nanorc file + docs: remove the note about the formatter having been removed + feedback: say it when spell check or manipulation did not change anything + files: distinguish between read error and write error when prepending + files: don't mention the name of the temp file when reading goes wrong + files: when opening a file for copying, it should NOT be created + formatter: accept the formatted result also upon a nonzero exit status + formatter: don't let output from the program pollute the screen + gnulib: update to its current upstream state + history: don't wait when there is something wrong with the history files + linter: report it as an error when running the linting program fails + rcfile: allow binding also F17...F24 + rcfile: process extensions to file-matching commands straightaway + restored feature: a per-syntax 'fixer' command that processes the buffer + softwrap: when switching to another buffer, re-align the starting column + speller: prefer 'hunspell' over 'spell', because it can handle UTF-8 + speller: when 'spell' is not found, try running 'hunspell -l' instead + statusbar: show only the first error message, with dots to indicate more + syntax: c: recognize some C++ header files by their Emacs modeline + syntax: default: don't colorize stuff between two pairs of brackets + syntax: html: add a formatter command, making use of 'tidy' + syntax: html: colorize only full attributes, and colorize strings later + syntax: javascript: colorize also special values 'null' and 'undefined' + syntax: javascript: colorize the boolean values 'true' and 'false' too + syntax: nanorc: colorize all arguments of 'fixer' and 'linter' as valid + syntax: nanorc: colorize in bright red everything that is invalid + syntax: nanorc: colorize only lowercase keywords as valid + syntax: nanorc: colorize the 'fixer' command as valid + syntax: ruby: colorize also lowercase global/instance variables + syntaxes: put the 'linter' and 'formatter' commands on a separate line + tweaks: add a helper function without the ubiquitous NULL argument + tweaks: add a local variable, for clarity, to not preuse another one + tweaks: add some "fall-through" comments, and reshuffle some breaks + tweaks: add two translator hints + tweaks: adjust the indentation after the previous change + tweaks: adjust the indentation after the previous change + tweaks: adjust the indentation after the previous change, and another + tweaks: adjust two comments, to better fit the actual functions + tweaks: avoid setting and resetting a variable when there is no need + tweaks: avoid three unneeded calls of umask() in the normal case + tweaks: be explicit about which program complained + tweaks: check the return value of copy_file() also after its other uses + tweaks: close the unused reading ends of two more output pipes + tweaks: condense a fragment of code by making use of a helper function + tweaks: condense or improve some comments + tweaks: condense two comments, and rename two parameters + tweaks: condense two comments, and rewrap a line + tweaks: correct a comment, and retype a variable + tweaks: die on an impossible condition -- to be removed later + tweaks: don't do in the parent something that only the child needs + tweaks: don't wrap calls of statusline() that slightly overshoot 80 cols + tweaks: drop the unneeded closing of descriptors when exiting anyway + tweaks: elide a duplicate opening of the existing file when prepending + tweaks: elide a function call for the plain ASCII case + tweaks: elide another two calls of umask(), and rename two variables + tweaks: elide an unneeded and leaky function + tweaks: elide an unneeded check when making a backup + tweaks: elide a variable, and add a condition to elide an assignment + tweaks: elide a variable that is the same as another + tweaks: exclude two fragments of code from the tiny version + tweaks: fuse two regexes into one + tweaks: group the closing of descriptors together, for compactness + tweaks: group the closing of two descriptors, and reword two comments + tweaks: harmonize a message with another + tweaks: improve some comments, and trim some repetitive ones + tweaks: make a function do a check so its calls don't need to + tweaks: mark two strings for translation + tweaks: move a call of umask() closer to where it is relevant + tweaks: move two functions to after the one that they make use of + tweaks: normalize the indentation after the previous change + tweaks: order two functions more sensibly + tweaks: pass an empty string as an answer instead of a NULL pointer + tweaks: pass an empty string for copying instead of a non-existent one + tweaks: pass any special undo/redo messages to the add_undo() function + tweaks: remove a pointless updating of the title bar + tweaks: remove a redundant check for an existing emergency file + tweaks: remove the superfluous closing of a file descriptor + tweaks: remove two pointless re-inclusion guards + tweaks: remove two superfluous conditions when prepending + tweaks: rename a function and add a parameter, so it becomes more general + tweaks: rename a function, and elide a parameter that is always NULL + tweaks: rename a function and elide its first parameter + tweaks: rename a local variable, to not shadow another + tweaks: rename a variable, to be a bit more fitting + tweaks: rename a variable, to be distinct and visible + tweaks: rename three variables, and reshuffle some lines + tweaks: rename three variables, to be consistent with other linestructs + tweaks: rename three variables, to be more descriptive + tweaks: rename three variables, to match others elsewhere + tweaks: rename two parameters, for contrast and to match others + tweaks: rename two parameters plus a variable, to match others + tweaks: rename two variables, and add a third, for more contrast + tweaks: reshuffle a few declarations, and reduce the scope of one + tweaks: reshuffle a fragment of code into two alternatives + tweaks: reshuffle an 'if' to avoid a negation, and improve a comment + tweaks: reshuffle some declarations, and rename a variable + tweaks: reword an undo/redo string that was overlooked during the rename + tweaks: silence a warning when configured with --enable-tiny + tweaks: simplify the opening of files when prepending + tweaks: slightly reword some fragments in the manual's rebinding section + tweaks: use a better variable name for the argument of an option + tweaks: use a literal NULL instead of a variable that is NULL + tweaks: use a simpler positive/negative check for after copy_file() + tweaks: use a string-copy function that checks for out-of-memory + tweaks: use the given string instead of the found match, for clarity + undo: don't try to copy a string that doesn't exist + undo: put the cursor back on the original row for a full-buffer operation + utils: don't accept NULL for the string to be copied + +Jeroen Roovers (1): + syntax: gentoo: highlight the BDEPEND variable as well + + Changes between v4.4 and v4.5: ------------------------------ diff -Nru nano-4.5/config.h.in nano-4.8/config.h.in --- nano-4.5/config.h.in 2019-10-04 10:06:08.000000000 +0000 +++ nano-4.8/config.h.in 2020-02-07 10:20:13.000000000 +0000 @@ -30,9 +30,6 @@ /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA -/* Define to 1 if the C locale may have encoding errors. */ -#undef C_LOCALE_MAYBE_EILSEQ - /* Define as the bit index in the word where to find bit 0 of the exponent of 'double'. */ #undef DBL_EXPBIT0_BIT @@ -204,6 +201,9 @@ /* Define to 1 when the gnulib module getlogin_r should be tested. */ #undef GNULIB_TEST_GETLOGIN_R +/* Define to 1 when the gnulib module getopt-posix should be tested. */ +#undef GNULIB_TEST_GETOPT_POSIX + /* Define to 1 when the gnulib module gettimeofday should be tested. */ #undef GNULIB_TEST_GETTIMEOFDAY @@ -252,6 +252,9 @@ /* Define to 1 when the gnulib module readdir should be tested. */ #undef GNULIB_TEST_READDIR +/* Define to 1 when the gnulib module setlocale_null should be tested. */ +#undef GNULIB_TEST_SETLOCALE_NULL + /* Define to 1 when the gnulib module sigaction should be tested. */ #undef GNULIB_TEST_SIGACTION @@ -631,6 +634,9 @@ /* Define to 1 if you have the `opendir' function. */ #undef HAVE_OPENDIR +/* Define if you have the header and the POSIX threads API. */ +#undef HAVE_PTHREAD_API + /* Define if the defines PTHREAD_MUTEX_RECURSIVE. */ #undef HAVE_PTHREAD_MUTEX_RECURSIVE @@ -783,6 +789,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H +/* Define to 1 if you have the `thrd_create' function. */ +#undef HAVE_THRD_CREATE + /* Define to 1 if you have the header file. */ #undef HAVE_THREADS_H @@ -811,6 +820,10 @@ /* Define to 1 if you have the `vasnprintf' function. */ #undef HAVE_VASNPRINTF +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#undef HAVE_VISIBILITY + /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF @@ -838,6 +851,10 @@ /* Define to 1 if you have the `wcwidth' function. */ #undef HAVE_WCWIDTH +/* Define to 1 if the compiler and linker support weak declarations of + symbols. */ +#undef HAVE_WEAK_SYMBOLS + /* Define to 1 if you have the header file. */ #undef HAVE_WINSOCK2_H @@ -915,6 +932,10 @@ */ #undef MBRTOWC_EMPTY_INPUT_BUG +/* Define if the mbrtowc function may signal encoding errors in the C locale. + */ +#undef MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ + /* Define if the mbrtowc function has the NULL pwc argument bug. */ #undef MBRTOWC_NULL_ARG1_BUG @@ -927,6 +948,10 @@ /* Define if the mbrtowc function returns a wrong return value. */ #undef MBRTOWC_RETVAL_BUG +/* Define if the mbrtowc function stores a wide character when reporting + incomplete input. */ +#undef MBRTOWC_STORES_INCOMPLETE_BUG + /* Use GNU style printf and scanf. */ #ifndef __USE_MINGW_ANSI_STDIO # undef __USE_MINGW_ANSI_STDIO @@ -1048,6 +1073,12 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE +/* Define to 1 if setlocale (LC_ALL, NULL) is multithread-safe. */ +#undef SETLOCALE_NULL_ALL_MTSAFE + +/* Define to 1 if setlocale (category, NULL) is multithread-safe. */ +#undef SETLOCALE_NULL_ONE_MTSAFE + /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'sig_atomic_t'. */ #undef SIG_ATOMIC_T_SUFFIX @@ -1080,6 +1111,13 @@ timespec. */ #undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC +/* Define if the combination of the ISO C and POSIX multithreading APIs can be + used. */ +#undef USE_ISOC_AND_POSIX_THREADS + +/* Define if the ISO C multithreading library can be used. */ +#undef USE_ISOC_THREADS + /* Define if the POSIX multithreading library can be used. */ #undef USE_POSIX_THREADS @@ -1174,6 +1212,12 @@ 'wchar_t'. */ #undef WCHAR_T_SUFFIX +/* Define if the wcrtomb function does not work in the C locale. */ +#undef WCRTOMB_C_LOCALE_BUG + +/* Define if the wcrtomb function has an incorrect return value. */ +#undef WCRTOMB_RETVAL_BUG + /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'wint_t'. */ #undef WINT_T_SUFFIX @@ -1212,7 +1256,14 @@ #ifndef _Noreturn # if (defined __cplusplus \ && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ - || (defined _MSC_VER && 1900 <= _MSC_VER))) + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ # define _Noreturn [[noreturn]] # elif ((!defined __cplusplus || defined __clang__) \ && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ @@ -1432,12 +1483,13 @@ nothing if this is not supported. Do not define if restrict is supported directly. */ #undef restrict -/* Work around a bug in Sun C++: it does not support _Restrict or - __restrict__, even though the corresponding Sun C compiler ends up with - "#define restrict _Restrict" or "#define restrict __restrict__" in the - previous line. Perhaps some future version of Sun C++ will work with - restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ -#if defined __SUNPRO_CC && !defined __RESTRICT +/* Work around a bug in older versions of Sun C++, which did not + #define __restrict__ or support _Restrict or __restrict__ + even though the corresponding Sun C compiler ended up with + "#define restrict _Restrict" or "#define restrict __restrict__" + in the previous line. This workaround can be removed once + we assume Oracle Developer Studio 12.5 (2016) or later. */ +#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ # define _Restrict # define __restrict__ #endif diff -Nru nano-4.5/configure nano-4.8/configure --- nano-4.5/configure 2019-10-04 10:06:04.000000000 +0000 +++ nano-4.8/configure 2020-02-07 10:20:09.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for GNU nano 4.5. +# Generated by GNU Autoconf 2.69 for GNU nano 4.8. # # Report bugs to . # @@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='GNU nano' PACKAGE_TARNAME='nano' -PACKAGE_VERSION='4.5' -PACKAGE_STRING='GNU nano 4.5' +PACKAGE_VERSION='4.8' +PACKAGE_STRING='GNU nano 4.8' PACKAGE_BUGREPORT='nano-devel@gnu.org' PACKAGE_URL='http://www.gnu.org/software/nano/' @@ -721,33 +721,6 @@ NEXT_STDLIB_H NEXT_AS_FIRST_DIRECTIVE_STDIO_H NEXT_STDIO_H -GL_GENERATE_STDINT_H_FALSE -GL_GENERATE_STDINT_H_TRUE -STDINT_H -HAVE_SYS_INTTYPES_H -HAVE_SYS_BITYPES_H -HAVE_C99_STDINT_H -WINT_T_SUFFIX -WCHAR_T_SUFFIX -SIG_ATOMIC_T_SUFFIX -SIZE_T_SUFFIX -PTRDIFF_T_SUFFIX -HAVE_SIGNED_WINT_T -HAVE_SIGNED_WCHAR_T -HAVE_SIGNED_SIG_ATOMIC_T -BITSIZEOF_WINT_T -BITSIZEOF_WCHAR_T -BITSIZEOF_SIG_ATOMIC_T -BITSIZEOF_SIZE_T -BITSIZEOF_PTRDIFF_T -HAVE_STDINT_H -NEXT_AS_FIRST_DIRECTIVE_STDINT_H -NEXT_STDINT_H -HAVE_SYS_TYPES_H -HAVE_INTTYPES_H -HAVE_WCHAR_H -HAVE_UNSIGNED_LONG_LONG_INT -HAVE_LONG_LONG_INT HAVE__BOOL GL_GENERATE_STDBOOL_H_FALSE GL_GENERATE_STDBOOL_H_TRUE @@ -777,7 +750,7 @@ GNULIB_SIGNAL_H_SIGPIPE GNULIB_RAISE GNULIB_PTHREAD_SIGMASK -APPLE_UNIVERSAL_BUILD +LIB_NL_LANGINFO HAVE_MSVC_INVALID_PARAMETER_HANDLER UNDEFINE_STRTOK_R REPLACE_STRSIGNAL @@ -854,8 +827,11 @@ GNULIB_FFSLL GNULIB_FFSL GNULIB_EXPLICIT_BZERO -LOCALE_FR_UTF8 +HAVE_VISIBILITY +CFLAG_VISIBILITY +LIB_MBRTOWC LOCALE_ZH_CN +LOCALE_FR_UTF8 LOCALE_JA NEXT_AS_FIRST_DIRECTIVE_MATH_H NEXT_MATH_H @@ -955,6 +931,7 @@ LIBMULTITHREAD LTLIBTHREAD LIBTHREAD +LIBSTDTHREAD NEXT_AS_FIRST_DIRECTIVE_LOCALE_H NEXT_LOCALE_H HAVE_XLOCALE_H @@ -977,14 +954,10 @@ HAVE_NEWLOCALE GNULIB_LOCALENAME GNULIB_DUPLOCALE +GNULIB_SETLOCALE_NULL GNULIB_SETLOCALE GNULIB_LOCALECONV LOCALCHARSET_TESTS_ENVIRONMENT -GL_GENERATE_LIMITS_H_FALSE -GL_GENERATE_LIMITS_H_TRUE -LIMITS_H -NEXT_AS_FIRST_DIRECTIVE_LIMITS_H -NEXT_LIMITS_H HAVE_LANGINFO_YESEXPR HAVE_LANGINFO_ERA HAVE_LANGINFO_ALTMON @@ -1003,8 +976,9 @@ NEXT_WCTYPE_H HAVE_CRTDEFS_H HAVE_WINT_T -GNULIB_OVERRIDES_WINT_T HAVE_ISWCNTRL +REPLACE_ISWXDIGIT +REPLACE_ISWDIGIT REPLACE_ISWBLANK HAVE_WCTRANS_T HAVE_WCTYPE_T @@ -1013,7 +987,65 @@ GNULIB_WCTRANS GNULIB_ISWCTYPE GNULIB_WCTYPE +GNULIB_ISWXDIGIT +GNULIB_ISWDIGIT GNULIB_ISWBLANK +NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H +NEXT_INTTYPES_H +UINT64_MAX_EQ_ULONG_MAX +UINT32_MAX_LT_UINTMAX_MAX +PRIPTR_PREFIX +PRI_MACROS_BROKEN +INT64_MAX_EQ_LONG_MAX +INT32_MAX_LT_INTMAX_MAX +REPLACE_STRTOUMAX +REPLACE_STRTOIMAX +HAVE_IMAXDIV_T +HAVE_DECL_STRTOUMAX +HAVE_DECL_STRTOIMAX +HAVE_DECL_IMAXDIV +HAVE_DECL_IMAXABS +GNULIB_STRTOUMAX +GNULIB_STRTOIMAX +GNULIB_IMAXDIV +GNULIB_IMAXABS +GL_GENERATE_STDINT_H_FALSE +GL_GENERATE_STDINT_H_TRUE +STDINT_H +HAVE_SYS_INTTYPES_H +HAVE_SYS_BITYPES_H +HAVE_C99_STDINT_H +WINT_T_SUFFIX +WCHAR_T_SUFFIX +SIG_ATOMIC_T_SUFFIX +SIZE_T_SUFFIX +PTRDIFF_T_SUFFIX +HAVE_SIGNED_WINT_T +HAVE_SIGNED_WCHAR_T +HAVE_SIGNED_SIG_ATOMIC_T +BITSIZEOF_WINT_T +BITSIZEOF_WCHAR_T +BITSIZEOF_SIG_ATOMIC_T +BITSIZEOF_SIZE_T +BITSIZEOF_PTRDIFF_T +APPLE_UNIVERSAL_BUILD +HAVE_STDINT_H +NEXT_AS_FIRST_DIRECTIVE_STDINT_H +NEXT_STDINT_H +HAVE_SYS_TYPES_H +HAVE_INTTYPES_H +HAVE_WCHAR_H +GNULIB_OVERRIDES_WINT_T +GL_GENERATE_LIMITS_H_FALSE +GL_GENERATE_LIMITS_H_TRUE +LIMITS_H +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H +NEXT_LIMITS_H +LIB_HARD_LOCALE +LIB_SETLOCALE_NULL +LIB_SCHED_YIELD +LIBPMULTITHREAD +LIBPTHREAD GL_GENERATE_GLOB_H_FALSE GL_GENERATE_GLOB_H_TRUE GLOB_H @@ -1662,6 +1694,7 @@ GNULIB_GETUSERSHELL GNULIB_GETPASS GNULIB_GETPAGESIZE +GNULIB_GETOPT_POSIX GNULIB_GETLOGIN_R GNULIB_GETLOGIN GNULIB_GETHOSTNAME @@ -1687,6 +1720,7 @@ GNULIB_ACCESS LIB_CLOCK_GETTIME LOCALE_FR +REPLACE_WCSTOK REPLACE_WCSFTIME REPLACE_WCSWIDTH REPLACE_WCWIDTH @@ -2477,7 +2511,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures GNU nano 4.5 to adapt to many kinds of systems. +\`configure' configures GNU nano 4.8 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -2547,7 +2581,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of GNU nano 4.5:";; + short | recursive ) echo "Configuration of GNU nano 4.8:";; esac cat <<\_ACEOF @@ -2562,7 +2596,7 @@ --disable-dependency-tracking speeds up one-time build --disable-largefile omit support for large files - --enable-threads={posix|windows} + --enable-threads={isoc|posix|isoc+posix|windows} specify multithreading API --disable-threads build without multithread safety --enable-cross-guesses={conservative|risky} @@ -2696,7 +2730,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -GNU nano configure 4.5 +GNU nano configure 4.8 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -3122,6 +3156,10 @@ # accordingly. ac_fn_c_check_decl () { + ac_save_ac_compile="$ac_compile" + if test -n "$ac_compile_for_check_decl"; then + ac_compile="$ac_compile_for_check_decl" + fi as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack as_decl_name=`echo $2|sed 's/ *(.*//'` as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` @@ -3159,6 +3197,7 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + ac_compile="$ac_save_ac_compile" } # ac_fn_c_check_decl @@ -3405,7 +3444,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by GNU nano $as_me 4.5, which was +It was created by GNU nano $as_me 4.8, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3713,13 +3752,16 @@ as_fn_append ac_func_list " glob" as_fn_append ac_func_list " glob_pattern_p" as_fn_append ac_func_list " getpwnam_r" +as_fn_append ac_header_list " threads.h" +as_fn_append ac_header_list " limits.h" +as_fn_append ac_header_list " wchar.h" +as_fn_append ac_header_list " stdint.h" +as_fn_append ac_header_list " inttypes.h" as_fn_append ac_func_list " iswcntrl" as_fn_append ac_header_list " crtdefs.h" as_fn_append ac_func_list " iswblank" as_fn_append ac_header_list " langinfo.h" -as_fn_append ac_header_list " limits.h" as_fn_append ac_header_list " xlocale.h" -as_fn_append ac_header_list " threads.h" as_fn_append ac_func_list " lstat" as_fn_append ac_header_list " math.h" as_fn_append ac_func_list " mbsinit" @@ -3737,8 +3779,6 @@ as_fn_append ac_func_list " snprintf" as_fn_append ac_func_list " vasnprintf" as_fn_append ac_header_list " features.h" -as_fn_append ac_header_list " wchar.h" -as_fn_append ac_header_list " stdint.h" as_fn_append ac_header_list " strings.h" as_fn_append ac_header_list " sys/wait.h" as_fn_append ac_func_list " utime" @@ -4405,7 +4445,7 @@ # Define the identity of the package. PACKAGE='nano' - VERSION='4.5' + VERSION='4.8' cat >>confdefs.h <<_ACEOF @@ -5880,6 +5920,80 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler is clang" >&5 +$as_echo_n "checking whether the compiler is clang... " >&6; } +if ${gl_cv_compiler_clang+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #ifdef __clang__ + barfbarf + #endif + +int +main () +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_compiler_clang=no +else + gl_cv_compiler_clang=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_clang" >&5 +$as_echo "$gl_cv_compiler_clang" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for compiler option needed when checking for declarations" >&5 +$as_echo_n "checking for compiler option needed when checking for declarations... " >&6; } +if ${gl_cv_compiler_check_decl_option+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test $gl_cv_compiler_clang = yes; then + save_ac_compile="$ac_compile" + ac_compile="$ac_compile -Werror=implicit-function-declaration" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration' +else + gl_cv_compiler_check_decl_option=none +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_compile="$save_ac_compile" + else + gl_cv_compiler_check_decl_option=none + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_check_decl_option" >&5 +$as_echo "$gl_cv_compiler_check_decl_option" >&6; } + if test "x$gl_cv_compiler_check_decl_option" != xnone; then + ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option" + else + ac_compile_for_check_decl="$ac_compile" + fi + + depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 @@ -7053,8 +7167,14 @@ fi - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # For using : + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = isoc \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + # For using or : + + + if test -z "$gl_anythreadlib_early_done"; then case "$host_os" in osf*) # On OSF/1, the compiler needs the flag -D_REENTRANT so that it @@ -7073,6 +7193,9 @@ aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; esac + gl_anythreadlib_early_done=done + fi + fi @@ -7122,9 +7245,9 @@ # Code from module glob: # Code from module glob-h: # Code from module hard-locale: - # Code from module havelib: # Code from module include_next: # Code from module intprops: + # Code from module inttypes-incomplete: # Code from module isblank: # Code from module isnand-nolibm: # Code from module isnanf-nolibm: @@ -7164,6 +7287,7 @@ # Code from module readdir: # Code from module regex: # Code from module scratch_buffer: + # Code from module setlocale-null: # Code from module sigaction: # Code from module signal-h: # Code from module signbit: @@ -7255,6 +7379,7 @@ LIBC_FATAL_STDERR_=1 export LIBC_FATAL_STDERR_ + ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : @@ -7551,6 +7676,7 @@ REPLACE_WCWIDTH=0; REPLACE_WCSWIDTH=0; REPLACE_WCSFTIME=0; + REPLACE_WCSTOK=0; { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether uses 'inline' correctly" >&5 @@ -7847,6 +7973,7 @@ GNULIB_GETHOSTNAME=0; GNULIB_GETLOGIN=0; GNULIB_GETLOGIN_R=0; + GNULIB_GETOPT_POSIX=0; GNULIB_GETPAGESIZE=0; GNULIB_GETPASS=0; GNULIB_GETUSERSHELL=0; @@ -10695,697 +10822,655 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'double'" >&5 -$as_echo_n "checking where to find the exponent in a 'double'... " >&6; } -if ${gl_cv_cc_double_expbit0+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined arm || defined __arm || defined __arm__ - mixed_endianness -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "mixed_endianness" >/dev/null 2>&1; then : - gl_cv_cc_double_expbit0="unknown" -else - : -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes; then : + gl_have_pthread_h=yes else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; + gl_have_pthread_h=no +fi -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include +#include + pthread_mutex_t m; + pthread_mutexattr_t ma; int main () { -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - +pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if ac_fn_c_try_link "$LINENO"; then : + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_kill+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); int main () { -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - +return pthread_kill (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_kill=yes else - ac_cv_c_bigendian=no + ac_cv_lib_pthread_pthread_kill=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) + +$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + esac + +fi + + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_kill+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); int main () { -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - +return pthread_kill (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_kill=yes +else + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread +fi + + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } +if ${ac_cv_lib_c_r_pthread_kill+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); int main () { -#ifndef _BIG_ENDIAN - not big endian - #endif - +return pthread_kill (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_r_pthread_kill=yes else - ac_cv_c_bigendian=no + ac_cv_lib_c_r_pthread_kill=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r +fi + + fi + fi fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +$as_echo_n "checking whether POSIX threads API is available... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +$as_echo "$gl_pthread_api" >&6; } + + + if test $gl_pthread_api = yes; then + +$as_echo "#define HAVE_PTHREAD_API 1" >>confdefs.h + + fi + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIB_SCHED_YIELD= + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +$as_echo_n "checking for sched_yield in -lrt... " >&6; } +if ${ac_cv_lib_rt_sched_yield+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); int main () { -return use_ascii (foo) == use_ebcdic (foo); +return sched_yield (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_sched_yield=yes +else + ac_cv_lib_rt_sched_yield=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = xyes; then : + LIB_SCHED_YIELD=-lrt +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +$as_echo_n "checking for sched_yield in -lposix4... " >&6; } +if ${ac_cv_lib_posix4_sched_yield+:} false; then : + $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); int main () { - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - +return sched_yield (); ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_posix4_sched_yield=yes else - ac_cv_c_bigendian=yes + ac_cv_lib_posix4_sched_yield=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +$as_echo "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = xyes; then : + LIB_SCHED_YIELD=-lposix4 fi - fi fi -: - case $ac_cv_c_bigendian in #( - yes) - gl_cv_cc_double_expbit0="word 0 bit 20";; #( - no) - gl_cv_cc_double_expbit0="word 1 bit 20" ;; #( - universal) -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - ;; #( - *) - gl_cv_cc_double_expbit0="unknown" ;; - esac +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + + gl_pthreadlib_body_done=done + fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 +$as_echo_n "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } +if ${gl_cv_func_setlocale_null_all_mtsafe+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$host_os" in + # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. + *-musl* | darwin* | freebsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) + gl_cv_func_setlocale_null_all_mtsafe=no ;; + # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. + *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) + gl_cv_func_setlocale_null_all_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; + esac + fi -rm -f conftest* +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 +$as_echo "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } + case "$host_os" in + mingw*) ;; + *) + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_all_mtsafe="trivially yes" + fi + ;; + esac + case "$gl_cv_func_setlocale_null_all_mtsafe" in + *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; + *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; + esac + +cat >>confdefs.h <<_ACEOF +#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE +_ACEOF + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 +$as_echo_n "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } +if ${gl_cv_func_setlocale_null_one_mtsafe+:} false; then : + $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include -#include -#define NWORDS \ - ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { double value; unsigned int word[NWORDS]; } memory_double; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (double x) -{ - memory_double m; - size_t i; - /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ - memset (&m, 0, sizeof (memory_double)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} -int main () -{ - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25); - add_to_ored_words (0.5); - add_to_ored_words (1.0); - add_to_ored_words (2.0); - add_to_ored_words (4.0); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); -} - -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_double_expbit0=`cat conftest.out` -else - gl_cv_cc_double_expbit0="unknown" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - rm -f conftest.out + case "$host_os" in + # Guess no on OpenBSD, AIX. + openbsd* | aix*) + gl_cv_func_setlocale_null_one_mtsafe=no ;; + # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. + *-gnu* | gnu* | *-musl* | darwin* | freebsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) + gl_cv_func_setlocale_null_one_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_double_expbit0" >&5 -$as_echo "$gl_cv_cc_double_expbit0" >&6; } - case "$gl_cv_cc_double_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 +$as_echo "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } + case "$host_os" in + mingw*) ;; + *) + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_one_mtsafe="trivially yes" + fi + ;; + esac + case "$gl_cv_func_setlocale_null_one_mtsafe" in + *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; + *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; + esac cat >>confdefs.h <<_ACEOF -#define DBL_EXPBIT0_WORD $word +#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE _ACEOF -cat >>confdefs.h <<_ACEOF -#define DBL_EXPBIT0_BIT $bit -_ACEOF - - ;; - esac + if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then + case "$host_os" in + mingw*) LIB_SETLOCALE_NULL= ;; + *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'float'" >&5 -$as_echo_n "checking where to find the exponent in a 'float'... " >&6; } -if ${gl_cv_cc_float_expbit0+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } +if ${gl_cv_have_weak+:} false; then : $as_echo_n "(cached) " >&6 else + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void xyzzy (); +#pragma weak xyzzy +int +main () +{ +xyzzy(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_have_weak=maybe +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : + gl_cv_have_weak="guessing yes" +else + gl_cv_have_weak="guessing no" +fi +rm -f conftest* + - if test "$cross_compiling" = yes; then : - gl_cv_cc_float_expbit0="word 0 bit 23" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include #include -#include -#define NWORDS \ - ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) -typedef union { float value; unsigned int word[NWORDS]; } memory_float; -static unsigned int ored_words[NWORDS]; -static unsigned int anded_words[NWORDS]; -static void add_to_ored_words (float x) -{ - memory_float m; - size_t i; - /* Clear it first, in case - sizeof (float) < sizeof (memory_float). */ - memset (&m, 0, sizeof (memory_float)); - m.value = x; - for (i = 0; i < NWORDS; i++) - { - ored_words[i] |= m.word[i]; - anded_words[i] &= m.word[i]; - } -} +#pragma weak fputs int main () { - size_t j; - FILE *fp = fopen ("conftest.out", "w"); - if (fp == NULL) - return 1; - for (j = 0; j < NWORDS; j++) - anded_words[j] = ~ (unsigned int) 0; - add_to_ored_words (0.25f); - add_to_ored_words (0.5f); - add_to_ored_words (1.0f); - add_to_ored_words (2.0f); - add_to_ored_words (4.0f); - /* Remove bits that are common (e.g. if representation of the first mantissa - bit is explicit). */ - for (j = 0; j < NWORDS; j++) - ored_words[j] &= ~anded_words[j]; - /* Now find the nonzero word. */ - for (j = 0; j < NWORDS; j++) - if (ored_words[j] != 0) - break; - if (j < NWORDS) - { - size_t i; - for (i = j + 1; i < NWORDS; i++) - if (ored_words[i] != 0) - { - fprintf (fp, "unknown"); - return (fclose (fp) != 0); - } - for (i = 0; ; i++) - if ((ored_words[j] >> i) & 1) - { - fprintf (fp, "word %d bit %d", (int) j, (int) i); - return (fclose (fp) != 0); - } - } - fprintf (fp, "unknown"); - return (fclose (fp) != 0); + return (fputs == NULL); } - _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_cc_float_expbit0=`cat conftest.out` + gl_cv_have_weak=yes else - gl_cv_cc_float_expbit0="unknown" + gl_cv_have_weak=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest.out + fi + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_expbit0" >&5 -$as_echo "$gl_cv_cc_float_expbit0" >&6; } - case "$gl_cv_cc_float_expbit0" in - word*bit*) - word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` - bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` - -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_WORD $word -_ACEOF - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +$as_echo "$gl_cv_have_weak" >&6; } + case "$gl_cv_have_weak" in + *yes) -cat >>confdefs.h <<_ACEOF -#define FLT_EXPBIT0_BIT $bit -_ACEOF +$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h ;; esac + case "$gl_cv_have_weak" in + *yes) LIB_SETLOCALE_NULL= ;; + *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; + esac + ;; + esac + else + LIB_SETLOCALE_NULL= + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_limits_h='<'limits.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_limits_h+:} false; then : + $as_echo_n "(cached) " >&6 else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif + if test $ac_cv_header_limits_h = yes; then - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'limits.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_limits_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_limits_h + gl_cv_next_limits_h='"'$gl_header'"' + else + gl_cv_next_limits_h='<'limits.h'>' + fi - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_limits_h" >&5 +$as_echo "$gl_cv_next_limits_h" >&6; } + fi + NEXT_LIMITS_H=$gl_cv_next_limits_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'limits.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_limits_h + fi + NEXT_AS_FIRST_DIRECTIVE_LIMITS_H=$gl_next_as_first_directive + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc." >&5 +$as_echo_n "checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.... " >&6; } +if ${gl_cv_header_limits_width+:} false; then : + $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + long long llm = LLONG_MAX; + int wb = WORD_BIT; + int ullw = ULLONG_WIDTH; + int main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_limits_width=yes else - ac_cv_c_bigendian=yes + gl_cv_header_limits_width=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_limits_width" >&5 +$as_echo "$gl_cv_header_limits_width" >&6; } + if test "$gl_cv_header_limits_width" = yes; then + LIMITS_H= + else + LIMITS_H=limits.h + fi - fi + if test -n "$LIMITS_H"; then + GL_GENERATE_LIMITS_H_TRUE= + GL_GENERATE_LIMITS_H_FALSE='#' +else + GL_GENERATE_LIMITS_H_TRUE='#' + GL_GENERATE_LIMITS_H_FALSE= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h -;; #( - no) - ;; #( - universal) - -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - - ;; #( - *) - as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac - - - - GNULIB_ISWBLANK=0; - GNULIB_WCTYPE=0; - GNULIB_ISWCTYPE=0; - GNULIB_WCTRANS=0; - GNULIB_TOWCTRANS=0; - HAVE_ISWBLANK=1; - HAVE_WCTYPE_T=1; - HAVE_WCTRANS_T=1; - REPLACE_ISWBLANK=0; - @@ -11479,33 +11564,80 @@ - if test $ac_cv_header_crtdefs_h = yes; then - HAVE_CRTDEFS_H=1 - else - HAVE_CRTDEFS_H=0 - fi - - - + gl_cv_c_multiarch=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + arch= + prev= + for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do + if test -n "$prev"; then + case $word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$arch" || test "$arch" = "$word"; then + arch="$word" + else + gl_cv_c_multiarch=yes + fi + ;; + esac + prev= + else + if test "x$word" = "x-arch"; then + prev=arch + fi + fi + done - if test $ac_cv_func_iswcntrl = yes; then - HAVE_ISWCNTRL=1 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $gl_cv_c_multiarch = yes; then + APPLE_UNIVERSAL_BUILD=1 else - HAVE_ISWCNTRL=0 + APPLE_UNIVERSAL_BUILD=0 fi - if test $gt_cv_c_wint_t = yes; then - HAVE_WINT_T=1 + + + + + +$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h + + +$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h + + + + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 else - HAVE_WINT_T=0 + HAVE_WCHAR_H=0 fi + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + + + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi @@ -11518,22 +11650,22 @@ if test $gl_cv_have_include_next = yes; then - gl_cv_next_wctype_h='<'wctype.h'>' + gl_cv_next_stdint_h='<'stdint.h'>' else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_wctype_h+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_stdint_h+:} false; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_wctype_h = yes; then + if test $ac_cv_header_stdint_h = yes; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; @@ -11549,7 +11681,7 @@ ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'wctype.h' \ + gl_header_literal_regex=`echo 'stdint.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ @@ -11558,49 +11690,214 @@ q }' - gl_cv_absolute_wctype_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + gl_cv_absolute_stdint_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_wctype_h - gl_cv_next_wctype_h='"'$gl_header'"' + gl_header=$gl_cv_absolute_stdint_h + gl_cv_next_stdint_h='"'$gl_header'"' else - gl_cv_next_wctype_h='<'wctype.h'>' + gl_cv_next_stdint_h='<'stdint.h'>' fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wctype_h" >&5 -$as_echo "$gl_cv_next_wctype_h" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdint_h" >&5 +$as_echo "$gl_cv_next_stdint_h" >&6; } fi - NEXT_WCTYPE_H=$gl_cv_next_wctype_h + NEXT_STDINT_H=$gl_cv_next_stdint_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'wctype.h'>' + gl_next_as_first_directive='<'stdint.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_wctype_h + gl_next_as_first_directive=$gl_cv_next_stdint_h fi - NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H=$gl_next_as_first_directive + NEXT_AS_FIRST_DIRECTIVE_STDINT_H=$gl_next_as_first_directive - if test $ac_cv_header_wctype_h = yes; then - if test $ac_cv_func_iswcntrl = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iswcntrl works" >&5 -$as_echo_n "checking whether iswcntrl works... " >&6; } -if ${gl_cv_func_iswcntrl_works+:} false; then : + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + + + if test $ac_cv_header_stdint_h = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h conforms to C99" >&5 +$as_echo_n "checking whether stdint.h conforms to C99... " >&6; } +if ${gl_cv_header_working_stdint_h+:} false; then : $as_echo_n "(cached) " >&6 else - - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_cv_header_working_stdint_h=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #if __GNU_LIBRARY__ == 1 - Linux libc5 i18n is broken. - #endif + + +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 +#include +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in " +#endif + + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +/* Check that SIZE_MAX has the correct type, if possible. */ +#if 201112 <= __STDC_VERSION__ +int k = _Generic (SIZE_MAX, size_t: 0); +#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) +extern size_t k; +extern __typeof__ (SIZE_MAX) k; +#endif + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0 / ia64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + int main () { @@ -11610,130 +11907,142 @@ } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_iswcntrl_works="guessing yes" -else - gl_cv_func_iswcntrl_works="guessing no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; + # In general, assume it works. + *) gl_cv_header_working_stdint_h="guessing yes" ;; + esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - /* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #include - int main () { return iswprint ('x') == 0; } -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_iswcntrl_works=yes -else - gl_cv_func_iswcntrl_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 +#include -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswcntrl_works" >&5 -$as_echo "$gl_cv_func_iswcntrl_works" >&6; } - fi - HAVE_WCTYPE_H=1 - else - HAVE_WCTYPE_H=0 - fi + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif - case "$gl_cv_func_iswcntrl_works" in - *yes) REPLACE_ISWCNTRL=0 ;; - *) REPLACE_ISWCNTRL=1 ;; - esac +#include +#include +#define MVAL(macro) MVAL1(macro) +#define MVAL1(expression) #expression +static const char *macro_values[] = + { +#ifdef INT8_MAX + MVAL (INT8_MAX), +#endif +#ifdef INT16_MAX + MVAL (INT16_MAX), +#endif +#ifdef INT32_MAX + MVAL (INT32_MAX), +#endif +#ifdef INT64_MAX + MVAL (INT64_MAX), +#endif +#ifdef UINT8_MAX + MVAL (UINT8_MAX), +#endif +#ifdef UINT16_MAX + MVAL (UINT16_MAX), +#endif +#ifdef UINT32_MAX + MVAL (UINT32_MAX), +#endif +#ifdef UINT64_MAX + MVAL (UINT64_MAX), +#endif + NULL + }; +int +main () +{ - if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then - : - fi + const char **mv; + for (mv = macro_values; *mv != NULL; mv++) + { + const char *value = *mv; + /* Test whether it looks like a cast expression. */ + if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 + || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 + || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 + || strncmp (value, "((int)"/*)*/, 6) == 0 + || strncmp (value, "((signed short)"/*)*/, 15) == 0 + || strncmp (value, "((signed char)"/*)*/, 14) == 0) + return mv - macro_values + 1; + } + return 0; - if test $REPLACE_ISWCNTRL = 1; then - REPLACE_TOWLOWER=1 - else - for ac_func in towlower -do : - ac_fn_c_check_func "$LINENO" "towlower" "ac_cv_func_towlower" -if test "x$ac_cv_func_towlower" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_TOWLOWER 1 + ; + return 0; +} _ACEOF - +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_header_working_stdint_h=yes fi -done - - if test $ac_cv_func_towlower = yes; then - REPLACE_TOWLOWER=0 - else - ac_fn_c_check_decl "$LINENO" "towlower" "ac_cv_have_decl_towlower" "/* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #if HAVE_WCTYPE_H - # include - #endif - -" -if test "x$ac_cv_have_decl_towlower" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_TOWLOWER $ac_have_decl -_ACEOF - - if test $ac_cv_have_decl_towlower = yes; then - REPLACE_TOWLOWER=1 - else - REPLACE_TOWLOWER=0 - fi - fi - fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then - : +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdint_h" >&5 +$as_echo "$gl_cv_header_working_stdint_h" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctype_t" >&5 -$as_echo_n "checking for wctype_t... " >&6; } -if ${gl_cv_type_wctype_t+:} false; then : + HAVE_C99_STDINT_H=0 + HAVE_SYS_BITYPES_H=0 + HAVE_SYS_INTTYPES_H=0 + STDINT_H=stdint.h + case "$gl_cv_header_working_stdint_h" in + *yes) + HAVE_C99_STDINT_H=1 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h predates C++11" >&5 +$as_echo_n "checking whether stdint.h predates C++11... " >&6; } +if ${gl_cv_header_stdint_predates_cxx11_h+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_cv_header_stdint_predates_cxx11_h=yes + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #if HAVE_WCTYPE_H - # include - #endif - wctype_t a; + + +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include + + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + +intmax_t im = INTMAX_MAX; +int32_t i32 = INT32_C (0x7fffffff); int main () @@ -11744,36 +12053,48 @@ } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_wctype_t=yes -else - gl_cv_type_wctype_t=no + gl_cv_header_stdint_predates_cxx11_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctype_t" >&5 -$as_echo "$gl_cv_type_wctype_t" >&6; } - if test $gl_cv_type_wctype_t = no; then - HAVE_WCTYPE_T=0 - fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_predates_cxx11_h" >&5 +$as_echo "$gl_cv_header_stdint_predates_cxx11_h" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctrans_t" >&5 -$as_echo_n "checking for wctrans_t... " >&6; } -if ${gl_cv_type_wctrans_t+:} false; then : + if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then + +$as_echo "#define __STDC_CONSTANT_MACROS 1" >>confdefs.h + + +$as_echo "#define __STDC_LIMIT_MACROS 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h has UINTMAX_WIDTH etc." >&5 +$as_echo_n "checking whether stdint.h has UINTMAX_WIDTH etc.... " >&6; } +if ${gl_cv_header_stdint_width+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_cv_header_stdint_width=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Tru64 with Desktop Toolkit C has a bug: must be - included before . - BSD/OS 4.0.1 has a bug: , and - must be included before . */ - #include - #include - #include - #include - #include - wctrans_t a; + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 + #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + int iw = UINTMAX_WIDTH; int main () @@ -11784,129 +12105,150 @@ } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_wctrans_t=yes -else - gl_cv_type_wctrans_t=no + gl_cv_header_stdint_width=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctrans_t" >&5 -$as_echo "$gl_cv_type_wctrans_t" >&6; } - if test $gl_cv_type_wctrans_t = no; then - HAVE_WCTRANS_T=0 - fi - - - - - - - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_width" >&5 +$as_echo "$gl_cv_header_stdint_width" >&6; } + if test "$gl_cv_header_stdint_width" = yes; then + STDINT_H= + fi + ;; + *) + for ac_header in sys/inttypes.h sys/bitypes.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF - GNULIB_NL_LANGINFO=0; - HAVE_NL_LANGINFO=1; - REPLACE_NL_LANGINFO=0; +fi +done + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + fi + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + fi + if test $APPLE_UNIVERSAL_BUILD = 0; then + for gltype in ptrdiff_t size_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 +$as_echo_n "checking for bit size of $gltype... " >&6; } +if eval \${gl_cv_bitsizeof_${gltype}+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif +#include "; then : +else + result=unknown +fi + eval gl_cv_bitsizeof_${gltype}=\$result +fi +eval ac_res=\$gl_cv_bitsizeof_${gltype} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + cat >>confdefs.h <<_ACEOF +#define BITSIZEOF_${GLTYPE} $result +_ACEOF + eval BITSIZEOF_${GLTYPE}=\$result + done + fi - if test $gl_cv_have_include_next = yes; then - gl_cv_next_limits_h='<'limits.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_limits_h+:} false; then : + for gltype in sig_atomic_t wchar_t wint_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 +$as_echo_n "checking for bit size of $gltype... " >&6; } +if eval \${gl_cv_bitsizeof_${gltype}+:} false; then : $as_echo_n "(cached) " >&6 else + if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif - if test $ac_cv_header_limits_h = yes; then - - - - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'limits.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - - gl_cv_absolute_limits_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` +#include "; then : - gl_header=$gl_cv_absolute_limits_h - gl_cv_next_limits_h='"'$gl_header'"' - else - gl_cv_next_limits_h='<'limits.h'>' - fi +else + result=unknown +fi + eval gl_cv_bitsizeof_${gltype}=\$result fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_limits_h" >&5 -$as_echo "$gl_cv_next_limits_h" >&6; } - fi - NEXT_LIMITS_H=$gl_cv_next_limits_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'limits.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_limits_h - fi - NEXT_AS_FIRST_DIRECTIVE_LIMITS_H=$gl_next_as_first_directive +eval ac_res=\$gl_cv_bitsizeof_${gltype} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + cat >>confdefs.h <<_ACEOF +#define BITSIZEOF_${GLTYPE} $result +_ACEOF + eval BITSIZEOF_${GLTYPE}=\$result + done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc." >&5 -$as_echo_n "checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.... " >&6; } -if ${gl_cv_header_limits_width+:} false; then : + for gltype in sig_atomic_t wchar_t wint_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gltype is signed" >&5 +$as_echo_n "checking whether $gltype is signed... " >&6; } +if eval \${gl_cv_type_${gltype}_signed+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ - #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 - #endif - #include - long long llm = LLONG_MAX; - int wb = WORD_BIT; - int ullw = ULLONG_WIDTH; + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; int main () { @@ -11916,59 +12258,75 @@ } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_limits_width=yes + result=yes else - gl_cv_header_limits_width=no + result=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_limits_width" >&5 -$as_echo "$gl_cv_header_limits_width" >&6; } - if test "$gl_cv_header_limits_width" = yes; then - LIMITS_H= - else - LIMITS_H=limits.h - fi + eval gl_cv_type_${gltype}_signed=\$result - if test -n "$LIMITS_H"; then - GL_GENERATE_LIMITS_H_TRUE= - GL_GENERATE_LIMITS_H_FALSE='#' -else - GL_GENERATE_LIMITS_H_TRUE='#' - GL_GENERATE_LIMITS_H_FALSE= fi +eval ac_res=\$gl_cv_type_${gltype}_signed + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_SIGNED_${GLTYPE} 1 +_ACEOF + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done - GNULIB_LOCALECONV=0; - GNULIB_SETLOCALE=0; - GNULIB_DUPLOCALE=0; - GNULIB_LOCALENAME=0; - HAVE_NEWLOCALE=1; - HAVE_DUPLOCALE=1; - HAVE_FREELOCALE=1; - REPLACE_LOCALECONV=0; - REPLACE_SETLOCALE=0; - REPLACE_NEWLOCALE=0; - REPLACE_DUPLOCALE=0; - REPLACE_FREELOCALE=0; - REPLACE_STRUCT_LCONV=0; - - - REPLACE_NULL=0; - HAVE_MAX_ALIGN_T=1; - HAVE_WCHAR_T=1; + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + if test $APPLE_UNIVERSAL_BUILD = 0; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wchar_t" >&5 -$as_echo_n "checking for wchar_t... " >&6; } -if ${gt_cv_c_wchar_t+:} false; then : + for gltype in ptrdiff_t size_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 +$as_echo_n "checking for $gltype integer literal suffix... " >&6; } +if eval \${gl_cv_type_${gltype}_suffix+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - wchar_t foo = (wchar_t)'\0'; + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; int main () { @@ -11978,39 +12336,69 @@ } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_c_wchar_t=yes -else - gt_cv_c_wchar_t=no + eval gl_cv_type_${gltype}_suffix=\$glsuf fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wchar_t" >&5 -$as_echo "$gt_cv_c_wchar_t" >&6; } - if test $gt_cv_c_wchar_t = yes; then - -$as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h - - fi +eval ac_res=\$gl_cv_type_${gltype}_suffix + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + cat >>confdefs.h <<_ACEOF +#define ${GLTYPE}_SUFFIX $result +_ACEOF + done + fi - STDDEF_H= - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for good max_align_t" >&5 -$as_echo_n "checking for good max_align_t... " >&6; } -if ${gl_cv_type_max_align_t+:} false; then : + for gltype in sig_atomic_t wchar_t wint_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 +$as_echo_n "checking for $gltype integer literal suffix... " >&6; } +if eval \${gl_cv_type_${gltype}_suffix+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - unsigned int s = sizeof (max_align_t); - #if defined __GNUC__ || defined __IBM__ALIGNOF__ - int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; - int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; - #endif + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; int main () { @@ -12020,67 +12408,88 @@ } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_type_max_align_t=yes -else - gl_cv_type_max_align_t=no + eval gl_cv_type_${gltype}_suffix=\$glsuf fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_max_align_t" >&5 -$as_echo "$gl_cv_type_max_align_t" >&6; } - if test $gl_cv_type_max_align_t = no; then - HAVE_MAX_ALIGN_T=0 - STDDEF_H=stddef.h - fi +eval ac_res=\$gl_cv_type_${gltype}_suffix + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + cat >>confdefs.h <<_ACEOF +#define ${GLTYPE}_SUFFIX $result +_ACEOF - if test $gt_cv_c_wchar_t = no; then - HAVE_WCHAR_T=0 - STDDEF_H=stddef.h + done + + + + if test $GNULIB_OVERRIDES_WINT_T = 1; then + BITSIZEOF_WINT_T=32 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NULL can be used in arbitrary expressions" >&5 -$as_echo_n "checking whether NULL can be used in arbitrary expressions... " >&6; } -if ${gl_cv_decl_null_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - int test[2 * (sizeof NULL == sizeof (void *)) -1]; + ;; + esac -int -main () -{ - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_decl_null_works=yes + + LIMITS_H='limits.h' + if test -n "$LIMITS_H"; then + GL_GENERATE_LIMITS_H_TRUE= + GL_GENERATE_LIMITS_H_FALSE='#' else - gl_cv_decl_null_works=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + GL_GENERATE_LIMITS_H_TRUE='#' + GL_GENERATE_LIMITS_H_FALSE= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_null_works" >&5 -$as_echo "$gl_cv_decl_null_works" >&6; } - if test $gl_cv_decl_null_works = no; then - REPLACE_NULL=1 - STDDEF_H=stddef.h - fi - if test -n "$STDDEF_H"; then - GL_GENERATE_STDDEF_H_TRUE= - GL_GENERATE_STDDEF_H_FALSE='#' + + + + + + if test -n "$STDINT_H"; then + GL_GENERATE_STDINT_H_TRUE= + GL_GENERATE_STDINT_H_FALSE='#' else - GL_GENERATE_STDDEF_H_TRUE='#' - GL_GENERATE_STDDEF_H_FALSE= + GL_GENERATE_STDINT_H_TRUE='#' + GL_GENERATE_STDINT_H_FALSE= fi - if test -n "$STDDEF_H"; then + + + + + GNULIB_IMAXABS=0; + GNULIB_IMAXDIV=0; + GNULIB_STRTOIMAX=0; + GNULIB_STRTOUMAX=0; + HAVE_DECL_IMAXABS=1; + HAVE_DECL_IMAXDIV=1; + HAVE_DECL_STRTOIMAX=1; + HAVE_DECL_STRTOUMAX=1; + HAVE_IMAXDIV_T=1; + REPLACE_STRTOIMAX=0; + REPLACE_STRTOUMAX=0; + INT32_MAX_LT_INTMAX_MAX=1; + INT64_MAX_EQ_LONG_MAX='defined _LP64'; + PRI_MACROS_BROKEN=0; + PRIPTR_PREFIX=__PRIPTR_PREFIX; + UINT32_MAX_LT_UINTMAX_MAX=1; + UINT64_MAX_EQ_ULONG_MAX='defined _LP64'; + + + + + + + @@ -12090,19 +12499,22 @@ if test $gl_cv_have_include_next = yes; then - gl_cv_next_stddef_h='<'stddef.h'>' + gl_cv_next_inttypes_h='<'inttypes.h'>' else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_stddef_h+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_inttypes_h+:} false; then : $as_echo_n "(cached) " >&6 else + if test $ac_cv_header_inttypes_h = yes; then + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include +#include _ACEOF case "$host_os" in aix*) gl_absname_cpp="$ac_cpp -C" ;; @@ -12118,7 +12530,7 @@ ;; esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'stddef.h' \ + gl_header_literal_regex=`echo 'inttypes.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ @@ -12127,32 +12539,34 @@ q }' - gl_cv_absolute_stddef_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + gl_cv_absolute_inttypes_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | sed -n "$gl_absolute_header_sed"` - gl_header=$gl_cv_absolute_stddef_h - gl_cv_next_stddef_h='"'$gl_header'"' + gl_header=$gl_cv_absolute_inttypes_h + gl_cv_next_inttypes_h='"'$gl_header'"' + else + gl_cv_next_inttypes_h='<'inttypes.h'>' + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stddef_h" >&5 -$as_echo "$gl_cv_next_stddef_h" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_inttypes_h" >&5 +$as_echo "$gl_cv_next_inttypes_h" >&6; } fi - NEXT_STDDEF_H=$gl_cv_next_stddef_h + NEXT_INTTYPES_H=$gl_cv_next_inttypes_h if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'stddef.h'>' + gl_next_as_first_directive='<'inttypes.h'>' else # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_stddef_h + gl_next_as_first_directive=$gl_cv_next_inttypes_h fi - NEXT_AS_FIRST_DIRECTIVE_STDDEF_H=$gl_next_as_first_directive + NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H=$gl_next_as_first_directive - fi @@ -12160,720 +12574,712 @@ - gl_threads_api=none - LIBTHREAD= - LTLIBTHREAD= - LIBMULTITHREAD= - LTLIBMULTITHREAD= - if test "$gl_use_threads" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 -$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } -if ${gl_cv_have_weak+:} false; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'double'" >&5 +$as_echo_n "checking where to find the exponent in a 'double'... " >&6; } +if ${gl_cv_cc_double_expbit0+:} false; then : $as_echo_n "(cached) " >&6 else - gl_cv_have_weak=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -extern void xyzzy (); -#pragma weak xyzzy -int -main () -{ -xyzzy(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_cv_have_weak=maybe -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test $gl_cv_have_weak = maybe; then - if test "$cross_compiling" = yes; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + if test "$cross_compiling" = yes; then : + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef __ELF__ - Extensible Linking Format - #endif + +#if defined arm || defined __arm || defined __arm__ + mixed_endianness +#endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : - gl_cv_have_weak="guessing yes" + $EGREP "mixed_endianness" >/dev/null 2>&1; then : + gl_cv_cc_double_expbit0="unknown" else - gl_cv_have_weak="guessing no" -fi -rm -f conftest* - + : +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; -#include -#pragma weak fputs -int main () -{ - return (fputs == NULL); -} _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_have_weak=yes -else - gl_cv_have_weak=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi - case " $LDFLAGS " in - *" -static "*) gl_cv_have_weak=no ;; - esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 -$as_echo "$gl_cv_have_weak" >&6; } - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then +if ac_fn_c_try_compile "$LINENO"; then : - : - fi - if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then - # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that - # it groks . It's added above, in gl_THREADLIB_EARLY_BODY. - ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" -if test "x$ac_cv_header_pthread_h" = xyes; then : - gl_have_pthread_h=yes -else - gl_have_pthread_h=no + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done fi - - - if test "$gl_have_pthread_h" = yes; then - # Other possible tests: - # -lpthreads (FSU threads, PCthreads) - # -lgthreads - gl_have_pthread= - # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist - # in libc. IRIX 6.5 has the first one in both libc and libpthread, but - # the second one only in libpthread, and lock.c needs it. - # - # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 - # needs -pthread for some reason. See: - # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html - save_LIBS=$LIBS - for gl_pthread in '' '-pthread'; do - LIBS="$LIBS $gl_pthread" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - pthread_mutex_t m; - pthread_mutexattr_t ma; +#include + #include int main () { -pthread_mutex_lock (&m); - pthread_mutexattr_init (&ma); +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - gl_have_pthread=yes - LIBTHREAD=$gl_pthread LTLIBTHREAD=$gl_pthread - LIBMULTITHREAD=$gl_pthread LTLIBMULTITHREAD=$gl_pthread -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LIBS=$save_LIBS - test -n "$gl_have_pthread" && break - done - - # Test for libpthread by looking for pthread_kill. (Not pthread_self, - # since it is defined as a macro on OSF/1.) - if test -n "$gl_have_pthread" && test -z "$LIBTHREAD"; then - # The program links fine without libpthread. But it may actually - # need to link with libpthread in order to create multiple threads. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + #include -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); int main () { -return pthread_kill (); +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes else - ac_cv_lib_pthread_pthread_kill=no + ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread - # On Solaris and HP-UX, most pthread functions exist also in libc. - # Therefore pthread_in_use() needs to actually try to create a - # thread: pthread_create from libc will fail, whereas - # pthread_create will actually create a thread. - # On Solaris 10 or newer, this test is no longer needed, because - # libc contains the fully functional pthread functions. - case "$host_os" in - solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) - -$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h - - esac +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include -fi +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif - elif test -z "$gl_have_pthread"; then - # Some library is needed. Try libpthread and libc_r. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 -$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } -if ${ac_cv_lib_pthread_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpthread $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); int main () { -return pthread_kill (); +#ifndef _BIG_ENDIAN + not big endian + #endif + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_kill=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes else - ac_cv_lib_pthread_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ac_cv_c_bigendian=no fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } -if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : - gl_have_pthread=yes - LIBTHREAD=-lpthread LTLIBTHREAD=-lpthread - LIBMULTITHREAD=-lpthread LTLIBMULTITHREAD=-lpthread +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; - if test -z "$gl_have_pthread"; then - # For FreeBSD 4. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 -$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } -if ${ac_cv_lib_c_r_pthread_kill+:} false; then : - $as_echo_n "(cached) " >&6 +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lc_r $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_kill (); +$ac_includes_default int main () { -return pthread_kill (); + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_c_r_pthread_kill=yes +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no else - ac_cv_lib_c_r_pthread_kill=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + ac_cv_c_bigendian=yes fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 -$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } -if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : - gl_have_pthread=yes - LIBTHREAD=-lc_r LTLIBTHREAD=-lc_r - LIBMULTITHREAD=-lc_r LTLIBMULTITHREAD=-lc_r +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi - fi - if test -n "$gl_have_pthread"; then - gl_threads_api=posix - -$as_echo "#define USE_POSIX_THREADS 1" >>confdefs.h - - if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then - if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - -$as_echo "#define USE_POSIX_THREADS_WEAK 1" >>confdefs.h - - LIBTHREAD= - LTLIBTHREAD= - fi - fi - fi - fi - fi - if test -z "$gl_have_pthread"; then - case "$gl_use_threads" in - yes | windows | win32) # The 'win32' is for backward compatibility. - if { case "$host_os" in - mingw*) true;; - *) false;; - esac - }; then - gl_threads_api=windows - -$as_echo "#define USE_WINDOWS_THREADS 1" >>confdefs.h - - fi - ;; - esac fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for multithread API to use" >&5 -$as_echo_n "checking for multithread API to use... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_threads_api" >&5 -$as_echo "$gl_threads_api" >&6; } - - - - - - - +fi +: + case $ac_cv_c_bigendian in #( + yes) + gl_cv_cc_double_expbit0="word 0 bit 20";; #( + no) + gl_cv_cc_double_expbit0="word 1 bit 20" ;; #( + universal) +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + ;; #( + *) + gl_cv_cc_double_expbit0="unknown" ;; + esac +fi +rm -f conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 -$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } -if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f conftest.sym conftest.file - echo >conftest.file - if test "$cross_compiling" = yes; then : - case "$host_os" in - linux-* | linux) - # Guess yes on Linux systems. - gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; - *-gnu* | gnu*) - # Guess yes on glibc systems. - gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; - mingw*) - # Guess no on native Windows. - gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; - *) - # If we don't know, obey --enable-cross-guesses. - gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; - esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$ac_includes_default -int -main () -{ -struct stat sbuf; - if (symlink ("conftest.file", "conftest.sym") != 0) - return 1; - /* Linux will dereference the symlink and fail, as required by - POSIX. That is better in the sense that it means we will not - have to compile and use the lstat wrapper. */ - return lstat ("conftest.sym/", &sbuf) == 0; - ; - return 0; +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (double) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { double value; unsigned int word[NWORDS]; } memory_double; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (double x) +{ + memory_double m; + size_t i; + /* Clear it first, in case sizeof (double) < sizeof (memory_double). */ + memset (&m, 0, sizeof (memory_double)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } +} +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25); + add_to_ored_words (0.5); + add_to_ored_words (1.0); + add_to_ored_words (2.0); + add_to_ored_words (4.0); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); } + _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_lstat_dereferences_slashed_symlink=yes + gl_cv_cc_double_expbit0=`cat conftest.out` else - gl_cv_func_lstat_dereferences_slashed_symlink=no + gl_cv_cc_double_expbit0="unknown" fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - rm -f conftest.sym conftest.file + rm -f conftest.out fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5 -$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; } - case "$gl_cv_func_lstat_dereferences_slashed_symlink" in - *yes) +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_double_expbit0" >&5 +$as_echo "$gl_cv_cc_double_expbit0" >&6; } + case "$gl_cv_cc_double_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_double_expbit0" | sed -e 's/word.*bit //'` cat >>confdefs.h <<_ACEOF -#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 +#define DBL_EXPBIT0_WORD $word +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define DBL_EXPBIT0_BIT $bit _ACEOF ;; esac - GNULIB__EXIT=0; - GNULIB_ATOLL=0; - GNULIB_CALLOC_POSIX=0; - GNULIB_CANONICALIZE_FILE_NAME=0; - GNULIB_GETLOADAVG=0; - GNULIB_GETSUBOPT=0; - GNULIB_GRANTPT=0; - GNULIB_MALLOC_POSIX=0; - GNULIB_MBTOWC=0; - GNULIB_MKDTEMP=0; - GNULIB_MKOSTEMP=0; - GNULIB_MKOSTEMPS=0; - GNULIB_MKSTEMP=0; - GNULIB_MKSTEMPS=0; - GNULIB_POSIX_OPENPT=0; - GNULIB_PTSNAME=0; - GNULIB_PTSNAME_R=0; - GNULIB_PUTENV=0; - GNULIB_QSORT_R=0; - GNULIB_RANDOM=0; - GNULIB_RANDOM_R=0; - GNULIB_REALLOCARRAY=0; - GNULIB_REALLOC_POSIX=0; - GNULIB_REALPATH=0; - GNULIB_RPMATCH=0; - GNULIB_SECURE_GETENV=0; - GNULIB_SETENV=0; - GNULIB_STRTOD=0; - GNULIB_STRTOLD=0; - GNULIB_STRTOLL=0; - GNULIB_STRTOULL=0; - GNULIB_SYSTEM_POSIX=0; - GNULIB_UNLOCKPT=0; - GNULIB_UNSETENV=0; - GNULIB_WCTOMB=0; - HAVE__EXIT=1; - HAVE_ATOLL=1; - HAVE_CANONICALIZE_FILE_NAME=1; - HAVE_DECL_GETLOADAVG=1; - HAVE_GETSUBOPT=1; - HAVE_GRANTPT=1; - HAVE_INITSTATE=1; - HAVE_DECL_INITSTATE=1; - HAVE_MBTOWC=1; - HAVE_MKDTEMP=1; - HAVE_MKOSTEMP=1; - HAVE_MKOSTEMPS=1; - HAVE_MKSTEMP=1; - HAVE_MKSTEMPS=1; - HAVE_POSIX_OPENPT=1; - HAVE_PTSNAME=1; - HAVE_PTSNAME_R=1; - HAVE_QSORT_R=1; - HAVE_RANDOM=1; - HAVE_RANDOM_H=1; - HAVE_RANDOM_R=1; - HAVE_REALLOCARRAY=1; - HAVE_REALPATH=1; - HAVE_RPMATCH=1; - HAVE_SECURE_GETENV=1; - HAVE_SETENV=1; - HAVE_DECL_SETENV=1; - HAVE_SETSTATE=1; - HAVE_DECL_SETSTATE=1; - HAVE_STRTOD=1; - HAVE_STRTOLD=1; - HAVE_STRTOLL=1; - HAVE_STRTOULL=1; - HAVE_STRUCT_RANDOM_DATA=1; - HAVE_SYS_LOADAVG_H=0; - HAVE_UNLOCKPT=1; - HAVE_DECL_UNSETENV=1; - REPLACE_CALLOC=0; - REPLACE_CANONICALIZE_FILE_NAME=0; - REPLACE_INITSTATE=0; - REPLACE_MALLOC=0; - REPLACE_MBTOWC=0; - REPLACE_MKSTEMP=0; - REPLACE_PTSNAME=0; - REPLACE_PTSNAME_R=0; - REPLACE_PUTENV=0; - REPLACE_QSORT_R=0; - REPLACE_RANDOM=0; - REPLACE_RANDOM_R=0; - REPLACE_REALLOC=0; - REPLACE_REALPATH=0; - REPLACE_SETENV=0; - REPLACE_SETSTATE=0; - REPLACE_STRTOD=0; - REPLACE_STRTOLD=0; - REPLACE_UNSETENV=0; - REPLACE_WCTOMB=0; - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc, realloc, calloc are POSIX compliant" >&5 -$as_echo_n "checking whether malloc, realloc, calloc are POSIX compliant... " >&6; } -if ${gl_cv_func_malloc_posix+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the exponent in a 'float'" >&5 +$as_echo_n "checking where to find the exponent in a 'float'... " >&6; } +if ${gl_cv_cc_float_expbit0+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$cross_compiling" = yes; then : + gl_cv_cc_float_expbit0="word 0 bit 23" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -int -main () +#include +#include +#include +#include +#define NWORDS \ + ((sizeof (float) + sizeof (unsigned int) - 1) / sizeof (unsigned int)) +typedef union { float value; unsigned int word[NWORDS]; } memory_float; +static unsigned int ored_words[NWORDS]; +static unsigned int anded_words[NWORDS]; +static void add_to_ored_words (float x) { -#if defined _WIN32 && ! defined __CYGWIN__ - choke me - #endif - - ; - return 0; + memory_float m; + size_t i; + /* Clear it first, in case + sizeof (float) < sizeof (memory_float). */ + memset (&m, 0, sizeof (memory_float)); + m.value = x; + for (i = 0; i < NWORDS; i++) + { + ored_words[i] |= m.word[i]; + anded_words[i] &= m.word[i]; + } } +int main () +{ + size_t j; + FILE *fp = fopen ("conftest.out", "w"); + if (fp == NULL) + return 1; + for (j = 0; j < NWORDS; j++) + anded_words[j] = ~ (unsigned int) 0; + add_to_ored_words (0.25f); + add_to_ored_words (0.5f); + add_to_ored_words (1.0f); + add_to_ored_words (2.0f); + add_to_ored_words (4.0f); + /* Remove bits that are common (e.g. if representation of the first mantissa + bit is explicit). */ + for (j = 0; j < NWORDS; j++) + ored_words[j] &= ~anded_words[j]; + /* Now find the nonzero word. */ + for (j = 0; j < NWORDS; j++) + if (ored_words[j] != 0) + break; + if (j < NWORDS) + { + size_t i; + for (i = j + 1; i < NWORDS; i++) + if (ored_words[i] != 0) + { + fprintf (fp, "unknown"); + return (fclose (fp) != 0); + } + for (i = 0; ; i++) + if ((ored_words[j] >> i) & 1) + { + fprintf (fp, "word %d bit %d", (int) j, (int) i); + return (fclose (fp) != 0); + } + } + fprintf (fp, "unknown"); + return (fclose (fp) != 0); +} + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_func_malloc_posix=yes +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_cc_float_expbit0=`cat conftest.out` else - gl_cv_func_malloc_posix=no + gl_cv_cc_float_expbit0="unknown" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f conftest.out fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_malloc_posix" >&5 -$as_echo "$gl_cv_func_malloc_posix" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_float_expbit0" >&5 +$as_echo "$gl_cv_cc_float_expbit0" >&6; } + case "$gl_cv_cc_float_expbit0" in + word*bit*) + word=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word //' -e 's/ bit.*//'` + bit=`echo "$gl_cv_cc_float_expbit0" | sed -e 's/word.*bit //'` +cat >>confdefs.h <<_ACEOF +#define FLT_EXPBIT0_WORD $word +_ACEOF - for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 +cat >>confdefs.h <<_ACEOF +#define FLT_EXPBIT0_BIT $bit _ACEOF -fi + ;; + esac -done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on platforms where we know the result. - *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \ - | hpux* | solaris* | cygwin* | mingw*) - ac_cv_func_malloc_0_nonnull="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; - esac + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H - # include - #else - char *malloc (); - #endif +#include + #include int main () { -char *p = malloc (0); - int result = !p; - free (p); - return result; +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + ; return 0; } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + ; + return 0; +} _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_malloc_0_nonnull=yes +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes else - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_c_bigendian=no fi - - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } - case "$ac_cv_func_malloc_0_nonnull" in - *yes) - gl_cv_func_malloc_0_nonnull=1 - ;; - *) - gl_cv_func_malloc_0_nonnull=0 - ;; - esac +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif -cat >>confdefs.h <<_ACEOF -#define MALLOC_0_IS_NONNULL $gl_cv_func_malloc_0_nonnull + ; + return 0; +} _ACEOF - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 -$as_echo_n "checking for unsigned long long int... " >&6; } -if ${ac_cv_type_unsigned_long_long_int+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_type_unsigned_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include - /* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ - /* Test literals. */ - long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - unsigned long long int ull = 18446744073709551615ULL; - /* Test constant expressions. */ - typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; - typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63; int main () { -/* Test availability of runtime routines for shift and division. */ - long long int llmax = 9223372036854775807ll; - unsigned long long int ullmax = 18446744073709551615ull; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull)); +#ifndef _BIG_ENDIAN + not big endian + #endif + ; return 0; } - _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes else - ac_cv_type_unsigned_long_long_int=no + ac_cv_c_bigendian=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 -$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } - if test $ac_cv_type_unsigned_long_long_int = yes; then - -$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h - - fi - - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 -$as_echo_n "checking for long long int... " >&6; } -if ${ac_cv_type_long_long_int+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_type_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int - if test $ac_cv_type_long_long_int = yes; then - if test "$cross_compiling" = yes; then : - : +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #ifndef LLONG_MAX - # define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - # define LLONG_MAX (HALF - 1 + HALF) - #endif +$ac_includes_default int main () { -long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0; + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - + ac_cv_c_bigendian=no else - ac_cv_type_long_long_int=no + ac_cv_c_bigendian=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi - fi + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 -$as_echo "$ac_cv_type_long_long_int" >&6; } - if test $ac_cv_type_long_long_int = yes; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + -$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h + GNULIB_ISWBLANK=0; + GNULIB_ISWDIGIT=0; + GNULIB_ISWXDIGIT=0; + GNULIB_WCTYPE=0; + GNULIB_ISWCTYPE=0; + GNULIB_WCTRANS=0; + GNULIB_TOWCTRANS=0; + HAVE_ISWBLANK=1; + HAVE_WCTYPE_T=1; + HAVE_WCTRANS_T=1; + REPLACE_ISWBLANK=0; + REPLACE_ISWDIGIT=0; + REPLACE_ISWXDIGIT=0; + + + + + + + + if test $ac_cv_header_crtdefs_h = yes; then + HAVE_CRTDEFS_H=1 + else + HAVE_CRTDEFS_H=0 fi @@ -12882,1881 +13288,2497 @@ + if test $ac_cv_func_iswcntrl = yes; then + HAVE_ISWCNTRL=1 + else + HAVE_ISWCNTRL=0 + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 -$as_echo_n "checking for a traditional japanese locale... " >&6; } -if ${gt_cv_locale_ja+:} false; then : + if test $gt_cv_c_wint_t = yes; then + HAVE_WINT_T=1 + else + HAVE_WINT_T=0 + fi + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_wctype_h='<'wctype.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_wctype_h+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#if HAVE_LANGINFO_CODESET -# include -#endif -#include -#include -struct tm t; -char buf[16]; -int main () -{ - /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl - imitates locale dependent behaviour by looking at the environment - variables, and all locales use the UTF-8 encoding. */ -#if defined __BEOS__ || defined __HAIKU__ - return 1; -#else - /* Check whether the given locale name is recognized by the system. */ -# if defined _WIN32 && !defined __CYGWIN__ - /* On native Windows, setlocale(category, "") looks at the system settings, - not at the environment variables. Also, when an encoding suffix such - as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE - category of the locale to "C". */ - if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL - || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) - return 1; -# else - if (setlocale (LC_ALL, "") == NULL) return 1; -# endif - /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) - is empty, and the behaviour of Tcl 8.4 in this locale is not useful. - On OpenBSD 4.0, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. - On MirBSD 10, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -# if HAVE_LANGINFO_CODESET - { - const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 - || strcmp (cs, "UTF-8") == 0) - return 1; - } -# endif -# ifdef __CYGWIN__ - /* On Cygwin, avoid locale names without encoding suffix, because the - locale_charset() function relies on the encoding suffix. Note that - LC_ALL is set on the command line. */ - if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -# endif - /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales - on Cygwin 1.5.x. */ - if (MB_CUR_MAX == 1) - return 1; - /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. - This excludes the UTF-8 encoding (except on MirBSD). */ - { - const char *p; - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; - for (p = buf; *p != '\0'; p++) - if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) - return 1; - } - return 0; -#endif -} - -_ACEOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - case "$host_os" in - # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", - # "fr" or "fra" as "French" or "French_France.1252", - # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", - # and similar. - mingw*) - # Note that on native Windows, the Japanese locale is - # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we - # cannot use it here. - gt_cv_locale_ja=none - ;; - *) - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the AIX locale name. - if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP.EUC-JP - else - # Test for the HP-UX, OSF/1, NetBSD locale name. - if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP.eucJP - else - # Test for the IRIX, FreeBSD locale name. - if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja_JP.EUC - else - # Test for the Solaris 7 locale name. - if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_ja=ja - else - # Special test for NetBSD 1.6. - if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then - gt_cv_locale_ja=ja_JP.eucJP - else - # None found. - gt_cv_locale_ja=none - fi - fi - fi - fi - fi - fi - ;; - esac - fi - rm -fr conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 -$as_echo "$gt_cv_locale_ja" >&6; } - LOCALE_JA=$gt_cv_locale_ja - - + if test $ac_cv_header_wctype_h = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 -$as_echo_n "checking for a transitional chinese locale... " >&6; } -if ${gt_cv_locale_zh_CN+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac -#include -#include -#include -#if HAVE_LANGINFO_CODESET -# include -#endif -#include -#include -struct tm t; -char buf[16]; -int main () -{ - /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl - imitates locale dependent behaviour by looking at the environment - variables, and all locales use the UTF-8 encoding. */ -#if defined __BEOS__ || defined __HAIKU__ - return 1; -#else - /* Check whether the given locale name is recognized by the system. */ -# if defined _WIN32 && !defined __CYGWIN__ - /* On native Windows, setlocale(category, "") looks at the system settings, - not at the environment variables. Also, when an encoding suffix such - as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE - category of the locale to "C". */ - if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL - || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) - return 1; -# else - if (setlocale (LC_ALL, "") == NULL) return 1; -# endif - /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) - is empty, and the behaviour of Tcl 8.4 in this locale is not useful. - On OpenBSD 4.0, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. - On MirBSD 10, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "UTF-8". */ -# if HAVE_LANGINFO_CODESET - { - const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 - || strcmp (cs, "UTF-8") == 0) - return 1; - } -# endif -# ifdef __CYGWIN__ - /* On Cygwin, avoid locale names without encoding suffix, because the - locale_charset() function relies on the encoding suffix. Note that - LC_ALL is set on the command line. */ - if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -# endif - /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. - This excludes the UTF-8 encoding (except on MirBSD). */ - { - const char *p; - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; - for (p = buf; *p != '\0'; p++) - if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) - return 1; - } - /* Check whether a typical GB18030 multibyte sequence is recognized as a - single wide character. This excludes the GB2312 and GBK encodings. */ - if (mblen ("\203\062\332\066", 5) != 4) - return 1; - return 0; -#endif -} + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'wctype.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' -_ACEOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - case "$host_os" in - # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", - # "fr" or "fra" as "French" or "French_France.1252", - # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", - # and similar. - mingw*) - # Test for the hypothetical native Windows locale name. - if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=Chinese_China.54936 - else - # None found. - gt_cv_locale_zh_CN=none - fi - ;; - solaris2.8) - # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are - # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. - # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. - gt_cv_locale_zh_CN=none - ;; - *) - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the locale name without encoding suffix. - if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=zh_CN + gl_cv_absolute_wctype_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_wctype_h + gl_cv_next_wctype_h='"'$gl_header'"' else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_zh_CN=zh_CN.GB18030 - else - # None found. - gt_cv_locale_zh_CN=none - fi - fi - ;; - esac - else - # If there was a link error, due to mblen(), the system is so old that - # it certainly doesn't have a chinese locale. - gt_cv_locale_zh_CN=none - fi - rm -fr conftest* + gl_cv_next_wctype_h='<'wctype.h'>' + fi + fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 -$as_echo "$gt_cv_locale_zh_CN" >&6; } - LOCALE_ZH_CN=$gt_cv_locale_zh_CN +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_wctype_h" >&5 +$as_echo "$gl_cv_next_wctype_h" >&6; } + fi + NEXT_WCTYPE_H=$gl_cv_next_wctype_h + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'wctype.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_wctype_h + fi + NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H=$gl_next_as_first_directive - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 -$as_echo_n "checking for a french Unicode locale... " >&6; } -if ${gt_cv_locale_fr_utf8+:} false; then : + + if test $ac_cv_header_wctype_h = yes; then + if test $ac_cv_func_iswcntrl = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether iswcntrl works" >&5 +$as_echo_n "checking whether iswcntrl works... " >&6; } +if ${gl_cv_func_iswcntrl_works+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include -#include -#if HAVE_LANGINFO_CODESET -# include -#endif #include -#include -struct tm t; -char buf[16]; -int main () { - /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl - imitates locale dependent behaviour by looking at the environment - variables, and all locales use the UTF-8 encoding. */ -#if !(defined __BEOS__ || defined __HAIKU__) - /* Check whether the given locale name is recognized by the system. */ -# if defined _WIN32 && !defined __CYGWIN__ - /* On native Windows, setlocale(category, "") looks at the system settings, - not at the environment variables. Also, when an encoding suffix such - as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE - category of the locale to "C". */ - if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL - || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) - return 1; -# else - if (setlocale (LC_ALL, "") == NULL) return 1; -# endif - /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". - On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) - is empty, and the behaviour of Tcl 8.4 in this locale is not useful. - On OpenBSD 4.0, when an unsupported locale is specified, setlocale() - succeeds but then nl_langinfo(CODESET) is "646". In this situation, - some unit tests fail. */ -# if HAVE_LANGINFO_CODESET - { - const char *cs = nl_langinfo (CODESET); - if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) - return 1; - } -# endif -# ifdef __CYGWIN__ - /* On Cygwin, avoid locale names without encoding suffix, because the - locale_charset() function relies on the encoding suffix. Note that - LC_ALL is set on the command line. */ - if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; -# endif - /* Check whether in the abbreviation of the second month, the second - character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is - two bytes long, with UTF-8 encoding. */ - t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; - if (strftime (buf, sizeof (buf), "%b", &t) < 4 - || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') - return 1; -#endif -#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ - /* Check whether the decimal separator is a comma. - On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point - are nl_langinfo(RADIXCHAR) are both ".". */ - if (localeconv () ->decimal_point[0] != ',') return 1; -#endif + #if __GNU_LIBRARY__ == 1 + Linux libc5 i18n is broken. + #endif +int +main () +{ + + ; return 0; } - _ACEOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - case "$host_os" in - # Handle native Windows specially, because there setlocale() interprets - # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", - # "fr" or "fra" as "French" or "French_France.1252", - # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", - # "ja" as "Japanese" or "Japanese_Japan.932", - # and similar. - mingw*) - # Test for the hypothetical native Windows locale name. - if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=French_France.65001 - else - # None found. - gt_cv_locale_fr_utf8=none - fi - ;; - *) - # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because - # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the - # configure script would override the LC_ALL setting. Likewise for - # LC_CTYPE, which is also set at the beginning of the configure script. - # Test for the usual locale name. - if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR - else - # Test for the locale name with explicit encoding suffix. - if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr_FR.UTF-8 - else - # Test for the Solaris 7 locale name. - if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then - gt_cv_locale_fr_utf8=fr.UTF-8 - else - # None found. - gt_cv_locale_fr_utf8=none - fi - fi - fi - ;; - esac - fi - rm -fr conftest* - +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_func_iswcntrl_works="guessing yes" +else + gl_cv_func_iswcntrl_works="guessing no" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 -$as_echo "$gt_cv_locale_fr_utf8" >&6; } - LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif + + /* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include + #include + int main () { return iswprint ('x') == 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_iswcntrl_works=yes +else + gl_cv_func_iswcntrl_works=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_iswcntrl_works" >&5 +$as_echo "$gl_cv_func_iswcntrl_works" >&6; } + fi + HAVE_WCTYPE_H=1 + else + HAVE_WCTYPE_H=0 + fi + if test $GNULIB_OVERRIDES_WINT_T = 1; then + REPLACE_ISWCNTRL=1 + else + case "$gl_cv_func_iswcntrl_works" in + *yes) REPLACE_ISWCNTRL=0 ;; + *) REPLACE_ISWCNTRL=1 ;; + esac + fi + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then + : + fi - GNULIB_EXPLICIT_BZERO=0; - GNULIB_FFSL=0; - GNULIB_FFSLL=0; - GNULIB_MEMCHR=0; - GNULIB_MEMMEM=0; - GNULIB_MEMPCPY=0; - GNULIB_MEMRCHR=0; - GNULIB_RAWMEMCHR=0; - GNULIB_STPCPY=0; - GNULIB_STPNCPY=0; - GNULIB_STRCHRNUL=0; - GNULIB_STRDUP=0; - GNULIB_STRNCAT=0; - GNULIB_STRNDUP=0; - GNULIB_STRNLEN=0; - GNULIB_STRPBRK=0; - GNULIB_STRSEP=0; - GNULIB_STRSTR=0; - GNULIB_STRCASESTR=0; - GNULIB_STRTOK_R=0; - GNULIB_MBSLEN=0; - GNULIB_MBSNLEN=0; - GNULIB_MBSCHR=0; - GNULIB_MBSRCHR=0; - GNULIB_MBSSTR=0; - GNULIB_MBSCASECMP=0; - GNULIB_MBSNCASECMP=0; - GNULIB_MBSPCASECMP=0; - GNULIB_MBSCASESTR=0; - GNULIB_MBSCSPN=0; - GNULIB_MBSPBRK=0; - GNULIB_MBSSPN=0; - GNULIB_MBSSEP=0; - GNULIB_MBSTOK_R=0; - GNULIB_STRERROR=0; - GNULIB_STRERROR_R=0; - GNULIB_STRSIGNAL=0; - GNULIB_STRVERSCMP=0; - HAVE_MBSLEN=0; - HAVE_EXPLICIT_BZERO=1; - HAVE_FFSL=1; - HAVE_FFSLL=1; - HAVE_MEMCHR=1; - HAVE_DECL_MEMMEM=1; - HAVE_MEMPCPY=1; - HAVE_DECL_MEMRCHR=1; - HAVE_RAWMEMCHR=1; - HAVE_STPCPY=1; - HAVE_STPNCPY=1; - HAVE_STRCHRNUL=1; - HAVE_DECL_STRDUP=1; - HAVE_DECL_STRNDUP=1; - HAVE_DECL_STRNLEN=1; - HAVE_STRPBRK=1; - HAVE_STRSEP=1; - HAVE_STRCASESTR=1; - HAVE_DECL_STRTOK_R=1; - HAVE_DECL_STRERROR_R=1; - HAVE_DECL_STRSIGNAL=1; - HAVE_STRVERSCMP=1; - REPLACE_MEMCHR=0; - REPLACE_MEMMEM=0; - REPLACE_STPNCPY=0; - REPLACE_STRCHRNUL=0; - REPLACE_STRDUP=0; - REPLACE_STRNCAT=0; - REPLACE_STRNDUP=0; - REPLACE_STRNLEN=0; - REPLACE_STRSTR=0; - REPLACE_STRCASESTR=0; - REPLACE_STRTOK_R=0; - REPLACE_STRERROR=0; - REPLACE_STRERROR_R=0; - REPLACE_STRSIGNAL=0; - UNDEFINE_STRTOK_R=0; - - - + if test $REPLACE_ISWCNTRL = 1; then + REPLACE_TOWLOWER=1 + else + for ac_func in towlower +do : + ac_fn_c_check_func "$LINENO" "towlower" "ac_cv_func_towlower" +if test "x$ac_cv_func_towlower" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TOWLOWER 1 +_ACEOF +fi +done + if test $ac_cv_func_towlower = yes; then + REPLACE_TOWLOWER=0 + else + ac_fn_c_check_decl "$LINENO" "towlower" "ac_cv_have_decl_towlower" "/* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include + #if HAVE_WCTYPE_H + # include + #endif - # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it - # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is - # irrelevant for anonymous mappings. - ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" -if test "x$ac_cv_func_mmap" = xyes; then : - gl_have_mmap=yes +" +if test "x$ac_cv_have_decl_towlower" = xyes; then : + ac_have_decl=1 else - gl_have_mmap=no + ac_have_decl=0 fi +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_TOWLOWER $ac_have_decl +_ACEOF - # Try to allow MAP_ANONYMOUS. - gl_have_mmap_anonymous=no - if test $gl_have_mmap = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 -$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + if test $ac_cv_have_decl_towlower = yes; then + REPLACE_TOWLOWER=1 + else + REPLACE_TOWLOWER=0 + fi + fi + fi -#include -#ifdef MAP_ANONYMOUS - I cannot identify this map -#endif -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "I cannot identify this map" >/dev/null 2>&1; then : - gl_have_mmap_anonymous=yes -fi -rm -f conftest* + if test $HAVE_ISWCNTRL = 0 || test $REPLACE_TOWLOWER = 1; then + : + fi - if test $gl_have_mmap_anonymous != yes; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctype_t" >&5 +$as_echo_n "checking for wctype_t... " >&6; } +if ${gl_cv_type_wctype_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +/* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include + #if HAVE_WCTYPE_H + # include + #endif + wctype_t a; -#include -#ifdef MAP_ANON - I cannot identify this map -#endif +int +main () +{ + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "I cannot identify this map" >/dev/null 2>&1; then : - -$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h - - gl_have_mmap_anonymous=yes +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_type_wctype_t=yes +else + gl_cv_type_wctype_t=no fi -rm -f conftest* - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 -$as_echo "$gl_have_mmap_anonymous" >&6; } - if test $gl_have_mmap_anonymous = yes; then - -$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctype_t" >&5 +$as_echo "$gl_cv_type_wctype_t" >&6; } + if test $gl_cv_type_wctype_t = no; then + HAVE_WCTYPE_T=0 fi - - - - - - if test $HAVE_MEMCHR = 1; then - # Detect platform-specific bugs in some versions of glibc: - # memchr should not dereference anything with length 0 - # https://bugzilla.redhat.com/show_bug.cgi?id=499689 - # memchr should not dereference overestimated length after a match - # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 - # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 - # memchr should cast the second argument to 'unsigned char'. - # This bug exists in Android 4.3. - # Assume that memchr works on platforms that lack mprotect. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether memchr works" >&5 -$as_echo_n "checking whether memchr works... " >&6; } -if ${gl_cv_func_memchr_works+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctrans_t" >&5 +$as_echo_n "checking for wctrans_t... " >&6; } +if ${gl_cv_type_wctrans_t+:} false; then : $as_echo_n "(cached) " >&6 else - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess no on Android. - linux*-android*) gl_cv_func_memchr_works="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_memchr_works="guessing yes" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; - esac - -else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#include -#if HAVE_SYS_MMAN_H -# include -# include -# include -# include -# ifndef MAP_FILE -# define MAP_FILE 0 -# endif -#endif +/* Tru64 with Desktop Toolkit C has a bug: must be + included before . + BSD/OS 4.0.1 has a bug: , and + must be included before . */ + #include + #include + #include + #include + #include + wctrans_t a; int main () { - int result = 0; - char *fence = NULL; -#if HAVE_SYS_MMAN_H && HAVE_MPROTECT -# if HAVE_MAP_ANONYMOUS - const int flags = MAP_ANONYMOUS | MAP_PRIVATE; - const int fd = -1; -# else /* !HAVE_MAP_ANONYMOUS */ - const int flags = MAP_FILE | MAP_PRIVATE; - int fd = open ("/dev/zero", O_RDONLY, 0666); - if (fd >= 0) -# endif - { - int pagesize = getpagesize (); - char *two_pages = - (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, - flags, fd, 0); - if (two_pages != (char *)(-1) - && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) - fence = two_pages + pagesize; - } -#endif - if (fence) - { - if (memchr (fence, 0, 0)) - result |= 1; - strcpy (fence - 9, "12345678"); - if (memchr (fence - 9, 0, 79) != fence - 1) - result |= 2; - if (memchr (fence - 1, 0, 3) != fence - 1) - result |= 4; - } - /* Test against bug on Android 4.3. */ - { - char input[3]; - input[0] = 'a'; - input[1] = 'b'; - input[2] = 'c'; - if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) - result |= 8; - } - return result; - ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_memchr_works=yes +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_type_wctrans_t=yes else - gl_cv_func_memchr_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext + gl_cv_type_wctrans_t=no fi - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_memchr_works" >&5 -$as_echo "$gl_cv_func_memchr_works" >&6; } - case "$gl_cv_func_memchr_works" in - *yes) ;; - *) REPLACE_MEMCHR=1 ;; - esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wctrans_t" >&5 +$as_echo "$gl_cv_type_wctrans_t" >&6; } + if test $gl_cv_type_wctrans_t = no; then + HAVE_WCTRANS_T=0 fi - if test $ac_cv_func__set_invalid_parameter_handler = yes; then - HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 -$as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h - else - HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 - fi + + GNULIB_NL_LANGINFO=0; + HAVE_NL_LANGINFO=1; + REPLACE_NL_LANGINFO=0; + + GNULIB_LOCALECONV=0; + GNULIB_SETLOCALE=0; + GNULIB_SETLOCALE_NULL=0; + GNULIB_DUPLOCALE=0; + GNULIB_LOCALENAME=0; + HAVE_NEWLOCALE=1; + HAVE_DUPLOCALE=1; + HAVE_FREELOCALE=1; + REPLACE_LOCALECONV=0; + REPLACE_SETLOCALE=0; + REPLACE_NEWLOCALE=0; + REPLACE_DUPLOCALE=0; + REPLACE_FREELOCALE=0; + REPLACE_STRUCT_LCONV=0; + + REPLACE_NULL=0; + HAVE_MAX_ALIGN_T=1; + HAVE_WCHAR_T=1; - gl_cv_c_multiarch=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wchar_t" >&5 +$as_echo_n "checking for wchar_t... " >&6; } +if ${gt_cv_c_wchar_t+:} false; then : + $as_echo_n "(cached) " >&6 +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; +#include + wchar_t foo = (wchar_t)'\0'; +int +main () +{ + ; + return 0; +} _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - - arch= - prev= - for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do - if test -n "$prev"; then - case $word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$arch" || test "$arch" = "$word"; then - arch="$word" - else - gl_cv_c_multiarch=yes - fi - ;; - esac - prev= - else - if test "x$word" = "x-arch"; then - prev=arch - fi - fi - done - + gt_cv_c_wchar_t=yes +else + gt_cv_c_wchar_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $gl_cv_c_multiarch = yes; then - APPLE_UNIVERSAL_BUILD=1 - else - APPLE_UNIVERSAL_BUILD=0 - fi - - - - +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wchar_t" >&5 +$as_echo "$gt_cv_c_wchar_t" >&6; } + if test $gt_cv_c_wchar_t = yes; then +$as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h + fi - GNULIB_PTHREAD_SIGMASK=0; - GNULIB_RAISE=0; - GNULIB_SIGNAL_H_SIGPIPE=0; - GNULIB_SIGPROCMASK=0; - GNULIB_SIGACTION=0; - HAVE_POSIX_SIGNALBLOCKING=1; - HAVE_PTHREAD_SIGMASK=1; - HAVE_RAISE=1; - HAVE_SIGSET_T=1; - HAVE_SIGINFO_T=1; - HAVE_SIGACTION=1; - HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; - HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; - HAVE_SIGHANDLER_T=1; - REPLACE_PTHREAD_SIGMASK=0; - REPLACE_RAISE=0; + STDDEF_H= - ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" " - #include - /* Mingw defines sigset_t not in , but in . */ - #include + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for good max_align_t" >&5 +$as_echo_n "checking for good max_align_t... " >&6; } +if ${gl_cv_type_max_align_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + unsigned int s = sizeof (max_align_t); + #if defined __GNUC__ || defined __IBM__ALIGNOF__ + int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; + int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; + #endif -" -if test "x$ac_cv_type_sigset_t" = xyes; then : +int +main () +{ -cat >>confdefs.h <<_ACEOF -#define HAVE_SIGSET_T 1 + ; + return 0; +} _ACEOF - -gl_cv_type_sigset_t=yes +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_type_max_align_t=yes else - gl_cv_type_sigset_t=no + gl_cv_type_max_align_t=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $gl_cv_type_sigset_t != yes; then - HAVE_SIGSET_T=0 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_max_align_t" >&5 +$as_echo "$gl_cv_type_max_align_t" >&6; } + if test $gl_cv_type_max_align_t = no; then + HAVE_MAX_ALIGN_T=0 + STDDEF_H=stddef.h fi + if test $gt_cv_c_wchar_t = no; then + HAVE_WCHAR_T=0 + STDDEF_H=stddef.h + fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C Library >= 2.1 or uClibc" >&5 -$as_echo_n "checking whether we are using the GNU C Library >= 2.1 or uClibc... " >&6; } -if ${ac_cv_gnu_library_2_1+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NULL can be used in arbitrary expressions" >&5 +$as_echo_n "checking whether NULL can be used in arbitrary expressions... " >&6; } +if ${gl_cv_decl_null_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + int test[2 * (sizeof NULL == sizeof (void *)) -1]; -#include -#ifdef __GNU_LIBRARY__ - #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) - Lucky GNU user - #endif -#endif -#ifdef __UCLIBC__ - Lucky user -#endif +int +main () +{ + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Lucky" >/dev/null 2>&1; then : - ac_cv_gnu_library_2_1=yes +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_decl_null_works=yes else - ac_cv_gnu_library_2_1=no + gl_cv_decl_null_works=no fi -rm -f conftest* - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_null_works" >&5 +$as_echo "$gl_cv_decl_null_works" >&6; } + if test $gl_cv_decl_null_works = no; then + REPLACE_NULL=1 + STDDEF_H=stddef.h + fi + if test -n "$STDDEF_H"; then + GL_GENERATE_STDDEF_H_TRUE= + GL_GENERATE_STDDEF_H_FALSE='#' +else + GL_GENERATE_STDDEF_H_TRUE='#' + GL_GENERATE_STDDEF_H_FALSE= fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gnu_library_2_1" >&5 -$as_echo "$ac_cv_gnu_library_2_1" >&6; } - GLIBC21="$ac_cv_gnu_library_2_1" + if test -n "$STDDEF_H"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 -$as_echo_n "checking for uid_t in sys/types.h... " >&6; } -if ${ac_cv_type_uid_t+:} false; then : - $as_echo_n "(cached) " >&6 + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stddef_h='<'stddef.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_stddef_h+:} false; then : + $as_echo_n "(cached) " >&6 else + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - +#include _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "uid_t" >/dev/null 2>&1; then : - ac_cv_type_uid_t=yes -else - ac_cv_type_uid_t=no -fi -rm -f conftest* + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 -$as_echo "$ac_cv_type_uid_t" >&6; } -if test $ac_cv_type_uid_t = no; then + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'stddef.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' -$as_echo "#define uid_t int" >>confdefs.h + gl_cv_absolute_stddef_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + gl_header=$gl_cv_absolute_stddef_h + gl_cv_next_stddef_h='"'$gl_header'"' -$as_echo "#define gid_t int" >>confdefs.h fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stddef_h" >&5 +$as_echo "$gl_cv_next_stddef_h" >&6; } + fi + NEXT_STDDEF_H=$gl_cv_next_stddef_h -: + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'stddef.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_stddef_h + fi + NEXT_AS_FIRST_DIRECTIVE_STDDEF_H=$gl_next_as_first_directive + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether locale.h defines locale_t" >&5 +$as_echo_n "checking whether locale.h defines locale_t... " >&6; } +if ${gl_cv_header_locale_has_locale_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + locale_t x; +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_locale_has_locale_t=yes +else + gl_cv_header_locale_has_locale_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_has_locale_t" >&5 +$as_echo "$gl_cv_header_locale_has_locale_t" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf returns a byte count as in C99" >&5 -$as_echo_n "checking whether snprintf returns a byte count as in C99... " >&6; } -if ${gl_cv_func_snprintf_retval_c99+:} false; then : + + if test $ac_cv_header_xlocale_h = yes; then + HAVE_XLOCALE_H=1 + if test $gl_cv_header_locale_has_locale_t = yes; then + gl_cv_header_locale_h_needs_xlocale_h=no + else + gl_cv_header_locale_h_needs_xlocale_h=yes + fi + HAVE_LOCALE_T=1 + else + HAVE_XLOCALE_H=0 + gl_cv_header_locale_h_needs_xlocale_h=no + if test $gl_cv_header_locale_has_locale_t = yes; then + HAVE_LOCALE_T=1 + else + HAVE_LOCALE_T=0 + fi + fi + + + + + gl_threads_api=none + LIBTHREAD= + LTLIBTHREAD= + LIBMULTITHREAD= + LTLIBMULTITHREAD= + if test "$gl_use_threads" != no; then + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } +if ${gl_cv_have_weak+:} false; then : $as_echo_n "(cached) " >&6 else - - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; - darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_snprintf_retval_c99="guessing no";; - openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; - solaris*) gl_cv_func_printf_sizes_c99="guessing no";; - # Guess yes on AIX >= 4. - aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; - aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_snprintf_retval_c99="guessing no";; - netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on Android. - linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -#ifdef _MSC_VER - Known -#endif +extern void xyzzy (); +#pragma weak xyzzy +int +main () +{ +xyzzy(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_have_weak=maybe +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_snprintf_retval_c99="guessing yes" + $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : + gl_cv_have_weak="guessing yes" else - gl_cv_func_snprintf_retval_c99="guessing no" + gl_cv_have_weak="guessing no" fi rm -f conftest* - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";; - esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include -#include -#if HAVE_SNPRINTF -# define my_snprintf snprintf -#else -# include -static int my_snprintf (char *buf, int size, const char *format, ...) -{ - va_list args; - int ret; - va_start (args, format); - ret = vsnprintf (buf, size, format, args); - va_end (args); - return ret; -} -#endif -static char buf[100]; +#pragma weak fputs int main () { - strcpy (buf, "ABCDEF"); - if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) - return 1; - if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) - return 2; - if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) - return 3; - return 0; + return (fputs == NULL); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_snprintf_retval_c99=yes + gl_cv_have_weak=yes else - gl_cv_func_snprintf_retval_c99=no + gl_cv_have_weak=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + fi + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_retval_c99" >&5 -$as_echo "$gl_cv_func_snprintf_retval_c99" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +$as_echo "$gl_cv_have_weak" >&6; } + case "$gl_cv_have_weak" in + *yes) -ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" -if test "x$ac_cv_have_decl_snprintf" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi +$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_SNPRINTF $ac_have_decl -_ACEOF + ;; + esac + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdint.h" >&5 -$as_echo_n "checking for stdint.h... " >&6; } -if ${gl_cv_header_stdint_h+:} false; then : - $as_echo_n "(cached) " >&6 + : + fi + if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then + + gl_have_isoc_threads="$ac_cv_header_threads_h" + fi + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + + + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes; then : + gl_have_pthread_h=yes else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + gl_have_pthread_h=no +fi + + + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include - #include +#include + pthread_mutex_t m; + pthread_mutexattr_t ma; + int main () { -uintmax_t i = (uintmax_t) -1; return !i; +pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_stdint_h=yes -else - gl_cv_header_stdint_h=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +if ac_fn_c_try_link "$LINENO"; then : + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_h" >&5 -$as_echo "$gl_cv_header_stdint_h" >&6; } - if test $gl_cv_header_stdint_h = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_STDINT_H_WITH_UINTMAX 1 -_ACEOF - - fi - +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inttypes.h" >&5 -$as_echo_n "checking for inttypes.h... " >&6; } -if ${gl_cv_header_inttypes_h+:} false; then : + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_kill+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include - +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); int main () { -uintmax_t i = (uintmax_t) -1; return !i; +return pthread_kill (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_inttypes_h=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_kill=yes else - gl_cv_header_inttypes_h=no + ac_cv_lib_pthread_pthread_kill=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_inttypes_h" >&5 -$as_echo "$gl_cv_header_inttypes_h" >&6; } - if test $gl_cv_header_inttypes_h = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_INTTYPES_H_WITH_UINTMAX 1 -_ACEOF - - fi - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) +$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + esac +fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports size specifiers as in C99" >&5 -$as_echo_n "checking whether printf supports size specifiers as in C99... " >&6; } -if ${gl_cv_func_printf_sizes_c99+:} false; then : + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_kill+:} false; then : $as_echo_n "(cached) " >&6 else - - if test "$cross_compiling" = yes; then : - - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on FreeBSD >= 5. - freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; - darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on OpenBSD >= 3.9. - openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) - gl_cv_func_printf_sizes_c99="guessing no";; - openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; - solaris*) gl_cv_func_printf_sizes_c99="guessing no";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_sizes_c99="guessing no";; - netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef _MSC_VER - Known +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" #endif - +char pthread_kill (); +int +main () +{ +return pthread_kill (); + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_sizes_c99="guessing yes" +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_kill=yes else - gl_cv_func_printf_sizes_c99="guessing no" + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread fi -rm -f conftest* - - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";; - esac + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } +if ${ac_cv_lib_c_r_pthread_kill+:} false; then : + $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -#include -#include -#if HAVE_STDINT_H_WITH_UINTMAX -# include -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -# include +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" #endif -static char buf[100]; -int main () +char pthread_kill (); +int +main () { - int result = 0; -#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX - buf[0] = '\0'; - if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 - || strcmp (buf, "12345671 33") != 0) - result |= 1; -#else - result |= 1; -#endif - buf[0] = '\0'; - if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 - || strcmp (buf, "12345672 33") != 0) - result |= 2; - buf[0] = '\0'; - if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 - || strcmp (buf, "12345673 33") != 0) - result |= 4; - buf[0] = '\0'; - if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 - || strcmp (buf, "1.5 33") != 0) - result |= 8; - return result; +return pthread_kill (); + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_sizes_c99=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_r_pthread_kill=yes else - gl_cv_func_printf_sizes_c99=no + ac_cv_lib_c_r_pthread_kill=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r fi + fi + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +$as_echo_n "checking whether POSIX threads API is available... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +$as_echo "$gl_pthread_api" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_sizes_c99" >&5 -$as_echo "$gl_cv_func_printf_sizes_c99" >&6; } + if test $gl_pthread_api = yes; then +$as_echo "#define HAVE_PTHREAD_API 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports 'long double' arguments" >&5 -$as_echo_n "checking whether printf supports 'long double' arguments... " >&6; } -if ${gl_cv_func_printf_long_double+:} false; then : - $as_echo_n "(cached) " >&6 -else + fi - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess no on BeOS. - beos*) gl_cv_func_printf_long_double="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_long_double="guessing yes";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +int +main () +{ +sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + LIB_SCHED_YIELD= -#ifdef _MSC_VER - Known -#endif +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +$as_echo_n "checking for sched_yield in -lrt... " >&6; } +if ${ac_cv_lib_rt_sched_yield+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); +int +main () +{ +return sched_yield (); + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_long_double="guessing yes" +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_sched_yield=yes else - gl_cv_func_printf_long_double="guessing no" + ac_cv_lib_rt_sched_yield=no fi -rm -f conftest* - - ;; - *) gl_cv_func_printf_long_double="guessing yes";; - esac - +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = xyes; then : + LIB_SCHED_YIELD=-lrt +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +$as_echo_n "checking for sched_yield in -lposix4... " >&6; } +if ${ac_cv_lib_posix4_sched_yield+:} false; then : + $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -static char buf[10000]; -int main () +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); +int +main () { - int result = 0; - buf[0] = '\0'; - if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.750000 33") != 0) - result |= 1; - buf[0] = '\0'; - if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.750000e+00 33") != 0) - result |= 2; - buf[0] = '\0'; - if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 - || strcmp (buf, "1.75 33") != 0) - result |= 4; - return result; +return sched_yield (); + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_long_double=yes +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_posix4_sched_yield=yes else - gl_cv_func_printf_long_double=no + ac_cv_lib_posix4_sched_yield=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +$as_echo "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = xyes; then : + LIB_SCHED_YIELD=-lposix4 +fi + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_long_double" >&5 -$as_echo "$gl_cv_func_printf_long_double" >&6; } +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + gl_pthreadlib_body_done=done + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports infinite 'double' arguments" >&5 -$as_echo_n "checking whether printf supports infinite 'double' arguments... " >&6; } -if ${gl_cv_func_printf_infinite+:} false; then : - $as_echo_n "(cached) " >&6 + LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD + LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD + if test $gl_pthread_api = yes; then + if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then + gl_threads_api='isoc+posix' + +$as_echo "#define USE_ISOC_AND_POSIX_THREADS 1" >>confdefs.h + + LIBTHREAD= LTLIBTHREAD= + else + gl_threads_api=posix + +$as_echo "#define USE_POSIX_THREADS 1" >>confdefs.h + + if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + +$as_echo "#define USE_POSIX_THREADS_WEAK 1" >>confdefs.h + + LIBTHREAD= LTLIBTHREAD= + fi + fi + fi + fi + fi + if test $gl_threads_api = none; then + if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + + + + if test -z "$gl_stdthreadlib_body_done"; then + + + case "$host_os" in + mingw*) + LIBSTDTHREAD= + ;; + *) + + + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes; then : + gl_have_pthread_h=yes else + gl_have_pthread_h=no +fi - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; - darwin*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; - hpux*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on NetBSD >= 3. - netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) - gl_cv_func_printf_infinite="guessing no";; - netbsd*) gl_cv_func_printf_infinite="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_infinite="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_infinite="guessing no";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include + pthread_mutex_t m; + pthread_mutexattr_t ma; -#ifdef _MSC_VER - Known -#endif +int +main () +{ +pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_kill+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); +int +main () +{ +return pthread_kill (); + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_infinite="guessing yes" +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_kill=yes else - gl_cv_func_printf_infinite="guessing no" + ac_cv_lib_pthread_pthread_kill=no fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_infinite="$gl_cross_guess_normal";; - esac +$as_echo "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + esac + +fi + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +$as_echo_n "checking for pthread_kill in -lpthread... " >&6; } +if ${ac_cv_lib_pthread_pthread_kill+:} false; then : + $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -static int -strisnan (const char *string, size_t start_index, size_t end_index) +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); +int +main () { - if (start_index < end_index) - { - if (string[start_index] == '-') - start_index++; - if (start_index + 3 <= end_index - && memcmp (string + start_index, "nan", 3) == 0) - { - start_index += 3; - if (start_index == end_index - || (string[start_index] == '(' && string[end_index - 1] == ')')) - return 1; - } - } +return pthread_kill (); + ; return 0; } -static int -have_minus_zero () +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pthread_pthread_kill=yes +else + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +$as_echo "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes; then : + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread +fi + + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +$as_echo_n "checking for pthread_kill in -lc_r... " >&6; } +if ${ac_cv_lib_c_r_pthread_kill+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pthread_kill (); +int +main () { - static double plus_zero = 0.0; - double minus_zero = - plus_zero; - return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; +return pthread_kill (); + ; + return 0; } -static char buf[10000]; -static double zero = 0.0; -int main () +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_c_r_pthread_kill=yes +else + ac_cv_lib_c_r_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +$as_echo "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = xyes; then : + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r +fi + + fi + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +$as_echo_n "checking whether POSIX threads API is available... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +$as_echo "$gl_pthread_api" >&6; } + + + if test $gl_pthread_api = yes; then + +$as_echo "#define HAVE_PTHREAD_API 1" >>confdefs.h + + fi + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () { - int result = 0; - if (sprintf (buf, "%f", 1.0 / zero) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%f", -1.0 / zero) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%f", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%e", 1.0 / zero) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 4; - if (sprintf (buf, "%e", -1.0 / zero) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 4; - if (sprintf (buf, "%e", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 8; - if (sprintf (buf, "%g", 1.0 / zero) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 16; - if (sprintf (buf, "%g", -1.0 / zero) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 16; - if (sprintf (buf, "%g", zero / zero) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 32; - /* This test fails on HP-UX 10.20. */ - if (have_minus_zero ()) - if (sprintf (buf, "%g", - zero) < 0 - || strcmp (buf, "-0") != 0) - result |= 64; - return result; +sched_yield (); + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_infinite=yes +if ac_fn_c_try_link "$LINENO"; then : + LIB_SCHED_YIELD= + else - gl_cv_func_printf_infinite=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +$as_echo_n "checking for sched_yield in -lrt... " >&6; } +if ${ac_cv_lib_rt_sched_yield+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); +int +main () +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_rt_sched_yield=yes +else + ac_cv_lib_rt_sched_yield=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +$as_echo "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = xyes; then : + LIB_SCHED_YIELD=-lrt +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +$as_echo_n "checking for sched_yield in -lposix4... " >&6; } +if ${ac_cv_lib_posix4_sched_yield+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char sched_yield (); +int +main () +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_posix4_sched_yield=yes +else + ac_cv_lib_posix4_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +$as_echo "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = xyes; then : + LIB_SCHED_YIELD=-lposix4 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_infinite" >&5 -$as_echo "$gl_cv_func_printf_infinite" >&6; } +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + gl_pthreadlib_body_done=done + fi - if test -n "$gl_printf_safe"; then + if test $ac_cv_header_threads_h = yes; then + for ac_func in thrd_create +do : + ac_fn_c_check_func "$LINENO" "thrd_create" "ac_cv_func_thrd_create" +if test "x$ac_cv_func_thrd_create" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_THRD_CREATE 1 +_ACEOF -$as_echo "#define CHECK_PRINTF_SAFE 1" >>confdefs.h +fi +done - fi - case "$gl_cv_func_printf_long_double" in - *yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports infinite 'long double' arguments" >&5 -$as_echo_n "checking whether printf supports infinite 'long double' arguments... " >&6; } -if ${gl_cv_func_printf_infinite_long_double+:} false; then : + if test $ac_cv_func_thrd_create = yes; then + LIBSTDTHREAD= + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for thrd_create in -lstdthreads" >&5 +$as_echo_n "checking for thrd_create in -lstdthreads... " >&6; } +if ${ac_cv_lib_stdthreads_thrd_create+:} false; then : $as_echo_n "(cached) " >&6 else - - if test "$cross_compiling" = yes; then : - case "$host_cpu" in - # Guess no on ia64, x86_64, i386. - ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; - *) - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess yes on HP-UX >= 11. - hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; - hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_check_lib_save_LIBS=$LIBS +LIBS="-lstdthreads $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef _MSC_VER - Known +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" #endif - +char thrd_create (); +int +main () +{ +return thrd_create (); + ; + return 0; +} _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_infinite_long_double="guessing yes" +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_stdthreads_thrd_create=yes else - gl_cv_func_printf_infinite_long_double="guessing no" + ac_cv_lib_stdthreads_thrd_create=no fi -rm -f conftest* +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_stdthreads_thrd_create" >&5 +$as_echo "$ac_cv_lib_stdthreads_thrd_create" >&6; } +if test "x$ac_cv_lib_stdthreads_thrd_create" = xyes; then : - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";; - esac - ;; - esac + LIBSTDTHREAD='-lstdthreads -lpthread' else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + LIBSTDTHREAD="$LIBPMULTITHREAD" -#include -#if defined __MACH__ && defined __APPLE__ -/* Avoid a crash on Mac OS X. */ -#include -#include -#include -#include -#include -#include -/* The exception port on which our thread listens. */ -static mach_port_t our_exception_port; -/* The main function of the thread listening for exceptions of type - EXC_BAD_ACCESS. */ -static void * -mach_exception_thread (void *arg) -{ - /* Buffer for a message to be received. */ - struct { - mach_msg_header_t head; - mach_msg_body_t msgh_body; - char data[1024]; - } msg; - mach_msg_return_t retval; - /* Wait for a message on the exception port. */ - retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), - our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); - if (retval != MACH_MSG_SUCCESS) - abort (); - exit (1); +fi + + fi + else + LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" + fi + ;; + esac + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ISO C threads API is available" >&5 +$as_echo_n "checking whether ISO C threads API is available... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_threads_h" >&5 +$as_echo "$ac_cv_header_threads_h" >&6; } + gl_stdthreadlib_body_done=done + fi + + LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD + LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD + gl_threads_api=isoc + +$as_echo "#define USE_ISOC_THREADS 1" >>confdefs.h + + fi + fi + if test $gl_threads_api = none; then + case "$gl_use_threads" in + yes | windows | win32) # The 'win32' is for backward compatibility. + if { case "$host_os" in + mingw*) true;; + *) false;; + esac + }; then + gl_threads_api=windows + +$as_echo "#define USE_WINDOWS_THREADS 1" >>confdefs.h + + fi + ;; + esac + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for multithread API to use" >&5 +$as_echo_n "checking for multithread API to use... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_threads_api" >&5 +$as_echo "$gl_threads_api" >&6; } + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 +$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } +if ${gl_cv_func_lstat_dereferences_slashed_symlink+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f conftest.sym conftest.file + echo >conftest.file + if test "$cross_compiling" = yes; then : + case "$host_os" in + linux-* | linux) + # Guess yes on Linux systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + *-gnu* | gnu*) + # Guess yes on glibc systems. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;; + mingw*) + # Guess no on native Windows. + gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;; + *) + # If we don't know, obey --enable-cross-guesses. + gl_cv_func_lstat_dereferences_slashed_symlink="$gl_cross_guess_normal" ;; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +struct stat sbuf; + if (symlink ("conftest.file", "conftest.sym") != 0) + return 1; + /* Linux will dereference the symlink and fail, as required by + POSIX. That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + return lstat ("conftest.sym/", &sbuf) == 0; + + ; + return 0; } -static void -nocrash_init (void) +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_lstat_dereferences_slashed_symlink=yes +else + gl_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f conftest.sym conftest.file + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5 +$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; } + case "$gl_cv_func_lstat_dereferences_slashed_symlink" in + *yes) + +cat >>confdefs.h <<_ACEOF +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 +_ACEOF + + ;; + esac + + + GNULIB__EXIT=0; + GNULIB_ATOLL=0; + GNULIB_CALLOC_POSIX=0; + GNULIB_CANONICALIZE_FILE_NAME=0; + GNULIB_GETLOADAVG=0; + GNULIB_GETSUBOPT=0; + GNULIB_GRANTPT=0; + GNULIB_MALLOC_POSIX=0; + GNULIB_MBTOWC=0; + GNULIB_MKDTEMP=0; + GNULIB_MKOSTEMP=0; + GNULIB_MKOSTEMPS=0; + GNULIB_MKSTEMP=0; + GNULIB_MKSTEMPS=0; + GNULIB_POSIX_OPENPT=0; + GNULIB_PTSNAME=0; + GNULIB_PTSNAME_R=0; + GNULIB_PUTENV=0; + GNULIB_QSORT_R=0; + GNULIB_RANDOM=0; + GNULIB_RANDOM_R=0; + GNULIB_REALLOCARRAY=0; + GNULIB_REALLOC_POSIX=0; + GNULIB_REALPATH=0; + GNULIB_RPMATCH=0; + GNULIB_SECURE_GETENV=0; + GNULIB_SETENV=0; + GNULIB_STRTOD=0; + GNULIB_STRTOLD=0; + GNULIB_STRTOLL=0; + GNULIB_STRTOULL=0; + GNULIB_SYSTEM_POSIX=0; + GNULIB_UNLOCKPT=0; + GNULIB_UNSETENV=0; + GNULIB_WCTOMB=0; + HAVE__EXIT=1; + HAVE_ATOLL=1; + HAVE_CANONICALIZE_FILE_NAME=1; + HAVE_DECL_GETLOADAVG=1; + HAVE_GETSUBOPT=1; + HAVE_GRANTPT=1; + HAVE_INITSTATE=1; + HAVE_DECL_INITSTATE=1; + HAVE_MBTOWC=1; + HAVE_MKDTEMP=1; + HAVE_MKOSTEMP=1; + HAVE_MKOSTEMPS=1; + HAVE_MKSTEMP=1; + HAVE_MKSTEMPS=1; + HAVE_POSIX_OPENPT=1; + HAVE_PTSNAME=1; + HAVE_PTSNAME_R=1; + HAVE_QSORT_R=1; + HAVE_RANDOM=1; + HAVE_RANDOM_H=1; + HAVE_RANDOM_R=1; + HAVE_REALLOCARRAY=1; + HAVE_REALPATH=1; + HAVE_RPMATCH=1; + HAVE_SECURE_GETENV=1; + HAVE_SETENV=1; + HAVE_DECL_SETENV=1; + HAVE_SETSTATE=1; + HAVE_DECL_SETSTATE=1; + HAVE_STRTOD=1; + HAVE_STRTOLD=1; + HAVE_STRTOLL=1; + HAVE_STRTOULL=1; + HAVE_STRUCT_RANDOM_DATA=1; + HAVE_SYS_LOADAVG_H=0; + HAVE_UNLOCKPT=1; + HAVE_DECL_UNSETENV=1; + REPLACE_CALLOC=0; + REPLACE_CANONICALIZE_FILE_NAME=0; + REPLACE_INITSTATE=0; + REPLACE_MALLOC=0; + REPLACE_MBTOWC=0; + REPLACE_MKSTEMP=0; + REPLACE_PTSNAME=0; + REPLACE_PTSNAME_R=0; + REPLACE_PUTENV=0; + REPLACE_QSORT_R=0; + REPLACE_RANDOM=0; + REPLACE_RANDOM_R=0; + REPLACE_REALLOC=0; + REPLACE_REALPATH=0; + REPLACE_SETENV=0; + REPLACE_SETSTATE=0; + REPLACE_STRTOD=0; + REPLACE_STRTOLD=0; + REPLACE_UNSETENV=0; + REPLACE_WCTOMB=0; + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc, realloc, calloc are POSIX compliant" >&5 +$as_echo_n "checking whether malloc, realloc, calloc are POSIX compliant... " >&6; } +if ${gl_cv_func_malloc_posix+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () { - mach_port_t self = mach_task_self (); - /* Allocate a port on which the thread shall listen for exceptions. */ - if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) - == KERN_SUCCESS) { - /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ - if (mach_port_insert_right (self, our_exception_port, our_exception_port, - MACH_MSG_TYPE_MAKE_SEND) - == KERN_SUCCESS) { - /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting - for us. */ - exception_mask_t mask = EXC_MASK_BAD_ACCESS; - /* Create the thread listening on the exception port. */ - pthread_attr_t attr; - pthread_t thread; - if (pthread_attr_init (&attr) == 0 - && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 - && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { - pthread_attr_destroy (&attr); - /* Replace the exception port info for these exceptions with our own. - Note that we replace the exception port for the entire task, not only - for a particular thread. This has the effect that when our exception - port gets the message, the thread specific exception port has already - been asked, and we don't need to bother about it. - See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ - task_set_exception_ports (self, mask, our_exception_port, - EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); - } - } +#if defined _WIN32 && ! defined __CYGWIN__ + choke me + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_func_malloc_posix=yes +else + gl_cv_func_malloc_posix=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_malloc_posix" >&5 +$as_echo "$gl_cv_func_malloc_posix" >&6; } + + + + for ac_header in stdlib.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDLIB_H 1 +_ACEOF + +fi + +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +$as_echo_n "checking for GNU libc compatible malloc... " >&6; } +if ${ac_cv_func_malloc_0_nonnull+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess yes on platforms where we know the result. + *-gnu* | gnu* | *-musl* | freebsd* | netbsd* | openbsd* \ + | hpux* | solaris* | cygwin* | mingw*) + ac_cv_func_malloc_0_nonnull="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) ac_cv_func_malloc_0_nonnull="$gl_cross_guess_normal" ;; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H + # include + #else + char *malloc (); + #endif + +int +main () +{ +char *p = malloc (0); + int result = !p; + free (p); + return result; + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_malloc_0_nonnull=yes +else + ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } + case "$ac_cv_func_malloc_0_nonnull" in + *yes) + gl_cv_func_malloc_0_nonnull=1 + ;; + *) + gl_cv_func_malloc_0_nonnull=0 + ;; + esac + + +cat >>confdefs.h <<_ACEOF +#define MALLOC_0_IS_NONNULL $gl_cv_func_malloc_0_nonnull +_ACEOF + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a traditional japanese locale" >&5 +$as_echo_n "checking for a traditional japanese locale... " >&6; } +if ${gt_cv_locale_ja+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#if HAVE_LANGINFO_CODESET +# include +#endif +#include +#include +struct tm t; +char buf[16]; +int main () +{ + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else + if (setlocale (LC_ALL, "") == NULL) return 1; +# endif + /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + is empty, and the behaviour of Tcl 8.4 in this locale is not useful. + On OpenBSD 4.0, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "646". In this situation, + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ +# if HAVE_LANGINFO_CODESET + { + const char *cs = nl_langinfo (CODESET); + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) + return 1; + } +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check whether MB_CUR_MAX is > 1. This excludes the dysfunctional locales + on Cygwin 1.5.x. */ + if (MB_CUR_MAX == 1) + return 1; + /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. + This excludes the UTF-8 encoding (except on MirBSD). */ + { + const char *p; + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; + for (p = buf; *p != '\0'; p++) + if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) + return 1; + } + return 0; +#endif +} + +_ACEOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Note that on native Windows, the Japanese locale is + # Japanese_Japan.932, and CP932 is very different from EUC-JP, so we + # cannot use it here. + gt_cv_locale_ja=none + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the AIX locale name. + if (LC_ALL=ja_JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=ja_JP.EUC-JP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP.EUC-JP + else + # Test for the HP-UX, OSF/1, NetBSD locale name. + if (LC_ALL=ja_JP.eucJP LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP.eucJP + else + # Test for the IRIX, FreeBSD locale name. + if (LC_ALL=ja_JP.EUC LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja_JP.EUC + else + # Test for the Solaris 7 locale name. + if (LC_ALL=ja LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_ja=ja + else + # Special test for NetBSD 1.6. + if test -f /usr/share/locale/ja_JP.eucJP/LC_CTYPE; then + gt_cv_locale_ja=ja_JP.eucJP + else + # None found. + gt_cv_locale_ja=none + fi + fi + fi + fi + fi + fi + ;; + esac + fi + rm -fr conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_ja" >&5 +$as_echo "$gt_cv_locale_ja" >&6; } + LOCALE_JA=$gt_cv_locale_ja + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a french Unicode locale" >&5 +$as_echo_n "checking for a french Unicode locale... " >&6; } +if ${gt_cv_locale_fr_utf8+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#if HAVE_LANGINFO_CODESET +# include +#endif +#include +#include +struct tm t; +char buf[16]; +int main () { + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if !(defined __BEOS__ || defined __HAIKU__) + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; +# else + if (setlocale (LC_ALL, "") == NULL) return 1; +# endif + /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + is empty, and the behaviour of Tcl 8.4 in this locale is not useful. + On OpenBSD 4.0, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "646". In this situation, + some unit tests fail. */ +# if HAVE_LANGINFO_CODESET + { + const char *cs = nl_langinfo (CODESET); + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0) + return 1; } -} -#elif defined _WIN32 && ! defined __CYGWIN__ -/* Avoid a crash on native Windows. */ -#define WIN32_LEAN_AND_MEAN -#include -#include -static LONG WINAPI -exception_filter (EXCEPTION_POINTERS *ExceptionInfo) -{ - switch (ExceptionInfo->ExceptionRecord->ExceptionCode) - { - case EXCEPTION_ACCESS_VIOLATION: - case EXCEPTION_IN_PAGE_ERROR: - case EXCEPTION_STACK_OVERFLOW: - case EXCEPTION_GUARD_PAGE: - case EXCEPTION_PRIV_INSTRUCTION: - case EXCEPTION_ILLEGAL_INSTRUCTION: - case EXCEPTION_DATATYPE_MISALIGNMENT: - case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: - case EXCEPTION_NONCONTINUABLE_EXCEPTION: - exit (1); - } - return EXCEPTION_CONTINUE_SEARCH; -} -static void -nocrash_init (void) -{ - SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); -} -#else -/* Avoid a crash on POSIX systems. */ -#include -#include -/* A POSIX signal handler. */ -static void -exception_handler (int sig) -{ - _exit (1); -} -static void -nocrash_init (void) -{ -#ifdef SIGSEGV - signal (SIGSEGV, exception_handler); +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check whether in the abbreviation of the second month, the second + character (should be U+00E9: LATIN SMALL LETTER E WITH ACUTE) is + two bytes long, with UTF-8 encoding. */ + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%b", &t) < 4 + || buf[1] != (char) 0xc3 || buf[2] != (char) 0xa9 || buf[3] != 'v') + return 1; #endif -#ifdef SIGBUS - signal (SIGBUS, exception_handler); +#if !defined __BIONIC__ /* Bionic libc's 'struct lconv' is just a dummy. */ + /* Check whether the decimal separator is a comma. + On NetBSD 3.0 in the fr_FR.ISO8859-1 locale, localeconv()->decimal_point + are nl_langinfo(RADIXCHAR) are both ".". */ + if (localeconv () ->decimal_point[0] != ',') return 1; #endif + return 0; } -#endif -#include -#include +_ACEOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL=French_France.65001 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=French_France.65001 + else + # None found. + gt_cv_locale_fr_utf8=none + fi + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the usual locale name. + if (LC_ALL=fr_FR LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=fr_FR.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr_FR.UTF-8 + else + # Test for the Solaris 7 locale name. + if (LC_ALL=fr.UTF-8 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_fr_utf8=fr.UTF-8 + else + # None found. + gt_cv_locale_fr_utf8=none + fi + fi + fi + ;; + esac + fi + rm -fr conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_fr_utf8" >&5 +$as_echo "$gt_cv_locale_fr_utf8" >&6; } + LOCALE_FR_UTF8=$gt_cv_locale_fr_utf8 + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a transitional chinese locale" >&5 +$as_echo_n "checking for a transitional chinese locale... " >&6; } +if ${gt_cv_locale_zh_CN+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#if HAVE_LANGINFO_CODESET +# include +#endif +#include #include -static int -strisnan (const char *string, size_t start_index, size_t end_index) -{ - if (start_index < end_index) - { - if (string[start_index] == '-') - start_index++; - if (start_index + 3 <= end_index - && memcmp (string + start_index, "nan", 3) == 0) - { - start_index += 3; - if (start_index == end_index - || (string[start_index] == '(' && string[end_index - 1] == ')')) - return 1; - } - } - return 0; -} -static char buf[10000]; -static long double zeroL = 0.0L; +struct tm t; +char buf[16]; int main () { - int result = 0; - nocrash_init(); - if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 1; - if (sprintf (buf, "%Le", 1.0L / zeroL) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Le", -1.0L / zeroL) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Le", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 1; - if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0 - || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0 - || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) - result |= 1; - if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 1; -#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE -/* Representation of an 80-bit 'long double' as an initializer for a sequence - of 'unsigned int' words. */ -# ifdef WORDS_BIGENDIAN -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ - ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ - (unsigned int) (mantlo) << 16 \ - } + /* On BeOS and Haiku, locales are not implemented in libc. Rather, libintl + imitates locale dependent behaviour by looking at the environment + variables, and all locales use the UTF-8 encoding. */ +#if defined __BEOS__ || defined __HAIKU__ + return 1; +#else + /* Check whether the given locale name is recognized by the system. */ +# if defined _WIN32 && !defined __CYGWIN__ + /* On native Windows, setlocale(category, "") looks at the system settings, + not at the environment variables. Also, when an encoding suffix such + as ".65001" or ".54936" is specified, it succeeds but sets the LC_CTYPE + category of the locale to "C". */ + if (setlocale (LC_ALL, getenv ("LC_ALL")) == NULL + || strcmp (setlocale (LC_CTYPE, NULL), "C") == 0) + return 1; # else -# define LDBL80_WORDS(exponent,manthi,mantlo) \ - { mantlo, manthi, exponent } + if (setlocale (LC_ALL, "") == NULL) return 1; # endif - { /* Quiet NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - } + /* Check whether nl_langinfo(CODESET) is nonempty and not "ASCII" or "646". + On Mac OS X 10.3.5 (Darwin 7.5) in the fr_FR locale, nl_langinfo(CODESET) + is empty, and the behaviour of Tcl 8.4 in this locale is not useful. + On OpenBSD 4.0, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "646". In this situation, + some unit tests fail. + On MirBSD 10, when an unsupported locale is specified, setlocale() + succeeds but then nl_langinfo(CODESET) is "UTF-8". */ +# if HAVE_LANGINFO_CODESET { - /* Signalling NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Le", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - if (sprintf (buf, "%Lg", x.value) < 0 - || !strisnan (buf, 0, strlen (buf))) - result |= 2; - } - { /* Pseudo-NaN. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 4; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 4; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 4; - } - { /* Pseudo-Infinity. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 8; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 8; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 8; - } - { /* Pseudo-Zero. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 16; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 16; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 16; - } - { /* Unnormalized number. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 32; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 32; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 32; + const char *cs = nl_langinfo (CODESET); + if (cs[0] == '\0' || strcmp (cs, "ASCII") == 0 || strcmp (cs, "646") == 0 + || strcmp (cs, "UTF-8") == 0) + return 1; } - { /* Pseudo-Denormal. */ - static union { unsigned int word[4]; long double value; } x = - { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; - if (sprintf (buf, "%Lf", x.value) <= 0) - result |= 64; - if (sprintf (buf, "%Le", x.value) <= 0) - result |= 64; - if (sprintf (buf, "%Lg", x.value) <= 0) - result |= 64; +# endif +# ifdef __CYGWIN__ + /* On Cygwin, avoid locale names without encoding suffix, because the + locale_charset() function relies on the encoding suffix. Note that + LC_ALL is set on the command line. */ + if (strchr (getenv ("LC_ALL"), '.') == NULL) return 1; +# endif + /* Check whether in a month name, no byte in the range 0x80..0x9F occurs. + This excludes the UTF-8 encoding (except on MirBSD). */ + { + const char *p; + t.tm_year = 1975 - 1900; t.tm_mon = 2 - 1; t.tm_mday = 4; + if (strftime (buf, sizeof (buf), "%B", &t) < 2) return 1; + for (p = buf; *p != '\0'; p++) + if ((unsigned char) *p >= 0x80 && (unsigned char) *p < 0xa0) + return 1; } + /* Check whether a typical GB18030 multibyte sequence is recognized as a + single wide character. This excludes the GB2312 and GBK encodings. */ + if (mblen ("\203\062\332\066", 5) != 4) + return 1; + return 0; #endif - return result; } + _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_infinite_long_double=yes + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + case "$host_os" in + # Handle native Windows specially, because there setlocale() interprets + # "ar" as "Arabic" or "Arabic_Saudi Arabia.1256", + # "fr" or "fra" as "French" or "French_France.1252", + # "ge"(!) or "deu"(!) as "German" or "German_Germany.1252", + # "ja" as "Japanese" or "Japanese_Japan.932", + # and similar. + mingw*) + # Test for the hypothetical native Windows locale name. + if (LC_ALL=Chinese_China.54936 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=Chinese_China.54936 + else + # None found. + gt_cv_locale_zh_CN=none + fi + ;; + solaris2.8) + # On Solaris 8, the locales zh_CN.GB18030, zh_CN.GBK, zh.GBK are + # broken. One witness is the test case in gl_MBRTOWC_SANITYCHECK. + # Another witness is that "LC_ALL=zh_CN.GB18030 bash -c true" dumps core. + gt_cv_locale_zh_CN=none + ;; + *) + # Setting LC_ALL is not enough. Need to set LC_TIME to empty, because + # otherwise on Mac OS X 10.3.5 the LC_TIME=C from the beginning of the + # configure script would override the LC_ALL setting. Likewise for + # LC_CTYPE, which is also set at the beginning of the configure script. + # Test for the locale name without encoding suffix. + if (LC_ALL=zh_CN LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=zh_CN + else + # Test for the locale name with explicit encoding suffix. + if (LC_ALL=zh_CN.GB18030 LC_TIME= LC_CTYPE= ./conftest; exit) 2>/dev/null; then + gt_cv_locale_zh_CN=zh_CN.GB18030 + else + # None found. + gt_cv_locale_zh_CN=none + fi + fi + ;; + esac + else + # If there was a link error, due to mblen(), the system is so old that + # it certainly doesn't have a chinese locale. + gt_cv_locale_zh_CN=none + fi + rm -fr conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_locale_zh_CN" >&5 +$as_echo "$gt_cv_locale_zh_CN" >&6; } + LOCALE_ZH_CN=$gt_cv_locale_zh_CN + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 else - gl_cv_func_printf_infinite_long_double=no + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + + + + + + + GNULIB_EXPLICIT_BZERO=0; + GNULIB_FFSL=0; + GNULIB_FFSLL=0; + GNULIB_MEMCHR=0; + GNULIB_MEMMEM=0; + GNULIB_MEMPCPY=0; + GNULIB_MEMRCHR=0; + GNULIB_RAWMEMCHR=0; + GNULIB_STPCPY=0; + GNULIB_STPNCPY=0; + GNULIB_STRCHRNUL=0; + GNULIB_STRDUP=0; + GNULIB_STRNCAT=0; + GNULIB_STRNDUP=0; + GNULIB_STRNLEN=0; + GNULIB_STRPBRK=0; + GNULIB_STRSEP=0; + GNULIB_STRSTR=0; + GNULIB_STRCASESTR=0; + GNULIB_STRTOK_R=0; + GNULIB_MBSLEN=0; + GNULIB_MBSNLEN=0; + GNULIB_MBSCHR=0; + GNULIB_MBSRCHR=0; + GNULIB_MBSSTR=0; + GNULIB_MBSCASECMP=0; + GNULIB_MBSNCASECMP=0; + GNULIB_MBSPCASECMP=0; + GNULIB_MBSCASESTR=0; + GNULIB_MBSCSPN=0; + GNULIB_MBSPBRK=0; + GNULIB_MBSSPN=0; + GNULIB_MBSSEP=0; + GNULIB_MBSTOK_R=0; + GNULIB_STRERROR=0; + GNULIB_STRERROR_R=0; + GNULIB_STRSIGNAL=0; + GNULIB_STRVERSCMP=0; + HAVE_MBSLEN=0; + HAVE_EXPLICIT_BZERO=1; + HAVE_FFSL=1; + HAVE_FFSLL=1; + HAVE_MEMCHR=1; + HAVE_DECL_MEMMEM=1; + HAVE_MEMPCPY=1; + HAVE_DECL_MEMRCHR=1; + HAVE_RAWMEMCHR=1; + HAVE_STPCPY=1; + HAVE_STPNCPY=1; + HAVE_STRCHRNUL=1; + HAVE_DECL_STRDUP=1; + HAVE_DECL_STRNDUP=1; + HAVE_DECL_STRNLEN=1; + HAVE_STRPBRK=1; + HAVE_STRSEP=1; + HAVE_STRCASESTR=1; + HAVE_DECL_STRTOK_R=1; + HAVE_DECL_STRERROR_R=1; + HAVE_DECL_STRSIGNAL=1; + HAVE_STRVERSCMP=1; + REPLACE_MEMCHR=0; + REPLACE_MEMMEM=0; + REPLACE_STPNCPY=0; + REPLACE_STRCHRNUL=0; + REPLACE_STRDUP=0; + REPLACE_STRNCAT=0; + REPLACE_STRNDUP=0; + REPLACE_STRNLEN=0; + REPLACE_STRSTR=0; + REPLACE_STRCASESTR=0; + REPLACE_STRTOK_R=0; + REPLACE_STRERROR=0; + REPLACE_STRERROR_R=0; + REPLACE_STRSIGNAL=0; + UNDEFINE_STRTOK_R=0; -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_infinite_long_double" >&5 -$as_echo "$gl_cv_func_printf_infinite_long_double" >&6; } - ;; - *) - gl_cv_func_printf_infinite_long_double="irrelevant" - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'a' and 'A' directives" >&5 -$as_echo_n "checking whether printf supports the 'a' and 'A' directives... " >&6; } -if ${gl_cv_func_printf_directive_a+:} false; then : - $as_echo_n "(cached) " >&6 + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = xyes; then : + gl_have_mmap=yes else + gl_have_mmap=no +fi - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on glibc >= 2.5 systems. - *-gnu* | gnu*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +$as_echo_n "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - #ifdef __GNU_LIBRARY__ - #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ - BZ2908 - #endif - #endif +#include +#ifdef MAP_ANONYMOUS + I cannot identify this map +#endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "BZ2908" >/dev/null 2>&1; then : - gl_cv_func_printf_directive_a="guessing yes" -else - gl_cv_func_printf_directive_a="guessing no" + $EGREP "I cannot identify this map" >/dev/null 2>&1; then : + gl_have_mmap_anonymous=yes fi rm -f conftest* - ;; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_directive_a="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_a="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_printf_directive_a="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; - esac + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef MAP_ANON + I cannot identify this map +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cannot identify this map" >/dev/null 2>&1; then : + +$as_echo "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -f conftest* + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +$as_echo "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +$as_echo "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + if test $HAVE_MEMCHR = 1; then + # Detect platform-specific bugs in some versions of glibc: + # memchr should not dereference anything with length 0 + # https://bugzilla.redhat.com/show_bug.cgi?id=499689 + # memchr should not dereference overestimated length after a match + # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521737 + # https://sourceware.org/bugzilla/show_bug.cgi?id=10162 + # memchr should cast the second argument to 'unsigned char'. + # This bug exists in Android 4.3. + # Assume that memchr works on platforms that lack mprotect. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether memchr works" >&5 +$as_echo_n "checking whether memchr works... " >&6; } +if ${gl_cv_func_memchr_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess no on Android. + linux*-android*) gl_cv_func_memchr_works="guessing no" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_memchr_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_memchr_works="$gl_cross_guess_normal" ;; + esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include #include -static char buf[100]; -static double zero = 0.0; -int main () +#if HAVE_SYS_MMAN_H +# include +# include +# include +# include +# ifndef MAP_FILE +# define MAP_FILE 0 +# endif +#endif + +int +main () { + int result = 0; - if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 - || (strcmp (buf, "0x1.922p+1 33") != 0 - && strcmp (buf, "0x3.244p+0 33") != 0 - && strcmp (buf, "0x6.488p-1 33") != 0 - && strcmp (buf, "0xc.91p-2 33") != 0)) - result |= 1; - if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 - || (strcmp (buf, "-0X1.922P+1 33") != 0 - && strcmp (buf, "-0X3.244P+0 33") != 0 - && strcmp (buf, "-0X6.488P-1 33") != 0 - && strcmp (buf, "-0XC.91P-2 33") != 0)) - result |= 2; - /* This catches a FreeBSD 6.1 bug: it doesn't round. */ - if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 - || (strcmp (buf, "0x1.83p+0 33") != 0 - && strcmp (buf, "0x3.05p-1 33") != 0 - && strcmp (buf, "0x6.0ap-2 33") != 0 - && strcmp (buf, "0xc.14p-3 33") != 0)) - result |= 4; - /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ - if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 - || (strcmp (buf, "0x2p+0 33") != 0 - && strcmp (buf, "0x3p-1 33") != 0 - && strcmp (buf, "0x6p-2 33") != 0 - && strcmp (buf, "0xcp-3 33") != 0)) - result |= 4; - /* This catches a FreeBSD 6.1 bug. See - */ - if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 - || buf[0] == '0') - result |= 8; - /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ - if (sprintf (buf, "%.1a", 1.999) < 0 - || (strcmp (buf, "0x1.0p+1") != 0 - && strcmp (buf, "0x2.0p+0") != 0 - && strcmp (buf, "0x4.0p-1") != 0 - && strcmp (buf, "0x8.0p-2") != 0)) - result |= 16; - /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a - glibc 2.4 bug . */ - if (sprintf (buf, "%.1La", 1.999L) < 0 - || (strcmp (buf, "0x1.0p+1") != 0 - && strcmp (buf, "0x2.0p+0") != 0 - && strcmp (buf, "0x4.0p-1") != 0 - && strcmp (buf, "0x8.0p-2") != 0)) - result |= 32; + char *fence = NULL; +#if HAVE_SYS_MMAN_H && HAVE_MPROTECT +# if HAVE_MAP_ANONYMOUS + const int flags = MAP_ANONYMOUS | MAP_PRIVATE; + const int fd = -1; +# else /* !HAVE_MAP_ANONYMOUS */ + const int flags = MAP_FILE | MAP_PRIVATE; + int fd = open ("/dev/zero", O_RDONLY, 0666); + if (fd >= 0) +# endif + { + int pagesize = getpagesize (); + char *two_pages = + (char *) mmap (NULL, 2 * pagesize, PROT_READ | PROT_WRITE, + flags, fd, 0); + if (two_pages != (char *)(-1) + && mprotect (two_pages + pagesize, pagesize, PROT_NONE) == 0) + fence = two_pages + pagesize; + } +#endif + if (fence) + { + if (memchr (fence, 0, 0)) + result |= 1; + strcpy (fence - 9, "12345678"); + if (memchr (fence - 9, 0, 79) != fence - 1) + result |= 2; + if (memchr (fence - 1, 0, 3) != fence - 1) + result |= 4; + } + /* Test against bug on Android 4.3. */ + { + char input[3]; + input[0] = 'a'; + input[1] = 'b'; + input[2] = 'c'; + if (memchr (input, 0x789abc00 | 'b', 3) != input + 1) + result |= 8; + } return result; + + ; + return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_directive_a=yes + gl_cv_func_memchr_works=yes else - gl_cv_func_printf_directive_a=no + gl_cv_func_memchr_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -14764,110 +15786,217 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_a" >&5 -$as_echo "$gl_cv_func_printf_directive_a" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_memchr_works" >&5 +$as_echo "$gl_cv_func_memchr_works" >&6; } + case "$gl_cv_func_memchr_works" in + *yes) ;; + *) REPLACE_MEMCHR=1 ;; + esac + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'F' directive" >&5 -$as_echo_n "checking whether printf supports the 'F' directive... " >&6; } -if ${gl_cv_func_printf_directive_f+:} false; then : - $as_echo_n "(cached) " >&6 + + + if test $ac_cv_func__set_invalid_parameter_handler = yes; then + HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 + +$as_echo "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h + + else + HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 + fi + + + + + + + + + + + GNULIB_PTHREAD_SIGMASK=0; + GNULIB_RAISE=0; + GNULIB_SIGNAL_H_SIGPIPE=0; + GNULIB_SIGPROCMASK=0; + GNULIB_SIGACTION=0; + HAVE_POSIX_SIGNALBLOCKING=1; + HAVE_PTHREAD_SIGMASK=1; + HAVE_RAISE=1; + HAVE_SIGSET_T=1; + HAVE_SIGINFO_T=1; + HAVE_SIGACTION=1; + HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; + + HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; + + HAVE_SIGHANDLER_T=1; + REPLACE_PTHREAD_SIGMASK=0; + REPLACE_RAISE=0; + + + ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" " + #include + /* Mingw defines sigset_t not in , but in . */ + #include + +" +if test "x$ac_cv_type_sigset_t" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIGSET_T 1 +_ACEOF + +gl_cv_type_sigset_t=yes else + gl_cv_type_sigset_t=no +fi - if test "$cross_compiling" = yes; then : + if test $gl_cv_type_sigset_t != yes; then + HAVE_SIGSET_T=0 + fi - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on FreeBSD >= 6. - freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; - freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on Mac OS X >= 10.3. - darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; - darwin*) gl_cv_func_printf_directive_f="guessing yes";; - # Guess yes on Solaris >= 2.10. - solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";; - solaris*) gl_cv_func_printf_directive_f="guessing no";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_f="guessing no";; - # Guess yes on MSVC, no on mingw. - mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C Library >= 2.1 or uClibc" >&5 +$as_echo_n "checking whether we are using the GNU C Library >= 2.1 or uClibc... " >&6; } +if ${ac_cv_gnu_library_2_1+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#ifdef _MSC_VER - Known +#include +#ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif +#endif +#ifdef __UCLIBC__ + Lucky user #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "Known" >/dev/null 2>&1; then : - gl_cv_func_printf_directive_f="guessing yes" + $EGREP "Lucky" >/dev/null 2>&1; then : + ac_cv_gnu_library_2_1=yes else - gl_cv_func_printf_directive_f="guessing no" + ac_cv_gnu_library_2_1=no fi rm -f conftest* - ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_directive_f="$gl_cross_guess_normal";; - esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gnu_library_2_1" >&5 +$as_echo "$ac_cv_gnu_library_2_1" >&6; } + + GLIBC21="$ac_cv_gnu_library_2_1" + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +$as_echo_n "checking for uid_t in sys/types.h... " >&6; } +if ${ac_cv_type_uid_t+:} false; then : + $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include -#include -#include -static char buf[100]; -static double zero = 0.0; -int main () -{ - int result = 0; - if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 - || strcmp (buf, "1234567.000000 33") != 0) - result |= 1; - if (sprintf (buf, "%F", 1.0 / zero) < 0 - || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) - result |= 2; - /* This catches a Cygwin 1.5.x bug. */ - if (sprintf (buf, "%.F", 1234.0) < 0 - || strcmp (buf, "1234") != 0) - result |= 4; - return result; -} _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_directive_f=yes +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1; then : + ac_cv_type_uid_t=yes else - gl_cv_func_printf_directive_f=no + ac_cv_type_uid_t=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f conftest* + fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 +$as_echo "$ac_cv_type_uid_t" >&6; } +if test $ac_cv_type_uid_t = no; then + +$as_echo "#define uid_t int" >>confdefs.h + +$as_echo "#define gid_t int" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_f" >&5 -$as_echo "$gl_cv_func_printf_directive_f" >&6; } + +: - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'n' directive" >&5 -$as_echo_n "checking whether printf supports the 'n' directive... " >&6; } -if ${gl_cv_func_printf_directive_n+:} false; then : + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether snprintf returns a byte count as in C99" >&5 +$as_echo_n "checking whether snprintf returns a byte count as in C99... " >&6; } +if ${gl_cv_func_snprintf_retval_c99+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_n="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_printf_directive_n="guessing no";; - *) gl_cv_func_printf_directive_n="guessing yes";; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_snprintf_retval_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_snprintf_retval_c99="guessing no";; + darwin*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_snprintf_retval_c99="guessing no";; + openbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; + # Guess yes on AIX >= 4. + aix[1-3]*) gl_cv_func_snprintf_retval_c99="guessing no";; + aix*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_snprintf_retval_c99="guessing no";; + netbsd*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_snprintf_retval_c99="guessing yes";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : + gl_cv_func_snprintf_retval_c99="guessing yes" +else + gl_cv_func_snprintf_retval_c99="guessing no" +fi +rm -f conftest* + + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_snprintf_retval_c99="$gl_cross_guess_normal";; esac else @@ -14875,42 +16004,38 @@ /* end confdefs.h. */ #include -#include #include -#ifdef _MSC_VER -/* See page about "Parameter Validation" on msdn.microsoft.com. */ -static void cdecl -invalid_parameter_handler (const wchar_t *expression, - const wchar_t *function, - const wchar_t *file, unsigned int line, - uintptr_t dummy) +#if HAVE_SNPRINTF +# define my_snprintf snprintf +#else +# include +static int my_snprintf (char *buf, int size, const char *format, ...) { - exit (1); + va_list args; + int ret; + va_start (args, format); + ret = vsnprintf (buf, size, format, args); + va_end (args); + return ret; } #endif -static char fmtstring[10]; -static char buf[100]; -int main () -{ - int count = -1; -#ifdef _MSC_VER - _set_invalid_parameter_handler (invalid_parameter_handler); -#endif - /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) - support %n in format strings in read-only memory but not in writable - memory. */ - strcpy (fmtstring, "%d %n"); - if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 - || strcmp (buf, "123 ") != 0 - || count != 4) +static char buf[100]; +int main () +{ + strcpy (buf, "ABCDEF"); + if (my_snprintf (buf, 3, "%d %d", 4567, 89) != 7) return 1; + if (my_snprintf (buf, 0, "%d %d", 4567, 89) != 7) + return 2; + if (my_snprintf (NULL, 0, "%d %d", 4567, 89) != 7) + return 3; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_directive_n=yes + gl_cv_func_snprintf_retval_c99=yes else - gl_cv_func_printf_directive_n=no + gl_cv_func_snprintf_retval_c99=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -14918,192 +16043,195 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_n" >&5 -$as_echo "$gl_cv_func_printf_directive_n" >&6; } - - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_snprintf_retval_c99" >&5 +$as_echo "$gl_cv_func_snprintf_retval_c99" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'ls' directive" >&5 -$as_echo_n "checking whether printf supports the 'ls' directive... " >&6; } -if ${gl_cv_func_printf_directive_ls+:} false; then : - $as_echo_n "(cached) " >&6 +ac_fn_c_check_decl "$LINENO" "snprintf" "ac_cv_have_decl_snprintf" "$ac_includes_default" +if test "x$ac_cv_have_decl_snprintf" = xyes; then : + ac_have_decl=1 else + ac_have_decl=0 +fi - if test "$cross_compiling" = yes; then : +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF $ac_have_decl +_ACEOF - case "$host_os" in - openbsd*) gl_cv_func_printf_directive_ls="guessing no";; - irix*) gl_cv_func_printf_directive_ls="guessing no";; - solaris*) gl_cv_func_printf_directive_ls="guessing no";; - cygwin*) gl_cv_func_printf_directive_ls="guessing no";; - beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; - # Guess yes on native Windows. - mingw*) gl_cv_func_printf_directive_ls="guessing yes";; - *) gl_cv_func_printf_directive_ls="guessing yes";; - esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdint.h" >&5 +$as_echo_n "checking for stdint.h... " >&6; } +if ${gl_cv_header_stdint_h+:} false; then : + $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - -/* Tru64 with Desktop Toolkit C has a bug: must be included before - . - BSD/OS 4.0.1 has a bug: , and must be - included before . */ -#include -#include -#include -#include -#include -int main () +#include + #include +int +main () { - int result = 0; - char buf[100]; - /* Test whether %ls works at all. - This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on - Cygwin 1.5. */ - { - static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; - buf[0] = '\0'; - if (sprintf (buf, "%ls", wstring) < 0 - || strcmp (buf, "abc") != 0) - result |= 1; - } - /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an - assertion failure inside libc), but not on OpenBSD 4.0. */ - { - static const wchar_t wstring[] = { 'a', 0 }; - buf[0] = '\0'; - if (sprintf (buf, "%ls", wstring) < 0 - || strcmp (buf, "a") != 0) - result |= 2; - } - /* Test whether precisions in %ls are supported as specified in ISO C 99 - section 7.19.6.1: - "If a precision is specified, no more than that many bytes are written - (including shift sequences, if any), and the array shall contain a - null wide character if, to equal the multibyte character sequence - length given by the precision, the function would need to access a - wide character one past the end of the array." - This test fails on Solaris 10. */ - { - static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 }; - buf[0] = '\0'; - if (sprintf (buf, "%.2ls", wstring) < 0 - || strcmp (buf, "ab") != 0) - result |= 8; - } - return result; +uintmax_t i = (uintmax_t) -1; return !i; + ; + return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_directive_ls=yes +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_stdint_h=yes else - gl_cv_func_printf_directive_ls=no + gl_cv_header_stdint_h=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_h" >&5 +$as_echo "$gl_cv_header_stdint_h" >&6; } + if test $gl_cv_header_stdint_h = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_STDINT_H_WITH_UINTMAX 1 +_ACEOF -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_ls" >&5 -$as_echo "$gl_cv_func_printf_directive_ls" >&6; } - + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the grouping flag" >&5 -$as_echo_n "checking whether printf supports the grouping flag... " >&6; } -if ${gl_cv_func_printf_flag_grouping+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inttypes.h" >&5 +$as_echo_n "checking for inttypes.h... " >&6; } +if ${gl_cv_header_inttypes_h+:} false; then : $as_echo_n "(cached) " >&6 else - - if test "$cross_compiling" = yes; then : - - case "$host_os" in - cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; - netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; - # Guess no on native Windows. - mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; - *) gl_cv_func_printf_flag_grouping="guessing yes";; - esac - -else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include -static char buf[100]; -int main () +#include +#include + +int +main () { - if (sprintf (buf, "%'d %d", 1234567, 99) < 0 - || buf[strlen (buf) - 1] != '9') - return 1; +uintmax_t i = (uintmax_t) -1; return !i; + ; return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_flag_grouping=yes +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_inttypes_h=yes else - gl_cv_func_printf_flag_grouping=no + gl_cv_header_inttypes_h=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_inttypes_h" >&5 +$as_echo "$gl_cv_header_inttypes_h" >&6; } + if test $gl_cv_header_inttypes_h = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_INTTYPES_H_WITH_UINTMAX 1 +_ACEOF -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_grouping" >&5 -$as_echo "$gl_cv_func_printf_flag_grouping" >&6; } + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the left-adjust flag correctly" >&5 -$as_echo_n "checking whether printf supports the left-adjust flag correctly... " >&6; } -if ${gl_cv_func_printf_flag_leftadjust+:} false; then : + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports size specifiers as in C99" >&5 +$as_echo_n "checking whether printf supports size specifiers as in C99... " >&6; } +if ${gl_cv_func_printf_sizes_c99+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess yes on HP-UX 11. - hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess no on HP-UX 10 and older. - hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess yes on native Windows. - mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; - # Guess yes otherwise. - *) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on FreeBSD >= 5. + freebsd[1-4].*) gl_cv_func_printf_sizes_c99="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_sizes_c99="guessing no";; + darwin*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on OpenBSD >= 3.9. + openbsd[1-2].* | openbsd3.[0-8] | openbsd3.[0-8].*) + gl_cv_func_printf_sizes_c99="guessing no";; + openbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[1-9][0-9]*) gl_cv_func_printf_sizes_c99="guessing yes";; + solaris*) gl_cv_func_printf_sizes_c99="guessing no";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_sizes_c99="guessing no";; + netbsd*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_sizes_c99="guessing yes";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : + gl_cv_func_printf_sizes_c99="guessing yes" +else + gl_cv_func_printf_sizes_c99="guessing no" +fi +rm -f conftest* + + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_sizes_c99="$gl_cross_guess_normal";; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include #include #include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +# include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +# include +#endif static char buf[100]; int main () { - /* Check that a '-' flag is not annihilated by a negative width. */ - if (sprintf (buf, "a%-*sc", -3, "b") < 0 - || strcmp (buf, "ab c") != 0) - return 1; - return 0; + int result = 0; +#if HAVE_STDINT_H_WITH_UINTMAX || HAVE_INTTYPES_H_WITH_UINTMAX + buf[0] = '\0'; + if (sprintf (buf, "%ju %d", (uintmax_t) 12345671, 33, 44, 55) < 0 + || strcmp (buf, "12345671 33") != 0) + result |= 1; +#else + result |= 1; +#endif + buf[0] = '\0'; + if (sprintf (buf, "%zu %d", (size_t) 12345672, 33, 44, 55) < 0 + || strcmp (buf, "12345672 33") != 0) + result |= 2; + buf[0] = '\0'; + if (sprintf (buf, "%tu %d", (ptrdiff_t) 12345673, 33, 44, 55) < 0 + || strcmp (buf, "12345673 33") != 0) + result |= 4; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", (long double) 1.5, 33, 44, 55) < 0 + || strcmp (buf, "1.5 33") != 0) + result |= 8; + return result; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_flag_leftadjust=yes + gl_cv_func_printf_sizes_c99=yes else - gl_cv_func_printf_flag_leftadjust=no + gl_cv_func_printf_sizes_c99=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -15111,32 +16239,42 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_leftadjust" >&5 -$as_echo "$gl_cv_func_printf_flag_leftadjust" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_sizes_c99" >&5 +$as_echo "$gl_cv_func_printf_sizes_c99" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the zero flag correctly" >&5 -$as_echo_n "checking whether printf supports the zero flag correctly... " >&6; } -if ${gl_cv_func_printf_flag_zero+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports 'long double' arguments" >&5 +$as_echo_n "checking whether printf supports 'long double' arguments... " >&6; } +if ${gl_cv_func_printf_long_double+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess no on BeOS. + beos*) gl_cv_func_printf_long_double="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_long_double="guessing yes";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on musl systems. - *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_flag_zero="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; - # Guess no on native Windows. - mingw*) gl_cv_func_printf_flag_zero="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : + gl_cv_func_printf_long_double="guessing yes" +else + gl_cv_func_printf_long_double="guessing no" +fi +rm -f conftest* + + ;; + *) gl_cv_func_printf_long_double="guessing yes";; esac else @@ -15145,21 +16283,29 @@ #include #include -static char buf[100]; -static double zero = 0.0; +static char buf[10000]; int main () { - if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0 - || (strcmp (buf, " inf") != 0 - && strcmp (buf, " infinity") != 0)) - return 1; - return 0; + int result = 0; + buf[0] = '\0'; + if (sprintf (buf, "%Lf %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000 33") != 0) + result |= 1; + buf[0] = '\0'; + if (sprintf (buf, "%Le %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.750000e+00 33") != 0) + result |= 2; + buf[0] = '\0'; + if (sprintf (buf, "%Lg %d", 1.75L, 33, 44, 55) < 0 + || strcmp (buf, "1.75 33") != 0) + result |= 4; + return result; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_flag_zero=yes + gl_cv_func_printf_long_double=yes else - gl_cv_func_printf_flag_zero=no + gl_cv_func_printf_long_double=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -15167,27 +16313,61 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_zero" >&5 -$as_echo "$gl_cv_func_printf_flag_zero" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_long_double" >&5 +$as_echo "$gl_cv_func_printf_long_double" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports large precisions" >&5 -$as_echo_n "checking whether printf supports large precisions... " >&6; } -if ${gl_cv_func_printf_precision+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports infinite 'double' arguments" >&5 +$as_echo_n "checking whether printf supports infinite 'double' arguments... " >&6; } +if ${gl_cv_func_printf_infinite+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : case "$host_os" in - # Guess no only on Solaris, native Windows, and BeOS systems. - solaris*) gl_cv_func_printf_precision="guessing no" ;; - mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; - beos*) gl_cv_func_printf_precision="guessing no" ;; - # Guess yes on Android. - linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; - *) gl_cv_func_printf_precision="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5].*) gl_cv_func_printf_infinite="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_infinite="guessing no";; + darwin*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite="guessing no";; + hpux*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on NetBSD >= 3. + netbsd[1-2]* | netbsdelf[1-2]* | netbsdaout[1-2]* | netbsdcoff[1-2]*) + gl_cv_func_printf_infinite="guessing no";; + netbsd*) gl_cv_func_printf_infinite="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_infinite="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_infinite="guessing no";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : + gl_cv_func_printf_infinite="guessing yes" +else + gl_cv_func_printf_infinite="guessing no" +fi +rm -f conftest* + + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_infinite="$gl_cross_guess_normal";; esac else @@ -15196,31 +16376,75 @@ #include #include -static char buf[5000]; +static int +strisnan (const char *string, size_t start_index, size_t end_index) +{ + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static int +have_minus_zero () +{ + static double plus_zero = 0.0; + double minus_zero = - plus_zero; + return memcmp (&plus_zero, &minus_zero, sizeof (double)) != 0; +} +static char buf[10000]; +static double zero = 0.0; int main () { int result = 0; -#ifdef __BEOS__ - /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ - return 1; -#endif - if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) + if (sprintf (buf, "%f", 1.0 / zero) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 1; - if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) + if (sprintf (buf, "%f", -1.0 / zero) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 1; + if (sprintf (buf, "%f", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) result |= 2; - if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5 - || buf[0] != '1') + if (sprintf (buf, "%e", 1.0 / zero) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) result |= 4; - if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5 - || buf[0] != '1') + if (sprintf (buf, "%e", -1.0 / zero) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) result |= 4; + if (sprintf (buf, "%e", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 8; + if (sprintf (buf, "%g", 1.0 / zero) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 16; + if (sprintf (buf, "%g", -1.0 / zero) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 16; + if (sprintf (buf, "%g", zero / zero) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 32; + /* This test fails on HP-UX 10.20. */ + if (have_minus_zero ()) + if (sprintf (buf, "%g", - zero) < 0 + || strcmp (buf, "-0") != 0) + result |= 64; return result; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_func_printf_precision=yes + gl_cv_func_printf_infinite=yes else - gl_cv_func_printf_precision=no + gl_cv_func_printf_infinite=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -15228,22 +16452,71 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_precision" >&5 -$as_echo "$gl_cv_func_printf_precision" >&6; } - - +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_infinite" >&5 +$as_echo "$gl_cv_func_printf_infinite" >&6; } + + + + + + + if test -n "$gl_printf_safe"; then + +$as_echo "#define CHECK_PRINTF_SAFE 1" >>confdefs.h + + fi + case "$gl_cv_func_printf_long_double" in + *yes) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports infinite 'long double' arguments" >&5 +$as_echo_n "checking whether printf supports infinite 'long double' arguments... " >&6; } +if ${gl_cv_func_printf_infinite_long_double+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test "$cross_compiling" = yes; then : + case "$host_cpu" in + # Guess no on ia64, x86_64, i386. + ia64 | x86_64 | i*86) gl_cv_func_printf_infinite_long_double="guessing no";; + *) + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5].*) gl_cv_func_printf_infinite_long_double="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess yes on HP-UX >= 11. + hpux[7-9]* | hpux10*) gl_cv_func_printf_infinite_long_double="guessing no";; + hpux*) gl_cv_func_printf_infinite_long_double="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_infinite_long_double="guessing no";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Known +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : + gl_cv_func_printf_infinite_long_double="guessing yes" +else + gl_cv_func_printf_infinite_long_double="guessing no" +fi +rm -f conftest* + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_infinite_long_double="$gl_cross_guess_normal";; + esac + ;; + esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf survives out-of-memory conditions" >&5 -$as_echo_n "checking whether printf survives out-of-memory conditions... " >&6; } -if ${gl_cv_func_printf_enomem+:} false; then : - $as_echo_n "(cached) " >&6 else - - gl_cv_func_printf_enomem="guessing no" - if test "$cross_compiling" = no; then - if test $APPLE_UNIVERSAL_BUILD = 0; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -15267,7 +16540,7 @@ struct { mach_msg_header_t head; mach_msg_body_t msgh_body; - char data1024; + char data[1024]; } msg; mach_msg_return_t retval; /* Wait for a message on the exception port. */ @@ -15360,722 +16633,627 @@ } #endif +#include #include -#include -#include -#include -#include -int main() +#include +static int +strisnan (const char *string, size_t start_index, size_t end_index) { - struct rlimit limit; - int ret; - nocrash_init (); - /* Some printf implementations allocate temporary space with malloc. */ - /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ -#ifdef RLIMIT_DATA - if (getrlimit (RLIMIT_DATA, &limit) < 0) - return 77; - if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) - limit.rlim_max = 5000000; - limit.rlim_cur = limit.rlim_max; - if (setrlimit (RLIMIT_DATA, &limit) < 0) - return 77; -#endif - /* On Linux systems, malloc() is limited by RLIMIT_AS. */ -#ifdef RLIMIT_AS - if (getrlimit (RLIMIT_AS, &limit) < 0) - return 77; - if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) - limit.rlim_max = 5000000; - limit.rlim_cur = limit.rlim_max; - if (setrlimit (RLIMIT_AS, &limit) < 0) - return 77; -#endif - /* Some printf implementations allocate temporary space on the stack. */ -#ifdef RLIMIT_STACK - if (getrlimit (RLIMIT_STACK, &limit) < 0) - return 77; - if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) - limit.rlim_max = 5000000; - limit.rlim_cur = limit.rlim_max; - if (setrlimit (RLIMIT_STACK, &limit) < 0) - return 77; + if (start_index < end_index) + { + if (string[start_index] == '-') + start_index++; + if (start_index + 3 <= end_index + && memcmp (string + start_index, "nan", 3) == 0) + { + start_index += 3; + if (start_index == end_index + || (string[start_index] == '(' && string[end_index - 1] == ')')) + return 1; + } + } + return 0; +} +static char buf[10000]; +static long double zeroL = 0.0L; +int main () +{ + int result = 0; + nocrash_init(); + if (sprintf (buf, "%Lf", 1.0L / zeroL) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Lf", -1.0L / zeroL) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Lf", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 1; + if (sprintf (buf, "%Le", 1.0L / zeroL) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Le", -1.0L / zeroL) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Le", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 1; + if (sprintf (buf, "%Lg", 1.0L / zeroL) < 0 + || (strcmp (buf, "inf") != 0 && strcmp (buf, "infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Lg", -1.0L / zeroL) < 0 + || (strcmp (buf, "-inf") != 0 && strcmp (buf, "-infinity") != 0)) + result |= 1; + if (sprintf (buf, "%Lg", zeroL / zeroL) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 1; +#if CHECK_PRINTF_SAFE && ((defined __ia64 && LDBL_MANT_DIG == 64) || (defined __x86_64__ || defined __amd64__) || (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_)) && !HAVE_SAME_LONG_DOUBLE_AS_DOUBLE +/* Representation of an 80-bit 'long double' as an initializer for a sequence + of 'unsigned int' words. */ +# ifdef WORDS_BIGENDIAN +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { ((unsigned int) (exponent) << 16) | ((unsigned int) (manthi) >> 16), \ + ((unsigned int) (manthi) << 16) | ((unsigned int) (mantlo) >> 16), \ + (unsigned int) (mantlo) << 16 \ + } +# else +# define LDBL80_WORDS(exponent,manthi,mantlo) \ + { mantlo, manthi, exponent } +# endif + { /* Quiet NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0xC3333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + } + { + /* Signalling NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + if (sprintf (buf, "%Le", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + if (sprintf (buf, "%Lg", x.value) < 0 + || !strisnan (buf, 0, strlen (buf))) + result |= 2; + } + { /* Pseudo-NaN. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x40000001, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 4; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 4; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 4; + } + { /* Pseudo-Infinity. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0xFFFF, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 8; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 8; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 8; + } + { /* Pseudo-Zero. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4004, 0x00000000, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 16; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 16; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 16; + } + { /* Unnormalized number. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x4000, 0x63333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 32; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 32; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 32; + } + { /* Pseudo-Denormal. */ + static union { unsigned int word[4]; long double value; } x = + { LDBL80_WORDS (0x0000, 0x83333333, 0x00000000) }; + if (sprintf (buf, "%Lf", x.value) <= 0) + result |= 64; + if (sprintf (buf, "%Le", x.value) <= 0) + result |= 64; + if (sprintf (buf, "%Lg", x.value) <= 0) + result |= 64; + } #endif - ret = printf ("%.5000000f", 1.0); - return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); + return result; } - _ACEOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then - (./conftest 2>&5 - result=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $result" >&5 - if test $result != 0 && test $result != 77; then result=1; fi - exit $result - ) >/dev/null 2>/dev/null - case $? in - 0) gl_cv_func_printf_enomem="yes" ;; - 77) gl_cv_func_printf_enomem="guessing no" ;; - *) gl_cv_func_printf_enomem="no" ;; - esac - else - gl_cv_func_printf_enomem="guessing no" - fi - rm -fr conftest* - else - gl_cv_func_printf_enomem="guessing no" - fi - fi - if test "$gl_cv_func_printf_enomem" = "guessing no"; then - case "$host_os" in - # Guess yes on glibc systems. - *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on Solaris. - solaris*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on AIX. - aix*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on HP-UX/hppa. - hpux*) case "$host_cpu" in - hppa*) gl_cv_func_printf_enomem="guessing yes";; - *) gl_cv_func_printf_enomem="guessing no";; - esac - ;; - # Guess yes on IRIX. - irix*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on OSF/1. - osf*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on BeOS. - beos*) gl_cv_func_printf_enomem="guessing yes";; - # Guess yes on Haiku. - haiku*) gl_cv_func_printf_enomem="guessing yes";; - # Guess no on Android. - linux*-android*) gl_cv_func_printf_enomem="guessing no";; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_printf_enomem="$gl_cross_guess_normal";; - esac - fi - +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_printf_infinite_long_double=yes +else + gl_cv_func_printf_infinite_long_double=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_enomem" >&5 -$as_echo "$gl_cv_func_printf_enomem" >&6; } - - case "$gl_cv_func_printf_long_double" in - *yes) +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_infinite_long_double" >&5 +$as_echo "$gl_cv_func_printf_infinite_long_double" >&6; } ;; *) - -$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - + gl_cv_func_printf_infinite_long_double="irrelevant" ;; esac - - - - - if test $ac_cv_header_features_h = yes; then - HAVE_FEATURES_H=1 - else - HAVE_FEATURES_H=0 - fi - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intmax_t" >&5 -$as_echo_n "checking for intmax_t... " >&6; } -if ${gt_cv_c_intmax_t+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'a' and 'A' directives" >&5 +$as_echo_n "checking whether printf supports the 'a' and 'A' directives... " >&6; } +if ${gl_cv_func_printf_directive_a+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#if HAVE_STDINT_H_WITH_UINTMAX -#include -#endif -#if HAVE_INTTYPES_H_WITH_UINTMAX -#include -#endif - -int -main () -{ -intmax_t x = -1; return !x; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gt_cv_c_intmax_t=yes -else - gt_cv_c_intmax_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_intmax_t" >&5 -$as_echo "$gt_cv_c_intmax_t" >&6; } - if test $gt_cv_c_intmax_t = yes; then - -$as_echo "#define HAVE_INTMAX_T 1" >>confdefs.h - - else - - test $ac_cv_type_long_long_int = yes \ - && ac_type='long long' \ - || ac_type='long' - -cat >>confdefs.h <<_ACEOF -#define intmax_t $ac_type -_ACEOF - - fi - - + if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess yes on glibc >= 2.5 systems. + *-gnu* | gnu*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + #include + #ifdef __GNU_LIBRARY__ + #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 5) || (__GLIBC__ > 2)) && !defined __UCLIBC__ + BZ2908 + #endif + #endif - for ac_func in snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF - -fi -done - - ac_fn_c_check_decl "$LINENO" "_snprintf" "ac_cv_have_decl__snprintf" "#include -" -if test "x$ac_cv_have_decl__snprintf" = xyes; then : - ac_have_decl=1 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "BZ2908" >/dev/null 2>&1; then : + gl_cv_func_printf_directive_a="guessing yes" else - ac_have_decl=0 + gl_cv_func_printf_directive_a="guessing no" fi +rm -f conftest* -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL__SNPRINTF $ac_have_decl -_ACEOF - - - - case "$gl_cv_func_snprintf_retval_c99" in - *yes) - -$as_echo "#define HAVE_SNPRINTF_RETVAL_C99 1" >>confdefs.h - - ;; - esac + ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_directive_a="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_a="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_printf_directive_a="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_directive_a="$gl_cross_guess_normal";; + esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 -$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } -if ${ac_cv_header_stdbool_h+:} false; then : - $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - #include - - #ifdef __cplusplus - typedef bool Bool; - #else - typedef _Bool Bool; - #ifndef bool - "error: bool is not defined" - #endif - #ifndef false - "error: false is not defined" - #endif - #if false - "error: false is not 0" - #endif - #ifndef true - "error: true is not defined" - #endif - #if true != 1 - "error: true is not 1" - #endif - #endif - - #ifndef __bool_true_false_are_defined - "error: __bool_true_false_are_defined is not defined" - #endif - - struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; - - char a[true == 1 ? 1 : -1]; - char b[false == 0 ? 1 : -1]; - char c[__bool_true_false_are_defined == 1 ? 1 : -1]; - char d[(bool) 0.5 == true ? 1 : -1]; - /* See body of main program for 'e'. */ - char f[(Bool) 0.0 == false ? 1 : -1]; - char g[true]; - char h[sizeof (Bool)]; - char i[sizeof s.t]; - enum { j = false, k = true, l = false * true, m = true * 256 }; - /* The following fails for - HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ - Bool n[m]; - char o[sizeof n == m * sizeof n[0] ? 1 : -1]; - char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; - /* Catch a bug in an HP-UX C compiler. See - https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html - https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html - */ - Bool q = true; - Bool *pq = &q; - bool *qq = &q; - -int -main () +#include +#include +static char buf[100]; +static double zero = 0.0; +int main () { - - bool e = &s; - *pq |= q; *pq |= ! q; - *qq |= q; *qq |= ! q; - /* Refer to every declared value, to avoid compiler optimizations. */ - return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l - + !m + !n + !o + !p + !q + !pq + !qq); - - ; - return 0; + int result = 0; + if (sprintf (buf, "%a %d", 3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.922p+1 33") != 0 + && strcmp (buf, "0x3.244p+0 33") != 0 + && strcmp (buf, "0x6.488p-1 33") != 0 + && strcmp (buf, "0xc.91p-2 33") != 0)) + result |= 1; + if (sprintf (buf, "%A %d", -3.1416015625, 33, 44, 55) < 0 + || (strcmp (buf, "-0X1.922P+1 33") != 0 + && strcmp (buf, "-0X3.244P+0 33") != 0 + && strcmp (buf, "-0X6.488P-1 33") != 0 + && strcmp (buf, "-0XC.91P-2 33") != 0)) + result |= 2; + /* This catches a FreeBSD 6.1 bug: it doesn't round. */ + if (sprintf (buf, "%.2a %d", 1.51, 33, 44, 55) < 0 + || (strcmp (buf, "0x1.83p+0 33") != 0 + && strcmp (buf, "0x3.05p-1 33") != 0 + && strcmp (buf, "0x6.0ap-2 33") != 0 + && strcmp (buf, "0xc.14p-3 33") != 0)) + result |= 4; + /* This catches a Mac OS X 10.12.4 (Darwin 16.5) bug: it doesn't round. */ + if (sprintf (buf, "%.0a %d", 1.51, 33, 44, 55) < 0 + || (strcmp (buf, "0x2p+0 33") != 0 + && strcmp (buf, "0x3p-1 33") != 0 + && strcmp (buf, "0x6p-2 33") != 0 + && strcmp (buf, "0xcp-3 33") != 0)) + result |= 4; + /* This catches a FreeBSD 6.1 bug. See + */ + if (sprintf (buf, "%010a %d", 1.0 / zero, 33, 44, 55) < 0 + || buf[0] == '0') + result |= 8; + /* This catches a Mac OS X 10.3.9 (Darwin 7.9) bug. */ + if (sprintf (buf, "%.1a", 1.999) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) + result |= 16; + /* This catches the same Mac OS X 10.3.9 (Darwin 7.9) bug and also a + glibc 2.4 bug . */ + if (sprintf (buf, "%.1La", 1.999L) < 0 + || (strcmp (buf, "0x1.0p+1") != 0 + && strcmp (buf, "0x2.0p+0") != 0 + && strcmp (buf, "0x4.0p-1") != 0 + && strcmp (buf, "0x8.0p-2") != 0)) + result |= 32; + return result; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdbool_h=yes +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_printf_directive_a=yes else - ac_cv_header_stdbool_h=no + gl_cv_func_printf_directive_a=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 -$as_echo "$ac_cv_header_stdbool_h" >&6; } - ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" -if test "x$ac_cv_type__Bool" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE__BOOL 1 -_ACEOF fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_a" >&5 +$as_echo "$gl_cv_func_printf_directive_a" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'F' directive" >&5 +$as_echo_n "checking whether printf supports the 'F' directive... " >&6; } +if ${gl_cv_func_printf_directive_f+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on FreeBSD >= 6. + freebsd[1-5].*) gl_cv_func_printf_directive_f="guessing no";; + freebsd* | kfreebsd*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on Mac OS X >= 10.3. + darwin[1-6].*) gl_cv_func_printf_directive_f="guessing no";; + darwin*) gl_cv_func_printf_directive_f="guessing yes";; + # Guess yes on Solaris >= 2.10. + solaris2.[1-9][0-9]*) gl_cv_func_printf_directive_f="guessing yes";; + solaris*) gl_cv_func_printf_directive_f="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_f="guessing no";; + # Guess yes on MSVC, no on mingw. + mingw*) cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef _MSC_VER + Known +#endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Known" >/dev/null 2>&1; then : + gl_cv_func_printf_directive_f="guessing yes" +else + gl_cv_func_printf_directive_f="guessing no" +fi +rm -f conftest* + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_directive_f="$gl_cross_guess_normal";; + esac +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +static char buf[100]; +static double zero = 0.0; +int main () +{ + int result = 0; + if (sprintf (buf, "%F %d", 1234567.0, 33, 44, 55) < 0 + || strcmp (buf, "1234567.000000 33") != 0) + result |= 1; + if (sprintf (buf, "%F", 1.0 / zero) < 0 + || (strcmp (buf, "INF") != 0 && strcmp (buf, "INFINITY") != 0)) + result |= 2; + /* This catches a Cygwin 1.5.x bug. */ + if (sprintf (buf, "%.F", 1234.0) < 0 + || strcmp (buf, "1234") != 0) + result |= 4; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_printf_directive_f=yes +else + gl_cv_func_printf_directive_f=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - if test $ac_cv_type_long_long_int = yes; then - HAVE_LONG_LONG_INT=1 - else - HAVE_LONG_LONG_INT=0 - fi - - - if test $ac_cv_type_unsigned_long_long_int = yes; then - HAVE_UNSIGNED_LONG_LONG_INT=1 - else - HAVE_UNSIGNED_LONG_LONG_INT=0 - fi - - - - if test $ac_cv_header_wchar_h = yes; then - HAVE_WCHAR_H=1 - else - HAVE_WCHAR_H=0 - fi - - - if test $ac_cv_header_inttypes_h = yes; then - HAVE_INTTYPES_H=1 - else - HAVE_INTTYPES_H=0 - fi - - - if test $ac_cv_header_sys_types_h = yes; then - HAVE_SYS_TYPES_H=1 - else - HAVE_SYS_TYPES_H=0 - fi - - - - - - - - +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_f" >&5 +$as_echo "$gl_cv_func_printf_directive_f" >&6; } - if test $gl_cv_have_include_next = yes; then - gl_cv_next_stdint_h='<'stdint.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if ${gl_cv_next_stdint_h+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'n' directive" >&5 +$as_echo_n "checking whether printf supports the 'n' directive... " >&6; } +if ${gl_cv_func_printf_directive_n+:} false; then : $as_echo_n "(cached) " >&6 else - if test $ac_cv_header_stdint_h = yes; then - - - + if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_n="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_printf_directive_n="guessing no";; + *) gl_cv_func_printf_directive_n="guessing yes";; + esac +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - gl_header_literal_regex=`echo 'stdint.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - - gl_cv_absolute_stdint_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"` - - gl_header=$gl_cv_absolute_stdint_h - gl_cv_next_stdint_h='"'$gl_header'"' - else - gl_cv_next_stdint_h='<'stdint.h'>' - fi - +#include +#include +#include +#ifdef _MSC_VER +/* See page about "Parameter Validation" on msdn.microsoft.com. */ +static void cdecl +invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, unsigned int line, + uintptr_t dummy) +{ + exit (1); +} +#endif +static char fmtstring[10]; +static char buf[100]; +int main () +{ + int count = -1; +#ifdef _MSC_VER + _set_invalid_parameter_handler (invalid_parameter_handler); +#endif + /* Copy the format string. Some systems (glibc with _FORTIFY_SOURCE=2) + support %n in format strings in read-only memory but not in writable + memory. */ + strcpy (fmtstring, "%d %n"); + if (sprintf (buf, fmtstring, 123, &count, 33, 44, 55) < 0 + || strcmp (buf, "123 ") != 0 + || count != 4) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_printf_directive_n=yes +else + gl_cv_func_printf_directive_n=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdint_h" >&5 -$as_echo "$gl_cv_next_stdint_h" >&6; } - fi - NEXT_STDINT_H=$gl_cv_next_stdint_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'stdint.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_stdint_h - fi - NEXT_AS_FIRST_DIRECTIVE_STDINT_H=$gl_next_as_first_directive - +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_n" >&5 +$as_echo "$gl_cv_func_printf_directive_n" >&6; } - if test $ac_cv_header_stdint_h = yes; then - HAVE_STDINT_H=1 - else - HAVE_STDINT_H=0 - fi - if test $ac_cv_header_stdint_h = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h conforms to C99" >&5 -$as_echo_n "checking whether stdint.h conforms to C99... " >&6; } -if ${gl_cv_header_working_stdint_h+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the 'ls' directive" >&5 +$as_echo_n "checking whether printf supports the 'ls' directive... " >&6; } +if ${gl_cv_func_printf_directive_ls+:} false; then : $as_echo_n "(cached) " >&6 else - gl_cv_header_working_stdint_h=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#define __STDC_CONSTANT_MACROS 1 -#define __STDC_LIMIT_MACROS 1 -#include -/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ -#if !(defined WCHAR_MIN && defined WCHAR_MAX) -#error "WCHAR_MIN, WCHAR_MAX not defined in " -#endif + if test "$cross_compiling" = yes; then : + case "$host_os" in + openbsd*) gl_cv_func_printf_directive_ls="guessing no";; + irix*) gl_cv_func_printf_directive_ls="guessing no";; + solaris*) gl_cv_func_printf_directive_ls="guessing no";; + cygwin*) gl_cv_func_printf_directive_ls="guessing no";; + beos* | haiku*) gl_cv_func_printf_directive_ls="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_directive_ls="guessing no";; + # Guess yes on native Windows. + mingw*) gl_cv_func_printf_directive_ls="guessing yes";; + *) gl_cv_func_printf_directive_ls="guessing yes";; + esac - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +#include +int main () +{ + int result = 0; + char buf[100]; + /* Test whether %ls works at all. + This test fails on OpenBSD 4.0, IRIX 6.5, Solaris 2.6, Haiku, but not on + Cygwin 1.5. */ + { + static const wchar_t wstring[] = { 'a', 'b', 'c', 0 }; + buf[0] = '\0'; + if (sprintf (buf, "%ls", wstring) < 0 + || strcmp (buf, "abc") != 0) + result |= 1; + } + /* This test fails on IRIX 6.5, Solaris 2.6, Cygwin 1.5, Haiku (with an + assertion failure inside libc), but not on OpenBSD 4.0. */ + { + static const wchar_t wstring[] = { 'a', 0 }; + buf[0] = '\0'; + if (sprintf (buf, "%ls", wstring) < 0 + || strcmp (buf, "a") != 0) + result |= 2; + } + /* Test whether precisions in %ls are supported as specified in ISO C 99 + section 7.19.6.1: + "If a precision is specified, no more than that many bytes are written + (including shift sequences, if any), and the array shall contain a + null wide character if, to equal the multibyte character sequence + length given by the precision, the function would need to access a + wide character one past the end of the array." + This test fails on Solaris 10. */ + { + static const wchar_t wstring[] = { 'a', 'b', (wchar_t) 0xfdfdfdfd, 0 }; + buf[0] = '\0'; + if (sprintf (buf, "%.2ls", wstring) < 0 + || strcmp (buf, "ab") != 0) + result |= 8; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_printf_directive_ls=yes +else + gl_cv_func_printf_directive_ls=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi -#ifdef INT8_MAX -int8_t a1 = INT8_MAX; -int8_t a1min = INT8_MIN; -#endif -#ifdef INT16_MAX -int16_t a2 = INT16_MAX; -int16_t a2min = INT16_MIN; -#endif -#ifdef INT32_MAX -int32_t a3 = INT32_MAX; -int32_t a3min = INT32_MIN; -#endif -#ifdef INT64_MAX -int64_t a4 = INT64_MAX; -int64_t a4min = INT64_MIN; -#endif -#ifdef UINT8_MAX -uint8_t b1 = UINT8_MAX; -#else -typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; -#endif -#ifdef UINT16_MAX -uint16_t b2 = UINT16_MAX; -#endif -#ifdef UINT32_MAX -uint32_t b3 = UINT32_MAX; -#endif -#ifdef UINT64_MAX -uint64_t b4 = UINT64_MAX; -#endif -int_least8_t c1 = INT8_C (0x7f); -int_least8_t c1max = INT_LEAST8_MAX; -int_least8_t c1min = INT_LEAST8_MIN; -int_least16_t c2 = INT16_C (0x7fff); -int_least16_t c2max = INT_LEAST16_MAX; -int_least16_t c2min = INT_LEAST16_MIN; -int_least32_t c3 = INT32_C (0x7fffffff); -int_least32_t c3max = INT_LEAST32_MAX; -int_least32_t c3min = INT_LEAST32_MIN; -int_least64_t c4 = INT64_C (0x7fffffffffffffff); -int_least64_t c4max = INT_LEAST64_MAX; -int_least64_t c4min = INT_LEAST64_MIN; -uint_least8_t d1 = UINT8_C (0xff); -uint_least8_t d1max = UINT_LEAST8_MAX; -uint_least16_t d2 = UINT16_C (0xffff); -uint_least16_t d2max = UINT_LEAST16_MAX; -uint_least32_t d3 = UINT32_C (0xffffffff); -uint_least32_t d3max = UINT_LEAST32_MAX; -uint_least64_t d4 = UINT64_C (0xffffffffffffffff); -uint_least64_t d4max = UINT_LEAST64_MAX; -int_fast8_t e1 = INT_FAST8_MAX; -int_fast8_t e1min = INT_FAST8_MIN; -int_fast16_t e2 = INT_FAST16_MAX; -int_fast16_t e2min = INT_FAST16_MIN; -int_fast32_t e3 = INT_FAST32_MAX; -int_fast32_t e3min = INT_FAST32_MIN; -int_fast64_t e4 = INT_FAST64_MAX; -int_fast64_t e4min = INT_FAST64_MIN; -uint_fast8_t f1 = UINT_FAST8_MAX; -uint_fast16_t f2 = UINT_FAST16_MAX; -uint_fast32_t f3 = UINT_FAST32_MAX; -uint_fast64_t f4 = UINT_FAST64_MAX; -#ifdef INTPTR_MAX -intptr_t g = INTPTR_MAX; -intptr_t gmin = INTPTR_MIN; -#endif -#ifdef UINTPTR_MAX -uintptr_t h = UINTPTR_MAX; -#endif -intmax_t i = INTMAX_MAX; -uintmax_t j = UINTMAX_MAX; -/* Check that SIZE_MAX has the correct type, if possible. */ -#if 201112 <= __STDC_VERSION__ -int k = _Generic (SIZE_MAX, size_t: 0); -#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \ - || (0x5110 <= __SUNPRO_C && !__STDC__)) -extern size_t k; -extern __typeof__ (SIZE_MAX) k; -#endif +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_directive_ls" >&5 +$as_echo "$gl_cv_func_printf_directive_ls" >&6; } -#include /* for CHAR_BIT */ -#define TYPE_MINIMUM(t) \ - ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) -#define TYPE_MAXIMUM(t) \ - ((t) ((t) 0 < (t) -1 \ - ? (t) -1 \ - : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) -struct s { - int check_PTRDIFF: - PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) - && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) - ? 1 : -1; - /* Detect bug in FreeBSD 6.0 / ia64. */ - int check_SIG_ATOMIC: - SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) - && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) - ? 1 : -1; - int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; - int check_WCHAR: - WCHAR_MIN == TYPE_MINIMUM (wchar_t) - && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) - ? 1 : -1; - /* Detect bug in mingw. */ - int check_WINT: - WINT_MIN == TYPE_MINIMUM (wint_t) - && WINT_MAX == TYPE_MAXIMUM (wint_t) - ? 1 : -1; - /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ - int check_UINT8_C: - (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; - int check_UINT16_C: - (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; - /* Detect bugs in OpenBSD 3.9 stdint.h. */ -#ifdef UINT8_MAX - int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; -#endif -#ifdef UINT16_MAX - int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; -#endif -#ifdef UINT32_MAX - int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; -#endif -#ifdef UINT64_MAX - int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; -#endif - int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; - int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; - int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; - int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; - int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; - int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; - int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; - int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; - int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; - int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; - int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; -}; + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the grouping flag" >&5 +$as_echo_n "checking whether printf supports the grouping flag... " >&6; } +if ${gl_cv_func_printf_flag_grouping+:} false; then : + $as_echo_n "(cached) " >&6 +else -int -main () -{ + if test "$cross_compiling" = yes; then : - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if test "$cross_compiling" = yes; then : - case "$host_os" in - # Guess yes on native Windows. - mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; - # In general, assume it works. - *) gl_cv_header_working_stdint_h="guessing yes" ;; - esac + case "$host_os" in + cygwin*) gl_cv_func_printf_flag_grouping="guessing no";; + netbsd*) gl_cv_func_printf_flag_grouping="guessing no";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_flag_grouping="guessing no";; + # Guess no on native Windows. + mingw* | pw*) gl_cv_func_printf_flag_grouping="guessing no";; + *) gl_cv_func_printf_flag_grouping="guessing yes";; + esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#include +static char buf[100]; +int main () +{ + if (sprintf (buf, "%'d %d", 1234567, 99) < 0 + || buf[strlen (buf) - 1] != '9') + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_printf_flag_grouping=yes +else + gl_cv_func_printf_flag_grouping=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#define __STDC_CONSTANT_MACROS 1 -#define __STDC_LIMIT_MACROS 1 -#include +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_grouping" >&5 +$as_echo "$gl_cv_func_printf_flag_grouping" >&6; } - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif -#include -#include -#define MVAL(macro) MVAL1(macro) -#define MVAL1(expression) #expression -static const char *macro_values[] = - { -#ifdef INT8_MAX - MVAL (INT8_MAX), -#endif -#ifdef INT16_MAX - MVAL (INT16_MAX), -#endif -#ifdef INT32_MAX - MVAL (INT32_MAX), -#endif -#ifdef INT64_MAX - MVAL (INT64_MAX), -#endif -#ifdef UINT8_MAX - MVAL (UINT8_MAX), -#endif -#ifdef UINT16_MAX - MVAL (UINT16_MAX), -#endif -#ifdef UINT32_MAX - MVAL (UINT32_MAX), -#endif -#ifdef UINT64_MAX - MVAL (UINT64_MAX), -#endif - NULL - }; + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the left-adjust flag correctly" >&5 +$as_echo_n "checking whether printf supports the left-adjust flag correctly... " >&6; } +if ${gl_cv_func_printf_flag_leftadjust+:} false; then : + $as_echo_n "(cached) " >&6 +else -int -main () -{ + if test "$cross_compiling" = yes; then : - const char **mv; - for (mv = macro_values; *mv != NULL; mv++) - { - const char *value = *mv; - /* Test whether it looks like a cast expression. */ - if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 - || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 - || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 - || strncmp (value, "((int)"/*)*/, 6) == 0 - || strncmp (value, "((signed short)"/*)*/, 15) == 0 - || strncmp (value, "((signed char)"/*)*/, 14) == 0) - return mv - macro_values + 1; - } - return 0; + case "$host_os" in + # Guess yes on HP-UX 11. + hpux11*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess no on HP-UX 10 and older. + hpux*) gl_cv_func_printf_flag_leftadjust="guessing no";; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes on native Windows. + mingw*) gl_cv_func_printf_flag_leftadjust="guessing yes";; + # Guess yes otherwise. + *) gl_cv_func_printf_flag_leftadjust="guessing yes";; + esac - ; +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static char buf[100]; +int main () +{ + /* Check that a '-' flag is not annihilated by a negative width. */ + if (sprintf (buf, "a%-*sc", -3, "b") < 0 + || strcmp (buf, "ab c") != 0) + return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_header_working_stdint_h=yes + gl_cv_func_printf_flag_leftadjust=yes +else + gl_cv_func_printf_flag_leftadjust=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -16083,464 +17261,562 @@ fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_leftadjust" >&5 +$as_echo "$gl_cv_func_printf_flag_leftadjust" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdint_h" >&5 -$as_echo "$gl_cv_header_working_stdint_h" >&6; } - fi - HAVE_C99_STDINT_H=0 - HAVE_SYS_BITYPES_H=0 - HAVE_SYS_INTTYPES_H=0 - STDINT_H=stdint.h - case "$gl_cv_header_working_stdint_h" in - *yes) - HAVE_C99_STDINT_H=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h predates C++11" >&5 -$as_echo_n "checking whether stdint.h predates C++11... " >&6; } -if ${gl_cv_header_stdint_predates_cxx11_h+:} false; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports the zero flag correctly" >&5 +$as_echo_n "checking whether printf supports the zero flag correctly... " >&6; } +if ${gl_cv_func_printf_flag_zero+:} false; then : $as_echo_n "(cached) " >&6 else - gl_cv_header_stdint_predates_cxx11_h=yes - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + + if test "$cross_compiling" = yes; then : + + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on musl systems. + *-musl*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_flag_zero="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_flag_zero="guessing no";; + # Guess no on native Windows. + mingw*) gl_cv_func_printf_flag_zero="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_flag_zero="$gl_cross_guess_normal";; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ +#include +#include +static char buf[100]; +static double zero = 0.0; +int main () +{ + if (sprintf (buf, "%010f", 1.0 / zero, 33, 44, 55) < 0 + || (strcmp (buf, " inf") != 0 + && strcmp (buf, " infinity") != 0)) + return 1; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_printf_flag_zero=yes +else + gl_cv_func_printf_flag_zero=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi -#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ -#include +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_flag_zero" >&5 +$as_echo "$gl_cv_func_printf_flag_zero" >&6; } - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif -intmax_t im = INTMAX_MAX; -int32_t i32 = INT32_C (0x7fffffff); + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf supports large precisions" >&5 +$as_echo_n "checking whether printf supports large precisions... " >&6; } +if ${gl_cv_func_printf_precision+:} false; then : + $as_echo_n "(cached) " >&6 +else -int -main () -{ + if test "$cross_compiling" = yes; then : - ; - return 0; + case "$host_os" in + # Guess no only on Solaris, native Windows, and BeOS systems. + solaris*) gl_cv_func_printf_precision="guessing no" ;; + mingw* | pw*) gl_cv_func_printf_precision="guessing no" ;; + beos*) gl_cv_func_printf_precision="guessing no" ;; + # Guess yes on Android. + linux*-android*) gl_cv_func_printf_precision="guessing yes" ;; + *) gl_cv_func_printf_precision="guessing yes" ;; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +static char buf[5000]; +int main () +{ + int result = 0; +#ifdef __BEOS__ + /* On BeOS, this would crash and show a dialog box. Avoid the crash. */ + return 1; +#endif + if (sprintf (buf, "%.4000d %d", 1, 33, 44) < 4000 + 3) + result |= 1; + if (sprintf (buf, "%.4000f %d", 1.0, 33, 44) < 4000 + 5) + result |= 2; + if (sprintf (buf, "%.511f %d", 1.0, 33, 44) < 511 + 5 + || buf[0] != '1') + result |= 4; + if (sprintf (buf, "%.999f %d", 1.0, 33, 44) < 999 + 5 + || buf[0] != '1') + result |= 4; + return result; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_stdint_predates_cxx11_h=no +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_printf_precision=yes +else + gl_cv_func_printf_precision=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_predates_cxx11_h" >&5 -$as_echo "$gl_cv_header_stdint_predates_cxx11_h" >&6; } - if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then -$as_echo "#define __STDC_CONSTANT_MACROS 1" >>confdefs.h +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_precision" >&5 +$as_echo "$gl_cv_func_printf_precision" >&6; } -$as_echo "#define __STDC_LIMIT_MACROS 1" >>confdefs.h - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h has UINTMAX_WIDTH etc." >&5 -$as_echo_n "checking whether stdint.h has UINTMAX_WIDTH etc.... " >&6; } -if ${gl_cv_header_stdint_width+:} false; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether printf survives out-of-memory conditions" >&5 +$as_echo_n "checking whether printf survives out-of-memory conditions... " >&6; } +if ${gl_cv_func_printf_enomem+:} false; then : $as_echo_n "(cached) " >&6 else - gl_cv_header_stdint_width=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - /* Work if build is not clean. */ - #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 - #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ - #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 - #endif - #include - - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif + gl_cv_func_printf_enomem="guessing no" + if test "$cross_compiling" = no; then + if test $APPLE_UNIVERSAL_BUILD = 0; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - int iw = UINTMAX_WIDTH; -int -main () +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data1024; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) { + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif - ; - return 0; +#include +#include +#include +#include +#include +int main() +{ + struct rlimit limit; + int ret; + nocrash_init (); + /* Some printf implementations allocate temporary space with malloc. */ + /* On BSD systems, malloc() is limited by RLIMIT_DATA. */ +#ifdef RLIMIT_DATA + if (getrlimit (RLIMIT_DATA, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_DATA, &limit) < 0) + return 77; +#endif + /* On Linux systems, malloc() is limited by RLIMIT_AS. */ +#ifdef RLIMIT_AS + if (getrlimit (RLIMIT_AS, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_AS, &limit) < 0) + return 77; +#endif + /* Some printf implementations allocate temporary space on the stack. */ +#ifdef RLIMIT_STACK + if (getrlimit (RLIMIT_STACK, &limit) < 0) + return 77; + if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > 5000000) + limit.rlim_max = 5000000; + limit.rlim_cur = limit.rlim_max; + if (setrlimit (RLIMIT_STACK, &limit) < 0) + return 77; +#endif + ret = printf ("%.5000000f", 1.0); + return !(ret == 5000002 || (ret < 0 && errno == ENOMEM)); } + _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_stdint_width=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_width" >&5 -$as_echo "$gl_cv_header_stdint_width" >&6; } - if test "$gl_cv_header_stdint_width" = yes; then - STDINT_H= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + (./conftest 2>&5 + result=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $result" >&5 + if test $result != 0 && test $result != 77; then result=1; fi + exit $result + ) >/dev/null 2>/dev/null + case $? in + 0) gl_cv_func_printf_enomem="yes" ;; + 77) gl_cv_func_printf_enomem="guessing no" ;; + *) gl_cv_func_printf_enomem="no" ;; + esac + else + gl_cv_func_printf_enomem="guessing no" + fi + rm -fr conftest* + else + gl_cv_func_printf_enomem="guessing no" + fi + fi + if test "$gl_cv_func_printf_enomem" = "guessing no"; then + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on Solaris. + solaris*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on AIX. + aix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on HP-UX/hppa. + hpux*) case "$host_cpu" in + hppa*) gl_cv_func_printf_enomem="guessing yes";; + *) gl_cv_func_printf_enomem="guessing no";; + esac + ;; + # Guess yes on IRIX. + irix*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on OSF/1. + osf*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on BeOS. + beos*) gl_cv_func_printf_enomem="guessing yes";; + # Guess yes on Haiku. + haiku*) gl_cv_func_printf_enomem="guessing yes";; + # Guess no on Android. + linux*-android*) gl_cv_func_printf_enomem="guessing no";; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_printf_enomem="$gl_cross_guess_normal";; + esac fi - ;; - *) - for ac_header in sys/inttypes.h sys/bitypes.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_enomem" >&5 +$as_echo "$gl_cv_func_printf_enomem" >&6; } -done - - if test $ac_cv_header_sys_inttypes_h = yes; then - HAVE_SYS_INTTYPES_H=1 - fi - if test $ac_cv_header_sys_bitypes_h = yes; then - HAVE_SYS_BITYPES_H=1 - fi - if test $APPLE_UNIVERSAL_BUILD = 0; then + case "$gl_cv_func_printf_long_double" in + *yes) + ;; + *) +$as_echo "#define NEED_PRINTF_LONG_DOUBLE 1" >>confdefs.h - for gltype in ptrdiff_t size_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 -$as_echo_n "checking for bit size of $gltype... " >&6; } -if eval \${gl_cv_bitsizeof_${gltype}+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif + ;; + esac -#include "; then : -else - result=unknown -fi - eval gl_cv_bitsizeof_${gltype}=\$result -fi -eval ac_res=\$gl_cv_bitsizeof_${gltype} - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval result=\$gl_cv_bitsizeof_${gltype} - if test $result = unknown; then - result=0 - fi - GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - cat >>confdefs.h <<_ACEOF -#define BITSIZEOF_${GLTYPE} $result -_ACEOF - eval BITSIZEOF_${GLTYPE}=\$result - done + if test $ac_cv_header_features_h = yes; then + HAVE_FEATURES_H=1 + else + HAVE_FEATURES_H=0 fi - for gltype in sig_atomic_t wchar_t wint_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 -$as_echo_n "checking for bit size of $gltype... " >&6; } -if eval \${gl_cv_bitsizeof_${gltype}+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif - -#include "; then : - -else - result=unknown -fi - - eval gl_cv_bitsizeof_${gltype}=\$result - -fi -eval ac_res=\$gl_cv_bitsizeof_${gltype} - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval result=\$gl_cv_bitsizeof_${gltype} - if test $result = unknown; then - result=0 - fi - GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - cat >>confdefs.h <<_ACEOF -#define BITSIZEOF_${GLTYPE} $result -_ACEOF - - eval BITSIZEOF_${GLTYPE}=\$result - done - - for gltype in sig_atomic_t wchar_t wint_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gltype is signed" >&5 -$as_echo_n "checking whether $gltype is signed... " >&6; } -if eval \${gl_cv_type_${gltype}_signed+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intmax_t" >&5 +$as_echo_n "checking for intmax_t... " >&6; } +if ${gt_cv_c_intmax_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif +#include +#include +#if HAVE_STDINT_H_WITH_UINTMAX +#include +#endif +#if HAVE_INTTYPES_H_WITH_UINTMAX +#include +#endif - int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; int main () { - +intmax_t x = -1; return !x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - result=yes + gt_cv_c_intmax_t=yes else - result=no + gt_cv_c_intmax_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval gl_cv_type_${gltype}_signed=\$result - fi -eval ac_res=\$gl_cv_type_${gltype}_signed - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval result=\$gl_cv_type_${gltype}_signed - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - if test "$result" = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_SIGNED_${GLTYPE} 1 -_ACEOF +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_intmax_t" >&5 +$as_echo "$gt_cv_c_intmax_t" >&6; } + if test $gt_cv_c_intmax_t = yes; then - eval HAVE_SIGNED_${GLTYPE}=1 - else - eval HAVE_SIGNED_${GLTYPE}=0 - fi - done +$as_echo "#define HAVE_INTMAX_T 1" >>confdefs.h + else - gl_cv_type_ptrdiff_t_signed=yes - gl_cv_type_size_t_signed=no - if test $APPLE_UNIVERSAL_BUILD = 0; then +cat >>confdefs.h <<_ACEOF +#define intmax_t long long +_ACEOF + fi - for gltype in ptrdiff_t size_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 -$as_echo_n "checking for $gltype integer literal suffix... " >&6; } -if eval \${gl_cv_type_${gltype}_suffix+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval gl_cv_type_${gltype}_suffix=no - eval result=\$gl_cv_type_${gltype}_signed - if test "$result" = yes; then - glsufu= - else - glsufu=u - fi - for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do - case $glsuf in - '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; - ui64)gltype1='unsigned __int64';; - esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif - extern $gltype foo; - extern $gltype1 foo; -int -main () -{ - ; - return 0; -} + + for ac_func in snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval gl_cv_type_${gltype}_suffix=\$glsuf + fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" != no && break - done +done + + ac_fn_c_check_decl "$LINENO" "_snprintf" "ac_cv_have_decl__snprintf" "#include +" +if test "x$ac_cv_have_decl__snprintf" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 fi -eval ac_res=\$gl_cv_type_${gltype}_suffix - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" = no && result= - eval ${GLTYPE}_SUFFIX=\$result - cat >>confdefs.h <<_ACEOF -#define ${GLTYPE}_SUFFIX $result + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL__SNPRINTF $ac_have_decl _ACEOF - done - fi + case "$gl_cv_func_snprintf_retval_c99" in + *yes) +$as_echo "#define HAVE_SNPRINTF_RETVAL_C99 1" >>confdefs.h - for gltype in sig_atomic_t wchar_t wint_t ; do - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 -$as_echo_n "checking for $gltype integer literal suffix... " >&6; } -if eval \${gl_cv_type_${gltype}_suffix+:} false; then : + ;; + esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if ${ac_cv_header_stdbool_h+:} false; then : $as_echo_n "(cached) " >&6 else - eval gl_cv_type_${gltype}_suffix=no - eval result=\$gl_cv_type_${gltype}_signed - if test "$result" = yes; then - glsufu= - else - glsufu=u - fi - for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do - case $glsuf in - '') gltype1='int';; - l) gltype1='long int';; - ll) gltype1='long long int';; - i64) gltype1='__int64';; - u) gltype1='unsigned int';; - ul) gltype1='unsigned long int';; - ull) gltype1='unsigned long long int';; - ui64)gltype1='unsigned __int64';; - esac - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ - /* BSD/OS 4.0.1 has a bug: , and must be - included before . */ - #include - #include - #if HAVE_WCHAR_H - # include - # include - # include - #endif + #include + + #ifdef __cplusplus + typedef bool Bool; + #else + typedef _Bool Bool; + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #endif + + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html + */ + Bool q = true; + Bool *pq = &q; + bool *qq = &q; - extern $gltype foo; - extern $gltype1 foo; int main () { + bool e = &s; + *pq |= q; *pq |= ! q; + *qq |= q; *qq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq + !qq); + ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - eval gl_cv_type_${gltype}_suffix=\$glsuf + ac_cv_header_stdbool_h=yes +else + ac_cv_header_stdbool_h=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" != no && break - done -fi -eval ac_res=\$gl_cv_type_${gltype}_suffix - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` - eval result=\$gl_cv_type_${gltype}_suffix - test "$result" = no && result= - eval ${GLTYPE}_SUFFIX=\$result - cat >>confdefs.h <<_ACEOF -#define ${GLTYPE}_SUFFIX $result -_ACEOF - - done - - - - if test $GNULIB_OVERRIDES_WINT_T = 1; then - BITSIZEOF_WINT_T=32 - fi - - ;; - esac - - - - LIMITS_H='limits.h' - if test -n "$LIMITS_H"; then - GL_GENERATE_LIMITS_H_TRUE= - GL_GENERATE_LIMITS_H_FALSE='#' -else - GL_GENERATE_LIMITS_H_TRUE='#' - GL_GENERATE_LIMITS_H_FALSE= fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } + ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = xyes; then : +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 +_ACEOF - - - - - if test -n "$STDINT_H"; then - GL_GENERATE_STDINT_H_TRUE= - GL_GENERATE_STDINT_H_FALSE='#' -else - GL_GENERATE_STDINT_H_TRUE='#' - GL_GENERATE_STDINT_H_FALSE= fi @@ -17284,6 +18560,7 @@ + gl_source_base='lib' @@ -19606,6 +20883,21 @@ + GNULIB_GETOPT_POSIX=1 + + + + + +$as_echo "#define GNULIB_TEST_GETOPT_POSIX 1" >>confdefs.h + + + + + + + + @@ -19966,6 +21258,10 @@ + LIB_HARD_LOCALE="$LIB_SETLOCALE_NULL" + + + @@ -21094,6 +22390,8 @@ + + case "$host_os" in solaris*) @@ -21130,47 +22428,6 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_h_posix2001" >&5 $as_echo "$gl_cv_header_locale_h_posix2001" >&6; } - - if test $ac_cv_header_xlocale_h = yes; then - HAVE_XLOCALE_H=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether locale.h defines locale_t" >&5 -$as_echo_n "checking whether locale.h defines locale_t... " >&6; } -if ${gl_cv_header_locale_has_locale_t+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - locale_t x; -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_header_locale_has_locale_t=yes -else - gl_cv_header_locale_has_locale_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_locale_has_locale_t" >&5 -$as_echo "$gl_cv_header_locale_has_locale_t" >&6; } - if test $gl_cv_header_locale_has_locale_t = yes; then - gl_cv_header_locale_h_needs_xlocale_h=no - else - gl_cv_header_locale_h_needs_xlocale_h=yes - fi - else - HAVE_XLOCALE_H=0 - gl_cv_header_locale_h_needs_xlocale_h=no - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct lconv is properly defined" >&5 $as_echo_n "checking whether struct lconv is properly defined... " >&6; } if ${gl_cv_sys_struct_lconv_ok+:} false; then : @@ -21201,7 +22458,27 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_lconv_ok" >&5 $as_echo "$gl_cv_sys_struct_lconv_ok" >&6; } if test $gl_cv_sys_struct_lconv_ok = no; then - REPLACE_STRUCT_LCONV=1 + case "$host_os" in + mingw*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER + Special +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Special" >/dev/null 2>&1; then : + +else + REPLACE_STRUCT_LCONV=1 +fi +rm -f conftest* + + ;; + *) REPLACE_STRUCT_LCONV=1 ;; + esac fi @@ -21657,7 +22934,6 @@ - if test $gl_cv_have_include_next = yes; then gl_cv_next_math_h='<'math.h'>' else @@ -21808,7 +23084,15 @@ - if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then + + + + if case "$host_os" in + mingw*) true ;; + *) test $ac_cv_func_mbsinit = yes ;; + esac \ + && test $ac_cv_func_mbrtowc = yes; then + @@ -21866,6 +23150,50 @@ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + else + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_mbrtowc_incomplete_state=yes +else + gl_cv_func_mbrtowc_incomplete_state=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi fi fi @@ -22328,6 +23656,144 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc stores incomplete characters" >&5 +$as_echo_n "checking whether mbrtowc stores incomplete characters... " >&6; } +if ${gl_cv_func_mbrtowc_stores_incomplete+:} false; then : + $as_echo_n "(cached) " >&6 +else + + case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_func_mbrtowc_stores_incomplete="guessing yes" ;; + *) gl_cv_func_mbrtowc_stores_incomplete="guessing no" ;; + esac + case "$host_os" in + mingw*) + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +int main () +{ + int result = 0; + if (setlocale (LC_ALL, "French_France.65001") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 1; + } + if (setlocale (LC_ALL, "Japanese_Japan.932") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\226", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 2; + } + if (setlocale (LC_ALL, "Chinese_Taiwan.950") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\245", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 4; + } + if (setlocale (LC_ALL, "Chinese_China.936") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\261", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + result |= 8; + } + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_mbrtowc_stores_incomplete=no +else + gl_cv_func_mbrtowc_stores_incomplete=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + ;; + *) + + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + wchar_t wc = (wchar_t) 0xBADFACE; + mbstate_t state; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, "\303", 1, &state) == (size_t)(-2) + && wc != (wchar_t) 0xBADFACE) + return 1; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_mbrtowc_stores_incomplete=no +else + gl_cv_func_mbrtowc_stores_incomplete=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_stores_incomplete" >&5 +$as_echo "$gl_cv_func_mbrtowc_stores_incomplete" >&6; } + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc works on empty input" >&5 $as_echo_n "checking whether mbrtowc works on empty input... " >&6; } if ${gl_cv_func_mbrtowc_empty_input+:} false; then : @@ -22373,16 +23839,16 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C locale is free of encoding errors" >&5 $as_echo_n "checking whether the C locale is free of encoding errors... " >&6; } -if ${gl_cv_C_locale_sans_EILSEQ+:} false; then : +if ${gl_cv_func_mbrtowc_C_locale_sans_EILSEQ+:} false; then : $as_echo_n "(cached) " >&6 else - gl_cv_C_locale_sans_EILSEQ="$gl_cross_guess_normal" + gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="$gl_cross_guess_normal" if test "$cross_compiling" = yes; then : case "$host_os" in # Guess yes on native Windows. - mingw*) gl_cv_C_locale_sans_EILSEQ="guessing yes" ;; + mingw*) gl_cv_func_mbrtowc_C_locale_sans_EILSEQ="guessing yes" ;; esac else @@ -22416,9 +23882,9 @@ } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - gl_cv_C_locale_sans_EILSEQ=yes + gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=yes else - gl_cv_C_locale_sans_EILSEQ=no + gl_cv_func_mbrtowc_C_locale_sans_EILSEQ=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext @@ -22426,8 +23892,8 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_C_locale_sans_EILSEQ" >&5 -$as_echo "$gl_cv_C_locale_sans_EILSEQ" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&5 +$as_echo "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" >&6; } case "$gl_cv_func_mbrtowc_null_arg1" in *yes) ;; @@ -22461,6 +23927,14 @@ REPLACE_MBRTOWC=1 ;; esac + case "$gl_cv_func_mbrtowc_stores_incomplete" in + *no) ;; + *) +$as_echo "#define MBRTOWC_STORES_INCOMPLETE_BUG 1" >>confdefs.h + + REPLACE_MBRTOWC=1 + ;; + esac case "$gl_cv_func_mbrtowc_empty_input" in *yes) ;; *) @@ -22469,16 +23943,130 @@ REPLACE_MBRTOWC=1 ;; esac - case $gl_cv_C_locale_sans_EILSEQ in + case "$gl_cv_func_mbrtowc_C_locale_sans_EILSEQ" in *yes) ;; *) -$as_echo "#define C_LOCALE_MAYBE_EILSEQ 1" >>confdefs.h +$as_echo "#define MBRTOWC_IN_C_LOCALE_MAYBE_EILSEQ 1" >>confdefs.h REPLACE_MBRTOWC=1 ;; esac fi fi + if test $REPLACE_MBSTATE_T = 1; then + case "$host_os" in + mingw*) LIB_MBRTOWC= ;; + *) + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } +if ${gl_cv_have_weak+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void xyzzy (); +#pragma weak xyzzy +int +main () +{ +xyzzy(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_have_weak=maybe +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : + gl_cv_have_weak="guessing yes" +else + gl_cv_have_weak="guessing no" +fi +rm -f conftest* + + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#pragma weak fputs +int main () +{ + return (fputs == NULL); +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_have_weak=yes +else + gl_cv_have_weak=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +$as_echo "$gl_cv_have_weak" >&6; } + case "$gl_cv_have_weak" in + *yes) + +$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h + + ;; + esac + + case "$gl_cv_have_weak" in + *yes) LIB_MBRTOWC= ;; + *) LIB_MBRTOWC="$LIBPTHREAD" ;; + esac + ;; + esac + else + LIB_MBRTOWC= + fi + if test $HAVE_MBRTOWC = 0 || test $REPLACE_MBRTOWC = 1; then @@ -22491,6 +24079,114 @@ gl_LIBOBJS="$gl_LIBOBJS mbrtowc.$ac_objext" + if test $REPLACE_MBSTATE_T = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS lc-charset-dispatch.$ac_objext" + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS mbtowc-lock.$ac_objext" + + + + + CFLAG_VISIBILITY= + HAVE_VISIBILITY=0 + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 +$as_echo_n "checking whether the -Werror option is usable... " >&6; } +if ${gl_cv_cc_vis_werror+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_cc_vis_werror=yes +else + gl_cv_cc_vis_werror=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$gl_save_CFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5 +$as_echo "$gl_cv_cc_vis_werror" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 +$as_echo_n "checking for simple visibility declarations... " >&6; } +if ${gl_cv_cc_visibility+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=hidden" + if test $gl_cv_cc_vis_werror = yes; then + CFLAGS="$CFLAGS -Werror" + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void); + void dummyfunc (void) {} + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_cc_visibility=yes +else + gl_cv_cc_visibility=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$gl_save_CFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 +$as_echo "$gl_cv_cc_visibility" >&6; } + if test $gl_cv_cc_visibility = yes; then + CFLAG_VISIBILITY="-fvisibility=hidden" + HAVE_VISIBILITY=1 + fi + fi + + + +cat >>confdefs.h <<_ACEOF +#define HAVE_VISIBILITY $HAVE_VISIBILITY +_ACEOF + + + + fi : @@ -22522,7 +24218,13 @@ - if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then + + if case "$host_os" in + mingw*) true ;; + *) test $ac_cv_func_mbsinit = yes ;; + esac \ + && test $ac_cv_func_mbrtowc = yes; then + @@ -22580,6 +24282,50 @@ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + else + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_mbrtowc_incomplete_state=yes +else + gl_cv_func_mbrtowc_incomplete_state=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi fi fi @@ -22744,7 +24490,13 @@ - if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then + + if case "$host_os" in + mingw*) true ;; + *) test $ac_cv_func_mbsinit = yes ;; + esac \ + && test $ac_cv_func_mbrtowc = yes; then + @@ -22802,6 +24554,50 @@ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + else + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_mbrtowc_incomplete_state=yes +else + gl_cv_func_mbrtowc_incomplete_state=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi fi fi @@ -23263,7 +25059,8 @@ - if test $ac_cv_func_nl_langinfo = yes; then + + if test $ac_cv_func_nl_langinfo = yes; then # On Irix 6.5, YESEXPR is defined, but nl_langinfo(YESEXPR) is broken. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether YESEXPR works" >&5 $as_echo_n "checking whether YESEXPR works... " >&6; } @@ -23330,6 +25127,12 @@ else HAVE_NL_LANGINFO=0 fi + if test $HAVE_NL_LANGINFO = 0 || test $HAVE_LANGINFO_CODESET = 0; then + LIB_NL_LANGINFO="$LIB_SETLOCALE_NULL" + else + LIB_NL_LANGINFO= + fi + if test $HAVE_NL_LANGINFO = 0 || test $REPLACE_NL_LANGINFO = 1; then @@ -24252,105 +26055,414 @@ ;; esac - if test $ac_use_included_regex = yes; then + if test $ac_use_included_regex = yes; then + +$as_echo "#define _REGEX_INCLUDE_LIMITS_H 1" >>confdefs.h + + +$as_echo "#define _REGEX_LARGE_OFFSETS 1" >>confdefs.h + + +$as_echo "#define re_syntax_options rpl_re_syntax_options" >>confdefs.h + + +$as_echo "#define re_set_syntax rpl_re_set_syntax" >>confdefs.h + + +$as_echo "#define re_compile_pattern rpl_re_compile_pattern" >>confdefs.h + + +$as_echo "#define re_compile_fastmap rpl_re_compile_fastmap" >>confdefs.h + + +$as_echo "#define re_search rpl_re_search" >>confdefs.h + + +$as_echo "#define re_search_2 rpl_re_search_2" >>confdefs.h + + +$as_echo "#define re_match rpl_re_match" >>confdefs.h + + +$as_echo "#define re_match_2 rpl_re_match_2" >>confdefs.h + + +$as_echo "#define re_set_registers rpl_re_set_registers" >>confdefs.h + + +$as_echo "#define re_comp rpl_re_comp" >>confdefs.h + + +$as_echo "#define re_exec rpl_re_exec" >>confdefs.h + + +$as_echo "#define regcomp rpl_regcomp" >>confdefs.h + + +$as_echo "#define regexec rpl_regexec" >>confdefs.h + + +$as_echo "#define regerror rpl_regerror" >>confdefs.h + + +$as_echo "#define regfree rpl_regfree" >>confdefs.h + + fi + + if test $ac_use_included_regex = yes; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS regex.$ac_objext" + + + + + + + + + for ac_header in libintl.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default" +if test "x$ac_cv_header_libintl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBINTL_H 1 +_ACEOF + +fi + +done + + + ac_fn_c_check_decl "$LINENO" "isblank" "ac_cv_have_decl_isblank" "#include +" +if test "x$ac_cv_have_decl_isblank" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ISBLANK $ac_have_decl +_ACEOF + + + fi + + -$as_echo "#define _REGEX_INCLUDE_LIMITS_H 1" >>confdefs.h -$as_echo "#define _REGEX_LARGE_OFFSETS 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (LC_ALL, NULL) is multithread-safe" >&5 +$as_echo_n "checking whether setlocale (LC_ALL, NULL) is multithread-safe... " >&6; } +if ${gl_cv_func_setlocale_null_all_mtsafe+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$host_os" in + # Guess no on musl libc, macOS, FreeBSD, NetBSD, OpenBSD, AIX, Haiku, Cygwin. + *-musl* | darwin* | freebsd* | netbsd* | openbsd* | aix* | haiku* | cygwin*) + gl_cv_func_setlocale_null_all_mtsafe=no ;; + # Guess yes on glibc, HP-UX, IRIX, Solaris, native Windows. + *-gnu* | gnu* | hpux* | irix* | solaris* | mingw*) + gl_cv_func_setlocale_null_all_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_all_mtsafe="$gl_cross_guess_normal" ;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_all_mtsafe" >&5 +$as_echo "$gl_cv_func_setlocale_null_all_mtsafe" >&6; } + case "$host_os" in + mingw*) ;; + *) + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_all_mtsafe="trivially yes" + fi + ;; + esac + case "$gl_cv_func_setlocale_null_all_mtsafe" in + *yes) SETLOCALE_NULL_ALL_MTSAFE=1 ;; + *) SETLOCALE_NULL_ALL_MTSAFE=0 ;; + esac -$as_echo "#define re_syntax_options rpl_re_syntax_options" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SETLOCALE_NULL_ALL_MTSAFE $SETLOCALE_NULL_ALL_MTSAFE +_ACEOF -$as_echo "#define re_set_syntax rpl_re_set_syntax" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether setlocale (category, NULL) is multithread-safe" >&5 +$as_echo_n "checking whether setlocale (category, NULL) is multithread-safe... " >&6; } +if ${gl_cv_func_setlocale_null_one_mtsafe+:} false; then : + $as_echo_n "(cached) " >&6 +else + case "$host_os" in + # Guess no on OpenBSD, AIX. + openbsd* | aix*) + gl_cv_func_setlocale_null_one_mtsafe=no ;; + # Guess yes on glibc, musl libc, macOS, FreeBSD, NetBSD, HP-UX, IRIX, Solaris, Haiku, Cygwin, native Windows. + *-gnu* | gnu* | *-musl* | darwin* | freebsd* | netbsd* | hpux* | irix* | solaris* | haiku* | cygwin* | mingw*) + gl_cv_func_setlocale_null_one_mtsafe=yes ;; + # If we don't know, obey --enable-cross-guesses. + *) + gl_cv_func_setlocale_null_one_mtsafe="$gl_cross_guess_normal" ;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_setlocale_null_one_mtsafe" >&5 +$as_echo "$gl_cv_func_setlocale_null_one_mtsafe" >&6; } + case "$host_os" in + mingw*) ;; + *) + if test $gl_pthread_api = no && test $ac_cv_header_threads_h = no; then + gl_cv_func_setlocale_null_one_mtsafe="trivially yes" + fi + ;; + esac + case "$gl_cv_func_setlocale_null_one_mtsafe" in + *yes) SETLOCALE_NULL_ONE_MTSAFE=1 ;; + *) SETLOCALE_NULL_ONE_MTSAFE=0 ;; + esac -$as_echo "#define re_compile_pattern rpl_re_compile_pattern" >>confdefs.h +cat >>confdefs.h <<_ACEOF +#define SETLOCALE_NULL_ONE_MTSAFE $SETLOCALE_NULL_ONE_MTSAFE +_ACEOF -$as_echo "#define re_compile_fastmap rpl_re_compile_fastmap" >>confdefs.h + if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then + case "$host_os" in + mingw*) LIB_SETLOCALE_NULL= ;; + *) -$as_echo "#define re_search rpl_re_search" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +$as_echo_n "checking whether imported symbols can be declared weak... " >&6; } +if ${gl_cv_have_weak+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void xyzzy (); +#pragma weak xyzzy +int +main () +{ +xyzzy(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + gl_cv_have_weak=maybe +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1; then : + gl_cv_have_weak="guessing yes" +else + gl_cv_have_weak="guessing no" +fi +rm -f conftest* -$as_echo "#define re_search_2 rpl_re_search_2" >>confdefs.h +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ -$as_echo "#define re_match rpl_re_match" >>confdefs.h +#include +#pragma weak fputs +int main () +{ + return (fputs == NULL); +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_have_weak=yes +else + gl_cv_have_weak=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +$as_echo "$gl_cv_have_weak" >&6; } + case "$gl_cv_have_weak" in + *yes) -$as_echo "#define re_match_2 rpl_re_match_2" >>confdefs.h +$as_echo "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h + ;; + esac -$as_echo "#define re_set_registers rpl_re_set_registers" >>confdefs.h + case "$gl_cv_have_weak" in + *yes) LIB_SETLOCALE_NULL= ;; + *) LIB_SETLOCALE_NULL="$LIBPTHREAD" ;; + esac + ;; + esac + else + LIB_SETLOCALE_NULL= + fi -$as_echo "#define re_comp rpl_re_comp" >>confdefs.h + if test $SETLOCALE_NULL_ALL_MTSAFE = 0 || test $SETLOCALE_NULL_ONE_MTSAFE = 0; then -$as_echo "#define re_exec rpl_re_exec" >>confdefs.h -$as_echo "#define regcomp rpl_regcomp" >>confdefs.h -$as_echo "#define regexec rpl_regexec" >>confdefs.h -$as_echo "#define regerror rpl_regerror" >>confdefs.h + gl_LIBOBJS="$gl_LIBOBJS setlocale-lock.$ac_objext" -$as_echo "#define regfree rpl_regfree" >>confdefs.h - fi - if test $ac_use_included_regex = yes; then + CFLAG_VISIBILITY= + HAVE_VISIBILITY=0 + if test -n "$GCC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the -Werror option is usable" >&5 +$as_echo_n "checking whether the -Werror option is usable... " >&6; } +if ${gl_cv_cc_vis_werror+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_cc_vis_werror=yes +else + gl_cv_cc_vis_werror=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$gl_save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_vis_werror" >&5 +$as_echo "$gl_cv_cc_vis_werror" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for simple visibility declarations" >&5 +$as_echo_n "checking for simple visibility declarations... " >&6; } +if ${gl_cv_cc_visibility+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fvisibility=hidden" + if test $gl_cv_cc_vis_werror = yes; then + CFLAGS="$CFLAGS -Werror" + fi + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern __attribute__((__visibility__("hidden"))) int hiddenvar; + extern __attribute__((__visibility__("default"))) int exportedvar; + extern __attribute__((__visibility__("hidden"))) int hiddenfunc (void); + extern __attribute__((__visibility__("default"))) int exportedfunc (void); + void dummyfunc (void) {} +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_cc_visibility=yes +else + gl_cv_cc_visibility=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$gl_save_CFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_visibility" >&5 +$as_echo "$gl_cv_cc_visibility" >&6; } + if test $gl_cv_cc_visibility = yes; then + CFLAG_VISIBILITY="-fvisibility=hidden" + HAVE_VISIBILITY=1 + fi + fi +cat >>confdefs.h <<_ACEOF +#define HAVE_VISIBILITY $HAVE_VISIBILITY +_ACEOF - gl_LIBOBJS="$gl_LIBOBJS regex.$ac_objext" + fi + GNULIB_SETLOCALE_NULL=1 - for ac_header in libintl.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default" -if test "x$ac_cv_header_libintl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBINTL_H 1 -_ACEOF -fi -done - ac_fn_c_check_decl "$LINENO" "isblank" "ac_cv_have_decl_isblank" "#include -" -if test "x$ac_cv_have_decl_isblank" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi +$as_echo "#define GNULIB_TEST_SETLOCALE_NULL 1" >>confdefs.h -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_ISBLANK $ac_have_decl -_ACEOF - fi @@ -24533,7 +26645,8 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for signbit macro" >&5 + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for signbit macro" >&5 $as_echo_n "checking for signbit macro... " >&6; } if ${gl_cv_func_signbit+:} false; then : $as_echo_n "(cached) " >&6 @@ -24788,6 +26901,16 @@ *yes) ;; *) REPLACE_SIGNBIT=1 + ;; + esac + ;; + esac + case "$host_os" in + solaris*) + REPLACE_SIGNBIT=1 + ;; + esac + if test $REPLACE_SIGNBIT = 1; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the sign bit in a 'float'" >&5 @@ -25109,8 +27232,8 @@ esac - if test "$gl_cv_cc_float_signbit" = unknown; then - ac_fn_c_check_decl "$LINENO" "copysignf" "ac_cv_have_decl_copysignf" "#include + if test "$gl_cv_cc_float_signbit" = unknown; then + ac_fn_c_check_decl "$LINENO" "copysignf" "ac_cv_have_decl_copysignf" "#include " if test "x$ac_cv_have_decl_copysignf" = xyes; then : ac_have_decl=1 @@ -25122,17 +27245,17 @@ #define HAVE_DECL_COPYSIGNF $ac_have_decl _ACEOF - if test "$ac_cv_have_decl_copysignf" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether copysignf can be used without linking with libm" >&5 + if test "$ac_cv_have_decl_copysignf" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether copysignf can be used without linking with libm" >&5 $as_echo_n "checking whether copysignf can be used without linking with libm... " >&6; } if ${gl_cv_func_copysignf_no_libm+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - float x, y; + float x, y; int main () { @@ -25152,15 +27275,15 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_copysignf_no_libm" >&5 $as_echo "$gl_cv_func_copysignf_no_libm" >&6; } - if test $gl_cv_func_copysignf_no_libm = yes; then + if test $gl_cv_func_copysignf_no_libm = yes; then $as_echo "#define HAVE_COPYSIGNF_IN_LIBC 1" >>confdefs.h - fi - fi - fi - if test "$gl_cv_cc_double_signbit" = unknown; then - ac_fn_c_check_decl "$LINENO" "copysign" "ac_cv_have_decl_copysign" "#include + fi + fi + fi + if test "$gl_cv_cc_double_signbit" = unknown; then + ac_fn_c_check_decl "$LINENO" "copysign" "ac_cv_have_decl_copysign" "#include " if test "x$ac_cv_have_decl_copysign" = xyes; then : ac_have_decl=1 @@ -25172,17 +27295,17 @@ #define HAVE_DECL_COPYSIGN $ac_have_decl _ACEOF - if test "$ac_cv_have_decl_copysign" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether copysign can be used without linking with libm" >&5 + if test "$ac_cv_have_decl_copysign" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether copysign can be used without linking with libm" >&5 $as_echo_n "checking whether copysign can be used without linking with libm... " >&6; } if ${gl_cv_func_copysign_no_libm+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - double x, y; + double x, y; int main () { @@ -25202,15 +27325,15 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_copysign_no_libm" >&5 $as_echo "$gl_cv_func_copysign_no_libm" >&6; } - if test $gl_cv_func_copysign_no_libm = yes; then + if test $gl_cv_func_copysign_no_libm = yes; then $as_echo "#define HAVE_COPYSIGN_IN_LIBC 1" >>confdefs.h - fi - fi - fi - if test "$gl_cv_cc_long_double_signbit" = unknown; then - ac_fn_c_check_decl "$LINENO" "copysignl" "ac_cv_have_decl_copysignl" "#include + fi + fi + fi + if test "$gl_cv_cc_long_double_signbit" = unknown; then + ac_fn_c_check_decl "$LINENO" "copysignl" "ac_cv_have_decl_copysignl" "#include " if test "x$ac_cv_have_decl_copysignl" = xyes; then : ac_have_decl=1 @@ -25222,17 +27345,17 @@ #define HAVE_DECL_COPYSIGNL $ac_have_decl _ACEOF - if test "$ac_cv_have_decl_copysignl" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether copysignl can be used without linking with libm" >&5 + if test "$ac_cv_have_decl_copysignl" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether copysignl can be used without linking with libm" >&5 $as_echo_n "checking whether copysignl can be used without linking with libm... " >&6; } if ${gl_cv_func_copysignl_no_libm+:} false; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - long double x, y; + long double x, y; int main () { @@ -25252,17 +27375,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_copysignl_no_libm" >&5 $as_echo "$gl_cv_func_copysignl_no_libm" >&6; } - if test $gl_cv_func_copysignl_no_libm = yes; then + if test $gl_cv_func_copysignl_no_libm = yes; then $as_echo "#define HAVE_COPYSIGNL_IN_LIBC 1" >>confdefs.h - fi - fi - fi - ;; - esac - ;; - esac + fi + fi + fi + fi if test $REPLACE_SIGNBIT = 1; then @@ -26289,8 +28409,6 @@ - - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" if test "x$ac_cv_type_ptrdiff_t" = xyes; then : @@ -26810,10 +28928,20 @@ - # Define two additional variables used in the Makefile substitution. - if test "$ac_cv_header_stdbool_h" = yes; then - STDBOOL_H='' + if test "$ac_cv_header_stdbool_h" = yes; then + case "$host_os" in + solaris*) + if test -z "$GCC"; then + STDBOOL_H='stdbool.h' + else + STDBOOL_H='' + fi + ;; + *) + STDBOOL_H='' + ;; + esac else STDBOOL_H='stdbool.h' fi @@ -28227,8 +30355,6 @@ - - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" if test "x$ac_cv_type_ptrdiff_t" = xyes; then : @@ -29081,8 +31207,6 @@ - - ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default" if test "x$ac_cv_type_ptrdiff_t" = xyes; then : @@ -29237,7 +31361,13 @@ - if test $ac_cv_func_mbsinit = yes && test $ac_cv_func_mbrtowc = yes; then + + if case "$host_os" in + mingw*) true ;; + *) test $ac_cv_func_mbsinit = yes ;; + esac \ + && test $ac_cv_func_mbrtowc = yes; then + @@ -29295,6 +31425,50 @@ conftest.$ac_objext conftest.beam conftest.$ac_ext fi + else + if test $LOCALE_FR_UTF8 != none; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +/* Tru64 with Desktop Toolkit C has a bug: must be included before + . + BSD/OS 4.0.1 has a bug: , and must be + included before . */ +#include +#include +#include +#include +int main () +{ + if (setlocale (LC_ALL, "$LOCALE_FR_UTF8") != NULL) + { + const char input[] = "B\303\274\303\237er"; /* "Büßer" */ + mbstate_t state; + wchar_t wc; + + memset (&state, '\0', sizeof (mbstate_t)); + if (mbrtowc (&wc, input + 1, 1, &state) == (size_t)(-2)) + if (mbsinit (&state)) + return 2; + } + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_mbrtowc_incomplete_state=yes +else + gl_cv_func_mbrtowc_incomplete_state=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi fi fi @@ -29410,10 +31584,7 @@ REPLACE_WCRTOMB=1 fi else - if test $REPLACE_MBSTATE_T = 1; then - REPLACE_WCRTOMB=1 - fi - if test $REPLACE_WCRTOMB = 0; then + if test $REPLACE_WCRTOMB = 0; then @@ -29471,7 +31642,10 @@ $as_echo "$gl_cv_func_wcrtomb_works" >&6; } case "$gl_cv_func_wcrtomb_works" in *yes) ;; - *) REPLACE_WCRTOMB=1 ;; + *) +$as_echo "#define WCRTOMB_C_LOCALE_BUG 1" >>confdefs.h + + REPLACE_WCRTOMB=1 ;; esac fi if test $REPLACE_WCRTOMB = 0; then @@ -29482,12 +31656,10 @@ else case "$host_os" in - # Guess no on AIX 4, OSF/1 and Solaris. - aix4* | osf* | solaris*) gl_cv_func_wcrtomb_retval="guessing no" ;; - # Guess yes on native Windows. - mingw*) gl_cv_func_wcrtomb_retval="guessing yes" ;; - # Guess yes otherwise. - *) gl_cv_func_wcrtomb_retval="guessing yes" ;; + # Guess no on AIX 4, OSF/1, Solaris, native Windows. + aix4* | osf* | solaris* | mingw*) gl_cv_func_wcrtomb_retval="guessing no" ;; + # Guess yes otherwise. + *) gl_cv_func_wcrtomb_retval="guessing yes" ;; esac if test $LOCALE_FR != none || test $LOCALE_FR_UTF8 != none || test $LOCALE_JA != none || test $LOCALE_ZH_CN != none; then if test "$cross_compiling" = yes; then : @@ -29506,6 +31678,7 @@ #include #include #include +#include int main () { int result = 0; @@ -29518,6 +31691,12 @@ { if (wcrtomb (NULL, 0, NULL) != 1) result |= 2; + { + wchar_t wc = (wchar_t) 0xBADFACE; + if (mbtowc (&wc, "\303\274", 2) == 2) + if (wcrtomb (NULL, wc, NULL) != 1) + result |= 2; + } } if (setlocale (LC_ALL, "$LOCALE_JA") != NULL) { @@ -29548,7 +31727,10 @@ $as_echo "$gl_cv_func_wcrtomb_retval" >&6; } case "$gl_cv_func_wcrtomb_retval" in *yes) ;; - *) REPLACE_WCRTOMB=1 ;; + *) +$as_echo "#define WCRTOMB_RETVAL_BUG 1" >>confdefs.h + + REPLACE_WCRTOMB=1 ;; esac fi fi @@ -29749,10 +31931,14 @@ fi - case "$gl_cv_func_iswcntrl_works" in - *yes) REPLACE_ISWCNTRL=0 ;; - *) REPLACE_ISWCNTRL=1 ;; - esac + if test $GNULIB_OVERRIDES_WINT_T = 1; then + REPLACE_ISWCNTRL=1 + else + case "$gl_cv_func_iswcntrl_works" in + *yes) REPLACE_ISWCNTRL=0 ;; + *) REPLACE_ISWCNTRL=1 ;; + esac + fi if test $HAVE_ISWCNTRL = 0 || test $REPLACE_ISWCNTRL = 1; then @@ -30173,6 +32359,7 @@ + gl_source_base='tests' gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS @@ -30987,12 +33174,38 @@ } fi -if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld" >&5 -$as_echo_n "checking for ld... " >&6; } -elif test "$GCC" = yes; then +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`echo "$ac_prog"| sed 's%\\\\%/%g'` + while echo "$ac_prog" | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } @@ -31000,129 +33213,44 @@ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi -if test -n "$LD"; then - # Let the user override the test with a path. - : -else - if ${acl_cv_path_LD+:} false; then : +if ${acl_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else - - acl_cv_path_LD= # Final result of this test - ac_prog=ld # Program to search in $PATH - if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - acl_output=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - acl_output=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $acl_output in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - acl_output=`echo "$acl_output" | sed 's%\\\\%/%g'` - while echo "$acl_output" | grep "$re_direlt" > /dev/null 2>&1; do - acl_output=`echo $acl_output | sed "s%$re_direlt%/%"` - done - # Got the pathname. No search in PATH is needed. - acl_cv_path_LD="$acl_output" - ac_prog= - ;; - "") - # If it fails, then pretend we aren't using GCC. - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; + if test -z "$LD"; then + acl_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$acl_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 &1 conftest.$ac_ext -/* end confdefs.h. */ -#if defined __powerpc64__ || defined _ARCH_PPC64 - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # The compiler produces 64-bit code. Add option '-b64' so that the - # linker groks 64-bit object files. - case "$acl_cv_path_LD " in - *" -b64 "*) ;; - *) acl_cv_path_LD="$acl_cv_path_LD -b64" ;; - esac - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - sparc64-*-netbsd*) - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __sparcv9 || defined __arch64__ - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - + done + IFS="$acl_save_ifs" else - # The compiler produces 32-bit code. Add option '-m elf32_sparc' - # so that the linker groks 32-bit object files. - case "$acl_cv_path_LD " in - *" -m elf32_sparc "*) ;; - *) acl_cv_path_LD="$acl_cv_path_LD -m elf32_sparc" ;; - esac - + acl_cv_path_LD="$LD" # Let the user override the test with a path. fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - esac - fi - LD="$acl_cv_path_LD" -fi +LD="$acl_cv_path_LD" if test -n "$LD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${acl_cv_prog_gnu_ld+:} false; then : @@ -31179,324 +33307,67 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: checking 32-bit host C ABI" >&5 -$as_echo_n "checking 32-bit host C ABI... " >&6; } -if ${gl_cv_host_cpu_c_abi_32bit+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$gl_cv_host_cpu_c_abi"; then - case "$gl_cv_host_cpu_c_abi" in - i386 | x86_64-x32 | arm | armhf | arm64-ilp32 | hppa | ia64-ilp32 | mips | mipsn32 | powerpc | riscv*-ilp32* | s390 | sparc) - gl_cv_host_cpu_c_abi_32bit=yes ;; - *) - gl_cv_host_cpu_c_abi_32bit=no ;; - esac - else - case "$host_cpu" in - - i[4567]86 ) - gl_cv_host_cpu_c_abi_32bit=yes - ;; - - x86_64 ) - # On x86_64 systems, the C compiler may be generating code in one of - # these ABIs: - # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. - # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 - # with native Windows (mingw, MSVC). - # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. - # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if (defined __x86_64__ || defined __amd64__ \ - || defined _M_X64 || defined _M_AMD64) \ - && !(defined __ILP32__ || defined _ILP32) - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - arm* | aarch64 ) - # Assume arm with EABI. - # On arm64 systems, the C compiler may be generating code in one of - # these ABIs: - # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. - # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. - # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __aarch64__ && !(defined __ILP32__ || defined _ILP32) - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) - # On hppa, the C compiler may be generating 32-bit code or 64-bit - # code. In the latter case, it defines _LP64 and __LP64__. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __LP64__ - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - ia64* ) - # On ia64 on HP-UX, the C compiler may be generating 64-bit code or - # 32-bit code. In the latter case, it defines _ILP32. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef _ILP32 - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=yes -else - gl_cv_host_cpu_c_abi_32bit=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - mips* ) - # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this - # at 32. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - powerpc* ) - # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. - # No need to distinguish them here; the caller may distinguish - # them based on the OS. - # On powerpc64 systems, the C compiler may still be generating - # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may - # be generating 64-bit code. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __powerpc64__ || defined _ARCH_PPC64 - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - rs6000 ) - gl_cv_host_cpu_c_abi_32bit=yes - ;; - - riscv32 | riscv64 ) - # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. - # Size of 'long' and 'void *': - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __LP64__ - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - s390* ) - # On s390x, the C compiler may be generating 64-bit (= s390x) code - # or 31-bit (= s390) code. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __LP64__ || defined __s390x__ - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - sparc | sparc64 ) - # UltraSPARCs running Linux have `uname -m` = "sparc64", but the - # C compiler still generates 32-bit code. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined __sparcv9 || defined __arch64__ - int ok; - #else - error fail - #endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_cv_host_cpu_c_abi_32bit=no -else - gl_cv_host_cpu_c_abi_32bit=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ;; - - *) - gl_cv_host_cpu_c_abi_32bit=no - ;; - esac - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi_32bit" >&5 -$as_echo "$gl_cv_host_cpu_c_abi_32bit" >&6; } - - HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" - - - - - + acl_libdirstem=lib + acl_libdirstem2= case "$host_os" in solaris*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 $as_echo_n "checking for 64-bit host... " >&6; } if ${gl_cv_solaris_64bit+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ + #ifdef _LP64 - int ok; - #else - error fail - #endif +sixtyfour bits +#endif _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "sixtyfour bits" >/dev/null 2>&1; then : gl_cv_solaris_64bit=yes else gl_cv_solaris_64bit=no fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +rm -f conftest* + fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 -$as_echo "$gl_cv_solaris_64bit" >&6; };; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the common suffixes of directories in the library search path" >&5 -$as_echo_n "checking for the common suffixes of directories in the library search path... " >&6; } -if ${acl_cv_libdirstems+:} false; then : - $as_echo_n "(cached) " >&6 -else - acl_libdirstem=lib - acl_libdirstem2= - case "$host_os" in - solaris*) - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - if test "$HOST_CPU_C_ABI_32BIT" != yes; then - searchpath=`(if test -f /usr/bin/gcc \ - && LC_ALL=C /usr/bin/gcc -print-search-dirs >/dev/null 2>/dev/null; then \ - LC_ALL=C /usr/bin/gcc -print-search-dirs; \ - else \ - LC_ALL=C $CC -print-search-dirs; \ - fi) 2>/dev/null \ - | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then +$as_echo "$gl_cv_solaris_64bit" >&6; } + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" - acl_cv_libdirstems="$acl_libdirstem,$acl_libdirstem2" + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_libdirstems" >&5 -$as_echo "$acl_cv_libdirstems" >&6; } - # Decompose acl_cv_libdirstems into acl_libdirstem and acl_libdirstem2. - acl_libdirstem=`echo "$acl_cv_libdirstems" | sed -e 's/,.*//'` - acl_libdirstem2=`echo "$acl_cv_libdirstems" | sed -e '/,/s/.*,//'` @@ -31545,7 +33416,7 @@ additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && test ! -d "$withval/$acl_libdirstem"; then + && ! test -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi @@ -31986,6 +33857,7 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 $as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : @@ -32390,6 +34262,7 @@ + use_additional=yes acl_save_prefix="$prefix" @@ -32427,7 +34300,7 @@ additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && test ! -d "$withval/$acl_libdirstem"; then + && ! test -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi @@ -32843,6 +34716,7 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 $as_echo_n "checking for GNU gettext in libintl... " >&6; } if eval \${$gt_func_gnugettext_libintl+:} false; then : @@ -33108,6 +34982,12 @@ +if test "x$with_slang" = xyes; then + if test "x$enable_tiny" != xyes; then + as_fn_error $? "--with-slang is supported only together with --enable-tiny" "$LINENO" 5 + fi +fi + # Check whether --enable-browser was given. if test "${enable_browser+set}" = set; then : enableval=$enable_browser; @@ -33866,7 +35746,6 @@ - if test "x$enable_utf8" != xno; then for ac_func in iswalnum iswpunct mblen mbstowcs mbtowc wctomb do : @@ -35095,12 +36974,20 @@ as_fn_error $? "conditional \"GL_GENERATE_GLOB_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi - - if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_STDINT_H_TRUE}" && test -z "${GL_GENERATE_STDINT_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_STDINT_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + + if test -z "${GL_GENERATE_STDDEF_H_TRUE}" && test -z "${GL_GENERATE_STDDEF_H_FALSE}"; then as_fn_error $? "conditional \"GL_GENERATE_STDDEF_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -35117,14 +37004,6 @@ as_fn_error $? "conditional \"GL_GENERATE_STDDEF_H\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then - as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${GL_GENERATE_STDINT_H_TRUE}" && test -z "${GL_GENERATE_STDINT_H_FALSE}"; then - as_fn_error $? "conditional \"GL_GENERATE_STDINT_H\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_TRUE}" && test -z "${LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH_FALSE}"; then as_fn_error $? "conditional \"LIBUNISTRING_COMPILE_UNIWIDTH_WIDTH\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -35582,7 +37461,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by GNU nano $as_me 4.5, which was +This file was extended by GNU nano $as_me 4.8, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -35650,7 +37529,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -GNU nano config.status 4.5 +GNU nano config.status 4.8 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru nano-4.5/configure.ac nano-4.8/configure.ac --- nano-4.5/configure.ac 2019-10-04 09:47:50.000000000 +0000 +++ nano-4.8/configure.ac 2020-02-07 10:10:15.000000000 +0000 @@ -1,6 +1,6 @@ # Configuration for GNU nano - a small and user-friendly text editor # -# Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. +# Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. # Copyright (C) 2014, 2017 Mike Frysinger # # GNU nano is free software: you can redistribute it and/or modify @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see https://www.gnu.org/licenses/. -AC_INIT([GNU nano], [4.5], [nano-devel@gnu.org], [nano]) +AC_INIT([GNU nano], [4.8], [nano-devel@gnu.org], [nano]) AC_CONFIG_SRCDIR([src/nano.c]) AC_CANONICAL_HOST AM_INIT_AUTOMAKE([1.14]) @@ -89,6 +89,12 @@ dnl Checks for options. +if test "x$with_slang" = xyes; then + if test "x$enable_tiny" != xyes; then + AC_MSG_ERROR([--with-slang is supported only together with --enable-tiny]) + fi +fi + AC_ARG_ENABLE(browser, AS_HELP_STRING([--disable-browser], [Disable the built-in file browser])) if test "x$enable_tiny" = xyes; then @@ -516,7 +522,6 @@ ;; esac], [AC_MSG_RESULT(no)]) - dnl Checks for functions. if test "x$enable_utf8" != xno; then diff -Nru nano-4.5/debian/changelog nano-4.8/debian/changelog --- nano-4.5/debian/changelog 2019-10-11 10:28:03.000000000 +0000 +++ nano-4.8/debian/changelog 2020-03-03 11:35:42.000000000 +0000 @@ -1,8 +1,43 @@ -nano (4.5-1~18.04.york0) bionic; urgency=medium +nano (4.8-1~18.04.york0) bionic; urgency=medium - * No-change backport + * Revert to debhelper 11 - -- Jonathon Fernyhough Fri, 11 Oct 2019 11:28:03 +0100 + -- Jonathon Fernyhough Tue, 03 Mar 2020 11:35:42 +0000 + +nano (4.8-1) unstable; urgency=medium + + * The "SIT AND TALK" release. + * New upstream release. + * Sync debian/nanorc with upstream nanorc.sample. + + -- Jordi Mallach Fri, 14 Feb 2020 11:08:47 +0100 + +nano (4.7-2) unstable; urgency=medium + + * The "Glòria" release. + * No change reupload as I uploaded amd64 binaries by mistake. 🙄 + + -- Jordi Mallach Thu, 30 Jan 2020 23:54:29 +0100 + +nano (4.7-1) unstable; urgency=medium + + * The "#MaiPAI" release. + * New upstream release. + * Add gbp.conf. + * Update Standards-Version to 4.5.0. + * Build nano-tiny against ncurses. Slang support is increasingly + buggy due to untested codepaths and bugs in Slang itself. + + -- Jordi Mallach Thu, 30 Jan 2020 00:29:34 +0100 + +nano (4.6-1) unstable; urgency=medium + + * The "Tren Gandia-Dénia" release. + * New upstream release. + * Sync debian/nanorc with upstream nanorc.sample. + * Suggest hunspell instead of spell, as nano will now try that first. + + -- Jordi Mallach Fri, 29 Nov 2019 16:14:55 +0100 nano (4.5-1) unstable; urgency=medium diff -Nru nano-4.5/debian/compat nano-4.8/debian/compat --- nano-4.5/debian/compat 1970-01-01 00:00:00.000000000 +0000 +++ nano-4.8/debian/compat 2020-03-03 11:35:40.000000000 +0000 @@ -0,0 +1 @@ +11 diff -Nru nano-4.5/debian/control nano-4.8/debian/control --- nano-4.5/debian/control 2019-10-08 19:45:05.000000000 +0000 +++ nano-4.8/debian/control 2020-03-03 11:35:35.000000000 +0000 @@ -3,12 +3,12 @@ Priority: optional Maintainer: Jordi Mallach Uploaders: Steve Langasek -Build-Depends: debhelper-compat (= 12), +Build-Depends: debhelper (>= 11), libncurses5-dev, libncursesw5-dev, libslang2-dev, pkg-config -Standards-Version: 4.3.0 +Standards-Version: 4.5.0 Vcs-Git: https://salsa.debian.org/debian/nano.git Vcs-Browser: https://salsa.debian.org/debian/nano Homepage: https://www.nano-editor.org/ @@ -18,7 +18,7 @@ Architecture: any Priority: important Depends: ${misc:Depends}, ${shlibs:Depends} -Suggests: spell +Suggests: hunspell Breaks: nano-tiny (<< 2.8.6-2) Conflicts: pico Replaces: pico, nano-tiny (<< 2.8.6-2) diff -Nru nano-4.5/debian/gbp.conf nano-4.8/debian/gbp.conf --- nano-4.5/debian/gbp.conf 1970-01-01 00:00:00.000000000 +0000 +++ nano-4.8/debian/gbp.conf 2020-01-30 07:53:56.000000000 +0000 @@ -0,0 +1,5 @@ +[DEFAULT] +pristine-tar = true +debian-branch = master +upstream-branch = upstream +upstream-vcs-tag = v%(version)s diff -Nru nano-4.5/debian/nanorc nano-4.8/debian/nanorc --- nano-4.5/debian/nanorc 2019-10-08 19:59:21.000000000 +0000 +++ nano-4.8/debian/nanorc 2020-02-07 11:27:28.000000000 +0000 @@ -54,9 +54,9 @@ ## Do not use the line below the title bar, leaving it entirely blank. # set emptyline -## Enable hard-wrapping and set the target width, both for automatic -## line wrapping and for justifying paragraphs. If the value is 0 or -## less, the wrapping point will be the screen width minus this number. +## Set the target width for automatic hard-wrapping and for justifying +## paragraphs. If the specified value is 0 or less, the wrapping point +## will be the terminal's width minus this number. # set fill -8 ## Remember the used search/replace strings for the next session. @@ -97,10 +97,6 @@ ## Don't automatically add a newline when a file does not end with one. # set nonewlines -## Don't pause between warnings at startup. Which means that only the -## last one will be readable (when there are multiple ones). -# set nopauses - ## Set operating directory. nano will not read or write files outside ## this directory and its subdirectories. Also, the current directory ## is changed to here, so any files are inserted from this dir. A blank @@ -218,44 +214,31 @@ ## Setup of syntax coloring. ## -## Format: -## -## syntax "short description" ["filename regex" ...] -## -## The "none" syntax is reserved; specifying it on the command line is -## the same as not having a syntax at all. The "default" syntax is -## special: it takes no filename regexes, and applies to files that -## don't match any other syntax's filename regexes. +## syntax "name" ["filename regex" ...] ## -## color foreground,background "regex" ["regex"...] -## or -## icolor foreground,background "regex" ["regex"...] +## color|icolor foreground,background "regex" ["regex"...] +## [...] ## -## "color" will do case-sensitive matches, while "icolor" will do +## 'color' will do case-sensitive matches, while 'icolor' will do ## case-insensitive matches. ## -## Valid color names ares: white, black, normal, red, blue, green, -## yellow, magenta, cyan. For foreground colors, you may use the -## prefix "bright" to get a stronger highlight. +## All color commands are applied in the order in which they are specified, +## meaning that later commands can recolor stuff that was colored earlier. +## +## Valid color names for foreground and background are: white, black, normal, +## red, blue, green, yellow, magenta, cyan. For foreground colors, you may +## use the prefix "bright" to get a stronger highlight. ## ## All regexes (regular expressions) are of the extended type (ERE). ## -## To use multi-line regexes, use the start="regex" end="regex" -## [start="regex" end="regex"...] format. +## If the coloring rule should span multiple lines, use the following format: ## -## If your system supports transparency, not specifying a background -## color will use a transparent color. If you don't want this, be sure -## to set the background color to black or white. +## color fg,bg start="regex" end="regex" ## ## If you wish, you may put your syntax definitions in separate files. ## You can make use of such files as follows: ## -## include "/path/to/syntax_file.nanorc" -## -## Unless otherwise noted, the name of the syntax file (without the -## ".nanorc" extension) should be the same as the "short description" -## name inside that file. These names are kept fairly short to make -## them easier to remember and faster to type using nano's -Y option. +## include "/path/to/syntax_file.nanorc" ## To include all existing syntax definitions, you can do: include "/usr/share/nano/*.nanorc" @@ -264,7 +247,7 @@ ## If should always produce four spaces when editing a Python file, ## independent of the settings of 'tabsize' and 'tabstospaces': # extendsyntax python tabgives " " -# + ## If should always produce an actual TAB when editing a Makefile: # extendsyntax makefile tabgives " " @@ -285,6 +268,9 @@ ## such as ^O for Open, ^F for Find, ^H for Help, and ^Q for Quit, ## then uncomment these: #bind ^Q exit all +#bind ^S savefile main +#bind ^W writeout main +#bind ^O insert main #bind ^H help all #bind ^H exit help #bind ^F whereis all @@ -292,23 +278,23 @@ #bind ^B wherewas all #bind ^D findprevious all #bind ^R replace main -#bind ^W writeout main -#bind ^O insert main -#unbind ^V all -#unbind ^Y all #bind M-X flipnewbuffer all #bind ^X cut all -#bind ^C copy all +#bind ^C copy main #bind ^V paste all #bind ^P curpos main +#bind ^A mark main +#unbind ^K main +#unbind ^U all +#unbind ^N main +#unbind ^Y all +#unbind M-J main +#unbind M-T main #bind ^T gotoline main #bind ^T gotodir browser #bind ^Y speller main -#unbind ^K all -#unbind ^U all +#bind M-U undo main #bind M-R redo main #bind ^U undo main #bind ^E redo main -#unbind M-J main -#unbind M-T main #set multibuffer diff -Nru nano-4.5/debian/rules nano-4.8/debian/rules --- nano-4.5/debian/rules 2019-10-04 11:17:39.000000000 +0000 +++ nano-4.8/debian/rules 2020-01-30 07:53:56.000000000 +0000 @@ -25,6 +25,14 @@ --disable-justify \ --disable-tabcomp \ --disable-nls \ + --disable-wrapping + +CONFFLAGS_udeb = \ + --enable-tiny \ + --disable-speller \ + --disable-justify \ + --disable-tabcomp \ + --disable-nls \ --disable-wrapping \ --with-slang @@ -37,7 +45,7 @@ dh_auto_configure --builddirectory=$(tinybuild) \ -- $(CONFFLAGS) $(CONFFLAGS_tiny) CFLAGS="$(CFLAGS) $(CFTINY)" dh_auto_configure --builddirectory=$(udebbuild) \ - -- $(CONFFLAGS) $(CONFFLAGS_tiny) CFLAGS="$(CFLAGS) $(CFTINY)" + -- $(CONFFLAGS) $(CONFFLAGS_udeb) CFLAGS="$(CFLAGS) $(CFTINY)" override_dh_auto_build: dh_auto_build --builddirectory=$(nanobuild) diff -Nru nano-4.5/doc/faq.html nano-4.8/doc/faq.html --- nano-4.5/doc/faq.html 2019-10-04 09:47:50.000000000 +0000 +++ nano-4.8/doc/faq.html 2020-02-07 10:10:15.000000000 +0000 @@ -1,9 +1,12 @@ - - + + + The GNU nano editor FAQ - + + +

The GNU nano editor FAQ

@@ -28,11 +31,12 @@ 3.1. How do I install the RPM or DEB package?
3.2. Compiling from source: WHAT THE HECK DO I DO NOW?
3.3. Why does everything go into /usr/local?
- 3.5. nano should automatically run strip on the binary when installing it!
- 3.6. How can I make the executable smaller? This is too bloated!
- 3.7. Tell me more about this multibuffer stuff!
- 3.8. Tell me more about this verbatim input stuff!
- 3.9. How do I make a .nanorc file that nano will read when I start it?
+ 3.4. nano should automatically run strip on the binary when installing it!
+ 3.5. How can I make the executable smaller? This is too bloated!
+ 3.6. Tell me more about this multibuffer stuff!
+ 3.7. Tell me more about this verbatim input stuff!
+ 3.8. How do I make a .nanorc file that nano will read when I start it?
+ 3.9. Why does my self-compiled nano not read /etc/nanorc?

4. Running

@@ -85,7 +89,7 @@

1.3. Why the name change from TIP?

On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).

1.4. What is the current version of nano?

-

The current version of nano should be 4.5. Of course, you should always check the nano homepage to see what the latest and greatest version is.

+

The current version of nano should be 4.8. Of course, you should always check the nano homepage to see what the latest and greatest version is.

1.5. I want to read the man page without having to download the program!

Jeez, demanding, aren't we? Okay, look here.


@@ -94,8 +98,8 @@

2.1. Web sites that carry nano.

The nano source tarballs can be downloaded from the following web sites:

2.2. RPM packages (RedHat, OpenSuse, and derivatives).

@@ -112,7 +116,7 @@
  • testing
  • unstable
  • -

    You can also have a look at the Package Pool to see all the available binary and source packages.

    +

    You can also have a look at the Package Pool to see all the available binary and source packages.

    2.4. By GIT (for the brave).

    For the 'bleeding edge' current version of nano, you can use GIT to download the current source code. Note: believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see the nano GIT document for info on anonymous GIT access to the nano source.

    @@ -120,23 +124,23 @@

    3. Installation and Configuration

    3.1. How do I install the RPM or DEB package?

    -

    It's simple really! As root, type rpm -Uvh nano-x.y.z-1.i386.rpm if you have a RedHat-ish system or dpkg -i nano_x.y.z-1.deb if you have a Debian-ish system, where x.y.z is the release of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.

    +

    It's simple really! As root, type rpm -Uvh nano-x.y-1*.rpm if you have a RedHat-ish system or dpkg -i nano_x.y-1*.deb if you have a Debian-ish system, where x.y is the version number of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.

    3.2. Compiling from source: WHAT THE HECK DO I DO NOW?

    Okay, take a deep breath, this really isn't hard. Unpack the nano source with a command like:

    -

    tar -xvf nano-x.y.z.tar.gz

    +

    tar -xvf nano-x.y.tar.gz

    Then you need to run configure with any options you might want (if any).

    The average case is this:

    -

    cd nano-x.y.z/
    +

    cd nano-x.y/
    ./configure
    make
    make install (as root, of course)

    3.3. Why does everything go into /usr/local?

    Well, that's what the configure script defaults to. If you wish to change this, simply do this:

    ./configure --prefix=/usr

    -

    to put nano into /usr/bin when you run make install.

    -

    3.5. nano should automatically run strip on the binary when installing it!

    -

    Actually, it does, but you have to use make install-strip. The default make install does not, and will not, run strip automatically.

    -

    3.6. How can I make the executable smaller? This is too bloated!

    +

    This will put nano into /usr/bin when you run make install.

    +

    3.4. nano should automatically run strip on the binary when installing it!

    +

    It does when you use make install-strip. The default make install does not, and will not, run strip automatically.

    +

    3.5. How can I make the executable smaller? This is too bloated!

    Actually, there are several parts of the editor that can be disabled. You can pass arguments to the configure script that disable certain features. Here's a brief list:

       --disable-browser       Disable the built-in file browser
    @@ -156,26 +160,28 @@
       --disable-tabcomp       Disable the tab-completion functions
       --disable-wordcomp      Disable the word-completion function
       --disable-wrapping      Disable all hard-wrapping of text
    -

    There's also the --enable-tiny option which disables everything above, as well as some larger chunks of the program (like the marker code that you use with Control-^ to select text). Also, if you know you aren't going to be using other languages, you can use --disable-nls to disable internationalization and save a few K to a few dozen K depending on whether you have locale support on your system. And finally, there's always good old strip to strip all debugging code and code that exists in libraries on your system.

    +

    There's also the --enable-tiny option which disables everything above, as well as some larger chunks of the program (like the undo/redo code and the code for selecting text). Also, if you know you don't need other languages, you can use --disable-nls to disable internationalization and save a few kilobytes. And finally, there's always good old strip to remove all unneeded symbols.

    -

    3.7. Tell me more about this multibuffer stuff!

    +

    3.6. Tell me more about this multibuffer stuff!

    To use multiple file buffers, you must not have configured nano with --disable-multibuffer nor with --enable-tiny (use nano -V to check the compilation options). Then when you want to insert a file into its own buffer instead of into the current file, just hit Meta-F after typing ^R. If you always want files to be loaded into their own buffers, use the -F or --multibuffer flag when you invoke nano, or add set multibuffer to your .nanorc file.

    You can move between the buffers you have open with the Meta-< and Meta-> keys, or more easily without holding Shift: Meta-, and Meta-. (clear as mud, right? =-). When you have more than one buffer open, the ^X shortcut will say "Close", instead of "Exit".

    -

    3.8. Tell me more about this verbatim input stuff!

    +

    3.7. Tell me more about this verbatim input stuff!

    When you want to insert a literal character into the file you're editing, such as a control character that nano usually treats as a command, first press Meta-V (if you're not at a prompt, you'll get the message "Verbatim Input" on the status bar), then press the key(s) that generate the character you want.

    Alternatively, if Unicode support is enabled (see section 5.3), you can press Meta-V and then type a six-digit hexadecimal code (from 000000 to 10FFFF, case-insensitive), and the character with the corresponding value will be inserted. The status bar will change to "Unicode Input: ......" when you do this.

    -

    3.9. How do I make a .nanorc file that will be read when I start nano?

    -

    It's not hard at all! But, your nano must not have been compiled with --disable-nanorc. Then simply copy the sample.nanorc that came with the nano source or your nano package (most likely in /usr/doc/nano) to .nanorc in your home directory. If you didn't get one, the syntax of the file is simple. Flags are turned on and off by using the words set and unset plus the long option name for the feature. For example, "set nowrap" or "set smarthome".

    +

    3.8. How do I make a .nanorc file that will be read when I start nano?

    +

    It's not hard at all! Simply copy the sample.nanorc from the doc/ directory in the nano source package (or from /usr/doc/nano on your system) to .nanorc in your home directory, and then edit it. If you didn't get a sample nanorc, the syntax of the file is simple: features are turned on and off by using the words set and unset followed by the long option name of the feature (see man nanorc for the full list of options). For example, "set quickblank" or "set smarthome". Of course, for this to work, your nano must not have been compiled with --disable-nanorc.

    +

    3.9. Why does my self-compiled nano not read /etc/nanorc?

    +

    By default (see 3.3), nano gets installed into /usr/local. This also means that, at startup, nano will read /usr/local/etc/nanorc instead of /etc/nanorc. You can make a symlink from the former to the latter if you want your self-compiled nano to read the same nanorc as the system-installed nano. Or you can configure your nano to overwrite the system nano (again, see 3.3).


    4. Running

    4.1. How do I open a file with a name beginning with '+' from the command line?

    -

    If a command-line option that begins with '+' is followed by another option, the former is always treated as a starting line and column number, and the latter is always treated as a filename. If a command-line option that begins with '+' isn't followed by another option, it's always treated as a filename. Examples:

    -

    To open '+filename.txt' starting on line 1: nano +filename.txt
    +

    If a command-line argument that begins with '+' is followed by another argument, the former is always treated as a starting line (plus column number), and the latter always as a filename. If a command-line argument that begins with '+' isn't followed by another argument, it's treated as a filename. Examples:

    +

    To open '+filename.txt': nano +filename.txt
    To open '+filename.txt' starting on line 10: nano +10 +filename.txt
    To open '+filename.txt' starting on line 1, column 20: nano +,20 +filename.txt
    To open '+filename.txt' starting on line 10, column 20: nano +10,20 +filename.txt
    - To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 40 (if nano has been compiled with multibuffer support): nano +1 +filename.txt +40 filename.txt

    + To open '+filename.txt' starting on line 1 and 'filename.txt' starting on line 40: nano +1 +filename.txt +40 filename.txt

    4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?

    Try setting your $TERM variable to 'vt100'. nano doesn't yet support every term entry under the sun.

    Bourne shell users (bash and sh): export TERM=vt100
    @@ -187,9 +193,11 @@

    4.5. How do I select text for or paste text from the clipboard when nano's mouse support is turned on?

    Try holding down the Shift key and selecting or pasting the text as you normally would.

    4.6. When I paste text into a document, each line gets indented further than the last. Why? And how can I stop this?

    -

    You have the autoindent feature turned on. Hit Meta-I to turn it off, paste your text, and then hit Meta-I again to turn it back on.

    +

    You have the autoindent feature turned on. Hit Meta-I to turn it off, paste your text, and then hit Meta-I again to turn it back on.

    +

    Update: Since version 4.8, nano will suppress auto-indentation during a paste, so you no longer need to toggle it off and on manually.

    4.7. When I paste from Windows into a remote nano, nano rewraps the lines. What gives?

    -

    When pasting from Windows, in some situations linefeeds are sent instead of carriage returns (Enters). And linefeeds are ^Js, which make nano justify (rewrap) the current paragraph. To prevent these linefeeds from causing these unwanted justifications, add this line to your .nanorc on the remote Linux box: unbind ^J main or bind ^J enter main, depending on whether the paste contains CR + LF or only LF.

    +

    When pasting from Windows, in some situations linefeeds are sent instead of carriage returns (Enters). And linefeeds are ^Js, which make nano justify (rewrap) the current paragraph. To prevent these linefeeds from causing these unwanted justifications, add this line to your .nanorc on the remote Linux box: unbind ^J main or bind ^J enter main, depending on whether the paste contains CR + LF or only LF.

    +

    Update: Since version 4.8, nano will ignore linefeed characters in a paste, so you no longer need the above workaround.

    4.8. I've compiled nano with color support, but I don't see any color when I run it!

    If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Several example configurations are in the syntax/ subdirectory of the nano source, which are normally installed to /usr/local/share/nano/. To enable all of them, uncomment the line # include "/usr/local/share/nano/*.nanorc" in your nanorc. See also section 3.9.

    4.9. How do I make nano my default editor (in Pine, mutt, etc.)?

    @@ -203,8 +211,8 @@ [ ] enable-alternate-editor-implicitly

    Then exit (E) and select Yes (Y).

    If you're a mutt user, you should see an effect immediately the next time you log in. No further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your .muttrc:

    -

    my_hdr X-Composer: nano x.y.z

    -

    Again, replace x.y.z with the version of nano you use.

    +

    my_hdr X-Composer: nano-x.y

    +

    Again, replace x.y with the version of nano you use.


    5. Internationalization

    diff -Nru nano-4.5/doc/Makefile.in nano-4.8/doc/Makefile.in --- nano-4.5/doc/Makefile.in 2019-10-04 10:06:11.000000000 +0000 +++ nano-4.8/doc/Makefile.in 2020-02-07 10:20:15.000000000 +0000 @@ -119,29 +119,29 @@ $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \ $(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/glob.m4 \ $(top_srcdir)/m4/glob_h.m4 $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/gnulib-comp.m4 \ - $(top_srcdir)/m4/host-cpu-c-abi.m4 $(top_srcdir)/m4/iconv.m4 \ + $(top_srcdir)/m4/gnulib-comp.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/include_next.m4 \ $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax_t.m4 \ - $(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/isblank.m4 \ - $(top_srcdir)/m4/isnand.m4 $(top_srcdir)/m4/isnanf.m4 \ - $(top_srcdir)/m4/isnanl.m4 $(top_srcdir)/m4/iswblank.m4 \ - $(top_srcdir)/m4/langinfo_h.m4 $(top_srcdir)/m4/largefile.m4 \ - $(top_srcdir)/m4/ldexpl.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/isblank.m4 $(top_srcdir)/m4/isnand.m4 \ + $(top_srcdir)/m4/isnanf.m4 $(top_srcdir)/m4/isnanl.m4 \ + $(top_srcdir)/m4/iswblank.m4 $(top_srcdir)/m4/langinfo_h.m4 \ + $(top_srcdir)/m4/largefile.m4 $(top_srcdir)/m4/ldexpl.m4 \ + $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ + $(top_srcdir)/m4/lib-prefix.m4 \ $(top_srcdir)/m4/libunistring-base.m4 \ $(top_srcdir)/m4/limits-h.m4 $(top_srcdir)/m4/localcharset.m4 \ $(top_srcdir)/m4/locale-fr.m4 $(top_srcdir)/m4/locale-ja.m4 \ $(top_srcdir)/m4/locale-zh.m4 $(top_srcdir)/m4/locale_h.m4 \ $(top_srcdir)/m4/localeconv.m4 \ $(top_srcdir)/m4/localtime-buffer.m4 $(top_srcdir)/m4/lock.m4 \ - $(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/lstat.m4 \ - $(top_srcdir)/m4/malloc.m4 $(top_srcdir)/m4/malloca.m4 \ - $(top_srcdir)/m4/math_h.m4 $(top_srcdir)/m4/mbrtowc.m4 \ - $(top_srcdir)/m4/mbsinit.m4 $(top_srcdir)/m4/mbsrtowcs.m4 \ - $(top_srcdir)/m4/mbstate_t.m4 $(top_srcdir)/m4/mbtowc.m4 \ - $(top_srcdir)/m4/memchr.m4 $(top_srcdir)/m4/mempcpy.m4 \ - $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/m4/msvc-inval.m4 \ + $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/malloc.m4 \ + $(top_srcdir)/m4/malloca.m4 $(top_srcdir)/m4/math_h.m4 \ + $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbsinit.m4 \ + $(top_srcdir)/m4/mbsrtowcs.m4 $(top_srcdir)/m4/mbstate_t.m4 \ + $(top_srcdir)/m4/mbtowc.m4 $(top_srcdir)/m4/memchr.m4 \ + $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/mmap-anon.m4 \ + $(top_srcdir)/m4/msvc-inval.m4 \ $(top_srcdir)/m4/msvc-nothrow.m4 $(top_srcdir)/m4/multiarch.m4 \ $(top_srcdir)/m4/nl_langinfo.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/off_t.m4 \ @@ -151,8 +151,8 @@ $(top_srcdir)/m4/progtest.m4 \ $(top_srcdir)/m4/pthread_rwlock_rdlock.m4 \ $(top_srcdir)/m4/raise.m4 $(top_srcdir)/m4/readdir.m4 \ - $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/sigaction.m4 \ - $(top_srcdir)/m4/signal_h.m4 \ + $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/setlocale_null.m4 \ + $(top_srcdir)/m4/sigaction.m4 $(top_srcdir)/m4/signal_h.m4 \ $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/signbit.m4 \ $(top_srcdir)/m4/size_max.m4 \ $(top_srcdir)/m4/snprintf-posix.m4 \ @@ -171,13 +171,14 @@ $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utime_h.m4 \ $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \ - $(top_srcdir)/m4/vasnprintf.m4 \ + $(top_srcdir)/m4/vasnprintf.m4 $(top_srcdir)/m4/visibility.m4 \ $(top_srcdir)/m4/vsnprintf-posix.m4 \ $(top_srcdir)/m4/vsnprintf.m4 $(top_srcdir)/m4/warn-on-use.m4 \ $(top_srcdir)/m4/wchar_h.m4 $(top_srcdir)/m4/wchar_t.m4 \ $(top_srcdir)/m4/wcrtomb.m4 $(top_srcdir)/m4/wctype_h.m4 \ $(top_srcdir)/m4/wcwidth.m4 $(top_srcdir)/m4/wint_t.m4 \ - $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac + $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/m4/zzgnulib.m4 \ + $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_html_DATA_DIST) \ @@ -364,6 +365,7 @@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ +CFLAG_VISIBILITY = @CFLAG_VISIBILITY@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CURSES_LIB = @CURSES_LIB@ @@ -501,6 +503,7 @@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@ GNULIB_GETLOGIN = @GNULIB_GETLOGIN@ GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@ +GNULIB_GETOPT_POSIX = @GNULIB_GETOPT_POSIX@ GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@ GNULIB_GETPASS = @GNULIB_GETPASS@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ @@ -516,6 +519,8 @@ GNULIB_ILOGB = @GNULIB_ILOGB@ GNULIB_ILOGBF = @GNULIB_ILOGBF@ GNULIB_ILOGBL = @GNULIB_ILOGBL@ +GNULIB_IMAXABS = @GNULIB_IMAXABS@ +GNULIB_IMAXDIV = @GNULIB_IMAXDIV@ GNULIB_ISATTY = @GNULIB_ISATTY@ GNULIB_ISBLANK = @GNULIB_ISBLANK@ GNULIB_ISFINITE = @GNULIB_ISFINITE@ @@ -526,6 +531,8 @@ GNULIB_ISNANL = @GNULIB_ISNANL@ GNULIB_ISWBLANK = @GNULIB_ISWBLANK@ GNULIB_ISWCTYPE = @GNULIB_ISWCTYPE@ +GNULIB_ISWDIGIT = @GNULIB_ISWDIGIT@ +GNULIB_ISWXDIGIT = @GNULIB_ISWXDIGIT@ GNULIB_LCHMOD = @GNULIB_LCHMOD@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LDEXPF = @GNULIB_LDEXPF@ @@ -652,6 +659,7 @@ GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SETHOSTNAME = @GNULIB_SETHOSTNAME@ GNULIB_SETLOCALE = @GNULIB_SETLOCALE@ +GNULIB_SETLOCALE_NULL = @GNULIB_SETLOCALE_NULL@ GNULIB_SIGACTION = @GNULIB_SIGACTION@ GNULIB_SIGNAL_H_SIGPIPE = @GNULIB_SIGNAL_H_SIGPIPE@ GNULIB_SIGNBIT = @GNULIB_SIGNBIT@ @@ -684,10 +692,12 @@ GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@ GNULIB_STRSTR = @GNULIB_STRSTR@ GNULIB_STRTOD = @GNULIB_STRTOD@ +GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@ GNULIB_STRTOK_R = @GNULIB_STRTOK_R@ GNULIB_STRTOLD = @GNULIB_STRTOLD@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ GNULIB_STRTOULL = @GNULIB_STRTOULL@ +GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@ GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@ GNULIB_SYMLINK = @GNULIB_SYMLINK@ GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@ @@ -824,6 +834,8 @@ HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ +HAVE_DECL_IMAXABS = @HAVE_DECL_IMAXABS@ +HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@ HAVE_DECL_INITSTATE = @HAVE_DECL_INITSTATE@ HAVE_DECL_LDEXPL = @HAVE_DECL_LDEXPL@ HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ @@ -854,7 +866,9 @@ HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@ HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@ HAVE_DECL_TANL = @HAVE_DECL_TANL@ HAVE_DECL_TRUNC = @HAVE_DECL_TRUNC@ HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ @@ -923,6 +937,7 @@ HAVE_ILOGB = @HAVE_ILOGB@ HAVE_ILOGBF = @HAVE_ILOGBF@ HAVE_ILOGBL = @HAVE_ILOGBL@ +HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@ HAVE_INITSTATE = @HAVE_INITSTATE@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_ISBLANK = @HAVE_ISBLANK@ @@ -951,7 +966,6 @@ HAVE_LOGBL = @HAVE_LOGBL@ HAVE_LOGF = @HAVE_LOGF@ HAVE_LOGL = @HAVE_LOGL@ -HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ HAVE_MBRLEN = @HAVE_MBRLEN@ @@ -1068,13 +1082,13 @@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ -HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_USLEEP = @HAVE_USLEEP@ HAVE_UTIME = @HAVE_UTIME@ HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ HAVE_UTIME_H = @HAVE_UTIME_H@ HAVE_VASPRINTF = @HAVE_VASPRINTF@ HAVE_VDPRINTF = @HAVE_VDPRINTF@ +HAVE_VISIBILITY = @HAVE_VISIBILITY@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_WCPCPY = @HAVE_WCPCPY@ @@ -1124,6 +1138,8 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INT32_MAX_LT_INTMAX_MAX = @INT32_MAX_LT_INTMAX_MAX@ +INT64_MAX_EQ_LONG_MAX = @INT64_MAX_EQ_LONG_MAX@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ @@ -1133,12 +1149,20 @@ LIBINTL = @LIBINTL@ LIBMULTITHREAD = @LIBMULTITHREAD@ LIBOBJS = @LIBOBJS@ +LIBPMULTITHREAD = @LIBPMULTITHREAD@ +LIBPTHREAD = @LIBPTHREAD@ LIBS = @LIBS@ +LIBSTDTHREAD = @LIBSTDTHREAD@ LIBTHREAD = @LIBTHREAD@ LIBUNISTRING_UNITYPES_H = @LIBUNISTRING_UNITYPES_H@ LIBUNISTRING_UNIWIDTH_H = @LIBUNISTRING_UNIWIDTH_H@ LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ LIB_GETLOGIN = @LIB_GETLOGIN@ +LIB_HARD_LOCALE = @LIB_HARD_LOCALE@ +LIB_MBRTOWC = @LIB_MBRTOWC@ +LIB_NL_LANGINFO = @LIB_NL_LANGINFO@ +LIB_SCHED_YIELD = @LIB_SCHED_YIELD@ +LIB_SETLOCALE_NULL = @LIB_SETLOCALE_NULL@ LIMITS_H = @LIMITS_H@ LN_S = @LN_S@ LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@ @@ -1169,6 +1193,7 @@ NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H = @NEXT_AS_FIRST_DIRECTIVE_FNMATCH_H@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_GLOB_H = @NEXT_AS_FIRST_DIRECTIVE_GLOB_H@ +NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@ NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@ NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@ @@ -1198,6 +1223,7 @@ NEXT_FNMATCH_H = @NEXT_FNMATCH_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_GLOB_H = @NEXT_GLOB_H@ +NEXT_INTTYPES_H = @NEXT_INTTYPES_H@ NEXT_LANGINFO_H = @NEXT_LANGINFO_H@ NEXT_LIMITS_H = @NEXT_LIMITS_H@ NEXT_LOCALE_H = @NEXT_LOCALE_H@ @@ -1235,6 +1261,8 @@ POSUB = @POSUB@ PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PRIPTR_PREFIX = @PRIPTR_PREFIX@ +PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RANLIB = @RANLIB@ @@ -1331,6 +1359,8 @@ REPLACE_ISNAN = @REPLACE_ISNAN@ REPLACE_ISWBLANK = @REPLACE_ISWBLANK@ REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@ +REPLACE_ISWDIGIT = @REPLACE_ISWDIGIT@ +REPLACE_ISWXDIGIT = @REPLACE_ISWXDIGIT@ REPLACE_ITOLD = @REPLACE_ITOLD@ REPLACE_LCHOWN = @REPLACE_LCHOWN@ REPLACE_LDEXPL = @REPLACE_LDEXPL@ @@ -1440,8 +1470,10 @@ REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ REPLACE_STRSTR = @REPLACE_STRSTR@ REPLACE_STRTOD = @REPLACE_STRTOD@ +REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@ REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ REPLACE_STRTOLD = @REPLACE_STRTOLD@ +REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@ REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@ REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ @@ -1473,6 +1505,7 @@ REPLACE_WCSFTIME = @REPLACE_WCSFTIME@ REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@ REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@ +REPLACE_WCSTOK = @REPLACE_WCSTOK@ REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@ REPLACE_WCTOB = @REPLACE_WCTOB@ REPLACE_WCTOMB = @REPLACE_WCTOMB@ @@ -1490,6 +1523,8 @@ STRIP = @STRIP@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ +UINT32_MAX_LT_UINTMAX_MAX = @UINT32_MAX_LT_UINTMAX_MAX@ +UINT64_MAX_EQ_ULONG_MAX = @UINT64_MAX_EQ_ULONG_MAX@ UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ diff -Nru nano-4.5/doc/nano.1 nano-4.8/doc/nano.1 --- nano-4.5/doc/nano.1 2019-10-04 09:47:50.000000000 +0000 +++ nano-4.8/doc/nano.1 2020-02-07 10:10:15.000000000 +0000 @@ -1,4 +1,4 @@ -.\" Copyright (C) 1999-2011, 2013-2019 Free Software Foundation, Inc. +.\" Copyright (C) 1999-2011, 2013-2020 Free Software Foundation, Inc. .\" .\" This document is dual-licensed. You may distribute and/or modify it .\" under the terms of either of the following licenses: @@ -16,7 +16,7 @@ .\" Documentation License along with this program. If not, see .\" . .\" -.TH NANO 1 "version 4.5" "October 2019" +.TH NANO 1 "version 4.8" "February 2020" .SH NAME nano \- Nano's ANOther editor, inspired by Pico @@ -28,12 +28,18 @@ .BR nano " [" \fIoptions "] [[" + [ crCR ]( / | ? ) \fIstring "] " \fIfile ]... .SH NOTICE -Starting with version 4.0, \fBnano\fR no longer hard-wraps an overlong -line by default. It further uses smooth scrolling by default, and by -default includes the line below the title bar into the editing area. +Since version 4.0, \fBnano\fR by default: +.sp +.RS 4 +\(bu does not automatically hard-wrap lines that become overlong, +.br +\(bu includes the line below the title bar in the editing area, +.br +\(bu does linewise (smooth) scrolling. +.RE .sp If you want the old, Pico behavior back, you can use \fB\-\-breaklonglines\fR, -\fB\-\-jumpyscrolling\fR, and \fB\-\-emptyline\fR (or \fB\-bje\fR for short). +\fB\-\-emptyline\fR, and \fB\-\-jumpyscrolling\fR (or \fB\-bej\fR for short). .SH DESCRIPTION \fBnano\fP is a small and friendly editor. It copies the look and feel @@ -44,6 +50,7 @@ When giving a filename on the command line, the cursor can be put on a specific line by adding the line number with a plus sign (\fB+\fR) before the filename, and even in a specific column by adding it with a comma. +(Negative numbers count from the end of the file or line.) The cursor can be put on the first or last occurrence of a specific string by specifying that string after \fB+/\fR or \fB+?\fR before the filename. The string can be made case sensitive and/or caused to be interpreted as a @@ -105,7 +112,10 @@ The uniquely numbered files are stored in the specified \fIdirectory\fR. .TP .BR \-D ", " \-\-boldtext -Use bold text instead of reverse video text. +For the interface, use bold instead of reverse video. This will be overridden +by setting the options \fBtitlecolor\fP, \fBstatuscolor\fP, \fBkeycolor\fP, +\fBfunctioncolor\fP, \fBnumbercolor\fP, and/or \fBselectedcolor\fP in your +nanorc file. See \fBnanorc\fR(5). .TP .BR \-E ", " \-\-tabstospaces Convert typed tabs to spaces. @@ -225,6 +235,10 @@ .BR \-e ", " \-\-emptyline Do not use the line below the title bar, leaving it entirely blank. .TP +.BR \-f\ \fIfile ", " \-\-rcfile= \fIfile +Read only this \fIfile\fR for setting nano's options, instead of reading +both the system-wide and the user's nanorc files. +.TP .BR \-g ", " \-\-showcursor Make the cursor visible in the file browser (putting it on the highlighted item) and in the help viewer. Useful for braille users @@ -277,8 +291,9 @@ point to vary along with the width of the screen if the screen is resized. The default value is \-8. .TP -.B "\-s ""\fIprogram\fR [\fIarg\fR...]\fB""\fR, \fB\-\-speller=""\fIprogram\fR [\fIarg\fR...]\fB""" -Use this alternative command to perform spell checking. +.B "\-s ""\fIprogram\fR [\fIargument \fR...]\fB""\fR, \fB\-\-speller=""\fIprogram\fR [\fIargument \fR...]\fB""" +Use this command to perform spell checking and correcting, instead of +using the built-in corrector that calls \fBhunspell\fR or GNU \fBspell\fR. .TP .BR \-t ", " \-\-tempfile Save a changed buffer without prompting (when exiting with \fB^X\fR). @@ -325,6 +340,8 @@ See at the end of the \fB^G\fR help text for a complete list. .SH FILES +When \fB\-\-rcfile\fR is given, \fBnano\fR will read just the specified file +for setting its options and syntaxes and key bindings. Without that option, \fBnano\fR will read two configuration files: first the system's \fInanorc\fR (if it exists), and then the user's \fInanorc\fR (if it exists), either \fI~/.nanorc\fR or \fI$XDG_CONFIG_HOME/nano/nanorc\fR diff -Nru nano-4.5/doc/nano.1.html nano-4.8/doc/nano.1.html --- nano-4.5/doc/nano.1.html 2019-10-04 09:51:05.000000000 +0000 +++ nano-4.8/doc/nano.1.html 2020-02-07 10:11:00.000000000 +0000 @@ -1,5 +1,5 @@ - + @@ -64,18 +64,21 @@ -

    Starting with -version 4.0, nano no longer hard-wraps an overlong -line by default. It further uses smooth scrolling by -default, and by default includes the line below the title -bar into the editing area.

    +

    Since version +4.0, nano by default:

    + +

    • does not +automatically hard-wrap lines that become overlong,
    +• includes the line below the title bar in the editing +area,
    +• does linewise (smooth) scrolling.

    If you want the old, Pico behavior back, you can use −−breaklonglines, -−−jumpyscrolling, and -−−emptyline (or −bje for -short).

    +−−emptyline, and +−−jumpyscrolling (or −bej +for short).

    DESCRIPTION @@ -93,7 +96,8 @@ filename on the command line, the cursor can be put on a specific line by adding the line number with a plus sign (+) before the filename, and even in a specific -column by adding it with a comma. The cursor can be put on +column by adding it with a comma. (Negative numbers count +from the end of the file or line.) The cursor can be put on the first or last occurrence of a specific string by specifying that string after +/ or +? before the filename. The string can be made case sensitive and/or @@ -186,8 +190,12 @@

    −D, −−boldtext

    -

    Use bold text instead of -reverse video text.

    +

    For the interface, use bold +instead of reverse video. This will be overridden by setting +the options titlecolor, statuscolor, +keycolor, functioncolor, numbercolor, +and/or selectedcolor in your nanorc file. See +nanorc(5).

    −E, −−tabstospaces

    @@ -398,6 +406,14 @@

    Do not use the line below the title bar, leaving it entirely blank.

    + +

    −f file, +−−rcfile=file

    + +

    Read only this file for +setting nano’s options, instead of reading both the +system-wide and the user’s nanorc files.

    +

    −g, −−showcursor

    @@ -490,12 +506,14 @@ −8.

    −s -"program [arg...]", +"program [argument ...]", −−speller="program -[arg...]"

    +[argument ...]"

    -

    Use this alternative command to -perform spell checking.

    +

    Use this command to perform +spell checking and correcting, instead of using the built-in +corrector that calls hunspell or GNU +spell.

    −t, −−tempfile

    @@ -579,8 +597,11 @@

    -

    nano -will read two configuration files: first the system’s +

    When +−−rcfile is given, nano will read +just the specified file for setting its options and syntaxes +and key bindings. Without that option, nano will read +two configuration files: first the system’s nanorc (if it exists), and then the user’s nanorc (if it exists), either ~/.nanorc or $XDG_CONFIG_HOME/nano/nanorc or diff -Nru nano-4.5/doc/nano.html nano-4.8/doc/nano.html --- nano-4.5/doc/nano.html 2019-10-04 09:51:09.000000000 +0000 +++ nano-4.8/doc/nano.html 2020-02-07 10:11:03.000000000 +0000 @@ -1,6 +1,6 @@ - + nano @@ -12,7 +12,6 @@ -