diff --git a/contrib/ncurses/COPYING b/contrib/ncurses/COPYING index 87658988b18b..3a2297536813 100644 --- a/contrib/ncurses/COPYING +++ b/contrib/ncurses/COPYING @@ -1,4 +1,4 @@ -Copyright 2018-2019,2020 Thomas E. Dickey +Copyright 2018-2020,2021 Thomas E. Dickey Copyright 1998-2017,2018 Free Software Foundation, Inc. Permission is hereby granted, free of charge, to any person obtaining a @@ -26,4 +26,4 @@ sale, use or other dealings in this Software without prior written authorization. -- vile:txtmode fc=72 --- $Id: COPYING,v 1.9 2020/02/08 13:34:12 tom Exp $ +-- $Id: COPYING,v 1.10 2021/01/01 09:54:30 tom Exp $ diff --git a/contrib/ncurses/INSTALL b/contrib/ncurses/INSTALL index f3e710d8fa67..95f5a3931683 100644 --- a/contrib/ncurses/INSTALL +++ b/contrib/ncurses/INSTALL @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: INSTALL,v 1.217 2020/02/15 13:39:30 tom Exp $ +-- $Id: INSTALL,v 1.226 2020/09/06 23:41:16 tom Exp $ --------------------------------------------------------------------- How to install Ncurses/Terminfo on your system --------------------------------------------------------------------- @@ -41,7 +41,7 @@ including `c++', `form', `man', `menu', 'misc', `ncurses', `panel', `progs', and `test'. See the README file for a roadmap to the package. If you are a distribution integrator or packager, please read and act on the -section titled IF YOU ARE A SYSTEM INTEGRATOR below. +section titled FOR SYSTEM INTEGRATORS below. If you are converting from BSD curses and do not have root access, be sure to read the BSD CONVERSION NOTES section below. @@ -49,11 +49,7 @@ to read the BSD CONVERSION NOTES section below. If you are trying to build applications using gpm with ncurses, read the USING NCURSES WITH GPM section below. -If you are running over the Andrew File System see the note below on -USING NCURSES WITH AFS. - -If you are cross-compiling, see the note below on BUILDING NCURSES WITH A -CROSS-COMPILER. +If you are cross-compiling, see the note below on BUILDING WITH A CROSS-COMPILER. If you want to build the Ada95 binding, go to the Ada95 directory and follow the instructions there. The Ada95 binding is not covered below. @@ -270,8 +266,8 @@ INSTALLATION PROCEDURE: YOU MAY NOT BE ABLE TO COMPILE (OR RUN) NCURSES APPLICATIONS WITH C++. -SUMMARY OF CONFIGURE OPTIONS: ----------------------------- +CONFIGURE OPTIONS: +----------------- The configure script provides a short list of its options when you type @@ -439,6 +435,31 @@ SUMMARY OF CONFIGURE OPTIONS: Without some special effort, it will either fail to compile at all, or the compiler may find a different unctrl.h file. + In addition to the curses library, a system may provide its own + versions of the add-on libraries (form, menu, panel), which would + not be compatible with ncurses. These options allow you to rename + ncurses' add-on libraries to avoid conflicts when linking: + + --with-form-libname=XXX + --with-menu-libname=XXX + --with-panel-libname=XXX + + Rather than renaming them abitrarily, a prefix or suffix is + recommended. An "n" prefix provides consistency with ncurses versus + curses, i.e., + + --with-form-libname=nform + --with-menu-libname=nmenu + --with-panel-libname=npanel + + --disable-pkg-ldflags + Omit options in $EXTRA_LDFLAGS from the pkg-config ".pc" and + corresponding ncurses*-config script which normally are listed via + the "--libs" option. These options are normally used to facilitate + linking to ncurses when it was configured to use the rpath feature. + + See also --enable-rpath and --disable-rpath-hack. + --disable-relink If --enable-rpath is given, the generated makefiles normally will rebuild shared libraries during install. Use this option to simply @@ -561,6 +582,9 @@ SUMMARY OF CONFIGURE OPTIONS: For testing, generate functions for certain macros to make them visible as such to the debugger. See also the --disable-macros option. + --enable-exp-win32 + When configuring for MinGW, use the experimental Windows 10 driver. + --enable-ext-colors Extend the cchar_t structure to allow more than 16 colors to be encoded. This applies only to the wide-character (--enable-widec) @@ -587,6 +611,12 @@ SUMMARY OF CONFIGURE OPTIONS: ncurses. This does not change the ABI (the binary interface seen by calling applications). + --enable-fvisibility + Use the gcc "-fvisibility=hidden" option to make symbols which are not + explicitly exported, "hidden". Doing this may reduce the number of + symbols exported in the C++ binding; it should have less effect on the + C libraries when symbol-versioning is used. + --enable-getcap Use the 4.4BSD getcap code if available, or a bundled version of it to fetch termcap entries. Entries read in this way cannot use (make @@ -864,6 +894,9 @@ SUMMARY OF CONFIGURE OPTIONS: Specify a suffix for the ncursesw6-config file, etc., used to work around conflicts with packages. + --with-cxx-libname=NAME + Override the basename of the ncurses++ library (default: "ncurses++") + --with-cxx-shared When --with-shared is set, build libncurses++ as a shared library. This implicitly relies upon building with gcc/g++, since other @@ -909,6 +942,9 @@ SUMMARY OF CONFIGURE OPTIONS: See also "--with-tic-path" and "--with-infocmp-path". + --with-form-libname=NAME + Override the basename of the form library (default: "form") + --with-gpm use Alessandro Rubini's GPM library to provide mouse support on the Linux console. Prior to ncurses 5.5, this introduced a dependency on @@ -1043,6 +1079,9 @@ SUMMARY OF CONFIGURE OPTIONS: by running them through tbl to generate tables understandable by nroff. + --with-menu-libname=NAME + Override the basename of the menu library (default: "menu") + --with-mmask-t=TYPE Override type of mmask_t, which stores the mouse mask. Prior to ncurses 5.5, this was always unsigned long, but with ncurses 5.5, it @@ -1070,6 +1109,9 @@ SUMMARY OF CONFIGURE OPTIONS: those using termcap, do not use the higher speeds. Your application (or system, in general) may or may not. + --with-panel-libname=NAME + Override the basename of the panel library (default: "panel") + --with-pc-suffix=SUFFIX If ".pc" files are installed, optionally add a suffix to the files and corresponding package names to separate unusual configurations. @@ -1328,8 +1370,8 @@ SUMMARY OF CONFIGURE OPTIONS: X11R5 and X11R6 xterm. -COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: --------------------------------------------- +COMPATIBILITY WITH OLDER RELEASES: +--------------------------------- Because ncurses implements X/Open Curses, its interface is fairly stable. That does not mean the interface does not change. Changes are made to the @@ -2053,8 +2095,8 @@ COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: incorrect color scheme. -IF YOU ARE A SYSTEM INTEGRATOR: ------------------------------- +FOR SYSTEM INTEGRATORS: +---------------------- Configuration and Installation: @@ -2130,7 +2172,7 @@ IF YOU ARE A SYSTEM INTEGRATOR: that will make users' lives easier rather than harder. -RECENT XTERM VERSIONS: +MODERN XTERM VERSIONS: --------------------- The terminfo database file included with this distribution assumes you @@ -2146,9 +2188,13 @@ CONFIGURING FALLBACK ENTRIES: In order to support operation of ncurses programs before the terminfo tree is accessible (that is, in single-user mode or at OS installation time) the ncurses library can be compiled to include an array of - pre-fetched fallback entries. This must be done on a machine which - has ncurses' infocmp and terminfo database installed (as well as - ncurses' tic and infocmp programs). + pre-fetched fallback entries. + + NOTE: This must be done on a machine which has ncurses' infocmp and + terminfo database installed (as well as ncurses' tic and infocmp + programs). That is because the fallback sources are generated and + compiled into the library before the build-tree's copy of infocmp is + available. These entries are checked by setupterm() only when the conventional fetches from the terminfo tree and the termcap fallback (if configured) @@ -2267,12 +2313,8 @@ terminfo directory directly. ------------------------------- CUT HERE -------------------------------- -USING NCURSES WITH AFS: - AFS treats each directory as a separate logical filesystem, you - can't hard-link across them. The --enable-symlinks option copes - with this by making tic use symbolic links. - -USING NCURSES WITH GPM: +USING GPM: +--------- Ncurses 4.1 and up can be configured to use GPM (General Purpose Mouse) which is used with Linux console. Be aware that GPM is commonly installed as a shared library which contains a wrapper for the curses @@ -2291,7 +2333,9 @@ USING NCURSES WITH GPM: https://invisible-island.net/ncurses/ncurses.faq.html#using_gpm_lib -BUILDING NCURSES WITH A CROSS-COMPILER + +BUILDING WITH A CROSS-COMPILER: +------------------------------ Ncurses can be built with a cross-compiler. Some parts must be built with the host's compiler since they are used for building programs (e.g., ncurses/make_hash and ncurses/make_keys) that generate tables @@ -2316,14 +2360,26 @@ BUILDING NCURSES WITH A CROSS-COMPILER When ncurses has been successfully cross-compiled, you may want to use "make install" (with a suitable target directory) to construct an install tree. Note that in this case (as with the --with-fallbacks - option), ncurses uses the development platform's tic to do the - "make install.data" portion. + option), ncurses uses the development platform's tic to do the "make + install.data" portion. The system's tic program is used to install the terminal database, - even for cross-compiles. For best results, the tic program should - be from the most current version of ncurses. + even for cross-compiles. For best results, the tic program should be + from the most current version of ncurses. -BUGS: + NOTE: the system's tic program may use a different terminfo database + format than the target system. For instance, as described in term(5), + the conventional terminfo layout uses a directory hierarchy with one + letter names, while some platforms use two-letter names to work with + case-insensitive filesystems. The configure script searches for a tic + program using the AC_CHECK_TOOL macro, which will prefer programs + using the canonical host prefix in their name. You can use this fact + to provide a cross-compiler support utility tic, otherwise you can + override the configure script's choice using --with-tic-path + + +BUG REPORTS: +----------- Send any feedback to the ncurses mailing list at bug-ncurses@gnu.org. To subscribe send mail to bug-ncurses-request@gnu.org with body that reads: diff --git a/contrib/ncurses/MANIFEST b/contrib/ncurses/MANIFEST index aa8603a70095..1dbfb96b7a1c 100644 --- a/contrib/ncurses/MANIFEST +++ b/contrib/ncurses/MANIFEST @@ -235,7 +235,6 @@ ./config.sub ./configure ./configure.in -./convert_configure.pl ./dist.mk ./doc/hackguide.doc ./doc/html/Ada95.html @@ -547,6 +546,7 @@ ./include/MKterm.h.awk.in ./include/Makefile.in ./include/capdefaults.c +./include/curses.events ./include/curses.h.in ./include/curses.tail ./include/curses.wide @@ -559,6 +559,7 @@ ./include/nc_string.h ./include/nc_termios.h ./include/nc_tparm.h +./include/nc_win32.h ./include/ncurses_cfg.hin ./include/ncurses_defs ./include/ncurses_dll.h.in @@ -567,6 +568,7 @@ ./include/termcap.h.in ./include/tic.h ./include/unctrl.h.in +./include/win32_curses.h ./install-sh ./man/MKada_config.in ./man/MKncu_config.in @@ -942,6 +944,8 @@ ./ncurses/tinfo/lib_tparm.c ./ncurses/tinfo/lib_tputs.c ./ncurses/tinfo/lib_ttyflags.c +./ncurses/tinfo/lib_win32con.c +./ncurses/tinfo/lib_win32util.c ./ncurses/tinfo/make_hash.c ./ncurses/tinfo/make_keys.c ./ncurses/tinfo/name_match.c @@ -998,6 +1002,7 @@ ./ncurses/widechar/widechars.c ./ncurses/win32con/gettimeofday.c ./ncurses/win32con/wcwidth.c +./ncurses/win32con/win32_driver.c ./ncurses/win32con/win_driver.c ./package/debian-mingw/changelog ./package/debian-mingw/compat @@ -1089,6 +1094,7 @@ ./test/Makefile.in ./test/README ./test/aclocal.m4 +./test/back_ground.c ./test/background.c ./test/blue.c ./test/bs.6 @@ -1123,6 +1129,7 @@ ./test/dots_xcurses.c ./test/dump_window.c ./test/dump_window.h +./test/dup_field.c ./test/echochar.c ./test/edit_field.c ./test/edit_field.h @@ -1155,6 +1162,7 @@ ./test/mini.xterm_48x48.xpm ./test/mk-test.awk ./test/modules +./test/move_field.c ./test/movewindow.c ./test/ncurses.c ./test/ncurses_tst.hin @@ -1212,6 +1220,7 @@ ./test/test_setupterm.c ./test/test_sgr.c ./test/test_termattrs.c +./test/test_tparm.c ./test/test_vid_puts.c ./test/test_vidputs.c ./test/testaddch.c diff --git a/contrib/ncurses/NEWS b/contrib/ncurses/NEWS index c4f6fe360bb9..4203d188f7f4 100644 --- a/contrib/ncurses/NEWS +++ b/contrib/ncurses/NEWS @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- --- Copyright 2018-2019,2020 Thomas E. Dickey -- +-- Copyright 2018-2020,2021 Thomas E. Dickey -- -- Copyright 1998-2017,2018 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- @@ -26,7 +26,7 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: NEWS,v 1.3450 2020/02/15 18:56:00 tom Exp $ +-- $Id: NEWS,v 1.3634 2021/02/21 00:18:55 tom Exp $ ------------------------------------------------------------------------------- This is a log of changes that ncurses has gone through since Zeyd started @@ -46,6 +46,469 @@ See the AUTHORS file for the corresponding full names. Changes through 1.9.9e did not credit all contributions; it is not possible to add this information. +20210220 + + improve tic warning when oc/op do not mention SGR 39/49 for xterm + compatible XT flag. + + revert change to lib_addch.c in waddch_literal() from 20210130, since + the followup fix in PutCharLR() actually corrects the problem while + this change causes too-early filling/wrapping (report by Johannes + Altmanninger). + + add/use vt220+pcedit and vt220+vtedit -TD + + add scrt/securecrt and absolute -TD + + add nel to xterm-new, though supported since X11R5 -TD + + add/use xterm+nofkeys -TD + + move use of ecma+italics from xterm-basic to xterm+nofkeys -TD + +20210213 + + add test/back_ground.c, to exercise the wide-character background + functions. + + add a check in _nc_build_wch() in case the background character is a + wide-character, rather than a new part of a multibyte character. + + improve tracemunch's coverage of form/menu/panel libraries. + + improve tracemunch's checking/reporting the type for the first + parameter, e.g., "WINDOW*" rather than "#1". + +20210206 + + provide for wide-characters as background character in wbkgrnd + (report/testcase by Anton Vidovic) + + add name for Fedora's pcre2 to configure check for "--with-pcre2" + option, from xterm #363 -TD + + modify adjustment in PutCharLR to restore the cursor position before + writing to the lower-right corner, rather than decrementing the + cursor column, in case it was a double-width character (cf: 20210130). + +20210130 + + correct an off-by-one in comparison in waddch_literal() which caused + scrolling when a double-cell character would not fit at the lower + right corner of the screen (report by Benno Schulenberg). + + split-out att610+cvis, vt220+cvis, vt220+cvis8 -TD + + add vt220-base, for terminal emulators which generally have not + supported att610's blinking cursor control -TD + + use vt220+cvis in vt220, etc -TD + + use att610+cvis, xterm+tmux and ansi+enq in kitty -TD + + use vt220+cvis in st, terminology, termite since they ignore + blinking-cursor detail in att610+cvis -TD + +20210123 + + modify package/config scripts to provide an explicit -L option for + cases when the loader search path has other directories preceding + the one in which ncurses is installed (report by Yuri Victorovich). + + minor build-fixes in configure script and makefiles to work around + quirks of pmake. + +20210116 + + add comment for linux2.6 regarding CONFIG_CONSOLE_TRANSLATIONS + (report by Patrick McDermott) -TD + + make opts extension for getcchar work as documented for ncurses 6.1, + adding "-g" flag to test/demo_new_pair to illustrate. + +20210109 + + fix errata in man/ncurses.3x from recent updates. + + improve quoting/escaping in configure script, uses some features of + autoconf 2.52.20210105 + +20210102 + + update man/curs_memleaks.3x, to include which declares + exit_terminfo. + + clarify man/curs_terminfo.3x, to mention why the macro setterm is + defined in , and remove it from the list of prototypes + (prompted by patch by Graeme McCutcheon). + + amend man/curs_terminfo.3x, to note that is required + for certain functions, e.g., those using chtype or attr_t for + types, as well as mvcur (cf: 20201031). + + use parameter-names in prototypes in curs_sp_funcs.3x, for + consistency with other manpages. + +20201227 + + update terminology entry to 1.8.1 -TD + + fix some compiler-warnings which gcc8 reports incorrectly. + +20201219 + + suppress hyphenation in generated html for manpages, to address + regression in upgrade of groff 1.22.2 to 1.22.3. + + fix inconsistent sort-order in see-also sections of manpages (report + by Chris Bennett). + +20201212 + + improve manual pages for form field-types. + +20201205 + + amend build-fixes for gnat 10 to work with certain systems lacking + gprbuild (cf: 20200627). + + eliminate an additional strlen and wsclen. + + eliminate an unnecessary strlen in waddnstr() (suggested by Benjamin + Abendroth). + + modify inopts manpage, separating the items for nodelay and notimeout + (patch by Benno Schulenberg). + + correct mlterm3 kf1-kf4 (Debian #975322) -TD + + add flash to mlterm3 -TD + +20201128 + + add Smulx to alacritty (Christian Duerr). + + add rep to PuTTY -TD + + add putty+keypad -TD + + add another fflush(stdout) in _nc_flush() to handle time-delays in + the middle of strings such as flash when the application uses + low-level calls rather than curses (cf: 20161217). + + modify configure check for c89/c99 aliases of clang to use its + -std option instead, because some platforms, in particular macOS, + do not provide workable c89/c99 aliases. + +20201121 + + fix some compiler-warnings in experimental Windows-10 driver. + + add the definitions needed in recent configure-check for clang + (report by Steven Pitman). + +20201114 + + fix some compiler-warnings in experimental Windows-10 driver. + + modify a check for parameters in terminfo capabilities to handle the + special case where short extended capability strings were not + converted from terminfo to termcap format. + + modify CF_MIXEDCASE_FILENAMES macro, adding darwin as special case + when cross-compiling (report by Eli Rykoff). + +20201107 + + update kitty+common -TD + + add putty+screen and putty-screen (suggested by Alexandre Montaron). + + explain in ncurses.3x that functions in the tinfo library do not rely + upon wide-characters (prompted by discussion with Reuben Thomas). + +20201031 + + modify MKterm.h.in so that it is not necessary to include + before (prompted by discussion with Reuben Thomas). + + review/improve synopsis for curs_sp_funcs.3x (prompted by discussion + with Reuben Thomas). + + improve format of output in tic's check_infotocap() function, to + ensure that the messages contain only printable text. + + modify configure-check for clang to verify that -Qunused-arguments + is supported. IBM's xlclang does not support it (report by Steven + Pitman). + +20201024 + + provide workaround configure-check for bool when cross-compiling. + + fix a potential indexing error in _nc_parse_entry(), seen with + Herlim's test data using address-sanitizer. + + change a null-pointer check in set_curterm to a valid-string check, + needed in to tic's use-resolution when pad_char is cancelled + (report/testcase by Robert Sebastian Herlim) + + improve tic's -c option to validate the number and type of parameters + and compare against expected number/type before deciding which set of + parameter-lists to use in tparm calls (report/testcase by Robert + Sebastian Herlim). + + fix a link for tabs.1 manpage in announce.html.in (report by Nick + Black), as well as some fixes via linklint. + +20201017 + + improve manpage typography. + + improve discussion in curs_addch.3x of the use of unctrl to display + nonprintable characters. + + add a note in terminfo.5 explaining that no-parameter strings such + as sgr0 or cnorm should not be used with tparm. + +20201010 + + correct sgr in aaa+rv (report by Florian Weimer) -TD + + fix some sgr inconsistencies in d230c, ibm6153, ibm6154, + ncrvt100an -TD + + improve tic's check for errors detected in tparm (prompted by + discussion with Florian Weimer). + + set output-mode to binary in experimental Windows-10 driver (Juergen + Pfeifer). + +20201003 + + remove output-related checks for nl/nonl (report by Leon Winter). + + change tmux's kbs to ^? (report by Premysl Eric Janouch) + + simplify mlterm initialization with DECSTR -TD + + fix a typo in man/curs_terminfo.3 (Reuben Thomas). + + add tmux-direct (tmux #2370, Debian #895754) + + add user-defined capabilities from mintty to Caps-ncurses, for + checking consistency with tic. + +20200926 + + correct configure-check for gnurx library. + + regenerate llib-* files. + + modify tracemunch and the panel library to show readable traces for + panel- and user-pointers. + +20200919 + + update mlterm3 for 3.9.0 (report by Premysl Eric Janouch) -TD + +20200918 + + corrected condition for appending curses.events to the generated + curses.h (report by Sven Joachim, Debian #970545). + +20200912 + + add configure-check for systre/tre with mingw configuration, to get + the library-dependencies as seen in msys2 configuration for mingw64. + + build-fixes for the win32-driver configuration. + + use more defensive binary mode setting for Win32 (Juergen Pfeifer). + +20200907 + + fix regression in setupterm validating non-empty $TERM (report by + Soren Tempel). + +20200906 + + merge/adapt in-progress work by Juergen Pfeifer for new version of + win32-driver. + + correct description of vt330/vt340 (Ross Combs). + +20200831 + + build-fix for awk-scripts modified for win32-driver (report by Werner + Fink). + +20200829 + + remove a redundant NCURSES_EXPORT as a build-fix for "Maarten + Anonymous". + + merge/adapt in-progress work by Juergen Pfeifer for new version of + win32-driver. + + modify configure script, moving gcc -Werror options to EXTRA_CFLAGS + to avoid breaking configure-checks (adapted from ongoing work on + mawk and lynx). + > errata for terminfo.src (report by Florian Weimer): + + correct icl6404 csr + + correct ti916 cup + + improve ndr9500 + +20200822 + + improve version-number extraction in MKlib_gen.sh + + make the test-package for manpages installable by adjusting the + man_db.renames file. + + correct an off-by-one loop-limit in convert_strings function + (report by Yue Tai). + + add CF_SHARED_OPTS cases for HPE NonStop systems (Randall S Becker). + + modify CF_SHARED_OPTS case for NetBSD to use the same "-shared" + option for the non-rpath case as for the rpath case, to allow gcc to + provide suitable runtime initialization (report by Rajeev V Pillai). + +20200817 + + reduce build-warnings by excluding ncurses-internals from deprecation + warnings. + + mark wgetch-events feature as deprecated. + + add definition for $(LIBS) to ncurses/Makefile.in, to simplify builds + using the string-hacks option. + + prevent KEY_EVENT from appearing in curses.h unless the configure + option --enable-wgetch-events is used (report by Werner Fink). + +20200816 + + amend tic/infocmp check to allow for the respective tool's absence + (report by Steve Wills, cf: 20200808). + + improved some of the build-scripts with shellcheck + + filter out -MT/-MD/-MTd/-MDd options in script for Visual Studio C++ + (discussion with "Maarten Anonymous"). + +20200808 + + improve discussion of the system's tic utility when used as part + of cross-compiling (discussion with Keith Marshall). + + modify configuration checks for build-time tic/infocmp to use + AC_CHECK_TOOL. That can still be overridden by --with-tic-path and + --with-infocmp-path when fallbacks are used, but even if not using + fallbacks, the improved check may help with cross-compiling + (discussion with Keith Marshall). + + other build-fixes for Ada95 with MinGW. + + modify Ada95 source-generation utility to write to a file given as + parameter rather than to the standard output, allowing builds with + MinGW. + +20200801 + + remove remaining parts of checks for ISC Unix (cf: 20121006). + + add user32.lib to LDFLAGS for Visual Studio C++ configuration + (discussion with "Maarten Anonymous"). + + modify MKkey_defs.sh to hide ncurses' definition of KEY_EVENTS to + reduce Visual Studio C++ redefinition warnings. + + improve/update checks for external functions in test/configure + +20200725 + + set LINK_TESTS in CF_SHARED_OPTS for msvc (patch by + "Maarten Anonymous") + + improved workaround for redefinition-warnings for KEY_EVENT. + + improve man/term.5 section on legacy storage format (report by + Florian Weimer). + +20200718 + + reduce redefinition-warnings for KEY_EVENT when building with Visual + Studio C++. + + define NCURSES_STATIC when compiling programs to link with static + libraries, to work with MinGW vs Visual Studio C++. + > additional changes for building with Visual Studio C++ and msys2 + (reports/patches by "Maarten Anonymous") + + modify c++/Makefile.in to set the current directory while compiling + the main program, so the linker can find related objects. + + several changes to allow the c++/demo program to compile/link. + + change an ifdef in test-directory, to use VC++ wide-character funcs. + +20200711 + + fix pound-sign mapping in acsc of linux2.6 entry (report by Ingo + Bruckl). + + additional changes for building with Visual Studio C++ and msys2 + (reports/patches by "Maarten Anonymous") + + build-improvements for Windows 10 and MinGW (patch by Juergen + Pfeifer). + + fix a typo in curs_printw.3x (patch by William Pursell). + + fix two errors in infotocap which allowed indexing outside the + buffer (report/testcases by Zhang Gan). + + update length of strings in infocmp's usage function to restore a + trailing null on the longest string (report/testcase by Zhang Gen). + +20200704 + + modify version-check with Ada generics to use the same pattern as in + the check for supported gnat versions (report by Pascal Pignard). + > additional changes for building with Visual Studio C++ and msys2 + (patches by "Maarten Anonymous"): + + adjust headers/declarations to provide for "dllimport" vs "dllexport" + declarations when constructing DLLs, to worko with Visual Studio C++. + +20200627 + + build-fixes for gnat 10.1.1, whose gnatmake drops integration with + gprbuild. + + correct buffer-length in test/color_name.h + +20200613 + + update list of functions in ncurses.3x + + move dlclose() call from lib_mouse.c to delscreen() to avoid a case + in the former which could be called from SIGTSTP handler (Debian + #961097). + +20200606 + + add xterm+256color2, xterm+88color2, to deprecate nonstandard usage + in xterm+256color, xterm+88color -TD + + add shifted Linux console keys in linux+sfkeys entry for + screen.linux (report by Alexandre Montaron). + + use vt100+enq in screen (report by Alexandre Montaron). + + add screen.linux-s alias (suggested by Alexandre Montaron). + +20200531 + + correct configure version-check/warnng for g++ to allow for 10.x + + re-enable "bel" in konsole-base (report by Nia Huang) + + add linux-s entry (patch by Alexandre Montaron). + + drop long-obsolete convert_configure.pl + + add test/test_parm.c, for checking tparm changes. + + improve parameter-checking for tparm, adding function _nc_tiparm() to + handle the most-used case, which accepts only numeric parameters + (report/testcase by "puppet-meteor"). + + use a more conservative estimate of the buffer-size in lib_tparm.c's + save_text() and save_number(), in case the sprintf() function + passes-through unexpected characters from a format specifier + (report/testcase by "puppet-meteor"). + + add a check for end-of-string in cvtchar to handle a malformed + string in infotocap (report/testcase by "puppet-meteor"). + +20200523 + + update version-check for gnat to allow for gnat 10.x to 99.x + + fix an uninitialized variable in lib_mouse.c changes (cf: 20200502) + + add a check in EmitRange to guard against repeat_char emitting digits + which could be interpreted as BSD-style padding when --enable-bsdpad + is configured (report/patch by Hiltjo Posthuma). + + add --disable-pkg-ldflags to suppress EXTRA_LDFLAGS from the + generated pkg-config and ncurses*-config files, to simplify + configuring in the case where rpath is used but the packager wants + to hide the feature (report by Michael Stapelberg). + > fixes for building with Visual Studio C++ and msys2 (patches by + "Maarten Anonymous"): + + modify CF_SHARED_OPTS to generate a script which translates linker + options into Visual Studio's dialect. + + omit parentheses around function-names in generated lib_gen.c to + work around a Visual Studio C++ limitation. + +20200516 + + add notes on termcap.h header in curs_termcap.3x + + update notes on vscode / xterm.js -TD + +20200509 + + add "-r" option to the dots test-programs, to help with scripting + a performance comparison. + + build-fix test/move_field.c for NetBSD curses, whose form headers + use different names than SVr4 or ncurses. + +20200502 + + add details on the change to Linux SGR 21 in 2018 -TD + + add xterm-direct16 and xterm-direct256 -TD + + modify lib_mouse.c to check for out-of-range button numbers, convert + those to position reports. + +20200425 + + use vt100+fnkeys in putty -TD + + fix a typo in tput.1; "columns" should be "cols". + +20200418 + + improve tracemunch logic for "RUN" compaction. + + fix a special case in wresize() where copying the old text did not + check if the last cell on a row was the beginning of a fullwidth + character (adapted from patch by Benno Schulenberg). + + use vt52+keypad in xterm-vt52, from xterm #354 -TD + + improve see-also section of user_caps.5 + +20200411 + + fix find_pair(), overlooked when refactoring for _nc_reserve_pairs() + (report/testcase by Brad Town, cf: 20170812). + + add a trailing null for magic-string in putwin, flagged by gcc 10 + + update check for gcc version versus gnat to work with gcc 10.x + +20200404 + + modify -fvisibility check to work with g++ + > fixes for building with Visual Studio C++ and msys2 (patches by + "Maarten Anonymous"): + + add configure option and check for gcc -fvisibility=hidden feature + + define NCURSES_NOMACROS in lib_gen.c to work around Visual Studio + C++ preprocessor limitations. + + modify some of the configure-macros, as well as mk-1st.awk to work + with Visual Studio C++ default filenaming. + +20200328 + + correct length of buffer copied in dup_field(). + + remove "$(srcdir)/" from path of library.gpr, needed for out-of-tree + builds of Ada95 (patch by Adam Van Ymeren). + +20200321 + + improve configure-checks to reduce warnings about unused variables. + + improve description of error-returns in waddch and waddnstr manual + pages (prompted by patch by Benno Schulenberg). + + add test/move_field.c to demonstrate move_field(), and a stub for + a corresponding demo of dup_field(). + +20200314 + + add history note to curs_scanw.3x for and + + add history note to curs_printw.3x for and + + add portability note to ncurses.3x regarding + +20200308 + + update copyright notices in test-packages. + + modify tracemunch to guard against errors in its known_p1 table. + + add several --with-xxx-libname options, to help with pkgsrc (prompted + by discussion with Thomas Klausner). + +20200301 + + modify wbkgd() and wbkgrnd() to avoid storing a null in the + background character, because it may be used in cases where the + corresponding 0x80 is not treated as a null (report by Marc Rechte, + cf: 20181208). + +20200229 + + modify CF_NCURSES_CONFIG to work around xcode's c99 "-W" option, + which conflicts with conventional use for passing linker options. + > fixes for building with Visual Studio C++ and msys2 (patches by + "Maarten Anonymous"): + + check for pcre2posix.h instead of pcre2-posix.h + + add case in CF_SHARED_OPTS for msys2 + msvc + + add fallback definition for STDIN_FILENO in progs.priv.h + + modify win_driver.c to use _alloca() rather than gcc's variable + length array feature. + + add NCURSES_IMPEXP to ncurses wrapped-variable declarations + + remove NCURSES_IMPEXP from class variables in c++/cursslk.h + + remove fallback prototype for exit() from c++/etip.h.in + + use configured check for in a couple of places + + conditionally include winsock.h in ncurses/win32con/gettimeofday.c, + because Visual Studio needs this for the timestruct declaration. + + adjust syntax in a couple of files using the NCURSES_API symbol. + +20200222 + + expanded note in ncurses.3x regarding automatically-included headers + + improve vt50h and vt52 based on DECScope manual -TD + + add/use vt52+keypad and vt52-basic -TD + + check/workaround for line-too-long in Ada95 generate utility when + building out-of-tree. + + improve/update HEADER_DEPS in */Makefile.in + + add "check" rule to include/Makefile, to demonstrate that the headers + include all of the required headers for the types used. + 20200215 + improve manual page for panel library, extending the portability section as well as documenting error-returns. @@ -220,7 +683,7 @@ it is not possible to add this information. + build-fixes for Ada95 configure-script and corresponding test package 20190907 - + add --with-ada-libname option and modify Ada95 configuration to + + add --with-ada-libname option and modify Ada95 configuration to allow renaming the "AdaCurses" library (prompted by proposed changes by Pascal Pignard). + modify configure script to distinguish gcc from icc and clang when diff --git a/contrib/ncurses/README.MinGW b/contrib/ncurses/README.MinGW index 56a2bca21e34..3add2e7de3e2 100644 --- a/contrib/ncurses/README.MinGW +++ b/contrib/ncurses/README.MinGW @@ -26,114 +26,123 @@ -- sale, use or other dealings in this Software without prior written -- -- authorization. -- ------------------------------------------------------------------------------- --- $Id: README.MinGW,v 1.10 2020/02/02 23:34:34 tom Exp $ +-- $Id: README.MinGW,v 1.14 2020/09/06 22:22:44 tom Exp $ -- Author: Juergen Pfeifer ------------------------------------------------------------------------------- -This is work in progress, but it's in an state where one can see it +This is work in progress, but it is in an state where one can see it works at least on the Windows Console. -You should install the MSYS package, so that you've a shell environment that -allows you to run the scripts, especially configure etc. You can get that -from http://www.mingw.org +You should install the MSYS2 package, so that you have a shell environment that +allows you to run scripts, especially configure, etc. You can get that +from + https://www.msys2.org/ -To build ncurses for native Windows, you need the MinGW toolchain. The -original MinGW toolchain from the above site is only for 32-Bit Windows. As -Windows Server - and also regular workstations - are moving to 64-Bit, it -seems to be reasonable to have a toolchain that supports both architectures. -I recommend to use the TDM gcc toolchain which you can find at -http://tdm-gcc.tdragon.net/download. Go to the download section and select -the bundle installer for tdm64 (MinGW-w64). This installs a multilib version -of the gcc toolchain that can compile for native 32- and 64-Bit Windows -versions. It also comes with a working pthread implementation. +or the individual packages from -The latest config and build scripts we use for MinGW have only been tested -for the gcc-4.6.1 compiler toolchain (or better). + https://sourceforge.net/projects/msys2/files/ -Using MinGW is a pragmatic decision, it's the easiest way to port this +You may also use a hosted MinGW cross-compile toolchain, e.g., on Ubuntu or +ArchLinux to build the libraries and tools. + +To build ncurses for native Windows with support for the new Windows 10 Virtual +Terminal and PseudoConsole support, you should install at least version 8.0 of +the mingw-w64-x86_64-headers package as it appears to have support for the +required Windows SDK level. Please note that some of the Linux distributions +are a bit behind with respect to the required MinGW header versions and you may +not be able to properly build the libraries for current Windows 10 using these +toolchains. Although it is a bit slow, MSYS2 on Windows 10 64-Bit is the +authoritative build environment for the MinGW version of ncurses. + +Using MinGW is a pragmatic decision, it is the easiest way to port this heavily UNIX based sourcebase to native Windows. The goal is of course to provide the includes, libraries and DLLs to be used with the more common traditional development environments on Windows, mainly with Microsoft Visual Studio. -The TERM environment variable must be set specially to active the Windows +The TERM environment variable must be set especially to activate the Windows console-driver. The driver checks if TERM is set to "#win32con" (explicit use) or if TERM is unset or empty (implicit). -Please also make sure that MSYS links to the correct directory containing -your MinGW toolchain. For TDM this is usually C:\MinGW64. In your Windows -CMD.EXE command shell go to the MSYS root directory (most probably -C:\MSYS or C:\MSYS\1.0) and verify, that there is a junction point mingw -that points to the MinGW toolchain directory. If not, delete the mingw -directory and use the mklink command (or the linkd.exe utility on older -Windows) to create the junction point. +Beginning with build 17763 (Fall 2018 update), Windows 10 supports ANSI escape +sequences (Virtual Terminal support). If ncurses detects this or a later +Windows 10 version, the interpretation of the implicit TERM setting (which +means: TERM is not set or empty) changes. In this case, TERM is to be assumed +to be "ms-terminal" and ncurses acts using the regular terminfo based driver, +thus acting like a regular Terminal we all know from UNIX like environments. -This code requires WindowsNT 5.1 or better, which means on the client -Windows XP or better, on the server Windows Server 2003 or better. +This code requires WindowsNT 6.0 or better, which means on the client +Windows Vista or better, on the server Windows Server 2008 or better. -I recommend using libtool to build ncurses on MinGW, because libtool -knows exactly how to build dll's on Windows for use with MinGW. +If running on Windows 10 Build 17763 or later is detected, any program +spawning a subprocess running a ncurses program should use the new +PseudoConsole support, which provides what we know as pty from the UNIX +world also for Windows. Using the CreatePseudoConsole API +(see https://docs.microsoft.com/en-us/windows/console/createpseudoconsole) +in the calling process, it is guaranteed that the called ncurses program has +a console that is required by its implementation, even if the calling program +is NOT a console program, e.g., MSYS2's own mintty Terminal emulator. + +In the current MSYS2/minGW setup, building MinGW shared libraries with +libtool for ncurses seems to be broken, so I recommend NOT to use libtool. To build a modern but still small footprint ncurses that provides hooks for interop, I recommend using these options: - --with-libtool - --disable-home-terminfo - --enable-database - --disable-termcap - --enable-sp-funcs - --enable-term-driver - --enable-interop + --without-libtool + --disable-home-terminfo + --enable-database + --disable-termcap + --enable-sp-funcs + --enable-term-driver + --enable-interop -This is the configuration commandline as I'm using it at the moment (assuming -environment variable MINGW_ROOT to hold the root directory name of your MinGW -build): +This is the configuration command line which I am using at the moment +(assuming environment variable MINGW_ROOT holds the root directory name of +your MinGW build): ./configure \ - --prefix=$MINGW_ROOT \ - --with-cxx \ + --prefix=/mingw64 \ + --without-cxx \ --without-ada \ --enable-warnings \ --enable-assertions \ + --enable-exp-win32 \ + --enable-ext-funcs \ --disable-home-terminfo \ + --disable-echo \ + --disable-getcap \ + --disable-hard-tabs \ + --disable-leaks \ + --disable-macros \ + --disable-overwrite \ + --enable-opaque-curses \ + --enable-opaque-panel \ + --enable-opaque-menu \ + --enable-opaque-form \ --enable-database \ --enable-sp-funcs \ --enable-term-driver \ --enable-interop \ --disable-termcap \ + --enable-database \ --with-progs \ - --with-libtool \ + --without-libtool \ --enable-pc-files \ - --mandir=$MINGW_ROOT/share/man + --with-shared \ + --with-normal \ + --without-debug \ + --with-fallbacks=ms-terminal \ + --without-manpages Please note that it is also necessary to set this environment variable: export PATH_SEPARATOR=";" in order to parse the terminfo paths correctly. Terminfo paths should -always be separated by a seeeemicolon,even when running under MSYS. - -To support regular expressions properly, ncurses under MinGW should be -linked against the gnurx regex library, which must be built separately -under MinGW. See - - ftp.gnome.org/pub/GNOME/binaries/win32/dependencies/libgnurx-src-2.5.zip +always be separated by a semicolon, even when running under MSYS2. All the options above are - like the whole Windows support - experimental. -A lot is still TODO, e.g.: - - - Wide Character support (display is workable, but input untested) - The Win32Con driver should actually only use Unicode in the - future. - - Thread support (locking). If using TDM toolchain this is done by - configuring pthreads. - - A GUI console driver - - Support for Terminals attached via a serial port (via terminfo) - - Support for networked Terminal connections (via terminfo) - - Workarounds for MinGW's filesystem access are necessary to make infocmp - work (though tic works). - -To support terminfo, we would need to have an ioctl() simulation for the -serial and networked terminals. +-- vile:txtmode diff --git a/contrib/ncurses/VERSION b/contrib/ncurses/VERSION index 73ac659d490e..f8f03afcea5f 100644 --- a/contrib/ncurses/VERSION +++ b/contrib/ncurses/VERSION @@ -1 +1 @@ -5:0:10 6.2 20200215 +5:0:10 6.2 20210220 diff --git a/contrib/ncurses/aclocal.m4 b/contrib/ncurses/aclocal.m4 index c27cc3685dc9..d498939330c1 100644 --- a/contrib/ncurses/aclocal.m4 +++ b/contrib/ncurses/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright 2018-2019,2020 Thomas E. Dickey * +dnl Copyright 2018-2020,2021 Thomas E. Dickey * dnl Copyright 1998-2017,2018 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * @@ -29,7 +29,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey 1995-on dnl -dnl $Id: aclocal.m4,v 1.896 2020/02/08 21:01:07 tom Exp $ +dnl $Id: aclocal.m4,v 1.950 2021/01/26 23:45:12 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl These macros are maintained separately from NCURSES. The copyright on @@ -42,7 +42,7 @@ dnl https://invisible-island.net/autoconf/my-autoconf.html dnl dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- -dnl AM_LANGINFO_CODESET version: 4 updated: 2015/04/18 08:56:57 +dnl AM_LANGINFO_CODESET version: 6 updated: 2021/01/01 16:53:59 dnl ------------------- dnl Inserted as requested by gettext 0.10.40 dnl File from /usr/share/aclocal @@ -55,11 +55,11 @@ AC_DEFUN([AM_LANGINFO_CODESET], [ AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, [AC_TRY_LINK([#include ], - [char* cs = nl_langinfo(CODESET);], + [char* cs = nl_langinfo(CODESET); (void)cs], am_cv_langinfo_codeset=yes, am_cv_langinfo_codeset=no) ]) - if test $am_cv_langinfo_codeset = yes; then + if test "$am_cv_langinfo_codeset" = yes; then AC_DEFINE(HAVE_LANGINFO_CODESET, 1, [Define if you have and nl_langinfo(CODESET).]) fi @@ -158,10 +158,11 @@ AC_DEFUN([CF_ADD_ADAFLAGS],[ AC_SUBST(ADAFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_CFLAGS version: 13 updated: 2017/02/25 18:57:40 +dnl CF_ADD_CFLAGS version: 15 updated: 2020/12/31 10:54:15 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS -dnl The second parameter if given makes this macro verbose. +dnl $1 = flags to add +dnl $2 = if given makes this macro verbose. dnl dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily @@ -175,19 +176,19 @@ cf_new_extra_cppflags= for cf_add_cflags in $1 do -case $cf_fix_cppflags in +case "$cf_fix_cppflags" in (no) - case $cf_add_cflags in + case "$cf_add_cflags" in (-undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) - case $cf_add_cflags in + case "$cf_add_cflags" in (-D*) - cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` + cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ && cf_fix_cppflags=yes - if test $cf_fix_cppflags = yes ; then + if test "$cf_fix_cppflags" = yes ; then CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) continue elif test "${cf_tst_cflags}" = "\"'" ; then @@ -200,7 +201,7 @@ case $cf_fix_cppflags in (*$cf_add_cflags) ;; (*) - case $cf_add_cflags in + case "$cf_add_cflags" in (-D*) cf_tst_cppflags=`echo "x$cf_add_cflags" | sed -e 's/^...//' -e 's/=.*//'` CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,$cf_tst_cppflags) @@ -218,7 +219,7 @@ case $cf_fix_cppflags in (yes) CF_APPEND_TEXT(cf_new_extra_cppflags,$cf_add_cflags) - cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` + cf_tst_cflags=`echo "${cf_add_cflags}" |sed -e 's/^[[^"]]*"'\''//'` test "x${cf_add_cflags}" != "x${cf_tst_cflags}" \ && test -z "${cf_tst_cflags}" \ @@ -246,7 +247,24 @@ AC_SUBST(EXTRA_CPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_INCDIR version: 15 updated: 2018/06/20 20:23:13 +dnl CF_ADD_CXXFLAGS version: 1 updated: 2020/04/04 16:16:13 +dnl --------------- +dnl Copy non-preprocessor flags to $CXXFLAGS, preprocessor flags to $CPPFLAGS +dnl The second parameter if given makes this macro verbose. +dnl +dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, +dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily +dnl confused by the quotes (which require backslashes to keep them usable). +AC_DEFUN([CF_ADD_CXXFLAGS], +[ +cf_save_CXXFLAGS="$CFLAGS" +CFLAGS="$CXXFLAGS" +CF_ADD_CFLAGS($1 ifelse($2,,,[,$2])) +CXXFLAGS="$CFLAGS" +CFLAGS="$cf_save_CXXFLAGS" +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ADD_INCDIR version: 16 updated: 2020/12/31 20:19:42 dnl ------------- dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's dnl redundant. We don't normally need to add -I/usr/local/include for gcc, @@ -258,9 +276,9 @@ AC_DEFUN([CF_ADD_INCDIR], if test -n "$1" ; then for cf_add_incdir in $1 do - while test $cf_add_incdir != /usr/include + while test "$cf_add_incdir" != /usr/include do - if test -d $cf_add_incdir + if test -d "$cf_add_incdir" then cf_have_incdir=no if test -n "$CFLAGS$CPPFLAGS" ; then @@ -291,7 +309,7 @@ if test -n "$1" ; then CF_VERBOSE(adding $cf_add_incdir to include-path) ifelse([$2],,CPPFLAGS,[$2])="$ifelse([$2],,CPPFLAGS,[$2]) -I$cf_add_incdir" - cf_top_incdir=`echo $cf_add_incdir | sed -e 's%/include/.*$%/include%'` + cf_top_incdir=`echo "$cf_add_incdir" | sed -e 's%/include/.*$%/include%'` test "$cf_top_incdir" = "$cf_add_incdir" && break cf_add_incdir="$cf_top_incdir" else @@ -313,7 +331,7 @@ dnl $1 = library to add, without the "-l" dnl $2 = variable to update (default $LIBS) AC_DEFUN([CF_ADD_LIB],[CF_ADD_LIBS(-l$1,ifelse($2,,LIBS,[$2]))])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_LIBDIR version: 10 updated: 2015/04/18 08:56:57 +dnl CF_ADD_LIBDIR version: 11 updated: 2020/12/31 20:19:42 dnl ------------- dnl Adds to the library-path dnl @@ -327,9 +345,9 @@ AC_DEFUN([CF_ADD_LIBDIR], if test -n "$1" ; then for cf_add_libdir in $1 do - if test $cf_add_libdir = /usr/lib ; then + if test "$cf_add_libdir" = /usr/lib ; then : - elif test -d $cf_add_libdir + elif test -d "$cf_add_libdir" then cf_have_libdir=no if test -n "$LDFLAGS$LIBS" ; then @@ -375,7 +393,7 @@ done ifelse($2,,LIBS,[$2])="$cf_add_libs" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_SUBDIR_PATH version: 4 updated: 2013/10/08 17:47:05 +dnl CF_ADD_SUBDIR_PATH version: 5 updated: 2020/12/31 20:19:42 dnl ------------------ dnl Append to a search-list for a nonstandard header/lib-file dnl $1 = the variable to return as result @@ -387,13 +405,13 @@ AC_DEFUN([CF_ADD_SUBDIR_PATH], [ test "x$4" != "x$5" && \ test -d "$4" && \ -ifelse([$5],NONE,,[(test -z "$5" || test x$5 = xNONE || test "x$4" != "x$5") &&]) { +ifelse([$5],NONE,,[{ test -z "$5" || test "x$5" = xNONE || test "x$4" != "x$5"; } &&]) { test -n "$verbose" && echo " ... testing for $3-directories under $4" - test -d $4/$3 && $1="[$]$1 $4/$3" - test -d $4/$3/$2 && $1="[$]$1 $4/$3/$2" - test -d $4/$3/$2/$3 && $1="[$]$1 $4/$3/$2/$3" - test -d $4/$2/$3 && $1="[$]$1 $4/$2/$3" - test -d $4/$2/$3/$2 && $1="[$]$1 $4/$2/$3/$2" + test -d "$4/$3" && $1="[$]$1 $4/$3" + test -d "$4/$3/$2" && $1="[$]$1 $4/$3/$2" + test -d "$4/$3/$2/$3" && $1="[$]$1 $4/$3/$2/$3" + test -d "$4/$2/$3" && $1="[$]$1 $4/$2/$3" + test -d "$4/$2/$3/$2" && $1="[$]$1 $4/$2/$3/$2" } ])dnl dnl --------------------------------------------------------------------------- @@ -442,7 +460,7 @@ ifelse([$3],,[ :]dnl ])dnl ])])dnl dnl --------------------------------------------------------------------------- -dnl CF_AR_FLAGS version: 6 updated: 2015/10/10 15:25:05 +dnl CF_AR_FLAGS version: 9 updated: 2021/01/01 13:31:04 dnl ----------- dnl Check for suitable "ar" (archiver) options for updating an archive. dnl @@ -453,39 +471,55 @@ AC_DEFUN([CF_AR_FLAGS],[ AC_REQUIRE([CF_PROG_AR]) AC_CACHE_CHECK(for options to update archives, cf_cv_ar_flags,[ - cf_cv_ar_flags=unknown - for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv - do + case "$cf_cv_system_name" in + (*-msvc*) + cf_cv_ar_flags='' + cat >mk_static_lib.sh <<-EOF + #!$SHELL + MSVC_BIN="[$]AR" + out="\[$]1" + shift + exec \[$]MSVC_BIN -out:"\[$]out" \[$]@ + EOF + chmod +x mk_static_lib.sh + AR=`pwd`/mk_static_lib.sh + ;; + (*) + cf_cv_ar_flags=unknown + for cf_ar_flags in -curvU -curv curv -crv crv -cqv cqv -rv rv + do - # check if $ARFLAGS already contains this choice - if test "x$ARFLAGS" != "x" ; then - cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` - if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then - cf_cv_ar_flags= - break + # check if $ARFLAGS already contains this choice + if test "x$ARFLAGS" != "x" ; then + cf_check_ar_flags=`echo "x$ARFLAGS" | sed -e "s/$cf_ar_flags\$//" -e "s/$cf_ar_flags / /"` + if test "x$ARFLAGS" != "$cf_check_ar_flags" ; then + cf_cv_ar_flags= + break + fi fi - fi - rm -f conftest.$ac_cv_objext - rm -f conftest.a + rm -f "conftest.$ac_cv_objext" + rm -f conftest.a - cat >conftest.$ac_ext <"conftest.$ac_ext" <&AC_FD_CC - $AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext 2>&AC_FD_CC 1>/dev/null - if test -f conftest.a ; then - cf_cv_ar_flags=$cf_ar_flags + if AC_TRY_EVAL(ac_compile) ; then + echo "$AR $ARFLAGS $cf_ar_flags conftest.a conftest.$ac_cv_objext" >&AC_FD_CC + $AR $ARFLAGS "$cf_ar_flags" conftest.a "conftest.$ac_cv_objext" 2>&AC_FD_CC 1>/dev/null + if test -f conftest.a ; then + cf_cv_ar_flags="$cf_ar_flags" + break + fi + else + CF_VERBOSE(cannot compile test-program) break fi - else - CF_VERBOSE(cannot compile test-program) - break - fi - done - rm -f conftest.a conftest.$ac_ext conftest.$ac_cv_objext + done + rm -f conftest.a "conftest.$ac_ext" "conftest.$ac_cv_objext" + ;; + esac ]) if test -n "$ARFLAGS" ; then @@ -570,7 +604,7 @@ else AC_MSG_RESULT(no) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_BOOL_SIZE version: 15 updated: 2017/01/21 11:06:25 +dnl CF_BOOL_SIZE version: 17 updated: 2020/10/24 19:48:55 dnl ------------ dnl Test for the size of 'bool' in the configured C++ compiler (e.g., a type). dnl Don't bother looking for bool.h, since it's been deprecated. @@ -579,8 +613,30 @@ dnl If the current compiler is C rather than C++, we get the bool definition dnl from . AC_DEFUN([CF_BOOL_SIZE], [ -AC_MSG_CHECKING([for size of bool]) -AC_CACHE_VAL(cf_cv_type_of_bool,[ +AC_CHECK_SIZEOF(bool,,[ +#include +#include + +#if defined(__cplusplus) + +#ifdef HAVE_GXX_BUILTIN_H +#include +#elif HAVE_GPP_BUILTIN_H +#include +#elif HAVE_BUILTIN_H +#include +#endif + +#else + +#if $cf_cv_header_stdbool_h +#include +#endif + +#endif +]) + +AC_CACHE_CHECK(for type of bool, cf_cv_type_of_bool,[ rm -f cf_test.out AC_TRY_RUN([ #include @@ -625,10 +681,18 @@ int main(void) cf_cv_type_of_bool=unknown fi], [cf_cv_type_of_bool=unknown], - [cf_cv_type_of_bool=unknown]) - ]) + [ + case x$ac_cv_sizeof_bool in + (x1) cf_cv_type_of_bool="unsigned char";; + (x2) cf_cv_type_of_bool="unsigned short";; + (x4) cf_cv_type_of_bool="unsigned int";; + (x8) cf_cv_type_of_bool="unsigned long";; + (*) cf_cv_type_of_bool=unknown;; + esac + ]) rm -f cf_test.out -AC_MSG_RESULT($cf_cv_type_of_bool) +]) + if test "$cf_cv_type_of_bool" = unknown ; then case .$NCURSES_BOOL in (.auto|.) NCURSES_BOOL=unsigned;; @@ -638,7 +702,7 @@ if test "$cf_cv_type_of_bool" = unknown ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_BUILD_CC version: 8 updated: 2018/01/04 20:31:04 +dnl CF_BUILD_CC version: 9 updated: 2021/01/02 09:31:20 dnl ----------- dnl If we're cross-compiling, allow the user to override the tools and their dnl options. The configure script is oriented toward identifying the host @@ -704,7 +768,7 @@ if test "$cross_compiling" = yes ; then : ${BUILD_CC:='${CC}'} - if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}' ) ; then + if { test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '${CC}'; } ; then AC_MSG_ERROR([Cross-build requires two compilers. Use --with-build-cc to specify the native compiler.]) fi @@ -730,7 +794,7 @@ AC_SUBST(BUILD_EXEEXT) AC_SUBST(BUILD_OBJEXT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CC_ENV_FLAGS version: 9 updated: 2018/07/29 18:03:26 +dnl CF_CC_ENV_FLAGS version: 10 updated: 2020/12/31 18:40:20 dnl --------------- dnl Check for user's environment-breakage by stuffing CFLAGS/CPPFLAGS content dnl into CC. This will not help with broken scripts that wrap the compiler @@ -745,7 +809,7 @@ dnl outweighs that limitation. AC_DEFUN([CF_CC_ENV_FLAGS], [ # This should have been defined by AC_PROG_CC -: ${CC:=cc} +: "${CC:=cc}" AC_MSG_CHECKING(\$CFLAGS variable) case "x$CFLAGS" in @@ -794,7 +858,7 @@ case "$CC" in esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CFG_DEFAULTS version: 11 updated: 2015/04/17 21:13:04 +dnl CF_CFG_DEFAULTS version: 16 updated: 2021/01/04 19:33:05 dnl --------------- dnl Determine the default configuration into which we'll install ncurses. This dnl can be overridden by the user's command-line options. There's two items to @@ -807,7 +871,8 @@ dnl We don't use AC_PREFIX_DEFAULT, because it gets evaluated too soon, and dnl we don't use AC_PREFIX_PROGRAM, because we cannot distinguish ncurses's dnl programs from a vendor's. AC_DEFUN([CF_CFG_DEFAULTS], -[ +[AC_REQUIRE([AC_PROG_FGREP])dnl + AC_MSG_CHECKING(for prefix) if test "x$prefix" = "xNONE" ; then case "$cf_cv_system_name" in @@ -825,20 +890,20 @@ if test "x$prefix" = "xNONE" ; then AC_MSG_CHECKING(for default include-directory) test -n "$verbose" && echo 1>&AC_FD_MSG for cf_symbol in \ - $includedir \ - $includedir/ncurses \ - $prefix/include \ - $prefix/include/ncurses \ + "$includedir" \ + "$includedir/ncurses" \ + "$prefix/include" \ + "$prefix/include/ncurses" \ /usr/local/include \ /usr/local/include/ncurses \ /usr/include \ /usr/include/ncurses do - cf_dir=`eval echo $cf_symbol` - if test -f $cf_dir/curses.h ; then - if ( fgrep NCURSES_VERSION $cf_dir/curses.h 2>&1 >/dev/null ) ; then + cf_dir=`eval echo "$cf_symbol"` + if test -f "$cf_dir/curses.h" ; then + if ( ${FGREP-fgrep} NCURSES_VERSION "$cf_dir/curses.h" >/dev/null 2>&1 ) ; then includedir="$cf_symbol" - test -n "$verbose" && echo $ac_n " found " 1>&AC_FD_MSG + test -n "$verbose" && echo $ECHO_N " found " 1>&AC_FD_MSG break fi fi @@ -893,7 +958,7 @@ AC_TRY_LINK([ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_CACHE version: 12 updated: 2012/10/02 20:55:03 +dnl CF_CHECK_CACHE version: 13 updated: 2020/12/31 10:54:15 dnl -------------- dnl Check if we're accidentally using a cache from a different machine. dnl Derive the system name, as a check for reusing the autoconf cache. @@ -907,7 +972,7 @@ dnl Note: we would use $ac_config_sub, but that is one of the places where dnl autoconf 2.5x broke compatibility with autoconf 2.13 AC_DEFUN([CF_CHECK_CACHE], [ -if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then +if test -f "$srcdir/config.guess" || test -f "$ac_aux_dir/config.guess" ; then ifelse([$1],,[AC_CANONICAL_HOST],[$1]) system_name="$host_os" else @@ -957,7 +1022,7 @@ fi CF_CHECK_EXTERN_DATA($1,ifelse([$2],,int,[$2])) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_ERRNO version: 12 updated: 2015/04/18 08:56:57 +dnl CF_CHECK_ERRNO version: 13 updated: 2020/03/10 18:53:47 dnl -------------- dnl Check for data that is usually declared in or , e.g., dnl the 'errno' variable. Define a DECL_xxx symbol if we must declare it @@ -975,7 +1040,7 @@ AC_CACHE_CHECK(if external $1 is declared, cf_cv_dcl_$1,[ #include #include #include ], - ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1, + ifelse([$2],,int,[$2]) x = (ifelse([$2],,int,[$2])) $1; (void)x, [cf_cv_dcl_$1=yes], [cf_cv_dcl_$1=no]) ]) @@ -1014,7 +1079,29 @@ fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_GETENV version: 1 updated: 2019/06/23 15:28:15 +dnl CF_CHECK_FVISIBILITY version: 2 updated: 2020/04/04 16:16:13 +dnl -------------------- +dnl Check whether the compiler understands -fvisibility=hidden +dnl +dnl $1 = compiler +dnl $2 = compiler-flags variable name +dnl $3 = cache variable to set +AC_DEFUN([CF_CHECK_FVISIBILITY],[ +AC_CACHE_CHECK(if $1 -fvisibility=hidden option works,$3,[ + cf_save_cflags="[$]$2" + $2="[$]$2 -fvisibility=hidden" + AC_TRY_LINK([ +__attribute__ ((visibility("default"))) int somefunc() {return 42;} + ],[ + if (somefunc()) return 1; +], + [$3=yes], + [$3=no]) + $2=$cf_save_cflags +]) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_GETENV version: 2 updated: 2021/01/02 17:09:14 dnl --------------- dnl Check if repeated getenv calls return the same pointer, e.g., it does not dnl discard the previous pointer when returning a new one. @@ -1071,7 +1158,7 @@ int main(void) mynames[j] = str_alloc(environ[j]); equals = strchr(mynames[j], '='); if (equals != 0) { - *equals++ = '\0'; + *equals++ = '\\0'; myvalues[j] = str_alloc(equals); } else { myvalues[j] = str_alloc(""); @@ -1105,13 +1192,13 @@ int main(void) char *value = getenv(mynames[j]); if (pass) { if (value == 0) { - fprintf(stderr, "getenv returned null for %s\n", mynames[j]); + fprintf(stderr, "getenv returned null for %s\\n", mynames[j]); ${cf_cv_main_return:-return}(1); } else if (value != mypointer[j]) { - fprintf(stderr, "getenv returned different pointer for %s\n", mynames[j]); + fprintf(stderr, "getenv returned different pointer for %s\\n", mynames[j]); ${cf_cv_main_return:-return}(1); } else if (strcmp(value, myvalues[j])) { - fprintf(stderr, "getenv returned different value for %s\n", mynames[j]); + fprintf(stderr, "getenv returned different value for %s\\n", mynames[j]); ${cf_cv_main_return:-return}(1); } } else { @@ -1119,7 +1206,7 @@ int main(void) mypointer[j] = value; for (k = 0; k < j; ++k) { if (mypointer[j] == mypointer[k]) { - fprintf(stderr, "getenv returned same pointer for %s and %s\n", mynames[j], mynames[k]); + fprintf(stderr, "getenv returned same pointer for %s and %s\\n", mynames[j], mynames[k]); ${cf_cv_main_return:-return}(1); } } @@ -1140,13 +1227,13 @@ then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_GNAT_VERSION version: 2 updated: 2019/12/31 08:53:54 +dnl CF_CHECK_GNAT_VERSION version: 4 updated: 2021/01/01 13:31:04 dnl --------------------- AC_DEFUN([CF_CHECK_GNAT_VERSION], [ AC_REQUIRE([CF_GNAT_VERSION]) -case $cf_cv_gnat_version in -(3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|20[[0-9]][[0-9]]) +case "$cf_cv_gnat_version" in +(3.1[[1-9]]*|3.[[2-9]]*|[[4-9]].*|[[1-9]][[0-9]].[[0-9]]*|20[[0-9]][[0-9]]) cf_cv_prog_gnat_correct=yes ;; (*) @@ -1156,12 +1243,14 @@ case $cf_cv_gnat_version in esac ]) dnl --------------------------------------------------------------------------- -dnl CF_CHECK_GPM_WGETCH version: 3 updated: 2017/01/21 11:06:25 +dnl CF_CHECK_GPM_WGETCH version: 6 updated: 2021/01/04 18:48:01 dnl ------------------- dnl Check if GPM is already linked with curses. If so - and if the linkage dnl is not "weak" - warn about this because it can create problems linking dnl applications with ncurses. AC_DEFUN([CF_CHECK_GPM_WGETCH],[ +AC_REQUIRE([AC_PROG_EGREP])dnl + AC_CHECK_LIB(gpm,Gpm_Wgetch,[ AC_CACHE_CHECK(if GPM is weakly bound to curses library, cf_cv_check_gpm_wgetch,[ @@ -1185,12 +1274,12 @@ CF_EOF LIBS="-static -lgpm -dynamic $LIBS" if AC_TRY_EVAL(ac_compile) ; then if AC_TRY_EVAL(ac_link) ; then - cf_cv_check_gpm_wgetch=`nm conftest$ac_exeext | egrep '\' | egrep '\<[[vVwW]]\>'` + cf_cv_check_gpm_wgetch="`nm \"conftest$ac_exeext\" | ${EGREP-egrep} '\' | ${EGREP-egrep} '\<[[vVwW]]\>'`" test -n "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=yes test -z "$cf_cv_check_gpm_wgetch" && cf_cv_check_gpm_wgetch=no fi fi - rm -rf conftest* + rm -rf ./conftest* LIBS="$cf_save_LIBS" fi ]) @@ -1221,7 +1310,7 @@ else fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_WCHAR_H version: 2 updated: 2017/01/21 11:06:25 +dnl CF_CHECK_WCHAR_H version: 3 updated: 2021/01/01 13:31:04 dnl ---------------- dnl Check if wchar.h can be used, i.e., without defining _XOPEN_SOURCE_EXTENDED AC_DEFUN([CF_CHECK_WCHAR_H],[ @@ -1245,13 +1334,13 @@ AC_TRY_COMPILE( [cf_cv_wchar_h_okay=yes], [cf_cv_wchar_h_okay=no])]) -if test $cf_cv_wchar_h_okay = no +if test "$cf_cv_wchar_h_okay" = no then CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_WCWIDTH_GRAPHICS version: 1 updated: 2015/12/19 17:47:56 +dnl CF_CHECK_WCWIDTH_GRAPHICS version: 2 updated: 2021/01/02 17:09:14 dnl ------------------------- dnl Most "modern" terminal emulators are based to some degree on VT100, and dnl should support line-drawing. Even with Unicode. There is a problem. @@ -1372,19 +1461,19 @@ main(void) if ((fp = fopen("conftest.in", "r")) != 0) { while (fgets(buffer, MY_LEN, fp) != 0) { if (*buffer == '-') { - fprintf(stderr, "\t%s", buffer); + fprintf(stderr, "\\t%s", buffer); } else if (sscanf(buffer, "%x %s", &value, notes) == 2) { ++totals; if (wcwidth(value) == 1) ++passed; - fprintf(stderr, "%d\t%s", wcwidth(value), buffer); + fprintf(stderr, "%d\\t%s", wcwidth(value), buffer); } else { - fprintf(stderr, "?\t%s", buffer); + fprintf(stderr, "?\\t%s", buffer); } } } } - fprintf(stderr, "%d/%d passed wcwidth/graphics check\n", passed, totals); + fprintf(stderr, "%d/%d passed wcwidth/graphics check\\n", passed, totals); return (totals == passed) ? 0 : 1; } ], @@ -1394,7 +1483,7 @@ main(void) ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CLANG_COMPILER version: 2 updated: 2013/11/19 19:23:35 +dnl CF_CLANG_COMPILER version: 8 updated: 2021/01/01 13:31:04 dnl ----------------- dnl Check if the given compiler is really clang. clang's C driver defines dnl __GNUC__ (fooling the configure script into setting $GCC to yes) but does @@ -1413,21 +1502,56 @@ ifelse([$2],,CLANG_COMPILER,[$2])=no if test "$ifelse([$1],,[$1],GCC)" = yes ; then AC_MSG_CHECKING(if this is really Clang ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" - ifelse([$3],,CFLAGS,[$3])="$ifelse([$3],,CFLAGS,[$3]) -Qunused-arguments" AC_TRY_COMPILE([],[ #ifdef __clang__ #else make an error #endif ],[ifelse([$2],,CLANG_COMPILER,[$2])=yes -cf_save_CFLAGS="$cf_save_CFLAGS -Qunused-arguments" ],[]) ifelse([$3],,CFLAGS,[$3])="$cf_save_CFLAGS" AC_MSG_RESULT($ifelse([$2],,CLANG_COMPILER,[$2])) fi + +CLANG_VERSION=none + +if test "x$ifelse([$2],,CLANG_COMPILER,[$2])" = "xyes" ; then + case "$CC" in + (c[[1-9]][[0-9]]|*/c[[1-9]][[0-9]]) + AC_MSG_WARN(replacing broken compiler alias $CC) + CFLAGS="$CFLAGS -std=`echo "$CC" | sed -e 's%.*/%%'`" + CC=clang + ;; + esac + + AC_MSG_CHECKING(version of $CC) + CLANG_VERSION="`$CC --version 2>/dev/null | sed -e '2,$d' -e 's/^.*(CLANG[[^)]]*) //' -e 's/^.*(Debian[[^)]]*) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" + test -z "$CLANG_VERSION" && CLANG_VERSION=unknown + AC_MSG_RESULT($CLANG_VERSION) + + for cf_clang_opt in \ + -Qunused-arguments \ + -Wno-error=implicit-function-declaration + do + AC_MSG_CHECKING(if option $cf_clang_opt works) + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $cf_clang_opt" + AC_TRY_LINK([ + #include ],[ + printf("hello!\\n");],[ + cf_clang_optok=yes],[ + cf_clang_optok=no]) + AC_MSG_RESULT($cf_clang_optok) + CFLAGS="$cf_save_CFLAGS" + if test "$cf_clang_optok" = yes; then + CF_VERBOSE(adding option $cf_clang_opt) + CF_APPEND_TEXT(CFLAGS,$cf_clang_opt) + fi + done +fi ]) dnl --------------------------------------------------------------------------- -dnl CF_CONST_X_STRING version: 3 updated: 2020/01/11 18:39:22 +dnl CF_CONST_X_STRING version: 6 updated: 2021/01/01 13:31:04 dnl ----------------- dnl The X11R4-X11R6 Xt specification uses an ambiguous String type for most dnl character-strings. @@ -1439,7 +1563,7 @@ dnl did not take into account the use of const for telling the compiler that dnl string literals would be in readonly memory. dnl dnl As a workaround, one could (starting with X11R5) define XTSTRINGDEFINES, to -dnl let the compiler decide how to represent Xt's strings which were #define'd. +dnl let the compiler decide how to represent Xt's strings which were #define'd. dnl That does not solve the problem of using the block of Xt's strings which dnl are compiled into the library (and is less efficient than one might want). dnl @@ -1457,7 +1581,7 @@ AC_TRY_COMPILE( #include #include ], -[String foo = malloc(1)],[ +[String foo = malloc(1); (void)foo],[ AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ AC_TRY_COMPILE( @@ -1475,7 +1599,7 @@ AC_CACHE_CHECK(for X11/Xt const-feature,cf_cv_const_x_string,[ CF_RESTORE_XTRA_FLAGS([CF_CONST_X_STRING]) -case $cf_cv_const_x_string in +case "$cf_cv_const_x_string" in (no) CF_APPEND_TEXT(CPPFLAGS,-DXTSTRINGDEFINES) ;; @@ -1578,13 +1702,13 @@ fi test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST,1,[Define to 1 if C++ has static_cast]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CXX_AR_FLAGS version: 2 updated: 2015/04/17 21:13:04 +dnl CF_CXX_AR_FLAGS version: 3 updated: 2021/01/01 13:31:04 dnl --------------- dnl Setup special archiver flags for given compilers. AC_DEFUN([CF_CXX_AR_FLAGS],[ CXX_AR='$(AR)' CXX_ARFLAGS='$(ARFLAGS)' - case $cf_cv_system_name in + case "$cf_cv_system_name" in (irix*) if test "$GXX" != yes ; then CXX_AR='$(CXX)' @@ -1662,12 +1786,12 @@ fi AC_SUBST($1) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_DIRNAME version: 4 updated: 2002/12/21 19:25:52 +dnl CF_DIRNAME version: 5 updated: 2020/12/31 20:19:42 dnl ---------- dnl "dirname" is not portable, so we fake it with a shell script. -AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl +AC_DEFUN([CF_DIRNAME],[$1=`echo "$2" | sed -e 's%/[[^/]]*$%%'`])dnl dnl --------------------------------------------------------------------------- -dnl CF_DIRS_TO_MAKE version: 3 updated: 2002/02/23 20:38:31 +dnl CF_DIRS_TO_MAKE version: 4 updated: 2021/01/01 13:31:04 dnl --------------- AC_DEFUN([CF_DIRS_TO_MAKE], [ @@ -1677,13 +1801,13 @@ do CF_OBJ_SUBDIR($cf_item,cf_subdir) for cf_item2 in $DIRS_TO_MAKE do - test $cf_item2 = $cf_subdir && break + test "$cf_item2" = "$cf_subdir" && break done test ".$cf_item2" != ".$cf_subdir" && DIRS_TO_MAKE="$DIRS_TO_MAKE $cf_subdir" done for cf_dir in $DIRS_TO_MAKE do - test ! -d $cf_dir && mkdir $cf_dir + test ! -d "$cf_dir" && mkdir "$cf_dir" done AC_SUBST(DIRS_TO_MAKE) ])dnl @@ -1736,7 +1860,7 @@ CF_ARG_DISABLE(gnat-projects, AC_MSG_RESULT($enable_gnat_projects) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_DISABLE_LEAKS version: 7 updated: 2012/10/02 20:55:03 +dnl CF_DISABLE_LEAKS version: 8 updated: 2021/01/05 20:05:09 dnl ---------------- dnl Combine no-leak checks with the libraries or tools that are used for the dnl checks. @@ -1749,11 +1873,13 @@ AC_REQUIRE([CF_WITH_VALGRIND]) AC_MSG_CHECKING(if you want to perform memory-leak testing) AC_ARG_ENABLE(leaks, [ --disable-leaks test: free permanent memory, analyze leaks], - [if test "x$enableval" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi], - : ${with_no_leaks:=no}) + [enable_leaks=no], + [enable_leaks=yes]) +dnl TODO - drop with_no_leaks +if test "x$enable_leaks" = xno; then with_no_leaks=yes; else with_no_leaks=no; fi AC_MSG_RESULT($with_no_leaks) -if test "$with_no_leaks" = yes ; then +if test "$enable_leaks" = no ; then AC_DEFINE(NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) AC_DEFINE(YY_NO_LEAKS,1,[Define to 1 if you want to perform memory-leak testing.]) fi @@ -1800,7 +1926,7 @@ AC_SUBST(ABI_VERSION) AC_SUBST(LIBTOOL_VERSION) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_DISABLE_RPATH_HACK version: 2 updated: 2011/02/13 13:31:33 +dnl CF_DISABLE_RPATH_HACK version: 3 updated: 2021/01/05 20:14:44 dnl --------------------- dnl The rpath-hack makes it simpler to build programs, particularly with the dnl *BSD ports which may have essential libraries in unusual places. But it @@ -1811,15 +1937,18 @@ AC_DEFUN([CF_DISABLE_RPATH_HACK], AC_MSG_CHECKING(if rpath-hack should be disabled) CF_ARG_DISABLE(rpath-hack, [ --disable-rpath-hack don't add rpath options for additional libraries], - [cf_disable_rpath_hack=yes], - [cf_disable_rpath_hack=no]) + [enable_rpath_hack=no], + [enable_rpath_hack=yes]) +dnl TODO - drop cf_disable_rpath_hack +if test "x$enable_rpath_hack" = xno; then cf_disable_rpath_hack=yes; else cf_disable_rpath_hack=no; fi AC_MSG_RESULT($cf_disable_rpath_hack) -if test "$cf_disable_rpath_hack" = no ; then + +if test "$enable_rpath_hack" = yes ; then CF_RPATH_HACK fi ]) dnl --------------------------------------------------------------------------- -dnl CF_ENABLE_BROKEN_LINKER version: 1 updated: 2020/02/08 15:59:30 +dnl CF_ENABLE_BROKEN_LINKER version: 2 updated: 2021/01/02 17:09:14 dnl ----------------------- dnl Some linkers cannot reference a data-only object. Cygwin used to be one. dnl This usually follows CF_LINK_DATAONLY, but is not required in case we need @@ -1833,7 +1962,7 @@ AC_ARG_ENABLE(broken_linker, [with_broken_linker=no]) AC_MSG_RESULT($with_broken_linker) -: ${BROKEN_LINKER:=0} +: "${BROKEN_LINKER:=0}" if test "x$with_broken_linker" = xyes ; then AC_DEFINE(BROKEN_LINKER,1,[Define to 1 to work around linkers which cannot link data-only modules]) BROKEN_LINKER=1 @@ -1893,7 +2022,7 @@ AC_ARG_ENABLE(rpath, AC_MSG_RESULT($cf_cv_enable_rpath) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ENABLE_STRING_HACKS version: 5 updated: 2016/10/08 17:34:11 +dnl CF_ENABLE_STRING_HACKS version: 6 updated: 2021/01/05 19:23:48 dnl ---------------------- dnl On a few platforms, the compiler and/or loader nags with untruthful dnl comments stating that "most" uses of strcat/strcpy/sprintf are incorrect, @@ -1913,11 +2042,11 @@ AC_DEFUN([CF_ENABLE_STRING_HACKS], AC_MSG_CHECKING(if you want to work around bogus compiler/loader warnings) AC_ARG_ENABLE(string-hacks, [ --enable-string-hacks work around bogus compiler/loader warnings], - [with_string_hacks=$enableval], - [with_string_hacks=no]) -AC_MSG_RESULT($with_string_hacks) + [enable_string_hacks=$enableval], + [enable_string_hacks=no]) +AC_MSG_RESULT($enable_string_hacks) -if test "x$with_string_hacks" = "xyes"; then +if test "x$enable_string_hacks" = "xyes"; then AC_DEFINE(USE_STRING_HACKS,1,[Define to 1 to work around bogus compiler/loader warnings]) AC_MSG_WARN(enabling string-hacks to work around bogus compiler/loader warnings) AC_CHECK_FUNC(strlcat,[ @@ -1933,6 +2062,36 @@ if test "x$with_string_hacks" = "xyes"; then fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_ENABLE_WARNINGS version: 9 updated: 2021/01/05 19:40:50 +dnl ------------------ +dnl Configure-option to enable gcc warnings +dnl +dnl $1 = extra options to add, if supported +dnl $2 = option for checking attributes. By default, this is done when +dnl warnings are enabled. For other values: +dnl yes: always do this, e.g., to use in generated library-headers +dnl no: never do this +AC_DEFUN([CF_ENABLE_WARNINGS],[ +if test "$GCC" = yes || test "$GXX" = yes +then +CF_FIX_WARNINGS(CFLAGS) +CF_FIX_WARNINGS(CPPFLAGS) +CF_FIX_WARNINGS(LDFLAGS) +AC_MSG_CHECKING(if you want to turn on gcc warnings) +CF_ARG_ENABLE(warnings, + [ --enable-warnings test: turn on gcc compiler warnings], + [enable_warnings=yes], + [enable_warnings=no]) +AC_MSG_RESULT($enable_warnings) +if test "$enable_warnings" = "yes" +then + ifelse($2,,[CF_GCC_ATTRIBUTES]) + CF_GCC_WARNINGS($1) +fi +ifelse($2,yes,[CF_GCC_ATTRIBUTES]) +fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_ERRNO version: 5 updated: 1997/11/30 12:44:39 dnl -------- dnl Check if 'errno' is declared in @@ -1941,7 +2100,7 @@ AC_DEFUN([CF_ERRNO], CF_CHECK_ERRNO(errno) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ETIP_DEFINES version: 5 updated: 2012/02/18 17:51:07 +dnl CF_ETIP_DEFINES version: 6 updated: 2021/01/02 17:09:14 dnl --------------- dnl Test for conflicting definitions of exception in gcc 2.8.0, etc., between dnl math.h and builtin.h, only for ncurses @@ -1954,7 +2113,7 @@ cf_result="none" # etip.h includes ncurses.h which includes ncurses_dll.h # But ncurses_dll.h is generated - fix here. test -d include || mkdir include -test -f include/ncurses_dll.h || sed -e 's/@NCURSES_WRAP_PREFIX@/'$NCURSES_WRAP_PREFIX'/g' ${srcdir}/include/ncurses_dll.h.in >include/ncurses_dll.h +test -f include/ncurses_dll.h || sed -e 's/@NCURSES_WRAP_PREFIX@/'$NCURSES_WRAP_PREFIX'/g' "${srcdir}/include/ncurses_dll.h.in" >include/ncurses_dll.h for cf_math in "" MATH_H do @@ -1977,7 +2136,7 @@ AC_MSG_RESULT($cf_result) CXXFLAGS="$cf_save_CXXFLAGS" ]) dnl --------------------------------------------------------------------------- -dnl CF_FIND_LINKAGE version: 21 updated: 2018/06/20 20:23:13 +dnl CF_FIND_LINKAGE version: 22 updated: 2020/12/31 20:19:42 dnl --------------- dnl Find a library (specifically the linkage used in the code fragment), dnl searching for it if it is not already in the library path. @@ -2034,7 +2193,7 @@ AC_TRY_LINK([$1],[$2],[ CF_HEADER_PATH(cf_search,ifelse([$6],,[$3],[$6])) for cf_cv_header_path_$3 in $cf_search do - if test -d $cf_cv_header_path_$3 ; then + if test -d "$cf_cv_header_path_$3" ; then CF_VERBOSE(... testing $cf_cv_header_path_$3) CPPFLAGS="$cf_save_CPPFLAGS" CF_APPEND_TEXT(CPPFLAGS,-I$cf_cv_header_path_$3) @@ -2069,7 +2228,7 @@ AC_TRY_LINK([$1],[$2],[ CF_LIBRARY_PATH(cf_search,$3) for cf_cv_library_path_$3 in $cf_search do - if test -d $cf_cv_library_path_$3 ; then + if test -d "$cf_cv_library_path_$3" ; then CF_VERBOSE(... testing $cf_cv_library_path_$3) CPPFLAGS="$cf_test_CPPFLAGS" LIBS="-l$3 $7 $cf_save_LIBS" @@ -2108,7 +2267,7 @@ ifelse([$5],,AC_MSG_WARN(Cannot find $3 library),[$5]) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FIND_SUB_INCDIR version: 2 updated: 2015/04/17 21:13:04 +dnl CF_FIND_SUB_INCDIR version: 3 updated: 2021/01/01 13:31:04 dnl ------------------ dnl Find an include-directory with the given leaf-name. This is useful for dnl example with FreeBSD ports, which use this convention to distinguish @@ -2117,7 +2276,7 @@ AC_DEFUN([CF_FIND_SUB_INCDIR],[ CF_SUBDIR_PATH(cf_search,$1,include) for cf_item in $cf_search do - case $cf_item in + case "$cf_item" in (*/$1) CF_ADD_INCDIR($cf_item) ;; @@ -2125,7 +2284,7 @@ AC_DEFUN([CF_FIND_SUB_INCDIR],[ done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FIND_SUB_LIBDIR version: 2 updated: 2015/04/17 21:13:04 +dnl CF_FIND_SUB_LIBDIR version: 3 updated: 2021/01/01 13:31:04 dnl ------------------ dnl Find a library-directory with the given leaf-name. This is useful for dnl example with FreeBSD ports, which use this convention to distinguish @@ -2134,7 +2293,7 @@ AC_DEFUN([CF_FIND_SUB_LIBDIR],[ CF_SUBDIR_PATH(cf_search,$1,lib) for cf_item in $cf_search do - case $cf_item in + case "$cf_item" in (*/$1) CF_ADD_LIBDIR($cf_item) ;; @@ -2161,6 +2320,40 @@ AC_DEFUN([CF_FIXUP_ADAFLAGS],[ AC_MSG_RESULT($ADAFLAGS) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_FIX_WARNINGS version: 3 updated: 2020/12/31 18:40:20 +dnl --------------- +dnl Warning flags do not belong in CFLAGS, CPPFLAGS, etc. Any of gcc's +dnl "-Werror" flags can interfere with configure-checks. Those go into +dnl EXTRA_CFLAGS. +dnl +dnl $1 = variable name to repair +define([CF_FIX_WARNINGS],[ +if test "$GCC" = yes || test "$GXX" = yes +then + case [$]$1 in + (*-Werror=*) + CF_VERBOSE(repairing $1: [$]$1) + cf_temp_flags= + for cf_temp_scan in [$]$1 + do + case "x$cf_temp_scan" in + (x-Werror=*) + CF_APPEND_TEXT(EXTRA_CFLAGS,$cf_temp_scan) + ;; + (*) + CF_APPEND_TEXT(cf_temp_flags,$cf_temp_scan) + ;; + esac + done + $1="$cf_temp_flags" + CF_VERBOSE(... fixed [$]$1) + CF_VERBOSE(... extra $EXTRA_CFLAGS) + ;; + esac +fi +AC_SUBST(EXTRA_CFLAGS) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_FOPEN_BIN_R version: 2 updated: 2019/12/31 08:53:54 dnl -------------- dnl Check if fopen works when the "b" (binary) flag is added to the mode @@ -2313,7 +2506,7 @@ int main(void) { test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP,1,[Define to 1 if we have nanosleep()]) ]) dnl --------------------------------------------------------------------------- -dnl CF_FUNC_OPENPTY version: 5 updated: 2015/09/12 14:46:50 +dnl CF_FUNC_OPENPTY version: 6 updated: 2021/01/01 13:31:04 dnl --------------- dnl Check for openpty() function, along with header. It may need the dnl "util" library as well. @@ -2322,7 +2515,7 @@ AC_DEFUN([CF_FUNC_OPENPTY], AC_CHECK_LIB(util,openpty,cf_cv_lib_util=yes,cf_cv_lib_util=no) AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[ cf_save_LIBS="$LIBS" - test $cf_cv_lib_util = yes && { CF_ADD_LIB(util) } + test "$cf_cv_lib_util" = yes && { CF_ADD_LIB(util) } for cf_header in pty.h libutil.h util.h do AC_TRY_LINK([ @@ -2341,12 +2534,12 @@ AC_CACHE_CHECK(for openpty header,cf_cv_func_openpty,[ ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FUNC_POLL version: 9 updated: 2015/10/10 13:27:32 +dnl CF_FUNC_POLL version: 10 updated: 2021/01/04 19:13:57 dnl ------------ dnl See if the poll function really works. Some platforms have poll(), but dnl it does not work for terminals or files. AC_DEFUN([CF_FUNC_POLL],[ -tty 2>&1 >/dev/null || { AC_CHECK_FUNCS(posix_openpt) } +tty >/dev/null 2>&1 || { AC_CHECK_FUNCS(posix_openpt) } AC_CACHE_CHECK(if poll really works,cf_cv_working_poll,[ AC_TRY_RUN([ #include @@ -2431,7 +2624,7 @@ tcgetattr(1, &foo);], test "$cf_cv_have_tcgetattr" = yes && AC_DEFINE(HAVE_TCGETATTR,1,[Define to 1 if we have tcgetattr]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_FUNC_VSSCANF version: 6 updated: 2015/04/18 08:56:57 +dnl CF_FUNC_VSSCANF version: 7 updated: 2021/01/01 13:31:04 dnl --------------- dnl Check for vsscanf() function, which is in c9x but generally not in earlier dnl versions of C. It is in the GNU C library, and can often be simulated by @@ -2468,7 +2661,7 @@ AC_TRY_LINK([ return (_doscan(&strbuf, "%d", ap))],[cf_cv_func_vsscanf=_doscan],[ cf_cv_func_vsscanf=no])])])]) -case $cf_cv_func_vsscanf in +case "$cf_cv_func_vsscanf" in (vsscanf) AC_DEFINE(HAVE_VSSCANF,1,[Define to 1 if we have vsscanf]);; (vfscanf) AC_DEFINE(HAVE_VFSCANF,1,[Define to 1 if we have vfscanf]);; (_doscan) AC_DEFINE(HAVE__DOSCAN,1,[Define to 1 if we have _doscan]);; @@ -2476,14 +2669,15 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_ATTRIBUTES version: 17 updated: 2015/04/12 15:39:00 +dnl CF_GCC_ATTRIBUTES version: 23 updated: 2021/01/03 18:30:50 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary dnl to documentation, unrecognized directives cause older compilers to barf. AC_DEFUN([CF_GCC_ATTRIBUTES], -[ -if test "$GCC" = yes +[AC_REQUIRE([AC_PROG_FGREP])dnl + +if test "$GCC" = yes || test "$GXX" = yes then cat > conftest.i < conftest.$ac_ext < "conftest.$ac_ext" < conftest.$ac_ext <&AC_FD_CC - case $cf_attribute in + case "$cf_attribute" in (printf) cf_printf_attribute=yes cat >conftest.h <>confdefs.h - case $cf_attribute in + case "$cf_attribute" in (noreturn) AC_DEFINE_UNQUOTED(GCC_NORETURN,$cf_directive,[Define to noreturn-attribute for gcc]) ;; @@ -2580,9 +2774,9 @@ EOF fi done else - fgrep define conftest.i >>confdefs.h + ${FGREP-fgrep} define conftest.i >>confdefs.h fi -rm -rf conftest* +rm -rf ./conftest* fi ])dnl dnl --------------------------------------------------------------------------- @@ -2603,7 +2797,7 @@ CF_INTEL_COMPILER(GCC,INTEL_COMPILER,CFLAGS) CF_CLANG_COMPILER(GCC,CLANG_COMPILER,CFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_WARNINGS version: 37 updated: 2020/01/05 20:04:12 +dnl CF_GCC_WARNINGS version: 41 updated: 2021/01/01 16:53:59 dnl --------------- dnl Check if the compiler supports useful warning options. There's a few that dnl we don't use, simply because they're too noisy: @@ -2627,7 +2821,7 @@ AC_DEFUN([CF_GCC_WARNINGS], [ AC_REQUIRE([CF_GCC_VERSION]) if test "x$have_x" = xyes; then CF_CONST_X_STRING fi -cat > conftest.$ac_ext < "conftest.$ac_ext" <>library.gpr <&AC_FD_CC 2>&1 ) ; then cf_gnat_projects=yes @@ -2855,7 +3048,7 @@ CF_EOF then cf_gnat_libraries=yes fi - rm -rf conftest* *~conftest* + rm -rf ./conftest* ./*~conftest* ;; esac ;; @@ -2863,19 +3056,30 @@ esac AC_MSG_RESULT($cf_gnat_projects) fi # enable_gnat_projects -if test $cf_gnat_projects = yes +if test "$cf_gnat_projects" = yes then AC_MSG_CHECKING(if GNAT supports libraries) AC_MSG_RESULT($cf_gnat_libraries) fi +USE_OLD_MAKERULES="" +USE_GNAT_PROJECTS="#" +USE_GNAT_MAKE_GPR="#" +USE_GNAT_GPRBUILD="#" + if test "$cf_gnat_projects" = yes then USE_OLD_MAKERULES="#" USE_GNAT_PROJECTS="" -else - USE_OLD_MAKERULES="" - USE_GNAT_PROJECTS="#" + if test "$cf_cv_VERSION_GPRBUILD" != no + then + USE_GNAT_GPRBUILD="" + elif test "$cf_cv_VERSION_GNATMAKE" != no + then + USE_GNAT_MAKE_GPR="" + else + AC_MSG_WARN(use old makefile rules since tools are missing) + fi fi if test "$cf_gnat_libraries" = yes @@ -2888,9 +3092,11 @@ fi AC_SUBST(USE_OLD_MAKERULES) AC_SUBST(USE_GNAT_PROJECTS) AC_SUBST(USE_GNAT_LIBRARIES) +AC_SUBST(USE_GNAT_MAKE_GPR) +AC_SUBST(USE_GNAT_GPRBUILD) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNAT_SIGINT version: 1 updated: 2011/03/27 20:07:59 +dnl CF_GNAT_SIGINT version: 2 updated: 2021/01/01 13:31:04 dnl -------------- dnl Check if gnat supports SIGINT, and presumably tasking. For the latter, it dnl is noted that gnat may compile a tasking unit even for configurations which @@ -2929,7 +3135,7 @@ end ConfTest;], [cf_cv_gnat_sigint=yes], [cf_cv_gnat_sigint=no])]) -if test $cf_cv_gnat_sigint = yes ; then +if test "$cf_cv_gnat_sigint" = yes ; then USE_GNAT_SIGINT="" else USE_GNAT_SIGINT="#" @@ -2937,7 +3143,7 @@ fi AC_SUBST(USE_GNAT_SIGINT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNAT_TRY_LINK version: 3 updated: 2011/03/19 14:47:45 +dnl CF_GNAT_TRY_LINK version: 4 updated: 2021/01/01 13:31:04 dnl ---------------- dnl Verify that a test program compiles/links with GNAT. dnl $cf_ada_make is set to the program that compiles/links @@ -2949,22 +3155,22 @@ dnl $3 is the shell command to execute if successful dnl $4 is the shell command to execute if not successful AC_DEFUN([CF_GNAT_TRY_LINK], [ -rm -rf conftest* *~conftest* +rm -rf ./conftest* ./*~conftest* cat >>conftest.ads <>conftest.adb <&AC_FD_CC 2>&1 ) ; then +if ( "$cf_ada_make" $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then ifelse($3,, :,[ $3]) ifelse($4,,,[else $4]) fi -rm -rf conftest* *~conftest* +rm -rf ./conftest* ./*~conftest* ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GNAT_TRY_RUN version: 5 updated: 2011/03/19 14:47:45 +dnl CF_GNAT_TRY_RUN version: 6 updated: 2021/01/01 13:31:04 dnl --------------- dnl Verify that a test program compiles and runs with GNAT dnl $cf_ada_make is set to the program that compiles/links @@ -2976,14 +3182,14 @@ dnl $3 is the shell command to execute if successful dnl $4 is the shell command to execute if not successful AC_DEFUN([CF_GNAT_TRY_RUN], [ -rm -rf conftest* *~conftest* +rm -rf ./conftest* ./*~conftest* cat >>conftest.ads <>conftest.adb <&AC_FD_CC 2>&1 ) ; then +if ( "$cf_ada_make" $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then ifelse($3,, :,[ $3]) ifelse($4,,,[ else @@ -2992,7 +3198,7 @@ ifelse($4,,,[ else ifelse($4,,,[else $4]) fi -rm -rf conftest* *~conftest* +rm -rf ./conftest* ./*~conftest* ])dnl dnl --------------------------------------------------------------------------- dnl CF_GNAT_VERSION version: 22 updated: 2019/12/31 08:53:54 @@ -3122,7 +3328,7 @@ if test x$cf_cv_gnu_library = xyes; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GPP_LIBRARY version: 12 updated: 2015/04/17 21:13:04 +dnl CF_GPP_LIBRARY version: 13 updated: 2021/01/01 13:31:04 dnl -------------- dnl If we're trying to use g++, test if libg++ is installed (a rather common dnl problem :-). If we have the compiler but no library, we'll be able to @@ -3130,7 +3336,7 @@ dnl configure, but won't be able to build the c++ demo program. AC_DEFUN([CF_GPP_LIBRARY], [ cf_cxx_library=unknown -case $cf_cv_system_name in +case "$cf_cv_system_name" in (os2*) cf_gpp_libname=gpp ;; @@ -3184,7 +3390,7 @@ if test "$GXX" = yes; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GXX_WARNINGS version: 9 updated: 2015/04/17 21:13:04 +dnl CF_GXX_WARNINGS version: 11 updated: 2021/01/08 16:50:55 dnl --------------- dnl Check if the compiler supports useful warning options. dnl @@ -3263,7 +3469,7 @@ then EXTRA_CXXFLAGS="-W -Wall" cf_gxx_extra_warnings="" test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings" - case "$GCC_VERSION" in + case "$GXX_VERSION" in ([[1-2]].*) ;; (*) @@ -3297,7 +3503,7 @@ then CXXFLAGS="$cf_save_CXXFLAGS" fi -rm -rf conftest* +rm -rf ./conftest* AC_LANG_RESTORE AC_SUBST(EXTRA_CXXFLAGS) ])dnl @@ -3347,7 +3553,7 @@ fi ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_HASHED_DB_LIBS version: 9 updated: 2010/05/29 16:31:02 +dnl CF_HASHED_DB_LIBS version: 10 updated: 2021/01/02 17:09:14 dnl ----------------- dnl Given that we have the header and version for hashed database, find the dnl library information. @@ -3361,7 +3567,7 @@ do if test -n "$cf_db_libs"; then CF_ADD_LIB($cf_db_libs) fi - CF_MSG_LOG(checking for library "$cf_db_libs") + CF_MSG_LOG(checking for library $cf_db_libs) AC_TRY_LINK([ $ac_includes_default #include @@ -3457,7 +3663,7 @@ done ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_HEADER_PATH version: 13 updated: 2015/04/15 19:08:48 +dnl CF_HEADER_PATH version: 15 updated: 2021/01/01 13:31:04 dnl -------------- dnl Construct a search-list of directories for a nonstandard header-file dnl @@ -3473,7 +3679,7 @@ cf_header_path_list="" if test -n "${CFLAGS}${CPPFLAGS}" ; then for cf_header_path in $CPPFLAGS $CFLAGS do - case $cf_header_path in + case "$cf_header_path" in (-I*) cf_header_path=`echo ".$cf_header_path" |sed -e 's/^...//' -e 's,/include$,,'` CF_ADD_SUBDIR_PATH($1,$2,include,$cf_header_path,NONE) @@ -3489,15 +3695,15 @@ CF_SUBDIR_PATH($1,$2,include) test "$includedir" != NONE && \ test "$includedir" != "/usr/include" && \ test -d "$includedir" && { - test -d $includedir && $1="[$]$1 $includedir" - test -d $includedir/$2 && $1="[$]$1 $includedir/$2" + test -d "$includedir" && $1="[$]$1 $includedir" + test -d "$includedir/$2" && $1="[$]$1 $includedir/$2" } test "$oldincludedir" != NONE && \ test "$oldincludedir" != "/usr/include" && \ test -d "$oldincludedir" && { - test -d $oldincludedir && $1="[$]$1 $oldincludedir" - test -d $oldincludedir/$2 && $1="[$]$1 $oldincludedir/$2" + test -d "$oldincludedir" && $1="[$]$1 $oldincludedir" + test -d "$oldincludedir/$2" && $1="[$]$1 $oldincludedir/$2" } $1="[$]$1 $cf_header_path_list" @@ -3538,7 +3744,7 @@ CF_INSTALL_OPT_P CF_INSTALL_OPT_O ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INSTALL_OPT_O version: 2 updated: 2015/05/15 19:45:35 +dnl CF_INSTALL_OPT_O version: 3 updated: 2020/12/31 20:19:42 dnl ---------------- dnl Almost all "install" programs default to the current user's ownership. dnl Almost - MINIX is an exception. @@ -3557,7 +3763,7 @@ esac AC_MSG_RESULT($with_install_o) if test "x$with_install_o" = xyes then - INSTALL_OPT_O=`id root|sed -e 's/uid=[[0-9]]*(/ -o /' -e 's/gid=[[0-9]]*(/ -g /' -e 's/ [[^=[:space:]]][[^=[:space:]]]*=.*/ /' -e 's/)//g'` + INSTALL_OPT_O="`id root|sed -e 's/uid=[[0-9]]*(/ -o /' -e 's/gid=[[0-9]]*(/ -g /' -e 's/ [[^=[:space:]]][[^=[:space:]]]*=.*/ /' -e 's/)//g'`" else INSTALL_OPT_O= fi @@ -3565,16 +3771,16 @@ fi AC_SUBST(INSTALL_OPT_O) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INSTALL_OPT_P version: 1 updated: 2018/08/18 12:19:21 +dnl CF_INSTALL_OPT_P version: 3 updated: 2021/01/01 13:31:04 dnl ---------------- dnl Some install-programs accept a "-p" option to preserve file modification dnl timestamps. That can be useful as an install option, as well as a way to dnl avoid the need for ranlib after copying a static archive. AC_DEFUN([CF_INSTALL_OPT_P], [ -: ${INSTALL:=install} +: "${INSTALL:=install}" AC_CACHE_CHECK(if install accepts -p option, cf_cv_install_p,[ - rm -rf conftest* + rm -rf ./conftest* date >conftest.in mkdir conftest.out sleep 3 @@ -3596,11 +3802,11 @@ AC_CACHE_CHECK(if install accepts -p option, cf_cv_install_p,[ else cf_cv_install_p=no fi - rm -rf conftest* + rm -rf ./conftest* ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INSTALL_OPT_S version: 2 updated: 2018/08/18 12:19:21 +dnl CF_INSTALL_OPT_S version: 3 updated: 2021/01/05 19:23:48 dnl ---------------- dnl By default, we should strip executables which are installed, but leave the dnl ability to suppress that for unit-testing. @@ -3609,11 +3815,11 @@ AC_DEFUN([CF_INSTALL_OPT_S], AC_MSG_CHECKING(if you want to install stripped executables) CF_ARG_DISABLE(stripping, [ --disable-stripping do not strip (debug info) installed executables], - [with_stripping=no], - [with_stripping=yes]) -AC_MSG_RESULT($with_stripping) + [enable_stripping=no], + [enable_stripping=yes]) +AC_MSG_RESULT($enable_stripping) -if test "$with_stripping" = yes +if test "$enable_stripping" = yes then INSTALL_OPT_S="-s" else @@ -3622,7 +3828,7 @@ fi AC_SUBST(INSTALL_OPT_S) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_INTEL_COMPILER version: 7 updated: 2015/04/12 15:39:00 +dnl CF_INTEL_COMPILER version: 8 updated: 2021/01/01 16:53:59 dnl ----------------- dnl Check if the given compiler is really the Intel compiler for Linux. It dnl tries to imitate gcc, but does not return an error when it finds a mismatch @@ -3640,7 +3846,7 @@ AC_REQUIRE([AC_CANONICAL_HOST]) ifelse([$2],,INTEL_COMPILER,[$2])=no if test "$ifelse([$1],,[$1],GCC)" = yes ; then - case $host_os in + case "$host_os" in (linux*|gnu*) AC_MSG_CHECKING(if this is really Intel ifelse([$1],GXX,C++,C) compiler) cf_save_CFLAGS="$ifelse([$3],,CFLAGS,[$3])" @@ -3675,7 +3881,7 @@ AC_MSG_RESULT($cf_cv_have_isascii) test "$cf_cv_have_isascii" = yes && AC_DEFINE(HAVE_ISASCII,1,[Define to 1 if we have isascii()]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LARGEFILE version: 11 updated: 2018/06/20 20:23:13 +dnl CF_LARGEFILE version: 12 updated: 2020/03/19 20:23:48 dnl ------------ dnl Add checks for large file support. AC_DEFUN([CF_LARGEFILE],[ @@ -3715,6 +3921,7 @@ ifdef([AC_FUNC_FSEEKO],[ struct dirent64 *x = readdir((DIR *)0); struct dirent *y = readdir((DIR *)0); int z = x - y; + (void)z; ], [cf_cv_struct_dirent64=yes], [cf_cv_struct_dirent64=no]) @@ -3724,7 +3931,7 @@ ifdef([AC_FUNC_FSEEKO],[ ]) ]) dnl --------------------------------------------------------------------------- -dnl CF_LDFLAGS_STATIC version: 12 updated: 2015/04/18 08:56:57 +dnl CF_LDFLAGS_STATIC version: 14 updated: 2021/01/02 17:09:14 dnl ----------------- dnl Check for compiler/linker flags used to temporarily force usage of static dnl libraries. This depends on the compiler and platform. Use this to help @@ -3733,7 +3940,7 @@ dnl the list of linker options and libraries. AC_DEFUN([CF_LDFLAGS_STATIC],[ if test "$GCC" = yes ; then - case $cf_cv_system_name in + case "$cf_cv_system_name" in (OS/2*|os2*|aix[[4]]*|solaris2.1[[0-9]]|darwin*) LDFLAGS_STATIC= LDFLAGS_SHARED= @@ -3744,7 +3951,7 @@ if test "$GCC" = yes ; then ;; esac else - case $cf_cv_system_name in + case "$cf_cv_system_name" in (aix[[4-7]]*) # from ld manpage LDFLAGS_STATIC=-bstatic LDFLAGS_SHARED=-bdynamic @@ -3797,7 +4004,7 @@ int cf_ldflags_static(FILE *fp); return cf_ldflags_static(stdin); ],[ # some linkers simply ignore the -dynamic - case x`file conftest$ac_exeext 2>/dev/null` in + case x`file "conftest$ac_exeext" 2>/dev/null` in (*static*) cf_ldflags_static=no ;; @@ -3812,7 +4019,7 @@ int cf_ldflags_static(FILE *fp); AC_MSG_RESULT($cf_ldflags_static) - if test $cf_ldflags_static != yes + if test "$cf_ldflags_static" != yes then LDFLAGS_STATIC= LDFLAGS_SHARED= @@ -3826,7 +4033,7 @@ AC_SUBST(LDFLAGS_STATIC) AC_SUBST(LDFLAGS_SHARED) ]) dnl --------------------------------------------------------------------------- -dnl CF_LD_RPATH_OPT version: 8 updated: 2018/08/18 16:36:35 +dnl CF_LD_RPATH_OPT version: 9 updated: 2021/01/01 13:31:04 dnl --------------- dnl For the given system and compiler, find the compiler flags to pass to the dnl loader to use the "rpath" feature. @@ -3838,7 +4045,7 @@ LD_RPATH_OPT= if test "x$cf_cv_enable_rpath" != xno then AC_MSG_CHECKING(for an rpath option) - case $cf_cv_system_name in + case "$cf_cv_system_name" in (irix*) if test "$GCC" = yes; then LD_RPATH_OPT="-Wl,-rpath," @@ -3953,7 +4160,7 @@ LD_SEARCHPATH=`echo "$cf_cv_ld_searchpath"|sed -e 's/ /|/g'` AC_SUBST(LD_SEARCHPATH) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIBRARY_PATH version: 10 updated: 2015/04/15 19:08:48 +dnl CF_LIBRARY_PATH version: 11 updated: 2021/01/01 13:31:04 dnl --------------- dnl Construct a search-list of directories for a nonstandard library-file dnl @@ -3967,7 +4174,7 @@ cf_library_path_list="" if test -n "${LDFLAGS}${LIBS}" ; then for cf_library_path in $LDFLAGS $LIBS do - case $cf_library_path in + case "$cf_library_path" in (-L*) cf_library_path=`echo ".$cf_library_path" |sed -e 's/^...//' -e 's,/lib$,,'` CF_ADD_SUBDIR_PATH($1,$2,lib,$cf_library_path,NONE) @@ -3994,13 +4201,13 @@ fi test -z "$cf_cv_libtool_version" && unset cf_cv_libtool_version ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIB_PREFIX version: 12 updated: 2015/10/17 19:03:33 +dnl CF_LIB_PREFIX version: 14 updated: 2021/01/01 13:31:04 dnl ------------- dnl Compute the library-prefix for the given host system dnl $1 = variable to set define([CF_LIB_PREFIX], [ - case $cf_cv_system_name in + case "$cf_cv_system_name" in (OS/2*|os2*) if test "$DFT_LWR_MODEL" = libtool; then LIB_PREFIX='lib' @@ -4008,6 +4215,9 @@ define([CF_LIB_PREFIX], LIB_PREFIX='' fi ;; + (*-msvc*) + LIB_PREFIX='' + ;; (*) LIB_PREFIX='lib' ;; esac @@ -4015,7 +4225,7 @@ ifelse($1,,,[$1=$LIB_PREFIX]) AC_SUBST(LIB_PREFIX) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIB_RULES version: 88 updated: 2018/08/18 12:19:21 +dnl CF_LIB_RULES version: 94 updated: 2021/01/23 15:37:41 dnl ------------ dnl Append definitions and rules for the given models to the subdirectory dnl Makefiles, and the recursion rule for the top-level Makefile. If the @@ -4031,39 +4241,40 @@ dnl lib.so.. dnl dnl Note: Libs_To_Make is mixed case, since it is not a pure autoconf variable. AC_DEFUN([CF_LIB_RULES], -[ +[AC_REQUIRE([AC_PROG_FGREP])dnl + cf_prefix=$LIB_PREFIX AC_REQUIRE([CF_SUBST_NCURSES_VERSION]) -case $cf_cv_shlib_version in -(cygdll|msysdll|mingw) +case "$cf_cv_shlib_version" in +(cygdll|msysdll|mingw|msvcdll) TINFO_NAME=$TINFO_ARG_SUFFIX TINFO_SUFFIX=.dll ;; esac if test -n "$TINFO_SUFFIX" ; then - case $TINFO_SUFFIX in + case "$TINFO_SUFFIX" in (tw*) TINFO_NAME="${TINFO_NAME}tw${EXTRA_SUFFIX}" - TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^tw'$EXTRA_SUFFIX'//'` + TINFO_SUFFIX=`echo "$TINFO_SUFFIX" | sed 's/^tw'$EXTRA_SUFFIX'//'` ;; (t*) TINFO_NAME="${TINFO_NAME}t${EXTRA_SUFFIX}" - TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^t'$EXTRA_SUFFIX'//'` + TINFO_SUFFIX=`echo "$TINFO_SUFFIX" | sed 's/^t'$EXTRA_SUFFIX'//'` ;; (w*) TINFO_NAME="${TINFO_NAME}w${EXTRA_SUFFIX}" - TINFO_SUFFIX=`echo $TINFO_SUFFIX | sed 's/^w'$EXTRA_SUFFIX'//'` + TINFO_SUFFIX=`echo "$TINFO_SUFFIX" | sed 's/^w'$EXTRA_SUFFIX'//'` ;; esac fi for cf_dir in $SRC_SUBDIRS do - if test ! -d $srcdir/$cf_dir ; then + if test ! -d "$srcdir/$cf_dir" ; then continue - elif test -f $srcdir/$cf_dir/modules; then + elif test -f "$srcdir/$cf_dir/modules" ; then SHARED_LIB= Libs_To_Make= @@ -4093,7 +4304,7 @@ resulting.map: $UNALTERED_SYMS $cf_awk_program \ { if ( last != "" && ( skip == 0 || \[$]\[$]0 !~ /}/ ) ) { print last; }\ skip = 0; last = \[$]\[$]0; } \ -END { print last; }' < $UNALTERED_SYMS >\[$]@ +END { print last; }' < "$UNALTERED_SYMS" >\[$]@ distclean:: rm -f resulting.map @@ -4103,9 +4314,14 @@ CF_EOF for cf_item in $cf_LIST_MODELS do CF_LIB_SUFFIX($cf_item,cf_suffix,cf_depsuf) - cf_libname=$cf_dir - test "$cf_dir" = c++ && cf_libname=ncurses++ - if test $cf_item = shared ; then + if test "$cf_dir" = "c++" + then + CF_MAP_LIB_BASENAME(cf_libname,cxx) + else + CF_MAP_LIB_BASENAME(cf_libname,$cf_dir) + fi + test -z "$cf_libname" && cf_libname="$cf_dir" + if test "$cf_item" = shared ; then if test -n "${LIB_SUFFIX}" then cf_shared_suffix=`echo "$cf_suffix" | sed 's/^'"${USE_LIB_SUFFIX}"'//'` @@ -4146,7 +4362,7 @@ CF_EOF # cygwin needs import library, and has unique naming convention # use autodetected ${cf_prefix} for import lib and static lib, but # use 'cyg' prefix for shared lib. - case $cf_cv_shlib_version in + case "$cf_cv_shlib_version" in (cygdll) cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` cf_add_lib="../lib/cyg${cf_libname}${cf_cygsuf}" @@ -4159,6 +4375,10 @@ CF_EOF cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` cf_add_lib="../lib/lib${cf_libname}${cf_cygsuf}" ;; + (msvcdll) + cf_cygsuf=`echo "$cf_suffix" | sed -e 's/\.dll/\${ABI_VERSION}.dll/'` + cf_add_lib="../lib/${cf_libname}${cf_cygsuf}" + ;; (*) cf_add_lib= ;; @@ -4173,7 +4393,7 @@ CF_EOF Libs_To_Make="$Libs_To_Make $cf_add_lib" done - if test $cf_dir = ncurses ; then + if test "$cf_dir" = ncurses ; then cf_subsets="$LIB_SUBSETS" cf_r_parts="$cf_subsets" cf_liblist="$Libs_To_Make" @@ -4184,12 +4404,12 @@ CF_EOF cf_r_parts=`echo "$cf_r_parts" |sed -e 's/^[[^ ]]* //'` if test "$cf_l_parts" != "$cf_r_parts" ; then cf_add_lib= - case $cf_l_parts in + case "$cf_l_parts" in (*termlib*) - cf_add_lib=`echo $cf_liblist |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g` + cf_add_lib=`echo "$cf_liblist" |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g` ;; (*ticlib*) - cf_add_lib=`echo $cf_liblist |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TICS_LIB_SUFFIX}%g` + cf_add_lib=`echo "$cf_liblist" |sed -e s%${LIB_NAME}${USE_LIB_SUFFIX}%${TICS_LIB_SUFFIX}%g` ;; (*) break @@ -4206,12 +4426,12 @@ CF_EOF cf_subsets=`echo "$LIB_SUBSETS" | sed -e 's/^termlib.* //'` fi - if test $cf_dir = c++; then + if test "$cf_dir" = c++; then if test "x$with_shared_cxx" != xyes && test -n "$cf_shared_suffix"; then cf_list= for cf_item in $Libs_To_Make do - case $cf_item in + case "$cf_item" in (*.a) ;; (*) @@ -4235,12 +4455,12 @@ CF_EOF sed -e "s%@Libs_To_Make@%$Libs_To_Make%" \ -e "s%@SHARED_LIB@%$SHARED_LIB%" \ - $cf_dir/Makefile >$cf_dir/Makefile.out - mv $cf_dir/Makefile.out $cf_dir/Makefile + "$cf_dir/Makefile" >$cf_dir/Makefile.out + mv "$cf_dir/Makefile.out" "$cf_dir/Makefile" - $AWK -f $srcdir/mk-0th.awk \ + $AWK -f "$srcdir/mk-0th.awk" \ libname="${cf_dir}${LIB_SUFFIX}" subsets="$LIB_SUBSETS" ticlib="$TICS_LIB_SUFFIX" termlib="$TINFO_LIB_SUFFIX" \ - $srcdir/$cf_dir/modules >>$cf_dir/Makefile + "$srcdir/$cf_dir/modules" >>$cf_dir/Makefile for cf_subset in $cf_subsets do @@ -4253,8 +4473,8 @@ CF_EOF CXX_MODEL=$cf_ITEM if test "$CXX_MODEL" = SHARED; then - case $cf_cv_shlib_version in - (cygdll|msysdll|mingw) + case "$cf_cv_shlib_version" in + (cygdll|msysdll|mingw|msvcdll) test "x$with_shared_cxx" = xno && CF_VERBOSE(overriding CXX_MODEL to SHARED) with_shared_cxx=yes ;; @@ -4269,8 +4489,8 @@ CF_EOF # Test for case where we build libtinfo with a different name. cf_libname=$cf_dir - if test $cf_dir = ncurses ; then - case $cf_subset in + if test "$cf_dir" = ncurses ; then + case "$cf_subset" in (*base*) cf_libname=${cf_libname}$USE_LIB_SUFFIX ;; @@ -4281,14 +4501,16 @@ CF_EOF cf_libname=$TICS_LIB_SUFFIX ;; esac - elif test $cf_dir = c++ ; then - cf_libname=ncurses++$USE_LIB_SUFFIX + elif test "$cf_dir" = c++ ; then + CF_MAP_LIB_BASENAME(cf_libname,cxx) + cf_libname=${cf_libname}$USE_LIB_SUFFIX else + CF_MAP_LIB_BASENAME(cf_libname,$cf_dir) cf_libname=${cf_libname}$USE_LIB_SUFFIX fi if test -n "${USE_ARG_SUFFIX}" ; then # undo $USE_LIB_SUFFIX add-on in CF_LIB_SUFFIX - cf_suffix=`echo $cf_suffix |sed -e "s%^${USE_LIB_SUFFIX}%%"` + cf_suffix=`echo "$cf_suffix" |sed -e "s%^${USE_LIB_SUFFIX}%%"` fi # These dependencies really are for development, not @@ -4300,9 +4522,9 @@ CF_EOF cf_reldir="\${srcdir}" fi - if test -f $srcdir/$cf_dir/$cf_dir.priv.h; then + if test -f "$srcdir/$cf_dir/$cf_dir.priv.h" ; then cf_depend="$cf_depend $cf_reldir/$cf_dir.priv.h" - elif test -f $srcdir/$cf_dir/curses.priv.h; then + elif test -f "$srcdir/$cf_dir/curses.priv.h" ; then cf_depend="$cf_depend $cf_reldir/curses.priv.h" fi @@ -4310,32 +4532,32 @@ CF_EOF old_cf_suffix="$cf_suffix" if test "$cf_cv_shlib_version_infix" = yes ; then if test -n "$USE_LIB_SUFFIX" ; then - case $USE_LIB_SUFFIX in + case "$USE_LIB_SUFFIX" in (tw*) - cf_libname=`echo $cf_libname | sed 's/tw'$EXTRA_SUFFIX'$//'` - cf_suffix=`echo $cf_suffix | sed 's/^tw'$EXTRA_SUFFIX'//'` + cf_libname=`echo "$cf_libname" | sed 's/tw'$EXTRA_SUFFIX'$//'` + cf_suffix=`echo "$cf_suffix" | sed 's/^tw'$EXTRA_SUFFIX'//'` cf_dir_suffix=tw$EXTRA_SUFFIX ;; (t*) - cf_libname=`echo $cf_libname | sed 's/t'$EXTRA_SUFFIX'$//'` - cf_suffix=`echo $cf_suffix | sed 's/^t'$EXTRA_SUFFIX'//'` + cf_libname=`echo "$cf_libname" | sed 's/t'$EXTRA_SUFFIX'$//'` + cf_suffix=`echo "$cf_suffix" | sed 's/^t'$EXTRA_SUFFIX'//'` cf_dir_suffix=t$EXTRA_SUFFIX ;; (w*) - cf_libname=`echo $cf_libname | sed 's/w'$EXTRA_SUFFIX'$//'` - cf_suffix=`echo $cf_suffix | sed 's/^w'$EXTRA_SUFFIX'//'` + cf_libname=`echo "$cf_libname" | sed 's/w'$EXTRA_SUFFIX'$//'` + cf_suffix=`echo "$cf_suffix" | sed 's/^w'$EXTRA_SUFFIX'//'` cf_dir_suffix=w$EXTRA_SUFFIX ;; (*) - cf_libname=`echo $cf_libname | sed 's/'$EXTRA_SUFFIX'$//'` - cf_suffix=`echo $cf_suffix | sed 's/^'$EXTRA_SUFFIX'//'` + cf_libname=`echo "$cf_libname" | sed 's/'$EXTRA_SUFFIX'$//'` + cf_suffix=`echo "$cf_suffix" | sed 's/^'$EXTRA_SUFFIX'//'` cf_dir_suffix=$EXTRA_SUFFIX ;; esac fi fi - $AWK -f $srcdir/mk-1st.awk \ + $AWK -f "$srcdir/mk-1st.awk" \ name=${cf_libname}${cf_dir_suffix} \ traces=$LIB_TRACING \ MODEL=$cf_ITEM \ @@ -4359,16 +4581,16 @@ CF_EOF depend="$cf_depend" \ host="$host" \ libtool_version="$LIBTOOL_VERSION" \ - $srcdir/$cf_dir/modules >>$cf_dir/Makefile + "$srcdir/$cf_dir/modules" >>$cf_dir/Makefile cf_suffix="$old_cf_suffix" for cf_subdir2 in $cf_subdirs lib do - test $cf_subdir = $cf_subdir2 && break + test "$cf_subdir" = "$cf_subdir2" && break done test "${cf_subset}.${cf_subdir2}" != "${cf_subset}.${cf_subdir}" && \ - $AWK -f $srcdir/mk-2nd.awk \ + $AWK -f "$srcdir/mk-2nd.awk" \ name=$cf_dir \ traces=$LIB_TRACING \ MODEL=$cf_ITEM \ @@ -4378,35 +4600,35 @@ CF_EOF echo=$WITH_ECHO \ crenames=$cf_cv_prog_CC_c_o \ cxxrenames=$cf_cv_prog_CXX_c_o \ - $srcdir/$cf_dir/modules >>$cf_dir/Makefile + "$srcdir/$cf_dir/modules" >>$cf_dir/Makefile cf_subdirs="$cf_subdirs $cf_subdir" done done fi - echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >>Makefile + echo ' ( cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@ )' >>Makefile done for cf_dir in $SRC_SUBDIRS do - if test ! -d $srcdir/$cf_dir ; then + if test ! -d "$srcdir/$cf_dir" ; then continue fi - if test -f $cf_dir/Makefile ; then + if test -f "$cf_dir/Makefile" ; then case "$cf_dir" in (Ada95) echo 'libs \' >> Makefile echo 'install.libs \' >> Makefile echo 'uninstall.libs ::' >> Makefile - echo ' cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@' >> Makefile + echo ' ( cd '$cf_dir' && ${MAKE} ${TOP_MFLAGS} [$]@ )' >> Makefile ;; esac fi - if test -f $srcdir/$cf_dir/modules; then + if test -f "$srcdir/$cf_dir/modules" ; then echo >> Makefile - if test -f $srcdir/$cf_dir/headers; then + if test -f "$srcdir/$cf_dir/headers" ; then cat >> Makefile <> Makefile <> Makefile <> Makefile <> Makefile <> Makefile <>headers.sh </<\$END\/\$NAME>/" >> \$TMPSED @@ -4533,7 +4755,7 @@ else case \$DST in (/*/include/*) END=\`basename \$DST\` - for i in \`cat \$REF/../*/headers |fgrep -v "#"\` + for i in \`cat \$REF/../*/headers |${FGREP-fgrep} -v "#"\` do NAME=\`basename \$i\` if test "\$NAME" = "curses.h" @@ -4555,7 +4777,7 @@ rm -f \$TMPSRC sed -f \$TMPSED \$SRC > \$TMPSRC NAME=\`basename \$SRC\` CF_EOF -if test $WITH_CURSES_H != yes; then +if test "$WITH_CURSES_H" != yes; then cat >>headers.sh <>$cf_dir/Makefile + "$srcdir/$cf_dir/headers" >>$cf_dir/Makefile fi - if test -f $srcdir/$cf_dir/modules; then + if test -f "$srcdir/$cf_dir/modules" ; then if test "$cf_dir" != "c++" ; then cat >>$cf_dir/Makefile <<"CF_EOF" depend : ${AUTO_SRC} @@ -4597,7 +4819,7 @@ done AC_SUBST(Libs_To_Make) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIB_SONAME version: 6 updated: 2017/01/21 11:06:25 +dnl CF_LIB_SONAME version: 9 updated: 2021/01/04 18:48:01 dnl ------------- dnl Find the and soname for the given shared library. Set the cache variable dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache @@ -4607,7 +4829,8 @@ dnl $1 = headers dnl $2 = code dnl $3 = library name AC_DEFUN([CF_LIB_SONAME], -[ +[AC_REQUIRE([AC_PROG_FGREP])dnl + AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[ cf_cv_$3_soname=unknown @@ -4624,17 +4847,17 @@ cf_save_LIBS="$LIBS" CF_ADD_LIB($3) if AC_TRY_EVAL(ac_compile) ; then if AC_TRY_EVAL(ac_link) ; then - cf_cv_$3_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.` + cf_cv_$3_soname="`ldd \"conftest$ac_exeext\" 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | ${FGREP-fgrep} lib$3.`" test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown fi fi -rm -rf conftest* +rm -rf ./conftest* LIBS="$cf_save_LIBS" fi ]) ]) dnl --------------------------------------------------------------------------- -dnl CF_LIB_SUFFIX version: 25 updated: 2015/04/17 21:13:04 +dnl CF_LIB_SUFFIX version: 28 updated: 2021/01/01 16:53:59 dnl ------------- dnl Compute the library file-suffix from the given model name dnl $1 = model name @@ -4649,19 +4872,37 @@ AC_DEFUN([CF_LIB_SUFFIX], $3=[$]$2 ;; (Xdebug) - $2='_g.a' + case "$cf_cv_system_name" in + (*-msvc*) + $2='_g.lib' + ;; + (*) + $2='_g.a' + ;; + esac $3=[$]$2 ;; (Xprofile) - $2='_p.a' + case "$cf_cv_system_name" in + (*-msvc*) + $2='_p.lib' + ;; + (*) + $2='_p.a' + ;; + esac $3=[$]$2 ;; (Xshared) - case $cf_cv_system_name in + case "$cf_cv_system_name" in (aix[[5-7]]*) $2='.so' $3=[$]$2 ;; + (*-msvc*) + $2='.dll' + $3='.dll.lib' + ;; (cygwin*|msys*|mingw*) $2='.dll' $3='.dll.a' @@ -4671,7 +4912,7 @@ AC_DEFUN([CF_LIB_SUFFIX], $3=[$]$2 ;; (hpux*) - case $target in + case "$target" in (ia64*) $2='.so' $3=[$]$2 @@ -4689,7 +4930,14 @@ AC_DEFUN([CF_LIB_SUFFIX], esac ;; (*) - $2='.a' + case "$target" in + (*-msvc*) + $2='.lib' + ;; + (*) + $2='.a' + ;; + esac $3=[$]$2 ;; esac @@ -4842,14 +5090,15 @@ int main(void) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MAKEFLAGS version: 18 updated: 2018/02/21 21:26:03 +dnl CF_MAKEFLAGS version: 20 updated: 2021/01/03 19:29:49 dnl ------------ dnl Some 'make' programs support ${MAKEFLAGS}, some ${MFLAGS}, to pass 'make' dnl options to lower-levels. It's very useful for "make -n" -- if we have it. dnl (GNU 'make' does both, something POSIX 'make', which happens to make the dnl ${MAKEFLAGS} variable incompatible because it adds the assignments :-) AC_DEFUN([CF_MAKEFLAGS], -[ +[AC_REQUIRE([AC_PROG_FGREP])dnl + AC_CACHE_CHECK(for makeflags variable, cf_cv_makeflags,[ cf_cv_makeflags='' for cf_option in '-${MAKEFLAGS}' '${MFLAGS}' @@ -4859,10 +5108,10 @@ SHELL = $SHELL all : @ echo '.$cf_option' CF_EOF - cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | fgrep -v "ing directory" | sed -e 's,[[ ]]*$,,'` + cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp 2>/dev/null | ${FGREP-fgrep} -v "ing directory" | sed -e 's,[[ ]]*$,,'` case "$cf_result" in (.*k|.*kw) - cf_result=`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null` + cf_result="`${MAKE:-make} -k -f cf_makeflags.tmp CC=cc 2>/dev/null`" case "$cf_result" in (.*CC=*) cf_cv_makeflags= ;; @@ -4921,7 +5170,7 @@ AC_SUBST(MAKE_UPPER_TAGS) AC_SUBST(MAKE_LOWER_TAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MANPAGE_FORMAT version: 11 updated: 2015/04/18 08:56:57 +dnl CF_MANPAGE_FORMAT version: 14 updated: 2021/01/02 17:09:14 dnl ----------------- dnl Option to allow user to override automatic configuration of manpage format. dnl There are several special cases: @@ -4951,7 +5200,7 @@ MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'` cf_unknown= -case $MANPAGE_FORMAT in +case "$MANPAGE_FORMAT" in (unknown) if test -z "$MANPATH" ; then MANPATH="/usr/man:/usr/share/man" @@ -4959,16 +5208,16 @@ case $MANPAGE_FORMAT in # look for the 'date' man-page (it's most likely to be installed!) MANPAGE_FORMAT= - cf_preform=no - cf_catonly=yes - cf_example=date + cf_preform="no" + cf_catonly="yes" + cf_example="date" IFS="${IFS:- }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" for cf_dir in $MANPATH; do test -z "$cf_dir" && cf_dir=/usr/man for cf_name in $cf_dir/man*/$cf_example.[[01]]* $cf_dir/cat*/$cf_example.[[01]]* $cf_dir/man*/$cf_example $cf_dir/cat*/$cf_example do - cf_test=`echo $cf_name | sed -e 's/*//'` + cf_test=`echo "$cf_name" | sed -e 's/*//'` if test "x$cf_test" = "x$cf_name" ; then case "$cf_name" in @@ -4999,7 +5248,7 @@ case $MANPAGE_FORMAT in cf_found=yes ;; esac - test $cf_found=yes && break + test "$cf_found" = yes && break fi done # only check the first directory in $MANPATH where we find manpages @@ -5013,7 +5262,7 @@ case $MANPAGE_FORMAT in ;; (*) for cf_option in $MANPAGE_FORMAT; do - case $cf_option in + case "$cf_option" in (gzip|compress|BSDI|normal|formatted|catonly) ;; (*) @@ -5030,7 +5279,7 @@ if test -n "$cf_unknown" ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MANPAGE_RENAMES version: 10 updated: 2015/08/05 20:44:28 +dnl CF_MANPAGE_RENAMES version: 12 updated: 2021/01/01 16:53:59 dnl ------------------ dnl The Debian people have their own naming convention for manpages. This dnl option lets us override the name of the file containing renaming, or @@ -5050,7 +5299,7 @@ case ".$MANPAGE_RENAMES" in (.|.yes) # Debian 'man' program? if test -f /etc/debian_version ; then - MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames + MANPAGE_RENAMES=`cd "$srcdir" && pwd`/man/man_db.renames else MANPAGE_RENAMES=no fi @@ -5058,9 +5307,9 @@ case ".$MANPAGE_RENAMES" in esac if test "$MANPAGE_RENAMES" != no ; then - if test -f $srcdir/man/$MANPAGE_RENAMES ; then - MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES - elif test ! -f $MANPAGE_RENAMES ; then + if test -f "$srcdir/man/$MANPAGE_RENAMES" ; then + MANPAGE_RENAMES=`cd "$srcdir/man" && pwd`/$MANPAGE_RENAMES + elif test ! -f "$MANPAGE_RENAMES" ; then AC_MSG_ERROR(not a filename: $MANPAGE_RENAMES) fi @@ -5069,7 +5318,7 @@ if test "$MANPAGE_RENAMES" != no ; then # Construct a sed-script to perform renaming within man-pages if test -n "$MANPAGE_RENAMES" ; then test ! -d man && mkdir man - $SHELL $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed + $SHELL "$srcdir/man/make_sed.sh" "$MANPAGE_RENAMES" >./edit_man.sed fi fi @@ -5139,7 +5388,7 @@ AC_ARG_WITH(manpage-tbl, AC_MSG_RESULT($MANPAGE_TBL) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MAN_PAGES version: 47 updated: 2017/08/12 07:58:51 +dnl CF_MAN_PAGES version: 51 updated: 2021/01/05 16:29:19 dnl ------------ dnl Try to determine if the man-pages on the system are compressed, and if dnl so, what format is used. Use this information to construct a script that @@ -5230,7 +5479,7 @@ shift || exit 1 if test "\$form" = normal ; then if test "$cf_format" = yes ; then if test "$cf_inboth" = no ; then - $SHELL \[$]0 format \$verb \$mandir \$srcdir \[$]* + $SHELL "\[$]0" format "\$verb" "\$mandir" "\$srcdir" "\[$]@" exit $? fi fi @@ -5242,19 +5491,19 @@ else fi # process the list of source-files -for i in \[$]* ; do +for i in "\[$]@" ; do case \$i in (*.orig|*.rej) ;; (*.[[0-9]]*) section=\`expr "\$i" : '.*\\.\\([[0-9]]\\)[[xm]]*'\`; - if test \$verb = installing ; then - if test ! -d \$cf_subdir\${section} ; then - mkdir -p \$cf_subdir\$section + if test "\$verb" = installing ; then + if test ! -d "\$cf_subdir\${section}" ; then + mkdir -p "\$cf_subdir\$section" fi fi # replace variables in man page - if test ! -f $cf_man_alias ; then + if test ! -f "$cf_man_alias" ; then cat >>$cf_man_alias <<-CF_EOF2 s,@DATADIR@,\$datadir,g s,@TERMINFO@,\${TERMINFO:="no default value"},g @@ -5268,7 +5517,7 @@ CF_EOF for cf_name in $1 do cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` - cf_name=`echo $cf_name|sed "$program_transform_name"` + cf_name=`echo "$cf_name" | sed "$program_transform_name"` cat >>$cf_edit_man <<-CF_EOF s,@$cf_NAME@,$cf_name,g CF_EOF @@ -5280,11 +5529,11 @@ CF_EOF2 fi aliases= - cf_source=\`basename \$i\` + cf_source=\`basename "\$i"\` inalias=\$cf_source - test ! -f \$inalias && inalias="\$srcdir/\$inalias" - if test ! -f \$inalias ; then - echo .. skipped \$cf_source + test ! -f "\$inalias" && inalias="\$srcdir/\$inalias" + if test ! -f "\$inalias" ; then + echo ".. skipped \$cf_source" continue fi CF_EOF @@ -5292,8 +5541,8 @@ CF_EOF if test "$MANPAGE_ALIASES" != no ; then cat >>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <\$TMP + < "\$i" | sed -f `pwd`/edit_man.sed >\$TMP CF_EOF else cat >>$cf_edit_man <\$TMP + < "\$i" >\$TMP CF_EOF fi @@ -5339,22 +5588,22 @@ if test \$cf_tables = yes ; then fi CF_EOF -if test $with_overwrite != yes ; then +if test "$with_overwrite" != yes ; then cat >>$cf_edit_man <\$TMP.out + sed -e "/\\#[ ]*include/s,\$TMP.out mv \$TMP.out \$TMP CF_EOF fi -if test $with_curses_h != yes ; then +if test "$with_curses_h" != yes ; then cat >>$cf_edit_man <\$TMP.out + sed -e "/\\#[ ]*include/s,curses.h,ncurses.h," < \$TMP >\$TMP.out mv \$TMP.out \$TMP CF_EOF fi cat >>$cf_edit_man <\$TMP.out mv \$TMP.out \$TMP fi @@ -5362,8 +5611,8 @@ CF_EOF if test -n "$cf_compress" ; then cat >>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man < #include ], - [double x = rand(); printf("result = %g\n", ]ifelse([$2],,sin(x),$2)[)], + [double x = rand(); printf("result = %g\\n", ]ifelse([$2],,sin(x),$2)[)], [cf_cv_need_libm=no], [cf_cv_need_libm=yes])]) if test "$cf_cv_need_libm" = yes @@ -5506,7 +5766,7 @@ ifelse($1,,[ fi ]) dnl --------------------------------------------------------------------------- -dnl CF_MIXEDCASE_FILENAMES version: 7 updated: 2015/04/12 15:39:00 +dnl CF_MIXEDCASE_FILENAMES version: 9 updated: 2021/01/01 16:53:59 dnl ---------------------- dnl Check if the file-system supports mixed-case filenames. If we're able to dnl create a lowercase name and see it as uppercase, it doesn't support that. @@ -5514,8 +5774,8 @@ AC_DEFUN([CF_MIXEDCASE_FILENAMES], [ AC_CACHE_CHECK(if filesystem supports mixed-case filenames,cf_cv_mixedcase,[ if test "$cross_compiling" = yes ; then - case $target_alias in - (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*) + case "$target_alias" in + (*-os2-emx*|*-msdosdjgpp*|*-cygwin*|*-msys*|*-mingw*|*-uwin*|darwin*) cf_cv_mixedcase=no ;; (*) @@ -5536,7 +5796,7 @@ fi test "$cf_cv_mixedcase" = yes && AC_DEFINE(MIXEDCASE_FILENAMES,1,[Define to 1 if filesystem supports mixed-case filenames.]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MKSTEMP version: 10 updated: 2017/01/21 11:12:16 +dnl CF_MKSTEMP version: 11 updated: 2021/01/01 13:31:04 dnl ---------- dnl Check for a working mkstemp. This creates two files, checks that they are dnl successfully created and distinct (AmigaOS apparently fails on the last). @@ -5545,7 +5805,7 @@ AC_CHECK_HEADERS( \ unistd.h \ ) AC_CACHE_CHECK(for working mkstemp, cf_cv_func_mkstemp,[ -rm -rf conftest* +rm -rf ./conftest* AC_TRY_RUN([ #include #ifdef HAVE_UNISTD_H @@ -5602,13 +5862,13 @@ AC_DEFUN([CF_MSG_LOG],[ echo "${as_me:-configure}:__oline__: testing $* ..." 1>&AC_FD_CC ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_ABI_6 version: 3 updated: 2015/06/06 16:10:11 +dnl CF_NCURSES_ABI_6 version: 4 updated: 2021/01/01 13:31:04 dnl ---------------- dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and dnl warn about this. AC_DEFUN([CF_NCURSES_ABI_6],[ if test "${with_abi_version+set}" != set; then - case $cf_cv_rel_version in + case "$cf_cv_rel_version" in (5.*) cf_cv_rel_version=6.0 cf_cv_abi_version=6 @@ -5618,7 +5878,7 @@ if test "${with_abi_version+set}" != set; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_WITH_ABI_VERSION version: 2 updated: 2015/12/19 17:51:52 +dnl CF_NCURSES_WITH_ABI_VERSION version: 3 updated: 2021/01/01 13:31:04 dnl --------------------------- dnl Allow ncurses's ABI to be overridden. Generally this happens when a dnl packager has incremented the ABI past that used in the original package, @@ -5630,7 +5890,7 @@ AC_DEFUN([CF_NCURSES_WITH_ABI_VERSION],[ CF_WITH_ABI_VERSION($1) if test "x$cf_cv_abi_version" != "x$with_abi_version" then - case $cf_cv_rel_version in + case "$cf_cv_rel_version" in (5.*) cf_cv_rel_version=$with_abi_version.0 ;; @@ -5638,7 +5898,7 @@ then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NO_LEAKS_OPTION version: 6 updated: 2015/04/12 15:39:00 +dnl CF_NO_LEAKS_OPTION version: 8 updated: 2021/01/05 20:05:09 dnl ------------------ dnl see CF_WITH_NO_LEAKS AC_DEFUN([CF_NO_LEAKS_OPTION],[ @@ -5648,13 +5908,13 @@ AC_ARG_WITH($1, [AC_DEFINE_UNQUOTED($3,1,"Define to 1 if you want to use $1 for testing.")ifelse([$4],,[ $4 ]) - : ${with_cflags:=-g} - : ${with_no_leaks:=yes} + : "${with_cflags:=-g}" + : "${enable_leaks:=no}" with_$1=yes], [with_$1=]) AC_MSG_RESULT(${with_$1:-no}) -case .$with_cflags in +case ".$with_cflags" in (.*-g*) case .$CFLAGS in (.*-g*) @@ -5686,7 +5946,7 @@ else fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_OBJ_SUBDIR version: 7 updated: 2015/04/17 21:13:04 +dnl CF_OBJ_SUBDIR version: 8 updated: 2021/01/01 13:31:04 dnl ------------- dnl Compute the object-directory name from the given model name AC_DEFUN([CF_OBJ_SUBDIR], @@ -5697,7 +5957,7 @@ AC_DEFUN([CF_OBJ_SUBDIR], (debug) $2='obj_g' ;; (profile) $2='obj_p' ;; (shared) - case $cf_cv_system_name in + case "$cf_cv_system_name" in (cygwin|msys) $2='objects' ;; (*) @@ -5706,14 +5966,14 @@ AC_DEFUN([CF_OBJ_SUBDIR], esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PATHSEP version: 7 updated: 2015/04/12 15:39:00 +dnl CF_PATHSEP version: 8 updated: 2021/01/01 13:31:04 dnl ---------- dnl Provide a value for the $PATH and similar separator (or amend the value dnl as provided in autoconf 2.5x). AC_DEFUN([CF_PATHSEP], [ AC_MSG_CHECKING(for PATH separator) - case $cf_cv_system_name in + case "$cf_cv_system_name" in (os2*) PATH_SEPARATOR=';' ;; (*) ${PATH_SEPARATOR:=':'} ;; esac @@ -5722,7 +5982,7 @@ ifelse([$1],,,[$1=$PATH_SEPARATOR]) AC_MSG_RESULT($PATH_SEPARATOR) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PATH_PROG version: 10 updated: 2019/06/30 19:44:43 +dnl CF_PATH_PROG version: 12 updated: 2021/01/02 09:31:20 dnl ------------ dnl Check for a given program, defining corresponding symbol. dnl $1 = environment variable, which is suffixed by "_PATH" in the #define. @@ -5737,7 +5997,7 @@ dnl FIXME: we should allow this to be overridden by environment variables dnl AC_DEFUN([CF_PATH_PROG],[ AC_REQUIRE([CF_PATHSEP]) -test -z "[$]$1" && $1=$2 +test -z "[$]$1" && $1="$2" AC_PATH_PROGS($1,[$]$1 $2 ifelse($3,,,$3),[$]$1, ifelse($4,,,$4)) cf_path_prog="" @@ -5750,7 +6010,7 @@ do CF_PATH_SYNTAX(cf_temp,break) cf_path_prog="$cf_temp" else - cf_path_prog="`basename $cf_temp`" + cf_path_prog="`basename "$cf_temp"`" fi elif test -z "$cf_path_args" ; then cf_path_args="$cf_temp" @@ -5767,7 +6027,7 @@ if test -n "$cf_path_prog" ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PATH_SYNTAX version: 16 updated: 2015/04/18 08:56:57 +dnl CF_PATH_SYNTAX version: 18 updated: 2020/12/31 18:40:20 dnl -------------- dnl Check the argument to see that it looks like a pathname. Rewrite it if it dnl begins with one of the prefix/exec_prefix variables, and then again if the @@ -5787,16 +6047,16 @@ case ".[$]$1" in ;; (.[[a-zA-Z]]:[[\\/]]*) # OS/2 EMX ;; -(.\[$]{*prefix}*|.\[$]{*dir}*) +(.\[$]\{*prefix\}*|.\[$]\{*dir\}*) eval $1="[$]$1" case ".[$]$1" in (.NONE/*) - $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` + $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` ;; esac ;; (.no|.NONE/*) - $1=`echo [$]$1 | sed -e s%NONE%$cf_path_syntax%` + $1=`echo "[$]$1" | sed -e s%NONE%$cf_path_syntax%` ;; (*) ifelse([$2],,[AC_MSG_ERROR([expected a pathname, not \"[$]$1\"])],$2) @@ -5804,7 +6064,7 @@ case ".[$]$1" in esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PKG_CONFIG version: 10 updated: 2015/04/26 18:06:58 +dnl CF_PKG_CONFIG version: 11 updated: 2021/01/01 13:31:04 dnl ------------- dnl Check for the package-config program, unless disabled by command-line. AC_DEFUN([CF_PKG_CONFIG], @@ -5816,7 +6076,7 @@ AC_ARG_WITH(pkg-config, [cf_pkg_config=yes]) AC_MSG_RESULT($cf_pkg_config) -case $cf_pkg_config in +case "$cf_pkg_config" in (no) PKG_CONFIG=none ;; @@ -5979,7 +6239,7 @@ make an error fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PRG_RULES version: 1 updated: 2006/06/03 11:45:08 +dnl CF_PRG_RULES version: 2 updated: 2021/01/01 13:31:04 dnl ------------ dnl Append definitions and rules for the given programs to the subdirectory dnl Makefiles, and the recursion rule for the top-level Makefile. @@ -5994,10 +6254,10 @@ AC_DEFUN([CF_PRG_RULES], [ for cf_dir in $2 do - if test ! -d $srcdir/$cf_dir; then + if test ! -d "$srcdir/$cf_dir" ; then continue - elif test -f $srcdir/$cf_dir/programs; then - $AWK -f $1 $srcdir/$cf_dir/programs >>$cf_dir/Makefile + elif test -f "$srcdir/$cf_dir/programs" ; then + $AWK -f $1 "$srcdir/$cf_dir/programs" >>$cf_dir/Makefile fi done @@ -6036,7 +6296,7 @@ CF_ACVERSION_CHECK(2.52, CF_CC_ENV_FLAGS ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_CC_C_O version: 5 updated: 2017/01/21 11:06:25 +dnl CF_PROG_CC_C_O version: 6 updated: 2021/01/01 13:31:04 dnl -------------- dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that dnl the output file can be renamed, and allows for a shell variable that can @@ -6068,31 +6328,16 @@ then else eval cf_cv_prog_$1_c_o=no fi -rm -rf conftest* +rm -rf ./conftest* ])dnl -if test $cf_cv_prog_$1_c_o = yes; then +if test "$cf_cv_prog_$1_c_o" = yes; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_EGREP version: 2 updated: 2015/04/18 08:56:57 -dnl ------------- -dnl AC_PROG_EGREP was introduced in autoconf 2.53. -dnl This macro adds a check to ensure the script found something. -AC_DEFUN([CF_PROG_EGREP], -[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], - [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi]) - EGREP=$ac_cv_prog_egrep - AC_SUBST([EGREP]) - test -z "$EGREP" && AC_MSG_ERROR(No egrep program found) -])dnl -dnl --------------------------------------------------------------------------- -dnl CF_PROG_GNAT version: 10 updated: 2019/12/31 08:53:54 +dnl CF_PROG_GNAT version: 12 updated: 2021/01/02 17:09:14 dnl ------------ dnl Check for gnat/gnatmake/etc, ensure that the toolset is complete. AC_DEFUN([CF_PROG_GNAT],[ @@ -6103,14 +6348,14 @@ do unset ac_cv_path_cf_TEMP_gnat unset cf_TEMP_gnat AC_PATH_PROG(cf_TEMP_gnat,$cf_prog_gnat,no) - eval cf_cv_PATH_$cf_upper_prog_gnat=[$]ac_cv_path_cf_TEMP_gnat + eval "cf_cv_PATH_$cf_upper_prog_gnat=[$]ac_cv_path_cf_TEMP_gnat" if test "x$cf_TEMP_gnat" != xno; then unset cf_cv_gnat_version unset cf_TEMP_gnat CF_GNAT_VERSION(cf_TEMP_gnat,$cf_prog_gnat) fi - eval cf_cv_VERSION_$cf_upper_prog_gnat=[$]cf_TEMP_gnat + eval "cf_cv_VERSION_$cf_upper_prog_gnat=[$]cf_TEMP_gnat" unset cf_TEMP_gnat unset cf_cv_gnat_version @@ -6126,7 +6371,7 @@ else # gprconfig is newer than gnatmake; we can continue... cf_ada_config="##" else - rm -rf conftest* *~conftest* + rm -rf ./conftest* ./*~conftest* if mkdir conftest.src then cf_ada_config="" @@ -6134,12 +6379,12 @@ else for cf_gprconfig in Ada C do AC_MSG_CHECKING(for gprconfig name for $cf_gprconfig) - if test $cf_gprconfig = C + if test "$cf_gprconfig" = C then for cf_gprconfig_param in \ - $cf_gprconfig,,,,GNATGCC \ - $cf_gprconfig,,,,GCC \ - $cf_gprconfig + "$cf_gprconfig,,,,GNATGCC" \ + "$cf_gprconfig,,,,GCC" \ + "$cf_gprconfig" do cf_gprconfig_value=`echo s| gprconfig --config=$cf_gprconfig_param 2>&AC_FD_CC | ${AWK:-awk} '/^\*/{print [$]3;}' | head -n 1` test -n "$cf_gprconfig_value" && break @@ -6150,7 +6395,7 @@ else fi if test -n "$cf_gprconfig_value" then - eval cf_ada_config_[$]cf_gprconfig=[$]cf_gprconfig_value + eval "cf_ada_config_[$]cf_gprconfig=[$]cf_gprconfig_value" AC_MSG_RESULT($cf_gprconfig_value) else AC_MSG_RESULT(missing) @@ -6159,7 +6404,7 @@ else fi done cd .. - rm -rf conftest* *~conftest* + rm -rf ./conftest* ./*~conftest* fi fi if test "x$cf_ada_config" != "x#" @@ -6197,7 +6442,7 @@ AC_SUBST(cf_ada_config_Ada) AC_SUBST(cf_ada_config_C) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PROG_INSTALL version: 7 updated: 2015/04/18 08:56:57 +dnl CF_PROG_INSTALL version: 10 updated: 2021/01/04 19:33:05 dnl --------------- dnl Force $INSTALL to be an absolute-path. Otherwise, edit_man.sh and the dnl misc/tabset install won't work properly. Usually this happens only when @@ -6210,7 +6455,7 @@ case $INSTALL in (*) CF_DIRNAME(cf_dir,$INSTALL) test -z "$cf_dir" && cf_dir=. - INSTALL=`cd $cf_dir && pwd`/`echo $INSTALL | sed -e 's%^.*/%%'` + INSTALL="`cd \"$cf_dir\" && pwd`"/"`echo "$INSTALL" | sed -e 's%^.*/%%'`" ;; esac ])dnl @@ -6270,7 +6515,7 @@ AC_MSG_RESULT($cf_prog_ln_sf) test "$cf_prog_ln_sf" = yes && LN_S="$LN_S -f" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_REGEX version: 12 updated: 2015/04/18 08:56:57 +dnl CF_REGEX version: 18 updated: 2021/01/01 16:53:59 dnl -------- dnl Attempt to determine if we've got one of the flavors of regular-expression dnl code that we can support. @@ -6278,24 +6523,36 @@ AC_DEFUN([CF_REGEX], [ cf_regex_func=no - -cf_regex_libs="regex re" -case $host_os in +cf_regex_libs= +case "$host_os" in (mingw*) - cf_regex_libs="gnurx $cf_regex_libs" + # -lsystre -ltre -lintl -liconv + AC_CHECK_LIB(systre,regcomp,[ + AC_CHECK_LIB(iconv,libiconv_open,[CF_ADD_LIB(iconv)]) + AC_CHECK_LIB(intl,libintl_gettext,[CF_ADD_LIB(intl)]) + AC_CHECK_LIB(tre,tre_regcomp,[CF_ADD_LIB(tre)]) + CF_ADD_LIB(systre) + cf_regex_func=regcomp + ],[ + AC_CHECK_LIB(gnurx,regcomp,[ + CF_ADD_LIB(gnurx) + cf_regex_func=regcomp]) + ]) + ;; +(*) + cf_regex_libs="regex re" + AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ + for cf_regex_lib in $cf_regex_libs + do + AC_CHECK_LIB($cf_regex_lib,regcomp,[ + CF_ADD_LIB($cf_regex_lib) + cf_regex_func=regcomp + break]) + done + ]) ;; esac -AC_CHECK_FUNC(regcomp,[cf_regex_func=regcomp],[ - for cf_regex_lib in $cf_regex_libs - do - AC_CHECK_LIB($cf_regex_lib,regcomp,[ - CF_ADD_LIB($cf_regex_lib) - cf_regex_func=regcomp - break]) - done -]) - if test "$cf_regex_func" = no ; then AC_CHECK_FUNC(compile,[cf_regex_func=compile],[ AC_CHECK_LIB(gen,compile,[ @@ -6310,13 +6567,15 @@ fi AC_CACHE_CHECK(for regular-expression headers,cf_cv_regex_hdrs,[ cf_cv_regex_hdrs=no -case $cf_regex_func in +case "$cf_regex_func" in (compile) for cf_regex_hdr in regexp.h regexpr.h do AC_TRY_LINK([#include <$cf_regex_hdr>],[ char *p = compile("", "", "", 0); int x = step("", ""); + (void)p; + (void)x; ],[ cf_cv_regex_hdrs=$cf_regex_hdr break @@ -6328,9 +6587,11 @@ case $cf_regex_func in do AC_TRY_LINK([#include #include <$cf_regex_hdr>],[ - regex_t *p; + regex_t *p = 0; int x = regcomp(p, "", 0); int y = regexec(p, "", 0, 0, 0); + (void)x; + (void)y; regfree(p); ],[ cf_cv_regex_hdrs=$cf_regex_hdr @@ -6342,7 +6603,7 @@ esac ]) -case $cf_cv_regex_hdrs in +case "$cf_cv_regex_hdrs" in (no) AC_MSG_WARN(no regular expression header found) ;; (regex.h) AC_DEFINE(HAVE_REGEX_H_FUNCS,1,[Define to 1 to include regex.h for regular expressions]) ;; (regexp.h) AC_DEFINE(HAVE_REGEXP_H_FUNCS,1,[Define to 1 to include regexp.h for regular expressions]) ;; @@ -6391,11 +6652,12 @@ CFLAGS="$cf_save_CFLAGS_$1" CPPFLAGS="$cf_save_CPPFLAGS_$1" ])dnl dnl --------------------------------------------------------------------------- -dnl CF_RPATH_HACK version: 11 updated: 2013/09/01 13:02:00 +dnl CF_RPATH_HACK version: 13 updated: 2021/01/03 18:30:50 dnl ------------- AC_DEFUN([CF_RPATH_HACK], -[ -AC_REQUIRE([CF_LD_RPATH_OPT]) +[AC_REQUIRE([AC_PROG_FGREP])dnl +AC_REQUIRE([CF_LD_RPATH_OPT])dnl + AC_MSG_CHECKING(for updated LDFLAGS) if test -n "$LD_RPATH_OPT" ; then AC_MSG_RESULT(maybe) @@ -6408,8 +6670,8 @@ if test -n "$LD_RPATH_OPT" ; then AC_TRY_LINK([#include ], [printf("Hello");], - [cf_rpath_oops=`$cf_ldd_prog conftest$ac_exeext | fgrep ' not found' | sed -e 's% =>.*$%%' |sort | uniq` - cf_rpath_list=`$cf_ldd_prog conftest$ac_exeext | fgrep / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) + [cf_rpath_oops=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} ' not found' | sed -e 's% =>.*$%%' |sort | uniq` + cf_rpath_list=`"$cf_ldd_prog" "conftest$ac_exeext" | ${FGREP-fgrep} / | sed -e 's%^.*[[ ]]/%/%' -e 's%/[[^/]][[^/]]*$%%' |sort | uniq`]) # If we passed the link-test, but get a "not found" on a given library, # this could be due to inept reconfiguration of gcc to make it only @@ -6425,7 +6687,7 @@ AC_TRY_LINK([#include ], /usr/pkg \ /opt/sfw do - if test -f $cf_rpath_dir/lib/$cf_rpath_src + if test -f "$cf_rpath_dir/lib/$cf_rpath_src" then CF_VERBOSE(...adding -L$cf_rpath_dir/lib to LDFLAGS for $cf_rpath_src) LDFLAGS="$LDFLAGS -L$cf_rpath_dir/lib" @@ -6448,7 +6710,7 @@ fi AC_SUBST(EXTRA_LDFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_RPATH_HACK_2 version: 7 updated: 2015/04/12 15:39:00 +dnl CF_RPATH_HACK_2 version: 8 updated: 2021/01/01 13:31:04 dnl --------------- dnl Do one set of substitutions for CF_RPATH_HACK, adding an rpath option to dnl EXTRA_LDFLAGS for each -L option found. @@ -6464,7 +6726,7 @@ CF_VERBOSE(...checking $1 [$]$1) cf_rpath_dst= for cf_rpath_src in [$]$1 do - case $cf_rpath_src in + case "$cf_rpath_src" in (-L*) # check if this refers to a directory which we will ignore @@ -6533,7 +6795,7 @@ do done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 93 updated: 2018/08/18 16:36:35 +dnl CF_SHARED_OPTS version: 105 updated: 2021/01/02 17:09:14 dnl -------------- dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared @@ -6583,7 +6845,7 @@ AC_DEFUN([CF_SHARED_OPTS], AC_ARG_WITH(shlib-version, [ --with-shlib-version=X Specify rel or abi version for shared libs], [test -z "$withval" && withval=auto - case $withval in + case "$withval" in (yes) cf_cv_shlib_version=auto ;; @@ -6609,7 +6871,7 @@ AC_DEFUN([CF_SHARED_OPTS], then cf_try_fPIC=yes else - case $cf_cv_system_name in + case "$cf_cv_system_name" in (*linux*) # e.g., PGI compiler cf_try_fPIC=yes ;; @@ -6631,7 +6893,7 @@ AC_DEFUN([CF_SHARED_OPTS], cf_cv_shlib_version_infix=no - case $cf_cv_system_name in + case "$cf_cv_system_name" in (aix4.[3-9]*|aix[[5-7]]*) if test "$GCC" = yes; then CC_SHARED_OPTS='-Wl,-brtl' @@ -6700,7 +6962,7 @@ CF_EOF LDFLAGS="$LDFLAGS -Wl,-search_paths_first" AC_TRY_LINK(, [int i;], cf_cv_ldflags_search_paths_first=yes, cf_cv_ldflags_search_paths_first=no) LDFLAGS=$cf_save_LDFLAGS]) - if test $cf_cv_ldflags_search_paths_first = yes; then + if test "$cf_cv_ldflags_search_paths_first" = yes; then LDFLAGS="$LDFLAGS -Wl,-search_paths_first" fi ;; @@ -6759,6 +7021,112 @@ CF_EOF CF_SHARED_SONAME MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' ;; + (mingw*msvc*) + cf_cv_shlib_version=msvcdll + cf_cv_shlib_version_infix=msvcdll + shlibdir=$bindir + MAKE_DLLS= + if test "$DFT_LWR_MODEL" = "shared" ; then + LOCAL_LDFLAGS="-link -dll" + LOCAL_LDFLAGS2="$LOCAL_LDFLAGS" + EXTRA_LDFLAGS="-link -dll $EXTRA_LDFLAGS" + fi + CC_SHARED_OPTS= + MK_SHARED_LIB=$SHELL' '$rel_builddir'/mk_shared_lib.sh [$]@ ${LD} [$]{CFLAGS}' + RM_SHARED_OPTS="$RM_SHARED_OPTS $rel_builddir/mk_shared_lib.sh *.dll.lib" + cat >mk_shared_lib.sh <<-CF_EOF + #!$SHELL + SHARED_LIB=\[$]1 + IMPORT_LIB=\`echo "\[$]1" | sed -e 's/[[0-9]]*\.dll[$]/.dll.lib/'\` + shift + my_ld=\[$]1 + shift + cat <<-EOF + Linking shared library + ** SHARED LIB \$SHARED_LIB + ** IMPORT_LIB \$IMPORT_LIB +EOF + args=\$(echo \[$]* | sed -E "s#-l(\w*)#\1.dll.lib#g" | sed -E "s#-L(\w*)#-LIBPATH:\1#g") + exec \$my_ld -DLL -IMPLIB:"\${IMPORT_LIB}" -OUT:"\${SHARED_LIB}" ${LDFLAGS} \$args + mv "\${IMPORT_LIB}" "\${IMPORT_LIB}" +CF_EOF + chmod +x mk_shared_lib.sh + cat >mk_prog.sh <<-CF_EOF + #!$SHELL + shift + # Ignore first argument (compiler) and use LD (link.exe) unconditionally + LD="[$]LD" + clopts=() + ldopts=("/subsystem:console") + libs=() + isdll=0 + while test \[$]# -gt 0; do + case "\[$]1" in + -link) + # ignore -link argument + ;; + -M[[TD]] | -M[[TD]]d) + # ignore runtime-library option + ;; + -dll) + isdll=1 + ;; + -W* | -w*) + # ignore warnings + ;; + -D*) + clopts+=("\[$]1") + ;; + -I*) + clopts+=("\[$]1") + ;; + -l*) + libs+=("\`echo \"\[$]1\" | sed \"s/^-l//\"\`") + ;; + -L*) + ldopts+=("\`echo \"\[$]1\" | sed \"s/^-L/-LIBPATH:/\"\`") + ;; + *.obj | *.o) + ldopts+=("\[$]1") + ;; + -Wl,*) + for linkarg in \`echo '\[$]1' | sed -e 's/-Wl,//' -e 's/,/ /'\`; do + ldopts+=("\[$]{linkarg}") + done + ;; + *.lib) + ldopts+=("\[$]1") + ;; + -o) + shift + ldopts+=("-out:\[$]1") + ;; + *) + clopts+=("\[$]1") + ldopts+=("\[$]1") + ;; + esac + shift + done + if [[ "\$isdll" -ne 0 ]]; then + for lib in \[$]{libs[[*]]}; do + ldopts+=("\[$]lib.dll.lib") + done + else + for lib in \[$]{libs[[*]]}; do + ldopts+=("\[$]lib.lib") + done + fi + cat <<-EOF + Creating program + ** ld options: "\[$]{ldopts[[@]]}" +EOF + exec \[$]LD \[$]{ldopts[[@]]} +CF_EOF + chmod +x mk_prog.sh + LINK_PROGS="$SHELL ${rel_builddir}/mk_prog.sh" + LINK_TESTS="$SHELL ${rel_builddir}/mk_prog.sh" + ;; (mingw*) cf_cv_shlib_version=mingw cf_cv_shlib_version_infix=mingw @@ -6798,6 +7166,14 @@ CF_EOF CF_SHARED_SONAME MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-Bshareable,-soname,'$cf_cv_shared_soname',-stats,-lc -o $[@]' ;; + (nskJ*) + CC_SHARED_OPTS= + MK_SHARED_LIB='${LD} -Wshared -Weld=-export_all -o $[@]' + ;; + (nskL*) + CC_SHARED_OPTS= + MK_SHARED_LIB='${LD} -Wshared -Wxld=-export_all -o $[@]' + ;; (nto-qnx*|openbsd*|freebsd[[12]].*) CC_SHARED_OPTS="$CC_SHARED_OPTS -DPIC" MK_SHARED_LIB='${LD} ${LDFLAGS} -Bshareable -o $[@]' @@ -6829,7 +7205,7 @@ CF_EOF CF_SHARED_SONAME MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -Wl,-soname,'$cf_cv_shared_soname' -o $[@]' else - MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -Wl,-shared -Wl,-Bshareable -o $[@]' + MK_SHARED_LIB='${CC} ${LDFLAGS} ${CFLAGS} -shared -o $[@]' fi ;; (osf*|mls+*) @@ -6837,7 +7213,7 @@ CF_EOF # tested with OSF/1 V3.2 and gcc 2.6.3 (but the c++ demo didn't # link with shared libs). MK_SHARED_LIB='${LD} ${LDFLAGS} -set_version ${REL_VERSION}:${ABI_VERSION} -expect_unresolved "*" -shared -soname `basename $[@]`' - case $host_os in + case "$host_os" in (osf4*) MK_SHARED_LIB="${MK_SHARED_LIB} -msym" ;; @@ -6887,7 +7263,7 @@ CF_EOF for cf_shared_opts in -xcode=pic32 -xcode=pic13 -KPIC -Kpic -O do CFLAGS="$cf_shared_opts $cf_save_CFLAGS" - AC_TRY_COMPILE([#include ],[printf("Hello\n");],[break]) + AC_TRY_COMPILE([#include ],[printf("Hello\\n");],[break]) done CFLAGS="$cf_save_CFLAGS" CC_SHARED_OPTS=$cf_shared_opts @@ -6930,7 +7306,7 @@ cat > conftest.$ac_ext < int main(int argc, char *argv[[]]) { - printf("hello\n"); + printf("hello\\n"); return (argv[[argc-1]] == 0) ; } EOF @@ -6954,7 +7330,7 @@ EOF test -n "$cf_ld_rpath_opt" && MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\${RPATH_LIST}" test -z "$RPATH_LIST" && RPATH_LIST="\${libdir}" - test $cf_cv_rm_so_locs = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations" + test "$cf_cv_rm_so_locs" = yes && RM_SHARED_OPTS="$RM_SHARED_OPTS so_locations" CF_VERBOSE(CC_SHARED_OPTS: $CC_SHARED_OPTS) CF_VERBOSE(MK_SHARED_LIB: $MK_SHARED_LIB) @@ -6994,7 +7370,7 @@ define([CF_SHARED_SONAME], fi ]) dnl --------------------------------------------------------------------------- -dnl CF_SIGWINCH version: 2 updated: 2019/03/23 19:54:44 +dnl CF_SIGWINCH version: 6 updated: 2021/01/01 13:31:04 dnl ----------- dnl Use this macro after CF_XOPEN_SOURCE, but do not require it (not all dnl programs need this test). @@ -7009,7 +7385,7 @@ AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ AC_TRY_COMPILE([ #include #include -],[int x = SIGWINCH], +],[int x = SIGWINCH; (void)x], [cf_cv_define_sigwinch=yes], [AC_TRY_COMPILE([ #undef _XOPEN_SOURCE @@ -7017,7 +7393,7 @@ AC_CACHE_CHECK(if SIGWINCH is defined,cf_cv_define_sigwinch,[ #undef _POSIX_C_SOURCE #include #include -],[int x = SIGWINCH], +],[int x = SIGWINCH; (void)x], [cf_cv_define_sigwinch=maybe], [cf_cv_define_sigwinch=no]) ]) @@ -7027,7 +7403,7 @@ if test "$cf_cv_define_sigwinch" = maybe ; then AC_CACHE_CHECK(for actual SIGWINCH definition,cf_cv_fixup_sigwinch,[ cf_cv_fixup_sigwinch=unknown cf_sigwinch=32 -while test $cf_sigwinch != 1 +while test "$cf_sigwinch" != 1 do AC_TRY_COMPILE([ #undef _XOPEN_SOURCE @@ -7039,11 +7415,11 @@ do #if SIGWINCH != $cf_sigwinch make an error #endif -int x = SIGWINCH], +int x = SIGWINCH; (void)x], [cf_cv_fixup_sigwinch=$cf_sigwinch break]) -cf_sigwinch=`expr $cf_sigwinch - 1` +cf_sigwinch="`expr "$cf_sigwinch" - 1`" done ]) @@ -7053,7 +7429,7 @@ done fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SIG_ATOMIC_T version: 4 updated: 2020/01/18 12:30:44 +dnl CF_SIG_ATOMIC_T version: 5 updated: 2020/03/10 18:53:47 dnl --------------- dnl signal handler, but there are some gcc dependencies in that recommendation. dnl Try anyway. @@ -7075,6 +7451,7 @@ extern $cf_type x; $cf_type x; static void handler(int sig) { + (void)sig; x = 5; }], [signal(SIGINT, handler); @@ -7088,7 +7465,7 @@ AC_MSG_RESULT($cf_cv_sig_atomic_t) test "$cf_cv_sig_atomic_t" != no && AC_DEFINE_UNQUOTED(SIG_ATOMIC_T, $cf_cv_sig_atomic_t,[Define to signal global datatype]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SIZECHANGE version: 14 updated: 2018/06/20 20:23:13 +dnl CF_SIZECHANGE version: 17 updated: 2021/01/01 13:31:04 dnl ------------- dnl Check for definitions & structures needed for window size-changing dnl @@ -7131,13 +7508,17 @@ do ],[ #ifdef TIOCGSIZE struct ttysize win; /* SunOS 3.0... */ - int y = win.ts_lines; - int x = win.ts_cols; + int y = win.ts_lines = 2; + int x = win.ts_cols = 1; + (void)y; + (void)x; #else #ifdef TIOCGWINSZ struct winsize win; /* everything else */ - int y = win.ws_row; - int x = win.ws_col; + int y = win.ws_row = 2; + int x = win.ws_col = 1; + (void)y; + (void)x; #else no TIOCGSIZE or TIOCGWINSZ #endif /* TIOCGWINSZ */ @@ -7156,7 +7537,7 @@ done ]) if test "$cf_cv_sizechange" != no ; then AC_DEFINE(HAVE_SIZECHANGE,1,[Define to 1 if sizechange declarations are provided]) - case $cf_cv_sizechange in + case "$cf_cv_sizechange" in (NEED*) AC_DEFINE_UNQUOTED($cf_cv_sizechange ) ;; @@ -7164,7 +7545,7 @@ if test "$cf_cv_sizechange" != no ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SRC_MODULES version: 31 updated: 2019/09/21 18:08:42 +dnl CF_SRC_MODULES version: 33 updated: 2021/01/01 13:31:04 dnl -------------- dnl For each parameter, test if the source-directory exists, and if it contains dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll @@ -7192,11 +7573,11 @@ PC_MODULES_TO_MAKE="ncurses${USE_ARG_SUFFIX}" cf_cv_src_modules= for cf_dir in $1 do - if test -f $srcdir/$cf_dir/modules; then + if test -f "$srcdir/$cf_dir/modules" ; then # We may/may not have tack in the distribution, though the # makefile is. - if test $cf_dir = tack ; then + if test "$cf_dir" = tack ; then if test "x$cf_with_tack" != "xyes"; then continue fi @@ -7212,20 +7593,21 @@ do # well. These are header files that are the same name as their # directory. Ncurses is the only library that does not follow # that pattern. - if test $cf_dir = tack ; then + if test "$cf_dir" = tack ; then continue - elif test -f $srcdir/${cf_dir}/${cf_dir}.h; then + elif test -f "$srcdir/${cf_dir}/${cf_dir}.h" ; then CF_UPPER(cf_have_include,$cf_dir) AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H) AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include}) - TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" - TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2" + CF_MAP_LIB_BASENAME(TEST_ROOT,$cf_dir) + TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TEST_ROOT}${DFT_DEP_SUFFIX} $TEST_DEPS" + TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${TEST_ROOT}${DFT_DEP_SUFFIX} $TEST_DEP2" if test "$DFT_LWR_MODEL" = "libtool"; then TEST_ARGS="${TEST_DEPS}" TEST_ARG2="${TEST_DEP2}" else - TEST_ARGS="-l${cf_dir}${USE_ARG_SUFFIX} $TEST_ARGS" - TEST_ARG2="-l${cf_dir}${USE_ARG_SUFFIX} $TEST_ARG2" + TEST_ARGS="-l${TEST_ROOT}${USE_ARG_SUFFIX} $TEST_ARGS" + TEST_ARG2="-l${TEST_ROOT}${USE_ARG_SUFFIX} $TEST_ARG2" fi PC_MODULES_TO_MAKE="${PC_MODULES_TO_MAKE} ${cf_dir}${USE_ARG_SUFFIX}" fi @@ -7267,7 +7649,7 @@ test "x$with_ticlib" != xno && PC_MODULES_TO_MAKE="$PC_MODULES_TO_MAKE $TICS_ARG AC_SUBST(PC_MODULES_TO_MAKE) ADA_SUBDIRS= -if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f $srcdir/Ada95/Makefile.in; then +if test "x$cf_with_ada" = "xyes" && test "x$cf_cv_prog_gnat_correct" = xyes && test -f "$srcdir/Ada95/Makefile.in" ; then SRC_SUBDIRS="$SRC_SUBDIRS Ada95" ADA_SUBDIRS="gen src" if test "x$cf_with_tests" != "xno" ; then @@ -7290,7 +7672,7 @@ if test -n "$ADA_SUBDIRS"; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_STDCPP_LIBRARY version: 11 updated: 2015/10/17 19:03:33 +dnl CF_STDCPP_LIBRARY version: 12 updated: 2021/01/01 13:31:04 dnl ----------------- dnl Check for -lstdc++, which is GNU's standard C++ library. dnl If $CXXLIBS is set, add that to the libraries used for test-linking. @@ -7311,9 +7693,9 @@ if test -n "$GXX" ; then AC_MSG_RESULT($cf_have_libstdcpp) LIBS="$cf_save" - if test $cf_have_libstdcpp != yes + if test "$cf_have_libstdcpp" != yes then - case $cf_cv_system_name in + case "$cf_cv_system_name" in (os2*) if test -z "`g++ -dM -E - < /dev/null | grep __KLIBC__`"; then cf_stdcpp_libname=stdcpp @@ -7342,11 +7724,11 @@ if test -n "$GXX" ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_STRIP_G_OPT version: 3 updated: 2002/12/21 19:25:52 +dnl CF_STRIP_G_OPT version: 4 updated: 2021/01/02 09:31:20 dnl -------------- dnl Remove "-g" option from the compiler options AC_DEFUN([CF_STRIP_G_OPT], -[$1=`echo ${$1} | sed -e 's%-g %%' -e 's%-g$%%'`])dnl +[$1=`echo "${$1}" | CF__SED_TRIMBLANKS(-e 's%-g %%' -e 's%-g$%%')`])dnl dnl --------------------------------------------------------------------------- dnl CF_STRUCT_SIGACTION version: 5 updated: 2012/10/06 17:56:13 dnl ------------------- @@ -7375,7 +7757,7 @@ AC_MSG_RESULT($sigact_bad) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_STRUCT_TERMIOS version: 9 updated: 2018/06/08 21:57:23 +dnl CF_STRUCT_TERMIOS version: 11 updated: 2020/03/19 20:46:13 dnl ----------------- dnl Some machines require _POSIX_SOURCE to completely define struct termios. AC_DEFUN([CF_STRUCT_TERMIOS],[ @@ -7398,12 +7780,12 @@ if test "$ac_cv_header_termios_h" = yes ; then if test "$termios_bad" = maybe ; then AC_MSG_CHECKING(whether termios.h needs _POSIX_SOURCE) AC_TRY_COMPILE([#include ], - [struct termios foo; int x = foo.c_iflag], + [struct termios foo; int x = foo.c_iflag = 1; (void)x], termios_bad=no, [ AC_TRY_COMPILE([ #define _POSIX_SOURCE #include ], - [struct termios foo; int x = foo.c_iflag], + [struct termios foo; int x = foo.c_iflag = 2; (void)x], termios_bad=unknown, termios_bad=yes AC_DEFINE(_POSIX_SOURCE,1,[Define to 1 if we must define _POSIX_SOURCE])) ]) @@ -7455,15 +7837,15 @@ fi AC_SUBST($2) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SUBST_NCURSES_VERSION version: 8 updated: 2006/09/16 11:40:59 +dnl CF_SUBST_NCURSES_VERSION version: 10 updated: 2021/01/04 18:48:01 dnl ------------------------ dnl Get the version-number for use in shared-library naming, etc. AC_DEFUN([CF_SUBST_NCURSES_VERSION], -[ -AC_REQUIRE([CF_PROG_EGREP]) -NCURSES_MAJOR="`$ac_cv_prog_egrep '^NCURSES_MAJOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" -NCURSES_MINOR="`$ac_cv_prog_egrep '^NCURSES_MINOR[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" -NCURSES_PATCH="`$ac_cv_prog_egrep '^NCURSES_PATCH[[ ]]*=' $srcdir/dist.mk | sed -e 's/^[[^0-9]]*//'`" +[AC_REQUIRE([AC_PROG_EGREP])dnl + +NCURSES_MAJOR="`${EGREP-egrep} '^NCURSES_MAJOR[[ ]]*=' "$srcdir/dist.mk" | sed -e 's/^[[^0-9]]*//'`" +NCURSES_MINOR="`${EGREP-egrep} '^NCURSES_MINOR[[ ]]*=' "$srcdir/dist.mk" | sed -e 's/^[[^0-9]]*//'`" +NCURSES_PATCH="`${EGREP-egrep} '^NCURSES_PATCH[[ ]]*=' "$srcdir/dist.mk" | sed -e 's/^[[^0-9]]*//'`" cf_cv_abi_version=${NCURSES_MAJOR} cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} dnl Show the computed version, for logging @@ -7513,21 +7895,21 @@ top_builddir=ifelse($1,,`pwd`,$1) AC_SUBST(top_builddir) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_TRY_PKG_CONFIG version: 5 updated: 2013/07/06 21:27:06 +dnl CF_TRY_PKG_CONFIG version: 6 updated: 2020/12/31 10:54:15 dnl ----------------- dnl This is a simple wrapper to use for pkg-config, for libraries which may be dnl available in that form. dnl -dnl $1 = package name +dnl $1 = package name, which may be a shell variable dnl $2 = extra logic to use, if any, after updating CFLAGS and LIBS dnl $3 = logic to use if pkg-config does not have the package AC_DEFUN([CF_TRY_PKG_CONFIG],[ AC_REQUIRE([CF_PKG_CONFIG]) -if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists $1; then +if test "$PKG_CONFIG" != none && "$PKG_CONFIG" --exists "$1"; then CF_VERBOSE(found package $1) - cf_pkgconfig_incs="`$PKG_CONFIG --cflags $1 2>/dev/null`" - cf_pkgconfig_libs="`$PKG_CONFIG --libs $1 2>/dev/null`" + cf_pkgconfig_incs="`$PKG_CONFIG --cflags "$1" 2>/dev/null`" + cf_pkgconfig_libs="`$PKG_CONFIG --libs "$1" 2>/dev/null`" CF_VERBOSE(package $1 CFLAGS: $cf_pkgconfig_incs) CF_VERBOSE(package $1 LIBS: $cf_pkgconfig_libs) CF_ADD_CFLAGS($cf_pkgconfig_incs) @@ -7790,7 +8172,7 @@ AC_DEFUN([CF_VERBOSE], CF_MSG_LOG([$1]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_VERSION_INFO version: 7 updated: 2015/04/17 21:13:04 +dnl CF_VERSION_INFO version: 8 updated: 2021/01/01 13:31:04 dnl --------------- dnl Define several useful symbols derived from the VERSION file. A separate dnl file is preferred to embedding the version numbers in various scripts. @@ -7818,13 +8200,13 @@ dnl $1 = internal name for package dnl $2 = external name for package AC_DEFUN([CF_VERSION_INFO], [ -if test -f $srcdir/VERSION ; then +if test -f "$srcdir/VERSION" ; then AC_MSG_CHECKING(for package version) # if there are not enough fields, cut returns the last one... - cf_field1=`sed -e '2,$d' $srcdir/VERSION|cut -f1` - cf_field2=`sed -e '2,$d' $srcdir/VERSION|cut -f2` - cf_field3=`sed -e '2,$d' $srcdir/VERSION|cut -f3` + cf_field1=`sed -e '2,$d' "$srcdir/VERSION" |cut -f1` + cf_field2=`sed -e '2,$d' "$srcdir/VERSION" |cut -f2` + cf_field3=`sed -e '2,$d' "$srcdir/VERSION" |cut -f3` # this is how CF_BUNDLED_INTL uses $VERSION: VERSION="$cf_field1" @@ -7954,7 +8336,7 @@ weak_symbol(fopen); ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_ABI_VERSION version: 3 updated: 2015/06/06 16:10:11 +dnl CF_WITH_ABI_VERSION version: 4 updated: 2021/01/01 13:31:04 dnl ------------------- dnl Allow library's ABI to be overridden. Generally this happens when a dnl packager has incremented the ABI past that used in the original package, @@ -7969,7 +8351,7 @@ AC_ARG_WITH(abi-version, if test "x$cf_cv_abi_version" != "x$withval" then AC_MSG_WARN(overriding ABI version $cf_cv_abi_version to $withval) - case $cf_cv_rel_version in + case "$cf_cv_rel_version" in (5.*) cf_cv_rel_version=$withval.0 ;; @@ -8179,7 +8561,7 @@ if test "$with_gpm" != no ; then fi ]) dnl --------------------------------------------------------------------------- -dnl CF_WITH_LIBTOOL version: 35 updated: 2017/08/12 07:58:51 +dnl CF_WITH_LIBTOOL version: 36 updated: 2021/01/01 13:31:04 dnl --------------- dnl Provide a configure option to incorporate libtool. Define several useful dnl symbols for the makefile rules. @@ -8284,7 +8666,7 @@ ifdef([AC_PROG_LIBTOOL],[ AC_SUBST([LT_UNDEF]) # special hack to add --tag option for C++ compiler - case $cf_cv_libtool_version in + case "$cf_cv_libtool_version" in (1.[[5-9]]*|[[2-9]].[[0-9.a-z]]*) LIBTOOL_CXX="$LIBTOOL --tag=CXX" LIBTOOL="$LIBTOOL --tag=CC" @@ -8343,7 +8725,36 @@ esac AC_SUBST(LIBTOOL_OPTS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_LIB_PREFIX version: 1 updated: 2012/01/21 19:28:10 +dnl CF_WITH_LIB_BASENAME version: 1 updated: 2020/03/07 20:05:14 +dnl -------------------- +dnl Allow for overriding the basename of a library, i.e., the part to which +dnl prefixes/suffixes are attached. +dnl +dnl $1 = variable to set +dnl $2 = option name +dnl $3 = default basename for library, if omitted use $2 +AC_DEFUN([CF_WITH_LIB_BASENAME], +[ +AC_MSG_CHECKING(for desired basename for $2 library) +AC_ARG_WITH($2-libname, + [ --with-$2-libname=XXX override ifelse($3,,$2,$3) basename of library], + [with_lib_basename=$withval], + [with_lib_basename=ifelse($3,,$2,$3)]) +$1="$with_lib_basename" + +case "x[$]$1" in +(x|xno|xnone|xyes) + $1=ifelse($3,,$2,$3) + ;; +(*) + ;; +esac + +AC_MSG_RESULT([$]$1) +AC_SUBST($1) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_WITH_LIB_PREFIX version: 2 updated: 2021/01/01 16:53:59 dnl ------------------ dnl Allow the library-prefix to be overridden. OS/2 EMX originally had no dnl "lib" prefix, e.g., because it used the dll naming convention. @@ -8358,10 +8769,10 @@ AC_ARG_WITH(lib-prefix, [with_lib_prefix=auto]) AC_MSG_RESULT($with_lib_prefix) -if test $with_lib_prefix = auto +if test "$with_lib_prefix" = auto then CF_LIB_PREFIX($1) -elif test $with_lib_prefix = no +elif test "$with_lib_prefix" = no then LIB_PREFIX= else @@ -8390,7 +8801,7 @@ eval $3="$withval" AC_SUBST($3)dnl ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_PATHLIST version: 10 updated: 2015/04/17 21:13:04 +dnl CF_WITH_PATHLIST version: 12 updated: 2021/01/01 13:31:04 dnl ---------------- dnl Process an option specifying a list of colon-separated paths. dnl @@ -8419,9 +8830,9 @@ IFS="$ac_save_ifs" ifelse($6,define,[ # Strip single quotes from the value, e.g., when it was supplied as a literal # for $4 or $5. -case $cf_dst_path in +case "$cf_dst_path" in (\'*) - cf_dst_path=`echo $cf_dst_path |sed -e s/\'// -e s/\'\$//` + cf_dst_path="`echo "$cf_dst_path" |sed -e s/\'// -e s/\'\$//`" ;; esac cf_dst_path=`echo "$cf_dst_path" | sed -e 's/\\\\/\\\\\\\\/g'` @@ -8468,7 +8879,7 @@ AC_ARG_WITH($2-path, ]) ]) dnl --------------------------------------------------------------------------- -dnl CF_WITH_PCRE2 version: 2 updated: 2018/07/14 16:47:56 +dnl CF_WITH_PCRE2 version: 5 updated: 2021/01/26 18:45:12 dnl ------------- dnl Add PCRE2 (Perl-compatible regular expressions v2) to the build if it is dnl available and the user requests it. Assume the application will otherwise @@ -8486,14 +8897,17 @@ test -z "$with_pcre2" && with_pcre2=no AC_MSG_RESULT($with_pcre2) if test "x$with_pcre2" != xno ; then - CF_TRY_PKG_CONFIG(libpcre2,,[ - CF_TRY_PKG_CONFIG(libpcre,,[ - AC_MSG_ERROR(Cannot find PCRE2 library)])]) + cf_with_pcre2_ok=no + for cf_with_pcre2 in libpcre2 libpcre2-posix libpcre + do + CF_TRY_PKG_CONFIG($cf_with_pcre2,[cf_with_pcre2_ok=yes; break]) + done + cf_with_pcre2_ok=yes || AC_MSG_ERROR(Cannot find PCRE2 library) AC_DEFINE(HAVE_LIB_PCRE2,1,[Define to 1 if we can/should compile with the PCRE2 library]) # if pkgconfig gave no results, look for the libraries directly - case $LIBS in + case "$LIBS" in (*pcre2-posix*|*pcreposix*) ;; (*) @@ -8506,16 +8920,16 @@ if test "x$with_pcre2" != xno ; then esac # either way, check for the library header files - AC_CHECK_HEADERS(pcre2-posix.h pcreposix.h) + AC_CHECK_HEADERS(pcre2posix.h pcreposix.h) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_PKG_CONFIG_LIBDIR version: 10 updated: 2015/08/22 17:10:56 +dnl CF_WITH_PKG_CONFIG_LIBDIR version: 11 updated: 2021/01/01 16:16:30 dnl ------------------------- dnl Allow the choice of the pkg-config library directory to be overridden. AC_DEFUN([CF_WITH_PKG_CONFIG_LIBDIR],[ -case $PKG_CONFIG in +case "$PKG_CONFIG" in (no|none|yes) AC_MSG_CHECKING(for pkg-config library directory) ;; @@ -8572,7 +8986,7 @@ case x$PKG_CONFIG_LIBDIR in for cf_config in $cf_search_path do CF_VERBOSE(checking $cf_config/pkgconfig) - if test -d $cf_config/pkgconfig + if test -d "$cf_config/pkgconfig" then PKG_CONFIG_LIBDIR=$cf_config/pkgconfig AC_MSG_CHECKING(done) @@ -8716,7 +9130,7 @@ CF_NO_LEAKS_OPTION(valgrind, [USE_VALGRIND]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_VERSIONED_SYMS version: 8 updated: 2018/10/20 20:24:34 +dnl CF_WITH_VERSIONED_SYMS version: 10 updated: 2021/01/04 18:48:01 dnl ---------------------- dnl Use this when building shared library with ELF, to markup symbols with the dnl version identifier from the given input file. Generally that identifier is @@ -8724,7 +9138,9 @@ dnl the same as the SONAME at which the symbol was first introduced. dnl dnl $1 = basename of the ".map" file (default $PACKAGE) AC_DEFUN([CF_WITH_VERSIONED_SYMS], -[ +[AC_REQUIRE([AC_PROG_FGREP])dnl +AC_REQUIRE([AC_PROG_EGREP])dnl + AC_MSG_CHECKING(if versioned-symbols file should be used) AC_ARG_WITH(versioned-syms, [ --with-versioned-syms=X markup versioned symbols using ld], @@ -8841,7 +9257,7 @@ EOF if make -f conftest.mk 2>&AC_FD_CC >/dev/null then # test for missing symbol in either Data or Text section - cf_missing=`nm -P conftest.so 2>&AC_FD_CC |fgrep _ismissing | egrep '[[ ]][[DT]][[ ]]'` + cf_missing="`nm -P conftest.so 2>&AC_FD_CC |${FGREP-fgrep} _ismissing | ${EGREP-egrep} '[[ ]][[DT]][[ ]]'`" test -n "$cf_missing" && WILDCARD_SYMS=yes fi AC_MSG_RESULT($WILDCARD_SYMS) @@ -8939,7 +9355,7 @@ fi AC_SUBST(no_x11_rgb) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 55 updated: 2018/12/31 20:46:17 +dnl CF_XOPEN_SOURCE version: 57 updated: 2021/01/01 16:53:59 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality, @@ -8958,7 +9374,7 @@ cf_XOPEN_SOURCE=ifelse([$1],,500,[$1]) cf_POSIX_C_SOURCE=ifelse([$2],,199506L,[$2]) cf_xopen_source= -case $host_os in +case "$host_os" in (aix[[4-7]]*) cf_xopen_source="-D_ALL_SOURCE" ;; @@ -9051,7 +9467,7 @@ make an error [cf_XOPEN_SOURCE_set=yes], [cf_XOPEN_SOURCE_set=no]) AC_MSG_RESULT($cf_XOPEN_SOURCE_set) - if test $cf_XOPEN_SOURCE_set = yes + if test "$cf_XOPEN_SOURCE_set" = yes then AC_TRY_COMPILE([#include ],[ #if (_XOPEN_SOURCE - 0) < $cf_XOPEN_SOURCE @@ -9059,7 +9475,7 @@ make an error #endif], [cf_XOPEN_SOURCE_set_ok=yes], [cf_XOPEN_SOURCE_set_ok=no]) - if test $cf_XOPEN_SOURCE_set_ok = no + if test "$cf_XOPEN_SOURCE_set_ok" = no then AC_MSG_WARN(_XOPEN_SOURCE is lower than requested) fi @@ -9069,3 +9485,9 @@ make an error fi fi # cf_cv_posix_visible ]) +dnl --------------------------------------------------------------------------- +dnl CF__SED_TRIMBLANKS version: 1 updated: 2021/01/02 09:31:20 +dnl ------------------ +dnl Trim something using sed, then trim extra whitespace +dnl $1 = extra parameters, e.g., in CF_STRIP_G_OPT +define([CF__SED_TRIMBLANKS],[sed ifelse($1,,,[$1] )-e 's%[[ ]]% %g' -e 's% [[ ]]*% %g' -e 's%^ %%' -e 's% [$]%%'])dnl diff --git a/contrib/ncurses/announce.html.in b/contrib/ncurses/announce.html.in index 2ac7d7d73363..84b9d4297de5 100644 --- a/contrib/ncurses/announce.html.in +++ b/contrib/ncurses/announce.html.in @@ -1,5 +1,5 @@ bottom_panel %s", USER_PTR(pan->user))); + dBug(("--> bottom_panel %s", USER_PTR(pan->user, 1))); HIDE_PANEL(pan, err, OK); assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); diff --git a/contrib/ncurses/panel/p_delete.c b/contrib/ncurses/panel/p_delete.c index 6b122a6c9b92..da3dcdf97a98 100644 --- a/contrib/ncurses/panel/p_delete.c +++ b/contrib/ncurses/panel/p_delete.c @@ -38,22 +38,21 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_delete.c,v 1.11 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_delete.c,v 1.17 2020/12/26 18:25:34 tom Exp $") -NCURSES_EXPORT(int) -del_panel(PANEL * pan) +PANEL_EXPORT(int) +del_panel(PANEL *pan) { int err = OK; T((T_CALLED("del_panel(%p)"), (void *)pan)); if (pan) { - dBug(("--> del_panel %s", USER_PTR(pan->user))); - { - GetHook(pan); - HIDE_PANEL(pan, err, OK); - free((void *)pan); - } + GetHook(pan); + HIDE_PANEL(pan, err, OK); + dBug(("...discard ptr=%s", USER_PTR(pan->user, 1))); + dBug(("...deleted pan=%p", (void *)pan)); + free((void *)pan); } else err = ERR; diff --git a/contrib/ncurses/panel/p_hidden.c b/contrib/ncurses/panel/p_hidden.c index ddb23b13412a..43057fa5999d 100644 --- a/contrib/ncurses/panel/p_hidden.c +++ b/contrib/ncurses/panel/p_hidden.c @@ -38,9 +38,9 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hidden.c,v 1.10 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_hidden.c,v 1.11 2020/05/24 01:40:20 anonymous.maarten Exp $") -NCURSES_EXPORT(int) +PANEL_EXPORT(int) panel_hidden(const PANEL * pan) { int rc = ERR; diff --git a/contrib/ncurses/panel/p_hide.c b/contrib/ncurses/panel/p_hide.c index fc26f752fe14..6a372ace4bcf 100644 --- a/contrib/ncurses/panel/p_hide.c +++ b/contrib/ncurses/panel/p_hide.c @@ -37,9 +37,9 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hide.c,v 1.12 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_hide.c,v 1.14 2020/09/26 18:02:35 tom Exp $") -NCURSES_EXPORT(int) +PANEL_EXPORT(int) hide_panel(register PANEL * pan) { int err = ERR; @@ -50,7 +50,7 @@ hide_panel(register PANEL * pan) { GetHook(pan); - dBug(("--> hide_panel %s", USER_PTR(pan->user))); + dBug(("--> hide_panel %s", USER_PTR(pan->user, 1))); dStack("", 1, pan); HIDE_PANEL(pan, err, ERR); diff --git a/contrib/ncurses/panel/p_move.c b/contrib/ncurses/panel/p_move.c index 02830bf5a413..7ff6fa7e8179 100644 --- a/contrib/ncurses/panel/p_move.c +++ b/contrib/ncurses/panel/p_move.c @@ -38,9 +38,9 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_move.c,v 1.12 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_move.c,v 1.13 2020/05/24 01:40:20 anonymous.maarten Exp $") -NCURSES_EXPORT(int) +PANEL_EXPORT(int) move_panel(PANEL * pan, int starty, int startx) { int rc = ERR; diff --git a/contrib/ncurses/panel/p_new.c b/contrib/ncurses/panel/p_new.c index d2f8d03692b3..a7c5a4e2db21 100644 --- a/contrib/ncurses/panel/p_new.c +++ b/contrib/ncurses/panel/p_new.c @@ -39,11 +39,29 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_new.c,v 1.17 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_new.c,v 1.22 2020/12/26 18:25:48 tom Exp $") #ifdef TRACE static char *stdscr_id; static char *new_id; + +static PANEL * +AllocPanel(const char *name) +{ + PANEL *result = typeMalloc(PANEL, 1); + + _tracef("create :%s %p", name, (void *)result); + return result; +} +#define InitUser(name) \ + if (!name ## _id) \ + name ## _id = strdup(#name); \ + pan->user = name ## _id; \ + _tracef("create :user_ptr %p", pan->user) +#else +#define AllocPanel(name) typeMalloc(PANEL, 1) +#define InitUser(name) \ + pan->user = (void *)0 #endif /*+------------------------------------------------------------------------- @@ -60,39 +78,33 @@ root_panel(NCURSES_SP_DCL0) struct panelhook *ph = _nc_panelhook(); #endif - if (_nc_stdscr_pseudo_panel == (PANEL *) 0) + if (_nc_stdscr_pseudo_panel == (PANEL *)0) { assert(SP_PARM && SP_PARM->_stdscr && !_nc_bottom_panel && !_nc_top_panel); #if NO_LEAKS ph->destroy = del_panel; #endif - _nc_stdscr_pseudo_panel = typeMalloc(PANEL, 1); + _nc_stdscr_pseudo_panel = AllocPanel("root_panel"); if (_nc_stdscr_pseudo_panel != 0) { PANEL *pan = _nc_stdscr_pseudo_panel; WINDOW *win = SP_PARM->_stdscr; pan->win = win; - pan->below = (PANEL *) 0; - pan->above = (PANEL *) 0; -#ifdef TRACE - if (!stdscr_id) - stdscr_id = strdup("stdscr"); - pan->user = stdscr_id; -#else - pan->user = (void *)0; -#endif + pan->below = (PANEL *)0; + pan->above = (PANEL *)0; + InitUser(stdscr); _nc_bottom_panel = _nc_top_panel = pan; } } return _nc_stdscr_pseudo_panel; } -NCURSES_EXPORT(PANEL *) +PANEL_EXPORT(PANEL *) new_panel(WINDOW *win) { - PANEL *pan = (PANEL *) 0; + PANEL *pan = (PANEL *)0; GetWindowHook(win); @@ -105,18 +117,12 @@ new_panel(WINDOW *win) (void)root_panel(NCURSES_SP_ARG); assert(_nc_stdscr_pseudo_panel); - if (!(win->_flags & _ISPAD) && (pan = typeMalloc(PANEL, 1))) + if (!(win->_flags & _ISPAD) && (pan = AllocPanel("new_panel"))) { pan->win = win; - pan->above = (PANEL *) 0; - pan->below = (PANEL *) 0; -#ifdef TRACE - if (!new_id) - new_id = strdup("new"); - pan->user = new_id; -#else - pan->user = (char *)0; -#endif + pan->above = (PANEL *)0; + pan->below = (PANEL *)0; + InitUser(new); (void)show_panel(pan); } returnPanel(pan); diff --git a/contrib/ncurses/panel/p_replace.c b/contrib/ncurses/panel/p_replace.c index 5acbccf8406d..a2d56ae6316b 100644 --- a/contrib/ncurses/panel/p_replace.c +++ b/contrib/ncurses/panel/p_replace.c @@ -37,9 +37,9 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_replace.c,v 1.12 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_replace.c,v 1.13 2020/05/24 01:40:20 anonymous.maarten Exp $") -NCURSES_EXPORT(int) +PANEL_EXPORT(int) replace_panel(PANEL * pan, WINDOW *win) { int rc = ERR; diff --git a/contrib/ncurses/panel/p_show.c b/contrib/ncurses/panel/p_show.c index 933bf5aa2db4..0c973dbeaf66 100644 --- a/contrib/ncurses/panel/p_show.c +++ b/contrib/ncurses/panel/p_show.c @@ -37,9 +37,9 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_show.c,v 1.14 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_show.c,v 1.16 2020/09/26 18:02:35 tom Exp $") -NCURSES_EXPORT(int) +PANEL_EXPORT(int) show_panel(PANEL * pan) { int err = ERR; @@ -53,7 +53,7 @@ show_panel(PANEL * pan) if (Is_Top(pan)) returnCode(OK); - dBug(("--> show_panel %s", USER_PTR(pan->user))); + dBug(("--> show_panel %s", USER_PTR(pan->user, 1))); HIDE_PANEL(pan, err, OK); diff --git a/contrib/ncurses/panel/p_top.c b/contrib/ncurses/panel/p_top.c index 09e89fcc3b54..17abd7680136 100644 --- a/contrib/ncurses/panel/p_top.c +++ b/contrib/ncurses/panel/p_top.c @@ -37,9 +37,9 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_top.c,v 1.7 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_top.c,v 1.8 2020/05/24 01:40:20 anonymous.maarten Exp $") -NCURSES_EXPORT(int) +PANEL_EXPORT(int) top_panel(PANEL * pan) { T((T_CALLED("top_panel(%p)"), (void *)pan)); diff --git a/contrib/ncurses/panel/p_update.c b/contrib/ncurses/panel/p_update.c index 3fe4770b46c9..40212965d3bb 100644 --- a/contrib/ncurses/panel/p_update.c +++ b/contrib/ncurses/panel/p_update.c @@ -38,9 +38,9 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_update.c,v 1.12 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_update.c,v 1.13 2020/05/24 01:40:20 anonymous.maarten Exp $") -NCURSES_EXPORT(void) +PANEL_EXPORT(void) NCURSES_SP_NAME(update_panels) (NCURSES_SP_DCL0) { PANEL *pan; @@ -71,7 +71,7 @@ NCURSES_SP_NAME(update_panels) (NCURSES_SP_DCL0) } #if NCURSES_SP_FUNCS -NCURSES_EXPORT(void) +PANEL_EXPORT(void) update_panels(void) { NCURSES_SP_NAME(update_panels) (CURRENT_SCREEN); diff --git a/contrib/ncurses/panel/p_user.c b/contrib/ncurses/panel/p_user.c index 633431ea204e..9eec8ba11672 100644 --- a/contrib/ncurses/panel/p_user.c +++ b/contrib/ncurses/panel/p_user.c @@ -37,9 +37,9 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_user.c,v 1.9 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_user.c,v 1.10 2020/05/24 01:40:20 anonymous.maarten Exp $") -NCURSES_EXPORT(int) +PANEL_EXPORT(int) set_panel_userptr(PANEL * pan, NCURSES_CONST void *uptr) { T((T_CALLED("set_panel_userptr(%p,%p)"), (void *)pan, (NCURSES_CONST void *)uptr)); @@ -49,7 +49,7 @@ set_panel_userptr(PANEL * pan, NCURSES_CONST void *uptr) returnCode(OK); } -NCURSES_EXPORT(NCURSES_CONST void *) +PANEL_EXPORT(NCURSES_CONST void *) panel_userptr(const PANEL * pan) { T((T_CALLED("panel_userptr(%p)"), (const void *)pan)); diff --git a/contrib/ncurses/panel/p_win.c b/contrib/ncurses/panel/p_win.c index 023a71c93499..d188988577eb 100644 --- a/contrib/ncurses/panel/p_win.c +++ b/contrib/ncurses/panel/p_win.c @@ -37,9 +37,9 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_win.c,v 1.7 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: p_win.c,v 1.8 2020/05/24 01:40:20 anonymous.maarten Exp $") -NCURSES_EXPORT(WINDOW *) +PANEL_EXPORT(WINDOW *) panel_window(const PANEL * pan) { T((T_CALLED("panel_window(%p)"), (const void *)pan)); diff --git a/contrib/ncurses/panel/panel.c b/contrib/ncurses/panel/panel.c index a0e632d27631..1b2d6e8349a0 100644 --- a/contrib/ncurses/panel/panel.c +++ b/contrib/ncurses/panel/panel.c @@ -37,13 +37,13 @@ /* panel.c -- implementation of panels library, some core routines */ #include "panel.priv.h" -MODULE_ID("$Id: panel.c,v 1.27 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: panel.c,v 1.30 2020/09/26 18:05:17 tom Exp $") /*+------------------------------------------------------------------------- _nc_retrace_panel (pan) --------------------------------------------------------------------------*/ #ifdef TRACE -NCURSES_EXPORT(PANEL *) +PANEL_EXPORT(PANEL *) _nc_retrace_panel(PANEL * pan) { T((T_RETURN("%p"), (void *)pan)); @@ -56,16 +56,16 @@ _nc_retrace_panel(PANEL * pan) --------------------------------------------------------------------------*/ #ifdef TRACE #ifndef TRACE_TXT -NCURSES_EXPORT(const char *) -_nc_my_visbuf(const void *ptr) +PANEL_EXPORT(const char *) +_nc_my_visbuf(const void *ptr, int n) { char temp[32]; if (ptr != 0) - _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "ptr:%p", ptr); + _nc_SPRINTF(temp, _nc_SLIMIT(sizeof(temp)) "%p", ptr); else _nc_STRCPY(temp, "", sizeof(temp)); - return _nc_visbuf(temp); + return _nc_visbuf2(n, temp); } #endif #endif @@ -74,13 +74,13 @@ _nc_my_visbuf(const void *ptr) dPanel(text,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -NCURSES_EXPORT(void) +PANEL_EXPORT(void) _nc_dPanel(const char *text, const PANEL * pan) { _tracef("%s id=%s b=%s a=%s y=%d x=%d", - text, USER_PTR(pan->user), - (pan->below) ? USER_PTR(pan->below->user) : "--", - (pan->above) ? USER_PTR(pan->above->user) : "--", + text, USER_PTR(pan->user, 1), + (pan->below) ? USER_PTR(pan->below->user, 2) : "--", + (pan->above) ? USER_PTR(pan->above->user, 3) : "--", PSTARTY(pan), PSTARTX(pan)); } #endif @@ -89,7 +89,7 @@ _nc_dPanel(const char *text, const PANEL * pan) dStack(fmt,num,pan) --------------------------------------------------------------------------*/ #ifdef TRACE -NCURSES_EXPORT(void) +PANEL_EXPORT(void) _nc_dStack(const char *fmt, int num, const PANEL * pan) { char s80[80]; @@ -98,10 +98,10 @@ _nc_dStack(const char *fmt, int num, const PANEL * pan) _nc_SPRINTF(s80, _nc_SLIMIT(sizeof(s80)) fmt, num, pan); _tracef("%s b=%s t=%s", s80, - (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--", - (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--"); + (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user, 1) : "--", + (_nc_top_panel) ? USER_PTR(_nc_top_panel->user, 2) : "--"); if (pan) - _tracef("pan id=%s", USER_PTR(pan->user)); + _tracef("pan id=%s", USER_PTR(pan->user, 1)); pan = _nc_bottom_panel; while (pan) { @@ -115,7 +115,7 @@ _nc_dStack(const char *fmt, int num, const PANEL * pan) Wnoutrefresh(pan) - debugging hook for wnoutrefresh --------------------------------------------------------------------------*/ #ifdef TRACE -NCURSES_EXPORT(void) +PANEL_EXPORT(void) _nc_Wnoutrefresh(const PANEL * pan) { dPanel("wnoutrefresh", pan); @@ -127,7 +127,7 @@ _nc_Wnoutrefresh(const PANEL * pan) Touchpan(pan) --------------------------------------------------------------------------*/ #ifdef TRACE -NCURSES_EXPORT(void) +PANEL_EXPORT(void) _nc_Touchpan(const PANEL * pan) { dPanel("Touchpan", pan); @@ -139,7 +139,7 @@ _nc_Touchpan(const PANEL * pan) Touchline(pan,start,count) --------------------------------------------------------------------------*/ #ifdef TRACE -NCURSES_EXPORT(void) +PANEL_EXPORT(void) _nc_Touchline(const PANEL * pan, int start, int count) { char s80[80]; diff --git a/contrib/ncurses/panel/panel.h b/contrib/ncurses/panel/panel.h index 2eebe178575a..62acc8ff120b 100644 --- a/contrib/ncurses/panel/panel.h +++ b/contrib/ncurses/panel/panel.h @@ -33,7 +33,7 @@ * and: Juergen Pfeifer 1996-1999,2008 * ****************************************************************************/ -/* $Id: panel.h,v 1.13 2020/02/02 23:34:34 tom Exp $ */ +/* $Id: panel.h,v 1.14 2020/07/04 20:38:43 tom Exp $ */ /* panel.h -- interface file for panels library */ @@ -57,27 +57,38 @@ PANEL; extern "C" { #endif -extern NCURSES_EXPORT(WINDOW*) panel_window (const PANEL *); -extern NCURSES_EXPORT(void) update_panels (void); -extern NCURSES_EXPORT(int) hide_panel (PANEL *); -extern NCURSES_EXPORT(int) show_panel (PANEL *); -extern NCURSES_EXPORT(int) del_panel (PANEL *); -extern NCURSES_EXPORT(int) top_panel (PANEL *); -extern NCURSES_EXPORT(int) bottom_panel (PANEL *); -extern NCURSES_EXPORT(PANEL*) new_panel (WINDOW *); -extern NCURSES_EXPORT(PANEL*) panel_above (const PANEL *); -extern NCURSES_EXPORT(PANEL*) panel_below (const PANEL *); -extern NCURSES_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); -extern NCURSES_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); -extern NCURSES_EXPORT(int) move_panel (PANEL *, int, int); -extern NCURSES_EXPORT(int) replace_panel (PANEL *,WINDOW *); -extern NCURSES_EXPORT(int) panel_hidden (const PANEL *); +#if defined(BUILDING_PANEL) +# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT +#else +# define PANEL_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT +#endif + +#define PANEL_WRAPPED_VAR(type,name) extern PANEL_IMPEXP type NCURSES_PUBLIC_VAR(name)(void) + +#define PANEL_EXPORT(type) PANEL_IMPEXP type NCURSES_API +#define PANEL_EXPORT_VAR(type) PANEL_IMPEXP type + +extern PANEL_EXPORT(WINDOW*) panel_window (const PANEL *); +extern PANEL_EXPORT(void) update_panels (void); +extern PANEL_EXPORT(int) hide_panel (PANEL *); +extern PANEL_EXPORT(int) show_panel (PANEL *); +extern PANEL_EXPORT(int) del_panel (PANEL *); +extern PANEL_EXPORT(int) top_panel (PANEL *); +extern PANEL_EXPORT(int) bottom_panel (PANEL *); +extern PANEL_EXPORT(PANEL*) new_panel (WINDOW *); +extern PANEL_EXPORT(PANEL*) panel_above (const PANEL *); +extern PANEL_EXPORT(PANEL*) panel_below (const PANEL *); +extern PANEL_EXPORT(int) set_panel_userptr (PANEL *, NCURSES_CONST void *); +extern PANEL_EXPORT(NCURSES_CONST void*) panel_userptr (const PANEL *); +extern PANEL_EXPORT(int) move_panel (PANEL *, int, int); +extern PANEL_EXPORT(int) replace_panel (PANEL *,WINDOW *); +extern PANEL_EXPORT(int) panel_hidden (const PANEL *); #if NCURSES_SP_FUNCS -extern NCURSES_EXPORT(PANEL *) ground_panel(SCREEN *); -extern NCURSES_EXPORT(PANEL *) ceiling_panel(SCREEN *); +extern PANEL_EXPORT(PANEL *) ground_panel(SCREEN *); +extern PANEL_EXPORT(PANEL *) ceiling_panel(SCREEN *); -extern NCURSES_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); +extern PANEL_EXPORT(void) NCURSES_SP_NAME(update_panels) (SCREEN*); #endif #if defined(__cplusplus) diff --git a/contrib/ncurses/panel/panel.priv.h b/contrib/ncurses/panel/panel.priv.h index c8e3ea798f9d..029a4f33cd8d 100644 --- a/contrib/ncurses/panel/panel.priv.h +++ b/contrib/ncurses/panel/panel.priv.h @@ -27,7 +27,7 @@ * authorization. * ****************************************************************************/ -/* $Id: panel.priv.h,v 1.28 2020/02/02 23:34:34 tom Exp $ */ +/* $Id: panel.priv.h,v 1.30 2020/09/26 18:05:32 tom Exp $ */ #ifndef NCURSES_PANEL_PRIV_H #define NCURSES_PANEL_PRIV_H 1 @@ -50,21 +50,21 @@ struct screen; /* forward declaration */ #include "panel.h" #ifdef TRACE - extern NCURSES_EXPORT(const char *) _nc_my_visbuf (const void *); + extern PANEL_EXPORT(const char *) _nc_my_visbuf (const void *, int); # ifdef TRACE_TXT -# define USER_PTR(ptr) _nc_visbuf((const char *)ptr) +# define USER_PTR(ptr,n) _nc_visbuf2(n, (const char *)ptr) # else -# define USER_PTR(ptr) _nc_my_visbuf((const char *)ptr) +# define USER_PTR(ptr,n) _nc_my_visbuf((const char *)ptr, n) # endif # define returnPanel(code) TRACE_RETURN1(code,panel) - extern NCURSES_EXPORT(PANEL *) _nc_retrace_panel (PANEL *); - extern NCURSES_EXPORT(void) _nc_dPanel (const char*, const PANEL*); - extern NCURSES_EXPORT(void) _nc_dStack (const char*, int, const PANEL*); - extern NCURSES_EXPORT(void) _nc_Wnoutrefresh (const PANEL*); - extern NCURSES_EXPORT(void) _nc_Touchpan (const PANEL*); - extern NCURSES_EXPORT(void) _nc_Touchline (const PANEL*, int, int); + extern PANEL_EXPORT(PANEL *) _nc_retrace_panel (PANEL *); + extern PANEL_EXPORT(void) _nc_dPanel (const char*, const PANEL*); + extern PANEL_EXPORT(void) _nc_dStack (const char*, int, const PANEL*); + extern PANEL_EXPORT(void) _nc_Wnoutrefresh (const PANEL*); + extern PANEL_EXPORT(void) _nc_Touchpan (const PANEL*); + extern PANEL_EXPORT(void) _nc_Touchline (const PANEL*, int, int); # define dBug(x) _tracef x # define dPanel(text,pan) _nc_dPanel(text,pan) @@ -205,7 +205,7 @@ struct screen; /* forward declaration */ #if NCURSES_SP_FUNCS /* These may become later renamed and part of panel.h and the public API */ -extern NCURSES_EXPORT(void) NCURSES_SP_NAME(_nc_update_panels)(SCREEN*); +extern PANEL_EXPORT(void) NCURSES_SP_NAME(_nc_update_panels)(SCREEN*); #endif /* *INDENT-ON* */ diff --git a/contrib/ncurses/progs/Makefile.in b/contrib/ncurses/progs/Makefile.in index 79cbc99ecf28..1511ec271210 100644 --- a/contrib/ncurses/progs/Makefile.in +++ b/contrib/ncurses/progs/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.103 2020/02/02 23:34:34 tom Exp $ +# $Id: Makefile.in,v 1.108 2021/01/23 20:42:08 tom Exp $ ############################################################################## -# Copyright 2020 Thomas E. Dickey # +# Copyright 2020,2021 Thomas E. Dickey # # Copyright 1998-2016,2018 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # @@ -47,7 +47,7 @@ SHELL = @SHELL@ VPATH = @srcdir@ THIS = Makefile -CF_MFLAGS = @cf_cv_makeflags@ +TOP_MFLAGS = @cf_cv_makeflags@ DESTDIR="$(DESTDIR)" RPATH_LIST="$(RPATH_LIST)" @SET_MAKE@ x = @EXEEXT@ @@ -90,7 +90,7 @@ ETAGS = @ETAGS@ CC = @CC@ CPP = @CPP@ -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ @EXTRA_CFLAGS@ INCDIR = $(top_srcdir)/include CPPFLAGS = -DHAVE_CONFIG_H -I../progs @CPPFLAGS@ @@ -98,9 +98,9 @@ CPPFLAGS = -DHAVE_CONFIG_H -I../progs @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) CFLAGS_LIBTOOL = $(CCFLAGS) -CFLAGS_NORMAL = $(CCFLAGS) -CFLAGS_DEBUG = $(CCFLAGS) @CC_G_OPT@ -DTRACE -CFLAGS_PROFILE = $(CCFLAGS) -pg +CFLAGS_NORMAL = $(CCFLAGS) -DNCURSES_STATIC +CFLAGS_DEBUG = $(CCFLAGS) -DNCURSES_STATIC @CC_G_OPT@ -DTRACE +CFLAGS_PROFILE = $(CCFLAGS) -DNCURSES_STATIC -pg CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) @@ -203,10 +203,10 @@ install.progs: $(AUTO_SRC) $(PROGS) $(DESTDIR)$(bindir) @MAKE_TERMINFO@ $(LIBTOOL_INSTALL) $(INSTALL_PROG) toe$x $(DESTDIR)$(bindir)/$(actual_toe) @MAKE_TERMINFO@ @echo "linking $(actual_infotocap) to $(actual_tic)" @MAKE_TERMINFO@ -@rm -f $(DESTDIR)$(bindir)/$(actual_infotocap) -@MAKE_TERMINFO@ (cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_infotocap)) +@MAKE_TERMINFO@ ( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_infotocap) ) @MAKE_TERMINFO@ @echo "linking $(actual_captoinfo) to $(actual_tic)" @MAKE_TERMINFO@ -@rm -f $(DESTDIR)$(bindir)/$(actual_captoinfo) -@MAKE_TERMINFO@ (cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_captoinfo)) +@MAKE_TERMINFO@ ( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tic) $(actual_captoinfo) ) $(LIBTOOL_INSTALL) $(INSTALL_PROG) infocmp$x $(DESTDIR)$(bindir)/$(actual_infocmp) $(LIBTOOL_INSTALL) $(INSTALL_PROG) clear$x $(DESTDIR)$(bindir)/$(actual_clear) $(LIBTOOL_INSTALL) $(INSTALL_PROG) tabs$x $(DESTDIR)$(bindir)/$(actual_tabs) @@ -214,7 +214,7 @@ install.progs: $(AUTO_SRC) $(PROGS) $(DESTDIR)$(bindir) $(LIBTOOL_INSTALL) $(INSTALL_PROG) tset$x $(DESTDIR)$(bindir)/$(actual_tset) @echo "linking $(actual_reset) to $(actual_tset)" -@rm -f $(DESTDIR)$(bindir)/$(actual_reset) - (cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tset) $(actual_reset)) + ( cd $(DESTDIR)$(bindir) && $(LN_S) $(actual_tset) $(actual_reset) ) uninstall.progs: @MAKE_TERMINFO@ -@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(bindir)/$(actual_tic) @@ -323,9 +323,9 @@ realclean :: distclean ../include/hashsize.h \ ../include/parametrized.h \ ../include/term.h : - cd ../include; $(MAKE) $(CF_MFLAGS) + ( cd ../include && $(MAKE) $(TOP_MFLAGS) ) $(DEPS_CURSES) : - cd ../ncurses; $(MAKE) $(CF_MFLAGS) + ( cd ../ncurses && $(MAKE) $(TOP_MFLAGS) ) lint: @MAKE_TERMINFO@ $(LINT) $(LINT_OPTS) $(CPPFLAGS) $(srcdir)/tic.c $(srcdir)/dump_entry.c $(LINT_LIBS) diff --git a/contrib/ncurses/progs/dump_entry.c b/contrib/ncurses/progs/dump_entry.c index 85d56eb92c2d..75bbe059cd0b 100644 --- a/contrib/ncurses/progs/dump_entry.c +++ b/contrib/ncurses/progs/dump_entry.c @@ -40,7 +40,7 @@ #include "termsort.c" /* this C file is generated */ #include /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.176 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.181 2020/12/26 18:25:18 tom Exp $") #define DISCARD(string) string = ABSENT_STRING #define PRINTF (void) printf @@ -747,7 +747,7 @@ leading_DYN(DYNBUF * buffer, const char *leading) } bool -has_params(const char *src) +has_params(const char *src, bool formatting) { bool result = FALSE; int len = (int) strlen(src); @@ -765,7 +765,11 @@ has_params(const char *src) } } if (!ifthen) { - result = ((len > 50) && params); + if (formatting) { + result = ((len > 50) && params); + } else { + result = params; + } } return result; } @@ -774,7 +778,7 @@ static char * fmt_complex(TERMTYPE2 *tterm, const char *capability, char *src, int level) { bool percent = FALSE; - bool params = has_params(src); + bool params = has_params(src, TRUE); while (*src != '\0') { switch (*src) { @@ -801,7 +805,7 @@ fmt_complex(TERMTYPE2 *tterm, const char *capability, char *src, int level) strncpy_DYN(&tmpbuf, "%", (size_t) 1); strncpy_DYN(&tmpbuf, src, (size_t) 1); src++; - params = has_params(src); + params = has_params(src, TRUE); if (!params && *src != '\0' && *src != '%') { strncpy_DYN(&tmpbuf, "\n", (size_t) 1); indent_DYN(&tmpbuf, level + 1); @@ -1110,7 +1114,7 @@ fmt_entry(TERMTYPE2 *tterm, ? parametrized[i] : ((*srccap == 'k') ? 0 - : has_params(srccap))); + : has_params(srccap, FALSE))); char *cv = _nc_infotocap(name, srccap, params); if (cv == 0) { @@ -1125,7 +1129,7 @@ fmt_entry(TERMTYPE2 *tterm, char *s = srccap, *d = buffer; int need = 3 + (int) strlen(name); while ((*d = *s++) != 0) { - if ((d - buffer + 1) >= (int) sizeof(buffer)) { + if ((d - buffer + 2) >= (int) sizeof(buffer)) { fprintf(stderr, "%s: value for %s is too long\n", _nc_progname, @@ -1343,7 +1347,7 @@ kill_labels(TERMTYPE2 *tterm, int target) int n; int result = 0; char *cap; - char name[10]; + char name[20]; for (n = 0; n <= 10; ++n) { _nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "lf%d", n); @@ -1369,7 +1373,7 @@ kill_fkeys(TERMTYPE2 *tterm, int target) int n; int result = 0; char *cap; - char name[10]; + char name[20]; for (n = 60; n >= 0; --n) { _nc_SPRINTF(name, _nc_SLIMIT(sizeof(name)) "kf%d", n); diff --git a/contrib/ncurses/progs/dump_entry.h b/contrib/ncurses/progs/dump_entry.h index 984fee709551..98551914cd63 100644 --- a/contrib/ncurses/progs/dump_entry.h +++ b/contrib/ncurses/progs/dump_entry.h @@ -34,7 +34,7 @@ ****************************************************************************/ /* - * $Id: dump_entry.h,v 1.42 2020/02/02 23:34:34 tom Exp $ + * $Id: dump_entry.h,v 1.43 2020/11/14 18:16:57 tom Exp $ * * Dump control definitions and variables */ @@ -73,7 +73,7 @@ typedef int (*PredFunc) (PredType, PredIdx); typedef void (*PredHook) (PredType, PredIdx, const char *); extern NCURSES_CONST char *nametrans(const char *); -extern bool has_params(const char *src); +extern bool has_params(const char *, bool); extern int fmt_entry(TERMTYPE2 *, PredFunc, int, int, int, int); extern int show_entry(void); extern void compare_entry(PredHook, TERMTYPE2 *, bool); diff --git a/contrib/ncurses/progs/infocmp.c b/contrib/ncurses/progs/infocmp.c index f42ff3416ece..dbdbdc2dfe35 100644 --- a/contrib/ncurses/progs/infocmp.c +++ b/contrib/ncurses/progs/infocmp.c @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: infocmp.c,v 1.144 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.145 2020/07/07 20:28:47 tom Exp $") #define MAX_STRING 1024 /* maximum formatted string */ @@ -1194,8 +1194,9 @@ usage(void) DATA("Options:") }; #undef DATA + /* length is given here so the compiler can make everything readonly */ #define DATA(s) s - static const char options[][45] = + static const char options[][46] = { " -0 print single-row" ," -1 print single-column" @@ -1835,8 +1836,8 @@ main(int argc, char *argv[]) tname[termcount]); status = _nc_read_entry2(tname[termcount], - tfile[termcount], - &entries[termcount].tterm); + tfile[termcount], + &entries[termcount].tterm); } if (status <= 0) { diff --git a/contrib/ncurses/progs/progs.priv.h b/contrib/ncurses/progs/progs.priv.h index da7a5154f734..3dc177d0a866 100644 --- a/contrib/ncurses/progs/progs.priv.h +++ b/contrib/ncurses/progs/progs.priv.h @@ -31,7 +31,7 @@ * Author: Thomas E. Dickey 1997-on * ****************************************************************************/ /* - * $Id: progs.priv.h,v 1.48 2020/02/02 23:34:34 tom Exp $ + * $Id: progs.priv.h,v 1.52 2020/09/05 19:35:06 tom Exp $ * * progs.priv.h * @@ -58,10 +58,6 @@ #include #endif -#if HAVE_SYS_BSDTYPES_H -#include /* needed for ISC */ -#endif - #if HAVE_LIMITS_H # include #elif HAVE_SYS_PARAM_H @@ -119,10 +115,20 @@ extern char *optarg; extern int optind; #endif /* HAVE_GETOPT_H */ +#undef _NC_WINDOWS +#if (defined(_WIN32) || defined(_WIN64)) +#define _NC_WINDOWS 1 +#endif + #define NCURSES_INTERNALS 1 #define NCURSES_OPAQUE 0 #include + +#if !(defined(NCURSES_WGETCH_EVENTS) && defined(NEED_KEY_EVENT)) +#undef KEY_EVENT /* reduce compiler-warnings with Visual C++ */ +#endif + #include #include #include @@ -155,6 +161,10 @@ extern int optind; #endif /* gcc workarounds */ /* usually in */ +#ifndef STDIN_FILENO +#define STDIN_FILENO 0 +#endif + #ifndef STDOUT_FILENO #define STDOUT_FILENO 1 #endif diff --git a/contrib/ncurses/progs/reset_cmd.c b/contrib/ncurses/progs/reset_cmd.c index 9d23cd05ec2e..5e517cc74e9e 100644 --- a/contrib/ncurses/progs/reset_cmd.c +++ b/contrib/ncurses/progs/reset_cmd.c @@ -53,7 +53,7 @@ #include #endif -MODULE_ID("$Id: reset_cmd.c,v 1.19 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: reset_cmd.c,v 1.24 2020/11/21 22:11:10 tom Exp $") /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, @@ -363,6 +363,13 @@ default_erase(void) void set_control_chars(TTY * tty_settings, int my_erase, int my_intr, int my_kill) { +#if defined(EXP_WIN32_DRIVER) + /* noop */ + (void) tty_settings; + (void) my_erase; + (void) my_intr; + (void) my_kill; +#else if (DISABLED(tty_settings->c_cc[VERASE]) || my_erase >= 0) { tty_settings->c_cc[VERASE] = UChar((my_erase >= 0) ? my_erase @@ -380,6 +387,7 @@ set_control_chars(TTY * tty_settings, int my_erase, int my_intr, int my_kill) ? my_kill : CKILL); } +#endif } /* @@ -389,6 +397,9 @@ set_control_chars(TTY * tty_settings, int my_erase, int my_intr, int my_kill) void set_conversions(TTY * tty_settings) { +#if defined(EXP_WIN32_DRIVER) + /* FIXME */ +#else #ifdef ONLCR tty_settings->c_oflag |= ONLCR; #endif @@ -412,6 +423,7 @@ set_conversions(TTY * tty_settings) tty_settings->c_oflag &= ~OXTABS; #endif /* OXTABS */ tty_settings->c_lflag |= (ECHOE | ECHOK); +#endif } static bool @@ -501,16 +513,15 @@ send_init_strings(int fd GCC_UNUSED, TTY * old_settings) } else #if defined(set_lr_margin) if (VALID_STRING(set_lr_margin)) { - need_flush |= sent_string(TPARM_2(set_lr_margin, 0, - columns - 1)); + need_flush |= sent_string(TIPARM_2(set_lr_margin, 0, columns - 1)); } else #endif #if defined(set_left_margin_parm) && defined(set_right_margin_parm) if (VALID_STRING(set_left_margin_parm) && VALID_STRING(set_right_margin_parm)) { - need_flush |= sent_string(TPARM_1(set_left_margin_parm, 0)); - need_flush |= sent_string(TPARM_1(set_right_margin_parm, - columns - 1)); + need_flush |= sent_string(TIPARM_1(set_left_margin_parm, 0)); + need_flush |= sent_string(TIPARM_1(set_right_margin_parm, + columns - 1)); } else #endif if (VALID_STRING(set_left_margin) @@ -518,8 +529,8 @@ send_init_strings(int fd GCC_UNUSED, TTY * old_settings) need_flush |= to_left_margin(); need_flush |= sent_string(set_left_margin); if (VALID_STRING(parm_right_cursor)) { - need_flush |= sent_string(TPARM_1(parm_right_cursor, - columns - 1)); + need_flush |= sent_string(TIPARM_1(parm_right_cursor, + columns - 1)); } else { for (i = 0; i < columns - 1; i++) { out_char(' '); @@ -552,15 +563,23 @@ show_tty_change(TTY * old_settings, int which, unsigned def) { - unsigned older, newer; + unsigned older = 0, newer = 0; char *p; +#if defined(EXP_WIN32_DRIVER) + /* noop */ + (void) old_settings; + (void) new_settings; + (void) name; + (void) which; + (void) def; +#else newer = new_settings->c_cc[which]; older = old_settings->c_cc[which]; if (older == newer && older == def) return; - +#endif (void) fprintf(stderr, "%s %s ", name, older == newer ? "is" : "set to"); if (DISABLED(newer)) { @@ -604,9 +623,13 @@ reset_flush(void) void print_tty_chars(TTY * old_settings, TTY * new_settings) { +#if defined(EXP_WIN32_DRIVER) + /* noop */ +#else show_tty_change(old_settings, new_settings, "Erase", VERASE, CERASE); show_tty_change(old_settings, new_settings, "Kill", VKILL, CKILL); show_tty_change(old_settings, new_settings, "Interrupt", VINTR, CINTR); +#endif } #if HAVE_SIZECHANGE diff --git a/contrib/ncurses/progs/tabs.c b/contrib/ncurses/progs/tabs.c index 8a3bc108fe8d..0539e85653ea 100644 --- a/contrib/ncurses/progs/tabs.c +++ b/contrib/ncurses/progs/tabs.c @@ -39,7 +39,7 @@ #include #include -MODULE_ID("$Id: tabs.c,v 1.42 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: tabs.c,v 1.45 2020/05/27 23:47:22 tom Exp $") static void usage(void) GCC_NORETURN; @@ -75,7 +75,7 @@ do_tabs(int *tab_list) } } if (stop <= max_cols) { - tputs(tparm(set_tab, stop), 1, putch); + tputs(TIPARM_1(set_tab, stop), 1, putch); last = stop; } else { break; diff --git a/contrib/ncurses/progs/tic.c b/contrib/ncurses/progs/tic.c index 328bcd6b2772..9b02a23216fa 100644 --- a/contrib/ncurses/progs/tic.c +++ b/contrib/ncurses/progs/tic.c @@ -49,7 +49,7 @@ #include #include -MODULE_ID("$Id: tic.c,v 1.282 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.291 2021/02/20 23:57:24 tom Exp $") #define STDIN_NAME "" @@ -1179,6 +1179,14 @@ check_acs(TERMTYPE2 *tp) } } +static char * +safe_strdup(const char *value) +{ + if (value == NULL) + value = ""; + return strdup(value); +} + static bool same_color(NCURSES_CONST char *oldcap, NCURSES_CONST char *newcap, int limit) { @@ -1189,8 +1197,8 @@ same_color(NCURSES_CONST char *oldcap, NCURSES_CONST char *newcap, int limit) int n; int same; for (n = same = 0; n < limit; ++n) { - char *oldvalue = strdup(TPARM_1(oldcap, n)); - char *newvalue = strdup(TPARM_1(newcap, n)); + char *oldvalue = safe_strdup(TIPARM_1(oldcap, n)); + char *newvalue = safe_strdup(TIPARM_1(newcap, n)); same += !strcmp(oldvalue, newvalue); free(oldvalue); free(newvalue); @@ -1703,6 +1711,7 @@ check_screen(TERMTYPE2 *tp) int have_bce = back_color_erase; bool have_kmouse = FALSE; bool use_sgr_39_49 = FALSE; + const char *name_39_49 = "orig_pair or orig_colors"; char *name = _nc_first_name(tp->term_names); bool is_screen = !strncmp(name, "screen", 6); bool screen_base = (is_screen @@ -1720,10 +1729,15 @@ check_screen(TERMTYPE2 *tp) if (VALID_STRING(key_mouse)) { have_kmouse = !strcmp("\033[M", key_mouse); } - if (VALID_STRING(orig_colors)) { - use_sgr_39_49 = uses_SGR_39_49(orig_colors); - } else if (VALID_STRING(orig_pair)) { - use_sgr_39_49 = uses_SGR_39_49(orig_pair); + if (have_bce) { + if (VALID_STRING(orig_pair)) { + name_39_49 = "orig_pair"; + use_sgr_39_49 = uses_SGR_39_49(orig_pair); + } + if (!use_sgr_39_49 && VALID_STRING(orig_colors)) { + name_39_49 = "orig_colors"; + use_sgr_39_49 = uses_SGR_39_49(orig_colors); + } } if (have_XM && have_XT) { @@ -1738,10 +1752,14 @@ check_screen(TERMTYPE2 *tp) _nc_warning("expected kmous capability with XT"); } } - if (!have_bce && max_colors > 0) - _nc_warning("expected bce capability with XT"); - if (!use_sgr_39_49 && have_bce && max_colors > 0) - _nc_warning("expected orig_colors capability with XT to have 39/49 parameters"); + if (max_colors > 0) { + if (!have_bce) { + _nc_warning("expected bce capability with XT"); + } else if (!use_sgr_39_49) { + _nc_warning("expected %s capability with XT " + "to have 39/49 parameters", name_39_49); + } + } if (VALID_STRING(to_status_line)) _nc_warning("\"tsl\" capability is redundant, given XT"); } else { @@ -1835,7 +1853,6 @@ expected_params(const char *name) DATA( "wingo", 1 ), }; /* *INDENT-ON* */ - #undef DATA unsigned n; @@ -1910,7 +1927,7 @@ check_params(TERMTYPE2 *tp, const char *name, char *value, int extended) int expected = expected_params(name); int actual = 0; int n; - bool params[NUM_PARM]; + bool params[1 + NUM_PARM]; char *s = value; #ifdef set_top_margin_parm @@ -1919,7 +1936,7 @@ check_params(TERMTYPE2 *tp, const char *name, char *value, int extended) expected = 2; #endif - for (n = 0; n < NUM_PARM; n++) + for (n = 0; n <= NUM_PARM; n++) params[n] = FALSE; while (*s != 0) { @@ -2173,6 +2190,9 @@ check_1_infotocap(const char *name, NCURSES_CONST char *value, int count) char *result; char blob[NUM_PARM * 10]; char *next = blob; + TParams expect; + TParams actual; + int nparam; *next++ = '\0'; for (k = 1; k <= NUM_PARM; k++) { @@ -2184,7 +2204,16 @@ check_1_infotocap(const char *name, NCURSES_CONST char *value, int count) next += strlen(next) + 1; } - switch (tparm_type(name)) { + expect = tparm_type(name); + nparam = _nc_tparm_analyze(value, p_is_s, &ignored); + actual = guess_tparm_type(nparam, p_is_s); + + if (expect != actual) { + _nc_warning("%s has mismatched parameters", name); + actual = Other; + } + + switch (actual) { case Num_Str: result = TPARM_2(value, numbers[1], strings[2]); break; @@ -2192,8 +2221,21 @@ check_1_infotocap(const char *name, NCURSES_CONST char *value, int count) result = TPARM_3(value, numbers[1], strings[2], strings[3]); break; case Numbers: +#define myParam(n) numbers[n] + result = TIPARM_9(value, + myParam(1), + myParam(2), + myParam(3), + myParam(4), + myParam(5), + myParam(6), + myParam(7), + myParam(8), + myParam(9)); +#undef myParam + break; + case Other: default: - (void) _nc_tparm_analyze(value, p_is_s, &ignored); #define myParam(n) (p_is_s[n - 1] != 0 ? ((TPARM_ARG) strings[n]) : numbers[n]) result = TPARM_9(value, myParam(1), @@ -2205,6 +2247,7 @@ check_1_infotocap(const char *name, NCURSES_CONST char *value, int count) myParam(7), myParam(8), myParam(9)); +#undef myParam break; } return strdup(result); @@ -2339,14 +2382,13 @@ check_infotocap(TERMTYPE2 *tp, int i, const char *value) ? parametrized[i] : ((*value == 'k') ? 0 - : has_params(value))); - int to_char = 0; + : has_params(value, FALSE))); char *ti_value; char *tc_value; bool embedded; assert(SIZEOF(parametrized) == STRCOUNT); - if ((ti_value = _nc_tic_expand(value, TRUE, to_char)) == ABSENT_STRING) { + if (!VALID_STRING(value) || (ti_value = strdup(value)) == NULL) { _nc_warning("tic-expansion of %s failed", name); } else if ((tc_value = _nc_infotocap(name, ti_value, params)) == ABSENT_STRING) { _nc_warning("tic-conversion of %s failed", name); @@ -2369,12 +2411,14 @@ check_infotocap(TERMTYPE2 *tp, int i, const char *value) if (strcmp(ti_check, tc_check)) { if (first) { fprintf(stderr, "check_infotocap(%s)\n", name); - fprintf(stderr, "...ti '%s'\n", ti_value); - fprintf(stderr, "...tc '%s'\n", tc_value); + fprintf(stderr, "...ti '%s'\n", _nc_visbuf2(0, ti_value)); + fprintf(stderr, "...tc '%s'\n", _nc_visbuf2(0, tc_value)); first = FALSE; } _nc_warning("tparm-conversion of %s(%d) differs between\n\tterminfo %s\n\ttermcap %s", - name, count, ti_check, tc_check); + name, count, + _nc_visbuf2(0, ti_check), + _nc_visbuf2(1, tc_check)); } free(ti_check); free(tc_check); @@ -2509,22 +2553,29 @@ similar_sgr(int num, char *a, char *b) return ((num != 0) || (*a == 0)); } +static void +check_tparm_err(int num) +{ + if (_nc_tparm_err) + _nc_warning("tparam error in sgr(%d): %s", num, sgr_names[num]); +} + static char * check_sgr(TERMTYPE2 *tp, char *zero, int num, char *cap, const char *name) { char *test; _nc_tparm_err = 0; - test = TPARM_9(set_attributes, - num == 1, - num == 2, - num == 3, - num == 4, - num == 5, - num == 6, - num == 7, - num == 8, - num == 9); + test = TIPARM_9(set_attributes, + num == 1, + num == 2, + num == 3, + num == 4, + num == 5, + num == 6, + num == 7, + num == 8, + num == 9); if (test != 0) { if (PRESENT(cap)) { if (!similar_sgr(num, test, cap)) { @@ -2539,8 +2590,7 @@ check_sgr(TERMTYPE2 *tp, char *zero, int num, char *cap, const char *name) } else if (PRESENT(cap)) { _nc_warning("sgr(%d) missing, but %s present", num, name); } - if (_nc_tparm_err) - _nc_warning("stack error in sgr(%d) string", num); + check_tparm_err(num); return test; } @@ -2695,7 +2745,6 @@ check_conflict(TERMTYPE2 *tp) { NULL, NULL }, }; /* *INDENT-ON* */ - /* * SVr4 curses defines the "xcurses" names listed above except for * the special cases in the "shifted" column. When using these @@ -2973,10 +3022,9 @@ check_termtype(TERMTYPE2 *tp, bool literal) if (PRESENT(exit_attribute_mode)) { zero = strdup(CHECK_SGR(0, exit_attribute_mode)); } else { - zero = strdup(TPARM_9(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0)); + zero = strdup(TIPARM_9(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0)); } - if (_nc_tparm_err) - _nc_warning("stack error in sgr(0) string"); + check_tparm_err(0); if (zero != 0) { CHECK_SGR(1, enter_standout_mode); diff --git a/contrib/ncurses/progs/tparm_type.c b/contrib/ncurses/progs/tparm_type.c index da681ce90fe2..3da4a0774af5 100644 --- a/contrib/ncurses/progs/tparm_type.c +++ b/contrib/ncurses/progs/tparm_type.c @@ -33,7 +33,7 @@ #include -MODULE_ID("$Id: tparm_type.c,v 1.3 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: tparm_type.c,v 1.4 2020/10/24 17:30:32 tom Exp $") /* * Lookup the type of call we should make to tparm(). This ignores the actual @@ -70,3 +70,31 @@ tparm_type(const char *name) } return result; } + +TParams +guess_tparm_type(int nparam, char **p_is_s) +{ + TParams result = Other; + switch (nparam) { + case 0: + case 1: + if (!p_is_s[0]) + result = Numbers; + break; + case 2: + if (!p_is_s[0] && !p_is_s[1]) + result = Numbers; + if (!p_is_s[0] && p_is_s[1]) + result = Num_Str; + break; + case 3: + if (!p_is_s[0] && !p_is_s[1] && !p_is_s[2]) + result = Numbers; + if (!p_is_s[0] && p_is_s[1] && p_is_s[2]) + result = Num_Str_Str; + break; + default: + break; + } + return result; +} diff --git a/contrib/ncurses/progs/tparm_type.h b/contrib/ncurses/progs/tparm_type.h index 77f4f21cfb56..7c102a309c1a 100644 --- a/contrib/ncurses/progs/tparm_type.h +++ b/contrib/ncurses/progs/tparm_type.h @@ -32,7 +32,7 @@ ****************************************************************************/ /* - * $Id: tparm_type.h,v 1.2 2020/02/02 23:34:34 tom Exp $ + * $Id: tparm_type.h,v 1.3 2020/10/24 17:11:33 tom Exp $ * * determine expected/actual number of parameters to setup for tparm */ @@ -43,11 +43,13 @@ #include typedef enum { - Numbers = 0 + Other = -1 + ,Numbers = 0 ,Num_Str ,Num_Str_Str } TParams; extern TParams tparm_type(const char *name); +extern TParams guess_tparm_type(int nparam, char **p_is_s); #endif /* TPARM_TYPE_H */ diff --git a/contrib/ncurses/progs/tput.c b/contrib/ncurses/progs/tput.c index 295b83fb8161..cac8d292a94b 100644 --- a/contrib/ncurses/progs/tput.c +++ b/contrib/ncurses/progs/tput.c @@ -51,7 +51,7 @@ #include #include -MODULE_ID("$Id: tput.c,v 1.81 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: tput.c,v 1.84 2020/10/24 18:29:38 tom Exp $") #define PUTS(s) fputs(s, stdout) @@ -63,7 +63,7 @@ static bool is_reset = FALSE; static bool is_clear = FALSE; static void -quit(int status, const char *fmt,...) +quit(int status, const char *fmt, ...) { va_list argp; @@ -251,6 +251,21 @@ tput_cmd(int fd, TTY * saved_settings, bool opt_x, int argc, char *argv[]) s = TPARM_3(s, numbers[1], strings[2], strings[3]); break; case Numbers: +#define myParam(n) numbers[n] + s = TIPARM_9(s, + myParam(1), + myParam(2), + myParam(3), + myParam(4), + myParam(5), + myParam(6), + myParam(7), + myParam(8), + myParam(9)); +#undef myParam + break; + case Other: + /* FALLTHRU */ default: (void) _nc_tparm_analyze(s, p_is_s, &ignored); #define myParam(n) (p_is_s[n - 1] != 0 ? ((TPARM_ARG) strings[n]) : numbers[n]) @@ -264,6 +279,7 @@ tput_cmd(int fd, TTY * saved_settings, bool opt_x, int argc, char *argv[]) myParam(7), myParam(8), myParam(9)); +#undef myParam break; } } diff --git a/contrib/ncurses/progs/tset.c b/contrib/ncurses/progs/tset.c index ca0520e215a1..4d33ca8789c2 100644 --- a/contrib/ncurses/progs/tset.c +++ b/contrib/ncurses/progs/tset.c @@ -98,7 +98,7 @@ char *ttyname(int fd); #endif -MODULE_ID("$Id: tset.c,v 1.121 2020/02/02 23:34:34 tom Exp $") +MODULE_ID("$Id: tset.c,v 1.125 2020/09/05 22:54:47 tom Exp $") #ifndef environ extern char **environ; @@ -133,7 +133,7 @@ exit_error(void) } static void -err(const char *fmt,...) +err(const char *fmt, ...) { va_list ap; va_start(ap, fmt); @@ -227,10 +227,16 @@ static MAP *cur, *maplist; #define DATA(name,value) { { name }, value } typedef struct speeds { - const char string[7]; + const char string[8]; int speed; } SPEEDS; +#if defined(EXP_WIN32_DRIVER) +static const SPEEDS speeds[] = +{ + {"0", 0} +}; +#else static const SPEEDS speeds[] = { DATA("0", B0), @@ -331,6 +337,7 @@ static const SPEEDS speeds[] = #endif }; #undef DATA +#endif static int tbaudrate(char *rate) @@ -839,6 +846,8 @@ main(int argc, char **argv) oldmode = mode; #ifdef TERMIOS ospeed = (NCURSES_OSPEED) cfgetospeed(&mode); +#elif defined(EXP_WIN32_DRIVER) + ospeed = 0; #else ospeed = (NCURSES_OSPEED) mode.sg_ospeed; #endif diff --git a/contrib/ncurses/test/back_ground.c b/contrib/ncurses/test/back_ground.c new file mode 100644 index 000000000000..100282464ac8 --- /dev/null +++ b/contrib/ncurses/test/back_ground.c @@ -0,0 +1,300 @@ +/**************************************************************************** + * Copyright 2021 Thomas E. Dickey * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ +/* + * $Id: back_ground.c,v 1.5 2021/02/20 12:23:21 tom Exp $ + */ + +#include + +#if USE_WIDEC_SUPPORT + +#define NEED_COLOR_CODE 1 +#define NEED_COLOR_NAME 1 +#include +#include + +static int default_bg = COLOR_BLACK; +static int default_fg = COLOR_WHITE; +static wchar_t wide_fill = L' '; + +static wchar_t +decode_wchar(const char *value) +{ + long result; + char *next = NULL; + int radix = 0; + + if (!strncmp(value, "U+", 2)) { + value += 2; + radix = 16; + } + result = strtol(value, &next, radix); + if (next == value || (next == NULL || *next != '\0')) { + fprintf(stderr, "decoding wchar_t: %s\n", value); + exit(EXIT_FAILURE); + } + return (wchar_t) result; +} + +static void +test_background(void) +{ + NCURSES_COLOR_T f, b; + int row; + int chr; + wchar_t blank[2]; + wchar_t graphics[2]; + cchar_t data; + + if (pair_content(0, &f, &b) == ERR) { + printw("pair 0 contains no data\n"); + } else { + printw("pair 0 contains (%d,%d)\n", (int) f, (int) b); + } + dump_window(stdscr); + + blank[0] = wide_fill; + blank[1] = L'\0'; + + printw("Initializing pair 1 to red/%s\n", color_name(default_bg)); + init_pair(1, COLOR_RED, (NCURSES_COLOR_T) default_bg); + setcchar(&data, blank, A_NORMAL, 1, NULL); + bkgrndset(&data); + printw("RED/BLACK\n"); + dump_window(stdscr); + + printw("Initializing pair 2 to %s/blue\n", color_name(default_fg)); + init_pair(2, (NCURSES_COLOR_T) default_fg, COLOR_BLUE); + setcchar(&data, blank, A_NORMAL, 2, NULL); + bkgrndset(&data); + printw("This line should be %s/blue\n", color_name(default_fg)); + dump_window(stdscr); + + printw("Initializing pair 3 to %s/cyan (ACS_HLINE)\n", color_name(default_fg)); + init_pair(3, (NCURSES_COLOR_T) default_fg, COLOR_CYAN); + printw("...and drawing a box which should be followed by lines\n"); + graphics[0] = ACS_HLINE & A_CHARTEXT; + graphics[1] = L'\0'; + setcchar(&data, graphics, A_ALTCHARSET, 3, NULL); + bkgrndset(&data); + /* + * Characters from vt100 line-drawing should be mapped to line-drawing, + * since A_ALTCHARSET is set in the background, and the character part + * of the background is replaced by the nonblank characters written. + * + * Characters not in the line-drawing range are usually sent as-is. + * + * With SVr4 curses it is possible to rely on this to mix uppercase text + * with the (lowercase) line-drawing characters. ncurses uses some of + * the uppercase characters for encoding thick- and double-lines. + */ + row = 7; + mvprintw(row++, 10, "l"); + for (chr = 0; chr < 32; ++chr) + AddCh(' '); + printw("x\n"); + chr = 32; + while (chr < 128) { + if ((chr % 32) == 0) + mvprintw(row++, 10, "x"); + AddCh((chr == 127) ? ' ' : chr); + if ((++chr % 32) == 0) + printw("x\n"); + } + mvprintw(row++, 10, "m"); + for (chr = 0; chr < 32; ++chr) + AddCh(' '); + printw("j\n"); + dump_window(stdscr); + + setcchar(&data, blank, A_NORMAL, 0, NULL); + bkgrndset(&data); + printw("Default Colors\n"); + dump_window(stdscr); + + printw("Resetting colors to pair 1\n"); + setcchar(&data, blank, A_NORMAL, 1, NULL); + bkgrndset(&data); + printw("This line should be red/%s\n", color_name(default_bg)); + dump_window(stdscr); + + printw("Setting screen to pair 0\n"); + setcchar(&data, blank, A_NORMAL, 0, NULL); + bkgrndset(&data); + dump_window(stdscr); + + printw("Setting screen to pair 1\n"); + setcchar(&data, blank, A_NORMAL, 1, NULL); + bkgrndset(&data); + dump_window(stdscr); + + printw("Setting screen to pair 2\n"); + setcchar(&data, blank, A_NORMAL, 2, NULL); + bkgrndset(&data); + dump_window(stdscr); + + printw("Setting screen to pair 3\n"); + setcchar(&data, blank, A_NORMAL, 3, NULL); + bkgrndset(&data); + dump_window(stdscr); + + printw("Setting screen to pair 0\n"); + setcchar(&data, blank, A_NORMAL, 0, NULL); + bkgrndset(&data); + dump_window(stdscr); +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: background [options]" + ,"" + ,"Options:" +#if HAVE_ASSUME_DEFAULT_COLORS + ," -a invoke assume_default_colors, repeat to use in init_pair" +#endif + ," -b XXX specify background color" +#if HAVE_USE_DEFAULT_COLORS + ," -d invoke use_default_colors, repeat to use in init_pair" +#endif + ," -f XXX specify foreground color" + ," -l FILE log window-dumps to this file" + ," -w fill background with stipple pattern" + ," -W CODE fill background with this Unicode value" + }; + size_t n; + + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ +#if HAVE_ASSUME_DEFAULT_COLORS + int a_option = 0; +#endif +#if HAVE_USE_DEFAULT_COLORS + int d_option = 0; +#endif + int n; + + setlocale(LC_ALL, ""); + + while ((n = getopt(argc, argv, "ab:df:l:wW:")) != -1) { + switch (n) { +#if HAVE_ASSUME_DEFAULT_COLORS + case 'a': + ++a_option; + break; +#endif + case 'b': + default_bg = color_code(optarg); + break; +#if HAVE_USE_DEFAULT_COLORS + case 'd': + ++d_option; + break; +#endif + case 'f': + default_fg = color_code(optarg); + break; + case 'l': + if (!open_dump(optarg)) + usage(); + break; + case 'w': + wide_fill = L'\u2591'; + break; + case 'W': + wide_fill = decode_wchar(optarg); + break; + default: + usage(); + } + } +#if HAVE_USE_DEFAULT_COLORS && HAVE_ASSUME_DEFAULT_COLORS + if (a_option && d_option) { + fprintf(stderr, "Use either -a or -d option, but not both\n"); + ExitProgram(EXIT_FAILURE); + } +#endif + + initscr(); + cbreak(); + noecho(); + + if (has_colors()) { + start_color(); + +#if HAVE_USE_DEFAULT_COLORS + if (d_option) { + printw("Using default colors...\n"); + use_default_colors(); + if (d_option > 1) { + default_fg = -1; + default_bg = -1; + } + } +#endif +#if HAVE_ASSUME_DEFAULT_COLORS + if (a_option) { + printw("Using assumed colors %s/%s...\n", + color_name(default_fg), + color_name(default_bg)); + assume_default_colors(default_fg, default_bg); + if (a_option > 1) { + default_fg = -1; + default_bg = -1; + } + } +#endif + + test_background(); + + } else { + printw("This demo requires a color terminal"); + getch(); + } + endwin(); + close_dump(); + ExitProgram(EXIT_SUCCESS); +} + +#else +int +main(void) +{ + printf("This program requires the wide-curses library\n"); + ExitProgram(EXIT_FAILURE); +} +#endif /* USE_WIDEC_SUPPORT */ diff --git a/contrib/ncurses/test/dup_field.c b/contrib/ncurses/test/dup_field.c new file mode 100644 index 000000000000..5ca67f0b0f5a --- /dev/null +++ b/contrib/ncurses/test/dup_field.c @@ -0,0 +1,394 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ +/* + * $Id: dup_field.c,v 1.1 2020/03/21 19:28:36 tom Exp $ + * + * Demonstrate move_field(). + */ + +#include + +#if USE_LIBFORM + +#include +#include + +#define MY_DEMO EDIT_FIELD('f') + +static char empty[] = ""; +static FIELD *all_fields[100]; + +/* *INDENT-OFF* */ +static struct { + int code; + int result; + const char *help; +} commands[] = { + { CTRL('A'), REQ_BEG_FIELD, "go to beginning of field" }, + { CTRL('D'), REQ_DOWN_FIELD, "move downward to field" }, + { CTRL('E'), REQ_END_FIELD, "go to end of field" }, + { CTRL('G'), MY_DEMO, "move current field with cursor keys" }, + { CTRL('H'), REQ_DEL_PREV, "delete previous character" }, + { CTRL('I'), REQ_NEXT_FIELD, "go to next field" }, + { CTRL('K'), REQ_CLR_EOF, "clear to end of field" }, + { CTRL('N'), REQ_NEXT_FIELD, "go to next field" }, + { CTRL('P'), REQ_PREV_FIELD, "go to previous field" }, + { CTRL('Q'), MY_QUIT, "exit form" }, + { CTRL('U'), REQ_UP_FIELD, "move upward to field" }, + { CTRL('W'), REQ_NEXT_WORD, "go to next word" }, + { CTRL('X'), REQ_CLR_FIELD, "clear field" }, + { CTRL('['), MY_QUIT, "exit form" }, + { KEY_F(1), MY_HELP, "show this screen", }, + { KEY_BACKSPACE, REQ_DEL_PREV, "delete previous character" }, + { KEY_BTAB, REQ_PREV_FIELD, "go to previous field" }, + { KEY_DOWN, REQ_DOWN_CHAR, "move down 1 character" }, + { KEY_END, REQ_LAST_FIELD, "go to last field" }, + { KEY_HOME, REQ_FIRST_FIELD, "go to first field" }, + { KEY_LEFT, REQ_LEFT_CHAR, "move left 1 character" }, + { KEY_NEXT, REQ_NEXT_FIELD, "go to next field" }, + { KEY_PREVIOUS, REQ_PREV_FIELD, "go to previous field" }, + { KEY_RIGHT, REQ_RIGHT_CHAR, "move right 1 character" }, + { KEY_UP, REQ_UP_CHAR, "move up 1 character" } +}; +/* *INDENT-ON* */ + +static void +my_help_edit_field(void) +{ + int used = 0; + unsigned n; + char **msgs = typeCalloc(char *, 3 + SIZEOF(commands)); + + msgs[used++] = strdup("Defined form edit/traversal keys:"); + for (n = 0; n < SIZEOF(commands); ++n) { + char *msg; + const char *name; + const char *code = keyname(commands[n].code); + size_t need = 5; +#ifdef NCURSES_VERSION + if ((name = form_request_name(commands[n].result)) == 0) +#endif + name = commands[n].help; + need = 5 + strlen(code) + strlen(name); + msg = typeMalloc(char, need); + _nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name); + msgs[used++] = msg; + } + msgs[used++] = + strdup("Arrow keys move within a field as you would expect."); + msgs[used] = 0; + popup_msg2(stdscr, msgs); + for (n = 0; msgs[n] != 0; ++n) { + free(msgs[n]); + } + free(msgs); +} + +static void +do_demo(FORM *form) +{ +} + +static FIELD * +make_label(const char *label, int frow, int fcol) +{ + FIELD *f = new_field(1, (int) strlen(label), frow, fcol, 0, 0); + + if (f) { + set_field_buffer(f, 0, label); + set_field_opts(f, (int) ((unsigned) field_opts(f) & ~O_ACTIVE)); + } + return (f); +} + +static FIELD * +make_field(int frow, int fcol, int rows, int cols) +{ + FIELD *f = new_field(rows, cols, frow, fcol, 0, 1); + + if (f) { + set_field_back(f, A_UNDERLINE); + init_edit_field(f, empty); + } + return (f); +} + +static void +erase_form(FORM *f) +{ + WINDOW *w = form_win(f); + WINDOW *s = form_sub(f); + + unpost_form(f); + werase(w); + wrefresh(w); + delwin(s); + delwin(w); +} + +static int +my_form_driver(FORM *form, int c) +{ + switch (c) { + case MY_QUIT: + if (form_driver(form, REQ_VALIDATION) == E_OK) + return (TRUE); + break; + case MY_HELP: + my_help_edit_field(); + break; + case MY_DEMO: + do_demo(form); + break; + default: + beep(); + break; + } + return (FALSE); +} + +static FieldAttrs * +my_field_attrs(FIELD *f) +{ + return (FieldAttrs *) field_userptr(f); +} + +static int +buffer_length(FIELD *f) +{ + return my_field_attrs(f)->row_lengths[0]; +} + +static void +set_buffer_length(FIELD *f, int length) +{ + my_field_attrs(f)->row_lengths[0] = length; +} + +static int +offset_in_field(FORM *form) +{ + FIELD *field = current_field(form); + int currow, curcol; + + form_getyx(form, currow, curcol); + return curcol + currow * (int) field->dcols; +} + +static void +inactive_field(FIELD *f) +{ + set_field_back(f, my_field_attrs(f)->background); +} + +static int +my_edit_field(FORM *form, int *result) +{ + int ch = wgetch(form_win(form)); + int status; + FIELD *before; + unsigned n; + int length; + int before_row; + int before_col; + int before_off = offset_in_field(form); + + form_getyx(form, before_row, before_col); + before = current_field(form); + set_field_back(before, A_NORMAL); + if (ch <= KEY_MAX) { + set_field_back(before, A_REVERSE); + } else if (ch <= MAX_FORM_COMMAND) { + inactive_field(before); + } + + *result = ch; + for (n = 0; n < SIZEOF(commands); ++n) { + if (commands[n].code == ch) { + *result = commands[n].result; + break; + } + } + + status = form_driver(form, *result); + + if (status == E_OK) { + bool modified = TRUE; + + length = buffer_length(before); + if (length < before_off) + length = before_off; + switch (*result) { + case REQ_CLR_EOF: + length = before_off; + break; + case REQ_CLR_EOL: + if ((int) (before_row + 1) == (int) (before->rows)) + length = before_off; + break; + case REQ_CLR_FIELD: + length = 0; + break; + case REQ_DEL_CHAR: + if (length > before_off) + --length; + break; + case REQ_DEL_PREV: + if (length > 0) { + if (before_col > 0) { + --length; + } else if (before_row > 0) { + length -= (int) before->cols + before_col; + } + } + break; + case REQ_NEW_LINE: + length += (int) before->cols; + break; + + default: + modified = (ch < MIN_FORM_COMMAND + && isprint(ch)); + break; + } + + /* + * If we do not force a re-validation, then field_buffer 0 will + * be lagging by one character. + */ + if (modified && form_driver(form, REQ_VALIDATION) == E_OK && *result + < MIN_FORM_COMMAND) + ++length; + + set_buffer_length(before, length); + } + + if (current_field(form) != before) + inactive_field(before); + return status; +} + +static void +demo_forms(void) +{ + FORM *form; + int c; + unsigned n = 0; + const char *fname; + + /* describe the form */ + all_fields[n++] = make_label("Sample Form", 0, 15); + + fname = "Last Name"; + all_fields[n++] = make_label(fname, 2, 0); + all_fields[n++] = make_field(3, 0, 1, 18); + set_field_type(all_fields[n - 1], TYPE_ALPHA, 1); + + fname = "First Name"; + all_fields[n++] = make_label(fname, 2, 20); + all_fields[n++] = make_field(3, 20, 1, 12); + set_field_type(all_fields[n - 1], TYPE_ALPHA, 1); + + fname = "Middle Name"; + all_fields[n++] = make_label(fname, 2, 34); + all_fields[n++] = make_field(3, 34, 1, 12); + set_field_type(all_fields[n - 1], TYPE_ALPHA, 1); + + fname = "Comments"; + all_fields[n++] = make_label(fname, 5, 0); + all_fields[n++] = make_field(6, 0, 4, 46); + init_edit_field(all_fields[n - 1], empty); + + all_fields[n] = (FIELD *) 0; + + if ((form = new_form(all_fields)) != 0) { + int finished = 0; + + post_form(form); + + while (!finished) { + switch (my_edit_field(form, &c)) { + case E_OK: + break; + case E_UNKNOWN_COMMAND: + finished = my_form_driver(form, c); + break; + default: + beep(); + break; + } + } + + erase_form(form); + + free_form(form); + } + for (c = 0; all_fields[c] != 0; c++) { + free_edit_field(all_fields[c]); + free_field(all_fields[c]); + } + noraw(); + nl(); +} + +int +main(void) +{ + setlocale(LC_ALL, ""); + + initscr(); + cbreak(); + noecho(); + raw(); + nonl(); /* lets us read ^M's */ + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + + if (has_colors()) { + start_color(); + init_pair(1, COLOR_WHITE, COLOR_BLUE); + init_pair(2, COLOR_GREEN, COLOR_BLACK); + init_pair(3, COLOR_CYAN, COLOR_BLACK); + bkgd((chtype) COLOR_PAIR(1)); + refresh(); + } + + demo_forms(); + + endwin(); + ExitProgram(EXIT_SUCCESS); +} + +#else +int +main(void) +{ + printf("This program requires the curses form library\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/contrib/ncurses/test/move_field.c b/contrib/ncurses/test/move_field.c new file mode 100644 index 000000000000..8344c56f8c14 --- /dev/null +++ b/contrib/ncurses/test/move_field.c @@ -0,0 +1,524 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ +/* + * $Id: move_field.c,v 1.7 2020/05/09 12:52:00 tom Exp $ + * + * Demonstrate move_field(). + */ + +#include + +#if USE_LIBFORM + +#include +#include + +#ifdef HAVE_NETBSD_FORM_H +#define form_field_row(field) (field)->form_row +#define form_field_col(field) (field)->form_col +#else /* e.g., SVr4, ncurses */ +#define form_field_row(field) (field)->frow +#define form_field_col(field) (field)->fcol +#endif + +#define DO_DEMO CTRL('F') /* actual key for toggling demo-mode */ +#define MY_DEMO EDIT_FIELD('f') /* internal request-code */ + +static char empty[] = ""; +static FIELD *all_fields[100]; + +/* *INDENT-OFF* */ +static struct { + int code; + int result; + const char *help; +} commands[] = { + { CTRL('A'), REQ_BEG_FIELD, "go to beginning of field" }, + { CTRL('D'), REQ_DOWN_FIELD, "move downward to field" }, + { CTRL('E'), REQ_END_FIELD, "go to end of field" }, + { CTRL('H'), REQ_DEL_PREV, "delete previous character" }, + { CTRL('I'), REQ_NEXT_FIELD, "go to next field" }, + { CTRL('K'), REQ_CLR_EOF, "clear to end of field" }, + { CTRL('N'), REQ_NEXT_FIELD, "go to next field" }, + { CTRL('P'), REQ_PREV_FIELD, "go to previous field" }, + { CTRL('Q'), MY_QUIT, "exit form" }, + { CTRL('U'), REQ_UP_FIELD, "move upward to field" }, + { CTRL('W'), REQ_NEXT_WORD, "go to next word" }, + { CTRL('X'), REQ_CLR_FIELD, "clear field" }, + { CTRL('['), MY_QUIT, "exit form" }, + { KEY_F(1), MY_HELP, "show this screen", }, + { KEY_BACKSPACE, REQ_DEL_PREV, "delete previous character" }, + { KEY_BTAB, REQ_PREV_FIELD, "go to previous field" }, + { KEY_DOWN, REQ_DOWN_CHAR, "move down 1 character" }, + { KEY_END, REQ_LAST_FIELD, "go to last field" }, + { KEY_HOME, REQ_FIRST_FIELD, "go to first field" }, + { KEY_LEFT, REQ_LEFT_CHAR, "move left 1 character" }, + { KEY_NEXT, REQ_NEXT_FIELD, "go to next field" }, + { KEY_PREVIOUS, REQ_PREV_FIELD, "go to previous field" }, + { KEY_RIGHT, REQ_RIGHT_CHAR, "move right 1 character" }, + { KEY_UP, REQ_UP_CHAR, "move up 1 character" }, + { DO_DEMO, MY_DEMO, "move current field with cursor keys" } +}; +/* *INDENT-ON* */ + +static void +my_help_edit_field(void) +{ + int used = 0; + unsigned n; + char **msgs = typeCalloc(char *, 3 + SIZEOF(commands)); + + msgs[used++] = strdup("Defined form edit/traversal keys:"); + for (n = 0; n < SIZEOF(commands); ++n) { + char *msg; + const char *name; + const char *code = keyname(commands[n].code); + size_t need = 5; +#ifdef NCURSES_VERSION + if ((name = form_request_name(commands[n].result)) == 0) +#endif + name = commands[n].help; + need = 5 + strlen(code) + strlen(name); + msg = typeMalloc(char, need); + _nc_SPRINTF(msg, _nc_SLIMIT(need) "%s -- %s", code, name); + msgs[used++] = msg; + } + msgs[used++] = + strdup("Arrow keys move within a field as you would expect."); + msgs[used] = 0; + popup_msg2(stdscr, msgs); + for (n = 0; msgs[n] != 0; ++n) { + free(msgs[n]); + } + free(msgs); +} + +static FIELD * +make_label(const char *label, int frow, int fcol) +{ + FIELD *f = new_field(1, (int) strlen(label), frow, fcol, 0, 0); + + if (f) { + set_field_buffer(f, 0, label); + set_field_opts(f, (int) ((unsigned) field_opts(f) & ~O_ACTIVE)); + } + return (f); +} + +static FIELD * +make_field(int frow, int fcol, int rows, int cols) +{ + FIELD *f = new_field(rows, cols, frow, fcol, 0, 1); + + if (f) { + set_field_back(f, A_UNDERLINE); + init_edit_field(f, empty); + } + return (f); +} + +static void +erase_form(FORM *f) +{ + WINDOW *w = form_win(f); + WINDOW *s = form_sub(f); + + unpost_form(f); + werase(w); + wrefresh(w); + delwin(s); + delwin(w); +} + +static FieldAttrs * +my_field_attrs(FIELD *f) +{ + return (FieldAttrs *) field_userptr(f); +} + +static int +buffer_length(FIELD *f) +{ + return my_field_attrs(f)->row_lengths[0]; +} + +static void +set_buffer_length(FIELD *f, int length) +{ + my_field_attrs(f)->row_lengths[0] = length; +} + +static int +offset_in_field(FORM *form) +{ + FIELD *field = current_field(form); + int currow, curcol; + + form_getyx(form, currow, curcol); + return curcol + currow * (int) field->dcols; +} + +static void +inactive_field(FIELD *f) +{ + set_field_back(f, my_field_attrs(f)->background); +} + +static int +my_edit_field(FORM *form, int *result) +{ + int ch = wgetch(form_win(form)); + int status; + FIELD *before; + unsigned n; + int length; + int before_row; + int before_col; + int before_off = offset_in_field(form); + + form_getyx(form, before_row, before_col); + before = current_field(form); + set_field_back(before, A_NORMAL); + if (ch <= KEY_MAX) { + set_field_back(before, A_REVERSE); + } else if (ch <= MAX_FORM_COMMAND) { + inactive_field(before); + } + + *result = ch; + for (n = 0; n < SIZEOF(commands); ++n) { + if (commands[n].code == ch) { + *result = commands[n].result; + break; + } + } + + status = form_driver(form, *result); + + if (status == E_OK) { + bool modified = TRUE; + + length = buffer_length(before); + if (length < before_off) + length = before_off; + switch (*result) { + case REQ_CLR_EOF: + length = before_off; + break; + case REQ_CLR_EOL: + if ((int) (before_row + 1) == (int) (before->rows)) + length = before_off; + break; + case REQ_CLR_FIELD: + length = 0; + break; + case REQ_DEL_CHAR: + if (length > before_off) + --length; + break; + case REQ_DEL_PREV: + if (length > 0) { + if (before_col > 0) { + --length; + } else if (before_row > 0) { + length -= (int) before->cols + before_col; + } + } + break; + case REQ_NEW_LINE: + length += (int) before->cols; + break; + + default: + modified = (ch < MIN_FORM_COMMAND + && isprint(ch)); + break; + } + + /* + * If we do not force a re-validation, then field_buffer 0 will + * be lagging by one character. + */ + if (modified && form_driver(form, REQ_VALIDATION) == E_OK && *result + < MIN_FORM_COMMAND) + ++length; + + set_buffer_length(before, length); + } + + if (current_field(form) != before) + inactive_field(before); + return status; +} + +static FIELD ** +copy_fields(FIELD **source, size_t length) +{ + FIELD **target = calloc(length + 1, sizeof(FIELD *)); + memcpy(target, source, length * sizeof(FIELD *)); + return target; +} + +/* display a status message to show what's happening */ +static void +show_status(FORM *form, FIELD *field) +{ + WINDOW *sub = form_sub(form); + int currow, curcol; + + getyx(stdscr, currow, curcol); + mvprintw(LINES - 1, 0, + "Field at [%d,%d]. Press %s to quit moving.", + getbegy(sub) + form_field_row(field), + getbegx(sub) + form_field_col(field), + keyname(DO_DEMO)); + clrtobot(); + move(currow, curcol); + refresh(); +} + +/* + * Move the current label+field in response to cursor-keys (or h,j,k,l) until + * a control/F is read. + */ +static void +do_demo(FORM *form) +{ + int count = field_count(form); + FIELD *my_field = current_field(form); + + if (count > 0 && my_field != NULL) { + size_t needed = (size_t) count; + FIELD **old_fields = copy_fields(form_fields(form), needed); + FIELD **new_fields = copy_fields(form_fields(form), needed); + int ch; + + if (old_fields != NULL && new_fields != NULL) { + bool found = FALSE; + + /* TODO: move the label too, in parallel with the editing field */ + + /* remove the current field from the newer list */ + for (ch = 0; ch <= count; ++ch) { + if (found) { + new_fields[ch - 1] = new_fields[ch]; + } else if (new_fields[ch] == my_field) { + found = TRUE; + } + } + + if (found) { + int currow, curcol; + + getyx(stdscr, currow, curcol); + + show_status(form, my_field); + ch = '?'; + while ((ch = wgetch(form_win(form))) != DO_DEMO) { + int field_y = form_field_row(my_field); + int field_x = form_field_col(my_field); + + switch (ch) { + case 'h': + case KEY_LEFT: + if (field_x > 0) + field_x--; + break; + case 'j': + case KEY_DOWN: + field_y++; + break; + case 'k': + case KEY_UP: + if (field_y > 0) + field_y--; + break; + case 'l': + case KEY_RIGHT: + field_x++; + break; + case CTRL('Q'): + case CTRL('['): + ch = DO_DEMO; + /* FALLTHRU */ + case DO_DEMO: + break; + default: + continue; + } + + if (ch == DO_DEMO) + break; + + /* alter connected fields temporarily to move the field */ + unpost_form(form); + set_form_fields(form, new_fields); + post_form(form); + + /* TODO: update screen position on success */ + move_field(my_field, field_y, field_x); + + /* restore the form's list of fields */ + unpost_form(form); + set_form_fields(form, old_fields); + post_form(form); + + show_status(form, my_field); + } + + /* cleanup */ + move(LINES - 1, 0); + clrtobot(); + move(currow, curcol); + refresh(); + } + } + free(new_fields); + } +} + +static int +my_form_driver(FORM *form, int c) +{ + switch (c) { + case MY_QUIT: + if (form_driver(form, REQ_VALIDATION) == E_OK) + return (TRUE); + break; + case MY_HELP: + my_help_edit_field(); + break; + case MY_DEMO: + do_demo(form); + break; + default: + beep(); + break; + } + return (FALSE); +} + +static void +demo_forms(void) +{ + FORM *form; + int c; + unsigned n = 0; + const char *fname; + + /* describe the form */ + all_fields[n++] = make_label("Sample Form", 0, 15); + + fname = "Last Name"; + all_fields[n++] = make_label(fname, 2, 0); + all_fields[n++] = make_field(3, 0, 1, 18); + set_field_type(all_fields[n - 1], TYPE_ALPHA, 1); + + fname = "First Name"; + all_fields[n++] = make_label(fname, 2, 20); + all_fields[n++] = make_field(3, 20, 1, 12); + set_field_type(all_fields[n - 1], TYPE_ALPHA, 1); + + fname = "Middle Name"; + all_fields[n++] = make_label(fname, 2, 34); + all_fields[n++] = make_field(3, 34, 1, 12); + set_field_type(all_fields[n - 1], TYPE_ALPHA, 1); + + fname = "Comments"; + all_fields[n++] = make_label(fname, 5, 0); + all_fields[n++] = make_field(6, 0, 4, 46); + init_edit_field(all_fields[n - 1], empty); + + all_fields[n] = (FIELD *) 0; + + if ((form = new_form(all_fields)) != 0) { + int finished = 0; + + post_form(form); + + while (!finished) { + switch (my_edit_field(form, &c)) { + case E_OK: + break; + case E_UNKNOWN_COMMAND: + finished = my_form_driver(form, c); + break; + default: + beep(); + break; + } + } + + erase_form(form); + + free_form(form); + } + for (c = 0; all_fields[c] != 0; c++) { + free_edit_field(all_fields[c]); + free_field(all_fields[c]); + } + noraw(); + nl(); +} + +int +main(void) +{ + setlocale(LC_ALL, ""); + + initscr(); + cbreak(); + noecho(); + raw(); + nonl(); /* lets us read ^M's */ + intrflush(stdscr, FALSE); + keypad(stdscr, TRUE); + + if (has_colors()) { + start_color(); + init_pair(1, COLOR_WHITE, COLOR_BLUE); + init_pair(2, COLOR_GREEN, COLOR_BLACK); + init_pair(3, COLOR_CYAN, COLOR_BLACK); + bkgd((chtype) COLOR_PAIR(1)); + refresh(); + } + + demo_forms(); + + endwin(); + ExitProgram(EXIT_SUCCESS); +} + +#else +int +main(void) +{ + printf("This program requires the curses form library\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/contrib/ncurses/test/test_tparm.c b/contrib/ncurses/test/test_tparm.c new file mode 100644 index 000000000000..40ffc4fb1d07 --- /dev/null +++ b/contrib/ncurses/test/test_tparm.c @@ -0,0 +1,388 @@ +/**************************************************************************** + * Copyright 2020 Thomas E. Dickey * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/* + * Author: Thomas E. Dickey + * + * $Id: test_tparm.c,v 1.4 2020/05/31 00:51:32 tom Exp $ + * + * Exercise tparm, either for all possible capabilities with fixed parameters, + * or one capability with all possible parameters. + * + * TODO: incorporate tic.h and _nc_tparm_analyze + * TODO: optionally test tiparm + * TODO: add checks/logic to handle "%s" in tparm + */ +#define USE_TINFO +#include + +static void failed(const char *) GCC_NORETURN; + +static void +failed(const char *msg) +{ + fprintf(stderr, "%s\n", msg); + ExitProgram(EXIT_FAILURE); +} + +#if HAVE_TIGETSTR + +static int a_opt; +static int v_opt; + +static int +isNumeric(char *source) +{ + char *next = 0; + long value = strtol(source, &next, 0); + int result = (next == 0 || next == source || *next != '\0') ? 0 : 1; + (void) value; + return result; +} + +static char * +validate(const char *name) +{ + char *value = tigetstr(name); + if (!VALID_STRING(value)) { + if (v_opt > 1) { + printf("? %s %s\n", + (value == ABSENT_STRING) + ? "absent" + : "cancel", + name); + } + value = 0; + } + return value; +} + +static int +increment(int *all_parms, int *num_parms, int len_parms, int end_parms) +{ + int rc = 0; + int n; + + if (len_parms > 9) + len_parms = 9; + + if (end_parms < len_parms) { + if (all_parms[end_parms]++ >= num_parms[end_parms]) { + all_parms[end_parms] = 0; + increment(all_parms, num_parms, len_parms, end_parms + 1); + } + } + for (n = 0; n < len_parms; ++n) { + if (all_parms[n] != 0) { + rc = 1; + break; + } + } + /* return 1 until the vector resets to all 0's */ + return rc; +} + +static void +test_tparm(const char *name, int *number) +{ + char *format = tigetstr(name); + if ((format = validate(name)) != 0) { + char *result = tparm(format, + number[0], + number[1], + number[2], + number[3], + number[4], + number[5], + number[6], + number[7], + number[8]); + if (v_opt > 1) + printf(".. %2d = %2d %2d %2d %2d %2d %2d %2d %2d %2d %s\n", + result != 0 ? (int) strlen(result) : -1, + number[0], + number[1], + number[2], + number[3], + number[4], + number[5], + number[6], + number[7], + number[8], + name); + } +} + +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: test_tparm [options] [capability] [value1 [value2 [...]]]", + "", + "Print all distinct combinations of given capability.", + "", + "Options:", + " -T TERM override $TERM; this may be a comma-separated list or \"-\"", + " to read a list from standard-input", + " -a if capability is given, test all combinations of values", + " -r NUM repeat tests NUM times", + " -v show values and results", + }; + unsigned n; + for (n = 0; n < SIZEOF(msg); ++n) { + fprintf(stderr, "%s\n", msg[n]); + } + ExitProgram(EXIT_FAILURE); +} + +#define PLURAL(n) n, (n != 1) ? "s" : "" +#define COLONS(n) (n >= 1) ? ":" : "" + +int +main(int argc, char *argv[]) +{ + int n; + int r_run, t_run, n_run; + char *old_term = getenv("TERM"); + int r_opt = 1; + char *t_opt = 0; + int len_names = 0; /* cur # of items in all_names[] */ + int use_names = 10; /* max # of items in all_names[] */ + char **all_names = typeCalloc(char *, use_names); + int all_parms[10]; /* workspace for "-a" option */ + int len_terms = 0; /* cur # of items in all_terms[] */ + int use_terms = 10; /* max # of items in all_terms[] */ + char **all_terms = typeCalloc(char *, use_terms); + int len_parms = 0; /* cur # of items in num_parms[], str_parms[] */ + int use_parms = argc + 10; /* max # of items in num_parms[], str_parms[] */ + int *num_parms = typeCalloc(int, use_parms); + char **str_parms = typeCalloc(char *, use_parms); + + if (all_names == 0 || all_terms == 0 || num_parms == 0 || str_parms == 0) + failed("no memory"); + + while ((n = getopt(argc, argv, "T:ar:v")) != -1) { + switch (n) { + case 'T': + t_opt = optarg; + break; + case 'a': + ++a_opt; + break; + case 'r': + r_opt = atoi(optarg); + break; + case 'v': + ++v_opt; + break; + default: + usage(); + break; + } + } + + /* + * If there is a nonnumeric parameter after the options, use that as the + * capability name. + */ + if (optind < argc) { + if (!isNumeric(argv[optind])) { + all_names[len_names++] = strdup(argv[optind++]); + } + } + + /* + * Any remaining arguments must be possible parameter values. If numeric, + * and "-a" is not set, use those as the maximum values within which the + * test parameters should vary. + */ + while (optind < argc) { + if (isNumeric(argv[optind])) { + char *dummy = 0; + long value = strtol(argv[optind], &dummy, 0); + num_parms[len_parms] = (int) value; + } + str_parms[len_parms] = argv[optind]; + ++optind; + ++len_parms; + } + for (n = len_parms; n < use_parms; ++n) { + static char dummy[1]; + str_parms[n] = dummy; + } + if (v_opt) { + printf("%d parameter%s%s\n", PLURAL(len_parms), COLONS(len_parms)); + for (n = 0; n < len_parms; ++n) { + printf(" %d: %d (%s)\n", n + 1, num_parms[n], str_parms[n]); + } + } + + /* + * Make a list of values for $TERM. Accept "-" for standard input to + * simplify scripting a check of the whole database. + */ + old_term = strdup((old_term == 0) ? "unknown" : old_term); + if (t_opt != 0) { + if (!strcmp(t_opt, "-")) { + char buffer[BUFSIZ]; + while (fgets(buffer, sizeof(buffer) - 1, stdin) != 0) { + char *s = buffer; + char *t; + while (isspace(UChar(s[0]))) + ++s; + t = s + strlen(s); + while (t != s && isspace(UChar(t[-1]))) + *--t = '\0'; + s = strdup(s); + if (len_terms + 2 >= use_terms) { + use_terms *= 2; + all_terms = typeRealloc(char *, use_terms, all_terms); + if (all_terms == 0) + failed("no memory: all_terms"); + } + all_terms[len_terms++] = s; + } + } else { + char *s = t_opt; + char *t; + while ((t = strtok(s, ",")) != 0) { + s = 0; + if (len_terms + 2 >= use_terms) { + use_terms *= 2; + all_terms = typeRealloc(char *, use_terms, all_terms); + if (all_terms == 0) + failed("no memory: all_terms"); + } + all_terms[len_terms++] = strdup(t); + } + } + } else { + all_terms[len_terms++] = strdup(old_term); + } + all_terms[len_terms] = 0; + if (v_opt) { + printf("%d term%s:\n", PLURAL(len_terms)); + for (n = 0; n < len_terms; ++n) { + printf(" %d: %s\n", n + 1, all_terms[n]); + } + } + + /* + * If no capability name was selected, use the predefined list of string + * capabilities. + * + * TODO: To address the "other" systems which do not follow SVr4, + * just use the output from infocmp on $TERM. + */ + if (len_names == 0) { +#if defined(HAVE_CURSES_DATA_BOOLNAMES) || defined(DECL_CURSES_DATA_BOOLNAMES) + for (n = 0; strnames[n] != 0; ++n) { + if (len_names + 2 >= use_names) { + use_names *= 2; + all_names = typeRealloc(char *, use_names, all_names); + if (all_names == 0) { + failed("no memory: all_names"); + } + } + all_names[len_names++] = strdup(strnames[n]); + } +#else + all_names[len_names++] = strdup("cup"); + all_names[len_names++] = strdup("sgr"); +#endif + } + all_names[len_names] = 0; + if (v_opt) { + printf("%d name%s%s\n", PLURAL(len_names), COLONS(len_names)); + for (n = 0; n < len_names; ++n) { + printf(" %d: %s\n", n + 1, all_names[n]); + } + } + + if (r_opt <= 0) + r_opt = 1; + + for (r_run = 0; r_run < r_opt; ++r_run) { + for (t_run = 0; t_run < len_terms; ++t_run) { + int errs; + + if (setupterm(all_terms[t_run], fileno(stdout), &errs) != OK) { + printf("** skipping %s (errs:%d)\n", all_terms[t_run], errs); + } + + if (v_opt) + printf("** testing %s\n", all_terms[t_run]); + if (len_names == 1) { + if (a_opt) { + /* for each combination of values */ + memset(all_parms, 0, sizeof(all_parms)); + do { + test_tparm(all_names[0], all_parms); + } + while (increment(all_parms, num_parms, len_parms, 0)); + } else { + /* for the given values */ + test_tparm(all_names[0], num_parms); + } + } else { + for (n_run = 0; n_run < len_names; ++n_run) { + test_tparm(all_names[n_run], num_parms); + } + } + if (cur_term != 0) { + del_curterm(cur_term); + } else { + printf("? no cur_term\n"); + } + } + } +#if NO_LEAKS + for (n = 0; n < len_names; ++n) { + free(all_names[n]); + } + free(all_names); + free(old_term); + for (n = 0; n < len_terms; ++n) { + free(all_terms[n]); + } + free(all_terms); + free(num_parms); + free(str_parms); +#endif + + ExitProgram(EXIT_SUCCESS); +} + +#else /* !HAVE_TIGETSTR */ +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + failed("This program requires the terminfo functions such as tigetstr"); +} +#endif /* HAVE_TIGETSTR */