#! /bin/sh # # This is patch #1 to gawk 3.1. cd to gawk-3.1.0 and sh this file. # Then remove all the .orig files and rename the directory gawk-3.1.1 # Changes to files that are automatically recreated have been omitted. # They will be recreated the first time you run make. # This includes all the extracted example files in awklib. # You will need Texinfo 4.2 or later to remake the doc/*.info files. # First, slight rearranging: echo Removing old / obselete files rm -f \ Makefile.in \ aclocal.m4 \ awklib/Makefile.in \ configure \ doc/Makefile.in \ doc/uf002331.eps \ doc/uf002331.jpg \ intl/* \ missing_d/strftime.3 \ missing_d/strftime.c \ po/Makefile.in.in \ po/cat-id-tbl.c \ po/stamp-cat-id \ test/Makefile.in # Now, apply the patch: echo Applying patch patch -p1 << \EOF diff -crN gawk-3.1.0/ABOUT-NLS gawk-3.1.1/ABOUT-NLS *** gawk-3.1.0/ABOUT-NLS Wed Feb 16 09:57:30 2000 --- gawk-3.1.1/ABOUT-NLS Sun Apr 28 17:01:51 2002 *************** *** 8,14 **** If you found this `ABOUT-NLS' file inside a distribution, you may assume that the distributed package does use GNU `gettext' internally, ! itself available at your nearest GNU archive site. But you do *not* need to install GNU `gettext' prior to configuring, installing or using this package with messages translated. --- 8,14 ---- If you found this `ABOUT-NLS' file inside a distribution, you may assume that the distributed package does use GNU `gettext' internally, ! itself available at your nearest GNU archive site. But you do _not_ need to install GNU `gettext' prior to configuring, installing or using this package with messages translated. *************** *** 22,29 **** `gettext' which is used. The information can be found in the `intl/VERSION' file, in internationalized packages. ! One advise in advance ! ===================== If you want to exploit the full power of internationalization, you should configure it using --- 22,29 ---- `gettext' which is used. The information can be found in the `intl/VERSION' file, in internationalized packages. ! Quick configuration advice ! ========================== If you want to exploit the full power of internationalization, you should configure it using *************** *** 34,46 **** package, despite the existence of internationalizing capabilities in the operating system where this package is being installed. So far, only the `gettext' implementation in the GNU C library version 2 provides as ! many features (such as locale alias or message inheritance) as the ! implementation here. It is also not possible to offer this additional ! functionality on top of a `catgets' implementation. Future versions of ! GNU `gettext' will very likely convey even more functionality. So it ! might be a good idea to change to GNU `gettext' as soon as possible. ! So you need not provide this option if you are using GNU libc 2 or you have installed a recent copy of the GNU gettext package with the included `libintl'. --- 34,47 ---- package, despite the existence of internationalizing capabilities in the operating system where this package is being installed. So far, only the `gettext' implementation in the GNU C library version 2 provides as ! many features (such as locale alias, message inheritance, automatic ! charset conversion or plural form handling) as the implementation here. ! It is also not possible to offer this additional functionality on top ! of a `catgets' implementation. Future versions of GNU `gettext' will ! very likely convey even more functionality. So it might be a good idea ! to change to GNU `gettext' as soon as possible. ! So you need _not_ provide this option if you are using GNU libc 2 or you have installed a recent copy of the GNU gettext package with the included `libintl'. *************** *** 53,75 **** ways to internationalization, predating GNU `gettext'. By default, this package will be installed to allow translation of ! messages. It will automatically detect whether the system provides ! usable `catgets' (if using this is selected by the installer) or ! `gettext' functions. If neither is available, the GNU `gettext' own library will be used. This library is wholly contained within this package, usually in the `intl/' subdirectory, so prior installation of ! the GNU `gettext' package is *not* required. Installers may use special options at configuration time for changing the default behaviour. The commands: ./configure --with-included-gettext - ./configure --with-catgets ./configure --disable-nls ! will respectively bypass any pre-existing `catgets' or `gettext' to use ! the internationalizing routines provided within this package, enable ! the use of the `catgets' functions (if found on the locale system), or ! else, *totally* disable translation of messages. When you already have GNU `gettext' installed on your system and run configure without an option for your new package, `configure' will --- 54,73 ---- ways to internationalization, predating GNU `gettext'. By default, this package will be installed to allow translation of ! messages. It will automatically detect whether the system already ! provides the GNU `gettext' functions. If not, the GNU `gettext' own library will be used. This library is wholly contained within this package, usually in the `intl/' subdirectory, so prior installation of ! the GNU `gettext' package is _not_ required. Installers may use special options at configuration time for changing the default behaviour. The commands: ./configure --with-included-gettext ./configure --disable-nls ! will respectively bypass any pre-existing `gettext' to use the ! internationalizing routines provided within this package, or else, ! _totally_ disable translation of messages. When you already have GNU `gettext' installed on your system and run configure without an option for your new package, `configure' will *************** *** 83,100 **** to prevent auto-detection. ! By default the configuration process will not test for the `catgets' ! function and therefore they will not be used. The reasons are already ! given above: the emulation on top of `catgets' cannot provide all the ! extensions provided by the GNU `gettext' library. If you nevertheless ! want to use the `catgets' functions use ! ! ./configure --with-catgets ! ! to enable the test for `catgets' (this causes no harm if `catgets' is ! not available on your system). If you really select this option we ! would like to hear about the reasons because we cannot think of any ! good one ourself. Internationalized packages have usually many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless --- 81,90 ---- to prevent auto-detection. ! The configuration process will not test for the `catgets' function ! and therefore it will not be used. The reason is that even an ! emulation of `gettext' on top of `catgets' could not provide all the ! extensions of the GNU `gettext' library. Internationalized packages have usually many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. Unless *************** *** 110,131 **** As a user, if your language has been installed for this package, you only have to set the `LANG' environment variable to the appropriate ! ISO 639 `LL' two-letter code prior to using the programs in the ! package. For example, let's suppose that you speak German. At the ! shell prompt, merely execute `setenv LANG de' (in `csh'), ! `export LANG; LANG=de' (in `sh') or `export LANG=de' (in `bash'). This ! can be done from your `.login' or `.profile' file, once and for all. ! ! An operating system might already offer message localization for ! many of its programs, while other programs have been installed locally ! with the full capabilities of GNU `gettext'. Just using `gettext' ! extended syntax for `LANG' would break proper localization of already ! available operating system programs. In this case, users should set ! both `LANGUAGE' and `LANG' variables in their environment, as programs ! using GNU `gettext' give preference to `LANGUAGE'. For example, some ! Swedish users would rather read translations in German than English for ! when Swedish is not available. This is easily accomplished by setting ! `LANGUAGE' to `sv:de' while leaving `LANG' to `sv'. Translating Teams ================= --- 100,141 ---- As a user, if your language has been installed for this package, you only have to set the `LANG' environment variable to the appropriate ! `LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, ! and `CC' is an ISO 3166 two-letter country code. For example, let's ! suppose that you speak German and live in Germany. At the shell ! prompt, merely execute `setenv LANG de_DE' (in `csh'), ! `export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). ! This can be done from your `.login' or `.profile' file, once and for ! all. ! ! You might think that the country code specification is redundant. ! But in fact, some languages have dialects in different countries. For ! example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The ! country code serves to distinguish the dialects. ! ! The locale naming convention of `LL_CC', with `LL' denoting the ! language and `CC' denoting the country, is the one use on systems based ! on GNU libc. On other systems, some variations of this scheme are ! used, such as `LL' or `LL_CC.ENCODING'. You can get the list of ! locales supported by your system for your country by running the command ! `locale -a | grep '^LL''. ! ! Not all programs have translations for all languages. By default, an ! English message is shown in place of a nonexistent translation. If you ! understand other languages, you can set up a priority list of languages. ! This is done through a different environment variable, called ! `LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' ! for the purpose of message handling, but you still need to have `LANG' ! set to the primary language; this is required by other parts of the ! system libraries. For example, some Swedish users who would rather ! read translations in German than English for when Swedish is not ! available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. ! ! In the `LANGUAGE' environment variable, but not in the `LANG' ! environment variable, `LL_CC' combinations can be abbreviated as `LL' ! to denote the language's main dialect. For example, `de' is equivalent ! to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' ! (Portuguese as spoken in Portugal) in this context. Translating Teams ================= *************** *** 133,165 **** For the Free Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. ! Each translation team has its own mailing list, courtesy of Linux ! International. You may reach your translation team at the address ! `LL@li.org', replacing LL by the two-letter ISO 639 code for your ! language. Language codes are *not* the same as the country codes given ! in ISO 3166. The following translation teams exist, as of December ! 1997: ! ! Chinese `zh', Czech `cs', Danish `da', Dutch `nl', English `en', ! Esperanto `eo', Finnish `fi', French `fr', German `de', Hungarian ! `hu', Irish `ga', Italian `it', Indonesian `id', Japanese `ja', ! Korean `ko', Latin `la', Norwegian `no', Persian `fa', Polish ! `pl', Portuguese `pt', Russian `ru', Slovenian `sl', Spanish `es', ! Swedish `sv', and Turkish `tr'. ! For example, you may reach the Chinese translation team by writing to ! `zh@li.org'. ! ! If you'd like to volunteer to *work* at translating messages, you should become a member of the translating team for your own language. ! The subscribing address is *not* the same as the list itself, it has `-request' appended. For example, speakers of Swedish can send a message to `sv-request@li.org', having this message body: subscribe Keep in mind that team members are expected to participate ! *actively* in translations, or at solving translational difficulties, rather than merely lurking around. If your team does not exist yet and you want to start one, or if you are unsure about what to do or how to get started, please write to `translation@iro.umontreal.ca' to reach the --- 143,163 ---- For the Free Translation Project to be a success, we need interested people who like their own language and write it well, and who are also able to synergize with other translators speaking the same language. ! Each translation team has its own mailing list. The up-to-date list of ! teams can be found at the Free Translation Project's homepage, ! `http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" ! area. ! If you'd like to volunteer to _work_ at translating messages, you should become a member of the translating team for your own language. ! The subscribing address is _not_ the same as the list itself, it has `-request' appended. For example, speakers of Swedish can send a message to `sv-request@li.org', having this message body: subscribe Keep in mind that team members are expected to participate ! _actively_ in translations, or at solving translational difficulties, rather than merely lurking around. If your team does not exist yet and you want to start one, or if you are unsure about what to do or how to get started, please write to `translation@iro.umontreal.ca' to reach the *************** *** 173,214 **** ================== Languages are not equally supported in all packages. The following ! matrix shows the current state of internationalization, as of December ! 1997. The matrix shows, in regard of each package, for which languages ! PO files have been submitted to translation coordination. ! ! Ready PO files cs da de en es fi fr it ja ko nl no pl pt ru sl sv ! .----------------------------------------------------. ! bash | [] [] [] | 3 ! bison | [] [] [] | 3 ! clisp | [] [] [] [] | 4 ! cpio | [] [] [] [] [] [] | 6 ! diffutils | [] [] [] [] [] | 5 ! enscript | [] [] [] [] [] [] | 6 ! fileutils | [] [] [] [] [] [] [] [] [] [] | 10 ! findutils | [] [] [] [] [] [] [] [] [] | 9 ! flex | [] [] [] [] | 4 ! gcal | [] [] [] [] [] | 5 ! gettext | [] [] [] [] [] [] [] [] [] [] [] | 12 ! grep | [] [] [] [] [] [] [] [] [] [] | 10 ! hello | [] [] [] [] [] [] [] [] [] [] [] | 11 ! id-utils | [] [] [] | 3 ! indent | [] [] [] [] [] | 5 ! libc | [] [] [] [] [] [] [] | 7 ! m4 | [] [] [] [] [] [] | 6 ! make | [] [] [] [] [] [] | 6 ! music | [] [] | 2 ! ptx | [] [] [] [] [] [] [] [] | 8 ! recode | [] [] [] [] [] [] [] [] [] | 9 ! sh-utils | [] [] [] [] [] [] [] [] | 8 ! sharutils | [] [] [] [] [] [] | 6 ! tar | [] [] [] [] [] [] [] [] [] [] [] | 11 ! texinfo | [] [] [] | 3 ! textutils | [] [] [] [] [] [] [] [] [] | 9 ! wdiff | [] [] [] [] [] [] [] [] | 8 ! `----------------------------------------------------' ! 17 languages cs da de en es fi fr it ja ko nl no pl pt ru sl sv ! 27 packages 6 4 25 1 18 1 26 2 1 12 20 9 19 7 4 7 17 179 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are --- 171,372 ---- ================== Languages are not equally supported in all packages. The following ! matrix shows the current state of internationalization, as of April ! 2002. The matrix shows, in regard of each package, for which languages ! PO files have been submitted to translation coordination, with a ! translation percentage of at least 50%. ! ! Ready PO files bg ca cs da de el en eo es et fi fr ! +-------------------------------------+ ! a2ps | [] [] [] [] | ! bash | [] [] [] [] | ! bfd | [] [] | ! binutils | [] [] | ! bison | [] [] [] [] | ! clisp | [] [] [] [] | ! cpio | [] [] [] [] | ! diffutils | [] [] [] [] [] [] | ! enscript | [] [] | ! error | [] [] | ! fetchmail | [] () [] [] [] () | ! fileutils | [] [] [] [] [] | ! findutils | [] [] [] [] [] | ! flex | [] [] [] [] [] | ! gas | [] [] | ! gawk | [] [] [] | ! gcal | [] [] | ! gcc | [] [] | ! gettext | [] [] [] [] [] | ! gnupg | [] [] [] [] [] [] | ! gprof | [] [] | ! gpsdrive | () () () () () | ! grep | [] [] [] [] [] [] [] | ! gretl | | ! hello | [] [] [] [] [] [] [] [] | ! id-utils | [] [] [] | ! indent | [] [] [] [] [] | ! jpilot | () [] [] [] | ! jwhois | [] [] | ! kbd | [] [] | ! ld | [] [] | ! libc | [] [] [] [] [] [] [] | ! lilypond | [] [] | ! lynx | [] [] [] [] | ! m4 | [] [] [] [] [] | ! make | [] [] [] [] | ! mysecretdiary | [] [] | ! nano | [] () [] [] [] [] | ! nano_1_0 | [] () [] [] [] [] | ! opcodes | [] [] [] | ! parted | [] [] [] [] [] | ! ptx | [] [] [] [] [] | ! python | | ! recode | [] [] [] [] [] [] | ! sed | [] [] [] [] [] [] [] [] | ! sh-utils | [] [] [] [] [] [] [] [] | ! sharutils | [] [] [] [] [] [] | ! sketch | () [] () | ! soundtracker | [] [] [] | ! sp | [] | ! tar | [] [] [] [] [] [] | ! texinfo | [] [] [] [] [] | ! textutils | [] [] [] [] [] | ! util-linux | [] [] [] [] [] [] | ! vorbis-tools | | ! wastesedge | | ! wdiff | [] [] [] [] [] [] | ! wget | [] [] [] [] [] [] [] [] [] | ! +-------------------------------------+ ! bg ca cs da de el en eo es et fi fr ! 2 14 11 31 40 10 1 8 41 16 1 50 ! ! gl he hr hu id it ja ko lv nb nl nn ! +-------------------------------------+ ! a2ps | () () [] | ! bash | | ! bfd | [] | ! binutils | [] | ! bison | [] [] | ! clisp | [] | ! cpio | [] [] [] | ! diffutils | [] [] [] [] | ! enscript | [] [] | ! error | [] | ! fetchmail | [] | ! fileutils | [] [] [] | ! findutils | [] [] [] [] [] [] [] | ! flex | [] | ! gas | | ! gawk | [] | ! gcal | | ! gcc | | ! gettext | [] [] | ! gnupg | [] [] [] [] | ! gprof | | ! gpsdrive | () () | ! grep | [] [] [] [] [] [] | ! gretl | | ! hello | [] [] [] [] [] [] [] [] [] [] [] [] | ! id-utils | [] | ! indent | [] [] [] | ! jpilot | () () | ! jwhois | [] | ! kbd | | ! ld | | ! libc | [] [] [] [] | ! lilypond | [] [] | ! lynx | [] [] [] | ! m4 | [] [] [] [] | ! make | [] [] [] [] [] [] | ! mysecretdiary | | ! nano | [] [] [] () [] [] [] | ! nano_1_0 | [] [] [] () [] [] | ! opcodes | [] | ! parted | [] [] [] | ! ptx | [] [] [] [] | ! python | | ! recode | [] [] [] | ! sed | [] [] [] [] [] [] [] | ! sh-utils | [] [] [] [] [] | ! sharutils | [] [] [] | ! sketch | () | ! soundtracker | [] | ! sp | | ! tar | [] [] [] [] [] | ! texinfo | [] [] [] | ! textutils | [] [] [] | ! util-linux | () [] | ! vorbis-tools | | ! wastesedge | | ! wdiff | [] [] | ! wget | [] [] [] [] [] [] | ! +-------------------------------------+ ! gl he hr hu id it ja ko lv nb nl nn ! 23 9 8 4 12 12 25 9 1 8 20 4 ! ! no pl pt pt_BR ru sk sl sv tr uk zh_TW ! +----------------------------------------+ ! a2ps | () () () [] [] [] [] () | 9 ! bash | | 4 ! bfd | [] [] | 5 ! binutils | [] | 4 ! bison | [] [] [] | 9 ! clisp | | 5 ! cpio | [] [] [] [] | 11 ! diffutils | [] [] [] [] [] [] | 16 ! enscript | [] [] [] | 7 ! error | [] [] [] | 6 ! fetchmail | () () [] | 6 ! fileutils | [] [] [] [] [] | 13 ! findutils | [] [] [] [] [] [] [] | 19 ! flex | [] [] [] | 9 ! gas | [] | 3 ! gawk | [] [] | 6 ! gcal | [] [] | 4 ! gcc | [] | 3 ! gettext | [] [] [] [] [] [] | 13 ! gnupg | [] [] [] | 13 ! gprof | [] [] | 4 ! gpsdrive | () | 0 ! grep | [] [] [] [] | 17 ! gretl | | 0 ! hello | [] [] [] [] [] [] [] | 27 ! id-utils | [] [] | 6 ! indent | [] [] [] [] | 12 ! jpilot | () () [] | 4 ! jwhois | () () [] [] | 5 ! kbd | [] [] | 4 ! ld | [] [] | 4 ! libc | [] [] [] [] [] [] | 17 ! lilypond | [] | 5 ! lynx | [] [] [] | 10 ! m4 | [] [] [] | 12 ! make | [] [] [] [] | 14 ! mysecretdiary | [] [] | 4 ! nano | () [] [] [] [] | 15 ! nano_1_0 | () [] [] [] [] | 14 ! opcodes | [] [] | 6 ! parted | [] [] [] | 11 ! ptx | [] [] [] [] [] [] | 15 ! python | | 0 ! recode | [] [] [] [] | 13 ! sed | [] [] [] [] [] [] | 21 ! sh-utils | [] [] [] [] [] [] [] [] [] | 22 ! sharutils | [] [] [] [] | 13 ! sketch | [] () | 3 ! soundtracker | [] | 5 ! sp | | 1 ! tar | [] [] [] [] [] [] [] | 18 ! texinfo | [] [] | 10 ! textutils | [] [] [] [] [] | 13 ! util-linux | [] [] [] | 10 ! vorbis-tools | [] | 1 ! wastesedge | | 0 ! wdiff | [] [] [] [] | 12 ! wget | [] [] [] [] [] [] [] [] | 23 ! +----------------------------------------+ ! 35 teams no pl pt pt_BR ru sk sl sv tr uk zh_TW ! 58 domains 5 16 2 14 27 11 11 41 36 4 9 536 Some counters in the preceding matrix are higher than the number of visible blocks let us expect. This is because a few extra PO files are *************** *** 221,226 **** lag between the mere existence a PO file and its wide availability in a distribution. ! If December 1997 seems to be old, you may fetch a more recent copy ! of this `ABOUT-NLS' file on most GNU archive sites. --- 379,405 ---- lag between the mere existence a PO file and its wide availability in a distribution. ! If April 2002 seems to be old, you may fetch a more recent copy of ! this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date ! matrix with full percentage details can be found at ! `http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. ! ! Using `gettext' in new packages ! =============================== ! ! If you are writing a freely available program and want to ! internationalize it you are welcome to use GNU `gettext' in your ! package. Of course you have to respect the GNU Library General Public ! License which covers the use of the GNU `gettext' library. This means ! in particular that even non-free programs can use `libintl' as a shared ! library, whereas only free software can use `libintl' as a static ! library or use modified versions of `libintl'. ! ! Once the sources are changed appropriately and the setup can handle ! to use of `gettext' the only thing missing are the translations. The ! Free Translation Project is also available for packages which are not ! developed inside the GNU project. Therefore the information given above ! applies also for every other Free Software Project. Contact ! `translation@iro.umontreal.ca' to make the `.pot' files available to ! the translation teams. diff -crN gawk-3.1.0/ChangeLog gawk-3.1.1/ChangeLog *** gawk-3.1.0/ChangeLog Sun Jun 3 13:05:12 2001 --- gawk-3.1.1/ChangeLog Wed May 1 16:41:47 2002 *************** *** 1,3 **** --- 1,656 ---- + Wed May 1 16:41:32 2002 Arnold D. Robbins + + * Release 3.1.1: Release tar file made. + + Wed May 1 16:07:49 2002 Arnold D. Robbins + + * getopt.c: Installed latest version from glibc. + + Sun Apr 28 17:19:07 2002 Arnold D. Robbins + + * fixvers: Changed patterns to allow test versions of the + form `gawk-3.1.1a'. + * patchlev.h: Patchlevel is now a string constant. + * main.c (version): Print patchlevel using %s, not %d. + * Makefile.am: Rework DEFPATH stuff and datadir stuff yet again. + + * config.sub: Updated with current version from ftp.gnu.org. + * config.guess: Ditto. + + Upgrade to gettext-0.11.2: + + * ABOUT-NLS: Replaced with version from gettext 0.11.2. + * config.rpath: Replaced with version from gettext 0.11.2. + * intl/*: Replaced with version from gettext 0.11.2. + * po/Makefile.in.in: Replaced with version from gettext 0.11.2. + * po/Makevars.template: Replaced with version from gettext 0.11.2. + * po/Rules-quot: Replaced with version from gettext 0.11.2. + * po/boldquot.sed: Replaced with version from gettext 0.11.2. + * po/en@boldquot.header: Replaced with version from gettext 0.11.2. + * po/en@quot.header: Replaced with version from gettext 0.11.2. + * po/insert-header.sin: Replaced with version from gettext 0.11.2. + * po/quot.sed: Replaced with version from gettext 0.11.2. + * po/remove-potcdate.sin: Replaced with version from gettext 0.11.2. + * m4/codeset.m4: Replaced with version from gettext 0.11.2. + * m4/gettext.m4: Replaced with version from gettext 0.11.2. + * m4/glibc21.m4: Replaced with version from gettext 0.11.2. + * m4/iconv.m4: Replaced with version from gettext 0.11.2. + * m4/isc-posix.m4: Replaced with version from gettext 0.11.2. + * m4/lcmessage.m4: Replaced with version from gettext 0.11.2. + * m4/lib-ld.m4: Replaced with version from gettext 0.11.2. + * m4/lib-link.m4: Replaced with version from gettext 0.11.2. + * m4/lib-prefix.m4: Replaced with version from gettext 0.11.2. + * m4/progtest.m4: Replaced with version from gettext 0.11.2. + + Wed Apr 17 15:09:45 2002 Arnold D. Robbins + + * regex.c (PREFIX): Change test for token concatenation ability + to `#ifdef HAVE_STRINGIZE'. If a cpp has one, it ought to have + the other. + + Tue Apr 16 12:26:06 2002 Arnold D. Robbins + + * profile.c (tree_eval): Make unary minus case smarter, + use is_scalar test and if false parenthesize expression. + Add Node_TEXTDOMAIN case. + (pp_lhs, is_scalar, prec_level): Add Node_TEXTDOMAIN cases. + + Thu Apr 11 21:28:33 2002 Arnold D. Robbins + + * array.c (do_adump): Spelling fix in output message. + * builtin.c: Ditto, in multiple routines. + (do_toupper, do_tolower): Add cast to size_t in assigment to mbclen + for some compilers. + * re.c (research): Fix way returning is done to silence some + compiler diagnostics. + + Wed Apr 10 19:30:51 2002 Arnold D. Robbins + + * Makefile.am (datadir): Set directly to have `/awk'. + (DEFPATH): Go back to using $(datadir) for path. + + Tue Apr 9 17:34:09 2002 Arnold D. Robbins + + Upgraded to gettext 0.11.1. + + * Makefile.am (LDADD): Use @LIBINTL@ instead of @INTLLIBS@. + * ABOUT-NLS: Version from 0.11.1. + * config.rpath: Version from 0.11.1. + * aclocal.m4: Regenerated based on new files. + * intl/*: Replaced with version from 0.11.1. + * m4/ChangeLog: New file. + * m4/codeset.m4: New file. + * m4/gettext.m4: Version from 0.11.1. + * po/ChangeLog: New file. + * po/Makefile.in.in: Version from 0.11.1. + * po/remove-potcdate.sin: New file. + + Mon Apr 8 22:22:58 2002 Arnold D. Robbins + + * Makefile.am (libexecdir): Set directly to have `/awk'. + (DEFPATH): Use $(pkgdatadir) for path. + (install-exec-hook): Add version link for pgawk. + (uninstall-links): Remove pgawk version link. + + Wed Mar 20 13:44:21 2002 Isamu Hasegawa + + * regex.c (__alignof__): Definition for non-GCC compilers. + + Sun Mar 17 17:41:55 2002 Arnold D. Robbins + + * io.c (do_pathopen): Malloc buffers to hold constructed + filenames: No Arbitrary Limits! Thanks to keoki@techie.com + for the bug report. + + Sun Mar 10 16:59:06 2002 Scott Deifik + + * awk.h (LOCALEDIR): Provide a definition in case not using + i18n stuff. + + Wed Mar 6 18:14:44 2002 Arnold D. Robbins + + * main.c (usage): Add some explanatory text and examples at end. + + Sun Mar 3 16:42:50 2002 Arnold D. Robbins + + * getopt.h, getopt.c, getopt1.c: Update to current version + from glibc CVS. + + Fri Feb 22 15:53:38 2002 Isamu Hasegawa + + * dfa.c (fetch_wc): Fix type from wchar_t to wint_t. + (parse_bracket_exp_mb): Likewise. + * regex.c (extract_number): Retrieve the sign information from + byte-code in case of AIX. + + Thu Feb 21 16:44:24 2002 Arnold D. Robbins + + * re.c (resetup): Moved setting re_max_failures into regex.c. + * regex.c (re_max_failures): Set to really big if REGEX_MALLOC + defined. Do this in both places that define re_max_failures. + + Thu Feb 21 19:02:22 2002 Isamu Hasegawa + + * builtin.c (sub_common): Avoid index_multibyte_buffer invocation + in single byte character environments. + + Thu Feb 21 10:08:56 2002 Isamu Hasegawa + + * dfa.c (parse_bracket_exp_mb): For ':', use wctype_t in MALLOC, + not wchar_t. + + Thu Feb 21 09:52:16 2002 Arnold D. Robbins + + Upgraded to automake 1.5 and gettext-0.11. + Also bug fix to multibyte code. + + * ABOUT-NLS: upgraded. + * config.guess, config.sub, config.rpath, gettext.h, ylwrap: new files. + * Makefile.am: added above to appropriate places. + * awk.h: Replace libintl.h and macros with include of gettext.h. + (emalloc, erealloc): Add num bytes to error message, put string inside _(). + (index_multibyte_buffer): Removed decl. + * awklib/Makefile.am: Use $(EXEEXT) for grcat and pwcat targets. + * builtin.c (index_multibyte_buffer): Made static to this file. + (sub_common): Add checks that replacement string is length > 0 so + that we don't try to malloc(0): this fails on some systems. + * configure.in (AM_GNU_GETTEXT): Update macro for gettext 0.11. + (ALL_LINGUAS): Removed. + * m4/codeset.m4: new file. + * m4/gettext.m4: updated. + * m4/glibc21.m4: new file. + * m4/iconv.m4: new file. + * m4/isc-posix.m4: new file. + * m4/lcmessage.m4: updated. + * m4/lib-ld.m4: new file. + * m4/lib-link.m4: new file. + * m4/lib-prefix.m4: new file. + * m4/progtest.m4: updated. + * intl/*: Replaced with version from gettext 0.11. + * po/*: Revised for gettext 0.11. + + Mon Feb 18 14:42:39 2002 Arnold D. Robbins + + * builtin.c (nondec2awknum): Change assert to runtime check + in case user passed in bad data. + + 2002-02-17 Paul Eggert + + * re.c (resetup): Try to avoid silly limitation of regex.c by + setting re_max_failures to the largest reasonable value. + + Sun Feb 17 14:57:43 2002 Arnold D. Robbins + + * builtin.c (research): If re_search() returns -2, the + match failed since regex couldn't allocate enough memory + for what it needed. Fail with a fatal message instead. + This is a workaround, not a fix, but I don't mess with + regex.[ch]. + + Fri Feb 8 16:01:11 2002 Arnold D. Robbins + + * awkgram.y (LEX_FOR): Fix case of array loop with body of single + delete statement to actually check the right things to make the + optimization. + * profile.c (tree_eval): Add case for Node_K_delete_loop. + (prec_level): Ditto. + + Mon Feb 4 10:38:00 2002 Bruno Haible + + * awk.h (dcngettext): New macro. + (do_dcngettext): New declaration. + * awkgram.y (tokentab): Add dcngettext. + (snode): Add a warning for incorrect use of dcngettext. + (dumpintlstr): fflush at the end, not in the middle. + (dumpintlstr2): New function. + * builtin.c (localecategory_from_argument): New function, extracted + from do_dcgettext. + (do_dcgettext): Call it. + (do_dcngettext): New function. + + Sun Feb 3 17:56:20 2002 Bruno Haible + + * builtin.c (do_bindtextdomain): Don't free the same variable twice. + * main.c (main): Call setlocale for LC_MESSAGE, to make dcgettext + function work on glibc systems. + + Wed Jan 23 15:03:36 2002 Andreas Buening + + * configure.in (PATH_SEPARATOR): Code added for OS/2. + Makefile.am (PATH_SEPARATOR): Added. + (DEFPATH): Make use of PATH_SEPARATOR. + + Wed Jan 23 14:46:04 2002 Arnold D. Robbins + + * awkgram.y (yylex): Add test for lasttok != '$' when looking + at _"...". See comments in code. + + Wed Aug 15 07:43:10 2001 Isamu Hasegawa + + * regex.c : Implements the codes for exactn_bin to work correctly + in multibyte environments, in case of invalid multibyte sequence. + + Wed Aug 15 07:36:56 2001 Isamu Hasegawa + + * regex.c : Implements the codes for charset/charset_not to + work in multibyte environments. + + Wed Aug 15 05:04:34 2001 Isamu Hasegawa + + * regex.c : Add some comments. + + Wed Aug 15 05:04:15 2001 Isamu Hasegawa + + * regex.c (count_mbs_length): New function, check the mutibyte + strings and count how many wchar_t the substring occupy. + (CHAR_T): New macro, character type depending on + environments(singlebyte/multibyte). + (UCHAR_T): New macro, unsigned character type. + (COMPILED_BUFFER_VAR): New macro, the buffer containing + the compiled buffer. + Adapt singlebyte/multibyte environments with CHAR_T, UCHAR_T, + and COMPILED_BUFFER_VAR. + + Mon Jun 25 09:00:41 2001 Isamu Hasegawa + + * regex.c : Reorganize code to build code twice. byte_* are + for single byte, wcs_* are for multibyte character sets. + Chose functions according to current locale dynamically. + * regex.c (convert_mbs_to_wcs): New function, convert multibyte + strings to wide character strings for multibyte environments. + + Fri Jun 22 05:43:50 2001 Isamu Hasegawa + + * regex.c (MBS_SUPPORT): New macro, defined if the environment + can handle multibyte characters. + (OFFSET_ADDRESS_SIZE): Offset address size in the + compiled buffer. + Rewrite offset addresses with OFFSET_ADDRESS_SIZE. + + Thu Apr 26 08:03:17 2001 Isamu Hasegawa + + * builtin.c (index_multibyte_buffer) : inspect the buffer and write + the index. + (sub_common) : in multibyte environment, skip multibyte characters + when we check special characters. + * awk.h (index_multibyte_buffer) : add prototype. + * eval.c (cmp_nodes) : in multibyte environment, compare per character. + * field.c (re_parse_field) : in multibyte environment, avoid to + call research() on invalid boundary. + (sc_parse_field) : in multibyte environment, avoid to compare on + invalid boundary. + (null_parse_field) : in multibyte environment, split per + character, not per byte. + * io.c (get_a_record) : in multibyte environment, avoid to compare + on invalid boundary. + + Wed Apr 25 08:29:47 2001 Isamu Hasegawa + + * awk.h (strncasecmpmbs) : add prototype. + * builtin.c (strncasecmpmbs) : new function like strncasecmp but for + multibyte strings. + (do_index) : in multibyte environment, compare per character. + * builtin.c (do_tolower) : in multibyte environment, user towlower + instead of TOLOWER. + (do_toupper) : in multibyte environment, user towupper instead + of TOUPPER. + + Tue Apr 24 10:38:06 2001 Isamu Hasegawa + + In multibyte environments, handle multibyte characters as single + characters in bracket expressions. + + * dfa.h (mb_char_classes) : new structure. + (mbcsets) : new variable. + (nmbcsets) : new variable. + (mbcsets_alloc) : new variable. + * dfa.c (prtok) : handle MBCSET. + (fetch_wc) : new function to fetch a wide character. + (parse_bracket_exp_mb) : new function to handle multibyte character + in lex(). + (lex) : invoke parse_bracket_exp_mb() for multibyte bracket expression. + (atom) : handle MBCSET. + (epsclosure) : likewise. + (dfaanalyze) : likewise. + (dfastate) : likewise. + (match_mb_charset) : new function to judge whether a bracket match + with a multibyte character. + (check_matching_with_multibyte_ops) : handle MBCSET. + (dfainit) : initialize new variables. + (dfafree) : free new variables. + + Mon Apr 23 01:40:09 2001 Isamu Hasegawa + + Implement the mechanism to match with multibyte characters, + and use it for `period' in multibyte environments. + + * dfa.h (mbps) : new variable. + * dfa.c (prtok) : handle ANYCHAR. + (lex) : use ANYCHAR for `period' in multibyte environments. + (atom) : handle ANYCHAR. + (state_index) : initialize mbps in multibyte environments. + (epsclosure) : handle ANYCHAR. + (dfaanalyze) : handle ANYCHAR. + (dfastate) : handle ANYCHAR. + (realloc_trans_if_necessary) : new function. + (transit_state_singlebyte) : new function. + (match_anychar) : new function. + (check_matching_with_multibyte_ops) : new function. + (transit_state_consume_1char) : new function. + (transit_state) : new function. + (dfaexec) : invoke transit_state if expression can match with + a multibyte character in multibyte environments. + (dfamust) : handle ANYCHAR. + + Fri Apr 20 11:31:24 2001 Isamu Hasegawa + + Avoid incorrect state transition in multibyte environments. + + * dfa.h (nmultibyte_prop) : new variable. + (multibyte_prop) : new variable. + * dfa.c (addtok) : set inputwcs. + (dfastate) : avoid incorrect state transition in multibyte + environments. + (dfaexec) : likewise. + (dfainit) : init multibyte_prop. + (dfafree) : free multibyte_prop. + (inputwcs): new variable. + (mblen_buf) : new variable contains the amount of remain byte + of corresponding multibyte character in the input string. + + Fri Apr 20 06:28:59 2001 Isamu Hasegawa + + Handle a multibyte character followed by '*', '+', and '{n,m}' + correctly. + + * dfa.c (update_mb_len_index): new function. + Support for multibyte string. + (FETCH) : call update_mb_len_index. + (lex) : check cur_mb_index not to misunderstand multibyte characters. + (atom) : make a tree from a multibyte character. + (dfaparse) : initialize new variables. + (mbs) : new variable. + (cur_mb_len) : new variable. + (cur_mb_index) : new variable. + + Thu Apr 19 09:32:47 2001 Isamu Hasegawa + + * awkgram.y (cur_mbstate) : new varialble containing means current + shift state. + (cur_char_ring) : new varialbe reffering the buffer which contains + last some character from the buffer. + (cur_ring_idx) : new variable containing the current index on + cur_char_ring. + (nextc_is_1stbyte) : new macro, means that last nextc() return a + singlebyte character or 1st byte of a multibyte character. + (nextc) : check the buffer and update cur_ring_char in multibyte + environments. + (pushback) : adjust cur_ring_idx in multibyte environments. + (yylex) : add check whether nextc() returned 1st-byte in multibyte + environments. + * re.c (make_regexp) : in multibyte environment, skip multibyte + characters when we check special characters. + + Wed Apr 18 07:58:20 2001 Isamu Hasegawa + + * awk.h (MBS_SUPPORT) : New flag, means supporting multibyte strings. + * configure.in : add check for wchar.h, wctype.h, mbrtowc, and mbrlen. + + Wed Jan 16 16:32:40 2002 Arnold D. Robbins + + * builtin.c (do_strtonum): Simplified. Check first if the + value matches a non-decimal number, and if so convert it. + Otherwise do a regular force_number. + + Mon Jan 7 22:12:15 2002 Arnold D. Robbins + + * awkgram.y (statement): moved delete, print, and expressions into + new non-terminal `simple_stmt'. Allow opt_simple_stmt in the + first and third part of a for loop, per latest POSIX, which documents + an otherwise undocumented historical oddity in Unix awk. This has + the pleasant side effect of making line numbers more accurate for + messages involving delete statements. + (opt_simple_stmt, simple_stmt): new non-terminals. + + Based on bug report from drj@pobox.com. + + Mon Dec 24 14:04:02 2001 Arnold D. Robbins + + * configure.in: Changes for VMS with new strftime: + (AC_HEADER_TIME): added + (AC_CHECK_HEADERS): Check for sys/time.h. + (TIME_T_IN_SYS_TYPES_H): Add header check. + * acconfig.h (TIME_T_IN_SYS_TYPES_H): Added. + + Wed Dec 19 16:01:58 2001 Peter J. Farley III + + * configure.in: Add MS-DOS to getpgrp special case. + * dfa.c, getopt.c, regex.c: Fix code to work with --disable-nls. + + Wed Dec 19 15:59:25 2001 Eli Zaretskii + + * profile.c (init_profiling_signals) [__DJGPP__]: Use SIGINT + instead of SIGHUP and SIGQUIT instead of SIGUSR1. + + Tue Dec 18 20:56:07 2001 Andreas Buening + + More OS/2 stuff. + + * awk.h (O_BINARY): Don't redefine for EMX. + * io.c (gawk_popen): Add __EMX__ in case compiling DOS executable. + * configure.in: Add OS/2 to case for manual GETPGRP_VOID. + + Tue Dec 4 17:54:30 2001 Arnold D. Robbins + + New configure time option, --with-whiny-user-strftime. + + * configure.in (AC_ARG_WITH): Add appropriate code for autoconf. + * accondig.h (USE_INCLUDED_STRFTIME): add #undef for it. + * custom.h (USE_INCLUDED_STRFTIME): set things up write. + + Tue Dec 4 16:44:07 2001 Andreas Buening + + Mongo patch for updated OS/2 support. + + * awk.h (TOUPPER, TOLOWER): Define only if not already defined. + * awkgram.y (extproc feature): Add ifdef for __EMX__. + * gawkmisc.c (__EMX__): include pc/gawkmisc.c directly. + * io.c (__EMX__): Added for a number of places in addition to OS2 def. + (two_way_open): Added OS/2 specific code added that uses spawn. + (gawk_popen): ditto. + + Mon Dec 3 14:07:56 2001 Arnold D. Robbins + + Fix use of getgroups to use dynamic memory, solves + problem of systems where NGROUPS_MAX lies. + + * awk.h (groupset, ngroups): New extern variables. + * configure.in (AC_CHECK_FUNCS): Add getgroups to list. + * io.c (user_open): Use global ngroups and groupset variables, + don't call getgroups here. + * main.c (init_groupset): New function to init global + vars using malloc. Declare it at top. + (main): Call init_groupset(). + (load_procinfo): Use global ngroups and groupset variables. + + Sun Nov 18 11:56:01 2001 Arnold D. Robbins + + * random.c (srandomdev): ifdef-out. Lots of compile time + problems on multiple platforms, and gawk doesn't even + use the routine. The heck with fine-grained solutions. + + Wed Nov 14 16:12:40 2001 Pat Rankin + + * builtin.c (bchunk_one): Use `ofre < 1' instead of `ofre <= 0' + to avoid compiler complaint about suspicious comparison for + unsigned variable. (`ofre == 0' ought to suffice...) + + Tue Nov 13 17:27:52 2001 Arnold D. Robbins + + * awkgram.y (yyerror): Fix the code to behave like it + used to. Keep "no arbitrary limits" by mallocing the + buffer and freeing it. + + Wed Nov 7 16:46:20 2001 Arnold D. Robbins + + * awkgram.y (yyerror): Remove dependency upon buf[] to + hold prepended space and `^' pointer. Avoids core dumps + for long source lines. + + Sat Nov 3 22:27:21 2001 Arnold D. Robbins + + * m4/strtod.m4: Add missing `#endif'. Oops. + + Mon Oct 29 14:53:57 2001 Arnold D. Robbins + + * awkgram.y: Add semicolons in calls to count_args(). + Apparently bisoon adds a semicolon to each body + automatically and byacc doesn't. + + Sun Oct 28 16:53:18 2001 Arnold D. Robbins + + * builtin.c (format_tree): Fix off-by-one error in "ran out + for this one" diagnostic. Also fix lint check for too many + arguments vs. count in format string. + + Wed Oct 10 11:01:47 2001 Arnold D. Robbins + + * fixvers: Check that files exist before doing `cmp', in + case they're in a source code system and aren't there. + Fix from Grant Erickson (gerickson@brocade.com). + + Thu Oct 4 18:20:36 2001 Arnold D. Robbins + + * eval.c (r_tree_eval): For comparison, dupnode() results of + evaluation so that we can hang on to them and avoid memory + corruption. Change calls to free_temp() to unref(). + + Tue Sep 25 15:19:53 2001 Arnold D. Robbins + + * io.c (iop_open): Only call os_close_on_exec() for + fd > fileno(stderr). + + 2001-09-07 Paul Eggert + + * io.c (redirect): When deciding to use the fdopen bug hack, + use "__sun" rather than "solaris". No compilers predefine + "solaris", but both GCC and Sun C predefine "__sun". + + Thu Aug 30 15:17:12 2001 Arnold D. Robbins + + * main.c (copyleft): Use a printf %d for last year of update + to avoid translation strings changing when the file + is updated from now on. Suggestion from Ulrich Drepper. + + Thu Aug 23 14:01:14 2001 Arnold D. Robbins + + * awkgram.y (unary minus production): Add check that value + isn't a string. Based on bug report from drj@pobox.com. + * profile.c (tree_eval): For node_val, only test NUMBER + to see if value is numeric, not NUM|NUMBER. + + Thu Aug 16 12:21:28 2001 Arnold D. Robbins + + * configure.in (ALL_LINGUAS): Added `fr' and `tr'. + * po/fr.po, po/tr.fo: New files. + + 2001-08-13 Paul Eggert + + This patch fixes a bug that causes gawk to rewind standard + input incorrectly. It also removes all instances of fseek, + from the gawk source proper, which should make gawk a bit + more portable. + + (The original patch removed off_t & lseek too, but I need + that for something else. ADR.) + + * posix/gawkmisc.c (optimal_bufsize): + Don't use lseek on the input, because that might change + its state. Instead, just check whether it is a regular file. + This obviates the need to invoke isatty. + (Also, fix a spelling error in the first line of the source.) + * pc/gawkmisc.pc, unsupported/atari/gawkmisc.atr: Likewise. + + * awk.h (S_ISREG): Move this macro here ... + * io.c (S_ISREG): from here. + + * protos.h (fseek): Remove prototype; no longer used. + + Fri Aug 3 13:38:54 2001 Arnold D. Robbins + + * array.c (assoc_lookup): Change assert test on type to real test + to protect against FS[1] = "x" kinds of things. It'd be better + to do this in the grammar, but this is easier and just as + effective. + + Undid BECAMEARRAY changes of 25 June 2001 in favor of correct code: + * eval.c (pop_fcall): Change test and comment for freeing n->vname. + (flags2str): removed BECAMEARRAY entry. + * awk.h (BECAMEARRAY): Removed define. + * array.c (assoc_lookup): Removed setting of BECAMEARRAY flag. + + Mon Jul 23 17:33:13 2001 Arnold D. Robbins + + * io.c (get_a_record): Handle case where RS = "" and input file + is only newlines. See test/onlynl. Bug report by + Michel Jouvin . + + Wed Jul 4 18:34:19 2001 Arnold D. Robbins + + * eval.c (assign_val): Don't allow negative values for NF. + * field.c (set_NF): Robustify field-freeing code to make sure + values are always positive. + + Sun Jul 1 19:15:01 2001 Arnold D. Robbins + + * builtin.c (do_index): If second string is "", return 1. + + Mon Jun 25 19:34:24 2001 Arnold D. Robbins + + Further rationalization of treatment of dynamic regexes, + so that profiling code works correctly. + * awk.h (NODETYPE): New type, Node_dynregex. + * awkgram.y (mk_rexp): Use Node_dynregex. + * eval.c (nodetypes): Add Node_dynregex. + (r_tree_eval): Add Node_dynregex to case for match_op(). + * profile.c (tree_eval): Add Node_dynregex to case for pp_match_op(). + (pp_match_op): Handle Node_dynregex, simplify cases for ~ and !~. + * re.c (re_update): Add assertion that type is Node_regex when flags + indicate CONST. + + New lint warning. + * awkgram.y (yylex): Added lint warning that constant with leading + zero is treated as octal or hex. + + Generalized code for those who are Strong In The Ways of the Source. + * awk.h: New boolean variable. + * main.c (main): set it. + * eval.c (interpret): For arrays, check it. Remove variable 'first', + not needed anymore. + * profile.c (pp_string_fp): Enable printing of non-ascii characters + verbatim if variable set. + + Fix memory corruption on SCO for array vars as params changed globally. + * awk.h (BECAMEARRAY): new flag. + * array.c (assoc_lookup): set the flag as appropriate. + * eval.c (flags2str): Add the flag. + (pop_fcall): Check the flag, don't free memory if set. + + Wed Jun 13 18:07:06 2001 Arnold D. Robbins + + * eval.c (fmt_index): Actually call erealloc() to grow fmt_list + if that's really necessary. Bug report from David Jones, + djones@zoonami.com. + + Sun Jun 10 14:24:48 2001 Arnold D. Robbins + + * profile.c (pp_match_op): Rationalized the code. + + Thu Jun 7 11:54:36 2001 Arnold D. Robbins + + * awk.h (O_BINARY): Don't define if already defined + (as is true for cygwin/gcc --- oops). + Sun Jun 3 13:04:44 2001 Arnold D. Robbins * Release 3.1.0: Release tar file made. And there was diff -crN gawk-3.1.0/FUTURES gawk-3.1.1/FUTURES *** gawk-3.1.0/FUTURES Tue Nov 7 18:18:18 2000 --- gawk-3.1.1/FUTURES Mon Apr 15 09:38:15 2002 *************** *** 17,24 **** ====== DONE: A PROCINFO array to replace /dev/pid, /dev/user, et al. - DONE: Add `abort' statement a la Thompson awk. - DONE: Provide awk profiling. DONE: Integrate GNU NLS support. --- 17,22 ---- diff -crN gawk-3.1.0/Makefile.am gawk-3.1.1/Makefile.am *** gawk-3.1.0/Makefile.am Tue May 15 20:09:08 2001 --- gawk-3.1.1/Makefile.am Sun Apr 28 17:27:54 2002 *************** *** 1,7 **** # # Makefile.am --- automake input file for gawk # ! # Copyright (C) 2000-2001 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. --- 1,7 ---- # # Makefile.am --- automake input file for gawk # ! # Copyright (C) 2000-2002 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. *************** *** 45,50 **** --- 45,53 ---- PROBLEMS \ README_d \ bisonfix.sed \ + config.guess \ + config.rpath \ + config.sub \ depcomp \ extension \ fixvers \ *************** *** 54,60 **** pc \ posix \ unsupported \ ! vms # The order to do things in. # Build in intl first in case we need the local gettext version. --- 57,64 ---- pc \ posix \ unsupported \ ! vms \ ! ylwrap # The order to do things in. # Build in intl first in case we need the local gettext version. *************** *** 86,91 **** --- 90,96 ---- getopt.c \ getopt.h \ getopt1.c \ + gettext.h \ io.c \ main.c \ msg.c \ *************** *** 105,128 **** pgawk_SOURCES = $(base_sources) eval_p.c profile_p.c # Get extra libs as needed ! LDADD = @INTLLIBS@ @SOCKET_LIBS@ # stuff for compiling gawk/pgawk ! DEFPATH="\".:$(datadir)\"" DEFS= -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR="\"$(datadir)/locale\"" ! INCLUDES = -I. -I$(srcdir) -I$(srcdir)/intl # We want hard links for install-exec-hook, below LN= ln # First, add a link from gawk to gawk-X.Y.Z # For systems where gawk is awk, add a link to awk install-exec-hook: (fullname=gawk-`./gawk --version | sed 1q | awk '{print $$3}'` ; \ cd $(DESTDIR)$(bindir); \ $(LN) gawk $$fullname ; \ if [ ! -f awk ]; \ then $(LN_S) gawk awk; \ fi; exit 0) --- 110,143 ---- pgawk_SOURCES = $(base_sources) eval_p.c profile_p.c # Get extra libs as needed ! LDADD = @LIBINTL@ @SOCKET_LIBS@ ! ! # Special stuff for OS/2, remove after switch to autoconf 2.5x ! PATH_SEPARATOR = @PATH_SEPARATOR@ ! ! # Set autoconf Makefile.in variables correctly ! datadir = @datadir@ ! awkdatadir = @datadir@/awk ! libexecdir = @libexecdir@/awk # stuff for compiling gawk/pgawk ! DEFPATH="\".$(PATH_SEPARATOR)$(awkdatadir)\"" DEFS= -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR="\"$(datadir)/locale\"" ! INCLUDES = -I$(srcdir)/intl # We want hard links for install-exec-hook, below LN= ln # First, add a link from gawk to gawk-X.Y.Z + # Same for pgawk # For systems where gawk is awk, add a link to awk install-exec-hook: (fullname=gawk-`./gawk --version | sed 1q | awk '{print $$3}'` ; \ cd $(DESTDIR)$(bindir); \ $(LN) gawk $$fullname ; \ + $(LN) pgawk p$$fullname ; \ if [ ! -f awk ]; \ then $(LN_S) gawk awk; \ fi; exit 0) *************** *** 132,138 **** (cd $(DESTDIR)$(bindir); \ if [ -f awk ] && cmp awk gawk > /dev/null; then rm -f awk; fi ; \ fullname=gawk-`./gawk --version | sed 1q | ./gawk '{print $$3}'` ; \ ! rm -f $$fullname; exit 0) uninstall-recursive: uninstall-links --- 147,153 ---- (cd $(DESTDIR)$(bindir); \ if [ -f awk ] && cmp awk gawk > /dev/null; then rm -f awk; fi ; \ fullname=gawk-`./gawk --version | sed 1q | ./gawk '{print $$3}'` ; \ ! rm -f $$fullname p$$fullname; exit 0) uninstall-recursive: uninstall-links diff -crN gawk-3.1.0/Makefile.in gawk-3.1.1/Makefile.in *** gawk-3.1.0/Makefile.in Thu Jan 1 02:00:00 1970 --- gawk-3.1.1/Makefile.in Mon Apr 29 17:36:46 2002 *************** *** 0 **** --- 1,802 ---- + # Makefile.in generated automatically by automake 1.5 from Makefile.am. + + # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + # Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. + + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY, to the extent permitted by law; without + # even the implied warranty of MERCHANTABILITY or FITNESS FOR A + # PARTICULAR PURPOSE. + + @SET_MAKE@ + + # + # Makefile.am --- automake input file for gawk + # + # Copyright (C) 2000-2002 the Free Software Foundation, Inc. + # + # This file is part of GAWK, the GNU implementation of the + # AWK Programming Language. + # + # GAWK is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by + # the Free Software Foundation; either version 2 of the License, or + # (at your option) any later version. + # + # GAWK is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + # + + # Automatic de-ANSI-fication if needed + + SHELL = @SHELL@ + + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ + prefix = @prefix@ + exec_prefix = @exec_prefix@ + + bindir = @bindir@ + sbindir = @sbindir@ + sysconfdir = @sysconfdir@ + sharedstatedir = @sharedstatedir@ + localstatedir = @localstatedir@ + libdir = @libdir@ + infodir = @infodir@ + mandir = @mandir@ + includedir = @includedir@ + oldincludedir = /usr/include + pkgdatadir = $(datadir)/@PACKAGE@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = . + + ACLOCAL = @ACLOCAL@ + AUTOCONF = @AUTOCONF@ + AUTOMAKE = @AUTOMAKE@ + AUTOHEADER = @AUTOHEADER@ + + INSTALL = @INSTALL@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_DATA = @INSTALL_DATA@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ + INSTALL_HEADER = $(INSTALL_DATA) + transform = @program_transform_name@ + NORMAL_INSTALL = : + PRE_INSTALL = : + POST_INSTALL = : + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : + host_alias = @host_alias@ + host_triplet = @host@ + AMTAR = @AMTAR@ + AWK = @AWK@ + BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ + CATOBJEXT = @CATOBJEXT@ + CC = @CC@ + CFLAGS = @CFLAGS@ + CPP = @CPP@ + DATADIRNAME = @DATADIRNAME@ + DEPDIR = @DEPDIR@ + EXEEXT = @EXEEXT@ + GENCAT = @GENCAT@ + GLIBC21 = @GLIBC21@ + GMSGFMT = @GMSGFMT@ + HAVE_LIB = @HAVE_LIB@ + INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + INSTOBJEXT = @INSTOBJEXT@ + INTLBISON = @INTLBISON@ + INTLLIBS = @INTLLIBS@ + INTLOBJS = @INTLOBJS@ + INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ + LIB = @LIB@ + LIBICONV = @LIBICONV@ + LIBINTL = @LIBINTL@ + LN_S = @LN_S@ + LTLIB = @LTLIB@ + LTLIBICONV = @LTLIBICONV@ + LTLIBINTL = @LTLIBINTL@ + MKINSTALLDIRS = @MKINSTALLDIRS@ + OBJEXT = @OBJEXT@ + PACKAGE = @PACKAGE@ + POSUB = @POSUB@ + RANLIB = @RANLIB@ + SOCKET_LIBS = @SOCKET_LIBS@ + U = @U@ + USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ + USE_NLS = @USE_NLS@ + VERSION = @VERSION@ + YACC = @YACC@ + am__include = @am__include@ + am__quote = @am__quote@ + install_sh = @install_sh@ + libexecdir = @libexecdir@/awk + + # Set autoconf Makefile.in variables correctly + datadir = @datadir@ + + # Special stuff for OS/2, remove after switch to autoconf 2.5x + PATH_SEPARATOR = @PATH_SEPARATOR@ + + AUTOMAKE_OPTIONS = ansi2knr + + # This undocumented variable insures that aclocal runs + # correctly after changing configure.in + ACLOCAL_AMFLAGS = -I m4 + + # This insures that make flags get passed down to child makes. + AM_MAKEFLAGS = 'CFLAGS=$(CFLAGS)' 'LDFLAGS=$(LDFLAGS)' + + # Stuff to include in the dist that doesn't need it's own + # Makefile.am files + EXTRA_DIST = \ + COPYING \ + FUTURES \ + INSTALL \ + LIMITATIONS \ + NEWS \ + POSIX.STD \ + PROBLEMS \ + README_d \ + bisonfix.sed \ + config.guess \ + config.rpath \ + config.sub \ + depcomp \ + extension \ + fixvers \ + m4 \ + missing \ + missing_d \ + pc \ + posix \ + unsupported \ + vms \ + ylwrap + + + # The order to do things in. + # Build in intl first in case we need the local gettext version. + # Build explicitly "." next in order to build gawk first, so + # that `make check' without a prior `make' works. + SUBDIRS = \ + intl \ + . \ + awklib \ + doc \ + po \ + test + + + # what to make and install + bin_PROGRAMS = gawk pgawk + + # sources for both gawk and pgawk + base_sources = \ + array.c \ + awk.h \ + awkgram.y \ + builtin.c \ + custom.h \ + dfa.c \ + dfa.h \ + ext.c \ + field.c \ + gawkmisc.c \ + getopt.c \ + getopt.h \ + getopt1.c \ + gettext.h \ + io.c \ + main.c \ + msg.c \ + node.c \ + patchlev.h \ + protos.h \ + random.c \ + random.h \ + re.c \ + regex.c \ + regex.h \ + replace.c \ + version.in \ + version.c + + + gawk_SOURCES = $(base_sources) eval.c profile.c + pgawk_SOURCES = $(base_sources) eval_p.c profile_p.c + + # Get extra libs as needed + LDADD = @LIBINTL@ @SOCKET_LIBS@ + awkdatadir = @datadir@/awk + + # stuff for compiling gawk/pgawk + DEFPATH = "\".$(PATH_SEPARATOR)$(awkdatadir)\"" + + DEFS = -DDEFPATH=$(DEFPATH) -DHAVE_CONFIG_H -DGAWK -DLOCALEDIR="\"$(datadir)/locale\"" + + INCLUDES = -I$(srcdir)/intl + + # We want hard links for install-exec-hook, below + LN = ln + subdir = . + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = config.h + CONFIG_CLEAN_FILES = intl/Makefile + bin_PROGRAMS = gawk$(EXEEXT) pgawk$(EXEEXT) + PROGRAMS = $(bin_PROGRAMS) + + am_gawk_OBJECTS = array$U.$(OBJEXT) awkgram$U.$(OBJEXT) \ + builtin$U.$(OBJEXT) dfa$U.$(OBJEXT) ext$U.$(OBJEXT) \ + field$U.$(OBJEXT) gawkmisc$U.$(OBJEXT) getopt$U.$(OBJEXT) \ + getopt1$U.$(OBJEXT) io$U.$(OBJEXT) main$U.$(OBJEXT) \ + msg$U.$(OBJEXT) node$U.$(OBJEXT) random$U.$(OBJEXT) \ + re$U.$(OBJEXT) regex$U.$(OBJEXT) replace$U.$(OBJEXT) \ + version$U.$(OBJEXT) eval$U.$(OBJEXT) profile$U.$(OBJEXT) + gawk_OBJECTS = $(am_gawk_OBJECTS) + gawk_LDADD = $(LDADD) + gawk_DEPENDENCIES = + gawk_LDFLAGS = + am_pgawk_OBJECTS = array$U.$(OBJEXT) awkgram$U.$(OBJEXT) \ + builtin$U.$(OBJEXT) dfa$U.$(OBJEXT) ext$U.$(OBJEXT) \ + field$U.$(OBJEXT) gawkmisc$U.$(OBJEXT) getopt$U.$(OBJEXT) \ + getopt1$U.$(OBJEXT) io$U.$(OBJEXT) main$U.$(OBJEXT) \ + msg$U.$(OBJEXT) node$U.$(OBJEXT) random$U.$(OBJEXT) \ + re$U.$(OBJEXT) regex$U.$(OBJEXT) replace$U.$(OBJEXT) \ + version$U.$(OBJEXT) eval_p$U.$(OBJEXT) profile_p$U.$(OBJEXT) + pgawk_OBJECTS = $(am_pgawk_OBJECTS) + pgawk_LDADD = $(LDADD) + pgawk_DEPENDENCIES = + pgawk_LDFLAGS = + DEFAULT_INCLUDES = -I. -I$(srcdir) -I. + CPPFLAGS = @CPPFLAGS@ + LDFLAGS = @LDFLAGS@ + LIBS = @LIBS@ + depcomp = $(SHELL) $(top_srcdir)/depcomp + @AMDEP_TRUE@DEP_FILES = $(DEPDIR)/array$U.Po $(DEPDIR)/awkgram$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/builtin$U.Po $(DEPDIR)/dfa$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/eval$U.Po $(DEPDIR)/eval_p$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/ext$U.Po $(DEPDIR)/field$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/gawkmisc$U.Po $(DEPDIR)/getopt$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/getopt1$U.Po $(DEPDIR)/io$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/main$U.Po $(DEPDIR)/msg$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/node$U.Po $(DEPDIR)/profile$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/profile_p$U.Po $(DEPDIR)/random$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/re$U.Po $(DEPDIR)/regex$U.Po \ + @AMDEP_TRUE@ $(DEPDIR)/replace$U.Po $(DEPDIR)/version$U.Po + COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + CCLD = $(CC) + LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ + YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS) + YLWRAP = $(top_srcdir)/ylwrap + DIST_SOURCES = $(gawk_SOURCES) $(pgawk_SOURCES) + + RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ + uninstall-info-recursive all-recursive install-data-recursive \ + install-exec-recursive installdirs-recursive install-recursive \ + uninstall-recursive check-recursive installcheck-recursive + DIST_COMMON = README ./stamp-h.in ABOUT-NLS AUTHORS COPYING ChangeLog \ + INSTALL Makefile.am Makefile.in NEWS acconfig.h acinclude.m4 \ + aclocal.m4 ansi2knr.1 ansi2knr.c awkgram.c config.guess \ + config.sub configh.in configure configure.in depcomp install-sh \ + missing mkinstalldirs ylwrap + DIST_SUBDIRS = $(SUBDIRS) + SOURCES = $(gawk_SOURCES) $(pgawk_SOURCES) + + all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + + .SUFFIXES: + .SUFFIXES: .c .o .obj .y + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile + Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$@ $(SHELL) ./config.status + + $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + $(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + + $(ACLOCAL_M4): configure.in acinclude.m4 m4/arch.m4 m4/codeset.m4 m4/gettext.m4 m4/glibc21.m4 m4/iconv.m4 m4/isc-posix.m4 m4/jm-mktime.m4 m4/largefile.m4 m4/lcmessage.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/progtest.m4 m4/socket.m4 m4/ssize_t.m4 m4/strtod.m4 + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi + stamp-h: $(srcdir)/configh.in $(top_builddir)/config.status + @rm -f stamp-h stamp-hT + @echo timestamp > stamp-hT 2> /dev/null + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h:configh.in \ + $(SHELL) ./config.status + @mv stamp-hT stamp-h + $(srcdir)/configh.in: $(srcdir)/./stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/./stamp-h.in; \ + $(MAKE) $(srcdir)/./stamp-h.in; \ + else :; fi + $(srcdir)/./stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) $(top_srcdir)/acconfig.h + @rm -f $(srcdir)/./stamp-h.in $(srcdir)/./stamp-h.inT + @echo timestamp > $(srcdir)/./stamp-h.inT 2> /dev/null + cd $(top_srcdir) && $(AUTOHEADER) + @mv $(srcdir)/./stamp-h.inT $(srcdir)/./stamp-h.in + + distclean-hdr: + -rm -f config.h + intl/Makefile: $(top_builddir)/config.status $(top_srcdir)/intl/Makefile.in + cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= CONFIG_LINKS= $(SHELL) ./config.status + install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + + uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + + clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) + gawk$(EXEEXT): $(gawk_OBJECTS) $(gawk_DEPENDENCIES) + @rm -f gawk$(EXEEXT) + $(LINK) $(gawk_LDFLAGS) $(gawk_OBJECTS) $(gawk_LDADD) $(LIBS) + pgawk$(EXEEXT): $(pgawk_OBJECTS) $(pgawk_DEPENDENCIES) + @rm -f pgawk$(EXEEXT) + $(LINK) $(pgawk_LDFLAGS) $(pgawk_OBJECTS) $(pgawk_LDADD) $(LIBS) + + mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + + distclean-compile: + -rm -f *.tab.c + + ANSI2KNR = @ANSI2KNR@ + ansi2knr: ansi2knr.$(OBJEXT) + $(LINK) ansi2knr.$(OBJEXT) $(LIBS) + ansi2knr.$(OBJEXT): $(CONFIG_HEADER) + + clean-krextra: + -rm -f ansi2knr + + mostlyclean-kr: + -rm -f *_.c + + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/array$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/awkgram$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/builtin$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/dfa$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/eval$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/eval_p$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ext$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/field$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/gawkmisc$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt1$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/io$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/main$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/msg$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/node$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/profile$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/profile_p$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/random$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/re$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/regex$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/replace$U.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/version$U.Po@am__quote@ + + distclean-depend: + -rm -rf $(DEPDIR) + + .c.o: + @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ + @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< + + .c.obj: + @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ + @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + CCDEPMODE = @CCDEPMODE@ + array_.c: array.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/array.c; then echo $(srcdir)/array.c; else echo array.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > array_.c || rm -f array_.c + awkgram_.c: awkgram.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/awkgram.c; then echo $(srcdir)/awkgram.c; else echo awkgram.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > awkgram_.c || rm -f awkgram_.c + builtin_.c: builtin.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/builtin.c; then echo $(srcdir)/builtin.c; else echo builtin.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > builtin_.c || rm -f builtin_.c + dfa_.c: dfa.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dfa.c; then echo $(srcdir)/dfa.c; else echo dfa.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > dfa_.c || rm -f dfa_.c + eval_.c: eval.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eval.c; then echo $(srcdir)/eval.c; else echo eval.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eval_.c || rm -f eval_.c + eval_p_.c: eval_p.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eval_p.c; then echo $(srcdir)/eval_p.c; else echo eval_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > eval_p_.c || rm -f eval_p_.c + ext_.c: ext.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ext.c; then echo $(srcdir)/ext.c; else echo ext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > ext_.c || rm -f ext_.c + field_.c: field.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/field.c; then echo $(srcdir)/field.c; else echo field.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > field_.c || rm -f field_.c + gawkmisc_.c: gawkmisc.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gawkmisc.c; then echo $(srcdir)/gawkmisc.c; else echo gawkmisc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gawkmisc_.c || rm -f gawkmisc_.c + getopt_.c: getopt.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt.c; then echo $(srcdir)/getopt.c; else echo getopt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt_.c || rm -f getopt_.c + getopt1_.c: getopt1.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getopt1.c; then echo $(srcdir)/getopt1.c; else echo getopt1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > getopt1_.c || rm -f getopt1_.c + io_.c: io.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/io.c; then echo $(srcdir)/io.c; else echo io.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > io_.c || rm -f io_.c + main_.c: main.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/main.c; then echo $(srcdir)/main.c; else echo main.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > main_.c || rm -f main_.c + msg_.c: msg.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/msg.c; then echo $(srcdir)/msg.c; else echo msg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > msg_.c || rm -f msg_.c + node_.c: node.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/node.c; then echo $(srcdir)/node.c; else echo node.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > node_.c || rm -f node_.c + profile_.c: profile.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/profile.c; then echo $(srcdir)/profile.c; else echo profile.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > profile_.c || rm -f profile_.c + profile_p_.c: profile_p.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/profile_p.c; then echo $(srcdir)/profile_p.c; else echo profile_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > profile_p_.c || rm -f profile_p_.c + random_.c: random.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random.c; then echo $(srcdir)/random.c; else echo random.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > random_.c || rm -f random_.c + re_.c: re.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/re.c; then echo $(srcdir)/re.c; else echo re.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > re_.c || rm -f re_.c + regex_.c: regex.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/regex.c; then echo $(srcdir)/regex.c; else echo regex.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > regex_.c || rm -f regex_.c + replace_.c: replace.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/replace.c; then echo $(srcdir)/replace.c; else echo replace.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > replace_.c || rm -f replace_.c + version_.c: version.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/version.c; then echo $(srcdir)/version.c; else echo version.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > version_.c || rm -f version_.c + array_.$(OBJEXT) awkgram_.$(OBJEXT) builtin_.$(OBJEXT) dfa_.$(OBJEXT) \ + eval_.$(OBJEXT) eval_p_.$(OBJEXT) ext_.$(OBJEXT) field_.$(OBJEXT) \ + gawkmisc_.$(OBJEXT) getopt_.$(OBJEXT) getopt1_.$(OBJEXT) io_.$(OBJEXT) \ + main_.$(OBJEXT) msg_.$(OBJEXT) node_.$(OBJEXT) profile_.$(OBJEXT) \ + profile_p_.$(OBJEXT) random_.$(OBJEXT) re_.$(OBJEXT) regex_.$(OBJEXT) \ + replace_.$(OBJEXT) version_.$(OBJEXT) : $(ANSI2KNR) + + .y.c: + $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h -- $(YACCCOMPILE) + uninstall-info-am: + + # This directory's subdirectories are mostly independent; you can cd + # into them and run `make' without going through this Makefile. + # To change the values of `make' variables: instead of editing Makefiles, + # (1) if the variable is set in `config.status', edit `config.status' + # (which will cause the Makefiles to be regenerated when you run `make'); + # (2) otherwise, pass the desired values on the `make' command line. + $(RECURSIVE_TARGETS): + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + + mostlyclean-recursive clean-recursive distclean-recursive \ + maintainer-clean-recursive: + @set fnord $(MAKEFLAGS); amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" + tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done + + tags: TAGS + + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + + TAGS: tags-recursive $(HEADERS) $(SOURCES) configh.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)configh.in$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags configh.in $$unique $(LISP) + + GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + + DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + + top_distdir = . + # Avoid unsightly `./'. + distdir = $(PACKAGE)-$(VERSION) + + GZIP_ENV = --best + + distdir: $(DISTFILES) + -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + mkdir $(distdir) + $(mkinstalldirs) $(distdir)/intl $(distdir)/po + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + for subdir in $(SUBDIRS); do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="${top_distdir}" distdir="$(distdir)" \ + dist-hook + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) + dist: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + + # This target untars the dist file and tries a VPATH configuration. Then + # it guarantees that the distribution is self-contained by making another + # tarfile. + distcheck: dist + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + chmod a-w $(distdir) + dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \ + && cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + --with-included-gettext \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ + || (echo "Error: files left after uninstall" 1>&2; \ + exit 1) ) \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && $(MAKE) $(AM_MAKEFLAGS) distclean \ + && rm -f $(distdir).tar.gz \ + && (test `find . -type f -print | wc -l` -eq 0 \ + || (echo "Error: files left after distclean" 1>&2; \ + exit 1) ) + -chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir) + @echo "$(distdir).tar.gz is ready for distribution" | \ + sed 'h;s/./=/g;p;x;p;x' + check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local + check: check-recursive + all-am: Makefile $(ANSI2KNR) $(PROGRAMS) config.h + installdirs: installdirs-recursive + installdirs-am: + $(mkinstalldirs) $(DESTDIR)$(bindir) + + install: install-recursive + install-exec: install-exec-recursive + install-data: install-data-recursive + uninstall: uninstall-recursive + + install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + + installcheck: installcheck-recursive + install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + mostlyclean-generic: + + clean-generic: + + distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + clean: clean-recursive + + clean-am: clean-binPROGRAMS clean-generic clean-krextra mostlyclean-am + + dist-all: distdir + $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + distclean: distclean-recursive + -rm -f config.status config.cache config.log + distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-hdr distclean-tags + + dvi: dvi-recursive + + dvi-am: + + info: info-recursive + + info-am: + + install-data-am: + + install-exec-am: install-binPROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + + install-info: install-info-recursive + + install-man: + + installcheck-am: + + maintainer-clean: maintainer-clean-recursive + + maintainer-clean-am: distclean-am maintainer-clean-generic + + mostlyclean: mostlyclean-recursive + + mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr + + uninstall-am: uninstall-binPROGRAMS uninstall-info-am + + uninstall-info: uninstall-info-recursive + + .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am check-local \ + clean clean-binPROGRAMS clean-generic clean-krextra \ + clean-recursive dist dist-all distcheck distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-hdr distclean-recursive distclean-tags distdir dvi \ + dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-binPROGRAMS install-data install-data-am \ + install-data-recursive install-exec install-exec-am \ + install-exec-recursive install-info install-info-am \ + install-info-recursive install-man install-recursive \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am installdirs-recursive maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-kr \ + mostlyclean-recursive tags tags-recursive uninstall \ + uninstall-am uninstall-binPROGRAMS uninstall-info-am \ + uninstall-info-recursive uninstall-recursive + + + # First, add a link from gawk to gawk-X.Y.Z + # Same for pgawk + # For systems where gawk is awk, add a link to awk + install-exec-hook: + (fullname=gawk-`./gawk --version | sed 1q | awk '{print $$3}'` ; \ + cd $(DESTDIR)$(bindir); \ + $(LN) gawk $$fullname ; \ + $(LN) pgawk p$$fullname ; \ + if [ ! -f awk ]; \ + then $(LN_S) gawk awk; \ + fi; exit 0) + + # Undo the above when uninstalling + uninstall-links: + (cd $(DESTDIR)$(bindir); \ + if [ -f awk ] && cmp awk gawk > /dev/null; then rm -f awk; fi ; \ + fullname=gawk-`./gawk --version | sed 1q | ./gawk '{print $$3}'` ; \ + rm -f $$fullname p$$fullname; exit 0) + + uninstall-recursive: uninstall-links + + # force there to be a gawk executable before running tests + check-local: gawk pgawk + + # A little extra clean up when making distributions. + # FIXME: most of this rule should go away upon switching to libtool. + dist-hook: + cd $(distdir)/extension ; rm -f *.o *.so + + # Special rules for individual files + awkgram.c: awkgram.y + $(YACC) $(AM_YFLAGS) $(YFLAGS) $< && sed -f $(srcdir)/bisonfix.sed < y.tab.c > $*.c && $(RM) y.tab.c + if test -f y.tab.h; then \ + if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \ + else :; fi + + # these force version and patchlevel to be up to date based + # on what's in configure.in. No-one else but me should have + # to use them. So there. + patchlev.h: configure.in + ./fixvers -p + + version.c: configure.in version.in + ./fixvers -v + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff -crN gawk-3.1.0/NEWS gawk-3.1.1/NEWS *** gawk-3.1.0/NEWS Mon Feb 26 10:40:00 2001 --- gawk-3.1.1/NEWS Mon Apr 29 14:52:29 2002 *************** *** 1,3 **** --- 1,52 ---- + Changes from 3.1.0 to 3.1.1 + --------------------------- + + 1. Six new translations. + + 2. Having more than 4 different value for OFMT and/or CONVFMT now works. + + 3. The handling of dynamic regexes is now more more sane, esp. w.r.t. + the profiling code. The profiling code has been fixed in several + places. + + 4. The return value of index("", "") is now 1. + + 5. Gawk should no longer close fd 0 in child processes. + + 6. Fixed test for strtod semantics and regenerated configure. + + 7. Gawk can now be built with byacc; an accidental bison dependency was + removed. + + 8. yyerror() will no longer dump core on long source lines. + + 9. Gawk now correctly queries getgroups(2) to figure out how many groups + the process has. + + 10. New configure option to force use of included strftime, e.g. on + Solaris systems. See `./configure --help' for the details. Replaced + the included strftime.c with the one from textutils. + + 11. OS/2 port has been updated. + + 12. Multi-byte character support has been added, courtesy of IBM Japan. + + 13. The `for (iggy in foo) delete foo[iggy]' -> `delete foo' optimisation + now works. + + 14. Upgraded to gettext 0.11.2 and automake 1.5. + + 15. Full gettext compatibility (new dcngettext function). + + 16. The O'Reilly copyedits and indexing changes for the documentation have + been folded into the texinfo version of the manuals. + + 17. A humongously long value for the AWKPATH environment variable will no + longer dump core. + + 18. Configuration / Installation issues have been straightened out in + Makefile.am. + Changes from 3.0.6 to 3.1.0 --------------------------- diff -crN gawk-3.1.0/README gawk-3.1.1/README *** gawk-3.1.0/README Wed May 16 10:43:45 2001 --- gawk-3.1.1/README Tue Apr 16 13:54:14 2002 *************** *** 1,10 **** README: ! This is GNU Awk 3.1.0. It is upwardly compatible with the Bell Labs research version of awk. It is almost completely compliant with the 1993 POSIX 1003.2 standard for awk. (See the note below about POSIX.) ! There are lots of new features -- see NEWS and ChangeLog for details. Work to be done is described briefly in the FUTURES file. Changes in this version are summarized in the NEWS file. Please read the LIMITATIONS file. --- 1,10 ---- README: ! This is GNU Awk 3.1.1. It is upwardly compatible with the Bell Labs research version of awk. It is almost completely compliant with the 1993 POSIX 1003.2 standard for awk. (See the note below about POSIX.) ! This is a bug fix release. See NEWS and ChangeLog for details. Work to be done is described briefly in the FUTURES file. Changes in this version are summarized in the NEWS file. Please read the LIMITATIONS file. *************** *** 92,99 **** juan@biophnet.unlp.edu.ar OS/2: ! Kai Uwe Rommel ! rommel@ars.de Tandem: Stephen Davies --- 92,98 ---- juan@biophnet.unlp.edu.ar OS/2: ! gawk-maintainer@unixos2.org Tandem: Stephen Davies diff -crN gawk-3.1.0/README_d/README.VMS gawk-3.1.1/README_d/README.VMS *** gawk-3.1.0/README_d/README.VMS Fri Dec 13 05:56:43 1996 --- gawk-3.1.1/README_d/README.VMS Mon Apr 22 14:22:27 2002 *************** *** 19,27 **** `@vmsbuild GNUC DO_GNUC_SETUP' or `MMS/MACRO=("GNUC","DO_GNUC_SETUP")'. ! Tested under Alpha/VMS V6.2 using DEC C V5.2 and under VAX/VMS V6.2 ! using DEC C V5.2, VAX C 3.2, and GNU C 2.7.1. GAWK should work without ! modifications for VMS V4.6 and up. Installing GAWK on VMS: --- 19,26 ---- `@vmsbuild GNUC DO_GNUC_SETUP' or `MMS/MACRO=("GNUC","DO_GNUC_SETUP")'. ! Tested under Alpha/VMS V7.1 using DEC C V6.4. GAWK should work ! without modifications for VMS V4.6 and up. Installing GAWK on VMS: *************** *** 80,103 **** value should be quoted so that it retains a single translation, not a multi-translation RMS searchlist. - - Building and using GAWK under VMS POSIX: - - Ignore the instructions above, although vms/gawk.hlp should still - be made available in a help library. The source tree should be unpacked - into a container file subsystem rather than into the ordinary VMS file - system. Make sure that the two scripts, 'configure' and 'vms/posix-cc.sh', - are executable; use `chmod +x' on them if necessary. Then execute the - following two commands: - |psx> CC=vms/posix-cc.sh configure - |psx> make CC=c89 gawk - The first command will construct files "config.h" and "Makefile" out - of templates, using a script to make the C compiler fit 'configure's - expectations. The second command will compile and link 'gawk' using - the C compiler directly; ignore any warnings from `make' about being - unable to redefine "CC". The configure script will take a very long - time to execute, but at least it provides incremental feedback as it - runs. - - Tested with VAX/VMS V6.2 + VMS POSIX V2.0 + DEC C V5.2. - --- 79,81 ---- diff -crN gawk-3.1.0/README_d/README.ia64 gawk-3.1.1/README_d/README.ia64 *** gawk-3.1.0/README_d/README.ia64 Wed Apr 25 17:17:52 2001 --- gawk-3.1.1/README_d/README.ia64 Tue Apr 16 13:55:42 2002 *************** *** 1,3 **** --- 1,7 ---- + Tue Apr 16 13:55:15 IDT 2002 + ============================ + The current version of the IA-64 environment builds gawk without any problems. + Wed Apr 25 17:17:01 IDT 2001 ============================ diff -crN gawk-3.1.0/README_d/README.pc gawk-3.1.1/README_d/README.pc *** gawk-3.1.0/README_d/README.pc Sun Jan 7 15:36:06 2001 --- gawk-3.1.1/README_d/README.pc Wed Jan 16 15:16:35 2002 *************** *** 8,13 **** --- 8,27 ---- version for Windows 9x/NT, and MSC can be used to build 16-bit versions for DOS and OS/2. + The cygwin environment (http://www.cygwin.com) may also be used + to compile and run gawk under Windows. For cygwin, building and + installation is the same as under Unix: + + tar -xvpzf gawk-3.1.x.tar.gz + cd gawk-3.1.x + ./configure && make + + The `configure' step takes a long time, but works otherwise. + + ******************************** N O T E ********************************** + * The `|&' operator only works when gawk is compiled for cygwin. Neither * + * socket support nor two-way pipes work in any other Windows environment! * + *************************************************************************** Building gawk ------------- *************** *** 330,335 **** --- 344,351 ---- 9. gawk built from the mingw32 and vcWin32 targets continues to have problems with pipes; in particular, the pipeio1 test fails. + 10. As mentioned above, `|&' only works with cygwin. + Gawk thanks ----------- *************** *** 350,360 **** Scott Deifik, scottd@amgen.com (DOS versions) or ! Kai Uwe Rommel, rommel@ars.de (OS/2 or bound versions) Darrel Hankerson, hankedr@mail.auburn.edu ! Support for Win32 started in gawk-3.0.3. Reports concerning the emx ! version using rsxnt (emxnt) should go to Kai Uwe Rommel. Reports on the Visual C++ version (vcWin32) may be sent to Juan Grigera, juan@biophnet.unlp.edu.ar (Visual C++ version) --- 366,375 ---- Scott Deifik, scottd@amgen.com (DOS versions) or ! gawk-maintainer@unixos2.org (OS/2 version) Darrel Hankerson, hankedr@mail.auburn.edu ! Support for Win32 started in gawk-3.0.3. Reports on the Visual C++ version (vcWin32) may be sent to Juan Grigera, juan@biophnet.unlp.edu.ar (Visual C++ version) diff -crN gawk-3.1.0/README_d/README.solaris gawk-3.1.1/README_d/README.solaris *** gawk-3.1.0/README_d/README.solaris Tue Jul 4 07:57:24 2000 --- gawk-3.1.1/README_d/README.solaris Sun Sep 9 12:01:57 2001 *************** *** 53,60 **** Arnold Robbins arnold@gnu.org ! Solution to Problem #1: ! ======================= From: Paul Nevai Subject: Re: gawk-3.0.4 To: arnold@skeeve.com (Aharon Robbins) --- 53,65 ---- Arnold Robbins arnold@gnu.org ! Solution (a) to Problem #2: ! =========================== ! Now fixed in the code via Paul Eggert's 2001-09-0 patch. See the ! ChangeLog. ! ! Solution (b) to Problem #2: ! =========================== From: Paul Nevai Subject: Re: gawk-3.0.4 To: arnold@skeeve.com (Aharon Robbins) diff -crN gawk-3.1.0/acconfig.h gawk-3.1.1/acconfig.h *** gawk-3.1.0/acconfig.h Sun Jan 21 17:47:22 2001 --- gawk-3.1.1/acconfig.h Mon Dec 24 14:27:33 2001 *************** *** 33,38 **** --- 33,40 ---- #undef DYNAMIC /* allow dynamic addition of builtins */ #undef STRTOD_NOT_C89 /* strtod doesn't have C89 semantics */ #undef ssize_t /* signed version of size_t */ + #undef USE_INCLUDED_STRFTIME /* force use of our version of strftime */ + #undef TIME_T_IN_SYS_TYPES_H /* some systems define this type here */ @BOTTOM@ diff -crN gawk-3.1.0/aclocal.m4 gawk-3.1.1/aclocal.m4 *** gawk-3.1.0/aclocal.m4 Thu Jan 1 02:00:00 1970 --- gawk-3.1.1/aclocal.m4 Mon Apr 29 17:36:45 2002 *************** *** 0 **** --- 1,2792 ---- + # aclocal.m4 generated automatically by aclocal 1.5 + + # Copyright 1996, 1997, 1998, 1999, 2000, 2001 + # Free Software Foundation, Inc. + # This file is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. + + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY, to the extent permitted by law; without + # even the implied warranty of MERCHANTABILITY or FITNESS FOR A + # PARTICULAR PURPOSE. + + sinclude(arch.m4)dnl + sinclude(gettext.m4)dnl + sinclude(jm-mktime.m4)dnl + sinclude(largefile.m4)dnl + sinclude(lcmessage.m4)dnl + sinclude(progtest.m4)dnl + sinclude(socket.m4)dnl + sinclude(strtod.m4)dnl + + # Do all the work for Automake. This macro actually does too much -- + # some checks are only needed if your package does certain things. + # But this isn't really a big deal. + + # serial 5 + + # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be + # written in clear, in which case automake, when reading aclocal.m4, + # will think it sees a *use*, and therefore will trigger all it's + # C support machinery. Also note that it means that autoscan, seeing + # CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + # We require 2.13 because we rely on SHELL being computed by configure. + AC_PREREQ([2.13]) + + # AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) + # ----------------------------------------------------------- + # If MACRO-NAME is provided do IF-PROVIDED, else IF-NOT-PROVIDED. + # The purpose of this macro is to provide the user with a means to + # check macros which are provided without letting her know how the + # information is coded. + # If this macro is not defined by Autoconf, define it here. + ifdef([AC_PROVIDE_IFELSE], + [], + [define([AC_PROVIDE_IFELSE], + [ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + + # AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE]) + # ---------------------------------------------- + AC_DEFUN([AM_INIT_AUTOMAKE], + [AC_REQUIRE([AC_PROG_INSTALL])dnl + # test to see if srcdir already configured + if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run \"make distclean\" there first]) + fi + + # Define the identity of the package. + PACKAGE=$1 + AC_SUBST(PACKAGE)dnl + VERSION=$2 + AC_SUBST(VERSION)dnl + ifelse([$3],, + [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) + + # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow + # the ones we care about. + ifdef([m4_pattern_allow], + [m4_pattern_allow([^AM_[A-Z]+FLAGS])])dnl + + # Autoconf 2.50 always computes EXEEXT. However we need to be + # compatible with 2.13, for now. So we always define EXEEXT, but we + # don't compute it. + AC_SUBST(EXEEXT) + # Similar for OBJEXT -- only we only use OBJEXT if the user actually + # requests that it be used. This is a bit dumb. + : ${OBJEXT=o} + AC_SUBST(OBJEXT) + + # Some tools Automake needs. + AC_REQUIRE([AM_SANITY_CHECK])dnl + AC_REQUIRE([AC_ARG_PROGRAM])dnl + AM_MISSING_PROG(ACLOCAL, aclocal) + AM_MISSING_PROG(AUTOCONF, autoconf) + AM_MISSING_PROG(AUTOMAKE, automake) + AM_MISSING_PROG(AUTOHEADER, autoheader) + AM_MISSING_PROG(MAKEINFO, makeinfo) + AM_MISSING_PROG(AMTAR, tar) + AM_PROG_INSTALL_SH + AM_PROG_INSTALL_STRIP + # We need awk for the "check" target. The system "awk" is bad on + # some platforms. + AC_REQUIRE([AC_PROG_AWK])dnl + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AM_DEP_TRACK])dnl + AC_REQUIRE([AM_SET_DEPDIR])dnl + AC_PROVIDE_IFELSE([AC_PROG_][CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_][CC], + defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl + AC_PROVIDE_IFELSE([AC_PROG_][CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_][CXX], + defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl + ]) + + # + # Check to make sure that the build environment is sane. + # + + # serial 3 + + # AM_SANITY_CHECK + # --------------- + AC_DEFUN([AM_SANITY_CHECK], + [AC_MSG_CHECKING([whether build environment is sane]) + # Just in case + sleep 1 + echo timestamp > conftest.file + # Do `set' in a subshell so we don't clobber the current shell's + # arguments. Must try -L first in case configure is actually a + # symlink; some systems play weird games with the mod time of symlinks + # (eg FreeBSD returns the mod time of the symlink's containing + # directory). + if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + + test "$[2]" = conftest.file + ) + then + # Ok. + : + else + AC_MSG_ERROR([newly created file is older than distributed files! + Check your system clock]) + fi + AC_MSG_RESULT(yes)]) + + + # serial 2 + + # AM_MISSING_PROG(NAME, PROGRAM) + # ------------------------------ + AC_DEFUN([AM_MISSING_PROG], + [AC_REQUIRE([AM_MISSING_HAS_RUN]) + $1=${$1-"${am_missing_run}$2"} + AC_SUBST($1)]) + + + # AM_MISSING_HAS_RUN + # ------------------ + # Define MISSING if not defined so far and test if it supports --run. + # If it does, set am_missing_run to use it, otherwise, to nothing. + AC_DEFUN([AM_MISSING_HAS_RUN], + [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl + test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" + # Use eval to expand $SHELL + if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " + else + am_missing_run= + am_backtick='`' + AC_MSG_WARN([${am_backtick}missing' script is too old or missing]) + fi + ]) + + # AM_AUX_DIR_EXPAND + + # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets + # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to + # `$srcdir', `$srcdir/..', or `$srcdir/../..'. + # + # Of course, Automake must honor this variable whenever it calls a + # tool from the auxiliary directory. The problem is that $srcdir (and + # therefore $ac_aux_dir as well) can be either absolute or relative, + # depending on how configure is run. This is pretty annoying, since + # it makes $ac_aux_dir quite unusable in subdirectories: in the top + # source directory, any form will work fine, but in subdirectories a + # relative path needs to be adjusted first. + # + # $ac_aux_dir/missing + # fails when called from a subdirectory if $ac_aux_dir is relative + # $top_srcdir/$ac_aux_dir/missing + # fails if $ac_aux_dir is absolute, + # fails when called from a subdirectory in a VPATH build with + # a relative $ac_aux_dir + # + # The reason of the latter failure is that $top_srcdir and $ac_aux_dir + # are both prefixed by $srcdir. In an in-source build this is usually + # harmless because $srcdir is `.', but things will broke when you + # start a VPATH build or use an absolute $srcdir. + # + # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, + # iff we strip the leading $srcdir from $ac_aux_dir. That would be: + # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` + # and then we would define $MISSING as + # MISSING="\${SHELL} $am_aux_dir/missing" + # This will work as long as MISSING is not called from configure, because + # unfortunately $(top_srcdir) has no meaning in configure. + # However there are other variables, like CC, which are often used in + # configure, and could therefore not use this "fixed" $ac_aux_dir. + # + # Another solution, used here, is to always expand $ac_aux_dir to an + # absolute PATH. The drawback is that using absolute paths prevent a + # configured tree to be moved without reconfiguration. + + AC_DEFUN([AM_AUX_DIR_EXPAND], [ + # expand $ac_aux_dir to an absolute path + am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` + ]) + + # AM_PROG_INSTALL_SH + # ------------------ + # Define $install_sh. + AC_DEFUN([AM_PROG_INSTALL_SH], + [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl + install_sh=${install_sh-"$am_aux_dir/install-sh"} + AC_SUBST(install_sh)]) + + # One issue with vendor `install' (even GNU) is that you can't + # specify the program used to strip binaries. This is especially + # annoying in cross-compiling environments, where the build's strip + # is unlikely to handle the host's binaries. + # Fortunately install-sh will honor a STRIPPROG variable, so we + # always use install-sh in `make install-strip', and initialize + # STRIPPROG with the value of the STRIP variable (set by the user). + AC_DEFUN([AM_PROG_INSTALL_STRIP], + [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl + INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + AC_SUBST([INSTALL_STRIP_PROGRAM])]) + + # serial 4 -*- Autoconf -*- + + + + # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be + # written in clear, in which case automake, when reading aclocal.m4, + # will think it sees a *use*, and therefore will trigger all it's + # C support machinery. Also note that it means that autoscan, seeing + # CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + + + # _AM_DEPENDENCIES(NAME) + # --------------------- + # See how the compiler implements dependency checking. + # NAME is "CC", "CXX" or "OBJC". + # We try a few techniques and use that to set a single cache variable. + # + # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was + # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular + # dependency, and given that the user is not expected to run this macro, + # just rely on AC_PROG_CC. + AC_DEFUN([_AM_DEPENDENCIES], + [AC_REQUIRE([AM_SET_DEPDIR])dnl + AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl + AC_REQUIRE([AM_MAKE_INCLUDE])dnl + AC_REQUIRE([AM_DEP_TRACK])dnl + + ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'] + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + + AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], + [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir + else + am_cv_$1_dependencies_compiler_type=none + fi + ]) + $1DEPMODE="depmode=$am_cv_$1_dependencies_compiler_type" + AC_SUBST([$1DEPMODE]) + ]) + + + # AM_SET_DEPDIR + # ------------- + # Choose a directory name for dependency files. + # This macro is AC_REQUIREd in _AM_DEPENDENCIES + AC_DEFUN([AM_SET_DEPDIR], + [rm -f .deps 2>/dev/null + mkdir .deps 2>/dev/null + if test -d .deps; then + DEPDIR=.deps + else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps + fi + rmdir .deps 2>/dev/null + AC_SUBST(DEPDIR) + ]) + + + # AM_DEP_TRACK + # ------------ + AC_DEFUN([AM_DEP_TRACK], + [AC_ARG_ENABLE(dependency-tracking, + [ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) + if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + fi + AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) + pushdef([subst], defn([AC_SUBST])) + subst(AMDEPBACKSLASH) + popdef([subst]) + ]) + + # Generate code to set up dependency tracking. + # This macro should only be invoked once -- use via AC_REQUIRE. + # Usage: + # AM_OUTPUT_DEPENDENCY_COMMANDS + + # + # This code is only required when automatic dependency tracking + # is enabled. FIXME. This creates each `.P' file that we will + # need in order to bootstrap the dependency handling code. + AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],[ + AC_OUTPUT_COMMANDS([ + test x"$AMDEP_TRUE" != x"" || + for mf in $CONFIG_FILES; do + case "$mf" in + Makefile) dirpart=.;; + */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; + *) continue;; + esac + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`echo "$file" | sed -e 's|/[^/]*$||'` + $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done + ], [AMDEP_TRUE="$AMDEP_TRUE" + ac_aux_dir="$ac_aux_dir"])]) + + # AM_MAKE_INCLUDE() + # ----------------- + # Check to see how make treats includes. + AC_DEFUN([AM_MAKE_INCLUDE], + [am_make=${MAKE-make} + cat > confinc << 'END' + doit: + @echo done + END + # If we don't find an include directive, just comment out the code. + AC_MSG_CHECKING([for style of include used by $am_make]) + am__include='#' + am__quote= + _am_result=none + # First try GNU make style include. + echo "include confinc" > confmf + # We grep out `Entering directory' and `Leaving directory' + # messages which can occur if `w' ends up in MAKEFLAGS. + # In particular we don't look at `^make:' because GNU make might + # be invoked under some other name (usually "gmake"), in which + # case it prints its new name instead of `make'. + if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU + fi + # Now try BSD make style include. + if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote='"' + _am_result=BSD + fi + fi + AC_SUBST(am__include) + AC_SUBST(am__quote) + AC_MSG_RESULT($_am_result) + rm -f confinc confmf + ]) + + # serial 3 + + # AM_CONDITIONAL(NAME, SHELL-CONDITION) + # ------------------------------------- + # Define a conditional. + # + # FIXME: Once using 2.50, use this: + # m4_match([$1], [^TRUE\|FALSE$], [AC_FATAL([$0: invalid condition: $1])])dnl + AC_DEFUN([AM_CONDITIONAL], + [ifelse([$1], [TRUE], + [errprint(__file__:__line__: [$0: invalid condition: $1 + ])dnl + m4exit(1)])dnl + ifelse([$1], [FALSE], + [errprint(__file__:__line__: [$0: invalid condition: $1 + ])dnl + m4exit(1)])dnl + AC_SUBST([$1_TRUE]) + AC_SUBST([$1_FALSE]) + if $2; then + $1_TRUE= + $1_FALSE='#' + else + $1_TRUE='#' + $1_FALSE= + fi]) + + # Like AC_CONFIG_HEADER, but automatically create stamp file. + + # serial 3 + + # When config.status generates a header, we must update the stamp-h file. + # This file resides in the same directory as the config header + # that is generated. We must strip everything past the first ":", + # and everything past the last "/". + + AC_PREREQ([2.12]) + + AC_DEFUN([AM_CONFIG_HEADER], + [ifdef([AC_FOREACH],dnl + [dnl init our file count if it isn't already + m4_ifndef([_AM_Config_Header_Index], m4_define([_AM_Config_Header_Index], [0])) + dnl prepare to store our destination file list for use in config.status + AC_FOREACH([_AM_File], [$1], + [m4_pushdef([_AM_Dest], m4_patsubst(_AM_File, [:.*])) + m4_define([_AM_Config_Header_Index], m4_incr(_AM_Config_Header_Index)) + dnl and add it to the list of files AC keeps track of, along + dnl with our hook + AC_CONFIG_HEADERS(_AM_File, + dnl COMMANDS, [, INIT-CMDS] + [# update the timestamp + echo timestamp >"AS_ESCAPE(_AM_DIRNAME(]_AM_Dest[))/stamp-h]_AM_Config_Header_Index[" + ][$2]m4_ifval([$3], [, [$3]]))dnl AC_CONFIG_HEADERS + m4_popdef([_AM_Dest])])],dnl + [AC_CONFIG_HEADER([$1]) + AC_OUTPUT_COMMANDS( + ifelse(patsubst([$1], [[^ ]], []), + [], + [test -z "$CONFIG_HEADERS" || echo timestamp >dnl + patsubst([$1], [^\([^:]*/\)?.*], [\1])stamp-h]),dnl + [am_indx=1 + for am_file in $1; do + case " \$CONFIG_HEADERS " in + *" \$am_file "*) + am_dir=\`echo \$am_file |sed 's%:.*%%;s%[^/]*\$%%'\` + if test -n "\$am_dir"; then + am_tmpdir=\`echo \$am_dir |sed 's%^\(/*\).*\$%\1%'\` + for am_subdir in \`echo \$am_dir |sed 's%/% %'\`; do + am_tmpdir=\$am_tmpdir\$am_subdir/ + if test ! -d \$am_tmpdir; then + mkdir \$am_tmpdir + fi + done + fi + echo timestamp > "\$am_dir"stamp-h\$am_indx + ;; + esac + am_indx=\`expr \$am_indx + 1\` + done]) + ])]) # AM_CONFIG_HEADER + + # _AM_DIRNAME(PATH) + # ----------------- + # Like AS_DIRNAME, only do it during macro expansion + AC_DEFUN([_AM_DIRNAME], + [m4_if(m4_regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, + m4_if(m4_regexp([$1], [^//\([^/]\|$\)]), -1, + m4_if(m4_regexp([$1], [^/.*]), -1, + [.], + m4_patsubst([$1], [^\(/\).*], [\1])), + m4_patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), + m4_patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl + ]) # _AM_DIRNAME + + # isc-posix.m4 serial 2 (gettext-0.11.2) + dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + + # This file is not needed with autoconf-2.53 and newer. Remove it in 2005. + + # This test replaces the one in autoconf. + # Currently this macro should have the same name as the autoconf macro + # because gettext's gettext.m4 (distributed in the automake package) + # still uses it. Otherwise, the use in gettext.m4 makes autoheader + # give these diagnostics: + # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX + # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX + + undefine([AC_ISC_POSIX]) + + AC_DEFUN([AC_ISC_POSIX], + [ + dnl This test replaces the obsolescent AC_ISC_POSIX kludge. + AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"]) + ] + ) + + #serial 19 + + dnl By default, many hosts won't let programs access large files; + dnl one must use special compiler options to get large-file access to work. + dnl For more details about this brain damage please see: + dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html + + dnl Written by Paul Eggert . + + dnl Internal subroutine of AC_SYS_LARGEFILE. + dnl AC_SYS_LARGEFILE_TEST_INCLUDES + AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES, + [[#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ + # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + ]]) + + dnl Internal subroutine of AC_SYS_LARGEFILE. + dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY) + AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE, + [AC_CACHE_CHECK([for $1 value needed for large files], $3, + [$3=no + AC_TRY_COMPILE([$5], + [$6], + , + [AC_TRY_COMPILE([#define $1 $2] + [$5] + , + [$6], + [$3=$2])])]) + if test "[$]$3" != no; then + AC_DEFINE_UNQUOTED([$1], [$]$3, [$4]) + fi]) + + AC_DEFUN(AC_SYS_LARGEFILE, + [AC_REQUIRE([AC_PROG_CC]) + AC_ARG_ENABLE(largefile, + [ --disable-largefile omit support for large files]) + if test "$enable_largefile" != no; then + + AC_CACHE_CHECK([for special C compiler options needed for large files], + ac_cv_sys_largefile_CC, + [ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , , + [ac_save_CC="$CC" + CC="$CC -n32" + AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , + ac_cv_sys_largefile_CC=' -n32') + CC="$ac_save_CC"]) + fi]) + if test "$ac_cv_sys_largefile_CC" != no; then + CC="$CC$ac_cv_sys_largefile_CC" + fi + + AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, + ac_cv_sys_file_offset_bits, + [Number of bits in a file offset, on hosts where this is settable.], + AC_SYS_LARGEFILE_TEST_INCLUDES) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, + ac_cv_sys_large_files, + [Define for large files, on AIX-style hosts.], + AC_SYS_LARGEFILE_TEST_INCLUDES) + fi + ]) + + AC_DEFUN(AC_FUNC_FSEEKO, + [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1, + ac_cv_sys_largefile_source, + [Define to make fseeko visible on some hosts (e.g. glibc 2.2).], + [#include ], [return !fseeko;]) + # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug + # in glibc 2.1.3, but that breaks too many other things. + # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. + + AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko, + [ac_cv_func_fseeko=no + AC_TRY_LINK([#include ], + [return fseeko && fseeko (stdin, 0, 0);], + [ac_cv_func_fseeko=yes])]) + if test $ac_cv_func_fseeko != no; then + AC_DEFINE(HAVE_FSEEKO, 1, + [Define if fseeko (and presumably ftello) exists and is declared.]) + fi]) + + dnl + dnl arch.m4 --- autoconf input file for gawk + dnl + dnl Copyright (C) 1995, 1996, 1998, 1999, 2000 the Free Software Foundation, Inc. + dnl + dnl This file is part of GAWK, the GNU implementation of the + dnl AWK Progamming Language. + dnl + dnl GAWK is free software; you can redistribute it and/or modify + dnl it under the terms of the GNU General Public License as published by + dnl the Free Software Foundation; either version 2 of the License, or + dnl (at your option) any later version. + dnl + dnl GAWK is distributed in the hope that it will be useful, + dnl but WITHOUT ANY WARRANTY; without even the implied warranty of + dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + dnl GNU General Public License for more details. + dnl + dnl You should have received a copy of the GNU General Public License + dnl along with this program; if not, write to the Free Software + dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + dnl + + dnl Check for AIX and add _XOPEN_SOURCE_EXTENDED + AC_DEFUN(GAWK_AC_AIX_TWEAK, [ + AC_MSG_CHECKING([for AIX compilation hacks]) + AC_CACHE_VAL(gawk_cv_aix_hack, [ + if test -d /lpp/bos + then + CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED=1" + gawk_cv_aix_hack=yes + else + gawk_cv_aix_hack=no + fi + ])dnl + AC_MSG_RESULT([${gawk_cv_aix_hack}]) + ])dnl + + dnl Check for Alpha Linux systems + AC_DEFUN(GAWK_AC_LINUX_ALPHA, [ + AC_MSG_CHECKING([for Linux/Alpha compilation hacks]) + AC_CACHE_VAL(gawk_cv_linux_alpha_hack, [ + if test "Linux" = "`uname`" && test "alpha" = "`uname -m`" + then + # this isn't necessarily always true, + # the vendor's compiler is also often found + if test "$GCC" = yes + then + CFLAGS="$CFLAGS -mieee" + gawk_cv_linux_alpha_hack=yes + else + gawk_cv_linux_alpha_hack=no + fi + else + gawk_cv_linux_alpha_hack=no + fi + ])dnl + AC_MSG_RESULT([${gawk_cv_linux_alpha_hack}]) + ])dnl + + + # serial 1 + + # @defmac AC_PROG_CC_STDC + # @maindex PROG_CC_STDC + # @ovindex CC + # If the C compiler in not in ANSI C mode by default, try to add an option + # to output variable @code{CC} to make it so. This macro tries various + # options that select ANSI C on some system or another. It considers the + # compiler to be in ANSI C mode if it handles function prototypes correctly. + # + # If you use this macro, you should check after calling it whether the C + # compiler has been set to accept ANSI C; if not, the shell variable + # @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source + # code in ANSI C, you can make an un-ANSIfied copy of it by using the + # program @code{ansi2knr}, which comes with Ghostscript. + # @end defmac + + AC_DEFUN([AM_PROG_CC_STDC], + [AC_REQUIRE([AC_PROG_CC]) + AC_BEFORE([$0], [AC_C_INLINE]) + AC_BEFORE([$0], [AC_C_CONST]) + dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require + dnl a magic option to avoid problems with ANSI preprocessor commands + dnl like #elif. + dnl FIXME: can't do this because then AC_AIX won't work due to a + dnl circular dependency. + dnl AC_BEFORE([$0], [AC_PROG_CPP]) + AC_MSG_CHECKING([for ${CC-cc} option to accept ANSI C]) + AC_CACHE_VAL(am_cv_prog_cc_stdc, + [am_cv_prog_cc_stdc=no + ac_save_CC="$CC" + # Don't try gcc -ansi; that turns off useful extensions and + # breaks some systems' header files. + # AIX -qlanglvl=ansi + # Ultrix and OSF/1 -std1 + # HP-UX 10.20 and later -Ae + # HP-UX older versions -Aa -D_HPUX_SOURCE + # SVR4 -Xc -D__EXTENSIONS__ + for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" + do + CC="$ac_save_CC $ac_arg" + AC_TRY_COMPILE( + [#include + #include + #include + #include + /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ + struct buf { int x; }; + FILE * (*rcsopen) (struct buf *, struct stat *, int); + static char *e (p, i) + char **p; + int i; + { + return p[i]; + } + static char *f (char * (*g) (char **, int), char **p, ...) + { + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; + } + int test (int i, double x); + struct s1 {int (*f) (int a);}; + struct s2 {int (*f) (double a);}; + int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); + int argc; + char **argv; + ], [ + return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ], + [am_cv_prog_cc_stdc="$ac_arg"; break]) + done + CC="$ac_save_CC" + ]) + if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) + else + AC_MSG_RESULT([$am_cv_prog_cc_stdc]) + fi + case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; + esac + ]) + + + # serial 1 + + AC_DEFUN([AM_C_PROTOTYPES], + [AC_REQUIRE([AM_PROG_CC_STDC]) + AC_REQUIRE([AC_PROG_CPP]) + AC_MSG_CHECKING([for function prototypes]) + if test "$am_cv_prog_cc_stdc" != no; then + AC_MSG_RESULT(yes) + AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes]) + U= ANSI2KNR= + else + AC_MSG_RESULT(no) + U=_ ANSI2KNR=./ansi2knr + fi + # Ensure some checks needed by ansi2knr itself. + AC_HEADER_STDC + AC_CHECK_HEADERS(string.h) + AC_SUBST(U)dnl + AC_SUBST(ANSI2KNR)dnl + ]) + + # gettext.m4 serial 14 (gettext-0.11.2) + dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + dnl + dnl This file can can be used in projects which are not available under + dnl the GNU General Public License or the GNU Library General Public + dnl License but which still want to provide support for the GNU gettext + dnl functionality. + dnl Please note that the actual code of the GNU gettext library is covered + dnl by the GNU Library General Public License, and the rest of the GNU + dnl gettext package package is covered by the GNU General Public License. + dnl They are *not* in the public domain. + + dnl Authors: + dnl Ulrich Drepper , 1995-2000. + dnl Bruno Haible , 2000-2002. + + dnl Macro to add for using GNU gettext. + + dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). + dnl INTLSYMBOL can be one of 'external', 'no-libtool', 'use-libtool'. The + dnl default (if it is not specified or empty) is 'no-libtool'. + dnl INTLSYMBOL should be 'external' for packages with no intl directory, + dnl and 'no-libtool' or 'use-libtool' for packages with an intl directory. + dnl If INTLSYMBOL is 'use-libtool', then a libtool library + dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, + dnl depending on --{enable,disable}-{shared,static} and on the presence of + dnl AM-DISABLE-SHARED). If INTLSYMBOL is 'no-libtool', a static library + dnl $(top_builddir)/intl/libintl.a will be created. + dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext + dnl implementations (in libc or libintl) without the ngettext() function + dnl will be ignored. + dnl INTLDIR is used to find the intl libraries. If empty, + dnl the value `$(top_builddir)/intl/' is used. + dnl + dnl The result of the configuration is one of three cases: + dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled + dnl and used. + dnl Catalog format: GNU --> install in $(datadir) + dnl Catalog extension: .mo after installation, .gmo in source tree + dnl 2) GNU gettext has been found in the system's C library. + dnl Catalog format: GNU --> install in $(datadir) + dnl Catalog extension: .mo after installation, .gmo in source tree + dnl 3) No internationalization, always use English msgid. + dnl Catalog format: none + dnl Catalog extension: none + dnl If INTLSYMBOL is 'external', only cases 2 and 3 can occur. + dnl The use of .gmo is historical (it was needed to avoid overwriting the + dnl GNU format catalogs when building on a platform with an X/Open gettext), + dnl but we keep it in order not to force irrelevant filename changes on the + dnl maintainers. + dnl + AC_DEFUN([AM_GNU_GETTEXT], + [ + dnl Argument checking. + ifelse([$1], [], , [ifelse([$1], [external], , [ifelse([$1], [no-libtool], , [ifelse([$1], [use-libtool], , + [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT + ])])])])]) + ifelse([$2], [], , [ifelse([$2], [need-ngettext], , + [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT + ])])]) + define(gt_included_intl, ifelse([$1], [external], [no], [yes])) + define(gt_libtool_suffix_prefix, ifelse([$1], [use-libtool], [l], [])) + + AC_REQUIRE([AM_PO_SUBDIRS])dnl + ifelse(gt_included_intl, yes, [ + AC_REQUIRE([AM_INTL_SUBDIR])dnl + ]) + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + + ifelse(gt_included_intl, yes, [ + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + ]) + LIBINTL= + LTLIBINTL= + POSUB= + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + ifelse(gt_included_intl, yes, [ + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + ]) + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If GNU gettext is available we use this. Else we have + dnl to fall back to GNU NLS library. + + dnl Add a version number to the cache macros. + define([gt_api_version], ifelse([$2], [need-ngettext], 2, 1)) + define([gt_cv_func_gnugettext_libc], [gt_cv_func_gnugettext]gt_api_version[_libc]) + define([gt_cv_func_gnugettext_libintl], [gt_cv_func_gnugettext]gt_api_version[_libintl]) + + AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc, + [AC_TRY_LINK([#include + extern int _nl_msg_cat_cntr; + extern int *_nl_domain_bindings;], + [bindtextdomain ("", ""); + return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_domain_bindings], + gt_cv_func_gnugettext_libc=yes, + gt_cv_func_gnugettext_libc=no)]) + + if test "$gt_cv_func_gnugettext_libc" != "yes"; then + dnl Sometimes libintl requires libiconv, so first search for libiconv. + ifelse(gt_included_intl, yes, , [ + AM_ICONV_LINK + ]) + dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL + dnl accordingly. Don't use AC_LIB_LINKFLAGS_BODY([intl],[iconv]) + dnl because that would add "-liconv" to LIBINTL and LTLIBINTL + dnl even if libiconv doesn't exist. + AC_LIB_LINKFLAGS_BODY([intl]) + AC_CACHE_CHECK([for GNU gettext in libintl], + gt_cv_func_gnugettext_libintl, + [gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + dnl Now see whether libintl exists and does not depend on libiconv. + AC_TRY_LINK([#include + extern int _nl_msg_cat_cntr; + extern + #ifdef __cplusplus + "C" + #endif + const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); + return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + gt_cv_func_gnugettext_libintl=yes, + gt_cv_func_gnugettext_libintl=no) + dnl Now see whether libintl exists and depends on libiconv. + if test "$gt_cv_func_gnugettext_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include + extern int _nl_msg_cat_cntr; + extern + #ifdef __cplusplus + "C" + #endif + const char *_nl_expand_alias ();], + [bindtextdomain ("", ""); + return (int) gettext ("")]ifelse([$2], [need-ngettext], [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr + *_nl_expand_alias (0)], + [LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext_libintl=yes + ]) + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS"]) + fi + + dnl If an already present or preinstalled GNU gettext() is found, + dnl use it. But if this macro is used in GNU gettext, and GNU + dnl gettext is already preinstalled in libintl, we update this + dnl libintl. (Cf. the install rule in intl/Makefile.in.) + if test "$gt_cv_func_gnugettext_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + gt_use_preinstalled_gnugettext=yes + else + dnl Reset the values set by searching for libintl. + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + ifelse(gt_included_intl, yes, [ + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + dnl GNU gettext is not found in the C library. + dnl Fall back on included GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + INTLOBJS="\$(GETTOBJS)" + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LIBICONV" + LTLIBINTL="ifelse([$3],[],\${top_builddir}/intl,[$3])/libintl.[]gt_libtool_suffix_prefix[]a $LTLIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions to use GNU gettext tools. + CATOBJEXT=.gmo + fi + ]) + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + AC_DEFINE(ENABLE_NLS, 1, + [Define to 1 if translation of program messages to the user's native language + is requested.]) + else + USE_NLS=no + fi + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext_libintl" = "yes"; then + AC_MSG_CHECKING([how to link with libintl]) + AC_MSG_RESULT([$LIBINTL]) + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCINTL]) + fi + + dnl For backward compatibility. Some packages may be using this. + AC_DEFINE(HAVE_GETTEXT, 1, + [Define if the GNU gettext() function is already present or preinstalled.]) + AC_DEFINE(HAVE_DCGETTEXT, 1, + [Define if the GNU dcgettext() function is already present or preinstalled.]) + fi + + dnl We need to process the po/ directory. + POSUB=po + fi + + ifelse(gt_included_intl, yes, [ + dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL + dnl to 'yes' because some of the testsuite requires it. + if test "$PACKAGE" = gettext; then + BUILD_INCLUDED_LIBINTL=yes + fi + + dnl Make all variables we use known to autoconf. + AC_SUBST(BUILD_INCLUDED_LIBINTL) + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATOBJEXT) + AC_SUBST(INTLOBJS) + + dnl For backward compatibility. Some configure.ins may be using this. + nls_cv_header_intl= + nls_cv_header_libgt= + + dnl For backward compatibility. Some Makefiles may be using this. + DATADIRNAME=share + AC_SUBST(DATADIRNAME) + + dnl For backward compatibility. Some Makefiles may be using this. + INSTOBJEXT=.mo + AC_SUBST(INSTOBJEXT) + + dnl For backward compatibility. Some Makefiles may be using this. + GENCAT=gencat + AC_SUBST(GENCAT) + + dnl Enable libtool support if the surrounding package wishes it. + INTL_LIBTOOL_SUFFIX_PREFIX=gt_libtool_suffix_prefix + AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX) + ]) + + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST(INTLLIBS) + + dnl Make all documented variables known to autoconf. + AC_SUBST(LIBINTL) + AC_SUBST(LTLIBINTL) + AC_SUBST(POSUB) + ]) + + + dnl Checks for all prerequisites of the po subdirectory, + dnl except for USE_NLS. + AC_DEFUN([AM_PO_SUBDIRS], + [ + AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + + dnl Perform the following tests also if --disable-nls has been given, + dnl because they are needed for "make dist" to work. + + dnl Search for GNU msgfmt in the PATH. + dnl The first test excludes Solaris msgfmt and early GNU msgfmt versions. + dnl The second test excludes FreeBSD msgfmt. + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [$ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + + dnl Search for GNU xgettext 0.11 or newer in the PATH. + dnl The first test excludes Solaris xgettext and early GNU xgettext versions. + dnl The second test excludes FreeBSD xgettext. + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [$ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi)], + :) + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + + dnl Search for GNU msgmerge 0.11 or newer in the PATH. + AM_PATH_PROG_WITH_TEST(MSGMERGE, msgmerge, + [$ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1], :) + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU msgfmt. + if test "$GMSGFMT" != ":"; then + dnl If it is no GNU msgfmt we define it as : so that the + dnl Makefiles still can work. + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + AC_MSG_RESULT( + [found $GMSGFMT program is not GNU msgfmt; ignore it]) + GMSGFMT=":" + fi + fi + + dnl This could go away some day; the PATH_PROG_WITH_TEST already does it. + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + AC_MSG_RESULT( + [found xgettext program is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + dnl Remove leftover from FreeBSD xgettext call. + rm -f messages.po + fi + + AC_OUTPUT_COMMANDS([ + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + fi + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + GMOFILES= + UPDATEPOFILES= + DUMMYPOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done], + [# Capture the value of obsolete $ALL_LINGUAS because we need it to compute + # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # from automake. + eval 'ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + ]) + ]) + + + dnl Checks for all prerequisites of the intl subdirectory, + dnl except for INTL_LIBTOOL_SUFFIX_PREFIX (and possibly LIBTOOL), INTLOBJS, + dnl USE_INCLUDED_LIBINTL, BUILD_INCLUDED_LIBINTL. + AC_DEFUN([AM_INTL_SUBDIR], + [ + AC_REQUIRE([AC_PROG_INSTALL])dnl + AC_REQUIRE([AM_MKINSTALLDIRS])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + AC_REQUIRE([AC_PROG_RANLIB])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + AC_REQUIRE([jm_GLIBC21])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ + stdlib.h string.h unistd.h sys/param.h]) + AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ + geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ + strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next]) + + AM_ICONV + AM_LANGINFO_CODESET + AM_LC_MESSAGES + + dnl intl/plural.c is generated from intl/plural.y. It requires bison, + dnl because plural.y uses bison specific features. It requires at least + dnl bison-1.26 because earlier versions generate a plural.c that doesn't + dnl compile. + dnl bison is only needed for the maintainer (who touches plural.y). But in + dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put + dnl the rule in general Makefile. Now, some people carelessly touch the + dnl files or have a broken "make" program, hence the plural.c rule will + dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not + dnl present or too old. + AC_CHECK_PROGS([INTLBISON], [bison]) + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + dnl Found it, now check the version. + AC_MSG_CHECKING([version of bison]) + changequote(<<,>>)dnl + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) + changequote([,])dnl + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + AC_MSG_RESULT([$ac_prog_version]) + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi + ]) + + + AC_DEFUN([AM_MKINSTALLDIRS], + [ + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but $(top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + ]) + + # lib-prefix.m4 serial 1 (gettext-0.11) + dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + + dnl From Bruno Haible. + + dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed + dnl to access previously installed libraries. The basic assumption is that + dnl a user will want packages to use other packages he previously installed + dnl with the same --prefix option. + dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate + dnl libraries, but is otherwise very convenient. + AC_DEFUN([AC_LIB_PREFIX], + [ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH([lib-prefix], + [ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], + [ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + ]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi + ]) + + dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, + dnl acl_final_exec_prefix, containing the values to which $prefix and + dnl $exec_prefix will expand at the end of the configure script. + AC_DEFUN([AC_LIB_PREPARE_PREFIX], + [ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + ]) + + dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the + dnl variables prefix and exec_prefix bound to the values they will have + dnl at the end of the configure script. + AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], + [ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + ]) + + # lib-link.m4 serial 2 (gettext-0.11.2) + dnl Copyright (C) 2001-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + + dnl From Bruno Haible. + + dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and + dnl the libraries corresponding to explicit and implicit dependencies. + dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and + dnl augments the CPPFLAGS variable. + AC_DEFUN([AC_LIB_LINKFLAGS], + [ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + undefine([Name]) + undefine([NAME]) + ]) + + dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode) + dnl searches for libname and the libraries corresponding to explicit and + dnl implicit dependencies, together with the specified include files and + dnl the ability to compile and link the specified testcode. If found, it + dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and + dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and + dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs + dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. + AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], + [ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + define([Name],[translit([$1],[./-], [___])]) + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + LIBS="$LIBS $LIB[]NAME" + AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no]) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + undefine([Name]) + undefine([NAME]) + ]) + + dnl Determine the platform dependent parameters needed to use rpath: + dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator, + dnl hardcode_direct, hardcode_minus_L, + dnl sys_lib_search_path_spec, sys_lib_dlsearch_path_spec. + AC_DEFUN([AC_LIB_RPATH], + [ + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" + sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" + ]) + + dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and + dnl the libraries corresponding to explicit and implicit dependencies. + dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. + AC_DEFUN([AC_LIB_LINKFLAGS_BODY], + [ + define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH([lib$1-prefix], + [ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib + --without-lib$1-prefix don't search for lib$1 in includedir and libdir], + [ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + ]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "X$found_dir" = "X/usr/lib"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi + ]) + + dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, + dnl unless already present in VAR. + dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes + dnl contains two or three consecutive elements that belong together. + AC_DEFUN([AC_LIB_APPENDTOVAR], + [ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done + ]) + + # lib-ld.m4 serial 1 (gettext-0.11) + dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + + dnl Subroutines of libtool.m4, + dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision + dnl with libtool.m4. + + dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. + AC_DEFUN([AC_LIB_PROG_LD_GNU], + [AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld, + [# I'd rather use --version here, but apparently some GNU ld's only accept -v. + if $LD -v 2>&1 &5; then + acl_cv_prog_gnu_ld=yes + else + acl_cv_prog_gnu_ld=no + fi]) + with_gnu_ld=$acl_cv_prog_gnu_ld + ]) + + dnl From libtool-1.4. Sets the variable LD. + AC_DEFUN([AC_LIB_PROG_LD], + [AC_ARG_WITH(gnu-ld, + [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], + test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_CANONICAL_HOST])dnl + ac_prog=ld + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) + else + AC_MSG_CHECKING([for non-GNU ld]) + fi + AC_CACHE_VAL(acl_cv_path_LD, + [if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + else + acl_cv_path_LD="$LD" # Let the user override the test with a path. + fi]) + LD="$acl_cv_path_LD" + if test -n "$LD"; then + AC_MSG_RESULT($LD) + else + AC_MSG_RESULT(no) + fi + test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) + AC_LIB_PROG_LD_GNU + ]) + + # iconv.m4 serial AM3 (gettext-0.11) + dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + + dnl From Bruno Haible. + + AC_DEFUN([AM_ICONV_LINK], + [ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + + dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([iconv]) + + dnl Add $INCICONV to CPPFLAGS before performing the following checks, + dnl because if the user has installed libiconv and not disabled its use + dnl via --without-libiconv-prefix, he wants to use it. The first + dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed. + am_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include + #include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_TRY_LINK([#include + #include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST(LIBICONV) + AC_SUBST(LTLIBICONV) + ]) + + AC_DEFUN([AM_ICONV], + [ + AC_REQUIRE([AM_ICONV_LINK]) + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ + #include + #include + extern + #ifdef __cplusplus + "C" + #endif + #if defined(__STDC__) || defined(__cplusplus) + size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); + #else + size_t iconv(); + #endif + ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi + ]) + + # progtest.m4 serial 2 (gettext-0.10.40) + dnl Copyright (C) 1996-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + dnl + dnl This file can can be used in projects which are not available under + dnl the GNU General Public License or the GNU Library General Public + dnl License but which still want to provide support for the GNU gettext + dnl functionality. + dnl Please note that the actual code of the GNU gettext library is covered + dnl by the GNU Library General Public License, and the rest of the GNU + dnl gettext package package is covered by the GNU General Public License. + dnl They are *not* in the public domain. + + dnl Authors: + dnl Ulrich Drepper , 1996. + + # Search path for a program which passes the given test. + + dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, + dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) + AC_DEFUN([AM_PATH_PROG_WITH_TEST], + [# Extract the first word of "$2", so it can be a program name with args. + set dummy $2; ac_word=[$]2 + AC_MSG_CHECKING([for $ac_word]) + AC_CACHE_VAL(ac_cv_path_$1, + [case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + dnl If no 4th arg is given, leave the cache variable unset, + dnl so AC_PATH_PROGS will keep looking. + ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" + ])dnl + ;; + esac])dnl + $1="$ac_cv_path_$1" + if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then + AC_MSG_RESULT([$]$1) + else + AC_MSG_RESULT(no) + fi + AC_SUBST($1)dnl + ]) + + # glibc21.m4 serial 2 (fileutils-4.1.3, gettext-0.10.40) + dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + + # Test for the GNU C Library, version 2.1 or newer. + # From Bruno Haible. + + AC_DEFUN([jm_GLIBC21], + [ + AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer, + ac_cv_gnu_library_2_1, + [AC_EGREP_CPP([Lucky GNU user], + [ + #include + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif + #endif + ], + ac_cv_gnu_library_2_1=yes, + ac_cv_gnu_library_2_1=no) + ] + ) + AC_SUBST(GLIBC21) + GLIBC21="$ac_cv_gnu_library_2_1" + ] + ) + + # codeset.m4 serial AM1 (gettext-0.10.40) + dnl Copyright (C) 2000-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + + dnl From Bruno Haible. + + 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);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi + ]) + + # lcmessage.m4 serial 2 (gettext-0.10.40) + dnl Copyright (C) 1995-2002 Free Software Foundation, Inc. + dnl This file is free software, distributed under the terms of the GNU + dnl General Public License. As a special exception to the GNU General + dnl Public License, this file may be distributed as part of a program + dnl that contains a configuration script generated by Autoconf, under + dnl the same distribution terms as the rest of that program. + dnl + dnl This file can can be used in projects which are not available under + dnl the GNU General Public License or the GNU Library General Public + dnl License but which still want to provide support for the GNU gettext + dnl functionality. + dnl Please note that the actual code of the GNU gettext library is covered + dnl by the GNU Library General Public License, and the rest of the GNU + dnl gettext package package is covered by the GNU General Public License. + dnl They are *not* in the public domain. + + dnl Authors: + dnl Ulrich Drepper , 1995. + + # Check whether LC_MESSAGES is available in . + + AC_DEFUN([AM_LC_MESSAGES], + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include ], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES, 1, + [Define if your file defines LC_MESSAGES.]) + fi + fi]) + + #serial 1 + + dnl AC_PREREQ(2.14a) + + dnl This is a specialization of AC_CHECK_TYPE applied to `ssize_t' with + dnl the difference that it also includes unistd.h on systems that have it. + dnl On Fujitsu UXP/V systems ssize_t is defined in unistd.h. + AC_DEFUN(GAWK_AC_TYPE_SSIZE_T, + [ + AC_CHECK_HEADERS(unistd.h) + AC_CHECK_TYPE(ssize_t, int, + [ + #include + #if STDC_HEADERS + # include + # include + #endif + #if HAVE_UNISTD_H + # include + #endif + ] + ) + ] + ) + + dnl + dnl strtod.m4 --- autoconf input file for gawk + dnl + dnl Copyright (C) 2001, 2002 the Free Software Foundation, Inc. + dnl + dnl This file is part of GAWK, the GNU implementation of the + dnl AWK Progamming Language. + dnl + dnl GAWK is free software; you can redistribute it and/or modify + dnl it under the terms of the GNU General Public License as published by + dnl the Free Software Foundation; either version 2 of the License, or + dnl (at your option) any later version. + dnl + dnl GAWK is distributed in the hope that it will be useful, + dnl but WITHOUT ANY WARRANTY; without even the implied warranty of + dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + dnl GNU General Public License for more details. + dnl + dnl You should have received a copy of the GNU General Public License + dnl along with this program; if not, write to the Free Software + dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + + dnl Check for strtod with C89 semantics + + AC_DEFUN(GAWK_AC_FUNC_STRTOD_C89, + [ + AC_CHECK_HEADERS(stdlib.h) + AC_CHECK_FUNCS(strtod) + AC_CACHE_CHECK([for strtod with C89 semantics], gawk_ac_cv_func_strtod_c89, + [AC_TRY_RUN( + [/* Test program from Arnold Robbins (arnold@skeeve.com) */ + #if HAVE_STDLIB_H + #include + #else + extern double strtod(); + #endif + + int + main () + { + #if ! HAVE_STRTOD + exit(1); + #else + double d; + char *str = "0x345a"; + + d = strtod(str, 0); + if (d == 0) + exit (0); + else + exit (1); + #endif + }], + gawk_ac_cv_func_strtod_c89=yes, gawk_ac_cv_func_strtod_c89=no, + gawk_ac_cv_func_strtod_c89=no)]) + if test $gawk_ac_cv_func_strtod_c89 = no; then + AC_DEFINE(STRTOD_NOT_C89) + fi + ])# GAWK_FUNC_STRTOD_C89 + + #serial 7 + + dnl From Jim Meyering. + dnl A wrapper around AC_FUNC_MKTIME. + + AC_DEFUN(jm_FUNC_MKTIME, + [AC_REQUIRE([AC_FUNC_MKTIME])dnl + + dnl mktime.c uses localtime_r if it exists. Check for it. + AC_CHECK_FUNCS(localtime_r) + + if test $ac_cv_func_working_mktime = no; then + AC_DEFINE_UNQUOTED(mktime, rpl_mktime, + [Define to rpl_mktime if the replacement function should be used.]) + fi + ]) + + # AC_FUNC_MKTIME + # -------------- + # Stolen from CVS Autoconf. Should be removed once you use Autoconf 2.15. + AC_DEFUN(AC_FUNC_MKTIME, + [AC_REQUIRE([AC_HEADER_TIME])dnl + AC_CHECK_HEADERS(sys/time.h unistd.h) + AC_CHECK_FUNCS(alarm) + AC_CACHE_CHECK([for working mktime], ac_cv_func_working_mktime, + [AC_TRY_RUN( + [/* Test program from Paul Eggert (eggert@twinsun.com) + and Tony Leneis (tony@plaza.ds.adp.com). */ + #if TIME_WITH_SYS_TIME + # include + # include + #else + # if HAVE_SYS_TIME_H + # include + # else + # include + # endif + #endif + + #if HAVE_UNISTD_H + # include + #endif + + #if !HAVE_ALARM + # define alarm(X) /* empty */ + #endif + + /* Work around redefinition to rpl_putenv by other config tests. */ + #undef putenv + + static time_t time_t_max; + + /* Values we'll use to set the TZ environment variable. */ + static const char *const tz_strings[] = { + (const char *) 0, "TZ=GMT0", "TZ=JST-9", + "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" + }; + #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) + + /* Fail if mktime fails to convert a date in the spring-forward gap. + Based on a problem report from Andreas Jaeger. */ + static void + spring_forward_gap () + { + /* glibc (up to about 1998-10-07) failed this test) */ + struct tm tm; + + /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" + instead of "TZ=America/Vancouver" in order to detect the bug even + on systems that don't support the Olson extension, or don't have the + full zoneinfo tables installed. */ + putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); + + tm.tm_year = 98; + tm.tm_mon = 3; + tm.tm_mday = 5; + tm.tm_hour = 2; + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_isdst = -1; + if (mktime (&tm) == (time_t)-1) + exit (1); + } + + static void + mktime_test (now) + time_t now; + { + struct tm *lt; + if ((lt = localtime (&now)) && mktime (lt) != now) + exit (1); + now = time_t_max - now; + if ((lt = localtime (&now)) && mktime (lt) != now) + exit (1); + } + + static void + irix_6_4_bug () + { + /* Based on code from Ariel Faigon. */ + struct tm tm; + tm.tm_year = 96; + tm.tm_mon = 3; + tm.tm_mday = 0; + tm.tm_hour = 0; + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_isdst = -1; + mktime (&tm); + if (tm.tm_mon != 2 || tm.tm_mday != 31) + exit (1); + } + + static void + bigtime_test (j) + int j; + { + struct tm tm; + time_t now; + tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; + now = mktime (&tm); + if (now != (time_t) -1) + { + struct tm *lt = localtime (&now); + if (! (lt + && lt->tm_year == tm.tm_year + && lt->tm_mon == tm.tm_mon + && lt->tm_mday == tm.tm_mday + && lt->tm_hour == tm.tm_hour + && lt->tm_min == tm.tm_min + && lt->tm_sec == tm.tm_sec + && lt->tm_yday == tm.tm_yday + && lt->tm_wday == tm.tm_wday + && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) + == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) + exit (1); + } + } + + int + main () + { + time_t t, delta; + int i, j; + + /* This test makes some buggy mktime implementations loop. + Give up after 60 seconds; a mktime slower than that + isn't worth using anyway. */ + alarm (60); + + for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) + continue; + time_t_max--; + delta = time_t_max / 997; /* a suitable prime number */ + for (i = 0; i < N_STRINGS; i++) + { + if (tz_strings[i]) + putenv (tz_strings[i]); + + for (t = 0; t <= time_t_max - delta; t += delta) + mktime_test (t); + mktime_test ((time_t) 60 * 60); + mktime_test ((time_t) 60 * 60 * 24); + + for (j = 1; 0 < j; j *= 2) + bigtime_test (j); + bigtime_test (j - 1); + } + irix_6_4_bug (); + spring_forward_gap (); + exit (0); + }], + ac_cv_func_working_mktime=yes, ac_cv_func_working_mktime=no, + ac_cv_func_working_mktime=no)]) + if test $ac_cv_func_working_mktime = no; then + LIBOBJS="$LIBOBJS mktime.${ac_objext}" + fi + ])# AC_FUNC_MKTIME + dnl + dnl socket.m4 --- autoconf input file for gawk + dnl + dnl Copyright (C) 1995, 96, 98, 99, 2000 the Free Software Foundation, Inc. + dnl + dnl This file is part of GAWK, the GNU implementation of the + dnl AWK Progamming Language. + dnl + dnl GAWK is free software; you can redistribute it and/or modify + dnl it under the terms of the GNU General Public License as published by + dnl the Free Software Foundation; either version 2 of the License, or + dnl (at your option) any later version. + dnl + dnl GAWK is distributed in the hope that it will be useful, + dnl but WITHOUT ANY WARRANTY; without even the implied warranty of + dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + dnl GNU General Public License for more details. + dnl + dnl You should have received a copy of the GNU General Public License + dnl along with this program; if not, write to the Free Software + dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + dnl + + dnl Find the socket libraries + dnl largely stolen from AC_PATH_XTRA + AC_DEFUN(GAWK_AC_LIB_SOCKETS, [ + gawk_have_sockets=no + # Check for system-dependent location of socket libraries + + SOCKET_LIBS= + if test "$ISC" = yes; then + SOCKET_LIBS="-lnsl_s -linet" + else + # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And karl@cs.umb.edu says + # the Alpha needs dnet_stub (dnet does not exist). + # + # ADR: Is this needed just for sockets??? + # AC_CHECK_LIB(dnet, dnet_ntoa, [SOCKET_LIBS="$SOCKET_LIBS -ldnet"]) + # if test $ac_cv_lib_dnet_ntoa = no; then + # AC_CHECK_LIB(dnet_stub, dnet_ntoa, + # [SOCKET_LIBS="$SOCKET_LIBS -ldnet_stub"]) + # fi + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to dickey@clark.net. + AC_CHECK_FUNC(gethostbyname) + if test $ac_cv_func_gethostbyname = no; then + AC_CHECK_LIB(nsl, gethostbyname, SOCKET_LIBS="$SOCKET_LIBS -lnsl") + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says simon@lia.di.epfl.ch: it contains + # gethostby* variants that don't use the nameserver (or something). + # -lsocket must be given before -lnsl if both are needed. + # We assume that if connect needs -lnsl, so does gethostbyname. + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, SOCKET_LIBS="-lsocket $SOCKET_LIBS" + gawk_have_sockets=yes, , + $SOCKET_LIBS) + else + gawk_have_sockets=yes + fi + fi + + if test "${gawk_have_sockets}" = "yes" + then + AC_MSG_CHECKING([where to find the socket library calls]) + case "${SOCKET_LIBS}" in + ?*) gawk_lib_loc="${SOCKET_LIBS}" ;; + *) gawk_lib_loc="the standard library" ;; + esac + AC_MSG_RESULT([${gawk_lib_loc}]) + + AC_DEFINE(HAVE_SOCKETS) + fi + AC_SUBST(SOCKET_LIBS)dnl + ])dnl + diff -crN gawk-3.1.0/array.c gawk-3.1.1/array.c *** gawk-3.1.0/array.c Tue Feb 20 16:35:24 2001 --- gawk-3.1.1/array.c Tue Apr 16 14:40:06 2002 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-2002 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 270,276 **** register int hash1; register NODE *bucket; ! assert(symbol->type == Node_var_array || symbol->type == Node_var); (void) force_string(subs); --- 270,278 ---- register int hash1; register NODE *bucket; ! /* protect against silly users, e.g. FS[1] = "x" */ ! if (symbol->type != Node_var_array && symbol->type != Node_var) ! fatal(_("attempt to use scalar `%s' as array"), symbol->vname); (void) force_string(subs); *************** *** 607,613 **** a = tree->lnode; if (a->type == Node_param_list) { ! printf(_("%s: is paramater\n"), a->vname); a = stack_ptr[a->param_cnt]; } --- 609,615 ---- a = tree->lnode; if (a->type == Node_param_list) { ! printf(_("%s: is parameter\n"), a->vname); a = stack_ptr[a->param_cnt]; } diff -crN gawk-3.1.0/awk.h gawk-3.1.1/awk.h *** gawk-3.1.0/awk.h Sun Apr 22 16:44:13 2001 --- gawk-3.1.1/awk.h Tue Apr 16 14:40:18 2002 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-2002 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 49,69 **** #include #include ! #if defined(HAVE_LIBINTL_H) && defined(ENABLE_NLS) && ENABLE_NLS > 0 ! #include ! #else /* ! (HAVE_LOCALE_H && defined(ENABLE_NLS) && ENABLE_LS > 0) */ ! #define gettext(msgid) (msgid) ! #define gettext_noop(msgid) msgid ! #define dgettext(domain, msgid) (msgid) ! #define dcgettext(domain, msgid, cat) (msgid) ! #define bindtextdomain(domain, directory) (directory) ! #define textdomain(package) /* nothing */ #ifndef LOCALEDIR #define LOCALEDIR NULL #endif /* LOCALEDIR */ ! #endif /* ! (HAVE_LOCALE_H && defined(ENABLE_NLS) && ENABLE_LS > 0) */ ! #define _(msgid) gettext(msgid) ! #define N_(msgid) msgid #ifdef HAVE_LOCALE_H #include --- 49,63 ---- #include #include ! #include "gettext.h" ! #define _(msgid) gettext(msgid) ! #define N_(msgid) msgid ! ! #if ! (defined(HAVE_LIBINTL_H) && defined(ENABLE_NLS) && ENABLE_NLS > 0) #ifndef LOCALEDIR #define LOCALEDIR NULL #endif /* LOCALEDIR */ ! #endif #ifdef HAVE_LOCALE_H #include *************** *** 82,87 **** --- 76,87 ---- #ifdef HAVE_SIGNUM_H #include #endif + #if defined(HAVE_MBRLEN) && defined(HAVE_MBRTOWC) && defined(HAVE_WCHAR_H) && defined(HAVE_WCTYPE_H) + /* We can handle multibyte strings. */ + #define MBS_SUPPORT + #include + #include + #endif /* ----------------- System dependencies (with more includes) -----------*/ *************** *** 116,124 **** #define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper ((unsigned char) c)) #define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit ((unsigned char) c)) #define TOUPPER(c) toupper((unsigned char) c) #define TOLOWER(c) tolower((unsigned char) c) ! #ifdef __STDC__ #define P(s) s --- 116,127 ---- #define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper ((unsigned char) c)) #define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit ((unsigned char) c)) + #ifndef TOUPPER #define TOUPPER(c) toupper((unsigned char) c) + #endif + #ifndef TOLOWER #define TOLOWER(c) tolower((unsigned char) c) ! #endif #ifdef __STDC__ #define P(s) s *************** *** 139,144 **** --- 142,151 ---- #include /* avoid in io.c */ #endif /* VMS */ + #if ! defined(S_ISREG) && defined(S_IFREG) + #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) + #endif + #ifdef STDC_HEADERS #include #else /* not STDC_HEADERS */ *************** *** 169,175 **** #include #endif /* atarist || VMS */ ! #if ! defined(MSDOS) && ! defined(OS2) && ! defined(WIN32) #define O_BINARY 0 #endif --- 176,182 ---- #include #endif /* atarist || VMS */ ! #if ! defined(MSDOS) && ! defined(OS2) && ! defined(WIN32) && ! defined(__EMX__) && ! defined(O_BINARY) /*duh*/ #define O_BINARY 0 #endif *************** *** 368,373 **** --- 375,381 ---- Node_cond_exp, /* lnode is conditonal, rnode is if_branches */ Node_regex, /* a regexp, text, compiled, flags, etc */ + Node_dynregex, /* a dynamic regexp */ Node_hashnode, /* an identifier in the symbol table */ Node_ahash, /* an array element */ Node_array_ref, /* array passed by ref as parameter */ *************** *** 641,646 **** --- 649,660 ---- extern int do_tidy_mem; extern int in_begin_rule; extern int in_end_rule; + extern int whiny_users; + + #if defined (HAVE_GETGROUPS) && defined(NGROUPS_MAX) && NGROUPS_MAX > 0 + extern GETGROUPS_T *groupset; + extern int ngroups; + #endif extern const char *myname; *************** *** 730,749 **** #ifdef HAVE_STRINGIZE #define emalloc(var,ty,x,str) (void)((var=(ty)malloc((MALLOC_ARG_T)(x))) ||\ ! (fatal("%s: %s: can't allocate memory (%s)",\ ! (str), #var, strerror(errno)),0)) #define erealloc(var,ty,x,str) (void)((var=(ty)realloc((char *)var,\ (MALLOC_ARG_T)(x))) ||\ ! (fatal("%s: %s: can't allocate memory (%s)",\ ! (str), #var, strerror(errno)),0)) #else /* HAVE_STRINGIZE */ #define emalloc(var,ty,x,str) (void)((var=(ty)malloc((MALLOC_ARG_T)(x))) ||\ ! (fatal("%s: %s: can't allocate memory (%s)",\ ! (str), "var", strerror(errno)),0)) #define erealloc(var,ty,x,str) (void)((var=(ty)realloc((char *)var,\ (MALLOC_ARG_T)(x))) ||\ ! (fatal("%s: %s: can't allocate memory (%s)",\ ! (str), "var", strerror(errno)),0)) #endif /* HAVE_STRINGIZE */ #ifdef GAWKDEBUG --- 744,763 ---- #ifdef HAVE_STRINGIZE #define emalloc(var,ty,x,str) (void)((var=(ty)malloc((MALLOC_ARG_T)(x))) ||\ ! (fatal(_("%s: %s: can't allocate %d bytes of memory (%s)"),\ ! (str), #var, x, strerror(errno)),0)) #define erealloc(var,ty,x,str) (void)((var=(ty)realloc((char *)var,\ (MALLOC_ARG_T)(x))) ||\ ! (fatal(_("%s: %s: can't allocate %d bytes of memory (%s)"),\ ! (str), #var, x, strerror(errno)),0)) #else /* HAVE_STRINGIZE */ #define emalloc(var,ty,x,str) (void)((var=(ty)malloc((MALLOC_ARG_T)(x))) ||\ ! (fatal(_("%s: %s: can't allocate %d bytes of memory (%s)"),\ ! (str), "var", x, strerror(errno)),0)) #define erealloc(var,ty,x,str) (void)((var=(ty)realloc((char *)var,\ (MALLOC_ARG_T)(x))) ||\ ! (fatal(_("%s: %s: can't allocate %d bytes of memory (%s)"),\ ! (str), "var", x, strerror(errno)),0)) #endif /* HAVE_STRINGIZE */ #ifdef GAWKDEBUG *************** *** 852,858 **** --- 866,877 ---- extern NODE *do_strtonum P((NODE *tree)); extern AWKNUM nondec2awknum P((char *str, size_t len)); extern NODE *do_dcgettext P((NODE *tree)); + extern NODE *do_dcngettext P((NODE *tree)); extern NODE *do_bindtextdomain P((NODE *tree)); + #ifdef MBS_SUPPORT + extern int strncasecmpmbs P((const char *, mbstate_t, const char *, + mbstate_t, size_t)); + #endif /* eval.c */ extern int interpret P((NODE *volatile tree)); extern NODE *r_tree_eval P((NODE *tree, int iscond)); diff -crN gawk-3.1.0/awkgram.y gawk-3.1.1/awkgram.y *** gawk-3.1.0/awkgram.y Mon Apr 23 10:25:58 2001 --- gawk-3.1.1/awkgram.y Tue Apr 16 14:40:13 2002 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-2002 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 56,61 **** --- 56,62 ---- static int isnoeffect P((NODETYPE t)); static int isassignable P((NODE *n)); static void dumpintlstr P((char *str, size_t len)); + static void dumpintlstr2 P((char *str1, size_t len1, char *str2, size_t len2)); static void count_args P((NODE *n)); enum defref { FUNC_DEFINE, FUNC_USE }; *************** *** 110,115 **** --- 111,117 ---- %type rexpression_list opt_rexpression_list %type expression_list opt_expression_list %type statements statement if_statement opt_param_list + %type simple_stmt opt_simple_stmt %type opt_exp opt_variable regexp %type input_redir output_redir %type print *************** *** 406,429 **** * Check that the body is a `delete a[i]' statement, * and that both the loop var and array names match. */ ! if ($8 != NULL && $8->type == Node_K_delete ! && $8->rnode != NULL ! && ($8->rnode->type == Node_var || $8->rnode->type == Node_param_list) ! && strcmp($3, $8->rnode->var_value->vname) == 0 ! && strcmp($5, $8->lnode->vname) == 0) { ! $8->type = Node_K_delete_loop; ! $$ = $8; } else { $$ = node($8, Node_K_arrayfor, make_for_loop(variable($3, CAN_FREE, Node_var), (NODE *) NULL, variable($5, CAN_FREE, Node_var_array))); } } ! | LEX_FOR '(' opt_exp semi opt_nls exp semi opt_nls opt_exp r_paren opt_nls statement { $$ = node($12, Node_K_for, (NODE *) make_for_loop($3, $6, $9)); } ! | LEX_FOR '(' opt_exp semi opt_nls semi opt_nls opt_exp r_paren opt_nls statement { $$ = node($11, Node_K_for, (NODE *) make_for_loop($3, (NODE *) NULL, $8)); --- 408,443 ---- * Check that the body is a `delete a[i]' statement, * and that both the loop var and array names match. */ ! if ($8 != NULL && $8->type == Node_K_delete) { ! NODE *arr, *sub; ! ! assert($8->rnode->type == Node_expression_list); ! arr = $8->lnode; /* array var */ ! sub = $8->rnode->lnode; /* index var */ ! ! if ( (arr->type == Node_var ! || arr->type == Node_var_array ! || arr->type == Node_param_list) ! && (sub->type == Node_var || sub->type == Node_param_list) ! && strcmp($3, sub->vname) == 0 ! && strcmp($5, arr->vname) == 0) { ! $8->type = Node_K_delete_loop; ! $$ = $8; ! } ! else ! goto regular_loop; } else { + regular_loop: $$ = node($8, Node_K_arrayfor, make_for_loop(variable($3, CAN_FREE, Node_var), (NODE *) NULL, variable($5, CAN_FREE, Node_var_array))); } } ! | LEX_FOR '(' opt_simple_stmt semi opt_nls exp semi opt_nls opt_simple_stmt r_paren opt_nls statement { $$ = node($12, Node_K_for, (NODE *) make_for_loop($3, $6, $9)); } ! | LEX_FOR '(' opt_simple_stmt semi opt_nls semi opt_nls opt_simple_stmt r_paren opt_nls statement { $$ = node($11, Node_K_for, (NODE *) make_for_loop($3, (NODE *) NULL, $8)); *************** *** 434,467 **** | LEX_CONTINUE statement_term /* similarly */ { $$ = node((NODE *) NULL, Node_K_continue, (NODE *) NULL); } - | print '(' expression_list r_paren output_redir statement_term - { - $$ = node($3, $1, $5); - if ($$->type == Node_K_printf) - count_args($$) - } - | print opt_rexpression_list output_redir statement_term - { - if ($1 == Node_K_print && $2 == NULL) { - static int warned = FALSE; - - $2 = node(node(make_number(0.0), - Node_field_spec, - (NODE *) NULL), - Node_expression_list, - (NODE *) NULL); - - if (do_lint && ! io_allowed && ! warned) { - warned = TRUE; - lintwarn( - _("plain `print' in BEGIN or END rule should probably be `print \"\"'")); - } - } - - $$ = node($2, $1, $3); - if ($$->type == Node_K_printf) - count_args($$) - } | LEX_NEXT statement_term { NODETYPE type; --- 448,453 ---- *************** *** 498,506 **** } opt_exp statement_term { $$ = node($3, Node_K_return, (NODE *) NULL); } ! | LEX_DELETE NAME '[' expression_list ']' statement_term { $$ = node(variable($2, CAN_FREE, Node_var_array), Node_K_delete, $4); } ! | LEX_DELETE NAME statement_term { if (do_lint) lintwarn(_("`delete array' is a gawk extension")); --- 484,532 ---- } opt_exp statement_term { $$ = node($3, Node_K_return, (NODE *) NULL); } ! | simple_stmt statement_term ! ; ! ! /* ! * A simple_stmt exists to satisfy a constraint in the POSIX ! * grammar allowing them to occur as the 1st and 3rd parts ! * in a `for (...;...;...)' loop. This is a historical oddity ! * inherited from Unix awk, not at all documented in the AK&W ! * awk book. We support it, as this was reported as a bug. ! * We don't bother to document it though. So there. ! */ ! simple_stmt ! : print '(' expression_list r_paren output_redir ! { ! $$ = node($3, $1, $5); ! if ($$->type == Node_K_printf) ! count_args($$); ! } ! | print opt_rexpression_list output_redir ! { ! if ($1 == Node_K_print && $2 == NULL) { ! static int warned = FALSE; ! ! $2 = node(node(make_number(0.0), ! Node_field_spec, ! (NODE *) NULL), ! Node_expression_list, ! (NODE *) NULL); ! ! if (do_lint && ! io_allowed && ! warned) { ! warned = TRUE; ! lintwarn( ! _("plain `print' in BEGIN or END rule should probably be `print \"\"'")); ! } ! } ! ! $$ = node($2, $1, $3); ! if ($$->type == Node_K_printf) ! count_args($$); ! } ! | LEX_DELETE NAME '[' expression_list ']' { $$ = node(variable($2, CAN_FREE, Node_var_array), Node_K_delete, $4); } ! | LEX_DELETE NAME { if (do_lint) lintwarn(_("`delete array' is a gawk extension")); *************** *** 514,520 **** } $$ = node(variable($2, CAN_FREE, Node_var_array), Node_K_delete, (NODE *) NULL); } ! | exp statement_term { $$ = $1; } ; --- 540,553 ---- } $$ = node(variable($2, CAN_FREE, Node_var_array), Node_K_delete, (NODE *) NULL); } ! | exp ! { $$ = $1; } ! ; ! ! opt_simple_stmt ! : /* empty */ ! { $$ = NULL; } ! | simple_stmt { $$ = $1; } ; *************** *** 819,825 **** | '-' simp_exp %prec UNARY { ! if ($2->type == Node_val) { $2->numbr = -(force_number($2)); $$ = $2; } else --- 852,858 ---- | '-' simp_exp %prec UNARY { ! if ($2->type == Node_val && ($2->flags & (STR|STRING)) == 0) { $2->numbr = -(force_number($2)); $$ = $2; } else *************** *** 919,924 **** --- 952,958 ---- {"continue", Node_K_continue, LEX_CONTINUE, 0, 0}, {"cos", Node_builtin, LEX_BUILTIN, NOT_OLD|A(1), do_cos}, {"dcgettext", Node_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3), do_dcgettext}, + {"dcngettext", Node_builtin, LEX_BUILTIN, GAWKX|A(1)|A(2)|A(3)|A(4)|A(5), do_dcngettext}, {"delete", Node_K_delete, LEX_DELETE, NOT_OLD, 0}, {"do", Node_K_do, LEX_DO, NOT_OLD, 0}, {"else", Node_illegal, LEX_ELSE, 0, 0}, *************** *** 969,974 **** --- 1003,1022 ---- {"xor", Node_builtin, LEX_BUILTIN, GAWKX|A(2), do_xor}, }; + #ifdef MBS_SUPPORT + /* Variable containing the current shift state. */ + static mbstate_t cur_mbstate; + /* Ring buffer containing current characters. */ + #define MAX_CHAR_IN_RING_BUFFER 8 + #define RING_BUFFER_SIZE (MAX_CHAR_IN_RING_BUFFER * MB_LEN_MAX) + static char cur_char_ring[RING_BUFFER_SIZE]; + /* Index for ring buffers. */ + static int cur_ring_idx; + /* This macro means that last nextc() return a singlebyte character + or 1st byte of a multibyte character. */ + #define nextc_is_1stbyte (cur_char_ring[cur_ring_idx] == 1) + #endif /* MBS_SUPPORT */ + /* getfname --- return name of a builtin function (for pretty printing) */ const char * *************** *** 1006,1012 **** const char *mesg = NULL; register char *bp, *cp; char *scan; ! char buf[120]; static char end_of_file_line[] = "(END OF FILE)"; errcount++; --- 1054,1061 ---- const char *mesg = NULL; register char *bp, *cp; char *scan; ! char *buf; ! int count; static char end_of_file_line[] = "(END OF FILE)"; errcount++; *************** *** 1033,1043 **** bp = thisline + strlen(thisline); } msg("%.*s", (int) (bp - thisline), thisline); bp = buf; ! cp = buf + sizeof(buf) - 24; /* 24 more than longest msg. input */ if (lexptr != NULL) { scan = thisline; ! while (bp < cp && scan < lexeme) if (*scan++ == '\t') *bp++ = '\t'; else --- 1082,1105 ---- bp = thisline + strlen(thisline); } msg("%.*s", (int) (bp - thisline), thisline); + + #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ + va_start(args, m); + if (mesg == NULL) + mesg = m; + #else + va_start(args); + if (mesg == NULL) + mesg = va_arg(args, char *); + #endif + count = (bp - thisline) + strlen(mesg) + 2 + 1; + emalloc(buf, char *, count, "yyerror"); + bp = buf; ! if (lexptr != NULL) { scan = thisline; ! while (scan < lexeme) if (*scan++ == '\t') *bp++ = '\t'; else *************** *** 1045,1062 **** *bp++ = '^'; *bp++ = ' '; } - #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__ - va_start(args, m); - if (mesg == NULL) - mesg = m; - #else - va_start(args); - if (mesg == NULL) - mesg = va_arg(args, char *); - #endif strcpy(bp, mesg); err("", buf, args); va_end(args); } /* get_src_buf --- read the next buffer of source program */ --- 1107,1116 ---- *bp++ = '^'; *bp++ = ' '; } strcpy(bp, mesg); err("", buf, args); va_end(args); + free(buf); } /* get_src_buf --- read the next buffer of source program */ *************** *** 1237,1242 **** --- 1291,1365 ---- /* nextc --- get the next input character */ + #ifdef MBS_SUPPORT + + static int + nextc() + { + if (MB_CUR_MAX > 1) { + /* Update the buffer index. */ + cur_ring_idx = (cur_ring_idx == RING_BUFFER_SIZE - 1)? 0 : + cur_ring_idx + 1; + + /* Did we already check the current character? */ + if (cur_char_ring[cur_ring_idx] == 0) { + /* No, we need to check the next character on the buffer. */ + int idx, work_ring_idx = cur_ring_idx; + mbstate_t tmp_state; + size_t mbclen; + + if (!lexptr || lexptr >= lexend) + if (!get_src_buf()) { + return EOF; + } + + for (idx = 0 ; lexptr + idx < lexend ; idx++) { + tmp_state = cur_mbstate; + mbclen = mbrlen(lexptr, idx + 1, &tmp_state); + + if (mbclen == 1 || mbclen == (size_t)-1 || mbclen == 0) { + /* It is a singlebyte character, non-complete multibyte + character or EOF. We treat it as a singlebyte + character. */ + cur_char_ring[work_ring_idx] = 1; + break; + } else if (mbclen == (size_t)-2) { + /* It is not a complete multibyte character. */ + cur_char_ring[work_ring_idx] = idx + 1; + } else { + /* mbclen > 1 */ + cur_char_ring[work_ring_idx] = mbclen; + break; + } + work_ring_idx = (work_ring_idx == RING_BUFFER_SIZE - 1)? + 0 : work_ring_idx + 1; + } + cur_mbstate = tmp_state; + + /* Put a mark on the position on which we write next character. */ + work_ring_idx = (work_ring_idx == RING_BUFFER_SIZE - 1)? + 0 : work_ring_idx + 1; + cur_char_ring[work_ring_idx] = 0; + } + + return (int) (unsigned char) *lexptr++; + } + else { + int c; + + if (lexptr && lexptr < lexend) + c = (int) (unsigned char) *lexptr++; + else if (get_src_buf()) + c = (int) (unsigned char) *lexptr++; + else + c = EOF; + + return c; + } + } + + #else /* MBS_SUPPORT */ + #if GAWKDEBUG int nextc() *************** *** 1259,1268 **** --- 1382,1410 ---- ) #endif + #endif /* MBS_SUPPORT */ + /* pushback --- push a character back on the input */ + #ifdef MBS_SUPPORT + + static void + pushback() + { + if (MB_CUR_MAX > 1) { + cur_ring_idx = (cur_ring_idx == 0)? RING_BUFFER_SIZE - 1 : + cur_ring_idx - 1; + (lexptr && lexptr > lexptr_begin ? lexptr-- : lexptr); + } else + (lexptr && lexptr > lexptr_begin ? lexptr-- : lexptr); + } + + #else + #define pushback() (lexptr && lexptr > lexptr_begin ? lexptr-- : lexptr) + #endif /* MBS_SUPPORT */ + /* allow_newline --- allow newline after &&, ||, ? and : */ static void *************** *** 1317,1323 **** return 0; } pushback(); ! #ifdef OS2 /* * added for OS/2's extproc feature of cmd.exe * (like #! in BSD sh) --- 1459,1465 ---- return 0; } pushback(); ! #if defined OS2 || defined __EMX__ /* * added for OS/2's extproc feature of cmd.exe * (like #! in BSD sh) *************** *** 1352,1357 **** --- 1494,1502 ---- tok = tokstart; for (;;) { c = nextc(); + #ifdef MBS_SUPPORT + if (MB_CUR_MAX == 1 || nextc_is_1stbyte) + #endif switch (c) { case '[': /* one day check for `.' and `=' too */ *************** *** 1409,1414 **** --- 1554,1562 ---- tok = tokstart; yylval.nodetypeval = Node_illegal; + #ifdef MBS_SUPPORT + if (MB_CUR_MAX == 1 || nextc_is_1stbyte) + #endif switch (c) { case EOF: if (lasttok != NEWLINE) { *************** *** 1650,1655 **** --- 1798,1806 ---- yyerror(_("unterminated string")); exit(1); } + #ifdef MBS_SUPPORT + if (MB_CUR_MAX == 1 || nextc_is_1stbyte) + #endif if (c == '\\') { c = nextc(); if (c == '\n') { *************** *** 1779,1787 **** eof_warned = TRUE; } tokadd('\0'); ! if (! do_traditional && isnondecimal(tokstart)) yylval.nodeval = make_number(nondec2awknum(tokstart, strlen(tokstart))); ! else yylval.nodeval = make_number(atof(tokstart)); yylval.nodeval->flags |= PERM; return lasttok = YNUMBER; --- 1930,1944 ---- eof_warned = TRUE; } tokadd('\0'); ! if (! do_traditional && isnondecimal(tokstart)) { ! static short warned = FALSE; ! if (do_lint && ! warned) { ! warned = TRUE; ! lintwarn("numeric constant `%.*s' treated as octal or hexadecimal", ! strlen(tokstart)-1, tokstart); ! } yylval.nodeval = make_number(nondec2awknum(tokstart, strlen(tokstart))); ! } else yylval.nodeval = make_number(atof(tokstart)); yylval.nodeval->flags |= PERM; return lasttok = YNUMBER; *************** *** 1816,1822 **** exit(1); } ! if (! do_traditional && c == '_') { if ((c = nextc()) == '"') { intlstr = TRUE; goto string; --- 1973,1993 ---- exit(1); } ! /* ! * Lots of fog here. Consider: ! * ! * print "xyzzy"$_"foo" ! * ! * Without the check for ` lasttok != '$'' ', this is parsed as ! * ! * print "xxyzz" $(_"foo") ! * ! * With the check, it is "correctly" parsed as three ! * string concatenations. Sigh. This seems to be ! * "more correct", but this is definitely one of those ! * occasions where the interactions are funny. ! */ ! if (! do_traditional && c == '_' && lasttok != '$') { if ((c = nextc()) == '"') { intlstr = TRUE; goto string; *************** *** 1953,1959 **** /* traverse expression list to see how many args. given */ for (n = subn; n != NULL; n = n->rnode) { nexp++; ! if (nexp > 3) break; } --- 2124,2130 ---- /* traverse expression list to see how many args. given */ for (n = subn; n != NULL; n = n->rnode) { nexp++; ! if (nexp > 5) break; } *************** *** 2047,2054 **** /* don't dump it, the lexer already did */ else dumpintlstr(str->stptr, str->stlen); ! } r->subnode = subn; if (r->proc == do_sprintf) { --- 2218,2238 ---- /* don't dump it, the lexer already did */ else dumpintlstr(str->stptr, str->stlen); ! } else if (do_intl /* --gen-po */ ! && r->proc == do_dcngettext /* dcngettext(...) */ ! && subn->lnode->type == Node_val /* 1st arg is constant */ ! && (subn->lnode->flags & STR) != 0 /* it's a string constant */ ! && subn->rnode->lnode->type == Node_val /* 2nd arg is constant too */ ! && (subn->rnode->lnode->flags & STR) != 0) { /* it's a string constant */ ! /* ala xgettext, dcngettext("some string", "some plural" ...) dumps the string */ ! NODE *str1 = subn->lnode; ! NODE *str2 = subn->rnode->lnode; + if (((str1->flags | str2->flags) & INTLSTR) != 0) + warning(_("use of dcngettext(_\"...\") is incorrect: remove leading underscore")); + else + dumpintlstr2(str1->stptr, str1->stlen, str2->stptr, str2->stlen); + } r->subnode = subn; if (r->proc == do_sprintf) { *************** *** 2726,2732 **** return exp; getnode(n); ! n->type = Node_regex; n->re_exp = exp; n->re_text = NULL; n->re_reg = NULL; --- 2910,2916 ---- return exp; getnode(n); ! n->type = Node_dynregex; n->re_exp = exp; n->re_text = NULL; n->re_reg = NULL; *************** *** 2828,2834 **** NODE * stopme(NODE *tree) { ! return tmp_number((AWKNUM) 0.0); } /* dumpintlstr --- write out an initial .po file entry for the string */ --- 3012,3018 ---- NODE * stopme(NODE *tree) { ! return 0; } /* dumpintlstr --- write out an initial .po file entry for the string */ *************** *** 2848,2857 **** } printf("msgid "); - fflush(stdout); pp_string_fp(stdout, str, len, '"', TRUE); putchar('\n'); printf("msgstr \"\"\n\n"); } /* count_args --- count the number of printf arguments */ --- 3032,3067 ---- } printf("msgid "); pp_string_fp(stdout, str, len, '"', TRUE); putchar('\n'); printf("msgstr \"\"\n\n"); + fflush(stdout); + } + + /* dumpintlstr2 --- write out an initial .po file entry for the string and its plural */ + + static void + dumpintlstr2(char *str1, size_t len1, char *str2, size_t len2) + { + char *cp; + + /* See the GNU gettext distribution for details on the file format */ + + if (source != NULL) { + /* ala the gettext sources, remove leading `./'s */ + for (cp = source; cp[0] == '.' && cp[1] == '/'; cp += 2) + continue; + printf("#: %s:%d\n", cp, sourceline); + } + + printf("msgid "); + pp_string_fp(stdout, str1, len1, '"', TRUE); + putchar('\n'); + printf("msgid_plural "); + pp_string_fp(stdout, str2, len2, '"', TRUE); + putchar('\n'); + printf("msgstr[0] \"\"\nmsgstr[1] \"\"\n\n"); + fflush(stdout); } /* count_args --- count the number of printf arguments */ diff -crN gawk-3.1.0/awklib/ChangeLog gawk-3.1.1/awklib/ChangeLog *** gawk-3.1.0/awklib/ChangeLog Sun Jun 3 13:05:33 2001 --- gawk-3.1.1/awklib/ChangeLog Wed May 1 16:41:52 2002 *************** *** 1,3 **** --- 1,15 ---- + Wed May 1 16:41:32 2002 Arnold D. Robbins + + * Release 3.1.1: Release tar file made. + + Wed Apr 17 15:20:27 2002 Arnold D. Robbins + + * Makefile.am (clean): Add *.exe to list of files to be cleaned. + + 2002-01-27 Bruno Haible + + * eg/lib/libintl.awk (dcngettext): New function. + Sun Jun 3 13:04:44 2001 Arnold D. Robbins * Release 3.1.0: Release tar file made. And there was diff -crN gawk-3.1.0/awklib/Makefile.am gawk-3.1.1/awklib/Makefile.am *** gawk-3.1.0/awklib/Makefile.am Tue Feb 27 11:53:18 2001 --- gawk-3.1.1/awklib/Makefile.am Wed Apr 17 15:20:19 2002 *************** *** 1,7 **** # # awklib/Makefile.am --- automake input file for gawk # ! # Copyright (C) 1995-2001 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. --- 1,7 ---- # # awklib/Makefile.am --- automake input file for gawk # ! # Copyright (C) 1995-2002 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. *************** *** 49,55 **** rm -f $(DESTDIR)$(bindir)/igawk clean-local: ! rm -f $(AUXAWK) igawk stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi rm -fr eg stamp-eg --- 49,55 ---- rm -f $(DESTDIR)$(bindir)/igawk clean-local: ! rm -f $(AUXAWK) igawk *.exe stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi rm -fr eg stamp-eg *************** *** 57,66 **** @echo 'some makes are stupid and will not check a directory' > stamp-eg @echo 'against a file, so this file is a place holder. gack.' >> stamp-eg ! pwcat: $(srcdir)/eg/lib/pwcat.c $(CC) $(CFLAGS) $(srcdir)/eg/lib/pwcat.c $(LDFLAGS) -o $@ ! grcat: $(srcdir)/eg/lib/grcat.c $(CC) $(CFLAGS) $(srcdir)/eg/lib/grcat.c $(LDFLAGS) -o $@ igawk: $(srcdir)/eg/prog/igawk.sh --- 57,66 ---- @echo 'some makes are stupid and will not check a directory' > stamp-eg @echo 'against a file, so this file is a place holder. gack.' >> stamp-eg ! pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c $(CC) $(CFLAGS) $(srcdir)/eg/lib/pwcat.c $(LDFLAGS) -o $@ ! grcat$(EXEEXT): $(srcdir)/eg/lib/grcat.c $(CC) $(CFLAGS) $(srcdir)/eg/lib/grcat.c $(LDFLAGS) -o $@ igawk: $(srcdir)/eg/prog/igawk.sh diff -crN gawk-3.1.0/awklib/Makefile.in gawk-3.1.1/awklib/Makefile.in *** gawk-3.1.0/awklib/Makefile.in Thu Jan 1 02:00:00 1970 --- gawk-3.1.1/awklib/Makefile.in Mon Apr 29 17:37:02 2002 *************** *** 0 **** --- 1,428 ---- + # Makefile.in generated automatically by automake 1.5 from Makefile.am. + + # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + # Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. + + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY, to the extent permitted by law; without + # even the implied warranty of MERCHANTABILITY or FITNESS FOR A + # PARTICULAR PURPOSE. + + @SET_MAKE@ + + # + # awklib/Makefile.am --- automake input file for gawk + # + # Copyright (C) 1995-2002 the Free Software Foundation, Inc. + # + # This file is part of GAWK, the GNU implementation of the + # AWK Programming Language. + # + # GAWK is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by + # the Free Software Foundation; either version 2 of the License, or + # (at your option) any later version. + # + # GAWK is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + # + + SHELL = @SHELL@ + + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ + prefix = @prefix@ + exec_prefix = @exec_prefix@ + + bindir = @bindir@ + sbindir = @sbindir@ + sysconfdir = @sysconfdir@ + sharedstatedir = @sharedstatedir@ + localstatedir = @localstatedir@ + libdir = @libdir@ + infodir = @infodir@ + mandir = @mandir@ + includedir = @includedir@ + oldincludedir = /usr/include + pkgdatadir = $(datadir)/@PACKAGE@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. + + ACLOCAL = @ACLOCAL@ + AUTOCONF = @AUTOCONF@ + AUTOMAKE = @AUTOMAKE@ + AUTOHEADER = @AUTOHEADER@ + + INSTALL = @INSTALL@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_DATA = @INSTALL_DATA@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ + INSTALL_HEADER = $(INSTALL_DATA) + transform = @program_transform_name@ + NORMAL_INSTALL = : + PRE_INSTALL = : + POST_INSTALL = : + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : + host_alias = @host_alias@ + host_triplet = @host@ + AMTAR = @AMTAR@ + AWK = @AWK@ + BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ + CATOBJEXT = @CATOBJEXT@ + CC = @CC@ + CFLAGS = @CFLAGS@ + CPP = @CPP@ + DATADIRNAME = @DATADIRNAME@ + DEPDIR = @DEPDIR@ + EXEEXT = @EXEEXT@ + GENCAT = @GENCAT@ + GLIBC21 = @GLIBC21@ + GMSGFMT = @GMSGFMT@ + HAVE_LIB = @HAVE_LIB@ + INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + INSTOBJEXT = @INSTOBJEXT@ + INTLBISON = @INTLBISON@ + INTLLIBS = @INTLLIBS@ + INTLOBJS = @INTLOBJS@ + INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ + LIB = @LIB@ + LIBICONV = @LIBICONV@ + LIBINTL = @LIBINTL@ + LN_S = @LN_S@ + LTLIB = @LTLIB@ + LTLIBICONV = @LTLIBICONV@ + LTLIBINTL = @LTLIBINTL@ + MKINSTALLDIRS = @MKINSTALLDIRS@ + OBJEXT = @OBJEXT@ + PACKAGE = @PACKAGE@ + PATH_SEPARATOR = @PATH_SEPARATOR@ + POSUB = @POSUB@ + RANLIB = @RANLIB@ + SOCKET_LIBS = @SOCKET_LIBS@ + U = @U@ + USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ + USE_NLS = @USE_NLS@ + VERSION = @VERSION@ + YACC = @YACC@ + am__include = @am__include@ + am__quote = @am__quote@ + install_sh = @install_sh@ + libexecdir = @libexecdir@/awk + + datadir = @datadir@/awk + + EXTRA_DIST = ChangeLog extract.awk eg stamp-eg + + bin_SCRIPTS = igawk + libexec_PROGRAMS = pwcat grcat + AUXAWK = passwd.awk group.awk + nodist_grcat_SOURCES = grcat.c + nodist_pwcat_SOURCES = pwcat.c + subdir = awklib + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = $(top_builddir)/config.h + CONFIG_CLEAN_FILES = + libexec_PROGRAMS = pwcat$(EXEEXT) grcat$(EXEEXT) + PROGRAMS = $(libexec_PROGRAMS) + + nodist_grcat_OBJECTS = grcat.$(OBJEXT) + grcat_OBJECTS = $(nodist_grcat_OBJECTS) + grcat_LDADD = $(LDADD) + grcat_DEPENDENCIES = + grcat_LDFLAGS = + nodist_pwcat_OBJECTS = pwcat.$(OBJEXT) + pwcat_OBJECTS = $(nodist_pwcat_OBJECTS) + pwcat_LDADD = $(LDADD) + pwcat_DEPENDENCIES = + pwcat_LDFLAGS = + SCRIPTS = $(bin_SCRIPTS) + + + DEFS = @DEFS@ + DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) + CPPFLAGS = @CPPFLAGS@ + LDFLAGS = @LDFLAGS@ + LIBS = @LIBS@ + depcomp = $(SHELL) $(top_srcdir)/depcomp + @AMDEP_TRUE@DEP_FILES = $(DEPDIR)/grcat.Po $(DEPDIR)/pwcat.Po + COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) + CCLD = $(CC) + LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ + DIST_SOURCES = + DIST_COMMON = ChangeLog Makefile.am Makefile.in + SOURCES = $(nodist_grcat_SOURCES) $(nodist_pwcat_SOURCES) + + all: all-am + + .SUFFIXES: + .SUFFIXES: .c .o .obj + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu awklib/Makefile + Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status + install-libexecPROGRAMS: $(libexec_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(libexecdir) + @list='$(libexec_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$f"; \ + $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p $(DESTDIR)$(libexecdir)/$$f; \ + else :; fi; \ + done + + uninstall-libexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(libexec_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f $(DESTDIR)$(libexecdir)/$$f"; \ + rm -f $(DESTDIR)$(libexecdir)/$$f; \ + done + + clean-libexecPROGRAMS: + -test -z "$(libexec_PROGRAMS)" || rm -f $(libexec_PROGRAMS) + install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(bindir) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f="`echo $$p|sed '$(transform)'`"; \ + if test -f $$p; then \ + echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_SCRIPT) $$p $(DESTDIR)$(bindir)/$$f; \ + elif test -f $(srcdir)/$$p; then \ + echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f"; \ + $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(bindir)/$$f; \ + else :; fi; \ + done + + uninstall-binSCRIPTS: + @$(NORMAL_UNINSTALL) + @list='$(bin_SCRIPTS)'; for p in $$list; do \ + f="`echo $$p|sed '$(transform)'`"; \ + echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ + rm -f $(DESTDIR)$(bindir)/$$f; \ + done + + mostlyclean-compile: + -rm -f *.$(OBJEXT) core *.core + + distclean-compile: + -rm -f *.tab.c + + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/grcat.Po@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pwcat.Po@am__quote@ + + distclean-depend: + -rm -rf $(DEPDIR) + + .c.o: + @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ + @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< + + .c.obj: + @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ + @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ + @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(COMPILE) -c `cygpath -w $<` + CCDEPMODE = @CCDEPMODE@ + uninstall-info-am: + + tags: TAGS + + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique $(LISP) + + TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || etags $(ETAGS_ARGS) $$tags $$unique $(LISP) + + GTAGS: + here=`CDPATH=: && cd $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + + distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH + + DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + + top_distdir = .. + distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + check-am: all-am + check: check-am + all-am: Makefile $(PROGRAMS) $(SCRIPTS) + + installdirs: + $(mkinstalldirs) $(DESTDIR)$(libexecdir) $(DESTDIR)$(bindir) + + install: install-am + install-exec: install-exec-am + install-data: install-data-am + uninstall: uninstall-am + + install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + + installcheck: installcheck-am + install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + mostlyclean-generic: + + clean-generic: + + distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + clean: clean-am + + clean-am: clean-generic clean-libexecPROGRAMS clean-local mostlyclean-am + + distclean: distclean-am + + distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-tags + + dvi: dvi-am + + dvi-am: + + info: info-am + + info-am: + + install-data-am: + + install-exec-am: install-binSCRIPTS install-libexecPROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + + install-info: install-info-am + + install-man: + + installcheck-am: + + maintainer-clean: maintainer-clean-am + + maintainer-clean-am: distclean-am maintainer-clean-generic + + mostlyclean: mostlyclean-am + + mostlyclean-am: mostlyclean-compile mostlyclean-generic + + uninstall-am: uninstall-binSCRIPTS uninstall-info-am \ + uninstall-libexecPROGRAMS uninstall-local + + .PHONY: GTAGS all all-am check check-am clean clean-generic \ + clean-libexecPROGRAMS clean-local distclean distclean-compile \ + distclean-depend distclean-generic distclean-tags distdir dvi \ + dvi-am info info-am install install-am install-binSCRIPTS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-libexecPROGRAMS \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic tags \ + uninstall uninstall-am uninstall-binSCRIPTS uninstall-info-am \ + uninstall-libexecPROGRAMS uninstall-local + + + all: stamp-eg $(AUXPROGS) igawk $(AUXAWK) + + install-exec-hook: $(AUXAWK) + $(mkinstalldirs) $(DESTDIR)$(datadir) + for i in $(AUXAWK) $(srcdir)/eg/lib/*.awk ; do \ + progname=`echo $$i | sed 's;.*/;;'` ; \ + $(INSTALL_DATA) $$i $(DESTDIR)$(datadir)/$$progname ; \ + done + + # libexecdir and datadir are removed in the top level Makefile's uninstall + uninstall-local: + rm -fr $(DESTDIR)$(libexecdir)/* $(DESTDIR)$(datadir)/* + rm -f $(DESTDIR)$(bindir)/igawk + + clean-local: + rm -f $(AUXAWK) igawk *.exe + + stamp-eg: $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi + rm -fr eg stamp-eg + $(AWK) -f $(srcdir)/extract.awk $(srcdir)/../doc/gawk.texi $(srcdir)/../doc/gawkinet.texi + @echo 'some makes are stupid and will not check a directory' > stamp-eg + @echo 'against a file, so this file is a place holder. gack.' >> stamp-eg + + pwcat$(EXEEXT): $(srcdir)/eg/lib/pwcat.c + $(CC) $(CFLAGS) $(srcdir)/eg/lib/pwcat.c $(LDFLAGS) -o $@ + + grcat$(EXEEXT): $(srcdir)/eg/lib/grcat.c + $(CC) $(CFLAGS) $(srcdir)/eg/lib/grcat.c $(LDFLAGS) -o $@ + + igawk: $(srcdir)/eg/prog/igawk.sh + cp $(srcdir)/eg/prog/igawk.sh $@ ; chmod 755 $@ + + passwd.awk: $(srcdir)/eg/lib/passwdawk.in + (cd $(srcdir)/eg/lib ; \ + sed 's;/usr/local/libexec/awk;$(libexecdir);' < passwdawk.in) > passwd.awk + + group.awk: $(srcdir)/eg/lib/groupawk.in + (cd $(srcdir)/eg/lib ; \ + sed 's;/usr/local/libexec/awk;$(libexecdir);' < groupawk.in) > group.awk + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff -crN gawk-3.1.0/awklib/eg/lib/grcat.c gawk-3.1.1/awklib/eg/lib/grcat.c *** gawk-3.1.0/awklib/eg/lib/grcat.c Sun May 13 18:42:06 2001 --- gawk-3.1.1/awklib/eg/lib/grcat.c Mon Apr 22 14:27:33 2002 *************** *** 8,13 **** --- 8,21 ---- * Public Domain */ + /* For OS/2, do nothing. */ + #if HAVE_CONFIG_H + #include + #endif + + #ifndef HAVE_GETPGRENT + int main() { exit(0); } + #else #include #include *************** *** 32,34 **** --- 40,43 ---- endgrent(); exit(0); } + #endif /* HAVE_GETPGRENT */ diff -crN gawk-3.1.0/builtin.c gawk-3.1.1/builtin.c *** gawk-3.1.0/builtin.c Tue Feb 27 12:14:24 2001 --- gawk-3.1.1/builtin.c Tue Apr 16 14:40:31 2002 *************** *** 3,9 **** */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-2001 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 3,9 ---- */ /* ! * Copyright (C) 1986, 1988, 1989, 1991-2002 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 204,209 **** --- 204,274 ---- return tmp_number((AWKNUM) status); } + #ifdef MBS_SUPPORT + /* strncasecmpmbs --- like strncasecmp(multibyte string version) */ + int + strncasecmpmbs(const char *s1, mbstate_t mbs1, const char *s2, + mbstate_t mbs2, size_t n) + { + int i1, i2, mbclen1, mbclen2, gap; + wchar_t wc1, wc2; + for (i1 = i2 = 0 ; i1 < n && i2 < n ;i1 += mbclen1, i2 += mbclen2) { + mbclen1 = mbrtowc(&wc1, s1 + i1, n - i1, &mbs1); + if (mbclen1 == (size_t) -1 || mbclen1 == (size_t) -2 || mbclen1 == 0) { + /* We treat it as a singlebyte character. */ + mbclen1 = 1; + wc1 = s1[i1]; + } + mbclen2 = mbrtowc(&wc2, s2 + i2, n - i2, &mbs2); + if (mbclen2 == (size_t) -1 || mbclen2 == (size_t) -2 || mbclen2 == 0) { + /* We treat it as a singlebyte character. */ + mbclen2 = 1; + wc2 = s2[i2]; + } + if ((gap = towlower(wc1) - towlower(wc2)) != 0) + /* s1 and s2 are not equivalent. */ + return gap; + } + /* s1 and s2 are equivalent. */ + return 0; + } + + /* Inspect the buffer `src' and write the index of each byte to `dest'. + Caller must allocate `dest'. + e.g. str = , , a, b, , , , c + where mb(i) means the `i'-th byte of a multibyte character. + dest = 1, 2, 1, 1, 1, 2, 3. 1 + */ + static void + index_multibyte_buffer(char* src, char* dest, int len) + { + int idx, prev_idx; + mbstate_t mbs, prevs; + memset(&prevs, 0, sizeof(mbstate_t)); + + for (idx = prev_idx = 0 ; idx < len ; idx++) { + size_t mbclen; + mbs = prevs; + mbclen = mbrlen(src + prev_idx, idx - prev_idx + 1, &mbs); + if (mbclen == (size_t) -1 || mbclen == 1 || mbclen == 0) { + /* singlebyte character. */ + mbclen = 1; + prev_idx = idx + 1; + } else if (mbclen == (size_t) -2) { + /* a part of a multibyte character. */ + mbclen = idx - prev_idx + 1; + } else if (mbclen > 1) { + /* the end of a multibyte character. */ + prev_idx = idx + 1; + prevs = mbs; + } else { + /* Can't reach. */ + } + dest[idx] = mbclen; + } + } + #endif + /* do_index --- find index of a string */ NODE * *************** *** 213,218 **** --- 278,291 ---- register char *p1, *p2; register size_t l1, l2; long ret; + #ifdef MBS_SUPPORT + size_t mbclen = 0; + mbstate_t mbs1, mbs2; + if (MB_CUR_MAX > 1) { + memset(&mbs1, 0, sizeof(mbstate_t)); + memset(&mbs2, 0, sizeof(mbstate_t)); + } + #endif s1 = tree_eval(tree->lnode); *************** *** 231,241 **** --- 304,341 ---- l2 = s2->stlen; ret = 0; + /* + * Icky special case, index(foo, "") should return 1, + * since both bwk awk and mawk do, and since match("foo", "") + * returns 1. This makes index("", "") work, too, fwiw. + */ + if (l2 == 0) { + ret = 1; + goto out; + } + /* IGNORECASE will already be false if posix */ if (IGNORECASE) { while (l1 > 0) { if (l2 > l1) break; + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) { + if (strncasecmpmbs(p1, mbs1, p2, mbs2, l2) == 0) { + ret = 1 + s1->stlen - l1; + break; + } + /* Update l1, and p1. */ + mbclen = mbrlen(p1, l1, &mbs1); + if ((mbclen == 1) || (mbclen == (size_t) -1) + || (mbclen == (size_t) -2) || (mbclen == 0)) { + /* We treat it as a singlebyte character. */ + mbclen = 1; + } + l1 -= mbclen; + p1 += mbclen; + } else { + #endif if (casetable[(unsigned char)*p1] == casetable[(unsigned char)*p2] && (l2 == 1 || strncasecmp(p1, p2, l2) == 0)) { ret = 1 + s1->stlen - l1; *************** *** 243,248 **** --- 343,351 ---- } l1--; p1++; + #ifdef MBS_SUPPORT + } + #endif } } else { while (l1 > 0) { *************** *** 253,262 **** --- 356,382 ---- ret = 1 + s1->stlen - l1; break; } + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) { + mbclen = mbrlen(p1, l1, &mbs1); + if ((mbclen == 1) || (mbclen == (size_t) -1) || + (mbclen == (size_t) -2) || (mbclen == 0)) { + /* We treat it as a singlebyte character. */ + mbclen = 1; + } + l1 -= mbclen; + p1 += mbclen; + } else { + l1--; + p1++; + } + #else l1--; p1++; + #endif } } + out: free_temp(s1); free_temp(s2); return tmp_number((AWKNUM) ret); *************** *** 360,366 **** /* copy one byte from 's' to 'obufout' checking for space in the process */ #define bchunk_one(s) { \ ! if (ofre <= 0) { \ long olen = obufout - obuf; \ erealloc(obuf, char *, osiz * 2, "format_tree"); \ ofre += osiz; \ --- 480,486 ---- /* copy one byte from 's' to 'obufout' checking for space in the process */ #define bchunk_one(s) { \ ! if (ofre < 1) { \ long olen = obufout - obuf; \ erealloc(obuf, char *, osiz * 2, "format_tree"); \ ofre += osiz; \ *************** *** 945,958 **** if (toofew) fatal("%s\n\t`%s'\n\t%*s%s", _("not enough arguments to satisfy format string"), ! fmt_string, s1 - fmt_string - 2, "", _("^ ran out for this one")); } if (do_lint) { if (need_format) lintwarn( _("[s]printf: format specifier does not have control letter")); ! if (carg != NULL) lintwarn( _("too many arguments supplied for format string")); } --- 1065,1078 ---- if (toofew) fatal("%s\n\t`%s'\n\t%*s%s", _("not enough arguments to satisfy format string"), ! fmt_string, s1 - fmt_string - 1, "", _("^ ran out for this one")); } if (do_lint) { if (need_format) lintwarn( _("[s]printf: format specifier does not have control letter")); ! if (cur_arg < num_args) lintwarn( _("too many arguments supplied for format string")); } *************** *** 1140,1146 **** if (tree->lnode != NULL) { NODE *tmp = tree_eval(tree->lnode); if (do_lint && (tmp->flags & (STRING|STR)) == 0) ! lintwarn(_("strftime: recieved non-string first argument")); t1 = force_string(tmp); format = t1->stptr; formatlen = t1->stlen; --- 1260,1266 ---- if (tree->lnode != NULL) { NODE *tmp = tree_eval(tree->lnode); if (do_lint && (tmp->flags & (STRING|STR)) == 0) ! lintwarn(_("strftime: received non-string first argument")); t1 = force_string(tmp); format = t1->stptr; formatlen = t1->stlen; *************** *** 1155,1161 **** if (tree->rnode != NULL) { t2 = tree_eval(tree->rnode->lnode); if (do_lint && (t2->flags & (NUM|NUMBER)) == 0) ! lintwarn(_("strftime: recieved non-numeric second argument")); fclock = (time_t) force_number(t2); free_temp(t2); } --- 1275,1281 ---- if (tree->rnode != NULL) { t2 = tree_eval(tree->rnode->lnode); if (do_lint && (t2->flags & (NUM|NUMBER)) == 0) ! lintwarn(_("strftime: received non-numeric second argument")); fclock = (time_t) force_number(t2); free_temp(t2); } *************** *** 1263,1269 **** (void) flush_io(); /* so output is synchronous with gawk's */ tmp = tree_eval(tree->lnode); if (do_lint && (tmp->flags & (STRING|STR)) == 0) ! lintwarn(_("system: recieved non-string argument")); cmd = force_string(tmp)->stptr; if (cmd && *cmd) { --- 1383,1389 ---- (void) flush_io(); /* so output is synchronous with gawk's */ tmp = tree_eval(tree->lnode); if (do_lint && (tmp->flags & (STRING|STR)) == 0) ! lintwarn(_("system: received non-string argument")); cmd = force_string(tmp)->stptr; if (cmd && *cmd) { *************** *** 1380,1393 **** { NODE *t1, *t2; register unsigned char *cp, *cp2; t1 = tree_eval(tree->lnode); if (do_lint && (t1->flags & (STRING|STR)) == 0) ! lintwarn(_("tolower: recieved non-string argument")); t1 = force_string(t1); t2 = tmp_string(t1->stptr, t1->stlen); for (cp = (unsigned char *)t2->stptr, cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++) if (ISUPPER(*cp)) *cp = TOLOWER(*cp); free_temp(t1); --- 1500,1541 ---- { NODE *t1, *t2; register unsigned char *cp, *cp2; + #ifdef MBS_SUPPORT + size_t mbclen = 0; + mbstate_t mbs, prev_mbs; + if (MB_CUR_MAX > 1) + memset(&mbs, 0, sizeof(mbstate_t)); + #endif t1 = tree_eval(tree->lnode); if (do_lint && (t1->flags & (STRING|STR)) == 0) ! lintwarn(_("tolower: received non-string argument")); t1 = force_string(t1); t2 = tmp_string(t1->stptr, t1->stlen); for (cp = (unsigned char *)t2->stptr, cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++) + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) { + wchar_t wc; + prev_mbs = mbs; + mbclen = (size_t) mbrtowc(&wc, cp, cp2 - cp, &mbs); + if ((mbclen != 1) && (mbclen != (size_t) -1) && + (mbclen != (size_t) -2) && (mbclen != 0)) { + /* a multibyte character. */ + if (iswupper(wc)) + { + wc = towlower(wc); + wcrtomb(cp, wc, &prev_mbs); + } + /* Adjust the pointer. */ + cp += mbclen - 1; + } else { + /* Otherwise we treat it as a singlebyte character. */ + if (ISUPPER(*cp)) + *cp = tolower(*cp); + } + } else + #endif if (ISUPPER(*cp)) *cp = TOLOWER(*cp); free_temp(t1); *************** *** 1401,1414 **** { NODE *t1, *t2; register unsigned char *cp, *cp2; t1 = tree_eval(tree->lnode); if (do_lint && (t1->flags & (STRING|STR)) == 0) ! lintwarn(_("toupper: recieved non-string argument")); t1 = force_string(t1); t2 = tmp_string(t1->stptr, t1->stlen); for (cp = (unsigned char *)t2->stptr, cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++) if (ISLOWER(*cp)) *cp = TOUPPER(*cp); free_temp(t1); --- 1549,1590 ---- { NODE *t1, *t2; register unsigned char *cp, *cp2; + #ifdef MBS_SUPPORT + size_t mbclen = 0; + mbstate_t mbs, prev_mbs; + if (MB_CUR_MAX > 1) + memset(&mbs, 0, sizeof(mbstate_t)); + #endif t1 = tree_eval(tree->lnode); if (do_lint && (t1->flags & (STRING|STR)) == 0) ! lintwarn(_("toupper: received non-string argument")); t1 = force_string(t1); t2 = tmp_string(t1->stptr, t1->stlen); for (cp = (unsigned char *)t2->stptr, cp2 = (unsigned char *)(t2->stptr + t2->stlen); cp < cp2; cp++) + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) { + wchar_t wc; + prev_mbs = mbs; + mbclen = (size_t) mbrtowc(&wc, cp, cp2 - cp, &mbs); + if ((mbclen != 1) && (mbclen != (size_t) -1) && + (mbclen != (size_t) -2) && (mbclen != 0)) { + /* a multibyte character. */ + if (iswlower(wc)) + { + wc = towupper(wc); + wcrtomb(cp, wc, &prev_mbs); + } + /* Adjust the pointer. */ + cp += mbclen - 1; + } else { + /* Otherwise we treat it as a singlebyte character. */ + if (ISLOWER(*cp)) + *cp = toupper(*cp); + } + } else + #endif if (ISLOWER(*cp)) *cp = TOUPPER(*cp); free_temp(t1); *************** *** 1669,1674 **** --- 1845,1853 ---- int global = (how_many == -1); long current; int lastmatchnonzero; + #ifdef MBS_SUPPORT + char *mb_indices; + #endif tmp = tree->lnode; rp = re_update(tmp); *************** *** 1712,1719 **** --- 1891,1918 ---- buf[buflen] = '\0'; buf[buflen + 1] = '\0'; ampersands = 0; + #ifdef MBS_SUPPORT + /* + * Some systems' malloc() can't handle being called with an + * argument of zero. Thus we have to have some special case + * code to check for `repllen == 0'. This can occur for + * something like: + * sub(/foo/, "", mystring) + * for example. + */ + if (MB_CUR_MAX > 1 && repllen > 0) { + emalloc(mb_indices, char *, repllen * sizeof(char), "sub_common"); + index_multibyte_buffer(repl, mb_indices, repllen); + } else + mb_indices = NULL; + #endif for (scan = repl; scan < replend; scan++) { + #ifdef MBS_SUPPORT + if ((MB_CUR_MAX == 1 || (repllen > 0 && mb_indices[scan - repl] == 1)) + && (*scan == '&')) { + #else if (*scan == '&') { + #endif repllen--; ampersands++; } else if (*scan == '\\') { *************** *** 1783,1792 **** --- 1982,2003 ---- * making substitutions as we go. */ for (scan = repl; scan < replend; scan++) + #ifdef MBS_SUPPORT + if ((MB_CUR_MAX == 1 + || (repllen > 0 && mb_indices[scan - repl] == 1)) + && (*scan == '&')) + #else if (*scan == '&') + #endif for (cp = matchstart; cp < matchend; cp++) *bp++ = *cp; + #ifdef MBS_SUPPORT + else if ((MB_CUR_MAX == 1 + || (repllen > 0 && mb_indices[scan - repl] == 1)) + && (*scan == '\\')) { + #else else if (*scan == '\\') { + #endif if (backdigs) { /* gensub, behave sanely */ if (ISDIGIT(scan[1])) { int dig = scan[1] - '0'; *************** *** 1872,1877 **** --- 2083,2092 ---- (*after_assign)(); t->flags &= ~(NUM|NUMBER); } + #ifdef MBS_SUPPORT + if (mb_indices != NULL) + free(mb_indices); + #endif return tmp_number((AWKNUM) matches); } *************** *** 2250,2258 **** tmp = tree_eval(tree->lnode); ! if ((tmp->flags & (NUM|NUMBER)) != 0) ! d = (double) force_number(tmp); ! else if (isnondecimal(tmp->stptr)) d = nondec2awknum(tmp->stptr, tmp->stlen); else d = (double) force_number(tmp); --- 2465,2471 ---- tmp = tree_eval(tree->lnode); ! if (isnondecimal(tmp->stptr)) d = nondec2awknum(tmp->stptr, tmp->stlen); else d = (double) force_number(tmp); *************** *** 2278,2284 **** char *start = str; if (*str == '0' && (str[1] == 'x' || str[1] == 'X')) { ! assert(len > 2); for (str += 2, len -= 2; len > 0; len--, str++) { switch (*str) { --- 2491,2502 ---- char *start = str; if (*str == '0' && (str[1] == 'x' || str[1] == 'X')) { ! /* ! * User called strtonum("0x") or some such, ! * so just quit early. ! */ ! if (len <= 2) ! return (AWKNUM) 0.0; for (str += 2, len -= 2; len > 0; len--, str++) { switch (*str) { *************** *** 2336,2360 **** return retval; } ! /* do_dcgettext --- handle i18n translations */ ! /* ! * awk usage is ! * ! * str = dcgettext(string [, domain [, category]]) ! * ! * Default domain is TEXTDOMAIN, default category is LC_MESSAGES. ! */ ! NODE * ! do_dcgettext(NODE *tree) { - NODE *tmp, *t1, *t2; - char *string; - char *the_result; - #if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT - int lc_cat = -1; - char *category, *domain; static struct category_table { int val; char *name; --- 2554,2566 ---- return retval; } ! /* do_dcgettext, do_dcngettext --- handle i18n translations */ ! #if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT ! static int ! localecategory_from_argument(NODE *tree) { static struct category_table { int val; char *name; *************** *** 2384,2410 **** { LC_TIME, "LC_TIME" }, #endif /* LC_TIME */ }; - #endif /* ENABLE_NLS */ - tmp = tree->lnode; /* first argument */ - t1 = force_string(tree_eval(tmp)); - string = t1->stptr; - - t2 = NULL; - #if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT - tree = tree->rnode; /* second argument */ if (tree != NULL) { - tmp = tree->lnode; - t2 = force_string(tree_eval(tmp)); - domain = t2->stptr; - } else - domain = TEXTDOMAIN; - - if (tree != NULL && tree->rnode != NULL) { /* third argument */ int low, high, i, mid; ! NODE *t; - tree = tree->rnode; tmp = tree->lnode; t = force_string(tree_eval(tmp)); category = t->stptr; --- 2590,2602 ---- { LC_TIME, "LC_TIME" }, #endif /* LC_TIME */ }; if (tree != NULL) { int low, high, i, mid; ! NODE *tmp, *t; ! char *category; ! int lc_cat = -1; tmp = tree->lnode; t = force_string(tree_eval(tmp)); category = t->stptr; *************** *** 2429,2434 **** --- 2621,2669 ---- fatal(_("dcgettext: `%s' is not a valid locale category"), category); free_temp(t); + return lc_cat; + } else + return LC_MESSAGES; + } + + #endif + + /* + * awk usage is + * + * str = dcgettext(string [, domain [, category]]) + * str = dcngettext(string1, string2, number [, domain [, category]]) + * + * Default domain is TEXTDOMAIN, default category is LC_MESSAGES. + */ + + NODE * + do_dcgettext(NODE *tree) + { + NODE *tmp, *t1, *t2; + char *string; + char *the_result; + #if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT + int lc_cat; + char *domain; + #endif /* ENABLE_NLS */ + + tmp = tree->lnode; /* first argument */ + t1 = force_string(tree_eval(tmp)); + string = t1->stptr; + + t2 = NULL; + #if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT + tree = tree->rnode; /* second argument */ + if (tree != NULL) { + tmp = tree->lnode; + t2 = force_string(tree_eval(tmp)); + domain = t2->stptr; + } else + domain = TEXTDOMAIN; + + if (tree && tree->rnode != NULL) { /* third argument */ + lc_cat = localecategory_from_argument(tree->rnode); } else lc_cat = LC_MESSAGES; *************** *** 2443,2448 **** --- 2678,2733 ---- return tmp_string(the_result, strlen(the_result)); } + NODE * + do_dcngettext(NODE *tree) + { + NODE *tmp, *t1, *t2, *t3; + char *string1, *string2; + long number; + char *the_result; + #if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT + int lc_cat; + char *domain; + #endif /* ENABLE_NLS */ + + tmp = tree->lnode; /* first argument */ + t1 = force_string(tree_eval(tmp)); + string1 = t1->stptr; + + tmp = tree->rnode->lnode; /* second argument */ + t2 = force_string(tree_eval(tmp)); + string2 = t2->stptr; + + tmp = tree->rnode->rnode->lnode; /* third argument */ + number = (long) double_to_int(force_number(tree_eval(tmp))); + + t3 = NULL; + #if ENABLE_NLS && HAVE_LC_MESSAGES && HAVE_DCGETTEXT + tree = tree->rnode->rnode->rnode; /* fourth argument */ + if (tree != NULL) { + tmp = tree->lnode; + t3 = force_string(tree_eval(tmp)); + domain = t3->stptr; + } else + domain = TEXTDOMAIN; + + if (tree && tree->rnode != NULL) { /* fifth argument */ + lc_cat = localecategory_from_argument(tree->rnode); + } else + lc_cat = LC_MESSAGES; + + the_result = dcngettext(domain, string1, string2, number, lc_cat); + #else + the_result = (number == 1 ? string1 : string2); + #endif + free_temp(t1); + free_temp(t2); + if (t3 != NULL) + free_temp(t3); + + return tmp_string(the_result, strlen(the_result)); + } + /* do_bindtextdomain --- set the directory for a text domain */ /* *************** *** 2482,2488 **** free_temp(t1); if (t2 != NULL) ! free_temp(t1); return tmp_string(the_result, strlen(the_result)); } --- 2767,2773 ---- free_temp(t1); if (t2 != NULL) ! free_temp(t2); return tmp_string(the_result, strlen(the_result)); } diff -crN gawk-3.1.0/config.guess gawk-3.1.1/config.guess *** gawk-3.1.0/config.guess Thu Jan 1 02:00:00 1970 --- gawk-3.1.1/config.guess Sun Apr 28 17:08:33 2002 *************** *** 0 **** --- 1,1321 ---- + #! /bin/sh + # Attempt to guess a canonical system name. + # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + # 2000, 2001, 2002 Free Software Foundation, Inc. + + timestamp='2002-03-20' + + # This file is free software; you can redistribute it and/or modify it + # under the terms of the GNU General Public License as published by + # the Free Software Foundation; either version 2 of the License, or + # (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, but + # WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + + # Originally written by Per Bothner . + # Please send patches to . Submit a context + # diff and a properly formatted ChangeLog entry. + # + # This script attempts to guess a canonical system name similar to + # config.sub. If it succeeds, it prints the system name on stdout, and + # exits with 0. Otherwise, it exits with 1. + # + # The plan is that this can be called by configure scripts if you + # don't specify an explicit build system type. + + me=`echo "$0" | sed -e 's,.*/,,'` + + usage="\ + Usage: $0 [OPTION] + + Output the configuration name of the system \`$me' is run on. + + Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + + Report bugs and patches to ." + + version="\ + GNU config.guess ($timestamp) + + Originally written by Per Bothner. + Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + + help=" + Try \`$me --help' for more information." + + # Parse command line + while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac + done + + if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 + fi + + + dummy=dummy-$$ + trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + + # CC_FOR_BUILD -- compiler used by this script. + # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still + # use `HOST_CC' if defined, but it is deprecated. + + set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c ; + for c in cc gcc c89 c99 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $dummy.c $dummy.o $dummy.rel ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; + esac' + + # This is needed to find uname on a Pyramid OSx when run in the BSD universe. + # (ghazi@noc.rutgers.edu 1994-08-24) + if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH + fi + + UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown + UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown + UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown + UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + + # Note: order is significant - the case branches are not exclusive. + + case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <$dummy.s + .data + \$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main + main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main + EOF + eval $set_cc_for_build + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `./$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + esac + fi + rm -f $dummy.s $dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __cplusplus + #include /* for printf() prototype */ + int main (int argc, char *argv[]) { + #else + int main (argc, argv) int argc; char *argv[]; { + #endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } + EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } + EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } + EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } + EOF + $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[GKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + esac + + #echo '(No uname command or uname output not recognized.)' 1>&2 + #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + + eval $set_cc_for_build + cat >$dummy.c < + # include + #endif + main () + { + #if defined (sony) + #if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); + #else + #include + printf ("m68k-sony-newsos%s\n", + #ifdef NEWSOS4 + "4" + #else + "" + #endif + ); exit (0); + #endif + #endif + + #if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); + #endif + + #if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); + #endif + + #if defined (NeXT) + #if !defined (__ARCHITECTURE__) + #define __ARCHITECTURE__ "m68k" + #endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); + #endif + + #if defined (MULTIMAX) || defined (n16) + #if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); + #else + #if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); + #else + printf ("ns32k-encore-bsd\n"); exit (0); + #endif + #endif + #endif + + #if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); + #endif + + #if defined (sequent) + #if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); + #endif + #if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); + #endif + #endif + + #if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + + #endif + + #if defined (vax) + # if !defined (ultrix) + # include + # if defined (BSD) + # if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); + # else + # if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); + # else + printf ("vax-dec-bsd\n"); exit (0); + # endif + # endif + # else + printf ("vax-dec-bsd\n"); exit (0); + # endif + # else + printf ("vax-dec-ultrix\n"); exit (0); + # endif + #endif + + #if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); + #endif + + exit (1); + } + EOF + + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + + # Apollos put the system type in the environment. + + test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + + # Convex versions that predate uname can use getsysinfo(1) + + if [ -x /usr/convex/getsysinfo ] + then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac + fi + + cat >&2 < in order to provide the needed + information to handle your system. + + config.guess timestamp = $timestamp + + uname -m = `(uname -m) 2>/dev/null || echo unknown` + uname -r = `(uname -r) 2>/dev/null || echo unknown` + uname -s = `(uname -s) 2>/dev/null || echo unknown` + uname -v = `(uname -v) 2>/dev/null || echo unknown` + + /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` + /bin/uname -X = `(/bin/uname -X) 2>/dev/null` + + hostinfo = `(hostinfo) 2>/dev/null` + /bin/universe = `(/bin/universe) 2>/dev/null` + /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` + /bin/arch = `(/bin/arch) 2>/dev/null` + /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` + /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + + UNAME_MACHINE = ${UNAME_MACHINE} + UNAME_RELEASE = ${UNAME_RELEASE} + UNAME_SYSTEM = ${UNAME_SYSTEM} + UNAME_VERSION = ${UNAME_VERSION} + EOF + + exit 1 + + # Local variables: + # eval: (add-hook 'write-file-hooks 'time-stamp) + # time-stamp-start: "timestamp='" + # time-stamp-format: "%:y-%02m-%02d" + # time-stamp-end: "'" + # End: diff -crN gawk-3.1.0/config.rpath gawk-3.1.1/config.rpath *** gawk-3.1.0/config.rpath Thu Jan 1 02:00:00 1970 --- gawk-3.1.1/config.rpath Sun Apr 28 17:01:51 2002 *************** *** 0 **** --- 1,513 ---- + #! /bin/sh + # Output a system dependent set of variables, describing how to set the + # run time search path of shared libraries in an executable. + # + # Copyright 1996-2002 Free Software Foundation, Inc. + # Taken from GNU libtool, 2001 + # Originally by Gordon Matzigkeit , 1996 + # + # This program is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by + # the Free Software Foundation; either version 2 of the License, or + # (at your option) any later version. + # + # This program is distributed in the hope that it will be useful, but + # WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + # General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + # + # As a special exception to the GNU General Public License, if you + # distribute this file as part of a program that contains a + # configuration script generated by Autoconf, you may include it under + # the same distribution terms that you use for the rest of that program. + # + # The first argument passed to this file is the canonical host specification, + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM + # or + # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld + # should be set by the caller. + # + # The set of defined variables is at the end of this script. + + # All known linkers require a `.a' archive for static linking (except M$VC, + # which needs '.lib'). + libext=a + shlibext= + + host="$1" + host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` + host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + wl= + if test "$GCC" = yes; then + wl='-Wl,' + else + case "$host_os" in + aix3* | aix4* | aix5*) + wl='-Wl,' + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6*) + wl='-Wl,' + ;; + linux*) + echo '__INTEL_COMPILER' > conftest.$ac_ext + if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null + then + : + else + # Intel icc + wl='-Qoption,ld,' + fi + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + solaris*) + wl='-Wl,' + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + if test "x$host_vendor" = xsni; then + wl='-LD' + else + wl='-Wl,' + fi + ;; + esac + fi + + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_direct=no + hardcode_minus_L=no + + case "$host_os" in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + if test "$with_gnu_ld" = yes; then + case "$host_os" in + aix3* | aix4* | aix5*) + # On AIX, the GNU linker is very broken + ld_shlibs=no + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + ;; + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + fi + else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + esac + fi + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib' + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib' + fi + fi + ;; + amigaos*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=yes + ;; + freebsd1*) + ld_shlibs=no + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9* | hpux10* | hpux11*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + ;; + irix5* | irix6*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + openbsd*) + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + sco3.2v5*) + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + if test "x$host_vendor" = xsno; then + hardcode_direct=yes # is this really true??? + else + hardcode_direct=no # Motorola manual says yes, but my tests say they lie + fi + ;; + sysv4.3*) + ;; + sysv5*) + hardcode_libdir_flag_spec= + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4.2uw2*) + hardcode_direct=yes + hardcode_minus_L=no + ;; + sysv5uw7* | unixware7*) + ;; + *) + ld_shlibs=no + ;; + esac + fi + + # Check dynamic linker characteristics + libname_spec='lib$name' + sys_lib_dlsearch_path_spec="/lib /usr/lib" + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + case "$host_os" in + aix3*) + shlibext=so + ;; + aix4* | aix5*) + shlibext=so + ;; + amigaos*) + shlibext=ixlibrary + ;; + beos*) + shlibext=so + ;; + bsdi4*) + shlibext=so + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + ;; + cygwin* | mingw* | pw32*) + case $GCC,$host_os in + yes,cygwin*) + shlibext=dll.a + ;; + yes,mingw*) + shlibext=dll + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"` + ;; + yes,pw32*) + shlibext=dll + ;; + *) + shlibext=dll + ;; + esac + ;; + darwin* | rhapsody*) + shlibext=dylib + ;; + freebsd1*) + ;; + freebsd*) + shlibext=so + ;; + gnu*) + shlibext=so + ;; + hpux9* | hpux10* | hpux11*) + shlibext=sl + ;; + irix5* | irix6*) + shlibext=so + case "$host_os" in + irix5*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 ") libsuff= shlibsuff= ;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + ;; + linux-gnu*) + shlibext=so + ;; + netbsd*) + shlibext=so + ;; + newsos6) + shlibext=so + ;; + openbsd*) + shlibext=so + ;; + os2*) + libname_spec='$name' + shlibext=dll + ;; + osf3* | osf4* | osf5*) + shlibext=so + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + sco3.2v5*) + shlibext=so + ;; + solaris*) + shlibext=so + ;; + sunos4*) + shlibext=so + ;; + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + shlibext=so + case "$host_vendor" in + motorola) + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + uts4*) + shlibext=so + ;; + dgux*) + shlibext=so + ;; + sysv4*MP*) + if test -d /usr/nec; then + shlibext=so + fi + ;; + esac + + sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` + escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + + sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <. Submit a context + # diff and a properly formatted ChangeLog entry. + # + # Configuration subroutine to validate and canonicalize a configuration type. + # Supply the specified configuration type as an argument. + # If it is invalid, we print an error message on stderr and exit with code 1. + # Otherwise, we print the canonical config type on stdout and succeed. + + # This file is supposed to be the same for all GNU packages + # and recognize all the CPU types, system types and aliases + # that are meaningful with *any* GNU software. + # Each package is responsible for reporting which valid configurations + # it does not support. The user should be able to distinguish + # a failure to support a valid configuration from a meaningless + # configuration. + + # The goal of this file is to map all the various variations of a given + # machine specification into a single specification in the form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM + # or in some cases, the newer four-part form: + # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + # It is wrong to echo any other type of specification. + + me=`echo "$0" | sed -e 's,.*/,,'` + + usage="\ + Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + + Canonicalize a configuration name. + + Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + + Report bugs and patches to ." + + version="\ + GNU config.sub ($timestamp) + + Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. + + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + + help=" + Try \`$me --help' for more information." + + # Parse command line + while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac + done + + case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; + esac + + # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). + # Here we must recognize all the valid KERNEL-OS combinations. + maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` + case $maybe_os in + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; + esac + + ### Let's recognize common machines as not being operating systems so + ### that things like config.sub decstation-3100 work. We also + ### recognize some manufacturers as not being operating systems, so we + ### can provide default operating systems below. + case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + esac + + # Decode aliases for certain CPU-COMPANY combinations. + case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dsp16xx \ + | fr30 \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el | mips64vr4300 \ + | mips64vr4300el | mips64vr5000 | mips64vr5000el \ + | mipsbe | mipseb | mipsel | mipsle | mipstx39 | mipstx39el \ + | mipsisa32 | mipsisa64 \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[34] | sh[34]eb | shbe | shle | sh64 \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ + | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipseb-* \ + | mipsle-* | mipsel-* | mipstx39-* | mipstx39el-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* | sh64-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; + # I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + + # Here we handle the default manufacturer of certain CPU types. It is in + # some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + esac + + # Here we canonicalize certain aliases for manufacturers. + case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; + esac + + # Decode manufacturer-specific aliases for certain operating systems. + + if [ x"$os" != x"" ] + then + case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* ) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; + esac + else + + # Here we handle the default operating systems that come with various machines. + # The value should be what the vendor currently ships out the door with their + # machine or put another way, the most popular os provided with the machine. + + # Note that if you're going to try to match "-MANUFACTURER" here (say, + # "-sun"), then you have to tell the case statement up towards the top + # that MANUFACTURER isn't an operating system. Otherwise, code above + # will signal an error saying that MANUFACTURER isn't an operating + # system, and we'll never get to this point. + + case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; + esac + fi + + # Here we handle the case where we know the os, and the CPU type, but not the + # manufacturer. We pick the logical manufacturer. + vendor=unknown + case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; + esac + + echo $basic_machine$os + exit 0 + + # Local variables: + # eval: (add-hook 'write-file-hooks 'time-stamp) + # time-stamp-start: "timestamp='" + # time-stamp-format: "%:y-%02m-%02d" + # time-stamp-end: "'" + # End: diff -crN gawk-3.1.0/configh.in gawk-3.1.1/configh.in *** gawk-3.1.0/configh.in Tue Feb 27 12:18:34 2001 --- gawk-3.1.1/configh.in Tue Apr 16 13:29:06 2002 *************** *** 142,147 **** --- 142,149 ---- #undef DYNAMIC /* allow dynamic addition of builtins */ #undef STRTOD_NOT_C89 /* strtod doesn't have C89 semantics */ #undef ssize_t /* signed version of size_t */ + #undef USE_INCLUDED_STRFTIME /* force use of our version of strftime */ + #undef TIME_T_IN_SYS_TYPES_H /* some systems define this type here */ /* Define if you have the __argz_count function. */ #undef HAVE___ARGZ_COUNT *************** *** 155,178 **** /* Define if you have the alarm function. */ #undef HAVE_ALARM ! /* Define if you have the dcgettext function. */ ! #undef HAVE_DCGETTEXT /* Define if you have the fmod function. */ #undef HAVE_FMOD /* Define if you have the getcwd function. */ #undef HAVE_GETCWD /* Define if you have the getpagesize function. */ #undef HAVE_GETPAGESIZE /* Define if you have the memcmp function. */ #undef HAVE_MEMCMP /* Define if you have the memcpy function. */ #undef HAVE_MEMCPY /* Define if you have the memset function. */ #undef HAVE_MEMSET --- 157,210 ---- /* Define if you have the alarm function. */ #undef HAVE_ALARM ! /* Define if you have the feof_unlocked function. */ ! #undef HAVE_FEOF_UNLOCKED ! ! /* Define if you have the fgets_unlocked function. */ ! #undef HAVE_FGETS_UNLOCKED /* Define if you have the fmod function. */ #undef HAVE_FMOD + /* Define if you have the getc_unlocked function. */ + #undef HAVE_GETC_UNLOCKED + /* Define if you have the getcwd function. */ #undef HAVE_GETCWD + /* Define if you have the getegid function. */ + #undef HAVE_GETEGID + + /* Define if you have the geteuid function. */ + #undef HAVE_GETEUID + + /* Define if you have the getgid function. */ + #undef HAVE_GETGID + + /* Define if you have the getgroups function. */ + #undef HAVE_GETGROUPS + /* Define if you have the getpagesize function. */ #undef HAVE_GETPAGESIZE + /* Define if you have the getuid function. */ + #undef HAVE_GETUID + + /* Define if you have the mbrlen function. */ + #undef HAVE_MBRLEN + + /* Define if you have the mbrtowc function. */ + #undef HAVE_MBRTOWC + /* Define if you have the memcmp function. */ #undef HAVE_MEMCMP /* Define if you have the memcpy function. */ #undef HAVE_MEMCPY + /* Define if you have the mempcpy function. */ + #undef HAVE_MEMPCPY + /* Define if you have the memset function. */ #undef HAVE_MEMSET *************** *** 212,220 **** --- 244,258 ---- /* Define if you have the strtod function. */ #undef HAVE_STRTOD + /* Define if you have the strtoul function. */ + #undef HAVE_STRTOUL + /* Define if you have the system function. */ #undef HAVE_SYSTEM + /* Define if you have the tsearch function. */ + #undef HAVE_TSEARCH + /* Define if you have the tzset function. */ #undef HAVE_TZSET *************** *** 257,262 **** --- 295,303 ---- /* Define if you have the header file. */ #undef HAVE_STDARG_H + /* Define if you have the header file. */ + #undef HAVE_STDDEF_H + /* Define if you have the header file. */ #undef HAVE_STDLIB_H *************** *** 272,288 **** /* Define if you have the header file. */ #undef HAVE_SYS_SOCKET_H /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define if you have the header file. */ #undef HAVE_UNISTD_H ! /* Define if you have the i library (-li). */ ! #undef HAVE_LIBI ! /* Define if you have the intl library (-lintl). */ ! #undef HAVE_LIBINTL /* Define if you have the m library (-lm). */ #undef HAVE_LIBM --- 313,335 ---- /* Define if you have the header file. */ #undef HAVE_SYS_SOCKET_H + /* Define if you have the header file. */ + #undef HAVE_SYS_STAT_H + /* Define if you have the header file. */ #undef HAVE_SYS_TIME_H + /* Define if you have the header file. */ + #undef HAVE_SYS_TYPES_H + /* Define if you have the header file. */ #undef HAVE_UNISTD_H ! /* Define if you have the header file. */ ! #undef HAVE_WCHAR_H ! /* Define if you have the header file. */ ! #undef HAVE_WCTYPE_H /* Define if you have the m library (-lm). */ #undef HAVE_LIBM *************** *** 302,321 **** /* Define if compiler has function prototypes */ #undef PROTOTYPES ! /* Define to 1 if you have the stpcpy function. */ ! #undef HAVE_STPCPY ! /* Define if your locale.h file contains LC_MESSAGES. */ #undef HAVE_LC_MESSAGES ! /* Define to 1 if NLS is requested. */ #undef ENABLE_NLS ! /* Define to 1 if you have gettext and don't want to use GNU gettext. */ #undef HAVE_GETTEXT ! /* Define as 1 if you have catgets and don't want to use GNU gettext. */ ! #undef HAVE_CATGETS #include /* overrides for stuff autoconf can't deal with */ --- 349,375 ---- /* Define if compiler has function prototypes */ #undef PROTOTYPES ! /* Define if you have the iconv() function. */ ! #undef HAVE_ICONV ! ! /* Define as const if the declaration of iconv() needs const. */ ! #undef ICONV_CONST ! /* Define if you have and nl_langinfo(CODESET). */ ! #undef HAVE_LANGINFO_CODESET ! ! /* Define if your file defines LC_MESSAGES. */ #undef HAVE_LC_MESSAGES ! /* Define to 1 if translation of program messages to the user's native language ! is requested. */ #undef ENABLE_NLS ! /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT ! /* Define if the GNU dcgettext() function is already present or preinstalled. */ ! #undef HAVE_DCGETTEXT #include /* overrides for stuff autoconf can't deal with */ diff -crN gawk-3.1.0/configure gawk-3.1.1/configure *** gawk-3.1.0/configure Thu Jan 1 02:00:00 1970 --- gawk-3.1.1/configure Mon Apr 29 17:36:47 2002 *************** *** 0 **** --- 1,7297 ---- + #! /bin/sh + + # Guess values for system-dependent variables and create Makefiles. + # Generated automatically using autoconf version 2.13 + # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. + # + # This configure script is free software; the Free Software Foundation + # gives unlimited permission to copy, distribute and modify it. + + # Defaults: + ac_help= + ac_default_prefix=/usr/local + # Any additions from configure.in: + ac_help="$ac_help + --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors" + ac_help="$ac_help + --enable-portals Enable /p as path prefix for portals" + ac_help="$ac_help + --with-whiny-user-strftime Force use of included version of strftime for deficient systems" + ac_help="$ac_help + --disable-largefile omit support for large files" + ac_help="$ac_help + --with-gnu-ld assume the C compiler uses GNU ld [default=no]" + ac_help="$ac_help + --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib + --without-libiconv-prefix don't search for libiconv in includedir and libdir" + ac_help="$ac_help + --disable-nls do not use Native Language Support" + ac_help="$ac_help + --with-included-gettext use the GNU gettext library included here" + ac_help="$ac_help + --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib + --without-libintl-prefix don't search for libintl in includedir and libdir" + + # Initialize some variables set by options. + # The variables have the same names as the options, with + # dashes changed to underlines. + build=NONE + cache_file=./config.cache + exec_prefix=NONE + host=NONE + no_create= + nonopt=NONE + no_recursion= + prefix=NONE + program_prefix=NONE + program_suffix=NONE + program_transform_name=s,x,x, + silent= + site= + srcdir= + target=NONE + verbose= + x_includes=NONE + x_libraries=NONE + bindir='${exec_prefix}/bin' + sbindir='${exec_prefix}/sbin' + libexecdir='${exec_prefix}/libexec' + datadir='${prefix}/share' + sysconfdir='${prefix}/etc' + sharedstatedir='${prefix}/com' + localstatedir='${prefix}/var' + libdir='${exec_prefix}/lib' + includedir='${prefix}/include' + oldincludedir='/usr/include' + infodir='${prefix}/info' + mandir='${prefix}/man' + + # Initialize some other variables. + subdirs= + MFLAGS= MAKEFLAGS= + SHELL=${CONFIG_SHELL-/bin/sh} + # Maximum number of lines to put in a shell here document. + ac_max_here_lines=12 + + ac_prev= + for ac_option + do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF + Usage: configure [options] [host] + Options: [defaults in brackets after descriptions] + Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure + Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names + EOF + cat << EOF + Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] + Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR + EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac + done + + if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } + fi + + trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + + # File descriptor usage: + # 0 standard input + # 1 file creation + # 2 errors and warnings + # 3 some systems may open it to /dev/tty + # 4 used on the Kubota Titan + # 6 checking for... messages and results + # 5 compiler messages saved in config.log + if test "$silent" = yes; then + exec 6>/dev/null + else + exec 6>&1 + fi + exec 5>./config.log + + echo "\ + This file contains any messages produced by compilers while + running configure, to aid debugging if configure makes a mistake. + " 1>&5 + + # Strip out --no-create and --no-recursion so they do not pile up. + # Also quote any args containing shell metacharacters. + ac_configure_args= + for ac_arg + do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac + done + + # NLS nuisances. + # Only set these to C if already set. These must not be set unconditionally + # because not all systems understand e.g. LANG=C (notably SCO). + # Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! + # Non-C LC_CTYPE values break the ctype check. + if test "${LANG+set}" = set; then LANG=C; export LANG; fi + if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi + if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi + if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + + # confdefs.h avoids OS command line length limits that DEFS can exceed. + rm -rf conftest* confdefs.h + # AIX cpp loses on an empty file, so make sure it contains at least a newline. + echo > confdefs.h + + # A filename unique to this package, relative to the directory that + # configure is in, which we can look for to find out if srcdir is correct. + ac_unique_file=awk.h + + # Find the source files, if location was not specified. + if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi + else + ac_srcdir_defaulted=no + fi + if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi + fi + srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + + # Prefer explicitly selected file to automatically selected ones. + if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi + fi + for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi + done + + if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file + else + echo "creating cache $cache_file" + > $cache_file + fi + + ac_ext=c + # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' + ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' + ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + cross_compiling=$ac_cv_prog_cc_cross + + ac_exeext= + ac_objext=o + if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' + ' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi + else + ac_n= ac_c='\c' ac_t= + fi + + # Check whether --with-gnu-ld or --without-gnu-ld was given. + if test "${with_gnu_ld+set}" = set; then + withval="$with_gnu_ld" + test "$withval" = no || with_gnu_ld=yes + else + with_gnu_ld=no + fi + + ac_prog=ld + if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6 + echo "configure:557: checking for ld used by GCC" >&5 + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld""... $ac_c" 1>&6 + echo "configure:587: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "configure:590: checking for non-GNU ld" >&5 + fi + if eval "test \"`echo '$''{'acl_cv_path_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$acl_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + else + acl_cv_path_LD="$LD" # Let the user override the test with a path. + fi + fi + + LD="$acl_cv_path_LD" + if test -n "$LD"; then + echo "$ac_t""$LD" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + test -z "$LD" && { echo "configure: error: no acceptable ld found in \$PATH" 1>&2; exit 1; } + echo $ac_n "checking if the linker ($LD) is GNU ld""... $ac_c" 1>&6 + echo "configure:625: checking if the linker ($LD) is GNU ld" >&5 + if eval "test \"`echo '$''{'acl_cv_prog_gnu_ld'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + # I'd rather use --version here, but apparently some GNU ld's only accept -v. + if $LD -v 2>&1 &5; then + acl_cv_prog_gnu_ld=yes + else + acl_cv_prog_gnu_ld=no + fi + fi + + echo "$ac_t""$acl_cv_prog_gnu_ld" 1>&6 + with_gnu_ld=$acl_cv_prog_gnu_ld + + + + + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi + done + if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + + # expand $ac_aux_dir to an absolute path + am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` + + # Find a good install program. We prefer a C program (faster), + # so one script is as good as another. But avoid the broken or + # incompatible versions: + # SysV /etc/install, /usr/sbin/install + # SunOS /usr/etc/install + # IRIX /sbin/install + # AIX /bin/install + # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag + # AFS /usr/afsws/bin/install, which mishandles nonexistent args + # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" + # ./install, which can be erroneously created by make from ./install.sh. + echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 + echo "configure:678: checking for a BSD compatible install" >&5 + if test -z "$INSTALL"; then + if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + + fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi + fi + echo "$ac_t""$INSTALL" 1>&6 + + # Use test -z because SunOS4 sh mishandles braces in ${var-val}. + # It thinks the first close brace ends the variable substitution. + test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + + test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 + echo "configure:731: checking whether build environment is sane" >&5 + # Just in case + sleep 1 + echo timestamp > conftest.file + # Do `set' in a subshell so we don't clobber the current shell's + # arguments. Must try -L first in case configure is actually a + # symlink; some systems play weird games with the mod time of symlinks + # (eg FreeBSD returns the mod time of the symlink's containing + # directory). + if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { echo "configure: error: ls -t appears to fail. Make sure there is not a broken + alias in your environment" 1>&2; exit 1; } + fi + + test "$2" = conftest.file + ) + then + # Ok. + : + else + { echo "configure: error: newly created file is older than distributed files! + Check your system clock" 1>&2; exit 1; } + fi + echo "$ac_t""yes" 1>&6 + if test "$program_transform_name" = s,x,x,; then + program_transform_name= + else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed + s,\\,\\\\,g; s,\$,$$,g + EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed + fi + test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" + # Use a double $ so make ignores it. + test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + + # sed with no file args requires a program. + test "$program_transform_name" = "" && program_transform_name="s,x,x," + + test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" + # Use eval to expand $SHELL + if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " + else + am_missing_run= + am_backtick='`' + echo "configure: warning: ${am_backtick}missing' script is too old or missing" 1>&2 + fi + + for ac_prog in gawk mawk nawk awk + do + # Extract the first word of "$ac_prog", so it can be a program name with args. + set dummy $ac_prog; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:802: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AWK="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" + fi + fi + AWK="$ac_cv_prog_AWK" + if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + test -n "$AWK" && break + done + + echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 + echo "configure:832: checking whether ${MAKE-make} sets \${MAKE}" >&5 + set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftestmake <<\EOF + all: + @echo 'ac_maketemp="${MAKE}"' + EOF + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` + if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes + else + eval ac_cv_prog_make_${ac_make}_set=no + fi + rm -f conftestmake + fi + if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= + else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" + fi + + # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. + if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + : + fi + + if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + fi + + + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' + else + AMDEP_TRUE='#' + AMDEP_FALSE= + fi + + + + + rm -f .deps 2>/dev/null + mkdir .deps 2>/dev/null + if test -d .deps; then + DEPDIR=.deps + else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps + fi + rmdir .deps 2>/dev/null + + + # test to see if srcdir already configured + if test "`CDPATH=:; cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run \"make distclean\" there first" 1>&2; exit 1; } + fi + + # Define the identity of the package. + PACKAGE=gawk + VERSION=3.1.1 + cat >> confdefs.h <> confdefs.h <> confdefs.h <<\EOF + #define HAVE_PORTALS 1 + EOF + + fi + + # Check whether --with-whiny-user-strftime or --without-whiny-user-strftime was given. + if test "${with_whiny_user_strftime+set}" = set; then + withval="$with_whiny_user_strftime" + if test "$withval" = yes + then + cat >> confdefs.h <<\EOF + #define USE_INCLUDED_STRFTIME 1 + EOF + + fi + + fi + + + for ac_prog in 'bison -y' byacc + do + # Extract the first word of "$ac_prog", so it can be a program name with args. + set dummy $ac_prog; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:980: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$YACC"; then + ac_cv_prog_YACC="$YACC" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_YACC="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" + fi + fi + YACC="$ac_cv_prog_YACC" + if test -n "$YACC"; then + echo "$ac_t""$YACC" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + test -n "$YACC" && break + done + test -n "$YACC" || YACC="yacc" + + echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 + echo "configure:1011: checking whether ln -s works" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + rm -f conftestdata + if ln -s X conftestdata 2>/dev/null + then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" + else + ac_cv_prog_LN_S=ln + fi + fi + LN_S="$ac_cv_prog_LN_S" + if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + # Extract the first word of "gcc", so it can be a program name with args. + set dummy gcc; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1034: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" + fi + fi + CC="$ac_cv_prog_CC" + if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. + set dummy cc; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1064: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" + if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi + fi + fi + fi + CC="$ac_cv_prog_CC" + if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. + set dummy cl; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1115: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" + fi + fi + CC="$ac_cv_prog_CC" + if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } + fi + + echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 + echo "configure:1147: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + + ac_ext=c + # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' + ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' + ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + cross_compiling=$ac_cv_prog_cc_cross + + cat > conftest.$ac_ext << EOF + + #line 1158 "configure" + #include "confdefs.h" + + main(){return(0);} + EOF + if { (eval echo configure:1163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no + fi + rm -fr conftest* + ac_ext=c + # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. + ac_cpp='$CPP $CPPFLAGS' + ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' + ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + cross_compiling=$ac_cv_prog_cc_cross + + echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 + if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } + fi + echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 + echo "configure:1189: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 + echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 + cross_compiling=$ac_cv_prog_cc_cross + + echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 + echo "configure:1194: checking whether we are using GNU C" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes + else + ac_cv_prog_gcc=no + fi + fi + + echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + + if test $ac_cv_prog_gcc = yes; then + GCC=yes + else + GCC= + fi + + ac_test_CFLAGS="${CFLAGS+set}" + ac_save_CFLAGS="$CFLAGS" + CFLAGS= + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 + echo "configure:1222: checking whether ${CC-cc} accepts -g" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + echo 'void f(){}' > conftest.c + if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes + else + ac_cv_prog_cc_g=no + fi + rm -f conftest* + + fi + + echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 + if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" + elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi + else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi + fi + + + am_make=${MAKE-make} + cat > confinc << 'END' + doit: + @echo done + END + # If we don't find an include directive, just comment out the code. + echo $ac_n "checking for style of include used by $am_make""... $ac_c" 1>&6 + echo "configure:1261: checking for style of include used by $am_make" >&5 + am__include='#' + am__quote= + _am_result=none + # First try GNU make style include. + echo "include confinc" > confmf + # We grep out `Entering directory' and `Leaving directory' + # messages which can occur if `w' ends up in MAKEFLAGS. + # In particular we don't look at `^make:' because GNU make might + # be invoked under some other name (usually "gmake"), in which + # case it prints its new name instead of `make'. + if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU + fi + # Now try BSD make style include. + if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote='"' + _am_result=BSD + fi + fi + + + echo "$ac_t""$_am_result" 1>&6 + rm -f confinc confmf + + + depcc="$CC" am_compiler_list= + + echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6 + echo "configure:1295: checking dependency style of $depcc" >&5 + if eval "test \"`echo '$''{'am_cv_CC_dependencies_compiler_type'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir + else + am_cv_CC_dependencies_compiler_type=none + fi + + fi + + echo "$ac_t""$am_cv_CC_dependencies_compiler_type" 1>&6 + CCDEPMODE="depmode=$am_cv_CC_dependencies_compiler_type" + + + echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 + echo "configure:1362: checking how to run the C preprocessor" >&5 + # On Suns, sometimes $CPP names a directory. + if test -n "$CPP" && test -d "$CPP"; then + CPP= + fi + if test -z "$CPP"; then + if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:1383: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:1400: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext < + Syntax Error + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:1417: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + : + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp + fi + rm -f conftest* + fi + rm -f conftest* + fi + rm -f conftest* + ac_cv_prog_CPP="$CPP" + fi + CPP="$ac_cv_prog_CPP" + else + ac_cv_prog_CPP="$CPP" + fi + echo "$ac_t""$CPP" 1>&6 + + # Extract the first word of "ranlib", so it can be a program name with args. + set dummy ranlib; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:1444: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" + fi + fi + RANLIB="$ac_cv_prog_RANLIB" + if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + + # This is a hack. Different versions of install on different systems + # are just too different. Chuck it and use install-sh. + # + # If the user supplies $INSTALL, figure they know what they're doing. + if test "x$INSTALL" = "x" + then + INSTALL="$srcdir/install-sh -c" + export INSTALL + fi + + # Find a good install program. We prefer a C program (faster), + # so one script is as good as another. But avoid the broken or + # incompatible versions: + # SysV /etc/install, /usr/sbin/install + # SunOS /usr/etc/install + # IRIX /sbin/install + # AIX /bin/install + # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag + # AFS /usr/afsws/bin/install, which mishandles nonexistent args + # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" + # ./install, which can be erroneously created by make from ./install.sh. + echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 + echo "configure:1494: checking for a BSD compatible install" >&5 + if test -z "$INSTALL"; then + if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + + fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi + fi + echo "$ac_t""$INSTALL" 1>&6 + + # Use test -z because SunOS4 sh mishandles braces in ${var-val}. + # It thinks the first close brace ends the variable substitution. + test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + + test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + + test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + + echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 + echo "configure:1548: checking whether ${MAKE-make} sets \${MAKE}" >&5 + set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftestmake <<\EOF + all: + @echo 'ac_maketemp="${MAKE}"' + EOF + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` + if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes + else + eval ac_cv_prog_make_${ac_make}_set=no + fi + rm -f conftestmake + fi + if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= + else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" + fi + + + # This is mainly for my use during testing and development. + # Yes, it's a bit of a hack. + echo $ac_n "checking for special development options""... $ac_c" 1>&6 + echo "configure:1578: checking for special development options" >&5 + if test -f $srcdir/.developing + then + # add other debug flags as appropriate, save GAWKDEBUG for emergencies + CFLAGS="$CFLAGS -DARRAYDEBUG" + # turn on compiler warnings if we're doing development + if test "$GCC" = yes + then + CFLAGS="$CFLAGS -Wall" + fi + echo "$ac_t""yes" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + + + echo $ac_n "checking for AIX""... $ac_c" 1>&6 + echo "configure:1596: checking for AIX" >&5 + cat > conftest.$ac_ext <&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF + #define _ALL_SOURCE 1 + EOF + + else + rm -rf conftest* + echo "$ac_t""no" 1>&6 + fi + rm -f conftest* + + + + echo $ac_n "checking for strerror in -lcposix""... $ac_c" 1>&6 + echo "configure:1621: checking for strerror in -lcposix" >&5 + ac_lib_var=`echo cposix'_'strerror | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_save_LIBS="$LIBS" + LIBS="-lcposix $LIBS" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" + fi + rm -f conftest* + LIBS="$ac_save_LIBS" + + fi + if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lcposix" + else + echo "$ac_t""no" 1>&6 + fi + + + + ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 + echo "configure:1664: checking for minix/config.h" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:1674: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + MINIX=yes + else + echo "$ac_t""no" 1>&6 + MINIX= + fi + + if test "$MINIX" = yes; then + cat >> confdefs.h <<\EOF + #define _POSIX_SOURCE 1 + EOF + + cat >> confdefs.h <<\EOF + #define _POSIX_1_SOURCE 2 + EOF + + cat >> confdefs.h <<\EOF + #define _MINIX 1 + EOF + + fi + + + # Check whether --enable-largefile or --disable-largefile was given. + if test "${enable_largefile+set}" = set; then + enableval="$enable_largefile" + : + fi + + if test "$enable_largefile" != no; then + + echo $ac_n "checking for special C compiler options needed for large files""... $ac_c" 1>&6 + echo "configure:1721: checking for special C compiler options needed for large files" >&5 + if eval "test \"`echo '$''{'ac_cv_sys_largefile_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat > conftest.$ac_ext < + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ + # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + + int main() { + + ; return 0; } + EOF + if { (eval echo configure:1746: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_save_CC="$CC" + CC="$CC -n32" + cat > conftest.$ac_ext < + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ + # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + + int main() { + + ; return 0; } + EOF + if { (eval echo configure:1771: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sys_largefile_CC=' -n32' + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + CC="$ac_save_CC" + fi + rm -f conftest* + fi + fi + + echo "$ac_t""$ac_cv_sys_largefile_CC" 1>&6 + if test "$ac_cv_sys_largefile_CC" != no; then + CC="$CC$ac_cv_sys_largefile_CC" + fi + + echo $ac_n "checking for _FILE_OFFSET_BITS value needed for large files""... $ac_c" 1>&6 + echo "configure:1791: checking for _FILE_OFFSET_BITS value needed for large files" >&5 + if eval "test \"`echo '$''{'ac_cv_sys_file_offset_bits'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_cv_sys_file_offset_bits=no + cat > conftest.$ac_ext < + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ + # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + + int main() { + + ; return 0; } + EOF + if { (eval echo configure:1813: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext < + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ + # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + + + int main() { + + ; return 0; } + EOF + if { (eval echo configure:1838: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sys_file_offset_bits=64 + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_sys_file_offset_bits" 1>&6 + if test "$ac_cv_sys_file_offset_bits" != no; then + cat >> confdefs.h <&6 + echo "configure:1858: checking for _LARGE_FILES value needed for large files" >&5 + if eval "test \"`echo '$''{'ac_cv_sys_large_files'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_cv_sys_large_files=no + cat > conftest.$ac_ext < + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ + # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + + int main() { + + ; return 0; } + EOF + if { (eval echo configure:1880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext < + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ + # define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + + + int main() { + + ; return 0; } + EOF + if { (eval echo configure:1905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sys_large_files=1 + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_sys_large_files" 1>&6 + if test "$ac_cv_sys_large_files" != no; then + cat >> confdefs.h <&6 + echo "configure:1928: checking for AIX compilation hacks" >&5 + if eval "test \"`echo '$''{'gawk_cv_aix_hack'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + + if test -d /lpp/bos + then + CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED=1" + gawk_cv_aix_hack=yes + else + gawk_cv_aix_hack=no + fi + + fi + echo "$ac_t""${gawk_cv_aix_hack}" 1>&6 + + + echo $ac_n "checking for Linux/Alpha compilation hacks""... $ac_c" 1>&6 + echo "configure:1946: checking for Linux/Alpha compilation hacks" >&5 + if eval "test \"`echo '$''{'gawk_cv_linux_alpha_hack'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + + if test "Linux" = "`uname`" && test "alpha" = "`uname -m`" + then + # this isn't necessarily always true, + # the vendor's compiler is also often found + if test "$GCC" = yes + then + CFLAGS="$CFLAGS -mieee" + gawk_cv_linux_alpha_hack=yes + else + gawk_cv_linux_alpha_hack=no + fi + else + gawk_cv_linux_alpha_hack=no + fi + + fi + echo "$ac_t""${gawk_cv_linux_alpha_hack}" 1>&6 + + + if test "$ISC" = 1 # will be set by test for ISC + then + CFLAGS="$CFLAGS -D_SYSV3" + fi + + + + + echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 + echo "configure:1979: checking for ${CC-cc} option to accept ANSI C" >&5 + if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + am_cv_prog_cc_stdc=no + ac_save_CC="$CC" + # Don't try gcc -ansi; that turns off useful extensions and + # breaks some systems' header files. + # AIX -qlanglvl=ansi + # Ultrix and OSF/1 -std1 + # HP-UX 10.20 and later -Ae + # HP-UX older versions -Aa -D_HPUX_SOURCE + # SVR4 -Xc -D__EXTENSIONS__ + for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" + do + CC="$ac_save_CC $ac_arg" + cat > conftest.$ac_ext < + #include + #include + #include + /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ + struct buf { int x; }; + FILE * (*rcsopen) (struct buf *, struct stat *, int); + static char *e (p, i) + char **p; + int i; + { + return p[i]; + } + static char *f (char * (*g) (char **, int), char **p, ...) + { + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; + } + int test (int i, double x); + struct s1 {int (*f) (int a);}; + struct s2 {int (*f) (double a);}; + int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); + int argc; + char **argv; + + int main() { + + return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + + ; return 0; } + EOF + if { (eval echo configure:2033: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + am_cv_prog_cc_stdc="$ac_arg"; break + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + done + CC="$ac_save_CC" + + fi + + if test -z "$am_cv_prog_cc_stdc"; then + echo "$ac_t""none needed" 1>&6 + else + echo "$ac_t""$am_cv_prog_cc_stdc" 1>&6 + fi + case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; + esac + + + + echo $ac_n "checking for function prototypes""... $ac_c" 1>&6 + echo "configure:2059: checking for function prototypes" >&5 + if test "$am_cv_prog_cc_stdc" != no; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF + #define PROTOTYPES 1 + EOF + + U= ANSI2KNR= + else + echo "$ac_t""no" 1>&6 + U=_ ANSI2KNR=./ansi2knr + fi + # Ensure some checks needed by ansi2knr itself. + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 + echo "configure:2073: checking for ANSI C header files" >&5 + if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include + #include + #include + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:2086: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no + fi + rm -f conftest* + + if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : + else + rm -rf conftest* + ac_cv_header_stdc=no + fi + rm -f conftest* + + fi + + if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : + else + rm -rf conftest* + ac_cv_header_stdc=no + fi + rm -f conftest* + + fi + + if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : + else + cat > conftest.$ac_ext < + #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') + #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) + #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) + int main () { int i; for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); + exit (0); } + + EOF + if { (eval echo configure:2153: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + : + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no + fi + rm -fr conftest* + fi + + fi + fi + + echo "$ac_t""$ac_cv_header_stdc" 1>&6 + if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF + #define STDC_HEADERS 1 + EOF + + fi + + for ac_hdr in string.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 + echo "configure:2180: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:2190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 + fi + done + + + + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + + + echo $ac_n "checking for shared library run path origin""... $ac_c" 1>&6 + echo "configure:2236: checking for shared library run path origin" >&5 + if eval "test \"`echo '$''{'acl_cv_rpath'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + + fi + + echo "$ac_t""$acl_cv_rpath" 1>&6 + wl="$acl_cv_wl" + libext="$acl_cv_libext" + shlibext="$acl_cv_shlibext" + hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + hardcode_direct="$acl_cv_hardcode_direct" + hardcode_minus_L="$acl_cv_hardcode_minus_L" + sys_lib_search_path_spec="$acl_cv_sys_lib_search_path_spec" + sys_lib_dlsearch_path_spec="$acl_cv_sys_lib_dlsearch_path_spec" + + + MKINSTALLDIRS= + if test -n "$ac_aux_dir"; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z "$MKINSTALLDIRS"; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + + # Make sure we can run config.sub. + if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : + else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + echo "configure:2277: checking host system type" >&5 + + host_alias=$host + case "$host_alias" in + NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; + esac + + host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` + host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` + host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` + host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + echo "$ac_t""$host" 1>&6 + + echo $ac_n "checking for working const""... $ac_c" 1>&6 + echo "configure:2298: checking for working const" >&5 + if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } + + ; return 0; } + EOF + if { (eval echo configure:2352: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_c_const" 1>&6 + if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF + #define const + EOF + + fi + + echo $ac_n "checking for inline""... $ac_c" 1>&6 + echo "configure:2373: checking for inline" >&5 + if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_cv_c_inline=no + for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + done + + fi + + echo "$ac_t""$ac_cv_c_inline" 1>&6 + case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF + #define inline + EOF + ;; + *) cat >> confdefs.h <&6 + echo "configure:2413: checking for off_t" >&5 + if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #if STDC_HEADERS + #include + #include + #endif + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes + else + rm -rf conftest* + ac_cv_type_off_t=no + fi + rm -f conftest* + + fi + echo "$ac_t""$ac_cv_type_off_t" 1>&6 + if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF + #define off_t long + EOF + + fi + + echo $ac_n "checking for size_t""... $ac_c" 1>&6 + echo "configure:2446: checking for size_t" >&5 + if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #if STDC_HEADERS + #include + #include + #endif + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes + else + rm -rf conftest* + ac_cv_type_size_t=no + fi + rm -f conftest* + + fi + echo "$ac_t""$ac_cv_type_size_t" 1>&6 + if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF + #define size_t unsigned + EOF + + fi + + # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works + # for constant arguments. Useless! + echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 + echo "configure:2481: checking for working alloca.h" >&5 + if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + int main() { + char *p = alloca(2 * sizeof(int)); + ; return 0; } + EOF + if { (eval echo configure:2493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_alloca_h=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 + if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_ALLOCA_H 1 + EOF + + fi + + echo $ac_n "checking for alloca""... $ac_c" 1>&6 + echo "configure:2514: checking for alloca" >&5 + if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + # define alloca _alloca + # else + # if HAVE_ALLOCA_H + # include + # else + # ifdef _AIX + #pragma alloca + # else + # ifndef alloca /* predefined by HP cc +Olibcalls */ + char *alloca (); + # endif + # endif + # endif + # endif + #endif + + int main() { + char *p = (char *) alloca(1); + ; return 0; } + EOF + if { (eval echo configure:2547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_alloca_works=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 + if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_ALLOCA 1 + EOF + + fi + + if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.${ac_objext} + cat >> confdefs.h <<\EOF + #define C_ALLOCA 1 + EOF + + + echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 + echo "configure:2579: checking whether alloca needs Cray hooks" >&5 + if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes + else + rm -rf conftest* + ac_cv_os_cray=no + fi + rm -f conftest* + + fi + + echo "$ac_t""$ac_cv_os_cray" 1>&6 + if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2609: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char $ac_func(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_$ac_func) || defined (__stub___$ac_func) + choke me + #else + $ac_func(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:2637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <&6 + fi + + done + fi + + echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 + echo "configure:2664: checking stack direction for C alloca" >&5 + if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 + else + cat > conftest.$ac_ext < addr) ? 1 : -1; + } + main () + { + exit (find_stack_direction() < 0); + } + EOF + if { (eval echo configure:2691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + ac_cv_c_stack_direction=1 + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 + fi + rm -fr conftest* + fi + + fi + + echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 + cat >> confdefs.h <&6 + echo "configure:2716: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:2726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 + fi + done + + for ac_func in getpagesize + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:2755: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char $ac_func(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_$ac_func) || defined (__stub___$ac_func) + choke me + #else + $ac_func(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:2783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 + fi + done + + echo $ac_n "checking for working mmap""... $ac_c" 1>&6 + echo "configure:2808: checking for working mmap" >&5 + if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no + else + cat > conftest.$ac_ext < + #include + #include + + #if HAVE_SYS_TYPES_H + # include + #endif + + #if HAVE_STDLIB_H + # include + #endif + + #if HAVE_SYS_STAT_H + # include + #endif + + #if HAVE_UNISTD_H + # include + #endif + + /* This mess was copied from the GNU getpagesize.h. */ + #ifndef HAVE_GETPAGESIZE + + /* Assume that all systems that can run configure have sys/param.h. */ + # ifndef HAVE_SYS_PARAM_H + # define HAVE_SYS_PARAM_H 1 + # endif + + # ifdef _SC_PAGESIZE + # define getpagesize() sysconf(_SC_PAGESIZE) + # else /* no _SC_PAGESIZE */ + # ifdef HAVE_SYS_PARAM_H + # include + # ifdef EXEC_PAGESIZE + # define getpagesize() EXEC_PAGESIZE + # else /* no EXEC_PAGESIZE */ + # ifdef NBPG + # define getpagesize() NBPG * CLSIZE + # ifndef CLSIZE + # define CLSIZE 1 + # endif /* no CLSIZE */ + # else /* no NBPG */ + # ifdef NBPC + # define getpagesize() NBPC + # else /* no NBPC */ + # ifdef PAGESIZE + # define getpagesize() PAGESIZE + # endif /* PAGESIZE */ + # endif /* no NBPC */ + # endif /* no NBPG */ + # endif /* no EXEC_PAGESIZE */ + # else /* no HAVE_SYS_PARAM_H */ + # define getpagesize() 8192 /* punt totally */ + # endif /* no HAVE_SYS_PARAM_H */ + # endif /* no _SC_PAGESIZE */ + + #endif /* no HAVE_GETPAGESIZE */ + + #ifdef __cplusplus + extern "C" { void *malloc(unsigned); } + #else + char *malloc(); + #endif + + int + main() + { + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); + } + + EOF + if { (eval echo configure:2969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + ac_cv_func_mmap_fixed_mapped=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_fixed_mapped=no + fi + rm -fr conftest* + fi + + fi + + echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 + if test $ac_cv_func_mmap_fixed_mapped = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_MMAP 1 + EOF + + fi + + + echo $ac_n "checking whether we are using the GNU C Library 2.1 or newer""... $ac_c" 1>&6 + echo "configure:2993: checking whether we are using the GNU C Library 2.1 or newer" >&5 + if eval "test \"`echo '$''{'ac_cv_gnu_library_2_1'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #ifdef __GNU_LIBRARY__ + #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2) + Lucky GNU user + #endif + #endif + + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "Lucky GNU user" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_gnu_library_2_1=yes + else + rm -rf conftest* + ac_cv_gnu_library_2_1=no + fi + rm -f conftest* + + + + fi + + echo "$ac_t""$ac_cv_gnu_library_2_1" 1>&6 + + GLIBC21="$ac_cv_gnu_library_2_1" + + + + + + + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + # Check whether --with-libiconv-prefix or --without-libiconv-prefix was given. + if test "${with_libiconv_prefix+set}" = set; then + withval="$with_libiconv_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + + fi + + LIBICONV= + LTLIBICONV= + INCICONV= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='iconv ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "X$found_dir" = "X/usr/lib"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBICONV; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" + ;; + esac + done + fi + else + LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" + done + fi + + + am_save_CPPFLAGS="$CPPFLAGS" + + for element in $INCICONV; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + + echo $ac_n "checking for iconv""... $ac_c" 1>&6 + echo "configure:3436: checking for iconv" >&5 + if eval "test \"`echo '$''{'am_cv_func_iconv'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + cat > conftest.$ac_ext < + #include + int main() { + iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; return 0; } + EOF + if { (eval echo configure:3454: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_func_iconv=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + cat > conftest.$ac_ext < + #include + int main() { + iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd); + ; return 0; } + EOF + if { (eval echo configure:3476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_lib_iconv=yes + am_cv_func_iconv=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + LIBS="$am_save_LIBS" + fi + + fi + + echo "$ac_t""$am_cv_func_iconv" 1>&6 + if test "$am_cv_func_iconv" = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_ICONV 1 + EOF + + fi + if test "$am_cv_lib_iconv" = yes; then + echo $ac_n "checking how to link with libiconv""... $ac_c" 1>&6 + echo "configure:3499: checking how to link with libiconv" >&5 + echo "$ac_t""$LIBICONV" 1>&6 + else + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + + + + + + + # Extract the first word of "msgfmt", so it can be a program name with args. + set dummy msgfmt; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:3515: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if $ac_dir/$ac_word --statistics /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" + ;; + esac + fi + MSGFMT="$ac_cv_path_MSGFMT" + if test "$MSGFMT" != ":"; then + echo "$ac_t""$MSGFMT" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. + set dummy gmsgfmt; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:3550: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; + esac + fi + GMSGFMT="$ac_cv_path_GMSGFMT" + if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + + # Extract the first word of "xgettext", so it can be a program name with args. + set dummy xgettext; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:3587: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $ac_dir/$ac_word --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; + esac + fi + XGETTEXT="$ac_cv_path_XGETTEXT" + if test "$XGETTEXT" != ":"; then + echo "$ac_t""$XGETTEXT" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + rm -f messages.po + + # Extract the first word of "msgmerge", so it can be a program name with args. + set dummy msgmerge; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:3624: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_path_MSGMERGE'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + case "$MSGMERGE" in + /*) + ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if $ac_dir/$ac_word --update -q /dev/null /dev/null >/dev/null 2>&1; then + ac_cv_path_MSGMERGE="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" + ;; + esac + fi + MSGMERGE="$ac_cv_path_MSGMERGE" + if test "$MSGMERGE" != ":"; then + echo "$ac_t""$MSGMERGE" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + + if test "$GMSGFMT" != ":"; then + if $GMSGFMT --statistics /dev/null >/dev/null 2>&1 && + (if $GMSGFMT --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + GMSGFMT=`echo "$GMSGFMT" | sed -e 's,^.*/,,'` + echo "$ac_t""found $GMSGFMT program is not GNU msgfmt; ignore it" 1>&6 + GMSGFMT=":" + fi + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header --copyright-holder= /dev/null >/dev/null 2>&1 && + (if $XGETTEXT --omit-header --copyright-holder= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then + : ; + else + echo "$ac_t""found xgettext program is not GNU xgettext; ignore it" 1>&6 + XGETTEXT=":" + fi + rm -f messages.po + fi + + + + + + for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h stddef.h \ + stdlib.h string.h unistd.h sys/param.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 + echo "configure:3687: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:3697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 + fi + done + + for ac_func in feof_unlocked fgets_unlocked getc_unlocked getcwd getegid \ + geteuid getgid getuid mempcpy munmap putenv setenv setlocale stpcpy \ + strcasecmp strdup strtoul tsearch __argz_count __argz_stringify __argz_next + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:3728: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char $ac_func(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_$ac_func) || defined (__stub___$ac_func) + choke me + #else + $ac_func(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:3756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 + fi + done + + + + + if test "$am_cv_func_iconv" = yes; then + echo $ac_n "checking for iconv declaration""... $ac_c" 1>&6 + echo "configure:3785: checking for iconv declaration" >&5 + if eval "test \"`echo '$''{'am_cv_proto_iconv'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + + cat > conftest.$ac_ext < + #include + extern + #ifdef __cplusplus + "C" + #endif + #if defined(__STDC__) || defined(__cplusplus) + size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); + #else + size_t iconv(); + #endif + + int main() { + + ; return 0; } + EOF + if { (eval echo configure:3810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + am_cv_proto_iconv_arg1="" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_proto_iconv_arg1="const" + fi + rm -f conftest* + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);" + fi + + am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + echo "$ac_t""${ac_t:- + }$am_cv_proto_iconv" 1>&6 + cat >> confdefs.h <&6 + echo "configure:3834: checking for nl_langinfo and CODESET" >&5 + if eval "test \"`echo '$''{'am_cv_langinfo_codeset'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + int main() { + char* cs = nl_langinfo(CODESET); + ; return 0; } + EOF + if { (eval echo configure:3846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_langinfo_codeset=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_langinfo_codeset=no + fi + rm -f conftest* + + fi + + echo "$ac_t""$am_cv_langinfo_codeset" 1>&6 + if test $am_cv_langinfo_codeset = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_LANGINFO_CODESET 1 + EOF + + fi + + if test $ac_cv_header_locale_h = yes; then + echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 + echo "configure:3869: checking for LC_MESSAGES" >&5 + if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + int main() { + return LC_MESSAGES + ; return 0; } + EOF + if { (eval echo configure:3881: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + am_cv_val_LC_MESSAGES=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_val_LC_MESSAGES=no + fi + rm -f conftest* + fi + + echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 + if test $am_cv_val_LC_MESSAGES = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_LC_MESSAGES 1 + EOF + + fi + fi + + for ac_prog in bison + do + # Extract the first word of "$ac_prog", so it can be a program name with args. + set dummy $ac_prog; ac_word=$2 + echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 + echo "configure:3907: checking for $ac_word" >&5 + if eval "test \"`echo '$''{'ac_cv_prog_INTLBISON'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test -n "$INTLBISON"; then + ac_cv_prog_INTLBISON="$INTLBISON" # Let the user override the test. + else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_INTLBISON="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" + fi + fi + INTLBISON="$ac_cv_prog_INTLBISON" + if test -n "$INTLBISON"; then + echo "$ac_t""$INTLBISON" 1>&6 + else + echo "$ac_t""no" 1>&6 + fi + + test -n "$INTLBISON" && break + done + + if test -z "$INTLBISON"; then + ac_verc_fail=yes + else + echo $ac_n "checking version of bison""... $ac_c" 1>&6 + echo "configure:3940: checking version of bison" >&5 + ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison.* \([0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*) + ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;; + *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;; + esac + echo "$ac_t""$ac_prog_version" 1>&6 + fi + if test $ac_verc_fail = yes; then + INTLBISON=: + fi + + + + + + + + + + + + + + echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 + echo "configure:3967: checking whether NLS is requested" >&5 + # Check whether --enable-nls or --disable-nls was given. + if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval + else + USE_NLS=yes + fi + + echo "$ac_t""$USE_NLS" 1>&6 + + + + BUILD_INCLUDED_LIBINTL=no + USE_INCLUDED_LIBINTL=no + + LIBINTL= + LTLIBINTL= + POSUB= + + if test "$USE_NLS" = "yes"; then + gt_use_preinstalled_gnugettext=no + + echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 + echo "configure:3991: checking whether included gettext is requested" >&5 + # Check whether --with-included-gettext or --without-included-gettext was given. + if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" + nls_cv_force_use_gnu_gettext=$withval + else + nls_cv_force_use_gnu_gettext=no + fi + + echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + + + + + + + echo $ac_n "checking for GNU gettext in libc""... $ac_c" 1>&6 + echo "configure:4011: checking for GNU gettext in libc" >&5 + if eval "test \"`echo '$''{'gt_cv_func_gnugettext2_libc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + extern int _nl_msg_cat_cntr; + extern int *_nl_domain_bindings; + int main() { + bindtextdomain ("", ""); + return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_domain_bindings + ; return 0; } + EOF + if { (eval echo configure:4026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + gt_cv_func_gnugettext2_libc=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gnugettext2_libc=no + fi + rm -f conftest* + fi + + echo "$ac_t""$gt_cv_func_gnugettext2_libc" 1>&6 + + if test "$gt_cv_func_gnugettext2_libc" != "yes"; then + + + + use_additional=yes + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + # Check whether --with-libintl-prefix or --without-libintl-prefix was given. + if test "${with_libintl_prefix+set}" = set; then + withval="$with_libintl_prefix" + + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + else + additional_includedir="$withval/include" + additional_libdir="$withval/lib" + fi + fi + + fi + + LIBINTL= + LTLIBINTL= + INCINTL= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='intl ' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" + else + : + fi + else + found_dir= + found_la= + found_so= + found_a= + if test $use_additional = yes; then + if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then + found_dir="$additional_libdir" + found_so="$additional_libdir/lib$name.$shlibext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + else + if test -f "$additional_libdir/lib$name.$libext"; then + found_dir="$additional_libdir" + found_a="$additional_libdir/lib$name.$libext" + if test -f "$additional_libdir/lib$name.la"; then + found_la="$additional_libdir/lib$name.la" + fi + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then + found_dir="$dir" + found_so="$dir/lib$name.$shlibext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + else + if test -f "$dir/lib$name.$libext"; then + found_dir="$dir" + found_a="$dir/lib$name.$libext" + if test -f "$dir/lib$name.la"; then + found_la="$dir/lib$name.la" + fi + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + if test "X$found_dir" = "X/usr/lib"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + if test "$hardcode_direct" = yes; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" + fi + if test "$hardcode_minus_L" != no; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" + fi + fi + additional_includedir= + case "$found_dir" in + */lib | */lib/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'` + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INCINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + if test -n "$found_la"; then + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + if test "X$additional_libdir" != "X/usr/lib"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/lib"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIBINTL; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + ;; + -l*) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" + ;; + esac + done + fi + else + LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$hardcode_libdir_separator"; then + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + else + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + for found_dir in $ltrpathdirs; do + LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" + done + fi + + echo $ac_n "checking for GNU gettext in libintl""... $ac_c" 1>&6 + echo "configure:4419: checking for GNU gettext in libintl" >&5 + if eval "test \"`echo '$''{'gt_cv_func_gnugettext2_libintl'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + gt_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $INCINTL" + gt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBINTL" + cat > conftest.$ac_ext < + extern int _nl_msg_cat_cntr; + extern + #ifdef __cplusplus + "C" + #endif + const char *_nl_expand_alias (); + int main() { + bindtextdomain ("", ""); + return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; return 0; } + EOF + if { (eval echo configure:4442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + gt_cv_func_gnugettext2_libintl=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gnugettext2_libintl=no + fi + rm -f conftest* + if test "$gt_cv_func_gnugettext2_libintl" != yes && test -n "$LIBICONV"; then + LIBS="$LIBS $LIBICONV" + cat > conftest.$ac_ext < + extern int _nl_msg_cat_cntr; + extern + #ifdef __cplusplus + "C" + #endif + const char *_nl_expand_alias (); + int main() { + bindtextdomain ("", ""); + return (int) gettext ("") + (int) ngettext ("", "", 0) + _nl_msg_cat_cntr + *_nl_expand_alias (0) + ; return 0; } + EOF + if { (eval echo configure:4469: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + LIBINTL="$LIBINTL $LIBICONV" + LTLIBINTL="$LTLIBINTL $LTLIBICONV" + gt_cv_func_gnugettext2_libintl=yes + + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + fi + CPPFLAGS="$gt_save_CPPFLAGS" + LIBS="$gt_save_LIBS" + fi + + echo "$ac_t""$gt_cv_func_gnugettext2_libintl" 1>&6 + fi + + if test "$gt_cv_func_gnugettext2_libc" = "yes" \ + || { test "$gt_cv_func_gnugettext2_libintl" = "yes" \ + && test "$PACKAGE" != gettext; }; then + gt_use_preinstalled_gnugettext=yes + else + LIBINTL= + LTLIBINTL= + INCINTL= + fi + + + if test "$gt_use_preinstalled_gnugettext" != "yes"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + INTLOBJS="\$(GETTOBJS)" + BUILD_INCLUDED_LIBINTL=yes + USE_INCLUDED_LIBINTL=yes + LIBINTL="\${top_builddir}/intl/libintl.a $LIBICONV" + LTLIBINTL="\${top_builddir}/intl/libintl.a $LTLIBICONV" + LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'` + fi + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + CATOBJEXT=.gmo + fi + + + if test "$gt_use_preinstalled_gnugettext" = "yes" \ + || test "$nls_cv_use_gnu_gettext" = "yes"; then + cat >> confdefs.h <<\EOF + #define ENABLE_NLS 1 + EOF + + else + USE_NLS=no + fi + fi + + if test "$USE_NLS" = "yes"; then + + if test "$gt_use_preinstalled_gnugettext" = "yes"; then + if test "$gt_cv_func_gnugettext2_libintl" = "yes"; then + echo $ac_n "checking how to link with libintl""... $ac_c" 1>&6 + echo "configure:4535: checking how to link with libintl" >&5 + echo "$ac_t""$LIBINTL" 1>&6 + + for element in $INCINTL; do + haveit= + for x in $CPPFLAGS; do + + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + eval x=\"$x\" + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" + + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" + fi + done + + fi + + cat >> confdefs.h <<\EOF + #define HAVE_GETTEXT 1 + EOF + + cat >> confdefs.h <<\EOF + #define HAVE_DCGETTEXT 1 + EOF + + fi + + POSUB=po + fi + + + if test "$PACKAGE" = gettext; then + BUILD_INCLUDED_LIBINTL=yes + fi + + + + + + + nls_cv_header_intl= + nls_cv_header_libgt= + + DATADIRNAME=share + + + INSTOBJEXT=.mo + + + GENCAT=gencat + + + INTL_LIBTOOL_SUFFIX_PREFIX= + + + + INTLLIBS="$LIBINTL" + + + + + + + + echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 + echo "configure:4610: checking for ANSI C header files" >&5 + if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include + #include + #include + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:4623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no + fi + rm -f conftest* + + if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : + else + rm -rf conftest* + ac_cv_header_stdc=no + fi + rm -f conftest* + + fi + + if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : + else + rm -rf conftest* + ac_cv_header_stdc=no + fi + rm -f conftest* + + fi + + if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : + else + cat > conftest.$ac_ext < + #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') + #define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) + #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) + int main () { int i; for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); + exit (0); } + + EOF + if { (eval echo configure:4690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + : + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no + fi + rm -fr conftest* + fi + + fi + fi + + echo "$ac_t""$ac_cv_header_stdc" 1>&6 + if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF + #define STDC_HEADERS 1 + EOF + + fi + + echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 + echo "configure:4714: checking for sys/wait.h that is POSIX.1 compatible" >&5 + if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include + #ifndef WEXITSTATUS + #define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) + #endif + #ifndef WIFEXITED + #define WIFEXITED(stat_val) (((stat_val) & 255) == 0) + #endif + int main() { + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; return 0; } + EOF + if { (eval echo configure:4735: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_wait_h=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 + if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_SYS_WAIT_H 1 + EOF + + fi + + echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 + echo "configure:4756: checking whether time.h and sys/time.h may both be included" >&5 + if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include + #include + int main() { + struct tm *tp; + ; return 0; } + EOF + if { (eval echo configure:4770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_header_time" 1>&6 + if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF + #define TIME_WITH_SYS_TIME 1 + EOF + + fi + + for ac_hdr in fcntl.h limits.h locale.h libintl.h mcheck.h \ + netdb.h netinet/in.h signum.h stdarg.h string.h \ + sys/param.h sys/socket.h sys/time.h unistd.h \ + wchar.h wctype.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 + echo "configure:4797: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:4807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 + fi + done + + + if test "$ac_cv_header_string_h" = yes + then + for ac_hdr in memory.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 + echo "configure:4840: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:4850: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 + fi + done + + else + for ac_hdr in strings.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 + echo "configure:4881: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:4891: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 + fi + done + + fi + + echo $ac_n "checking for pid_t""... $ac_c" 1>&6 + echo "configure:4920: checking for pid_t" >&5 + if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #if STDC_HEADERS + #include + #include + #endif + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes + else + rm -rf conftest* + ac_cv_type_pid_t=no + fi + rm -f conftest* + + fi + echo "$ac_t""$ac_cv_type_pid_t" 1>&6 + if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF + #define pid_t int + EOF + + fi + + echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 + echo "configure:4953: checking return type of signal handlers" >&5 + if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include + #ifdef signal + #undef signal + #endif + #ifdef __cplusplus + extern "C" void (*signal (int, void (*)(int)))(int); + #else + void (*signal ()) (); + #endif + + int main() { + int i; + ; return 0; } + EOF + if { (eval echo configure:4975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_type_signal" 1>&6 + cat >> confdefs.h <&6 + echo "configure:4994: checking for size_t" >&5 + if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #if STDC_HEADERS + #include + #include + #endif + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes + else + rm -rf conftest* + ac_cv_type_size_t=no + fi + rm -f conftest* + + fi + echo "$ac_t""$ac_cv_type_size_t" 1>&6 + if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF + #define size_t unsigned + EOF + + fi + + echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 + echo "configure:5027: checking for uid_t in sys/types.h" >&5 + if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "uid_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uid_t=yes + else + rm -rf conftest* + ac_cv_type_uid_t=no + fi + rm -f conftest* + + fi + + echo "$ac_t""$ac_cv_type_uid_t" 1>&6 + if test $ac_cv_type_uid_t = no; then + cat >> confdefs.h <<\EOF + #define uid_t int + EOF + + cat >> confdefs.h <<\EOF + #define gid_t int + EOF + + fi + + echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 + echo "configure:5061: checking type of array argument to getgroups" >&5 + if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then + ac_cv_type_getgroups=cross + else + cat > conftest.$ac_ext < + #define NGID 256 + #undef MAX + #define MAX(x, y) ((x) > (y) ? (x) : (y)) + main() + { + gid_t gidset[NGID]; + int i, n; + union { gid_t gval; long lval; } val; + + val.lval = -1; + for (i = 0; i < NGID; i++) + gidset[i] = val.gval; + n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, + gidset); + /* Exit non-zero if getgroups seems to require an array of ints. This + happens when gid_t is short but getgroups modifies an array of ints. */ + exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); + } + + EOF + if { (eval echo configure:5094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + ac_cv_type_getgroups=gid_t + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_type_getgroups=int + fi + rm -fr conftest* + fi + + if test $ac_cv_type_getgroups = cross; then + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "getgroups.*int.*gid_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_getgroups=gid_t + else + rm -rf conftest* + ac_cv_type_getgroups=int + fi + rm -f conftest* + + fi + fi + + echo "$ac_t""$ac_cv_type_getgroups" 1>&6 + cat >> confdefs.h <&6 + echo "configure:5136: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:5146: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 + fi + done + + echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 + echo "configure:5173: checking for ssize_t" >&5 + if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #if STDC_HEADERS + #include + #include + #endif + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ssize_t=yes + else + rm -rf conftest* + ac_cv_type_ssize_t=no + fi + rm -f conftest* + + fi + echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 + if test $ac_cv_type_ssize_t = no; then + cat >> confdefs.h <<\EOF + #define ssize_t int + EOF + + fi + + + + cat > conftest.$ac_ext < + EOF + if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "int.*sprintf" >/dev/null 2>&1; then + rm -rf conftest* + cat >> confdefs.h <<\EOF + #define SPRINTF_RET int + EOF + + else + rm -rf conftest* + cat >> confdefs.h <<\EOF + #define SPRINTF_RET char * + EOF + + fi + rm -f conftest* + + cat > conftest.$ac_ext < + int main() { + + time_t foo; + foo = 0; + + ; return 0; } + EOF + if { (eval echo configure:5239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cat >> confdefs.h <<\EOF + #define TIME_T_IN_SYS_TYPES_H 1 + EOF + + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + + cat >> confdefs.h <<\EOF + #define REGEX_MALLOC 1 + EOF + + echo $ac_n "checking for vprintf""... $ac_c" 1>&6 + echo "configure:5256: checking for vprintf" >&5 + if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char vprintf(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_vprintf) || defined (__stub___vprintf) + choke me + #else + vprintf(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:5284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_vprintf=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vprintf=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF + #define HAVE_VPRINTF 1 + EOF + + else + echo "$ac_t""no" 1>&6 + fi + + if test "$ac_cv_func_vprintf" != yes; then + echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 + echo "configure:5308: checking for _doprnt" >&5 + if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char _doprnt(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub__doprnt) || defined (__stub____doprnt) + choke me + #else + _doprnt(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:5336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func__doprnt=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func__doprnt=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF + #define HAVE_DOPRNT 1 + EOF + + else + echo "$ac_t""no" 1>&6 + fi + + fi + + + for ac_hdr in stdlib.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 + echo "configure:5365: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:5375: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 + fi + done + + for ac_func in strtod + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:5404: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char $ac_func(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_$ac_func) || defined (__stub___$ac_func) + choke me + #else + $ac_func(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:5432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 + fi + done + + echo $ac_n "checking for strtod with C89 semantics""... $ac_c" 1>&6 + echo "configure:5457: checking for strtod with C89 semantics" >&5 + if eval "test \"`echo '$''{'gawk_ac_cv_func_strtod_c89'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then + gawk_ac_cv_func_strtod_c89=no + else + cat > conftest.$ac_ext < + #else + extern double strtod(); + #endif + + int + main () + { + #if ! HAVE_STRTOD + exit(1); + #else + double d; + char *str = "0x345a"; + + d = strtod(str, 0); + if (d == 0) + exit (0); + else + exit (1); + #endif + } + EOF + if { (eval echo configure:5491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + gawk_ac_cv_func_strtod_c89=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + gawk_ac_cv_func_strtod_c89=no + fi + rm -fr conftest* + fi + + fi + + echo "$ac_t""$gawk_ac_cv_func_strtod_c89" 1>&6 + if test $gawk_ac_cv_func_strtod_c89 = no; then + cat >> confdefs.h <<\EOF + #define STRTOD_NOT_C89 1 + EOF + + fi + + for ac_hdr in sys/time.h unistd.h + do + ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 + echo "configure:5517: checking for $ac_hdr" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:5527: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <&6 + fi + done + + for ac_func in alarm + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:5556: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char $ac_func(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_$ac_func) || defined (__stub___$ac_func) + choke me + #else + $ac_func(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:5584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 + fi + done + + echo $ac_n "checking for working mktime""... $ac_c" 1>&6 + echo "configure:5609: checking for working mktime" >&5 + if eval "test \"`echo '$''{'ac_cv_func_working_mktime'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then + ac_cv_func_working_mktime=no + else + cat > conftest.$ac_ext < + # include + #else + # if HAVE_SYS_TIME_H + # include + # else + # include + # endif + #endif + + #if HAVE_UNISTD_H + # include + #endif + + #if !HAVE_ALARM + # define alarm(X) /* empty */ + #endif + + /* Work around redefinition to rpl_putenv by other config tests. */ + #undef putenv + + static time_t time_t_max; + + /* Values we'll use to set the TZ environment variable. */ + static const char *const tz_strings[] = { + (const char *) 0, "TZ=GMT0", "TZ=JST-9", + "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" + }; + #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) + + /* Fail if mktime fails to convert a date in the spring-forward gap. + Based on a problem report from Andreas Jaeger. */ + static void + spring_forward_gap () + { + /* glibc (up to about 1998-10-07) failed this test) */ + struct tm tm; + + /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" + instead of "TZ=America/Vancouver" in order to detect the bug even + on systems that don't support the Olson extension, or don't have the + full zoneinfo tables installed. */ + putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); + + tm.tm_year = 98; + tm.tm_mon = 3; + tm.tm_mday = 5; + tm.tm_hour = 2; + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_isdst = -1; + if (mktime (&tm) == (time_t)-1) + exit (1); + } + + static void + mktime_test (now) + time_t now; + { + struct tm *lt; + if ((lt = localtime (&now)) && mktime (lt) != now) + exit (1); + now = time_t_max - now; + if ((lt = localtime (&now)) && mktime (lt) != now) + exit (1); + } + + static void + irix_6_4_bug () + { + /* Based on code from Ariel Faigon. */ + struct tm tm; + tm.tm_year = 96; + tm.tm_mon = 3; + tm.tm_mday = 0; + tm.tm_hour = 0; + tm.tm_min = 0; + tm.tm_sec = 0; + tm.tm_isdst = -1; + mktime (&tm); + if (tm.tm_mon != 2 || tm.tm_mday != 31) + exit (1); + } + + static void + bigtime_test (j) + int j; + { + struct tm tm; + time_t now; + tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; + now = mktime (&tm); + if (now != (time_t) -1) + { + struct tm *lt = localtime (&now); + if (! (lt + && lt->tm_year == tm.tm_year + && lt->tm_mon == tm.tm_mon + && lt->tm_mday == tm.tm_mday + && lt->tm_hour == tm.tm_hour + && lt->tm_min == tm.tm_min + && lt->tm_sec == tm.tm_sec + && lt->tm_yday == tm.tm_yday + && lt->tm_wday == tm.tm_wday + && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) + == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) + exit (1); + } + } + + int + main () + { + time_t t, delta; + int i, j; + + /* This test makes some buggy mktime implementations loop. + Give up after 60 seconds; a mktime slower than that + isn't worth using anyway. */ + alarm (60); + + for (time_t_max = 1; 0 < time_t_max; time_t_max *= 2) + continue; + time_t_max--; + delta = time_t_max / 997; /* a suitable prime number */ + for (i = 0; i < N_STRINGS; i++) + { + if (tz_strings[i]) + putenv (tz_strings[i]); + + for (t = 0; t <= time_t_max - delta; t += delta) + mktime_test (t); + mktime_test ((time_t) 60 * 60); + mktime_test ((time_t) 60 * 60 * 24); + + for (j = 1; 0 < j; j *= 2) + bigtime_test (j); + bigtime_test (j - 1); + } + irix_6_4_bug (); + spring_forward_gap (); + exit (0); + } + EOF + if { (eval echo configure:5766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + ac_cv_func_working_mktime=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_working_mktime=no + fi + rm -fr conftest* + fi + + fi + + echo "$ac_t""$ac_cv_func_working_mktime" 1>&6 + if test $ac_cv_func_working_mktime = no; then + LIBOBJS="$LIBOBJS mktime.${ac_objext}" + fi + + case "$ac_cv_func_working_mktime" in + yes) cat >> confdefs.h <<\EOF + #define HAVE_MKTIME 1 + EOF + + ;; + esac + + echo $ac_n "checking for fmod in -lm""... $ac_c" 1>&6 + echo "configure:5794: checking for fmod in -lm" >&5 + ac_lib_var=`echo m'_'fmod | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_save_LIBS="$LIBS" + LIBS="-lm $LIBS" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" + fi + rm -f conftest* + LIBS="$ac_save_LIBS" + + fi + if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo m | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <&6 + fi + + for ac_func in getgroups memset memcpy memcmp fmod setlocale strchr strerror \ + strftime strncasecmp strtod system tzset mbrlen mbrtowc + do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 + echo "configure:5844: checking for $ac_func" >&5 + if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char $ac_func(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_$ac_func) || defined (__stub___$ac_func) + choke me + #else + $ac_func(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:5872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <&6 + fi + done + + + ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'` + echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6 + echo "configure:5899: checking for dlfcn.h" >&5 + if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + EOF + ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" + { (eval echo configure:5909: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } + ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` + if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" + else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" + fi + rm -f conftest* + fi + if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 + echo "configure:5926: checking for dlopen in -ldl" >&5 + ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_save_LIBS="$LIBS" + LIBS="-ldl $LIBS" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" + fi + rm -f conftest* + LIBS="$ac_save_LIBS" + + fi + if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF + #define DYNAMIC 1 + EOF + + LIBS="$LIBS -ldl" + if test "$GCC" = yes + then + # Add others here as appropriate, + # one day use GNU libtool. + if uname | egrep -i linux > /dev/null + then + LDFLAGS="$LDFLAGS -rdynamic" + fi + fi + + else + echo "$ac_t""no" 1>&6 + fi + + else + echo "$ac_t""no" 1>&6 + fi + + + case `(uname) 2> /dev/null` in + *VMS*|*BeOS*|*OS/2*|*MS-DOS*) + cat >> confdefs.h <<\EOF + #define GETPGRP_VOID 1 + EOF + + ;; + *) echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6 + echo "configure:5992: checking whether getpgrp takes no argument" >&5 + if eval "test \"`echo '$''{'ac_cv_func_getpgrp_void'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$cross_compiling" = yes; then + { echo "configure: error: cannot check getpgrp if cross compiling" 1>&2; exit 1; } + else + cat > conftest.$ac_ext < + #include + + int pid; + int pg1, pg2, pg3, pg4; + int ng, np, s, child; + + main() + { + pid = getpid(); + pg1 = getpgrp(0); + pg2 = getpgrp(); + pg3 = getpgrp(pid); + pg4 = getpgrp(1); + + /* + * If all of these values are the same, it's pretty sure that + * we're on a system that ignores getpgrp's first argument. + */ + if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) + exit(0); + + child = fork(); + if (child < 0) + exit(1); + else if (child == 0) { + np = getpid(); + /* + * If this is Sys V, this will not work; pgrp will be + * set to np because setpgrp just changes a pgrp to be + * the same as the pid. + */ + setpgrp(np, pg1); + ng = getpgrp(0); /* Same result for Sys V and BSD */ + if (ng == pg1) { + exit(1); + } else { + exit(0); + } + } else { + wait(&s); + exit(s>>8); + } + } + + EOF + if { (eval echo configure:6055: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + ac_cv_func_getpgrp_void=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_getpgrp_void=no + fi + rm -fr conftest* + fi + + + fi + + echo "$ac_t""$ac_cv_func_getpgrp_void" 1>&6 + if test $ac_cv_func_getpgrp_void = yes; then + cat >> confdefs.h <<\EOF + #define GETPGRP_VOID 1 + EOF + + fi + + ;; + esac + + + gawk_have_sockets=no + # Check for system-dependent location of socket libraries + + SOCKET_LIBS= + if test "$ISC" = yes; then + SOCKET_LIBS="-lnsl_s -linet" + else + # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And karl@cs.umb.edu says + # the Alpha needs dnet_stub (dnet does not exist). + # + # ADR: Is this needed just for sockets??? + # AC_CHECK_LIB(dnet, dnet_ntoa, [SOCKET_LIBS="$SOCKET_LIBS -ldnet"]) + # if test $ac_cv_lib_dnet_ntoa = no; then + # AC_CHECK_LIB(dnet_stub, dnet_ntoa, + # [SOCKET_LIBS="$SOCKET_LIBS -ldnet_stub"]) + # fi + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to dickey@clark.net. + echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 + echo "configure:6107: checking for gethostbyname" >&5 + if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char gethostbyname(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) + choke me + #else + gethostbyname(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:6135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_gethostbyname=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_gethostbyname=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : + else + echo "$ac_t""no" 1>&6 + fi + + if test $ac_cv_func_gethostbyname = no; then + echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 + echo "configure:6156: checking for gethostbyname in -lnsl" >&5 + ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_save_LIBS="$LIBS" + LIBS="-lnsl $LIBS" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" + fi + rm -f conftest* + LIBS="$ac_save_LIBS" + + fi + if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SOCKET_LIBS="$SOCKET_LIBS -lnsl" + else + echo "$ac_t""no" 1>&6 + fi + + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says simon@lia.di.epfl.ch: it contains + # gethostby* variants that don't use the nameserver (or something). + # -lsocket must be given before -lnsl if both are needed. + # We assume that if connect needs -lnsl, so does gethostbyname. + echo $ac_n "checking for connect""... $ac_c" 1>&6 + echo "configure:6205: checking for connect" >&5 + if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + /* Override any gcc2 internal prototype to avoid an error. */ + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char connect(); + + int main() { + + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ + #if defined (__stub_connect) || defined (__stub___connect) + choke me + #else + connect(); + #endif + + ; return 0; } + EOF + if { (eval echo configure:6233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_connect=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_connect=no" + fi + rm -f conftest* + fi + + if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : + else + echo "$ac_t""no" 1>&6 + fi + + if test $ac_cv_func_connect = no; then + echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 + echo "configure:6254: checking for connect in -lsocket" >&5 + ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` + if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_save_LIBS="$LIBS" + LIBS="-lsocket $SOCKET_LIBS $LIBS" + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" + fi + rm -f conftest* + LIBS="$ac_save_LIBS" + + fi + if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SOCKET_LIBS="-lsocket $SOCKET_LIBS" + gawk_have_sockets=yes + else + echo "$ac_t""no" 1>&6 + fi + + else + gawk_have_sockets=yes + fi + fi + + if test "${gawk_have_sockets}" = "yes" + then + echo $ac_n "checking where to find the socket library calls""... $ac_c" 1>&6 + echo "configure:6302: checking where to find the socket library calls" >&5 + case "${SOCKET_LIBS}" in + ?*) gawk_lib_loc="${SOCKET_LIBS}" ;; + *) gawk_lib_loc="the standard library" ;; + esac + echo "$ac_t""${gawk_lib_loc}" 1>&6 + + cat >> confdefs.h <<\EOF + #define HAVE_SOCKETS 1 + EOF + + fi + + + echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 + echo "configure:6317: checking for st_blksize in struct stat" >&5 + if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include + int main() { + struct stat s; s.st_blksize; + ; return 0; } + EOF + if { (eval echo configure:6330: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_blksize=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_blksize=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6 + if test $ac_cv_struct_st_blksize = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_ST_BLKSIZE 1 + EOF + + fi + + echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 + echo "configure:6351: checking whether time.h and sys/time.h may both be included" >&5 + if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include + #include + int main() { + struct tm *tp; + ; return 0; } + EOF + if { (eval echo configure:6365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_header_time" 1>&6 + if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF + #define TIME_WITH_SYS_TIME 1 + EOF + + fi + + echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 + echo "configure:6386: checking whether struct tm is in sys/time.h or time.h" >&5 + if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include + int main() { + struct tm *tp; tp->tm_sec; + ; return 0; } + EOF + if { (eval echo configure:6399: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm=time.h + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm=sys/time.h + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_struct_tm" 1>&6 + if test $ac_cv_struct_tm = sys/time.h; then + cat >> confdefs.h <<\EOF + #define TM_IN_SYS_TIME 1 + EOF + + fi + + echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 + echo "configure:6420: checking for tm_zone in struct tm" >&5 + if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #include <$ac_cv_struct_tm> + int main() { + struct tm tm; tm.tm_zone; + ; return 0; } + EOF + if { (eval echo configure:6433: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_tm_zone=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_tm_zone=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_struct_tm_zone" 1>&6 + if test "$ac_cv_struct_tm_zone" = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_TM_ZONE 1 + EOF + + else + echo $ac_n "checking for tzname""... $ac_c" 1>&6 + echo "configure:6453: checking for tzname" >&5 + if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext < + #ifndef tzname /* For SGI. */ + extern char *tzname[]; /* RS6000 and others reject char **tzname. */ + #endif + int main() { + atoi(*tzname); + ; return 0; } + EOF + if { (eval echo configure:6468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_var_tzname=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_var_tzname=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_var_tzname" 1>&6 + if test $ac_cv_var_tzname = yes; then + cat >> confdefs.h <<\EOF + #define HAVE_TZNAME 1 + EOF + + fi + fi + + + echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 + echo "configure:6491: checking whether char is unsigned" >&5 + if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + if test "$GCC" = yes; then + # GCC predefines this symbol on systems where it applies. + cat > conftest.$ac_ext <&5 | + egrep "yes" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_c_char_unsigned=yes + else + rm -rf conftest* + ac_cv_c_char_unsigned=no + fi + rm -f conftest* + + else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } + else + cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null + then + ac_cv_c_char_unsigned=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_char_unsigned=no + fi + rm -fr conftest* + fi + + fi + fi + + echo "$ac_t""$ac_cv_c_char_unsigned" 1>&6 + if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + cat >> confdefs.h <<\EOF + #define __CHAR_UNSIGNED__ 1 + EOF + + fi + + echo $ac_n "checking for working const""... $ac_c" 1>&6 + echo "configure:6554: checking for working const" >&5 + if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + } + + ; return 0; } + EOF + if { (eval echo configure:6608: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no + fi + rm -f conftest* + fi + + echo "$ac_t""$ac_cv_c_const" 1>&6 + if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF + #define const + EOF + + fi + + echo $ac_n "checking for inline""... $ac_c" 1>&6 + echo "configure:6629: checking for inline" >&5 + if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + ac_cv_c_inline=no + for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break + else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -f conftest* + done + + fi + + echo "$ac_t""$ac_cv_c_inline" 1>&6 + case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF + #define inline + EOF + ;; + *) cat >> confdefs.h <&6 + echo "configure:6671: checking for preprocessor stringizing operator" >&5 + if eval "test \"`echo '$''{'ac_cv_c_stringize'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 + else + cat > conftest.$ac_ext <&5 | + egrep "#teststring" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_c_stringize=no + else + rm -rf conftest* + ac_cv_c_stringize=yes + fi + rm -f conftest* + + fi + + if test "${ac_cv_c_stringize}" = yes + then + cat >> confdefs.h <<\EOF + #define HAVE_STRINGIZE 1 + EOF + + fi + echo "$ac_t""${ac_cv_c_stringize}" 1>&6 + + + PATH_SEPARATOR=':' + if test `uname` = 'OS/2'; then + PATH_SEPARATOR=';' + fi + + + trap '' 1 2 15 + cat > confcache <<\EOF + # This file is a shell script that caches the results of configure + # tests run on this system so they can be shared between configure + # scripts and configure runs. It is not useful on other systems. + # If it contains results you don't want to keep, you may remove or edit it. + # + # By default, configure uses ./config.cache as the cache file, + # creating it if it does not exist already. You can give configure + # the --cache-file=FILE option to use a different cache file; that is + # what configure does when it calls configure scripts in + # subdirectories, so they share the cache. + # Giving --cache-file=/dev/null disables caching, for debugging configure. + # config.status only pays attention to the cache file if you give it the + # --recheck option to rerun configure. + # + EOF + # The following way of writing the cache mishandles newlines in values, + # but we know of no workaround that is simple, portable, and efficient. + # So, don't put newlines in cache variables' values. + # Ultrix sh set writes to stderr and can't be redirected directly, + # and sets the high bit in the cache file unless we assign to the vars. + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache + if cmp -s $cache_file confcache; then + : + else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi + fi + rm -f confcache + + trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + + test "x$prefix" = xNONE && prefix=$ac_default_prefix + # Let make expand exec_prefix. + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + + # Any assignment to VPATH causes Sun make to only execute + # the first set of double-colon rules, so remove it if not needed. + # If there is a colon in the path, we need to keep it. + if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' + fi + + trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + + DEFS=-DHAVE_CONFIG_H + + # Without the "./", some shells look in PATH for config.status. + : ${CONFIG_STATUS=./config.status} + + echo creating $CONFIG_STATUS + rm -f $CONFIG_STATUS + cat > $CONFIG_STATUS </dev/null | sed 1q`: + # + # $0 $ac_configure_args + # + # Compiler output produced by configure, useful for debugging + # configure, is in ./config.log if it exists. + + ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" + for ac_option + do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac + done + + ac_given_srcdir=$srcdir + ac_given_INSTALL="$INSTALL" + + trap 'rm -fr `echo "Makefile \ + awklib/Makefile \ + doc/Makefile \ + intl/Makefile \ + po/Makefile.in \ + test/Makefile config.h:configh.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 + EOF + cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF + $ac_vpsub + $extrasub + s%@SHELL@%$SHELL%g + s%@CFLAGS@%$CFLAGS%g + s%@CPPFLAGS@%$CPPFLAGS%g + s%@CXXFLAGS@%$CXXFLAGS%g + s%@FFLAGS@%$FFLAGS%g + s%@DEFS@%$DEFS%g + s%@LDFLAGS@%$LDFLAGS%g + s%@LIBS@%$LIBS%g + s%@exec_prefix@%$exec_prefix%g + s%@prefix@%$prefix%g + s%@program_transform_name@%$program_transform_name%g + s%@bindir@%$bindir%g + s%@sbindir@%$sbindir%g + s%@libexecdir@%$libexecdir%g + s%@datadir@%$datadir%g + s%@sysconfdir@%$sysconfdir%g + s%@sharedstatedir@%$sharedstatedir%g + s%@localstatedir@%$localstatedir%g + s%@libdir@%$libdir%g + s%@includedir@%$includedir%g + s%@oldincludedir@%$oldincludedir%g + s%@infodir@%$infodir%g + s%@mandir@%$mandir%g + s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g + s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g + s%@INSTALL_DATA@%$INSTALL_DATA%g + s%@PACKAGE@%$PACKAGE%g + s%@VERSION@%$VERSION%g + s%@EXEEXT@%$EXEEXT%g + s%@OBJEXT@%$OBJEXT%g + s%@ACLOCAL@%$ACLOCAL%g + s%@AUTOCONF@%$AUTOCONF%g + s%@AUTOMAKE@%$AUTOMAKE%g + s%@AUTOHEADER@%$AUTOHEADER%g + s%@MAKEINFO@%$MAKEINFO%g + s%@AMTAR@%$AMTAR%g + s%@install_sh@%$install_sh%g + s%@INSTALL_STRIP_PROGRAM@%$INSTALL_STRIP_PROGRAM%g + s%@AWK@%$AWK%g + s%@SET_MAKE@%$SET_MAKE%g + s%@AMDEP_TRUE@%$AMDEP_TRUE%g + s%@AMDEP_FALSE@%$AMDEP_FALSE%g + s%@AMDEPBACKSLASH@%$AMDEPBACKSLASH%g + s%@DEPDIR@%$DEPDIR%g + s%@YACC@%$YACC%g + s%@LN_S@%$LN_S%g + s%@CC@%$CC%g + s%@am__include@%$am__include%g + s%@am__quote@%$am__quote%g + s%@CCDEPMODE@%$CCDEPMODE%g + s%@CPP@%$CPP%g + s%@RANLIB@%$RANLIB%g + s%@U@%$U%g + s%@ANSI2KNR@%$ANSI2KNR%g + s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g + s%@MSGFMT@%$MSGFMT%g + s%@GMSGFMT@%$GMSGFMT%g + s%@XGETTEXT@%$XGETTEXT%g + s%@MSGMERGE@%$MSGMERGE%g + s%@host@%$host%g + s%@host_alias@%$host_alias%g + s%@host_cpu@%$host_cpu%g + s%@host_vendor@%$host_vendor%g + s%@host_os@%$host_os%g + s%@ALLOCA@%$ALLOCA%g + s%@GLIBC21@%$GLIBC21%g + s%@LIBICONV@%$LIBICONV%g + s%@LTLIBICONV@%$LTLIBICONV%g + s%@INTLBISON@%$INTLBISON%g + s%@USE_NLS@%$USE_NLS%g + s%@BUILD_INCLUDED_LIBINTL@%$BUILD_INCLUDED_LIBINTL%g + s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g + s%@CATOBJEXT@%$CATOBJEXT%g + s%@INTLOBJS@%$INTLOBJS%g + s%@DATADIRNAME@%$DATADIRNAME%g + s%@INSTOBJEXT@%$INSTOBJEXT%g + s%@GENCAT@%$GENCAT%g + s%@INTL_LIBTOOL_SUFFIX_PREFIX@%$INTL_LIBTOOL_SUFFIX_PREFIX%g + s%@INTLLIBS@%$INTLLIBS%g + s%@LIBINTL@%$LIBINTL%g + s%@LTLIBINTL@%$LTLIBINTL%g + s%@POSUB@%$POSUB%g + s%@SOCKET_LIBS@%$SOCKET_LIBS%g + s%@PATH_SEPARATOR@%$PATH_SEPARATOR%g + + CEOF + EOF + + cat >> $CONFIG_STATUS <<\EOF + + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. + ac_file=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_cmds # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds="" + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi + EOF + + cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ + # $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub + s%@configure_input@%$configure_input%g + s%@srcdir@%$srcdir%g + s%@top_srcdir@%$top_srcdir%g + s%@INSTALL@%$INSTALL%g + " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file + fi; done + rm -f conftest.s* + + # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where + # NAME is the cpp macro being defined and VALUE is the value it is being given. + # + # ac_d sets the value in "#define NAME VALUE" lines. + ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' + ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' + ac_dC='\3' + ac_dD='%g' + # ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". + ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' + ac_uB='\([ ]\)%\1#\2define\3' + ac_uC=' ' + ac_uD='\4%g' + # ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". + ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' + ac_eB='$%\1#\2define\3' + ac_eC=' ' + ac_eD='%g' + + if test "${CONFIG_HEADERS+set}" != set; then + EOF + cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + fi + for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + + EOF + + # Transform confdefs.h into a sed script conftest.vals that substitutes + # the proper values into config.h.in to produce config.h. And first: + # Protect against being on the right side of a sed subst in config.status. + # Protect against being in an unquoted here document in config.status. + rm -f conftest.vals + cat > conftest.hdr <<\EOF + s/[\\&%]/\\&/g + s%[\\$`]%\\&%g + s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp + s%ac_d%ac_u%gp + s%ac_u%ac_e%gp + EOF + sed -n -f conftest.hdr confdefs.h > conftest.vals + rm -f conftest.hdr + + # This sed command replaces #undef with comments. This is necessary, for + # example, in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + cat >> conftest.vals <<\EOF + s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% + EOF + + # Break up conftest.vals because some shells have a limit on + # the size of here documents, and old seds have small limits too. + + rm -f conftest.tail + while : + do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in + ' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals + done + rm -f conftest.vals + + cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi + fi; done + + EOF + cat >> $CONFIG_STATUS < "\$am_dir"stamp-h\$am_indx + ;; + esac + am_indx=\`expr \$am_indx + 1\` + done + AMDEP_TRUE="$AMDEP_TRUE" + ac_aux_dir="$ac_aux_dir" + # Capture the value of obsolete $ALL_LINGUAS because we need it to compute + # POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES, CATALOGS. But hide it + # from automake. + eval 'ALL_LINGUAS''="$ALL_LINGUAS"' + # Capture the value of LINGUAS because we need it to compute CATALOGS. + LINGUAS="${LINGUAS-%UNSET%}" + + + EOF + cat >> $CONFIG_STATUS <<\EOF + test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h + + test x"$AMDEP_TRUE" != x"" || + for mf in $CONFIG_FILES; do + case "$mf" in + Makefile) dirpart=.;; + */Makefile) dirpart=`echo "$mf" | sed -e 's|/[^/]*$||'`;; + *) continue;; + esac + grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`echo "$file" | sed -e 's|/[^/]*$||'` + $ac_aux_dir/mkinstalldirs "$dirpart/$fdir" > /dev/null 2>&1 + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done + + + for ac_file in $CONFIG_FILES; do + # Support "outfile[:infile[:infile...]]" + case "$ac_file" in + *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + esac + # PO directories have a Makefile.in generated from Makefile.in.in. + case "$ac_file" in */Makefile.in) + # Adjust a relative srcdir. + ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` + ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" + ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` + # In autoconf-2.13 it is called $ac_given_srcdir. + # In autoconf-2.50 it is called $srcdir. + test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" + case "$ac_given_srcdir" in + .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; + /*) top_srcdir="$ac_given_srcdir" ;; + *) top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then + rm -f "$ac_dir/POTFILES" + test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" + cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" + # ALL_LINGUAS, POFILES, GMOFILES, UPDATEPOFILES, DUMMYPOFILES depend + # on $ac_dir but don't depend on user-specified configuration + # parameters. + if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then + # The LINGUAS file contains the set of available languages. + if test -n "$ALL_LINGUAS"; then + test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" + fi + ALL_LINGUAS_=`sed -e "/^#/d" "$ac_given_srcdir/$ac_dir/LINGUAS"` + # Hide the ALL_LINGUAS assigment from automake. + eval 'ALL_LINGUAS''=$ALL_LINGUAS_' + fi + case "$ac_given_srcdir" in + .) srcdirpre= ;; + *) srcdirpre='$(srcdir)/' ;; + esac + POFILES= + GMOFILES= + UPDATEPOFILES= + DUMMYPOFILES= + for lang in $ALL_LINGUAS; do + POFILES="$POFILES $srcdirpre$lang.po" + GMOFILES="$GMOFILES $srcdirpre$lang.gmo" + UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" + DUMMYPOFILES="$DUMMYPOFILES $lang.nop" + done + # CATALOGS depends on both $ac_dir and the user's LINGUAS + # environment variable. + INST_LINGUAS= + if test -n "$ALL_LINGUAS"; then + for presentlang in $ALL_LINGUAS; do + useit=no + if test "%UNSET%" != "$LINGUAS"; then + desiredlanguages="$LINGUAS" + else + desiredlanguages="$ALL_LINGUAS" + fi + for desiredlang in $desiredlanguages; do + # Use the presentlang catalog if desiredlang is + # a. equal to presentlang, or + # b. a variant of presentlang (because in this case, + # presentlang can be used as a fallback for messages + # which are not translated in the desiredlang catalog). + case "$desiredlang" in + "$presentlang"*) useit=yes;; + esac + done + if test $useit = yes; then + INST_LINGUAS="$INST_LINGUAS $presentlang" + fi + done + fi + CATALOGS= + if test -n "$INST_LINGUAS"; then + for lang in $INST_LINGUAS; do + CATALOGS="$CATALOGS $lang.gmo" + done + fi + test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" + sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" + for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do + if test -f "$f"; then + case "$f" in + *.orig | *.bak | *~) ;; + *) cat "$f" >> "$ac_dir/Makefile" ;; + esac + fi + done + fi + ;; + esac + done + + exit 0 + EOF + chmod +x $CONFIG_STATUS + rm -fr confdefs* $ac_clean_files + test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff -crN gawk-3.1.0/configure.in gawk-3.1.1/configure.in *** gawk-3.1.0/configure.in Tue May 15 19:46:40 2001 --- gawk-3.1.1/configure.in Mon Apr 29 15:23:32 2002 *************** *** 1,7 **** dnl dnl configure.in --- autoconf input file for gawk dnl ! dnl Copyright (C) 1995-2001 the Free Software Foundation, Inc. dnl dnl This file is part of GAWK, the GNU implementation of the dnl AWK Programming Language. --- 1,7 ---- dnl dnl configure.in --- autoconf input file for gawk dnl ! dnl Copyright (C) 1995-2002 the Free Software Foundation, Inc. dnl dnl This file is part of GAWK, the GNU implementation of the dnl AWK Programming Language. *************** *** 25,35 **** AC_INIT(awk.h) AC_PREREQ(2.13) ! AM_INIT_AUTOMAKE(gawk, 3.1.0) AM_CONFIG_HEADER(config.h:configh.in) dnl Additional argument stuff AC_ARG_ENABLE(portals, [ --enable-portals Enable /p as path prefix for portals], AC_DEFINE(HAVE_PORTALS)) dnl checks for programs AC_PROG_YACC --- 25,41 ---- AC_INIT(awk.h) AC_PREREQ(2.13) ! AM_INIT_AUTOMAKE(gawk, 3.1.1) AM_CONFIG_HEADER(config.h:configh.in) dnl Additional argument stuff AC_ARG_ENABLE(portals, [ --enable-portals Enable /p as path prefix for portals], AC_DEFINE(HAVE_PORTALS)) + AC_ARG_WITH(whiny-user-strftime, [ --with-whiny-user-strftime Force use of included version of strftime for deficient systems], + if test "$withval" = yes + then + AC_DEFINE(USE_INCLUDED_STRFTIME) + fi + ) dnl checks for programs AC_PROG_YACC *************** *** 89,103 **** AM_PROG_CC_STDC AM_C_PROTOTYPES ! ALL_LINGUAS="he" ! AM_GNU_GETTEXT dnl checks for header files AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h limits.h locale.h libintl.h mcheck.h \ netdb.h netinet/in.h signum.h stdarg.h string.h \ ! sys/param.h sys/socket.h unistd.h) if test "$ac_cv_header_string_h" = yes then --- 95,111 ---- AM_PROG_CC_STDC AM_C_PROTOTYPES ! dnl initialize GNU gettext ! AM_GNU_GETTEXT([no-libtool], [need-ngettext]) dnl checks for header files AC_HEADER_STDC AC_HEADER_SYS_WAIT + AC_HEADER_TIME AC_CHECK_HEADERS(fcntl.h limits.h locale.h libintl.h mcheck.h \ netdb.h netinet/in.h signum.h stdarg.h string.h \ ! sys/param.h sys/socket.h sys/time.h unistd.h \ ! wchar.h wctype.h) if test "$ac_cv_header_string_h" = yes then *************** *** 115,120 **** --- 123,134 ---- AC_EGREP_HEADER([int.*sprintf], stdio.h, AC_DEFINE(SPRINTF_RET, int), AC_DEFINE(SPRINTF_RET, char *)) + dnl see if time_t is defined in + AC_TRY_COMPILE([#include ],[ + time_t foo; + foo = 0; + ], + AC_DEFINE(TIME_T_IN_SYS_TYPES_H)) dnl checks for functions AC_DEFINE(REGEX_MALLOC) *************** *** 128,135 **** esac AC_CHECK_LIB(m, fmod) ! AC_CHECK_FUNCS(memset memcpy memcmp fmod setlocale strchr strerror \ ! strftime strncasecmp strtod system tzset) dnl check for dynamic linking dnl This is known to be very primitive --- 142,149 ---- esac AC_CHECK_LIB(m, fmod) ! AC_CHECK_FUNCS(getgroups memset memcpy memcmp fmod setlocale strchr strerror \ ! strftime strncasecmp strtod system tzset mbrlen mbrtowc) dnl check for dynamic linking dnl This is known to be very primitive *************** *** 150,158 **** dnl check for how to use getpgrp dnl have to hardwire it for VMS POSIX. Sigh. ! dnl ditto for BeOS. case `(uname) 2> /dev/null` in ! *VMS*|*BeOS*) AC_DEFINE(GETPGRP_VOID) ;; *) AC_FUNC_GETPGRP --- 164,172 ---- dnl check for how to use getpgrp dnl have to hardwire it for VMS POSIX. Sigh. ! dnl ditto for BeOS, OS/2, and MS-DOS. case `(uname) 2> /dev/null` in ! *VMS*|*BeOS*|*OS/2*|*MS-DOS*) AC_DEFINE(GETPGRP_VOID) ;; *) AC_FUNC_GETPGRP *************** *** 174,179 **** --- 188,201 ---- AC_C_INLINE AC_C_STRINGIZE + dnl the following code is for OS/2 only and can be removed if autoconf 2.5x is used + dnl instead of autoconf 2.13 + PATH_SEPARATOR=':' + if test `uname` = 'OS/2'; then + PATH_SEPARATOR=';' + fi + AC_SUBST(PATH_SEPARATOR) + AC_OUTPUT(Makefile \ awklib/Makefile \ doc/Makefile \ diff -crN gawk-3.1.0/custom.h gawk-3.1.1/custom.h *** gawk-3.1.0/custom.h Sun Jan 21 17:52:10 2001 --- gawk-3.1.1/custom.h Tue Apr 16 14:40:47 2002 *************** *** 11,17 **** */ /* ! * Copyright (C) 1995-2001 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. --- 11,17 ---- */ /* ! * Copyright (C) 1995-2002 the Free Software Foundation, Inc. * * This file is part of GAWK, the GNU implementation of the * AWK Programming Language. *************** *** 85,87 **** --- 85,91 ---- #define HAVE_MKTIME 1 #endif + /* For whiny users */ + #ifdef USE_INCLUDED_STRFTIME + #undef HAVE_STRFTIME + #endif diff -crN gawk-3.1.0/dfa.c gawk-3.1.1/dfa.c *** gawk-3.1.0/dfa.c Mon Apr 9 13:28:39 2001 --- gawk-3.1.1/dfa.c Tue Apr 16 14:57:13 2002 *************** *** 1,5 **** /* dfa.c - deterministic extended regexp routines for GNU ! Copyright 1988, 1998, 2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- 1,5 ---- /* dfa.c - deterministic extended regexp routines for GNU ! Copyright 1988, 1998, 2000, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by *************** *** 46,51 **** --- 46,61 ---- #include #endif + #if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC + /* We can handle multibyte string. */ + # define MBS_SUPPORT + #endif + + #ifdef MBS_SUPPORT + # include + # include + #endif + #ifndef DEBUG /* use the same approach as regex.c */ #undef assert #define assert(e) *************** *** 91,107 **** host does not conform to Posix. */ #define ISASCIIDIGIT(c) ((unsigned) (c) - '0' <= 9) /* If we (don't) have I18N. */ /* glibc defines _ */ ! #ifndef _ ! # ifdef HAVE_LIBINTL_H ! # include ! # ifndef _ ! # define _(Str) gettext (Str) # endif - # else - # define _(Str) (Str) # endif #endif #include "regex.h" --- 101,122 ---- host does not conform to Posix. */ #define ISASCIIDIGIT(c) ((unsigned) (c) - '0' <= 9) + /* Don't use gettext if ENABLE_NLS is not defined */ /* If we (don't) have I18N. */ /* glibc defines _ */ ! #ifdef ENABLE_NLS ! # ifndef _ ! # ifdef HAVE_LIBINTL_H ! # include ! # ifndef _ ! # define _(Str) gettext (Str) ! # endif ! # else ! # define _(Str) (Str) # endif # endif + #else + # define _(Str) (Str) #endif #include "regex.h" *************** *** 234,239 **** --- 249,258 ---- case ORTOP: s = "ORTOP"; break; case LPAREN: s = "LPAREN"; break; case RPAREN: s = "RPAREN"; break; + #ifdef MBS_SUPPORT + case ANYCHAR: s = "ANYCHAR"; break; + case MBCSET: s = "MBCSET"; break; + #endif /* MBS_SUPPORT */ default: s = "CSET"; break; } fprintf(stderr, "%s", s); *************** *** 349,356 **** static int parens; /* Count of outstanding left parens. */ static int minrep, maxrep; /* Repeat counts for {m,n}. */ /* Note that characters become unsigned here. */ ! #define FETCH(c, eoferr) \ { \ if (! lexleft) \ { \ --- 368,484 ---- static int parens; /* Count of outstanding left parens. */ static int minrep, maxrep; /* Repeat counts for {m,n}. */ + #ifdef MBS_SUPPORT + /* These variables are used only if (MB_CUR_MAX > 1). */ + static mbstate_t mbs; /* Mbstate for mbrlen(). */ + static int cur_mb_len; /* Byte length of the current scanning + multibyte character. */ + static int cur_mb_index; /* Byte index of the current scanning multibyte + character. + + singlebyte character : cur_mb_index = 0 + multibyte character + 1st byte : cur_mb_index = 1 + 2nd byte : cur_mb_index = 2 + ... + nth byte : cur_mb_index = n */ + static unsigned char *mblen_buf;/* Correspond to the input buffer in dfaexec(). + Each element store the amount of remain + byte of corresponding multibyte character + in the input string. A element's value + is 0 if corresponding character is a + singlebyte chracter. + e.g. input : 'a', , , + mblen_buf : 0, 3, 2, 1 + */ + + static wchar_t *inputwcs; /* Wide character representation of input + string in dfaexec(). + The length of this array is same as + the length of input string(char array). + inputstring[i] is a single-byte char, + or 1st byte of a multibyte char. + And inputwcs[i] is the codepoint. */ + static unsigned char const *buf_begin;/* refference to begin in dfaexec(). */ + static unsigned char const *buf_end; /* refference to end in dfaexec(). */ + #endif /* MBS_SUPPORT */ + + #ifdef MBS_SUPPORT + /* This function update cur_mb_len, and cur_mb_index. + p points current lexptr, len is the remaining buffer length. */ + static void + update_mb_len_index (unsigned char const *p, int len) + { + /* If last character is a part of a multibyte character, + we update cur_mb_index. */ + if (cur_mb_index) + cur_mb_index = (cur_mb_index >= cur_mb_len)? 0 + : cur_mb_index + 1; + + /* If last character is a single byte character, or the + last portion of a multibyte character, we check whether + next character is a multibyte character or not. */ + if (! cur_mb_index) + { + cur_mb_len = mbrlen(p, len, &mbs); + if (cur_mb_len > 1) + /* It is a multibyte character. + cur_mb_len was already set by mbrlen(). */ + cur_mb_index = 1; + else if (cur_mb_len < 1) + /* Invalid sequence. We treat it as a singlebyte character. + cur_mb_index is aleady 0. */ + cur_mb_len = 1; + /* Otherwise, cur_mb_len == 1, it is a singlebyte character. + cur_mb_index is aleady 0. */ + } + } + #endif /* MBS_SUPPORT */ + + #ifdef MBS_SUPPORT + /* Note that characters become unsigned here. */ + # define FETCH(c, eoferr) \ + { \ + if (! lexleft) \ + { \ + if (eoferr != 0) \ + dfaerror (eoferr); \ + else \ + return lasttok = END; \ + } \ + if (MB_CUR_MAX > 1) \ + update_mb_len_index(lexptr, lexleft); \ + (c) = (unsigned char) *lexptr++; \ + --lexleft; \ + } + + /* This function fetch a wide character, and update cur_mb_len, + used only if the current locale is a multibyte environment. */ + static wint_t + fetch_wc (char const *eoferr) + { + wchar_t wc; + if (! lexleft) + { + if (eoferr != 0) + dfaerror (eoferr); + else + return WEOF; + } + + cur_mb_len = mbrtowc(&wc, lexptr, lexleft, &mbs); + if (cur_mb_len <= 0) + { + cur_mb_len = 1; + wc = *lexptr; + } + lexptr += cur_mb_len; + lexleft -= cur_mb_len; + return wc; + } + #else /* Note that characters become unsigned here. */ ! # define FETCH(c, eoferr) \ { \ if (! lexleft) \ { \ *************** *** 362,367 **** --- 490,691 ---- (c) = (unsigned char) *lexptr++; \ --lexleft; \ } + #endif /* MBS_SUPPORT */ + + #ifdef MBS_SUPPORT + /* Multibyte character handling sub-routin for lex. + This function parse a bracket expression and build a struct + mb_char_classes. */ + static void + parse_bracket_exp_mb () + { + wint_t wc, wc1, wc2; + + /* Work area to build a mb_char_classes. */ + struct mb_char_classes *work_mbc; + int chars_al, range_sts_al, range_ends_al, ch_classes_al, + equivs_al, coll_elems_al; + + REALLOC_IF_NECESSARY(dfa->mbcsets, struct mb_char_classes, + dfa->mbcsets_alloc, dfa->nmbcsets + 1); + /* dfa->multibyteb_prop[] hold the index of dfa->mbcsets. + We will update dfa->multibyte_prop[] in addtok(), because we can't + decide the index in dfa->tokens[]. */ + + /* Initialize work are */ + work_mbc = &(dfa->mbcsets[dfa->nmbcsets++]); + + chars_al = 1; + range_sts_al = range_ends_al = 0; + ch_classes_al = equivs_al = coll_elems_al = 0; + MALLOC(work_mbc->chars, wchar_t, chars_al); + + work_mbc->nchars = work_mbc->nranges = work_mbc->nch_classes = 0; + work_mbc->nequivs = work_mbc->ncoll_elems = 0; + work_mbc->chars = work_mbc->ch_classes = NULL; + work_mbc->range_sts = work_mbc->range_ends = NULL; + work_mbc->equivs = work_mbc->coll_elems = NULL; + + wc = fetch_wc(_("Unbalanced [")); + if (wc == L'^') + { + wc = fetch_wc(_("Unbalanced [")); + work_mbc->invert = 1; + } + else + work_mbc->invert = 0; + do + { + wc1 = WEOF; /* mark wc1 is not initialized". */ + + /* Note that if we're looking at some other [:...:] construct, + we just treat it as a bunch of ordinary characters. We can do + this because we assume regex has checked for syntax errors before + dfa is ever called. */ + if (wc == L'[' && (syntax_bits & RE_CHAR_CLASSES)) + { + #define BRACKET_BUFFER_SIZE 128 + char str[BRACKET_BUFFER_SIZE]; + wc1 = wc; + wc = fetch_wc(_("Unbalanced [")); + + /* If pattern contains `[[:', `[[.', or `[[='. */ + if (cur_mb_len == 1 && (wc == L':' || wc == L'.' || wc == L'=')) + { + unsigned char c; + unsigned char delim = (unsigned char)wc; + int len = 0; + for (;;) + { + if (! lexleft) + dfaerror (_("Unbalanced [")); + c = (unsigned char) *lexptr++; + --lexleft; + + if ((c == delim && *lexptr == ']') || lexleft == 0) + break; + if (len < BRACKET_BUFFER_SIZE) + str[len++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; + } + str[len] = '\0'; + + if (lexleft == 0) + { + REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, + work_mbc->nchars + 2); + work_mbc->chars[work_mbc->nchars++] = L'['; + work_mbc->chars[work_mbc->nchars++] = delim; + break; + } + + if (--lexleft, *lexptr++ != ']') + dfaerror (_("Unbalanced [")); + if (delim == ':') + /* build character class. */ + { + wctype_t wt; + /* Query the character class as wctype_t. */ + wt = wctype (str); + + if (ch_classes_al == 0) + MALLOC(work_mbc->ch_classes, wctype_t, ++ch_classes_al); + REALLOC_IF_NECESSARY(work_mbc->ch_classes, wctype_t, + ch_classes_al, + work_mbc->nch_classes + 1); + work_mbc->ch_classes[work_mbc->nch_classes++] = wt; + + } + else if (delim == '=' || delim == '.') + { + char *elem; + MALLOC(elem, char, len + 1); + strncpy(elem, str, len + 1); + + if (delim == '=') + /* build equivalent class. */ + { + if (equivs_al == 0) + MALLOC(work_mbc->equivs, char*, ++equivs_al); + REALLOC_IF_NECESSARY(work_mbc->equivs, char*, + equivs_al, + work_mbc->nequivs + 1); + work_mbc->equivs[work_mbc->nequivs++] = elem; + } + + if (delim == '.') + /* build collating element. */ + { + if (coll_elems_al == 0) + MALLOC(work_mbc->coll_elems, char*, ++coll_elems_al); + REALLOC_IF_NECESSARY(work_mbc->coll_elems, char*, + coll_elems_al, + work_mbc->ncoll_elems + 1); + work_mbc->coll_elems[work_mbc->ncoll_elems++] = elem; + } + } + wc = WEOF; + } + else + /* We treat '[' as a normal character here. */ + { + wc2 = wc1; wc1 = wc; wc = wc2; /* swap */ + } + } + else + { + if (wc == L'\\' && (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS)) + wc = fetch_wc(("Unbalanced [")); + } + + if (wc1 == WEOF) + wc1 = fetch_wc(_("Unbalanced [")); + + if (wc1 == L'-') + /* build range characters. */ + { + wc2 = fetch_wc(_("Unbalanced [")); + if (wc2 == L']') + { + /* In the case [x-], the - is an ordinary hyphen, + which is left in c1, the lookahead character. */ + lexptr -= cur_mb_len; + lexleft += cur_mb_len; + wc2 = wc; + } + else + { + if (wc2 == L'\\' + && (syntax_bits & RE_BACKSLASH_ESCAPE_IN_LISTS)) + wc2 = fetch_wc(_("Unbalanced [")); + wc1 = fetch_wc(_("Unbalanced [")); + } + + if (range_sts_al == 0) + { + MALLOC(work_mbc->range_sts, wchar_t, ++range_sts_al); + MALLOC(work_mbc->range_ends, wchar_t, ++range_ends_al); + } + REALLOC_IF_NECESSARY(work_mbc->range_sts, wchar_t, + range_sts_al, work_mbc->nranges + 1); + work_mbc->range_sts[work_mbc->nranges] = (wchar_t)wc; + REALLOC_IF_NECESSARY(work_mbc->range_ends, wchar_t, + range_ends_al, work_mbc->nranges + 1); + work_mbc->range_ends[work_mbc->nranges++] = (wchar_t)wc2; + } + else if (wc != WEOF) + /* build normal characters. */ + { + REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al, + work_mbc->nchars + 1); + work_mbc->chars[work_mbc->nchars++] = (wchar_t)wc; + } + } + while ((wc = wc1) != L']'); + } + #endif /* MBS_SUPPORT */ #ifdef __STDC__ #define FUNC(F, P) static int F(int c) { return P(c); } *************** *** 442,447 **** --- 766,779 ---- for (i = 0; i < 2; ++i) { FETCH(c, 0); + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1 && cur_mb_index) + /* If this is a part of a multi-byte character, we must treat + this byte data as a normal character. + e.g. In case of SJIS encoding, some character contains '\', + but they must not be backslash. */ + goto normal_char; + #endif /* MBS_SUPPORT */ switch (c) { case '\\': *************** *** 662,667 **** --- 994,1008 ---- case '.': if (backslash) goto normal_char; + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + /* In multibyte environment period must match with a single + character not a byte. So we use ANYCHAR. */ + laststart = 0; + return lasttok = ANYCHAR; + } + #endif /* MBS_SUPPORT */ zeroset(ccl); notset(ccl); if (!(syntax_bits & RE_DOT_NEWLINE)) *************** *** 687,692 **** --- 1028,1044 ---- case '[': if (backslash) goto normal_char; + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + /* In multibyte environment a bracket expression may contain + multibyte characters, which must be treated as characters + (not bytes). So we parse it by parse_bracket_exp_mb(). */ + laststart = 0; + parse_bracket_exp_mb(); + return lasttok = MBCSET; + } + #endif zeroset(ccl); FETCH(c, _("Unbalanced [")); if (c == '^') *************** *** 815,820 **** --- 1167,1192 ---- static void addtok (token t) { + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + REALLOC_IF_NECESSARY(dfa->multibyte_prop, int, dfa->nmultibyte_prop, + dfa->tindex); + /* Set dfa->multibyte_prop. See struct dfa in dfa.h. */ + if (t == MBCSET) + dfa->multibyte_prop[dfa->tindex] = ((dfa->nmbcsets - 1) << 2) + 3; + else if (t < NOTCHAR) + dfa->multibyte_prop[dfa->tindex] + = (cur_mb_len == 1)? 3 /* single-byte char */ + : (((cur_mb_index == 1)? 1 : 0) /* 1st-byte of multibyte char */ + + ((cur_mb_index == cur_mb_len)? 2 : 0)); /* last-byte */ + else + /* It may be unnecessary, but it is safer to treat other symbols + as single byte characters. */ + dfa->multibyte_prop[dfa->tindex] = 3; + } + #endif + REALLOC_IF_NECESSARY(dfa->tokens, token, dfa->talloc, dfa->tindex); dfa->tokens[dfa->tindex++] = t; *************** *** 858,864 **** --- 1230,1239 ---- atom atom: + + ANYCHAR + MBCSET CSET BACKREF BEGLINE *************** *** 876,885 **** --- 1251,1281 ---- { if ((tok >= 0 && tok < NOTCHAR) || tok >= CSET || tok == BACKREF || tok == BEGLINE || tok == ENDLINE || tok == BEGWORD + #ifdef MBS_SUPPORT + || tok == ANYCHAR || tok == MBCSET /* MB_CUR_MAX > 1 */ + #endif /* MBS_SUPPORT */ || tok == ENDWORD || tok == LIMWORD || tok == NOTLIMWORD) { addtok(tok); tok = lex(); + #ifdef MBS_SUPPORT + /* We treat a multibyte character as a single atom, so that DFA + can treat a multibyte character as a single expression. + + e.g. We construct following tree from "". + + + */ + if (MB_CUR_MAX > 1) + { + while (cur_mb_index > 1 && tok >= 0 && tok < NOTCHAR) + { + addtok(tok); + addtok(CAT); + tok = lex(); + } + } + #endif /* MBS_SUPPORT */ } else if (tok == LPAREN) { *************** *** 998,1003 **** --- 1394,1407 ---- lasttok = END; laststart = 1; parens = 0; + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + cur_mb_index = 0; + cur_mb_len = 0; + memset(&mbs, 0, sizeof(mbstate_t)); + } + #endif /* MBS_SUPPORT */ if (! syntax_bits_set) dfaerror(_("No regexp syntax bits specified")); *************** *** 1139,1144 **** --- 1543,1552 ---- d->states[i].backref = 0; d->states[i].constraint = 0; d->states[i].first_end = 0; + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + d->states[i].mbps.nelem = 0; + #endif for (j = 0; j < s->nelem; ++j) if (d->tokens[s->elems[j].index] < 0) { *************** *** 1181,1186 **** --- 1589,1598 ---- for (i = 0; i < s->nelem; ++i) if (d->tokens[s->elems[i].index] >= NOTCHAR && d->tokens[s->elems[i].index] != BACKREF + #ifdef MBS_SUPPORT + && d->tokens[s->elems[i].index] != ANYCHAR + && d->tokens[s->elems[i].index] != MBCSET + #endif && d->tokens[s->elems[i].index] < CSET) { old = s->elems[i]; *************** *** 1462,1467 **** --- 1874,1883 ---- it with its epsilon closure. */ for (i = 0; i < d->tindex; ++i) if (d->tokens[i] < NOTCHAR || d->tokens[i] == BACKREF + #ifdef MBS_SUPPORT + || d->tokens[i] == ANYCHAR + || d->tokens[i] == MBCSET + #endif || d->tokens[i] >= CSET) { #ifdef DEBUG *************** *** 1563,1568 **** --- 1979,1987 ---- int wants_letter; /* New state wants to know letter context. */ int state_letter; /* New state on a letter transition. */ static int initialized; /* Flag for static initialization. */ + #ifdef MBS_SUPPORT + int next_isnt_1st_byte = 0; /* Flag if we can't add state0. */ + #endif int i, j, k; /* Initialize the set of letters, if necessary. */ *************** *** 1584,1589 **** --- 2003,2025 ---- setbit(d->tokens[pos.index], matches); else if (d->tokens[pos.index] >= CSET) copyset(d->charclasses[d->tokens[pos.index] - CSET], matches); + #ifdef MBS_SUPPORT + else if (d->tokens[pos.index] == ANYCHAR + || d->tokens[pos.index] == MBCSET) + /* MB_CUR_MAX > 1 */ + { + /* ANYCHAR and MBCSET must match with a single character, so we + must put it to d->states[s].mbps, which contains the positions + which can match with a single character not a byte. */ + if (d->states[s].mbps.nelem == 0) + { + MALLOC(d->states[s].mbps.elems, position, + d->states[s].elems.nelem); + } + insert(pos, &(d->states[s].mbps)); + continue; + } + #endif /* MBS_SUPPORT */ else continue; *************** *** 1720,1728 **** --- 2156,2201 ---- for (k = 0; k < d->follows[grps[i].elems[j].index].nelem; ++k) insert(d->follows[grps[i].elems[j].index].elems[k], &follows); + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + /* If a token in follows.elems is not 1st byte of a multibyte + character, or the states of follows must accept the bytes + which are not 1st byte of the multibyte character. + Then, if a state of follows encounter a byte, it must not be + a 1st byte of a multibyte character nor singlebyte character. + We cansel to add state[0].follows to next state, because + state[0] must accept 1st-byte + + For example, we assume is a certain singlebyte + character, is a certain multibyte character, and the + codepoint of equals the 2nd byte of the codepoint of + . + When state[0] accepts , state[i] transit to state[i+1] + by accepting accepts 1st byte of , and state[i+1] + accepts 2nd byte of , if state[i+1] encounter the + codepoint of , it must not be but 2nd byte of + , so we can not add state[0]. */ + + next_isnt_1st_byte = 0; + for (j = 0; j < follows.nelem; ++j) + { + if (!(d->multibyte_prop[follows.elems[j].index] & 1)) + { + next_isnt_1st_byte = 1; + break; + } + } + } + #endif + /* If we are building a searching matcher, throw in the positions of state 0 as well. */ + #ifdef MBS_SUPPORT + if (d->searchflag && (MB_CUR_MAX == 1 || !next_isnt_1st_byte)) + #else if (d->searchflag) + #endif for (j = 0; j < d->states[0].elems.nelem; ++j) insert(d->states[0].elems.elems[j], &follows); *************** *** 1871,1876 **** --- 2344,2777 ---- build_state(0, d); } + #ifdef MBS_SUPPORT + /* Multibyte character handling sub-routins for dfaexec. */ + + /* Initial state may encounter the byte which is not a singlebyte character + nor 1st byte of a multibyte character. But it is incorrect for initial + state to accept such a byte. + For example, in sjis encoding the regular expression like "\\" accepts + the codepoint 0x5c, but should not accept the 2nd byte of the codepoint + 0x815c. Then Initial state must skip the bytes which are not a singlebyte + character nor 1st byte of a multibyte character. */ + #define SKIP_REMAINS_MB_IF_INITIAL_STATE(s, p) \ + if (s == 0) \ + { \ + while (inputwcs[p - buf_begin] == 0 \ + && mblen_buf[p - buf_begin] > 0 \ + && (unsigned char const *)p < buf_end) \ + ++p; \ + if ((char*)p >= end) \ + { \ + free(mblen_buf); \ + free(inputwcs); \ + return NULL; \ + } \ + } + + static void + realloc_trans_if_necessary(struct dfa *d, int new_state) + { + /* Make sure that the trans and fail arrays are allocated large enough + to hold a pointer for the new state. */ + if (new_state >= d->tralloc) + { + int oldalloc = d->tralloc; + + while (new_state >= d->tralloc) + d->tralloc *= 2; + REALLOC(d->realtrans, int *, d->tralloc + 1); + d->trans = d->realtrans + 1; + REALLOC(d->fails, int *, d->tralloc); + REALLOC(d->success, int, d->tralloc); + REALLOC(d->newlines, int, d->tralloc); + while (oldalloc < d->tralloc) + { + d->trans[oldalloc] = NULL; + d->fails[oldalloc++] = NULL; + } + } + } + + /* Return values of transit_state_singlebyte(), and + transit_state_consume_1char. */ + typedef enum + { + TRANSIT_STATE_IN_PROGRESS, /* State transition has not finished. */ + TRANSIT_STATE_DONE, /* State transition has finished. */ + TRANSIT_STATE_END_BUFFER /* Reach the end of the buffer. */ + } status_transit_state; + + /* Consume a single byte and transit state from 's' to '*next_state'. + This function is almost same as the state transition routin in dfaexec(). + But state transition is done just once, otherwise matching succeed or + reach the end of the buffer. */ + static status_transit_state + transit_state_singlebyte (struct dfa *d, int s, unsigned char const *p, + int *next_state) + { + int *t; + int works = s; + + status_transit_state rval = TRANSIT_STATE_IN_PROGRESS; + + while (rval == TRANSIT_STATE_IN_PROGRESS) + { + if ((t = d->trans[works]) != NULL) + { + works = t[*p]; + rval = TRANSIT_STATE_DONE; + if (works < 0) + works = 0; + } + else + { + if (works >= 0 && d->fails[works]) + { + works = d->fails[works][*p]; + rval = TRANSIT_STATE_DONE; + } + + else if (works >= 0) + { + build_state(works, d); + } + else + { + works = 0; + } + } + } + *next_state = works; + return rval; + } + + /* Check whether period can match or not in the current context. If it can, + return the amount of the bytes with which period can match, otherwise + return 0. + `pos' is the position of the period. `index' is the index from the + buf_begin, and it is the current position in the buffer. */ + static int + match_anychar (struct dfa *d, int s, position pos, int index) + { + int newline = 0; + int letter = 0; + wchar_t wc; + int mbclen; + + wc = inputwcs[index]; + mbclen = (mblen_buf[index] == 0)? 1 : mblen_buf[index]; + + /* Check context. */ + if (wc == (wchar_t)eolbyte) + { + if (!(syntax_bits & RE_DOT_NEWLINE)) + return 0; + newline = 1; + } + else if (wc == (wchar_t)'\0') + { + if (syntax_bits & RE_DOT_NOT_NULL) + return 0; + newline = 1; + } + + if (iswalnum(wc) || wc == L'_') + letter = 1; + + if (!SUCCEEDS_IN_CONTEXT(pos.constraint, d->states[s].newline, + newline, d->states[s].letter, letter)) + return 0; + + return mbclen; + } + + /* Check whether bracket expression can match or not in the current context. + If it can, return the amount of the bytes with which expression can match, + otherwise return 0. + `pos' is the position of the bracket expression. `index' is the index + from the buf_begin, and it is the current position in the buffer. */ + int + match_mb_charset (struct dfa *d, int s, position pos, int index) + { + int i; + int match; /* Flag which represent that matching succeed. */ + int match_len; /* Length of the character (or collating element) + with which this operator match. */ + int op_len; /* Length of the operator. */ + char buffer[128]; + wchar_t wcbuf[6]; + + /* Pointer to the structure to which we are currently reffering. */ + struct mb_char_classes *work_mbc; + + int newline = 0; + int letter = 0; + wchar_t wc; /* Current reffering character. */ + + wc = inputwcs[index]; + + /* Check context. */ + if (wc == (wchar_t)eolbyte) + { + if (!(syntax_bits & RE_DOT_NEWLINE)) + return 0; + newline = 1; + } + else if (wc == (wchar_t)'\0') + { + if (syntax_bits & RE_DOT_NOT_NULL) + return 0; + newline = 1; + } + if (iswalnum(wc) || wc == L'_') + letter = 1; + if (!SUCCEEDS_IN_CONTEXT(pos.constraint, d->states[s].newline, + newline, d->states[s].letter, letter)) + return 0; + + /* Assign the current reffering operator to work_mbc. */ + work_mbc = &(d->mbcsets[(d->multibyte_prop[pos.index]) >> 2]); + match = !work_mbc->invert; + match_len = (mblen_buf[index] == 0)? 1 : mblen_buf[index]; + + /* match with a character class? */ + for (i = 0; inch_classes; i++) + { + if (iswctype((wint_t)wc, work_mbc->ch_classes[i])) + goto charset_matched; + } + + strncpy(buffer, buf_begin + index, match_len); + buffer[match_len] = '\0'; + + /* match with an equivalent class? */ + for (i = 0; inequivs; i++) + { + op_len = strlen(work_mbc->equivs[i]); + strncpy(buffer, buf_begin + index, op_len); + buffer[op_len] = '\0'; + if (strcoll(work_mbc->equivs[i], buffer) == 0) + { + match_len = op_len; + goto charset_matched; + } + } + + /* match with a collating element? */ + for (i = 0; incoll_elems; i++) + { + op_len = strlen(work_mbc->coll_elems[i]); + strncpy(buffer, buf_begin + index, op_len); + buffer[op_len] = '\0'; + + if (strcoll(work_mbc->coll_elems[i], buffer) == 0) + { + match_len = op_len; + goto charset_matched; + } + } + + wcbuf[0] = wc; + wcbuf[1] = wcbuf[3] = wcbuf[5] = '\0'; + + /* match with a range? */ + for (i = 0; inranges; i++) + { + wcbuf[2] = work_mbc->range_sts[i]; + wcbuf[4] = work_mbc->range_ends[i]; + + if (wcscoll(wcbuf, wcbuf+2) >= 0 && + wcscoll(wcbuf+4, wcbuf) >= 0) + goto charset_matched; + } + + /* match with a character? */ + for (i = 0; inchars; i++) + { + if (wc == work_mbc->chars[i]) + goto charset_matched; + } + + match = !match; + + charset_matched: + return match ? match_len : 0; + } + + /* Check each of `d->states[s].mbps.elem' can match or not. Then return the + array which corresponds to `d->states[s].mbps.elem' and each element of + the array contains the amount of the bytes with which the element can + match. + `index' is the index from the buf_begin, and it is the current position + in the buffer. + Caller MUST free the array which this function return. */ + static int* + check_matching_with_multibyte_ops (struct dfa *d, int s, int index) + { + int i; + int* rarray; + + MALLOC(rarray, int, d->states[s].mbps.nelem); + for (i = 0; i < d->states[s].mbps.nelem; ++i) + { + position pos = d->states[s].mbps.elems[i]; + switch(d->tokens[pos.index]) + { + case ANYCHAR: + rarray[i] = match_anychar(d, s, pos, index); + break; + case MBCSET: + rarray[i] = match_mb_charset(d, s, pos, index); + break; + default: + break; /* can not happen. */ + } + } + return rarray; + } + + /* Consume a single character and enumerate all of the positions which can + be next position from the state `s'. + `match_lens' is the input. It can be NULL, but it can also be the output + of check_matching_with_multibyte_ops() for optimization. + `mbclen' and `pps' are the output. `mbclen' is the length of the + character consumed, and `pps' is the set this function enumerate. */ + static status_transit_state + transit_state_consume_1char (struct dfa *d, int s, unsigned char const **pp, + int *match_lens, int *mbclen, position_set *pps) + { + int i, j; + int s1, s2; + int* work_mbls; + status_transit_state rs = TRANSIT_STATE_DONE; + + /* Calculate the length of the (single/multi byte) character + to which p points. */ + *mbclen = (mblen_buf[*pp - buf_begin] == 0)? 1 + : mblen_buf[*pp - buf_begin]; + + /* Calculate the state which can be reached from the state `s' by + consuming `*mbclen' single bytes from the buffer. */ + s1 = s; + for (i = 0; i < *mbclen; i++) + { + s2 = s1; + rs = transit_state_singlebyte(d, s2, (*pp)++, &s1); + } + /* Copy the positions contained by `s1' to the set `pps'. */ + copy(&(d->states[s1].elems), pps); + + /* Check (inputed)match_lens, and initialize if it is NULL. */ + if (match_lens == NULL && d->states[s].mbps.nelem != 0) + work_mbls = check_matching_with_multibyte_ops(d, s, *pp - buf_begin); + else + work_mbls = match_lens; + + /* Add all of the positions which can be reached from `s' by consuming + a single character. */ + for (i = 0; i < d->states[s].mbps.nelem ; i++) + { + if (work_mbls[i] == *mbclen) + for (j = 0; j < d->follows[d->states[s].mbps.elems[i].index].nelem; + j++) + insert(d->follows[d->states[s].mbps.elems[i].index].elems[j], + pps); + } + + if (match_lens == NULL && work_mbls != NULL) + free(work_mbls); + return rs; + } + + /* Transit state from s, then return new state and update the pointer of the + buffer. This function is for some operator which can match with a multi- + byte character or a collating element(which may be multi characters). */ + static int + transit_state (struct dfa *d, int s, unsigned char const **pp) + { + int s1; + int mbclen; /* The length of current input multibyte character. */ + int maxlen = 0; + int i, j; + int *match_lens = NULL; + int nelem = d->states[s].mbps.nelem; /* Just a alias. */ + position_set follows; + unsigned char const *p1 = *pp; + status_transit_state rs; + wchar_t wc; + + if (nelem > 0) + /* This state has (a) multibyte operator(s). + We check whether each of them can match or not. */ + { + /* Note: caller must free the return value of this function. */ + match_lens = check_matching_with_multibyte_ops(d, s, *pp - buf_begin); + + for (i = 0; i < nelem; i++) + /* Search the operator which match the longest string, + in this state. */ + { + if (match_lens[i] > maxlen) + maxlen = match_lens[i]; + } + } + + if (nelem == 0 || maxlen == 0) + /* This state has no multibyte operator which can match. + We need to check only one singlebyte character. */ + { + status_transit_state rs; + rs = transit_state_singlebyte(d, s, *pp, &s1); + + /* We must update the pointer if state transition succeeded. */ + if (rs == TRANSIT_STATE_DONE) + ++*pp; + + if (match_lens != NULL) + free(match_lens); + return s1; + } + + /* This state has some operators which can match a multibyte character. */ + follows.nelem = 0; + MALLOC(follows.elems, position, d->nleaves); + + /* `maxlen' may be longer than the length of a character, because it may + not be a character but a (multi character) collating element. + We enumerate all of the positions which `s' can reach by consuming + `maxlen' bytes. */ + rs = transit_state_consume_1char(d, s, pp, match_lens, &mbclen, &follows); + + wc = inputwcs[*pp - mbclen - buf_begin]; + s1 = state_index(d, &follows, wc == L'\n', iswalnum(wc)); + realloc_trans_if_necessary(d, s1); + + while (*pp - p1 < maxlen) + { + follows.nelem = 0; + rs = transit_state_consume_1char(d, s1, pp, NULL, &mbclen, &follows); + + for (i = 0; i < nelem ; i++) + { + if (match_lens[i] == *pp - p1) + for (j = 0; + j < d->follows[d->states[s1].mbps.elems[i].index].nelem; j++) + insert(d->follows[d->states[s1].mbps.elems[i].index].elems[j], + &follows); + } + + wc = inputwcs[*pp - mbclen - buf_begin]; + s1 = state_index(d, &follows, wc == L'\n', iswalnum(wc)); + realloc_trans_if_necessary(d, s1); + } + free(match_lens); + free(follows.elems); + return s1; + } + + #endif + /* Search through a buffer looking for a match to the given struct dfa. Find the first occurrence of a string matching the regexp in the buffer, and the shortest possible version thereof. Return a pointer to the first *************** *** 1914,1921 **** --- 2815,2894 ---- trans = d->trans; *end = eol; + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + int remain_bytes, i; + buf_begin = begin; + buf_end = end; + + /* initialize mblen_buf, and inputwcs. */ + MALLOC(mblen_buf, unsigned char, end - begin + 2); + MALLOC(inputwcs, wchar_t, end - begin + 2); + memset(&mbs, 0, sizeof(mbstate_t)); + remain_bytes = 0; + for (i = 0; i < end - begin + 1; i++) + { + if (remain_bytes == 0) + { + remain_bytes + = mbrtowc(inputwcs + i, begin + i, end - begin - i + 1, &mbs); + if (remain_bytes <= 1) + { + remain_bytes = 0; + inputwcs[i] = (wchar_t)begin[i]; + mblen_buf[i] = 0; + } + else + { + mblen_buf[i] = remain_bytes; + remain_bytes--; + } + } + else + { + mblen_buf[i] = remain_bytes; + inputwcs[i] = 0; + remain_bytes--; + } + } + mblen_buf[i] = 0; + inputwcs[i] = 0; /* sentinel */ + } + #endif /* MBS_SUPPORT */ + for (;;) { + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + while ((t = trans[s])) + { + if ((char *) p > end) + break; + s1 = s; + if (d->states[s].mbps.nelem != 0) + { + /* Can match with a multibyte character( and multi character + collating element). */ + unsigned char const *nextp; + + SKIP_REMAINS_MB_IF_INITIAL_STATE(s, p); + + nextp = p; + s = transit_state(d, s, &nextp); + p = (unsigned char *)nextp; + + /* Trans table might be updated. */ + trans = d->trans; + } + else + { + SKIP_REMAINS_MB_IF_INITIAL_STATE(s, p); + s = t[*p++]; + } + } + else + #endif /* MBS_SUPPORT */ while ((t = trans[s]) != 0) { /* hand-optimized loop */ s1 = t[*p++]; if ((t = trans[s1]) == 0) { *************** *** 1931,1940 **** { if (backref) *backref = (d->states[s].backref != 0); ! return (char *) p; } s1 = s; s = d->fails[s][*p++]; continue; } --- 2904,2933 ---- { if (backref) *backref = (d->states[s].backref != 0); ! #ifdef MBS_SUPPORT ! if (MB_CUR_MAX > 1) ! { ! free(mblen_buf); ! free(inputwcs); ! } ! #endif /* MBS_SUPPORT */ ! return (char *) p; } s1 = s; + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + unsigned char const *nextp; + nextp = p; + s = transit_state(d, s, &nextp); + p = (unsigned char *)nextp; + + /* Trans table might be updated. */ + trans = d->trans; + } + else + #endif /* MBS_SUPPORT */ s = d->fails[s][*p++]; continue; } *************** *** 1945,1951 **** /* Check if we've run off the end of the buffer. */ if ((char *) p > end) ! return NULL; if (s >= 0) { --- 2938,2953 ---- /* Check if we've run off the end of the buffer. */ if ((char *) p > end) ! { ! #ifdef MBS_SUPPORT ! if (MB_CUR_MAX > 1) ! { ! free(mblen_buf); ! free(inputwcs); ! } ! #endif /* MBS_SUPPORT */ ! return NULL; ! } if (s >= 0) { *************** *** 1976,1981 **** --- 2978,2993 ---- d->talloc = 1; MALLOC(d->tokens, token, d->talloc); d->tindex = d->depth = d->nleaves = d->nregexps = 0; + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + d->nmultibyte_prop = 1; + MALLOC(d->multibyte_prop, int, d->nmultibyte_prop); + d->nmbcsets = 0; + d->mbcsets_alloc = 1; + MALLOC(d->mbcsets, struct mb_char_classes, d->mbcsets_alloc); + } + #endif d->searchflag = 0; d->tralloc = 0; *************** *** 2036,2041 **** --- 3048,3084 ---- free((ptr_t) d->charclasses); free((ptr_t) d->tokens); + #ifdef MBS_SUPPORT + if (MB_CUR_MAX > 1) + { + free((ptr_t) d->multibyte_prop); + for (i = 0; i < d->nmbcsets; ++i) + { + int j; + struct mb_char_classes *p = &(d->mbcsets[i]); + if (p->chars != NULL) + free(p->chars); + if (p->ch_classes != NULL) + free(p->ch_classes); + if (p->range_sts != NULL) + free(p->range_sts); + if (p->range_ends != NULL) + free(p->range_ends); + + for (j = 0; j < p->nequivs; ++j) + free(p->equivs[j]); + if (p->equivs != NULL) + free(p->equivs); + + for (j = 0; j < p->ncoll_elems; ++j) + free(p->coll_elems[j]); + if (p->coll_elems != NULL) + free(p->coll_elems); + } + free((ptr_t) d->mbcsets); + } + #endif /* MBS_SUPPORT */ + for (i = 0; i < d->sindex; ++i) free((ptr_t) d->states[i].elems.elems); free((ptr_t) d->states); *************** *** 2091,2096 **** --- 3134,3143 ---- ---- ---- ----- -- -- char c # c # c # c # c + ANYCHAR ZERO ZERO ZERO ZERO + + MBCSET ZERO ZERO ZERO ZERO + CSET ZERO ZERO ZERO ZERO STAR ZERO ZERO ZERO ZERO *************** *** 2536,2542 **** /* not on *my* shift */ goto done; } ! else if (t >= CSET) { /* easy enough */ resetmust(mp); --- 3583,3594 ---- /* not on *my* shift */ goto done; } ! else if (t >= CSET ! #ifdef MBS_SUPPORT ! || t == ANYCHAR ! || t == MBCSET ! #endif /* MBS_SUPPORT */ ! ) { /* easy enough */ resetmust(mp); diff -crN gawk-3.1.0/dfa.h gawk-3.1.1/dfa.h *** gawk-3.1.0/dfa.h Fri Aug 13 18:02:53 1999 --- gawk-3.1.1/dfa.h Tue Apr 16 14:57:19 2002 *************** *** 1,5 **** /* dfa.h - declarations for GNU deterministic regexp compiler ! Copyright (C) 1988, 1998 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by --- 1,5 ---- /* dfa.h - declarations for GNU deterministic regexp compiler ! Copyright (C) 1988, 1998, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by *************** *** 136,141 **** --- 136,150 ---- RPAREN, /* RPAREN never appears in the parse tree. */ + #ifdef MBS_SUPPORT + ANYCHAR, /* ANYCHAR is a terminal symbol that matches + any multibyte(or singlebyte) characters. + It is used only if MB_CUR_MAX > 1. */ + + MBCSET, /* MBCSET is similar to CSET, but for + multibyte characters. */ + #endif /* MBS_SUPPORT */ + CSET /* CSET and (and any value greater) is a terminal symbol that matches any of a class of characters. */ *************** *** 223,228 **** --- 232,243 ---- char backref; /* True if this state matches a \. */ unsigned char constraint; /* Constraint for this state to accept. */ int first_end; /* Token value of the first END in elems. */ + #ifdef MBS_SUPPORT + position_set mbps; /* Positions which can match multibyte + characters. e.g. period. + These staff are used only if + MB_CUR_MAX > 1. */ + #endif } dfa_state; /* Element of a list of strings, at least one of which is known to *************** *** 234,239 **** --- 249,274 ---- struct dfamust *next; }; + #ifdef MBS_SUPPORT + /* A bracket operator. + e.g. [a-c], [[:alpha:]], etc. */ + struct mb_char_classes + { + int invert; + wchar_t *chars; /* Normal characters. */ + int nchars; + wctype_t *ch_classes; /* Character classes. */ + int nch_classes; + wchar_t *range_sts; /* Range characters (start of the range). */ + wchar_t *range_ends; /* Range characters (end of the range). */ + int nranges; + char **equivs; /* Equivalent classes. */ + int nequivs; + char **coll_elems; + int ncoll_elems; /* Collating elements. */ + }; + #endif + /* A compiled regular expression. */ struct dfa { *************** *** 252,257 **** --- 287,318 ---- int nleaves; /* Number of leaves on the parse tree. */ int nregexps; /* Count of parallel regexps being built with dfaparse(). */ + #ifdef MBS_SUPPORT + /* These stuff are used only if MB_CUR_MAX > 1 or multibyte environments. */ + int nmultibyte_prop; + int *multibyte_prop; + /* The value of multibyte_prop[i] is defined by following rule. + if tokens[i] < NOTCHAR + bit 1 : tokens[i] is a singlebyte character, or the last-byte of + a multibyte character. + bit 0 : tokens[i] is a singlebyte character, or the 1st-byte of + a multibyte character. + if tokens[i] = MBCSET + ("the index of mbcsets correspnd to this operator" << 2) + 3 + + e.g. + tokens + = 'single_byte_a', 'multi_byte_A', single_byte_b' + = 'sb_a', 'mb_A(1st byte)', 'mb_A(2nd byte)', 'mb_A(3rd byte)', 'sb_b' + multibyte_prop + = 3 , 1 , 0 , 2 , 3 + */ + + /* Array of the bracket expressoin in the DFA. */ + struct mb_char_classes *mbcsets; + int nmbcsets; + int mbcsets_alloc; + #endif /* Stuff owned by the state builder. */ dfa_state *states; /* States of the dfa. */ diff -crN gawk-3.1.0/doc/ChangeLog gawk-3.1.1/doc/ChangeLog *** gawk-3.1.0/doc/ChangeLog Sun Jun 3 13:05:21 2001 --- gawk-3.1.1/doc/ChangeLog Wed May 1 16:41:54 2002 *************** *** 1,3 **** --- 1,55 ---- + Wed May 1 16:41:32 2002 Arnold D. Robbins + + * Release 3.1.1: Release tar file made. + + Tue Apr 16 13:26:13 2002 Arnold D. Robbins + + * gawk.texi: FINALLY. All O'Reilly production and + indexing changes integrated. Index reviewed and + cleaned up. + * gawkinet.texi: Ditto. + * awkcard.in: Redid page breaking. + * Makefile.am (clean): Add `awkcard.tr' to list of files + that are removed. + (distclean): Depend on clean to REALLY GET `awkcard.tr'. + Sheesh. + + Mon Apr 15 14:43:51 2002 Arnold D. Robbins + + * texinfo.tex: Updated to version from Texinfo 4.2. + * gawk.texi: Modified to use new @copying command. + * gawkinet.texi: Ditto. + + Wed Mar 20 17:07:50 2002 Arnold D. Robbins + + * texinfo.tex: Updated to version from Texinfo 4.1. + + 2002-02-10 Paul Eggert + + * gawk.texi (Word Sorting): Don't use sort +1, as POSIX 1003.1-2001 + no longer allows it. Use sort -k instead. + + 2002-01-27 Bruno Haible + + * gawk.texi: Document the dcngettext function. + * awkcard.in: Likewise. + * gawk.1: Likewise. + + Mon Jan 28 18:41:02 2002 Arnold D. Robbins + + * gawkinet.texi, Makefile.am: Removed User Friendly cartoon. + Sigh. + + Wed Dec 19 16:00:39 2001 Eli Zaretskii + + * gawk.texi (Profiling): Describe the signals used for profile + dumping in the DJGPP version. + + Mon Sep 3 18:30:13 2001 Arnold D. Robbins + + * gawk.texi (Top): Put in @ifnottex so that makeinfo + --html is now happy. + Sun Jun 3 13:04:44 2001 Arnold D. Robbins * Release 3.1.0: Release tar file made. And there was diff -crN gawk-3.1.0/doc/Makefile.am gawk-3.1.1/doc/Makefile.am *** gawk-3.1.0/doc/Makefile.am Sun Jan 28 20:28:56 2001 --- gawk-3.1.1/doc/Makefile.am Tue Apr 16 15:22:53 2002 *************** *** 1,7 **** # # doc/Makefile.am --- automake input file for gawk # ! # Copyright (C) 2000, 2001 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. --- 1,7 ---- # # doc/Makefile.am --- automake input file for gawk # ! # Copyright (C) 2000, 2001, 2002 the Free Software Foundation, Inc. # # This file is part of GAWK, the GNU implementation of the # AWK Programming Language. *************** *** 30,36 **** EXTRA_DIST = ChangeLog README.card ad.block setter.outline \ awkcard.in awkforai.txt texinfo.tex cardfonts \ macros colors no.colors $(man_MANS) \ ! uf002331.eps uf002331.jpg lflashlight.eps rflashlight.eps \ statist.jpg statist.eps MAKEINFO = @MAKEINFO@ --no-split --- 30,36 ---- EXTRA_DIST = ChangeLog README.card ad.block setter.outline \ awkcard.in awkforai.txt texinfo.tex cardfonts \ macros colors no.colors $(man_MANS) \ ! lflashlight.eps rflashlight.eps \ statist.jpg statist.eps MAKEINFO = @MAKEINFO@ --no-split *************** *** 76,80 **** $(TROFF) $(CARDSRC_N) | $(SEDME) | cat $(srcdir)/setter.outline - > awkcard.ps && touch awkcard.nc clean: ! rm -f *.ps *~ awkcard.nc --- 76,81 ---- $(TROFF) $(CARDSRC_N) | $(SEDME) | cat $(srcdir)/setter.outline - > awkcard.ps && touch awkcard.nc clean: ! rm -f *.ps *~ awkcard.nc awkcard.tr + distclean: clean diff -crN gawk-3.1.0/doc/Makefile.in gawk-3.1.1/doc/Makefile.in *** gawk-3.1.0/doc/Makefile.in Thu Jan 1 02:00:00 1970 --- gawk-3.1.1/doc/Makefile.in Mon Apr 29 17:37:00 2002 *************** *** 0 **** --- 1,449 ---- + # Makefile.in generated automatically by automake 1.5 from Makefile.am. + + # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 + # Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation + # gives unlimited permission to copy and/or distribute it, + # with or without modifications, as long as this notice is preserved. + + # This program is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY, to the extent permitted by law; without + # even the implied warranty of MERCHANTABILITY or FITNESS FOR A + # PARTICULAR PURPOSE. + + @SET_MAKE@ + + # + # doc/Makefile.am --- automake input file for gawk + # + # Copyright (C) 2000, 2001, 2002 the Free Software Foundation, Inc. + # + # This file is part of GAWK, the GNU implementation of the + # AWK Programming Language. + # + # GAWK is free software; you can redistribute it and/or modify + # it under the terms of the GNU General Public License as published by + # the Free Software Foundation; either version 2 of the License, or + # (at your option) any later version. + # + # GAWK is distributed in the hope that it will be useful, + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + # + # You should have received a copy of the GNU General Public License + # along with this program; if not, write to the Free Software + # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + # + + SHELL = @SHELL@ + + srcdir = @srcdir@ + top_srcdir = @top_srcdir@ + VPATH = @srcdir@ + prefix = @prefix@ + exec_prefix = @exec_prefix@ + + bindir = @bindir@ + sbindir = @sbindir@ + libexecdir = @libexecdir@ + datadir = @datadir@ + sysconfdir = @sysconfdir@ + sharedstatedir = @sharedstatedir@ + localstatedir = @localstatedir@ + libdir = @libdir@ + infodir = @infodir@ + mandir = @mandir@ + includedir = @includedir@ + oldincludedir = /usr/include + pkgdatadir = $(datadir)/@PACKAGE@ + pkglibdir = $(libdir)/@PACKAGE@ + pkgincludedir = $(includedir)/@PACKAGE@ + top_builddir = .. + + ACLOCAL = @ACLOCAL@ + AUTOCONF = @AUTOCONF@ + AUTOMAKE = @AUTOMAKE@ + AUTOHEADER = @AUTOHEADER@ + + INSTALL = @INSTALL@ + INSTALL_PROGRAM = @INSTALL_PROGRAM@ + INSTALL_DATA = @INSTALL_DATA@ + INSTALL_SCRIPT = @INSTALL_SCRIPT@ + INSTALL_HEADER = $(INSTALL_DATA) + transform = @program_transform_name@ + NORMAL_INSTALL = : + PRE_INSTALL = : + POST_INSTALL = : + NORMAL_UNINSTALL = : + PRE_UNINSTALL = : + POST_UNINSTALL = : + host_alias = @host_alias@ + host_triplet = @host@ + AMTAR = @AMTAR@ + AWK = @AWK@ + BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ + CATOBJEXT = @CATOBJEXT@ + CC = @CC@ + CFLAGS = @CFLAGS@ + CPP = @CPP@ + DATADIRNAME = @DATADIRNAME@ + DEPDIR = @DEPDIR@ + EXEEXT = @EXEEXT@ + GENCAT = @GENCAT@ + GLIBC21 = @GLIBC21@ + GMSGFMT = @GMSGFMT@ + HAVE_LIB = @HAVE_LIB@ + INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + INSTOBJEXT = @INSTOBJEXT@ + INTLBISON = @INTLBISON@ + INTLLIBS = @INTLLIBS@ + INTLOBJS = @INTLOBJS@ + INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ + LIB = @LIB@ + LIBICONV = @LIBICONV@ + LIBINTL = @LIBINTL@ + LN_S = @LN_S@ + LTLIB = @LTLIB@ + LTLIBICONV = @LTLIBICONV@ + LTLIBINTL = @LTLIBINTL@ + MKINSTALLDIRS = @MKINSTALLDIRS@ + OBJEXT = @OBJEXT@ + PACKAGE = @PACKAGE@ + PATH_SEPARATOR = @PATH_SEPARATOR@ + POSUB = @POSUB@ + RANLIB = @RANLIB@ + SOCKET_LIBS = @SOCKET_LIBS@ + U = @U@ + USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ + USE_NLS = @USE_NLS@ + VERSION = @VERSION@ + YACC = @YACC@ + am__include = @am__include@ + am__quote = @am__quote@ + install_sh = @install_sh@ + + info_TEXINFOS = gawk.texi gawkinet.texi + + man_MANS = gawk.1 igawk.1 + + EXTRA_DIST = ChangeLog README.card ad.block setter.outline \ + awkcard.in awkforai.txt texinfo.tex cardfonts \ + macros colors no.colors $(man_MANS) \ + lflashlight.eps rflashlight.eps \ + statist.jpg statist.eps + + + MAKEINFO = @MAKEINFO@ --no-split + + TROFF = groff -t -Tps + SEDME = sed -e "s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/" \ + -e "s/^\/level0 save def/\/level0 save def 30 -48 translate/" + + + CARDSRC = $(srcdir)/macros $(srcdir)/cardfonts $(srcdir)/colors awkcard.tr + CARDSRC_N = $(srcdir)/macros $(srcdir)/cardfonts $(srcdir)/no.colors awkcard.tr + CARDFILES = $(CARDSRC) ad.block awkcard.in setter.outline + + # Use this if your troff can correctly handle macros from 'colors' file + AWKCARD = awkcard.ps + subdir = doc + mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs + CONFIG_HEADER = $(top_builddir)/config.h + CONFIG_CLEAN_FILES = + DIST_SOURCES = + INFO_DEPS = gawk.info gawkinet.info + DVIS = gawk.dvi gawkinet.dvi + TEXINFOS = gawk.texi gawkinet.texi + + NROFF = nroff + MANS = $(man_MANS) + DIST_COMMON = ChangeLog Makefile.am Makefile.in texinfo.tex + all: all-am + + .SUFFIXES: + .SUFFIXES: .dvi .info .ps .texi + $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu doc/Makefile + Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status + + gawk.info: gawk.texi + gawk.dvi: gawk.texi + + gawkinet.info: gawkinet.texi + gawkinet.dvi: gawkinet.texi + + .texi.info: + @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] + cd $(srcdir) \ + && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \ + `echo $< | sed 's,.*/,,'` + + .texi.dvi: + TEXINPUTS=$(srcdir):$$TEXINPUTS \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \ + $(TEXI2DVI) $< + + .texi: + @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] + cd $(srcdir) \ + && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \ + `echo $< | sed 's,.*/,,'` + TEXI2DVI = texi2dvi + DVIPS = dvips + .dvi.ps: + $(DVIPS) $< -o $@ + + uninstall-info-am: + $(PRE_UNINSTALL) + @if (install-info --version && \ + install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file"; \ + install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$file; \ + done; \ + else :; fi + @$(NORMAL_UNINSTALL) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + (if cd $(DESTDIR)$(infodir); then \ + echo " rm -f $$file $$file-[0-9] $$file-[0-9][0-9])"; \ + rm -f $$file $$file-[0-9] $$file-[0-9][0-9]; \ + else :; fi); \ + done + + dist-info: $(INFO_DEPS) + list='$(INFO_DEPS)'; \ + for base in $$list; do \ + d=$(srcdir); \ + for file in `CDPATH=: && cd $$d && eval echo $$base*`; do \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done; \ + done + + mostlyclean-aminfo: + -rm -f gawk.aux gawk.cp gawk.cps gawk.dvi gawk.fn gawk.ky gawk.log gawk.pg \ + gawk.ps gawk.toc gawk.tp gawk.vr gawkinet.aux gawkinet.cp \ + gawkinet.cps gawkinet.dvi gawkinet.fn gawkinet.ky \ + gawkinet.log gawkinet.pg gawkinet.ps gawkinet.toc gawkinet.tp \ + gawkinet.vr + + maintainer-clean-aminfo: + cd $(srcdir) && \ + for i in $(INFO_DEPS); do \ + rm -f $$i; \ + if test "`echo $$i-[0-9]*`" != "$$i-[0-9]*"; then \ + rm -f $$i-[0-9]*; \ + fi; \ + done + + man1dir = $(mandir)/man1 + install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(man1dir) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ + done + uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ + rm -f $(DESTDIR)$(man1dir)/$$inst; \ + done + tags: TAGS + TAGS: + + + DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + + top_distdir = .. + distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + + distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + $(mkinstalldirs) "$(distdir)/$$dir"; \ + fi; \ + if test -d $$d/$$file; then \ + cp -pR $$d/$$file $(distdir) \ + || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="${top_distdir}" distdir="$(distdir)" \ + dist-info + check-am: all-am + check: check-am + all-am: Makefile $(INFO_DEPS) $(MANS) + + installdirs: + $(mkinstalldirs) $(DESTDIR)$(infodir) $(DESTDIR)$(man1dir) + + install: install-am + install-exec: install-exec-am + install-data: install-data-am + uninstall: uninstall-am + + install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + + installcheck: installcheck-am + install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + mostlyclean-generic: + + clean-generic: + + distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + + maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + clean: clean-am + + clean-am: clean-generic mostlyclean-am + + distclean: distclean-am + + distclean-am: clean-am distclean-generic + + dvi: dvi-am + + dvi-am: $(DVIS) + + info: info-am + + info-am: $(INFO_DEPS) + + install-data-am: install-info-am install-man + + install-exec-am: + + install-info: install-info-am + + install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(infodir) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + d=$(srcdir); \ + for ifile in `CDPATH=: && cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \ + if test -f $$d/$$ifile; then \ + echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \ + $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \ + else : ; fi; \ + done; \ + done + @$(POST_INSTALL) + @if (install-info --version && \ + install-info --version | fgrep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\ + install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\ + done; \ + else : ; fi + install-man: install-man1 + + installcheck-am: + + maintainer-clean: maintainer-clean-am + + maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic + + mostlyclean: mostlyclean-am + + mostlyclean-am: mostlyclean-aminfo mostlyclean-generic + + uninstall-am: uninstall-info-am uninstall-man + + uninstall-man: uninstall-man1 + + .PHONY: all all-am check check-am clean clean-generic dist-info \ + distclean distclean-generic distdir dvi dvi-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-man1 install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic mostlyclean mostlyclean-aminfo \ + mostlyclean-generic uninstall uninstall-am uninstall-info-am \ + uninstall-man uninstall-man1 + + + # Uncomment the following definition of AWKCARD if your troff can produce + # Postscript but still has troubles with macros from 'colors'. As this + # is not groff you will have to change TROFF macro as well. Do not forget + # to ensure that awkcard.tr is processed by tbl. + #AWKCARD = awkcard.nc + + postscript: gawk.ps gawkinet.ps gawk.1.ps igawk.1.ps $(AWKCARD) + + gawk.ps: gawk.dvi + dvips -o gawk.ps gawk.dvi + + gawkinet.ps: gawkinet.dvi + dvips -o gawkinet.ps gawkinet.dvi + + gawk.1.ps: gawk.1 + -groff -man $(srcdir)/gawk.1 > gawk.1.ps + + igawk.1.ps: igawk.1 + -groff -man $(srcdir)/igawk.1 > igawk.1.ps + + awkcard.tr: awkcard.in + sed 's:SRCDIR:$(srcdir):' < $(srcdir)/awkcard.in > awkcard.tr + + awkcard.ps: $(CARDFILES) + $(TROFF) $(CARDSRC) | $(SEDME) | cat $(srcdir)/setter.outline - > awkcard.ps + + awkcard.nc: $(CARDFILES) + $(TROFF) $(CARDSRC_N) | $(SEDME) | cat $(srcdir)/setter.outline - > awkcard.ps && touch awkcard.nc + + clean: + rm -f *.ps *~ awkcard.nc awkcard.tr + + distclean: clean + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: diff -crN gawk-3.1.0/doc/awkcard.in gawk-3.1.1/doc/awkcard.in *** gawk-3.1.0/doc/awkcard.in Mon May 14 19:56:36 2001 --- gawk-3.1.1/doc/awkcard.in Tue Apr 16 14:32:24 2002 *************** *** 1,6 **** .\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org .\" ! .\" Copyright (C) 1996-2001 Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of .\" this reference card provided the copyright notice and this permission --- 1,6 ---- .\" AWK Reference Card --- Arnold Robbins, arnold@gnu.org .\" ! .\" Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. .\" .\" Permission is granted to make and distribute verbatim copies of .\" this reference card provided the copyright notice and this permission *************** *** 57,71 **** Conversions And Comparisons 9 Copying Permissions 18 Definitions 2 ! Dynamic Extensions (\*(GK) 18 ! Environment Variables (\*(GK) 18 Escape Sequences 8 Expressions 11 Fields 6 FTP/HTTP Information 18 ! Historical Features (\*(GK) 18 Input Control 12 ! Internationalization (\*(GK) 16 Lines And Statements 5 Localization (\*(GK) 17 Numeric Functions 14 --- 57,71 ---- Conversions And Comparisons 9 Copying Permissions 18 Definitions 2 ! Dynamic Extensions (\*(GK) 14 ! Environment Variables (\*(GK) 16 Escape Sequences 8 Expressions 11 Fields 6 FTP/HTTP Information 18 ! Historical Features (\*(GK) 16 Input Control 12 ! Internationalization (\*(GK) 18 Lines And Statements 5 Localization (\*(GK) 17 Numeric Functions 14 *************** *** 97,105 **** \*(CD .SL .nf ! \*(FR\(co Copyright 1996-2001, Free Software Foundation ! 59 Temple Place \(em Suite 330 ! Boston, MA 02111-1307 USA .nf .BT --- 97,104 ---- \*(CD .SL .nf ! \*(FRCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002 ! Free Software Foundation, Inc. .nf .BT *************** *** 111,117 **** .ES \*(CDThis card describes POSIX AWK, as well as the three freely available \*(AK implementations ! (see \fHFTP Information\fP below). \*(CLCommon extensions (in two or more versions) are printed in light blue. \*(CBFeatures specific to just one version\(emusually GNU AWK (\*(GK)\(emare printed in dark blue. --- 110,116 ---- .ES \*(CDThis card describes POSIX AWK, as well as the three freely available \*(AK implementations ! (see \fHFTP/HTTP Information\fP below). \*(CLCommon extensions (in two or more versions) are printed in light blue. \*(CBFeatures specific to just one version\(emusually GNU AWK (\*(GK)\(emare printed in dark blue. *************** *** 1422,1428 **** \*(CRThese filenames are now obsolete. Use the \*(FCPROCINFO\fP array to obtain the information they provide.\*(CL .EB "\s+2\f(HBSPECIAL FILENAMES\*(FR\s0" ! .\" --- Builtin Numeric Functions .ES .fi --- 1421,1427 ---- \*(CRThese filenames are now obsolete. Use the \*(FCPROCINFO\fP array to obtain the information they provide.\*(CL .EB "\s+2\f(HBSPECIAL FILENAMES\*(FR\s0" ! .sp .5 .\" --- Builtin Numeric Functions .ES .fi *************** *** 1445,1450 **** --- 1444,1467 ---- T} .TE .EB "\s+2\f(HBNUMERIC FUNCTIONS\*(FR\s0" + .sp .5 + .\" --- Extensions + .ES + .fi + .in +.2i + .ti -.2i + \*(CD\*(FCextension(\*(FIlib\*(FC, \*(FIfunc\*(FC)\*(FR + .br + dynamically load the shared library + \*(FIlib\*(FR + and call + \*(FIfunc\*(FR + in it to initialize the library. + This adds new built-in functions to \*(GK. + It returns the value returned by + \*(FIfunc\*(FR.\*(CB + .in -.2i + .EB "\s+2\f(HBDYNAMIC EXTENSIONS (\*(GK\f(HB)\*(FR\s0" .BT *************** *** 1647,1686 **** .in -.2i .EB "\s+2\f(HBBIT MANIPULATION FUNCTIONS (\*(GK\f(HB)\*(FR\s0" ! .\" --- Builtin Internationalizatin Functions .ES .fi ! \*(CD\*(GK ! provides the following functions for runtime message translation. ! .in +.2i ! .sp .5 ! .ti -.2i ! \*(FCbindtextdomain(\*(FIdirectory \*(FR[\*(FC, \*(FIdomain\*(FR]\*(FC)\*(FR ! .br ! specifies the directory where \*(GK looks for the \*(FC\&.mo\*(FR ! files, in case they ! will not or cannot be placed in the ``standard'' locations ! (e.g., during testing.) ! It returns the directory where \*(FIdomain\*(FR is ``bound.'' .sp .5 ! The default \*(FIdomain\*(FR is the value of \*(FCTEXTDOMAIN\*(FR. ! When \*(FIdirectory\*(FR is the null string (\*(FC"\^"\*(FR), ! \*(FCbindtextdomain()\*(FR returns the current binding for the ! given \*(FIdomain\*(FR. ! .ti -.2i ! \*(FCdcgettext(\*(FIstring \*(FR[\*(FC, \*(FIdomain \*(FR[\*(FC, \*(FIcategory\*(FR]]\*(FC)\*(FR ! .br ! returns the translation of \*(FIstring\*(FR in text domain ! \*(FIdomain\*(FR for locale category \*(FIcategory\*(FR. ! The default value for \*(FIdomain\*(FR is the current value of \*(FCTEXTDOMAIN\*(FR. ! The default value for \*(FIcategory\*(FR is \*(FC"LC_MESSAGES"\*(FR. .sp .5 ! If you supply a value for \*(FIcategory\*(FR, it must be a string equal to ! one of the known locale categories. ! You must also supply a text domain. Use \*(FCTEXTDOMAIN\*(FR ! to use the current domain.\*(CB ! .in -.2i ! .EB "\s+2\f(HBINTERNATIONALIZATION (\*(GK\f(HB)\*(FR\s0" .BT --- 1664,1706 ---- .in -.2i .EB "\s+2\f(HBBIT MANIPULATION FUNCTIONS (\*(GK\f(HB)\*(FR\s0" ! .\" --- Environment Variables .ES .fi ! \*(CDThe environment variable \*(FCAWKPATH\fP specifies a search path to use ! when finding source files named with the \*(FC\-f\fP ! option. ! The default path is ! \*(FC".:/usr/local/share/awk"\*(FR. ! .\" if this variable does not exist. ! .\" (The actual directory may vary, ! .\" depending upon how \*(GK was built and installed.) ! If a file name given to the \*(FC\-f\fP option contains a ``/'' character, ! no path search is performed. .sp .5 ! If \*(FCPOSIXLY_CORRECT\fP exists ! .\" in the environment, ! then \*(GK ! behaves exactly as if the \*(FC\-\^\-posix\fP option had been given.\*(CB ! .EB "\s+2\f(HBENVIRONMENT VARIABLES (\*(GK\f(HB)\*(FR\s0" ! ! .\" --- Historical Features ! .ES ! .fi ! \*(CD1. It is possible to call the \*(FClength()\fP ! built-in function not only with no argument, but even without parentheses. ! This feature is marked as ``deprecated'' in the POSIX standard, and \*(GK ! issues a warning about its use if \*(FC\-\^\-lint\fP ! is specified on the command line. .sp .5 ! 2. The \*(FCcontinue\fP ! and \*(FCbreak\fP statements may be used outside the body of a ! \*(FCwhile\*(FR, \*(FCfor\*(FR, or \*(FCdo\fP loop. ! Historical AWK implementations have treated such usage as ! equivalent to the \*(FCnext\fP statement. ! \*(GK supports this usage if \*(FC\-\^\-traditional\fP ! is specified.\*(CB ! .EB "\s+2\f(HBHISTORICAL FEATURES (\*(GK\f(HB)\*(FR\s0" .BT *************** *** 1756,1764 **** .sp .5 2. Mark all strings that should be translated with leading underscores. .sp .5 ! 3. Use the \*(FCdcgettext()\*(FR ! and/or \*(FCbindtextdomain()\*(FR ! functions in your program, as necessary or appropriate. .sp .5 4. Run .sp .5 --- 1776,1787 ---- .sp .5 2. Mark all strings that should be translated with leading underscores. .sp .5 ! 3. Use the ! \*(FCbindtextdomain()\*(FR, ! \*(FCdcgettext()\*(FR, ! and/or ! \*(FCdcngettext()\*(FR ! functions in your program, as appropriate. .sp .5 4. Run .sp .5 *************** *** 1777,1844 **** .BT ! .\" --- Extensions .ES .fi .in +.2i .ti -.2i ! \*(CD\*(FCextension(\*(FIlib\*(FC, \*(FIfunc\*(FC)\*(FR .br ! dynamically load the shared library ! \*(FIlib\*(FR ! and call ! \*(FIfunc\*(FR ! in it to initialize the library. ! This adds new built-in functions to \*(GK. ! It returns the value returned by ! \*(FIfunc\*(FR.\*(CB ! .in -.2i ! .EB "\s+2\f(HBDYNAMIC EXTENSIONS (\*(GK\f(HB)\*(FR\s0" ! ! .\" --- Environment Variables ! .ES ! .fi ! \*(CDThe environment variable \*(FCAWKPATH\fP specifies a search path to use ! when finding source files named with the \*(FC\-f\fP ! option. ! The default path is ! \*(FC".:/usr/local/share/awk"\*(FR, ! if this variable does not exist. ! (The actual directory may vary, ! depending upon how \*(GK was built and installed.) ! If a file name given to the \*(FC\-f\fP option contains a ``/'' character, ! no path search is performed. .sp .5 ! If \*(FCPOSIXLY_CORRECT\fP exists in the environment, then \*(GK ! behaves exactly as if \*(FC\-\^\-posix\fP had been specified on the ! command line.\*(CB ! .EB "\s+2\f(HBENVIRONMENT VARIABLES (\*(GK\f(HB)\*(FR\s0" ! ! .\" --- Historical Features ! .ES ! .fi ! \*(CD\*(GK supports two features of historical AWK implementations. ! First, it is possible to call the \*(FClength()\fP ! built-in function not only with no argument, but even without parentheses. ! This feature is marked as ``deprecated'' in the POSIX standard, and \*(GK ! issues a warning about its use if \*(FC\-\^\-lint\fP ! is specified on the command line. .sp .5 ! The other feature is the use of \*(FCcontinue\fP ! or \*(FCbreak\fP statements outside the body of a ! \*(FCwhile\*(FR, \*(FCfor\*(FR, or \*(FCdo\fP loop. ! Historical AWK implementations have treated such usage as ! equivalent to the \*(FCnext\fP statement. ! \*(GK supports this usage if \*(FC\-\^\-traditional\fP ! is specified.\*(CB ! .EB "\s+2\f(HBHISTORICAL FEATURES (\*(GK\f(HB)\*(FR\s0" ! .\" --- FTP Information .ES .nf ! \*(CDHost: \*(FCgnudist.gnu.org\*(FR ! File: \*(FC/gnu/gawk/gawk-3.1.0.tar.gz\fP .in +.2i .fi GNU \*(AK (\*(GK). There may be a later version. --- 1800,1859 ---- .BT ! .\" --- Builtin Internationalization Functions .ES .fi + \*(CD\*(GK + provides the following functions for runtime message translation. .in +.2i + .sp .5 .ti -.2i ! \*(FCbindtextdomain(\*(FIdirectory \*(FR[\*(FC, \*(FIdomain\*(FR]\*(FC)\*(FR .br ! specifies the directory where \*(GK looks for the \*(FC\&.mo\*(FR ! files, in case they ! will not or cannot be placed in the ``standard'' locations ! (e.g., during testing.) ! It returns the directory where \*(FIdomain\*(FR is ``bound.'' .sp .5 ! The default \*(FIdomain\*(FR is the value of \*(FCTEXTDOMAIN\*(FR. ! When \*(FIdirectory\*(FR is the null string (\*(FC"\^"\*(FR), ! \*(FCbindtextdomain()\*(FR returns the current binding for the ! given \*(FIdomain\*(FR. ! .ti -.2i ! \*(FCdcgettext(\*(FIstring \*(FR[\*(FC, \*(FIdomain \*(FR[\*(FC, \*(FIcategory\*(FR]]\*(FC)\*(FR ! .br ! returns the translation of \*(FIstring\*(FR in text domain ! \*(FIdomain\*(FR for locale category \*(FIcategory\*(FR. ! The default value for \*(FIdomain\*(FR is the current value of \*(FCTEXTDOMAIN\*(FR. ! The default value for \*(FIcategory\*(FR is \*(FC"LC_MESSAGES"\*(FR. .sp .5 ! If you supply a value for \*(FIcategory\*(FR, it must be a string equal to ! one of the known locale categories. ! You must also supply a text domain. Use \*(FCTEXTDOMAIN\*(FR ! to use the current domain. ! .ti -.2i ! \*(FCdcngettext(\*(FIstring1 \*(FR, \*(FIstring2 \*(FR, \*(FInumber \*(FR[\*(FC, \*(FIdomain \*(FR[\*(FC, \*(FIcategory\*(FR]]\*(FC)\*(FR ! .br ! returns the plural form used for \*(FInumber\*(FR of the translation of ! \*(FIstring1\*(FR and \*(FIstring2\*(FR in text domain ! \*(FIdomain\*(FR for locale category \*(FIcategory\*(FR. ! The default value for \*(FIdomain\*(FR is the current value of \*(FCTEXTDOMAIN\*(FR. ! The default value for \*(FIcategory\*(FR is \*(FC"LC_MESSAGES"\*(FR. ! .sp .5 ! If you supply a value for \*(FIcategory\*(FR, it must be a string equal to ! one of the known locale categories. ! You must also supply a text domain. Use \*(FCTEXTDOMAIN\*(FR ! to use the current domain.\*(CB ! .in -.2i ! .EB "\s+2\f(HBINTERNATIONALIZATION (\*(GK\f(HB)\*(FR\s0" ! .\" --- FTP/HTTP Information .ES .nf ! \*(CDHost: \*(FCftp.gnu.org\*(FR ! File: \*(FC/gnu/gawk/gawk-3.1.1.tar.gz\fP .in +.2i .fi GNU \*(AK (\*(GK). There may be a later version. *************** *** 1861,1870 **** .in -.2i .EB "\s+2\f(HBFTP/HTTP INFORMATION\*(FR\s0" .\" --- Copying Permissions .ES .fi ! \*(CDCopyright \(co 1996-2001 Free Software Foundation, Inc. .sp .5 Permission is granted to make and distribute verbatim copies of this reference card provided the copyright notice and this permission notice --- 1876,1886 ---- .in -.2i .EB "\s+2\f(HBFTP/HTTP INFORMATION\*(FR\s0" + .\" --- Copying Permissions .ES .fi ! \*(CDCopyright \(co 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. .sp .5 Permission is granted to make and distribute verbatim copies of this reference card provided the copyright notice and this permission notice diff -crN gawk-3.1.0/doc/gawk.1 gawk-3.1.1/doc/gawk.1 *** gawk-3.1.0/doc/gawk.1 Tue May 29 15:53:08 2001 --- gawk-3.1.1/doc/gawk.1 Tue Apr 16 14:02:26 2002 *************** *** 14,20 **** . if \w'\(rq' .ds rq "\(rq . \} .\} ! .TH GAWK 1 "May 29 2001" "Free Software Foundation" "Utility Commands" .SH NAME gawk \- pattern scanning and processing language .SH SYNOPSIS --- 14,20 ---- . if \w'\(rq' .ds rq "\(rq . \} .\} ! .TH GAWK 1 "Apr 16 2002" "Free Software Foundation" "Utility Commands" .SH NAME gawk \- pattern scanning and processing language .SH SYNOPSIS *************** *** 923,928 **** --- 923,929 ---- The index of the first character matched by .BR match() ; 0 if no match. + (This implies that character indices start at one.) .TP .B RLENGTH The length of the string matched by *************** *** 1494,1509 **** For example, the name .B e might be used to represent all of ! \*(lqe,\*(rq \*(lqe\h'-\w:e:u'\`,\*(rq and \*(lqe\h'-\w:e:u'\`.\*(rq In this case, .B [[=e=]] is a regular expression that matches any of .BR e , - ....BR "e\'" , .BR "e\h'-\w:e:u'\'" , or - ....BR "e\`" . .BR "e\h'-\w:e:u'\`" . .PP These features are very valuable in non-English speaking locales. --- 1495,1508 ---- For example, the name .B e might be used to represent all of ! \*(lqe,\*(rq \*(lqe\h'-\w:e:u'\',\*(rq and \*(lqe\h'-\w:e:u'\`.\*(rq In this case, .B [[=e=]] is a regular expression that matches any of .BR e , .BR "e\h'-\w:e:u'\'" , or .BR "e\h'-\w:e:u'\`" . .PP These features are very valuable in non-English speaking locales. *************** *** 1677,1683 **** \fBdelete \fIarray\^\fB[\^\fIindex\^\fB]\fR \fBdelete \fIarray\^\fR \fBexit\fR [ \fIexpression\fR ] ! \fB{ \fIstatements \fB} .fi .RE .SS "I/O Statements" --- 1676,1682 ---- \fBdelete \fIarray\^\fB[\^\fIindex\^\fB]\fR \fBdelete \fIarray\^\fR \fBexit\fR [ \fIexpression\fR ] ! \fB{ \fIstatements \fB}\fR .fi .RE .SS "I/O Statements" *************** *** 2322,2327 **** --- 2321,2327 ---- or 0 if .I t is not present. + (This implies that character indices start at one.) .TP \fBlength(\fR[\fIs\fR]\fB) Returns the length of the string *************** *** 2629,2634 **** --- 2629,2663 ---- You must also supply a text domain. Use .B TEXTDOMAIN if you want to use the current domain. + .TP + \fBdcngettext(\fIstring1 \fR, \fIstring2 \fR, \fInumber \fR[\fB, \fIdomain \fR[\fB, \fIcategory\fR]]\fB)\fR + Returns the plural form used for + .I number + of the translation of + .I string1 + and + .I string2 + in + text domain + .I domain + for locale category + .IR category . + The default value for + .I domain + is the current value of + .BR TEXTDOMAIN . + The default value for + .I category + is \fB"LC_MESSAGES"\fR. + .sp .5 + If you supply a value for + .IR category , + it must be a string equal to + one of the known locale categories described + in \*(EP. + You must also supply a text domain. Use + .B TEXTDOMAIN + if you want to use the current domain. .SH USER-DEFINED FUNCTIONS Functions in \*(AK are defined as follows: .PP *************** *** 3224,3237 **** the parse stack, generating a rather unhelpful message. Such programs are surprisingly difficult to diagnose in the completely general case, and the effort to do so really is not worth it. - .ig - .PP - .I Gawk - suffers from ``feeping creaturism.'' - It's too bad - .I perl - is so inelegant. - .. .SH AUTHORS The original version of \*(UX .I awk --- 3253,3258 ---- *************** *** 3299,3305 **** provided valuable assistance during testing and debugging. We thank him. .SH COPYING PERMISSIONS ! Copyright \(co 1989, 1991\-2001 Free Software Foundation, Inc. .PP Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission --- 3320,3327 ---- provided valuable assistance during testing and debugging. We thank him. .SH COPYING PERMISSIONS ! Copyright \(co 1989, 1991, 1992, 1993, 1994, 1995, 1996, ! 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc. .PP Permission is granted to make and distribute verbatim copies of this manual page provided the copyright notice and this permission diff -crN gawk-3.1.0/doc/gawk.texi gawk-3.1.1/doc/gawk.texi *** gawk-3.1.0/doc/gawk.texi Sun May 13 18:38:13 2001 --- gawk-3.1.1/doc/gawk.texi Mon Apr 22 14:26:20 2002 *************** *** 20,28 **** @c applies to and all the info about who's publishing this edition @c These apply across the board. ! @set UPDATE-MONTH March, 2001 @set VERSION 3.1 ! @set PATCHLEVEL 0 @set FSF --- 20,28 ---- @c applies to and all the info about who's publishing this edition @c These apply across the board. ! @set UPDATE-MONTH April, 2002 @set VERSION 3.1 ! @set PATCHLEVEL 1 @set FSF *************** *** 68,73 **** --- 68,74 ---- @set DF data file @set DDF Data File @set PVERSION version + @set CTL Ctrl @ignore Some comments on the layout for TeX. *************** *** 96,114 **** @finalout @end iftex ! @c Comment out the "smallbook" for technical review. Saves ! @c considerable paper. Remember to turn it back on *before* ! @c starting the page-breaking work. ! @smallbook ! ! @ifinfo ! This file documents @command{awk}, a program that you can use to select ! particular records in a file and perform operations upon them. This is Edition @value{EDITION} of @cite{@value{TITLE}: @value{SUBTITLE}}, ! for the @value{VERSION}.@value{PATCHLEVEL} version of the GNU implementation of AWK. ! ! Copyright (C) 1989, 1991, 1992, 1993, 1996-2001 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or --- 97,109 ---- @finalout @end iftex ! @copying ! Copyright @copyright{} 1989, 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. ! @sp 2 This is Edition @value{EDITION} of @cite{@value{TITLE}: @value{SUBTITLE}}, ! for the @value{VERSION}.@value{PATCHLEVEL} (or later) version of the GNU ! implementation of AWK. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or *************** *** 127,137 **** software. Copies published by the Free Software Foundation raise funds for GNU development.'' @end enumerate ! @end ifinfo @c Uncomment this for the release. Leaving it off saves paper @c during editing and review. ! @setchapternewpage odd @titlepage @title @value{TITLE} --- 122,142 ---- software. Copies published by the Free Software Foundation raise funds for GNU development.'' @end enumerate ! @end copying ! ! @c Comment out the "smallbook" for technical review. Saves ! @c considerable paper. Remember to turn it back on *before* ! @c starting the page-breaking work. ! ! @c 4/2002: Karl Berry recommends commenting out this and the ! @c `@setchapternewpage odd', and letting users use `texi2dvi -t' ! @c if they want to waste paper. ! @c @smallbook ! @c Uncomment this for the release. Leaving it off saves paper @c during editing and review. ! @c @setchapternewpage odd @titlepage @title @value{TITLE} *************** *** 166,179 **** Registered Trademark of Paramount Pictures Corporation. @* @c sorry, i couldn't resist @sp 3 - Copyright @copyright{} 1989, 1991, 1992, 1993, 1996-2001 Free Software Foundation, Inc. - @sp 2 - - This is Edition @value{EDITION} of @cite{@value{TITLE}: @value{SUBTITLE}}, - for the @value{VERSION}.@value{PATCHLEVEL} (or later) version of the GNU - implementation of AWK. - - @sp 2 Published by: @sp 1 --- 171,176 ---- *************** *** 187,210 **** @c This one is correct for gawk 3.1.0 from the FSF ISBN 1-882114-28-0 @* ! ! Permission is granted to copy, distribute and/or modify this document ! under the terms of the GNU Free Documentation License, Version 1.1 or ! any later version published by the Free Software Foundation; with the ! Invariant Sections being ``GNU General Public License'', the Front-Cover ! texts being (a) (see below), and with the Back-Cover Texts being (b) ! (see below). A copy of the license is included in the section entitled ! ``GNU Free Documentation License''. ! ! @enumerate a ! @item ! ``A GNU Manual'' ! ! @item ! ``You have freedom to copy and modify this GNU Manual, like GNU ! software. Copies published by the Free Software Foundation raise ! funds for GNU development.'' ! @end enumerate @sp 2 Cover art by Etienne Suvasa. @end titlepage --- 184,191 ---- @c This one is correct for gawk 3.1.0 from the FSF ISBN 1-882114-28-0 @* ! @sp 2 ! @insertcopying @sp 2 Cover art by Etienne Suvasa. @end titlepage *************** *** 237,243 **** @oddheading @| @| @strong{@thischapter}@ @ @ @thispage @end iftex ! @ifinfo @node Top, Foreword, (dir), (dir) @top General Introduction @c Preface node should come right after the Top --- 218,224 ---- @oddheading @| @| @strong{@thischapter}@ @ @ @thispage @end iftex ! @ifnottex @node Top, Foreword, (dir), (dir) @top General Introduction @c Preface node should come right after the Top *************** *** 247,257 **** This file documents @command{awk}, a program that you can use to select particular records in a file and perform operations upon them. ! This is Edition @value{EDITION} of @cite{@value{TITLE}: @value{SUBTITLE}}, ! for the @value{VERSION}.@value{PATCHLEVEL} version of the GNU implementation ! of AWK. ! @end ifinfo @menu * Foreword:: Some nice words about this --- 228,236 ---- This file documents @command{awk}, a program that you can use to select particular records in a file and perform operations upon them. ! @insertcopying ! @end ifnottex @menu * Foreword:: Some nice words about this *************** *** 309,315 **** * Acknowledgments:: Acknowledgments. * Running gawk:: How to run @command{gawk} programs; includes command-line syntax. ! * One-shot:: Running a short throw-away @command{awk} program. * Read Terminal:: Using no input files (input from terminal instead). --- 288,294 ---- * Acknowledgments:: Acknowledgments. * Running gawk:: How to run @command{gawk} programs; includes command-line syntax. ! * One-shot:: Running a short throwaway @command{awk} program. * Read Terminal:: Using no input files (input from terminal instead). *************** *** 333,339 **** * When:: When to use @command{gawk} and when to use other things. * Regexp Usage:: How to Use Regular Expressions. ! * Escape Sequences:: How to write non-printing characters. * Regexp Operators:: Regular Expression Operators. * Character Lists:: What can go between @samp{[...]}. * GNU Regexp Operators:: Operators specific to GNU software. --- 312,318 ---- * When:: When to use @command{gawk} and when to use other things. * Regexp Usage:: How to Use Regular Expressions. ! * Escape Sequences:: How to write nonprinting characters. * Regexp Operators:: Regular Expression Operators. * Character Lists:: What can go between @samp{[...]}. * GNU Regexp Operators:: Operators specific to GNU software. *************** *** 342,348 **** * Computed Regexps:: Using Dynamic Regexps. * Records:: Controlling how data is split into records. * Fields:: An introduction to fields. ! * Non-Constant Fields:: Non-constant Field Numbers. * Changing Fields:: Changing the Contents of a Field. * Field Separators:: The field separator and how to change it. * Regexp Field Splitting:: Using regexps as the field separator. --- 321,327 ---- * Computed Regexps:: Using Dynamic Regexps. * Records:: Controlling how data is split into records. * Fields:: An introduction to fields. ! * Nonconstant Fields:: Nonconstant Field Numbers. * Changing Fields:: Changing the Contents of a Field. * Field Separators:: The field separator and how to change it. * Regexp Field Splitting:: Using regexps as the field separator. *************** *** 390,396 **** * Close Files And Pipes:: Closing Input and Output Files and Pipes. * Constants:: String, numeric and regexp constants. * Scalar Constants:: Numeric and string constants. ! * Non-decimal-numbers:: What are octal and hex numbers. * Regexp Constants:: Regular Expression constants. * Using Constant Regexps:: When and how to use a regexp constant. * Variables:: Variables give names to values for later --- 369,375 ---- * Close Files And Pipes:: Closing Input and Output Files and Pipes. * Constants:: String, numeric and regexp constants. * Scalar Constants:: Numeric and string constants. ! * Nondecimal-numbers:: What are octal and hex numbers. * Regexp Constants:: Regular Expression constants. * Using Constant Regexps:: When and how to use a regexp constant. * Variables:: Variables give names to values for later *************** *** 503,509 **** * I18N Portability:: @command{awk}-level portability issues. * I18N Example:: A simple i18n example. * Gawk I18N:: @command{gawk} is also internationalized. ! * Non-decimal Data:: Allowing non-decimal input data. * Two-way I/O:: Two-way communications with another process. * TCP/IP Networking:: Using @command{gawk} for network --- 482,488 ---- * I18N Portability:: @command{awk}-level portability issues. * I18N Example:: A simple i18n example. * Gawk I18N:: @command{gawk} is also internationalized. ! * Nondecimal Data:: Allowing nondecimal input data. * Two-way I/O:: Two-way communications with another process. * TCP/IP Networking:: Using @command{gawk} for network *************** *** 595,600 **** --- 574,581 ---- and OS/2. * PC Using:: Running @command{gawk} on MS-DOS, Win32 and OS/2. + * Cygwin:: Building and running @command{gawk} for + Cygwin. * VMS Installation:: Installing @command{gawk} on VMS. * VMS Compilation:: How to compile @command{gawk} under VMS. * VMS Installation Details:: How to install @command{gawk} under VMS. *************** *** 774,780 **** You might want to extract certain lines and discard the rest. Or you may need to make changes wherever certain patterns appear, but leave the rest of the file alone. ! Writing single-use programs for these tasks in languages such as C, C++ or Pascal is time-consuming and inconvenient. Such jobs are often easier with @command{awk}. The @command{awk} utility interprets a special-purpose programming language --- 755,761 ---- You might want to extract certain lines and discard the rest. Or you may need to make changes wherever certain patterns appear, but leave the rest of the file alone. ! Writing single-use programs for these tasks in languages such as C, C++, or Pascal is time-consuming and inconvenient. Such jobs are often easier with @command{awk}. The @command{awk} utility interprets a special-purpose programming language *************** *** 788,795 **** Thus, we usually don't distinguish between @command{gawk} and other @command{awk} implementations. ! @cindex uses of @command{awk} ! @cindex applications of @command{awk} Using @command{awk} allows you to: @itemize @bullet --- 769,780 ---- Thus, we usually don't distinguish between @command{gawk} and other @command{awk} implementations. ! @cindex @command{awk}, POSIX and, See Also POSIX @command{awk} ! @cindex @command{awk}, POSIX and ! @cindex POSIX, @command{awk} and ! @cindex @command{gawk}, @command{awk} and ! @cindex @command{awk}, @command{gawk} and ! @cindex @command{awk}, uses for Using @command{awk} allows you to: @itemize @bullet *************** *** 807,816 **** @item Experiment with algorithms that you can adapt later to other computer ! languages. @end itemize ! @cindex uses of @command{gawk} In addition, @command{gawk} provides facilities that make it easy to: --- 792,803 ---- @item Experiment with algorithms that you can adapt later to other computer ! languages @end itemize ! @cindex @command{awk}, See Also @command{gawk} ! @cindex @command{gawk}, See Also @command{awk} ! @cindex @command{gawk}, uses for In addition, @command{gawk} provides facilities that make it easy to: *************** *** 823,848 **** Sort data @item ! Perform simple network communications. @end itemize This @value{DOCUMENT} teaches you about the @command{awk} language and how you can use it effectively. You should already be familiar with basic system commands, such as @command{cat} and @command{ls},@footnote{These commands ! are available on POSIX-compliant systems, as well as on traditional Unix ! based systems. If you are using some other operating system, you still need to be familiar with the ideas of I/O redirection and pipes.} as well as basic shell ! facilities, such as Input/Output (I/O) redirection and pipes. Implementations of the @command{awk} language are available for many different computing environments. This @value{DOCUMENT}, while describing the @command{awk} language in general, also describes the particular implementation of @command{awk} called @command{gawk} (which stands for ``GNU awk''). @command{gawk} runs on a broad range of Unix systems, ! ranging from 80386 PC-based computers, up through large-scale systems, such as Crays. @command{gawk} has also been ported to Mac OS X, ! MS-DOS, Microsoft Windows (all versions) and OS/2 PC's, Atari and Amiga ! micro-computers, BeOS, Tandem D20, and VMS. @menu * History:: The history of @command{gawk} and --- 810,836 ---- Sort data @item ! Perform simple network communications @end itemize This @value{DOCUMENT} teaches you about the @command{awk} language and how you can use it effectively. You should already be familiar with basic system commands, such as @command{cat} and @command{ls},@footnote{These commands ! are available on POSIX-compliant systems, as well as on traditional ! Unix-based systems. If you are using some other operating system, you still need to be familiar with the ideas of I/O redirection and pipes.} as well as basic shell ! facilities, such as input/output (I/O) redirection and pipes. + @cindex GNU @command{awk}, See @command{gawk} Implementations of the @command{awk} language are available for many different computing environments. This @value{DOCUMENT}, while describing the @command{awk} language in general, also describes the particular implementation of @command{awk} called @command{gawk} (which stands for ``GNU awk''). @command{gawk} runs on a broad range of Unix systems, ! ranging from 80386 PC-based computers up through large-scale systems, such as Crays. @command{gawk} has also been ported to Mac OS X, ! MS-DOS, Microsoft Windows (all versions) and OS/2 PCs, Atari and Amiga ! microcomputers, BeOS, Tandem D20, and VMS. @menu * History:: The history of @command{gawk} and *************** *** 876,888 **** more parts C. Document very well and release. @end quotation - @cindex acronym - @cindex history of @command{awk} @cindex Aho, Alfred @cindex Weinberger, Peter @cindex Kernighan, Brian ! @cindex old @command{awk} ! @cindex new @command{awk} The name @command{awk} comes from the initials of its designers: Alfred V.@: Aho, Peter J.@: Weinberger and Brian W.@: Kernighan. The original version of @command{awk} was written in 1977 at AT&T Bell Laboratories. --- 864,873 ---- more parts C. Document very well and release. @end quotation @cindex Aho, Alfred @cindex Weinberger, Peter @cindex Kernighan, Brian ! @cindex @command{awk}, history of The name @command{awk} comes from the initials of its designers: Alfred V.@: Aho, Peter J.@: Weinberger and Brian W.@: Kernighan. The original version of @command{awk} was written in 1977 at AT&T Bell Laboratories. *************** *** 925,948 **** @node Names, This Manual, History, Preface @section A Rose by Any Other Name ! @cindex old @command{awk} vs. new @command{awk} ! @cindex new @command{awk} vs. old @command{awk} The @command{awk} language has evolved over the years. Full details are provided in @ref{Language History, ,The Evolution of the @command{awk} Language}. The language described in this @value{DOCUMENT} is often referred to as ``new @command{awk}'' (@command{nawk}). Because of this, many systems have multiple versions of @command{awk}. Some systems have an @command{awk} utility that implements the original version of the @command{awk} language and a @command{nawk} utility for the new version. ! Others have an @command{oawk} for the ``old @command{awk}'' language and plain @command{awk} for the new one. Still others only have one version, which is usually the new one.@footnote{Often, these systems use @command{gawk} for their @command{awk} implementation!} All in all, this makes it difficult for you to know which version of @command{awk} you should run when writing your programs. The best advice I can give here is to check your local documentation. Look for @command{awk}, --- 910,935 ---- @node Names, This Manual, History, Preface @section A Rose by Any Other Name ! @cindex @command{awk}, new vs. old The @command{awk} language has evolved over the years. Full details are provided in @ref{Language History, ,The Evolution of the @command{awk} Language}. The language described in this @value{DOCUMENT} is often referred to as ``new @command{awk}'' (@command{nawk}). + @cindex @command{awk}, versions of Because of this, many systems have multiple versions of @command{awk}. Some systems have an @command{awk} utility that implements the original version of the @command{awk} language and a @command{nawk} utility for the new version. ! Others have an @command{oawk} version for the ``old @command{awk}'' language and plain @command{awk} for the new one. Still others only have one version, which is usually the new one.@footnote{Often, these systems use @command{gawk} for their @command{awk} implementation!} + @cindex @command{nawk} utility + @cindex @command{oawk} utility All in all, this makes it difficult for you to know which version of @command{awk} you should run when writing your programs. The best advice I can give here is to check your local documentation. Look for @command{awk}, *************** *** 959,1002 **** @node This Manual, Conventions, Names, Preface @section Using This Book ! @cindex book, using this ! @cindex using this book ! @cindex language, @command{awk} ! @cindex program, @command{awk} ! @ignore ! @cindex @command{awk} language ! @cindex @command{awk} program ! @end ignore ! @cindex Brandon, Dick ! @cindex sex, comparisons with ! @quotation ! @i{Documentation is like sex: when it is good, it is very, very good; and ! when it is bad, it is better than nothing.}@* ! Dick Brandon ! @end quotation The term @command{awk} refers to a particular program as well as to the language you use to tell this program what to do. When we need to be careful, we call ! the program ``the @command{awk} utility'' and the language ``the @command{awk} ! language.'' This @value{DOCUMENT} explains both the @command{awk} language and how to run the @command{awk} utility. The term @dfn{@command{awk} program} refers to a program written by you in the @command{awk} programming language. Primarily, this @value{DOCUMENT} explains the features of @command{awk}, as defined in the POSIX standard. It does so in the context of the @command{gawk} implementation. While doing so, it also attempts to describe important differences between @command{gawk} and other @command{awk} implementations.@footnote{All such differences ! appear in the index under the heading ``differences between @command{gawk} and ! @command{awk}.''} Finally, any @command{gawk} features that are not in the POSIX standard for @command{awk} are noted. @ifnotinfo This @value{DOCUMENT} has the difficult task of being both a tutorial and a reference. If you are a novice, feel free to skip over details that seem too complex. ! You should also ignore the many cross references; they are for the expert user and for the online Info version of the document. @end ifnotinfo --- 946,979 ---- @node This Manual, Conventions, Names, Preface @section Using This Book ! @cindex @command{awk}, terms describing The term @command{awk} refers to a particular program as well as to the language you use to tell this program what to do. When we need to be careful, we call ! the language ``the @command{awk} language,'' ! and the program ``the @command{awk} utility.'' This @value{DOCUMENT} explains both the @command{awk} language and how to run the @command{awk} utility. The term @dfn{@command{awk} program} refers to a program written by you in the @command{awk} programming language. + @cindex @command{gawk}, @command{awk} and + @cindex @command{awk}, @command{gawk} and + @cindex POSIX @command{awk} Primarily, this @value{DOCUMENT} explains the features of @command{awk}, as defined in the POSIX standard. It does so in the context of the @command{gawk} implementation. While doing so, it also attempts to describe important differences between @command{gawk} and other @command{awk} implementations.@footnote{All such differences ! appear in the index under the ! entry ``differences in @command{awk} and @command{gawk}.''} ! Finally, any @command{gawk} features that are not in the POSIX standard for @command{awk} are noted. @ifnotinfo This @value{DOCUMENT} has the difficult task of being both a tutorial and a reference. If you are a novice, feel free to skip over details that seem too complex. ! You should also ignore the many cross-references; they are for the expert user and for the online Info version of the document. @end ifnotinfo *************** *** 1006,1012 **** scattered throughout the @value{DOCUMENT}. They add a more complete explanation of points that are relevant, but not likely to be of interest on first reading. ! All appear in the index, under the heading ``advanced notes.'' Most of the time, the examples use complete @command{awk} programs. In some of the more advanced sections, only the part of the @command{awk} --- 983,989 ---- scattered throughout the @value{DOCUMENT}. They add a more complete explanation of points that are relevant, but not likely to be of interest on first reading. ! All appear in the index, under the heading ``advanced features.'' Most of the time, the examples use complete @command{awk} programs. In some of the more advanced sections, only the part of the @command{awk} *************** *** 1054,1060 **** @ref{Functions}, describes the built-in functions @command{awk} and ! @command{gawk} provide for you, as well as how to define your own functions. @ref{Internationalization, ,Internationalization with @command{gawk}}, --- 1031,1037 ---- @ref{Functions}, describes the built-in functions @command{awk} and ! @command{gawk} provide, as well as how to define your own functions. @ref{Internationalization, ,Internationalization with @command{gawk}}, *************** *** 1076,1087 **** @ref{Library Functions, ,A Library of @command{awk} Functions}, and @ref{Sample Programs, ,Practical @command{awk} Programs}, provide many sample @command{awk} programs. ! Reading them allows you to see @command{awk} being used ! for solving real problems. @ref{Language History, ,The Evolution of the @command{awk} Language}, ! describes how the @command{awk} language has evolved since it was ! first released to present. It also describes how @command{gawk} has acquired features over time. @ref{Installation, ,Installing @command{gawk}}, --- 1053,1064 ---- @ref{Library Functions, ,A Library of @command{awk} Functions}, and @ref{Sample Programs, ,Practical @command{awk} Programs}, provide many sample @command{awk} programs. ! Reading them allows you to see @command{awk} ! solving real problems. @ref{Language History, ,The Evolution of the @command{awk} Language}, ! describes how the @command{awk} language has evolved since ! first release to present. It also describes how @command{gawk} has acquired features over time. @ref{Installation, ,Installing @command{gawk}}, *************** *** 1101,1117 **** provides some very cursory background material for those who are completely unfamiliar with computer programming. Also centralized there is a discussion of some of the issues ! involved in using floating-point numbers. The @ref{Glossary}, defines most, if not all, the significant terms used throughout the book. ! If you find terms that you aren't familiar with, try looking them up. @ref{Copying, ,GNU General Public License}, and @ref{GNU Free Documentation License}, ! present the licenses that cover the @command{gawk} source code, and this @value{DOCUMENT}, respectively. @node Conventions, Manual History, This Manual, Preface --- 1078,1094 ---- provides some very cursory background material for those who are completely unfamiliar with computer programming. Also centralized there is a discussion of some of the issues ! surrounding floating-point numbers. The @ref{Glossary}, defines most, if not all, the significant terms used throughout the book. ! If you find terms that you aren't familiar with, try looking them up here. @ref{Copying, ,GNU General Public License}, and @ref{GNU Free Documentation License}, ! present the licenses that cover the @command{gawk} source code and this @value{DOCUMENT}, respectively. @node Conventions, Manual History, This Manual, Preface *************** *** 1157,1163 **** Characters that you type at the keyboard look @kbd{like this}. In particular, there are special characters called ``control characters.'' These are characters that you type by holding down both the @kbd{CONTROL} key and ! another key, at the same time. For example, a @kbd{Ctrl-d} is typed by first pressing and holding the @kbd{CONTROL} key, next pressing the @kbd{d} key and finally releasing both keys. --- 1134,1140 ---- Characters that you type at the keyboard look @kbd{like this}. In particular, there are special characters called ``control characters.'' These are characters that you type by holding down both the @kbd{CONTROL} key and ! another key, at the same time. For example, a @kbd{@value{CTL}-d} is typed by first pressing and holding the @kbd{CONTROL} key, next pressing the @kbd{d} key and finally releasing both keys. *************** *** 1170,1176 **** Brian Kernighan @end quotation ! @cindex d.c., see ``dark corner'' @cindex dark corner Until the POSIX standard (and @cite{The Gawk Manual}), many features of @command{awk} were either poorly documented or not --- 1147,1153 ---- Brian Kernighan @end quotation ! @cindex d.c., See dark corner @cindex dark corner Until the POSIX standard (and @cite{The Gawk Manual}), many features of @command{awk} were either poorly documented or not *************** *** 1191,1216 **** @node Manual History, How To Contribute, Conventions, Preface @unnumberedsec The GNU Project and This Book - @cindex Torvalds, Linus - @cindex sex, comparisons with - @quotation - @i{Software is like sex: it's better when it's free.}@* - Linus Torvalds - @end quotation ! @cindex FSF ! @cindex Free Software Foundation @cindex Stallman, Richard ! The Free Software Foundation (FSF) is a non-profit organization dedicated to the production and distribution of freely distributable software. It was founded by Richard M.@: Stallman, the author of the original Emacs editor. GNU Emacs is the most widely used version of Emacs today. @cindex GNU Project ! @cindex GPL ! @cindex General Public License ! @cindex GNU General Public License ! @cindex online documentation @cindex documentation, online The GNU@footnote{GNU stands for ``GNU's not Unix.''} Project is an ongoing effort on the part of the Free Software --- 1168,1185 ---- @node Manual History, How To Contribute, Conventions, Preface @unnumberedsec The GNU Project and This Book ! @cindex FSF (Free Software Foundation) ! @cindex Free Software Foundation (FSF) @cindex Stallman, Richard ! The Free Software Foundation (FSF) is a nonprofit organization dedicated to the production and distribution of freely distributable software. It was founded by Richard M.@: Stallman, the author of the original Emacs editor. GNU Emacs is the most widely used version of Emacs today. @cindex GNU Project ! @cindex GPL (General Public License) ! @cindex General Public License, See GPL @cindex documentation, online The GNU@footnote{GNU stands for ``GNU's not Unix.''} Project is an ongoing effort on the part of the Free Software *************** *** 1240,1249 **** @cindex Linux @cindex GNU/Linux ! @cindex BSD-based operating systems ! @cindex NetBSD ! @cindex FreeBSD ! @cindex OpenBSD Until the GNU operating system is more fully developed, you should consider using GNU/Linux, a freely distributable, Unix-like operating system for Intel 80386, DEC Alpha, Sun SPARC, IBM S/390, and other --- 1209,1216 ---- @cindex Linux @cindex GNU/Linux ! @cindex operating systems, BSD-based ! @cindex Alpha (DEC) Until the GNU operating system is more fully developed, you should consider using GNU/Linux, a freely distributable, Unix-like operating system for Intel 80386, DEC Alpha, Sun SPARC, IBM S/390, and other *************** *** 1260,1271 **** of @command{gawk} for their versions of @command{awk}.) @ifnotinfo ! The @value{DOCUMENT} you are reading now is actually free---at least, the ! information in it is free to anyone. The machine readable source code for the @value{DOCUMENT} comes with @command{gawk}; anyone may take this @value{DOCUMENT} to a copying machine and make as many ! copies of it as they like. (Take a moment to check the Free Documentation ! License; see @ref{GNU Free Documentation License}.) Although you could just print it out yourself, bound books are much easier to read and use. Furthermore, --- 1227,1238 ---- of @command{gawk} for their versions of @command{awk}.) @ifnotinfo ! The @value{DOCUMENT} you are reading is actually free---at least, the ! information in it is free to anyone. The machine-readable source code for the @value{DOCUMENT} comes with @command{gawk}; anyone may take this @value{DOCUMENT} to a copying machine and make as many ! copies as they like. (Take a moment to check the Free Documentation ! License in @ref{GNU Free Documentation License}.) Although you could just print it out yourself, bound books are much easier to read and use. Furthermore, *************** *** 1384,1390 **** @cindex Stallman, Richard I would like to acknowledge Richard M.@: Stallman, for his vision of a better world and for his courage in founding the FSF and starting the ! GNU project. The following people (in alphabetical order) provided helpful comments on various --- 1351,1357 ---- @cindex Stallman, Richard I would like to acknowledge Richard M.@: Stallman, for his vision of a better world and for his courage in founding the FSF and starting the ! GNU Project. The following people (in alphabetical order) provided helpful comments on various *************** *** 1394,1400 **** Karl Berry, Dr.@: Michael Brennan, Rich Burridge, ! Claire Coutier, Diane Close, Scott Deifik, Christopher (``Topher'') Eliot, --- 1361,1367 ---- Karl Berry, Dr.@: Michael Brennan, Rich Burridge, ! Claire Cloutier, Diane Close, Scott Deifik, Christopher (``Topher'') Eliot, *************** *** 1411,1417 **** @cindex Berry, Karl @cindex Chassell, Robert J.@: ! @cindex Texinfo Robert J.@: Chassell provided much valuable advice on the use of Texinfo. He also deserves special thanks for --- 1378,1384 ---- @cindex Berry, Karl @cindex Chassell, Robert J.@: ! @c @cindex Texinfo Robert J.@: Chassell provided much valuable advice on the use of Texinfo. He also deserves special thanks for *************** *** 1442,1455 **** --- 1409,1425 ---- @cindex Drepper, Ulrich @cindex GNITS mailing list + @cindex mailing list, GNITS The intrepid members of the GNITS mailing list, and most notably Ulrich Drepper, provided invaluable help and feedback for the design of the internationalization features. @cindex Beebe, Nelson @cindex Brown, Martin + @cindex Buening, Andreas @cindex Deifik, Scott @cindex Hankerson, Darrel + @cindex Hasegawa, Isamu @cindex Jaegermann, Michal @cindex Kahrs, J@"urgen @cindex Rankin, Pat *************** *** 1457,1471 **** @cindex Zaretskii, Eli Nelson Beebe, Martin Brown, Scott Deifik, Darrel Hankerson, Michal Jaegermann, J@"urgen Kahrs, Pat Rankin, Kai Uwe Rommel, and Eli Zaretskii (in alphabetical order) ! are long-time members of the @command{gawk} ``crack portability team.'' Without their hard work and help, @command{gawk} would not be nearly the fine program it is today. It has been and continues to be a pleasure working with this team of fine --- 1427,1443 ---- @cindex Zaretskii, Eli Nelson Beebe, Martin Brown, + Andreas Buening, Scott Deifik, Darrel Hankerson, + Isamu Hasegawa, Michal Jaegermann, J@"urgen Kahrs, Pat Rankin, Kai Uwe Rommel, and Eli Zaretskii (in alphabetical order) ! make up the @command{gawk} ``crack portability team.'' Without their hard work and help, @command{gawk} would not be nearly the fine program it is today. It has been and continues to be a pleasure working with this team of fine *************** *** 1487,1493 **** @cindex Robbins, Harry @cindex G-d I must thank my wonderful wife, Miriam, for her patience through ! the many versions of this project, for her proof-reading, and for sharing me with the computer. I would like to thank my parents for their love, and for the grace with which they raised and educated me. --- 1459,1465 ---- @cindex Robbins, Harry @cindex G-d I must thank my wonderful wife, Miriam, for her patience through ! the many versions of this project, for her proofreading, and for sharing me with the computer. I would like to thank my parents for their love, and for the grace with which they raised and educated me. *************** *** 1554,1563 **** @node Getting Started, Regexp, Preface, Top @chapter Getting Started with @command{awk} ! @cindex script, definition of ! @cindex rule, definition of ! @cindex program, definition of ! @cindex basic function of @command{awk} The basic function of @command{awk} is to search files for lines (or other units of text) that contain certain patterns. When a line matches one --- 1526,1536 ---- @node Getting Started, Regexp, Preface, Top @chapter Getting Started with @command{awk} ! @c @cindex script, definition of ! @c @cindex rule, definition of ! @c @cindex program, definition of ! @c @cindex basic function of @command{awk} ! @cindex @command{awk}, function of The basic function of @command{awk} is to search files for lines (or other units of text) that contain certain patterns. When a line matches one *************** *** 1565,1574 **** @command{awk} keeps processing input lines in this way until it reaches the end of the input files. ! @cindex data-driven languages ! @cindex procedural languages ! @cindex language, data-driven ! @cindex language, procedural Programs in @command{awk} are different from programs in most other languages, because @command{awk} programs are @dfn{data-driven}; that is, you describe the data you want to work with and then what to do when you find it. --- 1538,1547 ---- @command{awk} keeps processing input lines in this way until it reaches the end of the input files. ! @cindex @command{awk}, uses for ! @c comma here is NOT for secondary ! @cindex programming languages, data-driven vs. procedural ! @cindex @command{awk} programs Programs in @command{awk} are different from programs in most other languages, because @command{awk} programs are @dfn{data-driven}; that is, you describe the data you want to work with and then what to do when you find it. *************** *** 1577,1583 **** languages, it is usually much harder to clearly describe the data your program will process. For this reason, @command{awk} programs are often refreshingly easy to ! write and read. @cindex program, definition of @cindex rule, definition of --- 1550,1556 ---- languages, it is usually much harder to clearly describe the data your program will process. For this reason, @command{awk} programs are often refreshingly easy to ! read and write. @cindex program, definition of @cindex rule, definition of *************** *** 1619,1626 **** @node Running gawk, Sample Data Files, Getting Started, Getting Started @section How to Run @command{awk} Programs ! @cindex command-line formats ! @cindex running @command{awk} programs There are several ways to run an @command{awk} program. If the program is short, it is easiest to include it in the command that runs @command{awk}, like this: --- 1592,1598 ---- @node Running gawk, Sample Data Files, Getting Started, Getting Started @section How to Run @command{awk} Programs ! @cindex @command{awk} programs, running There are several ways to run an @command{awk} program. If the program is short, it is easiest to include it in the command that runs @command{awk}, like this: *************** *** 1629,1634 **** --- 1601,1607 ---- awk '@var{program}' @var{input-file1} @var{input-file2} @dots{} @end example + @cindex command line, formats When the program is long, it is usually more convenient to put it in a file and run it with a command like this: *************** *** 1640,1646 **** variations of each. @menu ! * One-shot:: Running a short throw-away @command{awk} program. * Read Terminal:: Using no input files (input from terminal instead). --- 1613,1619 ---- variations of each. @menu ! * One-shot:: Running a short throwaway @command{awk} program. * Read Terminal:: Using no input files (input from terminal instead). *************** *** 1653,1659 **** @end menu @node One-shot, Read Terminal, Running gawk, Running gawk ! @subsection One-Shot Throw-Away @command{awk} Programs Once you are familiar with @command{awk}, you will often type in simple programs the moment you want to use them. Then you can write the --- 1626,1632 ---- @end menu @node One-shot, Read Terminal, Running gawk, Running gawk ! @subsection One-Shot Throwaway @command{awk} Programs Once you are familiar with @command{awk}, you will often type in simple programs the moment you want to use them. Then you can write the *************** *** 1667,1673 **** where @var{program} consists of a series of @var{patterns} and @var{actions}, as described earlier. ! @cindex single quotes, why needed This command format instructs the @dfn{shell}, or command interpreter, to start @command{awk} and use the @var{program} to process records in the input file(s). There are single quotes around @var{program} so --- 1640,1647 ---- where @var{program} consists of a series of @var{patterns} and @var{actions}, as described earlier. ! @cindex single quote (@code{'}) ! @cindex @code{'} (single quote) This command format instructs the @dfn{shell}, or command interpreter, to start @command{awk} and use the @var{program} to process records in the input file(s). There are single quotes around @var{program} so *************** *** 1676,1681 **** --- 1650,1657 ---- a single argument for @command{awk}, and allow @var{program} to be more than one line long. + @cindex shells, scripts + @cindex @command{awk} programs, running, from shell scripts This format is also useful for running short or medium-sized @command{awk} programs from shell scripts, because it avoids the need for a separate file for the @command{awk} program. A self-contained shell script is more *************** *** 1710,1715 **** --- 1686,1692 ---- @cindex standard input @cindex input, standard + @cindex input files, running @command{awk} without You can also run @command{awk} without any input files. If you type the following command line: *************** *** 1720,1741 **** @noindent @command{awk} applies the @var{program} to the @dfn{standard input}, which usually means whatever you type on the terminal. This continues ! until you indicate end-of-file by typing @kbd{Ctrl-d}. (On other operating systems, the end-of-file character may be different. ! For example, on OS/2 and MS-DOS, it is @kbd{Ctrl-z}.) As an example, the following program prints a friendly piece of advice (from Douglas Adams's @cite{The Hitchhiker's Guide to the Galaxy}), ! to keep you from worrying about the complexities of computer programming. ! (@code{BEGIN} is a feature we haven't discussed yet.): @example $ awk "BEGIN @{ print \"Don't Panic!\" @}" @print{} Don't Panic! @end example ! @cindex quoting, shell ! @cindex shell quoting This program does not read any input. The @samp{\} before each of the inner double quotes is necessary because of the shell's quoting rules---in particular because it mixes both single quotes and --- 1697,1724 ---- @noindent @command{awk} applies the @var{program} to the @dfn{standard input}, which usually means whatever you type on the terminal. This continues ! until you indicate end-of-file by typing @kbd{@value{CTL}-d}. (On other operating systems, the end-of-file character may be different. ! For example, on OS/2 and MS-DOS, it is @kbd{@value{CTL}-z}.) + @cindex files, input, See input files + @cindex input files, running @command{awk} without + @cindex @command{awk} programs, running, without input files As an example, the following program prints a friendly piece of advice (from Douglas Adams's @cite{The Hitchhiker's Guide to the Galaxy}), ! to keep you from worrying about the complexities of computer programming ! (@code{BEGIN} is a feature we haven't discussed yet): @example $ awk "BEGIN @{ print \"Don't Panic!\" @}" @print{} Don't Panic! @end example ! @cindex quoting ! @cindex double quote (@code{"}) ! @cindex @code{"} (double quote) ! @cindex @code{\} (backslash) ! @cindex backslash (@code{\}) This program does not read any input. The @samp{\} before each of the inner double quotes is necessary because of the shell's quoting rules---in particular because it mixes both single quotes and *************** *** 1744,1751 **** put the single quote into the message.} This next simple @command{awk} program ! emulates the @command{cat} utility; it copies whatever you type at the ! keyboard to its standard output. (Why this works is explained shortly.) @example $ awk '@{ print @}' --- 1727,1734 ---- put the single quote into the message.} This next simple @command{awk} program ! emulates the @command{cat} utility; it copies whatever you type on the ! keyboard to its standard output (why this works is explained shortly). @example $ awk '@{ print @}' *************** *** 1757,1773 **** @print{} Four score and seven years ago, ... What, me worry? @print{} What, me worry? ! @kbd{Ctrl-d} @end example @node Long, Executable Scripts, Read Terminal, Running gawk @subsection Running Long Programs ! @cindex running long programs ! @cindex @code{-f} option ! @cindex command-line option, @code{-f} ! @cindex program file ! @cindex file, @command{awk} program Sometimes your @command{awk} programs can be very long. In this case, it is more convenient to put the program into a separate file. In order to tell @command{awk} to use that file for its program, you type: --- 1740,1754 ---- @print{} Four score and seven years ago, ... What, me worry? @print{} What, me worry? ! @kbd{@value{CTL}-d} @end example @node Long, Executable Scripts, Read Terminal, Running gawk @subsection Running Long Programs ! @cindex @command{awk} programs, running ! @cindex @command{awk} programs, lengthy ! @cindex files, @command{awk} programs in Sometimes your @command{awk} programs can be very long. In this case, it is more convenient to put the program into a separate file. In order to tell @command{awk} to use that file for its program, you type: *************** *** 1776,1781 **** --- 1757,1765 ---- awk -f @var{source-file} @var{input-file1} @var{input-file2} @dots{} @end example + @cindex @code{-f} option + @cindex command line, options + @cindex options, command-line The @option{-f} instructs the @command{awk} utility to get the @command{awk} program from the file @var{source-file}. Any @value{FN} can be used for @var{source-file}. For example, you could put the program: *************** *** 1798,1805 **** awk "BEGIN @{ print \"Don't Panic!\" @}" @end example ! @cindex quoting, shell ! @cindex shell quoting @noindent This was explained earlier (@pxref{Read Terminal, ,Running @command{awk} Without Input Files}). --- 1782,1788 ---- awk "BEGIN @{ print \"Don't Panic!\" @}" @end example ! @cindex quoting @noindent This was explained earlier (@pxref{Read Terminal, ,Running @command{awk} Without Input Files}). *************** *** 1809,1814 **** --- 1792,1801 ---- program did not have single quotes around it. The quotes are only needed for programs that are provided on the @command{awk} command line. + @c STARTOFRANGE sq1x + @cindex single quote (@code{'}) + @c STARTOFRANGE qs2x + @cindex @code{'} (single quote) If you want to identify your @command{awk} program files clearly as such, you can add the extension @file{.awk} to the @value{FN}. This doesn't affect the execution of the @command{awk} program but it does make *************** *** 1816,1826 **** @node Executable Scripts, Comments, Long, Running gawk @subsection Executable @command{awk} Programs ! @cindex executable scripts ! @cindex scripts, executable ! @cindex self-contained programs ! @cindex program, self-contained ! @cindex @code{#!} (executable scripts) Once you have learned @command{awk}, you may want to write self-contained @command{awk} scripts, using the @samp{#!} script mechanism. You can do --- 1803,1814 ---- @node Executable Scripts, Comments, Long, Running gawk @subsection Executable @command{awk} Programs ! @cindex @command{awk} programs ! @cindex @code{#} (number sign), @code{#!} (executable scripts) ! @cindex number sign (@code{#}), @code{#!} (executable scripts) ! @cindex Unix, @command{awk} scripts and ! @cindex @code{#} (number sign), @code{#!} (executable scripts), portability issues with ! @cindex number sign (@code{#}), @code{#!} (executable scripts), portability issues with Once you have learned @command{awk}, you may want to write self-contained @command{awk} scripts, using the @samp{#!} script mechanism. You can do *************** *** 1845,1851 **** interpreter. The operating system then runs the interpreter with the given argument and the full argument list of the executed program. The first argument in the list is the full @value{FN} of the @command{awk} program. The rest of the ! argument list is either options to @command{awk}, or @value{DF}s, or both.} as if you had typed @samp{awk -f advice}: --- 1833,1839 ---- interpreter. The operating system then runs the interpreter with the given argument and the full argument list of the executed program. The first argument in the list is the full @value{FN} of the @command{awk} program. The rest of the ! argument list contains either options to @command{awk}, or @value{DF}s, or both.} as if you had typed @samp{awk -f advice}: *************** *** 1862,1868 **** @c fakenode --- for prepinfo @subheading Advanced Notes: Portability Issues with @samp{#!} ! @cindex advanced notes Some systems limit the length of the interpreter name to 32 characters. Often, this can be dealt with by using a symbolic link. --- 1850,1856 ---- @c fakenode --- for prepinfo @subheading Advanced Notes: Portability Issues with @samp{#!} ! @cindex portability, @code{#!} (executable scripts) Some systems limit the length of the interpreter name to 32 characters. Often, this can be dealt with by using a symbolic link. *************** *** 1873,1879 **** Doing this leads to confusing behavior---most likely a usage diagnostic of some sort from @command{awk}. ! @cindex portability issues Finally, the value of @code{ARGV[0]} (@pxref{Built-in Variables}) --- 1861,1868 ---- Doing this leads to confusing behavior---most likely a usage diagnostic of some sort from @command{awk}. ! @cindex @code{ARGC}/@code{ARGV} variables, portability and ! @cindex portability, @code{ARGV} variable Finally, the value of @code{ARGV[0]} (@pxref{Built-in Variables}) *************** *** 1885,1895 **** @node Comments, Quoting, Executable Scripts, Running gawk @subsection Comments in @command{awk} Programs ! @cindex @code{#} (comment) ! @cindex comments ! @cindex use of comments ! @cindex documenting @command{awk} programs ! @cindex programs, documenting A @dfn{comment} is some text that is included in a program for the sake of human readers; it is not really an executable part of the program. Comments --- 1874,1883 ---- @node Comments, Quoting, Executable Scripts, Running gawk @subsection Comments in @command{awk} Programs ! @cindex @code{#} (number sign), commenting ! @cindex number sign (@code{#}), commenting ! @cindex commenting ! @cindex @command{awk} programs, documenting A @dfn{comment} is some text that is included in a program for the sake of human readers; it is not really an executable part of the program. Comments *************** *** 1909,1923 **** BEGIN @{ print "Don't Panic!" @} @end example ! You can put comment lines into keyboard-composed throw-away @command{awk} programs, but this usually isn't very useful; the purpose of a comment is to help you or another person understand the program when reading it at a later time. ! @cindex quoting, shell ! @cindex shell quoting @strong{Caution:} As mentioned in ! @ref{One-shot, ,One-Shot Throw-Away @command{awk} Programs}, you can enclose small to medium programs in single quotes, in order to keep your shell scripts self-contained. When doing so, @emph{don't} put an apostrophe (i.e., a single quote) into a comment (or anywhere else --- 1897,1912 ---- BEGIN @{ print "Don't Panic!" @} @end example ! You can put comment lines into keyboard-composed throwaway @command{awk} programs, but this usually isn't very useful; the purpose of a comment is to help you or another person understand the program when reading it at a later time. ! @cindex quoting ! @cindex single quote (@code{'}), vs. apostrophe ! @cindex @code{'} (single quote), vs. apostrophe @strong{Caution:} As mentioned in ! @ref{One-shot, ,One-Shot Throwaway @command{awk} Programs}, you can enclose small to medium programs in single quotes, in order to keep your shell scripts self-contained. When doing so, @emph{don't} put an apostrophe (i.e., a single quote) into a comment (or anywhere else *************** *** 1933,1939 **** @end example The shell sees that the first two quotes match, and that ! a new quoted object begins at the end of the command-line. It therefore prompts with the secondary prompt, waiting for more input. With Unix @command{awk}, closing the quoted string produces this result: --- 1922,1928 ---- @end example The shell sees that the first two quotes match, and that ! a new quoted object begins at the end of the command line. It therefore prompts with the secondary prompt, waiting for more input. With Unix @command{awk}, closing the quoted string produces this result: *************** *** 1944,1959 **** @error{} source line number 1 @end example Putting a backslash before the single quote in @samp{let's} wouldn't help, since backslashes are not special inside single quotes. The next @value{SUBSECTION} describes the shell's quoting rules. @node Quoting, , Comments, Running gawk ! @subsection Shell Quoting Issues ! @c the indexing here is purposely different, until we ! @c get a way to mark the defining instance for an index entry ! @cindex quoting rules, shell ! @cindex shell quoting rules For short to medium length @command{awk} programs, it is most convenient to enter the program on the @command{awk} command line. --- 1933,1947 ---- @error{} source line number 1 @end example + @cindex @code{\} (backslash) + @cindex backslash (@code{\}) Putting a backslash before the single quote in @samp{let's} wouldn't help, since backslashes are not special inside single quotes. The next @value{SUBSECTION} describes the shell's quoting rules. @node Quoting, , Comments, Running gawk ! @subsection Shell-Quoting Issues ! @cindex quoting, rules for For short to medium length @command{awk} programs, it is most convenient to enter the program on the @command{awk} command line. *************** *** 1965,1971 **** awk '@var{program text}' @var{input-file1} @var{input-file2} @dots{} @end example ! @cindex @command{csh} utility Once you are working with the shell, it is helpful to have a basic knowledge of shell quoting rules. The following rules apply only to POSIX-compliant, Bourne-style shells (such as @command{bash}, the GNU Bourne-Again --- 1953,1960 ---- awk '@var{program text}' @var{input-file1} @var{input-file2} @dots{} @end example ! @cindex shells, quoting, rules for ! @cindex Bourne shell, quoting rules for Once you are working with the shell, it is helpful to have a basic knowledge of shell quoting rules. The following rules apply only to POSIX-compliant, Bourne-style shells (such as @command{bash}, the GNU Bourne-Again *************** *** 1983,2004 **** character on to the command. @item Single quotes protect everything between the opening and closing quotes. The shell does no interpretation of the quoted text, passing it on verbatim to the command. It is @emph{impossible} to embed a single quote inside single-quoted text. Refer back to @ref{Comments, ,Comments in @command{awk} Programs}, ! for an example showing what happens if you try. @item Double quotes protect most things between the opening and closing quotes. The shell does at least variable and command substitution on the quoted text. Different shells may do additional kinds of processing on double-quoted text. Since certain characters within double-quoted text are processed by the shell, they must be @dfn{escaped} within the text. Of note are the characters ! @samp{$}, @samp{`}, @samp{\} and @samp{"}, all of which must be preceded by a backslash within double-quoted text if they are to be passed on literally to the program. (The leading backslash is stripped first.) Thus, the example seen --- 1972,1999 ---- character on to the command. @item + @cindex @code{\} (backslash) + @cindex backslash (@code{\}) + @cindex single quote (@code{'}) + @cindex @code{'} (single quote) Single quotes protect everything between the opening and closing quotes. The shell does no interpretation of the quoted text, passing it on verbatim to the command. It is @emph{impossible} to embed a single quote inside single-quoted text. Refer back to @ref{Comments, ,Comments in @command{awk} Programs}, ! for an example of what happens if you try. @item + @cindex double quote (@code{"}) + @cindex @code{"} (double quote) Double quotes protect most things between the opening and closing quotes. The shell does at least variable and command substitution on the quoted text. Different shells may do additional kinds of processing on double-quoted text. Since certain characters within double-quoted text are processed by the shell, they must be @dfn{escaped} within the text. Of note are the characters ! @samp{$}, @samp{`}, @samp{\}, and @samp{"}, all of which must be preceded by a backslash within double-quoted text if they are to be passed on literally to the program. (The leading backslash is stripped first.) Thus, the example seen *************** *** 2013,2018 **** --- 2008,2015 ---- @print{} Don't Panic! @end example + @cindex single quote (@code{'}), with double quotes + @cindex @code{'} (single quote), with double quotes Note that the single quote is not special within double quotes. @item *************** *** 2026,2031 **** --- 2023,2029 ---- @end example @noindent + @cindex null strings, quoting and Don't use this: @example *************** *** 2038,2044 **** This results in syntax errors at best, and confusing behavior at worst. @end itemize ! @cindex shell quoting, tricks Mixing single and double quotes is difficult. You have to resort to shell quoting tricks, like this: --- 2036,2042 ---- This results in syntax errors at best, and confusing behavior at worst. @end itemize ! @cindex quoting, tricks for Mixing single and double quotes is difficult. You have to resort to shell quoting tricks, like this: *************** *** 2070,2075 **** --- 2068,2075 ---- @end example @noindent + @c ENDOFRANGE sq1x + @c ENDOFRANGE qs2x This option is also painful, because double quotes, backslashes, and dollar signs are very common in @command{awk} programs. *************** *** 2081,2097 **** @section @value{DDF}s for the Examples @c For gawk >= 3.2, update these data files. No-one has such slow modems! ! @cindex input file, sample ! @cindex sample input files ! @cindex @file{BBS-list} file Many of the examples in this @value{DOCUMENT} take their input from two sample ! @value{DF}s. The first, called @file{BBS-list}, represents a list of computer bulletin board systems together with information about those systems. The second @value{DF}, called @file{inventory-shipped}, contains information about monthly shipments. In both files, each line is considered to be one @dfn{record}. ! In the file @file{BBS-list}, each record contains the name of a computer bulletin board, its phone number, the board's baud rate(s), and a code for the number of hours it is operational. An @samp{A} in the last column means the board operates 24 hours a day. A @samp{B} in the last --- 2081,2096 ---- @section @value{DDF}s for the Examples @c For gawk >= 3.2, update these data files. No-one has such slow modems! ! @cindex input files, examples ! @cindex @code{BBS-list} file Many of the examples in this @value{DOCUMENT} take their input from two sample ! @value{DF}s. The first, @file{BBS-list}, represents a list of computer bulletin board systems together with information about those systems. The second @value{DF}, called @file{inventory-shipped}, contains information about monthly shipments. In both files, each line is considered to be one @dfn{record}. ! In the @value{DF} @file{BBS-list}, each record contains the name of a computer bulletin board, its phone number, the board's baud rate(s), and a code for the number of hours it is operational. An @samp{A} in the last column means the board operates 24 hours a day. A @samp{B} in the last *************** *** 2120,2127 **** @c endfile @end example ! @cindex @file{inventory-shipped} file ! The second @value{DF}, called @file{inventory-shipped}, represents information about shipments during the year. Each record contains the month, the number of green crates shipped, the number of red boxes shipped, the number of --- 2119,2126 ---- @c endfile @end example ! @cindex @code{inventory-shipped} file ! The @value{DF} @file{inventory-shipped} represents information about shipments during the year. Each record contains the month, the number of green crates shipped, the number of red boxes shipped, the number of *************** *** 2173,2182 **** @section Some Simple Examples The following command runs a simple @command{awk} program that searches the ! input file @file{BBS-list} for the character string @samp{foo}. (A ! string of characters is usually called a @dfn{string}. ! The term @dfn{string} is based on similar usage in English, such ! as ``a string of pearls,'' or, ``a string of cars in a train.''): @example awk '/foo/ @{ print $0 @}' BBS-list --- 2172,2181 ---- @section Some Simple Examples The following command runs a simple @command{awk} program that searches the ! input file @file{BBS-list} for the character string @samp{foo} (a ! grouping of characters is usually called a @dfn{string}; ! the term @dfn{string} is based on similar usage in English, such ! as ``a string of pearls,'' or ``a string of cars in a train''): @example awk '/foo/ @{ print $0 @}' BBS-list *************** *** 2208,2231 **** @print{} sabafoo 555-2127 1200/300 C @end example ! @cindex action, default ! @cindex pattern, default ! @cindex default action ! @cindex default pattern In an @command{awk} rule, either the pattern or the action can be omitted, but not both. If the pattern is omitted, then the action is performed for @emph{every} input line. If the action is omitted, the default action is to print all lines that match the pattern. ! @cindex empty action ! @cindex action, empty Thus, we could leave out the action (the @code{print} statement and the curly ! braces) in the above example and the result would be the same: all lines matching the pattern @samp{foo} are printed. By comparison, omitting the @code{print} statement but retaining the curly braces makes an empty action that does nothing (i.e., no lines are printed). ! @cindex one-liners Many practical @command{awk} programs are just a line or two. Following is a collection of useful, short programs to get you started. Some of these programs contain constructs that haven't been covered yet. (The description --- 2207,2227 ---- @print{} sabafoo 555-2127 1200/300 C @end example ! @cindex actions, default ! @cindex patterns, default In an @command{awk} rule, either the pattern or the action can be omitted, but not both. If the pattern is omitted, then the action is performed for @emph{every} input line. If the action is omitted, the default action is to print all lines that match the pattern. ! @cindex actions, empty Thus, we could leave out the action (the @code{print} statement and the curly ! braces) in the previous example and the result would be the same: all lines matching the pattern @samp{foo} are printed. By comparison, omitting the @code{print} statement but retaining the curly braces makes an empty action that does nothing (i.e., no lines are printed). ! @cindex @command{awk} programs, one-line examples Many practical @command{awk} programs are just a line or two. Following is a collection of useful, short programs to get you started. Some of these programs contain constructs that haven't been covered yet. (The description *************** *** 2314,2320 **** @end example @item ! Count lines in a file: @example awk 'END @{ print NR @}' data --- 2310,2316 ---- @end example @item ! Count the lines in a file: @example awk 'END @{ print NR @}' data *************** *** 2328,2339 **** @end example If you use the expression @samp{NR % 2 == 1} instead, ! it would print the odd-numbered lines. @end itemize @node Two Rules, More Complex, Very Simple, Getting Started @section An Example with Two Rules ! @cindex how @command{awk} works The @command{awk} utility reads the input files one line at a time. For each line, @command{awk} tries the patterns of each of the rules. --- 2324,2335 ---- @end example If you use the expression @samp{NR % 2 == 1} instead, ! the program would print the odd-numbered lines. @end itemize @node Two Rules, More Complex, Very Simple, Getting Started @section An Example with Two Rules ! @cindex @command{awk} programs The @command{awk} utility reads the input files one line at a time. For each line, @command{awk} tries the patterns of each of the rules. *************** *** 2345,2351 **** @command{awk} reads the next line. (However, @pxref{Next Statement, ,The @code{next} Statement}, and also @pxref{Nextfile Statement, ,Using @command{gawk}'s @code{nextfile} Statement}). ! This continues until the end of the file is reached. For example, the following @command{awk} program contains two rules: @example --- 2341,2347 ---- @command{awk} reads the next line. (However, @pxref{Next Statement, ,The @code{next} Statement}, and also @pxref{Nextfile Statement, ,Using @command{gawk}'s @code{nextfile} Statement}). ! This continues until the program reaches the end of the file. For example, the following @command{awk} program contains two rules: @example *************** *** 2364,2370 **** strings, it is printed twice, once by each rule. This is what happens if we run this program on our two sample @value{DF}s, ! @file{BBS-list} and @file{inventory-shipped}, as shown here: @example $ awk '/12/ @{ print $0 @} --- 2360,2366 ---- strings, it is printed twice, once by each rule. This is what happens if we run this program on our two sample @value{DF}s, ! @file{BBS-list} and @file{inventory-shipped}: @example $ awk '/12/ @{ print $0 @} *************** *** 2403,2418 **** END @{ print sum @}' @end example ! @cindex @command{csh} utility ! @cindex @command{csh}, backslash continuation ! @cindex backslash continuation, in @command{csh} @cindex @command{ls} utility This command prints the total number of bytes in all the files in the current directory that were last modified in November (of any year). @footnote{In the C shell (@command{csh}), you need to type a semicolon and then a backslash at the end of the first line; see @ref{Statements/Lines, ,@command{awk} Statements Versus Lines}, for an ! explanation as to why. In a POSIX-compliant shell, such as the Bourne shell or @command{bash}, you can type the example as shown. If the command @samp{echo $path} produces an empty output line, you are most likely using a POSIX-compliant shell. Otherwise, you are probably using the --- 2399,2414 ---- END @{ print sum @}' @end example ! @cindex @command{csh} utility, backslash continuation and @cindex @command{ls} utility + @cindex backslash (@code{\}), continuing lines and, in @command{csh} + @cindex @code{\} (backslash), continuing lines and, in @command{csh} This command prints the total number of bytes in all the files in the current directory that were last modified in November (of any year). @footnote{In the C shell (@command{csh}), you need to type a semicolon and then a backslash at the end of the first line; see @ref{Statements/Lines, ,@command{awk} Statements Versus Lines}, for an ! explanation. In a POSIX-compliant shell, such as the Bourne shell or @command{bash}, you can type the example as shown. If the command @samp{echo $path} produces an empty output line, you are most likely using a POSIX-compliant shell. Otherwise, you are probably using the *************** *** 2433,2448 **** @end example @noindent The first field contains read-write permissions, the second field contains the number of links to the file, and the third field identifies the owner of the file. The fourth field identifies the group of the file. The fifth field contains the size of the file in bytes. The ! sixth, seventh and eighth fields contain the month, day, and time, respectively, that the file was last modified. Finally, the ninth field contains the name of the file.@footnote{On some very old systems, you may need to use @samp{ls -lg} to get this output.} ! @cindex automatic initialization @cindex initialization, automatic The @samp{$6 == "Nov"} in our @command{awk} program is an expression that tests whether the sixth field of the output from @w{@samp{ls -l}} --- 2429,2445 ---- @end example @noindent + @cindex line continuations, with C shell The first field contains read-write permissions, the second field contains the number of links to the file, and the third field identifies the owner of the file. The fourth field identifies the group of the file. The fifth field contains the size of the file in bytes. The ! sixth, seventh, and eighth fields contain the month, day, and time, respectively, that the file was last modified. Finally, the ninth field contains the name of the file.@footnote{On some very old systems, you may need to use @samp{ls -lg} to get this output.} ! @c @cindex automatic initialization @cindex initialization, automatic The @samp{$6 == "Nov"} in our @command{awk} program is an expression that tests whether the sixth field of the output from @w{@samp{ls -l}} *************** *** 2462,2474 **** (@pxref{Action Overview, ,Actions}). Before you can move on to more advanced @command{awk} programming, you have to know how @command{awk} interprets your input and displays your output. By manipulating fields and using ! @code{print} statements, you can produce some very useful and impressive ! looking reports. @node Statements/Lines, Other Features, More Complex, Getting Started @section @command{awk} Statements Versus Lines ! @cindex line break ! @cindex newline Most often, each line in an @command{awk} program is a separate statement or separate rule, like this: --- 2459,2471 ---- (@pxref{Action Overview, ,Actions}). Before you can move on to more advanced @command{awk} programming, you have to know how @command{awk} interprets your input and displays your output. By manipulating fields and using ! @code{print} statements, you can produce some very useful and ! impressive-looking reports. @node Statements/Lines, Other Features, More Complex, Getting Started @section @command{awk} Statements Versus Lines ! @cindex line breaks ! @cindex newlines Most often, each line in an @command{awk} program is a separate statement or separate rule, like this: *************** *** 2478,2483 **** --- 2475,2481 ---- /21/ @{ print $0 @}' BBS-list inventory-shipped @end example + @cindex @command{gawk}, newlines in However, @command{gawk} ignores newlines after any of the following symbols and keywords: *************** *** 2494,2502 **** extension; if @option{--posix} is specified (@pxref{Options, , Command-Line Options}), then this extension is disabled.} ! @cindex backslash continuation ! @cindex continuation of lines ! @cindex line continuation If you would like to split a single statement into two lines at a point where a newline would terminate it, you can @dfn{continue} it by ending the first line with a backslash character (@samp{\}). The backslash must be --- 2492,2499 ---- extension; if @option{--posix} is specified (@pxref{Options, , Command-Line Options}), then this extension is disabled.} ! @cindex @code{\} (backslash), continuing lines and ! @cindex backslash (@code{\}), continuing lines and If you would like to split a single statement into two lines at a point where a newline would terminate it, you can @dfn{continue} it by ending the first line with a backslash character (@samp{\}). The backslash must be *************** *** 2510,2516 **** @end example @noindent ! @cindex portability issues We have generally not used backslash continuation in the sample programs in this @value{DOCUMENT}. In @command{gawk}, there is no limit on the length of a line, so backslash continuation is never strictly necessary; --- 2507,2513 ---- @end example @noindent ! @cindex portability, backslash continuation and We have generally not used backslash continuation in the sample programs in this @value{DOCUMENT}. In @command{gawk}, there is no limit on the length of a line, so backslash continuation is never strictly necessary; *************** *** 2528,2537 **** @c solaris 2.7 nawk does not. Solaris /usr/xpg4/bin/awk does though! sigh. @cindex @command{csh} utility ! @cindex @command{csh}, backslash continuation ! @cindex backslash continuation, in @command{csh} @strong{Caution:} @emph{Backslash continuation does not work as described ! above with the C shell.} It works for @command{awk} programs in files and for one-shot programs, @emph{provided} you are using a POSIX-compliant shell, such as the Unix Bourne shell or @command{bash}. But the C shell behaves differently! There, you must use two backslashes in a row, followed by --- 2525,2534 ---- @c solaris 2.7 nawk does not. Solaris /usr/xpg4/bin/awk does though! sigh. @cindex @command{csh} utility ! @cindex backslash (@code{\}), continuing lines and, in @command{csh} ! @cindex @code{\} (backslash), continuing lines and, in @command{csh} @strong{Caution:} @emph{Backslash continuation does not work as described ! with the C shell.} It works for @command{awk} programs in files and for one-shot programs, @emph{provided} you are using a POSIX-compliant shell, such as the Unix Bourne shell or @command{bash}. But the C shell behaves differently! There, you must use two backslashes in a row, followed by *************** *** 2563,2572 **** @command{awk} is a line-oriented language. Each rule's action has to begin on the same line as the pattern. To have the pattern and action on separate lines, you @emph{must} use backslash continuation; there ! is no other way. ! @cindex backslash continuation, and comments ! @cindex comments and backslash continuation Another thing to keep in mind is that backslash continuation and comments do not mix. As soon as @command{awk} sees the @samp{#} that starts a comment, it ignores @emph{everything} on the rest of the --- 2560,2570 ---- @command{awk} is a line-oriented language. Each rule's action has to begin on the same line as the pattern. To have the pattern and action on separate lines, you @emph{must} use backslash continuation; there ! is no other option. ! @cindex backslash (@code{\}), continuing lines and, comments and ! @cindex @code{\} (backslash), continuing lines and, comments and ! @cindex commenting, backslash continuation and Another thing to keep in mind is that backslash continuation and comments do not mix. As soon as @command{awk} sees the @samp{#} that starts a comment, it ignores @emph{everything} on the rest of the *************** *** 2586,2592 **** noticed because it is ``hidden'' inside the comment. Thus, the @code{BEGIN} is noted as a syntax error. ! @cindex multiple statements on one line When @command{awk} statements within one rule are short, you might want to put more than one of them on a line. This is accomplished by separating the statements with a semicolon (@samp{;}). --- 2584,2592 ---- noticed because it is ``hidden'' inside the comment. Thus, the @code{BEGIN} is noted as a syntax error. ! @cindex statements, multiple ! @cindex @code{;} (semicolon) ! @cindex semicolon (@code{;}) When @command{awk} statements within one rule are short, you might want to put more than one of them on a line. This is accomplished by separating the statements with a semicolon (@samp{;}). *************** *** 2607,2619 **** @node Other Features, When, Statements/Lines, Getting Started @section Other Features of @command{awk} The @command{awk} language provides a number of predefined, or @dfn{built-in}, variables that your programs can use to get information from @command{awk}. There are other variables your program can set as well to control how @command{awk} processes your data. In addition, @command{awk} provides a number of built-in functions for doing ! common computational and string related operations. @command{gawk} provides built-in functions for working with timestamps, performing bit manipulation, and for runtime string translation. --- 2607,2620 ---- @node Other Features, When, Statements/Lines, Getting Started @section Other Features of @command{awk} + @cindex variables The @command{awk} language provides a number of predefined, or @dfn{built-in}, variables that your programs can use to get information from @command{awk}. There are other variables your program can set as well to control how @command{awk} processes your data. In addition, @command{awk} provides a number of built-in functions for doing ! common computational and string-related operations. @command{gawk} provides built-in functions for working with timestamps, performing bit manipulation, and for runtime string translation. *************** *** 2625,2632 **** @node When, , Other Features, Getting Started @section When to Use @command{awk} ! @cindex uses of @command{awk} ! @cindex applications of @command{awk} Now that you've seen some of what @command{awk} can do, you might wonder how @command{awk} could be useful for you. By using utility programs, advanced patterns, field separators, arithmetic --- 2626,2632 ---- @node When, , Other Features, Getting Started @section When to Use @command{awk} ! @cindex @command{awk}, uses for Now that you've seen some of what @command{awk} can do, you might wonder how @command{awk} could be useful for you. By using utility programs, advanced patterns, field separators, arithmetic *************** *** 2645,2654 **** Complex programs have been written in @command{awk}, including a complete retargetable assembler for eight-bit microprocessors (@pxref{Glossary}, for ! more information), and a microcode assembler for a special purpose Prolog computer. However, @command{awk}'s capabilities are strained by tasks of such complexity. If you find yourself writing @command{awk} scripts of more than, say, a few hundred lines, you might consider using a different programming language. Emacs Lisp is a good choice if you need sophisticated string --- 2645,2655 ---- Complex programs have been written in @command{awk}, including a complete retargetable assembler for eight-bit microprocessors (@pxref{Glossary}, for ! more information), and a microcode assembler for a special-purpose Prolog computer. However, @command{awk}'s capabilities are strained by tasks of such complexity. + @cindex @command{awk} programs, complex If you find yourself writing @command{awk} scripts of more than, say, a few hundred lines, you might consider using a different programming language. Emacs Lisp is a good choice if you need sophisticated string *************** *** 2662,2677 **** @node Regexp, Reading Files, Getting Started, Top @chapter Regular Expressions ! @cindex pattern, regular expressions ! @cindex regexp ! @cindex regular expression ! @cindex regular expressions as patterns A @dfn{regular expression}, or @dfn{regexp}, is a way of describing a set of strings. Because regular expressions are such a fundamental part of @command{awk} programming, their format and use deserve a separate @value{CHAPTER}. A regular expression enclosed in slashes (@samp{/}) is an @command{awk} pattern that matches every input record whose text belongs to that set. --- 2663,2679 ---- @node Regexp, Reading Files, Getting Started, Top @chapter Regular Expressions ! @cindex regexp, See regular expressions ! @c STARTOFRANGE regexp ! @cindex regular expressions A @dfn{regular expression}, or @dfn{regexp}, is a way of describing a set of strings. Because regular expressions are such a fundamental part of @command{awk} programming, their format and use deserve a separate @value{CHAPTER}. + @cindex forward slash (@code{/}) + @cindex @code{/} (forward slash) A regular expression enclosed in slashes (@samp{/}) is an @command{awk} pattern that matches every input record whose text belongs to that set. *************** *** 2690,2696 **** @menu * Regexp Usage:: How to Use Regular Expressions. ! * Escape Sequences:: How to write non-printing characters. * Regexp Operators:: Regular Expression Operators. * Character Lists:: What can go between @samp{[...]}. * GNU Regexp Operators:: Operators specific to GNU software. --- 2692,2698 ---- @menu * Regexp Usage:: How to Use Regular Expressions. ! * Escape Sequences:: How to write nonprinting characters. * Regexp Operators:: Regular Expression Operators. * Character Lists:: What can go between @samp{[...]}. * GNU Regexp Operators:: Operators specific to GNU software. *************** *** 2702,2707 **** --- 2704,2710 ---- @node Regexp Usage, Escape Sequences, Regexp, Regexp @section How to Use Regular Expressions + @cindex regular expressions, as patterns A regular expression can be used as a pattern by enclosing it in slashes. Then the regular expression is tested against the entire text of each record. (Normally, it only needs *************** *** 2717,2728 **** @print{} 555-2127 @end example ! @cindex regexp operators ! @cindex string-matching operators @cindex operators, string-matching ! @cindex operators, regexp matching ! @cindex @code{~} operator ! @cindex @code{!~} operator Regular expressions can also be used in matching expressions. These expressions allow you to specify the string to match against; it need not be the entire current input record. The two operators @samp{~} --- 2720,2740 ---- @print{} 555-2127 @end example ! @cindex regular expressions, operators @cindex operators, string-matching ! @c @cindex operators, @code{~} ! @cindex string-matching operators ! @code{~} (tilde), @code{~} operator ! @cindex tilde (@code{~}), @code{~} operator ! @cindex @code{!} (exclamation point), @code{!~} operator ! @cindex exclamation point (@code{!}), @code{!~} operator ! @c @cindex operators, @code{!~} ! @cindex @code{if} statement ! @cindex @code{while} statement ! @cindex @code{do}-@code{while} statement ! @c @cindex statements, @code{if} ! @c @cindex statements, @code{while} ! @c @cindex statements, @code{do} Regular expressions can also be used in matching expressions. These expressions allow you to specify the string to match against; it need not be the entire current input record. The two operators @samp{~} *************** *** 2777,2783 **** @dots{} @end example ! @cindex regexp constant When a regexp is enclosed in slashes, such as @code{/foo/}, we call it a @dfn{regexp constant}, much like @code{5.27} is a numeric constant and @code{"foo"} is a string constant. --- 2789,2796 ---- @dots{} @end example ! @cindex regexp constants ! @cindex regular expressions, constants, See regexp constants When a regexp is enclosed in slashes, such as @code{/foo/}, we call it a @dfn{regexp constant}, much like @code{5.27} is a numeric constant and @code{"foo"} is a string constant. *************** *** 2785,2798 **** @node Escape Sequences, Regexp Operators, Regexp Usage, Regexp @section Escape Sequences ! @cindex escape sequence notation Some characters cannot be included literally in string constants (@code{"foo"}) or regexp constants (@code{/foo/}). Instead, they should be represented with @dfn{escape sequences}, which are character sequences beginning with a backslash (@samp{\}). ! One use of an escape sequence is to include a double quote character in a string constant. Because a plain double quote ends the string, you ! must use @samp{\"} to represent an actual double quote character as a part of the string. For example: @example --- 2798,2813 ---- @node Escape Sequences, Regexp Operators, Regexp Usage, Regexp @section Escape Sequences ! @cindex escape sequences ! @cindex backslash (@code{\}), in escape sequences ! @cindex @code{\} (backslash), in escape sequences Some characters cannot be included literally in string constants (@code{"foo"}) or regexp constants (@code{/foo/}). Instead, they should be represented with @dfn{escape sequences}, which are character sequences beginning with a backslash (@samp{\}). ! One use of an escape sequence is to include a double-quote character in a string constant. Because a plain double quote ends the string, you ! must use @samp{\"} to represent an actual double-quote character as a part of the string. For example: @example *************** *** 2805,2812 **** string or regexp. Thus, the string whose contents are the two characters @samp{"} and @samp{\} must be written @code{"\"\\"}. ! Another use of backslash is to represent unprintable characters ! such as tab or newline. While there is nothing to stop you from entering most unprintable characters directly in a string constant or regexp constant, they may look ugly. --- 2820,2827 ---- string or regexp. Thus, the string whose contents are the two characters @samp{"} and @samp{\} must be written @code{"\"\\"}. ! Backslash also represents unprintable characters ! such as TAB or newline. While there is nothing to stop you from entering most unprintable characters directly in a string constant or regexp constant, they may look ugly. *************** *** 2819,2875 **** @item \\ A literal backslash, @samp{\}. ! @cindex @command{awk} language, V.4 version ! @cindex @code{\a} escape sequence @item \a ! The ``alert'' character, @kbd{Ctrl-g}, ASCII code 7 (BEL). (This usually makes some sort of audible noise.) ! @cindex @code{\b} escape sequence @item \b ! Backspace, @kbd{Ctrl-h}, ASCII code 8 (BS). ! @cindex @code{\f} escape sequence @item \f ! Formfeed, @kbd{Ctrl-l}, ASCII code 12 (FF). ! @cindex @code{\n} escape sequence @item \n ! Newline, @kbd{Ctrl-j}, ASCII code 10 (LF). ! @cindex @code{\r} escape sequence @item \r ! Carriage return, @kbd{Ctrl-m}, ASCII code 13 (CR). ! @cindex @code{\t} escape sequence @item \t ! Horizontal tab, @kbd{Ctrl-i}, ASCII code 9 (HT). ! @cindex @command{awk} language, V.4 version ! @cindex @code{\v} escape sequence @item \v ! Vertical tab, @kbd{Ctrl-k}, ASCII code 11 (VT). ! @cindex @code{\}@var{nnn} escape sequence (octal) @item \@var{nnn} The octal value @var{nnn}, where @var{nnn} stands for 1 to 3 digits between @samp{0} and @samp{7}. For example, the code for the ASCII ESC (escape) character is @samp{\033}. ! @cindex @code{\x} escape sequence ! @cindex @command{awk} language, V.4 version ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} @item \x@var{hh}@dots{} The hexadecimal value @var{hh}, where @var{hh} stands for a sequence ! of hexadecimal digits (@samp{0} through @samp{9}, and either @samp{A} ! through @samp{F} or @samp{a} through @samp{f}). Like the same construct ! in ISO C, the escape sequence continues until the first non-hexadecimal digit is seen. However, using more than two hexadecimal digits produces undefined results. (The @samp{\x} escape sequence is not allowed in POSIX @command{awk}.) ! @cindex @code{\/} escape sequence @item \/ A literal slash (necessary for regexp constants only). This expression is used when you want to write a regexp --- 2834,2899 ---- @item \\ A literal backslash, @samp{\}. ! @c @cindex @command{awk} language, V.4 version ! @cindex @code{\} (backslash), @code{\a} escape sequence ! @cindex backslash (@code{\}), @code{\a} escape sequence @item \a ! The ``alert'' character, @kbd{@value{CTL}-g}, ASCII code 7 (BEL). (This usually makes some sort of audible noise.) ! @cindex @code{\} (backslash), @code{\b} escape sequence ! @cindex backslash (@code{\}), @code{\b} escape sequence @item \b ! Backspace, @kbd{@value{CTL}-h}, ASCII code 8 (BS). ! @cindex @code{\} (backslash), @code{\f} escape sequence ! @cindex backslash (@code{\}), @code{\f} escape sequence @item \f ! Formfeed, @kbd{@value{CTL}-l}, ASCII code 12 (FF). ! @cindex @code{\} (backslash), @code{\n} escape sequence ! @cindex backslash (@code{\}), @code{\n} escape sequence @item \n ! Newline, @kbd{@value{CTL}-j}, ASCII code 10 (LF). ! @cindex @code{\} (backslash), @code{\r} escape sequence ! @cindex backslash (@code{\}), @code{\r} escape sequence @item \r ! Carriage return, @kbd{@value{CTL}-m}, ASCII code 13 (CR). ! @cindex @code{\} (backslash), @code{\t} escape sequence ! @cindex backslash (@code{\}), @code{\t} escape sequence @item \t ! Horizontal TAB, @kbd{@value{CTL}-i}, ASCII code 9 (HT). ! @c @cindex @command{awk} language, V.4 version ! @cindex @code{\} (backslash), @code{\v} escape sequence ! @cindex backslash (@code{\}), @code{\v} escape sequence @item \v ! Vertical tab, @kbd{@value{CTL}-k}, ASCII code 11 (VT). ! @cindex @code{\} (backslash), @code{\}@var{nnn} escape sequence ! @cindex backslash (@code{\}), @code{\}@var{nnn} escape sequence @item \@var{nnn} The octal value @var{nnn}, where @var{nnn} stands for 1 to 3 digits between @samp{0} and @samp{7}. For example, the code for the ASCII ESC (escape) character is @samp{\033}. ! @c @cindex @command{awk} language, V.4 version ! @c @cindex @command{awk} language, POSIX version ! @cindex @code{\} (backslash), @code{\x} escape sequence ! @cindex backslash (@code{\}), @code{\x} escape sequence @item \x@var{hh}@dots{} The hexadecimal value @var{hh}, where @var{hh} stands for a sequence ! of hexadecimal digits (@samp{0}--@samp{9}, and either @samp{A}--@samp{F} ! or @samp{a}--@samp{f}). Like the same construct ! in ISO C, the escape sequence continues until the first nonhexadecimal digit is seen. However, using more than two hexadecimal digits produces undefined results. (The @samp{\x} escape sequence is not allowed in POSIX @command{awk}.) ! @cindex @code{\} (backslash), @code{\/} escape sequence ! @cindex backslash (@code{\}), @code{\/} escape sequence @item \/ A literal slash (necessary for regexp constants only). This expression is used when you want to write a regexp *************** *** 2877,2883 **** slashes, you need to escape the slash that is part of the pattern, in order to tell @command{awk} to keep processing the rest of the regexp. ! @cindex @code{\"} escape sequence @item \" A literal double quote (necessary for string constants only). This expression is used when you want to write a string --- 2901,2908 ---- slashes, you need to escape the slash that is part of the pattern, in order to tell @command{awk} to keep processing the rest of the regexp. ! @cindex @code{\} (backslash), @code{\"} escape sequence ! @cindex backslash (@code{\}), @code{\"} escape sequence @item \" A literal double quote (necessary for string constants only). This expression is used when you want to write a string *************** *** 2890,2905 **** with a backslash have special meaning in regexps. @xref{GNU Regexp Operators, ,@command{gawk}-Specific Regexp Operators}. ! In a regexp, a backslash before any character that is not in the above table and not listed in @ref{GNU Regexp Operators, ,@command{gawk}-Specific Regexp Operators}, means that the next character should be taken literally, even if it would normally be a regexp operator. For example, @code{/a\+b/} matches the three characters @samp{a+b}. ! @cindex portability issues For complete portability, do not use a backslash before any character not ! shown in the table above. To summarize: --- 2915,2932 ---- with a backslash have special meaning in regexps. @xref{GNU Regexp Operators, ,@command{gawk}-Specific Regexp Operators}. ! In a regexp, a backslash before any character that is not in the previous list and not listed in @ref{GNU Regexp Operators, ,@command{gawk}-Specific Regexp Operators}, means that the next character should be taken literally, even if it would normally be a regexp operator. For example, @code{/a\+b/} matches the three characters @samp{a+b}. ! @cindex backslash (@code{\}), in escape sequences ! @cindex @code{\} (backslash), in escape sequences ! @cindex portability For complete portability, do not use a backslash before any character not ! shown in the previous list. To summarize: *************** *** 2922,2966 **** @c fakenode --- for prepinfo @subheading Advanced Notes: Backslash Before Regular Characters ! @cindex advanced notes ! @cindex common mistakes ! @cindex mistakes, common ! @cindex errors, common If you place a backslash in a string constant before something that is ! not one of the characters listed above, POSIX @command{awk} purposely leaves what happens as undefined. There are two choices: ! @cindex automatic warnings ! @cindex warnings, automatic @table @asis @item Strip the backslash out This is what Unix @command{awk} and @command{gawk} both do. For example, @code{"a\qc"} is the same as @code{"aqc"}. ! (Because this is such an easy bug to both introduce and to miss, @command{gawk} warns you about it.) Consider @samp{FS = @w{"[ \t]+\|[ \t]+"}} to use vertical bars surrounded by whitespace as the field separator. There should be ! two backslashes in the string, @samp{FS = @w{"[ \t]+\\|[ \t]+"}}.) @c I did this! This is why I added the warning. @item Leave the backslash alone Some other @command{awk} implementations do this. ! In such implementations, @code{"a\qc"} is the same as if you had typed @code{"a\\qc"}. @end table @c fakenode --- for prepinfo @subheading Advanced Notes: Escape Sequences for Metacharacters ! @cindex advanced notes Suppose you use an octal or hexadecimal ! escape to represent a regexp metacharacter ! (@pxref{Regexp Operators, , Regular Expression Operators}). Does @command{awk} treat the character as a literal character or as a regexp operator? ! @cindex dark corner Historically, such characters were taken literally. @value{DARKCORNER} However, the POSIX standard indicates that they should be treated --- 2949,2996 ---- @c fakenode --- for prepinfo @subheading Advanced Notes: Backslash Before Regular Characters ! @cindex portability, backslash in escape sequences ! @cindex POSIX @command{awk}, backslashes in string constants ! @cindex backslash (@code{\}), in escape sequences, POSIX and ! @cindex @code{\} (backslash), in escape sequences, POSIX and ! @cindex troubleshooting, backslash before nonspecial character If you place a backslash in a string constant before something that is ! not one of the characters previously listed, POSIX @command{awk} purposely leaves what happens as undefined. There are two choices: ! @c @cindex automatic warnings ! @c @cindex warnings, automatic @table @asis @item Strip the backslash out This is what Unix @command{awk} and @command{gawk} both do. For example, @code{"a\qc"} is the same as @code{"aqc"}. ! (Because this is such an easy bug both to introduce and to miss, @command{gawk} warns you about it.) Consider @samp{FS = @w{"[ \t]+\|[ \t]+"}} to use vertical bars surrounded by whitespace as the field separator. There should be ! two backslashes in the string @samp{FS = @w{"[ \t]+\\|[ \t]+"}}.) @c I did this! This is why I added the warning. + @cindex @command{gawk}, escape sequences + @cindex Unix @command{awk}, backslashes in escape sequences @item Leave the backslash alone Some other @command{awk} implementations do this. ! In such implementations, typing @code{"a\qc"} is the same as typing @code{"a\\qc"}. @end table @c fakenode --- for prepinfo @subheading Advanced Notes: Escape Sequences for Metacharacters ! @cindex metacharacters, escape sequences for Suppose you use an octal or hexadecimal ! escape to represent a regexp metacharacter. ! (See @ref{Regexp Operators, , Regular Expression Operators}.) Does @command{awk} treat the character as a literal character or as a regexp operator? ! @cindex dark corner, escape sequences, for metacharacters Historically, such characters were taken literally. @value{DARKCORNER} However, the POSIX standard indicates that they should be treated *************** *** 2972,2980 **** @node Regexp Operators, Character Lists, Escape Sequences, Regexp @section Regular Expression Operators ! @cindex metacharacters ! @cindex regular expression metacharacters ! @cindex regexp operators You can combine regular expressions with special characters, called @dfn{regular expression operators} or @dfn{metacharacters}, to --- 3002,3009 ---- @node Regexp Operators, Character Lists, Escape Sequences, Regexp @section Regular Expression Operators ! @c STARTOFRANGE regexpo ! @cindex regular expressions, operators You can combine regular expressions with special characters, called @dfn{regular expression operators} or @dfn{metacharacters}, to *************** *** 2985,3009 **** earlier @end ifnotinfo in @ref{Escape Sequences}, ! are valid inside a regexp. They are introduced by a @samp{\}, and ! are recognized and converted into the corresponding real characters as the very first step in processing regexps. Here is a list of metacharacters. All characters that are not escape sequences and that are not listed in the table stand for themselves: @table @code @item \ This is used to suppress the special meaning of a character when matching. For example, @samp{\$} matches the character @samp{$}. ! @cindex anchors in regexps ! @cindex regexp, anchors ! @cindex Texinfo @item ^ This matches the beginning of a string. For example, @samp{^@@chapter} ! matches @samp{@@chapter} at the beginning of a string, and can be used to identify chapter beginnings in Texinfo source files. The @samp{^} is known as an @dfn{anchor}, because it anchors the pattern to match only at the beginning of the string. --- 3014,3041 ---- earlier @end ifnotinfo in @ref{Escape Sequences}, ! are valid inside a regexp. They are introduced by a @samp{\} and ! are recognized and converted into corresponding real characters as the very first step in processing regexps. Here is a list of metacharacters. All characters that are not escape sequences and that are not listed in the table stand for themselves: @table @code + @cindex backslash (@code{\}) + @cindex @code{\} (backslash) @item \ This is used to suppress the special meaning of a character when matching. For example, @samp{\$} matches the character @samp{$}. ! @cindex regular expressions, anchors in ! @cindex Texinfo, chapter beginnings in files ! @cindex @code{^} (caret) ! @cindex caret (@code{^}) @item ^ This matches the beginning of a string. For example, @samp{^@@chapter} ! matches @samp{@@chapter} at the beginning of a string and can be used to identify chapter beginnings in Texinfo source files. The @samp{^} is known as an @dfn{anchor}, because it anchors the pattern to match only at the beginning of the string. *************** *** 3016,3072 **** if ("line1\nLINE 2" ~ /^L/) @dots{} @end example @item $ ! This is similar to @samp{^} but it matches only at the end of a string. For example, @samp{p$} matches a record that ends with a @samp{p}. The @samp{$} is an anchor and does not match the end of a line embedded in a string. ! The condition is not true in the following example: @example if ("line1\nLINE 2" ~ /1$/) @dots{} @end example @item . This matches any single character, @emph{including} the newline character. For example, @samp{.P} matches any single character followed by a @samp{P} in a string. Using ! concatenation, we can make a regular expression such as @samp{U.A}, that matches any three-character sequence that begins with @samp{U} and ends with @samp{A}. ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} In strict POSIX mode (@pxref{Options, ,Command-Line Options}), @samp{.} does not match the @sc{nul} character, which is a character with all bits equal to zero. Otherwise, @sc{nul} is just another character. Other versions of @command{awk} may not be able to match the @sc{nul} character. ! @cindex character list ! @cindex character set (regexp component) ! @cindex character class ! @cindex bracket expression @item [@dots{}] This is called a @dfn{character list}.@footnote{In other literature, you may see a character list referred to as either a ! @dfn{character set}, a @dfn{character class} or a @dfn{bracket expression}.} It matches any @emph{one} of the characters that are enclosed in the square brackets. For example, @samp{[MVX]} matches any one of ! the characters @samp{M}, @samp{V}, or @samp{X}, in a string. A full discussion of what can be inside the square brackets of a character list is given in @ref{Character Lists, ,Using Character Lists}. ! @cindex complemented character list ! @cindex character list, complemented @item [^ @dots{}] This is a @dfn{complemented character list}. The first character after the @samp{[} @emph{must} be a @samp{^}. It matches any characters @emph{except} those in the square brackets. For example, @samp{[^awk]} ! matches any character that is not an @samp{a}, a @samp{w}, ! or a @samp{k}. @item | This is the @dfn{alternation operator} and it is used to specify alternatives. --- 3048,3110 ---- if ("line1\nLINE 2" ~ /^L/) @dots{} @end example + @cindex @code{$} (dollar sign) + @cindex dollar sign (@code{$}) @item $ ! This is similar to @samp{^}, but it matches only at the end of a string. For example, @samp{p$} matches a record that ends with a @samp{p}. The @samp{$} is an anchor and does not match the end of a line embedded in a string. ! The condition in the following example is not true: @example if ("line1\nLINE 2" ~ /1$/) @dots{} @end example + @cindex @code{.} (period) + @cindex period (@code{.}) @item . This matches any single character, @emph{including} the newline character. For example, @samp{.P} matches any single character followed by a @samp{P} in a string. Using ! concatenation, we can make a regular expression such as @samp{U.A}, which matches any three-character sequence that begins with @samp{U} and ends with @samp{A}. ! @c comma before using does NOT do tertiary ! @cindex POSIX @command{awk}, period (@code{.}), using In strict POSIX mode (@pxref{Options, ,Command-Line Options}), @samp{.} does not match the @sc{nul} character, which is a character with all bits equal to zero. Otherwise, @sc{nul} is just another character. Other versions of @command{awk} may not be able to match the @sc{nul} character. ! @cindex @code{[]} (square brackets) ! @cindex square brackets (@code{[]}) ! @cindex character lists ! @cindex character sets, See Also character lists ! @cindex bracket expressions, See character lists @item [@dots{}] This is called a @dfn{character list}.@footnote{In other literature, you may see a character list referred to as either a ! @dfn{character set}, a @dfn{character class}, or a @dfn{bracket expression}.} It matches any @emph{one} of the characters that are enclosed in the square brackets. For example, @samp{[MVX]} matches any one of ! the characters @samp{M}, @samp{V}, or @samp{X} in a string. A full discussion of what can be inside the square brackets of a character list is given in @ref{Character Lists, ,Using Character Lists}. ! @cindex character lists, complemented @item [^ @dots{}] This is a @dfn{complemented character list}. The first character after the @samp{[} @emph{must} be a @samp{^}. It matches any characters @emph{except} those in the square brackets. For example, @samp{[^awk]} ! matches any character that is not an @samp{a}, @samp{w}, ! or @samp{k}. + @cindex @code{|} (vertical bar) + @cindex vertical bar (@code{|}) @item | This is the @dfn{alternation operator} and it is used to specify alternatives. *************** *** 3078,3092 **** The alternation applies to the largest possible regexps on either side. ! @cindex Texinfo @item (@dots{}) ! Parentheses are used for grouping in regular expressions, similar to arithmetic. They can be used to concatenate regular expressions containing the alternation operator, @samp{|}. For example, @samp{@@(samp|code)\@{[^@}]+\@}} matches both @samp{@@code@{foo@}} and @samp{@@samp@{bar@}}. (These are Texinfo formatting control sequences.) @item * This symbol means that the preceding regular expression should be repeated as many times as necessary to find a match. For example, @samp{ph*} --- 3116,3133 ---- The alternation applies to the largest possible regexps on either side. ! @cindex @code{()} (parentheses) ! @cindex parentheses @code{()} @item (@dots{}) ! Parentheses are used for grouping in regular expressions, as in arithmetic. They can be used to concatenate regular expressions containing the alternation operator, @samp{|}. For example, @samp{@@(samp|code)\@{[^@}]+\@}} matches both @samp{@@code@{foo@}} and @samp{@@samp@{bar@}}. (These are Texinfo formatting control sequences.) + @cindex @code{*} (asterisk), @code{*} operator, as regexp operator + @cindex asterisk (@code{*}), @code{*} operator, as regexp operator @item * This symbol means that the preceding regular expression should be repeated as many times as necessary to find a match. For example, @samp{ph*} *************** *** 3103,3110 **** Notice the escaping of the parentheses by preceding them with backslashes. @item + ! This symbol is similar to @samp{*} except that the preceding expression must be matched at least once. This means that @samp{wh+y} would match @samp{why} and @samp{whhy}, but not @samp{wy}, whereas @samp{wh*y} would match all three of these strings. --- 3144,3153 ---- Notice the escaping of the parentheses by preceding them with backslashes. + @cindex @code{+} (plus sign) + @cindex plus sign (@code{+}) @item + ! This symbol is similar to @samp{*}, except that the preceding expression must be matched at least once. This means that @samp{wh+y} would match @samp{why} and @samp{whhy}, but not @samp{wy}, whereas @samp{wh*y} would match all three of these strings. *************** *** 3115,3127 **** awk '/\(c[ad]+r x\)/ @{ print @}' sample @end example @item ? ! This symbol is similar to @samp{*} except that the preceding expression can be matched either once or not at all. For example, @samp{fe?d} matches @samp{fed} and @samp{fd}, but nothing else. - @cindex @command{awk} language, POSIX version - @cindex POSIX @command{awk} @cindex interval expressions @item @{@var{n}@} @itemx @{@var{n},@} --- 3158,3170 ---- awk '/\(c[ad]+r x\)/ @{ print @}' sample @end example + @cindex @code{?} (question mark) + @cindex question mark (@code{?}) @item ? ! This symbol is similar to @samp{*}, except that the preceding expression can be matched either once or not at all. For example, @samp{fe?d} matches @samp{fed} and @samp{fd}, but nothing else. @cindex interval expressions @item @{@var{n}@} @itemx @{@var{n},@} *************** *** 3145,3154 **** --- 3188,3199 ---- Matches @samp{whhy} or @samp{whhhy}, and so on. @end table + @cindex POSIX @command{awk}, interval expressions in Interval expressions were not traditionally available in @command{awk}. They were added as part of the POSIX standard to make @command{awk} and @command{egrep} consistent with each other. + @cindex @command{gawk}, interval expressions and However, because old programs may use @samp{@{} and @samp{@}} in regexp constants, by default @command{gawk} does @emph{not} match interval expressions in regexps. If either @option{--posix} or @option{--re-interval} are specified *************** *** 3163,3175 **** @end table @cindex precedence, regexp operators ! @cindex regexp operators, precedence of In regular expressions, the @samp{*}, @samp{+}, and @samp{?} operators, as well as the braces @samp{@{} and @samp{@}}, have the highest precedence, followed by concatenation, and finally by @samp{|}. As in arithmetic, parentheses can change how operators are grouped. In POSIX @command{awk} and @command{gawk}, the @samp{*}, @samp{+}, and @samp{?} operators stand for themselves when there is nothing in the regexp that precedes them. For example, @samp{/+/} matches a literal plus sign. However, many other versions of --- 3208,3222 ---- @end table @cindex precedence, regexp operators ! @cindex regular expressions, operators, precedence of In regular expressions, the @samp{*}, @samp{+}, and @samp{?} operators, as well as the braces @samp{@{} and @samp{@}}, have the highest precedence, followed by concatenation, and finally by @samp{|}. As in arithmetic, parentheses can change how operators are grouped. + @cindex POSIX @command{awk}, regular expressions and + @cindex @command{gawk}, regular expressions, precedence In POSIX @command{awk} and @command{gawk}, the @samp{*}, @samp{+}, and @samp{?} operators stand for themselves when there is nothing in the regexp that precedes them. For example, @samp{/+/} matches a literal plus sign. However, many other versions of *************** *** 3179,3187 **** --- 3226,3239 ---- (@pxref{Options, ,Command-Line Options}), POSIX character classes and interval expressions are not available in regular expressions. + @c ENDOFRANGE regexpo @node Character Lists, GNU Regexp Operators, Regexp Operators, Regexp @section Using Character Lists + @c STARTOFRANGE charlist + @cindex character lists + @cindex character lists, range expressions + @cindex range expressions Within a character list, a @dfn{range expression} consists of two characters separated by a hyphen. It matches any single character that *************** *** 3195,3200 **** --- 3247,3258 ---- locale by setting the @env{LC_ALL} environment variable to the value @samp{C}. + @cindex @code{\} (backslash), in character lists + @cindex backslash (@code{\}), in character lists + @cindex @code{^} (caret), in character lists + @cindex caret (@code{^}), in character lists + @cindex @code{-} (hyphen), in character lists + @cindex hyphen (@code{-}), in character lists To include one of the characters @samp{\}, @samp{]}, @samp{-}, or @samp{^} in a character list, put a @samp{\} in front of it. For example: *************** *** 3205,3210 **** --- 3263,3271 ---- @noindent matches either @samp{d} or @samp{]}. + @cindex POSIX @command{awk}, character lists and + @cindex Extended Regular Expressions (EREs) + @cindex EREs (Extended Regular Expressions) @cindex @command{egrep} utility This treatment of @samp{\} in character lists is compatible with other @command{awk} *************** *** 3214,3222 **** POSIX EREs are based on the regular expressions accepted by the traditional @command{egrep} utility. ! @cindex character class ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} @dfn{Character classes} are a new feature introduced in the POSIX standard. A character class is a special notation for describing lists of characters that have a specific attribute, but the --- 3275,3282 ---- POSIX EREs are based on the regular expressions accepted by the traditional @command{egrep} utility. ! @cindex character lists, character classes ! @cindex POSIX @command{awk}, character lists and, character classes @dfn{Character classes} are a new feature introduced in the POSIX standard. A character class is a special notation for describing lists of characters that have a specific attribute, but the *************** *** 3227,3233 **** A character class is only valid in a regexp @emph{inside} the brackets of a character list. Character classes consist of @samp{[:}, a keyword denoting the class, and @samp{:]}. Here are the character ! classes defined by the POSIX standard: @c the regular table is commented out while trying out the multitable. @c leave it here in case we need to go back, but make sure the text --- 3287,3293 ---- A character class is only valid in a regexp @emph{inside} the brackets of a character list. Character classes consist of @samp{[:}, a keyword denoting the class, and @samp{:]}. Here are the character ! classes defined by the POSIX standard. @c the regular table is commented out while trying out the multitable. @c leave it here in case we need to go back, but make sure the text *************** *** 3242,3248 **** Alphabetic characters. @item [:blank:] ! Space and tab characters. @item [:cntrl:] Control characters. --- 3302,3308 ---- Alphabetic characters. @item [:blank:] ! Space and TAB characters. @item [:cntrl:] Control characters. *************** *** 3265,3271 **** control characters, or space characters). @item [:space:] ! Space characters (such as space, tab, and formfeed, to name a few). @item [:upper:] Uppercase alphabetic characters. --- 3325,3331 ---- control characters, or space characters). @item [:space:] ! Space characters (such as space, TAB, and formfeed, to name a few). @item [:upper:] Uppercase alphabetic characters. *************** *** 3278,3284 **** @multitable {@code{[:xdigit:]}} {Characters that are both printable and visible. (A space is} @item @code{[:alnum:]} @tab Alphanumeric characters. @item @code{[:alpha:]} @tab Alphabetic characters. ! @item @code{[:blank:]} @tab Space and tab characters. @item @code{[:cntrl:]} @tab Control characters. @item @code{[:digit:]} @tab Numeric characters. @item @code{[:graph:]} @tab Characters that are both printable and visible. --- 3338,3344 ---- @multitable {@code{[:xdigit:]}} {Characters that are both printable and visible. (A space is} @item @code{[:alnum:]} @tab Alphanumeric characters. @item @code{[:alpha:]} @tab Alphabetic characters. ! @item @code{[:blank:]} @tab Space and TAB characters. @item @code{[:cntrl:]} @tab Control characters. @item @code{[:digit:]} @tab Numeric characters. @item @code{[:graph:]} @tab Characters that are both printable and visible. *************** *** 3287,3293 **** @item @code{[:print:]} @tab Printable characters (characters that are not control characters). @item @code{[:punct:]} @tab Punctuation characters (characters that are not letters, digits, control characters, or space characters). ! @item @code{[:space:]} @tab Space characters (such as space, tab, and formfeed, to name a few). @item @code{[:upper:]} @tab Uppercase alphabetic characters. @item @code{[:xdigit:]} @tab Characters that are hexadecimal digits. @end multitable --- 3347,3353 ---- @item @code{[:print:]} @tab Printable characters (characters that are not control characters). @item @code{[:punct:]} @tab Punctuation characters (characters that are not letters, digits, control characters, or space characters). ! @item @code{[:space:]} @tab Space characters (such as space, TAB, and formfeed, to name a few). @item @code{[:upper:]} @tab Uppercase alphabetic characters. @item @code{[:xdigit:]} @tab Characters that are hexadecimal digits. @end multitable *************** *** 3301,3306 **** --- 3361,3368 ---- @code{/[[:alnum:]]/} to match the alphabetic and numeric characters in your character set. + @cindex character lists, collating elements + @cindex character lists, non-ASCII @cindex collating elements Two additional special sequences can appear in character lists. These apply to non-ASCII character sets, which can have single symbols *************** *** 3308,3325 **** character. They can also have several characters that are equivalent for @dfn{collating}, or sorting, purposes. (For example, in French, a plain ``e'' and a grave-accented ``@`e'' are equivalent.) @table @asis @cindex collating symbols ! @item Collating Symbols ! A @dfn{collating symbol} is a multicharacter collating element enclosed between @samp{[.} and @samp{.]}. For example, if @samp{ch} is a collating element, then @code{[[.ch.]]} is a regexp that matches this collating element, whereas @code{[ch]} is a regexp that matches either @samp{c} or @samp{h}. ! @cindex equivalence classes ! @item Equivalence Classes ! An @dfn{equivalence class} is a locale-specific name for a list of characters that are equal. The name is enclosed between @samp{[=} and @samp{=]}. For example, the name @samp{e} might be used to represent all of --- 3370,3389 ---- character. They can also have several characters that are equivalent for @dfn{collating}, or sorting, purposes. (For example, in French, a plain ``e'' and a grave-accented ``@`e'' are equivalent.) + These sequences are: @table @asis + @cindex character lists, collating symbols @cindex collating symbols ! @item Collating symbols ! Multicharacter collating elements enclosed between @samp{[.} and @samp{.]}. For example, if @samp{ch} is a collating element, then @code{[[.ch.]]} is a regexp that matches this collating element, whereas @code{[ch]} is a regexp that matches either @samp{c} or @samp{h}. ! @cindex character lists, equivalence classes ! @item Equivalence classes ! Locale-specific names for a list of characters that are equal. The name is enclosed between @samp{[=} and @samp{=]}. For example, the name @samp{e} might be used to represent all of *************** *** 3327,3345 **** that matches any of @samp{e}, @samp{@'e}, or @samp{@`e}. @end table ! These features are very valuable in non-English speaking locales. @strong{Caution:} The library functions that @command{gawk} uses for regular ! expression matching currently only recognize POSIX character classes; they do not recognize collating symbols or equivalence classes. @c maybe one day ... @node GNU Regexp Operators, Case-sensitivity, Character Lists, Regexp @section @command{gawk}-Specific Regexp Operators @c This section adapted (long ago) from the regex-0.12 manual ! @cindex regexp operators, GNU specific @cindex word, regexp definition of GNU software that deals with regular expressions provides a number of additional regexp operators. These operators are described in this --- 3391,3418 ---- that matches any of @samp{e}, @samp{@'e}, or @samp{@`e}. @end table ! These features are very valuable in non-English-speaking locales. + @cindex internationalization, localization, character classes + @cindex @command{gawk}, character classes and + @cindex POSIX @command{awk}, character lists and, character classes @strong{Caution:} The library functions that @command{gawk} uses for regular ! expression matching currently recognize only POSIX character classes; they do not recognize collating symbols or equivalence classes. @c maybe one day ... + @c ENDOFRANGE charlist @node GNU Regexp Operators, Case-sensitivity, Character Lists, Regexp @section @command{gawk}-Specific Regexp Operators @c This section adapted (long ago) from the regex-0.12 manual ! @c STARTOFRANGE regexpg ! @cindex regular expressions, operators, @command{gawk} ! @c STARTOFRANGE gregexp ! @cindex @command{gawk}, regular expressions, operators ! @cindex operators, GNU-specific ! @cindex regular expressions, operators, for words @cindex word, regexp definition of GNU software that deals with regular expressions provides a number of additional regexp operators. These operators are described in this *************** *** 3350,3386 **** or underscores (@samp{_}): @table @code ! @cindex @code{\w} regexp operator @item \w Matches any word-constituent character---that is, it matches any ! letter, digit, or underscore. Think of it as short-hand for @w{@code{[[:alnum:]_]}}. ! @cindex @code{\W} regexp operator @item \W Matches any character that is not word-constituent. ! Think of it as short-hand for @w{@code{[^[:alnum:]_]}}. ! @cindex @code{\<} regexp operator @item \< Matches the empty string at the beginning of a word. For example, @code{/\} regexp operator @item \> Matches the empty string at the end of a word. For example, @code{/stow\>/} matches @samp{stow} but not @samp{stowaway}. ! @cindex @code{\y} regexp operator @cindex word boundaries, matching @item \y Matches the empty string at either the beginning or the end of a word (i.e., the word boundar@strong{y}). For example, @samp{\yballs?\y} matches either @samp{ball} or @samp{balls}, as a separate word. ! @cindex @code{\B} regexp operator @item \B Matches the empty string that occurs between two word-constituent characters. For example, --- 3423,3472 ---- or underscores (@samp{_}): @table @code ! @c @cindex operators, @code{\w} (@command{gawk}) ! @cindex backslash (@code{\}), @code{\w} operator (@command{gawk}) ! @cindex @code{\} (backslash), @code{\w} operator (@command{gawk}) @item \w Matches any word-constituent character---that is, it matches any ! letter, digit, or underscore. Think of it as shorthand for @w{@code{[[:alnum:]_]}}. ! @c @cindex operators, @code{\W} (@command{gawk}) ! @cindex backslash (@code{\}), @code{\W} operator (@command{gawk}) ! @cindex @code{\} (backslash), @code{\W} operator (@command{gawk}) @item \W Matches any character that is not word-constituent. ! Think of it as shorthand for @w{@code{[^[:alnum:]_]}}. ! @c @cindex operators, @code{\<} (@command{gawk}) ! @cindex backslash (@code{\}), @code{\<} operator (@command{gawk}) ! @cindex @code{\} (backslash), @code{\<} operator (@command{gawk}) @item \< Matches the empty string at the beginning of a word. For example, @code{/\} (@command{gawk}) ! @cindex backslash (@code{\}), @code{\>} operator (@command{gawk}) ! @cindex @code{\} (backslash), @code{\>} operator (@command{gawk}) @item \> Matches the empty string at the end of a word. For example, @code{/stow\>/} matches @samp{stow} but not @samp{stowaway}. ! @c @cindex operators, @code{\y} (@command{gawk}) ! @cindex backslash (@code{\}), @code{\y} operator (@command{gawk}) ! @cindex @code{\} (backslash), @code{\y} operator (@command{gawk}) ! @c comma before using does NOT do secondary @cindex word boundaries, matching @item \y Matches the empty string at either the beginning or the end of a word (i.e., the word boundar@strong{y}). For example, @samp{\yballs?\y} matches either @samp{ball} or @samp{balls}, as a separate word. ! @c @cindex operators, @code{\B} (@command{gawk}) ! @cindex backslash (@code{\}), @code{\B} operator (@command{gawk}) ! @cindex @code{\} (backslash), @code{\B} operator (@command{gawk}) @item \B Matches the empty string that occurs between two word-constituent characters. For example, *************** *** 3388,3416 **** @samp{\B} is essentially the opposite of @samp{\y}. @end table ! @cindex buffer matching operators There are two other operators that work on buffers. In Emacs, a @dfn{buffer} is, naturally, an Emacs buffer. For other programs, @command{gawk}'s regexp library routines consider the entire string to match as the buffer. @table @code @item \` ! @cindex @code{\`} regexp operator Matches the empty string at the beginning of a buffer (string). ! @cindex @code{\'} regexp operator @item \' Matches the empty string at the end of a buffer (string). @end table Because @samp{^} and @samp{$} always work in terms of the beginning and end of strings, these operators don't add any new capabilities for @command{awk}. They are provided for compatibility with other GNU software. In other GNU software, the word-boundary operator is @samp{\b}. However, that conflicts with the @command{awk} language's definition of @samp{\b} as backspace, so @command{gawk} uses a different letter. --- 3474,3516 ---- @samp{\B} is essentially the opposite of @samp{\y}. @end table ! @cindex buffers, operators for ! @cindex regular expressions, operators, for buffers ! @cindex operators, string-matching, for buffers There are two other operators that work on buffers. In Emacs, a @dfn{buffer} is, naturally, an Emacs buffer. For other programs, @command{gawk}'s regexp library routines consider the entire string to match as the buffer. + The operators are: @table @code @item \` ! @c @cindex operators, @code{\`} (@command{gawk}) ! @cindex backslash (@code{\}), @code{\`} operator (@command{gawk}) ! @cindex @code{\} (backslash), @code{\`} operator (@command{gawk}) Matches the empty string at the beginning of a buffer (string). ! @c @cindex operators, @code{\'} (@command{gawk}) ! @cindex backslash (@code{\}), @code{\'} operator (@command{gawk}) ! @cindex @code{\} (backslash), @code{\'} operator (@command{gawk}) @item \' Matches the empty string at the end of a buffer (string). @end table + @cindex @code{^} (caret) + @cindex caret (@code{^}) + @cindex @code{?} (question mark) + @cindex question mark (@code{?}) Because @samp{^} and @samp{$} always work in terms of the beginning and end of strings, these operators don't add any new capabilities for @command{awk}. They are provided for compatibility with other GNU software. + @cindex @command{gawk}, word-boundary operator + @cindex word-boundary operator (@command{gawk}) + @cindex operators, word-boundary (@command{gawk}) In other GNU software, the word-boundary operator is @samp{\b}. However, that conflicts with the @command{awk} language's definition of @samp{\b} as backspace, so @command{gawk} uses a different letter. *************** *** 3422,3428 **** @c NOTE!!! Keep this in sync with the same table in the summary appendix! @c @c Should really do this with file inclusion. ! @cindex regexp, effect of command-line options The various command-line options (@pxref{Options, ,Command-Line Options}) control how @command{gawk} interprets characters in regexps: --- 3522,3529 ---- @c NOTE!!! Keep this in sync with the same table in the summary appendix! @c @c Should really do this with file inclusion. ! @cindex regular expressions, @command{gawk}, command-line options ! @cindex @command{gawk}, command-line options The various command-line options (@pxref{Options, ,Command-Line Options}) control how @command{gawk} interprets characters in regexps: *************** *** 3449,3455 **** @item @code{--traditional} Traditional Unix @command{awk} regexps are matched. The GNU operators are not special, interval expressions are not available, nor ! are the POSIX character classes (@code{[[:alnum:]]} and so on). Characters described by octal and hexadecimal escape sequences are treated literally, even if they represent regexp metacharacters. --- 3550,3556 ---- @item @code{--traditional} Traditional Unix @command{awk} regexps are matched. The GNU operators are not special, interval expressions are not available, nor ! are the POSIX character classes (@code{[[:alnum:]]}, etc.). Characters described by octal and hexadecimal escape sequences are treated literally, even if they represent regexp metacharacters. *************** *** 3457,3468 **** Allow interval expressions in regexps, even if @option{--traditional} has been provided. @end table @node Case-sensitivity, Leftmost Longest, GNU Regexp Operators, Regexp @section Case Sensitivity in Matching ! @cindex case sensitivity ! @cindex ignoring case Case is normally significant in regular expressions, both when matching ordinary characters (i.e., not metacharacters) and inside character sets. Thus, a @samp{w} in a regular expression matches only a lowercase --- 3558,3573 ---- Allow interval expressions in regexps, even if @option{--traditional} has been provided. @end table + @c ENDOFRANGE gregexp + @c ENDOFRANGE regexpg @node Case-sensitivity, Leftmost Longest, GNU Regexp Operators, Regexp @section Case Sensitivity in Matching ! @c STARTOFRANGE regexpcs ! @cindex regular expressions, case sensitivity ! @c STARTOFRANGE csregexp ! @cindex case sensitivity, regexps and Case is normally significant in regular expressions, both when matching ordinary characters (i.e., not metacharacters) and inside character sets. Thus, a @samp{w} in a regular expression matches only a lowercase *************** *** 3470,3476 **** The simplest way to do a case-independent match is to use a character list---for example, @samp{[Ww]}. However, this can be cumbersome if ! you need to use it often and it can make the regular expressions harder to read. There are two alternatives that you might prefer. One way to perform a case-insensitive match at a particular point in the --- 3575,3581 ---- The simplest way to do a case-independent match is to use a character list---for example, @samp{[Ww]}. However, this can be cumbersome if ! you need to use it often, and it can make the regular expressions harder to read. There are two alternatives that you might prefer. One way to perform a case-insensitive match at a particular point in the *************** *** 3488,3502 **** converts the first field to lowercase before matching against it. This works in any POSIX-compliant @command{awk}. ! @cindex differences between @command{gawk} and @command{awk} ! @cindex @code{~} operator ! @cindex @code{!~} operator @cindex @code{IGNORECASE} variable Another method, specific to @command{gawk}, is to set the variable @code{IGNORECASE} to a nonzero value (@pxref{Built-in Variables}). When @code{IGNORECASE} is not zero, @emph{all} regexp and string operations ignore case. Changing the value of ! @code{IGNORECASE} dynamically controls the case sensitivity of the program as it runs. Case is significant by default because @code{IGNORECASE} (like most variables) is initialized to zero: --- 3593,3612 ---- converts the first field to lowercase before matching against it. This works in any POSIX-compliant @command{awk}. ! @cindex @command{gawk}, regular expressions, case sensitivity ! @cindex case sensitivity, @command{gawk} ! @cindex differences in @command{awk} and @command{gawk}, regular expressions ! @cindex @code{~} (tilde), @code{~} operator ! @cindex tilde (@code{~}), @code{~} operator ! @cindex @code{!} (exclamation point), @code{!~} operator ! @cindex exclamation point (@code{!}), @code{!~} operator @cindex @code{IGNORECASE} variable + @c @cindex variables, @code{IGNORECASE} Another method, specific to @command{gawk}, is to set the variable @code{IGNORECASE} to a nonzero value (@pxref{Built-in Variables}). When @code{IGNORECASE} is not zero, @emph{all} regexp and string operations ignore case. Changing the value of ! @code{IGNORECASE} dynamically controls the case-sensitivity of the program as it runs. Case is significant by default because @code{IGNORECASE} (like most variables) is initialized to zero: *************** *** 3534,3557 **** Beginning with @value{PVERSION} 3.0, both regexp and string comparison operations are also affected by @code{IGNORECASE}. ! @cindex ISO 8859-1 ! @cindex ISO Latin-1 Beginning with @command{gawk} 3.0, the equivalences between upper- and lowercase characters are based on the ISO-8859-1 (ISO Latin-1) character set. This character set is a superset of the traditional 128 ! ASCII characters, that also provides a number of characters suitable for use with European languages. The value of @code{IGNORECASE} has no effect if @command{gawk} is in compatibility mode (@pxref{Options, ,Command-Line Options}). Case is always significant in compatibility mode. @node Leftmost Longest, Computed Regexps, Case-sensitivity, Regexp @section How Much Text Matches? ! @cindex leftmost longest match ! @cindex matching, leftmost longest Consider the following: @example --- 3644,3669 ---- Beginning with @value{PVERSION} 3.0, both regexp and string comparison operations are also affected by @code{IGNORECASE}. ! @c @cindex ISO 8859-1 ! @c @cindex ISO Latin-1 Beginning with @command{gawk} 3.0, the equivalences between upper- and lowercase characters are based on the ISO-8859-1 (ISO Latin-1) character set. This character set is a superset of the traditional 128 ! ASCII characters, which also provides a number of characters suitable for use with European languages. The value of @code{IGNORECASE} has no effect if @command{gawk} is in compatibility mode (@pxref{Options, ,Command-Line Options}). Case is always significant in compatibility mode. + @c ENDOFRANGE csregexp + @c ENDOFRANGE regexpcs @node Leftmost Longest, Computed Regexps, Case-sensitivity, Regexp @section How Much Text Matches? ! @cindex regular expressions, leftmost longest match ! @c @cindex matching, leftmost longest Consider the following: @example *************** *** 3589,3600 **** @node Computed Regexps, , Leftmost Longest, Regexp @section Using Dynamic Regexps ! @cindex computed regular expressions @cindex regular expressions, computed ! @cindex dynamic regular expressions ! @cindex regexp, dynamic ! @cindex @code{~} operator ! @cindex @code{!~} operator The righthand side of a @samp{~} or @samp{!~} operator need not be a regexp constant (i.e., a string of characters between slashes). It may be any expression. The expression is evaluated and converted to a string --- 3701,3716 ---- @node Computed Regexps, , Leftmost Longest, Regexp @section Using Dynamic Regexps ! @c STARTOFRANGE dregexp @cindex regular expressions, computed ! @c STARTOFRANGE regexpd ! @cindex regular expressions, dynamic ! @cindex @code{~} (tilde), @code{~} operator ! @cindex tilde (@code{~}), @code{~} operator ! @cindex @code{!} (exclamation point), @code{!~} operator ! @cindex exclamation point (@code{!}), @code{!~} operator ! @c @cindex operators, @code{~} ! @c @cindex operators, @code{!~} The righthand side of a @samp{~} or @samp{!~} operator need not be a regexp constant (i.e., a string of characters between slashes). It may be any expression. The expression is evaluated and converted to a string *************** *** 3620,3629 **** the string is, in essence, scanned @emph{twice}: the first time when @command{awk} reads your program, and the second time when it goes to match the string on the lefthand side of the operator with the pattern ! on the right. This is true of any string valued expression (such as ! @code{digits_regexp} shown previously), not just string constants. ! @cindex regexp constants, difference between slashes and quotes What difference does it make if the string is scanned twice? The answer has to do with escape sequences, and particularly with backslashes. To get a backslash into a regular expression inside a --- 3736,3749 ---- the string is, in essence, scanned @emph{twice}: the first time when @command{awk} reads your program, and the second time when it goes to match the string on the lefthand side of the operator with the pattern ! on the right. This is true of any string-valued expression (such as ! @code{digits_regexp}, shown previously), not just string constants. ! @cindex regexp constants, slashes vs. quotes ! @cindex @code{\} (backslash), regexp constants ! @cindex backslash (@code{\}), regexp constants ! @cindex @code{"} (double quote), regexp constants ! @cindex double quote (@code{"}), regexp constants What difference does it make if the string is scanned twice? The answer has to do with escape sequences, and particularly with backslashes. To get a backslash into a regular expression inside a *************** *** 3635,3643 **** second one so that the string actually contains the two characters @samp{\} and @samp{*}. ! @cindex common mistakes ! @cindex mistakes, common ! @cindex errors, common Given that you can use both regexp and string constants to describe regular expressions, which should you use? The answer is ``regexp constants,'' for several reasons: --- 3755,3763 ---- second one so that the string actually contains the two characters @samp{\} and @samp{*}. ! @cindex troubleshooting, regexp constants vs. string constants ! @cindex regexp constants, vs. string constants ! @cindex string constants, vs. regexp constants Given that you can use both regexp and string constants to describe regular expressions, which should you use? The answer is ``regexp constants,'' for several reasons: *************** *** 3651,3657 **** @item It is more efficient to use regexp constants. @command{awk} can note ! that you have supplied a regexp, and store it internally in a form that makes pattern matching more efficient. When using a string constant, @command{awk} must first convert the string into this internal form and then perform the pattern matching. --- 3771,3777 ---- @item It is more efficient to use regexp constants. @command{awk} can note ! that you have supplied a regexp and store it internally in a form that makes pattern matching more efficient. When using a string constant, @command{awk} must first convert the string into this internal form and then perform the pattern matching. *************** *** 3663,3673 **** @c fakenode --- for prepinfo @subheading Advanced Notes: Using @code{\n} in Character Lists of Dynamic Regexps ! @cindex advanced notes ! @cindex dynamic regular expressions with embedded newlines ! @cindex regexp, dynamic, with embedded newlines ! @cindex newlines, embedded in dynamic regexps ! @cindex embedded newlines, in dynamic regexps Some commercial versions of @command{awk} do not allow the newline character to be used inside a character list for a dynamic regexp: --- 3783,3790 ---- @c fakenode --- for prepinfo @subheading Advanced Notes: Using @code{\n} in Character Lists of Dynamic Regexps ! @cindex regular expressions, dynamic, with embedded newlines ! @cindex newlines, in dynamic regexps Some commercial versions of @command{awk} do not allow the newline character to be used inside a character list for a dynamic regexp: *************** *** 3681,3720 **** @error{} >>> <<< @end example But a newline in a regexp constant works with no problem: @example $ awk '$0 ~ /[ \t\n]/' here is a sample line @print{} here is a sample line ! @kbd{Ctrl-d} @end example @command{gawk} does not have this problem, and it isn't likely to occur often in practice, but it's worth noting for future reference. @node Reading Files, Printing, Regexp, Top @chapter Reading Input Files ! @cindex reading files ! @cindex input ! @cindex standard input @cindex @code{FILENAME} variable In the typical @command{awk} program, all input is read either from the ! standard input (by default, this is the keyboard but often it is a pipe from another ! command), or from files whose names you specify on the @command{awk} command line. If you specify input files, @command{awk} reads them in order, processing all the data from one before going on to the next. The name of the current input file can be found in the built-in variable @code{FILENAME} (@pxref{Built-in Variables}). The input is read in units called @dfn{records}, and is processed by the rules of your program one record at a time. By default, each record is one line. Each record is automatically split into chunks called @dfn{fields}. This makes it more convenient for programs to work on the parts of a record. On rare occasions, you may need to use the @code{getline} command. The @code{getline} command is valuable, both because it can do explicit input from any number of files, and because the files --- 3798,3844 ---- @error{} >>> <<< @end example + @cindex newlines, in regexp constants But a newline in a regexp constant works with no problem: @example $ awk '$0 ~ /[ \t\n]/' here is a sample line @print{} here is a sample line ! @kbd{@value{CTL}-d} @end example @command{gawk} does not have this problem, and it isn't likely to occur often in practice, but it's worth noting for future reference. + @c ENDOFRANGE dregexp + @c ENDOFRANGE regexpd + @c ENDOFRANGE regexp @node Reading Files, Printing, Regexp, Top @chapter Reading Input Files ! @c STARTOFRANGE infir ! @cindex input files, reading ! @cindex input files @cindex @code{FILENAME} variable In the typical @command{awk} program, all input is read either from the ! standard input (by default, this is the keyboard, but often it is a pipe from another ! command) or from files whose names you specify on the @command{awk} command line. If you specify input files, @command{awk} reads them in order, processing all the data from one before going on to the next. The name of the current input file can be found in the built-in variable @code{FILENAME} (@pxref{Built-in Variables}). + @cindex records + @cindex fields The input is read in units called @dfn{records}, and is processed by the rules of your program one record at a time. By default, each record is one line. Each record is automatically split into chunks called @dfn{fields}. This makes it more convenient for programs to work on the parts of a record. + @cindex @code{getline} command On rare occasions, you may need to use the @code{getline} command. The @code{getline} command is valuable, both because it can do explicit input from any number of files, and because the files *************** *** 3724,3730 **** @menu * Records:: Controlling how data is split into records. * Fields:: An introduction to fields. ! * Non-Constant Fields:: Non-constant Field Numbers. * Changing Fields:: Changing the Contents of a Field. * Field Separators:: The field separator and how to change it. * Constant Size:: Reading constant width data. --- 3848,3854 ---- @menu * Records:: Controlling how data is split into records. * Fields:: An introduction to fields. ! * Nonconstant Fields:: Nonconstant Field Numbers. * Changing Fields:: Changing the Contents of a Field. * Field Separators:: The field separator and how to change it. * Constant Size:: Reading constant width data. *************** *** 3736,3742 **** @node Records, Fields, Reading Files, Reading Files @section How Input Is Split into Records ! @cindex number of records, @code{NR}, @code{FNR} @cindex @code{NR} variable @cindex @code{FNR} variable The @command{awk} utility divides the input for your @command{awk} --- 3860,3869 ---- @node Records, Fields, Reading Files, Reading Files @section How Input Is Split into Records ! @c STARTOFRANGE inspl ! @cindex input, splitting into records ! @c STARTOFRANGE recspl ! @cindex records, splitting input into @cindex @code{NR} variable @cindex @code{FNR} variable The @command{awk} utility divides the input for your @command{awk} *************** *** 3750,3765 **** number of input records read so far from all @value{DF}s. It starts at zero, but is never automatically reset to zero. ! @cindex record separator, @code{RS} ! @cindex changing the record separator ! @cindex record, definition of ! @cindex @code{RS} variable Records are separated by a character called the @dfn{record separator}. By default, the record separator is the newline character. This is why records are, by default, single lines. A different character can be used for the record separator by assigning the character to the built-in variable @code{RS}. Like any other variable, the value of @code{RS} can be changed in the @command{awk} program with the assignment operator, @samp{=} --- 3877,3892 ---- number of input records read so far from all @value{DF}s. It starts at zero, but is never automatically reset to zero. ! @cindex separators, for records ! @cindex record separators Records are separated by a character called the @dfn{record separator}. By default, the record separator is the newline character. This is why records are, by default, single lines. A different character can be used for the record separator by assigning the character to the built-in variable @code{RS}. + @cindex newlines, as record separators + @cindex @code{RS} variable Like any other variable, the value of @code{RS} can be changed in the @command{awk} program with the assignment operator, @samp{=} *************** *** 3772,3777 **** --- 3899,3905 ---- (@pxref{BEGIN/END, ,The @code{BEGIN} and @code{END} Special Patterns}). For example: + @cindex @code{BEGIN} pattern @example awk 'BEGIN @{ RS = "/" @} @{ print $0 @}' BBS-list *************** *** 3783,3789 **** are separated by slashes. Then the input file is read, and the second rule in the @command{awk} program (the action with no pattern) prints each record. Because each @code{print} statement adds a newline at the end of ! its output, the effect of this @command{awk} program is to copy the input with each slash changed to a newline. Here are the results of running the program on @file{BBS-list}: --- 3911,3917 ---- are separated by slashes. Then the input file is read, and the second rule in the @command{awk} program (the action with no pattern) prints each record. Because each @code{print} statement adds a newline at the end of ! its output, this @command{awk} program copies the input with each slash changed to a newline. Here are the results of running the program on @file{BBS-list}: *************** *** 3836,3841 **** --- 3964,3971 ---- is the original newline in the @value{DF}, not the one added by @command{awk} when it printed the record! + @cindex record separators, changing + @cindex separators, for records Another way to change the record separator is on the command line, using the variable-assignment feature (@pxref{Other Arguments, ,Other Command-Line Arguments}): *************** *** 3859,3870 **** There is one field, consisting of a newline. The value of the built-in variable @code{NF} is the number of fields in the current record. ! @cindex dark corner Reaching the end of an input file terminates the current input record, even if the last character in the file is not the character in @code{RS}. @value{DARKCORNER} ! @cindex empty string The empty string @code{""} (a string without any characters) has a special meaning as the value of @code{RS}. It means that records are separated --- 3989,4001 ---- There is one field, consisting of a newline. The value of the built-in variable @code{NF} is the number of fields in the current record. ! @cindex dark corner, input files Reaching the end of an input file terminates the current input record, even if the last character in the file is not the character in @code{RS}. @value{DARKCORNER} ! @cindex null strings ! @cindex strings, empty, See null strings The empty string @code{""} (a string without any characters) has a special meaning as the value of @code{RS}. It means that records are separated *************** *** 3877,3886 **** affected. @cindex @code{RT} variable ! @cindex record terminator, @code{RT} ! @cindex terminator, record ! @cindex differences between @command{gawk} and @command{awk} ! @cindex regular expressions as record separators After the end of the record has been determined, @command{gawk} sets the variable @code{RT} to the text in the input that matched @code{RS}. --- 4008,4019 ---- affected. @cindex @code{RT} variable ! @cindex records, terminating ! @cindex terminating records ! @cindex differences in @command{awk} and @command{gawk}, record separators ! @cindex regular expressions, as record separators ! @cindex record separators, regular expressions as ! @cindex separators, for records, regular expressions as After the end of the record has been determined, @command{gawk} sets the variable @code{RT} to the text in the input that matched @code{RS}. *************** *** 3893,3899 **** record starts at the end of the matching string. This general rule is actually at work in the usual case, where @code{RS} contains just a newline: a record ends at the beginning of the next matching string (the ! next newline in the input) and the following record starts just after the end of this string (at the first character of the following line). The newline, because it matches @code{RS}, is not part of either record. --- 4026,4032 ---- record starts at the end of the matching string. This general rule is actually at work in the usual case, where @code{RS} contains just a newline: a record ends at the beginning of the next matching string (the ! next newline in the input), and the following record starts just after the end of this string (at the first character of the following line). The newline, because it matches @code{RS}, is not part of either record. *************** *** 3924,3930 **** @xref{Simple Sed, ,A Simple Stream Editor}, for a more useful example of @code{RS} as a regexp and @code{RT}. ! @cindex differences between @command{gawk} and @command{awk} The use of @code{RS} as a regular expression and the @code{RT} variable are @command{gawk} extensions; they are not available in compatibility mode --- 4057,4063 ---- @xref{Simple Sed, ,A Simple Stream Editor}, for a more useful example of @code{RS} as a regexp and @code{RT}. ! @cindex differences in @command{awk} and @command{gawk}, @code{RS}/@code{RT} variables The use of @code{RS} as a regular expression and the @code{RT} variable are @command{gawk} extensions; they are not available in compatibility mode *************** *** 3934,3942 **** @c fakenode --- for prepinfo @subheading Advanced Notes: @code{RS = "\0"} Is Not Portable - @cindex advanced notes - @cindex portability issues There are times when you might want to treat an entire @value{DF} as a single record. The only way to make this happen is to give @code{RS} a value that you know doesn't occur in the input file. This is hard --- 4067,4075 ---- @c fakenode --- for prepinfo @subheading Advanced Notes: @code{RS = "\0"} Is Not Portable + @cindex advanced features, @value{DF}s as single record + @cindex portability, @value{DF}s as single record There are times when you might want to treat an entire @value{DF} as a single record. The only way to make this happen is to give @code{RS} a value that you know doesn't occur in the input file. This is hard *************** *** 3952,3982 **** BEGIN @{ RS = "\0" @} # whole file becomes one record? @end example ! @cindex differences between @command{gawk} and @command{awk} @command{gawk} in fact accepts this, and uses the @sc{nul} character for the record separator. However, this usage is @emph{not} portable to other @command{awk} implementations. ! @cindex dark corner All other @command{awk} implementations@footnote{At least that we know about.} store strings internally as C-style strings. C strings use the @sc{nul} character as the string terminator. In effect, this means that @samp{RS = "\0"} is the same as @samp{RS = ""}. @value{DARKCORNER} The best way to treat a whole file as a single record is to simply read the file in, one record at a time, concatenating each record onto the end of the previous ones. ! @node Fields, Non-Constant Fields, Records, Reading Files @section Examining Fields @cindex examining fields @cindex fields @cindex accessing fields When @command{awk} reads an input record, the record is ! automatically separated or @dfn{parsed} by the interpreter into chunks called @dfn{fields}. By default, fields are separated by @dfn{whitespace}, like words in a line. Whitespace in @command{awk} means any string of one or more spaces, --- 4085,4124 ---- BEGIN @{ RS = "\0" @} # whole file becomes one record? @end example ! @cindex differences in @command{awk} and @command{gawk}, strings, storing @command{gawk} in fact accepts this, and uses the @sc{nul} character for the record separator. However, this usage is @emph{not} portable to other @command{awk} implementations. ! @cindex dark corner, strings, storing All other @command{awk} implementations@footnote{At least that we know about.} store strings internally as C-style strings. C strings use the @sc{nul} character as the string terminator. In effect, this means that @samp{RS = "\0"} is the same as @samp{RS = ""}. @value{DARKCORNER} + @cindex records, treating files as + @cindex files, as single records The best way to treat a whole file as a single record is to simply read the file in, one record at a time, concatenating each record onto the end of the previous ones. + @c ENDOFRANGE inspl + @c ENDOFRANGE recspl ! @node Fields, Nonconstant Fields, Records, Reading Files @section Examining Fields @cindex examining fields @cindex fields @cindex accessing fields + @c STARTOFRANGE fiex + @cindex fields, examining + @cindex POSIX @command{awk}, field separators and + @cindex field separators, POSIX and + @cindex separators, field, POSIX and When @command{awk} reads an input record, the record is ! automatically @dfn{parsed} or separated by the interpreter into chunks called @dfn{fields}. By default, fields are separated by @dfn{whitespace}, like words in a line. Whitespace in @command{awk} means any string of one or more spaces, *************** *** 3993,4004 **** @cindex @code{$} field operator @cindex field operator @code{$} A dollar-sign (@samp{$}) is used to refer to a field in an @command{awk} program, followed by the number of the field you want. Thus, @code{$1} refers to the first field, @code{$2} to the second, and so on. (Unlike the Unix shells, the field numbers are not limited to single digits. ! @code{$127} is the one hundred and twenty-seventh field in the record.) For example, suppose the following is a line of input: @example --- 4135,4150 ---- @cindex @code{$} field operator @cindex field operator @code{$} + @cindex @code{$} (dollar sign), @code{$} field operator + @cindex dollar sign (@code{$}), @code{$} field operator + @c The comma here does NOT mark a secondary term: + @cindex field operators, dollar sign as A dollar-sign (@samp{$}) is used to refer to a field in an @command{awk} program, followed by the number of the field you want. Thus, @code{$1} refers to the first field, @code{$2} to the second, and so on. (Unlike the Unix shells, the field numbers are not limited to single digits. ! @code{$127} is the one hundred twenty-seventh field in the record.) For example, suppose the following is a line of input: @example *************** *** 4013,4019 **** field. @cindex @code{NF} variable ! @cindex number of fields, @code{NF} @code{NF} is a built-in variable whose value is the number of fields in the current record. @command{awk} automatically updates the value of @code{NF} each time it reads a record. No matter how many fields --- 4159,4165 ---- field. @cindex @code{NF} variable ! @cindex fields, number of @code{NF} is a built-in variable whose value is the number of fields in the current record. @command{awk} automatically updates the value of @code{NF} each time it reads a record. No matter how many fields *************** *** 4023,4029 **** one (such as @code{$8} when the record has only seven fields), you get the empty string. (If used in a numeric operation, you get zero.) ! The use of @code{$0}, which looks like a reference to the ``zeroth'' field, is a special case: it represents the whole input record when you are not interested in specific fields. Here are some more examples: --- 4169,4175 ---- one (such as @code{$8} when the record has only seven fields), you get the empty string. (If used in a numeric operation, you get zero.) ! The use of @code{$0}, which looks like a reference to the ``zero-th'' field, is a special case: it represents the whole input record when you are not interested in specific fields. Here are some more examples: *************** *** 4055,4063 **** @print{} macfoo A @print{} sabafoo C @end example ! @node Non-Constant Fields, Changing Fields, Fields, Reading Files ! @section Non-Constant Field Numbers The number of a field does not need to be a constant. Any expression in the @command{awk} language can be used after a @samp{$} to refer to a --- 4201,4212 ---- @print{} macfoo A @print{} sabafoo C @end example + @c ENDOFRANGE fiex ! @node Nonconstant Fields, Changing Fields, Fields, Reading Files ! @section Nonconstant Field Numbers ! @cindex fields, numbers ! @cindex field numbers The number of a field does not need to be a constant. Any expression in the @command{awk} language can be used after a @samp{$} to refer to a *************** *** 4106,4122 **** @code{$NF} is not a special feature---it is the direct consequence of evaluating @code{NF} and using its value as a field number. ! @node Changing Fields, Field Separators, Non-Constant Fields, Reading Files @section Changing the Contents of a Field @cindex fields, changing contents of - @cindex changing contents of a field - @cindex assignment to fields The contents of a field, as seen by @command{awk}, can be changed within an @command{awk} program; this changes what @command{awk} perceives as the current input record. (The actual input is untouched; @command{awk} @emph{never} modifies the input file.) ! Consider this example and its output: @example $ awk '@{ nboxes = $3 ; $3 = $3 - 10 --- 4255,4269 ---- @code{$NF} is not a special feature---it is the direct consequence of evaluating @code{NF} and using its value as a field number. ! @node Changing Fields, Field Separators, Nonconstant Fields, Reading Files @section Changing the Contents of a Field @cindex fields, changing contents of The contents of a field, as seen by @command{awk}, can be changed within an @command{awk} program; this changes what @command{awk} perceives as the current input record. (The actual input is untouched; @command{awk} @emph{never} modifies the input file.) ! Consider the following example and its output: @example $ awk '@{ nboxes = $3 ; $3 = $3 - 10 *************** *** 4171,4176 **** --- 4318,4325 ---- @dots{} @end example + @cindex adding, fields + @cindex fields, adding @noindent We've just created @code{$6}, whose value is the sum of fields @code{$2}, @code{$3}, @code{$4}, and @code{$5}. The @samp{+} sign *************** *** 4183,4188 **** --- 4332,4340 ---- the appropriate number of field separators between it and the previously existing fields. + @cindex @code{OFS} variable + @cindex output field separator, See @code{OFS} variable + @cindex field separators, See Also @code{OFS} This recomputation affects and is affected by @code{NF} (the number of fields; @pxref{Fields, ,Examining Fields}). It is also affected by a feature that has not been discussed yet: *************** *** 4240,4246 **** and @code{NF} is updated with the value six. @c FIXME: Verify that this is in POSIX ! @cindex dark corner Decrementing @code{NF} throws away the values of the fields after the new value of @code{NF} and recomputes @code{$0}. @value{DARKCORNER} --- 4392,4399 ---- and @code{NF} is updated with the value six. @c FIXME: Verify that this is in POSIX ! @cindex dark corner, @code{NF} variable, decrementing ! @cindex @code{NF} variable, decrementing Decrementing @code{NF} throws away the values of the fields after the new value of @code{NF} and recomputes @code{$0}. @value{DARKCORNER} *************** *** 4253,4261 **** @print{} a b c @end example ! @cindex portability issues @strong{Caution:} Some versions of @command{awk} don't rebuild @code{$0} when @code{NF} is decremented. Caveat emptor. @node Field Separators, Constant Size, Changing Fields, Reading Files @section Specifying How Fields Are Separated --- 4406,4416 ---- @print{} a b c @end example ! @c the comma before decrementing does NOT represent a tertiary entry ! @cindex portability, @code{NF} variable, decrementing @strong{Caution:} Some versions of @command{awk} don't rebuild @code{$0} when @code{NF} is decremented. Caveat emptor. + @c ENDOFRANGE ficon @node Field Separators, Constant Size, Changing Fields, Reading Files @section Specifying How Fields Are Separated *************** *** 4269,4275 **** @cindex @code{FS} variable @cindex fields, separating ! @cindex field separator, @code{FS} The @dfn{field separator}, which is either a single character or a regular expression, controls the way @command{awk} splits an input record into fields. @command{awk} scans the input record for character sequences that --- 4424,4433 ---- @cindex @code{FS} variable @cindex fields, separating ! @c STARTOFRANGE fisepr ! @cindex field separators ! @c STARTOFRANGE fisepg ! @cindex fields, separating The @dfn{field separator}, which is either a single character or a regular expression, controls the way @command{awk} splits an input record into fields. @command{awk} scans the input record for character sequences that *************** *** 4288,4301 **** @samp{@bullet{}gai@bullet{}pan}. Note the leading spaces in the values of the second and third fields. ! @cindex common mistakes ! @cindex mistakes, common ! @cindex errors, common The field separator is represented by the built-in variable @code{FS}. Shell programmers take note: @command{awk} does @emph{not} use the name @code{IFS} that is used by the POSIX-compliant shells (such as the Unix Bourne shell, @command{sh}, or @command{bash}). The value of @code{FS} can be changed in the @command{awk} program with the assignment operator, @samp{=} (@pxref{Assignment Ops, ,Assignment Expressions}). Often the right time to do this is at the beginning of execution --- 4446,4458 ---- @samp{@bullet{}gai@bullet{}pan}. Note the leading spaces in the values of the second and third fields. ! @cindex troubleshooting, @command{awk} uses @code{FS} not @code{IFS} The field separator is represented by the built-in variable @code{FS}. Shell programmers take note: @command{awk} does @emph{not} use the name @code{IFS} that is used by the POSIX-compliant shells (such as the Unix Bourne shell, @command{sh}, or @command{bash}). + @cindex @code{FS} variable, changing value of The value of @code{FS} can be changed in the @command{awk} program with the assignment operator, @samp{=} (@pxref{Assignment Ops, ,Assignment Expressions}). Often the right time to do this is at the beginning of execution *************** *** 4310,4315 **** --- 4467,4473 ---- awk 'BEGIN @{ FS = "," @} ; @{ print $2 @}' @end example + @cindex @code{BEGIN} pattern @noindent Given the input line: *************** *** 4321,4328 **** this @command{awk} program extracts and prints the string @samp{@bullet{}29@bullet{}Oak@bullet{}St.}. ! @cindex field separator, choice of @cindex regular expressions as field separators Sometimes the input data contains separator characters that don't separate fields the way you thought they would. For instance, the person's name in the example we just used might have a title or --- 4479,4487 ---- this @command{awk} program extracts and prints the string @samp{@bullet{}29@bullet{}Oak@bullet{}St.}. ! @cindex field separators, choice of @cindex regular expressions as field separators + @cindex field separators, regular expressions as Sometimes the input data contains separator characters that don't separate fields the way you thought they would. For instance, the person's name in the example we just used might have a title or *************** *** 4341,4346 **** --- 4500,4507 ---- (If the data is not in a form that is easy to process, perhaps you can massage it first with a separate @command{awk} program.) + @cindex newlines, as field separators + @cindex whitespace, as field separators Fields are normally separated by whitespace sequences (spaces, tabs, and newlines), not by single spaces. Two spaces in a row do not delimit an empty field. The default value of the field separator @code{FS} *************** *** 4361,4366 **** --- 4522,4531 ---- @node Regexp Field Splitting, Single Character Fields, Field Separators, Field Separators @subsection Using Regular Expressions to Separate Fields + @c STARTOFRANGE regexpfs + @cindex regular expressions, as field separators + @c STARTOFRANGE fsregexp + @cindex field separators, regular expressions as The previous @value{SUBSECTION} discussed the use of single characters or simple strings as the value of @code{FS}. *************** *** 4374,4383 **** @noindent makes every area of an input line that consists of a comma followed by a ! space and a tab into a field separator. @ifinfo (@samp{\t} ! is an @dfn{escape sequence} that stands for a tab; @pxref{Escape Sequences}, for the complete list of similar escape sequences.) @end ifinfo --- 4539,4548 ---- @noindent makes every area of an input line that consists of a comma followed by a ! space and a TAB into a field separator. @ifinfo (@samp{\t} ! is an @dfn{escape sequence} that stands for a TAB; @pxref{Escape Sequences}, for the complete list of similar escape sequences.) @end ifinfo *************** *** 4414,4421 **** @end example @noindent ! @cindex null string ! @cindex empty string In this case, the first field is @dfn{null} or empty. The stripping of leading and trailing whitespace also comes into --- 4579,4587 ---- @end example @noindent ! @cindex null strings ! @cindex strings, null ! @cindex empty strings, See null strings In this case, the first field is @dfn{null} or empty. The stripping of leading and trailing whitespace also comes into *************** *** 4434,4445 **** separated by the value of @code{OFS}. Because the leading whitespace was ignored when finding @code{$1}, it is not part of the new @code{$0}. Finally, the last @code{print} statement prints the new @code{$0}. @node Single Character Fields, Command Line Field Separator, Regexp Field Splitting, Field Separators @subsection Making Each Character a Separate Field ! @cindex differences between @command{gawk} and @command{awk} @cindex single-character fields There are times when you may want to examine each character of a record separately. This can be done in @command{gawk} by simply assigning the null string (@code{""}) to @code{FS}. In this case, --- 4600,4614 ---- separated by the value of @code{OFS}. Because the leading whitespace was ignored when finding @code{$1}, it is not part of the new @code{$0}. Finally, the last @code{print} statement prints the new @code{$0}. + @c ENDOFRANGE regexpfs + @c ENDOFRANGE fsregexp @node Single Character Fields, Command Line Field Separator, Regexp Field Splitting, Field Separators @subsection Making Each Character a Separate Field ! @cindex differences in @command{awk} and @command{gawk}, single-character fields @cindex single-character fields + @cindex fields, single-character There are times when you may want to examine each character of a record separately. This can be done in @command{gawk} by simply assigning the null string (@code{""}) to @code{FS}. In this case, *************** *** 4457,4463 **** @print{} Field 3 is b @end example ! @cindex dark corner Traditionally, the behavior of @code{FS} equal to @code{""} was not defined. In this case, most versions of Unix @command{awk} simply treat the entire record as only having one field. --- 4626,4633 ---- @print{} Field 3 is b @end example ! @cindex dark corner, @code{FS} as null string ! @cindex FS variable, as null string Traditionally, the behavior of @code{FS} equal to @code{""} was not defined. In this case, most versions of Unix @command{awk} simply treat the entire record as only having one field. *************** *** 4470,4478 **** @node Command Line Field Separator, Field Splitting Summary, Single Character Fields, Field Separators @subsection Setting @code{FS} from the Command Line @cindex @code{-F} option ! @cindex command-line option, @code{-F} ! @cindex field separator, on command line ! @cindex command line, setting @code{FS} on @code{FS} can be set on the command line. Use the @option{-F} option to do so. For example: --- 4640,4651 ---- @node Command Line Field Separator, Field Splitting Summary, Single Character Fields, Field Separators @subsection Setting @code{FS} from the Command Line @cindex @code{-F} option ! @cindex options, command-line ! @cindex command line, options ! @cindex field separators, on command line ! @c The comma before "setting" does NOT represent a tertiary ! @cindex command line, @code{FS} on, setting ! @cindex @code{FS} variable, setting from command line @code{FS} can be set on the command line. Use the @option{-F} option to do so. For example: *************** *** 4483,4489 **** @noindent sets @code{FS} to the @samp{,} character. Notice that the option uses ! a capital @samp{F} instead of a lowercase @option{-f}, which specifies a file containing an @command{awk} program. Case is significant in command-line options: the @option{-F} and @option{-f} options have nothing to do with each other. --- 4656,4663 ---- @noindent sets @code{FS} to the @samp{,} character. Notice that the option uses ! an uppercase @samp{F} instead of a lowercase @samp{f}. The latter ! option (@option{-f}) specifies a file containing an @command{awk} program. Case is significant in command-line options: the @option{-F} and @option{-f} options have nothing to do with each other. *************** *** 4502,4517 **** @end example @noindent Because @samp{\} is used for quoting in the shell, @command{awk} sees @samp{-F\\}. Then @command{awk} processes the @samp{\\} for escape characters (@pxref{Escape Sequences}), finally yielding a single @samp{\} to use for the field separator. ! @cindex historical features As a special case, in compatibility mode (@pxref{Options, ,Command-Line Options}), if the argument to @option{-F} is @samp{t}, then @code{FS} is set to ! the tab character. If you type @samp{-F\t} at the shell, without any quotes, the @samp{\} gets deleted, so @command{awk} figures that you really want your fields to be separated with tabs and not @samp{t}s. Use @samp{-v FS="t"} or @samp{-F"[t]"} on the command line --- 4676,4693 ---- @end example @noindent + @cindex @code{\} (backslash), as field separators + @cindex backslash (@code{\}), as field separators Because @samp{\} is used for quoting in the shell, @command{awk} sees @samp{-F\\}. Then @command{awk} processes the @samp{\\} for escape characters (@pxref{Escape Sequences}), finally yielding a single @samp{\} to use for the field separator. ! @c @cindex historical features As a special case, in compatibility mode (@pxref{Options, ,Command-Line Options}), if the argument to @option{-F} is @samp{t}, then @code{FS} is set to ! the TAB character. If you type @samp{-F\t} at the shell, without any quotes, the @samp{\} gets deleted, so @command{awk} figures that you really want your fields to be separated with tabs and not @samp{t}s. Use @samp{-v FS="t"} or @samp{-F"[t]"} on the command line *************** *** 4558,4563 **** --- 4734,4741 ---- originally intended. This demonstrates why you have to be careful in choosing your field and record separators. + @c The comma after "password files" does NOT start a tertiary + @cindex Unix @command{awk}, password files, field separators and Perhaps the most common use of a single character as the field separator occurs when processing the Unix system password file. On many Unix systems, each user has a separate entry in the system password *************** *** 4579,4590 **** @end example @node Field Splitting Summary, , Command Line Field Separator, Field Separators ! @subsection Field Splitting Summary The following table summarizes how fields are split, based on the ! value of @code{FS}. (@samp{==} means ``is equal to.'') @table @code @item FS == " " --- 4757,4768 ---- @end example @node Field Splitting Summary, , Command Line Field Separator, Field Separators ! @subsection Field-Splitting Summary The following table summarizes how fields are split, based on the ! value of @code{FS} (@samp{==} means ``is equal to''): @table @code @item FS == " " *************** *** 4611,4627 **** @c fakenode --- for prepinfo @subheading Advanced Notes: Changing @code{FS} Does Not Affect the Fields ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} According to the POSIX standard, @command{awk} is supposed to behave as if each record is split into fields at the time it is read. In particular, this means that if you change the value of @code{FS} after a record is read, the value of the fields (i.e., how they were split) should reflect the old value of @code{FS}, not the new one. ! @cindex dark corner @cindex @command{sed} utility ! @cindex stream editor However, many implementations of @command{awk} do not work this way. Instead, they defer splitting the fields until a field is actually referenced. The fields are split --- 4789,4805 ---- @c fakenode --- for prepinfo @subheading Advanced Notes: Changing @code{FS} Does Not Affect the Fields ! @cindex POSIX @command{awk}, field separators and ! @cindex field separators, POSIX and According to the POSIX standard, @command{awk} is supposed to behave as if each record is split into fields at the time it is read. In particular, this means that if you change the value of @code{FS} after a record is read, the value of the fields (i.e., how they were split) should reflect the old value of @code{FS}, not the new one. ! @cindex dark corner, field separators @cindex @command{sed} utility ! @cindex stream editors However, many implementations of @command{awk} do not work this way. Instead, they defer splitting the fields until a field is actually referenced. The fields are split *************** *** 4652,4657 **** --- 4830,4837 ---- @example root:nSijPlPhZZwgE:0:0:Root:/: @end example + @c ENDOFRANGE fisepr + @c ENDOFRANGE fisepg @node Constant Size, Multiple Line, Field Separators, Reading Files @section Reading Fixed-Width Data *************** *** 4668,4673 **** --- 4848,4856 ---- the first reading.) @end ifinfo + @cindex data, fixed-width + @cindex fixed-width data + @cindex advanced features, fixed-width data @command{gawk} @value{PVERSION} 2.13 introduced a facility for dealing with fixed-width fields with no distinctive field separator. For example, data of this nature arises in the input for old Fortran programs where *************** *** 4682,4689 **** (@pxref{String Functions, ,String Manipulation Functions}), this is awkward and inefficient for a large number of fields. ! @cindex fatal errors @cindex @command{w} utility The splitting of an input record into fixed-width fields is specified by assigning a string containing space-separated numbers to the built-in variable @code{FIELDWIDTHS}. Each number specifies the width of the field, --- 4865,4874 ---- (@pxref{String Functions, ,String Manipulation Functions}), this is awkward and inefficient for a large number of fields. ! @c comma before specifying is part of tertiary ! @cindex troubleshooting, fatal errors, field widths, specifying @cindex @command{w} utility + @cindex @code{FIELDWIDTHS} variable The splitting of an input record into fixed-width fields is specified by assigning a string containing space-separated numbers to the built-in variable @code{FIELDWIDTHS}. Each number specifies the width of the field, *************** *** 4711,4717 **** The following program takes the above input, converts the idle time to number of seconds, and prints out the first two fields and the calculated ! idle time. @strong{Note:} This program uses a number of @command{awk} features that --- 4896,4902 ---- The following program takes the above input, converts the idle time to number of seconds, and prints out the first two fields and the calculated ! idle time: @strong{Note:} This program uses a number of @command{awk} features that *************** *** 4762,4769 **** Exercise: Write a ballot card reading program @end ignore ! Assigning a value to @code{FS} causes @command{gawk} to return to using ! @code{FS} for field splitting. Use @samp{FS = FS} to make this happen, without having to know the current value of @code{FS}. In order to tell which kind of field splitting is in effect, use @code{PROCINFO["FS"]} --- 4947,4955 ---- Exercise: Write a ballot card reading program @end ignore ! @cindex @command{gawk}, splitting fields and ! Assigning a value to @code{FS} causes @command{gawk} to use ! @code{FS} for field splitting again. Use @samp{FS = FS} to make this happen, without having to know the current value of @code{FS}. In order to tell which kind of field splitting is in effect, use @code{PROCINFO["FS"]} *************** *** 4787,4800 **** @node Multiple Line, Getline, Constant Size, Reading Files @section Multiple-Line Records ! @cindex multiple line records ! @cindex input, multiple line records ! @cindex reading files, multiple line records ! @cindex records, multiple line In some databases, a single line cannot conveniently hold all the information in one entry. In such cases, you can use multiline records. The first step in doing this is to choose your data format. One technique is to use an unusual character or string to separate records. For example, you could use the formfeed character (written @samp{\f} in @command{awk}, as in C) to separate them, making each record --- 4973,4990 ---- @node Multiple Line, Getline, Constant Size, Reading Files @section Multiple-Line Records ! @c STARTOFRANGE recm ! @cindex records, multiline ! @c STARTOFRANGE imr ! @cindex input, multiline records ! @c STARTOFRANGE frm ! @cindex files, reading, multiline records ! @cindex input, files, See input files In some databases, a single line cannot conveniently hold all the information in one entry. In such cases, you can use multiline records. The first step in doing this is to choose your data format. + @cindex record separators, with multiline records One technique is to use an unusual character or string to separate records. For example, you could use the formfeed character (written @samp{\f} in @command{awk}, as in C) to separate them, making each record *************** *** 4803,4813 **** other character could equally well be used, as long as it won't be part of the data in a record. Another technique is to have blank lines separate records. By a special dispensation, an empty string as the value of @code{RS} indicates that records are separated by one or more blank lines. When @code{RS} is set to the empty string, each record always ends at the first blank line ! encountered. The next record doesn't start until the first non-blank line that follows. No matter how many blank lines appear in a row, they all act as one record separator. (Blank lines must be completely empty; lines that contain only --- 4993,5004 ---- other character could equally well be used, as long as it won't be part of the data in a record. + @cindex @code{RS} variable, multiline records and Another technique is to have blank lines separate records. By a special dispensation, an empty string as the value of @code{RS} indicates that records are separated by one or more blank lines. When @code{RS} is set to the empty string, each record always ends at the first blank line ! encountered. The next record doesn't start until the first nonblank line that follows. No matter how many blank lines appear in a row, they all act as one record separator. (Blank lines must be completely empty; lines that contain only *************** *** 4822,4831 **** sequence when there is a choice (@pxref{Leftmost Longest, ,How Much Text Matches?}). So the next record doesn't start until ! the first non-blank line that follows---no matter how many blank lines appear in a row, they are considered one record separator. ! @cindex dark corner There is an important difference between @samp{RS = ""} and @samp{RS = "\n\n+"}. In the first case, leading newlines in the input @value{DF} are ignored, and if a file ends without extra blank lines --- 5013,5022 ---- sequence when there is a choice (@pxref{Leftmost Longest, ,How Much Text Matches?}). So the next record doesn't start until ! the first nonblank line that follows---no matter how many blank lines appear in a row, they are considered one record separator. ! @cindex dark corner, multiline records There is an important difference between @samp{RS = ""} and @samp{RS = "\n\n+"}. In the first case, leading newlines in the input @value{DF} are ignored, and if a file ends without extra blank lines *************** *** 4833,4838 **** --- 5024,5030 ---- In the second case, this special processing is not done. @value{DARKCORNER} + @cindex field separators, in multiline records Now that the input is separated into records, the second step is to separate the fields in the record. One way to do this is to divide each of the lines into fields in the normal manner. This happens by default *************** *** 4854,4860 **** expression matches a single newline.) A practical example of a @value{DF} organized this way might be a mailing list, where each entry is separated by blank lines. Consider a mailing ! list in a file named @file{addresses}, that looks like this: @example Jane Doe --- 5046,5052 ---- expression matches a single newline.) A practical example of a @value{DF} organized this way might be a mailing list, where each entry is separated by blank lines. Consider a mailing ! list in a file named @file{addresses}, which looks like this: @example Jane Doe *************** *** 4932,4953 **** @item RS == @var{regexp} Records are separated by occurrences of characters that match @var{regexp}. Leading and trailing matches of @var{regexp} delimit empty records. ! (This is a @command{gawk} extension, it is not specified by the POSIX standard.) @end table @cindex @code{RT} variable In all cases, @command{gawk} sets @code{RT} to the input text that matched the value specified by @code{RS}. @node Getline, , Multiple Line, Reading Files @section Explicit Input with @code{getline} ! @cindex @code{getline} built-in function @cindex input, explicit - @cindex explicit input - @cindex input, @code{getline} command - @cindex reading files, @code{getline} command So far we have been getting our input data from @command{awk}'s main input stream---either the standard input (usually your terminal, sometimes the output from another program) or from the --- 5124,5146 ---- @item RS == @var{regexp} Records are separated by occurrences of characters that match @var{regexp}. Leading and trailing matches of @var{regexp} delimit empty records. ! (This is a @command{gawk} extension; it is not specified by the POSIX standard.) @end table @cindex @code{RT} variable In all cases, @command{gawk} sets @code{RT} to the input text that matched the value specified by @code{RS}. + @c ENDOFRANGE recm + @c ENDOFRANGE imr + @c ENDOFRANGE frm @node Getline, , Multiple Line, Reading Files @section Explicit Input with @code{getline} ! @c STARTOFRANGE getl ! @cindex @code{getline} command, explicit input with @cindex input, explicit So far we have been getting our input data from @command{awk}'s main input stream---either the standard input (usually your terminal, sometimes the output from another program) or from the *************** *** 4963,4972 **** rest of this @value{DOCUMENT} and have a good knowledge of how @command{awk} works. @cindex @code{ERRNO} variable ! @cindex differences between @command{gawk} and @command{awk} ! @cindex @code{getline}, return values The @code{getline} command returns one if it finds a record and zero if ! the end of the file is encountered. If there is some error in getting a record, such as a file that cannot be opened, then @code{getline} returns @minus{}1. In this case, @command{gawk} sets the variable @code{ERRNO} to a string describing the error that occurred. --- 5156,5165 ---- rest of this @value{DOCUMENT} and have a good knowledge of how @command{awk} works. @cindex @code{ERRNO} variable ! @cindex differences in @command{awk} and @command{gawk}, @code{getline} command ! @cindex @code{getline} command, return values The @code{getline} command returns one if it finds a record and zero if ! it encounters the end of the file. If there is some error in getting a record, such as a file that cannot be opened, then @code{getline} returns @minus{}1. In this case, @command{gawk} sets the variable @code{ERRNO} to a string describing the error that occurred. *************** *** 4997,5004 **** from the current input file. All it does in this case is read the next input record and split it up into fields. This is useful if you've finished processing the current record, but want to do some special ! processing @emph{right now} on the next record. Here's an ! example: @example @{ --- 5190,5196 ---- from the current input file. All it does in this case is read the next input record and split it up into fields. This is useful if you've finished processing the current record, but want to do some special ! processing on the next record @emph{right now}. For example: @example @{ *************** *** 5049,5054 **** --- 5241,5248 ---- @node Getline/Variable, Getline/File, Plain Getline, Getline @subsection Using @code{getline} into a Variable + @c comma before using is NOT for tertiary + @cindex variables, @code{getline} command into, using You can use @samp{getline @var{var}} to read the next record from @command{awk}'s input into the variable @var{var}. No other processing is *************** *** 5058,5065 **** any rules. This form of @code{getline} allows you to read that line and store it in a variable so that the main read-a-line-and-check-each-rule loop of @command{awk} never sees it. ! The following example swaps every two lines of input. ! The program is as follows: @example @{ --- 5252,5258 ---- any rules. This form of @code{getline} allows you to read that line and store it in a variable so that the main read-a-line-and-check-each-rule loop of @command{awk} never sees it. ! The following example swaps every two lines of input: @example @{ *************** *** 5101,5107 **** @cindex input redirection @cindex redirection of input ! @cindex @code{<} I/O operator Use @samp{getline < @var{file}} to read the next record from @var{file}. Here @var{file} is a string-valued expression that specifies the @value{FN}. @samp{< @var{file}} is called a @dfn{redirection} --- 5294,5302 ---- @cindex input redirection @cindex redirection of input ! @cindex @code{<} (left angle bracket), @code{<} operator (I/O) ! @cindex left angle bracket (@code{<}), @code{<} operator (I/O) ! @cindex operators, input/output Use @samp{getline < @var{file}} to read the next record from @var{file}. Here @var{file} is a string-valued expression that specifies the @value{FN}. @samp{< @var{file}} is called a @dfn{redirection} *************** *** 5126,5131 **** --- 5321,5327 ---- the normal manner, so the values of @code{$0} and the other fields are changed, resulting in a new value of @code{NF}. + @cindex POSIX @command{awk}, @code{<} operator and @c Thanks to Paul Eggert for initial wording here According to POSIX, @samp{getline < @var{expression}} is ambiguous if @var{expression} contains unparenthesized operators other than *************** *** 5138,5143 **** --- 5334,5341 ---- @node Getline/Variable/File, Getline/Pipe, Getline/File, Getline @subsection Using @code{getline} into a Variable from a File + @c comma before using is NOT for tertiary + @cindex variables, @code{getline} command into, using Use @samp{getline @var{var} < @var{file}} to read input from the file *************** *** 5164,5172 **** @end example Note here how the name of the extra input file is not built into ! the program; it is taken directly from the data, from the second field on the @samp{@@include} line. The @code{close} function is called to ensure that if two identical @samp{@@include} lines appear in the input, the entire specified file is included twice. --- 5362,5371 ---- @end example Note here how the name of the extra input file is not built into ! the program; it is taken directly from the data, specifically from the second field on the @samp{@@include} line. + @cindex @code{close} function The @code{close} function is called to ensure that if two identical @samp{@@include} lines appear in the input, the entire specified file is included twice. *************** *** 5182,5190 **** @node Getline/Pipe, Getline/Variable/Pipe, Getline/Variable/File, Getline @subsection Using @code{getline} from a Pipe ! @cindex @code{|} I/O operator @cindex input pipeline ! @cindex pipeline, input The output of a command can also be piped into @code{getline}, using @samp{@var{command} | getline}. In this case, the string @var{command} is run as a shell command and its output --- 5381,5391 ---- @node Getline/Pipe, Getline/Variable/Pipe, Getline/Variable/File, Getline @subsection Using @code{getline} from a Pipe ! @cindex @code{|} (vertical bar), @code{|} operator (I/O) ! @cindex vertical bar (@code{|}), @code{|} operator (I/O) @cindex input pipeline ! @cindex pipes, input ! @cindex operators, input/output The output of a command can also be piped into @code{getline}, using @samp{@var{command} | getline}. In this case, the string @var{command} is run as a shell command and its output *************** *** 5207,5212 **** --- 5408,5414 ---- @end example @noindent + @cindex @code{close} function The @code{close} function is called to ensure that if two identical @samp{@@execute} lines appear in the input, the command is run for each one. *************** *** 5242,5255 **** @end example @noindent ! Notice that this program ran the command @command{who} and printed the result. (If you try this program yourself, you will of course get different results, depending upon who is logged in on your system.) This variation of @code{getline} splits the record into fields, sets the ! value of @code{NF} and recomputes the value of @code{$0}. The values of @code{NR} and @code{FNR} are not changed. @c Thanks to Paul Eggert for initial wording here According to POSIX, @samp{@var{expression} | getline} is ambiguous if @var{expression} contains unparenthesized operators other than --- 5444,5458 ---- @end example @noindent ! Notice that this program ran the command @command{who} and printed the previous result. (If you try this program yourself, you will of course get different results, depending upon who is logged in on your system.) This variation of @code{getline} splits the record into fields, sets the ! value of @code{NF}, and recomputes the value of @code{$0}. The values of @code{NR} and @code{FNR} are not changed. + @cindex POSIX @command{awk}, @code{|} I/O operator and @c Thanks to Paul Eggert for initial wording here According to POSIX, @samp{@var{expression} | getline} is ambiguous if @var{expression} contains unparenthesized operators other than *************** *** 5264,5269 **** --- 5467,5474 ---- @node Getline/Variable/Pipe, Getline/Coprocess, Getline/Pipe, Getline @subsection Using @code{getline} into a Variable from a Pipe + @c comma before using is NOT for tertiary + @cindex variables, @code{getline} command into, using When you use @samp{@var{command} | getline @var{var}}, the output of @var{command} is sent through a pipe to *************** *** 5297,5305 **** @node Getline/Coprocess, Getline/Variable/Coprocess, Getline/Variable/Pipe, Getline @subsection Using @code{getline} from a Coprocess ! @cindex coprocess ! @cindex @code{|&} I/O operator ! @cindex differences between @command{gawk} and @command{awk} Input into @code{getline} from a pipe is a one-way operation. The command that is started with @samp{@var{command} | getline} only --- 5502,5514 ---- @node Getline/Coprocess, Getline/Variable/Coprocess, Getline/Variable/Pipe, Getline @subsection Using @code{getline} from a Coprocess ! @cindex coprocesses, @code{getline} from ! @c comma before using is NOT for tertiary ! @cindex @code{getline} command, coprocesses, using from ! @cindex @code{|} (vertical bar), @code{|&} operator (I/O) ! @cindex vertical bar (@code{|}), @code{|&} operator (I/O) ! @cindex operators, input/output ! @cindex differences in @command{awk} and @command{gawk}, input/output operators Input into @code{getline} from a pipe is a one-way operation. The command that is started with @samp{@var{command} | getline} only *************** *** 5310,5316 **** @command{gawk} allows you start a @dfn{coprocess}, with which two-way communications are possible. This is done with the @samp{|&} operator. ! Typically, you write data to the coprocess first, and then read results back, as shown in the following: @example --- 5519,5525 ---- @command{gawk} allows you start a @dfn{coprocess}, with which two-way communications are possible. This is done with the @samp{|&} operator. ! Typically, you write data to the coprocess first and then read results back, as shown in the following: @example *************** *** 5325,5331 **** @code{FNR} are not changed, because the main input stream is not used. However, the record is split into fields in ! the normal manner, thus changing the values of @code{$0}, the other fields, and of @code{NF}. Coprocesses are an advanced feature. They are discussed here only because --- 5534,5540 ---- @code{FNR} are not changed, because the main input stream is not used. However, the record is split into fields in ! the normal manner, thus changing the values of @code{$0}, of the other fields, and of @code{NF}. Coprocesses are an advanced feature. They are discussed here only because *************** *** 5335,5340 **** --- 5544,5551 ---- @node Getline/Variable/Coprocess, Getline Notes, Getline/Coprocess, Getline @subsection Using @code{getline} into a Variable from a Coprocess + @c comma before using is NOT for tertiary + @cindex variables, @code{getline} command into, using When you use @samp{@var{command} |& getline @var{var}}, the output from the coprocess @var{command} is sent through a two-way pipe to @code{getline} *************** *** 5352,5358 **** @end ifinfo @node Getline Notes, Getline Summary, Getline/Variable/Coprocess, Getline ! @subsection Points About @code{getline} to Remember Here are some miscellaneous points about @code{getline} that you should bear in mind: --- 5563,5569 ---- @end ifinfo @node Getline Notes, Getline Summary, Getline/Variable/Coprocess, Getline ! @subsection Points to Remember About @code{getline} Here are some miscellaneous points about @code{getline} that you should bear in mind: *************** *** 5363,5382 **** program and start testing the new record against every pattern. However, the new record is tested against any subsequent rules. ! @cindex differences between @command{gawk} and @command{awk} ! @cindex limitations ! @cindex implementation limits @item Many @command{awk} implementations limit the number of pipelines that an @command{awk} program may have open to just one. In @command{gawk}, there is no such limit. You can open as many pipelines (and coprocesses) as the underlying operating system permits. ! @cindex side effects ! @cindex @code{FILENAME} variable ! @cindex dark corner ! @cindex @code{getline}, setting @code{FILENAME} ! @cindex @code{FILENAME}, being set by @code{getline} @item An interesting side effect occurs if you use @code{getline} without a redirection inside a @code{BEGIN} rule. Because an unredirected @code{getline} --- 5574,5595 ---- program and start testing the new record against every pattern. However, the new record is tested against any subsequent rules. ! @cindex differences in @command{awk} and @command{gawk}, implementation limitations ! @cindex implementation issues, @command{gawk}, limits ! @cindex @command{awk}, implementations, limits ! @cindex @command{gawk}, implementation issues, limits @item Many @command{awk} implementations limit the number of pipelines that an @command{awk} program may have open to just one. In @command{gawk}, there is no such limit. You can open as many pipelines (and coprocesses) as the underlying operating system permits. ! @cindex side effects, @code{FILENAME} variable ! @c The comma before "setting with" does NOT represent a tertiary ! @cindex @code{FILENAME} variable, @code{getline}, setting with ! @cindex dark corner, @code{FILENAME} variable ! @cindex @code{getline} command, @code{FILENAME} variable and ! @cindex @code{BEGIN} pattern, @code{getline} and @item An interesting side effect occurs if you use @code{getline} without a redirection inside a @code{BEGIN} rule. Because an unredirected @code{getline} *************** *** 5391,5404 **** @node Getline Summary, , Getline Notes, Getline @subsection Summary of @code{getline} Variants The following table summarizes the eight variants of @code{getline}, listing which built-in variables are set by each one. @multitable {@var{command} @code{|& getline} @var{var}} {1234567890123456789012345678901234567890} ! @item @code{getline} @tab Sets @code{$0}, @code{NF}, @code{FNR} and @code{NR} ! @item @code{getline} @var{var} @tab Sets @var{var}, @code{FNR} and @code{NR} @item @code{getline <} @var{file} @tab Sets @code{$0} and @code{NF} --- 5604,5618 ---- @node Getline Summary, , Getline Notes, Getline @subsection Summary of @code{getline} Variants + @cindex @code{getline} command, variants The following table summarizes the eight variants of @code{getline}, listing which built-in variables are set by each one. @multitable {@var{command} @code{|& getline} @var{var}} {1234567890123456789012345678901234567890} ! @item @code{getline} @tab Sets @code{$0}, @code{NF}, @code{FNR}, and @code{NR} ! @item @code{getline} @var{var} @tab Sets @var{var}, @code{FNR}, and @code{NR} @item @code{getline <} @var{file} @tab Sets @code{$0} and @code{NF} *************** *** 5408,5426 **** @item @var{command} @code{| getline} @var{var} @tab Sets @var{var} ! @item @var{command} @code{|& getline} @tab Sets @code{$0} and @code{NF} ! (this is a @command{gawk} extension) ! @item @var{command} @code{|& getline} @var{var} @tab Sets @var{var} ! (this is a @command{gawk} extension) @end multitable @node Printing, Expressions, Reading Files, Top @chapter Printing Output @cindex printing ! @cindex output ! One of the most common programming actions is to @dfn{print} or output, some or all of the input. Use the @code{print} statement for simple output, and the @code{printf} statement for fancier formatting. --- 5622,5644 ---- @item @var{command} @code{| getline} @var{var} @tab Sets @var{var} ! @item @var{command} @code{|& getline} @tab Sets @code{$0} and @code{NF}. ! This is a @command{gawk} extension ! @item @var{command} @code{|& getline} @var{var} @tab Sets @var{var}. ! This is a @command{gawk} extension @end multitable + @c ENDOFRANGE getl + @c ENDOFRANGE inex + @c ENDOFRANGE infir @node Printing, Expressions, Reading Files, Top @chapter Printing Output + @c STARTOFRANGE prnt @cindex printing ! @cindex output, printing, See printing ! One of the most common programming actions is to @dfn{print}, or output, some or all of the input. Use the @code{print} statement for simple output, and the @code{printf} statement for fancier formatting. *************** *** 5430,5438 **** columns, whether to use exponential notation or not, and so on. (For the exceptions, @pxref{Output Separators}, and @ref{OFMT, ,Controlling Numeric Output with @code{print}}.) ! For that, you need the @code{printf} statement (@pxref{Printf, ,Using @code{printf} Statements for Fancier Printing}). Besides basic and formatted printing, this @value{CHAPTER} also covers I/O redirections to files and pipes, introduces the special @value{FN}s that @command{gawk} processes internally, --- 5648,5659 ---- columns, whether to use exponential notation or not, and so on. (For the exceptions, @pxref{Output Separators}, and @ref{OFMT, ,Controlling Numeric Output with @code{print}}.) ! For printing with specifications, you need the @code{printf} statement (@pxref{Printf, ,Using @code{printf} Statements for Fancier Printing}). + @c STARTOFRANGE prnts + @cindex @code{print} statement + @cindex @code{printf} statement Besides basic and formatted printing, this @value{CHAPTER} also covers I/O redirections to files and pipes, introduces the special @value{FN}s that @command{gawk} processes internally, *************** *** 5454,5460 **** @node Print, Print Examples, Printing, Printing @section The @code{print} Statement - @cindex @code{print} statement The @code{print} statement is used to produce output with simple, standardized formatting. Specify only the strings or numbers to print, in a --- 5675,5680 ---- *************** *** 5475,5487 **** current record (such as @code{$1}), variables, or any @command{awk} expression. Numeric values are converted to strings and then printed. The simple statement @samp{print} with no items is equivalent to @samp{print $0}: it prints the entire current record. To print a blank line, use @samp{print ""}, where @code{""} is the empty string. To print a fixed piece of text, use a string constant, such as @w{@code{"Don't Panic"}}, as one item. If you forget to use the ! double quote characters, your text is taken as an @command{awk} ! expression and you will probably get an error. Keep in mind that a space is printed between any two items. @node Print Examples, Output Separators, Print, Printing --- 5695,5710 ---- current record (such as @code{$1}), variables, or any @command{awk} expression. Numeric values are converted to strings and then printed. + @cindex records, printing + @cindex lines, blank, printing + @cindex text, printing The simple statement @samp{print} with no items is equivalent to @samp{print $0}: it prints the entire current record. To print a blank line, use @samp{print ""}, where @code{""} is the empty string. To print a fixed piece of text, use a string constant, such as @w{@code{"Don't Panic"}}, as one item. If you forget to use the ! double-quote characters, your text is taken as an @command{awk} ! expression, and you will probably get an error. Keep in mind that a space is printed between any two items. @node Print Examples, Output Separators, Print, Printing *************** *** 5492,5497 **** --- 5715,5721 ---- newline, the newline is output along with the rest of the string. A single @code{print} statement can make any number of lines this way. + @cindex newlines, printing The following is an example of printing a string that contains embedded newlines (the @samp{\n} is an escape sequence, used to represent the newline character; @pxref{Escape Sequences}): *************** *** 5503,5508 **** --- 5727,5733 ---- @print{} line three @end example + @cindex fields, printing The next example, which is run on the @file{inventory-shipped} file, prints the first two fields of each input record, with a space between them: *************** *** 5515,5523 **** @dots{} @end example ! @cindex common mistakes ! @cindex mistakes, common ! @cindex errors, common A common mistake in using the @code{print} statement is to omit the comma between two items. This often has the effect of making the items run together in the output, with no space. The reason for this is that --- 5740,5748 ---- @dots{} @end example ! @cindex @code{print} statement, commas, omitting ! @c comma does NOT start tertiary ! @cindex troubleshooting, @code{print} statement, omitting commas A common mistake in using the @code{print} statement is to omit the comma between two items. This often has the effect of making the items run together in the output, with no space. The reason for this is that *************** *** 5532,5537 **** --- 5757,5764 ---- @dots{} @end example + @c comma does NOT start tertiary + @cindex @code{BEGIN} pattern, headings, adding To someone unfamiliar with the @file{inventory-shipped} file, neither example's output makes much sense. A heading line at the beginning would make it clearer. Let's add some headings to our table of months *************** *** 5571,5576 **** --- 5798,5806 ---- @end group @end example + @c comma does NOT start tertiary + @cindex @code{printf} statement, columns, aligning + @cindex columns, aligning Lining up columns this way can get pretty complicated when there are many columns to fix. Counting spaces for two or three columns is simple, but any more than this can take up *************** *** 5578,5595 **** created (@pxref{Printf, ,Using @code{printf} Statements for Fancier Printing}); one of its specialties is lining up columns of data. ! @cindex line continuation @strong{Note:} You can continue either a @code{print} or @code{printf} statement simply by putting a newline after any comma (@pxref{Statements/Lines, ,@command{awk} Statements Versus Lines}). @node Output Separators, OFMT, Print Examples, Printing @section Output Separators - @cindex output field separator, @code{OFS} - @cindex output record separator, @code{ORS} @cindex @code{OFS} variable - @cindex @code{ORS} variable As mentioned previously, a @code{print} statement contains a list of items separated by commas. In the output, the items are normally separated by single spaces. However, this doesn't need to be the case; --- 5808,5824 ---- created (@pxref{Printf, ,Using @code{printf} Statements for Fancier Printing}); one of its specialties is lining up columns of data. ! @cindex line continuations, in @code{print} statement ! @cindex @code{print} statement, line continuations and @strong{Note:} You can continue either a @code{print} or @code{printf} statement simply by putting a newline after any comma (@pxref{Statements/Lines, ,@command{awk} Statements Versus Lines}). + @c ENDOFRANGE prnts @node Output Separators, OFMT, Print Examples, Printing @section Output Separators @cindex @code{OFS} variable As mentioned previously, a @code{print} statement contains a list of items separated by commas. In the output, the items are normally separated by single spaces. However, this doesn't need to be the case; *************** *** 5605,5610 **** --- 5834,5843 ---- value of @code{ORS} is the string @code{"\n"}; i.e., a newline character. Thus, each @code{print} statement normally makes a separate line. + @cindex output, records + @cindex output record separator, See @code{ORS} variable + @cindex @code{ORS} variable + @cindex @code{BEGIN} pattern, @code{OFS}/@code{ORS} variables, assigning values to In order to change how output fields and records are separated, assign new values to the variables @code{OFS} and @code{ORS}. The usual place to do this is in the @code{BEGIN} rule *************** *** 5644,5653 **** @node OFMT, Printf, Output Separators, Printing @section Controlling Numeric Output with @code{print} ! @cindex @code{OFMT} variable ! @cindex numeric output format ! @cindex format, numeric output ! @cindex output format specifier, @code{OFMT} When the @code{print} statement is used to print numeric values, @command{awk} internally converts the number to a string of characters and prints that string. @command{awk} uses the @code{sprintf} function --- 5877,5885 ---- @node OFMT, Printf, Output Separators, Printing @section Controlling Numeric Output with @code{print} ! @cindex numeric, output format ! @c the comma does NOT start a secondary ! @cindex formats, numeric output When the @code{print} statement is used to print numeric values, @command{awk} internally converts the number to a string of characters and prints that string. @command{awk} uses the @code{sprintf} function *************** *** 5660,5665 **** --- 5892,5901 ---- more fully in @ref{Control Letters, , Format-Control Letters}. + @cindex @code{sprintf} function + @cindex @code{OFMT} variable + @c the comma before OFMT does NOT start a tertiary + @cindex output, format specifier, @code{OFMT} The built-in variable @code{OFMT} contains the default format specification that @code{print} uses with @code{sprintf} when it wants to convert a number to a string for printing. *************** *** 5676,5694 **** @end example @noindent ! @cindex dark corner ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} According to the POSIX standard, @command{awk}'s behavior is undefined if @code{OFMT} contains anything but a floating-point conversion specification. @value{DARKCORNER} @node Printf, Redirection, OFMT, Printing @section Using @code{printf} Statements for Fancier Printing - @cindex formatted output - @cindex output, formatted - @cindex @code{printf} statement For more precise control over the output format than what is normally provided by @code{print}, use @code{printf}. @code{printf} can be used to --- 5912,5931 ---- @end example @noindent ! @cindex dark corner, @code{OFMT} variable ! @cindex POSIX @command{awk}, @code{OFMT} variable and ! @cindex @code{OFMT} variable, POSIX @command{awk} and According to the POSIX standard, @command{awk}'s behavior is undefined if @code{OFMT} contains anything but a floating-point conversion specification. @value{DARKCORNER} @node Printf, Redirection, OFMT, Printing @section Using @code{printf} Statements for Fancier Printing + @c STARTOFRANGE printfs + @cindex @code{printf} statement + @cindex output, formatted + @cindex formatting output For more precise control over the output format than what is normally provided by @code{print}, use @code{printf}. @code{printf} can be used to *************** *** 5719,5728 **** @noindent The entire list of arguments may optionally be enclosed in parentheses. The parentheses are necessary if any of the item expressions use the @samp{>} ! relational operator; otherwise it can be confused with a redirection (@pxref{Redirection, ,Redirecting Output of @code{print} and @code{printf}}). ! @cindex format string The difference between @code{printf} and @code{print} is the @var{format} argument. This is an expression whose value is taken as a string; it specifies how to output each of the other arguments. It is called the --- 5956,5965 ---- @noindent The entire list of arguments may optionally be enclosed in parentheses. The parentheses are necessary if any of the item expressions use the @samp{>} ! relational operator; otherwise, it can be confused with a redirection (@pxref{Redirection, ,Redirecting Output of @code{print} and @code{printf}}). ! @cindex format strings The difference between @code{printf} and @code{print} is the @var{format} argument. This is an expression whose value is taken as a string; it specifies how to output each of the other arguments. It is called the *************** *** 5755,5762 **** @node Control Letters, Format Modifiers, Basic Printf, Printf @subsection Format-Control Letters ! @cindex @code{printf}, format-control characters ! @cindex format specifier, @code{printf} A format specifier starts with the character @samp{%} and ends with a @dfn{format-control letter}---it tells the @code{printf} statement --- 5992,5999 ---- @node Control Letters, Format Modifiers, Basic Printf, Printf @subsection Format-Control Letters ! @cindex @code{printf} statement, format-control characters ! @cindex format specifiers, @code{printf} statement A format specifier starts with the character @samp{%} and ends with a @dfn{format-control letter}---it tells the @code{printf} statement *************** *** 5826,5837 **** instead of @samp{a} through @samp{f}. @item %% ! This isn't a format-control letter but it does have meaning---the sequence @samp{%%} outputs one @samp{%}; it does not consume an argument and it ignores any modifiers. @end table ! @cindex dark corner @strong{Note:} When using the integer format-control letters for values that are outside the range of a C @code{long} integer, @command{gawk} switches to the --- 6063,6075 ---- instead of @samp{a} through @samp{f}. @item %% ! This isn't a format-control letter, but it does have meaning---the sequence @samp{%%} outputs one @samp{%}; it does not consume an argument and it ignores any modifiers. @end table ! @cindex dark corner, format-control characters ! @cindex @command{gawk}, format-control characters @strong{Note:} When using the integer format-control letters for values that are outside the range of a C @code{long} integer, @command{gawk} switches to the *************** *** 5842,5849 **** @node Format Modifiers, Printf Examples, Control Letters, Printf @subsection Modifiers for @code{printf} Formats ! @cindex @code{printf}, modifiers ! @cindex modifiers (in format specifiers) A format specification can also include @dfn{modifiers} that can control how much of the item's value is printed, as well as how much space it gets. The modifiers come between the @samp{%} and the format-control letter. --- 6080,6089 ---- @node Format Modifiers, Printf Examples, Control Letters, Printf @subsection Modifiers for @code{printf} Formats ! @c STARTOFRANGE pfm ! @cindex @code{printf} statement, modifiers ! @c the comma here does NOT start a secondary ! @cindex modifiers, in format specifiers A format specification can also include @dfn{modifiers} that can control how much of the item's value is printed, as well as how much space it gets. The modifiers come between the @samp{%} and the format-control letter. *************** *** 5853,5868 **** which they may appear: @table @code ! @cindex differences between @command{gawk} and @command{awk} ! @cindex @code{printf}, positional specifier ! @cindex positional specifier, @code{printf} @item @var{N}$ An integer constant followed by a @samp{$} is a @dfn{positional specifier}. Normally, format specifications are applied to arguments in the order given in the format string. With a positional specifier, the format specification is applied to a specific argument, instead of what would be the next argument in the list. Positional specifiers begin ! counting with one: @example printf "%s %s\n", "don't", "panic" --- 6093,6109 ---- which they may appear: @table @code ! @cindex differences in @command{awk} and @command{gawk}, @code{print}/@code{printf} statements ! @cindex @code{printf} statement, positional specifiers ! @c the command does NOT start a secondary ! @cindex positional specifiers, @code{printf} statement @item @var{N}$ An integer constant followed by a @samp{$} is a @dfn{positional specifier}. Normally, format specifications are applied to arguments in the order given in the format string. With a positional specifier, the format specification is applied to a specific argument, instead of what would be the next argument in the list. Positional specifiers begin ! counting with one. Thus: @example printf "%s %s\n", "don't", "panic" *************** *** 5880,5886 **** For now, we will not use them. @item - ! The minus sign, used before the width modifier (see further on in this table), says to left-justify the argument within its specified width. Normally, the argument --- 6121,6127 ---- For now, we will not use them. @item - ! The minus sign, used before the width modifier (see later on in this table), says to left-justify the argument within its specified width. Normally, the argument *************** *** 5898,5904 **** negative values with a minus sign. @item + ! The plus sign, used before the width modifier (see further on in this table), says to always supply a sign for numeric conversions, even if the data to format is positive. The @samp{+} overrides the space modifier. --- 6139,6145 ---- negative values with a minus sign. @item + ! The plus sign, used before the width modifier (see later on in this table), says to always supply a sign for numeric conversions, even if the data to format is positive. The @samp{+} overrides the space modifier. *************** *** 6013,6022 **** @noindent This is not particularly easy to read but it does work. ! @cindex fatal errors ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} ! @cindex lint checks C programmers may be used to supplying additional @samp{l}, @samp{L}, and @samp{h} modifiers in @code{printf} format strings. These are not valid in @command{awk}. --- 6254,6262 ---- @noindent This is not particularly easy to read but it does work. ! @c @cindex lint checks ! @cindex troubleshooting, fatal errors, @code{printf} format strings ! @cindex POSIX @command{awk}, @code{printf} format strings and C programmers may be used to supplying additional @samp{l}, @samp{L}, and @samp{h} modifiers in @code{printf} format strings. These are not valid in @command{awk}. *************** *** 6025,6030 **** --- 6265,6271 ---- (@pxref{Options, ,Command-Line Options}), @command{gawk} warns about their use. If @option{--posix} is supplied, their use is a fatal error. + @c ENDOFRANGE pfm @node Printf Examples, , Format Modifiers, Printf @subsection Examples Using @code{printf} *************** *** 6111,6116 **** --- 6352,6358 ---- @file{inventory-shipped} example that was covered earlier in the @value{SECTION} on the @code{print} statement (@pxref{Print, ,The @code{print} Statement}). + @c ENDOFRANGE printfs @node Redirection, Special Files, Printf, Printing @section Redirecting Output of @code{print} and @code{printf} *************** *** 6127,6139 **** Redirections in @command{awk} are written just like redirections in shell commands, except that they are written inside the @command{awk} program. There are four forms of output redirection: output to a file, output appended to a file, output through a pipe to another command, and output to a coprocess. They are all shown for the @code{print} statement, but they work identically for @code{printf}: @table @code ! @cindex @code{>} I/O operator @item print @var{items} > @var{output-file} This type of redirection prints the items into the output file named @var{output-file}. The @value{FN} @var{output-file} can be any --- 6369,6386 ---- Redirections in @command{awk} are written just like redirections in shell commands, except that they are written inside the @command{awk} program. + @c the commas here are part of the see also + @cindex @code{print} statement, See Also redirection, of output + @cindex @code{printf} statement, See Also redirection, of output There are four forms of output redirection: output to a file, output appended to a file, output through a pipe to another command, and output to a coprocess. They are all shown for the @code{print} statement, but they work identically for @code{printf}: @table @code ! @cindex @code{>} (right angle bracket), @code{>} operator (I/O) ! @cindex right angle bracket (@code{>}), @code{>} operator (I/O) ! @cindex operators, input/output @item print @var{items} > @var{output-file} This type of redirection prints the items into the output file named @var{output-file}. The @value{FN} @var{output-file} can be any *************** *** 6165,6171 **** @noindent Each output file contains one name or number per line. ! @cindex @code{>>} I/O operator @item print @var{items} >> @var{output-file} This type of redirection prints the items into the pre-existing output file named @var{output-file}. The difference between this and the --- 6412,6419 ---- @noindent Each output file contains one name or number per line. ! @cindex @code{>} (right angle bracket), @code{>>} operator (I/O) ! @cindex right angle bracket (@code{>}), @code{>>} operator (I/O) @item print @var{items} >> @var{output-file} This type of redirection prints the items into the pre-existing output file named @var{output-file}. The difference between this and the *************** *** 6174,6182 **** appended to the file. If @var{output-file} does not exist, then it is created. ! @cindex @code{|} I/O operator ! @cindex pipes for output ! @cindex output, piping @item print @var{items} | @var{command} It is also possible to send output to another program through a pipe instead of into a file. This type of redirection opens a pipe to --- 6422,6430 ---- appended to the file. If @var{output-file} does not exist, then it is created. ! @cindex @code{|} (vertical bar), @code{|} operator (I/O) ! @cindex pipes, output ! @cindex output, pipes @item print @var{items} | @var{command} It is also possible to send output to another program through a pipe instead of into a file. This type of redirection opens a pipe to *************** *** 6218,6231 **** @end example The message is built using string concatenation and saved in the variable ! @code{m}. It is then sent down the pipeline to the @command{mail} program. (The parentheses group the items to concatenate---see @ref{Concatenation, ,String Concatenation}.) The @code{close} function is called here because it's a good idea to close the pipe as soon as all the intended output has been sent to it. @xref{Close Files And Pipes, ,Closing Input and Output Redirections}, ! for more information on this. This example also illustrates the use of a variable to represent a @var{file} or @var{command}---it is not necessary to always --- 6466,6479 ---- @end example The message is built using string concatenation and saved in the variable ! @code{m}. It's then sent down the pipeline to the @command{mail} program. (The parentheses group the items to concatenate---see @ref{Concatenation, ,String Concatenation}.) The @code{close} function is called here because it's a good idea to close the pipe as soon as all the intended output has been sent to it. @xref{Close Files And Pipes, ,Closing Input and Output Redirections}, ! for more information. This example also illustrates the use of a variable to represent a @var{file} or @var{command}---it is not necessary to always *************** *** 6233,6247 **** because @command{awk} requires that the string value be spelled identically every time. ! @cindex coprocess ! @cindex @code{|&} I/O operator ! @cindex differences between @command{gawk} and @command{awk} @item print @var{items} |& @var{command} This type of redirection prints the items to the input of @var{command}. The difference between this and the single-@samp{|} redirection is that the output from @var{command} can be read with @code{getline}. ! Thus @var{command} is a @dfn{coprocess}, that works together with, but subsidiary to, the @command{awk} program. This feature is a @command{gawk} extension, and is not available in --- 6481,6496 ---- because @command{awk} requires that the string value be spelled identically every time. ! @cindex coprocesses ! @cindex @code{|} (vertical bar), @code{|&} operator (I/O) ! @cindex operators, input/output ! @cindex differences in @command{awk} and @command{gawk}, input/output operators @item print @var{items} |& @var{command} This type of redirection prints the items to the input of @var{command}. The difference between this and the single-@samp{|} redirection is that the output from @var{command} can be read with @code{getline}. ! Thus @var{command} is a @dfn{coprocess}, which works together with, but subsidiary to, the @command{awk} program. This feature is a @command{gawk} extension, and is not available in *************** *** 6251,6263 **** @end table Redirecting output using @samp{>}, @samp{>>}, @samp{|}, or @samp{|&} ! asks the system to open a file, pipe, or coprocess, only if the particular @var{file} or @var{command} you specify has not already been written to by your program or if it has been closed since it was last written to. ! @cindex common mistakes ! @cindex mistakes, common ! @cindex errors, common It is a common error to use @samp{>} redirection for the first @code{print} to a file, and then to use @samp{>>} for subsequent output: --- 6500,6510 ---- @end table Redirecting output using @samp{>}, @samp{>>}, @samp{|}, or @samp{|&} ! asks the system to open a file, pipe, or coprocess only if the particular @var{file} or @var{command} you specify has not already been written to by your program or if it has been closed since it was last written to. ! @cindex troubleshooting, printing It is a common error to use @samp{>} redirection for the first @code{print} to a file, and then to use @samp{>>} for subsequent output: *************** *** 6275,6283 **** use @samp{>} for all the @code{print} statements, since the output file is only opened once. ! @cindex differences between @command{gawk} and @command{awk} ! @cindex limitations ! @cindex implementation limits @ifnotinfo As mentioned earlier (@pxref{Getline Notes, ,Points About @code{getline} to Remember}), --- 6522,6532 ---- use @samp{>} for all the @code{print} statements, since the output file is only opened once. ! @cindex differences in @command{awk} and @command{gawk}, implementation limitations ! @c the comma here does NOT start a secondary ! @cindex implementation issues, @command{gawk}, limits ! @cindex @command{awk}, implementation issues, pipes ! @cindex @command{gawk}, implementation issues, pipes @ifnotinfo As mentioned earlier (@pxref{Getline Notes, ,Points About @code{getline} to Remember}), *************** *** 6293,6309 **** @c fakenode --- for prepinfo @subheading Advanced Notes: Piping into @command{sh} ! @cindex advanced notes ! @cindex shell, piping commands into ! @cindex piping commands into the shell ! A particularly powerful way to use redirection is to build command lines, and pipe them into the shell, @command{sh}. For example, suppose you have a list of files brought over from a system where all the @value{FN}s are stored in uppercase, and you wish to rename them to have names in all lowercase. The following program is both simple and efficient: ! @cindex @command{mv} utility @example @{ printf("mv %s %s\n", $0, tolower($0)) | "sh" @} --- 6542,6557 ---- @c fakenode --- for prepinfo @subheading Advanced Notes: Piping into @command{sh} ! @cindex advanced features, piping into @command{sh} ! @cindex shells, piping commands into ! A particularly powerful way to use redirection is to build command lines and pipe them into the shell, @command{sh}. For example, suppose you have a list of files brought over from a system where all the @value{FN}s are stored in uppercase, and you wish to rename them to have names in all lowercase. The following program is both simple and efficient: ! @c @cindex @command{mv} utility @example @{ printf("mv %s %s\n", $0, tolower($0)) | "sh" @} *************** *** 6316,6324 **** --- 6564,6576 ---- The program builds up a list of command lines, using the @command{mv} utility to rename the files. It then sends the list to the shell for execution. + @c ENDOFRANGE outre + @c ENDOFRANGE reout @node Special Files, Close Files And Pipes, Redirection, Printing @section Special @value{FFN}s in @command{gawk} + @c STARTOFRANGE gfn + @cindex @command{gawk}, @value{FN}s in @command{gawk} provides a number of special @value{FN}s that it interprets internally. These @value{FN}s provide access to standard file descriptors, *************** *** 6334,6342 **** @node Special FD, Special Process, Special Files, Special Files @subsection Special Files for Standard Descriptors @cindex standard input @cindex standard output ! @cindex standard error output @cindex file descriptors Running programs conventionally have three input and output streams already available to them for reading and writing. These are known as --- 6586,6597 ---- @node Special FD, Special Process, Special Files, Special Files @subsection Special Files for Standard Descriptors @cindex standard input + @cindex input, standard @cindex standard output ! @cindex output, standard ! @cindex error output @cindex file descriptors + @cindex files, descriptors, See file descriptors Running programs conventionally have three input and output streams already available to them for reading and writing. These are known as *************** *** 6345,6354 **** they are often redirected with the shell, via the @samp{<}, @samp{<<}, @samp{>}, @samp{>>}, @samp{>&}, and @samp{|} operators. Standard error is typically used for writing error messages; the reason there are two separate ! streams, standard output, and standard error, is so that they can be redirected separately. ! @cindex differences between @command{gawk} and @command{awk} In other implementations of @command{awk}, the only way to write an error message to standard error in an @command{awk} program is as follows: --- 6600,6610 ---- they are often redirected with the shell, via the @samp{<}, @samp{<<}, @samp{>}, @samp{>>}, @samp{>&}, and @samp{|} operators. Standard error is typically used for writing error messages; the reason there are two separate ! streams, standard output and standard error, is so that they can be redirected separately. ! @cindex differences in @command{awk} and @command{gawk}, error messages ! @cindex error handling In other implementations of @command{awk}, the only way to write an error message to standard error in an @command{awk} program is as follows: *************** *** 6379,6391 **** streams, as well as any other inherited open files. If the @value{FN} matches one of these special names when @command{gawk} redirects input or output, then it directly uses the stream that the @value{FN} stands for. ! (These special @value{FN}s work for all operating systems that @command{gawk} ! has been ported to, not just those that are POSIX-compliant.): ! @cindex @file{/dev/stdin} special file ! @cindex @file{/dev/stdout} special file ! @cindex @file{/dev/stderr} special file ! @cindex @file{/dev/fd} special files @table @file @item /dev/stdin The standard input (file descriptor 0). --- 6635,6650 ---- streams, as well as any other inherited open files. If the @value{FN} matches one of these special names when @command{gawk} redirects input or output, then it directly uses the stream that the @value{FN} stands for. ! These special @value{FN}s work for all operating systems that @command{gawk} ! has been ported to, not just those that are POSIX-compliant: ! @cindex @value{FN}s, standard streams in @command{gawk} ! @cindex @code{/dev/@dots{}} special files (@command{gawk}) ! @cindex files, @code{/dev/@dots{}} special files ! @c @cindex @code{/dev/stdin} special file ! @c @cindex @code{/dev/stdout} special file ! @c @cindex @code{/dev/stderr} special file ! @c @cindex @code{/dev/fd} special files @table @file @item /dev/stdin The standard input (file descriptor 0). *************** *** 6413,6421 **** print "Serious error detected!" > "/dev/stderr" @end example ! @cindex common mistakes ! @cindex mistakes, common ! @cindex errors, common Note the use of quotes around the @value{FN}. Like any other redirection, the value must be a string. It is a common error to omit the quotes, which leads --- 6672,6678 ---- print "Serious error detected!" > "/dev/stderr" @end example ! @cindex troubleshooting, quotes with @value{FN}s Note the use of quotes around the @value{FN}. Like any other redirection, the value must be a string. It is a common error to omit the quotes, which leads *************** *** 6425,6430 **** --- 6682,6689 ---- @node Special Process, Special Network, Special FD, Special Files @subsection Special Files for Process-Related Information + @cindex files, for process information + @cindex process information, files for @command{gawk} also provides special @value{FN}s that give access to information about the running @command{gawk} process. Each of these ``files'' provides a single record of information. To read them more than once, they must *************** *** 6432,6442 **** (@pxref{Close Files And Pipes, ,Closing Input and Output Redirections}). The @value{FN}s are: ! @cindex process information ! @cindex @file{/dev/pid} special file ! @cindex @file{/dev/pgrpid} special file ! @cindex @file{/dev/ppid} special file ! @cindex @file{/dev/user} special file @table @file @item /dev/pid Reading this file returns the process ID of the current process, --- 6691,6700 ---- (@pxref{Close Files And Pipes, ,Closing Input and Output Redirections}). The @value{FN}s are: ! @c @cindex @code{/dev/pid} special file ! @c @cindex @code{/dev/pgrpid} special file ! @c @cindex @code{/dev/ppid} special file ! @c @cindex @code{/dev/user} special file @table @file @item /dev/pid Reading this file returns the process ID of the current process, *************** *** 6482,6489 **** as well as for I/O redirections within an @command{awk} program. They may not be used as source files with the @option{-f} option. ! @cindex automatic warnings ! @cindex warnings, automatic @strong{Note:} The special files that provide process-related information are now considered obsolete and will disappear entirely --- 6740,6747 ---- as well as for I/O redirections within an @command{awk} program. They may not be used as source files with the @option{-f} option. ! @c @cindex automatic warnings ! @c @cindex warnings, automatic @strong{Note:} The special files that provide process-related information are now considered obsolete and will disappear entirely *************** *** 6495,6504 **** @node Special Network, Special Caveats, Special Process, Special Files @subsection Special Files for Network Communications Starting with @value{PVERSION} 3.1 of @command{gawk}, @command{awk} programs can open a two-way ! TCP/IP connection, acting as either a client or server. This is done using a special @value{FN} of the form: @example --- 6753,6764 ---- @node Special Network, Special Caveats, Special Process, Special Files @subsection Special Files for Network Communications + @cindex networks, support for + @cindex TCP/IP, support for Starting with @value{PVERSION} 3.1 of @command{gawk}, @command{awk} programs can open a two-way ! TCP/IP connection, acting as either a client or a server. This is done using a special @value{FN} of the form: @example *************** *** 6519,6533 **** @subsection Special @value{FFN} Caveats Here is a list of things to bear in mind when using the ! special @value{FN}s that @command{gawk} provides. @itemize @bullet @item Recognition of these special @value{FN}s is disabled if @command{gawk} is in compatibility mode (@pxref{Options, ,Command-Line Options}). ! @cindex automatic warnings ! @cindex warnings, automatic @item @ifnottex The --- 6779,6796 ---- @subsection Special @value{FFN} Caveats Here is a list of things to bear in mind when using the ! special @value{FN}s that @command{gawk} provides: @itemize @bullet + @cindex compatibility mode (@command{gawk}), @value{FN}s + @cindex @value{FN}s, in compatibility mode @item Recognition of these special @value{FN}s is disabled if @command{gawk} is in compatibility mode (@pxref{Options, ,Command-Line Options}). ! @c @cindex automatic warnings ! @c @cindex warnings, automatic ! @cindex @code{PROCINFO} array @item @ifnottex The *************** *** 6548,6556 **** @item Starting with @value{PVERSION} 3.1, @command{gawk} @emph{always} interprets these special @value{FN}s.@footnote{Older versions of ! @command{gawk} would only interpret these names internally if the system ! did not actually have a a @file{/dev/fd} directory or any of the other ! above listed special files. Usually this didn't make a difference, but sometimes it did; thus, it was decided to make @command{gawk}'s behavior consistent on all systems and to have it always interpret the special @value{FN}s itself.} --- 6811,6819 ---- @item Starting with @value{PVERSION} 3.1, @command{gawk} @emph{always} interprets these special @value{FN}s.@footnote{Older versions of ! @command{gawk} would interpret these names internally only if the system ! did not actually have a @file{/dev/fd} directory or any of the other ! special files listed earlier. Usually this didn't make a difference, but sometimes it did; thus, it was decided to make @command{gawk}'s behavior consistent on all systems and to have it always interpret the special @value{FN}s itself.} *************** *** 6561,6574 **** close any of the files related to file descriptors 0, 1, and 2. Doing so results in unpredictable behavior. @end itemize @node Close Files And Pipes, , Special Files, Printing @section Closing Input and Output Redirections ! @cindex closing input files and pipes ! @cindex closing output files and pipes ! @cindex closing coprocesses ! @cindex coprocess ! @cindex @code{close} built-in function If the same @value{FN} or the same shell command is used with @code{getline} more than once during the execution of an @command{awk} program --- 6824,6845 ---- close any of the files related to file descriptors 0, 1, and 2. Doing so results in unpredictable behavior. @end itemize + @c ENDOFRANGE gfn @node Close Files And Pipes, , Special Files, Printing @section Closing Input and Output Redirections ! @cindex files, output, See output files ! @c STARTOFRANGE ifc ! @cindex input files, closing ! @c comma before closing is NOT start of tertiary ! @c STARTOFRANGE ofc ! @cindex output, files, closing ! @c STARTOFRANGE pc ! @cindex pipes, closing ! @c STARTOFRANGE cc ! @cindex coprocesses, closing ! @c comma before using is NOT start of tertiary ! @cindex @code{getline} command, coprocesses, using from If the same @value{FN} or the same shell command is used with @code{getline} more than once during the execution of an @command{awk} program *************** *** 6583,6588 **** --- 6854,6860 ---- writes to the same file or command are appended to the previous writes. The file or pipe stays open until @command{awk} exits. + @cindex @code{close} function This implies that special steps are necessary in order to read the same file again from the beginning, or to rerun a shell command (rather than reading more output from the same command). The @code{close} function *************** *** 6665,6672 **** a separate message. @end itemize ! @cindex differences between @command{gawk} and @command{awk} ! @cindex portability issues If you use more files than the system allows you to have open, @command{gawk} attempts to multiplex the available open files among your @value{DF}s. @command{gawk}'s ability to do this depends upon the --- 6937,6944 ---- a separate message. @end itemize ! @cindex differences in @command{awk} and @command{gawk}, @code{close} function ! @cindex portability, @code{close} function and If you use more files than the system allows you to have open, @command{gawk} attempts to multiplex the available open files among your @value{DF}s. @command{gawk}'s ability to do this depends upon the *************** *** 6706,6711 **** --- 6978,6985 ---- does not represent a file, pipe or coprocess that was opened with a redirection. + @c comma is part of tertiary + @cindex @code{|} (vertical bar), @code{|&} operator (I/O), pipes, closing When using the @samp{|&} operator to communicate with a coprocess, it is occasionally useful to be able to close one end of the two-way pipe without closing the other. *************** *** 6722,6732 **** @c fakenode --- for prepinfo @subheading Advanced Notes: Using @code{close}'s Return Value ! @cindex advanced notes ! @cindex dark corner ! @cindex differences between @command{gawk} and @command{awk} ! @cindex @code{close}, return value ! @cindex return value from @code{close} In many versions of Unix @command{awk}, the @code{close} function is actually a statement. It is a syntax error to try and use the return --- 6996,7008 ---- @c fakenode --- for prepinfo @subheading Advanced Notes: Using @code{close}'s Return Value ! @cindex advanced features, @code{close} function ! @cindex dark corner, @code{close} function ! @cindex @code{close} function, return values ! @c comma does NOT start secondary ! @cindex return values, @code{close} function ! @cindex differences in @command{awk} and @command{gawk}, @code{close} function ! @cindex Unix @command{awk}, @code{close} function and In many versions of Unix @command{awk}, the @code{close} function is actually a statement. It is a syntax error to try and use the return *************** *** 6759,6764 **** --- 7035,7043 ---- It allows you to get the output from a command as well as its exit status. + @cindex pipes, closing + @c comma does NOT start tertiary + @cindex POSIX @command{awk}, pipes, closing For POSIX-compliant systems, if the exit status is a number above 128, then the program was terminated by a signal. Subtract 128 to get the signal number: *************** *** 6776,6785 **** from @code{print} or @code{printf}, the return value from @code{close} is that of the library's @code{pclose} function. @node Expressions, Patterns and Actions, Printing, Top @chapter Expressions ! @cindex expression Expressions are the basic building blocks of @command{awk} patterns and actions. An expression evaluates to a value that you can print, test, --- 7055,7070 ---- from @code{print} or @code{printf}, the return value from @code{close} is that of the library's @code{pclose} function. + @c ENDOFRANGE ifc + @c ENDOFRANGE ofc + @c ENDOFRANGE pc + @c ENDOFRANGE cc + @c ENDOFRANGE prnt @node Expressions, Patterns and Actions, Printing, Top @chapter Expressions ! @c STARTOFRANGE exps ! @cindex expressions Expressions are the basic building blocks of @command{awk} patterns and actions. An expression evaluates to a value that you can print, test, *************** *** 6832,6846 **** @menu * Scalar Constants:: Numeric and string constants. ! * Non-decimal-numbers:: What are octal and hex numbers. * Regexp Constants:: Regular Expression constants. @end menu ! @node Scalar Constants, Non-decimal-numbers, Constants, Constants @subsection Numeric and String Constants ! @cindex numeric constant ! @cindex numeric value A @dfn{numeric constant} stands for a number. This number can be an integer, a decimal fraction, or a number in scientific (exponential) notation.@footnote{The internal representation of all numbers, --- 7117,7130 ---- @menu * Scalar Constants:: Numeric and string constants. ! * Nondecimal-numbers:: What are octal and hex numbers. * Regexp Constants:: Regular Expression constants. @end menu ! @node Scalar Constants, Nondecimal-numbers, Constants, Constants @subsection Numeric and String Constants ! @cindex numeric, constants A @dfn{numeric constant} stands for a number. This number can be an integer, a decimal fraction, or a number in scientific (exponential) notation.@footnote{The internal representation of all numbers, *************** *** 6858,6878 **** @cindex string constants A string constant consists of a sequence of characters enclosed in ! double quote marks. For example: @example "parrot" @end example @noindent ! @cindex differences between @command{gawk} and @command{awk} represents the string whose contents are @samp{parrot}. Strings in @command{gawk} can be of any length, and they can contain any of the possible eight-bit ASCII characters including ASCII @sc{nul} (character code zero). Other @command{awk} implementations may have difficulty with some character codes. ! @node Non-decimal-numbers, Regexp Constants, Scalar Constants, Constants @subsection Octal and Hexadecimal Numbers @cindex octal numbers @cindex hexadecimal numbers --- 7142,7163 ---- @cindex string constants A string constant consists of a sequence of characters enclosed in ! double-quotation marks. For example: @example "parrot" @end example @noindent ! @cindex differences in @command{awk} and @command{gawk}, strings ! @cindex strings, length of represents the string whose contents are @samp{parrot}. Strings in @command{gawk} can be of any length, and they can contain any of the possible eight-bit ASCII characters including ASCII @sc{nul} (character code zero). Other @command{awk} implementations may have difficulty with some character codes. ! @node Nondecimal-numbers, Regexp Constants, Scalar Constants, Constants @subsection Octal and Hexadecimal Numbers @cindex octal numbers @cindex hexadecimal numbers *************** *** 6882,6897 **** In @command{awk}, all numbers are in decimal; i.e., base 10. Many other programming languages allow you to specify numbers in other bases, often octal (base 8) and hexadecimal (base 16). ! In octal, the numbers go 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, etc.. ! Just as @samp{11} in decimal is 1 times 10 plus 1, so ! @samp{11} in octal is 1 times 8, plus 1. This equals nine in decimal. In hexadecimal, there are 16 digits. Since the everyday decimal ! number system only has ten digits (@samp{0}---@samp{9}), the letters @samp{a} through @samp{f} are used to represent the rest. (Case in the letters is usually irrelevant; hexadecimal @samp{a} and @samp{A} have the same value.) ! Thus, @samp{11} in ! hexadecimal is 1 times 16 plus 1, which equals 17 in decimal. Just by looking at plain @samp{11}, you can't tell what base it's in. So, in C, C++, and other languages derived from C, --- 7167,7182 ---- In @command{awk}, all numbers are in decimal; i.e., base 10. Many other programming languages allow you to specify numbers in other bases, often octal (base 8) and hexadecimal (base 16). ! In octal, the numbers go 0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, etc. ! Just as @samp{11}, in decimal, is 1 times 10 plus 1, so ! @samp{11}, in octal, is 1 times 8, plus 1. This equals 9 in decimal. In hexadecimal, there are 16 digits. Since the everyday decimal ! number system only has ten digits (@samp{0}--@samp{9}), the letters @samp{a} through @samp{f} are used to represent the rest. (Case in the letters is usually irrelevant; hexadecimal @samp{a} and @samp{A} have the same value.) ! Thus, @samp{11}, in ! hexadecimal, is 1 times 16 plus 1, which equals 17 in decimal. Just by looking at plain @samp{11}, you can't tell what base it's in. So, in C, C++, and other languages derived from C, *************** *** 6902,6908 **** @table @code @item 11 ! Decimal 11. @item 011 Octal 11, decimal value 9. --- 7187,7193 ---- @table @code @item 11 ! Decimal value 11. @item 011 Octal 11, decimal value 9. *************** *** 6922,6934 **** useful when working with data that cannot be represented conveniently as characters or as regular numbers, such as binary data of various sorts. @command{gawk} allows the use of octal and hexadecimal constants in your program text. However, such numbers in the input data are not treated differently; doing so by default would break old programs. (If you really need to do this, use the @option{--non-decimal-data} ! command-line option, ! @pxref{Non-decimal Data, ,Allowing Non-Decimal Input Data}.) If you have octal or hexadecimal data, you can use the @code{strtonum} function (@pxref{String Functions, ,String Manipulation Functions}) --- 7207,7221 ---- useful when working with data that cannot be represented conveniently as characters or as regular numbers, such as binary data of various sorts. + @cindex @command{gawk}, octal numbers and + @cindex @command{gawk}, hexadecimal numbers and @command{gawk} allows the use of octal and hexadecimal constants in your program text. However, such numbers in the input data are not treated differently; doing so by default would break old programs. (If you really need to do this, use the @option{--non-decimal-data} ! command-line option; ! @pxref{Nondecimal Data, ,Allowing Nondecimal Input Data}.) If you have octal or hexadecimal data, you can use the @code{strtonum} function (@pxref{String Functions, ,String Manipulation Functions}) *************** *** 6939,6945 **** for more information. Unlike some early C implementations, @samp{8} and @samp{9} are not valid ! in octal constants; e.g., @command{gawk} treats @samp{018} as decimal 18. @example $ gawk 'BEGIN @{ print "021 is", 021 ; print 018 @}' --- 7226,7232 ---- for more information. Unlike some early C implementations, @samp{8} and @samp{9} are not valid ! in octal constants; e.g., @command{gawk} treats @samp{018} as decimal 18: @example $ gawk 'BEGIN @{ print "021 is", 021 ; print 018 @}' *************** *** 6947,6952 **** --- 7234,7241 ---- @print{} 18 @end example + @cindex compatibility mode (@command{gawk}), octal numbers + @cindex compatibility mode (@command{gawk}), hexadecimal numbers Octal and hexadecimal source code constants are a @command{gawk} extension. If @command{gawk} is in compatibility mode (@pxref{Options, ,Command-Line Options}), *************** *** 6954,6960 **** @c fakenode --- for prepinfo @subheading Advanced Notes: A Constant's Base Does Not Affect Its Value ! @cindex advanced notes Once a numeric constant has been converted internally into a number, --- 7243,7250 ---- @c fakenode --- for prepinfo @subheading Advanced Notes: A Constant's Base Does Not Affect Its Value ! @c comma before values does NOT start tertiary ! @cindex advanced features, constants, values of Once a numeric constant has been converted internally into a number, *************** *** 6968,6995 **** @print{} 0x11 is <17> @end example ! @node Regexp Constants, , Non-decimal-numbers, Constants @subsection Regular Expression Constants ! @cindex @code{~} operator ! @cindex @code{!~} operator A regexp constant is a regular expression description enclosed in slashes, such as @code{@w{/^beginning and end$/}}. Most regexps used in @command{awk} programs are constant, but the @samp{~} and @samp{!~} matching operators can also match computed or ``dynamic'' regexps (which are just ordinary strings or variables that contain a regexp). @node Using Constant Regexps, Variables, Constants, Expressions @section Using Regular Expression Constants ! @cindex dark corner When used on the righthand side of the @samp{~} or @samp{!~} operators, a regexp constant merely stands for the regexp that is to be matched. However, regexp constants (such as @code{/foo/}) may be used like simple expressions. When a regexp constant appears by itself, it has the same meaning as if it appeared ! in a pattern, i.e.; @samp{($0 ~ /foo/)} @value{DARKCORNER} @xref{Expression Patterns, ,Expressions as Patterns}. This means that the following two code segments: --- 7258,7290 ---- @print{} 0x11 is <17> @end example ! @node Regexp Constants, , Nondecimal-numbers, Constants @subsection Regular Expression Constants ! @c STARTOFRANGE rec ! @cindex regexp constants ! @cindex @code{~} (tilde), @code{~} operator ! @cindex tilde (@code{~}), @code{~} operator ! @cindex @code{!} (exclamation point), @code{!~} operator ! @cindex exclamation point (@code{!}), @code{!~} operator A regexp constant is a regular expression description enclosed in slashes, such as @code{@w{/^beginning and end$/}}. Most regexps used in @command{awk} programs are constant, but the @samp{~} and @samp{!~} matching operators can also match computed or ``dynamic'' regexps (which are just ordinary strings or variables that contain a regexp). + @c ENDOFRANGE cnst @node Using Constant Regexps, Variables, Constants, Expressions @section Using Regular Expression Constants ! @cindex dark corner, regexp constants When used on the righthand side of the @samp{~} or @samp{!~} operators, a regexp constant merely stands for the regexp that is to be matched. However, regexp constants (such as @code{/foo/}) may be used like simple expressions. When a regexp constant appears by itself, it has the same meaning as if it appeared ! in a pattern, i.e., @samp{($0 ~ /foo/)} @value{DARKCORNER} @xref{Expression Patterns, ,Expressions as Patterns}. This means that the following two code segments: *************** *** 7018,7025 **** if (/foo/ ~ $1) print "found foo" @end example ! @cindex automatic warnings ! @cindex warnings, automatic @noindent This code is ``obviously'' testing @code{$1} for a match against the regexp @code{/foo/}. But in fact, the expression @samp{/foo/ ~ $1} actually means --- 7313,7322 ---- if (/foo/ ~ $1) print "found foo" @end example ! @c @cindex automatic warnings ! @c @cindex warnings, automatic ! @cindex @command{gawk}, regexp constants and ! @cindex regexp constants, in @command{gawk} @noindent This code is ``obviously'' testing @code{$1} for a match against the regexp @code{/foo/}. But in fact, the expression @samp{/foo/ ~ $1} actually means *************** *** 7042,7049 **** This feature of the language has never been well documented until the POSIX specification. ! @cindex differences between @command{gawk} and @command{awk} ! @cindex dark corner Constant regular expressions are also used as the first argument for the @code{gensub}, @code{sub}, and @code{gsub} functions, and as the second argument of the @code{match} function --- 7339,7349 ---- This feature of the language has never been well documented until the POSIX specification. ! @cindex differences in @command{awk} and @command{gawk}, regexp constants ! @cindex dark corner, regexp constants, as arguments to user-defined functions ! @cindex @code{gensub} function (@command{gawk}) ! @cindex @code{sub} function ! @cindex @code{gsub} function Constant regular expressions are also used as the first argument for the @code{gensub}, @code{sub}, and @code{gsub} functions, and as the second argument of the @code{match} function *************** *** 7053,7059 **** older implementations do not. @value{DARKCORNER} This can lead to confusion when attempting to use regexp constants ! as arguments to user defined functions (@pxref{User-defined, ,User-Defined Functions}). For example: --- 7353,7359 ---- older implementations do not. @value{DARKCORNER} This can lead to confusion when attempting to use regexp constants ! as arguments to user-defined functions (@pxref{User-defined, ,User-Defined Functions}). For example: *************** *** 7075,7082 **** @} @end example ! @cindex automatic warnings ! @cindex warnings, automatic In this example, the programmer wants to pass a regexp constant to the user-defined function @code{mysub}, which in turn passes it on to either @code{sub} or @code{gsub}. However, what really happens is that --- 7375,7382 ---- @} @end example ! @c @cindex automatic warnings ! @c @cindex warnings, automatic In this example, the programmer wants to pass a regexp constant to the user-defined function @code{mysub}, which in turn passes it on to either @code{sub} or @code{gsub}. However, what really happens is that *************** *** 7085,7094 **** --- 7385,7397 ---- @command{gawk} issues a warning when it sees a regexp constant used as a parameter to a user-defined function, since passing a truth value in this way is probably not what was intended. + @c ENDOFRANGE rec @node Variables, Conversion, Using Constant Regexps, Expressions @section Variables + @cindex variables, user-defined + @cindex user-defined, variables Variables are ways of storing values at one point in your program for use later in another part of your program. They can be manipulated entirely within the program text, and they can also be assigned values *************** *** 7104,7111 **** @node Using Variables, Assignment Options, Variables, Variables @subsection Using Variables in a Program - @cindex variables, user-defined - @cindex user-defined variables Variables let you give names to values and refer to them later. Variables have already been used in many of the examples. The name of a variable must be a sequence of letters, digits, or underscores, and it may not begin --- 7407,7412 ---- *************** *** 7119,7124 **** --- 7420,7427 ---- @xref{Assignment Ops, ,Assignment Expressions}. @c NEXT ED: Can also be changed by sub, gsub, split + @cindex variables, built-in + @cindex variables, initializing A few variables have special built-in meanings, such as @code{FS} (the field separator), and @code{NF} (the number of fields in the current input record). @xref{Built-in Variables}, for a list of the built-in variables. *************** *** 7135,7140 **** --- 7438,7446 ---- @node Assignment Options, , Using Variables, Variables @subsection Assigning Variables on the Command Line + @cindex variables, assigning on command line + @c comma before assigning does NOT start tertiary + @cindex command line, variables, assigning on Any @command{awk} variable can be set by including a @dfn{variable assignment} among the arguments on the command line when @command{awk} is invoked *************** *** 7145,7150 **** --- 7451,7458 ---- @var{variable}=@var{text} @end example + @c comma before assigning does NOT start tertiary + @cindex @code{-v} option, variables, assigning @noindent With it, a variable is set either at the beginning of the @command{awk} run or in between input files. *************** *** 7187,7205 **** @dots{} @end example ! @cindex dark corner Command-line arguments are made available for explicit examination by ! the @command{awk} program in an array named @code{ARGV} (@pxref{ARGC and ARGV, ,Using @code{ARGC} and @code{ARGV}}). @command{awk} processes the values of command-line assignments for escape sequences - @value{DARKCORNER} (@pxref{Escape Sequences}). @node Conversion, Arithmetic Ops, Variables, Expressions @section Conversion of Strings and Numbers ! @cindex conversion of strings and numbers Strings are converted to numbers and numbers are converted to strings, if the context of the @command{awk} program demands it. For example, if the value of either @code{foo} or @code{bar} in the expression @samp{foo + bar} --- 7495,7516 ---- @dots{} @end example ! @cindex dark corner, command-line arguments Command-line arguments are made available for explicit examination by ! the @command{awk} program in the @code{ARGV} array (@pxref{ARGC and ARGV, ,Using @code{ARGC} and @code{ARGV}}). @command{awk} processes the values of command-line assignments for escape sequences (@pxref{Escape Sequences}). + @value{DARKCORNER} @node Conversion, Arithmetic Ops, Variables, Expressions @section Conversion of Strings and Numbers ! @cindex converting, strings to numbers ! @cindex strings, converting ! @cindex numbers, converting ! @cindex converting, numbers Strings are converted to numbers and numbers are converted to strings, if the context of the @command{awk} program demands it. For example, if the value of either @code{foo} or @code{bar} in the expression @samp{foo + bar} *************** *** 7216,7225 **** This prints the (numeric) value 27. The numeric values of the variables @code{two} and @code{three} are converted to strings and concatenated together. The resulting string is converted back to the ! number 23, to which four is then added. ! @cindex null string ! @cindex empty string @cindex type conversion If, for some reason, you need to force a number to be converted to a string, concatenate the empty string, @code{""}, with that number. --- 7527,7535 ---- This prints the (numeric) value 27. The numeric values of the variables @code{two} and @code{three} are converted to strings and concatenated together. The resulting string is converted back to the ! number 23, to which 4 is then added. ! @cindex null strings, converting numbers to strings @cindex type conversion If, for some reason, you need to force a number to be converted to a string, concatenate the empty string, @code{""}, with that number. *************** *** 7247,7253 **** most of the time.@footnote{Pathological cases can require up to 752 digits (!), but we doubt that you need to worry about this.} ! @cindex dark corner Strange results can occur if you set @code{CONVFMT} to a string that doesn't tell @code{sprintf} how to format floating-point numbers in a useful way. For example, if you forget the @samp{%} in the format, @command{awk} converts --- 7557,7563 ---- most of the time.@footnote{Pathological cases can require up to 752 digits (!), but we doubt that you need to worry about this.} ! @cindex dark corner, @code{CONVFMT} variable Strange results can occur if you set @code{CONVFMT} to a string that doesn't tell @code{sprintf} how to format floating-point numbers in a useful way. For example, if you forget the @samp{%} in the format, @command{awk} converts *************** *** 7266,7274 **** @code{b} has the value @code{"12"}, not @code{"12.00"}. @value{DARKCORNER} ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} @cindex @code{OFMT} variable Prior to the POSIX standard, @command{awk} used the value of @code{OFMT} for converting numbers to strings. @code{OFMT} specifies the output format to use when printing numbers with @code{print}. --- 7576,7585 ---- @code{b} has the value @code{"12"}, not @code{"12.00"}. @value{DARKCORNER} ! @cindex POSIX @command{awk}, @code{OFMT} variable and @cindex @code{OFMT} variable + @cindex portability, new @command{awk} vs. old @command{awk} + @cindex @command{awk}, new vs. old, @code{OFMT} variable Prior to the POSIX standard, @command{awk} used the value of @code{OFMT} for converting numbers to strings. @code{OFMT} specifies the output format to use when printing numbers with @code{print}. *************** *** 7287,7299 **** @section Arithmetic Operators @cindex arithmetic operators @cindex operators, arithmetic ! @cindex addition ! @cindex subtraction ! @cindex multiplication ! @cindex division ! @cindex remainder ! @cindex quotient ! @cindex exponentiation The @command{awk} language uses the common arithmetic operators when evaluating expressions. All of these arithmetic operators follow normal --- 7598,7610 ---- @section Arithmetic Operators @cindex arithmetic operators @cindex operators, arithmetic ! @c @cindex addition ! @c @cindex subtraction ! @c @cindex multiplication ! @c @cindex division ! @c @cindex remainder ! @c @cindex quotient ! @c @cindex exponentiation The @command{awk} language uses the common arithmetic operators when evaluating expressions. All of these arithmetic operators follow normal *************** *** 7331,7338 **** @item + @var{x} Unary plus; the expression is converted to a number. ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} @item @var{x} ^ @var{y} @itemx @var{x} ** @var{y} Exponentiation; @var{x} raised to the @var{y} power. @samp{2 ^ 3} has --- 7642,7648 ---- @item + @var{x} Unary plus; the expression is converted to a number. ! @cindex POSIX @command{awk}, arithmetic operators and @item @var{x} ^ @var{y} @itemx @var{x} ** @var{y} Exponentiation; @var{x} raised to the @var{y} power. @samp{2 ^ 3} has *************** *** 7342,7350 **** @item @var{x} * @var{y} Multiplication. ! @cindex common mistakes ! @cindex mistakes, common ! @cindex errors, common @item @var{x} / @var{y} Division; because all numbers in @command{awk} are floating-point numbers, the result is @emph{not} rounded to an integer---@samp{3 / 4} has --- 7652,7659 ---- @item @var{x} * @var{y} Multiplication. ! @cindex troubleshooting, division ! @cindex division @item @var{x} / @var{y} Division; because all numbers in @command{awk} are floating-point numbers, the result is @emph{not} rounded to an integer---@samp{3 / 4} has *************** *** 7368,7374 **** the multiplication operators all have the same precedence, and addition and subtraction have the same precedence. ! @cindex differences between @command{gawk} and @command{awk} When computing the remainder of @code{@var{x} % @var{y}}, the quotient is rounded toward zero to an integer and multiplied by @var{y}. This result is subtracted from @var{x}; --- 7677,7684 ---- the multiplication operators all have the same precedence, and addition and subtraction have the same precedence. ! @cindex differences in @command{awk} and @command{gawk}, trunc-mod operation ! @cindex trunc-mod operation When computing the remainder of @code{@var{x} % @var{y}}, the quotient is rounded toward zero to an integer and multiplied by @var{y}. This result is subtracted from @var{x}; *************** *** 7387,7396 **** @end example In other @command{awk} implementations, the signedness of the remainder ! may be machine dependent. @c !!! what does posix say? ! @cindex portability issues @strong{Note:} The POSIX standard only specifies the use of @samp{^} for exponentiation. --- 7697,7708 ---- @end example In other @command{awk} implementations, the signedness of the remainder ! may be machine-dependent. @c !!! what does posix say? ! @cindex portability, @code{**} operator and ! @cindex @code{*} (asterisk), @code{**} operator ! @cindex asterisk (@code{*}), @code{**} operator @strong{Note:} The POSIX standard only specifies the use of @samp{^} for exponentiation. *************** *** 7406,7412 **** @cindex string operators @cindex operators, string ! @cindex concatenation There is only one string operation: concatenation. It does not have a specific operator to represent it. Instead, concatenation is performed by writing expressions next to one another, with no operator. For example: --- 7718,7724 ---- @cindex string operators @cindex operators, string ! @cindex concatenating There is only one string operation: concatenation. It does not have a specific operator to represent it. Instead, concatenation is performed by writing expressions next to one another, with no operator. For example: *************** *** 7428,7436 **** @dots{} @end example ! @cindex common mistakes ! @cindex mistakes, common ! @cindex errors, common Because string concatenation does not have an explicit operator, it is often necessary to insure that it happens at the right time by using parentheses to enclose the items to concatenate. For example, the --- 7740,7746 ---- @dots{} @end example ! @cindex troubleshooting, string concatenation Because string concatenation does not have an explicit operator, it is often necessary to insure that it happens at the right time by using parentheses to enclose the items to concatenate. For example, the *************** *** 7451,7458 **** @end example @cindex order of evaluation, concatenation ! @cindex concatenation evaluation order ! @cindex evaluation, order of @cindex side effects Parentheses should be used around concatenation in all but the most common contexts, such as on the righthand side of @samp{=}. --- 7761,7767 ---- @end example @cindex order of evaluation, concatenation ! @cindex evaluation order, concatenation @cindex side effects Parentheses should be used around concatenation in all but the most common contexts, such as on the righthand side of @samp{=}. *************** *** 7531,7541 **** @node Assignment Ops, Increment Ops, Concatenation, Expressions @section Assignment Expressions @cindex assignment operators @cindex operators, assignment ! @cindex expression, assignment ! ! @cindex @code{=} operator An @dfn{assignment} is an expression that stores a (usually different) value into a variable. For example, let's assign the value one to the variable @code{z}: --- 7840,7853 ---- @node Assignment Ops, Increment Ops, Concatenation, Expressions @section Assignment Expressions + @c STARTOFRANGE asop @cindex assignment operators + @c STARTOFRANGE opas @cindex operators, assignment ! @c STARTOFRANGE exas ! @cindex expressions, assignment ! @cindex @code{=} (equals sign), @code{=} operator ! @cindex equals sign (@code{=}), @code{=} operator An @dfn{assignment} is an expression that stores a (usually different) value into a variable. For example, let's assign the value one to the variable @code{z}: *************** *** 7558,7564 **** @end example @noindent ! @cindex side effects This also illustrates string concatenation. The @samp{=} sign is called an @dfn{assignment operator}. It is the simplest assignment operator because the value of the righthand --- 7870,7876 ---- @end example @noindent ! @cindex side effects, assignment expressions This also illustrates string concatenation. The @samp{=} sign is called an @dfn{assignment operator}. It is the simplest assignment operator because the value of the righthand *************** *** 7570,7577 **** makes itself felt through the alteration of the variable. We call this a @dfn{side effect}. ! @cindex lvalue ! @cindex rvalue The lefthand operand of an assignment need not be a variable (@pxref{Variables}); it can also be a field (@pxref{Changing Fields, ,Changing the Contents of a Field}) or --- 7882,7891 ---- makes itself felt through the alteration of the variable. We call this a @dfn{side effect}. ! @cindex lvalues/rvalues ! @cindex rvalues/lvalues ! @cindex assignment operators, lvalues/rvalues ! @cindex operators, assignment The lefthand operand of an assignment need not be a variable (@pxref{Variables}); it can also be a field (@pxref{Changing Fields, ,Changing the Contents of a Field}) or *************** *** 7580,7588 **** which means they can appear on the lefthand side of an assignment operator. The righthand operand may be any expression; it produces the new value that the assignment stores in the specified variable, field, or array ! element. (Such values are called @dfn{rvalues}). ! @cindex types of variables It is important to note that variables do @emph{not} have permanent types. A variable's type is simply the type of whatever value it happens to hold at the moment. In the following program fragment, the variable --- 7894,7902 ---- which means they can appear on the lefthand side of an assignment operator. The righthand operand may be any expression; it produces the new value that the assignment stores in the specified variable, field, or array ! element. (Such values are called @dfn{rvalues}.) ! @cindex variables, types of It is important to note that variables do @emph{not} have permanent types. A variable's type is simply the type of whatever value it happens to hold at the moment. In the following program fragment, the variable *************** *** 7611,7617 **** @strong{Note:} Using a variable as a number and then later as a string can be confusing and is poor programming style. The previous two examples illustrate how @command{awk} works, @emph{not} how you should write your ! own programs! An assignment is an expression, so it has a value---the same value that is assigned. Thus, @samp{z = 1} is an expression with the value one. --- 7925,7931 ---- @strong{Note:} Using a variable as a number and then later as a string can be confusing and is poor programming style. The previous two examples illustrate how @command{awk} works, @emph{not} how you should write your ! programs! An assignment is an expression, so it has a value---the same value that is assigned. Thus, @samp{z = 1} is an expression with the value one. *************** *** 7635,7640 **** --- 7949,7956 ---- programs hard to read; such nesting of assignments should be avoided, except perhaps in a one-shot program. + @cindex @code{+} (plus sign), @code{+=} operator + @cindex plus sign (@code{+}), @code{+=} operator Aside from @samp{=}, there are several other assignment operators that do arithmetic with the old value of the variable. For example, the operator @samp{+=} computes a new value by adding the righthand value *************** *** 7673,7678 **** --- 7989,7996 ---- @} @end example + @cindex operators, assignment, evaluation order + @cindex assignment operators, evaluation order @noindent The indices of @code{bar} are practically guaranteed to be different, because @code{rand} returns different values each time it is called. *************** *** 7723,7735 **** @end table @end ignore ! @cindex @code{+=} operator ! @cindex @code{-=} operator ! @cindex @code{*=} operator ! @cindex @code{/=} operator ! @cindex @code{%=} operator ! @cindex @code{^=} operator ! @cindex @code{**=} operator @multitable {@var{lvalue} *= @var{coefficient}} {Subtracts @var{decrement} from the value of @var{lvalue}.} @item @var{lvalue} @code{+=} @var{increment} @tab Adds @var{increment} to the value of @var{lvalue}. --- 8041,8058 ---- @end table @end ignore ! @cindex @code{-} (hyphen), @code{-=} operator ! @cindex hyphen (@code{-}), @code{-=} operator ! @cindex @code{*} (asterisk), @code{*=} operator ! @cindex asterisk (@code{*}), @code{*=} operator ! @cindex @code{/} (forward slash), @code{/=} operator ! @cindex forward slash (@code{/}), @code{/=} operator ! @cindex @code{%} (percent sign), @code{%=} operator ! @cindex percent sign (@code{%}), @code{%=} operator ! @cindex @code{^} (caret), @code{^=} operator ! @cindex caret (@code{^}), @code{^=} operator ! @cindex @code{*} (asterisk), @code{**=} operator ! @cindex asterisk (@code{*}), @code{**=} operator @multitable {@var{lvalue} *= @var{coefficient}} {Subtracts @var{decrement} from the value of @var{lvalue}.} @item @var{lvalue} @code{+=} @var{increment} @tab Adds @var{increment} to the value of @var{lvalue}. *************** *** 7747,7760 **** @item @var{lvalue} @code{**=} @var{power} @tab Raises @var{lvalue} to the power @var{power}. @end multitable ! @cindex portability issues @strong{Note:} Only the @samp{^=} operator is specified by POSIX. For maximum portability, do not use the @samp{**=} operator. @c fakenode --- for prepinfo @subheading Advanced Notes: Syntactic Ambiguities Between @samp{/=} and Regular Expressions ! @cindex advanced notes @c derived from email from "Nelson H. F. Beebe" @c Date: Mon, 1 Sep 1997 13:38:35 -0600 (MDT) --- 8070,8088 ---- @item @var{lvalue} @code{**=} @var{power} @tab Raises @var{lvalue} to the power @var{power}. @end multitable ! @cindex POSIX @command{awk}, @code{**=} operator and ! @cindex portability, @code{**=} operator and @strong{Note:} Only the @samp{^=} operator is specified by POSIX. For maximum portability, do not use the @samp{**=} operator. @c fakenode --- for prepinfo @subheading Advanced Notes: Syntactic Ambiguities Between @samp{/=} and Regular Expressions ! @cindex advanced features, regexp constants ! @cindex dark corner, regexp constants, @code{/=} operator and ! @cindex @code{/} (forward slash), @code{/=} operator, vs. @code{/=@dots{}/} regexp constant ! @cindex forward slash (@code{/}), @code{/=} operator, vs. @code{/=@dots{}/} regexp constant ! @cindex regexp constants, @code{/=@dots{}/}, @code{/=} operator and @c derived from email from "Nelson H. F. Beebe" @c Date: Mon, 1 Sep 1997 13:38:35 -0600 (MDT) *************** *** 7786,7805 **** @command{gawk} does not have this problem, nor do the other ! freely-available versions described in @ref{Other Versions, , Other Freely Available @command{awk} Implementations}. @node Increment Ops, Truth Values, Assignment Ops, Expressions @section Increment and Decrement Operators @cindex increment operators ! @cindex operators, increment @dfn{Increment} and @dfn{decrement operators} increase or decrease the value of a variable by one. An assignment operator can do the same thing, so ! the increment operators add no power to the @command{awk} language; however they are convenient abbreviations for very common operations. @cindex side effects The operator used for adding one is written @samp{++}. It can be used to increment a variable either before or after taking its value. To pre-increment a variable @code{v}, write @samp{++v}. This adds --- 8114,8141 ---- @command{gawk} does not have this problem, nor do the other ! freely available versions described in @ref{Other Versions, , Other Freely Available @command{awk} Implementations}. + @c ENDOFRANGE exas + @c ENDOFRANGE opas + @c ENDOFRANGE asop @node Increment Ops, Truth Values, Assignment Ops, Expressions @section Increment and Decrement Operators + @c STARTOFRANGE inop @cindex increment operators ! @c STARTOFRANGE opde ! @cindex operators, decrement/increment @dfn{Increment} and @dfn{decrement operators} increase or decrease the value of a variable by one. An assignment operator can do the same thing, so ! the increment operators add no power to the @command{awk} language; however, they are convenient abbreviations for very common operations. @cindex side effects + @cindex @code{+} (plus sign), decrement/increment operators + @cindex plus sign (@code{+}), decrement/increment operators + @cindex side effects, decrement/increment operators The operator used for adding one is written @samp{++}. It can be used to increment a variable either before or after taking its value. To pre-increment a variable @code{v}, write @samp{++v}. This adds *************** *** 7820,7839 **** not necessarily equal @code{foo}. But the difference is minute as long as you stick to numbers that are fairly small (less than 10e12). Fields and array elements are incremented just like variables. (Use @samp{$(i++)} when you want to do a field reference and a variable increment at the same time. The parentheses are necessary because of the precedence of the field reference operator @samp{$}.) @cindex decrement operators - @cindex operators, decrement The decrement operator @samp{--} works just like @samp{++}, except that it subtracts one instead of adding it. As with @samp{++}, it can be used before the lvalue to pre-decrement or after it to post-decrement. Following is a summary of increment and decrement expressions: @table @code ! @cindex @code{++} operator @item ++@var{lvalue} This expression increments @var{lvalue}, and the new value becomes the value of the expression. --- 8156,8177 ---- not necessarily equal @code{foo}. But the difference is minute as long as you stick to numbers that are fairly small (less than 10e12). + @cindex @code{$} (dollar sign), incrementing fields and arrays + @cindex dollar sign (@code{$}), incrementing fields and arrays Fields and array elements are incremented just like variables. (Use @samp{$(i++)} when you want to do a field reference and a variable increment at the same time. The parentheses are necessary because of the precedence of the field reference operator @samp{$}.) @cindex decrement operators The decrement operator @samp{--} works just like @samp{++}, except that it subtracts one instead of adding it. As with @samp{++}, it can be used before the lvalue to pre-decrement or after it to post-decrement. Following is a summary of increment and decrement expressions: @table @code ! @cindex @code{+} (plus sign), @code{++} operator ! @cindex plus sign (@code{+}), @code{++} operator @item ++@var{lvalue} This expression increments @var{lvalue}, and the new value becomes the value of the expression. *************** *** 7842,7848 **** This expression increments @var{lvalue}, but the value of the expression is the @emph{old} value of @var{lvalue}. ! @cindex @code{--} operator @item --@var{lvalue} This expression is like @samp{++@var{lvalue}}, but instead of adding, it subtracts. It --- 8180,8187 ---- This expression increments @var{lvalue}, but the value of the expression is the @emph{old} value of @var{lvalue}. ! @cindex @code{-} (hyphen), @code{--} operator ! @cindex hyphen (@code{-}), @code{--} operator @item --@var{lvalue} This expression is like @samp{++@var{lvalue}}, but instead of adding, it subtracts. It *************** *** 7857,7867 **** @c fakenode --- for prepinfo @subheading Advanced Notes: Operator Evaluation Order ! @cindex advanced notes @cindex precedence ! @cindex operator precedence ! @cindex portability issues ! @cindex evaluation, order of @cindex Marx, Groucho @quotation @i{Doctor, doctor! It hurts when I do this!@* --- 8196,8207 ---- @c fakenode --- for prepinfo @subheading Advanced Notes: Operator Evaluation Order ! @c comma before precedence does NOT start tertiary ! @cindex advanced features, operators, precedence @cindex precedence ! @cindex operators, precedence ! @cindex portability, operators ! @cindex evaluation order @cindex Marx, Groucho @quotation @i{Doctor, doctor! It hurts when I do this!@* *************** *** 7899,7913 **** You should avoid such things in your own programs. @c You'll sleep better at night and be able to look at yourself @c in the mirror in the morning. @node Truth Values, Typing and Comparison, Increment Ops, Expressions @section True and False in @command{awk} @cindex truth values ! @cindex logical true ! @cindex logical false ! @cindex null string ! @cindex empty string Many programming languages have a special representation for the concepts of ``true'' and ``false.'' Such languages usually use the special constants @code{true} and @code{false}, or perhaps their uppercase --- 8239,8256 ---- You should avoid such things in your own programs. @c You'll sleep better at night and be able to look at yourself @c in the mirror in the morning. + @c ENDOFRANGE inop + @c ENDOFRANGE opde + @c ENDOFRANGE deop @node Truth Values, Typing and Comparison, Increment Ops, Expressions @section True and False in @command{awk} @cindex truth values ! @cindex logical false/true ! @cindex false, logical ! @cindex true, logical ! @cindex null strings Many programming languages have a special representation for the concepts of ``true'' and ``false.'' Such languages usually use the special constants @code{true} and @code{false}, or perhaps their uppercase *************** *** 7915,7921 **** However, @command{awk} is different. It borrows a very simple concept of true and false from C. In @command{awk}, any nonzero numeric value @emph{or} any ! non-empty string value is true. Any other value (zero or the null string @code{""}) is false. The following program prints @samp{A strange truth value} three times: --- 8258,8264 ---- However, @command{awk} is different. It borrows a very simple concept of true and false from C. In @command{awk}, any nonzero numeric value @emph{or} any ! nonempty string value is true. Any other value (zero or the null string @code{""}) is false. The following program prints @samp{A strange truth value} three times: *************** *** 7937,7960 **** @node Typing and Comparison, Boolean Ops, Truth Values, Expressions @section Variable Typing and Comparison Expressions - @cindex comparison expressions - @cindex expression, comparison - @cindex expression, matching - @cindex relational operators - @cindex operators, relational - @cindex regexp operators - @cindex variable typing - @cindex types of variables @quotation @i{The Guide is definitive. Reality is frequently inaccurate.}@* The Hitchhiker's Guide to the Galaxy @end quotation Unlike other programming languages, @command{awk} variables do not have a fixed type. Instead, they can be either a number or a string, depending upon the value that is assigned to them. ! @cindex numeric string The 1992 POSIX standard introduced the concept of a @dfn{numeric string}, which is simply a string that looks like a number---for example, @code{@w{" +2"}}. This concept is used --- 8280,8310 ---- @node Typing and Comparison, Boolean Ops, Truth Values, Expressions @section Variable Typing and Comparison Expressions @quotation @i{The Guide is definitive. Reality is frequently inaccurate.}@* The Hitchhiker's Guide to the Galaxy @end quotation + @c STARTOFRANGE comex + @cindex comparison expressions + @c STARTOFRANGE excom + @cindex expressions, comparison + @cindex expressions, matching, See comparison expressions + @cindex matching, expressions, See comparison expressions + @cindex relational operators, See comparison operators + @c comma is part of See + @cindex operators, relational, See operators, comparison + @c STARTOFRANGE varting + @cindex variable typing + @c STARTOFRANGE vartypc + @cindex variables, types of, comparison expressions and Unlike other programming languages, @command{awk} variables do not have a fixed type. Instead, they can be either a number or a string, depending upon the value that is assigned to them. ! @cindex numeric, strings ! @cindex strings, numeric ! @cindex POSIX @command{awk}, numeric strings and The 1992 POSIX standard introduced the concept of a @dfn{numeric string}, which is simply a string that looks like a number---for example, @code{@w{" +2"}}. This concept is used *************** *** 8082,8097 **** operators}, which are a superset of those in C. Here is a table of them: ! @cindex relational operators ! @cindex operators, relational ! @cindex @code{<} operator ! @cindex @code{<=} operator ! @cindex @code{>} operator ! @cindex @code{>=} operator ! @cindex @code{==} operator ! @cindex @code{!=} operator ! @cindex @code{~} operator ! @cindex @code{!~} operator @cindex @code{in} operator @table @code @item @var{x} < @var{y} --- 8432,8453 ---- operators}, which are a superset of those in C. Here is a table of them: ! @cindex @code{<} (left angle bracket), @code{<} operator ! @cindex left angle bracket (@code{<}), @code{<} operator ! @cindex @code{<} (left angle bracket), @code{<=} operator ! @cindex left angle bracket (@code{<}), @code{<=} operator ! @cindex @code{>} (right angle bracket), @code{>=} operator ! @cindex right angle bracket (@code{>}), @code{>=} operator ! @cindex @code{>} (right angle bracket), @code{>} operator ! @cindex right angle bracket (@code{>}), @code{>} operator ! @cindex @code{=} (equals sign), @code{==} operator ! @cindex equals sign (@code{=}), @code{==} operator ! @cindex @code{!} (exclamation point), @code{!=} operator ! @cindex exclamation point (@code{!}), @code{!=} operator ! @cindex @code{~} (tilde), @code{~} operator ! @cindex tilde (@code{~}), @code{~} operator ! @cindex @code{!} (exclamation point), @code{!~} operator ! @cindex exclamation point (@code{!}), @code{!~} operator @cindex @code{in} operator @table @code @item @var{x} < @var{y} *************** *** 8133,8141 **** strings where one is a prefix of the other, the shorter string is less than the longer one. Thus, @code{"abc"} is less than @code{"abcd"}. ! @cindex common mistakes ! @cindex mistakes, common ! @cindex errors, common It is very easy to accidentally mistype the @samp{==} operator and leave off one of the @samp{=} characters. The result is still valid @command{awk} code, but the program does not do what is intended: --- 8489,8495 ---- strings where one is a prefix of the other, the shorter string is less than the longer one. Thus, @code{"abc"} is less than @code{"abcd"}. ! @cindex troubleshooting, @code{==} operator It is very easy to accidentally mistype the @samp{==} operator and leave off one of the @samp{=} characters. The result is still valid @command{awk} code, but the program does not do what is intended: *************** *** 8153,8158 **** --- 8507,8513 ---- so similar, this kind of error is very difficult to spot when scanning the source code. + @cindex @command{gawk}, comparison operators and The following table of expressions illustrates the kind of comparison @command{gawk} performs, as well as what the result of the comparison is: *************** *** 8185,8193 **** @print{} false @end example ! @cindex comparisons, string vs. regexp ! @cindex string comparison vs. regexp comparison ! @cindex regexp comparison vs. string comparison @noindent the result is @samp{false} because both @code{$1} and @code{$2} are user input. They are numeric strings---therefore both have --- 8540,8548 ---- @print{} false @end example ! @cindex comparison expressions, string vs. regexp ! @c @cindex string comparison vs. regexp comparison ! @c @cindex regexp comparison vs. string comparison @noindent the result is @samp{false} because both @code{$1} and @code{$2} are user input. They are numeric strings---therefore both have *************** *** 8214,8226 **** has the value one if @code{x} contains @samp{foo}, such as @code{"Oh, what a fool am I!"}. The righthand operand of the @samp{~} and @samp{!~} operators may be either a regexp constant (@code{/@dots{}/}) or an ordinary expression. In the latter case, the value of the expression as a string is used as a dynamic regexp (@pxref{Regexp Usage, ,How to Use Regular Expressions}; also @pxref{Computed Regexps, ,Using Dynamic Regexps}). ! @cindex regexp as expression In modern implementations of @command{awk}, a constant regular expression in slashes by itself is also an expression. The regexp @code{/@var{regexp}/} is an abbreviation for the following comparison expression: --- 8569,8586 ---- has the value one if @code{x} contains @samp{foo}, such as @code{"Oh, what a fool am I!"}. + @cindex @code{~} (tilde), @code{~} operator + @cindex tilde (@code{~}), @code{~} operator + @cindex @code{!} (exclamation point), @code{!~} operator + @cindex exclamation point (@code{!}), @code{!~} operator The righthand operand of the @samp{~} and @samp{!~} operators may be either a regexp constant (@code{/@dots{}/}) or an ordinary expression. In the latter case, the value of the expression as a string is used as a dynamic regexp (@pxref{Regexp Usage, ,How to Use Regular Expressions}; also @pxref{Computed Regexps, ,Using Dynamic Regexps}). ! @cindex @command{awk}, regexp constants and ! @cindex regexp constants In modern implementations of @command{awk}, a constant regular expression in slashes by itself is also an expression. The regexp @code{/@var{regexp}/} is an abbreviation for the following comparison expression: *************** *** 8234,8256 **** @samp{!~}. @xref{Using Constant Regexps, ,Using Regular Expression Constants}, where this is discussed in more detail. @node Boolean Ops, Conditional Exp, Typing and Comparison, Expressions @section Boolean Expressions ! @cindex expression, boolean ! @cindex boolean expressions ! @cindex operators, boolean ! @cindex boolean operators ! @cindex logical operators ! @cindex operators, logical ! @cindex short-circuit operators ! @cindex operators, short-circuit ! @cindex AND logical operator ! @cindex OR logical operator ! @cindex NOT logical operator ! @cindex @code{&&} operator ! @cindex @code{||} operator ! @cindex @code{!} operator A @dfn{Boolean expression} is a combination of comparison expressions or matching expressions, using the Boolean operators ``or'' --- 8594,8617 ---- @samp{!~}. @xref{Using Constant Regexps, ,Using Regular Expression Constants}, where this is discussed in more detail. + @c ENDOFRANGE comex + @c ENDOFRANGE excom + @c ENDOFRANGE vartypc + @c ENDOFRANGE varting @node Boolean Ops, Conditional Exp, Typing and Comparison, Expressions @section Boolean Expressions ! @cindex and Boolean-logic operator ! @cindex or Boolean-logic operator ! @cindex not Boolean-logic operator ! @c STARTOFRANGE exbo ! @cindex expressions, Boolean ! @c STARTOFRANGE boex ! @cindex Boolean expressions ! @cindex operators, Boolean, See Boolean expressions ! @cindex Boolean operators, See Boolean expressions ! @cindex logical operators, See Boolean expressions ! @cindex operators, logical, See Boolean expressions A @dfn{Boolean expression} is a combination of comparison expressions or matching expressions, using the Boolean operators ``or'' *************** *** 8264,8270 **** expressions can be used. They can be used in @code{if}, @code{while}, @code{do}, and @code{for} statements (@pxref{Statements, ,Control Statements in Actions}). ! They have numeric values (one if true, zero if false), that come into play if the result of the Boolean expression is stored in a variable or used in arithmetic. --- 8625,8631 ---- expressions can be used. They can be used in @code{if}, @code{while}, @code{do}, and @code{for} statements (@pxref{Statements, ,Control Statements in Actions}). ! They have numeric values (one if true, zero if false) that come into play if the result of the Boolean expression is stored in a variable or used in arithmetic. *************** *** 8282,8288 **** if ($0 ~ /2400/ && $0 ~ /foo/) print @end example ! @cindex side effects The subexpression @var{boolean2} is evaluated only if @var{boolean1} is true. This can make a difference when @var{boolean2} contains expressions that have side effects. In the case of @samp{$0 ~ /foo/ && --- 8643,8649 ---- if ($0 ~ /2400/ && $0 ~ /foo/) print @end example ! @cindex side effects, Boolean operators The subexpression @var{boolean2} is evaluated only if @var{boolean1} is true. This can make a difference when @var{boolean2} contains expressions that have side effects. In the case of @samp{$0 ~ /foo/ && *************** *** 8318,8334 **** @ref{Reference to Elements, ,Referring to an Array Element}.) @end table The @samp{&&} and @samp{||} operators are called @dfn{short-circuit} operators because of the way they work. Evaluation of the full expression is ``short-circuited'' if the result can be determined part way through its evaluation. ! @cindex line continuation Statements that use @samp{&&} or @samp{||} can be continued simply by putting a newline after them. But you cannot put a newline in front of either of these operators without using backslash continuation (@pxref{Statements/Lines, ,@command{awk} Statements Versus Lines}). @cindex flag variables The actual value of an expression using the @samp{!} operator is either one or zero, depending upon the truth value of the expression it --- 8679,8705 ---- @ref{Reference to Elements, ,Referring to an Array Element}.) @end table + @cindex short-circuit operators + @cindex operators, short-circuit + @cindex @code{&} (ampersand), @code{&&} operator + @cindex ampersand (@code{&}), @code{&&} operator + @cindex @code{|} (vertical bar), @code{||} operator + @cindex vertical bar (@code{|}), @code{||} operator The @samp{&&} and @samp{||} operators are called @dfn{short-circuit} operators because of the way they work. Evaluation of the full expression is ``short-circuited'' if the result can be determined part way through its evaluation. ! @cindex line continuations Statements that use @samp{&&} or @samp{||} can be continued simply by putting a newline after them. But you cannot put a newline in front of either of these operators without using backslash continuation (@pxref{Statements/Lines, ,@command{awk} Statements Versus Lines}). + @cindex @code{!} (exclamation point), @code{!} operator + @cindex exclamation point (@code{!}), @code{!} operator + @cindex newlines + @cindex variables, flag @cindex flag variables The actual value of an expression using the @samp{!} operator is either one or zero, depending upon the truth value of the expression it *************** *** 8357,8373 **** so we'll leave well enough alone. @end ignore @strong{Note:} The @code{next} statement is discussed in @ref{Next Statement, ,The @code{next} Statement}. @code{next} tells @command{awk} to skip the rest of the rules, get the next record, and start processing the rules over again at the top. The reason it's there is to avoid printing the bracketing @samp{START} and @samp{END} lines. @node Conditional Exp, Function Calls, Boolean Ops, Expressions @section Conditional Expressions ! @cindex conditional expression ! @cindex expression, conditional A @dfn{conditional expression} is a special kind of expression that has three operands. It allows you to use one expression's value to select --- 8728,8748 ---- so we'll leave well enough alone. @end ignore + @cindex @code{next} statement @strong{Note:} The @code{next} statement is discussed in @ref{Next Statement, ,The @code{next} Statement}. @code{next} tells @command{awk} to skip the rest of the rules, get the next record, and start processing the rules over again at the top. The reason it's there is to avoid printing the bracketing @samp{START} and @samp{END} lines. + @c ENDOFRANGE exbo + @c ENDOFRANGE boex @node Conditional Exp, Function Calls, Boolean Ops, Expressions @section Conditional Expressions ! @cindex conditional expressions ! @cindex expressions, conditional ! @cindex expressions, selecting A @dfn{conditional expression} is a special kind of expression that has three operands. It allows you to use one expression's value to select *************** *** 8391,8397 **** x >= 0 ? x : -x @end example ! @cindex side effects Each time the conditional expression is computed, only one of @var{if-true-exp} and @var{if-false-exp} is used; the other is ignored. This is important when the expressions have side effects. For example, --- 8766,8772 ---- x >= 0 ? x : -x @end example ! @cindex side effects, conditional expressions Each time the conditional expression is computed, only one of @var{if-true-exp} and @var{if-false-exp} is used; the other is ignored. This is important when the expressions have side effects. For example, *************** *** 8409,8416 **** @xref{Arrays, ,Arrays in @command{awk}}, for more information about arrays. ! @cindex differences between @command{gawk} and @command{awk} ! @cindex line continuation As a minor @command{gawk} extension, a statement that uses @samp{?:} can be continued simply by putting a newline after either character. --- 8784,8792 ---- @xref{Arrays, ,Arrays in @command{awk}}, for more information about arrays. ! @cindex differences in @command{awk} and @command{gawk}, line continuations ! @cindex line continuations, @command{gawk} ! @cindex @command{gawk}, line continuation in As a minor @command{gawk} extension, a statement that uses @samp{?:} can be continued simply by putting a newline after either character. *************** *** 8422,8435 **** @node Function Calls, Precedence, Conditional Exp, Expressions @section Function Calls ! @cindex function call ! @cindex calling a function A @dfn{function} is a name for a particular calculation. This enables you to ask for it by name at any point in the program. For example, the function @code{sqrt} computes the square root of a number. A fixed set of functions are @dfn{built-in}, which means they are available in every @command{awk} program. The @code{sqrt} function is one of these. @xref{Built-in, ,Built-in Functions}, for a list of built-in --- 8798,8811 ---- @node Function Calls, Precedence, Conditional Exp, Expressions @section Function Calls ! @cindex function calls A @dfn{function} is a name for a particular calculation. This enables you to ask for it by name at any point in the program. For example, the function @code{sqrt} computes the square root of a number. + @cindex functions, built-in A fixed set of functions are @dfn{built-in}, which means they are available in every @command{awk} program. The @code{sqrt} function is one of these. @xref{Built-in, ,Built-in Functions}, for a list of built-in *************** *** 8438,8444 **** @xref{User-defined, ,User-Defined Functions}, for instructions on how to do this. ! @cindex arguments in function call The way to use a function is with a @dfn{function call} expression, which consists of the function name followed immediately by a list of @dfn{arguments} in parentheses. The arguments are expressions that --- 8814,8820 ---- @xref{User-defined, ,User-Defined Functions}, for instructions on how to do this. ! @cindex arguments, in function calls The way to use a function is with a @dfn{function call} expression, which consists of the function name followed immediately by a list of @dfn{arguments} in parentheses. The arguments are expressions that *************** *** 8453,8458 **** --- 8829,8835 ---- rand() @i{no arguments} @end example + @cindex troubleshooting, function call syntax @strong{Caution:} Do not put any space between the function name and the open-parenthesis! A user-defined function name looks just like the name of a *************** *** 8463,8469 **** it is best not to get into the habit of using space to avoid mistakes with user-defined functions. Each function expects a particular number of arguments. For example, the @code{sqrt} function must be called with ! a single argument: the number to take the square root of: @example sqrt(@var{argument}) --- 8840,8846 ---- it is best not to get into the habit of using space to avoid mistakes with user-defined functions. Each function expects a particular number of arguments. For example, the @code{sqrt} function must be called with ! a single argument, the number of which to take the square root: @example sqrt(@var{argument}) *************** *** 8478,8484 **** treated as local variables and initialized to the empty string (@pxref{User-defined, ,User-Defined Functions}). ! @cindex side effects Like every other expression, the function call has a value, which is computed by the function based on the arguments you give it. In this example, the value of @samp{sqrt(@var{argument})} is the square root of --- 8855,8861 ---- treated as local variables and initialized to the empty string (@pxref{User-defined, ,User-Defined Functions}). ! @cindex side effects, function calls Like every other expression, the function call has a value, which is computed by the function based on the arguments you give it. In this example, the value of @samp{sqrt(@var{argument})} is the square root of *************** *** 8495,8507 **** @print{} The square root of 3 is 1.73205 5 @print{} The square root of 5 is 2.23607 ! @kbd{Ctrl-d} @end example @node Precedence, , Function Calls, Expressions @section Operator Precedence (How Operators Nest) @cindex precedence ! @cindex operator precedence @dfn{Operator precedence} determines how operators are grouped when different operators appear close by in one expression. For example, --- 8872,8886 ---- @print{} The square root of 3 is 1.73205 5 @print{} The square root of 5 is 2.23607 ! @kbd{@value{CTL}-d} @end example @node Precedence, , Function Calls, Expressions @section Operator Precedence (How Operators Nest) + @c STARTOFRANGE prec @cindex precedence ! @c STARTOFRANGE oppr ! @cindex operators, precedence @dfn{Operator precedence} determines how operators are grouped when different operators appear close by in one expression. For example, *************** *** 8535,8597 **** @samp{-(x^2)}, because @samp{-} has lower precedence than @samp{^}, whereas @samp{$} has higher precedence. This table presents @command{awk}'s operators, in order of highest ! precedence to lowest: @page - @cindex @code{$} field operator - @cindex @code{+} operator - @cindex @code{-} operator - @cindex @code{!} operator - @cindex @code{*} operator - @cindex @code{/} operator - @cindex @code{%} operator - @cindex @code{^} operator - @cindex @code{**} operator - @cindex @code{++} operator - @cindex @code{--} operator - @cindex @code{<} operator - @cindex @code{<=} operator - @cindex @code{==} operator - @cindex @code{!=} operator - @cindex @code{>} operator - @cindex @code{>=} operator - @cindex @code{>>} I/O operator - @cindex @code{|} I/O operator - @cindex @code{|&} I/O operator - @cindex @code{~} operator - @cindex @code{!~} operator - @cindex @code{in} operator - @cindex @code{&&} operator - @cindex @code{||} operator - @cindex @code{?:} operator - @cindex @code{+=} operator - @cindex @code{-=} operator - @cindex @code{*=} operator - @cindex @code{/=} operator - @cindex @code{%=} operator - @cindex @code{^=} operator - @cindex @code{**=} operator @c use @code in the items, looks better in TeX w/o all the quotes @table @code @item (@dots{}) Grouping. @item $ Field. @item ++ -- Increment, decrement. @item ^ ** Exponentiation. These operators group right-to-left. @item + - ! Unary plus, minus, logical ``not.'' @item * / % Multiplication, division, modulus. @item + - Addition, subtraction. --- 8914,8969 ---- @samp{-(x^2)}, because @samp{-} has lower precedence than @samp{^}, whereas @samp{$} has higher precedence. This table presents @command{awk}'s operators, in order of highest ! to lowest precedence: @page @c use @code in the items, looks better in TeX w/o all the quotes @table @code @item (@dots{}) Grouping. + @cindex @code{$} (dollar sign), @code{$} field operator + @cindex dollar sign (@code{$}), @code{$} field operator @item $ Field. + @cindex @code{+} (plus sign), @code{++} operator + @cindex plus sign (@code{+}), @code{++} operator + @cindex @code{-} (hyphen), @code{--} (decrement/increment) operator + @cindex hyphen (@code{-}), @code{--} (decrement/increment) operators @item ++ -- Increment, decrement. + @cindex @code{^} (caret), @code{^} operator + @cindex caret (@code{^}), @code{^} operator + @cindex @code{*} (asterisk), @code{**} operator + @cindex asterisk (@code{*}), @code{**} operator @item ^ ** Exponentiation. These operators group right-to-left. + @cindex @code{+} (plus sign), @code{+} operator + @cindex plus sign (@code{+}), @code{+} operator + @cindex @code{-} (hyphen), @code{-} operator + @cindex hyphen (@code{-}), @code{-} operator + @cindex @code{!} (exclamation point), @code{!} operator + @cindex exclamation point (@code{!}), @code{!} operator @item + - ! Unary plus, minus, logical ``not.'' + @cindex @code{*} (asterisk), @code{*} operator, as multiplication operator + @cindex asterisk (@code{*}), @code{*} operator, as multiplication operator + @cindex @code{/} (forward slash), @code{/} operator + @cindex forward slash (@code{/}), @code{/} operator + @cindex @code{%} (percent sign), @code{%} operator + @cindex percent sign (@code{%}), @code{%} operator @item * / % Multiplication, division, modulus. + @cindex @code{+} (plus sign), @code{+} operator + @cindex plus sign (@code{+}), @code{+} operator + @cindex @code{-} (hyphen), @code{-} operator + @cindex hyphen (@code{-}), @code{-} operator @item + - Addition, subtraction. *************** *** 8600,8605 **** --- 8972,8998 ---- The operands are simply written side by side (@pxref{Concatenation, ,String Concatenation}). + @cindex @code{<} (left angle bracket), @code{<} operator + @cindex left angle bracket (@code{<}), @code{<} operator + @cindex @code{<} (left angle bracket), @code{<=} operator + @cindex left angle bracket (@code{<}), @code{<=} operator + @cindex @code{>} (right angle bracket), @code{>=} operator + @cindex right angle bracket (@code{>}), @code{>=} operator + @cindex @code{>} (right angle bracket), @code{>} operator + @cindex right angle bracket (@code{>}), @code{>} operator + @cindex @code{=} (equals sign), @code{==} operator + @cindex equals sign (@code{=}), @code{==} operator + @cindex @code{!} (exclamation point), @code{!=} operator + @cindex exclamation point (@code{!}), @code{!=} operator + @cindex @code{>} (right angle bracket), @code{>>} operator (I/O) + @cindex right angle bracket (@code{>}), @code{>>} operator (I/O) + @cindex operators, input/output + @cindex @code{|} (vertical bar), @code{|} operator (I/O) + @cindex vertical bar (@code{|}), @code{|} operator (I/O) + @cindex operators, input/output + @cindex @code{|} (vertical bar), @code{|&} operator (I/O) + @cindex vertical bar (@code{|}), @code{|&} operator (I/O) + @cindex operators, input/output @item < <= == != @itemx > >= >> | |& Relational and redirection. *************** *** 8607,8651 **** level. Characters such as @samp{>} serve both as relationals and as redirections; the context distinguishes between the two meanings. Note that the I/O redirection operators in @code{print} and @code{printf} statements belong to the statement level, not to expressions. The redirection does not produce an expression that could be the operand of another operator. As a result, it does not make sense to use a redirection operator near another operator of lower precedence without ! parentheses. Such combinations (for example @samp{print foo > a ? b : c}), result in syntax errors. The correct way to write this statement is @samp{print foo > (a ? b : c)}. @item ~ !~ ! Matching, non-matching. @item in Array membership. @item && Logical ``and''. @item || Logical ``or''. @item ?: Conditional. This operator groups right-to-left. @item = += -= *= @itemx /= %= ^= **= ! Assignment. These operators group right-to-left. @end table ! @cindex portability issues ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} @strong{Note:} The @samp{|&}, @samp{**}, and @samp{**=} operators are not specified by POSIX. For maximum portability, do not use them. @node Patterns and Actions, Arrays, Expressions, Top @chapter Patterns, Actions, and Variables ! @cindex pattern, definition of As you have already seen, each @command{awk} statement consists of a pattern with an associated action. This @value{CHAPTER} describes how --- 9000,9073 ---- level. Characters such as @samp{>} serve both as relationals and as redirections; the context distinguishes between the two meanings. + @cindex @code{print} statement, I/O operators in + @cindex @code{printf} statement, I/O operators in Note that the I/O redirection operators in @code{print} and @code{printf} statements belong to the statement level, not to expressions. The redirection does not produce an expression that could be the operand of another operator. As a result, it does not make sense to use a redirection operator near another operator of lower precedence without ! parentheses. Such combinations (for example, @samp{print foo > a ? b : c}), result in syntax errors. The correct way to write this statement is @samp{print foo > (a ? b : c)}. + @cindex @code{~} (tilde), @code{~} operator + @cindex tilde (@code{~}), @code{~} operator + @cindex @code{!} (exclamation point), @code{!~} operator + @cindex exclamation point (@code{!}), @code{!~} operator @item ~ !~ ! Matching, nonmatching. + @cindex @code{in} operator @item in Array membership. + @cindex @code{&} (ampersand), @code{&&} operator + @cindex ampersand (@code{&}), @code{&&}operator @item && Logical ``and''. + @cindex @code{|} (vertical bar), @code{||} operator + @cindex vertical bar (@code{|}), @code{||} operator @item || Logical ``or''. + @cindex @code{?} (question mark), @code{?:} operator + @cindex question mark (@code{?}), @code{?:} operator @item ?: Conditional. This operator groups right-to-left. + @cindex @code{+} (plus sign), @code{+=} operator + @cindex plus sign (@code{+}), @code{+=} operator + @cindex @code{-} (hyphen), @code{-=} operator + @cindex hyphen (@code{-}), @code{-=} operator + @cindex @code{*} (asterisk), @code{*=} operator + @cindex asterisk (@code{*}), @code{*=} operator + @cindex @code{*} (asterisk), @code{**=} operator + @cindex asterisk (@code{*}), @code{**=} operator + @cindex @code{/} (forward slash), @code{/=} operator + @cindex forward slash (@code{/}), @code{/=} operator + @cindex @code{%} (percent sign), @code{%=} operator + @cindex percent sign (@code{%}), @code{%=} operator + @cindex @code{^} (caret), @code{^=} operator + @cindex caret (@code{^}), @code{^=} operator @item = += -= *= @itemx /= %= ^= **= ! Assignment. These operators group right to left. @end table ! @cindex portability, operators, not in POSIX @command{awk} @strong{Note:} The @samp{|&}, @samp{**}, and @samp{**=} operators are not specified by POSIX. For maximum portability, do not use them. + @c ENDOFRANGE prec + @c ENDOFRANGE oppr + @c ENDOFRANGE exps @node Patterns and Actions, Arrays, Expressions, Top @chapter Patterns, Actions, and Variables ! @c STARTOFRANGE pat ! @cindex patterns As you have already seen, each @command{awk} statement consists of a pattern with an associated action. This @value{CHAPTER} describes how *************** *** 8682,8688 **** @cindex patterns, types of Patterns in @command{awk} control the execution of rules---a rule is executed when its pattern matches the current input record. ! The following is a summary of the types of patterns in @command{awk}: @table @code @item /@var{regular expression}/ --- 9104,9110 ---- @cindex patterns, types of Patterns in @command{awk} control the execution of rules---a rule is executed when its pattern matches the current input record. ! The following is a summary of the types of @command{awk} patterns: @table @code @item /@var{regular expression}/ *************** *** 8714,8719 **** --- 9136,9143 ---- @node Regexp Patterns, Expression Patterns, Pattern Overview, Pattern Overview @subsection Regular Expressions as Patterns + @cindex patterns, expressions as + @cindex regular expressions, as patterns Regular expressions are one of the first kinds of patterns presented in this book. *************** *** 8729,8748 **** @node Expression Patterns, Ranges, Regexp Patterns, Pattern Overview @subsection Expressions as Patterns Any @command{awk} expression is valid as an @command{awk} pattern. The pattern matches if the expression's value is nonzero (if a number) or non-null (if a string). The expression is reevaluated each time the rule is tested against a new input record. If the expression uses fields such as @code{$1}, the ! value depends directly on the new input record's text; otherwise it depends on only what has happened so far in the execution of the @command{awk} program. Comparison expressions, using the comparison operators described in @ref{Typing and Comparison, ,Variable Typing and Comparison Expressions}, ! are a very common kind of pattern. ! Regexp matching and non-matching are also very common expressions. The left operand of the @samp{~} and @samp{!~} operators is a string. The right operand is either a constant regular expression enclosed in slashes (@code{/@var{regexp}/}), or any expression whose string value --- 9153,9175 ---- @node Expression Patterns, Ranges, Regexp Patterns, Pattern Overview @subsection Expressions as Patterns + @cindex expressions, as patterns Any @command{awk} expression is valid as an @command{awk} pattern. The pattern matches if the expression's value is nonzero (if a number) or non-null (if a string). The expression is reevaluated each time the rule is tested against a new input record. If the expression uses fields such as @code{$1}, the ! value depends directly on the new input record's text; otherwise, it depends on only what has happened so far in the execution of the @command{awk} program. + @cindex comparison expressions, as patterns + @cindex patterns, comparison expressions as Comparison expressions, using the comparison operators described in @ref{Typing and Comparison, ,Variable Typing and Comparison Expressions}, ! are a very common kind of pattern. ! Regexp matching and nonmatching are also very common expressions. The left operand of the @samp{~} and @samp{!~} operators is a string. The right operand is either a constant regular expression enclosed in slashes (@code{/@var{regexp}/}), or any expression whose string value *************** *** 8751,8756 **** --- 9178,9189 ---- The following example prints the second field of each input record whose first field is precisely @samp{foo}: + @cindex @code{/} (forward slash), patterns and + @cindex forward slash (@code{/}), patterns and + @cindex @code{~} (tilde), @code{~} operator + @cindex tilde (@code{~}), @code{~} operator + @cindex @code{!} (exclamation point), @code{!~} operator + @cindex exclamation point (@code{!}), @code{!~} operator @example $ awk '$1 == "foo" @{ print $2 @}' BBS-list @end example *************** *** 8768,8778 **** --- 9201,9214 ---- @print{} 555-2127 @end example + @cindex regexp constants, as patterns + @cindex patterns, regexp constants as A regexp constant as a pattern is also a special case of an expression pattern. The expression @code{/foo/} has the value one if @samp{foo} appears in the current input record. Thus, as a pattern, @code{/foo/} matches any record containing @samp{foo}. + @cindex Boolean expressions, as patterns Boolean expressions are also commonly used as patterns. Whether the pattern matches an input record depends on whether its subexpressions match. *************** *** 8813,8818 **** --- 9249,9256 ---- @print{} sdace 555-3430 2400/1200/300 A @end example + @cindex @code{BEGIN} pattern, Boolean patterns and + @cindex @code{END} pattern, Boolean patterns and The subexpressions of a Boolean operator in a pattern can be constant regular expressions, comparisons, or any other @command{awk} expressions. Range patterns are not expressions, so they cannot appear inside Boolean *************** *** 8823,8831 **** @node Ranges, BEGIN/END, Expression Patterns, Pattern Overview @subsection Specifying Record Ranges with Patterns ! @cindex range pattern ! @cindex pattern, range ! @cindex matching ranges of lines A @dfn{range pattern} is made of two patterns separated by a comma, in the form @samp{@var{begpat}, @var{endpat}}. It is used to match ranges of consecutive input records. The first pattern, @var{begpat}, controls --- 9261,9271 ---- @node Ranges, BEGIN/END, Expression Patterns, Pattern Overview @subsection Specifying Record Ranges with Patterns ! @cindex range patterns ! @cindex patterns, ranges in ! @cindex lines, matching ranges of ! @cindex @code{,} (comma), in range patterns ! @cindex comma (@code{,}), in range patterns A @dfn{range pattern} is made of two patterns separated by a comma, in the form @samp{@var{begpat}, @var{endpat}}. It is used to match ranges of consecutive input records. The first pattern, @var{begpat}, controls *************** *** 8848,8853 **** --- 9288,9295 ---- for the following record. Then the range pattern goes back to checking @var{begpat} against each record. + @c last comma does NOT start a tertiary + @cindex @code{if} statement, actions, changing The record that turns on the range pattern and the one that turns it off both match the range pattern. If you don't want to operate on these records, you can write @code{if} statements in the rule's action *************** *** 8856,8862 **** It is possible for a pattern to be turned on and off by the same record. If the record satisfies both conditions, then the action is executed for just that record. ! For example, suppose there is text between two identical markers (say the @samp{%} symbol), each on its own line, that should be ignored. A first attempt would be to combine a range pattern that describes the delimited text with the --- 9298,9304 ---- It is possible for a pattern to be turned on and off by the same record. If the record satisfies both conditions, then the action is executed for just that record. ! For example, suppose there is text between two identical markers (e.g., the @samp{%} symbol), each on its own line, that should be ignored. A first attempt would be to combine a range pattern that describes the delimited text with the *************** *** 8872,8879 **** @end example @noindent ! @cindex skipping lines between markers ! @cindex flag variables This program fails because the range pattern is both turned on and turned off by the first line, which just has a @samp{%} on it. To accomplish this task, write the program in the following manner, using a flag: --- 9314,9321 ---- @end example @noindent ! @cindex lines, skipping between markers ! @c @cindex flag variables This program fails because the range pattern is both turned on and turned off by the first line, which just has a @samp{%} on it. To accomplish this task, write the program in the following manner, using a flag: *************** *** 8886,8892 **** In a range pattern, the comma (@samp{,}) has the lowest precedence of all the operators (i.e., it is evaluated last). Thus, the following ! program attempts to combine a range pattern with another simpler test: @example echo Yes | awk '/1/,/2/ || /Yes/' --- 9328,9334 ---- In a range pattern, the comma (@samp{,}) has the lowest precedence of all the operators (i.e., it is evaluated last). Thus, the following ! program attempts to combine a range pattern with another, simpler test: @example echo Yes | awk '/1/,/2/ || /Yes/' *************** *** 8908,8918 **** @node BEGIN/END, Empty, Ranges, Pattern Overview @subsection The @code{BEGIN} and @code{END} Special Patterns ! @cindex @code{BEGIN} special pattern ! @cindex pattern, @code{BEGIN} ! @cindex @code{END} special pattern ! @cindex pattern, @code{END} ! @cindex blocks, @code{BEGIN} and @code{END} All the patterns described so far are for matching input records. The @code{BEGIN} and @code{END} special patterns are different. They supply startup and cleanup actions for @command{awk} programs. --- 9350,9359 ---- @node BEGIN/END, Empty, Ranges, Pattern Overview @subsection The @code{BEGIN} and @code{END} Special Patterns ! @c STARTOFRANGE beg ! @cindex @code{BEGIN} pattern ! @c STARTOFRANGE end ! @cindex @code{END} pattern All the patterns described so far are for matching input records. The @code{BEGIN} and @code{END} special patterns are different. They supply startup and cleanup actions for @command{awk} programs. *************** *** 8943,8948 **** --- 9384,9391 ---- @print{} "foo" appears 4 times. @end example + @cindex @code{BEGIN} pattern, operators and + @cindex @code{END} pattern, operators and This program finds the number of records in the input file @file{BBS-list} that contain the string @samp{foo}. The @code{BEGIN} rule prints a title for the report. There is no need to use the @code{BEGIN} rule to *************** *** 8972,8988 **** @code{END} rule to do its own initialization and/or cleanup. The order in which library functions are named on the command line controls the order in which their @code{BEGIN} and @code{END} rules are ! executed. Therefore you have to be careful when writing such rules in library files so that the order in which they are executed doesn't matter. @xref{Options, ,Command-Line Options}, for more information on using library functions. @xref{Library Functions, ,A Library of @command{awk} Functions}, for a number of useful library functions. ! If an @command{awk} program only has a @code{BEGIN} rule and no other rules, then the program exits after the @code{BEGIN} rule is run.@footnote{The original version of @command{awk} used to keep ! reading and ignoring input until end of file was seen.} However, if an @code{END} rule exists, then the input is read, even if there are no other rules in the program. This is necessary in case the @code{END} rule checks the @code{FNR} and @code{NR} variables. --- 9415,9431 ---- @code{END} rule to do its own initialization and/or cleanup. The order in which library functions are named on the command line controls the order in which their @code{BEGIN} and @code{END} rules are ! executed. Therefore, you have to be careful when writing such rules in library files so that the order in which they are executed doesn't matter. @xref{Options, ,Command-Line Options}, for more information on using library functions. @xref{Library Functions, ,A Library of @command{awk} Functions}, for a number of useful library functions. ! If an @command{awk} program has only a @code{BEGIN} rule and no other rules, then the program exits after the @code{BEGIN} rule is run.@footnote{The original version of @command{awk} used to keep ! reading and ignoring input until the end of the file was seen.} However, if an @code{END} rule exists, then the input is read, even if there are no other rules in the program. This is necessary in case the @code{END} rule checks the @code{FNR} and @code{NR} variables. *************** *** 8990,8996 **** @node I/O And BEGIN/END, , Using BEGIN/END, BEGIN/END @subsubsection Input/Output from @code{BEGIN} and @code{END} Rules ! @cindex I/O, from @code{BEGIN} and @code{END} There are several (sometimes subtle) points to remember when doing I/O from a @code{BEGIN} or @code{END} rule. The first has to do with the value of @code{$0} in a @code{BEGIN} --- 9433,9439 ---- @node I/O And BEGIN/END, , Using BEGIN/END, BEGIN/END @subsubsection Input/Output from @code{BEGIN} and @code{END} Rules ! @cindex input/output, from @code{BEGIN} and @code{END} There are several (sometimes subtle) points to remember when doing I/O from a @code{BEGIN} or @code{END} rule. The first has to do with the value of @code{$0} in a @code{BEGIN} *************** *** 9000,9008 **** yield a null string or zero, depending upon the context. One way to give @code{$0} a real value is to execute a @code{getline} command without a variable (@pxref{Getline, ,Explicit Input with @code{getline}}). ! Another way is to simply assign a value to @code{$0}. ! @cindex differences between @command{gawk} and @command{awk} The second point is similar to the first but from the other direction. Traditionally, due largely to implementation issues, @code{$0} and @code{NF} were @emph{undefined} inside an @code{END} rule. --- 9443,9455 ---- yield a null string or zero, depending upon the context. One way to give @code{$0} a real value is to execute a @code{getline} command without a variable (@pxref{Getline, ,Explicit Input with @code{getline}}). ! Another way is simply to assign a value to @code{$0}. ! @cindex differences in @command{awk} and @command{gawk}, @code{BEGIN}/@code{END} patterns ! @cindex POSIX @command{awk}, @code{BEGIN}/@code{END} patterns ! @cindex @code{print} statement, @code{BEGIN}/@code{END} patterns and ! @cindex @code{BEGIN} pattern, @code{print} statement and ! @cindex @code{END} pattern, @code{print} statement and The second point is similar to the first but from the other direction. Traditionally, due largely to implementation issues, @code{$0} and @code{NF} were @emph{undefined} inside an @code{END} rule. *************** *** 9024,9042 **** at least in @command{gawk}. It is also poor style, since if an empty line is needed in the output, the program should print one explicitly. Finally, the @code{next} and @code{nextfile} statements are not allowed in a @code{BEGIN} rule, because the implicit read-a-record-and-match-against-the-rules loop has not started yet. Similarly, those statements are not valid in an @code{END} rule, since all the input has been read. (@xref{Next Statement, ,The @code{next} Statement}, and see @ref{Nextfile Statement, ,Using @command{gawk}'s @code{nextfile} Statement}.) @node Empty, , BEGIN/END, Pattern Overview @subsection The Empty Pattern @cindex empty pattern ! @cindex pattern, empty ! An empty (i.e., non-existent) pattern is considered to match @emph{every} input record. For example, the program: @example --- 9471,9495 ---- at least in @command{gawk}. It is also poor style, since if an empty line is needed in the output, the program should print one explicitly. + @cindex @code{next} statement, @code{BEGIN}/@code{END} patterns and + @cindex @code{nextfile} statement, @code{BEGIN}/@code{END} patterns and + @cindex @code{BEGIN} pattern, @code{next}/@code{nextfile} statements and + @cindex @code{END} pattern, @code{next}/@code{nextfile} statements and Finally, the @code{next} and @code{nextfile} statements are not allowed in a @code{BEGIN} rule, because the implicit read-a-record-and-match-against-the-rules loop has not started yet. Similarly, those statements are not valid in an @code{END} rule, since all the input has been read. (@xref{Next Statement, ,The @code{next} Statement}, and see @ref{Nextfile Statement, ,Using @command{gawk}'s @code{nextfile} Statement}.) + @c ENDOFRANGE beg + @c ENDOFRANGE end @node Empty, , BEGIN/END, Pattern Overview @subsection The Empty Pattern @cindex empty pattern ! @cindex patterns, empty ! An empty (i.e., nonexistent) pattern is considered to match @emph{every} input record. For example, the program: @example *************** *** 9045,9056 **** @noindent prints the first field of every record. @node Using Shell Variables, Action Overview, Pattern Overview, Patterns and Actions @section Using Shell Variables in Programs ! @cindex shell varibles, using in @command{awk} programs ! @cindex using shell variables in @command{awk} programs ! @cindex shell and @command{awk} interaction @command{awk} programs are often used as components in larger programs written in shell. --- 9498,9510 ---- @noindent prints the first field of every record. + @c ENDOFRANGE pat @node Using Shell Variables, Action Overview, Pattern Overview, Patterns and Actions @section Using Shell Variables in Programs ! @cindex shells, variables ! @cindex @command{awk} programs, shell variables in ! @c @cindex shell and @command{awk} interaction @command{awk} programs are often used as components in larger programs written in shell. *************** *** 9059,9064 **** --- 9513,9519 ---- There are two ways to get the value of the shell variable into the body of the @command{awk} program. + @cindex shells, quoting The most common method is to use shell quoting to substitute the variable's value into the program inside the script. For example, in the following program: *************** *** 9110,9119 **** @node Action Overview, Statements, Using Shell Variables, Patterns and Actions @section Actions ! @cindex action, definition of ! @cindex curly braces ! @cindex action, curly braces ! @cindex action, separating statements An @command{awk} program or script consists of a series of rules and function definitions interspersed. (Functions are --- 9565,9575 ---- @node Action Overview, Statements, Using Shell Variables, Patterns and Actions @section Actions ! @c @cindex action, definition of ! @c @cindex curly braces ! @c @cindex action, curly braces ! @c @cindex action, separating statements ! @cindex actions An @command{awk} program or script consists of a series of rules and function definitions interspersed. (Functions are *************** *** 9131,9138 **** @dots{} @end example An action consists of one or more @command{awk} @dfn{statements}, enclosed ! in curly braces (@samp{@{} and @samp{@}}). Each statement specifies one thing to do. The statements are separated by newlines or semicolons. The curly braces around an action must be used even if the action contains only one statement, or if it contains no statements at --- 9587,9600 ---- @dots{} @end example + @cindex @code{@{@}} (braces), actions and + @cindex braces (@code{@{@}}), actions and + @cindex separators, for statements in actions + @cindex newlines, separating statements in actions + @cindex @code{;} (semicolon), separating statements in actions + @cindex semicolon (@code{;}), separating statements in actions An action consists of one or more @command{awk} @dfn{statements}, enclosed ! in curly braces (@samp{@{@dots{}@}}). Each statement specifies one thing to do. The statements are separated by newlines or semicolons. The curly braces around an action must be used even if the action contains only one statement, or if it contains no statements at *************** *** 9146,9198 **** The following types of statements are supported in @command{awk}: ! @itemize @bullet ! @cindex side effects ! @item ! Expressions, which can call functions or assign values to variables (@pxref{Expressions}). Executing this kind of statement simply computes the value of the expression. This is useful when the expression has side effects (@pxref{Assignment Ops, ,Assignment Expressions}). ! @item ! Control statements, which specify the control flow of @command{awk} programs. The @command{awk} language gives you C-like constructs (@code{if}, @code{for}, @code{while}, and @code{do}) as well as a few special ones (@pxref{Statements, ,Control Statements in Actions}). ! @item ! Compound statements, which consist of one or more statements enclosed in curly braces. A compound statement is used in order to put several statements together in the body of an @code{if}, @code{while}, @code{do}, or @code{for} statement. ! @item ! Input statements using the @code{getline} command ! (@pxref{Getline, ,Explicit Input with @code{getline}}), the @code{next} statement (@pxref{Next Statement, ,The @code{next} Statement}), and the @code{nextfile} statement (@pxref{Nextfile Statement, ,Using @command{gawk}'s @code{nextfile} Statement}). ! @item ! Output statements, such as @code{print} and @code{printf}. @xref{Printing, ,Printing Output}. ! @item ! Deletion statements for deleting array elements. @xref{Delete, ,The @code{delete} Statement}. ! @end itemize @node Statements, Built-in Variables, Action Overview, Patterns and Actions @section Control Statements in Actions ! @cindex control statement @dfn{Control statements}, such as @code{if}, @code{while}, and so on, control the flow of execution in @command{awk} programs. Most of the control statements in @command{awk} are patterned on similar statements in C. ! @cindex compound statement ! @cindex statement, compound All the control statements start with special keywords, such as @code{if} and @code{while}, to distinguish them from simple expressions. Many control statements contain other statements. For example, the --- 9608,9674 ---- The following types of statements are supported in @command{awk}: ! @table @asis ! @cindex side effects, statements ! @item Expressions ! Call functions or assign values to variables (@pxref{Expressions}). Executing this kind of statement simply computes the value of the expression. This is useful when the expression has side effects (@pxref{Assignment Ops, ,Assignment Expressions}). ! @item Control statements ! Specify the control flow of @command{awk} programs. The @command{awk} language gives you C-like constructs (@code{if}, @code{for}, @code{while}, and @code{do}) as well as a few special ones (@pxref{Statements, ,Control Statements in Actions}). ! @item Compound statements ! Consist of one or more statements enclosed in curly braces. A compound statement is used in order to put several statements together in the body of an @code{if}, @code{while}, @code{do}, or @code{for} statement. ! @item Input statements ! Use the @code{getline} command ! (@pxref{Getline, ,Explicit Input with @code{getline}}). ! Also supplied in @command{awk} are the @code{next} statement (@pxref{Next Statement, ,The @code{next} Statement}), and the @code{nextfile} statement (@pxref{Nextfile Statement, ,Using @command{gawk}'s @code{nextfile} Statement}). ! @item Output statements ! Such as @code{print} and @code{printf}. @xref{Printing, ,Printing Output}. ! @item Deletion statements ! For deleting array elements. @xref{Delete, ,The @code{delete} Statement}. ! @end table @node Statements, Built-in Variables, Action Overview, Patterns and Actions @section Control Statements in Actions ! @c STARTOFRANGE csta ! @cindex control statements ! @c STARTOFRANGE acs ! @cindex statements, control, in actions ! @c STARTOFRANGE accs ! @cindex actions, control statements in @dfn{Control statements}, such as @code{if}, @code{while}, and so on, control the flow of execution in @command{awk} programs. Most of the control statements in @command{awk} are patterned on similar statements in C. ! @c the comma here does NOT start a secondary ! @cindex compound statements, control statements and ! @c the second comma here does NOT start a tertiary ! @cindex statements, compound, control statements and ! @cindex body, in actions ! @cindex @code{@{@}} (braces), statements, grouping ! @cindex braces (@code{@{@}}), statements, grouping ! @cindex newlines, separating statements in actions ! @cindex @code{;} (semicolon), separating statements in actions ! @cindex semicolon (@code{;}), separating statements in actions All the control statements start with special keywords, such as @code{if} and @code{while}, to distinguish them from simple expressions. Many control statements contain other statements. For example, the *************** *** 9221,9227 **** @node If Statement, While Statement, Statements, Statements @subsection The @code{if}-@code{else} Statement ! @cindex @code{if}-@code{else} statement The @code{if}-@code{else} statement is @command{awk}'s decision-making statement. It looks like this: --- 9697,9703 ---- @node If Statement, While Statement, Statements, Statements @subsection The @code{if}-@code{else} Statement ! @cindex @code{if} statement The @code{if}-@code{else} statement is @command{awk}'s decision-making statement. It looks like this: *************** *** 9235,9241 **** executed; otherwise, @var{else-body} is executed. The @code{else} part of the statement is optional. The condition is considered false if its value is zero or ! the null string; otherwise the condition is true. Refer to the following: @example --- 9711,9717 ---- executed; otherwise, @var{else-body} is executed. The @code{else} part of the statement is optional. The condition is considered false if its value is zero or ! the null string; otherwise, the condition is true. Refer to the following: @example *************** *** 9247,9253 **** In this example, if the expression @samp{x % 2 == 0} is true (that is, if the value of @code{x} is evenly divisible by two), then the first ! @code{print} statement is executed; otherwise the second @code{print} statement is executed. If the @code{else} keyword appears on the same line as @var{then-body} and @var{then-body} is not a compound statement (i.e., not surrounded by --- 9723,9729 ---- In this example, if the expression @samp{x % 2 == 0} is true (that is, if the value of @code{x} is evenly divisible by two), then the first ! @code{print} statement is executed; otherwise, the second @code{print} statement is executed. If the @code{else} keyword appears on the same line as @var{then-body} and @var{then-body} is not a compound statement (i.e., not surrounded by *************** *** 9269,9276 **** @node While Statement, Do Statement, If Statement, Statements @subsection The @code{while} Statement @cindex @code{while} statement ! @cindex loop ! @cindex body of a loop In programming, a @dfn{loop} is a part of a program that can be executed two or more times in succession. --- 9745,9752 ---- @node While Statement, Do Statement, If Statement, Statements @subsection The @code{while} Statement @cindex @code{while} statement ! @cindex loops ! @cindex loops, See Also @code{while} statement In programming, a @dfn{loop} is a part of a program that can be executed two or more times in succession. *************** *** 9283,9288 **** --- 9759,9765 ---- @var{body} @end example + @cindex body, in loops @noindent @var{body} is a statement called the @dfn{body} of the loop, and @var{condition} is an expression that controls how long the loop *************** *** 9364,9370 **** @end example @noindent ! This program prints each input record ten times. However, it isn't a very realistic example, since in this case an ordinary @code{while} would do just as well. This situation reflects actual experience; only occasionally is there a real use for a @code{do} statement. --- 9841,9847 ---- @end example @noindent ! This program prints each input record 10 times. However, it isn't a very realistic example, since in this case an ordinary @code{while} would do just as well. This situation reflects actual experience; only occasionally is there a real use for a @code{do} statement. *************** *** 9411,9417 **** are equal. (But it is possible to initialize additional variables by writing their assignments as separate statements preceding the @code{for} loop.) ! @cindex comma operator, not supported The same is true of the @var{increment} part. Incrementing additional variables requires separate statements at the end of the loop. The C compound expression, using C's comma operator, is useful in --- 9888,9894 ---- are equal. (But it is possible to initialize additional variables by writing their assignments as separate statements preceding the @code{for} loop.) ! @c @cindex comma operator, not supported The same is true of the @var{increment} part. Incrementing additional variables requires separate statements at the end of the loop. The C compound expression, using C's comma operator, is useful in *************** *** 9444,9449 **** --- 9921,9927 ---- @} @end example + @cindex loops, @code{continue} statements and @noindent The only exception is when the @code{continue} statement (@pxref{Continue Statement, ,The @code{continue} Statement}) is used *************** *** 9524,9534 **** @} @end example ! @cindex @code{break}, outside of loops ! @cindex historical features ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} ! @cindex dark corner The @code{break} statement has no meaning when used outside the body of a loop. However, although it was never documented, historical implementations of @command{awk} treated the @code{break} --- 10002,10013 ---- @} @end example ! @c @cindex @code{break}, outside of loops ! @c @cindex historical features ! @c @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk}, @code{break} statement and ! @cindex dark corner, @code{break} statement ! @cindex @command{gawk}, @code{break} statement in The @code{break} statement has no meaning when used outside the body of a loop. However, although it was never documented, historical implementations of @command{awk} treated the @code{break} *************** *** 9571,9579 **** @end example @noindent ! This program prints all the numbers from 0 to 20---except for five, for which the @code{printf} is skipped. Because the increment @samp{x++} ! is not skipped, @code{x} does not remain stuck at five. Contrast the @code{for} loop from the previous example with the following @code{while} loop: @example --- 10050,10058 ---- @end example @noindent ! This program prints all the numbers from 0 to 20---except for 5, for which the @code{printf} is skipped. Because the increment @samp{x++} ! is not skipped, @code{x} does not remain stuck at 5. Contrast the @code{for} loop from the previous example with the following @code{while} loop: @example *************** *** 9590,9602 **** @end example @noindent ! This program loops forever once @code{x} reaches five. ! @cindex @code{continue}, outside of loops ! @cindex historical features ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} ! @cindex dark corner The @code{continue} statement has no meaning when used outside the body of a loop. Historical versions of @command{awk} treated a @code{continue} statement outside a loop the same way they treated a @code{break} --- 10069,10082 ---- @end example @noindent ! This program loops forever once @code{x} reaches 5. ! @c @cindex @code{continue}, outside of loops ! @c @cindex historical features ! @c @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk}, @code{continue} statement and ! @cindex dark corner, @code{continue} statement ! @cindex @command{gawk}, @code{continue} statement in The @code{continue} statement has no meaning when used outside the body of a loop. Historical versions of @command{awk} treated a @code{continue} statement outside a loop the same way they treated a @code{break} *************** *** 9625,9630 **** --- 10105,10111 ---- flow of control in any way (i.e., the rest of the current action executes with a new input record). + @cindex @command{awk} programs, execution of At the highest level, @command{awk} program execution is a loop that reads an input record and then tests each rule's pattern against it. If you think of this loop as a @code{for} statement whose body contains the *************** *** 9650,9660 **** the program's subsequent rules won't see the bad record. The error message is redirected to the standard error output stream, as error messages should be. ! @xref{Special Files, ,Special @value{FFN}s in @command{gawk}}. ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} ! @cindex @code{next}, inside a user-defined function According to the POSIX standard, the behavior is undefined if the @code{next} statement is used in a @code{BEGIN} or @code{END} rule. @command{gawk} treats it as a syntax error. --- 10131,10146 ---- the program's subsequent rules won't see the bad record. The error message is redirected to the standard error output stream, as error messages should be. ! For more detail see ! @ref{Special Files, ,Special @value{FFN}s in @command{gawk}}. ! @c @cindex @command{awk} language, POSIX version ! @c @cindex @code{next}, inside a user-defined function ! @cindex @code{BEGIN} pattern, @code{next}/@code{nextfile} statements and ! @cindex @code{END} pattern, @code{next}/@code{nextfile} statements and ! @cindex POSIX @command{awk}, @code{next}/@code{nextfile} statements and ! @cindex @code{next} statement, user-defined functions and ! @cindex functions, user-defined, @code{next}/@code{nextfile} statements and According to the POSIX standard, the behavior is undefined if the @code{next} statement is used in a @code{BEGIN} or @code{END} rule. @command{gawk} treats it as a syntax error. *************** *** 9672,9678 **** @node Nextfile Statement, Exit Statement, Next Statement, Statements @subsection Using @command{gawk}'s @code{nextfile} Statement @cindex @code{nextfile} statement ! @cindex differences between @command{gawk} and @command{awk} @command{gawk} provides the @code{nextfile} statement, which is similar to the @code{next} statement. --- 10158,10164 ---- @node Nextfile Statement, Exit Statement, Next Statement, Statements @subsection Using @command{gawk}'s @code{nextfile} Statement @cindex @code{nextfile} statement ! @cindex differences in @command{awk} and @command{gawk}, @code{next}/@code{nextfile} statements @command{gawk} provides the @code{nextfile} statement, which is similar to the @code{next} statement. *************** *** 9713,9719 **** for a user-defined function that simulates the @code{nextfile} statement. ! @cindex @code{nextfile}, inside a user-defined function The current version of the Bell Laboratories @command{awk} (@pxref{Other Versions, ,Other Freely Available @command{awk} Implementations}) also supports @code{nextfile}. However, it doesn't allow the @code{nextfile} --- 10199,10206 ---- for a user-defined function that simulates the @code{nextfile} statement. ! @cindex functions, user-defined, @code{next}/@code{nextfile} statements and ! @cindex @code{nextfile} statement, user-defined functions and The current version of the Bell Laboratories @command{awk} (@pxref{Other Versions, ,Other Freely Available @command{awk} Implementations}) also supports @code{nextfile}. However, it doesn't allow the @code{nextfile} *************** *** 9723,9729 **** function body reads the next record and starts processing it with the first rule in the program, just as any other @code{nextfile} statement. ! @cindex @code{next file} statement @strong{Caution:} Versions of @command{gawk} prior to 3.0 used two words (@samp{next file}) for the @code{nextfile} statement. In @value{PVERSION} 3.0, this was changed --- 10210,10219 ---- function body reads the next record and starts processing it with the first rule in the program, just as any other @code{nextfile} statement. ! @cindex @code{next file} statement, in @command{gawk} ! @cindex @command{gawk}, @code{next file} statement in ! @cindex @code{nextfile} statement, in @command{gawk} ! @cindex @command{gawk}, @code{nextfile} statement in @strong{Caution:} Versions of @command{gawk} prior to 3.0 used two words (@samp{next file}) for the @code{nextfile} statement. In @value{PVERSION} 3.0, this was changed *************** *** 9744,9749 **** --- 10234,10241 ---- exit @r{[}@var{return code}@r{]} @end example + @cindex @code{BEGIN} pattern, @code{exit} statement and + @cindex @code{END} pattern, @code{exit} statement and When an @code{exit} statement is executed from a @code{BEGIN} rule, the program stops processing everything immediately. No input records are read. However, if an @code{END} rule is present, *************** *** 9765,9771 **** @xref{Assert Function, ,Assertions}, for an example that does this. ! @cindex dark corner If an argument is supplied to @code{exit}, its value is used as the exit status code for the @command{awk} process. If no argument is supplied, @code{exit} returns status zero (success). In the case where an argument --- 10257,10263 ---- @xref{Assert Function, ,Assertions}, for an example that does this. ! @cindex dark corner, @code{exit} statement If an argument is supplied to @code{exit}, its value is used as the exit status code for the @command{awk} process. If no argument is supplied, @code{exit} returns status zero (success). In the case where an argument *************** *** 9774,9781 **** @command{awk} uses the previously supplied exit value. @value{DARKCORNER} ! @cindex conventions, programming ! @cindex programming conventions For example, suppose an error condition occurs that is difficult or impossible to handle. Conventionally, programs report this by exiting with a nonzero status. An @command{awk} program can do this --- 10266,10272 ---- @command{awk} uses the previously supplied exit value. @value{DARKCORNER} ! @cindex programming conventions, @code{exit} statement For example, suppose an error condition occurs that is difficult or impossible to handle. Conventionally, programs report this by exiting with a nonzero status. An @command{awk} program can do this *************** *** 9792,9803 **** close("date") @} @end example @node Built-in Variables, , Statements, Patterns and Actions @section Built-in Variables @cindex built-in variables ! Most @command{awk} variables are available for you to use for your own purposes; they never change unless your program assigns values to them, and they never affect anything unless your program examines them. However, a few variables in @command{awk} have special built-in meanings. --- 10283,10300 ---- close("date") @} @end example + @c ENDOFRANGE csta + @c ENDOFRANGE acs + @c ENDOFRANGE accs @node Built-in Variables, , Statements, Patterns and Actions @section Built-in Variables + @c STARTOFRANGE bvar @cindex built-in variables + @c STARTOFRANGE varb + @cindex variables, built-in ! Most @command{awk} variables are available to use for your own purposes; they never change unless your program assigns values to them, and they never affect anything unless your program examines them. However, a few variables in @command{awk} have special built-in meanings. *************** *** 9806,9811 **** --- 10303,10309 ---- automatically by @command{awk}, so that they carry information from the internal workings of @command{awk} to your program. + @cindex @command{gawk}, built-in variables and This @value{SECTION} documents all the built-in variables of @command{gawk}, most of which are also documented in the chapters describing their areas of activity. *************** *** 9820,9826 **** @node User-modified, Auto-set, Built-in Variables, Built-in Variables @subsection Built-in Variables That Control @command{awk} ! @cindex built-in variables, user modifiable The following is an alphabetical list of variables that you can change to control how @command{awk} does certain things. The variables that are --- 10318,10327 ---- @node User-modified, Auto-set, Built-in Variables, Built-in Variables @subsection Built-in Variables That Control @command{awk} ! @c STARTOFRANGE bvaru ! @cindex built-in variables, user-modifiable ! @c STARTOFRANGE nmbv ! @cindex user-modifiable variables The following is an alphabetical list of variables that you can change to control how @command{awk} does certain things. The variables that are *************** *** 9828,9839 **** @table @code @cindex @code{BINMODE} variable ! @cindex binary I/O ! @cindex I/O, binary ! @cindex differences between @command{gawk} and @command{awk} @item BINMODE # ! On non-POSIX systems, this variable specifies use of ``binary'' mode for all I/O. ! Numeric values of one, two, or three, specify that input files, output files, or all files, respectively, should use binary I/O. Alternatively, string values of @code{"r"} or @code{"w"} specify that input files and --- 10329,10339 ---- @table @code @cindex @code{BINMODE} variable ! @cindex binary input/output ! @cindex input/output, binary @item BINMODE # ! On non-POSIX systems, this variable specifies use of binary mode for all I/O. ! Numeric values of one, two, or three specify that input files, output files, or all files, respectively, should use binary I/O. Alternatively, string values of @code{"r"} or @code{"w"} specify that input files and *************** *** 9845,9850 **** --- 10345,10351 ---- @code{BINMODE} is described in more detail in @ref{PC Using, ,Using @command{gawk} on PC Operating Systems}. + @cindex differences in @command{awk} and @command{gawk}, @code{BINMODE} variable This variable is a @command{gawk} extension. In other @command{awk} implementations (except @command{mawk}, *************** *** 9854,9861 **** it is not special. @cindex @code{CONVFMT} variable ! @cindex @command{awk} language, POSIX version ! @cindex POSIX @command{awk} @item CONVFMT This string controls conversion of numbers to strings (@pxref{Conversion, ,Conversion of Strings and Numbers}). --- 10355,10363 ---- it is not special. @cindex @code{CONVFMT} variable ! @cindex POSIX @command{awk}, @code{CONVFMT} variable and ! @cindex numbers, converting, to strings ! @cindex strings, converting, numbers to @item CONVFMT This string controls conversion of numbers to strings (@pxref{Conversion, ,Conversion of Strings and Numbers}). *************** *** 9866,9871 **** --- 10368,10376 ---- @code{CONVFMT} was introduced by the POSIX standard. @cindex @code{FIELDWIDTHS} variable + @cindex differences in @command{awk} and @command{gawk}, @code{FIELDWIDTHS} variable + @cindex field separators, @code{FIELDWIDTHS} variable and + @cindex separators, field, @code{FIELDWIDTHS} variable and @item FIELDWIDTHS # This is a space-separated list of columns that tells @command{gawk} how to split input with fixed columnar boundaries. *************** *** 9873,9884 **** --- 10378,10392 ---- overrides the use of @code{FS} for field splitting. @xref{Constant Size, ,Reading Fixed-Width Data}, for more information. + @cindex @command{gawk}, @code{FIELDWIDTHS} variable in If @command{gawk} is in compatibility mode (@pxref{Options, ,Command-Line Options}), then @code{FIELDWIDTHS} has no special meaning, and field-splitting operations occur based exclusively on the value of @code{FS}. @cindex @code{FS} variable + @cindex separators, field + @cindex field separators @item FS This is the input field separator (@pxref{Field Separators, ,Specifying How Fields Are Separated}). *************** *** 9890,9895 **** --- 10398,10404 ---- specify the behavior when @code{FS} is the null string.) @c NEXT ED: Mark as common extension + @cindex POSIX @command{awk}, @code{FS} variable and The default value is @w{@code{" "}}, a string consisting of a single space. As a special exception, this value means that any sequence of spaces, tabs, and/or newlines is a single separator.@footnote{In *************** *** 9903,9917 **** awk -F, '@var{program}' @var{input-files} @end example If @command{gawk} is using @code{FIELDWIDTHS} for field splitting, assigning a value to @code{FS} causes @command{gawk} to return to the normal, @code{FS}-based field splitting. An easy way to do this is to simply say @samp{FS = FS}, perhaps with an explanatory comment. @cindex @code{IGNORECASE} variable @item IGNORECASE # If @code{IGNORECASE} is nonzero or non-null, then all string comparisons ! and all regular expression matching are case-independent. Thus, regexp matching with @samp{~} and @samp{!~}, as well as the @code{gensub}, @code{gsub}, @code{index}, @code{match}, @code{split}, and @code{sub} functions, record termination with @code{RS}, and field splitting with --- 10412,10431 ---- awk -F, '@var{program}' @var{input-files} @end example + @cindex @command{gawk}, field separators and If @command{gawk} is using @code{FIELDWIDTHS} for field splitting, assigning a value to @code{FS} causes @command{gawk} to return to the normal, @code{FS}-based field splitting. An easy way to do this is to simply say @samp{FS = FS}, perhaps with an explanatory comment. @cindex @code{IGNORECASE} variable + @cindex differences in @command{awk} and @command{gawk}, @code{IGNORECASE} variable + @cindex case sensitivity, string comparisons and + @cindex case sensitivity, regexps and + @cindex regular expressions, case sensitivity @item IGNORECASE # If @code{IGNORECASE} is nonzero or non-null, then all string comparisons ! and all regular expression matching are case independent. Thus, regexp matching with @samp{~} and @samp{!~}, as well as the @code{gensub}, @code{gsub}, @code{index}, @code{match}, @code{split}, and @code{sub} functions, record termination with @code{RS}, and field splitting with *************** *** 9919,9940 **** However, the value of @code{IGNORECASE} does @emph{not} affect array subscripting. @xref{Case-sensitivity, ,Case Sensitivity in Matching}. If @command{gawk} is in compatibility mode (@pxref{Options, ,Command-Line Options}), then @code{IGNORECASE} has no special meaning. Thus, string and regexp operations are always case-sensitive. @cindex @code{LINT} variable ! @cindex differences between @command{gawk} and @command{awk} ! @cindex lint checks @item LINT # When this variable is true (nonzero or non-null), @command{gawk} behaves as if the @option{--lint} command-line option is in effect. (@pxref{Options, ,Command-Line Options}). With a value of @code{"fatal"}, lint warnings become fatal errors. ! Any other true value prints non-fatal warnings. Assigning a false value to @code{LINT} turns off the lint warnings. This variable is a @command{gawk} extension. It is not special in other @command{awk} implementations. Unlike the other special variables, changing @code{LINT} does affect the production of lint warnings, --- 10433,10456 ---- However, the value of @code{IGNORECASE} does @emph{not} affect array subscripting. @xref{Case-sensitivity, ,Case Sensitivity in Matching}. + @cindex @command{gawk}, @code{IGNORECASE} variable in If @command{gawk} is in compatibility mode (@pxref{Options, ,Command-Line Options}), then @code{IGNORECASE} has no special meaning. Thus, string and regexp operations are always case-sensitive. @cindex @code{LINT} variable ! @cindex differences in @command{awk} and @command{gawk}, @code{LINT} variable ! @cindex lint checking @item LINT # When this variable is true (nonzero or non-null), @command{gawk} behaves as if the @option{--lint} command-line option is in effect. (@pxref{Options, ,Command-Line Options}). With a value of @code{"fatal"}, lint warnings become fatal errors. ! Any other true value prints nonfatal warnings. Assigning a false value to @code{LINT} turns off the lint warnings. + @cindex @command{gawk}, @code{LINT} variable in This variable is a @command{gawk} extension. It is not special in other @command{awk} implementations. Unlike the other special variables, changing @code{LINT} does affect the production of lint warnings, *************** *** 9945,9950 **** --- 10461,10468 ---- of @command{awk} being executed. @cindex @code{OFMT} variable + @cindex numbers, converting, to strings + @cindex strings, converting, numbers to @item OFMT This string controls conversion of numbers to strings (@pxref{Conversion, ,Conversion of Strings and Numbers}) for *************** *** 9955,9961 **** --- 10473,10483 ---- also used @code{OFMT} to specify the format for converting numbers to strings in general expressions; this is now done by @code{CONVFMT}. + @cindex @code{sprintf} function, @code{OFMT} variable and + @cindex @code{print} statement, @code{OFMT} variable and @cindex @code{OFS} variable + @cindex separators, field + @cindex field separators @item OFS This is the output field separator (@pxref{Output Separators}). It is output between the fields printed by a @code{print} statement. Its *************** *** 9968,9973 **** --- 10490,10497 ---- character. (@xref{Output Separators}.) @cindex @code{RS} variable + @cindex separators, record + @cindex record separators @item RS This is @command{awk}'s input record separator. Its default value is a string containing a single newline character, which means that an input record *************** *** 9986,9991 **** --- 10510,10517 ---- just the first character of @code{RS}'s value is used. @cindex @code{SUBSEP} variable + @cindex separators, subscript + @cindex subscript separators @item SUBSEP This is the subscript separator. It has the default value of @code{"\034"} and is used to separate the parts of the indices of a *************** *** 9994,10005 **** (@pxref{Multi-dimensional, ,Multidimensional Arrays}). @cindex @code{TEXTDOMAIN} variable ! @cindex internationalization @item TEXTDOMAIN # This variable is used for internationalization of programs at the @command{awk} level. It sets the default text domain for specially marked string constants in the source text, as well as for the ! @code{dcgettext} and @code{bindtextdomain} functions (@pxref{Internationalization, ,Internationalization with @command{gawk}}). The default value of @code{TEXTDOMAIN} is @code{"messages"}. --- 10520,10532 ---- (@pxref{Multi-dimensional, ,Multidimensional Arrays}). @cindex @code{TEXTDOMAIN} variable ! @cindex differences in @command{awk} and @command{gawk}, @code{TEXTDOMAIN} variable ! @cindex internationalization, localization @item TEXTDOMAIN # This variable is used for internationalization of programs at the @command{awk} level. It sets the default text domain for specially marked string constants in the source text, as well as for the ! @code{dcgettext}, @code{dcngettext} and @code{bindtextdomain} functions (@pxref{Internationalization, ,Internationalization with @command{gawk}}). The default value of @code{TEXTDOMAIN} is @code{"messages"}. *************** *** 10009,10027 **** (@pxref