diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 19:28:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 19:28:49 +0000 |
commit | 9f9b6e7b09a54b2c8089de33c975086104956249 (patch) | |
tree | 29445e7621f24b9ff64b2ea59a434ef0985a143e | |
parent | Initial commit. (diff) | |
download | autoconf-dickey-upstream.tar.xz autoconf-dickey-upstream.zip |
Adding upstream version 2.52+20231210.upstream/2.52+20231210upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
105 files changed, 86785 insertions, 0 deletions
@@ -0,0 +1,11 @@ +Autoconf was originally written by David MacKenzie, with help from +Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, Roland +McGrath, Noah Friedman, david d zuhn, and many others. + +Ben Elliston next took over the maintenance, facing a huge Autoconf +backlog that had been piling up since the departure of David. + +Today, there are no fewer than five maintainers: Akim Demaille, Paul +Eggert, Jim Meyering, Alexandre Oliva, and Tom Tromey, especially +helped by Lars J. Aas, Mo DeJong, Steven G. Johnson, Matthew +D. Langston, Pavel Roskin, and many others listed in the THANKS file. @@ -0,0 +1,20 @@ +-*- outline -*- + +This file lists the bugs you must be aware of. Be sure to check this +file before using Autoconf, and especially CVS versions of Autoconf. + +Autoconf must not be used in production if there are ``Serious'' bugs, +and use with caution an Autoconf with ``Important bugs''. + +Many other bugs are registered on the GNATS server: + + http://sources.redhat.com/cgi-bin/gnatsweb.pl?database=autoconf + +Please, don't register bugs listed below: we already know we have to +address them. + +* Status + + /*--------------------------. + | Good for production use. | + `--------------------------*/ @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + 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. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..6cbbf99 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,1113 @@ +-- vile:fk=utf-8 +2023-12-10 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20231210. + + fix warning about cast in AC_CHECK_DECL. + +2023-12-03 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20231203. + + spelling fixes, with codespell + + fix warning about nonzero pointer in AC_FUNC_FSEEKO. + + fix a few unused-variable warnings in AC_C_CONST. + + use void-parameter prototype in AC_C_INLINE. + + use void-parameter prototype in AC_LANG_CALL(C), to reduce strict + compiler warnings in existence-checks, noting this will break some + checks, e.g., where a built-in prototype is used by a compiler. + + updated config/config.{guess,sub} + +2023-09-03 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20230903. + + trim mentions of automake and aclocal, since unused (Debian #1035621). + + fix a sign-extension bug in AC_FUNC_MKTIME which caused the test to run + longer than necessary. + + amend fixes for $EGREP and $FGREP to work with Solaris 10 /bin/sh + + improve rules for generating tests and cleanup in tests/Makefile.in + + omit AC_PROG_FGREP from acspecific.at, to match output from mktests.sh + (Debian #1043105). + + updated config/config.{guess,sub}, install-sh + +2023-01-14 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20230114. + + modify AC_CHECK_DECL, AC_PROG_CC_STDC, AC_STRUCT_TM, and + AC_TYPE_SIGNAL to reduce compiler warnings. + +2022-12-02 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20221202. + + modify AC_TYPE_GETGROUPS to use AC_INCLUDES_DEFAULT + + modify AC_FUNC_STRTOD to use stdlib.h, amend check to reduce compiler + warnings. + + modify AC_FUNC_CLOSEDIR_VOID to reduce compiler warnings. + +2022-10-09 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20221009. + + improve workaround for GNU grep 3.8 by requiring egrep/fgrep checks + for AC_OUTPUT. + + corrected shell script for passing detected egrep/fgrep into + config.status + +2022-10-01 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20221001. + + work around warning messages from GNU grep 3.8 for egrep and fgrep. + + fix some shellcheck warnings in the generated config.status + + updated config/config.{guess,sub} + +2021-05-09 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20210509. + + quiet a configure-time compile warning using a cast (report by Miroslav + Lichvar). + + updated config/config.{guess,sub} + +2021-01-05 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20210105. + + Add ToD to tests/aclocal.m4 filtering for NetBSD's sh. + + Corrected check when no fgrep or egrep is found. + + Fix typo in generated shell-functions message-prefix. + + Update tests/aclocal.m4 for g77. + +2021-01-01 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20210101. + + Modify mktests.sh to work with the configured egrep. + + Add quotes, etc., to appease some of shellcheck's warnings; most are + false positives. + + Add autoconf option "--opt-functions" to optionally generate part of + the checks for compile/link/run in shell-functions, to reduce the + number of false-positives reported by shellcheck in its advice for + the eval feature. + + Fix regression in adaptation of egrep check. + +2020-12-28 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20201228. + + Adapt AC_PROG_GREP, AC_PROG_EGREP, AC_PROG_FGREP from "official" + branch, to address shellcheck warnings. + + Add quotes, etc., to appease some of shellcheck's warnings; most are + false positives. + + updated config/config.{guess,sub} + +2020-08-02 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20200802. + + Unset CLICOLOR_FORCE and GREP_OPTIONS environment variables (report by + "Victor"). + +2020-01-11 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20200111. + + Check/display m4's version in AC_PROG_GNU_M4 + + Add /opt/local and /opt/X11 paths for recent MacOS configurations. + + Check for byacc before bison, etc., for consistency with mawk, etc. + +2019-09-01 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20190901. + + Correct version in generated manpages (report by Sven Joachim). + +2019-08-28 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20190828. + + Add X11R7 include/lib paths for some older NetBSD configurations. + + Drop "fc" from Fortran77 choices, to work with modern Unix systems. + +2018-10-06 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20181006. + + Adapt changes from autoconf in 2002, etc., to work around optimization + in AC_LANG_FUNC_LINK_TRY. The workaround in 2012-03-03 is not needed. + +2018-08-19 Thomas E. Dickey <dickey@invisible-island.net> + Version 2.52.20180819. + + Recognize recent cruft "--runstatedir" which has made its way into + packager's boilerplate, notwithstanding the blatant inconsistency with + actual usage (Debian #887390). + + Fix some warnings in test-packages. + +2017-05-01 Thomas Dickey <dickey@invisible-island.net> + Version 2.52.20170501. + + fix "make check" to work with OSX. + + Modify test-program stubs to reduce compiler warnings. + + updated config/config.{guess,sub} + +2015-09-26 Thomas Dickey <dickey@invisible-island.net> + Version 2.52.20150926. + + Workaround for splitting sed script in config.status when the script + contains multiline values. + +2014-12-04 Thomas Dickey <dickey@invisible-island.net> + Version 2.52.20141204. + + Minor tweak to work around breakage in one of the "dash" variants. + +2012-10-02 Thomas Dickey <dickey@invisible-island.net> + Version 2.52.20121002. + + Modify autoheader to discard parameter lists on the assignments to + ac_verbatim_XXX variables to work with GCC_PRINTFLIKE, similar + macros. + +2012-09-29 Thomas Dickey <dickey@invisible-island.net> + Version 2.52.20120929. + + Modify grep pattern used to detect variables never set to allow + matches with lines such as + : ${name:=value} + + The last update used '/' in a sed command where a pathname might be + also be found; change to ','. + +2012-09-23 Thomas Dickey <dickey@invisible-island.net> + Version 2.52.20120923. + + improve handling of overlooked datarootdir (prompted by Adrian Bunk + comments). + +2012-09-22 Thomas Dickey <dickey@invisible-island.net> + Version 2.52.20120922. + + add checks for unsubstituted variables, e.g., datarootdir. + +2012-08-11 Thomas Dickey <dickey@invisible-island.net> + Version 2.52.20120811. + + add support for --datarootdir, which changes the default location for + infodir and mandir. + +2012-03-10 Thomas Dickey <dickey@invisible-island.net> + + Version 2.52.20120310. + + no code change - regenerate files to ensure their versions are + consistent (report by Sven Joachim). + +2012-03-03 Thomas Dickey <dickey@invisible-island.net> + + Version 2.52.20120303. + + modify AC_LANG_FUNC_LINK_TRY to ensure that the external function's + address is nonnull, to work around breakage in Intel compiler's use of + linker. + +2010-10-02 Thomas Dickey <dickey@invisible-island.net> + + Version 2.52.20101002. + + add build-depends to dpkg script (report by Sven Joachim). + + drop manpages for config.guess and config.sub, not provided by this + package (report by Sven Joachim). + + add build-scripts for Debian and RPM packages. + + add configure check for install-info, to work with Debian's renaming + of this utility. + + drop mkinstalldirs, use "mkdir -p" + + remove tests/foreign.at, since libtool is not a dependency of autoconf + (report by Sven Joachim). + + update bug-reporting address. + + remove usage of automake; it is not used to maintain this package, + and owing to automake's absence of design stability is only a nuisance. + +2010-08-14 Thomas Dickey <dickey@invisible-island.net> + + Version 2.52.20100814. + + Modify test-cleanup to also remove conftest.dSYM, to quiet misleading + warnings with Mac OS X. + +2010-05-30 Thomas Dickey <dickey@invisible-island.net> + + Version 2.52.20100530. + + change some ISO-8859-1 encoded comments to UTF-8 to allow this to + build with a UTF-8 locale (GNU sed chokes on the mis-encoded byte). + + add check in _AC_OUTPUT_COMMANDS to ensure it does not generate an + empty case-statement, which gives a warning in NetBSD's shell. + + change m4exit(-1) to m4exit(1) in autoconf.in, to work around incorrect + range check added in GNU m4 1.4.6 + +2010-03-20 Thomas Dickey <dickey@invisible-island.net> + + Version 2.52.20100320. + + Update check for lex to include "reflex". + +2008-12-25 Thomas Dickey <dickey@invisible-island.net> + + Version 2.52.20081225. + + Extend suffixes ignored when looking for executable produced by + C compiler (based on patch from Paul Gilmartin). + +2008-03-25 Thomas Dickey <dickey@invisible-island.net> + + Modify _AC_PATH_X_XMKMF and _AC_PATH_X_DIRECT, adding "dylib" + (for Mac OS X) and "dll" (Cygwin) to suffix lists. These macros + depend on finding the exact filename for libX11 (if xmkmf exists + and does not return an error), otherwise one must supply explicit + paths for include- and library-directories (reported by Jeremy + Huddleston). + +2006-12-16 Thomas Dickey <dickey@invisible-island.net> + + Replace exit() calls in test compiles with $ac_main_return, to allow + for override in case of old platforms relying on the use of exit() + vs return. + +2006-12-09 Thomas Dickey <dickey@invisible-island.net> + + Disable the workaround for mis-prototyped 'exit()' in GNU libc + which made its way into autoconf's configure definitions (and thence + into the auto-generated config.h). Its include of <stdlib.h> caused + redefinition warnings on Solaris. + +2003-02-08 Thomas Dickey <dickey@invisible-island.net> + + Repair AC_PROG_GCC_TRADITIONAL, which is broken by the combination of a + syntactically incorrect test statement with the inclusion of + <stdlib.h>. In particular, the test fails on Mac OS X (report by + Gerben Wierda <Sherlock@rna.nl>). + +2001-12-27 Thomas Dickey <dickey@invisible-island.net> + + Restore behavior of autoconf 2.13 to handle trailing blanks (and + inline comments) in config.hin + +2001-12-01 Thomas Dickey <dickey@invisible-island.net> + + Modify version number (e.g., to the 8-character yyyymmdd 20011201) to + avoid confusion. (This version of autoconf fixes bugs and some design + defects which make it unsuitable for my use, but is compatible with + autoconf 2.50). + + Improvements: + + + modify the AC_OUTPUT macro by allowing it to generate the contents + of the config.h file rather than simply substituting in a template. + (This requires adding AC_SETUP_DEFS() as well). + + + add utility macro AC_DIVERT_HELP to add text to the + enable/with options list. + + Fixes: + + + Correct error in top-level Makefile.in which prevented "make + distclean" when the file was not writable (a bug in automake + causes it to regenerate some of the makefile templates). + Make sure the file is writable, as a workaround. + + + Remove the --include-deps option from automake in the top-level + Makefile.in, which also prevented builds from pristine source. + + + Tidy up the alignment in the boilerplate for --help, correct some + spelling errors. + +------------------------------------------------------------------------------- + +2001-07-18 Akim Demaille <akim@epita.fr> + + Version 2.52. + +2001-07-18 Akim Demaille <akim@epita.fr> + + The C-Fortran 77 hooks are available only once AC_F77_DUMMY_MAIN + was run, while they are needed also when it is expanded. + Reported by Nicolas Joly. + + * aclang.m4 (AC_F77_DUMMY_MAIN): Define _AC_LANG_PROGRAM_C_F77_HOOKS. + (AC_LANG_PROGRAM(C)): Use it instead of depending upon + AC_F77_DUMMY_MAIN being expanded. + +2001-07-18 Akim Demaille <akim@epita.fr> + + * configure.in: Bump to 2.51a. + +2001-07-17 Akim Demaille <akim@epita.fr> + + Version 2.51. + +2001-07-17 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_F77_DUMMY_MAIN): Let the interface be more + Autoconfy: $1 = action-if-found, $2 = action-if-not-found. + +2001-07-17 Akim Demaille <akim@epita.fr> + + The runtime test for AC_FUNC_GETPGRP fails when prototypes are + used. Well, then use the prototypes when you can, and runtime as + a last resort. + Reported by Artur Frysiak + + * acfunctions.m4 (_AC_FUNC_GETPGRP_TEST): New. + (AC_FUNC_GETPGRP): Use it. + First try to compile with 0-ary or 1-ary calls. + +2001-07-17 Akim Demaille <akim@epita.fr> + + * actypes.m4 (_AC_CHECK_TYPE_REPLACEMENT_TYPE_P): `foo_t' is a + replacement type. + From Paul Eggert. + +2001-07-17 Akim Demaille <akim@epita.fr> + + * Makefile.maint: Sync. with cppi 1.10. + +2001-07-17 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_LANG_PROGRAM(C)): Output F77_DUMMY_MAIN only when + AC_F77_DUMMY_MAIN has been run. + From Pavel Roskin and Steven G. Johnson. + +2001-07-17 Akim Demaille <akim@epita.fr> + + * configure.in: Rename as... + * configure.ac: this. + +2001-07-17 Akim Demaille <akim@epita.fr> + + * Makefile.am (INSTALL.txt): Don't use $@ and $< in non suffix + rules. + From Marc Espie. + * Makefile.maint (release-archive-dir): Rename as... + (release_archive_dir): this, so that it can be specialized in + Makefile. + +2001-07-14 Akim Demaille <akim@epita.fr> + + * configure.in: Bump to 2.50d. + +2001-07-14 Akim Demaille <akim@epita.fr> + + Version 2.50c. + * Makefile.maint (alpha): Typo. + +2001-07-14 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Make): Macro names and underscore. + +2001-07-14 Akim Demaille <akim@epita.fr> + + * config/config.guess, config/config.sub, config/texinfo.tex + * doc/standards.texi, doc/make-stds.texi: Update. + +2001-07-14 Akim Demaille <akim@epita.fr> + + * Makefile.maint (cvs-check, cvs-tag-check, cvs-diff-check): New. + +2001-07-14 Akim Demaille <akim@epita.fr> + + * Makefile.maint (maintainer-check): Rename as... + (maintainer-distcheck): this. + (changelog-check, static-check): New. + Use them. + +2001-07-14 Kevin Ryde <user42@zip.com.au> + + * doc/autoconf.texi (C++ Compilers Characteristics): Last resort + for CXX is g++, not gcc. + +2001-07-14 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Files): New subsection. + +2001-07-14 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (C Compiler, Fortran 77 Compiler): Be subsections + of... + (Generic Compiler Characteristics): this. + (C++ Compiler): New subsection. + +2001-07-14 Akim Demaille <akim@epita.fr> + + * autoscan.in: Use IO::File. + Adjust all the routines to use it. + ($log): New file (autoscan.log). + (output): Dump detailed logs into $log, and a shortened version to + stderr. + (&scan_makefile): Refine the regexp catching tokens in the code. + * doc/autoconf.texi (autoscan Invocation): Document `autoscan.log' + and the `configure.ac' checking feature. + +2001-07-12 Akim Demaille <akim@epita.fr> + + For some AWK, such as on HPUX 11, `xfoo' does not match `foo|^bar'. + Reported by Michael Elizabeth Chastain. + + * autoconf.in: Refuse such AWK. + * configure.in: Likewise. + * Makefile.am (acversion.m4): Do not use move-if-change this file + has dependencies. + * doc/autoconf.texi (Fortran 77 Compiler): Some typos. + +2001-07-10 Jens Petersen <petersen@redhat.com> + + * autoscan.in (&scan_makefile): Improve programs regexp to parse + things like "g++", "file.c" and "some-conf" as tokens. + (&scan_file): Match C++ files extensions. + If the filename extension is C++ then ask for c++. + +2001-07-05 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_F77_DUMMY_MAIN): Use AC_TRY_LINK, not + AC_TRY_LINK_FUNC, to check whether defining a dummy + main-like routine is needed for linking with F77 libs. + +2001-07-05 Pavel Roskin <proski@gnu.org> + + * aclocal.m4 (_AC_PROG_CXX_EXIT_DECLARATION): Remove conftest* + after using break. + (_AC_PROG_F77_V_OUTPUT): Remove conftest*, not conftest.* after + linking. + +2001-07-05 Akim Demaille <akim@epita.fr> + + * Makefile.am (move_if_change): New. Use it instead of `mv'. + (acversion.m4): Name it `$(srcdir)/acversion.m4' to ease broken + Makes' lives. + Reported by Nicolas Joly. + +2001-07-04 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_RUN_IFELSE): Remove conftest.o when cleaning + up. + * acfunctions.m4 (AC_FUNC_WAIT3): Use `break' to silent some + warnings from compilers. + * aclang.m4 (_AC_LANG_COMPILER_GNU): Log the version information + for all the compilers, not only GNU. Hence move from here... + (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): to here. + +2001-07-04 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AC_FUNC_STRTOD, AC_FUNC_STRERROR_R) + (AC_FUNC_STRCOLL, AC_FUNC_WAIT3): Use AC_RUN_IFELSE and + AC_COMPILE_IFELSE. + +2001-07-04 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS): Actually apply + the ``strings.h'' change claimed below. + +2001-07-04 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_LANG_COMPILER_GNU): s/-dumpspecs/-v/. + +2001-07-04 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS): Include + strings.h if usable with string.h. + Suggested by Paul Eggert. + +2001-07-04 Akim Demaille <akim@epita.fr> + + * autoscan.in (&scan_file): Skip FILE if there is FILE.in. + From Jens Petersen. + +2001-07-03 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Specify CONFIG_FILES + etc. in the log. + +2001-07-03 Akim Demaille <akim@epita.fr> + + * acheaders.m4 (AC_CHECK_HEADER): When INCLUDES are set, use the + compiler, not the preprocessor. + * acgeneral.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS): No longer use + dedicated code to check for inttypes.h, as AC_CHECK_HEADERS does + the right thing. + * Makefile.am (.m4.m4f): Emphasize M4 error messages and fail + earlier if there are. + +2001-07-03 Akim Demaille <akim@epita.fr> + + * autoscan.in ($initfile): Remove. + (&find_file): Rename as... + (&scan_file): this. + Immediately scan the current file, instead of gathering them, and + later having them handled by &scan_files. + (&scan_files): Merely invoke Find::File. + Adjust. + +2001-07-02 Akim Demaille <akim@epita.fr> + + * autoscan.in: Formatting changes, matching the invocation order. + (File::Find): Use it instead of Perl 4's `find.pl'. + (&wanted): Rename as... + (&find_file): this. + +2001-07-01 Pavel Roskin <proski@gnu.org> + + * aclang.m4 (AC_F77_DUMMY_MAIN): Remove conftest* after using + break in the argument to AC_TRY_LINK_FUNC. + (AC_F77_MAIN): Remove conftest* after using break in the + argument to AC_TRY_LINK. + +2001-07-01 Steven G. Johnson <stevenj@alum.mit.edu> + + Add alternate 'main' routine detection for linking C/C++ with Fortran, + fixing link failures for e.g. AC_F77_WRAPPERS on NetBSD. + + * aclang.m4 (AC_F77_DUMMY_MAIN): New macro to detect whether a + dummy alternate main is required even if the user provides her own + 'main'. + (AC_F77_MAIN): New macro to detect whether it is possible to + provide an alternate 'main' function name, using the 'main' from + the Fortran libraries. + (AC_LANG_PROGRAM(C)): Use F77_DUMMY_MAIN, if it is defined, so that + cross-language link tests can be performed successfully. + (_AC_F77_NAME_MANGLING): Require AC_F77_DUMMY_MAIN. Also put $FLIBS + after $LIBS, for consistency; this should be the general rule since + the user may want to link to Fortran libraries that require $FLIBS. + * autoconf.texi: Document AC_F77_DUMMY_MAIN and AC_F77_MAIN. + +2001-06-29 Pavel Roskin <proski@gnu.org> + + * atgeneral.m4 (AT_CHECK): Add a newline to the end of + at-stdout and at-stderr instead of removing the newline + from the echo output, which is not guaranteed to work. + +2001-06-28 Jens Petersen <petersen@redhat.com> + + * aclang.m4 (_AC_PROG_CXX_EXIT_DECLARATION): Only add declaration to + confdefs.h when non-zero. + +2001-06-28 Akim Demaille <akim@epita.fr> + + * configure.in: Bump to 2.50c. + +2001-06-26 Akim Demaille <akim@epita.fr> + + Version 2.50b. + +2001-06-26 Akim Demaille <akim@epita.fr> + + Version 2.50a. + +2001-06-25 Pavel Roskin <proski@gnu.org> + + * tests/atspecific.m4 (AT_CHECK_MACRO): Accept one more + argument, AUTOCONF-FLAGS. + * tests/mktests.sh (update_exclude_list): Add + AC_SYS_RESTARTABLE_SYSCALLS and AC_FUNC_WAIT3. + * tests/semantics.at: Test AC_SYS_RESTARTABLE_SYSCALLS and + AC_FUNC_WAIT3 with "-W no-obsolete". + +2001-06-25 Akim Demaille <akim@epita.fr> + + * tests/foreign.at (libtool): Fix the `libtoolize --version' decoding. + +2001-06-25 Akim Demaille <akim@epita.fr> + + * autoscan.in (%macro): Now maps from word to list of macros. + (&init_tables): Die when a word which is already handled by + explicit macros is mapped to the default macro. + (&print_unique): Remove, inlined in... + (&output_kind): here. + (File::Basename): Use it. + (&output): Sort the CONFIG_FILES. + * acheaders: Normalize. + * acfunctions: Likewise. + +2001-06-25 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_LANG_COMPILER_GNU): If GNU, dump the compiler + characteristics in the logs. + Suggested by Mo DeJong. + +2001-06-24 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AM_FUNC_ERROR_AT_LINE, AM_FUNC_FNMATCH) + (AM_FUNC_MKTIME, AM_FUNC_OBSTACK, AM_FUNC_STRTOD): Reactivated. + * doc/autoconf.texi (Autoconf 2.13): New section. + +2001-06-24 Akim Demaille <akim@epita.fr> + + * autoconf.in (Task traces): Separate the error messages from the + traces to improve robustness. + + +2001-06-23 Akim Demaille <akim@epita.fr> + + * tests/torture.at (AC_ARG_VAR): Make it a single test instead of + three as failures are unlikely, and speed matters. + +2001-06-23 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Redefined M4 Macros): New. + +2001-06-23 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS): Consider + inttypes.h is missing if it conflicts with sys/types.h, as on IRIX + 5.3. + +2001-06-23 Paolo Bonzini <bonzini@gnu.org> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Defer parsing of + config.status targets to after the evaluation of the INIT-CMDS. + Double quote config.status targets (used to be single quoted). + +2001-06-23 Akim Demaille <akim@epita.fr> + + * tests/torture.at (CONFIG_FILES, HEADERS, LINKS and COMMANDS): + Check the content of the created file. + Check the ./config.status command line invocation. + +2001-06-23 Akim Demaille <akim@epita.fr> + + * tests/foreign.at (Libtool): Reject prehistoric versions. + +2001-06-23 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): Try to be robust to + preexisting files matching a.*. + +2001-06-23 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_ARG_VAR_VALIDATE): Output error messages on + stderr. + * doc/autoconf.texi (AC_ARG_VAR): Update. + +2001-06-21 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_ARG_VAR_VALIDATE): Die instead of warning when + precious variables have changed. + * tests/torture.at (AC_ARG_VAR): Adjust. + +2001-06-21 Akim Demaille <akim@epita.fr> + + ./configure --program-suffix=foo produces `transform=s,$$,foo,;', + but some sed choke on multiple `;', and other tools (e.g., + Automake), include the separator themselves. + + * acgeneral.m4 (AC_ARG_VAR): Be sure not to leave extra `;'. + +2001-06-19 Tim Van Holder <tim.van.holder@pandora.be> + + * doc/autoconf.texi (Functions Portability): Rename as... + (Function Portability): this. + (Function Portability): Document potential problems with unlink(). + +2001-06-19 Paul Eggert <eggert@twinsun.com> + + * NEWS, doc/autoconf.texi: Document quadrigraphs. + +2001-06-18 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AC_FUNC_FORK): Fix typos. + +2001-06-18 Rüdiger Kuhlmann <info@ruediger-kuhlmann.de> + + * acfunctions.m4: (AC_FUNC_VFORK) rename as... + (_AC_FUNC_VFORK): this. + Remove AC_DEFINEs and don't guess cross-compilation values. + (_AC_FUNC_FORK): New, check whether fork() isn't just a stub. + (AC_FUNC_FORK): New, use _AC_FUNC_VFORK and _AC_FUNC_FORK to + define HAVE_WORKING_FORK, HAVE_WORKING_VFORK; and vfork to fork if + vfork doesn't work. + Guess values if cross-compiling, but warn. + * acfunctions: Add AC_FUNC_FORK. + * doc/autoconf.texi: Document AC_FUNC_FORK. Give example to define + and vfork appropriately. + +2001-06-18 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Functions Portability): New section. + +2001-06-18 Akim Demaille <akim@epita.fr> + + * autoconf.in (M4): Pass --nesting-limit=1024, unless already set + in $M4. + Suggested by Andreas Schwab. + +2001-06-18 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AC_FUNC_CHOWN, AC_FUNC_CLOSEDIR_VOID) + (AC_FUNC_GETPGRP, AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK) + (AC_FUNC_MMAP, AC_FUNC_SELECT_ARGTYPES, _AC_FUNC_STAT) + (AC_FUNC_UTIME_NULL): Use AC_INCLUDES_DEFAULT. + Don't use AC_TRY_RUN, which double quotes, prefer AC_RUN_IFELSE, + and either AC_LANG_SOURCE or AC_LANG_PROGRAM. + (AC_FUNC_CLOSEDIR_VOID): Protect C++ from `int closedir ();' (or + the converse). + +2001-06-18 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (ms): New index. + (Macro Index): Rename as... + (Autoconf Macro Index): this. + (M4 Macro Index): New appendix. + (Programming in M4): New chapter. + Define M4sugar, M4sh, m4_pattern_forbid, and m4_pattern_allow. + (Quoting): Rename as... + (M$ Quotation): this. + Be part of `Programming in M4). + +2001-06-18 Nicolas Joly <njoly@pasteur.fr> + + * tests/torture.at (AC_ARG_VAR): Set variables and export them + in separate statements for compatibility with Tru64 v5.1. + +2001-06-17 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_ARG_VAR_VALIDATE): Be sure to cache the + current values of the precious variables, not the previously + cached values. + Pass precious variables which are set to config.status. + * doc/autoconf.texi (Setting Output Variables): Document AC_ARG_VAR. + * tests/torture.at (AC_ARG_VAR): New. + +2001-06-15 Paul Eggert <eggert@twinsun.com> + + * doc/autoconf.texi: Move AC_FUNC_WAIT3 and + AC_SYS_RESTARTABLE_SYSCALLS to the obsolete section, + and explain why and how to replace them. + * acfunctions.m4 (AC_FUNC_WAIT3): Warn as obsolete. + * acspecific.m4 (AC_SYS_RESTARTABLE_SYSCALLS): Likewise. + +2001-06-15 Akim Demaille <akim@epita.fr> + + `build_alias', `host_alias', and `target_alias' are not AC_SUBST'd. + Reported by Bruno Haible. + + * acgeneral.m4 (AC_ARG_VAR): Move the AC_SUBST, from here... + (_AC_ARG_VAR_PRECIOUS): to here. + +2001-06-15 Pavel Roskin <proski@gnu.org> + + * acheaders.m4 (_AC_CHECK_HEADER_DIRENT): Instead of defining + an unused pointer use cast to this type and `if' statement to + avoid warnings from the compiler. + (AC_HEADER_TIME): Likewise. + * actypes.m4 (AC_CHECK_MEMBER): s/foo/ac_aggr/. Use the member + in `if' statement to avoid warnings from the compiler. Declare + ac_aggr static to avoid the need to initialize it. + +2001-06-14 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Portable Shell): Move to follow `Writing + Macros'. + +2001-06-13 Akim Demaille <akim@epita.fr> + + * m4/missing.m4, config/missing: Updated to Automake 1.4g's. + Suggested by Alexander Mai. + +2001-06-13 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS): Guard + sys/types.h and sys/stat.h, and check for them. + +2001-06-13 Akim Demaille <akim@epita.fr> + + * acheaders.m4 (AC_CHECK_HEADER, AC_CHECK_HEADERS): Support $4 = + INCLUDES. + +2001-06-12 Maciej W. Rozycki <macro@ds2.pg.gda.pl> + + * acspecific.m4 (AC_PATH_XTRA): Check if linking against libX11 + succeeds and only try adding libdnet upon a failure. + +2001-06-12 Akim Demaille <akim@epita.fr> + + * autoscan.in (&output_kind): Output the comment only if it exists. + (%kind_comment): Add entry for `programs'. + (&output_programs): Use &output_kind. + (&output_functions, &output_identifiers, &output_headers) + (&output_programs): Inline, and remove. + +2001-06-12 Akim Demaille <akim@epita.fr> + + * autoscan.in (%kind_comment): New. + (output_kind): New. + (output_functions, output_identifiers, output_headers): Use it. + +2001-06-12 Akim Demaille <akim@epita.fr> + + * autoscan.in (&print_unique): Take `$kind' and `$word' as + arguments, to factor indirections into `%macro' and `%used'. + (%generic_macro): Fix a typo. + +2001-06-12 Akim Demaille <akim@epita.fr> + + * aclibraries: New. + * autoscan.in (@kinds): Add `libraries'. + Use `@kinds' instead of hard coded lists. + (%programs, %headers, %identifiers, %makevars, %libraries, %functions): + Remove, replaced by... + (%used): this. + +2001-06-12 Akim Demaille <akim@epita.fr> + + * autoscan.in (%functions_macros %headers_macros) + (%identifiers_macros %programs_macros %makevars_macros): Remove, + replaced by... + (%macro): New. + +2001-06-11 Raja R Harinath <harinath@cs.umn.edu> + + * aclang.m4 (AC_NO_EXECUTABLES): Override + _AC_COMPILER_EXEEXT_WORKS, not _AC_LANG_COMPILER_WORKS. + +2001-06-11 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_NO_EXECUTABLES): Define the macros with their + trailing new line. + Reported by Andreas Schwab. + +2001-06-11 Akim Demaille <akim@epita.fr> + + * Makefile.am, Makefile.maint: Typos. + +2001-06-09 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Here-Documents): New section, gathering + documentation about here-documents. + Use `href', not `uref', and other changes. + +2001-06-09 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Portable Shell Programming): Promoted as a + chapter. + +2001-06-09 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Builtins): Complete the + description of the here-docs penalties with Alexandre Oliva's + explanations. + +2001-06-01 Paul Eggert <eggert@twinsun.com> + + * doc/autoconf.texi: Talk about here documents and speedups. + Do not use "echo" on arbitrary strings. + Spell "here-documents" consistently with the standard. + +2001-06-09 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Concept Index): Introduce it. + Regenerate the menus. + +2001-06-09 Akim Demaille <akim@epita.fr> + + * Makefile.maint, GNUmakefile: New, from Jim Meyering. + * config/prev-version.txt: New. + * config/move-if-change: New, for GNU libc. + +2001-06-06 Pavel Roskin <proski@gnu.org> + + * tests/atgeneral.m4 (AT_INIT): Remove "/bin/sh" after $SHELL. + +2001-06-06 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_LIB): Fix the cache var name to work + properly when $1 is not a literal. + Fixes PR Autoconf/187, reported by Bram Moolenaar. + +2001-06-06 Akim Demaille <akim@epita.fr> + + Invoking AC_COPYRIGHT before AC_INIT fails. + + * Makefile.am (.m4.m4f): Pass --fatal-warnings to m4. + * acgeneral.m4 (_m4_divert(VERSION_FSF)) + (_m4_divert(VERSION_USER)): New. + (AC_COPYRIGHT): $2 is the diversion to use. + (_AC_INIT_COPYRIGHT): Use the FSF diversion. + (AC_INIT): Remove dead comments as now it's commutative. + +2001-06-06 Akim Demaille <akim@epita.fr> + + * tests/semantics.at (AC_CHECK_LIB): Strengthen to reflect + PR autoconf/187. + +2001-06-05 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): `prefix' and `exec_prefix' + can be empty. + `*dir' variables cannot be NONE. + Reported by Mark Kettenis. + +2001-06-05 Paul Eggert <eggert@twinsun.com> + + * doc/autoconf.texi: Fix references to Solaris and SunOS versions. + +2001-06-04 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_VAR_SET, AC_VAR_GET, AC_VAR_TEST_SET) + (AC_VAR_SET_IFELSE, AC_VAR_PUSHDEF and AC_VAR_POPDEF, AC_TR_CPP) + (AC_TR_SH): Move as... + * m4sh.m4 (AS_VAR_SET, AS_VAR_GET, AS_VAR_TEST_SET) + (AS_VAR_SET_IF, AC_VAR_PUSHDEF, AS_VAR_POPDEF, AS_TR_CPP) + (AS_TR_SH): these. + (_AS_TR_PREPARE, _AS_CR_PREPARE, _AS_TR_CPP_PREPARE) + (_AS_TR_SH_PREPARE): New. + (AS_SHELL_SANITIZE): Invoke _AS_TR_PREPARE. + * tests/aclocal.m4 (AC_STATE_SAVE): `as_' vars can be modified. + +2001-06-02 Akim Demaille <akim@epita.fr> + + * Makefile.am (.m4.m4f): Pass the options first. + Fixes PR autoconf/182. + +2001-06-02 Nathan Sidwell <nathan@codesourcery.com> + + GNU getopt, when POSIXLY_CORRECT does not permute options and + arguments. So pass the options first. + Fixes PR autoconf/184. + + * autoconf.sh (m4_prefiles, m4f_prefiles): New variables. + (run_m4): Remove files. + (run_m4f): Remove. + Update remainder of script to use them. + (for warning in): Do not use a literal comma as it will not be + split by IFS. + +2001-06-02 Christian Marquardt <marq@gfz-potsdam.de> + + * aclang.m4 (AC_PROG_F77): Add Fujitsu's "frt" to the list of + Fortran compilers to check. + (_AC_PROG_F77_V): Add '-###' as a possible option to print + information on library and object files. + (AC_PROG_CXX): Add Fujitsu's "FCC" to the list of C++ compilers + to check. + +2001-06-02 Akim Demaille <akim@epita.fr> + + * autom4te.in (Request::@request): Declare with `vars', not `my', + as it prevents updates via `do FILENAME'. + +2001-06-02 Akim Demaille <akim@epita.fr> + + * configure.in (standards_texi): Remove, dead code. + +2001-06-02 Akim Demaille <akim@epita.fr> + + * autom4te.in: New. + +2001-06-02 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_INIT_PREPARE): Don't rely on $? in the traps + for signals other than 0 - exit with code 1. + * m4sh.m4 (AS_TMPDIR): Likewise. + * autoconf.in: Likewise. Also don't rely on exit == exit $?. + * autoheader.in: Likewise. + * autoreconf.in: Likewise. + * tests/torture.at (Signal handling): New test for the above. + +2001-06-01 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_defn, m4_undefine, m4_popdef): Clarify the error + message. + +2001-05-31 Akim Demaille <akim@epita.fr> + + * acfunctions, acheaders, acidentifiers, acmakevars, acprograms: + Add copyright and comments. + * acheaders: Add stdint.h. + Suggested by Paul Eggert. + +2001-05-31 Akim Demaille <akim@epita.fr> + + * atgeneral.m4 (AT_INIT): Use $SHELL. + * atspecific.m4 (AT_CHECK_DEFINES): Skip HAVE_STDINT_H. + +2001-05-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INCLUDES_DEFAULT_REQUIREMENTS): Include + stdint.h. + From Paul Eggert and Lars Hecking. + +2001-05-31 Akim Demaille <akim@epita.fr> + + * tests/base.at: Adjust line numbers in error messages. + +2001-05-31 Akim Demaille <akim@epita.fr> + + * tests/base.at, tests/m4sh.at: When using AC_PLAIN_SCRIPT be sure + to emit the bangshe line. + Reported by David Carter. + +2001-05-30 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_PROG_F77): Add Compaq's "fort" to the list of + Fortran (95) compilers to check. + +2001-05-29 Alexandre Duret-Lutz <duret_g@epita.fr> + + * doc/autoconf.texi (Introduction, Pointers): Update the Autoconf + Macro Archive URL. + +2001-05-23 Pavel Roskin <proski@gnu.org> + + * aclang.m4 (AC_PROG_CPP): Use `break' instead of `break 2' since + _AC_PROG_PREPROC_WORKS_IFELSE expands arguments outside the loop. + (AC_PROG_CXXCPP): Likewise. + +2001-05-22 Akim Demaille <akim@epita.fr> + + * config: New directory. + * configure.in: AC_CONFIG_AUX_DIR it. + * tests/atspecific.m4 (AT_CONFIGURE_AC): Adjust. + +2001-05-22 Akim Demaille <akim@epita.fr> + + * autoconf.in, autoreconf.in, autoheader.in, autoscan.in, ifnames.in, + * autoupdate.in: Specify the Emacs mode. + * acversion.m4.in: Rename as... + * acversion.m4: this. + * tests/Makefile.am (CLEANFILES): More garbage. + +2001-05-22 Akim Demaille <akim@epita.fr> + + * autoconf.sh, autoreconf.sh, autoheader.sh, autoscan.pl, ifnames.sh: + Rename as... + * autoconf.in, autoreconf.in, autoheader.in, autoscan.in, ifnames.in: + these. + +2001-05-21 Akim Demaille <akim@epita.fr> + + * configure.in: Bump to 2.50a. diff --git a/ChangeLog.0 b/ChangeLog.0 new file mode 100644 index 0000000..3233b4e --- /dev/null +++ b/ChangeLog.0 @@ -0,0 +1,343 @@ +Mon Jul 20 01:08:01 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_ALLOCA): Don't try -lucb -- it's too often broken. + +Sat Jul 18 13:40:46 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_MAJOR_HEADER): Add missing "$". + + * acspecific.m4 (AC_ALLOCA): Put -lc before -lucb. + +Fri Jul 17 00:00:07 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * autoconf.sh: Print the lines of the input file where + unresolved macros occur. From Francois Pinard. + + * acspecific.m4 (AC_PROG_INSTALL), acgeneral.m4 + (AC_PROGRAM_CHECK): Use test -f instead of -s. + + * autoconf.sh: grep for undefined macros in output. + +Tue Jul 14 01:19:26 1992 David J. MacKenzie (djm@apple-gunkies.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PROGRAM_CHECK): Search PATH manually to + avoid "command not found" messages on /dev/tty. Remove "args + for check" argument. + (AC_INIT): Don't define checkfor; no longer needed. + * acspecific.m4 (AC_PROG_CC, AC_PROG_RANLIB, AC_PROG_YACC, + AC_PROG_LEX): Don't pass "args for check" argument. + + * acgeneral.m4 (AC_PROGRAMS_CHECK): New macro. + * acspecific.m4 (AC_PROG_AWK): Use it. Check for mawk, gawk, + nawk, and awk. + (AC_PROG_YACC): Check for byacc if bison isn't found. + + * acspecific.m4 (AC_PROG_CC): Renamed from AC_PROG_GCC. + (AC_PROG_YACC): Renamed from AC_PROG_BISON. + (AC_PROG_AWK): Renamed from AC_PROG_GAWK. + (AC_PROG_LEX): Renamed from AC_PROG_FLEX. + + * acgeneral.m4 (AC_TEST_PROGRAM): Redirect stderr to /dev/null + both inside and outside the subshell to try to prevent core + dumped messages. Who knows, it might even help. + +Thu Jul 9 21:37:45 1992 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): Check for DGUX before SVR4. + +Fri Jul 3 01:01:50 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (AC_REMOTE_TAPE): Renamed from AC_MTIO. + Define HAVE_SYS_MTIO_H instead of NO_MTIO. + (AC_LONG_FILE_NAMES): Renamed from AC_LONG_FILENAMES. + (AC_RSH): Define HAVE_NETDB_H instead of USE_REXEC. + Above mostly from Richard Stallman. + + * acgeneral.m4 (AC_MISSING_FUNCS): Macro removed. + * acspecific.m4 (AC_VPRINTF, AC_WAIT3, AC_UTIME_NULL, + AC_TIMEZONE, AC_ST_BLOCKS, AC_ST_BLKSIZE): Change from + FOO_MISSING to HAVE_FOO. + (AC_WAIT3): Renamed from AC_WAIT3_RUSAGE. + (AC_TIMEZONE): Require AC_STRUCT_TM. + (AC_STRUCT_TM): Provide itself. + + * acgeneral.m4 (AC_OUTPUT): Add --recheck option to config.status. + + * acspecific.m4 (AC_ST_RDEV, AC_CONST): New macros. + + * acgeneral.m4 (AC_DEFINE): Don't consider an empty value arg to + be an omitted arg. + +Thu Jul 2 16:05:05 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): New macro. + + * autoconf.sh: Only reject an arg that's not a known option if it + is an option. + +Tue Jun 30 16:08:04 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_INIT, AC_OUTPUT): Eliminate vpsub. + +Thu Jun 25 12:42:10 1992 David J. MacKenzie (djm@apple-gunkies.gnu.ai.mit.edu) + + * autoconf.sh: Add --version option. + * acgeneral.m4: Support it. + +Wed Jun 24 14:04:13 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_TIMEZONE): Do the checks unconditionally, + not only if strftime.o is in LIBOBJS. + + * acspecific.m4 (AC_DIR_HEADER): Don't assume sys/dir.h exists. + + * acgeneral.m4 (AC_PROGRAM_CHECK): Don't include the program + name in the value-if-found. From Rich Murphey. + * acspecific.m4 (AC_PROG_{GCC,RANLIB,GAWK,BISON,FLEX}): Change + callers. + + * acgeneral.m4 (AC_OUTPUT): Mention the args given to + configure in a comment in config.status. + +Fri Jun 19 13:18:12 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_FUNC_CHECK): Use the third arg when it's + non-null, not when it's null. From Ian Lance Taylor. + +Thu Jun 18 12:10:27 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_BEFORE): Print message in next-error format. + From Franc,ois Pinard. + + * acgeneral.m4 (AC_PROGRAM_CHECK): If args-for-use is empty, + don't put a space after the program name. + + * acspecific.m4 (AC_DECLARE_YYTEXT): Move AC_REQUIREs from + AC_PROG_FLEX to here, where they belong. + + * acspecific.m4 (AC_MEMORY_H): Look for memchr instead of memcpy. + From Karl Berry. + +Wed Jun 17 09:56:59 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_BEFORE): New macro. + * acspecific.m4 (AC_PROG_GCC, AC_DIR_HEADER, AC_AIX, + AC_MINIX, AC_ISC_POSIX): Use it. + +Tue Jun 16 14:46:29 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * autoconf.sh: Remove incomplete output file if interrupted. + + * acgeneral.m4 (AC_INIT): Avoid running an extra subshell for pwd. + From Franc,ois Pinard. + +Mon Jun 15 21:27:49 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_TEST_PROGRAM): Take another arg for + cross-compiling. + * acspecific.m4 (AC_CROSS_CHECK): New program. + + * acgeneral.m4 (AC_REQUIRE, AC_PROVIDE): New macros. + (AC_HEADER_EGREP, AC_PROGRAM_EGREP, AC_TEST_CPP): Use them. + * acspecific.m4 (AC_PROG_GCC, AC_GCC_TRADITIONAL, AC_PROG_CPP, + AC_PROG_FLEX, AC_INLINE): Ditto. + +Sat Jun 13 17:54:24 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (AC_MEMORY_H): echo what it's doing. + +Thu Jun 11 14:18:35 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (AC_MINUS_C_MINUS_O, AC_INLINE, + AC_SETVBUF_REVERSED): New macros. + (AC_ALLOCA): Define HAVE_ALLOCA_H if appropriate. + + * acgeneral.m4 (AC_INIT): Do pwd in the srcdir, not current dir. + Scan through "$@" (implicitly) instead of $*. + (AC_HEADER_EGREP, AC_PROGRAM_EGREP, AC_COMPILE_CHECK, + AC_TEST_PROGRAM, AC_TEST_CPP): Supply a `:' if `true' argument + is empty. + * acgeneral.m4, acspecific.m4: Omit `:' in callers. + +Wed Jun 10 12:03:11 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_HEADER_EGREP, AC_PROGRAM_EGREP, AC_HEADER_CHECK, + AC_COMPILE_CHECK, AC_TEST_PROGRAM, AC_TEST_CPP, AC_FUNC_CHECK): + Make the last argument (program to run if test fails) optional. + (AC_HAVE_FUNCS, AC_HAVE_HEADERS): Don't pass optional last args. + * acspecific.m4 (most macros): Likewise. + +Mon Jun 8 16:27:10 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_VFORK): Get rid of backquotes. + + * acgeneral.m4 (AC_OUTPUT): Exit with 0 status when + --no-create was given. + Only write to the AC_CONFIG_NAME file if it doesn't exist or is + different from what we'd write. From Ian Lance Taylor. + +Thu Jun 4 14:46:22 1992 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_UNISTD_H, AC_UID_T, AC_SIZE_T, AC_PID_T, + AC_ST_BLKSIZE, AC_STRUCT_TM): Quote the whole macro body. + + * acgeneral.m4 (AC_OUTPUT): Look for config header.in in + top_srcdir, not srcdir. From Garrett Wollman. + + * acgeneral.m4 (AC_OUTPUT): Don't add make .NOEXPORT rule to + output files. + + * acgeneral.m4, acspecific.m4: Rename AC_PROG_CHECK to + AC_PROGRAM_CHECK, AC_PROG_EGREP to AC_PROGRAM_EGREP, + AC_TEST_PROG to AC_TEST_PROGRAM. + +Wed Jun 3 14:00:07 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_INIT, AC_OUTPUT): Add --no-create option. + + * acgeneral.m4 (AC_COMPILE_CHECK): Check the C compiler exit + status instead of trying to run the test program. + + * acspecific.m4 (AC_RESTARTABLE_SYSCALLS): Use AC_TEST_PROG + instead of doing it by hand. + + * acspecific.m4 (AC_PROG_GCC, AC_AIX, AC_XENIX_DIR, + AC_SCO_INTL, AC_DYNIX_SEQ): Use AC_PROG_EGREP instead of + AC_TEST_PROG. + + * acgeneral.m4 (AC_TEST_PROG): Renamed from AC_TEST_PROGRAM. + + * acgeneral.m4 (AC_INIT): Don't relativize `.'. + (AC_OUTPUT): Substitute the subdirectory path, not the top + path, for srcdir, unless the top path is `.'. + + * acgeneral.m4 (AC_OUTPUT): Special-case substituting DEFS. + From Ian Lance Taylor. + + * acspecific.m4 (AC_GCC_TRADITIONAL): Use CPP instead of + compiling a test program. + + * acgeneral.m4 (AC_TEST_CPP): Pass DEFS to CPP. + (AC_HEADER_EGREP): Don't echo anything. + (AC_PROG_EGREP): New macro. + +Tue Jun 2 14:07:27 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_CONFIG_HEADER): Renamed from AC_HEADER_FILE. + Rename AC_HEADER_NAME TO AC_CONFIG_NAME. + (AC_SUBST): Add the arg variable to a diversion for config.status. + (AC_OUTPUT): Write the code to create output files into config.status, + then run that. Always use `awk'; checking for nawk in a subshell + doesn't seem to work on 4.3BSD. + + * acgeneral.m4 (AC_HEADER_EGREP): Pass DEFS to CPP. + + * acspecific.m4 (AC_SIZE_T): Define size_t as int, not long. + From Ian Lance Taylor. + + * acspecific.m4 (AC_STDC_HEADERS): Also check for stdarg.h. + From Garrett Wollman. + +Wed May 20 00:34:03 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Use nawk if available. + + * acgeneral.m4 (AC_INIT): Make srcdir=`.' absolute. + + * acspecific.m4 (AC_DIR_HEADER): Include sys/types.h before + dir header in closedir test. + + * acgeneral.m4, acspecific.m4: AC_LIBTHING_CHECK renamed to + AC_COMPILE_CHECK. + + * acspecific.m4 (AC_AIX, AC_XENIX_DIR, AC_SCO_INTL, AC_DYNIX_SEQ): + Use the C preprocessor instead of just looking for files. + +Mon May 18 20:51:50 1992 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (WORDS_BIGENDIAN): Fix exit expression. + (AC_DECLARE_YYTEXT): Eval $CPP. + (AC_DIR_HEADER): Compile the test program; don't just + preprocess it. Above all from Karl Berry. + +Fri May 15 00:57:01 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_AIX): Don't define _BSD, to avoid getting + union wait. + + * acgeneral.m4 (AC_HEADER_EGREP): New macro, replacing AC_IDENT*. + * acspecific.m4 (AC_MEMORY_H, AC_RETSIGTYPE, AC_{UID,SIZE,PID}_T): + Use it. + + * acgeneral.m4 (AC_TEST_CPP): New macro. + (AC_IDENT_{PRESENT,MISSING}): Macros deleted. + (AC_HEADER_CHECK): Use AC_TEST_CPP, replaces AC_HEADER_{PRESENT, + MISSING}. + (AC_LIBTHING_CHECK): Replace AC_LIBTHING_{PRESENT,MISSING}. + (AC_FUNC_CHECK): Replace AC_FUNC_PRESENT. + (AC_INIT): Don't set INCLUDEDIR. + * acspecific.m4 (AC_DIR_HEADER): Use AC_TEST_CPP. + * All other macros: Don't refer to INCLUDEDIR; use + AC_HEADER_CHECK instead. + + * acspecific.m4 (AC_PROG_CPP): Don't evaluate $CC until called. + Try $CC -E before /lib/cpp. + +Thu May 14 23:15:02 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Remove each file before creating it. + +Sat May 9 14:52:57 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_WAIT3_RUSAGE): New macro. + + * acgeneral.m4 (AC_INIT, AC_OUTPUT): Use AC_SUBST instead of a + special mechanism to substitute for srcdir. + + * acgeneral.m4 (AC_OUTPUT): Substitute for exec_prefix if it + was given, even if not substituting for prefix. + + * acgeneral.m4 (AC_INIT, AC_OUTPUT): Remove @VPATH@ + substitution; use @srcdir@ instead. + +Sun May 3 01:21:47 1992 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_NOTICE): New macro taken from AC_INIT, to avoid + m4 coredump. From Karl Berry. + + * acgeneral.m4 (AC_OUTPUT): Look for header-file.in in $srcdir, + not current dir. + + * acgeneral.m4 (AC_IDENT_{MISSING,PRESENT}): Make them agree + with the documentation -- the third arg is a shell command, + not an identifier to define. + * acspecific.m4 (AC_DIR_HEADER): Change the caller. + +Mon Apr 27 09:15:15 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acspecific.m4: Use AC_TEST_PROGRAM wherever $compile was + being used directly. + + * acgeneral.m4 (AC_HAVE_HEADERS, AC_HAVE_FUNCS, + AC_FUNC_PRESENT, AC_TEST_PROGRAM): New macros from Ian Lance Taylor. + + * acspecific.m4 (AC_PROG_INSTALL): Screen out /usr/sbin/install. + (AC_CHAR_UNSIGNED): Don't define __CHAR_UNSIGNED__ if it's + predefined. + +Fri Apr 24 10:08:21 1992 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Make the arg a list of files instead of + directories. + + * acspecific.m4 (AC_ALLOCA): Check whether the alternate libraries + actually contain alloca. From Ian Lance Taylor. + + * acspecific.m4 (AC_PROG_CPP): New macro. + + * acgeneral.m4 (AC_OUTPUT): Allow newly defined values to be more + than one word for AC_HEADER_FILE. From Karl Berry. + + * acgeneral.m4 (AC_OUTPUT): Don't substitute DEFS if AC_HEADER_FILE. + (AC_LIBTHING{PRESENT,MISSING}): Run conftest in subshell. + From Ian Lance Taylor. diff --git a/ChangeLog.1 b/ChangeLog.1 new file mode 100644 index 0000000..3bec872 --- /dev/null +++ b/ChangeLog.1 @@ -0,0 +1,1920 @@ +Thu May 12 15:55:40 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * Version 1.11. + + * autoconf.texi: Document filename restriction on CPP. + +Thu May 12 10:11:20 1994 David J. MacKenzie (djm@hill.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Treat "./Makefile" like "Makefile". + From Karl Berry. + +Tue May 10 00:08:19 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Set prefix and exec_prefix if they + weren't set already. + +Sat May 7 20:06:59 1994 Noah Friedman (friedman@kropotkin.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_INSTALL): If using install.sh, add `-c' + to INSTALL. + +Sat May 7 15:36:22 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acgeneral.m4 (AC_OUTPUT): If configuring in the source tree, + don't end top_srcdir with "/.". + * acspecific.m4 (AC_SET_MAKE): Remove temp file. + From John Interrante <interran@uluru.stanford.edu>. + +Fri May 6 15:26:48 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acgeneral.m4 (AC_SIZEOF_TYPE): Fatal error if test program fails. + +Fri May 6 12:52:19 1994 David J. MacKenzie (djm@gamera.eng.umd.edu) + + * acgeneral.m4 (AC_OUTPUT): Run "./config.status", not "config.status". + From Kevin Gallagher <kgallagh@spd.dsccc.com>. + +Fri May 6 00:45:29 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acspecific.m4 (AC_WAIT3): Sleep in the parent to avoid rm + problems on fast machines. From david d zuhn. + +Thu May 5 12:51:32 1994 David J. MacKenzie (djm@gamera.eng.umd.edu) + + * Version 1.10. + + * Makefile.in (install): Don't install INSTALL. + (installcheck, install-info): New targets. + +Mon May 2 16:31:33 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * autoconf.sh, autoheader.sh: If M4 is an absolute file name that + no longer exists, use M4=m4. + +Mon May 2 13:06:06 1994 David J. MacKenzie (djm@burnout.eng.umd.edu) + + * acspecific.m4 (AC_HAVE_POUNDBANG): Quote # in message. + From schwab@issan.informatik.uni-dortmund.de (Andreas Schwab). + + * autoconf.texi: Document config.h.bot. Fix typo in AC_HAVE_POUNDBANG. + + * acspecific.m4 (AC_PROG_CXX): Look for "cxx" (DEC C++ compiler) too. + + * autoheader.sh: Fix tr string for Solaris tr. + Add config.h.bot if present. + From richard@sol.kbsi.com (Richard Henderson). + +Fri Apr 29 12:53:53 1994 David J. MacKenzie (djm@burnout.eng.umd.edu) + + * acspecific.m4 (AC_PROG_INSTALL): Use install.sh from srcdir + or srcdir/.. or srcdir/../.. and never default to cp. + +Thu Apr 28 12:01:01 1994 David J. MacKenzie (djm@burnout.eng.umd.edu) + + * acconfig.h: Add HAVE_MMAP entry. + * acspecific.m4 (AC_MMAP): If NBPC is not defined, use PAGESIZE. + From "Kaveh R. Ghazi" <ghazi@eden.rutgers.edu>. + + * acgeneral.m4 (AC_OUTPUT_HEADER): For each file being created, + munge a copy of conftest.sed rather than the original. + From brook@trillium.botany.utexas.edu (Brook Milligan). + +Tue Apr 26 00:27:21 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_LANG_C, AC_LANG_CPLUSPLUS): Remove CFLAGS and + CXXFLAGS from ac_cpp. + +Thu Apr 21 19:43:20 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * Version 1.9. + + * autoconf.texi: Document special AC_FIND_XTRA ordering + dependencies. + + * acspecific.m4 (AC_FIND_XTRA): Reorder AC_REQUIREs. + + * acspecific.m4 (AC_FIND_X): AC_REQUIRE_CPP. + + * acspecific.m4 (AC_PROG_LEX): Say what we set LEXLIB to. + +Wed Apr 20 13:17:05 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PARSEARGS): Allow . in hostnames. Use string + comparison on them. + (AC_HAVE_LIBRARY): namespace cleanup. + + * autoconf.texi: Describe changes to AC_FIND_X, AC_FIND_XTRA, and + AC_YYTEXT_POINTER. + + * acconfig.h: Replace DECLARE_YYTEXT with YYTEXT_POINTER. + + * acgeneral.m4 (AC_PARSEARGS): --gas and --x set with_gas and + with_x to yes, not 1. + + * acspecific.m4 (AC_YYTEXT_POINTER): New macro, replacing + AC_DECLARE_YYTEXT. + (AC_FIND_X): Assume no X if --without-x was given. + (AC_FIND_XTRA): Quotes AC_REQUIRE args. Run uname in a subshell in + case it's missing. Put -l options in X_EXTRA_LIBS. Print values + of the variables we set if verbose. + +Tue Apr 19 14:14:25 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * autoconf.texi: Note GNU m4 1.0 bugs. + + * acspecific.m4 (AC_FIND_X_XMKMF): Set variables correctly. + + * autoconf.texi: Don't @setchapternewpage odd by default. Mention + autoheader AC_SIZEOF_TYPE symbol generation. + + * acgeneral.m4 (AC_SIZEOF_TYPE): Fix typo. + + * Makefile.in (install): Don't install aclocal.m4. + + * autoheader.sh: Generate entries for AC_SIZEOF_TYPE + automatically. + +Mon Apr 18 22:14:59 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_SIZEOF_TYPE): Remove second arg, and generate a + symbol name automatically. + + * autoconf.texi: Document new AC_SIZEOF_TYPE usage. + + * acspecific.m4 (AC_PROG_INSTALL): Only filter out "install" + containing "dspmsg". + (AC_FIND_X_XMKMF): Fix variable names to not conflict with grep -v. + + * autoconf.texi: Various small fixes. + + * INSTALL: Say configure takes "awhile". + +Sat Apr 16 15:05:31 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4: Call AC_LANG_C in AC_PREPARE, not AC_INIT. + +Fri Apr 15 07:00:37 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * Version 1.8. + + * acgeneral.m4: Rename ac_configure_args back to configure_args, + since some people have been using it. + +Thu Apr 14 14:45:29 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * autoconf.texi: Note that AC_ENABLE and AC_WITH arguments + shouldn't contain blanks, for now. + +Wed Apr 13 17:26:36 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_SET_MAKE): Use $MAKE if defined, else "make". + + * autoconf.texi: Add missing files to diagram. + + * acgeneral.m4 (AC_TEST_CPP): Propogate comment about Coherent + lossage into configures. + +Sat Apr 9 17:34:29 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PARSEARGS): Unknown option is a fatal error. + + * acgeneral.m4: Remove ac_ prefix from some variables set by + options, for consistency and backward compatibility. + +Fri Apr 8 13:24:29 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_FIND_XTRA): Don't test for -lsocket on IRIX. + From Karl Berry. + + * acspecific.m4 (AC_FIND_X_XMKMF, AC_FIND_X_DIRECT): Don't + override --x-includes and --x-libraries. Check openwin last due + to its bugs. + + * acgeneral.m4: Add --x-includes, --x-libraries options. Document + them and --build, --host, --target. + + * autoconf.texi: Mention --x-includes and --x-libraries. + + * INSTALL: Mention --x-includes and --x-libraries. + +Tue Apr 5 12:46:47 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * autoconf.texi: Document top_srcdir substitution. + + * acspecific.m4 (AC_PROG_INSTALL): Look for install.sh in + @top_srcdir@, not $srcdir. + + * acgeneral.m4 (AC_OUTPUT): AC_SUBST top_srcdir. Set it. + +Mon Apr 4 20:13:08 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * autoconf.texi: Fix dependencies examples. + + * Makefile.in: Update configuration dependencies. + + * acgeneral.m4: Add back --no-create option. Make config.status + --recheck use it. + + * autoheader.sh: Go back to doing move-if-change. (Work around in + dependencies by using stamp files.) + +Thu Mar 31 11:34:50 1994 David J. MacKenzie (djm@hill.gnu.ai.mit.edu) + + * Makefile.in (autoconf, autoheader, configure): Write to $@.tmp + instead of to $@ directly so that after a disk full error, the + targets to not exist. Otherwise, a subsequent make could install + a corrupt (but not executable) script. From Jim Meyering. + +Thu Mar 31 08:22:29 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * autoconf.texi: Re-document --with argument. + + * acgeneral.m4 (AC_PARSEARGS): --with can take an argument again. + +Wed Mar 30 20:01:57 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * autoconf.texi: Document --disable- options. + + * acgeneral.m4 (AC_PARSEARGS): Add --disable-FEATURE. + + * INSTALL: Mention --enable- options. + +Mon Mar 28 17:43:22 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PARSEARGS): Make multiple non-option args a + fatal error. + + * acspecific.m4: Change all occurrences of $(MAKE_VAR) to + ${MAKE_VAR}. + + * autoconf.texi (Command Line): New node. Move some descriptions + here from General Feature Tests. Describe --without- options. + + * acgeneral.m4 (AC_PARSEARGS): Rewrite again, using ideas from the + GNU libc configure.in. All options that take an argument set + shell variables. + (AC_COMPILE_CHECK): Add `return' in `int' function. + + * INSTALL: Fix typo. + +Sun Mar 27 00:44:07 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_NOTICE): Don't save original args or initialize + options here. + (AC_PARSEARGS): Do them here. + (AC_PREPARE): Save a copy of original args here, if it hasn't been + done yet. + +Sat Mar 26 01:32:40 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4: Omit obsolete options from usage message. + Quote args to AC_CHECKING that contain m4 variables. + + * INSTALL: Note that env can be used to set env vars. + + * autoconf.texi: Document AC_SET_MAKE. + Note that vsprintf and vfprintf come with vprintf. + Note that env can be used to set env vars. + + * acspecific.m4 (AC_SET_MAKE): New macro. + (AC_PROG_INSTALL): Find scoinst as a good install program. + + * acgeneral.m4: Initialize variables set by options. + (AC_HAVE_HEADERS): Require cpp. + + * autoconf.texi: Document AC_ENABLE and @prefix@ and @exec_prefix@ + substitutions. + + * acgeneral.m4: Recognize all the Cygnus configure options; warn + about other arguments. Make default value for --with "yes", not + "1". AC_SUBST for prefix and exec_prefix. + (AC_ENABLE): New macro. + +Thu Mar 24 18:11:00 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * INSTALL: Describe recently added configure options. + + * autoconf.texi: Style cleanups. Mention config.h.top. + + * autoheader.sh: Add ${config_h}.top to the output, if it's + present. + +Thu Mar 24 13:36:19 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * autoconf.sh: Remove all temp files when exiting. If m4 fails, + produce no output and exit with the m4 exit status. + + * autoconf.texi: Document AC_PREREQ. + + * acgeneral.m4 (AC_PREREQ): New macro, with some helper macros. + +Thu Mar 24 01:20:49 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * Makefile.in (acdatadir): New variable based on datadir, giving + Autoconf lib files their own subdirectory. Use it instead of + datadir. + +Wed Mar 23 22:41:54 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * autoconf.texi: Change names of nodes that describe invoking + configure and config.status to conform to coding standards. + Document --version, --help, --silent/--quiet, --verbose options to + configure and config.status. + + * acgeneral.m4 (AC_PARSEARGS): Add --help and --version to + configure. Simplify getting option arguments. Complain about + impossible host arguments. + (AC_OUTPUT): Add --help and --version to config.status. + +Wed Mar 23 00:16:28 1994 Roland McGrath (roland@mole.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_CHECKING): Do nothing if $ac_silent is set. + (AC_PARSEARGS): Grok -q/--quiet/--silent and set $ac_silent. + +Tue Mar 22 18:28:30 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * autoconf.texi: Document AC_SIZEOF_TYPE. + + * acspecific.m4 (AC_INT_16_BITS, AC_LONG_64_BITS): Mark obsolete + with advice to use AC_SIZEOF_TYPE instead. + + * acgeneral.m4 (AC_SIZEOF_TYPE): New macro. + +Tue Mar 22 08:44:40 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * autoconf.texi: Describe AC_CHECKING et al. + + * acspecific.m4: Use AC_CHECKING et al. where appropriate. + + * acgeneral.m4 (AC_CHECKING, AC_VERBOSE, AC_ERROR, AC_WARN): New + macros. Use them where appropriate. + (AC_LANG_C, AC_LANG_CPLUSPLUS): Fix quoting of ac_cpp. + + * acspecific.m4 (AC_PROG_CPP): Don't add $CFLAGS to CPP. + (AC_PROG_CXXCPP): Don't add $CXXFLAGS to CXXCPP. + + * acgeneral.m4 (AC_OUTPUT): Don't remove VPATH lines containing + colons. From Jim Meyering (meyering@comco.com). + (AC_LANG_C): Add CFLAGS to ac_cpp. + (AC_LANG_CPLUSPLUS): Add CXXFLAGS to ac_cpp. + +Sat Mar 19 16:38:03 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_LANG_RESTORE): Only emit shell code to change + the current language if it actually changed. + + * autoconf.texi: Add info dir entry. Describe new C++ macros and + AC_MMAP. + (Language Choice): New section. + Add another example of dependencies. + + * acspecific.m4 (AC_PROG_CXX, AC_PROG_CXXCPP, AC_REQUIRE_CPP): New + macros based on work by zoo@aggregate.com (david d zuhn). + (AC_DECLARE_YYTEXT): Use AC_REQUIRE_CPP. Warn that it's broken. + (AC_STDC_HEADERS): Use AC_REQUIRE_CPP. + (AC_MMAP): New macro from Mike Haertel and Jim Avera. + + * acgeneral.m4 (AC_PARSEARGS): Check for missing arguments to + options. Recognize --target. Save the original args before + modifying them. + (AC_INIT): Call AC_LANG_C. + (AC_PREPARE): Don't save the original args here (too late). + (AC_LANG_C, AC_LANG_CPLUSPLUS, AC_LANG_SAVE, AC_LANG_RESTORE): + New macros based on work by zoo@aggregate.com (david d zuhn). + (AC_HEADER_EGREP, AC_PROGRAM_EGREP, AC_COMPILE_CHECK, + AC_TEST_PROGRAM, AC_TEST_CPP): Use AC_REQUIRE_CPP and ac_ext and + ac_cpp. + + * autoheader.sh: Update the file even if it is unchanged, to avoid + foiling a Makefile rule that makes it from configure.in. If you + let the rule for making config.status from configure create + config.h from config.h.in, then an unnecessary update here will + not cause unneeded recompilation. Recompilation should only + happen if config.h is updated, which won't occur if config.h.in + had the same contents, even if its timestamp changed. (Ick.) + + * Makefile.in (Makefile): Don't depend on config.status, to avoid + running config.status too many times. + +Fri Mar 18 00:43:21 1994 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * autoconf.texi: Document AC_FIND_XTRA. + + * acgeneral.m4 (AC_OUTPUT): Remove VPATH lines if srcdir=., to + work around Sun make bug. From Karl Berry. + + Rename internal use shell variables to start with "ac_". + + Trap signal 2 (SIGINT), not signal 3 (SIGQUIT), which means stop + without cleaning up. From eggert@twinsun.com (Paul Eggert). + + * acspecific.m4 (AC_FIND_XTRA): New macro from Karl Berry + (karl@cs.umb.edu). + (AC_FIND_X, AC_ISC_POSIX): Provide self. + + (AC_DECLARE_YYTEXT): Move AC_SUBST. Don't quote value of + DECLARE_YYTEXT. From Karl Berry. + + (AC_PROG_CPP): Include $CFLAGS in CPP. + + Rename internal use shell variables to start with "ac_". + + * autoconf.sh, autoheader.sh: Trap signal 2 (SIGINT), not signal 3 + (SIGQUIT), which means stop without cleaning up. From + eggert@twinsun.com (Paul Eggert). + + * autoconf.texi: Mention shell variable prefixes. + + * autoconf.texi: Work around RCS substitution in AC_REVISION + example. + +Wed Mar 16 19:55:17 1994 Noah Friedman (friedman@prep.ai.mit.edu) + + * acgeneral.m4 (compile): Include $LDFLAGS. + +Thu Mar 10 01:27:20 1994 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PREPARE): Don't absolutize relative paths. + (AC_OUTPUT): For relative paths, prepend to $srcdir as many + "../" as the number of subdirectories deep the file being created is. + +Tue Feb 15 16:02:19 1994 Noah Friedman (friedman@prep.ai.mit.edu) + + * acspecific.m4 (AC_PROG_INSTALL): Reject /sbin/install. + +Sun Feb 13 21:15:45 1994 Noah Friedman (friedman@prep.ai.mit.edu) + + * autoconf.texi (Setting Variables, Sample configure.in): Replace + references to AC_UNISTD_H with AC_HAVE_HEADERS(unistd.h). + +Thu Feb 10 21:39:43 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_SYS_SIGLIST_DECLARED): New macro. + +Sat Feb 5 13:35:52 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): Check for -lkvm separately after + -lutil check. + +Fri Feb 4 17:17:11 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT_HEADER): Move creation of conftest.sed + outside of `for' loop. We need only do this once for all the + output files. + +Fri Jan 21 16:35:00 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_INSTALL_INSTALL_SH): New macro for + INSTALL value to use install.sh. + (AC_PROG_INSTALL): Use it. + +Thu Jan 6 16:22:25 1994 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_DEFINE): Use AC_QUOTE_SQUOTE instead of + AC_DEFINE_QUOTE on AC_VAL. From Bruno Haible + <haible@ma2s2.mathematik.uni-karlsruhe.de>. + * acgeneral.m4 (AC_DEFINE_UNQUOTED): pushdef/popdef + AC_QUOTE_SQUOTE instead of AC_DEFINE_QUOTE. + +Wed Dec 22 03:51:53 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_DEFINE): in verbose strings, put + AC_DEFINE_QUOTE exprs in double quotes to avoid shell wildcard + expansion. + + * acgeneral.m4 (AC_PROGRAM_PATH, AC_PROGRAMS_PATH): New macros. + * autoconf.texi (General Tests): Document them. + + * configure.in: Use AC_PROGRAMS_PATH to find m4, not AC_PROGRAMS_CHECK. + Put `m4' in the list of progs-to-check, since we want the absolute + pathname for that too if we can get it. + +Fri Dec 17 13:44:24 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_ALLOCA): define HAVE_ALLOCA if alloca is + present in system libraries. + +Tue Dec 14 14:53:55 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PREPARE): Remove $ac_clean_files in traps. + + * acspecific.m4 (AC_STDC_HEADERS): Check that free appears in stdlib.h. + +Fri Dec 10 06:35:25 1993 Noah Friedman (friedman@gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_INSTALL): Don't look for install in `.'. + +Wed Dec 8 12:10:59 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_FIND_X_XMKMF): Redirect stderr to /dev/null in + eval'd make pipeline. + + * acgeneral.m4 (AC_QUOTE_SED): Quote ! as well. + +Mon Dec 6 23:41:05 1993 Noah Friedman (friedman@gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_CPP): Try 'cc -E -traditional-cpp' for NeXT. + +Thu Dec 2 02:25:39 1993 Noah Friedman (friedman@gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PREPARE): use rm -r to remove conftest* both in + exit traps and at start of script. + +Wed Dec 1 03:22:21 1993 Noah Friedman (friedman@gnu.ai.mit.edu) + + * acspecific.m4 (AC_FIND_X_DIRECT): Search for includes and libs + in more places. + +Sun Nov 28 21:57:31 1993 Noah Friedman (friedman@gnu.ai.mit.edu) + + * acgeneral.m4 (AC_NOTICE): Replace "this program" with "this + configure script" to disambiguate between configure and the + program it is distributed with (which can have different terms). + +Tue Nov 23 19:41:53 1993 Noah Friedman (friedman@gnu.ai.mit.edu) + + * acspecific.m4 (AC_FIND_X_DIRECT): Use the shell variable + `x_direct_test_include' to choose the include file to search for. + +Sat Nov 20 17:58:09 1993 Noah Friedman (friedman@gnu.ai.mit.edu) + + * acspecific.m4 (AC_FIND_X_DIRECT): Search for R6 includes & libs + in various places. Look for /usr/athena/include & /usr/athena/lib. + Make AC_HAVE_LIBRARY check for the library specified by the shell + variable `x_direct_test_library', rather than hardcoding Xt (to + which the shell variable now defaults). + +Thu Nov 18 18:17:21 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT_HEADER): Use ! instead of @ as the + sed substitution separator. + + * install.sh: New file. + * Makefile.in (DISTFILES): Add it. + * acspecific.m4 (AC_PROG_INSTALL): Use it as the default + instead of cp, if it's there. + +Sat Nov 13 12:24:57 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Extend that last change to also + happen for .C, .cc, and .m (objc) files. + +Wed Nov 10 09:26:35 1993 Noah Friedman (friedman@gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): When substituting .c or .h files, put + autoconf-added comments in '/* ... */'. + +Mon Nov 8 16:22:48 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_NOTICE): Put autoconf version number in configure. + +Fri Nov 5 23:31:28 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_FIND_X_XMKMF): properly quote `acfindx' rule. + +Fri Oct 29 21:46:57 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (HAVE_LONG_DOUBLE): Add code to detect Stardent + Vistra lossage. From Kaveh R. Ghazi (ghazi@noc.rutgers.edu). + +Tue Oct 26 15:24:33 1993 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * Version 1.7. + +Tue Oct 19 23:49:50 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_TEST_PROGRAM): Don't remove conftest* before + running $2 or $3 or $4; just once at the end. + +Mon Oct 18 01:38:00 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PREPARE): Echo a newline into confdefs.h so it + is never empty. + +Fri Oct 15 18:49:20 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_CONST): Added test of trivial use for broken + Ultrix-32 V3.1 Rev 9 vcc. + +Fri Oct 15 15:44:39 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OBSOLETE): New macro. + * acspecific.m4 (AC_UNISTD_H, AC_USG, AC_MEMORY_H): Call it. + + * acspecific.m4 (AC_LONG_FILE_NAMES): Try to create files in + ${prefix}/lib and ${exec_prefix}/lib instead of ${prefix} and + ${exec_prefix}; they are more likely to be writable. + + * Makefile.in (clean): Remove *.ma and *.mas, the macro index files. + +Tue Oct 12 16:02:52 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_RETSIGTYPE): AC_PROVIDE self. + +Mon Oct 11 19:09:20 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Makefile.in (editsh): Obfuscate @M4@ and @datadir@ references so + configure doesn't edit them. + +Sun Oct 10 14:01:35 1993 Jim Meyering (meyering@comco.com) + + * autoconf.sh (--help): Exit successfully. + +Sat Oct 9 08:29:15 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * Version 1.6. + + * acconfig.h (inline): New entry. + + * acspecific.m4 (AC_DIR_HEADER_CHECK): Don't call opendir, in + case the needed libraries (e.g., -ldir on Xenix) aren't in + LIBS yet. From Jim Meyering (meyering@comco.com). + + * acspecific.m4 (AC_PROG_LEX): Fix typo. + + * acgeneral.m4 (AC_HEADER_EGREP, AC_PROGRAM_EGREP, + AC_COMPILE_CHECK, AC_TEST_PROGRAM, AC_TEST_CPP): Remove any + temporary files before doing the actions, in case they're + nested tests. From gray@antaire.com (Gray Watson). + + * configure.in: Check for GNU m4 under several names. + * Makefile.in: Use that value. + From Franc,ois Pinard. + + * acspecific.m4 (AC_STRUCT_TM): Use a member of struct tm, to + make sure the compiler complains if it's not defined. + From Bruno Haible (haible@ma2s2.mathematik.uni-karlsruhe.de). + + * acspecific.m4 (AC_FIND_X_XMKMF): If libX11.a isn't in + USRLIBDIR, check in LIBDIR. Filter out any make verbose messages. + +Tue Oct 05 19:21:29 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_LONG_DOUBLE): Announce that this feature is being + checked even if the test is simply whether $CC is gcc. + +Tue Oct 5 14:23:28 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoheader.sh: Produce HAVE_LIBfoo for AC_HAVE_LIBRARY. + +Sun Oct 3 15:41:36 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Write assignment for `extrasub'; in sed + cmds, write "$extrasub" so configure.in can set it to do sed frobs. + Take second arg and write it to config.status before `exit 0'. + + * acspecific.m4 (AC_CONST): Say `checking for lack of working + const'. That is precisely accurate. + +Wed Sep 22 15:47:50 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4: If not using GNU m4, abort. + + * acgeneral.m4 (AC_PREPARE): Lose if we're not in the srcdir, + not if we're in it. But disable the check for now. + +Mon Sep 20 15:32:30 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PREPARE): Check for $srcdir being configured, + diagnose and lose. + + * acgeneral.m4 (AC_QUOTE_SED): Quote @ and %. + + * acgeneral.m4 (AC_OUTPUT): Say "$file is unchanged" when it is. + +Sat Sep 18 14:32:04 1993 Ian Lance Taylor (ian@airs.com) + + * acgeneral.m4: Substitute for CONFIG_FILES and CONFIG_HEADERS + before using them, in case they have multiple values. + +Fri Sep 17 14:40:20 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_WAIT3): wait3 works if ru_stime is + nonzero, too. + +Thu Sep 16 15:39:53 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_FIND_X_XMKMF): Code moved from AC_FIND_X. + (AC_FIND_X_DIRECT): New function, derived from code by Karl + Berry and Rob Savoye. + (AC_FIND_X): Call them. + +Wed Sep 15 19:06:46 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PREPARE): Remove confdefs* on exit with trap 0. + (AC_OUTPUT): Don't bother removing it. + + * acgeneral.m4: Remove --no-create option; not useful. + +Mon Sep 13 21:54:46 1993 Paul Eggert (eggert@twinsun.com) + + * autoheader.sh: Rename the temporary output to the real + output if their contents differ, not if their contents are identical. + This fixes bug introduced in Aug 30 change. + +Mon Sep 13 16:50:30 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Run config.status with + CONFIG_SHELL if defined. Same for configure run from config.status. + Rename gen_files to CONFIG_FILES and gen_config to CONFIG_HEADERS. + + * acgeneral.m4 (AC_PREPARE): Remove confdefs* in trap. + +Fri Sep 10 00:29:20 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_LONG_FILE_NAMES): Test /var/tmp as well. + In loop, skip past nonexistent dirs. + + * acspecific.m4 (AC_CONST): Say "working", not "broken". We are + checking for a working const as opposed to a broken or absent + const, not for a broken const as opposed to a working one. + +Thu Sep 9 09:25:49 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4, acconfig.h (AC_LONG_64_BITS): New macro. + +Wed Sep 1 18:54:12 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PROGRAM_CHECK): Use && instead of test -a. + +Tue Aug 31 19:21:35 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT_HEADER): Support generating multiple + .h files. From gray@antaire.com (Gray Watson). + + * acspecific.m4 (AC_ALLOCA): If using alloca.o, define C_ALLOCA. + + * acgeneral.m4 (compile, AC_HEADER_EGREP, AC_PROGRAM_EGREP, + AC_COMPILE_CHECK, AC_TEST_PROGRAM, AC_TEST_CPP): Remove $DEFS + from cc and cpp command lines; include "confdefs.h" in test + files. + (AC_DEFINE): Append a #define to confdefs.h. + Reduce duplicated code by introducing a temp variable, AC_VAL. + +Mon Aug 30 17:36:54 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoheader.sh: Don't write output if it is the same as output file. + +Wed Aug 25 14:14:33 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_VFORK): Check for SunOS 5.2 bug with ignoring + signal in parent before vfork. From eggert. + +Fri Aug 20 10:14:42 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PARSEARGS): Support giving values to --with + options. Go back to using sed for invalid test, but without + using '*' in the regex. + +Thu Aug 19 14:53:29 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_LONG_FILE_NAMES): eval the args. + + * acgeneral.m4 (AC_PARSEARGS): Use case instead of sed and + test to detect invalid package names. Remove =value from + --with options until we support it. + +Wed Aug 11 18:52:41 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_FIND_X): Don't set x_includes if it's + /usr/include or x_libraries if it's /lib or /usr/lib. + +Wed Aug 11 13:00:18 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_LONG_FILE_NAMES): If we cannot write $dir, echo + a warning msg and continue the loop to skip that directory. + + * acgeneral.m4 (AC_REVISION): Also eat double quotes. + +Thu Aug 5 14:55:59 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acconfig.h: Add TIME_WITH_SYS_TIME. + +Mon Aug 2 14:55:16 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_DECLARE_YYTEXT): \-escape "s in rhs of + AC_DEFINE_UNQUOTED. + Remove gratuitous second arg to AC_SUBST. + +Sun Aug 1 19:13:08 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): Define HAVE_GETLOADAVG if we find + one and don't use our own getloadavg.c. + * acconfig.h: Add HAVE_GETLOADAVG. + +Sat Jul 31 17:28:48 1993 Karl Berry (karl@cs.umb.edu) + + * acspecific.m4 (AC_PROG_INSTALL): Report results under -v. + +Fri Jul 30 18:08:30 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoheader.sh (syms, headers, funcs, libs): Run values through + sort|uniq to remove duplicates. + +Wed Jul 28 00:02:34 1993 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * Makefile.in (config.status): Run config.status --recheck, + not configure. + (install): Remove refs to install-info until it's released, + because people are getting confused. + + * acgeneral.m4 (AC_OUTPUT): For config.status --recheck, echo + the configure command line that we run. + + * acspecific.m4 (AC_PROG_FLEX): Use AC_HAVE_LIBRARY. + +Mon Jul 26 19:11:01 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): Check that both -lutil and -lkvm + exist before choosing them in hopes they will define getloadavg. + + * autoheader.sh (frob): Put $2 and $3 in the expansion of + AC_HAVE_LIBRARY, so AC_DEFINE there is noticed. + +Mon Jul 26 14:21:33 1993 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (INT_16_BITS): Check the obvious way, so it + doesn't pick up machines with 64 bit longs. + +Mon Jul 26 14:01:38 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): Check for -lelf with + AC_HAVE_LIBRARY instead of checking for <elf.h> with AC_HEADER_CHECK. + +Mon Jul 26 13:58:39 1993 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (AC_SCO_INTL, AC_IRIX_SUN, AC_DYNIX_SEQ): Use + AC_HAVE_LIBRARY. + +Mon Jul 26 13:55:17 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoheader.sh (eval frob): Restore hairy sed use; we need it to + handle multi-line macro invocations. + +Mon Jul 26 00:50:43 1993 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (AC_FIND_X): Quote the Imakefile. + +Sun Jul 25 08:17:11 1993 Jim Meyering (meyering@comco.com) + + * acconfig.h (CRAY_STACKSEG_END): New #undef. + +Thu Jul 22 20:26:12 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * Version 1.5. + + * acspecific.m4 (AC_FIND_X): Let make substitute any variables + in INCROOT and USRLIBDIR, instead of using sed. + From wojo@veritas.com (Jack Woychowski). + + * acgeneral.m4 (AC_DEFINE): When printing value verbosely, use + double quotes and AC_DEFINE_QUOTE, like we do when assigning + the value, so shell variables get expanded the same way. + + * acgeneral.m4 (AC_REVISION): New macro. + From wollman@uvm-gen.EMBA.UVM.EDU (Garrett Wollman). + + * acgeneral.m4 (AC_DEFINE): Add newline before open brace. + +Thu Jul 22 17:07:15 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_STAT_MACROS_BROKEN): New macro. + * acconfig.h (STAT_MACROS_BROKEN): New #undef. + +Wed Jul 21 15:44:32 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_DECLARE_YYTEXT): Use AC_DEFINE_UNQUOTED so + shell var is replaced in rhs. + +Wed Jul 21 13:31:38 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acconfig.h (size_t, mode_t, off_t): Added. + * acspecific.m4 (AC_OFF_T): New macro. + +Tue Jul 20 15:39:44 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * autoheader.sh: Put header-file.in in comment at top. + + * acconfig.h (NDIR): Added. + +Mon Jul 19 22:10:49 1993 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * Makefile.in (info, dvi): New targets. + +Sun Jul 18 22:36:33 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoheader.sh (frob): Use `#' as the first line of each definition. + (eval frob): Totally simplify sed use to just handle "^@@@.*@@@$". + +Wed Jul 14 22:44:25 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acconfig.h: Restore blank lines between paragraphs. + + * autoheader.sh (libs): New variable and frob to set it from + AC_HAVE_LIBRARY uses. Produce #undef HAVE_* for each $libs. + +Tue Jul 13 19:03:46 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acconfig.h: Sort the entries, like the comment says. + + * acspecific.m4 (AC_GETLOADAVG): Only check for the AIX library + once, looking in both local and system dirs. + Consolidate SVR4 and Solaris cases. + +Mon Jul 12 20:33:36 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): If we find sys/dg_sys_info.h, do + AC_HAVE_LIBRARY on -ldgc. + +Sun Jul 11 00:43:51 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): BSD library is -lutil, not + -lutils, and requires -lkvm too. + Check for local AIX library using AC_HAVE_LIBRARY, not + AC_COMPILE_CHECK. + Un-nest some conditionals. Stop checking once we've + found a way to get getloadavg. + +Thu Jul 8 20:21:28 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * Makefile.in: Remove rules for making *.conf; make + Autoconf's configure script semi-normally. + +Wed Jul 7 14:37:35 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * autoheader.sh (--help): Print help message to stdout and exit 0. + (--version): Exit after printing version number. + * autoconf.sh (--version): Exit after printing version number. + + * acspecific.m4 (AC_LONG_DOUBLE): Make sure that long double + isn't smaller than double, as in Ultrix 4.[23] cc. + + * acgeneral.m4 (AC_REPLACE_FUNCS): Include ctype.h in the test + program to get stubs. + + * acspecific.m4 (AC_FIND_X): New macro. + +Tue Jul 6 19:15:17 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): Try ls -L first, in case + /dev/kmem is a symlink (as on Solaris). + +Wed Jun 30 22:08:22 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_MINUS_C_MINUS_O): Remove spurious `then'. + +Fri Jun 25 23:16:42 1993 Paul Eggert (eggert@twinsun.com) + + * acspecific.m4 (AC_CONST): Replace `p = <const char** expr>' + with `ccp = <const char** expr>'; the former wasn't ANSI C, and + was causing working compilers to be rejected. + +Fri Jun 25 13:26:34 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_LONG_FILE_NAMES): Redirect rm's stderr to + /dev/null. + +Thu Jun 24 15:58:04 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * autoconf.sh, autoheader.sh, acgeneral.m4 (AC_PREPARE): Undo + change of Jun 16 1993. Only set `LANG' and `LC_ALL' to "C" if + already set. + +Sat Jun 19 00:01:51 1993 Jim Meyering (meyering@comco.com) + + * acgeneral.m4: Undefine m4's `format' builtin. + * acspecific.m4 (AC_HAVE_POUNDBANG): Make conftest executable, + but not necessarily writable by group or other. + +Thu Jun 17 21:10:33 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_CPP): Put double quotes around ${CC-cc}, + not single quotes. + If --verbose option given, say what CPP is being set to. + +Wed Jun 16 17:50:00 1993 Jim Blandy (jimb@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_CPP): Make sure that `cc -E` doesn't + run the program through the C compiler too. Bob Olson + <olson@mcs.anl.gov> says it does on the NeXT. + +Wed Jun 16 16:17:05 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * autoconf.sh, autoheader.sh, acgeneral.m4 (AC_PREPARE): Always set + `LANG' and `LC_ALL' environment variables to `C'. + +Fri Jun 11 14:29:31 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_MINUS_C_MINUS_O): Test that cc works at all, + and only test it for -c -o if it does. + +Tue Jun 8 01:47:22 1993 Paul Eggert (eggert@twinsun.com) + + * acgeneral.m4 (AC_OUTPUT): The line + DEFS="`echo \"$DEFS\" | sed 's%[&\\\]%\\\&%g'`" + doesn't work in some shells, which don't allow nesting + \"\" inside `` inside "", and which don't unescape \\\& in the + expected (?) way. Also, some versions of echo interpret + backslashes inside $DEFS. Put $DEFS into a temporary file + to avoid these portability minefields. + +Mon Jun 7 20:11:50 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): In setting KMEM_GROUP, use new sed + magic from friedman which should win with both meanings of ls -lg. + +Mon Jun 7 06:48:49 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * Makefile.in (dist): Change gzipped tar file extension to `.gz'. + Use explicit --gzip option to tar to make sure tar uses the right + compression program (or else exits from failure to understand the + option). + + * acgeneral.m4 (AC_OUTPUT): Don't split sed expr for exec_prefix + across two lines, since not all versions of sed understand that. + + * acspecific.m4 (AC_HAVE_POUNDBANG): Complete rewrite which doesn't + depend on csh. + +Tue Jun 1 03:06:28 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * Version 1.4.1 (not announced to the general public, but + a snapshot was put on the June '93 GNU CDROM). + + * Makefile.in (dist): If ln fails (e.g. because of cross-device + links), mention on stdout that file is being copied. + + * acgeneral.m4 (AC_PREPARE): Use `[$]*' in assignment to + configure_args to get shell positional args, rather than m4 args to + AC_PREPARE. + (AC_OUTPUT): Use `configure_args' in config.status + when invoked with --recheck, rather than $*. + +Mon May 31 13:12:56 1993 Paul Eggert (eggert@twinsun.com) + + * acspecific.m4 (AC_LONG_FILE_NAMES): rm $dir/conftest*, + not conftest*. + +Mon May 31 04:18:18 1993 Roland McGrath (friedman@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_HAVE_LIBRARY): Quote libname in define. + +Sun May 30 19:52:24 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_SETVBUF_REVERSED): Pass (char *) main to + setvbuf instead of zero. + +Thu May 27 20:30:53 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PREPARE): Save $* in shell var `configure_args'. + (AC_OUTPUT): Use $configure_args in place of $*. + +Wed May 26 16:19:51 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * autoconf.texi (AC_PROG_INSTALL): Doc fix. + (Automatic Remaking): Put code fragment in @example ... @end example. + +Mon May 24 15:46:47 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoheader.sh (frob): Redefine AC_CONFIG_HEADER to set shell + variable `config_h'. + (config_h): New variable, initialize to "config.h" before frobbing. + (final output): Write ${config_h}.in. + +Sat May 22 17:45:19 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * Version 1.4 released. + +Thu May 20 20:25:45 1993 Jim Blandy (jimb@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_IDENTITY): New function. + (AC_DEFINE_UNQUOTED): Use it to fix this; due to a + misunderstanding of m4, this was using its first argument as + the definition. + +Thu May 20 09:21:55 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_ALLOCA) [find_stack_direction]: Return the + value from the recursive call. If it worked before, it was by luck. + From Bruno Haible <haible@ma2s2.mathematik.uni-karlsruhe.de>. + +Tue May 18 23:40:21 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_STDC_HEADERS): Require AC_PROG_CPP. + +Mon May 17 18:01:09 1993 Karl Berry (karl@hal.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Use variables gen_files and + gen_config in the loop that generates the output (Make)files, + instead of hardwiring the filenames. + +Sat May 15 17:23:19 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * autoconf.sh: Accept `-' to mean read stdin as input. + * autoheader.sh: Likewise. + +Fri May 14 12:41:02 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * autoheader.sh, acspecific.m4 (AC_PREPARE): If `LANG' environment + variable is set, reset its value to `C'. This is so `tr [...]' + works more portably. + +Thu May 13 22:56:20 1993 Paul Eggert (eggert@twinsun.com) + + * acspecific.m4 (VOID_CLOSEDIR): Test closedir instead of assuming + that it works. E.g. dynix closedir yields garbage, but has no + prototype. Presumably Xenix closedir had the same problem, so + stop special-casing it. + +Wed May 12 20:25:36 1993 Jim Meyering (meyering@comco.com) + + * acconfig.h: Add HAVE_LONG_DOUBLE. + +Wed May 12 15:07:36 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_DEFINE_UNQUOTED): New macro. + + * acgeneral.m4 (AC_FUNC_CHECK): Include ctype.h instead of stdio.h. + We want it only to define __stub_* in glibc. Using stdio.h lost + when it contained a conflicting prototype for $1; ctype.h has fewer + prototypes. + + * acconfig.h: Add GETGROUPS_T. + + * acspecific.m4 (AC_PROG_RANLIB): Use : instead of @: for no-op. + Some braindead make does bizarre magical things with @ in variables. + +Mon May 10 14:24:27 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_HAVE_POUNDBANG): New feature. + + * acgeneral.m4 (AC_OUTPUT): Add more backslashes to character class + in DEFS filter (sigh). + +Sun May 9 14:04:31 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_DEFINE_QUOTE): No AC_QUOTE_SED (was innermost). + (AC_HEADER_EGREP, AC_PROGRAM_EGREP, AC_TEST_CPP): Put a \ before + $DEFS in string to be evalled. + (AC_OUTPUT): Run DEFS through a sed filter that quotes things in it + from sed (woo woo!) before writing it into config.status. + + * acspecific.m4 (AC_ALLOCA): Use AC_PROGRAM_EGREP to test for [CRAY + && !CRAY2], instead of AC_TEST_PROGRAM. No need to run a program + for this. + + * acgeneral.m4 (AC_PROGRAM_CHECK): Extract the first word of $2 + when looking for it in PATH, so it can be a program name with args. + Omit default assignment if $4 is empty. + Only write verbose msg if $1 was set nonempty. + * acspecific.m4 (AC_PROG_YACC): Pass 'bison -y' (quoted like that) + in list to AC_PROGRAMS_CHECK. Don't test for bison later to add -y + flag. + +Sat May 8 00:23:58 1993 Jim Meyering (meyering@comco.com) + + * acgeneral.m4 (AC_REPLACE_FUNCS): Add a trailing newline in + code for AC_COMPILE_CHECK. Otherwise it got spurious failures. + + * acspecific.m4 (TIME_WITH_SYS_TIME): New macro. + + * Makefile.in (dist): Depend on Makefile. Use gzip instead + of compress. Link files individually instead of en masse; + if a link fails, use `cp -f' on the losing file. + + * acspecific.m4 (AC_ALLOCA): Define CRAY_STACKSEG_END (the + name of a function used in alloca.c) for CRAY-1, CRAY X-MP, + and CRAY Y-MP. + +Fri May 7 15:56:26 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): Check for mach/mach.h, but don't + disable nlist checks if found. + +Fri May 7 04:59:25 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_INSTALL): Don't look for `install' in + /usr/ucb. + +Thu May 6 20:41:35 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_FUNC_CHECK): The test program should choke on + #ifdef __stub___$1 as well. + (AC_REPLACE_FUNCS): Make the test program choke on stubs. + +Wed May 5 20:43:13 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoconf.sh ($infile existence check): Fixed test for + nonemptiness of $print_version to not always be true. + +Wed May 5 17:22:42 1993 David J. MacKenzie (djm@wookumz.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PREFIX, AC_PROGRAM_CHECK), acspecific.m4 + (AC_PROG_INSTALL): If IFS wasn't set initially, give it a + normal default value. Happens on LynxOS (x86), says + Pete Klammer <PKLAMMER@cudnvr.denver.colorado.edu>. + +Wed May 5 13:22:52 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4: Undefine the `shift' builtin. + + * acspecific.m4 (AC_PROG_YACC): Use AC_PROGRAMS_CHECK to check for + both bison and yacc, instead of two AC_PROGRAM_CHECK uses. + + * autoheader.sh ($# -eq 0): Set var $tmpout to name of temp file, + send stdout there instead of config.h.in. + (just before exit): If $# -eq 0, then move $tmpout to config.h.in + if $status -eq 0, or remove $tmpout otherwise. + + * acspecific.m4 (AC_STRCOLL): Rewritten to use a test program that + verifies that `strcoll' does vaguely reasonable ordering. + +Tue May 4 19:59:00 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_LONG_DOUBLE): Don't explicitely echo + `checking for long double'. + +Mon May 3 22:04:35 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_GETGROUPS_T): New macro. + +Sat May 1 22:37:55 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_LONG_DOUBLE): New macro. + +Wed Apr 28 15:52:42 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PROGRAM_CHECK): Write msg under --verbose. + +Thu Apr 22 18:24:40 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_FUNC_CHECK): Remove spurious `#endif' line at end. + + * acgeneral.m4 (AC_WITH): Fix reversed args to patsubst. + Test $with_FOO, not $FOO. + +Wed Apr 21 18:14:19 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_QUOTE_TOKEN): New macro. + (AC_DEFINE_QUOTE): Use it. + +Tue Apr 20 18:02:46 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_DECLARE_YYTEXT): Guess name of lex output file + and do AC_SUBST of `LEX_OUTPUT_ROOT'. + Add `dnl' after calling some autoconf macros. + +Mon Apr 19 15:46:24 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_MINUS_C_MINUS_O): Do each compile a second time + after testing for the existence of the output. Some compilers + refuse to overwrite an existing .o file with -o, though they will + create one. + + * acspecific.m4 (AC_DECLARE_YYTEXT): Changed lex input to two lines + of "%%", not just one. + +Sat Apr 17 17:26:12 1993 Jim Meyering (meyering@comco.com) + + * acgeneral.m4 (AC_COMPILE_CHECK): Don't print `checking for ...' + message if first argument is empty. + +Sat Apr 17 01:18:41 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PID_T): provide self. + (AC_VFORK): Require AC_PID_T. + +Fri Apr 16 11:57:35 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PROGRAMS_CHECK): Take optional third arg; if + given, use it as the default value. + +Thu Apr 15 16:43:45 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_REPLACE_FUNCS): Print a message under --verbose. + + * acgeneral.m4 (AC_HAVE_LIBRARY): Use m4's patsubst and translit + instead of running sed and tr at runtime. + + * acconfig.h: Add STACK_DIRECTION. + +Wed Apr 14 17:08:47 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_ALLOCA): If we chose alloca.c, run a test + program to define STACK_DIRECTION. + +Mon Apr 5 19:02:52 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_LONG_FILE_NAMES): Put test inside a for loop on + several directories: . /tmp $prefix $exec_prefix. Define + HAVE_LONG_FILE_NAMES iff long names win in all those directories. + +Sun Apr 4 18:38:23 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * Makefile.in (%.info): Removed pattern rule. + (autoconf.info, standards.info): New rules. + + * autoconf.sh (version_only): New variable, set nonempty for + `autoconf --version' with no input file. + (output writing): No output if $version_only is set. + +Wed Mar 31 17:33:57 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_CONST): Uncomment and fix second AIX test. + +Wed Mar 31 16:58:12 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_CONST): Rewrite first AIX XL C 1.02.0.0 test. + Comment out bogosity in second AIX test. + +Wed Mar 31 12:45:59 1993 Jim Meyering (meyering@comco.com) + + * acgeneral.m4 (AC_DEFINE): Put single quotes around definition + that is echoed with --verbose. AC_DEFINE(MVDIR, "$(libdir)/mvdir") + was generating losing code. + +Mon Mar 29 15:44:24 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acspecific.m4 (AC_STDC_HEADERS): Add a missing pair of [quotes]. + +Mon Mar 29 14:54:00 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_DECLARE_YYTEXT): Change sed regexp so it won't + match other identifiers beginning with `yytext'. + +Sat Mar 27 00:11:16 1993 Paul Eggert (eggert@twinsun.com) + + * acspecific.m4 (AC_CONST): Detect broken AIX XL C 1.2.0.0 compiler. + +Thu Mar 25 19:54:50 1993 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_CONST): Remove single quotes from the C + program; they produce shell syntax errors. + + * acgeneral.m4 (AC_DEFINE): Add a newline after "}" to prevent + commands following on the same line of configure.in from + generating shell syntax errors. + + * acgeneral.m4 (AC_COMPILE_CHECK): Use explicit return types + to avoid warnings. + (AC_TEST_CPP): Add parens to force redirection order. + (AC_OUTPUT): Allow hostname to return bogus exit status. + From Jean-loup Gailly <jloup@chorus.fr>. + +Mon Mar 22 16:53:01 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoconf.sh: Use $M4, not m4 explicitly. + (M4): If unset in env, initialize to @m4@. + * autoheader.sh: Likewise. + * Makefile.in (M4): Define new variable. + (autoconf.conf, %.conf): Use it. + (editsh): New variable: sed command to replace @datadir@; also + replace @M4@ with $(M4). + (autoconf, autoheader): Use $(editsh) instead of explicit sed command. + +Mon Mar 22 13:08:10 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_CONST): IBM's /bin/cc under AIX-3.2 on an rs6000 + rejects attempts to modify *any* member of a struct that has a + member declared like `const int *ap[2]'. + +Wed Mar 17 18:08:30 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * autoconf.sh, autoheader.sh (MACRODIR): Variable renamed to + AC_MACRODIR. Don't initialize it at runtime if it is already set + in the environment. + (MACROFILES): Don't set until after options are processed. + (print_version): New temp variable. + + * autoconf.sh, autoheader.sh: Rewrote argument parsing. + Added `-m', `--macrodir', `-h', `--help', and `--' options. + Updated usage string. + + * autoconf.texi: Documented --macrodir option and its effects for + both scripts. + +Tue Mar 16 09:10:48 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_CONST): Sun's SC1.0 ANSI compiler (acc) won't + increment a `const int *' pointer declared through a typedef. + +Mon Mar 15 16:08:42 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PARSEARGS): Grok `--verbose' flag; set verbose=yes. + (AC_DEFINE): Only echo "defining $1" if $verbose is set. + +Sun Mar 14 18:19:21 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_INSTALL): Choose `installbsd' if we find + it, in preference to `install'. + + * acspecific.m4 (AC_CONST): Add a check for `const int *foo' not + allowing modification of FOO (not *FOO). + +Fri Mar 12 15:27:53 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT_HEADER): Remove conftest.sh before + creating it. + +Thu Mar 11 12:57:53 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_DEFINE): Surround defn with { and }. + + * acgeneral.m4 (AC_OUTPUT_HEADER): Split up $SEDDEFS into smaller + chunks, since some shells can't handle large here documents. + We write several commands in config.status to create conftest.sed + in pieces. + +Mon Mar 8 14:40:53 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_WITH): Don't echo anything. + Use the m4 patsubst fn instead of a run-time sed invocation to + massage $1. + + * acspecific.m4 (AC_DIR_HEADER_CHECK): #include <sys/types.h> + before the header we are testing. + + * acgeneral.m4 (AC_DEFINE): If $2 is empty, echo "defining $1 to be + empty", rather than "defining $1 to be ". + + * acspecific.m4 (AC_DIR_HEADER_CHECK): New; subr of AC_DIR_HEADER. + (AC_DIR_HEADER): Use it to test for each possible header file. + +Tue Mar 2 01:06:25 1993 Noah Friedman (friedman@nutrimat.gnu.ai.mit.edu) + + * autoheader.sh: Don't use /p1/,/p2/ construct with sed---it's not + portable. Handle broken AIX sed that strips \n from hold space + when it shouldn't. From Jun Hamano <junio@twinsun.com>. + +Tue Mar 02 00:08:39 1993 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_CONST): Fix typo that caused spurious lossage + with /bin/cc from Irix-4. From Karl Berry. + +Fri Feb 26 17:14:58 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_CONST): Add bizarre case that loses on SCO 3.2v4. + +Mon Feb 22 13:02:27 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_QUOTE_HERE, AC_QUOTE_SED): Change the quote + chars to { and } instead of nothing. Then use {} (empty quotes) to + separate the patsubst forms from the following dnl. Otherwise the + result of patsubst is pasted together with dnl and the result is + seen as a single token. + + * acspecific.m4 (AC_MINUS_C_MINUS_O): Print msg saying what we are + doing before we do it. + + * acgeneral.m4 (AC_PREFIX): Print out the choice made. + (AC_DEFINE): Print out the definition being done. + + * acgeneral.m4 (AC_DEFINE_QUOTE): Add dnl at end of line. + + * acspecific.m4 (AC_GETLOADAVG): Do changequote around listing of + /dev/kmem and sed frobbing which needs to use [ and ]. + +Sun Feb 21 13:57:55 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoheader.sh: Use brackets in tr range args. + + * acspecific.m4 (AC_SETVBUF_REVERSED): Make the test fail if + setvbuf returns nonzero. + + * acspecific.m4 (AC_GETLOADAVG): If we need to install setgid, + figure out what group owns /dev/kmem, and set KMEM_GROUP to that. + + * acspecific.m4 (AC_MINUS_C_MINUS_O): Test plain `cc' after testing + $CC. We want to make sure both compilers grok -c -o. + +Thu Feb 18 18:05:14 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_QUOTE_{DQUOTE,SQUOTE,HERE,SED}): New macros. + (AC_DEFINE_{QUOTE,SEDQUOTE}): New macros; subrs of AC_DEFINE. + (AC_DEFINE): Use them to quote $2. + +Wed Feb 17 14:49:14 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_TIMEZONE): Fixed quoting in tzname check. + changequote inside quotes lost. + +Mon Feb 8 14:22:11 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acconfig.h (_ALL_SOURCE): Use #ifndef; AIX compiler way too dumb. + +Sun Jan 31 16:39:46 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_TIMEZONE): Put newlines before `#include ...' + in $defs value. + +Thu Jan 28 18:06:53 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acconfig.h (_ALL_SOURCE): Use "!defined (_ALL_SOURCE) || + _ALL_SOURCE == 0" rather than "!_ALL_SOURCE", which bombs on the + AIX compiler. + +Mon Jan 25 12:09:43 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acconfig.h (HAVE_UNION_WAIT, SYS_SIGLIST_DECLARED): New #undef's. + + * acconfig.h (_ALL_SOURCE): Surround with #if !_ALL_SOURCE. + +Fri Jan 22 15:08:33 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): If /usr/local/lib/libgetloadavg.a + exists, add -L/usr/local/lib to LDFLAGS. + +Fri Jan 22 12:49:11 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT_HEADER): Only comment out the #undef NAME + part of the line, to avoid causing errors from existing comments. + +Thu Jan 21 14:50:20 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_HAVE_LIBRARY): Use $libname in "checking for" + message, not $1, to avoid "checking for -l-lfoo". + + * acgeneral.m4 (AC_PREPARE): In compile defn, include $CFLAGS. + + * acgeneral.m4 (AC_OUTPUT): Broke AC_CONFIG_NAME writing out into: + (AC_OUTPUT_HEADER): New macro broken out of AC_OUTPUT. + Add to conftest.sed a new sed command to turn #undef's into comments. + + * acgeneral.m4 (AC_OUTPUT): Use new shell variable, $maxsedlines, + for max number of lines to feed to one sed invocation. + Lower this limit to 20; UTekV 3.2e can't cope with 40. + +Tue Jan 19 13:21:02 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * Version 1.3. + +Fri Jan 15 16:28:18 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_CONFIG_HEADER, AC_HEADER_EGREP, + AC_TEST_PROGRAM): Make DEFS always contain -D commands, + not C code. + +Thu Jan 14 17:05:17 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): Check for -lkvm; don't assume it. + +Thu Jan 14 16:46:41 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoheader.sh (selecting $syms from $TEMPLATES): Use sed to + replace lines containing only blanks with empty lines. + +Thu Jan 14 15:15:31 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acspecific.m4 (AC_MODE_T): New macro. + + * acgeneral.m4 (AC_OUTPUT): Check for grep -c returning + nothing (AIX 3.1) as well as returning 0. + +Wed Jan 13 16:05:59 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_FUNC_CHECK): Add missing #endif. + + * acgeneral.m4 (AC_OUTPUT): Use sed, not basename. + From Francois Pinard. + +Wed Jan 13 15:49:18 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Set exec_prefix to ${prefix}, not + $(prefix); it now works in both makefiles and shell scripts. + +Wed Jan 13 15:29:04 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * autoheader.sh: If input is empty, don't print all of + acconfig.h. From Francois Pinard. + + * acgeneral.m4 (AC_OUTPUT): Have config.status check all of its + args for validity. + +Tue Jan 12 11:11:45 1993 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Preserve whitespace around = in prefix + and exec_prefix assignments. + + * acspecific.m4 (AC_GETLOADAVG): Values for getloadavg_missing were + reversed. + +Fri Jan 8 18:45:59 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Make config.status not complain with + usage msg when given no args. + + * acgeneral.m4 (AC_HAVE_LIBRARY): Say "checking for -lfoo", not + just "checking for foo". + + * acgeneral.m4 (AC_HAVE_LIBRARY): Remove excess quoting around $2 + and $3. + + * acspecific.m4 (AC_GETLOADAVG): Check for getloadavg library, both + a normally installed one, and one in /usr/local/lib. + After figuring out params for getloadavg.c, figure out whether it + defined LDAV_PRIVILEGED, and if so, set NEED_SETGID to true, and + define GETLOADAVG_PRIVILEGED. + * acconfig.h: Added GETLOADAVG_PRIVILEGED. + +Fri Jan 8 16:16:35 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_DEFINE, AC_OUTPUT): Restore the third sed string. + + * acgeneral.m4 (AC_FUNC_CHECK): Use __stub_funcname. + + * autoheader.sh: Use Autoconf version number. + + * acgeneral.m4 (AC_OUTPUT): Diagnose usage errors for + config.status. Use grep -c to count nonempty lines instead of + test -s. + + * acspecific.m4 (AC_GETLOADAVG): Use AC_HAVE_LIBRARY. + +Wed Jan 6 19:54:47 1993 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * autoheader.sh (coverage check): Use $TEMPLATES in error msg, not + hard-wired "config.h". + +Wed Jan 6 18:24:41 1993 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): If AC_CONFIG_NAME, change + @DEFS@ to -DHAVE_CONFIG_H in Makefiles etc. Idea from Roland McGrath. + + * acgeneral.m4 (AC_FUNC_CHECK): If __STUB_funcname is defined, + assume the function isn't present. + + * acgeneral.m4 (AC_OUTPUT): Make no args to AC_OUTPUT work + again. From Ian Lance Taylor. + + * acspecific.m4 (AC_CONST): Fix quoting problem. + + * acconfig.h [const]: New addition. + +Thu Dec 31 17:56:18 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_HAVE_LIBRARY): New macro from Noah Friedman. + + * acconfig.h: Renamed from config.h. + + * autoheader.sh: Renamed from autohead.sh. + Support a local acconfig.h. + Use \\012 instead of \\n for tr for portability. + +Thu Dec 31 12:30:34 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * config.h: Added #undef vfork. + +Tue Dec 29 14:26:43 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_COMPILE_CHECK): Use cat rather than echo to + create conftest.c, to avoid " problems. + +Fri Dec 25 15:07:06 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acspecific.m4 (AC_CONST): Don't define HAVE_CONST. + + * acgeneral.m4 (AC_OUTPUT, AC_DEFINE): Combine the two sed + commands for #undef lines. + * acgeneral.m4 (AC_PROGRAM_EGREP, AC_TEST_PROGRAM, + AC_TEST_CPP, AC_OUTPUT), acspecific.m4 (AC_PROG_CC): Put > + before << when using both, to avoid HP-UX sh bug. + +Wed Dec 23 20:47:53 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PARSEARGS): Use if, not &&, for --with. + From Jan Brittenson. + +Mon Dec 21 17:13:57 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Use sed instead of head and tail. + Trap to remove the temp files. + + * acgeneral.m4 (AC_OUTPUT): Quote DEFS assignment. + From Ian Lance Taylor. + +Mon Dec 21 14:27:44 1992 Jim Meyering (meyering@comco.com) + + * acspecific.m4 (AC_STDC_HEADERS): Make sure ctype.h macros + are ANSI. Nest tests so we don't need shell temporary variable. + +Sun Dec 20 18:12:33 1992 Roland McGrath (roland@albert.gnu.ai.mit.edu) + + * Makefile.in (%.h: %.in): New rule using autohead. + (all): Do autohead. + (install): Install autohead and config.h. + (autohead): New rule. + (DISTFILES): Added autohead.sh. + * autohead: New script. + +Fri Dec 18 00:21:23 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_HAVE_FUNCS, AC_HAVE_HEADERS): Change method + of tr quoting to keep old shells happy. From Ian Lance Taylor. + + * acgeneral.m4 (AC_DEFINE): Add to SEDDEFS. + (AC_OUTPUT): Use sed instead of awk. + From Ian Lance Taylor. + +Mon Dec 14 14:33:29 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acspecific.m4 (AC_STDC_HEADERS): Check for string.h + declaring memchr. + + * acgeneral.m4 (AC_NOTICE): Fix comment. + +Fri Dec 11 17:59:23 1992 David J. MacKenzie (djm@kropotkin.gnu.ai.mit.edu) + + * acspecific.m4 (AC_ALLOCA): Don't use libPW; it causes too + much trouble. + +Wed Dec 9 14:04:30 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * config.h: Added HAVE_SYS_WAIT, HAVE_WAITPID, SVR4, UMAX, + [ugp]id_t, UMAX4_3, DGUX. + +Thu Dec 3 13:37:17 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_INSTALL): Ignore AFS install. + From James Clark, jjc@jclark.com. + +Tue Nov 24 07:47:45 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_LEX, AC_DECLARE_YYTEXT, AC_VFORK, AC_WAIT3, + AC_INT_16_BITS, AC_WORDS_BIGENDIAN, AC_ARG_ARRAY): End with a newline. + + * acspecific.m4 (AC_DIR_HEADER): If ndir.h exists and the other + choices don't, define NDIR. + +Sat Nov 21 00:14:51 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_RETSIGTYPE): Instead of grepping for the signal + declaration, try redeclaring it and see if we get an error. + Always define RETSIGTYPE, not just if it's int. + From Ian Lance Taylor. + +Fri Nov 20 17:06:09 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_DEFINE): Only put -D option in quotes if it + actually contains blanks. + +Thu Nov 19 17:18:40 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PARSEARGS): Set a shell var for --with-*. + (AC_WITH): New macro. + + * acspecific.m4 (AC_CONST): If const works, define HAVE_CONST. + + * acspecific.m4 (AC_ALLOCA): Don't use libPW on HP-UX. + +Wed Nov 18 17:36:08 1992 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_DEFINE): When writing a -D with a value, + surround it with 's so the value can contain spaces. + +Thu Nov 12 22:49:35 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_CC): Don't add -O to CC if GNU C. + (-O2, or nothing, might be more appropriate.) + +Sun Nov 8 23:33:23 1992 david d `zoo' zuhn (zoo at cirdan.cygnus.com) + + * acspecific.m4 (AC_GETLOADAVG): Check for dwarf.h for general + svr4, then elf.h for Solaris 2, which needs additional libraries. + +Thu Nov 12 22:18:54 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PARSEARGS): --exec_prefix -> --exec-prefix. + +Tue Nov 10 16:15:10 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4: undef m4 `include' builtin. + + * acspecific.m4 (AC_STDC_HEADERS): Don't test for limits.h + due to Ultrix conflict with float.h. + +Thu Oct 29 16:16:11 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PARSEARGS, AC_PREPARE): New macros, broken out + parts of AC_INIT. + (AC_INIT): Use them. + +Thu Oct 22 20:48:12 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_INSTALL): Comment out arg to `:'. + AIX doesn't like it. + +Wed Oct 14 12:41:02 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * Version 1.2. + + * acspecific.m4 (AC_INSTALL): Avoid the AIX install script. + + * acspecific.m4 (AC_RESTARTABLE_SYSCALLS): Wait for child if + sys calls are not restarted, to avoid leaving the child still + running. From Ian Lance Taylor. + +Tue Oct 13 15:43:56 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acspecific.m4 (AC_CONST): Add more tests for brokenness. + From Jim Meyering. + + * acgeneral.m4: Use % instead of ? to avoid shell variable expansion. + +Fri Oct 2 06:55:05 1992 David J. MacKenzie (djm@goldman.gnu.ai.mit.edu) + + * acgeneral.m4: Use ? instead of , to separate parts of sed arg. + +Mon Sep 14 12:33:41 1992 David J. MacKenzie (djm@apple-gunkies.gnu.ai.mit.edu) + + * acspecific.m4 (AC_STDC_HEADERS): Also check for float.h. + + * acspecific.m4 (AC_TIMEZONE): Protect [] from being quotes. + +Thu Sep 10 17:12:10 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Include the hostname in config.status. + + * acgeneral.m4 (AC_OUTPUT): Use a separate flag in the awk + script instead of checking for non-empty values, so things + like defining const as empty work. From + Steve Emmerson <steve@unidata.ucar.edu>. + +Fri Aug 28 18:51:13 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_INIT): If there's no path on $0, use '.'. + +Thu Aug 27 16:15:14 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * config.h: New file. + + * acgeneral.m4 (AC_INIT): Look for source files in the + directory containing `configure', if not given explicitly. + + * acspecific.m4 (AC_TIMEZONE): Adjust tzname decl for RS6000. + + * acspecific.m4 (AC_GETLOADAVG): Don't use double quotes in + the test program. + +Thu Aug 27 15:26:49 1992 Roland McGrath (roland@wookumz.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): Don't check nlist.h if we found + one of specific things. + +Mon Aug 24 16:22:45 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * Version 1.1. + + * acspecific.m4 (AC_TIMEZONE): Include time.h. Don't + declare tzname if it's a macro. From Jim Meyering. + +Fri Aug 21 14:12:35 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_ALLOCA): Check whether the alloca defined by + alloca.h works when given a non-constant argument. + + * acspecific.m4 (AC_GETLOADAVG): Define NLIST_STRUCT and + NLIST_NAME_UNION if appropriate. + + * acgeneral.m4 (AC_OUTPUT): If no args are given, omit the loop to + produce output files. + + * acgeneral.m4 (AC_TEST_PROGRAM): Add a call to exit to try to + suppress core dumped message. From Ian Lance Taylor. + + * acgeneral.m4 (AC_PREFIX): Only print the message if prefix + hasn't been set. From James Clark. + + * acspecific.m4 (AC_SIZE_T, AC_UID_T, AC_PID_T, + AC_RETSIGTYPE): Print a message saying what it's checking for. + (AC_SIZE_T): Define size_t to be unsigned, not int, for + ANSI-friendliness. + + * acspecific.m4 (AC_GETLOADAVG): Just check for elf.h, not + dwarf.h too. + + * autoconf.sh: Exit with status 1 if there are unresolved macros. + Isolate the pattern to make adding other prefixes easy. + Look for aclocal.m4 in . as well as MACRODIR. + +Tue Aug 18 16:35:46 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_STRCOLL): New macro. + +Tue Aug 18 15:22:45 1992 Roland McGrath (roland@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_GETLOADAVG): elf.h implies SVR4. + +Mon Jul 27 14:20:32 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_TEST_PROGRAM): Check for cross-compiling + was missing "test -n". From Ian Lance Taylor. + +Sun Jul 26 16:25:19 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_SUBST): Support multiple substitutions in a + line. + +Mon Jul 20 01:08:01 1992 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * Version 1.0. diff --git a/ChangeLog.2 b/ChangeLog.2 new file mode 100644 index 0000000..ae3a8b4 --- /dev/null +++ b/ChangeLog.2 @@ -0,0 +1,12848 @@ +2001-05-21 Akim Demaille <akim@epita.fr> + + Version 2.50. + +2001-05-19 Akim Demaille <akim@epita.fr> + + * tests/tools.at: s/undefined macro/possibly undefined macro/. + +2001-05-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_SEARCH_LIBS): Unobfuscate. + +2001-05-19 Akim Demaille <akim@epita.fr> + + * autoconf.sh: s/undefined macro/possibly undefined macro/. + +2001-05-19 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Particular Programs): Explain the + `AC_PROG_LEX invoked multiple times' message. + Reported by Rainer Orth as PR Autoconf/177. + +2001-05-19 Akim Demaille <akim@epita.fr> + + * autoheader.sh: Fix file names used in error messages. + Reported by Rainer Orth as PR Autoconf/178. + +2001-05-19 Akim Demaille <akim@epita.fr> + + * tests/compile.at (AC_PROG_CPP via CC): Invoke AC_PROG_CC instead + if using `cc'. + +2001-05-19 Akim Demaille <akim@epita.fr> + + * tests/compile.at (GNU Fortran 77): Don't AS_EXIT when using + AT_CHECK_MACRO since it skips tests embedded in configure.ac. + Remove files which might have been created when invoking the + compiler. + Reported by Nicolas Joly. + +2001-05-14 Pavel Roskin <proski@gnu.org> + + * doc/autoconf.texi (Shellology): Document a quirk in + here-document handling on OpenBSD. + +2001-05-11 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_PROG_PREPROC_WORKS_IFELSE): No longer use the + `maybe' strategy: first try cpp's exit status, then its stderr. + (AC_PROG_CPP, AC_PROG_CXXCPP): Adjust. + * tests/compile.at (AC_PROG_CPP via CC): Simplify mycc. + Remove unrelated code. + +2001-05-10 Akim Demaille <akim@epita.fr> + + * tests/compile.at (AC_PROG_CPP via CC): New. + From Daniel Carroll. + +2001-04-27 Akim Demaille <akim@epita.fr> + + If AC_PROG_CC is invoked but not AC_PROG_CPP, then CPPFLAGS is not + AC_SUBST'ed. + Reported by Ralf Corsepius. + + * aclang.m4 (_AC_ARG_VAR_CPPFLAGS, _AC_ARG_VAR_LDFLAGS): New. + (AC_PROG_CC, AC_PROG_CPP, AC_PROG_CXX, AC_PROG_CXXCPP) + (AC_PROG_F77): Use them. + +2001-04-27 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_PROG_PREPROC_WORKS): Rename and extend as... + (_AC_PROG_PREPROC_WORKS_IFELSE): this. + Adjust to admit + (AC_PROG_CPP, AC_PROG_CXXCPP): Use it. + Reported by Daniel Carroll. + +2001-04-26 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Use two backslashes + before double quotes in the copyright notice, since the native + OpenBSD shell removes single backslashes in here-documents with + unquoted delimiters. + +2001-04-25 Nicolas Joly <njoly@pasteur.fr> + + * acgeneral.m4 (_AC_RUN_IFELSE): Clean `core' files. + +2001-04-24 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi (The GNU build system): Add this chapter + introducing Autoconf+Automake+Libtool, and fix references in the + introduction. + +2001-04-24 Akim Demaille <akim@epita.fr> + + On HP-UX 10 `ranlib --version' creates `./--version'. + Reported by Bob Proulx and Jim Meyering. + + * acgeneral.m4 (AC_CHECK_PROG, AC_PATH_PROG): Do not invoke the + program with --version. + +2001-04-22 Jim Meyering <meyering@lucent.com> + + * acfunctions.m4 (AC_FUNC_MEMCMP): Remove `int main () {' and the + trailing `}', since AC_LANG_PROGRAM provides them. + +2001-04-20 Akim Demaille <akim@epita.fr> + + * configure.in: Bump to 2.49f. + +2001-04-20 Akim Demaille <akim@epita.fr> + + Version 2.49e. + +2001-04-20 Akim Demaille <akim@epita.fr> + + * tests/foreign.at (Libtool): Ignore configure's stderr. + +2001-04-20 Tim Van Holder <tim.van.holder@pandora.be> + + * acgeneral.m4 (AC_OUTPUT): Close the descriptor before running + config.status so config.log is properly created on MS-DOS. + +2001-04-20 Nicolas Joly <njoly@pasteur.fr> + + * tests/atspecific.m4 (AT_CHECK_AUTOUPDATE): Be robust to missing + or broken autoupdate. + * tests/tools.at: Likewise. + * tests/Makefile.am (CLEANFILES): Also clean Libtool files. + +2001-04-18 Tim Van Holder <tim.van.holder@pandora.be> + + * acgeneral.m4 (_AC_INIT_SRCDIR): Handle + backslashes (DOS paths) for $ac_confdir and $srcdir. + +2001-04-17 Akim Demaille <akim@epita.fr> + + Don't mess with FDs. + + * acgeneral.m4 (_AC_INIT_DEFAULTS_FDS): Remove, replace with + inline setting up of AS_MESSAGE_FD. + (AS_MESSAGE_LOG_FD): Do not define, so that AS_MESSAGE does not + output in it before... + (_AC_INIT_CONFIG_LOG): here, which is run after the handling of + options. + +2001-04-18 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi: Replace documentation for obsolete + AC_LIBOBJ_DECL with clearer documentation for AC_LIBSOURCE + and AC_LIBSOURCES, improving the AC_LIBOBJ docs as well. + +2001-04-17 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi: Fixes for punctuation and grammar.. Replace + "..." with "@dots{}" except when "..." is in literal code. + +2001-04-17 Nicolas Joly <njoly@pasteur.fr> + + * acgeneral.m4 (_AC_LINK_IFELSE): Be sure to remove temporary + `conftest.$ac_objext', as some compilers may forget it. + +2001-04-16 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_INIT_VERSION): Use AC_PACKAGE_NAME and + AC_PACKAGE_VERSION only if they are defined. + (_AC_OUTPUT_CONFIG_STATUS): Likewise. + +2001-04-15 Lars J. Aas <larsa@sim.no> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Alter response on + `config.status --version' to be more compliant with the GNU Coding + Standards. + +2001-04-13 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi: Still more minor modifications for clarity, + felicity, and grammar. + +2001-04-11 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi (AC_F77_WRAPPERS): Mention C++ as well as C. + In the example, don't #ifdef F77_FUNC before using it, as that + would push any errors to link-time rather than compile-time; note + that the user can test this to invoke alternative behavior. + +2001-04-11 Akim Demaille <akim@epita.fr> + + * autoconf.sh (Task script): Be sure that `forbidden.rx' and + `allowed.rx' exist when AWK loads then. + Reported by Rainer Orth. + +2001-04-11 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi: A few more minor modifications for clarity, + grammar, and formatting. + +2001-04-10 Lars J. Aas <larsa@sim.no> + + * Makefile.am: AC_SUBST fixes for PACKAGE_NAME, VERSION, PACKAGE... + * configure.in: Moved here. + Suggested by Akim Demaille and Raja R Harinath. + +2001-04-10 Lars J. Aas <larsa@sim.no> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Re-enable logging to + `config.log' from `config.status', but delay logging till after + command line option processing. + +2001-04-10 Lars J. Aas <larsa@sim.no> + + * autoupdate.in (print_usage): print "\ at end of line does not + work as expected, so change block to here-doc instead. + (print_version): Same. + +2001-04-09 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi: Replace all tab characters with (8) spaces, + lest the formatting of example code, etcetera, be messed up. + +2001-04-09 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi: Rephrase various parts for clarity, felicity, + and/or grammar. + +2001-04-09 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi: Clean up cache documentation: Document + --config-cache/-C option, and recommend instead of --cache-file. + Indent example AC_CACHE_VAL macros for clarity. Add new + "Cache Checkpointing" section for AC_CACHE_SAVE (and + AC_CACHE_LOAD), so that the "Cache Files" section focuses solely + on features visible to end-users (e.g. to better fit the cross + references). Various minor rewordings for clarity, felicity, + and/or grammar. + +2001-04-09 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi: Revert to "configure.in" in the history, since + "configure.ac" wasn't used in the past, and in any case it is + probably a good idea to preserve this section verbatim. + +2001-04-09 Steven G. Johnson <stevenj@alum.mit.edu> + + * AUTHORS: Fix grammar. + +2001-04-09 Lars J. Aas <larsa@sim.no> + + * Makefile.am: Manual addition of @PACKAGE@ substitution variable + needed by dist rules. Added explanatory comment. + Problem reported and comment suggested by Raja R Harinath. + +2001-04-06 Lars J. Aas <larsa@sim.no> + + * Makefile.am: Manual addition of @VERSION@ substitution variable + as a temporary Automake fix. Reported by Raja R Harinath. + +2001-04-04 Lars J. Aas <larsa@sim.no> + + * acgeneral (_AC_INIT_CONFIG_LOG): New macro for setting up the + config.log file. + (_AC_INIT_DEFAULTS_FDS): Log to /dev/null instead of config.log. + (AC_INIT): Invoke _AC_INIT_CONFIG_LOG after _AC_INIT_VERSION. + +2001-04-04 Lars J. Aas <larsa@sim.no> + + * acgeneral.m4 (_AC_INIT_DEFAULTS): Produce better version + information for config.log header. + (_AC_INIT_VERSION): Produce better version information for + `configure --version'. + +2001-03-30 Steven G. Johnson <stevenj@alum.mit.edu> + + * doc/autoconf.texi: Use "invalid" instead of "illegal," as + suggested by the GNU coding standards. + +2001-03-30 Tim Van Holder <tim.van.holder@pandora.be> + + * m4sh.m4 (AS_BASENAME): New. + (AS_SHELL_SANITIZE): Set `$as_me'. + * acgeneral.m4: Don't set as_me; AS_SHELL_SANITIZE now does this. + * tests/atgeneral.m4: Likewise. + (AT_INIT): Use $PATH_SEPARATOR for walking the path. + * autoconf.sh: Be DOS-friendly when setting as_me and M4. + Add quotes to support spaces in $tmp. + Work around problem in DJGPP port of awk by using a temporary file. + * autoheader.sh: Be DOS-friendly when setting as_me. + * autoreconf.sh: Be DOS-friendly when setting as_me, dir and + template_dir. + +2001-03-27 Lars J. Aas <larsa@sim.no> + + * acgeneral.m4 (AC_INIT_VERSION): Improved version information string + for `configure --version'. + +2001-03-27 Akim Demaille <akim@epita.fr> + + * autoheader.sh (config_h): Be robust to new lines when extracting + the first argument of AC_CONFIG_HEADERS. + Reported by Lars J. Aas. + +2001-03-27 Tim Van Holder <tim.van.holder@pandora.be> + + * doc/autoconf.texi: Minor tweaks. + +2001-03-27 Tim Van Holder <tim.van.holder@pandora.be> + + * Makefile.am, configure.in: autoupdate is a Perl script. + +2001-03-20 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Usual Tools): Some about + `touch'. + From Jim Meyering, Volker Borchert, and Peter Eisentraut. + +2001-03-20 Akim Demaille <akim@epita.fr> + + * tests/foreign.at (Libtool): Don't skip 1.3.5. + Invoke AC_CANONICAL_SYSTEM ---for some reason AC_CANONICAL_HOST is + not enough for 1.3.5. + From Lars J. Aas. + +2001-03-20 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4: s/Testing suite/Test suite/g. + From Jim. + (AT_INIT): Adjust the error message on invalid options. + * tests/foreign.at (Libtool): Skip Libtool 1.3 too. + +2001-03-20 Kevin Ryde <user42@zip.com.au> + + * doc/autoconf.texi: A couple of grammatical tweaks. + +2001-03-19 Akim Demaille <akim@epita.fr> + + * configure.in: Bump to 2.49e. + +2001-03-19 Akim Demaille <akim@epita.fr> + + Version 2.49d. + +2001-03-19 Akim Demaille <akim@epita.fr> + + * tests/tools.at (AWK portability): Don't rely on `empty'. + +2001-03-19 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): Fix the at_diff test. + Reported by Nicolas Joly. + +2001-03-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_PREPROC_IFELSE): Redirect stdout out of the + _AC_EVAL_STDERR invocation to avoid `illegal io' on Ultrix. + Reported by Harlan Stenn, and fixed by Jim Meyering. + +2001-03-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Don't hard code + `/bin/sh', use $SHELL. + From Paul Eggert. + +2001-03-19 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AC_FUNC_STRERROR_R): Update to + fileutils-4.0.42's. + +2001-03-19 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): Don't always create `empty', rather + do it only when diffing `/dev/null' is not supported. + And use `at-devnull' instead of `empty'. + +2001-03-13 Akim Demaille <akim@epita.fr> + + * autoscan.pl, autoupdate.in: Use `use' instead of `require' to + require some version of Perl, so that the test is performed at + compile time, not run time. + Suggested by Nicolas Joly. + +2001-03-13 Tim Van Holder <tim.van.holder@pandora.be> + + * tests/aclocal.m4: Fix some typos. Also ignore $PATH_SEPARATOR. + * tests/atconfig.in: Set PATH_SEPARATOR to the proper + path separator. Set SHELL here... + * tests/atgeneral.m4: ... instead of here. Use $PATH_SEPARATOR + when setting AUTOTEST_PATH. Don't default tests to "all" before + deciding whether the help text is needed. + * tests/semantics.at: Use the correct path separator. + +2001-03-13 Tim Van Holder <tim.van.holder@pandora.be> + + * doc/autoconf.texi: Expand section on DOS issues. + Add link to the `doschk' package. Fix minor typo. + Clean up white spaces. + +2001-03-13 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_PROG_F77_C_O): define F77_NO_MINUS_C_MINUS_O + when test fails, not when it succeeds(!). + +2001-03-13 Akim Demaille <akim@epita.fr> + + * tests/tools.at (AWK portability): Use AT_CHECK to check for GNU + AWK so that there is always a AT_CHECK between + AT_SETUP/AT_CLEANUP. + Reported by Nicolas Joly. + +2001-03-13 Akim Demaille <akim@epita.fr> + + * tests/tools.at: Be sure to remove configure.ac~. + +2001-03-13 Raja R Harinath <harinath@cs.umn.edu> + + * autoupdate.in (File::Basename): Use package. + (%ac_macros, %au_macros): Save only base filenames. + +2001-03-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT): In the AU_DEFUN definition, don't try + to issue an obsolete message, it can't work for macros being + defined both with AC_DEFUN and AU_DEFUN. + Hence do it in the AC_DEFUN definition. + +2001-03-06 Pavel Roskin <proski@gnu.org> + + * tests/base.at (AC_TRY_*): Escape `^' - it's a pipe command + separator on Tru64 v5.1. + Reported by Nicolas Joly. + +2001-03-05 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): Register at-setup-line and + at-check-line for removal. + Check for the presence of at-check-line only when $at_test was + really a test. + Reported by Pavel. + +2001-03-04 Pavel Roskin <proski@gnu.org> + + * tests/atgeneral.m4 (AT_INIT): s/am_me/as_me/. Quote AT_CHECK + in the error message. + +2001-03-02 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_INIT_PREPARE): Quote `$$*' correctly. + +2001-02-28 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): Warn when at-check-line is + missing. + * tests/tools.at (Syntax of the scripts): Use AT_CHECK to test + /bin/sh -n. Exit 77 on failure. + Reported by Harlan Stenn. + +2001-02-28 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE_FS_SEPARATORS): Use `.;.' instead + of `.;`pwd`': if pwd is c:/foo, we might walk through `.:c' + (fails), and then `/foo' which might succeed, resulting in + believing `;' is the right path separator. + +2001-02-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AH_VERBATIM, AH_TEMPLATE): New, use AS_ESCAPE, not + _AS_QUOTE. + (_AH_VERBATIM_OLD, _AH_TEMPLATE_OLD): New, used for bugward + compatibility in... + (AC_DEFINE, AC_DEFINE_UNQUOTED): here. + +2001-02-26 Pavel Roskin <proski@gnu.org> + + * autoupdate.in (&mktmpdir): Strip the newline from the output + of mktemp. + +2001-02-26 Pavel Roskin <proski@gnu.org> + + * man/Makefile.am: autoupdate.1 now depends on autoupdate.in. + +2001-02-25 Tim Van Holder <tim.van.holder@pandora.be> + + * autoupdate.in: Support DOS paths. Initialize $tmp to + avoid warnings. Default $autoconf to 'autoconf'. + +2001-02-25 Akim Demaille <akim@epita.fr> + + * autoupdate.in (&END): Try to preserve the exit status. + Use backquotes where more readable. + Internal details should be dumped when $debug, not when $verbose. + +2001-02-25 Akim Demaille <akim@epita.fr> + + * autoupdate.in (&mktmpdir): New. + (&END): Remove $tmp. + (&parse_args): Handle -d and -l. + +2001-02-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE): Remove conf$$* on exit. + * m4sh.m4 (_AS_LN_S_PREPARE, _AS_BROKEN_TEST_PREPARE): + s/conftest/conf$$/ to avoid race conditions. + From Lars J. Aas. + +2001-02-25 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_PROG_INSTALL): Use ac_path_separator. + Restore the IFS earlier. + Suggested by Tim Van Holder. + +2001-02-25 Akim Demaille <akim@epita.fr> + + * m4sh.m4 (_AS_TEST_PREPARE): Rename as... + (_AS_BROKEN_TEST_PREPARE): this. + (_AS_TEST_PREPARE): New dummy but working version of this macro. + * acspecific.m4 (AC_PROG_INSTALL): Use AS_EXECUTABLE_P. + +2001-02-25 Akim Demaille <akim@epita.fr> + + * autoupdate.in (&parse_args): Support `-'. + +2001-02-25 Akim Demaille <akim@epita.fr> + + * autoupdate.in: Less Bournisms, more Wallisms. + +2001-02-23 Jim Meyering <meyering@lucent.com> + + * acgeneral.m4 (_AC_INIT_PREPARE_FS_SEPARATORS): Fix typo: s/;/:/ + * acgeneral.m4 (_AC_INIT_PREPARE_FS_SEPARATORS): Revert that change. + There was no typo. + +2001-02-22 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi: Typos and formatting changes. + +2001-02-21 Lars J. Aas <larsa@sim.no> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Use `AS_EXIT(0)' instead + of `exit 0' when exiting config.status. + +2001-02-21 Tim Van Holder <tim.van.holder@pandora.be> + + * doc/autoconf.texi: Add new node discussing issues related to + file systems (DOS, specifically). Document DJGPP's bash's special + handling of $PATH_SEPARATOR. + +2001-02-21 Akim Demaille <akim@epita.fr> + + * autoupdate.in: New. Replaces autoupdate.sh. + +2001-02-21 Akim Demaille <akim@epita.fr> + + * autoscan.pl (&find_configure_ac): New. + +2001-02-20 Paul Martinolich <martinol@datasync.com> + + * autoscan.pl (check_configure_ac): Pretty missing macro warnings + output. + +2001-02-19 Paul Eggert <eggert@twinsun.com> + + * aclang.m4 (AC_C_INLINE): Define "inline" to empty if the + compiler doesn't support 'static inline'. This is needed for + Encore Umax-3.0.9.16b. + +2001-02-19 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_LANG_COMPILER_WORKS): Rename as... + (_AC_COMPILER_EXEEXT_WORKS): this. Use the `a.out' or `a.exe' + left by _AC_COMPILER_EXEEXT_DEFAULT to check if the compiler works. + (_AC_COMPILER_EXEEXT_CROSS): Extract from the above macro. + (_AC_COMPILER_EXEEXT): Use them. + Adjust all the compiler looking macros to check for EXEEXT + *first*, then OBJEXT. + Set ac_exeext yourself. + (_AC_COMPILER_EXEEXT_O): Don't. + +2001-02-07 Pavel Roskin <proski@gnu.org> + + * tests/atspecific.m4 (AT_CONFIGURE_AC): Double quote constant + part of the second argument to AT_DATA. + * tests/compile.at (AC_PROG_CPP with warnings): Fix underquoting + in a call to _AT_CHECK_AC_MACRO. + (AC_PROG_CPP without warnings): Likewise. + +2001-02-11 Jim Meyering <meyering@lucent.com> + + Ensure that even `autoscan --version' fails when e.g., + writing to a full disk. + * autoscan.pl (END): New function. + + * autoscan.pl: Misc. clean-up: + Move declarations of variables into the scope where they're used. + Use `qw'. Don't use `$_'. + +2001-02-06 Paul Eggert <eggert@twinsun.com> + + * acspecific.m4 (AC_SYS_LARGEFILE_TEST_INCLUDES): Don't reject + C++ compilers that are masquerading as C compilers, and that + incorrectly reject large integers. + +2001-02-07 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (AC_OUTPUT): Remove $(srcdir), ${srcdir} and + @srcdir@ from VPATH if srcdir is "." and replace blank VPATH + lines with empty lines to preserve line numbers. + Original version by Derek Price. + +2001-02-07 Derek Price <derek.price@openavenue.com> + + * acgeneral.m4 (_AC_LIBOBJ): Call AC_LIBSOURCE with '.c' extension + appended to function name. + +2001-02-06 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_RUN_LOG, _AC_RUN_LOG_STDERR, AC_RUN_LOG): New. + (_AC_EVAL_STDERR, _AC_EVAL): Use them. + (_AC_INIT_PREPARE_FS_SEPARATORS): Use AC_RUN_LOG. + +2001-02-05 Derek Price <derek.price@openavenue.com> + + * autoheader.sh: Only set config_h for the first call to + AC_CONFIG_HEADERS. + +2001-02-05 Jim Meyering <meyering@lucent.com> + + * acspecific.m4 (AC_SYS_LARGEFILE): Add ULL suffix to the + integer constants. + +2001-02-05 Akim Demaille <akim@epita.fr> + + acfunctions.m4 was still using the old AC_LIBOBJ_DECL. + Reported by Derek R. Price. + + * tests/semantics.at (AC_REPLACE_FUNCS): New test. + * acfunctions.m4 (AC_REPLACE_FUNCS, _AC_LIBOBJ_ALLOCA): Use + AC_LIBSOURCES. + +2001-02-03 Pavel Roskin <proski@gnu.org> + + * tests/base.at (AC_TRY_COMMAND): Add a colon between "then" and + "else". Separate commands inside AC_TRY_COMMAND with semicolons. + From Nicolas Joly. + +2001-02-03 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_LOG_COMPLETE): Removed, dead code. + +2001-02-03 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AC_FUNC_ERROR_AT_LINE, AC_FUNC_OBSTACK): Use + AC_LIBSOURCES. + +2001-02-03 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_LIBOBJ_DECL): Remove. + (AC_LIBSOURCES, AC_LIBSOURCE): New. + +2001-02-02 Akim Demaille <akim@epita.fr> + + * tests/base.at (AC_TRY_COMMAND): Fix the test. + From Nicolas Joly. + + The following patch went into Autoconf between the two previous + entries: + + * acgeneral.m4 (AC_TRY_COMMAND): Use the old code, using a tmp + variable, to recover multiline robustness. + Reported by Tim Van Holder. + * tests/base.at (AC_TRY_COMMAND): New. + +2001-02-02 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_COMPUTE_INT_COMPILE): Rename all occurences + of ac_try to ac_mid to avoid a name clash. + +2001-02-02 Pavel Roskin <proski@gnu.org> + + * autoscan.pl (scan_c_file): When in verbose mode, don't print + out hashes common for the whole package. Do it in scan_files() + instead. + (scan_makefile): Likewise. + (scan_sh_file): Likewise. + Thanks to Jim Meyering for improved implementation. + +2001-02-01 Pavel Roskin <proski@gnu.org> + + * autoreconf.sh: Fix the case when the verbose output was not + redirected to stderr as everywhere else. + +2001-01-30 Ralf Corsepius <corsepiu@faw.uni-ulm.de> + + * acgeneral.m4 (_AC_OUTPUT_SUBDIRS): Remove configure.ac + from check for ac_sub_configure. + +2001-01-30 Akim Demaille <akim@epita.fr> + + The recent addition of `exit's prototype in confdefs.h causes + AC_OUTPUT_MAKE_DEFS to include junky -D switches. + Reported by Wolfgang Mueller. + + * tests/torture.at (#define header templates): Include trash in + confdefs.h. + * tests/atgeneral.at (AT_INIT): Don't expect `find' to support + -maxdepth, hence don't use -follow either. + Reported by Nicolas Joly. + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS) <confdef2opt.sed>: In the + `quote' section, `p'rint the result. + If neither `#define' pattern match, just call `d' to start a new + cycle. + Invoke this sed program with -n. + +2001-01-30 Akim Demaille <akim@epita.fr> + + * tests/compile.at: New test. + * tests/atspecific.at (AT_CHECK): When given 77 as expected exit + status, don't include the `skip' mechanism. + +2001-01-30 Akim Demaille <akim@epita.fr> + + * tests/base.at (AC_CACHE_CHECK): Typo and clean up. + Check only --quiet. + +2001-01-30 Paul Eggert <eggert@twinsun.com> + + * autoheader.sh: Don't pass a string to 'echo' that might + possibly contain backslashes. + +2001-01-29 Pavel Roskin <proski@gnu.org> + + Don't use filenames that can be reduced to "conftest" on DOS. + + * acfunctions.m4 (AC_FUNC_MMAP): Use conftest.mmap, not + conftestmmap. + (AC_FUNC_UTIME_NULL): Use conftest.data, not conftestdata. + * acspecific.m4 (AC_PROG_MAKE_SET): Use conftest.make, not + conftestmake. + (_AC_PATH_X_XMKMF): Use conftest.dir, not conftestdir. + * acgeneral.m4 (AC_ARG_PROGRAM): Use conftest.sed, not + conftestsed. + * m4/sanity.m4: Use conftest.file, not conftestfile. + * doc/autoconf.texi (Guidelines for Test Programs): Suggest + using conftest.data, not conftestdata. + +2001-01-29 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4: Don't redirect builtins' stderr as Ultrix + hates this: use a subshell. + +2001-01-29 Assar Westerlund <assar@sics.se> + + * m4sh.m4 (_AS_TEST_PREPARE): Discard output when testing `test + -x' and `test -f' to avoid confusing users with error messages. + (AS_MKDIR_P): Invert order of separators in IFS to avoid problem + with some shells adding backslash between fields and parsing the + result for escapes. + * doc/autoconf.texi (Special Shell Variables): Document IFS. + +2001-01-29 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_PROG_F77): Improve documentation of the compilers + that are tried, add a few new ones (cft77, af77, epcf90, xlf95, g95), + and put pgf90 in the right place (before the F95 compilers). + +2001-01-29 Jim Meyering <meyering@lucent.com> + + * autoscan.pl: Do scan `configure.ac' when you claim it. + From Raja R Harinath. + (@kinds): Use `qw', rather than lots of quotes and commas. + (%generic_macro): Use single quotes around literals. + ($configure_scan): Define global, and use it instead of the literal. + Use `warn' in place of `printf STDERR'. + +2001-01-29 Akim Demaille <akim@epita.fr> + + * autoscan.pl: `Formatting++' changes: prototypes all the + functions, no longer use `&' to call functions as it disables + prototype checking, topological sort so that functions are defined + before being used, and put an Autoconf like nice comment to + describe the functions. + (output): Accept a CONFIGURE_SCAN parameter, and open CONF. + +2001-01-29 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_SITE_LOAD): Let config.log know what you load. + +2001-01-27 Akim Demaille <akim@epita.fr> + + Follow Tim Van Holder's suggestions for a uniform handling of + symlinks. + + * m4sh.m4: Stay in `as_', not `ac_'. + (_AS_LN_S_PREPARE): Eve out from... + * acspecific.m4 (AC_PROG_LN_S): here. Adjust. + * m4sh.m4 (AS_LN_S): New. + (AS_SHELL_PREPARE): Call _AS_LN_S_PREPARE. + +2001-01-26 Assar Westerlund <assar@sics.se> + + * autoreconf.sh (find): Fix precedence. + (aclocal): Same as below for autoheader. + +2001-01-26 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (autoheader): Run it when there is no template, as + there is no risk to override a handwritten template. + From Assar Westerlund. + +2001-01-26 Akim Demaille <akim@epita.fr> + + * aclang.m4: dnl AC_ARG_VAR's newline. + (AC_PROG_CC, AC_PROG_F77, AC_PROG_CXX): AC_ARG_VAR(LDFLAGS). + * acgeneral.m4 (AC_CHECK_LIB): Don't do it. + +2001-01-26 Akim Demaille <akim@epita.fr> + + * tests/mktests.sh: Handle DOS issues: directory separator, single + dot in file names, and one actual bug: when set -e, running + (false; true) will of course fail, use (false || true). + From Tim Van Holder. + +2001-01-26 Tim Van Holder <tim.van.holder@pandora.be> + + * tests/Makefile.am (testsuite): Use testsuite.tmp, not + testsuite-tmp as temporary file. + +2001-01-25 Assar Westerlund <assar@sics.se> + + * autoreconf.sh: Also find configure.in. + +2001-01-24 Akim Demaille <akim@epita.fr> + + * configure.in: Bump to 2.49d. + +2001-01-24 Akim Demaille <akim@epita.fr> + + Version 2.49c. + +2001-01-24 Jim Meyering <meyering@lucent.com> + + * autoscan.pl (output): Detect/report a close failure. + +2001-01-24 Akim Demaille <akim@epita.fr> + + Preserve INSTALL too. + + * acgeneral.m4 (_AC_OUTPUT_FILES): Use ac_INSTALL for internal + computations, and therefore use INSTALL where ac_given_INSTALL + was used. + (_AC_OUTPUT_SUBDIRS): There is no point in computing INSTALL in + here. It's not even used. + +2001-01-24 Akim Demaille <akim@epita.fr> + + While preserved in configure, srcdir is trashed in config.status. + Reported by Ralf Corsepius. + + * tests/aclocal.m4 (AC_STATE_SAVE): It is ok to modify + CONFIG_STATUS, DEFS, prefix and exec_prefix. + It is OK to produce config.* files. + * tests/atspecific.m4 (AT_CONFIGURE_AC): Save the env *after* + AC_OUTPUT to check that it doesn't break anything by itself. + * tests/torture.m4 (srcdir): New test, from Ralf Corsepius. + * acgeneral.m4 (_AC_OUTPUT_FILES): Use ac_top_srcdir and ac_srcdir + to preserve srcdir and top_srcdir. + Remove any use of `ac_given_srcdir' as `$srcdir' being preserved + is usable. + +2001-01-24 Alexandre Duret-Lutz <duret_g@epita.fr> + + configure -q did not work since 2000-11-03. + + * acgeneral.m4 (_AC_INIT_DEFAULTS_FDS): Don't check for $silent, + tie AS_MESSAGE_FD to stdout unconditionally. + (_AC_INIT_PARSE_ARGS): If $silent redirect AS_MESSAGE_FD to + /dev/null. + * tests/base.at (AC_CACHE_CHECK): New test. + +2001-01-24 Tim Van Holder <tim.van.holder@pandora.be> + + * m4sh.m4 (AS_EXECUTABLE_P, _AS_TEST_PREPARE): New macros. + (AS_SANITIZE_SHELL): Call _AS_TEST_PREPARE. + * acgeneral.m4 (AC_CHECK_PROG, AC_PATH_PROG): Use AS_EXECUTABLE_P + instead of test -f. + +2001-01-24 Akim Demaille <akim@epita.fr> + + * autoscan.pl (generic_macro): s/AC_CHECK_FUNCTIONS/AC_CHECK_FUNCS/. + * acfunctions: Just like the previous patch. + +2001-01-24 Akim Demaille <akim@epita.fr> + + * autoscan.pl (@kinds, %generic_macro): New. + (&init_tables): Use them. + * acheaders: Run `autoconf -t AC_CHECK_HEADERS:'$1'' on the fileutils, + and include all these headers in here. + Don't specify `AC_CHECK_HEADERS' as it's the default. + +2001-01-24 Akim Demaille <akim@epita.fr> + + * autoscan.pl: Just like the previous patch, but for + AC_CHECK_FUNCS, AC_CHECK_TYPES, and AC_CHECK_MEMBERS. + +2001-01-24 Akim Demaille <akim@epita.fr> + + * autoscan.pl (print_unique): Push all the macro invocation + locations. + (output_headers): For headers that need to be checked, push either + the specialized macro, or the generic macro call. + (check_configure_ac): Handle AC_CHECK_HEADERS. + +2001-01-24 Raja R Harinath <harinath@cs.umn.edu> + + Some non-srcdir build fixes. + * configure.in (BUGS): Look for file in $srcdir. + * tests/Makefile.am (MACRO_FILES): Use '..', not '$(top_srcdir)'. + +2001-01-24 Akim Demaille <akim@epita.fr> + + Don't AC_SUBST too much, as it makes Automake include those + variables in Makefiles, and drives autoscan to require unneeded + programs. + + * acgeneral.m4 (_AC_INIT_PREPARE): Don't AC_SUBST CFLAGS, + CPPFLAGS, CXXFLAGS and LDFLAGS. + (AC_ARG_VAR): AC_SUBST the var. + Document it only once, even if there are several different docs. + * aclang.m4 (AC_PROG_CPP): Declare CPP and CPPFLAGS to AC_ARG_VAR. + (AC_PROG_CXXCPP): Declare CXXCPP and CPPFLAGS. + +2001-01-24 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_expand_once): Accept a witness. + +2001-01-23 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_EXPAND_ONCE): Remove, use m4_expand_once. + (AC_DIVERT_ONCE): Move to... + * m4sugar.m4 (m4_expand_once): here. + +2001-01-23 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_LANG_SET): Turn off optimizations. + +2001-01-23 Akim Demaille <akim@epita.fr> + + * configure.in: If this is a beta, dump the core of BUGS. + * tests/base.at (AC_REQUIRE & AC_LANG): New test, currently failing. + +2001-01-23 Akim Demaille <akim@epita.fr> + + * autoscan.pl: Don't use `defined' to check whether an array is + defined. + Don't use parens with `defined'. + +2001-01-23 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE): Be sure to quote hashes to + avoid M4 thinking it's comments. + +2001-01-23 Tim Van Holder <tim.van.holder@pandora.be> + + * aclang.m4 (_AC_COMPILER_EXEEXT_O): Use + AS_IF([AC_TRY_EVAL(ac_link)]) instead of AC_LINK_IFELSE to + avoid depending on ac_exeext before it's found. + (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): Check for the + executable extension BEFORE checking whether the compiler + works, as that test depends on a correct ac_exeext. + +2001-01-23 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE) <trap>: Typo. + +2001-01-22 Pavel Roskin <proski@gnu.org> + + * autoscan.pl: Use "use strict". Declare all global variables + or make them private. Make all local variables private. + (find_autoconf): New, moved some code from the top level. + Use %ENV outside quotes to eliminate a warning. + +2001-01-22 Tim Van Holder <tim.van.holder@pandora.be> + + * acspecific.m4 (AC_PROG_LN_S): Detect DJGPP < 2.04, which only + supports 'ln -s' for executables. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * autoscan.pl ($dir, $autoconf): New. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * autoscan.pl ($headers, $functions, $identifiers, $libraries): + Also register locations of their requirement instead of a simple + counter. + (&check_configure_ac): Close TRACES. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * autoscan.pl: Formatting changes. + Check `configure.ac' or `configure.in' if present. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * autoscan.pl (&wanted): Don't register `Makefile' when + `Makefile.in' is present. + Factor the simplification of $name. + (&scan_makefile, &scan_sh_file): Instead of counting the number of + occurrences where a program/makevar is wanted, register file:line. + Adjust the verbose output. + (&check_configure_ac): Report the location where the macro is required. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * autoscan.pl: Instead of undefined globals, set them to empty + values. + (%needed_macros): New. + (&check_configure_ac): New. Call it. + (&output_libraries): Eve out from &output_programs. + (&print_unique): For the time being register in %needed_macros + only argument less macros. + +2001-01-22 Lars J. Aas <larsa@sim.no> + + * aclang.m4 (_AC_PROG_CXX_EXIT_DECLARATION): First try no declaration, + then '#include <stdlib.h>', before trying the explicit declarations. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_COMPILE_IFELSE): Wrap the test -s in + AC_TRY_COMMAND to improve config.log. + (_AC_INIT_DEFAULTS): Don't define ac_exeext and ac_objext to + highlight failures. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Work around a currently + impossible to describe bug of SunOS 4.1.3 which causes a shell + crash when using `VAR=${VAR="$default"}'. + Reported and diagnosed by Kevin Ryde. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AC_FUNC_GETGROUPS): Typo :(. + +2001-01-22 Lars J. Aas <larsa@sim.no> + + * aclang.m4 (_AC_COMPILER_EXEEXT_DEFAULT, _AC_COMPILER_EXEEXT_O): + Export ac_cv_exeext so ltconfig believes the value is cached and + skips its own faulty test. + +2001-01-22 Jim Meyering <meyering@lucent.com> + + * actypes.m4 (AC_TYPE_GETGROUPS): Double quote the test program + body. + +2001-01-22 Tim Van Holder <tim.van.holder@pandora.be> + + * aclang.m4 (AC_LANG_INT_SAVE, AC_LANG_INT_SAVE(C)): Use + conftest.val, not conftestval. + * acgeneral.m4 (_AC_COMPUTE_INT_RUN, _AC_COMPUTE_INT): + Likewise. + +2001-01-22 Akim Demaille <akim@epita.fr> + + Create actypes.m4. + + * acgeneral.m4 (AC_CHECK_SIZEOF, _AC_CHECK_TYPE_NEW) + (AC_CHECK_TYPES, _AC_CHECK_TYPE_OLD) + (_AC_CHECK_TYPE_REPLACEMENT_TYPE_P, _AC_CHECK_TYPE_MAYBE_TYPE_P) + (AC_CHECK_TYPE, AC_CHECK_MEMBER, AC_CHECK_MEMBERS): Move into... + * actypes.m4: here. + * acgeneral.m4 (AC_TYPE_GETGROUPS, AM_TYPE_PTRDIFF_T) + (AC_TYPE_UID_T, AC_TYPE_SIZE_T, AC_TYPE_PID_T, AC_TYPE_OFF_T) + (AC_TYPE_MODE_T, AC_INT_16_BITS, AC_LONG_64_BITS, AC_TYPE_SIGNAL) + (AC_STRUCT_TM, AC_STRUCT_TIMEZONE, AC_STRUCT_ST_BLKSIZE) + (AC_STRUCT_ST_BLOCKS, AC_STRUCT_ST_RDEV): Move into... + * actypes.m4: here. + Adjust the test suite. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): Include a default case for non + existing tests. + * tests/atspecific.m4 (AT_CONFIGURE_AC, AT_CHECK_ENV) + (AT_CHECK_AUTOUPDATE, AT_CHECK_AU_MACRO): New. + Spread their use. + (AT_CHECK_MACRO): Pass `-W obsolete' to autoconf. + * tests/semantics.at (AC_HAVE_FUNCS): Obsolete, don't check. + * tests/mktest.sh: Create one test file per Autoconf source + file instead of separating syntax/update. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi: Some about diff and cmp. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * sh.m4 (AS_ESCAPE): New. + (_AS_QUOTE_IFELSE): Use it. + * tests/atgeneral.m4 (AT_INIT) <SHELL>: Define and use. + <--help> Don't display the options help when tests were selected. + Document -d. + <at_skip_list>: New. + <testsuite.log>: Give a banner, include ChangeLog snippets, list + the failed and skipped tests. + Remove useless $at_traceoff in sub shells, this improves the + readability of the traces by removing testsuite's implementation + details. + (AT_CHECK): Filter out the shell traces from the tested command's + stderr. + Use AS_ESCAPE. + Don't register experr and expout for clean up, as it's hairy and + easier to do from... + Support STDOUT = stdout, and STDERR = stderr. + Force the output of shell traces. + (AT_INIT): Here. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INIT, AC_OUTPUT): Don't take care of completing + the log. + (_AC_INIT_PREPARE): Do it in the trap 0. + +2001-01-22 Akim Demaille <akim@epita.fr> + + * autoscan.pl: Instead of undefined globals, set them to empty + values. + (%needed_macros): New. + (&check_configure_ac): New. Call it. + (&output_libraries): Eve out from &output_programs. + (&print_unique): For the time being register in %needed_macros + only argument less macros. + +2001-01-22 Raja R Harinath <harinath@cs.umn.edu>, + Tim Van Holder <tim.van.holder@pandora.be>, + Jim Meyering <jim@meyering.net> + + * acspecific.m4 (AC_AIX): Fix typo: s/@\$/@%/. + +2001-01-19 Akim Demaille <akim@epita.fr> + + Catch only used patterns. + Reported by the whole Autoconf community. + + * m4sh.m4 (AS_INIT): New. + * acgeneral.m4 (AC_PLAIN_SCRIPT): Use it. + Forbid only AC, AU, AH and AM. + +2001-01-19 Akim Demaille <akim@epita.fr> + + Optimizing AC_LANG was broken. Test and fix. + + * aclang.m4 (AC_LANG(C), AC_LANG(C++), AC_LANG(Fortran 77)): Don't + use _AC_LANG_ABBREV so that you don't depend upon _AC_LANG. + (_AC_LANG_SET): New. + (AC_LANG, AC_LANG_PUSH, AC_LANG_POP): Use it. + * tests/compile.at: Test AC_LANG, AC_LANG_PUSH & AC_LANG_POP. + +2001-01-19 Akim Demaille <akim@epita.fr> + + * sugar.m4 (m4_require): Missing dnl. + +2001-01-18 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PLAIN_SCRIPT): AF_INET, AF_UNIX, AR_FLAGS, + AS_FLAGS are OK. + +2001-01-18 Tim Van Holder <tim.van.holder@pandora.be> + + * m4sh.m4 (AS_MKDIR_P): Properly support DOS-style paths. + +2001-01-18 Akim Demaille <akim@epita.fr> + + * tests/foreign.at (Autoconf & Libtool): `configure.in', not `.ac' + since Libtool does not yet support it. + Let the test suite be more verbose about at-path. + From Patrick Welche. + +2001-01-18 Akim Demaille <akim@epita.fr> + + * tests/atspecific.m4 (AT_CHECK_DEFINES): Discard + STDLIB|INTTYPES|MEMORY|STRING|UNISTD. + * tests/semantics.at (AC_CHECK_SIZEOF): Don't check the presence + of default headers, as it's machine dependent. + Reported by Jim Meyering and Nicolas Joly. + +2001-01-18 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Don't leave macro names in comments. + * aclang.m4: Likewise. + * configure.in: Likewise. + * tests/semantics.at: Likewise. + * tests/tools.at: Likewise. + +2001-01-18 Akim Demaille <akim@epita.fr> + + Medium term goal: AC_ macros can be tested with -W obsolete. + + * acgeneral.m4 (AC_RUN_IFELSE): Accept IF-CROSS-COMPILING. + (AC_TRY_RUN): Use it. + * acfunctions.m4: Start ousting AC_TRY_RUN and AC_TRY_COMPILE. + * acspecific.m4 (AC_AIX, AC_MINIX, AC_ISC_POSIX): AC_BEFORE on + AC_COMPILE_IFELSE and AC_RUN_IFELSE. + +2001-01-18 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INCLUDES_DEFAULT): Force the newline to avoid + bad surprises. + Reported by Jim. + +2001-01-18 Akim Demaille <akim@epita.fr> + + Require a perfect divert push/pop balance. + + * m4sugar.m4 (m4_divert, m4_divert_push, m4_divert_pop): Keep + track of them in m4_divert_stack. + (m4_divert_pop): Accept the expected current diversion as + argument and m4_fatal if incorrect, or if there is nothing to pop. + (globally): Specify the known m4_divert_pop. + Preserve symbolic values when possible. + * acgeneral.m4: No longer push the first diversion. + Specify the known m4_divert_pop. + (AC_PLAIN_SCRIPT): When m4_divert_push a diversion, m4_wrap its + pop. + (AC_INIT): Run AC_PLAIN_SCRIPT first, not last. + * tests/m4sh.at (AS_DIRNAME & AS_DIRNAME_SED): Can't use m4_defun + without m4_init. + * m4sugar.m4: Likewise. + +2001-01-18 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_defn, m4_undefine, m4_popdef): Unlike the + builtin, fail on undefined symbols. + * tests/torture.at (Torturing config.status): Stop playing nasty + tricks with changequote. + (AC_DEFUBST): Move here from... + * tests/aclocal.m4: there. + +2001-01-18 Akim Demaille <akim@epita.fr> + + Various cleanups and consistency checks. + + * m4sugar.m4: Formatting changes. + * acgeneral.m4 (AC_DIVERT_PUSH, AC_DIVERT_POP, AC_REQUIRE) + (AC_DIAGNOSE, AC_FATAL, AC_MSG_WARN, AC_MSG_NOTICE, AC_MSG_ERROR): + Use m4_copy to define them, in order to keep a good $0. + (AC_INIT): AC_LANG_PUSH C, not AC_LANG, to initialize the stack. + * aclang.m4 (AC_LANG_PUSH): Dont't use m4_defn on undefined macros. + (AC_LANG_POP): Admit an argument specifying the language we quit + when popping. + Adjust Autoconf's AC_LANG_POPs. + * tests/tools.at (AWK portability): Don't depend on AC_INIT. + (autoconf --trace: user macros): Obviously I + meant TRACE1, not AC_TRACE1. + +2001-01-17 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_undefine, m4_popdef): Don't tolerate undefined + arguments. + (_m4_expansion_stack): Rename as... + (m4_expansion_stack): this, and change its value: instead of using + the pushdef stack to stack each *line* of the stack, each + definition contains the whole stack. I.e., to display the whole + stack, instead of popdefing and displaying each definition, just + display the current definition. + (m4_expansion_stack_push, m4_expansion_stack_pop): New. + * tests/atspecific.m4 (AT_CHECK_AUTOCONF): Let $2 be the expected + exit status. + * tests/m4sugar.m4 (m4_require: circular dependencies): New test. + +2001-01-17 Pavel Roskin <proski@gnu.org> + + * m4sugar.m4 (m4_normalize): New macro - superposition of + m4_flatten and m4_strip. + (m4_join): Use m4_normalize. + * acgeneral.m4 (AC_FOREACH): Use m4_normalize. + (AC_CONFIG_HEADERS): Normalize the first argument. + (AC_CONFIG_LINKS): Likewise. + (AC_CONFIG_SUBDIRS): Likewise. + +2001-01-17 Tim Van Holder <tim.van.holder@pandora.be> + + * acgeneral.m4 (_AC_OUTPUT_SUBDIRS): Quote $ac_sub_srcdir uses. + +2001-01-16 Akim Demaille <akim@epita.fr> + + Work around the Ultrix limitations on ``multiple redirections''. + Reported by Harlan Stenn. + + * acgeneral.m4 (_AC_EVAL_STDERR): New. + (_AC_PREPROC_IFELSE): Use it. + +2001-01-16 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_data_files): Fix the computation of PATH. + +2001-01-16 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_LOG_COMPLETE): Eve out from AC_OUTPUT. + (_AC_INIT_DEFAULTS, AC_OUTPUT): Use it. + +2001-01-16 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi: Lots of additions and changes. + (File Descriptors): New. + (Limitations of Make): New. + +2001-01-16 Akim Demaille <akim@epita.fr> + + * m4sh.m4 (AS_EXIT): Don't rely on exit == exit $?. + Reported by Tim Van Holder. + +2001-01-16 Akim Demaille <akim@epita.fr> + + * Makefile.am (editpl, editsh): Merge into... + (edit). + * m4sh.m4 (AS_UNAME): Eved out from... + * acgeneral.m4 (_AC_INIT_DEFAULTS): here. + (_AC_INIT_PACKAGE): Define AC_PACKAGE_NAME. + (_AC_INIT_PARSE_ARGS): AC_SUBST the PACKAGE_ variables. + Propagate their use in the executables and the test suite. + * tests/atgeneral.m4 (PATH): Include only absolute paths. + (AT_INIT): Use AS_UNAME. + +2001-01-16 Akim Demaille <akim@epita.fr> + + When default headers are used, check for their presence. + Suggested by Jim. + + * acgeneral.m4 (_AC_INIT_DEFAULTS): Don't define + ac_includes_default, since... + (_AC_INCLUDES_DEFAULT_REQUIREMENTS): this new macro does. + (AC_INCLUDES_DEFAULT): Require the former when default includes + are used. + (AC_CHECK_MEMBERS, _AC_CHECK_TYPE_NEW): Don't require + AC_HEADERS_STDC, that's a job for stupendous AC_INCLUDES_DEFAULT. + * acfunctions.m4 (AC_FUNC_MALLOC): Check for stdlib.h. + +2001-01-15 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi: Normalize sh samples. + +2001-01-15 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): Simplify the hairy display of the + identity of the tests. + +2001-01-15 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): When the suite failed, complain + before creating the debug scripts. + Create a log file. + When ignoring a test, display a reassuring `ok' for stressed + users, and say `skipped' instead. + Simply run `testsuite' with the failed tests instead of running + the debug scripts, this avoids having zillions of banners `Testing + Blabla 2.13' (another means to avoid these banners is to have the + test suite succeed :-). + +2001-01-15 Akim Demaille <akim@epita.fr> + + * sh.m4 (AS_BOX, _AS_BOX_LITERAL, _AS_BOX_INDIR): New. + * tests/atgeneral.m4: Use it. + +2001-01-15 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_VAR_INDIR_IFELSE): Move as... + * m4sh.m4 (AS_LITERAL_IF): this. + (AS_IFELSE): Rename as... + (AS_IF): this. + +2001-01-12 Akim Demaille <akim@epita.fr> + + With `expr's that return `0' on failures, the executable suffix is + `0'. Test and fix. + Reported by Assar Westerlund. + + * Makefile.am (maintainer-check): New target. + * tests/Makefile.am (maintainer-check, maintainer-check-posix) + (maintainer-check-c++, expr): Likewise. + * configure.in (EXPR): Look for it. + * tests/atgeneral.m4 (AT_CHECK): Propagate $2's default value. + * tests/compile.at (Extensions): New test. + * aclang.m4 (_AC_COMPILER_EXEEXT_DEFAULT, _AC_COMPILER_EXEEXT_O): + Distinguish files with or without a dot. + +2001-01-12 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Last changes for `configure.ac'. + (_AC_INIT_HELP, _AC_OUTPUT_SUBDIRS): Take `configure.ac' into + account. + * autoreconf.sh: Likewise. + +2001-01-11 Motoyuki Kasahara <m-kasahr@sra.co.jp> + + * acfunctions.m4 (AC_FUNC_MEMCMP): Missing comma in AC_TRY_RUN + invocation. + +2001-01-11 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_PROG_CXX_EXIT_DECLARATION): New. + (AC_PROG_CC, AC_PROG_CXX): Use it. + (AC_PROG_CC_STDC): Be sure to remove tmp files. + * tests/compile.at (AC_TRY_LINK_FUNC): Don't use exit to test it, + since it produces a prototype which conflicts with the one + computed by _AC_PROG_CXX_EXIT_DECLARATION. + * tests/semantics.at (AC_CHECK_FUNCS, AC_HAVE_FUNCS): Likewise. + (AC_HAVE_FUNCS): Test AC_HAVE_FUNCS! + +2001-01-11 Kevin Ryde <user42@zip.com.au> + + * autoconf.texi (Shellology): Fix an @end itemize, and a typo. + +2001-01-11 Kelly Anderson <tgcorp@attglobal.net> + + * autoconf.sh (M4): Handle PC drive letters. + * autoupdate.sh: Likewise. + +2001-01-11 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_PROG_F77): Add pgf90 to the list of compilers to + look for, after the other Fortran 90 compilers. + +2001-01-11 Akim Demaille <akim@epita.fr> + + * aclang.m4: Use m4_copy to duplicate macros. + (AC_LANG_PUSH): In order to have AC_LANG's simplifications + effective, be sure to let _AC_LANG be the old language before + calling AC_LANG. + +2000-12-25 Pavel Roskin <proski@gnu.org> + + * autoreconf.sh: s/localddir/localdir/. + Reported by Motoyuki Kasahara. + +2000-12-23 Akim Demaille <akim@epita.fr> + + * autoconf.sh: Promote `configure.ac' over `configure.in'. + * autoreconf.sh: Likewise. + * autoheader.sh: Ditto. + * autoupdate.sh: Similarly. + * doc/autoconf.texi: Adjust. + * tests/atspecific.m4: Be sure to remove configure.in. + Adjust the test suite to use `configure.ac'. + +2000-12-22 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_EVAL, AC_TRY_EVAL, AC_TRY_COMMAND): Be a + single statement, so that one can make pipes with AC_TRYs, just as + in 2.13. + +2000-12-20 Lars J. Aas <larsa@sim.no> + + * aclang.m4 (_AC_COMPILER_OBJEXT, _AC_COMPILER_EXEEXT_O): + Make the order of arguments for ls count by splitting the ls + command into a sequence of ls commands. + +2000-12-20 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_LANG_COMPILER_GNU): Be sure to have `choke me' on + the seventh column so that the SGI Fortran compiler really chokes + on it. + From Ezra Peisach. + +2000-12-20 Akim Demaille <akim@epita.fr> + + * tests/foreign.at (Autoconf & Libtool): Ignore Libtool version + 1.3.[0-5]. + * tests/compile.at (GNU Fortran 77): Use AS_EXIT. + +2000-12-20 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_CLEANUP_FILE_IFELSE): Fix the regexp: the + pattern ` state* ' was added many times for `*' was improperly + escaped. + (AT_INIT): Remove the data files before running the tests. + Define AT_data_files and output it. + (AT_SETUP): Don't. + (_m4_divert(TEST)): Remove, now useless. + +2000-12-20 Akim Demaille <akim@epita.fr> + + * aclang.m4: `dnl' the AC_LANG_PUSH and AC_LANG_POP. + (AC_PROG_CXXCPP, AC_PROG_CPP): Set the current language instead of + just asserting it, since these macros can be called directly. + Reported by Raja R. Harinath. + +2000-12-19 Pavel Roskin <proski@gnu.org> + + * doc/autoconf.texi (Installation Directory Variables): More info + on prefix and exec_prefix. + +2000-12-19 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_COMPILER_OBJEXT): Don't rely on + _AC_COMPILE_IFELSE which uses ac_objext in a `test -s'. + Reported by Lars J. Aas. + +2000-12-19 Akim Demaille <akim@epita.fr> + + * tests/compile.at (AC_PROG_CPP without warnings, GNU Fortran 77): + Use AC_TRY_COMMAND when running commands, to enrich the logs. + +2000-12-19 Akim Demaille <akim@epita.fr>, Mo DeJong <mdejong@cygnus.com> + + * aclang.m4 (_AC_COMPILER_EXEEXT_DEFAULT): New. + (_AC_COMPILER_EXEEXT_O): Extracted from... + (_AC_COMPILER_EXEEXT): here. Adjust. + +2000-12-19 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_CHECK): Make exit status report more + visible. + * tests/atspecific.m4 (AT_CHECK_AUTOCONF): Support FLAGS, STDOUT + and STDERR. + (AT_CHECK_CONFIGURE): Support plenty, cleanup defs when needed. + Spread their use in the whole suite. + Simplify a few AT_CLEANUPs. + +2000-12-19 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_CHECK): Accept if-failed and + if-not-failed. + * tests/atspecific.m4 (AT_CHECK_CONFIGURE): Use it in order to + dump config.log when configure failed. Before, the log was + reported only on success. + +2000-12-19 Akim Demaille <akim@epita.fr> + + * tests/foreign.at: New file. + +2000-12-19 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_BANNER, AT_CLEANUP): Formatting changes. + +2000-12-18 Pavel Roskin <proski@gnu.org> + + * Makefile.am: Add a comment explaining why suffix rules are not + used there. + +2000-12-15 Pavel Roskin <proski@gnu.org> + + * autoconf.sh: If the "allowed" pattern is not defined set it + to "^$". + * tests/tools.at (autoconf: forbidden tokens, basic): New test. + (autoconf: forbidden tokens): Renamed to ... + (autoconf: forbidden tokens, exceptions): ... this. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_PROG_CXXCPP, AC_PROG_CPP): Require AC_PROG_CXX/CC. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * tests/compile.at (GNU Fortran 77): G77 is a `yes'/`' var. + Reported by Ezra Peisach. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * tests/compile.at (GNU Fortran 77): s/g77/G77/. + Reported by Ezra Peisach. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * man/Makefile.am (.x.1): Fix to work properly with + builddir != srcdir. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_LANG(C), AC_LANG(C++), AC_LANG(Fortran 77)) + (AC_PROG_CPP, AC_PROG_CXXCPP, AC_PROG_GCC_TRADITIONAL) + (_AC_PROG_CC_G, AC_PROG_CC_C_O, _AC_PROG_CXX_G, AC_PROG_CC_STDC): + Don't use `${CC-cc}' since now the AC_REQUIRE machinery guarantees + that $CC is defined. And if not, it's a bug which must be + observable. + * acspecific.m4 (AC_SYS_LARGEFILE): Likewise. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_PREPROC_IFELSE): Use ac_status as set by + AC_TRY_EVAL. + (_AC_COMPILE_IFELSE, _AC_LINK_IFELSE, _AC_RUN_IFELSE): More alike, + using AS_IFELSE, and systematically AC_TRY_COMMAND when testing + something (for the logs). + +2000-12-15 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_PROG_PREPROC_WORKS): Use _AC_PREPROC_IFELSE. + * acgeneral.m4 (_AC_TRY_CPP): Its last use was that above, so + inline it into... + (_AC_PREPROC_IFELSE): here. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): Forget about `-n'. + Adjust so that `./testsuite -h 1 2' explains only tests 1 & 2. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_EVAL): New. + (AC_TRY_EVAL, AC_TRY_COMMAND): Use it. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_PREPROC_IFELSE, AC_PREPROC_IFELSE): New. + (AC_TRY_CPP): Use AC_PREPROC_IFELSE. + (AC_CHECK_MEMBER, AC_CHECK_DECL, _AC_CHECK_TYPE_NEW): Quote + properly. + * acheaders.m4 (AC_CHECK_HEADER): Quote properly, use + AC_PREPROC_IFELSE. + * acspecific.m4 (_AC_PATH_X_DIRECT): Use AC_PREPROC_IFELSE. + +2000-12-15 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_init): Catch `dnl'. + +2000-12-15 Pavel Roskin <proski@gnu.org> + + * m4sh.sh (AS_ERROR): Restore dnl at the end of the macro. + +2000-12-14 Pavel Roskin <proski@gnu.org> + + * tests/semantics.at (AC_CHECK_TYPES): There are two tests with + this name. Rename the second one to "AC_CHECK_TYPES: backward + compatibility" + (AC_TRY_LINK_FUNC): Removed. It's now in tests/compile.at. + (C keywords): Likewise. + (AC_PROG_CPP with warnings): Likewise. + (AC_PROG_CPP without warnings): Likewise. + +2000-12-14 Akim Demaille <akim@epita.fr> + + Put back AC_CYGWIN etc. under the responsibility of the + configure.in maintainer, but discourage its use. + + * acspecific.m4 (_AC_CYGWIN, _AC_MINGW32, _AC_EMXOS2): Rename as... + (AC_CYGWIN, AC_MINGW32, AC_EMXOS2): these. + AU defined on top of AC_CANONICAL_HOST and $host_os. + * tests/mktests.sh (update_exclude_list): Add AC_CYGWIN, + AC_MINGW32, and AC_EMXOS2. + +2000-12-13 Pavel Roskin <proski@gnu.org> + + * m4sugar.m4 (m4_file_append): Add a newline after _m4eof, + otherwise _m4eof is appended to the output on FreeBSD 4.0. + * tests/atgeneral.m4 (AT_INIT): Avoid using unbalanced "y" + in sed, use "s" instead. + * tests/mktests.sh: Don't use \? in sed - it's a GNU extension. + Use separate patterns for A[CU]_DEFUN and AC_DEFUN_ONCE. + +2000-12-13 Akim Demaille <akim@epita.fr> + + EXEEXT and OBJEXT don't need to know $CYGWIN etc. + + * acspecific.m4 (AC_EXEEXT, AC_OBJEXT, _AC_EXEEXT, _AC_OBJEXT): + Move as... + * aclang.m4 (AC_EXEEXT, AC_OBJEXT, _AC_COMPILER_EXEEXT) + (_AC_COMPILER_OBJEXT): these. + (_AC_COMPILER_EXEEXT): Use _AC_LINK_IFELSE. + Don't depend upon $CYGWIN and the like. + (_AC_COMPILER_OBJEXT): Model after _AC_COMPILER_EXEEXT. + Skip more extensions. + Use _AC_COMPILE_IFELSE. + +2000-12-12 Pavel Roskin <proski@gnu.org> + + * Makefile.am: Don't use suffix rules for perl and shell + scripts. Use explicit rules instead. + +2000-12-12 Pavel Roskin <proski@gnu.org> + + * autoscan.pl (init_tables): Allow spaces on the right hand side + in autoscan tables. Die if there are no spaces at all. + (scan_c_file): Use \b instead of \W so that keywords match at + the beginning and the end of the line. + (scan_sh_file): Likewise. + (scan_makefile): Likewise. Use \B to match before `-l'. + (output): Suggest AC_CONFIG_HEADER if any C/C++ sources are + found. + * acidentifiers: Update macros for structure members st_blksize + and st_rdev. + +2000-12-12 Akim Demaille <akim@epita.fr> + + * tests/compile.at (GNU Fortran 77): Be robust to compilers that + choke on `--version'. + +2000-12-12 Akim Demaille <akim@epita.fr> + + * tests/suite.at: Run `tools.at' first. + +2000-12-12 Akim Demaille <akim@epita.fr> + + * tests/aclocal.m4 (AC_STATE_SAVE): Use a more precise regexp to + keep envvars. + +2000-12-12 Akim Demaille <akim@epita.fr> + + AS_ERROR was not properly saving data in the log file. + + * sh.m4 (AS_WARN, AS_ERROR): Use AS_MESSAGE. + (_AS_ECHO): Fix quotation. + (AS_MESSAGE): Use `as_me'. + * acgeneral.m4: More banners in the log. + (_AC_INIT_DEFAULTS): Compute as_me before using it. + +2000-12-08 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (System Services) <AC_PATH_XTRA>: Adjust the + documentation about X_DISPLAY_MISSING to the code. + +2000-12-07 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): More robust computation of + ac_tests_pattern. + Reported by Andrej Borsenkow. + +2000-12-07 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_EXEEXT): Skip *.pdb. + From Paul Berrevoets. + +2000-12-07 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_CHECK): Bad typo: assign `exit 1' to + at_continue if something failed, not `:'. + * tests/semantics.at (AC_PATH_XTRA): New. + * acspecific.m4 (_AC_PATH_X): New, extracted form AC_PATH_X. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * configure.in: Bump version to 2.49c. + +2000-12-06 Akim Demaille <akim@epita.fr> + + Version 2.49b. + +2000-12-06 Akim Demaille <akim@epita.fr> + + Stop playing with FDs in Autotest. + + * tests/atgeneral.m4 (AT_INIT): Set up FD 5. + (AT_CHECK): Instead of using exec to globally change the FDs of + `testsuite', enclose the body of the test into a + `(..) >stdout 2>stderr'. + In every case, when verbose, display the differences between + expected and observed (stdout, stderr, exit status). + Let `0' be the default for EXIT-STATUS. + Support EXIT-STATUS == `ignore'. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * tests/tools.at (autoconf: forbidden tokens): Adjust expected + result. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * man/config.guess.x: New file. + * man/config.sub.x: New file. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * tests/aclocal.m4 (AT_STATE_SAVE): Don't even try to preserve + egrep error messages, AT_CHECK will find them. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Usual Tools) <awk>: `for' on + arrays is nondeterministic across AWK implementations. + * tests/tools.at (autoconf: forbidden tokens): Sort the error + message to guarantee its uniqueness. + +2000-12-06 Akim Demaille <akim@epita.fr> + + The SunOS' egrep fails to process properly the `egrep' invocations + of the test suite. + + * tests/aclocal.m4 (AC_STATE_SAVE): If egrep fails, remove the + output file. + * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): Don't check `state-*' + if the files are not present. + + * m4sugar.m4 (m4_join): Rename as... + (m4_smash): this. + * tests/aclocal.m4 (join): Move as... + * m4sugar.m4 (m4_flatten): this. + * autoconf.sh (trace.m4): Rename m4_smash as m4_flatten. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * autoconf.sh (task trace): s/m4/$M4/. + * autoheader.sh: When loading trace.sh, catch errors and exit with + a decent error message. + * tests/tools.at: Be sure to test autoconf --trace before + autoheader. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_CHECK): Fix the m4_ifval invocation. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_LANG): Be `smart': don't issue the sh code if the + current language did not change. + (AC_LANG_ASSERT): New. + (AC_PROG_CPP, AC_PROG_CXXCPP): Assert the language. + (_AC_PROG_F77_V, _AC_F77_NAME_MANGLING): Don't require + AC_PROG_F77, the code you include does it. + (AC_F77_LIBRARY_LDFLAGS): Set the language. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (ifelse): Rename as... + (m4_if): this. + * autoconf.m4 (ifelse): Restore. + +2000-12-06 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_dquote, m4_pattern_forbid, m4_pattern_allow) + (m4_cr_letters, m4_cr_LETTERS, m4_cr_Letters, m4_cr_digits) + (m4_cr_symbols1, m4_cr_symbols2, m4_re_string, m4_re_word) + (m4_init): New macros. + (m4_token_allow): Remove. + * acgeneral.m4: Don't push BODY into the diversion stack. + (AC_PLAIN_SCRIPT): Do it. + Call m4_init, define the Autoconf patterns. + (AC_INIT): Use AC_PLAIN_SCRIPT. + Remove the useless `dnl' (those where the current diversion is + KILL). + * autoconf.sh (m4_common): Fix quotation. + (finalize.awk): Load forbidden.rx and allowed.rx. + Split the line into tokens, and check their validity. + * tests/tools.at (Forbidden tokens): Adjust. + +2000-12-05 Bob Wilson <bwilson@tensilica.com> + + * acspecific.m4 (_AC_OBJEXT, _AC_EXEEXT): Ignore .d files produced + by CFLAGS=-MD. + +2000-12-05 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_PROG_F77): Temporarily set ac_ext to F to run + _AC_LANG_COMPILER_GNU. + From Steven G. Johnson. + * tests/compile.at (GNU Fortran 77): New test. + +2000-12-05 Akim Demaille <akim@epita.fr> + + * tests/tools.at (autoupdate): Strengthen and check autoupdate's + idempotency. + +2000-12-05 Akim Demaille <akim@epita.fr> + + * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): s/cp -f/mv -f/. + +2000-12-01 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Don't escape + backquotes in AC_MSG_ERROR. Fix error message. + +2000-12-01 Pavel Roskin <proski@gnu.org> + + * tests/atgeneral.m4 (AT_INIT): Use ${CONFIG_SHELL-/bin/sh} + to run the testsuite from the debug scripts. + Suggested by Alexandre Oliva. + +2000-11-30 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Assignments): Don't use $? from an + assignment. + +2000-11-30 Akim Demaille <akim@epita.fr> + + * sh.m4 (AS_EXIT): Don't rely on false exiting 1. + Actually, always use `(exit $val); exit', don't try to be tricky. + * doc/autoconf.texi (Limitations of Builtins) <false>: new. + +2000-11-30 Akim Demaille <akim@epita.fr> + + * sh.m4 (_AS_EXPR_PREPARE): Don't rely on the exit status of a + back quote evaluation since the very system for which the test was + written does not propagate it. Groumph! + +2000-11-30 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_EXEEXT): Also remove conftest$ac_exeext. + Reported by Pavel. + +2000-11-30 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_EXEEXT, _AC_OBJEXT): Make the two macros more + alike: a loop over a sorted list of possible files. + Don't cleanup on errors, the trap will do it. + Cleanup when there are no errors. + (_AC_EXEEXT): Use the empty string instead of `no' as the cached + value. + Be sure to prefer `.exe' to `' when the two are observable. + Suggested by Lars and Earnie. + +2000-11-30 Akim Demaille <akim@epita.fr> + + When using Cygwin, in spite of all their efforts, it may happen + that `confestval' be read in binary mode. The shell then fails to + properly strip the \r\n. + Reported by Lars J. Aas. + + * aclang.m4 (AC_LANG_INT_SAVE): Don't add any trailing new line, + and close the file. + Suggested by Peter Eisentraut. + +2000-11-30 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Systemology): New section. + Some about QNX 4. + +2000-11-30 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Special Shell Variables): Document RANDOM. + +2000-11-30 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Usual Tools): Some about cp + and mv, thanks to Ian. + +2000-11-29 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_OBJEXT): Skip *.tds, special case .o and + .obj. + Suggested by Lars. + +2000-11-29 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Fix the portability of + the default assignment of CONFIG_FILES, CONFIG_HEADERS, + CONFIG_LINKS and CONFIG_COMMANDS. + +2000-11-29 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CACHE_SAVE): Use the `clear' trick to work + around broken seds. + (_AC_OUTPUT_HEADERS, _AC_OUTPUT_FILES): Rename the sed labels to + match the Autoconf documentation. + +2000-11-29 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Shell Substitutions): More on the variations + around ${foo=bar}. + (Assignments): Rewrite as a summary of the previous section. + * acgeneral.m4 (AC_CACHE_SAVE): Be protected against the Solaris' + `${foo='${bar}'}' bug. + +2000-11-29 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_HEADERS, _AC_OUTPUT_FILES): Don't use + `... echo "error: \\\`$f'" ...` + as it's not portable to BSDI 1.3. + Do this instead: + `... echo "error: $f" ...` + Reported by Daniele Arena. + +2000-11-29 Akim Demaille <akim@epita.fr> + + QNX 4.2.5's expr always exits 1 when `:' is used with parens. + + * doc/autoconf.texi (Limitations of Usual Tools) <expr>: More + information, thanks to Paul Berrevoets, Paul Eggert and David + Morgan. + * sh.m4 (_AS_EXPR_PREPARE): New. + (AS_DIRNAME): Use it. + +2000-11-29 Akim Demaille <akim@epita.fr> + + sizeof (struct {char a,b; }) is not required to be 2. + Reported by Johan Danielsson. + + * tests/semantics.at (AC_CHECK_SIZEOF): Define charchar as an + array of 2 chars. + Suggested by Alexandre. + +2000-11-29 Akim Demaille <akim@epita.fr> + + Provide a means to display banners in the test suite. + + * tests/atgeneral.m4 (AT_INIT): Initialize `AT_banner_ordinal'. + Execute the epilogue of the tests only if a test was run. + Don't build the value of `at_tests_all' with a for loop: expand + `AT_TESTS_ALL'. + (AT_SETUP): Build `AT_TESTS_ALL'. + (AT_BANNER): New. + Adjust all the former banners to use it. + (AT_CHECK): Don't trace the decoding of `$?'. + +2000-11-29 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_DEFINE, AT_UNDEFINE, AT_SHIFT) + (AT_INCLUDE): Remove, use the m4_ macros. + +2000-11-29 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (ifval, ifset, ifdef, ifndef, m4_ifvanl): Rename as... + (m4_ifval, m4_ifset, m4_ifdef, m4_ifndef, m4_ifvaln): this. + (m4_n): New macro. + (m4_ifvaln): Use it. + * autoconf.m4 (ifdef): Restore it. + +2000-11-29 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_errprint, divnum, errprint, esyscmd): Rename as... + (m4_errprintn, m4_divnum, m4_errprint, m4_esyscmd): this. + * autoconf.m4: Restore them. + +2000-11-28 Pavel Roskin <proski@gnu.org> + + * doc/autoconf.texi (Fortran 77 Compiler Characteristics): + Don't suggest obsolete AC_LANG_FORTRAN77. + (Language Choice): Better preamble. + +2000-11-28 Pavel Roskin <proski@gnu.org> + + * doc/install.texi: Minor changes to eliminate TeX warnings. + * doc/autoconf.texi: Likewise. Typo fixes. + +2000-11-23 Akim Demaille <akim@epita.fr> + + * tests/atconfig.in: Move code into... + * tests/atgeneral.m4 (AT_INIT): here. + Use AS_SHELL_SANITIZE. + +2000-11-23 Akim Demaille <akim@epita.fr> + + Have the test suite list of the test groups and their references. + + * tests/atgeneral.m4 (_m4_divert(SUITE_PRO)): Remove, replaced + by... + (_m4_divert(DEFAULT), _m4_divert(OPTIONS), _m4_divert(HELP)) + (_m4_divert(SETUP)): these. + (_m4_divert(SUITE_EPI)): Rename as... + (_m4_divert(TAIL)): this. + (AT_INIT): Adjust to the new diversions. + Insert the magic number. + Accept test groups as cli argument. + List the test groups. + Rename TESTS, test, and tests as at_tests_all, at_test, and + at_tests. + Have the debug scripts pass options to test suite. + Remove their banner. + * tests/atspecific.m4: Don't divert to 0. + * suite.at: Don't insert the magic number. + +2000-11-23 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_divert, m4_undivert): Support named diversions. + * tests/atgeneral.m4 (_m4_divert(SUITE_PRO), _m4_divert(TESTS)) + (_m4_divert(SUITE_EPI), _m4_divert(TEST)): New diversions. + Push the first two diversions. + (AT_INIT): Don't. + (AT_INIT, AT_SETUP, AT_CLEANUP): Adjust to use the named + diversions. + +2000-11-23 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_CLEANUP): Factor the computation of + at_test_count into... + (AT_INIT): here. + Use an sh variable, at_data_files, instead of an hard coded list. + +2000-11-23 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_CLEAN_FILE_IFELSE, AT_CLEANUP_FILE) + (AT_CLEANUP_FILES): New macros. + (AT_SETUP, AT_CHECK, AT_CLEANUP): Use them. + (AT_CHECK): Fix a use of at_verbose. + * tests/atspecific.m4 (AT_CHECK_AUTOCONF, AT_CHECK_AUTOHEADER) + (AT_CHECK_CONFIGURE): New macros. + +2000-11-23 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT) <at_verbose>: Be a :/echo variable. + <at_silent>: Remove. + (AT_CLEANUP): Clean up the diversion use. + +2000-11-23 Akim Demaille <akim@epita.fr> + + Factor part of the prologue of the tests. + + * tests/atgeneral.m4 (AT_SETUP, AT_CLEANUP): No longer handle + at_stop_on_error. + (AT_INIT): After having checked whether the test failed, break out + of the loop if requested (-e). + +2000-11-23 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_SETUP): Don't build at-check-line, that's + AT_CHECK's job. + Remove the code depending upon `at_skip_mode': it's unused. + +2000-11-23 Akim Demaille <akim@epita.fr> + + * tests/atconfig.in: Remove the `snippet' marks, there are no + longer used. + * tests/atgeneral.m4: Likewise. + +2000-11-23 Akim Demaille <akim@epita.fr> + + Factor the epilogue of the tests. + + * tests/atgeneral.m4 (AT_CLEANUP): Move the reading of at_status + into... + (AT_INIT): here, at the end of the `case'. + +2000-11-23 Akim Demaille <akim@epita.fr> + + The debug scripts are only wrapper around testsuite, asking for a + specific test. + + * tests/atgeneral.m4 (AC_INIT) <at_debug>: New variable, new + option, -d, to disable the creation of the debug scripts (when + testsuite was already launched from one). + <at_test_count>: Really compute it instead of using the number of + the last test run. + +2000-11-23 Akim Demaille <akim@epita.fr> + + Transform Autotest's body into a `for test; case $test'. + As a known side effect, currently any code outside + AT_SETUP/AT_CLEANUP is discarded. + + * acgeneral.m4 (_m4_divert(KILL)): Move to... + * m4sugar.m4: here. + * tests/atgeneral.m4 (AT_INIT): Use m4_divert_push/pop instead of + m4_divert. + Put all the tests inside a for;case. + Define TESTS. + (AT_SETUP, AT_CLEANUP): Open/close each case. + +2000-11-23 Akim Demaille <akim@epita.fr> + + Move divert and undivert into m4_. + + * m4sugar.m4 (m4_divert, divert, undivert): Rename as... + (m4_divert_text, m4_divert, m4_undivert): this. + * autoconf.m4 (divert, undivert): Restore them for user macros only. + +2000-11-23 Akim Demaille <akim@epita.fr> + + Move Autotest on top of M4sh. + + * tests/atgeneral.m4: Import M4sh. + Adjust the differences on the names of the builtins (define etc.). + (AT_CASE): Remove, use m4_case. + (AT_SETUP): Don't use `AT_group_description', `$1' is OK. + * tests/atspecific.m4 (m4_for, m4_foreach): Remove, use those of + M4sugar. + * tests/m4sugar.at: Strengthen the quotation and adjust to the new + macro names. + * tests/m4sh.at: Ditto. + * tests/torture.at: Ditto. + * tests/base.at: Ditto. + * m4sh.m4: Import M4sugar. + * autoconf.m4: Don't import M4sugar, M4sh does. + +2000-11-20 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_RUN_IFELSE): `==' in test is not portable, + replace with `='. + +2000-11-17 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_DEFAULTS): Also include `PATH' and + `/bin/machine' in the log. + +2000-11-17 Akim Demaille <akim@epita.fr> + + Let AC_TRY_RUN be more verbose + + * acgeneral.m4 (_AC_RUN_IFELSE): Instead of canceling the output + of the test program, save it into the log. + Save the exit status, and report it in the log when non zero. + Just use `(./conftest)' instead of `(./conftest; exit)'. + +2000-11-17 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_DEFAULTS) <ac_includes_default>: Include + sys/stat.h. + * acspecific.m4 (AC_STRUCT_ST_BLKSIZE, AC_STRUCT_ST_BLOCKS) + (AC_STRUCT_ST_RDEV): Simplify. + * acfunctions.m4 (AC_FUNC_MMAP): Include sys/stat.h unconditionally. + * doc/autoconf.texi (Default Includes): Adjust. + (Particular Structures) <AC_STRUCT_ST_BLKSIZE, AC_STRUCT_ST_RDEV>: + Adjust. + +2000-11-16 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Usual Tools) <expr>: + expr 'a' : '\(b\)'. + From Paul Eggert. + +2000-11-16 Akim Demaille <akim@epita.fr> + + Reorder the test suite so that low level features are tested + before high level ones. + + * tests/semantics.at (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS): + (missing templates): Move to... + * tests/torture.at: here. + Reorder the file so that the torture test is last. + * tests/semantics.at (AC_TRY_LINK_FUNC, AC_PROG_CPP with warnings) + (AC_PROG_CPP without warnings): Move to... + * tests/compile.at: here, new file. + * tests/suite.at: Run `torture' and then `compile' before + `semantics'. + +2000-11-16 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_SYS_LARGEFILE): _AC_SYS_LARGEFILE_SOURCE no + longer exist. + +2000-11-16 Akim Demaille <akim@epita.fr> + + POSIX doesn't require s/[^/]// to work. + From Paul Eggert and Johan Danielsson. + + * doc/autoconf.texi (Limitations of Usual Tools) <sed>: + Reorganize. Document this issue. + * autoupdate.sh (dir): Use `,' as separator instead of `/' + * autoreconf.sh: Likewise. + * autoupdate.sh: Ditto. + +2000-11-16 Paul Eggert <eggert@twinsun.com> + + * m4/largefile.m4 (_AC_SYS_LARGEFILE_SOURCE): Remove, replaced by... + (_AC_SYS_LARGEFILE_TEST_INCLUDES): this. + (AC_SYS_LARGEFILE_MACRO_VALUE): Use AC_LANG_PROGRAM instead of + _AC_SYS_LARGEFILE_SOURCE, i.e., don't pass + _AC_SYS_LARGEFILE_TEST_INCLUDES by default: this isn't desirable + when checking for fseeko. + (AC_SYS_LARGEFILE): Pass AC_SYS_LARGEFILE_TEST_INCLUDES to + _AC_SYS_LARGEFILE_MACRO_VALUE, since it no longer does this for us. + +2000-11-16 Akim Demaille <akim@epita.fr> + + Provide a means for escaping the forbidden patterns test. + + * tests/tools.at (Forbidden tokens): Test m4_token_allow. + * m4sugar.m4 (m4_file_append, m4_token_allow): New macros. + * autoconf.sh (task script): Pass `tmp' and `verbose' to + finalize.awk. + (finalize.awk::check_patterns): Eve out from the body. + (finalize.awk): Read `$tmp/tokens_allowed', and don't complain for + these exceptions. + +2000-11-14 Paul Eggert <eggert@twinsun.com> + + * acspecific.m4 (AC_SYS_LARGEFILE): Don't worry about + whether fseeko and ftello are properly declared. + * acfunctions.m4 (AC_FUNC_FSEEKO): New macro, which worries about + fseeko (and presumably ftello). Do not set _XOPEN_SOURCE; that + causes too many problems in practice. + * acfunctions (fteelo, fseeko): Trigger AC_FUNC_FSEEKO. + * doc/autoconf.texi: Adjust. + +2000-11-14 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Builtins): Comment `true'. + +2000-11-14 Akim Demaille <akim@epita.fr> + + * BUGS: New file. + Be sure to read this file if you're using a non released Autoconf. + * tests/tools.at (Syntax of the scripts): The non built tools are + in `$top_srcdir', not `..'. + (autoconf --trace): When using `-i' we need the src tree, not the + build tree. + +2000-11-14 Akim Demaille <akim@epita.fr> + + A single m4_require is enough. + + * m4sugar.m4 (_m4_require): $2 defaults to $1. + Rename as... + (m4_require): this. + * acgeneral.m4 (_AC_REQUIRE): Remove, use m4_require if you want + to get into the gory details. + +2000-11-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_DEFAULTS_ENVIRONMENT): Rename as... + * m4sh.m4 (AS_SHELL_SANITIZE): this. + +2000-11-14 Akim Demaille <akim@epita.fr> + + * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): Don't neutralize + autoconf's warnings. + +2000-11-14 Akim Demaille <akim@epita.fr> + + Set AC_LANG_PREPROC_REQUIRE which replaces AC_REQUIRE_CPP. + The main difference is that the former requires AC_LANG_COMPILER. + + * aclang (AC_LANG_PREPROC, AC_LANG_PREPROC(C), AC_LANG_PREPROC(C++)) + (AC_LANG_PREPROC(Fortran 77), AC_LANG_PREPROC_REQUIRE): New + macros. Issue a warning when looking for the Fortran 77 + preprocessor instead of an error. + (AC_LANG_COMPILER): Check that it is run before the corresponding + AC_LANG_PREPROC. + (AC_PROG_C + (AC_LANG_COMPILER_REQUIRE): Don't call directly + AC_LANG_COMPILER(_AC_LANG), rather invoke AC_LANG_COMPILER so that + the generic code in AC_LANG_COMPILER is run. + (AC_REQUIRE_CPP): Use AC_LANG_PREPROC_REQUIRE. + (AC_PROG_CC, AC_PROG_CXX): Don't require being run before the + corresponding AC_LANG_PREPROC: AC_LANG_COMPILER does it. + + + Propagate AC_LANG_PREPROC_REQUIRE. + + * acgeneral.m4 (AC_TRY_CPP, AC_EGREP_CPP): Use it instead of + AC_REQUIRE_CPP. + * acspecific.m4 (_AC_DECL_YYTEXT, AC_PATH_X): Don't + AC_REQUIRE_CPP, inner macro will do it. + * aclang.m4 (AC_PROG_GCC_TRADITIONAL, AC_C_STRINGIZE) + (AC_C_PROTOTYPES): Likewise. + (AC_C_STRINGIZE): Yeeks! The body of AC_CACHE_CHECK was not + quoted. Use @%:@ do assist Emacs. + + + For some reason (don't ask), this revamping revealed that + AC_PROG_CC_STDC, because of the `break', does not clean its tmp + files. + + * aclang.m4 (AC_PROG_CC_STDC): Extract the creation of conftest.c + out of AC_COMPILE_IFELSE. + Be sure to clean the tmp files. + +2000-11-14 Akim Demaille <akim@epita.fr> + + * tests/m4sh.at (AS_DIRNAME & AS_DIRNAME_SED): Simplify. + +2000-11-14 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AC_FUNC_ALLOCA): Don't require AC_PROG_CPP, + since (i) you actually need a compiler, (ii) AC_TRY_LINK handles + it. + * acheaders.m4 (AC_HEADER_STDC): Don't require AC_PROG_CPP, + AC_TRY_CPP does it. + +2000-11-14 Akim Demaille <akim@epita.fr> + + Create acheaders.m4. + + * acgeneral.m4 (AC_CHECK_HEADER, AC_CHECK_HEADERS) + (AH_CHECK_HEADERS): Move to... + * acheaders.m4: here, a new file. + * acspecific.m4 (_AC_CHECK_HEADER_DIRENT, AH_CHECK_HEADERS_DIRENT) + (AC_HEADER_DIRENT, AC_HEADER_MAJOR, AC_HEADER_STAT, AC_HEADER_STDC) + (AC_HEADER_SYS_WAIT, AC_HEADER_TIME) + (_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H) + (_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL, AC_HEADER_TIOCGWINSZ): Move + to... + * acheaders.m4: here. + +2000-11-14 Akim Demaille <akim@epita.fr> + + Move AC_MSG_* into M4sh. + + * acgeneral.m4 (_AC_SH_QUOTE, _AC_SH_QUOTE_IFELSE, _AC_ECHO): Move + to... + * m4sh.m4 (_AS_QUOTE, _AS_QUOTE_IFELSE, _AS_ECHO): here. + (AS_MESSAGE, AS_WARN, AS_ERROR): New. + * acgeneral.m4 (AC_MSG_NOTICE, AC_MSG_WARN, AC_MSG_ERROR): Use them. + (AC_FD_MSG, AC_FD_LOG): Be AU_ALIAS'es of... + (AS_MESSAGE_FD, AS_MESSAGE_LOG_FD): new. + Adjust all dependencies. + +2000-11-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Spread some AS_EXIT and AC_MSG_ERROR. + (AC_OUTPUT): Don't play with trap, use ac_clean_files. + +2000-11-14 Akim Demaille <akim@epita.fr> + + Use AC_MSG_ERROR in `config.status', but adjust AC_MSG_* to use $0 + instead of hard coded `configure'. + + * acgeneral.m4 (AC_COPYRIGHT): s/configure.in/__file__/. + (_AC_INIT_DEFAULTS_FDS): Append to AC_FD_LOG instead of creating + it. No longer insert the configure banner. + (_AC_INIT_DEFAULTS): Create config.log with the banner. + Define `as_me'. + (_AC_INIT_PARSE_ARGS, _AC_INIT_PREPARE, AC_MSG_NOTICE) + (AC_MSG_CHECKING, AC_MSG_RESULT, AC_MSG_RESULT_UNQUOTED) + (AC_MSG_WARN, AC_MSG_ERROR, AC_MSG_ERROR, AC_TRY_CPP) + (_AC_COMPILE_IFELSE, _AC_LINK_IFELSE, _AC_RUN_IFELSE) + (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS, _AC_PROG_F77_V_OUTPUT): Use + `$as_me' instead of `configure'. + (AC_OUTPUT): Get rid of the UCA, and of the empty line when + dumping confdefs.h into config.log. + (_AC_OUTPUT_CONFIG_STATUS): Use _AC_INIT_DEFAULTS_FDS. + Print a banner. + Use AC_MSG_ERROR and AC_MSG_NOTICE. + * acgeneral.m4 (AC_CACHE_LOAD, _AC_OUTPUT_FILES, _AC_OUTPUT_LINKS) + (_AC_OUTPUT_HEADERS): Use AC_MSG_NOTICE. + * tests/semantics.at (missing templates): Adjust. + +2000-11-14 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (autoconf Invocation): Explain `-W error' + gives back traces. + +2000-11-11 Pavel Roskin <proski@gnu.org> + + * acfunctions.m4 (AC_CHECK_FUNCS): Add missing m4 quotes. + (AC_FUNC_GETPGRP): Likewise. + * acspecific.m4 (AC_AIX): Likewise. + * m4/init.m4 (AM_INIT_AUTOMAKE): Likewise. + * m4/missing.m4 (AM_MISSING_PROG): Likewise. + * m4/sanity.m4 (AM_SANITY_CHECK): Likewise. + +2000-11-11 Pavel Roskin <proski@gnu.org> + + * acfunctions.m4: Always quote first argument of AC_MSG_ERROR, + AC_MSG_WARN, AC_MSG_CHECKING, AC_MSG_RESULT, + AC_MSG_RESULT_UNQUOTED. + * acgeneral.m4: Likewise. + * aclang.m4: Likewise. + * acspecific.m4: Likewise. + * configure.in: Likewise. + * doc/autoconf.texi: Likewise. + +2000-11-10 Pavel Roskin <proski@gnu.org> + + * doc/autoconf.texi (Particular Structures): Fix examples for + AC_STRUCT_ST_BLKSIZE and AC_STRUCT_ST_RDEV. + +2000-11-10 Pavel Roskin <proski@gnu.org> + + * doc/autoconf.texi (Limitations of Usual Tools): Don't use + uncommon abbreviations. + +2000-11-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Builtins): Some information + about `trap'. + Document the FreeBSD bug observed by Pavel. + +2000-11-10 Pavel Roskin <proski@gnu.org> + + * autoscan.pl (scan_files): Eliminate a warning if no C files + are found. + (output): Likewise. Use AC_CONFIG_SRCDIR and AC_CONFIG_FILES + instead of old-style arguments for AC_INIT and AC_OUTPUT. + +2000-11-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Usual Tools): `&' in sed's rhs + is portable. + +2000-11-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Shell Substitutions): Some information about + Solaris' sh handling of ``foo=${foo='}'}'' collected by Alexandre, + reported by David Taylor. + +2000-11-10 Akim Demaille <akim@epita.fr> + + * tests/m4sh.at (Negated classes in globbing): New test. + +2000-11-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Builtins): `for i; do'. + +2000-11-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Shellology): Some about /usr/xpg4/bin/sh on + Solaris. + Sort the entries. + Some words about POSIX vs Bourne shell. + From Russ Allbery and Robert Lipe. + +2000-11-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Shell Substitutions): Split into... + (Shell Substitutions, Assignments): these. + Move them before `Special Shell Variables'. + (Shell Substitutions): Include information on `$()' from Russ + Allbery. + +2000-11-10 Akim Demaille <akim@epita.fr> + + When running + + AC_INIT + AC_PROG_CC + AC_LANG_COMPILER_REQUIRE + + AC_PROG_CC is expanded twice, because AC_PROG_CC provides + `AC_PROG_CC', and not `AC_LANG_COMPILER(C)' as expected by + AC_LANG_COMPILER_REQUIRE. + + * aclang.m4 (AC_LANG_COMPILER(C)): Instead of calling AC_PROG_CC, + require it. + (AC_LANG_COMPILER(C++), AC_LANG_COMPILER(Fortran 77)): Likewise. + +2000-11-10 Akim Demaille <akim@epita.fr> + + * m4sh.m4 (AS_MKDIR_P, AS_DIRNAME_SED): Don't shell quote $1. + Adjust callers. + Reported by Paul Eggert. + * tests/m4sh.at: Sort. + +2000-11-09 Pavel Roskin <proski@gnu.org> + + * install-sh: Use ":" instead of "true". + +2000-11-09 Pavel Roskin <proski@gnu.org> + + * tests/tools.at (Syntax of the scripts): Check "autoreconf" + only once. Check "install-sh", "mkinstalldirs" and "missing". + +2000-11-09 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_COMPUTE_INT_COMPILE): Use ":" instead of + "true". + * tests/atgeneral.m4 (AT_INIT): Likewise. + * tests/tools.at (Syntax of the scripts): Likewise. + +2000-11-09 Pavel Roskin <proski@gnu.org> + + * tests/m4sugar.at (m4_warn): Adjusted to accept stack dump when + -Werror is used. + +2000-11-08 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (_m4_expansion_stack_dump): Really rename as... + (m4_expansion_stack_dump): this. + +2000-11-08 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_LANG_PROGRAM(Fortran 77): Complain about $1 having + a value. + Reported by Paul Martinolich. + (_AC_LANG_COMPILER_GNU): Pass the test as the body of + AC_LANG_PROGRAM, not the prologue. + +2000-11-07 Pavel Roskin <proski@gnu.org> + + * autoconf.sh: Temporarily disable recognizing of abbreviated + long options - it's hard to maintain them by hand. + * autoheader.sh: Likewise. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * ifnames.sh: Likewise. + +2000-11-07 Akim Demaille <akim@epita.fr> + + * aclang.m4 (ac_cv_prog_gcc, ac_cv_prog_gxx, ac_cv_prog_g77): + Be AU_DEFUN'd, not AU_ALIAS'd. + Reported by Ralf Corsepius. + * tests/mktests.sh (exclude_list): Skip these variables. + +2000-11-07 Akim Demaille <akim@epita.fr> + + m4_syscmd was reestablished as `syscd' intead of `syscmd' because + instead of `s/^m4_//', m4_copy_unm4 was running `s/[m4_]//'. + + * m4sugar.m4 (m4_copy_unm4): Fix. + +2000-11-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECKING): Is not an alias of AC_MSG_NOTICE, + hence use AU_DEFUN, not AU_ALIAS. + +2000-11-03 Jim Meyering <meyering@lucent.com> + + * acfunctions.m4 (AC_FUNC_FNMATCH): Add a test to detect + the d*/*1 vs d/s/1 bug. + Add a couple more test cases to catch bugs in glibc 2.1.95. + Include fnmatch.h unconditionally + Mention the GNU C library. + From Paul Eggert. + +2000-11-03 Akim Demaille <akim@epita.fr> + + AC_CONFIG_AUX_DIR_DEFAULTS overrides AC_CONFIG_AUX_DIR. Ouch. + Reported by Paul Martinolich. + + * acgeneral.m4 (AC_PROVIDE): Don't forget to `m4_provide'!!! + Tss, novice... + * tests/base.at (AC_REQUIRE & AC_PROVIDE): New test. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_location): When using its value, don't use + `m4_defn', since m4_location is not a variable, it's a macro which + expands to __file__:__line__. + * tests/m4sugar.at (m4_warn): New test. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * tests/tools.at (unexpanded macros): Strengthen. + * autoconf.sh (finalize.awk): Use `sub' instead of `index' + + `substr'. + More comments. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * Makefile.am (.m4.m4f): Check that processing produces only + comments and empty lines. + Check that freezing produced no output. + * m4sugar.m4: Commentize what was not. + * m4sh.m4: Likewise. + * aclang.m4: Formatting changes. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * autoconf.m4 (define): Reestablish only after having read the + `ac' files. + Adjust all the Autoconf code to use `m4_define', not `define'. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AU_ALIAS): Don't forget to pass the arguments to + the new macro... + Reported by Ezra Peisach. + * tests/semantics.m4 (AC_HAVE_FUNCS): New test. + * tests/tools.at (autoupdate): As a benign side effect, updating a + macro that takes no argument produces `UPDATED([])', no longer + `UPDATED()'. Adjust the test. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * autoconf.m4: Instead of reactivating the macros before reading + Autoconf's files, do it afterwards, so that Autoconf promotes the + right use, but users still can use the old names. + Of course this revealed numerous non updated uses of old macros in + Autoconf's files. Adjust them. + But for the time being, keep `define' alive for Autoconf. + +2000-11-03 Akim Demaille <akim@epita.fr> + + AC_REQUIRE and AC_DEFUN_ONCE don't work properly together. This + caused strange messages about AC_ARG_PROGRAM. + Reported by Jim Meyering. + + * acgeneral.m4 (AC_DEFUN_ONCE): Fix the indirection to + m4_defun_once. + * m4sugar.m4 (m4_defun_once): Also define + `m4_location(MACRO-NAME)'. s/ac_warn/m4_warn/. + Use `m4_defn' to read `m4_location'. + * tests/base.at (AC_REQUIRE & AC_DEFUN_ONCE): Two new tests. + +2000-11-03 Akim Demaille <akim@epita.fr> + + Set up config.log earlier so that AC_MSG_ERROR and AC_MSG_WARN can + be used early. + + * acgeneral.m4 (_AC_INIT_DEFAULTS): Call `_AC_INIT_PREPARE_FDS'. + (_AC_INIT_PREPARE): Don't. + (_AC_INIT_PREPARE_ENVIRONMENT, _AC_INIT_PREPARE_FDS): Rename as... + (_AC_INIT_DEFAULTS_ENVIRONMENT, _AC_INIT_DEFAULTS_FDS): these, + since they are called from `_AC_INIT_DEFAULTS', not + `_AC_INIT_PREPARE'. + (_AC_INIT_DEFAULTS_FDS): Dump `$@' in config.log, not + `$ac_configure_args' which is not computed yet. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): TRIPLET can include `_' and + `-'. + Reported by Andreas Jaeger. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * m4sh.m4 (_AS_UNSET_PREPARE): New macro, eved from + _AC_INIT_PREPARE_ENVIRONMENT, and fixed: set `FOO' before trying + to unset it: `unset' exits 1 if the variable is not defined. + (AS_UNSET): Require it. Use `as_unset' not `ac_unset'. + * acgeneral.m4 (_AC_INIT_PREPARE_ENVIRONMENT): Use it. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (builtin, changecom, changequote, decr, dumpdef) + (incr, index, indir, len, syscmd, sysval, traceoff, traceon): + Rename as... + (m4_builtin, m4_changecom, m4_changequote, m4_decr, m4_dumpdef) + (m4_incr, m4_index, m4_indir, m4_len, m4_syscmd, m4_sysval) + (m4_traceoff, m4_traceon): these. + * autoconf.m4 (builtin, changecom, decr, incr, index, indir, len) + (syscmd, sysval, traceoff, traceon): Reactivate. + +2000-11-03 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_rename_m4, m4_copy_unm4): New macros. + Use them. + (debugfile, debugmode, m4exit, m4wrap, maketemp, patsubst, regexp) + (substr, translit, m4_wrap): Rename as... + (m4_debugfile, m4_debugmode, m4_exit, m4_wrap, m4_maketemp) + (m4_patsubst, m4_regexp, m4_substr, m4_translit, m4_text_wrap): these. + Adjust all dependencies. + * acgeneral.m4: Adjust. + * tests/m4sugar.at: Adjust. + * autoconf.m4 (m4exit, patsubst, regexp, substr, translit): + Reestablish them. + +2000-11-02 Akim Demaille <akim@epita.fr> + + The documentation is not clear about the obsoleteness of + `acconfig.h', `config.h.top', and `config.h.bot'. + Reported by Aharon Robbins. + + * doc/autoconf.texi (Making configure Scripts) + (Automatic Remaking, Defining Symbols, Distributing): Forget about + these files. + (acconfig.h): Reword. + Display the old scheme presenting the dependencies between input + and output files. + (Changed File Names): Clarify. + +2000-11-02 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Usual Tools): Some about + dirname. + +2000-11-02 Pavel Roskin <proski@gnu.org> + + * ifnames.sh: Put the opening brace on the same line with + patterns. Reported by Paul Martinolich. + * tests/tools.at (AWK portability): Check ifnames. + (ifnames): New test for ifnames. + * THANKS: Updated. + +2000-11-02 Pavel Roskin <proski@gnu.org> + + * m4/atconfig.m4 (AT_CONFIG): s/AT_TESTPATH/AUTOTEST_PATH/ + because AT_TESTPATH looks like a macro. + * tests/atconfig.in: Likewise. + +2000-11-02 Akim Demaille <akim@epita.fr> + + * autoconf.sh (trace.m4): Move all the M4 builtins into `at_'. + Catch the failures of the big pipe. + +2000-11-02 Akim Demaille <akim@epita.fr> + + * tests/tools.at (Tracing M4 builtins): New test. + * autoconf.sh (trace_format): Fix its computation. + +2000-11-02 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_CHECK): Check stderr first, since if both + stdout and stderr fail, differences on the latter are probably + more significant than on the former. + +2000-11-02 Akim Demaille <akim@epita.fr> + + * autoconf.sh (task trace) [debug]: Instead of a long pipe, extend + trace.m4. + +2000-11-02 Akim Demaille <akim@epita.fr> + + * autoupdate.sh (m4.txt): Use `dumpdef' and m4 to build it. + +2000-11-02 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (popdef, pushdef): Rename as... + (m4_popdef, m4_pushdef): these. + Adjust dependencies. + * acgeneral.m4: Adjust. + * aclang.m4: Likewise. + * autoconf.m4 (popdef, pushdef): Reactivate them. + +2000-11-02 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_CHECK, AT_CLEANUP): Be more verbose when + `-v' is passed. + +2000-11-01 Pavel Roskin <proski@gnu.org> + + * autoconf.sh: Using trap-safe "exit". + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * tests/base.at: Use AS_EXIT instead of exit in configure.in. + * tests/m4sh.at: Likewise. + * tests/semantics.at: Likewise. + +2000-11-01 Akim Demaille <akim@epita.fr> + + In M4sugar, move `define', `undefine', and `defn' into the `m4_' + name space. + + * m4sugar.m4 (m4_define, m4_defn, m4_undefine): New macros. + (define, defn, undefine): Undefine. + Adjust all uses. + * m4sh.m4: Adjust. + * autoconf.m4: Reenable these builtins. + * m4sugar.m4 (m4_expansion_stack_dump): Use m4_copy. + +2000-11-01 Akim Demaille <akim@epita.fr> + + GNU M4 1.4 improperly handle the traces of copies of builtins. + + * autoconf.sh (task trace): When tracing `BUILTIN' also trace + `m4_BUILTIN'. + +2000-11-01 Akim Demaille <akim@epita.fr> + + Autoupdate should not depend upon foreign macros. + + * autoupdate.sh (ac.m4): Use `_au_define', not `define'. + (input.m4): Use `_au_BUILTIN' not `BUILTIN'. + +2000-11-01 Akim Demaille <akim@epita.fr> + + * m4sugar.m4 (m4_fatal): Dump the expansion stack. + * acgeneral.m4 (AC_FATAL): Use m4_fatal. + +2000-11-01 Akim Demaille <akim@epita.fr> + + Move the `defun' handling into M4sugar. + + * m4sugar.m4 (_m4_divert(GROW), _m4_expansion_stack_dump) + _m4_defun_pro, _m4_defun_epi, m4_defun, $1, m4_defun_once) + m4_before, _m4_require, m4_require, m4_expand_once, m4_provide) + m4_provide_ifelse): New macros. + * acgeneral.m4 (_AC_EXPANSION_STACK_DUMP, _AC_DEFUN_PRO) + _AC_DEFUN_EPI): Removed. + (AC_DEFUN, AC_DEFUN_ONCE, _AC_REQUIRE, AC_REQUIRE) + AC_PROVIDE_IFELSE, AC_FATAL): Reimplement atop M4sugar. + +2000-11-01 Raja R Harinath <harinath@cs.umn.edu> + + * tests/tools.at (autoupdating AC_LINK_FILES): Invoke autoconf + like in the rest of the tests. + +2000-11-01 Pavel Roskin <proski@gnu.org> + + * autoconf.sh: Typo: s/m4__warnings/m4_warnings/. + +2000-10-31 Pavel Roskin <proski@gnu.org> + + * autoupdate.sh: Check that $sed understands the meaning of "\b" + instead of checking "--version". + +2000-10-31 Akim Demaille <akim@epita.fr> + + Move the handling of classified warnings into M4sugar. + + * m4sugar.m4 (m4_diagnose): Remove. + (m4_warning): New. + * acgeneral.m4 (AC_WARNING_IFELSE, _AC_WARNING_IFELSE) + (_AC_WARNING_ERROR_IFELSE, __AC_WARNING_ERROR_IFELSE) + (_AC_DIAGNOSE, AC_DIAGNOSE): Rename as... + * m4sugar.m4 (m4_warning_ifelse, _m4_warning_ifelse) + (_m4_warning_error_ifelse, __m4_warning_error_ifelse) + (_m4_warn, m4_warn): these. + * acgeneral.m4 (AC_DIAGNOSE): Wrapper around `m4_warn'. + * autoconf.sh: Define `m4_warnings' instead of `_AC_WARNINGS'. + +2000-10-30 Pavel Roskin <proski@gnu.org> + + * acspecific.m4 (AC_PATH_XTRA): Use AC_LANG_PROGRAM() as the + argument to AC_LINK_IFELSE. + +2000-10-30 Pavel Roskin <proski@gnu.org> + + * m4sh.m4 (AS_EXIT): Use "false" for exit code 1, ":" for 0. + * acgeneral.m4 (AC_MSG_ERROR): Don't use m4_default for the + second argument - AS_EXIT takes care of it. + +2000-10-30 Akim Demaille <akim@epita.fr> + + * m4sugar.m4: Formatting changes. + +2000-10-30 Akim Demaille <akim@epita.fr> + + Move the handling of diversions into M4sugar. + + * acgeneral.m4 (_AC_DIVERT, AC_DIVERT, AC_DIVERT_PUSH) + (AC_DIVERT_POP): Move to... + * m4sugar.m4 (_m4_divert, m4_divert, m4_divert_push) + (m4_divert_pop): here. + * acgeneral.m4: Adjust to use only the M4sugar macros. + Nevertheless... + (AC_DIVERT_PUSH, AC_DIVERT_POP): New wrappers around the M4sugar + macros. + (_AC_DIVERT(...)): Rename all the diversions names as... + (_m4_divert(...)): these. + +2000-10-30 Pavel Roskin <proski@gnu.org> + + * m4sh.m4 (AS_EXIT): New macro that exits and makes sure that $? + is set correctly within the exit trap. + (AS_TMPDIR): Use it. + * acgeneral.m4 (AC_MSG_ERROR): Likewise, + +2000-10-29 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (AC_CHECK_TOOL): Set VARIABLE also when using the + cache. From Jim Meyering. + (AC_PATH_TOOL): Likewise. + +2000-10-29 Pavel Roskin <proski@gnu.org> + + * tests/atgeneral.m4 (AT_CHECK): Warn if the expected exit status + is different from what we got. Don't preserve exit status other + than 77. + +2000-10-29 Pavel Roskin <proski@gnu.org> + + * autoconf.sh: When scanning for unexpanded macros match only + words beginning with "A?_" and "m4_" or containing "_A?_". + Strip the comments before the matching. Don't use character + ranges. + +2000-10-29 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_INIT_PREPARE): Don't use a newline before + accessing $? - newlines in "trap" reset $? to 0 on FreeBSD 4.0. + +2000-10-29 Jim Meyering <meyering@lucent.com> + + * acgeneral.m4 (AC_MSG_WARN): Now that this macro expands to + two stmts, enclose them in `{' ... `}'. + +2000-10-28 Pavel Roskin <proski@gnu.org> + + * aclang.m4 (AC_REQUIRE_CPP): Don't default to C++ - call AC_FATAL + for unsupported languages. + +2000-10-27 Pavel Roskin <proski@gnu.org> + + * acfunctions.m4 (AC_FUNC_MMAP): Remove conftestmmap from the + shell, not from the test program. + +2000-10-27 Pavel Roskin <proski@gnu.org> + + * doc/autoconf.texi (Limitations of Builtins): Recommend using + AC_MSG_ERROR instead of exit. + (Autoconf Language): Fix examples. + +2000-10-27 Pavel Roskin <proski@gnu.org> + + * tests/suite.at: Move "-*- Autoconf -*-" to the second line. + +2000-10-27 Akim Demaille <akim@epita.fr> + + Use AC_MSG_ERROR in the test suite, not just `exit'. + + * tests/README: New file. + * tests/semantics.at: Don't just `exit 1' or `exit 77' from + configure.in: call AC_MSG_ERROR. + * tests/base.m4: Likewise. + * tests/m4sh.at: Likewise. + * tests/semantics.at (AT_CHECK_PROGS_PREPARE): New macro, eved + out of... + (AC_CHECK_PROG & AC_PATH_PROG): here. + Split into two individual tests... + (AC_CHECK_PROG & AC_CHECK_PROGS, AC_PATH_PROG & AC_PATH_PROGS): these. + +2000-10-27 Pavel Roskin <proski@gnu.org> + + * autoconf.sh: Recognize short options followed by arguments + without separators. + * autoheader.sh: Likewise. + * autoreconf.sh: Likewise. Recognize abbreviations for + "--autoconf-dir" and "--m4dir". + * autoupdate.sh: Likewise. Recognize abbreviations for + "--autoconf-dir". + +2000-10-26 Pavel Roskin <proski@gnu.org> + + * autoconf.sh: Don't show obsolete options on "--help". Report + obsolete options to stderr. Adjust list of options. Correct + processing of options. Process options with values separated by + "=" first, so that abbreviations work. Don't accept "=" with + short options. + * autoheader.sh: Likewise. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * ifnames.sh: There is no "--verbose" option. + * doc/autoconf.texi: Option "-A" requires an argument. + (autoreconf Invocation): Document "--install", "--symlink", + "--m4dir" and the options passed to Automake. + +2000-10-26 Akim Demaille <akim@epita.fr> + + * shell.m4: Rename as... + * m4sh.m4: this. + * tests/m4sugar.m4, tests/shell.m4, tests/torture.m4: Rename as... + * tests/m4sugar.at, tests/m4sh.at, tests/torture.at: these. + * tests/semantics.m4, tests/base.m4, tests/suite.m4: Rename as... + * tests/semantics.at, tests/base.at, tests/suite.at: these. + * tests/tools.m4, tests/update.m4, tests/syntax.m4: Rename as... + * tests/tools.at, tests/update.at, tests/syntax.at: these. + * tests/mktests.sh: Adjust the output file names. + +2000-10-25 Pavel Roskin <proski@gnu.org> + + * autoupdate.sh: Redirect stdin for sed to /dev/null to avoid + hangs with non-GNU versions of sed. + +2000-10-25 Akim Demaille <akim@epita.fr> + + Move the Autoconf independent shell macros into the file + `shell.m4' and the name space `AS_*'. + + * acgeneral.m4 (AC_SHELL_IFELSE, _AC_SHELL_TMPDIR, AC_SHELL_UNSET) + (AC_SHELL_MKDIR_P, AC_SHELL_DIRNAME): Rename and move to... + * shell.m4 (AS_IFELSE, AS_TMPDIR, AS_UNSET, AS_MKDIR_P) + (AS_DIRNAME): here, a new file. + Adjust all dependencies. + + * tests/base.m4 (m4_wrap): Eve out into... + * tests/shell.m4: here, new file. + * tests/base.m4 (AC_SHELL_MKDIR_P) + (AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): Eve out into... + * tests/m4sugar.m4 (AS_MKDIR_P, AS_DIRNAME & AS_DIRNAME_SED): + here, new file. + Adjust the test suite. + +2000-10-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_SHELL_DIRNAME): Split its code into... + (AC_SHELL_DIRNAME_EXPR, AC_SHELL_DIRNAME_SED): these new macros. + * tests/base.m4 (AC_SHELL_DIRNAME & AC_SHELL_DIRNAME_SED): New + test. + +2000-10-25 Pavel Roskin <proski@gnu.org> + + * tests/aclocal.m4 (AC_ENV_SAVE): Rename to ... + (AC_STATE_SAVE): ... this. Save the list of all files + in the current directory. + * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): Compare lists of + files created by AC_ENV_SAVE. Remove state* before and after + the test. + +2000-10-25 Pavel Roskin <proski@gnu.org> + + * Makefile.am: Add acversion.m4.in to EXTRA_DIST. + +2000-10-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_SHELL_DIRNAME): The sed fall back was producing + twice the output for it was not using `-n' and used `p'. Remove + the latter. + +2000-10-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE_FDS): Give some information on + the host in config.log. + +2000-10-24 Pavel Roskin <proski@gnu.org> + + * tests/mktests.sh: Set locale to C to make sure that syntax.m4 + and update.m4 are locale-independent. + +2000-10-24 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_CACHE_DUMP): Add a missing separator for sed + commands. + +2000-10-24 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AT_FILE_DEPENDENCY): Rename as... + (AC_FILE_DEPENDENCY_TRACE): this. + +2000-10-24 Lars J. Aas <larsa@sim.no> + + * m4sugar.m4: (m4_tolower, m4_toupper): New macros. + * acgeneral.m4 (AC_PREFIX_PROGRAM): Use m4_toupper(). + * aclang.m4 (AC_F77_FUNC): Use m4_toupper()/m4_tolower(). + +2000-10-24 Pavel Roskin <proski@gnu.org> + + * m4sugar.m4 (m4_quote): Comment change. + +2000-10-24 Akim Demaille <akim@epita.fr> + + Start avoiding dependence upon character ranges. + + * acgeneral.m4 (_AC_INIT_DEFAULTS): Introduce `ac_cr_AZ', + `ac_cr_az', `ac_cr_09', `ac_cr_alnum' and `ac_hostname'. + Spread their use. + +2000-10-24 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT): Don't play with `trap'. + (_AC_INIT_PREPARE): Trap after having created config.log. + Also trap on 0. + When trapped, report why in config.log. + (AC_MSG_WARN, AC_MSG_ERROR): Also output the message in + config.log. + +2000-10-24 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_SHELL_DIRNAME): Rename as... + (AC_SHELL_DIRNAME): this. + s/X$1/X[]$1/ so that when $1 is a macro, it's given a chance to be + expanded. + (AC_PREFIX_PROGRAM): Use AC_SHELL_DIRNAME. + Quote properly. + +2000-10-24 Akim Demaille <akim@epita.fr> + + * tests/tools.m4 (Syntax of the scripts): Specify the path to the + tested program, some shells don't honor the PATH with `sh PROG'. + +2000-10-23 Akim Demaille <akim@epita.fr> + + Since GNU M4 now comes with its libm4 (binary), to avoid + ambiguities let's rename `libm4' (M4 code) as `m4sugar': + + Readability And Greater Understanding Stands 4 M4sugar + + name coined by Lars J. Aas. + + * libm4.m4: Rename as... + * m4sugar.m4: this. + All dependencies adjusted. + +2000-10-23 Akim Demaille <akim@epita.fr> + + * tests/mktests.sh (update_exclude_list, syntax_exclude_list): Add + `AC_PREREQ'. + * tests/tools.m4: Globally, don't use `../' to invoke the tested + tools, since the PATH is properly set, and in most cases it + obfuscates the test code. + (autoupdating AC_PREREQ): New tests. + +2000-10-23 Akim Demaille <akim@epita.fr> + + In order to check that all the CPP symbols which are AC_DEFINE'd + are properly templated, autoheader traces + AC_DEFINE/AC_DEFINE_UNQUOTED. Only literals can be traced, and + actually tracing non literals produces invalid autoheader input. + Hence, provide a means to trace calls to + AC_DEFINE/AC_DEFINE_UNQUOTED with literals. + + * acgeneral.m4 (AC_DEFINE_TRACE, AC_DEFINE_TRACE_LITERAL): New + macros. + (AC_DEFINE, AC_DEFINE_UNQUOTED): Use AC_DEFINE_TRACE. + * autoheader.sh: Trace AC_DEFINE_TRACE_LITERAL, not + AC_DEFINE/AC_DEFINE_UNQUOTED. + +2000-10-23 Akim Demaille <akim@epita.fr> + + Let autoupdate change AC_PREREQ to require the current version of + Autoconf. + + * acgeneral.m4 (_AC_VERSION_UNLETTER, _AC_VERSION_COMPARE): Move + to... + * libm4.m4 (m4_version_unletter, m4_version_compare): here. + Adjust dependencies. + * acgeneral.m4 (AU::AC_PREREQ): New macro. + * autoupdate.sh: Fail when `m4 input.m4' fails. + +2000-10-21 Pavel Roskin <proski@gnu.org> + + * acfunctions.m4 (AC_FUNC_CHOWN): Remove temporary files on exit. + (AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): Likewise. + (AC_FUNC_SELECT_ARGTYPES): Likewise. + (AC_FUNC_UTIME_NULL): Likewise. + * acgeneral.m4 (_AC_COMPUTE_INT): Likewise. + * aclang.m4 (_AC_F77_NAME_MANGLING): Likewise. + * acspecific.m4 (_AC_SYS_LARGEFILE_MACRO_VALUE): Likewise. + +2000-10-20 Pavel Roskin <proski@gnu.org> + + * tests/tools.m4 (autoupdating AC_LINK FILES): Clean up "src1" + and "src2" at the end of the test. + +2000-10-19 Pavel Roskin <proski@gnu.org> + + * NEWS: Documented changes in AC_PROG_CPP and AC_TRY_CPP. + * doc/autoconf.texi (Compilers and Preprocessors): Likewise. + * acgeneral.m4 (AC_TRY_CPP): Comment changes. + +2000-10-19 Pavel Roskin <proski@gnu.org> + + * doc/autoconf.texi (Shellology): Documented quirks in ash-0.2. + +2000-10-18 Pavel Roskin <proski@gnu.org> + + * mdate-sh: Removed, its copy remains in the doc/ directory. + +2000-10-18 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_TOOLS): Use `$' when reading a variable. + +2000-10-18 Morten Eriksen <mortene@sim.no> + + * aclang.m4 (_AC_PROG_CC_G): Use the _AC_COMPILE_IFELSE macro + instead of reinventing the wheel. This also takes care of a bug + where the "-g" option was accepted if the compiler silently exits + with status unequal to 0. + (_AC_PROG_CXX_G): Likewise. + (AC_PROG_CC): As _AC_PROG_CC_G depends on $ac_objext and + $ac_exeext, move the expansion of _AC_OBJEXT and _AC_EXEEXT in + front of _AC_PROG_CC_G. + (AC_PROG_CXX, AC_PROG_F77): Likewise. + +2000-10-18 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (AT_INIT): Avoid foo="`bar`", foo=`bar` is + enough. + Use grep to check the presence of a string in a stream. + * m4/atconfig.m4: Quote. + +2000-10-18 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_SHELL_DIRNAME): Quote the `sed' fall back. + +2000-10-18 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_PROG_LN_S): If neither `ln -s' nor `ln' work, + fall back to `cp'. + +2000-10-17 Morten Eriksen <mortene@sim.no> + + * acgeneral.m4 (AC_CHECK_TOOL): As AC_CHECK_PROG first tests the + value of the VARIABLE argument when looking for executables, we + need to set it to the correct value from AC_CHECK_TOOL when not + just passing on the incoming VARIABLE directly. + (AC_CHECK_TOOLS, AC_PATH_TOOL): Likewise. + +2000-10-17 Assar Westerlund <assar@sics.se> + + * acgeneral.m4 (_AC_INIT_PREPARE): Move the + _AC_INIT_PREPARE_ENVIRONMENT invocation to... + (_AC_INIT_DEFAULTS): here, so that we keep the same known + environment for more of the script. + +2000-10-17 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (The GNU build system): Sketch of new a + chapter. + +2000-10-17 Akim Demaille <akim@epita.fr> + + Somehow, the adjustment of `mktests.sh' claimed on 2000-10-17 by + myself (`Fix autoupdate...') was not applied. + + * tests/mktests.sh (update_exclude_egrep): Add AC_INIT, AC_OUTPUT, + AC_LINK_IFELSE. + +2000-10-17 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_PROG, AC_CHECK_PROGS, AC_PATH_PROG) + (AC_PATH_PROGS, AC_PATH_TOOL, AC_CHECK_TOOL, AC_CHECK_TOOLS): Fix + the quotation. + (AC_PATH_TOOL, AC_CHECK_TOOL, AC_CHECK_TOOLS): Check with the + $ac_tool_prefix iff it is not empty. + +2000-10-17 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Particular Programs): Some notes on the + portability of Flex. + +2000-10-17 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_COMPILE_IFELSE, _AC_LINK_IFELSE) + (_AC_RUN_IFELSE): Before compiling, remove the files expected to + be produced. + (_AC_LINK_IFELSE, _AC_RUN_IFELSE): You don't create object files, + so don't remove them. + +2000-10-17 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_FATAL): Use _AC_EXPANSION_STACK_DUMP. + (_AC_REQUIRE): Use AC_FATAL. + +2000-10-17 Akim Demaille <akim@epita.fr> + + Give a means to report where the macros have been defined in error + messages. + + * libm4.m4 (m4_location): New macro. + (m4_errprint): Rename as... + (m4_diagnose): this. Use m4_location. + Adjust dependencies. + (m4_errprint): New macro, similar to `errprint' but for an + additional trailing `\n'. + * acgeneral.m4 (AC_DEFUN, AC_DEFUN_ONCE): Define `m4_location($1)' + to the current location (i.e., that of the definition of $1). + (_AC_DEFUN_PRO, _AC_REQUIRE): Also push the location of the + current macro in the stack. + (_AC_EXPANSION_STACK_DUMP): Adjust. + +2000-10-17 Akim Demaille <akim@epita.fr> + + Fix autoupdate: updating `AC_OUTPUT_COMMANDS' was failing because + it includes another AU defined macro. + + * autoupdate.sh (input.m4:_au_defun): New macro. + (au.m4): Use it instead of inlining _au_enable/_au_disable + invocations in the definition of all these macros. + (input.m4:__au_enable, input.m4:__au_disable): New macros. + (input.m4:_au_enable, input.m4:_au_disable): Use them. + * tests/mktests.sh (update_exclude_list): Add `AC_OUTPUT'. + Running it twice in a configure.in is not valid. + Add `AC_LINK_FILES' since it requires arguments. + * tests/tools.m4 (autoupdating AC_LINK_FILES): New test. + +2000-10-17 Raja R Harinath <harinath@cs.umn.edu> + + * Makefile.am (MAINTAINERCLEANFILES): Add acversion.m4. + (INSTALL.txt): Put into $(srcdir). + (acversion.m4): Build here ... + * configure.in (AC_OUTPUT): Not here. + + * tests/Makefile.am (MACRO_FILES): Don't use $(top_srcdir). + (syntax.m4): Create in $(srcdir). + (update.m4): Likewise. + * tests/atspecific.m4 (AT_CHECK_UPDATE): Look for autoconf + macros in the top source directory. + +2000-10-16 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_LANG_COMPILER_GNU): New macro, which unifies... + (_AC_PROG_F77_GNU, _AC_PROG_CC_GNU, _AC_PROG_CXX_GNU): Remove. + Adjust dependencies. + (ac_cv_prog_gcc, ac_cv_prog_gxx, ac_cv_prog_g77): AU_ALIAS'ed. + +2000-10-16 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Adjust copyright notice. + * acspecific.m4: Likewise. + * acoldnames.m4: Likewise. + * acversion.m4.in: Likewise. + * autoconf.sh: Likewise. + * autoheader.sh: Likewise. + * autoreconf.sh: Likewise. + * autoscan.pl: Likewise. + * autoupdate.sh: Likewise. + * ifnames.sh: Likewise. + +2000-10-16 Pavel Roskin <proski@gnu.org> + + * tests/aclocal.m4: Don't consider variables @, '*', '?' and + '#' in the output of `set' - they are modified by zsh. + +2000-10-14 Pavel Roskin <proski@gnu.org> + + * m4/missing.m4 (AM_MISSING_PROG): Use $SHELL to run "missing". + * configure.in: Don't add $SHELL to the path of help2man - + it is already added by AM_MISSING_PROG. + +2000-10-13 Akim Demaille <akim@epita.fr> + + * tests/mktests.sh: If ever it fails, touch the output files + ``a` la missing''. + +2000-10-13 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_LINKER_OPTION): Ahem, err, use `$' when + consulting a variable... + +2000-10-13 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Typos in comments spotted by Pavel. + +2000-10-12 Pavel Roskin <proski@gnu.org> + + * acspecific.m4 (AC_PROG_LEX): Don't assume that lex exists. + Don't run _AC_DECL_YYTEXT if it doesn't. Always check libl and + libfl regardless of the $LEX value. + +2000-10-12 Morten Eriksen <mortene@sim.no> + + * acgeneral.m4 (AC_CONFIG_SUBDIRS): Fixed nasty typo. + +2000-10-12 Akim Demaille <akim@epita.fr> + + * tests/mktests.sh: Backslash the quote in the heredocs to help + syntax highlighting tools. + * tests/atspecific.m4 (AT_CHECK_UPDATE): Give a better AT_SETUP + title. + +2000-10-12 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_SH_QUOTE): Issue an `obsolete' warning for use + of backquotes, instead of a `syntax' warning. + +2000-10-12 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_VAR_IN_INDIR, AC_VAR_IF_SET): Rename as... + (AC_VAR_INDIR_IFELSE, AC_VAR_SET_IFELSE): this. + +2000-10-12 Akim Demaille <akim@epita.fr> + + * tests/mktests.sh: Remove tmp files. + +2000-10-12 Akim Demaille <akim@epita.fr> + + Macros used by AC_LANG_COMPILER macros shall not AC_REQUIRE + AC_LANG_COMPILER by the way of AC_COMPILE_IFELSE etc. + + * acspecific.m4 (_AC_EXEEXT): Use _AC_LINK_IFELSE, not + AC_LINK_IFELSE to avoid AC_REQUIREing AC_PROG_CC which precisely + requires _AC_EXEEXT. + Don't run _AC_CYGWIN, _AC_MINGW32, _AC_EMXOS2. + * aclang.m4 (_AC_PROG_F77_G): Use _AC_COMPILE_IFELSE, not + AC_COMPILE_IFELSE. + (_AC_LANG_COMPILER_WORKS): Use _AC_LINK_IFELSE, not + AC_LINK_IFELSE. + +2000-10-12 Akim Demaille <akim@epita.fr> + + Diagnose AC_REQUIRE circular dependencies. + + * acgeneral.m4 (_AC_DEFUN_PRO, _AC_DEFUN_EPI): Keep a stack of + macro expansions, _AC_EXPANSION_STACK. + Use `_AC_EXPANDING(FOO)' to record the fact that `FOO' is being + expanded. + (_AC_REQUIRE): Diagnose required macros which are already being + expanded. + Record in _AC_EXPANSION_STACK the AC_REQUIRE calls. + (_AC_EXPANSION_STACK_DUMP): New macro. + +2000-10-12 Akim Demaille <akim@epita.fr> + + * libm4.m4 (m4_dumpdefs, _m4_dumpdefs_up, _m4_dumpdefs_down): New + macros. + +2000-10-11 Pavel Roskin <proski@gnu.org> + + * tests/atgeneral.m4 (AT_CHECK): Make sure that $? is set to 0 + if diffs have succeeded. + +2000-10-11 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_COMPILE_IFELSE, _AC_LINK_IFELSE) + (_AC_RUN_IFELSE): New macros which are the former + AC_COMPILE_IFELSE etc. without AC_LANG_COMPILER_REQUIRE. + (AC_COMPILE_IFELSE, AC_LINK_IFELSE, AC_RUN_IFELSE): Use them. + +2000-10-11 Morten Eriksen <mortene@sim.no> + + * acgeneral.m4 (AC_RUN_IFELSE): Add missing executable suffix. + * aclang.m4 (_AC_LANG_COMPILER_WORKS): Likewise. + * aclang.m4 (AC_PROG_CC_C_O, AC_PROG_F77_C_O): Fix typos where + $objext were used instead of $ac_objext. + +2000-10-05 Akim Demaille <akim@epita.fr> + + Check that updated scripts are valid scripts. + + * tests/mktests.sh: Generate `syntax.m4' directly. + * tests/macros.m4: Remove. + Adjust dependencies. + * tests/mktests.sh: Generate `update.m4' too. + * tests/update.m4: New generated file. + Adjust dependencies. + * tests/atspecific.m4 (AT_CHECK_UPDATE): New macro. + +2000-10-05 Akim Demaille <akim@epita.fr> + + * tests/mktests.sh: New file, which replaces the code inlined in + Makefile.am. + * src/Makefile.am (macros.m4): Use `mktests.sh'. + * tests/suite.m4: Reorder from low level to high level. + +2000-10-02 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_LANG_ABBREV, _AC_LANG_ABBREV(C)) + (_AC_LANG_ABBREV(C++), _AC_LANG_ABBREV(Fortran 77): New macros. + (AC_LANG_(C), AC_LANG_(C++), AC_LANG_(Fortran 77)): Don't define + AC_LANG_ABBREV. + (_AC_PROG_PREPROC_WORKS): Adjust. + * acgeneral.m4 (_AC_TRY_CPP): Likewise. + +2000-10-02 Pavel Roskin <proski@gnu.org> + + * acspecific.m4 (AC_PROG_LEX): Use AC_DEFUN_ONCE. + (AC_DECL_YYTEXT): Don't use AC_REQUIRE because autoupdate + would place it into configure.in but it's not allowed + outside AC_DEFUN. + +2000-10-02 Pavel Roskin <proski@gnu.org> + + * tests/Makefile.am: Macros defined by AC_DEFUN_ONCE should + go to macros.m4 for testing. + +2000-09-28 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (AC_SHELL_UNSET): Don't rely on variable + assignments changing $?. + +2000-09-28 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_OUTPUT_FILES): Fixed exit status. + (_AC_OUTPUT_HEADERS): Exit if the header template is missing. + +2000-09-28 Pavel Roskin <proski@gnu.org> + + * acfunctions.m4: Formatting fixes. + * acgeneral.m4: Likewise. + * aclang.m4: Likewise. + * acspecific.m4: Likewise. + * libm4.m4: Likewise. + +2000-09-27 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (AC_CHECK_PROG): Added protection against spaces + in $PATH. + * acspecific.m4 (AC_PROG_INSTALL): Likewise. + +2000-09-27 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (AC_CHECK_LIB): only call AH_CHECK_LIB if + ACTION-IF-TRUE is not given. + (AH_CHECK_LIB): related comment changes. + +2000-09-27 Pavel Roskin <proski@gnu.org> + + * aclang.m4 (_AC_LANG_COMPILER_WORKS): Remove []dnl because it + resulted in invalid shell code. + +2000-09-27 Lars J. Aas <larsa@sim.no> + + * autoconf.sh: Report full macro name for missing macros. + +2000-09-27 J. David Anglin <dave@hiauly1.hia.nrc.ca> + + * autoheader.sh: Fix trap (EXIT) status. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * autoconf.sh: Change `exit' to `{ (exit 1); exit; }' after m4 and + awk commands to ensure exit state is in a defined state. + +2000-09-25 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * tests/semantics.m4 (AC_PROG_CPP with warning): Simplified. + +2000-09-25 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Use + _AC_INIT_PREPARE_ENVIRONMENT to make the shell running + config.status sane and POSIX-compatible. + +2000-09-25 Pavel Roskin <proski@gnu.org> + + * autoheader.sh: Don't check status of variable assignments - + it's undefined in ash 0.2. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * autoconf.sh: Likewise. Also eliminated command substitution + inside variable expansion - ash 0.2 coredumps on it. + +2000-09-21 Pavel Roskin <proski@gnu.org> + + * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): Check stderr from + autoconf and autoheader. Expected warnings disabled by "-W none" + Preceding comment removed as no longer relevant. + * tests/semantics.m4 (AC_CHECK_PROG & AC_PATH_PROG): Check + stderr from autoconf. + (AC_PATH_PROG & AC_PATH_PROGS): Likewise. + (AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS): Likewise. + * tests/tools.m4 (autoheader): Check that autoheader prints + a warning for missing templates. Check stderr from autoconf. + * tests/torture.m4 (config.status under extreme conditions): + Check stderr from autoconf and autoheader. + (command line interface): Check stderr from autoconf. + +2000-09-21 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Fix usage info for + config.status - file arguments are optional. + +2000-09-21 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_OUTPUT_FILES): Ensure that config.status + exits if any input file is missing. + * tests/semantics.m4 (missing templates): Test it. + +2000-09-21 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_SHELL_TMPDIR): Don't check status of variable + assignment - it's undefined in ash 0.2. + +2000-09-21 Akim Demaille <akim@epita.fr> + + * src/atgeneral.m4 (AC_CHECK): Display stderr including when the + test failed because of stdout. + +2000-09-21 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4: Formatting changes. + (AT_INIT): Let `at_stop_on_error' and `at_verbose' be `:'/`false' + variables instead of `'/`1'. + `at_check_stds' replaces `at_no_redirs'. + Rename `Snippet 3' as `Snippet 4'. + Introduce `Snippet 3' for variable initializations. + Adjust the dependencies. + (AT_CHECK): Don't show diff's result unless verbose. + +2000-09-20 Pavel Roskin <proski@gnu.org> + + * tests/Makefile.am: AC_PREFIX_PROGRAM and AC_F77_FUNC excluded + from testing because they require an argument. + * tests/atspecific.m4: Make sure that configure doesn't write + anything to stderr. + +2000-09-20 Pavel Roskin <proski@gnu.org> + + * acspecific.m4 (_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H): Cache + variable wasn't always set inside AC_CACHE_CHECK. + (_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL): Likewise. + From Nicolas Joly. + +2000-09-20 Pavel Roskin <proski@gnu.org> + + * libm4.m4 (m4_ifvanl): Don't output a newline for empty + arguments. + +2000-09-19 Akim Demaille <akim@epita.fr> + + * tests/atspecific.m4 (AT_TEST_MACRO): Rename as... + (AT_CHECK_MACRO): this. All dependencies adjusted. + +2000-09-19 Akim Demaille <akim@epita.fr> + + * tests/aclocal.m4.new (AC_ENV_SAVE): Skip POW_LIB, used by + AC_FUNC_STRTOD. + From Bernard Dautrevaux. + +2000-09-19 Pavel Roskin <proski@gnu.org> + + * tests/atgeneral.m4 (AT_DATA): Use _ATEOF instead of EOF. + +2000-09-19 Pavel Roskin <proski@gnu.org> + + * tests/semantics.m4 (AC_PROG_CPP with warnings): Minor + simplification. + +2000-09-19 Akim Demaille <akim@epita.fr> + + * autoconf.sh (optarg): More robust expr invocation. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * autoheader.sh: Likewise. + Reported by Bernard Dautrevaux. + +2000-09-19 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (AU_ALIAS): Do not use `defn' since then autoupdate + would replace an old macro call with the new macro body instead of + the new macro call. + * tests/tools.m4 (autoupdate): Test an AU_ALIAS'd macro update. + +2000-09-19 Pavel Roskin <proski@gnu.org> + + * tests/atspecific.m4 (_AT_CHECK_AC_MACRO): New macro. + (AT_TEST_MACRO): Use it. + * tests/semantics.m4 (AC_PROG_CPP with warnings, AC_PROG_CPP + without warnings): New tests. + +2000-09-18 Rüdiger Kuhlmann <autoconf-list@ruediger-kuhlmann.de> + + * acgeneral.m4 (_AC_OUTPUT_SUBDIRS): Check for configure.gnu + as well. + (_AC_INIT_HELP): Likewise. + (NEWS): Note checking for configure.gnu. + * doc/autoconf.texi: Document checking for configure.gnu when + recursing subdirectories. + +2000-09-18 Jim Meyering <meyering@lucent.com> + + * acfunctions.m4 (AC_FUNC_GETLOADAVG): Restore the initial value + of LIBS. Otherwise, everyone ends up linking with -lelf for some + configurations. + Reported by Mike Stone. + +2000-09-14 Pavel Roskin <proski@gnu.org> + + * aclang.m4 (AC_PROG_CPP): Use double quotes in the for loop + and eliminate ac_tmp_cpp. + (AC_PROG_CXXCPP): Use double quotes in the for loop and + eliminate ac_tmp_cxxcpp. + +2000-09-14 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_TRY_CPP): Don't filter out conftest.$ac_ext + from the output - it is only printed by Visual C that gives + correct exit status. + * aclang.m4 (AC_PROG_CPP): Don't try '${CC-cc} -nologo -E' + by the same reason. + +2000-09-12 Pavel Roskin <proski@gnu.org> + + * aclocal.m4 (_AC_PROG_CPP_WORKS): Don't use AC_REQUIRE_CPP - + it's useless here. Rename to ... + (_AC_PROG_PREPROC_WORKS): ... this. + +2000-09-12 Rüdiger Kuhlmann <autoconf-list@ruediger-kuhlmann.de> + + * acspecific.m4 (AC_PROG_INSTALL): Exclude c:install on AmigaOS. + +2000-09-12 Akim Demaille <akim@epita.fr> + + The test suite fails on some hosts because for instance + AC_INIT + AC_CHECK_FUNC(exit) + will not look for a compiler, it will just use `cc'. + Macros that need a compiler should require one. + + * acgeneral.m4 (_AC_REQUIRE): New macro, which is actually the + previous version of AC_REQUIRE plus the possibility to distinguish + the name of the symbol being AC_PROVIDE'd, and the text to expand. + (AC_REQUIRE): Reimplement in terms of _AC_REQUIRE. + * aclang.m4 (AC_LANG_COMPILER, AC_LANG_COMPILER_REQUIRE) + (AC_LANG_COMPILER(C), AC_LANG_COMPILER(C++)) + (AC_LANG_COMPILER(Fortran 77)): + New macros. + * acgeneral.m4 (AC_COMPILE_IFELSE, AC_LINK_IFELSE, AC_RUN_IFELSE): + Require a compiler. + (AC_TRY_RUN): Formatting changes. + * acfunctions.m4 (AC_FUNC_SETPGRP): Quote properly. The previous + changes revealed the weaknesses of this macro. + +2000-09-12 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_TRY_CPP): New macro. It runs the preprocessor + and checks whether it produces errors or warnings. Don't put grep + output into a variable, use another grep instead. + (AC_TRY_CPP): Use _AC_TRY_CPP. Copy conftest.err to config.log + if the case of an error. + * aclang.m4 (AC_LANG(C), AC_LANG(C++), AC_LANG(Fortran 77)): + define AC_LANG_ABBREV to the short language name. + (_AC_PROG_CPP_WORKS): New macro. It checks whether the current + preprocessor can be used to check for existence of headers. + Most code taken from ... + (AC_PROG_CPP): ... here. Use _AC_PROG_CPP_WORKS. Use shell + "for" to find working CPP. Use AC_LANG_PUSH(C) and AC_LANG_POP - + it's a macro for C only. + (AC_PROG_CXXCPP): Rewritten using _AC_PROG_CPP_WORKS. + +2000-09-12 Akim Demaille <akim@epita.fr> + + * autoupdate.sh (sed): Look for GNU sed. + (usage): Ask for GNU sed. + +2000-09-12 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (AC_EGREP_CPP): Use additional quotes instead of + changequote. + +2000-09-12 Rüdiger Kuhlmann <autoconf-list@ruediger-kuhlmann.de> + + * acgeneral.m4 (AC_ARG_ENABLE, AC_ARG_WIDTH): Add trailing + semicolon to final fi. + +2000-09-11 Pavel Roskin <proski@gnu.org> + + * acgeneral.m4 (_AC_WARNING_ERROR_IFELSE) + (__AC_WARNING_ERROR_IFELSE): New macros for checking whether + warnings should be considered errors. + (_AC_DIAGNOSE): Use _AC_WARNING_ERROR_IFELSE. + +2000-09-11 Pavel Roskin <proski@gnu.org> + + * autoconf.sh: Properly report names of unexpanded macros that + begin with an underscore. + +2000-09-11 Pavel Roskin <proski@gnu.org> + + * doc/autoconf.texi (Preset Output Variables): Correctly specify + what languages are affected by CPPFLAGS, LDFLAGS and LIBS. + Extended description of LDFLAGS and LIBS. + (Compilers and Preprocessors, C Compiler Characteristics): + Recommend Automake as the source of ansi2knr. + (Autoconf Language, Quotation and Nested Macros): English fixes. + (Quotation and Nested Macros): Unclear example replaced with + an explanation of when m4 expands quotes. Added explanation why + unquoted calls are dangerous. + +2000-09-08 Pavel Roskin <proski@gnu.org> + + * doc/autoconf.texi: Always use one space before the opening + parenthesis in @defmac. + +2000-09-06 Morten Eriksen <mortene@sim.no> + + * acspecific.m4 (_AC_OBJEXT): No longer use AC_COMPILE_IFELSE, + which uses $ac_objext hence depends upon _AC_OBJEXT. + * aclang.m4 (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): Call + _AC_OBJEXT before _AC_EXEEXT since the latter needs $ac_objext. + +2000-09-06 Bernard Dautrevaux <dautrevaux@objectlive.com> + + * acspecific.m4 (_AC_EXEEXT): Set extension to void if linking + creates both an unsuffixed file and suffixed ones. + +2000-09-06 Peter Eisentraut <peter_e@gmx.net> + + * autoconf.texi: English and typo fixes. + +2000-09-05 Pavel Roskin <proski@gnu.org> + + * autoconf.sh: Consider undefined macros as errors. + * tests/base.m4 (unexpanded macros): Expect error, not warning. + +2000-09-05 Dave Love <fx@gnu.org> + + * aclang.m4 (_AC_PROG_F77_GNU): Run command from standard input so + that we can get some standard output. + +2000-09-04 Peter Eisentraut <peter_e@gmx.net> + + * autoscan.pl: Repair broken Getopt::Long use. + +2000-09-04 Akim Demaille <akim@epita.fr> + + * configure.in: Bump version to 2.49b. + * Makefile.am (bin_SCRIPTS): Depend upon configure.in. + +2000-08-11 Akim Demaille <akim@epita.fr> + + Version 2.49a. + +2000-08-11 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_NO_EXECUTABLES): New macro. + +2000-08-11 Akim Demaille <akim@epita.fr> + + * tests/base.m4 (AC_SHELL_MKDIR_P): Remove `a' too. + +2000-08-11 Akim Demaille <akim@epita.fr> + + * configure.in: Bump version to 2.49a. + +2000-08-11 J. David Anglin <dave@hiauly1.hia.nrc.ca> + + * autoconf.sh: Change `exit N' to `(exit N); exit' to provide + the correct exit status when an exit trap is taken. + +2000-08-11 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AM_FUNC_ERROR_AT_LINE, AM_FUNC_FNMATCH, + AM_FUNC_MKTIME, AM_FUNC_OBSTACK, AM_FUNC_STRTOD): Deactivate + their AU_ALIAS definition: Automake 1.4 does not quote the name of + these macros, hence when Autoconf reads Automake's definition the + name is expanded with unpredictable results. + +2000-08-09 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (Installing Autoconf extensions files): Remove. + +2000-08-09 Akim Demaille <akim@epita.fr> + + * autoconf.sh (finalize.awk): Don't leave spaces before the user + function calls. + Reported by John David Anglin. + * doc/autoconf.texi (Limitations of Usual Tools): Start the AWK + section. + * tests/tools.m4 (AWK portability): New test. + +2000-08-08 Pavel Roskin <proski@gnu.org> + + * Makefile.am: Substitute @bindir@ in shell scripts, needed by + autoheader. + +2000-08-07 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (_AC_LIBOBJ_ALLOCA, AC_REPLACE_FUNCS): Simplify + ${foo} into $foo. + * aclang.m4 (AC_LANG(C), AC_LANG(C++)): Move some internal + comments into the header comment. + * acgeneral.m4 (AC_TRY_CPP): Likewise. + +2000-08-07 Akim Demaille <akim@epita.fr> + + * tests/tools.m4 (undefined macros): New test. + +2000-08-07 Akim Demaille <akim@epita.fr> + + * autoconf.sh (finalize.awk): New subtool, eved from the previous + literal AWK program that performed the `oline' and quadrigraphs + substitution. + Fix its `oline' computation which was dead wrong when there are + empty lines (i.e., always). + Enhance it in order to look for and report unexpanded macro. + Don't let it pretend there are bugs in Autoconf (c:, the test + suite makes this scenario pretty unlikely as opposed to an actual + user bug. + Catch `m4_' too. + Remove the shell snippet which used to do this. + +2000-08-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_MSG_NOTICE): New macro, suggested by Pavel + Roskin. + (AC_MSG_ERROR): Use it. + +2000-08-04 Ruediger Kuhlmann <uck4@rz.uni-karlsruhe.de> + + * acspecific.m4 (AC_PROG_RANLIB): Use AC_CHECK_TOOL. + * doc/autoconf.texi (Limitations of Usual Tools): Typos. + +2000-08-04 Akim Demaille <akim@epita.fr> + + Solaris' /usr/ucb/expr, and SunOS' /usr/bin/expr fail with the `:' + operator when \(\) is used, and matches a string longer than 120 + characters. + Reported by Geoff Keating. + + * doc/autoconf.texi (Limitations of Usual Tools): Some words about + this. + * acgeneral.m4 (_AC_SHELL_DIRNAME): Fall back to echo|sed if expr + fails. + From Paul Eggert. + +2000-08-04 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: (AC_RUN_IFELSE, AC_LINK_IFELSE, AC_COMPILE_IFELSE): + Don't create the source file if none is given, and in this case, + don't remove it either. + +2000-08-04 Akim Demaille <akim@epita.fr> + + * libm4.m4 (m4_ifvanl): New macro. + * acgeneral.m4: Use it. + +2000-08-02 Akim Demaille <akim@epita.fr> + + Release Automake from being a substitute to Autoconf. + + * acspecific.m4 (_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H, + _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL, AC_HEADER_TIOCGWINSZ, + AC_SYS_POSIX_TERMIOS): New macros from both Automake and the + fileutils. + +2000-08-02 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_PROG_CC_G, _AC_PROG_CXX_G): Recent changes + inverted the results. Fix that. + +2000-08-02 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Special Shell Variables): More emphasis on + the dangers of character ranges. + From Paul Eggert. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * autoheader.sh (_ac_warnings): Be robust to LC_COLLATE. + `IFS=,; echo ,' will give a comma. Take this into account. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_PROG_CC): Also try to find $target_alias-cc. + +2000-08-01 Akim Demaille <akim@epita.fr> + + AC_VALIDATE_CACHED_SYSTEM_TUPLE no longer works properly since the + AC_CANONICAL_* revamping. + Reported by Peter Eisentraut. + In fact, let's just use the precious variables handling. + + * acgeneral.m4 (AC_VALIDATE_CACHED_SYSTEM_TUPLE): Obsoleted. + (_AC_ARG_VAR_PRECIOUS): New macro, eved from... + (AC_ARG_VAR): this macro. Adjust. + (_AC_INIT_PREPARE): `build_alias', `host_alias', and + `target_alias' are precious. + * doc/autoconf.texi: Adjust. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE_ENVIRONMENT): Neutralize also + LC_COLLATE and LC_NUMERIC. + * autoconf.m4: Don't rely on character ranges with tr. + * doc/autoconf.texi (Special Shell Variables): Adjust. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (_AC_LIBOBJ_STRTOD, AC_FUNC_STRTOD, + AM_FUNC_STRTOD): New macros, from Automake. + * acfunctions: Adjust. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * acidentifiers: Catch ptrdiff_t. + * acspecific.m4 (AM_TYPE_PTRDIFF_T): AU define. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * autoscan.pl: Be ready to handle AC_CHECK_TYPES requests. + Quote properly the output. + Remove useless backslashes. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AC_FUNC_ONSTACK): New macro, from + Automake. + * doc/autoconf.texi (Particular Functions): Adjust. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * acfunctions.m4 (AC_FUNC_ERROR_AT_LINE): New macro, from + Automake. + * doc/autoconf.texi (Particular Functions): Adjust. + +2000-08-01 Akim Demaille <akim@epita.fr> + + Create acfunctions.m4, in charge of the macros related to + functions. + + * acgeneral.m4 (AC_CHECK_FUNC, AC_CHECK_FUNCS, AC_REPLACE_FUNCS): + Move to... + * acfunctions.m4: here, new file. + * acspecific.m4 (_AC_LIBOBJ_ALLOCA, AC_FUNC_ALLOCA, AC_FUNC_CHOWN, + AC_FUNC_CLOSEDIR_VOID, AC_FUNC_FNMATCH, AC_FUNC_GETGROUPS, + _AC_LIBOBJ_GETLOADAVG, AC_FUNC_GETLOADAVG, AC_FUNC_GETMNTENT, + AC_FUNC_GETPGRP, AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, + AC_FUNC_MALLOC, AC_FUNC_MEMCMP, AC_FUNC_MKTIME, AC_FUNC_MMAP, + AC_FUNC_SELECT_ARGTYPES, AC_FUNC_SETPGRP, _AC_FUNC_STAT, + AC_FUNC_STAT, AC_FUNC_LSTAT, AC_FUNC_STRERROR_R, AC_FUNC_STRFTIME, + AC_FUNC_VFORK, AC_FUNC_VPRINTF, AC_FUNC_WAIT3, AC_FUNC_UTIME_NULL, + AC_FUNC_STRCOLL, AC_FUNC_SETVBUF_REVERSED): Likewise. + * Makefile.am: Adjust. + + Move also the old definitions into acfunctions.m4, and adjust the + test suite. + + * acgeneral.m4 (AU_ALIAS): New macro. + * acoldnames (AC_FUNC_CHECK, AC_HAVE_FUNCS, AC_ALLOCA, + AC_GETLOADAVG, AC_MMAP, AC_SETVBUF_REVERSED, AC_STRCOLL, + AC_UTIME_NULL, AC_VFORK, AC_VPRINTF, AC_WAIT3, AM_FUNC_FNMATCH, + AM_FUNC_MKTIME, fp_FUNC_FNMATCH): Move to... + * acfunctions.m4: here, using AU_ALIAS. + * acgeneral.m4 (AC_FD_CC, AC_CANONICAL_SYSTEM): Use AU_ALIAS to + define them. + * acoldnames.m4: Use AU_ALIAS instead of AU_DEFUN. + * tests/Makefile.am (MACRO_FILES): Adjust. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * autoscan.pl: Use Getopt::Long; + * acidentifiers: Classify, sort. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_PROG_CXX_GNU, _AC_PROG_CC_GNU, _AC_PROG_F77_GNU): + Use grep instead of egrep, don't redirect stderr. + +2000-08-01 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_NOTICE): Adjust so that there are no + empty lines in the header comments (should be `#' alone instead). + Reported by Didier Verna. + +2000-08-01 Greg A. Woods <woods@weird.com> + + * doc/autoconf.texi (Installation Directory Variables): + Clarifications and typos. + +2000-08-01 Didier Verna <didier@lrde.epita.fr> + + * acgeneral.m4 (AC_REVISION): Put a dot at the end of the line. + (_AC_INIT_HELP): Output the bug report address at + the end of a `configure --help' output. + (_AC_INIT_NOTICE): Ditto, but at the top of `configure'. + +2000-07-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE_FDS): New macro, pulled out of + (_AC_INIT_PREPARE): here, where it is called from. + * aclang.m4 (_AC_PROG_CC_G, _AC_PROG_CXX_G): Don't test -z "`foo`". + +2000-07-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_DIVERT(INIT_PARSE_ARGS)): Rename as... + (_AC_DIVERT(PARSE_ARGS)): this. Adjust dependencies. + (AC_ARG_WITH): Remove spurious newline. + (AC_ARG_VAR): No longer save precious variables in + ac_configure_args, rather snapshot them twice (one kept + unmodified, another one to be written to/overwritten by the cache + file). + (AC_CACHE_SAVE): Let the cache variables named `ac_cv_env_*' + be overwritten when loading the cache (i.e., don't use the + : ${foo=...} trick). + (_AC_ARG_VAR_VALIDATE): Compare the two snapshots of the precious + variables. + (_AC_INIT_PREPARE): Call it after having loaded the cache file. + +2000-07-28 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_LANG_CONFTEST, _AC_PROG_CC_GNU, _AC_PROG_CXX_GNU, + _AC_PROG_F77_GNU): Use ac_ext. Use _ACEOF instead of ACEOF. + +2000-07-28 Akim Demaille <akim@epita.fr> + + * autoconf.sh (--warnings): Catch `no-category', not `nocategory'. + * autoheader.sh: Likewise. + * acgeneral.m4 (_AC_WARNING_IFELSE): Adjust. + +2000-07-28 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Installation Directory Variables): New + section, Eved off from `Preset Output Variables', i.e., was a + small part of it, grew independent, and is its equal (at least). + (Coding Style): `$#' padding. + * Makefile.am (editsh, editpl): Do what the doc says you do: use + @datadir\@ instead of @''datadir''@. + +2000-07-28 Akim Demaille <akim@epita.fr> + + * aclang.m4 (_AC_PROG_CC_GNU, _AC_PROG_CXX_GNU, + _AC_PROG_F77_GNU): Use ac_ext. Use ACEOF instead of EOF. + (AC_LANG_CONFTEST): New macro. + (_AC_PROG_CC_G, AC_PROG_CC_C_O, _AC_PROG_CXX_G, AC_PROG_F77_C_O, + _AC_PROG_F77_V_OUTPUT): Use it. + * acgeneral.m4 (AC_TRY_CPP, AC_EGREP_CPP, AC_COMPILE_IFELSE, + AC_LINK_IFELSE, AC_RUN_IFELSE): Likewise. + +2000-07-24 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_F77_FUNC): New macro to give the user a clean + way of accessing Fortran name-mangling information other than + through CPP, and without having to know the different possible + name-mangling schemes. + * autoconf.texi: Documented AC_F77_FUNC + +2000-07-24 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_CHECK_TYPE_BUILTIN_P): Add `off_t' and + `size_t' which are often used too. + Fix a bug which prevents recognition of `bool' and `char'. + (_AC_CHECK_TYPE_MAYBE_TYPE_P): New macro. + (AC_CHECK_TYPE): Use it. + +2000-07-19 Peter Eisentraut <peter_e@gmx.net> + + * Makefile.am: Remove INSTALL.txt by maintainer-clean target. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * autoupdate.sh: Typo: s/infile/file/. + +2000-07-19 Martin Wilck <martin@tropos.de> + + * aclang.m4 (AC_F77_NAME_MANGLING): Obsolete, becomes + _AC_F77_NAME_MANGLING. + (_AC_F77_NAME_MANGLING): Use independent checks for the + name mangling of symbols with and without underscores. + Use algorithm with for loops instead of recursive macro calls. + (AC_F77_WRAPPERS): Adapt to changes in _AC_F77_NAME_MANGLING. + * doc/autoconf.texi (Fortran 77 Compiler Characteristics): + Remove documentation of AC_F77_NAME_MANGLING. + Remove documentation of f77_case and f77_underscore. + Replace AC_F77_FUNC_WRAPPER with AC_F77_WRAPPERS. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * NEWS: Fresh air. + * TODO: Fresh blood. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (autoheader Invocation): Explain the purpose + of autoheader. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi: Various English fixes from Jim. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Compilers and Preprocessors, Obsolete + Macros): Don't give boring internal details. + (Language Choice): Typo. + (Limitations of Builtins): Some about `!', `set', `$@'. + (Coding Style): Some about $[@] quotation. + Some about cross-compilation. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (dir): When verbose, say what are the tools you + will use. + +2000-07-19 Akim Demaille <akim@epita.fr> + + Warnings related to obsolete constructs should be properly + classified. + + * acspecific.m4 (AC_RSH, AC_USG, AC_MEMORY_H, AC_DIR_HEADER, + AC_INT_16_BITS, AC_LONG_64_BITS, AC_STRUCT_ST_BLKSIZE, + AC_STRUCT_ST_RDEV, AC_HAVE_POUNDBANG, AC_ARG_ARRAY): Use + `AC_DIAGNOSE(obsolete, ...)' instead of `AC_WARNING'. + +2000-07-19 Akim Demaille <akim@epita.fr> + + autoconf -W error does not work. + + * acgeneral.m4 (_AC_DIAGNOSE): use _AC_WARNING_IFELSE, + _AC_WARNING_ENABLE is dead. + +2000-07-19 Akim Demaille <akim@epita.fr> + + Martin Wilck found a Fortran 77 compiler which always exits with + success. + + * acgeneral.m4 (AC_COMPILE_IFELSE): Also check that the output + file was created and is nonempty. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Introduction): More about CVS, Gnats, the web + pages, and the mailing lists. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Prerequisite Macros): Dedocument AC_PROVIDE. + (Coding Style): Move some into... + (Macro Definitions): here. + +2000-07-19 Akim Demaille <akim@epita.fr> + + The --help message should have paragraphs starting with a title, + the options, and then optionally a small paragraph. + + * acgeneral.m4 (AC_DIVERT_ONCE): New macro. + (HELP_VAR_END): New diversion. + (AC_ARG_ENABLE, AC_ARG_WITH, AC_ARG_VAR): Use AC_DIVERT_ONCE. + (AC_ARG_VAR): Follow the --help style. + * acspecific.m4 (AC_PATH_X): Use AC_DIVERT_ONCE. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_PROG_CC): Don't require AC_PROG_F77, require + AC_PROG_CC instead. + From Martin Wilck. + (AC_PROG_F77_C_O): Require AC_PROG_F77. + Use a cache variable independent of $F77. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * autoreconf.sh: Accept --symbolic and -s. + +2000-07-19 Akim Demaille <akim@epita.fr> + + Make it clear that the regular user does not need --macrodir. + In fact, rename this option as -A, --autoconf-dir. + + * autoconf.sh: Complain when -m, --macrodir is used. + Accept -A, --autoconf-dir. + Use $autoconf_dir instead of $AC_MACRODIR. + Adjust --help. + * autoheader.sh: Likewise. + * autoscan.sh: Likewise. + * autoupdate.sh: Likewise. + Use $optarg. + * autoreconf.sh: Likewise. + * doc/autoconf.texi: Adjust. + * tests: Adjust the test suite. + +2000-07-19 Akim Demaille <akim@epita.fr> + + * autoreconf.sh: Forward --debug to sub tools. + Let them share the same tmp dir. + +2000-07-18 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_MING32): Rename as AC_MINGW32. + +2000-07-18 Steven G. Johnson <stevenj@alum.mit.edu> + + Fixed bug where the F77 compiler output was parsed differently + when detecting the verbose flag than when scanning for linker + options, and as a result the former test failed (under AIX/xlf). + + * aclang.m4 (_AC_PROG_F77_V_OUTPUT): New macro to get the + output of linking an F77 program with a given verbose flag, + and preprocess it as required to scan for linker flags. + (_AC_PROG_F77_V): Use the above macro here... + (AC_F77_LIBRARY_LDFLAGS): ...and here, enforcing consistency. + +2000-07-17 Martin Wilck <martin@tropos.de> + + * autoupdate.sh (autoconf): s,$updated,$tmp/updated,. + +2000-07-17 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Configuration Actions): Explain the + behavior of AC_CONFIG_HEADERS and AC_CONFIG_FILES with respect to + absolute and relative filenames, and stdin/stdout. + (config.status invocation): Likewise. + +2000-07-17 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Configuration Actions): Explain the + behavior of AC_CONFIG_HEADERS and AC_CONFIG_FILES with respect to + absolute and relative filenames, and stdin/stdout. + (config.status invocation): Likewise. + +2000-07-13 Akim Demaille <akim@epita.fr> + + Make it easier to trace what autoreconf does. + + * autoheader.sh: Be more verbose, and always report your name in + verbose messages. + * autoconf.sh: Likewise. + * autoreconf.sh: Likewise. + (update.sh): Redirect ls' stderr to /dev/null. + +2000-07-13 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS): Properly + handle absolute input file names. + From Alexandre Oliva. + +2000-07-12 Martin Wilck <martin@tropos.de> + + * aclang.m4 (AC_PROG_F77): Delete AC_BEFORE(AC_PROG_CPP) that + leads to unnecessary warnings if both C and Fortran are checked. + (AC_PROG_F77_C_O): AC_REQUIRE AC_PROG_F77 instead of pretend you + need to be AC_BEFORE it. + +2000-07-12 Akim Demaille <akim@epita.fr> + + * autoconf.sh (_ac_warnings): Fix call to tr. + Reported by Johan Danielsson. + +2000-07-11 Martin Wilck <martin@tropos.de> + + * aclang.m4 (_AC_PROG_F77_V): New macro to determine the flag that + causes the compiler to output verbose linking information. + (AC_F77_LIBRARY_LDFLAGS): Use _AC_PROG_F77_V instead of + simply "-v" + (AC_F77_LIBRARY_LDFLAGS): New algorithm to parse flags, uses + set/shift shell commands. + (AC_F77_LIBRARY_LDFLAGS): Set FLIBS at end, after determining + ac_cv_flibs. + +2000-07-11 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_DEFAULTS) <ac_max_here_lines>: Set to 38 + instead of 48, to pass the test on RISC/OS 4.52. + +2000-07-11 Akim Demaille <akim@epita.fr> + + !*^&$@ sed portability problems... The test on AC_CHECK_TYPES is + failing on RISC/OS 4.52 because of the forget-to-reset-the-flag + bug in its sed. + + * acgeneral.m4 (_AC_OUTPUT_HEADERS): Work around this bug. + +2000-07-11 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_INT_16_BITS, AC_LONG_64_BITS): s/ac_check/ac_cv/. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS): Look for + the input files first in $builddir, then $srcdir. + Suggested by Lars J. Aas, designed by Alexandre Oliva. + +2000-07-10 Lars J. Aas <larsa@sim.no> + + * acgeneral.m4 (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS): + Accept special filename '-' for stdin and stdout. + +2000-07-10 Akim Demaille <akim@epita.fr> + + Alexandre's suggestions. + + * autoreconf.sh (update.sh): Use `ls -1dt' instead of `-lt'. + Use test instead of sed. + <automake>: If automake is used, always run it: it has its own + mechanism not to update if unneeded. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_PROG_ECHO): Modernize. + +2000-07-10 Akim Demaille <akim@epita.fr> + + Stop being ridiculous :*( + + * acgeneral.m4 (_AC_SHELL_DIRNAME): When using m4 the argument + is named `$1' not `$dir'. + When using m4 you ought to quote properly. + When using m4, you should check that there are not too many shell + quotes (inside the macro itself, and where it is called). + When you do this, Autoconf, hm, works better. + +2000-07-10 Steven G. Johnson <stevenj@alum.mit.edu> + + Improve --help documentation of important environment variables. + + * acgeneral.m4 (_AC_INIT_HELP): Direct reader to descriptions + of useful variables at the end of the --help. + (AC_ARG_VAR): Emphasize use of environment variables to override + and/or help the configure script. Ensure that a given variable + is only documented once in the --help. + (AC_CHECK_LIB): Call AC_ARG_VAR to document and register the + LDFLAGS variable, and... + (AC_CHECK_HEADER): do the same for the CPPFLAGS variable. + * aclang.m4 (AC_PROG_CC): Call AC_ARG_VAR to document and register + the CC and CFLAGS variables, and do the same for... + (AC_PROG_CXX): CXX and CXXFLAGS, and... + (AC_PROG_F77): F77 and FFLAGS. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * Makefile.am (wget-update): New target. + (WGET): New variable. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Coding Style): Some more constraints :). + +2000-07-10 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_FUNC_STRERROR_R): Aaaaaaarg! Don't leave the + AC_DEFINE inside the AC_CACHE_CHECK. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_FUNC_STAT, AC_FUNC_STAT, AC_FUNC_LSTAT): New + macros, from Jim's stat.m4 and lstat.m4 serial 6. + * doc/autoconf.texi (Particular Functions): Document + * acfunctions: Add them. + +2000-07-10 Akim Demaille <akim@epita.fr> + + AC_LIBOBJ when used by AC_REPLACE_FUNCS should not complain for + variables as argument. + + * acgeneral.m4 (_AC_LIBOBJ): Same as the former AC_LIBOBJ, but + takes an additional argument: action to perform when non-literal + argument. + (AC_LIBOBJ): Use it. + (AC_REPLACE_FUNCS): Use _AC_LIBOBJ, not AC_LIBOBJ. + +2000-07-10 Akim Demaille <akim@epita.fr> + + LANGUAGE should be neutralized too. + + * acgeneral.m4 (_AC_INIT_PREPARE_ENVIRONMENT): Do it. + * doc/autoconf.texi (Special Shell Variables): Mention it. + +2000-07-10 Akim Demaille <akim@epita.fr> + + Set autoconf's default warnings to `syntax'. + + In fact, honor the most recent specification in the concatenation + of `syntax',$WARNINGS,<options> in that order. + Implement support for `none' and `noCATEGORY' so that the options + may override the previous choices. + Suggested by Didier Verna. + + * acgeneral.m4 (_AC_WARNING_IFELSE): New macro. + (AC_WARNING_IFELSE): Use this macro to implement the new specs. + (AC_WARNING): The empty category must not be used, default to + `syntax'. + * doc/autoconf.texi (autoconf Invocation, Reporting Messages): Adjust. + * autoconf.sh: Adjust. + Use `optarg' to fetch the arguments of options. + Fix a bug in the handling of `--trace='. + + * acgeneral.m4 (AC_CACHE_VAL): Typo: the macro was complaining iff + it shouldn't have. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (--install, --symlink): New options. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (dots, aclocal_m4, acconfig_h): Remove. + Adjust dependencies. + When using $verbose, redirect to stderr. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh: Clarify the difference between the location of + `aclocal.m4' and that of the location Autoconf extensions. + (-M, --m4dir): New option. + (aclocal_flags): Do not use $localdir, but $m4dir. + (localdir_opt): Remove, since $autoconf, $autoheader already + include `-l $localdir'. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoconf.sh (task install): We no longer use AC_INCLUDE. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * acoldnames.m4: Remove the obsolete comments. The technology is + now detailed in `autoupdate'. + Quote the names being defined. + Formatting changes. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_DEFUNCT): Remove. + (AC_RSH, AC_UNISTD_H, AC_USG, AC_MEMORY_H, AC_DIR_HEADER, + AC_INT_16_BITS, AC_LONG_64_BITS): They're alive!... + * doc/autoconf.texi (Obsolete Macros): but not fresh. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (debug): New variable. + (tmp): s/ac/ar/. + <options handling>: Support --debug. + * doc/autoconf.texi: Adjust. + +2000-07-10 Akim Demaille <akim@epita.fr> + + Fix the bugs recently introduced in autoreconf. + + * autoreconf.sh: Don't run automake when the package is not using + it. + When checking whether autoheader should be rerun, don't ask + config.h to be newer than stamp-h and vice-versa. + Remove an unbalanced `fi'. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (run_aclocal): Rename as `uses_aclocal' to avoid + the convention clash with autoconf.sh where `run_foo' is the + command to run `foo'. + (uses_autoheader): New variable. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (update.sh): New sub program. + Use it in the whole process. + (acconfig_h): New variable. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh <run_aclocal>: Use false/: instead of no/yes. + Formatting and factoring changes. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh: You too can have a $tmp dir if you wish. + (alflags.sed): New sub sed program. + Compute the flags of aclocal from Makefile.am instead of + Makefile.in, it is unlikely that aclocal be used but not automake, + while it is convenient to be able to run autoreconf even if + automake was not run yet. + Use `autoconf --trace' to get the list of configuration headers. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PLAIN_SCRIPT): New macro. + * tests/base.m4 (m4_wrap, AC_REQUIRE, AC_SHELL_MKDIR_P): Use it. + * autoconf.sh: Properly handle the case where `$output' is `-' + (i.e., stdout). + Handle `-ofile', not just `-o file'. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh: Formatting changes. + When verbose, display exactly what you do, not just a synopsis. + When using `$verbose' don't use quotes to avoid spurious spaces + for empty arguments. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (force): Instead of yes/no, use :/false. + Adjust the code. + (automake_deps, automake_force): No longer used. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_SHELL_DIRNAME): Use an `expr' solution instead + of echo|sed. + From Paul Eggert. + * doc/autoconf.texi (Limitations of Usual Tools): Include the + words from Paul about `|' with expr(1). + +2000-07-10 Akim Demaille <akim@epita.fr> + + * aclang.m4: Promote s,,, over s%%%, and `sed prog' over `sed -e + prog'. + * acgeneral.m4: Likewise. + * acspecific.m4: Likewise. + * doc/autoconf.texi (Limitations of Usual Tools, Coding Style): + Likewise. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * autoconf.sh: When using `mktemp -d', be sure that the directory + was created. + * autoheader.sh: Likewise. + * autoreconf.sh: Likewise. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * AUTHORS: Update. + * doc/autoconf.texi: Free Franc,ois Pinard from iftex and ifinfo, + use @,c. + Don't use `@code{m4}' when you mean M4, just as you shall not say + `@code{cc}' when you refer to the C language. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_LANG(C), AC_LANG(C++), AC_LANG(Fortran 77)): Set + ac_gnu_compiler. + (_AC_PROG_CC_GNU, _AC_PROG_CXX_GNU, _AC_PROG_F77_GNU): Compute + ac_gnu_compiler. + * acgeneral.m4 (AC_LINKER_OPTION): Adjust. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): Move the code + processing the result of AC_PROG_CC_G, AC_PROG_CXX_G, and + AC_PROG_F77_G into them. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Multiple Cases, Quotation Rule Of Thumb): + Follow the coding style. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Obsoleting Macros): Is not a subsection of + `Dependencies Between Macros', but rather a section of `Writing + Macros'. + +2000-07-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Coding Style): New node. + +2000-07-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_SHELL_MKDIR_P): s/ac_dir/ac_mkdir_dir/ to avoid + clashes with the numerous ac_dir loops. + Reported by Lars J. Aas. + +2000-07-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_SHELL_DIRNAME): Return `.', not `' when there + is no directory part. + +2000-07-07 François Pinard <pinard@iro.umontreal.ca> + + * tests/atgeneral.m4 (AT_CHECK): Fix a redirection problem. + +2000-07-07 Akim Demaille <akim@epita.fr> + + AC_REVISION must not AC_REQUIRE AC_INIT, it leaves the diversions + in a messy state. Don't even try to emulate AC_REQUIRE: just + introduce a diversion just for AC_REVISION, and let the magic + happen. + Fixes Autoconf PR/134, from Raja R Harinath. + + * acgeneral.m4 (_AC_DIVERT(REVISION)): New diversion. + (AC_REVISION): Don't require AC_INIT, dump in your diversion. + (_AC_INIT): Delete, inline its body in... + (AC_INIT): here. + (_AC_INIT_NOTICE, _AC_INIT_COPYRIGHT): New macros so that... + (AC_INIT): be more uniform. + (AC_INIT, AC_REVISION, AC_COPYRIGHT): `define', don't AC_DEFUN. + +2000-07-07 Martin Wilck <martin@tropos.de> + + * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Keep -lm, if a Fortran + compiler needs it, it is likely to be required when linking C/C++ + with Fortran. + <-YP,*>: Fix the list of arguments to loop on. + Don't mess with the user variable name space. + <ac_ld_run_path>: Prepend LD_RUN_PATH directories with -R only + when running Solaris (without this, link errors occur). + +2000-07-06 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_SHELL_DIRNAME): Fix quotation. + +2000-07-06 Akim Demaille <akim@epita.fr> + + * aclang.m4: Formatting and quotations changes. + +2000-07-06 Raja R Harinath <harinath@cs.umn.edu> + + * aclang.m4 (AC_LANG_INT_SAVE(C++)): Be a copy of + AC_LANG_INT_SAVE(C), not AC_LANG_INT_SAVE_TRY(C). + Fixes Autoconf PR/133. + +2000-07-06 Mo DeJong <mdejong@cygnus.com> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS, AC_CHECK_TOOLS): Change + warning message printed when only --host is given. Fix printing + of multiple compiler cache values, use PATH argument. + * aclang.m4 (AC_LANG_COMPILER_WORKS): Print the cross compile + status, fix problem where two results were printed at once. + +2000-07-06 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_SHELL_TMPDIR): Typo. + +2000-07-06 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * acgeneral.m4 (_AC_SHELL_DIRNAME): Behave properly when the + argument has trailing slashes, and when its depth is just one + (`/tmp'). + +2000-07-06 Lars J. Aas <larsa@sim.no> + + * acgeneral.m4 (_AC_SHELL_DIRNAME): New macro. + (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS, _AC_OUTPUT_LINKS): + Use _AC_SHELL_DIRNAME. + +2000-07-06 Martin Wilck <martin@tropos.de> + + * aclang.m4 (AC_PROG_F77): Add two compilers, + lf95 (Lahey/Fujitsu Fortran) and pgf77 (Portland Group Fortran) + (_AC_PROG_F77_G): Some Fortran compilers produce stdout/stderr + output even if no errors occur - check exit status rather than + output. + +2000-07-05 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_SHELL_TMPDIR): When using `mktemp -d', be sure + that the directory was created: under Ultrix 4.3 it just returns + a name, but does not create the directory. + Reported by Christian Krackowizer. + +2000-07-03 Lars J. Aas <larsa@sim.no> + + * acgeneral.m4 (AC_SHELL_MKDIR_P): New macro. + (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS, _AC_OUTPUT_LINKS, + AC_PROG_INSTALL): Use AC_SHELL_MKDIR_P. + * tests/base.m4 (AC_SHELL_MKDIR_P): Test it. + +2000-07-04 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CACHE_LOAD): Be ready to read the cache even + when `.' is not in the PATH. + * doc/install.texi (configure Invocation): Adjust. + +2000-06-30 Jim Meyering <meyering@lucent.com> + + * acgeneral.m4 (AC_REQUIRE): Tweak a diagnostic. + +2000-06-30 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + Re-enable the old behavior of --host and --build. + + * acgeneral.m4 (build_alias): Set to host_alias if --build is not + given but --host is, and enable cross-compile auto-detection. If + both are, and are different, enable cross compilation. + (AC_CANONICAL_HOST): Adjust help message. + (cross_compiling): Enclose in quotes when testing. + * aclang.m4 (_AC_LANG_COMPILER_WORKS): If cross_compiling is + maybe, set it to yes or no depending on the result of the + execution test. + * doc/autoconf.texi: Document the change. + * doc/install.texi: Likewise. + +2000-06-27 Jim Meyering <meyering@lucent.com> + + * acspecific.m4 (_AC_LIBOBJ_GETLOADAVG): Put quotes around use of + `$ac_cv_lib_elf_elf_begin', since that variable may not be defined. + From Volker Borchert. + +2000-06-26 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi: Fix various typos. + (Limitations of Usual Tools) <sed>: Anchors and groups. + (Language Choice): Don't mention cross_compiling here, do it... + (Specifying Names) <--host>: here. + (Obsoleting Macros): Don't document AC_DEFUNCT, it's going to be + removed anyway, obsoleted itself by AU_DEFUN. + +2000-06-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CACHE_VAL): Swap the arguments of `regexp'. + Reported by Alexandre Oliva. + +2000-06-26 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (automake, aclocal): New variables. Import + $AUTOMAKE and $ACLOCAL. + Pass --verbose to the tools. + Avoid using plenty of variables, just append to existing + variables. + * doc/autoconf.texi: List options in the order --help, --version, + --verbose, --debug, and then specific options. + +2000-06-26 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi: Various Texinfo adjustments. + (Specifying Names): When describing the system triplets, use the + same names as the shell variables. + (System Type Variables): Delete, merge its content into... + (Canonicalizing): here. + Clarify the difference between the `foo_target' and `foo' + variables. + +2000-06-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS, _AC_OUTPUT_CONFIG_STATUS): + s/echo | sed/expr/. + +2000-06-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CONFIG_LINKS, AC_CONFIG_HEADERS, + AC_CONFIG_COMMANDS, AC_CONFIG_FILES): Use a shell variable instead + of an m4 variable to store what must be done, so that sh + conditionals are honored. + (_AC_OUTPUT_LINKS, _AC_OUTPUT_HEADERS, + _AC_OUTPUT_COMMANDS, _AC_OUTPUT_FILES): Adjust. + * tests/semantics.m4: Test the four AC_CONFIG sisters. + * doc/autoconf.texi (Configuration Actions): Promote the use of + literals, show it works properly with sh conditionals. + +2000-06-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CACHE_VAL): Too many people put AC_DEFINE in + the commands-to-set-it part of it. Give them a warning. + +2000-06-26 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Prerequisite Macros): More about AC_REQUIRE. + +2000-06-26 Akim Demaille <akim@epita.fr> + + Given better names to the diversions. + + * acgeneral.m4 (_AC_DIVERT(NORMAL_2), _AC_DIVERT(NORMAL_3), + _AC_DIVERT(NORMAL_4)): Delete, unused. + (_AC_DIVERT(NORMAL_1), _AC_DIVERT(NORMAL), AC_DIVERT_DIVERSION): + Rename as _AC_DIVERT(PREPARE), _AC_DIVERT(BODY), + _AC_DIVERT_DIVERSION. + +2000-06-26 Akim Demaille <akim@epita.fr> + + The current implementation of AC_REQUIRE fails on + + | AC_DEFUN([TEST1], [REQUIRE([TEST2a])REQUIRE([TEST2b])]) + | AC_DEFUN([TEST2a], []) + | AC_DEFUN([TEST2b], [REQUIRE([TEST3])]) + | AC_DEFUN([TEST3], [REQUIRE([TEST2a])]) + | + | AC_INIT + | TEST1 + + because it produces TEST3; TEST2a; TEST2b; TEST1. + Fix this bug, implement the solution provided by Axel Thimm, + and test AC_REQUIRE. + + * acgeneral.m4: Document this implementation. + (_AC_DEFUN_PRO, _AC_DEFUN_EPI, AC_REQUIRE): Be sure that macros + are emitted in the same order as they are expanded. + (AC_REQUIRE): Forbid being calling out of an AC_DEFUN'd macro (in + particular the top level). + * tests/base.m4 (AC_REQUIRE): New test. + +2000-06-26 Akim Demaille <akim@epita.fr> + + A macro which is not defined with AC_DEFUN should not be + AC_REQUIRE'd, since it doesn't AC_PROVIDE itself. + + * acgeneral.m4 (AC_REQUIRE): Issue a warning when after expansion, + the macro is not AC_PROVIDE'd. + +2000-06-26 Akim Demaille <akim@epita.fr> + + Various cleanups. + + * acgeneral.m4 (AC_PRO, AC_EPI): Rename as _AC_DEFUN_PRO and + _AC_DEFUN_EPI. + Adjust dependencies. + (AC_DEFUN): Remove the not-to-be-released specializing mechanism. + (AC_SPECIALIZE): Remove for the same reasons. + Adjust dependencies. + (_AC_INIT_DEFAULTS, _AC_INIT_PARSE_ARGS, _AC_INIT_VERSION, + _AC_INIT_PREPARE, _AC_CANONICAL_SPLIT, _AC_CHECK_TYPE_NEW, + _AC_CHECK_TYPE_OLD): Define via `define' instead of `AC_DEFUN': + they are not related to AC_REQUIRE in any way. + * acspecific.m4 (AC_PROG_ECHO, _AC_DECL_YYTEXT, _AC_PATH_X_XMKMF, + _AC_PATH_X_DIRECT): Define via `define' instead of `AC_DEFUN'. + +2000-06-19 Steven G. Johnson <stevenj@alum.mit.edu> + + * acgeneral.m4 (AC_CHECK_TOOL): Use two variables in order to + avoid cache variable conflicts between AC_CHECK_PROG invocations. + (AC_PATH_TOOL): Fix same bugs as in 6/9/00 fixes to AC_CHECK_TOOL. + Pass correct arguments to AC_CHECK_PATH (different from + AC_CHECK_PROG). Use AC_CHECK_PATH cache variable, not + AC_CHECK_PROG var, and use two variables for two invocations as + above. Quote AC_CHECK_* args. + +2000-06-16 Akim Demaille <akim@epita.fr> + + The test suite reveals AC_OUTPUT_MAKE_DEFS fails on RISC/OS. + + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS) <confdef2opt.sed>: Reset the + t flag between each cycle. + * doc/autoconf.texi (Limitations of Usual Tools): Some about the t + flag in sed. + +2000-06-16 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_EXEEXT, AC_OBJEXT): Don't obsolete them, let + them be empty, so that Automake still provide support for $(EXEEXT). + +2000-06-15 Akim Demaille <akim@epita.fr> + + * autoconf.sh (option handling): Give a more understandable + message when an option is missing its argument. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * autoheader.sh: Likewise. + +2000-06-13 Akim Demaille <akim@epita.fr> + + `./config.status -d' is buggy. + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Remove the `shift' in + --debug. + * doc/autoconf.texi (Limitations of Builtins): Some about shift. + +2000-06-13 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Caching Results): Bigger warning about the + extremely frequent action-in-commands bug. + Move the documentation of AC_CACHE_SAVE and AC_CACHE_LOAD... + (Cache Files): into here. + +2000-06-09 Steven G. Johnson <stevenj@alum.mit.edu> + + * acgeneral.m4 (AC_CHECK_TOOL): Even if VALUE-IF-NOT-FOUND is not + specified, we should still check whether PROG-TO-CHECK-FOR + actually works before returning it when the prefixed program is + not found. Also, fixed a bug where it failed to pass the PATH + argument in the second call to AC_CHECK_PROG. + +2000-06-09 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_TOOLS): Rewrite. + +2000-06-09 Paul Eggert <eggert@twinsun.com> + + * doc/autoconf.texi: Use `@option' for options, not `@samp' nor + `@code'. + * doc/install.texi: Likewise. + +2000-06-09 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Don't require AC_CYGWIN. + (AC_F77_NAME_MANGLING): Removed useless comment. + (_AC_PROG_F77_GNU): Use `.f' not `.fpp' which is not properly + processed by Abysoft's Fortran compiler. + +2000-06-09 Steven G. Johnson <stevenj@superjdj.mit.edu> + + * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Fixed bug where + compiler output to stdout was not caught and interpreted. + +2000-06-09 Akim Demaille <akim@epita.fr> + + `autoconf --trace' dies on filenames with `:'. + Reported by Mark Elbrecht. + + * autoconf.sh <trace> (trace2m4.sed): Use `..*' instead of + `[^:][^:]*' to catch file names. The rest of regex is probably + precise enough to avoid incorrect parsing. + +2000-06-09 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_SYS_LARGEFILE_MACRO_VALUE): Always initialize + $3 to no. + +2000-06-08 Paul Eggert <eggert@twinsun.com> + + Import AC_SYS_LARGEFILE from largefile.m4 serial 12. + + * acspecific.m4 (AC_SYS_LARGEFILE, _AC_SYS_LARGEFILE_MACRO_VALUE, + _AC_SYS_LARGEFILE_SOURCE): New. + * doc/autoconf.texi (System Services): Document AC_SYS_LARGEFILE. + +2000-06-08 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Don't override FLIBS if + specified by the user. + Fix a bug: use the cached value to set FLIBS. + +2000-06-07 Dave Love <fx@gnu.org> + + * aclang.m4 (AC_PROG_F77): Check for f95 and fc too. + +2000-06-07 Philippe De Muyter <phdm@macqel.be> + + `foo=1 foo=2 cmd' has an undefined behavior. + + * acgeneral.m4 (_AC_COMPUTE_INT_COMPILE): Do not put two shell + variable assignments in one shell command. + * doc/autoconf.texi (Shell Substitutions): Document. + +2000-06-07 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Fix problem on Cray due to + confusion from the link command getting echoed in quotes. In the + future, a more general fix for quoted arguments with spaces might + be better. + +2000-06-07 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Builtins): More on `test' and + `case'. + Some on `if' and `break'. + +2000-06-07 Morten Eriksen <mortene@sim.no> + + * acspecific.m4 (_AC_PATH_X_DIRECT): Include `X11/Intrinsic.h' + when trying to use `XtMalloc' to actually have a chance of + succeeding. + +2000-06-07 Akim Demaille <akim@epita.fr> + + Hard (code) X. + + * acspecific.m4 (_AC_PATH_X_DIRECT): Hard code `X11/Intrinsic.h' + instead of using `ac_x_direct_test_include', likewise for `Xt' and + `ac_x_direct_test_lib', `XtMalloc' and + `ac_x_direct_test_function'. + +2000-06-07 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_PATH_X): Use AC_DIVERT. + Use `no', not `NO' for ac_x_includes and ac_x_libraries. + Adjust dependencies. + (_AC_PATH_X_DIRECT): Introduce ac_x_header_dirs to factor the list + of places where headers and libs might be. + (AC_PATH_XTRA): Don't quote the argument of `case'. + +2000-06-07 Jim Meyering <meyering@lucent.com> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Put the expansion of + AC_LIST_LINKS in an unquoted `here'-document. + +2000-06-06 Akim Demaille <akim@epita.fr> + + * tests/aclocal.m4 (AC_ENV_SAVE): Skip `no_x'. + From Mark Elbrecht. + +2000-06-05 Mo DeJong <mdejong@cygnus.com> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Move the setting + of ac_tool_prefix before the call to AC_DIVERT_POP. + +2000-06-05 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_TOOL_PREFIX): AU define it. + Suggested by Mo DeJong. + +2000-06-05 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_C_CHAR_UNSIGNED): Use the new compiler-test + technology so that we can do the test via compilations only. Also + use (char) -1 instead of (char) 255 to check if char is unsigned. + +2000-05-28 Jim Meyering <meyering@lucent.com> + + * acspecific.m4 (AC_FUNC_STRERROR_R): Call strerror_r with 2nd arg + of type char*, not int. Suggestion from Paul Eggert. + + * doc/autoconf.texi (Particular Functions): Give better description of + AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK. From Paul Eggert. + +2000-05-26 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Usual Tools): Document `ln -s' + on DJGPP, based on the comments from Mark Elbrecht. + +2000-05-26 Akim Demaille <akim@epita.fr> + + * autoreconf.sh (autoconf, autoheader): Be more conscientious when + looking for the executable. + * autoupdate.sh: Likewise. + * autoheader.sh: Likewise. + Suggested by Alexandre Oliva. + +2000-05-26 Akim Demaille <akim@epita.fr> + + Thanks to --program-transform-name, `autoconf' might be install as + `yo-man-i-am-the-all-mighty-AVt0c0nF-eh-eh'. But when + `yo-man-i-am-the-all-mighty-AVt0h3Ad3R-eh-eh' and the other tools + want to trace, they might stupidly invoke the program named + `autoconf' instead. Pfff, stupid scripts :) + + * Makefile.am (editsh): Transfer the names of the install + `autoconf' and `autoheader'. + * autoconf.sh: Add a missing period at the end of the comment + # Parse command line + Make sure to have a ChangeLog much longer than the patch. + * autoheader.sh: Use the right `autoconf'. + * autoupdate.sh: Likewise. + * autoreconf.sh: Likewise, and for `autoheader' too. + Simplify the handling of localdir and AC_MACRODIR. + * ifnames.sh: Formatting changes. + +2000-05-25 Steven G. Johnson <stevenj@alum.mit.edu> + + Don't use f2c as a possible Fortran compiler, since by itself it + cannot produce object code. + + * aclang.m4 (AC_PROG_F77): Remove f2c from the search list. + * doc/autoconf.texi: Excise mentions of f2c in AC_PROG_F77 docs. + +2000-05-26 Mark Elbrecht <snowball3@bigfoot.com> + + Currently, AC_PROG_LN_S incorrectly reports yes with DJGPP. This + is because the DJGPP `ln' emulates soft links for executables by + generating a stub that in turn calls the real program. This + feature also works with nonexistent files like in the Unix + spec. So `ln -s X conftestdata' will generate `conftestdata.exe' + which will attempt to call 'X.exe'. But this feature only works + for executables. Fix it. + + * acspecific.m4 (AC_PROG_LN_S): Create a sample file and use it to + test `ln -s'. + +2000-05-26 Ossama Othman <ossama@ece.uci.edu> + + * aclang.m4 (AC_PROG_CXX): Look for aCC before CC. + +2000-05-26 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_FUNC_STRERROR_R): New, from `strerror_r.m4', + serial 2, by Jim Meyering. + (AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK): New, from + `lstat-slash.m4', serial 1, by Jim Meyering. + * acfunctions: Adjust. + +2000-05-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_TOOLS): Don't require + AC_CHECK_TOOL_PREFIX, it's dead. + +2000-05-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Simplify all the + case "$switch" in + into + case $switch in + * acspecific.m4: Likewise. + * aclang.m4: Likewise. + +2000-05-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_TOOL_PREFIX): Remove. + Adjust dependencies. + (_AC_INIT_PARSE_ARGS): Set ac_tool_prefix. + +2000-05-26 Akim Demaille <akim@epita.fr> + + In `info', it is easier to type `autoconf <TAB>' to reach the list + of options, that `Invoking autoc<TAB>'. + + * doc/autoconf.texi: s/Invoking foo/foo Invocation/. + +2000-05-26 Akim Demaille <akim@epita.fr> + + Merge `Upgrading' and `Obsolete Constructs' together. + + * doc/autoconf.texi (Obsolete Constructs): Move right after + `Recreation a Configuration. + (Invoking autoupdate): Be a subsection of + `Obsolete Constructs'. + (Upgrading): Demote from chapter to section. + Be a section of `Obsolete Constructs'. + Rename as `Autoconf 1'. + +2000-05-26 Akim Demaille <akim@epita.fr> + + Find a means to extract integers from the compiler. + Use this technology to compute `sizeof' even when cross-compiling. + Ideas and initial suggestion by Kaveh Ghazi. + Binary search by Bruno Haible. + + * aclang.m4 (AC_LANG_BOOL_COMPILE_TRY, + AC_LANG_BOOL_COMPILE_TRY(C), AC_LANG_BOOL_COMPILE_TRY(C++), + AC_LANG_INT_SAVE, AC_LANG_INT_SAVE(C), AC_LANG_INT_SAVE(C++)): New + macros. + * acgeneral.m4 (_AC_COMPUTE_INT_COMPILE, _AC_COMPUTE_INT_RUN, + _AC_COMPUTE_INT): New. + (AC_CHECK_SIZEOF): Use them. + Check whether the type exists beforehand. + * tests/semantics.m4 (AC_CHECK_SIZEOF): Strengthen. + +2000-05-26 Ossama Othman <ossama@ece.uci.edu> + + * aclang.m4 (AC_PROG_CXX): Look for aCC KCC RCC xlC_r xlC. + s/c++ g++/g++ c++/. + * doc/autoconf.texi (Compilers and Preprocessors): Adjust. + +2000-05-26 Akim Demaille <akim@epita.fr> + + No library nor special privilege is needed to run `getloadavg' + under FreeBSD. + Reported by Alec Wolman. + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Check for `getloadavg' + without any additional library. + Fixes Autoconf/109. + +2000-05-26 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Usual Tools, Limitations of + Builtins): Integrate comments from Paul Eggert and Jim Meyering. + Add the sed limitation discovered by Philippe De Muyter. + Fix a typo spotted by Pavel Roskin. + +2000-05-25 Akim Demaille <akim@epita.fr> + + The test suite needs GNU m4. + Reported by Bob Friesenhahn. + + * tests/atconfig.in (M4): Set it. + * tests/base.m4: Use it. + +2000-05-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Don't use negated character + classes with `case'. Use `expr' instead. + Suggested by Paul Eggert. + * doc/autoconf.texi (Limitations of Builtins): Explain expr, the + `x' trick, and negated character classes. + +2000-05-24 Didier Verna <didier@lrde.epita.fr> + + * acgeneral.m4 (AC_INIT): Call _AC_PACKAGE before _AC_INIT. + +2000-05-24 Ossama Othman <ossama@debian.org> + + * aclang.m4 (AC_LANG(C++)): Change `ac_ext' from from `C' to `cc' + to avoid potential ambiguities on case-insensitive shells. + +2000-05-24 Mo DeJong <mdejong@cygnus.com> + + Have --host=sun4 automatically look for CC=sun4-cc etc. + + * acgeneral.m4 (AC_CHECK_TOOLS): New. + * aclang.m4 (AC_PROG_CXX, AC_PROG_CC, AC_PROG_F77): Use new + AC_CHECK_TOOLS macro instead of AC_CHECK_PROGS so that a cross + compiler is found by default with --host. + * doc/autoconf.texi (Generic Programs, Manual Configuration): + Describe new AC_CHECK_TOOLS macro. Fix unclear working about + AC_CHECK_PROGS. + * tests/Makefile.am (FILTER_MACROS): Adjust. + +2000-05-24 Akim Demaille <akim@epita.fr> + + The night of the living dead... + + * acspecific.m4 (AC_XENIX_DIR, AC_DYNIX_SEQ, AC_IRIX_SUN, + AC_SCO_INTL): Wake up a few zombies. + * doc/autoconf.texi: Adjust. + * tests/aclocal.m4 (AC_ENV_SAVE): Likewise. + +2000-05-24 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_LANG_FUNC_LINK_TRY, AC_LANG_FUNC_LINK_TRY(C), + AC_LANG_FUNC_LINK_TRY(C++)): New macros. + (AC_CHECK_FUNC): Use it, together with AC_LINK_ELSE. + +2000-05-24 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_FUNC_VFORK): Quote properly. + (AC_FUNC_STRFTIME, AC_FUNC_VFORK, AC_FUNC_VPRINTF): Don't use + AC_DEFINE, just use the AC_CHECK_*S macro. + +2000-05-24 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_WHICH_A): Replace it with... + (AC_SHELL_PATH_WALK): this. + (AC_CHECK_PROG, AC_PATH_PROG): Use it. + +2000-05-24 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Builtins): Document `unset'. + (Special Shell Variables): Adjust. + (Shellology): New section. Introduce bash and zsh. + (Special Shell Variables): Some data on NULLCMD. + (Quotation Thumb Rule): Rename as + (Quotation Rule of Thumb): this. + * acgeneral.m4 (AC_SHELL_UNSET): Remove. + (AC_SHELL_UNSETENV): Rename as... + (AC_SHELL_UNSET): this. + (_AC_INIT_PREPARE_ENVIRONMENT): Prepare bash and zsh. + Adjust to AC_SHELL_UNSET. + +2000-05-24 Akim Demaille <akim@epita.fr> + + The options --build etc. used to set `$build'. *If* + AC_CANONICAL_SYSTEM was run, then the value of `$build' given by + the user was saved into `$build_alias', and `$build' was + normalized using `config.sub'. + + Now, let `--build' set `$build_alias' so that scripts with or + without `AC_CANONICAL_BUILD' have the same semantics. This allows + to use `AC_CHECK_TOOL' without requiring `config.guess' and + `config.sub' (which was bizarre anyway). + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): --build, --host and --target + set `build_alias' etc. + After the option handling, set host to $host_alias etc. for + bugward compatibility. + (AC_CANONICALIZE): Mutate into... + (_AC_CANONICAL_SPLIT): this, which does not canonicalize, it just + computes `$foo_os' etc. + (_AC_CANONICAL_THING): Remove, too confusing. + (AC_CANONICAL_BUILD): Adjust. + Do not assign any value to `build_alias', just compute `build', and + `build_{cpy, vendor, os}'. + (AC_CANONICAL_HOST, AC_CANONICAL_TARGET): Likewise. + (AC_CHECK_TOOL_PREFIX): Fire your rule when `$host_alias' is + given, not when `$host != $build'. + + * acgeneral.m4 (sinclude): Fix typo. + +2000-05-23 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Limitations of Builtins): More details on + `test -n ='. + +2000-05-23 Akim Demaille <akim@epita.fr> + + Simplify the interface: users shouldn't need to explicitly check + for special environments. + + * acspecific.m4 (AC_EXEEXT, AC_OBJEXT): AU defined to + nothing. Replace them by... + (_AC_EXEEXT, _AC_OBJEXT): this. + * aclang.m4 (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): Call them. + (AC_PROG_CC_G, AC_PROG_CXX_G, AC_PROG_F77_G): Rename as... + (_AC_PROG_CC_G, _AC_PROG_CXX_G, _AC_PROG_F77_G): this. + Adjust dependencies. + * tests/Makefile.am (FILTER_MACROS): Adjust. + * doc/autoconf.texi (Compilers and Preprocessors): New section, + move the documentation of AC_PROG_CC, AC_PROG_CC_C_O, + AC_PROG_CC_STDC, AC_PROG_CPP, AC_PROG_CXX, AC_PROG_CXXCPP, + AC_PROG_F77, AC_PROG_F77_C_O, AC_PROG_GCC_TRADITIONAL here. + Factor the comment documentation of AC_PROG_CC, AC_PROG_CXX, + AC_PROG_F77. + +2000-05-23 Akim Demaille <akim@epita.fr> + + Modernize AC_EXEEXT and AC_OBJEXT. + Now work with other languages than C and C++. + + * acspecific.m4 (AC_EXEEXT, AC_OBJEXT): Use + AC_COMPILE_IFELSE/AC_LINK_IFELSE and AC_LANG_PROGRAM instead of + ad hoc code. + Use `$ac_ext' instead of listing `.c', `.C' etc. + Use AC_CACHE_CHECK. + * doc/autoconf.texi (System Services): Adjust. + +2000-05-23 Akim Demaille <akim@epita.fr> + + Simplify the interface: users shouldn't need to explicitly check + for special environments. + + * acspecific.m4 (AC_CYGWIN, AC_EMXOS2, AC_MINGW32): AU defined to + nothing. Replace them by... + (_AC_CYGWIN, _AC_EMXOS2, _AC_MINGW32): these, which are + automatically called by... + (AC_EXEEXT): this. + * doc/autoconf.texi (System Services, Obsolete Macros): Adjust. + +2000-05-23 Akim Demaille <akim@epita.fr> + + AC_PROG_GNU_M4 should actually be private to the package + Autoconf. + + * acspecific.m4 (AC_PROG_GNU_M4): Move to... + * m4/m4.m4: here. + * m4/Makefile.am (EXTRA_DIST): Adjust. + * doc/autoconf.texi (Particular Programs): Adjust. + +2000-05-23 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Exiting from Shell Scripts): Move contents + into... + (Limitations of Builtins): this new node. + Document limitations of `exit', `export' and `case'. + Welcome the documentation of `test' from... + (Limitations of Usual Tools): here. + +2000-05-22 Akim Demaille <akim@epita.fr> + + Load the additions *before* running AC_INIT. + This is important if you want to redefine AC_INIT or some of its + sub macros (eeerk!), or if you want to use user defined macros + before AC_INIT. + Suggested by Didier Verna. + + * acgeneral.m4 (_AC_INIT): Don't include `acsite.m4' and + `aclocal.m4'. + * autoconf.sh (run_m4, run_m4f): Do it. + +2000-05-22 Akim Demaille <akim@epita.fr> + + Reading the ChangeLog revealed that the recent update of + AC_FUNC_GETLOADAVG introduced a bug which already happened (see + Mon Nov 11 18:02:58 1996 David J MacKenzie). + + * acgeneral.m4 (AC_CHECK_LIB): Use a less tempting name: + s/ac_save_LIBS/ac_check_lib_save_LIBS/. + +2000-05-22 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_LIBOBJ_ALLOCA): New macro, extracted from... + (AC_FUNC_ALLOCA): here. Adjust. + +2000-05-22 Akim Demaille <akim@epita.fr> + + Add `configure --config-cache', `-C' as a shortcut for + `--cache-file=config.cache'. + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Let `configure' support + `--config-cache' and `-C'. + Report them in `--help'. + Fix the display of missing argument. + (_AC_OUTPUT_SUBDIRS): Adjust. + * doc/install.texi (Invoking configure): Rename the node as + (Running configure scripts): this, the name of the chapter. + (Operation Controls): Rename as... + (Invoking configure): this. + Document the new options. + * doc/autoconf.texi (direntry): Huh? What is this `aclocal' doing + here? Point to `Invoking configure'. + (Cache Files): No need to document the disabling of the cache. + +2000-05-22 Mark Elbrecht <snowball3@bigfoot.com>, Eli Zaretskii <eliz@gnu.org> + + More MS-DOS support. + + * acgeneral.m4 (_AC_OUTPUT_FILES): Fix the computation of + `ac_file_inputs' for `$ac_given_srcdir' containing a colon. + (AC_CHECK_MEMBERS, AC_PATH_PROG): s/ac_save_ifs/ac_save_IFS/. + +2000-05-22 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_FUNC_CHOWN): New macro, based on Jim + Meyering's `chown.m4' serial 4. + (AC_FUNC_GETGROUPS): New macro, based on Jim Meyering's + `getgroups.m4' serial 3. + (AC_FUNC_MEMCMP): Updated, based on Jim Meyering's `memcmp.m4' + serial 3. + (AC_FUNC_MALLOC): New macro, based on Jim Meyering's + `malloc.m4' serial 3. + (AC_FUNC_MMAP): Include `stdlib.h' when `STDC_HEADERS'. + * acfunctions: Sort. + Add `chown' and `malloc', point `getgroups' to `AC_FUNC_GETGROUPS' + instead of `AC_TYPE_GETGROUPS'. + * doc/autoconf.texi (Particular Functions): Adjust. + +2000-05-22 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Quote the names being m4-defined. + * acspecific.m4: Likewise. + * aclang.m4: Likewise. + +2000-05-22 Akim Demaille <akim@epita.fr> + + Factor the AC_PROG_<compiler>_WORKS macros. + + * acgeneral.m4 (_AC_INIT_DEFAULTS): Set `cross_compiling'. + (AC_TRY_COMPILER): Remove. + * aclang.m4 (AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS, + AC_PROG_F77_WORKS): Removed. + (_AC_LANG_COMPILER_WORKS): New macro. + (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): Adjust. + +2000-05-22 Akim Demaille <akim@epita.fr> + + * aclang.m4: Formatting changes. + +2000-05-22 Akim Demaille <akim@epita.fr> + + More than one argument to `configure' builds a broken + `config.status'. Fix and test. + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Use + `$ac_configure_args' directly, not via a tmp variable. + * tests/torture.m4 (command line interface): Test with more than + one argument. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_MSG_WARN): s/warning/WARNING/. + * autoheader.sh: Likewise. + From François Pinard. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PACKAGE): Rename as _AC_INIT_PACKAGE. + (AC_INIT): Dispatch arguments either to _AC_INIT_PACKAGE or + to AC_CONFIG_SRCDIR. + (AU::AC_INIT): New. + * configure.in: Adjust. + Use `#', not `dnl'. + * doc/autoconf.texi (configure.in Layout): Document the new form + of AC_INIT. + Document AC_CONFIG_SRCDIR. + (Obsolete Macros): Document the old one. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Simplify all the unjustified `[\$]foo' into + `\$foo', the quotes are needed only for `\$[1]', `\$[@]' etc. + Prefer `$$1' to `[$]$1', `$foo' to `[$]foo', `$[1]' to `[$]1' etc. + * aclang.m4: Likewise. + * acspecific.m4: Likewise. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_TRY_COMPILER): Fix quotation. + +2000-05-19 Akim Demaille <akim@epita.fr> + + Fix Autoconf/123. + + * libm4.m4: Rename `symbols' as `m4_symbols'. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_PROG_CC_GNU, AC_PROG_CXX_GNU, AC_PROG_F77_GNU): + Rename as: + (_AC_PROG_CC_GNU, _AC_PROG_CXX_GNU, _AC_PROG_F77_GNU): these. + Compute the value of GCC, GXX and G77 here. + Set to `no' (instead of empty) if not the GNU compiler. + (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): Adjust. + * doc/autoconf.texi: Adjust. + +2000-05-19 Akim Demaille <akim@epita.fr> + + Fix Autoconf/106. + + * aclang.m4 (AC_PROG_F77): Follow strictly the same scheme as + AC_PROG_CC to compute the default FFLAGS. + +2000-05-19 Akim Demaille <akim@epita.fr> + + Either we cross-compile the whole package, or we don't. + Using --host enables cross-compilation. + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): `--host' enables cross + compilation. + (AC_CANONICAL_BUILD): The help string should explicitly mention + cross compilation. + * aclang.m4 (AC_LANG(C), AC_LANG(C++), AC_LANG(Fortran 77)): Don't + set `cross_compiling'. + (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77): Run your `WORK' partner + only if not cross-compiling. + (AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS, AC_PROG_F77_WORKS): + If does not work, don't assume an implicit cross-compilation: + fail. + * doc/autoconf.texi: Adjust. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_SHELL_UNSETENV, AC_SHELL_UNSET): Add the + missing quotes. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Prefer + case $foo in + *[^-a-zA-Z0-9_]*) AC_ACTION;; + esac + over + if echo "$foo" | grep '[^-a-zA-Z0-9_]' >/dev/null 2>&1; then + AC_ACTION + fi + +2000-05-19 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Testing Values and Files): Delete, move its + content into... + (Limitations of Usual Tools::test): here. + Document more limitations. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_LIBOBJ_GETLOADAVG): New macro, extracted from + (AC_FUNC_GETLOADAVG): here. + Use it. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_SPECIALIZE): Avoid a useless `indir'. + (AC_CHECK_MEMBER, AC_CHECK_MEMBERS): Fix to work properly on + `struct f.g.h'. + * acspecific.m4 (AC_FUNC_GETLOADAVG): Use AC_CHECK_HEADERS and + AC_CHECK_MEMBERS instead of performing their task by hand. + +2000-05-19 Akim Demaille <akim@epita.fr> + + Synchronize AC_FUNC_GETLOADAVG with the version of the shellutils + 1.16f (serial 4). + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Check for + `pstat_getdynamic'. + Define `C_GETLOADAVG' if compiling `getloadavg.c'. + Check for NLS. + Compute `GETLOADAVG_LIBS'. + (AC_FUNC_MKTIME): Remove a forgotten `AC_SUBST(LIBOBJS)'. + +2000-05-19 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_SHELL_UNSET, AC_SHELL_UNSETENV): New macro. + (_AC_INIT_PREPARE_ENVIRONMENT): Use AC_SHELL_UNSETENV. + Set CDPATH. Fixes Autoconf/96. + + * doc/autoconf.texi (Special Shell Variables): New node. + Document `status', `CDPATH', `LANG', `LC_ALL', `LC_MESSAGES' and + `LC_CTYPE'. + +2000-05-12 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (sinclude): Define, some packages (binutils) need + it. + +2000-05-12 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Invoking config.status): Move the + documentation of the envvar CONFIG_(FILES, HEADERS, COMMANDS, + LINKS) to + (Obsolete config.status Use): here. + +2000-05-12 Paul Eggert <eggert@twinsun.com> + + * doc/autoconf.texi (Exiting from Shell Scripts): New node. + (Autoconf Language): Follow the advice in the new node. + +2000-05-12 Peter Eisentraut <peter_e@gmx.net> + + * doc/autoconf.texi: Fix typos. + +2000-05-11 Akim Demaille <akim@epita.fr> + + AC_CONFIG_SUBDIRS needs two lists: one, ac_subdirs_all, which + contains all the possible subdirs for `--help=recursive', and + another, `subdirs' which can be built dynamically for launching + sub configurations. + + * acgeneral.m4 (AC_CONFIG_SUBDIRS): Define `subdirs' dynamically. + Define `ac_subdirs_all' statically. + Warn if the argument is not a literal. + (AC_LIST_SUBDIRS): Rename as... + (_AC_LIST_SUBDIRS): this. + (_AC_INIT_HELP): Loop over `ac_subdirs_all', not `subdirs'. + (_AC_OUTPUT_SUBDIRS): Loop over `subdirs', not `AC_LIST_SUBDIRS'. + * doc/autoconf.texi (Subdirectories): Adjust. + + * acgeneral.m4: Replace all the `test ! -d foo && bar' with + `test -d foo || bar'. + + * Makefile.am (.m4.m4f): Stop hiding what you're doing. + Don't check for GNU m4, let it die. + +2000-05-11 Akim Demaille <akim@epita.fr> + + The Associated Rewriters are even prouder to present... + . + | + | + /-\ + / \ + )===( U T O U P D A T E I V + // \\ + ========= + _//_ _\\_ The ``Eiffel Tower'' Release + + * autoupdate.sh: Complete rewrite. See that file for a detailed + explanation. Basically, simulate the name spaces thanks to + `autoconf --trace' and auxiliary files. + No longer use `autoupdate.m4', remove the dependencies. + Synchronize the options and `--help'. + * doc/autoconf.texi (Invoking autoupdate): Humanoupdate. + * autoupdate.m4: Delete. + * tests/Makefile.am (FILTER_MACROS): Add `AC_OUTPUT'. + Since `AC_OUTPUT' is now AU_DEFUN'd, it is extracted for testing, + while it was not before. + * tests/tools.m4 (autoupdate): Re-enable. Adjust the expected + output with the right quotation (yeah!). + Pass `-m $top_srcdir': autoupdate wants the `.m4' files, not the + frozen files. + * Makefile.am (nodistpkgdataDATA): Move `acversion.m4' to + (distpkgdataDATA): here, so that all the `.m4' files are in the + source hierarchy, not split across src and build. + * acversion.m4.in: Update to today's standards. + * Makefile.am: Adjust. + +2000-05-11 Akim Demaille <akim@epita.fr> + + * libm4.m4: Be robust to multiple inclusion. + Have the first `changequote' robust to the current quotation + system. + Always quote the first argument of `define'. + +2000-05-11 Akim Demaille <akim@epita.fr> + + The Associated Rewriters are proud to present... + + ^ + / \ U T O U P D A T E I I I + /===\ + / \ It bells, It whistles... + + * autoupdate.sh: Complete rewrite. See that file for a detailed + explanation. + * acgeneral.sh: Don't use AU_DEFINE, but AU_DEFUN. + (AC_OUTPUT_COMMANDS_CNT): Renamed as... + (_AC_OUTPUT_COMMANDS_CNT): this. + +2000-05-11 Akim Demaille <akim@epita.fr> + + Get rid of the m4 name spaces. + + * libm4.m4 (m4_changequote, m4_define, m4_defn, m4_dnl, m4_indir, + m4_popdef, m4_pushdef, m4_undefine, m4_namespace_push, + m4_namespace_pop, m4_namespace_register, m4_namespace_define, + m4_disable, m4_enable): Removed. + All dependencies adjusted. + * libm4.m4: Remove all the name space initialization. + * acgeneral.m4: Adjust. + (AU_DEFINE): Redefine as `AC_DEFUN'. + * autoupdate.m4: Adjust. + * tests/tools.m4: Temporarily disable the `autoupdate' test. + +2000-05-11 Akim Demaille <akim@epita.fr> + + Eradicate AC_TRY_COMPILE. + + * aclang.m4 (AC_PROG_CC_STDC, AC_C_BIGENDIAN, AC_C_INLINE, + AC_C_CONST, AC_C_VOLATILE, AC_F77_NAME_MANGLING): Use + `AC_COMPILE_IFELSE'. + * acspecific.m4 (AC_DECL_SYS_SIGLIST, _AC_CHECK_HEADER_DIRENT, + AC_HEADER_SYS_WAIT, AC_HEADER_TIME, AC_TYPE_SIGNAL, + AC_FUNC_GETLOADAVG, AC_FUNC_SELECT_ARGTYPES, AC_STRUCT_TM, + AC_CYGWIN, AC_MINGW32, AC_EMXOS2): Likewise. + * tests/semantics.m4 (C keywords): Check that AC_C_CONST, + AC_C_VOLATILE, and AC_C_INLINE function properly with GCC. + +2000-05-11 Akim Demaille <akim@epita.fr> + + Replace AC_LANG_SAVE/AC_LANG_RESTORE with AC_LANG_PUSH/AC_LANG_POP. + + * aclang.m4 (_AC_LANG_CURRENT, AC_LANG_STACK): You two are the same + thing, which now we shall name `_AC_LANG'. + All users adjusted. + (AC_LANG_PUSH, AC_LANG_POP): New macros. + (AC_LANG_SAVE, AC_LANG_RESTORE): AU defined. + (AC_PROG_CC_WORKS, AC_PROG_CXXCPP, AC_PROG_CXX_WORKS, + AC_PROG_F77_WORKS, AC_F77_LIBRARY_LDFLAGS, AC_F77_NAME_MANGLING): + Use them. + (AC_F77_LIBRARY_LDFLAGS): Move the requirements to its top. + * doc/autoconf.texi (Language Choice): Document them. + (Old Macros): Welcome AC_LANG_SAVE and AC_LANG_RESTORE. + +2000-05-11 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): Less adventurous use of + `test'. + Fixes Autoconf/108. + +2000-05-11 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Particular Headers): Some more sorting. + Use `@multitable'. + +2000-05-11 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (_AC_CHECK_HEADER_DIRENT): Use more modern + Autoconf idioms. + (_AC_CHECK_HEADERS_DIRENT): Removed, instead... + (AC_HEADER_DIRENT): Handle the loop. + +2000-05-11 Akim Demaille <akim@epita.fr> + + Provide a means to track the dependencies of files created by + `configure'. + + * acgeneral.m4 (AT_FILE_DEPENDENCY, _AC_CONFIG_DEPENDENCY, + _AC_CONFIG_DEPENDENCIES): New macros. + (AC_CONFIG_FILES, AC_CONFIG_HEADERS, AC_CONFIG_LINKS): Use them. + +2000-05-11 Akim Demaille <akim@epita.fr> + + Merge AC_DECL_YYTEXT into AC_PROG_LEX. + + * acgeneral.m4 (AC_DECL_YYTEXT): Rename as + (_AC_DECL_YYTEXT): this. + (AC_PROG_LEX): Use it. + (AC_DECL_YYTEXT): New AU macro. + * doc/autoconf.texi: Adjust. + +2000-05-10 Akim Demaille <akim@epita.fr> + + * aclang.m4 (AC_F77_NAME_MANGLING): Use AC_COMPILE_IFELSE. + Move the requirements to the top of the macro. + +2000-05-10 Akim Demaille <akim@epita.fr> + + Update and polish the documentation. + + * doc/autoconf.texi: Use @sc where upper case names were used. + Remove a few useless `dnl'. + Convert some `dnl' into comments. + Promote `$(foo)' in Makefiles, not `${foo}'. + Promote `$foo' in shell scripts, not `${foo}'. + Promote `foo = bar' in Makefiles, not `foo=bar'. + (Language Choice): Document `AC_LANG', move `AC_LANG_C', + `AC_LANG_CPLUSPLUS' and `AC_LANG_FORTRAN77' to + (Old Macros): here. + * doc/install.texi: Fix a typo in the specification of the system + quadruples. + +2000-05-10 Akim Demaille <akim@epita.fr> + + * libm4.m4 (m4_foreach): Rewritten so that it does not require + lists in between parens. + (m4_foreach_quoted): new copy of the previous `m4_foreach' which + is still used by `m4_wrap'. + * acgeneral.m4 (AC_INCLUDE, AC_INCLUDES): Removed. + (AC_FOREACH): Don't use parens with `m4_foreach'. + (AC_CHECK_MEMBER, AC_CHECK_DECLS, AC_CHECK_TYPES): Adjust the + description. + * acspecific.m4 (AC_STRUCT_TIMEZONE, AC_STRUCT_ST_BLKSIZE, + AC_STRUCT_ST_BLOCKS, AC_STRUCT_ST_RDEV): Adjust. + * autoconf.texi (AC_CHECK_MEMBER, AC_CHECK_DECLS, AC_CHECK_TYPES): + Adjust their documentation. + (AC_INCLUDE): Undocument. + * tests/semantics.m4: Adjust. + * tests/actest.m4: Rename as... + * tests/aclocal.m4: this. + * tests/atspecific.m4: No longer include actest.m4. + * tests/torture.m4: Likewise. + * tests/Makefile.am: Adjust. + +2000-05-10 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Obsolete Macros): Document `AU_DEFUN'. + Move the documentation of `AC_OBSOLETE' from here, to... + (Old Macros): here. + * acspecific.m4 (AC_STRUCT_ST_BLKSIZE, AC_STRUCT_ST_RDEV): + AU_DEFUN'd. + +2000-05-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_LIBOBJ_DECL, AC_LIBOBJ): New macros. + (AC_REPLACE_FUNCS): Use AC_LIBOBJ. + * acspecific.m4 (AC_FUNC_MKTIME, AC_FUNC_MEMCMP, + AC_STRUCT_ST_BLOCKS): Use AC_LIBOBJ. + * doc/autoconf.texi : Adjust so that the user is not encouraged to + use LIBOBJS directly. + (Generic Functions): Document AC_LIBOBJ_DECL and AC_LIBOBJ. + +2000-05-09 Jim Meyering <meyering@lucent.com> + + * acgeneral.m4 (AC_SEARCH_LIBS): Remove double quotes around `no'. + +2000-05-09 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_FILES): Don't automatically spit + `Generated by...' in Makefiles. + Fixes Autoconf/102. + +2000-05-09 Akim Demaille <akim@epita.fr> + + Let `config.status' use a private temp dir. + Suggested by Jim Meyering. + + * acgeneral.m4 (_AC_SHELL_TMPDIR): New macro. + (_AC_OUTPUT_CONFIG_STATUS): Use it. + Use more quoted here docs to improve readability. + Compute `$me' and use it in the error messages. + Define `$configure' and `$configure_args' to avoid continuously + mixing the uses of `configure' and `config.status' evaluation in a + single line. + Define `$SHELL' and use it. + Simplify all the unjustified `[\$]foo' into `\$foo', the quotes + are needed only for `\$[1]', `\$[@]' etc. + Replace all the uses of `ac_cs_root' with files in the tmp dir of + `config.status'. + Remove a few `rm' covered by the removal of the `$tmp' dir. + Let `config.status' support `--debug'. + (_AC_INIT_PREPARE): Avoid the leading space in `ac_configure_args'. + * doc/autoconf.texi (Invoking config.status): Adjust. + +2000-05-05 Jim Meyering <meyering@lucent.com> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Set up traps to remove + temporaries upon exit, too, not just upon receipt of signal. + +2000-05-05 Akim Demaille <akim@epita.fr> + + AC_CHECK_PROG macro fails if REJECT value is set under Digital + Unix 4.0x and 5.0 because `"$@"' expands into an empty parameter + (instead of nothing) when there are no positional parameters. + From Nicolas Joly. + + * acgeneral.m4 (AC_CHECK_PROG, AC_CHECK_PROGS): Prefer + `$$1' to `[$]$1', `$foo' to `[$]foo', `$[1]' to `[$]1', and + `${1+"$[@]"}' to `"[$]@"'. + +2000-05-04 Akim Demaille <akim@epita.fr> + + AC_PREREQ understands `2.14a' as `2.141'. + Reported by Didier Verna. + + * acgeneral.m4 (AC_PREREQ): Don't quote AC_ACVERSION. + +2000-05-04 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AH_TOP, AH_BOTTOM): New macros. + (_AH_COUNTER): New variable. + * tests/tools.m4 (autoheader): Check their proper functioning. + +2000-05-04 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Obsolete Macros): Rename as... + (Obsoleting Macros): this. + (Old Macros): Rename as... + (Obsolete Macros): this. + Be a section of... + (Obsolete Constructs): New chapter. + (Invoking autoheader): Move the `acconfig.h' documentation to... + (acconfig.h): here, new section of `Obsolete Constructs'. + (Autoheader Macros): Document AH_VERBATIM, AH_TEMPLATE, AH_TOP and + AH_BOTTOM. + +2000-05-03 Nicolas Joly <njoly@pasteur.fr> + + * autoheader.sh (config_h): Sort the templates. + Under NetBSD 1.4.1 /bin/sh `set' command does not return a sorted + variables list. + +2000-05-03 Akim Demaille <akim@epita.fr> + + * tests/tools.m4 (autoheader): Don't pass `-l at_srcdir' to + `autoheader', since `acconfig.h' is created in the build dir. + There's one empty line less in `config.h.in' than before when + using `acconfig.h'. + +2000-05-03 Akim Demaille <akim@epita.fr> + + Simplify the handling of `acconfig.h'. + + * autoheader.sh: No longer try to select the needed paragraphs of + `acconfig.h', just dump everything into `config.h.in'. + Implement support for `--warnings'. + Warn the users that these auxiliary files are obsolete when `-W + obsolete'. + * doc/autoconf.texi (Invoking autoheader): Adjust. + +2000-05-03 Akim Demaille <akim@epita.fr> + + Support of acconfig.h was broken. Fix and test. + Reported by Jim Meyering. + + * autoheader.sh: Trace AC_DEFINE and AC_DEFINE_UNQUOTED to build + the list of $syms which are defined. + * tests/tools.m4 (autoheader): New test. + +2000-05-03 Akim Demaille <akim@epita.fr> + + Rename the language FORTRAN77 as Fortran 77. + + * aclang.m4 (AC_LANG(FORTRAN77), AC_LANG_SOURCE(FORTRAN77), + AC_LANG_PROGRAM(FORTRAN77), AC_LANG_CALL(FORTRAN77)): Rename as... + (AC_LANG(Fortran 77), AC_LANG_SOURCE(Fortran 77), + AC_LANG_PROGRAM(Fortran 77), AC_LANG_CALL(Fortran 77)): This. + (AC_LANG_FORTRAN77): Adjust. + +2000-05-03 Akim Demaille <akim@epita.fr> + + Provide a macro to canonicalize a configuration name. + Suggested by Ralf Corsepius. + + * acgeneral.m4 (AC_CANONICALIZE): New macro. + (_AC_CANONICAL_THING): Use it. + + + Change the defaults for build, host, and target systems: + build defaults to `config.guess`. + host defaults to $build. + target defaults to $host. + Suggested by Mo DeJong, Pavel Roskin, Tom Tromey, Ian Lance + Taylor, and many others. + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Set `$build', `$host' and + `$target' to nothing instead of NONE. + (AC_CANONICAL_SYSTEM): AU_DEFUN'd as `AC_CANONICAL_TARGET'. + (_AC_CANONICAL_THING): Use an explicit m4_case to set the defaults + depending upon the THING. + Implement the default values. + (AC_CANONICAL_TARGET): Handle the `AC_ARG_PROGRAM' part + `AC_CANONICAL_SYSTEM' used to provide. + * doc/autoconf.texi: Adjust. + + + When receiving an explicit argument, consider this is a default + for --build, --host and --target (unless set). + Some scripts might still depend on this historical syntax. + Suggested by Alexandre Oliva. + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Do that. + (_AC_CANONICAL_THING): Drop the support of `$nonopt'. + + + Documenting --build, --host and --target when configure does not + handle them causes confusion. + Suggested by Pavel Roskin. + Nevertheless configure must not die on such an `unsupported' + option: it does happen that people build an entire tree of + packages, some of them expecting `--host' etc. some others not. + Stressed by Tom Tromey and Ian Lance Taylor. + + * acgeneral.m4 (HELP_CANON): New diversion. + (_AC_INIT_PARSE_ARGS): Don't document these options. + (AC_CANONICAL_BUILD, AC_CANONICAL_HOST, AC_CANONICAL_TARGET): + Document your associated option. + +2000-04-28 Akim Demaille <akim@epita.fr> + + Don't double quote in AC_MSG_*. + + * acgeneral.m4 (_AC_SH_QUOTE): Don't double quote. Escape the + double quotes too. + (_AC_ECHO_UNQUOTED): Don't double quote :). + (_AC_ECHO, _AC_ECHO_N): Quote the call to _AC_SH_QUOTE. + + The autoheader chain needs to be adjusted. + + * acgeneral.m4 (AH_VERBATIM): Just pass two arguments to AH_OUTPUT + instead of trying to build what `autoheader' needs: let it handle + the format by itself. + * autoheader.m4: Adjust. + s,tmp/config.h,tmp/config.hin. + + The adjustment revealed that `autoconf --trace' is not robust to + single quotes in its argument. + + * autoconf.sh: Fix this issue. + Rename the escape `$*' as `$%'. Implement `$@'. + * doc/autoconf.texi: Adjust. + +2000-04-28 Akim Demaille <akim@epita.fr> + + mawk suffers a severe performance loss when using `sub' with a + changing value. On the `configure' script of the fileutils: + mawk '{ sub (/foo/, foo++) }' -> 14s. + mawk '{ if ($0 ~ /foo/) sub (/foo/, foo++) }' -> 0.03s. + mawk '{ sub (/foo/, foo) }' -> 0.03s. + + * autoconf.sh (task script, AWK script): Run `sub (__oline__, + oline)' only in the lines that match `__oline__'. + Suggested by Paul Eggert. + +2000-04-28 Akim Demaille <akim@epita.fr> + + * autoconf.sh (options handling::-W*): Strip two leading chars, not + just one. + +2000-04-20 Dave Love <fx@gnu.org> + + * acspecific.m4 (AC_FUNC_MKTIME): Use AC_SUBST. + +2000-04-12 Akim Demaille <akim@epita.fr> + + Provide a fine grained control over autoconf's warnings. + + * acgeneral.m4 (AC_WARNING_IFELSE, _AC_DIAGNOSE, AC_DIAGNOSE): + New macros. + (AC_DEFUN_ONCE, AC_OBSOLETE, AC_BEFORE, AU_DEFUN, AC_PREREQ, + AC_WARNING, AC_FATAL, AC_TRY_RUN): Use AC_DIAGNOSE. + * autoconf.sh: Provide support for `--warnings', `-W'. + * doc/autoconf.texi (Invoking autoconf): Adjust. + (Reporting Messages): New section. + +2000-04-12 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_HELP): Move --srcdir in the first + section. + Document --help=short and recursive. + Split the `Directory' section into `Installation directories' for + --prefix and --exec-prefix, and all the others into `Fine tuning + of the installation directories'. + In the latter, don't repeat `in DIR', the user understands, and it + comes out better. + Default for --exec-prefix is PREFIX. + Reported by Kathryn Hargreaves. + Move --host before --build. + Fix a test on `$ac_init_help' which was not updated. + +2000-04-11 Akim Demaille <akim@epita.fr> + + Have `make check' succeed with CC=g++. + + * tests/atspecific.m4 (AT_TEST_MACRO): Don't check `env-after' if + the file does not exist, which may happen when a `configure' exits + brutally. + * tests/semantics.m4 (AC_CHECK_MEMBERS, AC_CHECK_TYPES): ANSI C++ + forbids members named like their hosting struct, so don't do it. + +2000-04-11 Akim Demaille <akim@epita.fr> + + * autoscan.pl: Reindent using 2 spaces, not 4. + Use `#' to denote Autoconf comments, not `dnl'. + Put a few `\' here and there to avoid misfontification and + misindentation. + Use your base name when reporting errors. + (parse_args::usage): Use $0, use the same order as the other + executables. + (parse_args): Don't dump `--help' on cmd line errors. + +2000-04-11 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PROVIDE_IF): Rename as... + (AC_PROVIDE_IFELSE): this. Change all callers. + Spread the use of AC_PROVIDE_IFELSE, no macro should know how + AC_PROVIDE names its internal variables. + +2000-04-11 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Simplify all the `foo="$bar"' into `foo=$bar'. + * acspecific.m4: Likewise. + * aclang.m4: Likewise. + +2000-04-11 Akim Demaille <akim@epita.fr> + + Move obsolete macros' definitions out of the way. + + * doc/autoconf.texi (Old Macro Names): Rename as... + (Old Macros): this. Change the @table enumeration into a list of + @defmac. + (AC_CHECKING, AC_CHECK_TYPE, AC_COMPILE_CHECK, AC_C_CROSS, + AC_DYNIX_SEQ, AC_HAVE_LIBRARY, AC_IRIX_SUN, AC_LINK_FILES, + AC_OUTPUT, AC_OUTPUT_COMMANDS, AC_SCO_INTL, AC_VERBOSE, + AC_XENIX_DIR): Move their descriptions into here. + Kill a few TeX warnings. + +2000-04-11 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_MSG_ERROR_UNQUOTED): Remove. + (AC_MSG_RESULT, AC_MSG_RESULT_UNQUOTED): Output to the log too. + (AC_CHECKING, AC_VERBOSE): AU_ define. + +2000-04-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: s/1>&/>&/g. + (AC_FD_LOG): New macro, replaces... + (AC_FD_CC): this. Provide an AU definition. + (_AC_ECHO_UNQUOTED, _AC_ECHO_N): Use m4_default. + +2000-04-05 Akim Demaille <akim@epita.fr> + + At the end of `./configure', save the cache values, and the CPP + values. + + * acgeneral.m4 (_AC_CACHE_DUMP): New macro. + (AC_CACHE_SAVE, AC_OUTPUT): Use it. + (AC_OUTPUT): Dump confdefs.h into config.log. + (_AC_INIT_PREPARE::config.log): Name the package being configured + if you can. + +2000-04-05 Steven G. Johnson <stevenj@alum.mit.edu> + + Disable caching by default, so as not to cause problems when + newbies accidentally use a stale cache file. + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Set cache_file to /dev/null + to disable caching by default. + (_AC_INIT_HELP): Adjust the --help message. + (AC_CACHE_LOAD, AC_CACHE_SAVE): Don't print "loading/updating + /dev/null" messages. + * autoconf.texi: Note that caching is disabled, how to enable it, + and that `./config.cache' is the traditional name of the cache file. + * install.texi: Likewise. + +2000-04-03 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): If any option waiting for a + directory receives a relative path, die (bindir, sbindir, + libexecdir, datadir, sysconfdir, sharedstatedir, localstatedir, + libdir, includedir, oldincludedir, infodir, mandir, exec_prefix, + prefix). Fixes Autoconf 42. + +2000-04-03 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Canonicalizing): Officially recognize + AC_CANONICAL_TARGET and AC_CANONICAL_BUILD. + +2000-04-03 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Writing configure.in): Explain what Autoconf + is. Explain how to use the quotation scheme used in Autoconf. + (Quoting): Update. Do not advocate changequote. + +2000-03-30 Steven G. Johnson <stevenj@alum.mit.edu> + + Fix F77 name-mangling macros to work with cached values (so + they don't break the second time you run configure). + + * aclang.m4 (AC_F77_NAME_MANGLING): Extract f77_case, + f77_underscore from cache variable. + (AC_F77_WRAPPERS): Get rid of ac_cv_f77_wrappers, it's useless. + Simplify the nested case-esac into a single one. + Simplify the documentation strings of CPP symbols. + +2000-03-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Fix the accumulation in + CONFIG_HEADERS. + +2000-03-31 Akim Demaille <akim@epita.fr> + + * autoheader.sh: Catch up with the `mktemp -d' changes in + autoconf.sh. + * autoupdate.sh: Likewise. + +2000-03-31 Steven G. Johnson <stevenj@alum.mit.edu> + + * aclang.m4 (AC_F77_LIBRARY_LDFLAGS): bug fix in F77 test program + (missing whitespace--F77 requires program statements to start in + column 7). + +2000-03-29 Akim Demaille <akim@epita.fr> + + Rewrite the autoheader chain on top of `autoconf --trace'. + + * autoheader.m4: Dispatch the prototypes next to there AC_ + siblings. + (AH_TEMPLATE, AH_VERBATIM): Move to... + * acgeneral.m4: here. + (AH_OUTPUT): New macro. + * autoheader.sh: Run `autoconf --trace' instead of `m4 autoheader.m4'. + * autoheader.m4: Remove. + * Makefile.am: Adjust. + * tests/tools.m4 (AH_DEFUN): Remove, no longer makes sense. + * tests/actests.m4 (autoheader::AC_TATOOINE): Remove, was used by + the test above. + +2000-03-29 Akim Demaille <akim@epita.fr> + + silent.m4 depends upon the current quotation in m4, which changes + if `-i' is used or not. + + * autoconf.sh (trace::silent.m4): Removed. + (trace::run_m4_trace): Pass -Derrprint. + +2000-03-29 Akim Demaille <akim@epita.fr> + + Use `mktemp -d' when possible to create securely a tmp work dir. + + * autoconf.sh: Use it when possible to create the dir $tmp. + Stop using variables for tmp files, use their names in $tmp. + [install]: Use the new features of autoconf --trace. + +2000-03-28 Akim Demaille <akim@epita.fr> + + Probably all the versions of bash up to 2.04 fail on + fnmatch ("/tmp", "[/\\\\]") + The backslash must not be last. + + * acgeneral.m4 (_AC_INIT_HELP, AC_PATH_PROG, _AC_OUTPUT_FILES, + _AC_OUTPUT_LINKS, _AC_OUTPUT_SUBDIRS): Always make `\\' be the + first character in all the `[]' of `case' patterns. + +2000-03-27 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_CHECK_TOOL_PREFIX): Rename back as + AC_CHECK_TOOL_PREFIX since some packages rely on it. + +2000-03-27 Akim Demaille <akim@epita.fr> + + Move all the language dependent macros into aclang.m4. + + * aclang.m4: New file. + * autoconf.m4: Include it. + * autoheader.m4: Likewise. + * autoupdate.m4: Likewise. + * Makefile.am: Adjust. + * test/Makefile.am: Likewise. + * acgeneral.m4 (AC_LANG_CASE,AC_LANG_SAVE, _AC_LANG_DISPATCH, + AC_LANG, _AC_LANG_CURRENT, AC_LANG_SOURCE, AC_LANG_PROGRAM, + AC_LANG_CALL, AC_LANG(C), AC_LANG_SOURCE(C), AC_LANG_PROGRAM(C), + AC_LANG_CALL(C), AC_LANG(C++), AC_LANG_SOURCE(C++), + AC_LANG_PROGRAM(C++), AC_LANG_CALL(C++), AC_LANG(FORTRAN77), + AC_LANG_SOURCE(FORTRAN77), AC_LANG_PROGRAM(FORTRAN77), + AC_LANG_CALL(FORTRAN77): Move to... + * aclang.m4: here. + * acspecific.m4 (AC_PROG_CC, AC_PROG_CXX, AC_PROG_F77, + AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS, AC_PROG_F77_WORKS, + AC_PROG_CC_GNU, AC_PROG_CXX_GNU, AC_PROG_F77_GNU, AC_PROG_CC_G, + AC_PROG_CXX_G, AC_PROG_F77_G, AC_PROG_GCC_TRADITIONAL, + AC_PROG_CC_C_O, AC_PROG_F77_C_O, AC_PROG_CC_STDC, AC_PROG_CPP, + AC_PROG_CXXCPP, AC_REQUIRE_CPP, AC_PROG_LEX, AC_TYPE_MODE_T, + AC_C_CROSS, AC_C_CHAR_UNSIGNED, AC_C_LONG_DOUBLE, AC_C_BIGENDIAN, + AC_C_INLINE, AC_C_CONST, AC_C_VOLATILE, AC_C_STRINGIZE, + AC_C_PROTOTYPES, AC_F77_LIBRARY_LDFLAGS, AC_F77_NAME_MANGLING, + AC_F77_WRAPPERS): Move to... + * aclang.m4: here. + +2000-03-27 Akim Demaille <akim@epita.fr> + + * autoconf.sh (trace): Let translate_awk do the whole translation + from `$trace' to the m4 program. + +2000-03-27 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PACKAGE): Also define AC_PACKAGE_STRING. + Use it here and there. + +2000-03-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de> + + * acgeneral.m4 (_AC_INIT_HELP, _AC_OUTPUT_SUBDIRS): Fix the DOS + absolute path pattern: s/?:[[/\\]]/?:[[/\\]]*/. + +2000-03-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_CANONICAL_TARGET, _AC_CANONICAL_BUILD): Rename + as (AC_CANONICAL_TARGET, AC_CANONICAL_BUILD), although internal, + too much foreign code depends upon them. + +2000-03-25 Akim Demaille <akim@epita.fr> + + * autoconf.sh (translate_awk): `> "/dev/stderr"' is not portable + to systems without a real /dev/stderr in the file system or if not + using one of the three free awks. Use + print message | "cat >&2" + ... + END { close("cat >&2") } + From Aharon Robbins. + +2000-03-25 Akim Demaille <akim@epita.fr> + + * autoheader.sh (checking completeness): Be ready to recognize + patterns with a value, and spaces between `#' and the directive, e.g. + # define FOO FIXME: + Reported by John Fortin. + +2000-03-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_RUN_IFELSE): New macro. + (AC_TRY_RUN_NATIVE): Remove. + (AC_TRY_RUN): Use AC_RUN_IFELSE, not AC_TRY_RUN_NATIVE. + +2000-03-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_LIB): Ah ah! I recognized you, even + masked: you are AC_TRY_LINK_FUNC. + Fix quotation. + (AC_SEARCH_LIBS): Use AC_SHELL_IFELSE. + +2000-03-25 Akim Demaille <akim@epita.fr> + + * tests/semantics.m4 (AC_TRY_LINK_FUNC, AC_CHECK_LIB): New tests. + +2000-03-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_LANG_CALL, AC_LANG_CALL(C), AC_LANG_CALL(C++), + AC_LANG_CALL(FORTRAN77)): New macros. + (AC_TRY_LINK_FUNC): Use it. + (AC_TRY_CPP): Argument was output twice. + (AC_COMPILE_IFELSE, AC_LINK_IFELSE): Output $3 only if needed. + +2000-03-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_TRY_COMPILER): Use AC_LINK_IFELSE. + (AC_TRY_LINK_FUNC, AC_CHECK_LIB, AC_CHECK_FUNC): Don't check that + the current language is C++ to output `extern "C"': the CPP + condition is enough. + +2000-03-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_LINK_IFELSE, AC_COMPILE_IFELSE): New macros. + (AC_TRY_LINK, AC_TRY_COMPILE): Use them. + (AC_CHECK_MEMBER, AC_COMPILE_CHECK, AC_CHECK_DECL, + _AC_CHECK_TYPE_NEW): Adjust. + * acspecific.m4 (AC_DECL_YYTEXT, AC_PATH_XTRA): Adjust. + +2000-03-23 Steven G. Johnson <stevenj@alum.mit.edu> + + * acspecific.m4 (AC_F77_NAME_MANGLING): Need to use + AC_F77_LIBRARY_LDFLAGS when linking C and Fortran code. + +2000-03-23 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_LANG_PROGRAM, AC_LANG_PROGRAM(C), + AC_LANG_PROGRAM(C++), AC_LANG_PROGRAM(FORTRAN77)): New macros. + (AC_TRY_COMPILE, AC_TRY_LINK): Use them. + +2000-03-23 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Support --help={long, short, + recursive}. + (_AC_INIT_HELP): Propagate --help=recursive to CONFIG_SUBDIRS. + Code stolen from... + (AC_OUTPUT_SUBDIRS): s/ac_config_dir/ac_subdir/g. + +2000-03-23 Lars J. Aas <larsa@sim.no> + + * libm4.m4 (m4_do): New macro. + +2000-03-21 Akim Demaille <akim@epita.fr> + + Provide a language independent means to generate language specific + programs. + + * acgeneral.m4 (_AC_LANG_DISPATCH): New macro. + (AC_LANG): Use it. + (AC_LANG_SOURCE, AC_LANG_SOURCE(C), AC_LANG_SOURCE(C++), + AC_LANG_SOURCE(FORTRAN77)): New macros. + (AC_TRY_COMPILER, AC_EGREP_CPP, AC_TRY_RUN_NATIVE): Use + AC_LANG_SOURCE. + +2000-03-21 Akim Demaille <akim@epita.fr> + + Fix a bug: some macros (e.g., AC_REVISION, AC_COPYRIGHT etc.) can + be used before AC_INIT, but they do require it. But then, the + argument of the explicit AC_INIT call is lost. + + * acgeneral.m4 (AC_CONFIG_SRCDIR): New macro. + (_AC_INIT_SRCDIR): Adjust. + (_AC_INIT): Pass your argument to AC_CONFIG_SRCDIR. + +2000-03-21 Akim Demaille <akim@epita.fr> + + * tests/semantics.m4 (AC_PATH_PROG, AC_PATH_PROGS): New tests. + +2000-03-21 Akim Demaille <akim@epita.fr> + + Start the language support overhaul: Introduce AC_LANG(). + + * acgeneral.m4 (AC_LANG): Renamed as _AC_LANG_CURRENT. + (AC_LANG, AC_LANG(C), AC_LANG(C++), AC_LANG(FORTRAN77)): New + macros. + (AC_LANG_C, AC_LANG_CPLUSPLUS, AC_LANG_FORTRAN): AU_DEFUN'ed. + Adjust all callers. + * acspecific.m4 (AC_F77_NAME_MANGLING): Remove the exceeding + AC_LANG_RESTORE. + * tests/Makefile.am (FILTER_MACROS): Add AC_LANG. + +2000-03-21 Akim Demaille <akim@epita.fr> + + Speed ups. + + * libm4.m4 (m4_append, m4_list_append): Use m4_define, not define. + On my machine the former implementation takes 4mn 40s to run the + test suite. Using m4_define leads to 4mn 15s. + * acgeneral.m4 (_AC_SUBST): Use AC_EXPAND_ONCE (which uses + m4_define, not define). 4mn. + (_AC_DIVERT): Don't use m4_case. Starting from those 4mn, if you + just move NORMAL* first in m4_case, the test suite is run in 3mn. + If instead of using m4, you use an `associative array' plus a + wrapper (current implementation), it falls to 2mn. + +2000-03-21 Akim Demaille <akim@epita.fr> + + * tests/tools.m4 (autoconf --trace): New test. + +2000-03-21 Akim Demaille <akim@epita.fr> + + * autoconf.sh (task trace): Pipe the output of the first m4 into + the second one, instead of saving to a tmp file, so that we can + trace endless configure.in expansion. + +2000-03-21 Akim Demaille <akim@epita.fr> + + Uniform idioms. + + * acgeneral.m4 (_AC_OUTPUT_FILES, _AC_OUTPUT_HEADERS, + _AC_OUTPUT_LINKS, _AC_OUTPUT_COMMANDS): Prefer + for i in : $is; do test $i = : && continue + over + for i in .. $is; do if test $i != ..; then + +2000-03-21 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE, _AC_INIT_PARSE_ARGS): Move more + initializations to... + (_AC_INIT_DEFAULTS): here. + +2000-03-21 Akim Demaille <akim@epita.fr> + + Give a means to compute `srcdir' earlier in configure. + + * acgeneral.m4 (_AC_INIT_SRCDIR): New macro, pulled out from... + (_AC_INIT_PREPARE): No longer compute `srcdir'. + (_AC_INIT): Use _AC_INIT_SRCDIR. + (AC_INIT): Don't forget to pass the argument to _AC_INIT. + +2000-03-20 Jim Meyering <meyering@lucent.com> + + * acspecific.m4 (AC_SYS_LONG_FILE_NAMES): Don't test for existence + of $ac_xdir. Not only is `test -e' not portable, but the test isn't + necessary at all; the following mkdir ends up accomplishing the + same goal. Suggestion from Alexandre Oliva. + + * acgeneral.m4 (_AC_INIT_PREPARE_ENVIRONMENT) [setting IFS]: Be careful + to use space, tab and new line, in precisely that order. + +2000-03-20 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT_SUBDIRS): Rename as _AC_OUTPUT_SUBDIRS. + No argument, use AC_LIST_SUBDIRS. + Adjust callers. + +2000-03-20 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_ARG_ENABLE, AC_ARG_WITH): Double quote the head + of the help snippet. + +2000-03-20 Akim Demaille <akim@epita.fr> + + Give an identity to `configure' scripts. + + * acgeneral.m4 (AC_PACKAGE): New macro. + (_AC_COPYRIGHT_SEPARATOR): Remove. + (AC_COPYRIGHT): Adjust. + (_AC_INIT_HELP, _AC_INIT_VERSION): Name the package you configure + when you want. + (_AC_INIT): Adjust. + * configure.in (AC_PACKAGE): Add. + +2000-03-20 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formatting changes. + +2000-03-20 Akim Demaille <akim@epita.fr> + + Don't rely on RS = "\0" to swallow the whole input as a single + record, this is not portable: mawk and nawk understand it as RS = + "". gawk understands it as expected. + + * autoconf.sh (translate_awk::BEGIN): No longer change RS. + (translate_awk::body): Move to the END. + Instead, accumulate the input in `request'. + +2000-03-20 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Testing Values and Files): Be a subsection of + `Portable Shell Programming'. + (Shell Substitutions, Limitations of Usual Tools): New subsections. + +2000-03-17 Akim Demaille <akim@epita.fr> + + Use a single tool to reformat the raw `configure' script output by + m4. + Suggested by Paul Eggert. + + * autoconf.sh: Stop playing with 2 seds and an AWK to finalize + `configure', a single AWK program is enough. + +2000-03-17 Akim Demaille <akim@epita.fr> + + In Autoconf 2.13, although AC_OUTPUT_COMMANDS did double quote its + arguments, AC_OUTPUT arguments 2 and 3 were not! Currently, + AC_OUTPUT over quotes too: stop that. + Reported by Martin Buchholz. + + * doc/autoconf.texi (Output): Don't expand on the ternary + AC_OUTPUT. + * acgeneral.m4 (AC_OUTPUT): Don't over quote $2 and $3. + +2000-03-17 Joseph S. Myers <jsm28@cam.ac.uk> + + * acspecific.m4 (AC_SYS_LONG_FILE_NAMES): Security fixes: create + the temp files in a private temporary directory, not directly in + TMPDIR. + +2000-03-17 Akim Demaille <akim@epita.fr> + + Install the IFS we need once for all. + + * acgeneral.m4 (_AC_INIT_PREPARE_ENVIRONMENT): New macro. + Handle the NLS envvars, and IFS. + (_AC_INIT_PREPARE): Use it, no longer set the NLS envvars. + (_AC_WHICH_A, AC_PATH_PROG): Rely on the default IFS. + * acspecific.m4 (AC_PROG_INSTALL, AC_FUNC_SELECT_ARGTYPES): + Likewise. + +2000-03-17 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_TRY_CPP, AC_EGREP_CPP, AC_TRY_COMPILE, + AC_TRY_LINK, AC_TRY_RUN_NATIVE): Simplify the removal of the + contest files: don't remove them before running the actions, just + remove them at the end of the macro. + +2000-03-16 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_FUNC_SELECT_ARGTYPES): Use + : ${foo='some words'} + not + : ${foo=some words} + since this is not portable: Digital Unix v5.0: `bad substitution'. + From Nicolas Joly. + +2000-03-16 Lars J. Aas <larsa@sim.no> + + * libm4.m4 (m4_assert, m4_shiftn): New macros. + (m4_case,m4_match): Rewrite to use m4_shiftn (for readability reasons). + (m4_for): Add the STEP argument and some argument-verifying asserts. + (m4_split): Correct spaces to tabulator in regexp. + +2000-03-15 Akim Demaille <akim@epita.fr> + + Revamp AC_FUNC_SELECT_ARGTYPES. + + * acspecific.m4 (AC_FUNC_SELECT_ARGTYPES): Use a single cache + variable instead of three. + Use AC_CACHE_CHECK. + Shorten the name of the var loops, they are no longer cached. + Include sys/types.h unconditionally. + `select' returns an int, fixes Autoconf/46. + Don't display parens in the user messages. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * autoheader.sh: Use run_m4f, not run_m4. + +2000-03-14 John David Anglin <dave@hiauly1.hia.nrc.ca> + + * tests/actest.m4 (AC_ENV_SAVE): Don't consider RANDOM and LINENO + which some shells update. At least ksh on HP-UX 10.20 and sh on + IRIX 6.5 do change their `RANDOM' even if `read' via `set'. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_ARG_ENABLE, AC_ARG_WITH): No use for @%:@ here, + no need to over quote $1 in the comments. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Replace some ifelse with ifval or m4_default, or + even nothing when not needed. + * acspecific.m4: Likewise. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE): Insert the Autoconf version in + config.log, and the command line which ran configure. + Kill a couple of useless quote around dollars. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PREPARE): Kill a changequote in the + building of `ac_configure_args'. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_DIVERT): Rename _AC_DIVERT. + (AC_DIVERT): New macro. + Spread its use where better than a pair of AC_DIVERT_PUSH/POP. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_BINSH): Remove, useless now that... + (AC_REVISION): Require AC_INIT, not _AC_INIT_BINSH. + (AC_INIT): Do what _AC_INIT_BINSH used to. + Don't require _AC_INIT_VERSION, just call it. + Rename as _AC_INIT. + (AC_INIT): New macro, single expansion wrapper around _AC_INIT. + (_AC_COPYRIGHT_SEPARATOR): New. + (AC_COPYRIGHT): Use it. + Require AC_INIT, not _AC_INIT_VERSION. + * doc/autoconf.texi (Versions): Promote as first section of + `Setup'. + Rename as `Notices'. + Document AC_COPYRIGHT. + Don't give false reasons for placing AC_REVISION before AC_INIT, + the place no longer matters. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * autoconf.sh (trace_m4::smash): Double quote, we don't want the + result to be evaluated. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: s/@%:@line __oline__/#line __oline__/g. __oline__ + is not a macro, so there is just no use in avoiding `#'. + +2000-03-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): When there were no + CONFIG_FILES, we had to expand _AC_OUTPUT_FILES into the KILL + diversion, because it is AC_OUTPUT_FILES which undiverted the + AC_SUBST sed script at its proper place, otherwise it would have + been undiverted at the end of `configure', leading to an sh syntax + error. + Now that we no longer use a diversion, we don't need to call + AC_OUTPUT_FILES if useless. + (AC_OUTPUT_FILES): Rename as _AC_OUTPUT_FILES. + (AC_OUTPUT_LINKS): Rename as _AC_OUTPUT_LINKS. + +2000-03-14 Akim Demaille <akim@epita.fr> + + AC_ARG_PROGRAM must not be expanded twice, which is likely since + Automake calls it, and usually users do too. If it happens, + `--program-prefix=g' actually prepend two (or more) `g'. + + * acgeneral.m4 (AC_DEFUN_ONCE): New macro. + (AC_ARG_PROGRAM): AC_DEFUNed_ONCE. Or is it AC_DEFUN_ONCE'd? :). + No longer AC_EXPAND_ONCE the help string, the macro itself is + expanded at most once. + Rename the here-doc tag EOF_SED as EOF. + +2000-03-14 Akim Demaille <akim@epita.fr> + + Get rid of the ICMDS diversion. + + * acgeneral.m4 (AC_DIVERT): Remove ICMDS. + (_AC_OUTPUT_COMMANDS_INIT): New growing string. + (_AC_CONFIG_COMMANDS_INIT, _AC_OUTPUT_CONFIG_STATUS): Adjust. + +2000-03-14 Akim Demaille <akim@epita.fr> + + Introduce AC_SUBST(VAR, VAL). + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Stop global double quoting, + failed experiment. + Merge all the var=val AC_SUBST(var) into AC_SUBST(var, val). + (AC_SUBST): Implement support for 2nd arg. + * doc/autoconf.texi (Setting Output Variables): Adjust. + +2000-03-13 Akim Demaille <akim@epita.fr> + + Simplify the diversions naming system. + Suggested by Alexandre Oliva and Lars J. Aas + + * libm4.m4 (ifndef): New macro. + * acgeneral.m4 (AC_DIVERT): New macro, maps a diversion name to + its value. The diversions now have a short name, e.g., `NOTICE', + instead of the former macros which had long names, e.g., + `AC_DIVERSION_NOTICE'. + (AC_DIVERT_PUSH): Adjust. + (AC_DIVERT_POP): Use ifndef. + (AC_DIVERSION_CURRENT): Rename as `AC_DIVERT_DIVERSION' to stay + within the `AC_DIVERT' name domain. + Adjust all callers. + * acspecific.m4: Adjust all callers. + +2000-03-13 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Invoking autoconf): Update documentation of + `autoconf --trace'. + +2000-03-13 Akim Demaille <akim@epita.fr> + + * autoconf.sh (tmpbase): New var. Adjust trap code and other tmp + file names. + (translate_awk::BEGIN): Set RS to "\0" so that the whole file be a + single record. + (translate_awk::trans): Convert from array to function. + (translate_awk::error): New function. + (translate_awk::main action): Implement support for ${sep}@ and + ${sep}*. Use trans() and error(). + (translate_awk): Don't put space before user functions call, it is + not portable. + Remove trailing `;', this is not C :). + (task trace): Quote `$traces' when you eval it, to protect the + white spaces. + Propagate `translate_awk' failures to `autoconf.sh'. + Translate the quadrigraphs. + +2000-03-13 Akim Demaille <akim@epita.fr> + + Trap on 0 is not executed when `exit' is called without argument. + + * autoheader.sh (trap 1 2 13 15): s/exit/exit $?/. + * autoconf.sh: Likewise. + Remove translate_awk too. + * autoupdate.sh: Likewise. + Handle `--debug'. + +2000-03-13 Akim Demaille <akim@epita.fr> + + More uniform style in scripts. + + * autoheader.sh: s/-eq/=/. + Uniform ordering of variable initializations, option handling. + Don't use quotes where useless (foo=$1, not foo="$1"). + Propagate `run_m4' and `run_m4f'. + Use `$0' in --help. + * autoconf.sh: Likewise. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * ifnames.sh: Likewise. + * autoupdate.m4: Small bug: at the end `dnl' is disabled, so use + `m4_dnl'. + +2000-03-13 Akim Demaille <akim@epita.fr> + + `autoconf --trace': faster. + + * autoconf.sh (initialization): New var, new option. + (option loop): When you need an arg, make sure there is one. + (run_m4f): New var, which content is that of the former... + (run_m4): Don't use m4 frozen state files. + Change all callers. + Don't pass AC_LOCALDIR, not documented, and unused. + (task trace): Honor `--verbose' and `--initialization'. + (globally): Send `--verbose' messages in stderr. + Fix random typos. + +2000-03-13 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_PROG_BINSH): Removed. + +2000-03-13 Akim Demaille <akim@epita.fr> + + Start revamping `autoconf --trace'. + + * autoconf.sh (debug): New var, new option. + Adjust the trap code. + (task trace): Instead of decoding `m4 --trace' with sed, decode it + with m4 itself. + ($silent_m4): New file, which disables m4's `errprint'. + ($trace_m4): New file. Logistic for the m4 which is in charge of + decoding the traces of the first. + ($translate_awk): Transform a user trace request into $trace_m4 + code. + +2000-03-10 Akim Demaille <akim@epita.fr> + + Multiple `-e' to egrep are not portable. On IRIX 6.5 and Solaris + 2.5.1 only the last one is honored: + > printf "foo\nbar\n" | egrep -e 'foo' -e 'bar' + bar + > printf "foo\nbar\n" | egrep -e 'bar' -e 'foo' + foo + Reported by Nicolas Joly. + An alternative would have been to use `sed', unfortunately + alternation is not portable. + + * tests/actest.m4 (join): New macro. + (AC_ENV_SAVE): Join the egrep patterns into a single big one. + * tests/Makefile.am (EGREP_EXCLUDE): Rename as FILTER_MACROS. + Join the egrep patterns into a single big one. + +2000-03-10 Jim Meyering <meyering@lucent.com> + + * acgeneral.m4 (_AC_CHECK_TOOL_PREFIX): Correct typos in definition: + add `_' prefix to make the function name match comments and existing + uses. Remove leading prefix from _AC_CANONICAL_HOST. + +2000-03-09 Ossama Othman <ossama@debian.org> + + * acspecific.m4 (AC_SYS_RESTARTABLE_SYSCALLS): Added some missing + headers if they exist (needed for some missing prototypes) and + corrects the signal handler prototype/definition. The signal + handler prototype is now prepended with an `extern "C"' for C++ + compilers since some platforms explicitly require an `extern "C"' + signal handler. + +2000-03-08 Akim Demaille <akim@epita.fr> + + * autoheader.m4 (autoheader::AC_CHECK_HEADERS_DIRENT): Rename as + (autoheader::_AC_CHECK_HEADERS_DIRENT): to cope with the new name + of the autoconf:: macro. + Fixes autoconf/119, reported by Raja R Harinath. + +2000-03-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PATH_PROG, AC_OUTPUT_FILES, AC_OUTPUT_SUBDIRS): + Fix quotation problems in DOS path handling. + +2000-03-08 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> + + * acspecific.m4 (AC_FUNC_MMAP, AC_FUNC_ALLOCA): Make them C++ + safe: include the right headers, cast the allocations etc. + +2000-03-08 Akim Demaille <akim@epita.fr> + + The argument of AC_COPYRIGHT should be plain text, not an sh + comment. + + * libm4.m4 (m4_quote): s/$@/$*/. + * acgeneral.m4 (AC_COPYRIGHT): Prepend `# ' to the lines that go + on the top of `configure'. Actually, prepend `@%:@ ' so that + there are as many evaluations on both sides. + (_AC_INIT_VERSION): No longer strip `# '. + +2000-03-08 Akim Demaille <akim@epita.fr> + + * tests/Makefile.am (all-local): Remove. It wastes time to have + testsuite rebuilt each time an ac*.m4 file changes. It is enough + to build it for each `make check'. + +2000-03-08 Akim Demaille <akim@epita.fr> + + Leave a diversion exclusively for Copyright notices. + + * acgeneral.m4 (AC_DIVERSION_DEFAULTS): New diversion number. + (_AC_INIT_NOTICE): Move definition of `ac_includes_default' from + here... + (_AC_INIT_PREPARE): to here. + (_AC_INIT_NOTICE): Play with your diversion yourself, don't let + (AC_INIT): do it for you. + (_AC_INIT_DEFAULTS): New macro. + (AC_INIT): Use it. + +2000-03-08 Akim Demaille <akim@epita.fr> + + Provide a means to specify more Copyright information in + `configure'. And after all, it suits to `configure --version' too. + + * acgeneral.m4 (AC_DIVERSION_DEFAULTS, AC_DIVERSION_INIT_PREPARE): + New diversion numbers. + (AC_DIVERSION_INIT): Rename as... + (AC_DIVERSION_INIT_PARSE_ARGS): this. + (AC_DIVERT_POP): Instead of going into wild endless loops when + there are more pops than pushes, die with dignity. + (AC_COPYRIGHT): New macro. + (_AC_INIT_NOTICE): Move definition of `ac_includes_default' from + here... + (_AC_INIT_PREPARE): to here. + (_AC_INIT_NOTICE): Remove. + (AC_INIT): Use it to install Autoconf's Copyright. + (_AC_INIT_DEFAULTS): New macro. + (AC_INIT): Use it. + (AC_PREFIX_DEFAULTS): Dump in AC_DIVERSION_DEFAULTS. + (_AC_INIT_PARSE_ARGS): Dump in AC_DIVERSION_INIT_PREPARE. + +2000-03-08 Akim Demaille <akim@epita.fr> + + We don't need _AC_ARG_*_HELP_PROLOGUE. + + * acgeneral.m4 (AC_EXPAND_ONCE): AC_PROVIDE yourself, in case + there is no AC_DEFUN associated with the text to expand. + (_AC_ARG_ENABLE_HELP_PROLOGUE, _AC_ARG_WITH_HELP_PROLOGUE, + _AC_ARG_VAR_HELP_PROLOGUE): Remove, instead... + (AC_ARG_ENABLE, AC_ARG_WITH, AC_ARG_VAR): do it yourself. + +2000-03-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Fix copy n' paste typos in + `--with-*', `--without-*' and `*' decoding. + Reported by Raja R Harinath. + Fixes autoconf/118. + +2000-03-08 Akim Demaille <akim@epita.fr> + + Don't dump AC_ARG_PROGRAM help messages if not used. + + * acgeneral.m4 (_AC_INIT_HELP): Don't. + (AC_ARG_PROGRAM): Do. + +2000-03-08 Akim Demaille <akim@epita.fr> + + Don't dump X help messages when `configure' does not check for X. + + * acgeneral.m4 (_AC_INIT_HELP): Don't dump X help messages. + * acspecific.m4 (AC_PATH_X): Do it. + +2000-03-08 Akim Demaille <akim@epita.fr> + + No longer rely on /bin/sh to compose the optional parts of + `configure --help'. + + * acgeneral.m4 (AC_DIVERSION_HELP_BEGIN, AC_DIVERSION_HELP_ENABLE, + AC_DIVERSION_HELP_WITH, AC_DIVERSION_HELP_VAR, + AC_DIVERSION_HELP_END): New diversion numbers. + (AC_EXPAND_ONCE): New macro. + (AC_PROVIDE_IF): New macro. + (AC_BEFORE, AC_REQUIRE): Use it. + (AC_REQUIRE): Don't use indir. + (_AC_ARG_ENABLE_HELP_PROLOGUE, _AC_ARG_WITH_HELP_PROLOGUE, + _AC_ARG_VAR_HELP_PROLOGUE): New macros. + (AC_ARG_ENABLE, AC_ARG_WITH, AC_ARG_VAR): Expand once the + _HELP_PROLOGUE macro which corresponds. + (_AC_INIT_HELP): Adjust to AC_DIVERSION_HELP_BEGIN and + AC_DIVERSION_HELP_END. + (_AC_INIT_NOTICE, _AC_INIT_HELP): Remove the sh code which handled + the optional help strings. + +2000-03-08 Akim Demaille <akim@epita.fr> + + AC_OUTPUT_COMMANDS no longer uses a diversion. + + * acgeneral.m4 (AC_DIVERSION_CMDS): Removed. + (_AC_OUTPUT_CONFIG_STATUS): Don't undivert it. + +2000-03-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_INIT_PARSE_ARGS): Fix quoted/non quoted here + document problems. + +2000-03-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INIT_BINSH, AC_INIT_NOTICE, AC_INIT_PREPARE): + Rename as... + (_AC_INIT_BINSH, _AC_INIT_NOTICE, _AC_INIT_PREPARE): this. + All callers adjusted. + +2000-03-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Rename as... + (_AC_INIT_PARSE_ARGS): this. + Move the display of help and version strings to... + (_AC_INIT_HELP, _AC_INIT_VERSION): here. + (AC_INIT): Adjust. Also, fix quotation. + +2000-03-08 Akim Demaille <akim@epita.fr> + + Some tests are failing with srcdir != builddir, because they can't + find config.guess, install-sh etc. + Reported by Erez Zadok. + + * tests/atspecific.m4 (AT_TEST_MACRO): Set AC_CONFIG_AUX_DIR to + top_srcdir in configure.in, and pass the value of top_srcdir to + configure. + +2000-03-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_ARG_ENABLE, AC_ARG_WITH, AC_PATH_PROG, + AC_PATH_PROGS, AC_PATH_TOOL, AC_CHECK_TOOL, AC_PREFIX_PROGRAM, + AC_EGREP_CPP, AC_TRY_LINK, AC_COMPILE_CHECK, AC_TRY_RUN_NATIVE): + Use ifval instead of ifelse. + +2000-03-07 Mark Elbrecht <snowball3@bigfoot.com> + + Support absolute DOS-style paths. + + Any character before the colon is accepted because network drives + can be assigned characters outside the [a-zA-Z] range. DOS-style + relative paths (?:foo/bar) are also considered absolute for + Autoconf's purposes since the path '../?:foo/bar' is invalid. + + * acgeneral.m4 (AC_OUTPUT_FILES): Treat DOS-style paths (?:*') as + absolute. + (AC_OUTPUT_SUBDIRS): Likewise. + (AC_PATH_PROG): Make pattern for matching DOS-style paths the same + as that used in AC_OUTPUT_FILES and AC_OUTPUT_SUBDIRS. + +2000-03-06 Akim Demaille <akim@epita.fr> + + * tests/atspecific.m4 (m4_match): Remove, no longer used. + +2000-03-04 Jim Meyering <meyering@lucent.com> + + * autoheader.sh: Use `rm -f', not just `rm' when removing temporaries. + Preserve exit status in trap handler. + Based on suggestions from Paul Eggert. + +2000-03-03 Paul Eggert <eggert@twinsun.com> + + Move the quadrigraphs out of the user name space. + + * acgeneral.m4: 's/\@BKL@/@<:@/g', 's/\@BKR@/\@:>@/g', + 's/\@DLR@/\@S|@/g', 's/\@PND@/@%:@/g'. + * acspecific.m4: Likewise. + * autoconf.sh: Likewise. + +2000-03-03 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_WHICH_A): New macro. + (AC_CHECK_PROG): Use it. Use ifval. + (AC_CHECK_PROGS): Use ifval. Fix the quoting. + * tests/semantics.m4: Test AC_CHECK_PROG. + * tests/Makefile.am (EGREP_EXCLUDE): Add /AC_CHECK_PROGS?/. + +2000-03-02 Russ Allbery <rra@stanford.edu> + + * autoscan.pl (parse_args): Add support for -m <macrodir>. + +2000-03-02 Akim Demaille <akim@epita.fr> + + The whole family supports -V = --version. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Report and support -V. + * autoconf.sh: Likewise. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * autoheader.sh: Likewise. + * autoscan.pl: Likewise. + * ifnames.sh: Likewise. + In addition, don't dump --help on invalid options. + * doc/autoconf.texi: Adjusted. + * doc/install.texi: Likewise. + +2000-03-02 Lars J. Aas <larsa@sim.no> + + * libm4.m4 (m4_noquote): New macro. + +2000-03-02 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_PATH_X_DIRECT): Moved all the shell variable + into the ac_ name space. + Reported by Nicolas Joly. + +2000-03-02 Akim Demaille <akim@epita.fr> + + * acspecific.m4: Move some macros to a better place. + +2000-03-02 Akim Demaille <akim@epita.fr> + + Internal macros are named `_AC_'. + + * acgeneral.m4 (AC_CANONICAL_TARGET, AC_CANONICAL_BUILD, + AC_CANONICAL_THING, AC_CHECK_TOOL_PREFIX, AC_CONFIG_UNIQUE): + Prepend `_' to their names. + * acspecific.m4 (AC_CHECK_HEADER_DIRENT, AC_CHECK_HEADERS_DIRENT, + AC_PATH_X_XMKMF, AC_PATH_X_DIRECT): Prepend `_' to their names. + * doc/autoconf.texi (Macro Names): Adjusted. + +2000-03-02 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formatting changes. + * acspecific.m4: Likewise. + +2000-03-01 Akim Demaille <akim@epita.fr> + + The empty regexp cannot be portably used in egrep's alternation. + For instance with Digital Unix v5.0: + > echo "foo" | egrep -e "^(|foo|bar)$" + > echo "|foo" | egrep -e "^(|foo|bar)$" + |foo + > echo "|bar" | egrep -e "^(|foo|bar)$" + > echo "bar" | egrep -e "^(|foo|bar)$" + bar + > echo "bar" | egrep '^(foo|bar|)$' + > echo "bar|" | egrep '^(foo|bar|)$' + bar| + > echo "bar" | egrep '^(foo||bar)$' + > echo "|bar" | egrep '^(foo||bar)$' + |bar + > echo "foo" | egrep '^(foo||bar)$' + foo + > echo "foo|" | egrep '^(foo||bar)$' + > + Reported by Nicolas Joly. + + * src/actest.m4 (AC_ENV_SAVE): s/(|EXTRA_|PRE_)/(EXTRA_|PRE_)?/. + +2000-03-01 Akim Demaille <akim@epita.fr> + + * acspecific.m4: Removed a few addresses, the map is... + * THANKS: here. + +2000-03-01 Lars Hecking <lhecking@nmrc.ucc.ie> + + * acspecific.m4 (AC_PATH_XTRA): On LynxOS 3.0.1/i386, + gethostbyname(), getservbyname(), and inet_addr() are in -lbsd. + +2000-03-01 Akim Demaille <akim@epita.fr> + + * tests/actest.m4 (AC_ENV_SAVE): Use multiple -e instead of + multiple egrep. + +2000-03-01 Akim Demaille <akim@epita.fr> + + * config.guess: Updated from master repository. + * config.sub: Likewise. + +2000-03-01 Akim Demaille <akim@epita.fr> + + Test suite: instead of using a full list of the AC macros and an + AT macro with selects which are the AC macros to test, just + produce the list of the AC macros we want to test. + + * tests/atspecific.m4 (TEST_MACRO): Removed. + * tests/Makefile.am (EGREP_EXCLUDE): New variable, performing the + selection TEST_MACRO used to do. + (macros.m4): Use it. Use AT_TEST_MACRO, not TEST_MACRO. Check + also AU macros. + +2000-03-01 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi: Tune the use of quotes, add missing + @noindents, remove dead FIXME:s, promote #if ! over #ifndef, + simplify duplicated text. + +2000-03-01 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Configuration Commands): Document + AC_CONFIG_COMMANDS_PRE and _POST. + +2000-02-29 Akim Demaille <akim@epita.fr> + + Test suite: more debugging information. + + * tests/atspecific.m4 (AT_TEST_MACRO): When verbose, report the + content of config.log. + +2000-02-29 Akim Demaille <akim@epita.fr> + + * Makefile.am (MAKEINFO): Removed. + (INSTALL.txt): Call $(MAKEINFO) with --no-split. + Reported by Nicolas Joly. + +2000-02-28 Akim Demaille <akim@epita.fr> + + * doc/Makefile.am (MAKEINFO): s/makeinfo/@MAKEINFO@/. + * missing: chmod +x. + +2000-02-28 Akim Demaille <akim@epita.fr> + + * tests/Makefile.am (testsuite): Use $(M4), not m4. + From Patrick Tullmann. + +2000-02-25 Akim Demaille <akim@epita.fr> + + * src/acgeneral.texi (AC_INIT_NOTICE): Include inttypes.h in the + ac_includes_default. + * doc/autoconf.texi (Default Includes): Adjust. + +2000-02-25 Akim Demaille <akim@epita.fr> + + Export the knowledge on disabling echo's trailing new line. + + * acspecific.m4 (AC_PROG_ECHO_N): Rename as... + (_AC_PROG_ECHO): this. + Set ECHO_N, ECHO_C, ECHO_T instead of ac_n, ac_c and ac_t. + All dependencies changed. + * doc/autoconf.texi (Preset Output Variables): Document ECHO_C, + ECHO_N and ECHO_T. + * m4/atconfig.m4 (fp_PROG_ECHO): Removed. + (AT_CONFIG): Don't use it. + +2000-02-24 Akim Demaille <akim@epita.fr> + + * autoconf.sh (AC_ACLOCALDIR): Use `(aclocal) 2>/dev/null`, not + `aclocal 2>/dev/null` if you want no complaints for missing + aclocal. + From Nicolas Joly. + +2000-02-22 Pavel Roskin <pavel_roskin@geocities.com> + + * configure.in (HELP2MAN): Specify the third argument of + AM_MISSING_PROG. Fixes autoconf/116. + +2000-02-21 Akim Demaille <akim@epita.fr> + + * tests/tools.m4 (syntax.sh): The logic of the previous patch was + twisted. Fix it so that it performs what claims the entry below. + From Nicolas Joly. + +2000-02-21 Akim Demaille <akim@epita.fr> + + * tests/tools.m4 (syntax.sh): Exit 1 if you managed to kill the + child, since it means `/bin/sh -n' went loopy. + +2000-02-18 Akim Demaille <akim@epita.fr> + + Some `diff' refuse to diff with /dev/null, such as Tru64's. + Reported by Nicolas Joly. + + * tests/atgeneral.m4 (empty): New dummy file. + Changed various `diff /dev/null' as `diff empty'. + +2000-02-18 Akim Demaille <akim@epita.fr> + + * tests/atspecific.m4 (TEST_MACRO): Don't run AC_PATH_TOOL and + AC_PATH_PROG. + +2000-02-18 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4 (at_diff): Don't use `cmp -s', on DOS it + differentiate between Unix and DOS EOL. `diff' does not. + Reported by Eli Zaretski. + Also, be ready to use a diff that does not support `-u'. + +2000-02-18 Akim Demaille <akim@epita.fr> + + * tests/tools.m4 (Syntax of the scripts): Be robust to shells that + never return on some `/bin/sh -n foo.sh'. + Reported by Nicolas Joly. + +2000-02-17 Akim Demaille <akim@epita.fr> + + Move the documentation into doc/. + Some CVS tricks were used so that history is kept in both the top + directory, and in doc/. + + * doc/Makefile.am: New file. + * Makefile.am: Adjusted. + * configure.in: Adjusted. + * autoconf.texi: Moved from here to... + * doc/autoconf.texi: here. + * make-stdts.texi: Likewise. + * install.texi: Likewise. + * texinfo.tex: Likewise. + +2000-02-17 Akim Demaille <akim@epita.fr> + + * tests/actest.m4 (AC_ENV_SAVE): Added ALLOCA. + +2000-02-17 Akim Demaille <akim@epita.fr> + + * tests/semantics.m4 (AC_CHECK_TYPES): `addr, addr' is not + portable sed: use `addr,addr'. + +2000-02-17 Akim Demaille <akim@epita.fr> + + Fix the `missing dummy.in' reported by the test suite. + Reported by Erez Zadok. + + * tests/torture.m4 (config.status under extreme conditions): + Reorganized. Because files required by this test were created + outside the pair AT_SETUP/AT_CLEANUP, when the test fails and + autotest extracts this test, the `debug' script does not contain + the files it needs. Now AT_SETUP/AT_CLEANUP encloses the full + auto contained section. + +2000-02-16 Akim Demaille <akim@epita.fr> + + * tests/actest.m4 (AC_ENV_SAVE): X_EXTRA_LIBS can be changed by + AC_PATH_EXTRA. + Reported by Erez Zadok. + +2000-02-15 Akim Demaille <akim@epita.fr> + + Define HAVE_DECL_FOO both to 1 if found and 0 otherwise. + + * acgeneral.m4 (AC_CHECK_DECLS): Define HAVE_DECL_FOO to 1 instead + of NEED_FOO_DECL if found. Define to 0 if not found. + * autoheader.m4 (AC_CHECK_DECLS): Template HAVE_DECL_FOO. + * tests/semantics.m4 (AC_CHECK_DECLS): Adjusted. + * doc/autoconf.texi (Generic Declarations): Adjusted. + +2000-02-15 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Generic Structures): + s/AC_FATAL/AC_MSG_ERROR. + +2000-02-15 Akim Demaille <akim@epita.fr> + + autoreconf had a silly syntax error, test it and fix it. + Reported by Franc,ois Pinard and Rainer Orth. + + * autoreconf.sh: Removed spurious `;;'. + Formatting changes. + * tests/tools.m4 (Syntax of the scripts): Run `sh -n' on all the + shell scripts. + +2000-02-15 Akim Demaille <akim@epita.fr> + + * autoconf.sh (options handling): --v* of --version was shadowing + --verbose. + +2000-02-11 Akim Demaille <akim@epita.fr> + + * tests/torture.m4: Nuke the trailing space in defs. + +2000-02-11 Akim Demaille <akim@epita.fr> + + * tests/atspecific.m4: Really added to the CVS repository. + +2000-02-11 Akim Demaille <akim@epita.fr> + + Don't use `cat -s' to single out new-lines, it is not portable. + Also remove trailing blanks. + + * tests/Makefile.am (testsuite): Use sed instead of cat. + * tests/torture.m4: No longer check for a trailing space. + * autoconf.sh: Likewise. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * tests/actest.m4 (AC_ENV_SAVE): OpenBSD-2.3's /bin/sh defines an + envvar SECONDS which does change with time. + KMEM_GROUP is set by AC_FUNC_GETLOADAVG. + Reported by Volker Borchert. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * tests/Makefile.am (macros.m4): Better regex to build `macro'. + Depend upon acgeneral.m4. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * autoheader.sh: Remove the duplicate trap code. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT): When dispatching your arguments, use + ifval, not ifset! + Dispatch actions to AC_CONFIG_COMMANDS not AC_OUTPUT_COMMANDS, to + avoid unneeded warnings for obsolete use of AC_OUTPUT_COMMANDS. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_VERBOSE): This is a tab, not spaces. + +2000-02-10 Akim Demaille <akim@epita.fr> + + Changequote busters II. + They're back to save the world. + + * acspecific.m4 (AC_PROG_CC_C_O, AC_PROG_F77_C_O, + AC_PROG_MAKE_SET, AC_TYPE_GETGROUPS, AC_FUNC_GETLOADAVG, + AC_FUNC_MKTIME, AC_STRUCT_TIMEZONE, AC_F77_LIBRARY_LDFLAGS): Blast + that jelly o' changequote. Set the quotes free. + +2000-02-10 Akim Demaille <akim@epita.fr> + + Interrupting autoheader left temp files. + From Jim Meyering. + + * autoheader.sh (usage): The usage is to use $0 here. + (ah_base): Be in TMPDIR. + Install the `trap' before creating the first tmp file. + Also trap on 0. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS): This is a routine of + `configure', not `config.status', hence use `conftest' for tmp + files, not `$ac_cs_root'. + Removed forgotten developer comment. + Double quoting the whole body is nicer than just the part that + needs to be. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * tests/torture.m4: Also check the value of @DEFS@ when no + CONFIG_HEADER is used. + +2000-02-10 Akim Demaille <akim@epita.fr> + + Changequote-busters! + From Dan Ackroyd. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS, AC_INIT_PREPARE, + AC_CACHE_SAVE, AC_PREFIX_PROGRAM, AC_OUTPUT, + _AC_OUTPUT_CONFIG_STATUS, AC_OUTPUT_MAKE_DEFS, AC_OUTPUT_FILES, + _AC_OUTPUT_HEADERS, AC_OUTPUT_LINKS, AC_OUTPUT_SUBDIRS): Quit + playing with changequotes, @BKL@ and Co.! Just quote properly. + +2000-02-10 Akim Demaille <akim@epita.fr> + + Honor properly the `#define' config.h.in templates. + Test it. + + * acgeneral.m4 (AC_OUTPUT_HEADERS): Rename as... + (_AC_OUTPUT_HEADERS): this. All callers changed. + Don't mess with changequote, just quote properly. + Bug 1. Because of the `#' in `ac_dA', the quotes <<>> were not + removed, and therefore the sed script contained `<<define>>' + instead of `define'. Now that the block is properly quoted, there + is no need to quote `define'. + Bug 2. Once a `#define' substitution performed, we were branching + to the top of the sed script (`t top'). This resulted in an + endless substitution of `#define foo 1' to `#define foo 1'. + Branching is not enough: you also have to fetch the next input + line, i.e., use `t' instead of `t t' in ac_dD, and don't output + `: top' in `config.defines'. + Though it was correct for `#undef' templates, just apply the same + transformation to `ac_uD' and `config.undefs'. + Bug 3. Don't try to preserve what was behind the value in the + template, since on + #define NAME "bar baz" + it leads to + #define NAME 1 baz" + Now `ac_dB' catches everything behind the NAME (making sure there + is at least a space) and `ac_dC' only outputs a space. + * tests/torture.m4: Check that various forms of `#define' header + templates are properly handled. + +2000-02-10 Akim Demaille <akim@epita.fr> + + Avoid calling `rm' without arguments. + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): It is smarter to use a + quoted here doc to output the section providing defaults for + CONFIG_*. + Don't rm the CONFIG_FILES here but in.. + (AC_OUTPUT_FILES) [test -n "$CONFIG_FILES"]: here. + Hm, actually, no, just don't remove them at all, let the newly + created files replace the old ones, exactly as in + AC_OUTPUT_HEADERS. + From Graham Jenkins. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_LIST_MEMBER_OF): s/ac_$exists/$ac_exists/! + +2000-02-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formatting changes. + * acspecific.m4: Likewise. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (_AC_OUTPUT_CONFIG_STATUS): Don't + : ${FOO="$foo"} + but + : ${FOO=$foo} + Since Ultrix will also assign the quotes to FOO. + Reported by Harlan Stenn. + +2000-02-10 Akim Demaille <akim@epita.fr> + + Keep `AC_CHECK_TYPE' backward compatibility and provide a proper + `AC_CHECK_TYPE', + Based on ideas from Paul Eggert and Alexandre Oliva. + + * acgeneral.m4 (AC_CHECK_TYPE_INTERNAL): Rename as... + (_AC_CHECK_TYPE_NEW): this. + (AC_CHECK_TYPES): Adjusted. + (AC_CHECK_TYPE): Rename as... + (_AC_CHECK_TYPE_OLD): This. Adjusted to _AC_CHECK_TYPE_NEW. + No longer support extra includes, stick to 2.13's interface. + (_AC_CHECK_TYPE_BUILTIN_P): New macro. + (AC_CHECK_TYPE): New macro. + * autoheader.m4 (autoheader::AC_CHECK_TYPE): Rename as... + (autoheader::_AC_CHECK_TYPE_OLD): this. + * tests/atspecific.m4 (TEST_MACRO): Skip /^_AC_/ macros. + * tests/semantics.m4: Test the choices of AC_CHECK_TYPE (wrt _NEW + or _OLD implementation). + * doc/autoconf.texi (Generic Types): Reorganized. Explain + everything about AC_CHECK_TYPE and Co. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * libm4.m4 (near m4_split): Remove the buggy additional + changequote. + Quote properly `m4_split' when registering it. + +2000-02-10 Akim Demaille <akim@epita.fr> + + The AU-glue code for AC_LINK_FILES was not fully compatible: in + AC_LINK_FILES($from, $to) + `$from' and `$to' can be lists, hence `AC_CONFIG_LINKS($to:$from)' + is wrong. + Reported by H.J. Lu. + + * acgeneral.m4 (AC_LINK_FILES): Replace the m4-glue code from + AC_LINK_FILES to AC_CONFIG_LINKS, with sh-glue code. + Give a detailed update message. + (_AC_LINK_FILES_CNT): New variable. Initialize. + * tests/tools.m4 (autoupdate): No longer exercise `autoupdate' + with AC_LINK_FILES. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_PROG_SED): Removed. + +2000-02-10 Akim Demaille <akim@epita.fr> + + AC_CHECK_FILES has never worked properly. + + * acgeneral.m4 (AC_CHECK_FILE): Use AC_CACHE_CHECK. + * autoheader.m4 (AC_CHECK_FILES): AH-define. + * tests/semantics.m4: Test AC_CHECK_FILES. + * tests/atspecific.m4 (TEST_MACRO): Don't. + +2000-02-10 Akim Demaille <akim@epita.fr> + + No longer use a diversion to store the sed program implementing + AC_SUBST. + + * acgeneral.m4 (_AC_SUBST): New macro. + (_AC_SUBST_SED_PROGRAM): Initialize. + (AC_SUBST): Use _AC_SUBST. + (AC_SUBST_FILE): Likewise. + (AC_DIVERSION_SED): Removed. Renumber the AC_DIVERSIONs. + (AC_OUTPUT_FILES): Instead on undiverting AC_DIVERSION_SED, output + _AC_SUBST_SED_PROGRAM. + +2000-02-10 Akim Demaille <akim@epita.fr> + + Standardize the error messages in the options handling of + `configure' and `config.status'. + + * acgeneral.m4 (AC_OUTPUT_CONFIG_STATUS): Rename as... + (_AC_OUTPUT_CONFIG_STATUS): this. + Change the error messages from + value: invalid feature name + to + invalid feature: value + Invite the user to try --help for invalid options. + (AC_INIT_PARSE_ARGS): Likewise. + +2000-02-10 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT_COMMANDS_COMMANDS): Rename as... + (_AC_OUTPUT_COMMANDS): This. All callers changed. + Disable the verbose message until Automake uses the new features + of `config.status'. + Reported by Jim Meyering. + +2000-02-10 Akim Demaille <akim@epita.fr> + + Clean up a few changequotes. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Instead of using changequote + to protect a few `[ ]', double quote the constant sections. + +2000-02-10 Akim Demaille <akim@epita.fr> + + Restore AC_HAVE_LIBRARY. + + * acgeneral.m4 (AC_HAVE_LIBRARY): AU_DEFUNed in terms of + AC_CHECK_LIB. + * doc/autoconf.texi (Libraries): Document. + +2000-02-09 Akim Demaille <akim@epita.fr> + + Fix the handling of `./configure foo=bar' and test it. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS, getopt loop): Always define + ac_optarg as the rhs of the first `=', not only on `-.*=', so that + `configure var=val' defines ac_optarg=val. + Improve the robustness to shell special characters: + - Use grep when checking that shell variable names are valid. + - Quote the quotes in ac_optarg before `eval var='$ac_optarg''. + - Quote the quotes when building ac_configure_args. + + * tests/torture.m4: Test that `./configure foo=bar' works properly. + +2000-02-09 Akim Demaille <akim@epita.fr> + + Resynchronize `INSTALL' with the current `configure', and + conversely... + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Let `configure' support `-h = + --help' and `-n = --no-create'. + Document -h, -n and -q in configure's help message. + * install.texi (Operation Controls): Formatting changes. + Document `configure -h'. + +2000-02-09 Akim Demaille <akim@epita.fr> + + * README: Updated. + +2000-02-09 Akim Demaille <akim@epita.fr> + + * ChangeLog.1: Formatting changes. + +2000-02-09 Akim Demaille <akim@epita.fr> + + Clean up `make clean'. + + * Makefile.am (CLEANFILES): Added autoupdate.m4f and autoconf.tmp. + * tests/torture.m4: Rm dummy and dummy.in. + +2000-02-09 Akim Demaille <akim@epita.fr> + + Test `autoupdate'. + + * tests/tools.m4 (AH_DEFUN): Fix the comments. + Quote properly. + (autoupdate): New test. + +2000-02-09 Akim Demaille <akim@epita.fr> + + AU_ glue code for AC_OUTPUT with arguments. + + * acgeneral.m4 (AU_DEFINE): New macros, pulled out from AU_DEFUN. + Defines a macro in `autoupdate::' with all the required wrapping + for `autoupdate'. + (AU_DEFUN): Use it. + (AC_OUTPUT): When dispatching your arguments, use ifval, not + ifset! + Dispatch actions to AC_CONFIG_COMMANDS not AC_OUTPUT_COMMANDS, to + avoid unneeded warnings for obsolete use of AC_OUTPUT_COMMANDS. + (autoupdate::AC_OUTPUT): New macro. + * doc/autoconf.texi (Writing configure.in, the example): Don't + advocate AC_OUTPUT with args. + (Output, AC_OUTPUT with args): Simplify the documentation, and + provide the translation into the new scheme. + Propagate what remained into the proper sections. + +2000-02-09 Akim Demaille <akim@epita.fr> + + AU_ glue code for AC_OUTPUT_COMMANDS. + + * acgeneral.m4 (AC_OUTPUT_COMMANDS): AU_DEFUNed in terms of + AC_CONFIG_COMMANDS. + (AC_OUTPUT_COMMANDS_CNT): New variable, declared both in + `autoconf::' and `autoupdate::'. + (AC_OUTPUT): Register your arguments to AC_OUTPUT_COMMANDS only if + there are to avoid spurious `run autoupdate' messages. + * doc/autoconf.texi (Libraries): Document the changes. + +2000-02-09 Akim Demaille <akim@epita.fr> + + Avoid outputting `config_files' code in `config.status' if there + are none. + + * acgeneral.m4 (AC_OUTPUT): Don't register $1 to `AC_CONFIG_FILES' + if $1 is empty. + Normalize the names of the sections in `config.status --help'. + +2000-02-09 Akim Demaille <akim@epita.fr> + + * README-alpha: New file, based on Automake's. + * Makefile.am: Tuned. + +2000-02-09 Akim Demaille <akim@epita.fr> + + Extend the concept of `INIT-CMDS' to the AC_CONFIG_FOOS. + + * acgeneral.m4 (_AC_CONFIG_COMMANDS_INIT): New macro which will + collect the `INIT-CMDS'. + (AC_CONFIG_COMMANDS, AC_CONFIG_LINKS, AC_CONFIG_HEADERS, + AC_CONFIG_FILES): Use it, and also temporarily divert to -1 + instead of spamming dnl everywhere. + (AC_OUTPUT_CONFIG_STATUS): Make sure to output the INIT-CMDS + before the other sections, it'd be a pity to initialize after the + use :). + + * doc/autoconf.texi (Configuration Actions): New section, + documenting the common behavior of AC_CONFIG_FILES, + AC_CONFIG_HEADERS, macro AC_CONFIG_COMMANDS, and AC_CONFIG_LINKS. + (Configuration Files): Document $2 and $3 of AC_CONFIG_FILES. + (Configuration Headers): Document $2 and $3 of AC_CONFIG_HEADERS. + (Configuration Commands): Document $2 and $3 of AC_CONFIG_COMMANDS. + (Configuration Links): Document $2 and $3 of AC_CONFIG_FILES. + +2000-02-09 Akim Demaille <akim@epita.fr> + + * libm4.m4 (m4_sign, m4_cmp, m4_list_cmp): New macros. + * acgeneral.m4 (AC_UNGNITS): Rename as... + (_AC_VERSION_UNLETTER): this. All callers changed. + Implement the scheme proposed by Alexandre Oliva: + Nl -> (N+1).-1.(l#) + (_AC_VERSION_COMPARE): New macro. + (AC_PREREQ): Use it. + +2000-02-09 Akim Demaille <akim@epita.fr> + + * tests/base.m4: Really added to the CVS repository. + * tests/tools.m4: Likewise. + +2000-02-09 Akim Demaille <akim@epita.fr> + + * tests/base.m4: s/m4 -I ../m4 -I $at_top_srcdir/. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * autoheader.sh (debug): Initialize to `false', not 0. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Fix a bug: `libm4::define' was incorrectly registered. + + * libm4.m4 (libm4::define): Not only register, define too. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_COMPILE_CHECK): Use AU_DEFUN, remove the call + to AC_OBSOLETE. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PROVIDE): Use `m4_define', not `define'. + Because of the names pace machinery this change makes `autoconf' + about four times faster on complex `configure.in's. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Open the access to AH_ to users. + + * autoheader.m4 (autoheader::AH_DEFUN): New macro. + * tests/tools.m4: New file, in charge of testing the scripts. + All the dependencies adapted. + * tests/actest.m4 (autoheader::AC_TATOOINE): New macro, used while + testing autoheader. + * tests/atspecific.m4: Create config.hin instead of config.h.in. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Because of commas and brackets, m4_split must mess with the + quotes. + + * libm4.m4 (m4_split): Quote the elements of the list you produce. + * tests/base.m4: New file, testing libm4. + All callers adapted. + Test m4_wrap. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CONFIG_UNIQUE): Strip the `:foo.in' part + yourself, in order to give better error messages. + (AC_CONFIG_IF_MEMBER): Adapted to the above change. + Quote some regexp active characters ([+.*]). + Suggested by Alexandre Oliva. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INCLUDES_DEFAULT): Make it more robust to + the fact it is used non quoted. + Reported by Jim Meyering. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT_FILES): Simplify some excess in + changequote. + (AC_OUTPUT_SUBDIRS): Likewise. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * autoupdate.sh: Don't dump --help on --wrong-option. + * autoconf.sh: Reformatting, and use >&2 instead of 1>&2. + * autoreconf.sh: Likewise. + * autoheader.sh: Likewise. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * libm4.m4 (m4_namespace_push, m4_namespace_pop): Use the private + macros to be robust to name space changes. + (m4_popdef, m4_pushdef): New private macros. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Let the doc catch up. + + * doc/autoconf.texi (Common Behavior): New section, to document + the common behavior of the macros. + (Standard Symbols): New subsection. Describes the transformation + of the AC_DEFINEd names. + (Default Includes): New subsection. Obvious content. + All the ``callers'' updated. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT_HEADERS): Don't use `break' to exit the + while loops which are breaking conftest.defines and + conftest.undefs into smaller snippets: just use the proper + condition for the while. + Suggested by Alexandre Oliva. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Configuration Commands): New section, for + AC_CONFIG_COMMANDS. + Move the definition of AC_OUTPUT_COMMANDS here. + (Configuration Links): New section, for AC_CONFIG_LINKS and + AC_LINK_FILES. + (Configuration Files): New section, for AC_CONFIG_FILES. + (Globally) Promote AC_CONFIG_HEADERS over AC_CONFIG_HEADER. + (Using System Type): Don't document AC_CONFIG_LINKS and + AC_LINK_FILES. + (Invoking config.status): Mention CONFIG_COMMANDS. + Document --file and --header. + Talk first of the newest interface of config.status. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Introduce a concept index, and update a bit the documentation. + + * doc/autoconf.texi (Concept Index): New section. + Various entries added. + (Typedefs): Rename as... + (Types): this. Pay attention to not limiting the documentation to + the typedefs. + (Particular Types): Mention the equivalent generic test. + Promote the GNU coding style at various places. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Revamp the autoupdate/AC_OBSOLETE chain. All the details are + given in the prologue of acoldnames.m4. + + * acgeneral.m4 (Prologue): Enter the `autoconf' name space. + (AU_DEFUN): New macro. + + * autoupdate.m4: New file. + Disable the name spaces `autoconf', and `libm4'. Disable libm4. + * Makefile.am: Tuned to support the changes above. + + * autoupdate.sh: Model after autoconf.sh. + Can run on several files at once (for instance m4/*.m4). + Don't touch files that are up to date. + Run m4 on autoupdate.m4f instead of playing with sed. + + + Use AU_DEFUN. + + * acgeneral.m4 (AC_LINK_FILES, AC_ENABLE, AC_WITH): Use AU_DEFUN, + remove the call to AC_OBSOLETE. + * acspecific.m4 (AC_CYGWIN32): Likewise. + * acoldnames.m4: Replaced all the definitions via `define' or + `AC_DEFUN' to use `AU_DEFUN'. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Clean up some m4 files. + + * acoldnames.m4: Use `#', not `dnl'. + Don't spread `dnl' everywhere, anyway, we are in a divert(-1). + * autoconf.m4: Likewise. + * autoheader.m4: Likewise. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Clean up autoconf. + + * autoconf.sh: Minor reorganizations to clearly separate the + prologue, which is almost common to all the shell scripts of + Autoconf, and the body. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Improve support of name spaces in libm4. Put the m4 builtins + in the `libm4' name space. + + * libm4 (m4_changequote, m4_define, m4_defn, m4_dnl, m4_indir, + m4_undefine): Private copies in the global name space. Used by + the name space mechanisms. + (m4_namespace_register): New macro. + (m4_namespace_define): Use it. + (builtin, changequote, defn, dnl, esyscmd, ifdef, ifelse, indir, + patsubst, popdef, pushdef, regexp, undefine, syscmd, sysval): Put + in the `libm4' name space. + (m4_disable, m4_enable): Use the private m4_indir, otherwise once + `libm4' closed, there is no `indir' available, and therefore no + means to reopen a name space. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Output really nothing if AC_INIT was not given. Unconditional + output can be problematic with autoupdate. + + * acgeneral.m4 (AC_INIT_NOTICE): Output ac_includes_default. + (Default includes section): No longer dump ac_includes_default in + AC_DIVERSION_INIT. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * libm4.m4 (m4_namespace_define): Fix a bug: `m4_namespace' + instead of `$1'. + Simplify some excess in quoting. + Use NAMESPACE::MACRONAME instead of `m4_defn(NAMESPACE, + MACRONAME)'. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Adapt autoheader to use libm4's name spaces. + + * autoheader.m4 (AH_HOOK): Removed. + (AH_DEFUN): Define in the `autoheader' name space. + Use only AH_DEFUN to define macros in this file. + (epilogue): No longer run the `AH_HOOKS', enter the `autoheader' + name space. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Clean up a bit the user interface. + + * autoconf.sh: Give your name while reporting errors. + Don't spit --help for errors on arguments. + * autoreconf.sh: Likewise. + * autoheader.sh: Likewise. + More temporary files that one can browse when debugging. + Don't ${var}, just $var. + Don't dump --help when the arguments are invalid. + (config_h): Use the empty value instead of `undefined' to check + that it is defined. + * acspecific.m4: Formatting changes. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Introduce name spaces in libm4. + + * libm4.m4 (m4_namespace_push, m4_namespace_pop, + m4_namespace_define, define, m4_disable, m4_enable, m4_rename): + New macros. + (_m4_foreach, _m4_for, m4_wrap): Use m4_define for temporaries. + (m4_split): Don't mess with the quotes. + + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS, AC_OUTPUT_HEADERS): Quote + `define'. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * doc/autoconf.texi (Introduction): m4 1.4 is now required. + (Invoking autoconf): A better help on --trace. + (Defining Symbols): Advocate a proper use of the quotes in m4 + code, including if the quotes are sometimes useless. It is bad, + very bad not to quote properly, so quote all the examples + properly. + (Cache Files): Use a unary call to define, instead of an empty + $2. + (Using System Type): Watch out TeX wrapping. + (Pretty Help Strings): Don't give too long a snippet of --help. + Promote the coding style of Autoconf. Quote properly. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PRO): Use AC_PROVIDE instead of defining + yourself. This allows to see everything that is AC_PROVIDEd via + autoconf --trace. + (AC_SPECIALIZE): define'd, not AC_DEFUN'd. + (AC_PROVIDE): Use define with a single arg, instead of an empty $2. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (ac_includes_default): Don't use simple quotes, but + doubles quotes if you want to use \-continuation lines: this is + not recognized by MIPS' sh. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4. Formatting changes. + * acspecific.m4: Likewise. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CONFIG_HEADERS, AC_CONFIG_LINKS, + AC_CONFIG_SUBDIRS): A space was missing to separate the arguments + of m4_append. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Arrange that config.status creates the file with the AC_SUBSTing + engine only if needed. + + * acgeneral.m4 (AC_OUTPUT_FILES): Create the sed code only if test + -n "$CONFIG_FILES". + +2000-02-08 Akim Demaille <akim@epita.fr> + + Promote AC_LANG_CASE. + + * acgeneral.m4 (AC_TRY_COMPILER, AC_TRY_LINK_FUNC, AC_CHECK_LIB, + AC_TRY_COMPILE, AC_TRY_LINK, AC_TRY_RUN_NATIVE, AC_CHECK_FUNC): + Use AC_LANG_CASE instead of ifelse (AC_LANG, ...). + (AC_TRY_LINK_FUNC): Quote the body the the AC_DEFUN (whoa, how + could this survive so long?!?). + +2000-02-08 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formatting changes. + * acspecific.m4: Likewise. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Use the style we promote. + + * doc/autoconf.texi (Header Templates): Promote #if over #ifdef; + and #undef over #define in templates. + * acspecific.m4 (AC_DECL_SYS_SIGLIST, AC_FUNC_MMAP, + AC_FUNC_SETPGRP, AC_FUNC_VFORK, AC_FUNC_SELECT_ARGTYPES): Use #if, + not #ifdef and #ifndef, indent CPP directives. + +2000-02-08 Akim Demaille <akim@epita.fr> + + Quote properly AC_SHELL_IFELSE and callers. + + * acgeneral.m4 (AC_SHELL_IFELSE): Don't overquote $1. + (AC_VAR_IF_SET, AC_CHECK_MEMBER, AC_CHECK_LIB, AC_CHECK_HEADER, + AC_CHECK_DECL, AC_CHECK_FUNC, AC_CHECK_TYPE_INTERNAL): Quote the + first argument of AC_SHELL_IFELSE. + +2000-02-08 Akim Demaille <akim@epita.fr> + + It seems quite delicate to have AC_INCLUDES_DEFAULT insert the + default headers in the INIT section of configure: the reason is + that AC_INCLUDES_DEFAULT is called unquoted, and this results in + an un expected behavior. Thanks to Roman V. Shaposhnick for the + details. + + The current implementation is not satisfying: the default headers + are defined in the INIT section even if they are not used. + + * acgeneral.m4 (Prologue of AC_INCLUDES_DEFAULTS): Dump the + definition of ac_includes_default in the INIT section of + configure. + (AC_INCLUDES_DEFAULTS): Use it. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * TODO: Updated. + * THANKS: Updated. + +2000-02-08 Akim Demaille <akim@epita.fr> + + * libm4.m4 (m4_for): New macro. + +2000-02-07 Akim Demaille <akim@epita.fr> + + Stay in Autoconf's name space. + + * acspecific.m4 (AC_F77_LIBRARY_LDFLAGS): Prefixed with 'ac_': + arg, save_arg, i, seen, previous_arg, ld_run_path. + Rename f77_link_output as ac_link_output. + * tests/actest.m4 (AC_ENV_SAVE): Don't note F77, FFLAGS, FLIBS, + G77, f77_case, f77_underscore. + +2000-02-07 Akim Demaille <akim@epita.fr> + + Use `#' for comments instead of `dnl'. + Better highlighting of the sections in the sources. + + * acgeneral.m4: Formatting changes. + * acspecific.m4: Likewise. + * autoheader.m4: Likewise. + * acoldnames.m4: Likewise. + +2000-02-07 Akim Demaille <akim@epita.fr> + + Create libm4.m4. + + * Makefile.am: Adjusted for libm4.m4. + + * acgeneral.m4 (m4_errprint, m4_warn, m4_fatal, m4_prefix, + m4_eval, m4_shift, m4_format, m4_include_unique, m4_include, + m4_sinclude, m4_quote, m4_split, m4_join, m4_strip, m4_append, + m4_list_append, ifval, ifset, m4_default, m4_case, m4_match, + m4_foreach): Moved from here, to... + * libm4.m4: here. + * acgeneral.m4 (AC_WRAP): Moved from here, to... + * libm4.m4 (m4_wrap): here. All callers changed. + + * acgeneral.m4: Don't include acversion.m4. + * autoconf.m4: Include libm4.m4 and acversion.m4. + * autoheader.m4: Likewise. + +2000-02-07 Akim Demaille <akim@epita.fr> + + AC_CHECK_SIZEOF: Fix a bug, use standard default headers, and + test. + + * acgeneral.m4 (AC_CHECK_SIZEOF): Don't over quote $1, some [] + were left in the C code, and had the macro fail. + Use AC_INCLUDES_DEFAULT. + * doc/autoconf.texi: Mention default includes. Explain stdio.h + must always be given. + + * tests/atspecific.m4 (TEST_MACRO): Updated the list of + exceptions. + (AT_CHECK_DEFINES): New macro, to check the content of config.h. + * tests/semantics.m4: All the tests are updated to use + AT_CHECK_DEFINES. + Test AC_CHECK_SIZEOF, AC_CHECK_HEADERS, and AC_CHECK_FUNCS. + +2000-02-07 Akim Demaille <akim@epita.fr> + + Give explicit diagnostics when an input file (for config headers; + config files etc.) does not exist. + From Jim Meyering. + + * acgeneral.m4 (AC_OUTPUT_FILES, AC_OUTPUT_HEADERS): Check for the + existence of source files. + +2000-02-07 Akim Demaille <akim@epita.fr> + + Torture test config.status, AC_SUBST and AC_DEFINE. + + * tests/torture.m4: New file. + * tests/suite.m4: Include it. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * tests/atspecific.m4 (m4_for, m4_foreach): New macros. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_TYPE_INTERNAL): Instead of defining an + unused pointer to the type $1, use + if (($1 *) 0) return 0; + to avoid warnings from the compiler. + From Paul Eggert. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INCLUDES_DEFAULT): Include sys/types.h + Reported by Jim Meyering. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * tests/atspecific.m4: New file, for AT macros specific to + Autoconf testing. + * tests/suite.m4 (AT_TEST_MACRO): Moved to + * tests/atspecific.m4 (AT_TEST_MACRO): here. + * tests/syntax.m4 (TEST_MACRO): Moved to + * tests/atspecific.m4 (TEST_MACRO): here. Don't test /^AC_INIT/, + nor /^AC_PROG_\(CC\|CXX\|F77\)_\(GNU\|WORKS\)$/: they are already + tried elsewhere. + * tests/Makefile.am: Adjusted. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (m4_case): Fixed a typo and a bug: one shift was + missing. + (m4_match): New macro. + * tests/atgeneral.m4 (AT_CASE): Fixed. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formatting changes. + * acspecific.m4: Likewise. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_F77_LIBRARY_LDFLAGS): Don't use FFLAGS_SAVE + but ac_save_FFLAGS. + (AC_F77_NAME_MANGLING): Don't use foo_bar but ac_foo_bar. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_C_INLINE): Proceed as for AC_C_CONST: + condition out the test case if __cpluscplus. + Don't document the autoheader template twice, one is enough. + * autoheader.m4 (AC_CONFIG_HEADER): don't hook on this guy, but + on... + (AC_CONFIG_HEADERS), since the former is defined on the latter. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_TYPE_INTERNAL): Use the scheme proposed + by Alexandre Oliva for testing the definition of TYPE: + TYPE *foo; + sizeof (TYPE); + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_C_CONST): Don't changequote, there is no need + for it. Just quote properly! + condition out the test case if __cpluscplus. + AC_REQUIRE AC_PROG_CC_STDC. + Fix slightly the display of the result (formerly the first run + says `none needed', and later, because of the cache `no'). + (AC_C_INLINE, AC_C_VOLATILE): AC_REQUIRE AC_PROG_CC_STDC. + * doc/autoconf.texi (AC_C_CONST): Give a few hints on the + motivation for trusting the C++ compilers. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * tests/atgeneral.m4: Updated. + (AT_CASE): new macro. + (AT_CHECK): Use it. Don't changequote for patsubst, there is no + need. + * tests/syntax.m4 (TEST_MACRO): Don't run AC_ARG_VAR. + Reported by Jim Meyering. + Use AT_CASE. + +2000-02-07 Akim Demaille <akim@epita.fr> + + Test that the macros respect the user variable name space. + + * acgeneral.m4 (AC_CANONICAL_THING): define, not AC_DEFUN. + Don't AC_PROVIDE, there is no need. + When calling `config.sub`, also || exit 1, to catch failures from + config.sub. + * acspecific.m4 (AC_SYS_LONG_FILE_NAMES): Use ac_val, not val. + (AC_EXEEXT): Use ac_file, not file. + * tests/actest.m4: New file, holding extra Autoconf macros used + during the testing. + (AC_ENV_SAVE): New macro, save the sh variables in a file. + * tests/suite.m4 (AT_TEST_MACRO, Generation of configure.in): + include actest.m4, and call twice AC_ENV_SAVE to compare the + variables before and after the macro. + * tests/Makefile.am (macro.m4): Don't test macros that are + required: they will be tested somewhere else. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4(AC_CONFIG_PRE_COMMANDS, AC_CONFIG_POST_COMMANDS): + Rename as AC_CONFIG_COMMANDS_PRE, AC_CONFIG_COMMANDS_POST. All + dependencies changed. + From Jim Meyering. + +2000-02-07 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formatting changes. + * acspecific.m4: Likewise. + +2000-02-07 Akim Demaille <akim@epita.fr> + + Start a new series of tests which check the semantics. + + * acgeneral.m4 (AC_CHECK_MEMBER): It is not smart to define + ac_Foo, and use AC_Foo. Got rid of AC_Member_Aggregate and + AC_Member_Member which were complicating more than simplifying. + (AC_CHECK_DECLS): Use m4 lists. + (AC_CHECK_TYPES): A comma was missing. + * autoheader.m4: (AC_CHECK_DECLS): Use m4 lists. + * doc/autoconf.texi (Generic Declarations): AC_CHECK_DELCS uses m4 + lists. + * tests/semantics.m4: New file. Collection of semantical tests: + verify that the tests are positive and negative when appropriate. + Test AC_CHECK_MEMBERS, AC_CHECK_DECLS and AC_CHECK_TYPES. + +2000-02-04 Akim Demaille <akim@epita.fr> + + * tests/Makefile.am (macros.m4): Fix the sed snippet. + +2000-02-04 Akim Demaille <akim@epita.fr> + + * testsuite/autoconf.g/init.exp: Removed, test performed by + tests/syntax.m4. + * testsuite/autoconf.g/sizeof.exp: Likewise. + * testsuite/autoconf.s/defines.exp: Likewise. + * configure.in (AC_OUTPUT): Adjusted. + * Makefile.am (SUBDIRS): Adjusted. + +2000-02-04 Akim Demaille <akim@epita.fr> + + * tests/syntax.m4: Test AC_CHECK_SIZEOF. + * tests/Makefile.am (CLEANFILES, DISTCLEANFILES): Adjusted. + (macros.m4): Use tmp dest files ($@-t), not directly `$@'. + +2000-02-04 Akim Demaille <akim@epita.fr> + + Hide AH_HOOK behind AH_DEFUN. + + * autoheader.m4 (AH_DEFUN): New macro. Combination of define and + AH_HOOK. + (AC_TRY_RUN, AC_DEFINE, AC_DEFINE_UNQUOTED, AC_CHECK_LIB, + AC_CHECK_HEADERS, AC_CHECK_HEADERS_DIRENT, AC_CHECK_DECLS, + AC_CHECK_FUNCS, AC_CHECK_SIZEOF, AC_PROG_LEX, AC_CHECK_MEMBERS, + AC_CHECK_TYPE, AC_FUNC_ALLOCA, AC_CHECK_TYPES, AC_C_CHAR_UNSIGNED, + AC_AIX, AC_F77_WRAPPERS, AC_CONFIG_HEADER): All the former calls + to define and AH_HOOK in autoheader.m4 are replaced by AH_DEFUN. + +2000-02-04 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_RSH, AC_ARG_ARRAY, AC_HAVE_POUNDBANG): No use + to hide, you are DEFUNCT. + +1999-11-14 Akim Demaille <akim@epita.fr> + + * autoconf.texi (Invoking ifnames): ifnames no longer supports + --macrodir. + +1999-11-13 Akim Demaille <akim@epita.fr> + + Run the `syntax' test on acgeneral macros too. + Fix the bugs discovered. + + * acgeneral.m4 (AC_CANONICAL_THING): Quote the + AC_REQUIRE([AC_CANONICAL_HOST]). Bug triggered by the use of + AC_CANONICAL_BUILD alone in configure.in. Also, quote the + arguments of macros (eg, ifelse([$1]...), not ifelse($1...)). + (m4_case): New macro. + (AC_LINKER_OPTION): Don't clash with user's name space + (s/i/ac_link_opt). + (AC_LIST_MEMBER_OF). You mean AC_FATAL, not AC_MSG_ERROR. + Quote properly the argument. + dnl out the empty lines that result from m4 pure code. + Don't pollute the user name space. + Use AC_SHELL_IFELSE. + (AC_F77_NAME_MANGLING): Don't use `test -o'. There are still + name space problems. + * tests/Makefile.am (macros.m4): Also fetch the macros from + acgeneral.m4. + +1999-11-13 Akim Demaille <akim@epita.fr> + + Really install this patch. + + * acgeneral.m4 (AC_MSG_ERROR, AC_MSG_ERROR_UNQUOTED): Allow an + optional $2: exit status. + +1999-11-13 Akim Demaille <akim@epita.fr> + + Check that the AC_DEFINEs from acspecific.m4 do have a template. + Fix the discovered bugs. + + * tests/atgeneral.m4 (AT_CHECK): Don't just exit 1 when you want + to propagate the failure of a test: exit with the same exit + status, at least to preserve 77 (=ignore). + * tests/syntax.m4 (TEST_MACRO): Run also autoheader. Don't run + this test on all the macros, some just cannot run without + arguments. + * acgeneral.m4 (AC_OUTPUT_CONFIG_STATUS): In the if egrep/fi for + #define templates, add a `:' to prevent syntax errors in + config.status when there are no AC_DEFINE performed. + * autoheader.m4 (AH_TEMPLATE): Don't use _AC_SH_QUOTE here, use it + in... + (AH_VERBATIM): here. Now AH_C_UNSIGNED_CHAR is no longer failing + (formerly it would produce a non backslashed backquote, which + made sh choke). + +1999-11-13 Akim Demaille <akim@epita.fr> + + Introduce a means to distinguish failures of `configure' due to + extern software (so that the test suite doesn't fail on them). + + * acgeneral.m4 (AC_MSG_ERROR, AC_MSG_ERROR_UNQUOTED): Allow an + optional $2: exit status. + * doc/autoconf.texi: Document. + * acspecific.m4 (AC_PROG_CC_WORKS, PROG_CXX_WORKS, + AC_PROG_F77_WORKS): Exit 77 if the compiler does not work. + +1999-11-13 Akim Demaille <akim@epita.fr> + + Clean up a bit the handling of the LANG stack. More is needed. + + * acgeneral.m4 (AC_LANG_CASE): New macro. + (AC_LANG_RESTORE): Use m4_case. + (AC_LINKER_OPTION): Use AC_LANG_CASE. + +1999-11-11 Akim Demaille <akim@epita.fr> + + * autoconf.texi (Generic Declarations): Fixed a typo which + prevented `make distcheck' from succeeding. + * texinfo.tex: Updated for the same reasons. + +1999-11-11 Akim Demaille <akim@epita.fr> + + Introduce a new style of testing, independent from DejaGNU. + + + Introduce the logistics. + + * configure.in: Initialize AT, and output tests/atconfig, and + tests/Makefile. + * m4/atconfig.m4: New file. + * m4/Makefile.am: Adjusted. + * aclocal.m4: Include atconfig.m4. + * Makefile.am: Adjusted. + * tests/Makefile.am: New file. + * tests/atgeneral.m4: Likewise. + * tests/atconfig.in: Likewise. + + + Write tests. + + * tests/syntax.m4: New file, in charge of checking the validity of + the sh code produced by the macros defined in acspecific.m4. + acgeneral.m4 is not checked here, because these macros require + arguments. + * tests/suite.m4: New file. Run syntax.m4. + +1999-11-10 Akim Demaille <akim@epita.fr> + + A test suite will be introduced which tries to run all the + specific macros, but hasbeen'd macro make configure die with bad + exit status. So we wish to distinguish live macros from defunct + macros at the moment they are AC_DEFUN'd, not in their body. Hm, + defunct, defunct... Hey! That's a good name! + + * acgeneral.m4 (AC_DEFUNCT): New macro, comparable to AC_DEFUN, + but for macros which are no longer defined. Replaces AC_HASBEEN. + (AC_HASBEEN): Defunct. Well, removed in fact. + (AC_HAVE_LIBRARY): Don't use AC_DEFUN and AC_HASBEEN, just + AC_DEFUNCT. + * acspecific.m4 (AC_UNISTD_H, AC_USG, AC_MEMORY_H, AC_DIR_HEADER, + AC_INT_16_BITS, AC_LONG_64_BITS): Likewise. + (AC_XENIX_DIR): It was defunct even before I declared it was: was + depending upon AC_DIR_HEADER which is defunct. So AC_DEFUNCT'ed + now. + (AC_DYNIX_SEQ, AC_IRIX_SUN, AC_SCO_INTL): While we're here, you + too are defunct now. + * autoconf.texi (Obsolete Macros): Replace the documentation of + AC_HASBEEN with that of AC_DEFUNCT. + +1999-11-10 Akim Demaille <akim@epita.fr> + + * autoconf.sh: Formatting changes. + Removed development junk. + * acspecific.m4: Formatting changes. + * autoconf.m4: Likewise. + * autoheader.m4: Likewise. + +1999-11-10 Akim Demaille <akim@epita.fr> + + Let Autoconf use autoconf's `--install'. + + * m4/Makefile.am: New file. + * m4/init.am: New file, required by Automake. + * m4/missing.am: Likewise. + * m4/sanity.am: Likewise. + * aclocal.m4: Include them. + * configure.in (AC_OUTPUT): Added m4/Makefile. + +1999-11-10 Akim Demaille <akim@epita.fr> + + Make autoconf support --install. + + * autoconf.sh (task install): New task. Extract the set of + auxiliary m4 files a configure.in depends upon. Install links + from library files to the local dir so that the packages depends + only on local extensions. Check that the user includes exactly + the files she needs. + +1999-11-10 Akim Demaille <akim@epita.fr> + + Require GNU m4 1.4 (well 1.3 in fact). + + Because we are ready to handle the case where there are no frozen + files, we *have* to pass a -I, which is dangerous in conjunction + with the silent including of `aclocal.m4': you may include things + that were not expected. Since anyway handling pre 1.3 complicates + the task, just require an m4 which supports reloading of frozen + files. + + * acspecific.m4 (AC_PROG_GNU_M4): Check for --reload. + * autoconf.sh: Likewise + * autoheader.sh: Likewise. + * configure.in: Explicitly state the m4 version you want. + +1999-11-10 Akim Demaille <akim@epita.fr> + + No need for foo="`bar`", foo=`bar` is fine. + Simplify ${foo} and ${1} into $foo and $1. + + * acgeneral.m4 (ac_LF_and_DOT): Remove the double quotes. + * acspecific.m4 (AC_PROG_CC_C_O, AC_PROG_F77_C_O): Likewise. + * autoconf.sh: Likewise. + * autoheader.sh: Likewise. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * ifnames.sh: Remove all the code and messages related to + AC_MACRODIR, since ifnames is not related to macros in anyway. + +1999-11-10 Akim Demaille <akim@epita.fr> + + New version of AC_INCLUDE, which does not glob, nor rely upon the + shell. Add AC_INCLUDES too. Help tracking multiple inclusions. + + * acgeneral.m4 (m4_errprint, m4_warn, m4_fatal): New macros, + variations around errprint. + (m4_include_unique): New macro which registers what are the files + already included, and warns if some are included several times. + (m4_include, m4_sinclude): New macro, using m4_include_unique. + (AC_INCLUDE): Is now just a wrapper of m4_include. + (AC_INIT): Use m4_sinclude, not sinclude. + (_AC_ERRPRINT): Removed, m4_errprint is here! + (AC_WARNING, AC_FATAL): Wrappers of m4_warn and m4_fatal. + +1999-11-01 Akim Demaille <akim@epita.fr> + + * autoheader.sh: No longer rely on a system acconfig.h. + +1999-11-01 Akim Demaille <akim@epita.fr> + + Be kind to Automake: list the arguments of selected macros + (for instance AC_SUBST will list each variable which may be + substitued). + + * autoconf.sh (--trace, --output): New options. + Implement tracing of macros. + trap also on 0, so that there is no need to rm here and there. + * autoconf.texi (Output): Document --trace and --output. + +1999-11-01 Akim Demaille <akim@epita.fr> + + Clean up the macros for testing members of aggregates. + + * acgeneral.m4 (AC_CHECK_MEMBER): FATAL if $1 has no dot in it. + Use AC_INCLUDE_DEFAULTS. + (AC_C_STRUCT_MEMBER): Removed. + * acspecific.m4 (AC_STRUCT_TIMEZONE): Adapted to AC_CHECK_MEMBERS. + (AC_STRUCT_ST_BLKSIZE, AC_STRUCT_ST_RDEV): Adapted to + AC_CHECK_MEMBERS and obsoleted. + (AC_STRUCT_ST_BLOCKS): Adapted to AC_CHECK_MEMBERS. + * autoconf.texi (AC_STRUCT_ST_BLKSIZE, HAVE_STRUCT_STAT_ST_RDEV): + Explain they are obsoleted, and how to migrate. + (AC_STRUCT_ST_BLOCKS, AC_STRUCT_TIMEZONE): Explain that the + AC_DEFINE changed (but the former #defines remain defined + currently). + (AC_C_STRUCT_MEMBER): Removed, replaced by the definitions of + AC_CHECK_MEMBER and AC_CHECK_MEMBERS. + +1999-11-01 Akim Demaille <akim@epita.fr> + + Install a uniform set of default includes. + + * acgeneral.m4 (AC_INCLUDES_DEFAULT): New macro. Expands in its + argument if non empty, otherwise a default list of includes. + (AC_CHECK_DECL, AC_CHECK_TYPE_INTERNAL): Use AC_INCLUDES_DEFAULT. + * autoconf.texi: Adjusted. + +1999-11-01 Akim Demaille <akim@epita.fr> + + * autoheader.m4 (AH_FUNC_ALLOCA, AH_C_CHAR_UNSIGNED, AH_AIX): + Don't leave `[]dnl' in pseudo #-comment (actually CPP directives). + +1999-11-01 Akim Demaille <akim@epita.fr> + + Fix a bit of the brokenness of AC_CHECK_TYPE. + + * acgeneral.m4 (AC_CHECK_TYPE_INTERNAL): New macro, inspired from + the former AC_CHECK_TYPE. This macro is exactly the one that + ought to be named AC_CHECK_TYPE: it just checks, and executes user + actions. In the future, this macro ought to be renamed + AC_CHECK_TYPE. + There is a big difference with the former AC_CHECK_TYPE: instead + of grepping in the headers, it tries to compile a variable + declaration. This is both safer, slower, and better, since now we + can check for compiler types (e.g., unsigned long long). + (AC_CHECK_TYPES): The looping and AC_DEFINEing version of the + previous macro. Uses m4 loops. + (AC_CHECK_TYPE): Reimplemented on top of AC_CHECK_TYPE_INTERNAL. + * autoheader.m4 (AH_CHECK_TYPE, AH_CHECK_TYPES): New macros, + hooked. + * autoconf.texi (@ovar): New macro, for optional variables. + (Generic Typedefs): Document AC_CHECK_TYPES. + * autoheader.texi: (AH_CHECK_TYPE, AH_CHECK_TYPES): New macros. + (Epilogue): Hooks them. + +1999-11-01 Akim Demaille <akim@epita.fr> + + Update autoupdate. + + * acoldnames.m4: Sort the two sections. + * acoldnames.m4 (AM_CYGWIN32, AM_EXEEXT, AM_FUNC_FNMATCH, + AM_FUNC_MKTIME, AM_PROG_LIBTOOL, AM_MINGW32, AM_PROG_INSTALL, + fp_FUNC_FNMATCH): Added their new names. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Create man pages for the executables. + + * Makefile.am (SUBDIRS): Add `man' and prepend `.' so that + executables be built before help2man is run. + * configure.in (AC_OUTPUT): Add man/Makefile. + AC_MSG_ERROR, not AC_ERROR. + Check for missing help2man. + * man/Makefile.am: New file. + * man/autoconf.x: Likewise. + * man/autoreconf.x: Likewise. + * man/autoheader.x: Likewise. + * man/autoscan.x: Likewise. + * man/autoupdate.x: Likewise. + * man/ifnames.x: Likewise. + * man/common.x: Likewise. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Reformating of configure and + config.status --help. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT_CONFIG_STATUS): Implement `config.status + --file' and `--header'. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * autoheader.m4 (AH_TEMPLATE): Quote $2 once, now _AC_SH_QUOTE + behaves properly. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formatting changes. + * acspecific.m4: Likewise. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CONFIG_LINKS): Allow a second argument, + commands to run, as AC_CONFIG_FILES and HEADERS. + (AC_LIST_LINKS_COMMANDS): New growing string. Initialize. + (AC_OUTPUT_LINKS): Use it. + (AC_OUTPUT_FILES, AC_OUTPUT_HEADERS, AC_OUTPUT_LINKS): Don't + pretend to have arguments: you don't depend upon it. + (AC_OUTPUT): Call the previous macros without arguments. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PREFIX_PROGRAM): Don't use define/undefine, but + pushdef/podef. AC_UPCASE_NAME no longer exist. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formatting changes. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * TODO: Updated. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Clean up dead comments/code. Clean up the incompatibilities + between quoted and non quoted _AC_ECHO and the like. + + * acgeneral.m4: Remove the comments on the no longer defined AC_TR. + (_AC_SH_QUOTE): Be robust to active symbols. + (_AC_ECHO): Quote properly the argument. + (AC_TRY_RUN): Don't quote [AC_TRY_RUN] in the warning. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acspecific.m4: Formatting changes. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INIT_NOTICE, AC_INIT_PREPARE, AC_ARG_ENABLE, + AC_ARG_WITH, AC, TRY_COMPILER, AC_TRY_RUN, AC_TRY_CPP, + AC_EGREP_CPP): Use @PND@ instead of [#]: it looses the editors + that try to match the pairs of (), [] etc. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Fix the compatibility of the compiling macros with C++. + + * acgeneral.m4 (AC_TRY_COMPILE, AC_TRY_LINK, AC_CHECK_SIZEOF): Use + `int main () {...}', instead of `main () {...}'. + * acspecific.m4 (AC_TYPE_GETGROUPS, AC_FUNC_CLOSEDIR_VOID, + AC_FUNC_FNMATCH, AC_FUNC_GETPGRP, AC_FUNC_SETPGRP, AC_FUNC_VFORK, + AC_FUNC_WAIT3, AC_FUNC_ALLOCA, AC_FUNC_UTIME_NULL, + AC_FUNC_SETVBUF_REVERSED, AC_FUNC_MEMCMP, AC_C_CHAR_UNSIGNED, + AC_C_LONG_DOUBLE, AC_C_BIGENDIAN, AC_SYS_RESTARTABLE_SYSCALLS): + Likewise. + * acspecific.m4 (AC_FUNC_FNMATCH): Call + AC_CHECK_HEADERS(fnmatch.h), and include fnmatch.h in the compiled + code. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_COMPILE_CHECK, AC_TRY_COMPILE, + AC_TRY_RUN_NATIVE, AC_OUTPUT_CONFIG_STATUS): Use @PND@ instead of + [#]: it looses the editors that try to match the pairs of (), [] + etc. + Formatting changes. + * acspecific.m4: Formatting changes. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Allow standard beta version numbers. + + * configure.in: Declare version 2.14a. + * acgeneral.m4 (AC_UNGNITS): New macro which transform version + numbers to pure digits (2.14a to 2.14.0.1, 2.15z to 2.15.0.26 + etc.). + (AC_PREREQ): Normalize argument and AC_ACVERSION via AC_UNGNITS. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Fix the --version of all the executables. + + * Makefile.am (editsh, editpl): Substitute also PACKAGE and + VERSION. + * autoconf.sh (version): New string. + (--version): Use it. + (--help) Output on stdout, not stderr. + * autoheader.sh: Likewise. + * autoreconf.sh: Likewise. + * autoscan.pl: Likewise. + * autoupdate.sh: Likewise. + * ifnames.sh: Likewise. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Perform a better checking for missing templates in autoheader. + + * autoheader.m4 (AH_HOOK): When hook AC_FOO on AH_FOO, define the + new AC_FOO to be the expansion of both AH_FOO *and* AC_FOO. See + its definition for the motivations. + + * autoheader.m4 (AH_FUNC_ALLOCA): Remove the now useless + additional templates. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Work properly with Automake 1.4. + + * Makefile.am (distpkgdataDATA): Replaces dist_pkgdata_DATA. + (nodistpkgdataDATA): Replaces nodist_pkgdata_DATA. + (EXTRA_DIST): Added $(distpkgdataDATA). + (pkgdata_DATA): Adapted. + (AUTOMAKE_OPTION): Require 1.4. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Fix a bug in templates of AC_CHECK_LIB. + + * autoheader.m4 (AH_CHECK_LIB): Template HAVE_LIBFOO, not + HAVE_FOO. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acspecific.m4: Formating changes. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formating changes. + * acspecific.m4: Likewise. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * Makefile.am (pkgdata_DATA): Split into dist_pkgdata_DATA and + nodist_pkgdata_DATA. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_PROG_GNU_M4): New macro. + * configure.in: Use it. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Provide a means to specify commands to run before config.status is + created (and, for symmetry, after it is created). + + This is typically needed by Automake so that AC_REPLACEd functions + go through deansification via + + LIBOBJS=`echo $LIBOBJS | sed 's/\.o /\$U.o /g;s/\.o$/\$U.o/'` + + and/or by Libtool which needs to define LTLIBOBJS and others: + + LTLIBOBJS=`echo $LIBOBJS | sed 's/\.o/\.lo/g'` + AC_SUBST(LTLIBOBJS) + + * acgeneral.m4 (AC_OUTPUT_PRE_COMMANDS): New growing string. + Initialize. + (AC_OUTPUT_POST_COMMANDS): Likewise. + (AC_CONFIG_PRE_COMMANDS): New macro, grows AC_OUTPUT_PRE_COMMANDS. + (AC_CONFIG_PRE_COMMANDS): Likewise. + (AC_OUTPUT): Run AC_OUTPUT_PRE_COMMANDS before + AC_OUTPUT_CONFIG_STATUS, and AC_OUTPUT_POST_COMMANDS after. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Remove spurious empty lines appearing in configures. + + * acgeneral.m4 (AC_CONFIG_UNIQUE): Produce no output. Instead of + fighting with dnl, divert to KILL upon entry, and pop at exit. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Avoid using double quotes + inside "`...`": some shells parse this incorrectly. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * Makefile.am (pkgdata_DATA, EXTRA_DIST): Removed acconfig.h. + * testsuite/autoconf.s/defines.exp: Commented out, there is no + longer an acconfig.h. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * autoconf.m4: Insert -*- Autoconf -*-. + * acgeneral.m4: Likewise. + * acspecific.m4: Likewise. + * acoldnames.m4: Likewise. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Create AC_CONFIG_HEADERS which has the same interface as the other + AC_CONFIG_*S. + + * acgeneral.m4 (AC_CONFIG_HEADERS): New macro, with the same + interface as AC_CONFIG_LINKS and AC_CONFIG_FILES. + (AC_LIST_HEADERS_COMMANDS): New growing string, initialize it. + (AC_CONFIG_HEADER): Rename as... + (AC_CONFIG_HEADERS): this, for consistency. + (AC_CONFIG_HEADER): New macro, which calls AC_OUTPUT_HEADERS. + (AC_OUTPUT_HEADERS): The square brackets for sed and grep were + not properly quoted: use @BKL@ and @BKR@. + (AC_OUTPUT_HEADERS): Run the AC_LIST_HEADERS_COMMANDS. + + * acgeneral.m4 (AC_OUTPUT): Once config.status created, before + running it, trap to `exit 1' so that config.status is not removed + if configure is interrupted when config.status is complete. + + * acgeneral.m4 (AC_OUTPUT_CONFIG_STATUS): When recognizing + arguments, accept only foo, and no longer foo:foo.in etc. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Formating changes. + +1999-10-31 Akim Demaille <akim@epita.fr> + + config.status: Speed up the creation of config headers (about four + times faster on Linux). + + The previous scheme had three sed commands for each AC_DEFINE: one + for #define templates, and two for #undef templates (with or + without trailing spaces). Divide this in three sed scripts + instead: a one liner that removes the trailing spaces, one for + #defines, and then the last for #undef. + + The real speed up comes from the fact that the #define script + starts by checkin if the current input line has a #define, and if + not the script immediately goes to the next line, without running + the rest of the script as was the case before. Equally for the + #undef script. + + Note that this way, users that don't use #define templates don't + pay too much the overhead, since the sed script `realizes' quickly + there are no #define lines. My test case runs in 0.32s with + #define templates, and 0.24s without. To improve this common + case, the whole code for #define templates is conditionalized by a + proper egrep call. The result runs is 0.24s, i.e., almost no cost + at all. + + I made one dangerous change that I carefully evaluated before + commiting: the sed scripts are cut at 48 lines instead of 12 as + before. This produces here docs of about 4Kb. I checked many + `configure's and they all have big here documents, much bigger + than the 12 lines (for instance AC_FUNC_MMAP produces a 150 lines + long, 3800+ character here document). So I moved to the well + known HP UX sed limitations: no more than 100 commands, and there + are two commands per line now, plus a two command preamble. The + speed up is noticeable. + + * acgeneral.m4 (AC_OUTPUT_HEADERS): Remove the ac_e + family. + Changed ac_uD and ac_dD to `...;t t', instead of `...g'. + Instead of creating `conftest.vals' with both ac_e, ac_d, + and ac_u family, preprocess to strip the trailing spaces, and + create `conftest.defines' with the ac_d family, and then + `conftest.undefs' for the ac_e family. + Break up both `conftest.defines' and `conftest.undefs'. Insert a + top label and a global test for `#defines' and `#undef' before. + Call `conftest.defines' if there are #define in the input. + Call `conftest.undefs'. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Prefer `>file' over `> file' etc. + * acspecific.m4: Likewise. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Rename the family AC_NEED_DECL as AC_CHECK: it is more uniform, + but keep defining NEED_FOO_DECL when `foo' is not declared. Files + not using Autoconf behave better when declarations lacks than when + they are wrong. So the unset position should off, hence #if NEEDS + instead of #if !HAVE (which is triggered when HAVE is not set). + + * acgeneral.m4 (AC_NEED_DECL): Rename as... + (AC_CHECK_DECL): This. Make sure the arguments are the usual + IF-FOUND, IF-NOT-FOUND. + (AC_NEED_DECLS, AC_CHECK_DECLS): Likewise. + * autoconf.texi (Generic Declarations): Document the changes + aforementioned. + * autoheader.m4 (AH_NEED_DECLS): Rename as + (AH_CHECK_DECLS): This. + (AH_HOOKS): Hook AH_CHECK_DECLS on AC_CHECK_DECLS instead of + _NEED_. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Revamp the handling of the arguments of config.status: instead of + looping over config_files etc. to recognize the file names, use + the case which handles the options. + Suggested by Alexandre Oliva. + + * acgeneral.m4 (ifset): Rename as... + (ifval): This. All callers changed. + (ifset): New macro, which tests if a macro is set to a non empty + value. + + * acgeneral.m4: Initialize growing lists and strings to empty, to + ease the tests. + (AC_CONFIG_HEADER): Quote AC_LIST_HEADERS in the define, to handle + the case AC_LIST_HEADERS is initialized. + + * acgeneral.m4: (AC_OUTPUT_CONFIG_STATUS): New macro, pulled out + from... + (AC_OUTPUT): Instead of using $1, $2 and $3, pass them to the + official macros (AC_CONFIG_FILES, AC_OUTPUT_COMMANDS). + Call AC_OUTPUT_CONFIG_STATUS. + (option handling): Use the case-esac to recognize arguments. + (AC_OUTPUT_COMMANDS): Fix the missing fi;done. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Add a means to specify commands to be run by config.status. At + the difference of AC_OUTPUT_COMMANDS, require that the set of + commands be named, so that both + CONFIG_COMMANDS=foo ./config.status + and + ./config.status foo + perform the Right Thing. + + * acgeneral.m4 (AC_CONFIG_UNIQUE): Also check in + AC_LIST_COMMANDS. + (AC_CONFIG_FILES): Remove a dead pushdef. + (AC_CONFIG_COMMANDS): New macro. + (AC_LIST_COMMANDS): New config list. + (AC_LIST_COMMANDS_COMMANDS): New growing string. + (AC_OUTPUT_COMMANDS_COMMANDS): New macro, output config commands + in config.status. + (AC_OUTPUT): Take AC_LIST_COMMANDS into account. + (AC_OUTPUT): Call AC_OUTPUT_COMMANDS_COMMANDS. + +1999-10-31 Akim Demaille <akim@epita.fr> + + New macro: AC_CONFIG_FILES which is very much like AC_OUTPUT but + that one associates commands to run when a config file is created. + For instance for a shell script `foo', one uses + AC_CONFIG_FILES(foo, chmod +x foo). + + In addition, check that the same name is never used twice in + config files, headers, subdirs and links. + + * acgeneral.m4 (m4_append): Don't insert new line between + elements. + (m4_list_append): New macro. + (AC_CONFIG_IF_MEMBER): New macro which tests if a file is member + of a config list. + (AC_CONFIG_UNIQUE): New macro which ensures that a config file + name is not yet used. + (AC_CONFIG_HEADER, AC_CONFIG_LINKS, AC_CONFIG_SUBDIRS): Use + AC_CONFIG_UNIQUE. + + * acgeneral.m4 (AC_CONFIG_FILES): New macro. + (AC_LIST_FILES): New list, which stores arguments of + AC_CONFIG_LISTS the same as AC_LIST_LINKS stores AC_CONFIG_LINKS + etc. + (AC_OUTPUT): No longer rely on $1 to designate the config files: + register them via AC_CONFIG_FILES. All uses of $1 replaced by + uses of AC_LIST_FILES. + (AC_OUTPUT_FILES): Run the commands associated to the + CONFIG_FILES. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * autoconf.sh (Looking for bugs): In addition to AC_, match AH_ + and AM_. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Provide the m4 infrastructure for defining AH_ hooks. + + * autoheader.m4 (AH_HOOK): New macro. + Hook all the AC_ macros to their AH_siblings in AH_HOOKS. + Run AH_HOOKS. + + * acgeneral.m4 (m4_append): New macro. + (m4_list_append, m4_list_add): Removed. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acspecific.m4: Formating changes. + * acgeneral.m4: Likewise. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_CHECK_MEMBER, AC_CHECK_MEMBERS): New macros. + * autoheader.m4 (AH_CHECK_MEMBERS): New macro. + (epilogue): Hook AH_CHECK_MEMBERS on AC_CHECK_MEMBERS. + +1999-10-31 Akim Demaille <akim@epita.fr> + + * autoheader.m4 (AC_FUNC_ALLOCA): Rename from this ... + (AH_FUNC_ALLOCA): ... to this. Includes all the needed templates. + (AC_C_CHAR_UNSIGNED): Rename from this ... + (AH_C_CHAR_UNSIGNED): ... to this. + +1999-10-31 Ben Elliston <bje@cygnus.com> + + * Makefile.am (CLEANFILES): New explicit variable. + (editsh): acdatadir is no longer defined, so use pkgdatadir. + (editpl): Likewise. From Akim Demaille. + * Makefile.in: Regenerate. + + * configure: Regenerate. + * aclocal.m4: Generate. + * Makefile.in: Regenerate with Automake. + * testsuite/Makefile.in: Likewise. + +1999-10-31 Akim Demaille <akim@epita.fr> + + Use Automake. Based on files from Ben Elliston. + + * acgeneral.m4: No longer define AC_ACVERSION, include + acversion.m4. + * acversion.m4.in: New AC_CONFIG_FILE. + * acspecific.m4: Few formating changes. + * autoconf.texi: No longer define EDITION, VERSION and UPDATED: + include version.texi. + AC_OUTPUT the Makefiles mentioned below and acversion.m4. + * configure.in: Use AM_INIT_AUTOMAKE. + Do not AC_ARG_PROGRAM: AM_INIT_AUTOMAKE does it. + * Makefile.am: New file. + * mdate-sh: Likewise. + * missing: Likewise. + * testsuite/Makefile.am: Likewise. + +1999-10-31 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_PROG_CC_STDC, AC_C_PROTOTYPES): Inherit from + Automake. From Franc,ois Pinard. + * autoconf.texi (Particular Programs): Document AC_PROG_CC_STDC. + (C Compiler Characteristics): Document AC_C_PROTOTYPES. + + * testsuite/autoconf.s/defines.exp: Changed `fail' and `pass' in + `xfail' and `xpass'. The test suite checks that acconfig.h + templates the AC_DEFINEs. Since we no longer rely on acconfig.h, + the test is obsolete. + * acspecific.m4 (AC_PROG_BINSH, AC_PROG_SED): Don't quote the name + of the macro defined; the test suite does not recognize this + syntax. From Akim Demaille. + +1999-10-27 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (Generic Programs): @defmac for AC_PATH_TOOL may + not span multiple lines. + +1999-10-26 Ben Elliston <bje@cygnus.com> + + * INSTALL: Regenerate. + +1999-10-16 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_PROG_CXX): gcc is not a C++ compiler. + * autoconf.texi (AC_PROG_CXX): Update documentation. + +1999-10-13 Ben Elliston <bje@cygnus.com> + + * acconfig.h: Reintroduce missing definitions due to test suite + regressions. + + * autoconf.texi (Configuration Headers): Document the potential + trouble caused by autoheader and boilerplate files. Fix for + PR autoconf/45. + +1999-10-07 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * Makefile.in (dist): Fixed for srcdir != objdir. + +1999-10-07 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_CHECK_HEADER_DIRENT): Reintroduce its + AC_DEFUN. + +1999-10-06 Akim Demaille <akim@epita.fr> + + * acspecific.m4: Various formatting changes. + * acspecific.m4 (AC_PROG_CC_WORKS): Declare main returns an int. + +1999-10-05 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> + + Shell meta characters in an argument causes the configure script + to freak out and generate a config.status file that contains + syntax errors. + Bug triggered by ./configure --with-foobar=\''`"$'. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Quote single quotes that end + up between single quotes. Protect arguments of echo with double + quotes. + (AC_INIT_PREPARE): Likewise. + (AC_PATH_PROG): Protect argument of test. + (AC_OUTPUT): Quote meta characters in ac_configure_args. + +1999-10-05 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (AC_PATH_XTRA): Correctly document the behaviour + when X is not available. + +1999-10-05 Akim Demaille <akim@epita.fr> + + The sed quoting script depends on the shape of the commands used + by AC_SUBST. The latter was changed, but not the former. + Bug triggered with FOO='%\c' AC_SUBST(FOO). + + * acgeneral.m4 (AC_OUTPUT_FILES): Fix the sed quoting script. + +1999-10-05 Akim Demaille <akim@epita.fr> + + When you rely on the `t' flag of sed for the immediately + preceding substitution, use a combination of `: foo; t foo'. + Bug triggered if you AC_DEFINE(FOO, "%"). + Additionally, work around a bug in IRIX sed. + Suggested by Ken Pizzini. + + * acgeneral.m4 (AC_OUTPUT_HEADER): Added a label and a test in the + sed code of `$ac_cs_root.hdr'. + +1999-10-05 Akim Demaille <akim@epita.fr> + + Implement AC_PATH_TOOL. + Submited by Gary V. Vaughan. + + * acgeneral.m4 (AC_PATH_TOOL): New macro. + * autoconf.texi (Generic Programs): Document. + +1999-10-05 Akim Demaille <akim@epita.fr> + + Handle arbitrary version numbers. + Reported by H.J. Lu. + + * acgeneral.m4 (m4_split): Support a second optional argument: a + regexp to specify where to split. + (m4_compare): New macro, compares arbitrary long m4 lists of + integers. + (AC_PREREQ_SPLIT, AC_PREREQ_CANON, AC_PREREQ_COMPARE): Removed, + replaced by more generic macros. + (AC_PREREQ): Reimplemented, using m4_compare and m4_split. + +1999-10-04 Akim Demaille <akim@epita.fr> + + Beware of the expansions of $n in comments. + + * acgeneral.m4 (AC_OUTPUT): Changed $1 into $[1] in dnls. + +1999-10-04 Akim Demaille <akim@epita.fr> + + Revert partially the previous changes: AC_CHECK_HEADERS_DIRENT is + used by AC_HEADER_DIRENT. + + * autoheader.m4: Restablish the hook for AC_CHECK_HEADERS_DIRENT. + + * acspecific.m4 (AC_CHECK_HEADERS_DIRENT, AC_CHECK_HEADER_DIRENT): + Reinserted. + +1999-10-02 Akim Demaille <demaille@inf.enst.fr> + + * acgeneral.m4: Instead of just undefining eval, format, include + and shift, rename them to m4_eval, etc. + +1999-10-02 Akim Demaille <akim@epita.fr> + + AC_DIR_HEADERS is hasbeen'ed. + + * acspecific.m4 (AC_DIR_HEADER): Raised from obsolete to hasbeen. + + * acspecific.m4 (AC_CHECK_HEADERS_DIRENT, AC_CHECK_HEADER_DIRENT): + Removed, were used only by AC_DIR_HEADER and were not documented. + + * autoheader.m4: Remove the hooks for AC_CHECK_HEADERS_DIRENT. + + * autoconf.texi (Particular Headers): Removed the documentation of + AC_DIR_HEADER. + + * autoconf.texi (Environment Variables): Remove the very last + traces of documentation of --env-VAR. + +1999-10-02 Akim Demaille <akim@epita.fr> + + Remove hasbeen'ed macros from the documentation. + + * autoconf.texi (Obsolete Macros): Document AC_HASBEEN. + + * autoconf.texi (Libraries): Remove the documentation of + AC_HAVE_LIB. + (Particular Headers): likewise for AC_UNISTD_H, AC_MEMORY_H, + AC_USG. + (C Compiler Characteristics): Likewise for AC_INT_16_BITS, + AC_LONG_64_BITS. + +1999-10-01 Akim Demaille <akim@epita.fr> + + Make the handling of the configuration links (AC_LINK_FILES) + exactly the same as that of configurations files (AC_OUTPUT_FILES) + and headers (AC_CONFIG_HEADERS). As a result, it is sane to run + ./config.status src/libmy_lib + or + CONFIG_LINKS=src/lib_mylib:lib/lib_mylib ./config.status + + * acgeneral.m4 (AC_LINK_FILES): Use AC_FATAL to diagnose bad + number of argument. + Obsoleted (but implemented) in favor of AC_CONFIG_LINKS. + + * acgeneral.m4 (AC_CONFIG_LINKS): New macro. Takes space + separated list of DEST:SOURCES arguments. + + * acgeneral.m4: Rename each occurence of AC_LIST_HEADER as + AC_LIST_HEADERS for consistency. + + * acgeneral.m4 (AC_OUTPUT, config.status prologue): Move the + definition of config_files and config_headers to the top. + Add the definition of config_links. + Change the help message to use the aforementioned variables. + + * acgeneral.m4 (AC_OUTPUT_LINKS): Adapted to the new scheme of + AC_LIST_LINKS. + + * autoconf.texi (Output, AC_OUTPUT): Mention AC_CONFIG_LINKS. + (Invoking config.status): Mention CONFIG_LINKS. + + * autoconf.texi (Using System Type): Document AC_CONFIG_LINKS. + Explicit the obsoleteness of AC_LINK_FILES. + +1999-10-01 Akim Demaille <akim@epita.fr> + + Moving most of the task of creating config.h.in from sh to m4. + Getting rid of acconfig.h by supply a major new family of macros: + AH_* which make it possible to insert arbitrary text into + config.h.in. + + * autoheader.m4: Major rewrite: introduction of a set of macros + AH_ that produce code into config.h.in. There are two sets of + macros: generic macros, or specialized, documented below. The + basic idea is that an AC_FOO macro which needs an entry in + config.h.in should have a sibling AH_FOO which expands into that + entry. In a near future, these macros will be moved next to their + siblings. + + * autoheader.m4 (AH_VERBATIM, AH_DEFINE, AH_DEFINE, AH_NEED_DECLS, + AH_CHECK_SIZEOF, AH_CHECK_FUNCS, AH_CHECK_HEADERS, + AH_CHECK_HEADERS, AH_CHECK_LIB, AH_PROG_LEX, AH_FUNC_ALLOCA, + AH_C_CHAR_UNSIGNED, AH_AIX, AH_F77_WRAPPERS): New macros. + + * autoheader.m4 (End section): Bind AC_ macros to their + AH_siblings. + + * autoheader.sh: Remove the sections in charge of SYMS, TYPES, + FUNCS, HEADERS, LIBS and DECLS: autoheader.m4 is now in charge of + these. + + * autoheader.sh (options): Added -d, --debug, which does not + remove the temporary files. + + * autoheader.sh: Instead of redirecting stdout to the output + stream, always output to a temporary file. This allows to change + slightly the consistency check: before autoheader would check that + each non documented AC_DEFINE is templated in an acconfig. Now it + just checks whether the template is in the output file. + + * acconfig.h: Completely emptied, the remaining templates + (_ALL_SOURCE, __CHAR_UNSIGNED__, F77_FUNC, F77_FUNC_, + HAVE_STRINGIZE, and STACK_DIRECTION) are now either associated to + their AC_DEFINE, or to one of the new AH_ macros. + + * acgeneral.m4: Reordering of the m4 macros which are not specific + to Autoconf. + + * acgeneral.m4 (AC_HAVE_LIB): Promoted from obsolete to hasbeen. + + * acgeneral.m4 (AC_TR_CPP): Fixed quoting problem, and missing ^ + in patsubst. + (AC_TR_SH): Fixed quoting problem. + +1999-09-29 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_WRAP): Don't output an extra space after the + last word. + +1999-09-29 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Check for the kstat_open() + function in libkstat (on systems such as Solaris). This family of + functions is preferred since they don't require setgid permissions + to use them. Fix for PR autoconf/65. + +1999-09-29 Akim Demaille <akim@epita.fr> + + * acconfig.h: Commit the change announced below. + +1999-09-29 Akim Demaille <akim@epita.fr> + + * acspecific.m4 (AC_C_CONST): Changed from + const charset x; + to + const charset x = {0, 0}; + From Jim Meyering. + +1999-09-28 Akim Demaille <akim@epita.fr> + + Start to get rid of acconfig.h. It is an anachronism. + + * acgeneral.m4 (_AC_SH_QUOTE): Both cases must be evaluated the + same number of times. + + * acconfig.h (_ALLOCA, CLOSEDIR_VOID, const, CRAY_STACKSEG_END, + DGUX, DIRENT, GETGROUPS_T, GETLOADAVG_PRIVILEGED, GETPGRP_VOID, + gid_t, HAVE_ALLOCA, HAVE_ALLOCA_H, HAVE_DOPRNT, HAVE_FNMATCH, + HAVE_GETLOADAVG, HAVE_GETMNTENT, HAVE_LONG_DOUBLE, + HAVE_LONG_FILE_NAMES, HAVE_MMAP, HAVE_RESTARTABLE_SYSCALLS, + HAVE_ST_BLKSIZE, HAVE_ST_BLOCKS, HAVE_STRCOLL, HAVE_ST_RDEV, + HAVE_STRFTIME, HAVE_SYS_WAIT_H, HAVE_TM_ZONE, HAVE_TZNAME, + HAVE_UNISTD_H, HAVE_UTIME_NULL, HAVE_VFORK_H, HAVE_VPRINTF, + HAVE_WAIT3, inline, INT_16_BITS, LONG_64_BITS, MAJOR_IN_MKDEV, + MAJOR_IN_SYSMACROS, _MINIX, NDIR, NEED_MEMORY_H, NLIST_NAME_UNION, + NLIST_STRUCT, NO_MINUS_C_MINUS_O, F77_NO_MINUS_C_MINUS_O, + _POSIX_1_SOURCE, _POSIX_SOURCE, RETSIGTYPE, SELECT_TYPE_ARG1, + SELECT_TYPE_ARG234, SELECT_TYPE_ARG5, SETPGRP_VOID, + SETVBUF_REVERSED, STAT_MACROS_BROKEN, STDC_HEADERS, SVR4, SYSDIR, + SYSNDIR, SYS_SIGLIST_DECLARED, TIME_WITH_SYS_TIME, TM_IN_SYS_TIME, + uid_t, UMAX, UMAX4_3, USG, vfork, VOID_CLOSEDIR, WORDS_BIGENDIAN, + X_DISPLAY_MISSING, YYTEXT_POINTER): Removed their autoheader + template. They are now documented with their own AC_DEFINE. + + * acgeneral.m4 (AC_HASBEEN): New macro. Same as AC_OBSOLETE, but + dies. + + * acspecific.m4 (AC_UNISTD_H, AC_USG, AC_MEMORY_H, AC_INT_16_BITS, + AC_LONG_64_BITS): Promoted from obsolete to hasbeen. + + * autoheader.m4 (AC_DEFINE_UNQUOTED): Define via AC_DEFINE, so + that we program things only once. + (AC_DEFINE): Use AC_WRAP and _AC_SH_QUOTE. It is now safe to have + backquotes and extra spaces in the third argument, without + yielding a bad result. + + * autoheader.m4: Instead of a huge `eval', use a temporary file. + (option handling): Added --debug, to keep the temporary files. + Fixed a couple of missing quotes. + +1999-09-28 Akim Demaille <akim@epita.fr> + + Make AC_FOREACH be robust to active symbols. + + * acgeneral.m4 (m4_split, m4_join, m4_strip): New macros. + (AC_FOREACH_COMMA): Rename as... + (m4_foreach): this. + (_AC_CAR): Renamed as... + (_m4_car): this. + (_AC_FOREACH): Renamed as... + (_m4_foreach): this. + (_AC_COMMATIZE): Removed. + (AC_FOREACH): Rewritten using m4_split, m4_join, m4_strip, and + m4_foreach. + * acgeneral.m4: Spell checked. + * autoconf.texi: Likewise. + +1999-09-28 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_NEED_DECL): When $4 is given, don't provide + defaults headers. + Change the message from `have' to `need'. + Change the actions for `if-(not-)found' to `if-(not-)needed. + Remove trailing parentheses. + + * acgeneral.m4 (AC_NEED_DECLS): Change the actions for + `if-(not-)found' to `if-(not-)needed. + Define NEED_DECL_foo, instead of NEED_foo_DECL. + + * autoheader.sh (decls): Reflect this. + + * autoconf.texi (Generic Declarations): Update. + +1999-09-27 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT): Divert AC_OUTPUT_FILE to + AC_DIVERSION_KILL if there are no CONFIG_FILES. + (AC_OUTPUT, ac_cs_usage): Output the list of files to instanciate + only if there are. + +1999-09-27 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_DECL): Renamed as... + (AC_NEED_DECL): This. + (AC_CHECK_DECLS): Renamed as... + (AC_NEED_DECLS): This. + (AC_NEED_DECL): Include <stdio.h>, <memory.h>, <string.h>, + <strings.h>, <stdlib.h>, <stddef.h>, and <unistd.h>. + + * autoconf.texi (Generic Declarations): Updated. + +1999-09-27 Ben Elliston <bje@cygnus.com> + + * autoscan.pl (scan_files): Emit an AC_PROG_CC invocation to + configure.scan if there are any C files present. Fix for PR + autoconf/19. + +1999-09-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_WRAP): Rewritten. + (AC_HELP_STRING): Wrapper of AC_WRAP. + * acgeneral.m4 (_AC_SH_QUOTE): Rewritten. Don't try to handle + both backslashed and non backslashed backquotes in a single + string: consider that either all the backquotes are quoted, or + none. + +1999-09-26 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_PATH_PROG): Use a single case statement for + Unix and DOS absolute paths. + + * acgeneral.m4 (AC_CHECK_SIZEOF): Fix a typo. + Allow a third default argument: extra headers. + * autoconf.texi (C Compiler Characteristics): Document. + + * acgeneral.m4 (AC_CHECK_TYPE): Convert to the AC_VAR_* family. + Allow a third optional argument: extra includes. + * autoconf.texi (Generic Typedefs): Documents. + +1999-09-26 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (AC_OUTPUT_LINKS): Eliminate gratuitous spaces from + $ac_sources if this variable is otherwise empty. Fix for PR + autoconf/30. + +1999-09-25 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (AC_FUNC_SETVBUF): Do not mention which systems + might have their setvbuf() arguments reordered. It's difficult to + accurately determine and is not essential. Fix for PR autoconf/7. + + * acgeneral.m4 (AC_LINK_FILES): Emit an error if an incorrect + number of arguments are collected. Fix for PR autoconf/10. + +1999-09-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT, handling of options): Make it possible + to specify the files to configure on the command line instead of + via envvars. Document it. + +1999-09-25 Akim Demaille <akim@epita.fr> + + * acgeneral.m4: Rename the occurences of the variable `confstat' + as `ac_cs_root'. The previous name was breaking the naming + scheme. + +1999-10-24 Akim Demaille <akim@epita.fr> + + * TODO: Updated. + Added a section for 2.15 and 3. + +1999-09-24 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_HEADER_STDC): Define ISLOWER and ISUPPER + macros correctly on EBCDIC systems. Contributed by Kurt D. + Zeilenga. Fix for PR autoconf/6. + +1999-09-24 Jim Blandy <jimb@zwingli.cygnus.com> + + * acspecific.m4 (AC_C_VOLATILE): New test. + * acconfig.h: Add new entry for `volatile'. + * autoconf.texi (C Compiler Characteristics): Document it. + +1999-09-24 Ben Elliston <bje@cygnus.com> + + * autoreconf.sh: Do not run autoheader if AC_CONFIG_HEADER is + commented out in configure.in. Reported by Erez Zadok + as a fix for PR autoconf/21. + + * install.texi: Replace `can not' with `cannot'. + +1999-09-23 Pavel Roskin <pavel_roskin@geocities.com> + + Avoid that comments from aclocal.m4 show up in configure when + using AC_REVISION. + + * acgeneral.m4: New diversion levels AC_DIVERSION_KILL and + AC_DIVERSION_BINSH introduced. Use AC_DIVERSION_KILL as the + initial value for AC_DIVERSION_CURRENT. + (AC_INIT_BINSH): Set AC_DIVERSION_BINSH explicitly + (AC_REVISION): Likewise. + (AC_INIT): Set AC_DIVERSION_NOTICE when calling AC_INIT_NOTICE. + +1999-09-23 Akim Demaille <akim@epita.fr> + + * NEWS: Document AC_ARG_VAR. + + * acspecific.m4 (AC_C_LONG_DOUBLE): Avoid a needed execution by + using a pure compilation test. Excellent for cross compilation. + From Kaveh R. Ghazi. + +1999-09-22 Akim Demaille <akim@epita.fr> + + * install.texi: Give more details on envvar handling. + * acgeneral.m4 (AC_HELP_STRING): Add a third argument to tune the + width of the first column. + (AC_INIT_NOTICE): Initialize ac_arg_enable_help, ac_arg_with_help, + and ac_arg_var_help. + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Remove the handling of + --env-var=. After debate, the solution chosen to specify envvars + to configure is a` la make: ./configure VAR=VAL. + (AC_INIT_PARSE_ARGS, --help): Output ac_arg_enable_help, + ac_arg_with_help, and ac_arg_var_help. + * acgeneral.m4 (AC_ARG_VAR): New macro, to register and document + influent envvars. + * acspecific.m4 (AC_PROG_CC): Document CFLAGS. + This is mainly to test AC_ARG_VAR. Var to document are to be + defined. + +1999-09-22 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (m4_default): New macro. + (AC_CHECK_LIB): When ACTION-IF-FOUND is specified, don't perform + the default action. + Reported by Pavel. + +1999-09-22 Ben Elliston <bje@cygnus.com> + + * config.guess: Clear the CCOPTS environment variable before + invoking the C compiler on HP-UX. This is necessary to guarantee + that the test program is compiled correctly. Reported by Dietmar + P. Schindler. + +1999-09-22 Linas Vepstas <linas@linas.org> + + * config.guess: Add OS/390 match pattern. + * config.sub: Add mvs, openedition targets. + +1999-09-21 Nick Clifton <nickc@cygnus.com> + + * config.sub: Add fr30 target. + +1999-09-21 Ben Elliston <bje@cygnus.com> + + * configure.in: Check if an appropriate version of GNU m4 is + installed at configure-time rather than at runtime. From Pavel + Roskin. Fix for PR autoconf/2. + * configure: Regenerate. + +1999-09-21 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INIT_PARSE_ARGS, --help message): Use quoted + heredocs to avoid problems with quotes. + +1999-09-21 Akim Demaille <akim@epita.fr> + + * NEWS: Updated. + * THANKS: Likewise. + + * acgeneral.m4 (AC_CHECK_HEADER): Use AC_VAR_*. + (AC_CHECK_HEADERS): Adapted. + + * acgeneral.m4 (AC_TR): Remove, it is useless. + (AC_TR_CPP): Updated version of formerly AC_TR_DEFINE, based on + the model of AC_TR_SH. + All callers changed. + + * autoconf.sh (Checking for Bugs): Remove the indirection that + made the `sort -u' useless. + +1999-09-21 Akim Demaille <akim@epita.fr> + + * autoconf.sh (Last sed cmd): Change also @PND@ to `#', since this + is also a symbol very hard to quote in m4. + + * acgeneral.m4 (AC_CHECK_LIB): Use AC_VAR_*. + + * acgeneral.m4: Use `m4_BUILTIN' instead of indirection via + `builtin'. + +1999-09-21 Akim Demaille <akim@epita.fr> + + * autoconf.texi (Particular Structures): Move documentation of + AC_HEADER_STAT and AC_HEADER_TIME from here... + (Particular Headers): to here. + (Declarations): New section. + (Particular Headers): Move doc of AC_DECL_SYS_SIGLIST from here... + (Particular Declarations): to here. + +1999-09-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * acgeneral.m4 (AC_CHECK_FUNC_DECL, AC_CHECK_FUNC_DECLS): New + macros. + + * autoconf.texi (AC_CHECK_FUNC_DECL, AC_CHECK_FUNC_DECLS): + Document. + + * autoheader.m4: Add support for AC_CHECK_FUNC_DECLS. + + * autoheader.sh: Likewise. + +1999-09-21 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_SHELL_IFELSE): New macro. + (AC_VAR_IF_SET): Use it. + (AC_CHECK_FUNC): Likewise. + + * Makefile.in (${srcdir}/configure): Use autoconf.sh to build + Autoconf's configure. Before the building was performed running + m4 at hand, but much was not done (e.g., __oline__, + @BKL@... expansion) + +1999-09-20 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_OUTPUT): Don't remove the CONFIG_HEADERS + unconditionaly: it breaks the `config.h has not changed' trick. + +1999-09-20 Ben Elliston <bje@cygnus.com> + + * autoheader.sh: Bourne shell compatibility fix. From Pavel Roskin. + +1999-09-20 Pavel Roskin <pavel_roskin@geocities.com> + + * autoheader.sh: Fix the tr invocation. + +1999-09-17 Ben Elliston <bje@cygnus.com> + + * config.guess: Detect QNX version 4. + * config.sub: Handle `qnx' and `i386-qnx' aliases. + +1999-09-17 Erez Zadok <ezk@cs.columbia.edu> + + * config.guess: Eliminate the trailing dot if ${UNAME_RELEASE} is + 1.4-<SOMETHING>. Fix for PR autoconf/22. + +1999-09-17 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Improve configure's --help. + + * acgeneral.m4 (AC_OUTPUT): Change the root of filenames of + config.status from $conftest to $confstat. + The previous patch to make config.status reentrant was wrong, + because it changed some `conftest' that are used by configure into + `$conftest', while it was for config.status only. To avoid + another confusion like this, all the filenames of config.status + should be `$confstat*', and those of configure should be + `conftest*'. + (AC_OUTPUT): Rename the uses of `ac_file' for the sed fragments as + `ac_sed_frag'. + + * acgeneral.m4 (AC_OUTPUT): This macro used to open the here + documents that configure uses to generate config.status, included + that of the submacros. Now, it no longer handles the here + documents for its subroutines (it was far to hard to track). + (AC_OUTPUT_FILES): Open and close your here documents to + $CONFIG_STATUS. + (AC_OUTPUT_HEADER): Likewise. + (AC_OUTPUT_LINKS): Likewise. + + * acgeneral.m4 (AC_OUTPUT_FILES): Move $ac_vpsub and $extrasub + from the AC_SUBST substitutions (i.e., that of @SHELL@ etc.) to + the specific section (that of @srcdir@ etc.). + Now the ``general substitution'' section is absolutely uniform. + + * acgeneral.m4 (AC_SUBST): Change sed call from `s%@from@%to%g' + into `s%@from@%to%;t t'. + (AC_SUBST_FILE): Likewise. + (AC_OUTPUT_FILES): Optimize the sed scripts by branching if there + are no `@' on the line. Impressive speed up. + + * Makefile.in (DISTFILES): Add THANKS. + + * THANKS: New file. + +1999-09-15 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_CHECK_FILE): Use ifset. + (AC_CHECK_FUNC): Updated to use AC_VAR_*, and AC_CACHE_CHECK. + (AC_CHECK_SIZEOF): Likewise. + (AC_CACHE_CHECK): Use AC_MSG_RESULT_UNQUOTED. + (AC_MSG_RESULT_UNQUOTED): New macro. + +1999-09-15 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + Fix for PR autoconf/28. + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS): Don't assume LF is \012, use + `echo` followed by a non-blank, within quotes. + * autoheader.sh (syms): Likewise. + * configure: Rebuilt. + +1999-09-14 Alexandre Oliva <oliva@lsd.ic.unicamp.br> + + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS): Don't assume LF is \012, + use `echo` followed by a non-blank, within quotes. + * autoheader.sh (syms): Likewise. + * configure: Rebuilt. + Reported by Christian Krone. + + * acgeneral.m4 (AC_INCLUDE): New macro. + * autoconf.texi: Document it. + + * acgeneral.m4 (AC_OUTPUT_SUBDIRS): Save INSTALL in + ac_given_INSTALL, so that we can adjust relative pathnames for + sub-configures. + + * acgeneral.m4 (Configuration): Accept --env-VAR=VALUE and + VAR=value. + * autoconf.texi, install.texi: Document it. + * configure: Rebuilt. + +1999-09-14 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_HELP_STRING): Rewrite in m4. Have m4 work, and + give a break to sh. + (_AC_FOREACH): Be careful not to evaluate the arguments. A loop + over *quoted* macro names should loop over the macro names, not + upon their expansion. + (_AC_COMMATIZE): Also swallow end of lines. + + * autoconf.texi (Pretty Help Strings): Updated to reflect the + changes. + +1999-09-13 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (ifset): New helpy tiny macro. + (AC_OUTPUT): Improved --help of config.status. + (AC_OUTPUT): Remove inconditionaly all the files to be updated. + (AC_OUTPUT): Use pid to define the temporary file names in order + to allow parallel builds. + + * autoconf.sh: Substitute also /@BKL@/[/ /@BKR@/]/ /@DLR@/$/ so + that these characters are more easily accessible from m4 without + turning changequote juggling into a nightmare. + + * acgeneral.m4 (AC_WRAP): New macro, for word wrapping. + + * autoconf.texi: Update the direntry for more modern Texinfos. + Add pointer to configure and config.status. + Remove the dots from the menus: horizontal space is precious. + (Invoking config.status): More traditional presentation of the options. + +1999-09-07 Ben Elliston <bje@cygnus.com> + + * autoreconf.sh: Recognise -v as a synonym for --verbose. + +1999-09-07 Gary V. Vaughan <gvaughan@oranda.demon.co.uk> + + * Makefile.in (INSTALL, standards.info, autoconf.info): MiKTeX + for Windows treats all options after the first filename as + additional filenames, so real options must appear before the first + filename. + +1999-09-07 Steven G. Johnson <stevenj@alum.mit.edu> + + * autoconf.texi (LDFLAGS, LIBS): Document that -L linker flags + should be kept in LDFLAGS and not LIBS. + +1999-09-07 Jim Meyering <meyering@ascend.com> + + * acgeneral.m4 (AC_SEARCH_LIBS): Use $ac_lib as the index, not $i. + +1999-09-06 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_FUNC_ALLOCA): Rename cache variable to avoid + name clashes with AC_CHECK_HEADER(alloca.h). + +1999-09-05 Steve Chamberlain <sac@pobox.com> + + * config.sub: Add support for configuring for picoJava (pj). + +1999-09-05 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (CONFIG_AUX_DIRS): Try running `shtool install'. + Contributed by Ralf S. Engelschall. + +1999-09-04 Ben Elliston <bje@cygnus.com> + + * config.guess: Use POSIX compliant shell code on DG/UX. + Suggested by Stephen Gildea. + +1999-09-04 Pavel Roskin <pavel_roskin@geocities.com> + + * acgeneral.m4 (AC_OUTPUT_FILES): Output comment to not only + `Makefile', but also `makefile'. + +1999-09-04 Jim Blandy <jimb@zwingli.cygnus.com> + + * Makefile.in (install): Don't freak if the M4FROZEN files were + never generated. m4 1.1 is supported, but doesn't freeze files. + +1999-09-04 Scott Bambrough <scottb@netwinder.org> + + * config.guess: Autodetect ArmLinux using 2.9.1.xx linker + emulation names and using the emulation names from the linker from + the binutils CVS tree. + + * config.sub: Change manufacturer name for the NetWinder alias + from Corel to Rebel. + +1999-09-04 Jeremy Elson <jelson@circlemud.org> + + * autoheader.m4 (AC_CHECK_HEADER): Define. + +1999-09-02 Tom Tromey <tromey@cygnus.com> + + * autoheader.sh: Allow multiple spaces between #undef and symbol + name. + +1999-09-01 Akim Demaille <akim@epita.fr> + + * acgeneral.m4 (AC_ACVERSION): Bump to 2.14.1 to differenciate the + experimental branch from the main trunk. + + * acgeneral.m4 (AC_FOREACH_COMMA): New macro, to perform m4 loops + on m4 lists (i.e., list='(item_1, item_2, ..., item_n)'). + (AC_FOREACH): New macro, to perform m4 loops on shell lists (i.e., + list='item_1 item_2 ... item_n'). + + * acgeneral.m4 (AC_DEFUN): Now accept two other optionnal + parameters: the name of the macro which is specialized here, and + the name of the first argument. For instance `AC_CHECK_FNMATCH' + should be declared as specializing `AC_CHECK_FUNC' for `fnmatch' + as first argument. + + * acgeneral.m4 (AC_CHECK_FILES): Use AC_FOREACH for looping, + instead of the shell's loop. + + * acgeneral.m4 (AC_TR): In addition to transliteration, provide a + means to specify the valid destination alphabet and a default + character for aliens characters. This is in order to remove + characters such as `+:-' etc. that may appear in file names, but + are not valid for shell variables or #defines. + (AC_TR_DEFINE): New macro, maps anything to a valid uppercase + #define rhs. + (AC_TR_UPCASE_NAME): Replaced by AC_TR_DEFINE. All callers + changed. + (AC_TR_UPCASE_FILE): Likewise. + + * acgeneral.m4 (AC_TR_SH): Don't use the generic AC_TR: there is a + difficult problem of quoting between m4 and sh. Use the variable + $ac_tr_sh to work around this difficulty. + (AC_VAR_TEST_SET): New macro, which tests if a variable is set. + (AC_VAR_IF_SET): New `ifelse' macro. + (AC_CACHE_VAL): Use AC_VAR_IF_SET. + (AC_INIT_NOTICE): Define $ac_tr_sh. + + * acgeneral.m4 (AC_CHECK_FILE): Converted to use AC_TR and AC_VAR + families. + + * acgeneral.m4: Fixed the regular expressions: `$' shall not be + portably in a sed \(\) group. + +1999-08-28 Ben Elliston <bje@cygnus.com> + + * config.guess: Once and for all, emit the correct string for + Unixware 7! Contributed by Mike Hopkirk. + + * acspecific.m4 (AC_C_INLINE): Qualify the return type of the + dummy inlined function to satisfy newer C++ compilers. Fix for + PR autoconf/49. + +1999-08-26 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (Changed Results): Correct an error in one of the + examples. Fix for PR autoconf/38. + +1999-08-25 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (Cache Variable Names): Be more explicit about the + requirements for cache variable names. Fix for PR autoconf/53. + +1999-08-25 Alexandre Oliva <oliva@dcc.unicamp.br> + + * autoreconf.sh: Run aclocal with the -I option only if + aclocal_dir != `.'. Fix for PR autoconf/44. + +1999-08-22 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * acspecific.m4 (AC_PROG_CC): Remove uname test for win32/Cygwin, + and just test for `cl' as a last resort. + + * autoconf.texi (Particular Programs): Document new optional + argument to AC_PROG_CC, AC_PROG_CXX and AC_PROG_F77. Document + additions to the Fortran 77 compiler search list. + + * acspecific.m4 (AC_PROG_F77): Add more Fortran 77 compilers to + the search list. Contributed by Steven G. Johnson. + + (AC_PROG_CC): Likewise. + (AC_PROG_CXX): Likewise. + * acspecific.m4 (AC_PROG_F77): Add an optional first argument + which gives the user an opportunity to specify an alternative + search list for the compiler. + +1999-08-18 Ben Elliston <bje@cygnus.com> + + * config.guess: Remove "/MP" from the release string on + multiprocessor x86 machines running SVR4.0. Suggested by Tom + Purcell. + +1999-08-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> + + * acgeneral.m4 (AC_CHECK_TYPE): Add optional third argument + INCLUDES, which specifies the headers in which to search for the + type in question. Also, pass a "description" argument to + AC_DEFINE_UNQUOTED. + * acconfig.h (mode_t, off_t, pid_t, size_t): Remove definitions. + * autoconf.texi (AC_CHECK_TYPE): Document optional third argument. + +1999-08-05 Jeffrey A Law <law@cygnus.com> + + * config.sub (-wrs case): Use os=-vxworks, not os=vxworks. + +1999-08-05 Ben Elliston <bje@cygnus.com> + + * config.guess: Update patch submission address. + +1999-08-05 Ben Elliston <bje@cygnus.com> + + * config.sub: Accept version number appended to OS name for MiNT. + Contributed by Guido Flohr. + +1999-08-04 Ben Elliston <bje@cygnus.com> + + * Makefile.in (INSTALL_SCRIPT): Substitute. + (install): Install scripts with $(INSTALL_SCRIPT). + +1999-07-20 Tom Tromey <tromey@cygnus.com> + + * autoheader.sh: Fixed regexp when searching for missing symbol. + From Pavel Roskin. + +1999-07-16 Tom Tromey <tromey@cygnus.com> + + * autoheader.sh: Be more stringent when looking to see if symbol + is in a template file. + +1999-07-15 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * acspecific.m4 (AC_F77_LIBRARY_LDFLAGS): New implementation, to + make maintenance easier. + Grep the initial output so that we don't start parsing "-l" and + "-L" too early. From Christopher Lee. + + * acgeneral.m4 (AC_LIST_MEMBER_OF): New "private implementation + macro" use by AC_F77_LIBRARY_LDFLAGS. + (AC_LINKER_OPTION): Likewise. + +1999-07-11 Ben Elliston <bje@cygnus.com> + + * config.guess: Cray T3E has an Alpha CPU. + +1999-07-04 Mark Elbrecht <snowball3@bigfoot.com> + + * acspecific.m4 (AC_PROG_CXX): Look for gpp after g++. gpp is the + DJGPP C++ compiler, since `g++' is not a valid DOS filename. + +1999-06-12 Ben Elliston <bje@cygnus.com> + + * config.guess: Detect Linux on ia64. + * config.sub: Handle ia64. + +1999-06-12 Ben Elliston <bje@cygnus.com> + + * config.guess: Handle `elf32ppclinux' from ld. Contributed by + Cort Dougan. + +1999-06-09 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * autoconf.texi (Pretty Help Strings): Synchronize documentation + with implementation. + +1999-06-04 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS): Fix sed regexp for handling + CPP macros with args. + +1999-06-04 Nick Clifton <nickc@cygnus.com> + + * config.sub: Add mcore target. + +1999-06-03 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (AC_ACVERSION): Correct version number. + * autoconf.texi (EDITION): Likewise. + (VERSION): Likewise. + +1999-06-02 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * autoconf.texi (Pretty Help Strings): Document and regenerate the + indices. + * acgeneral.m4 (AC_HELP_STRING): New macro. + + * NEWS: Begin documenting "Major changes" for release 2.14. + + * acconfig.h (F77_FUNC): Add. + (F77_FUNC_): Likewise. + +1999-06-01 Akim Demaille <demaille@inf.enst.fr> + + * acgeneral.m4 (AC_PREFIX_PROGRAM): Use macros of the AC_TR_ + family. + (AC_HAVE_LIBRARY): Likewise. + (AC_CHECK_FUNCS): Likewise. + (AC_CHECK_FILES): Likewise. + (AC_CHECK_SIZEOF): Likewise. + + * acgeneral.m4 (AC_TR): New macro which performs transliteration + by m4 when possible, or by `tr' at configure time. + (AC_TR_UPCASE_NAME): New macro, transliteration 'a-z' to 'A-Z'. + (AC_TR_UPCASE_FILE): New macro, transliteration 'a-z./-' to + 'A-Z___'. + (AC_TR_SH): New macro, transliteration to valid sh var name. + + * acgeneral.m4 (_AC_SH_QUOTE): New macro which protects non + protected backquotes against shell expansion. + (AC_MSG_CHECKING): Use it. + (AC_CHECKING): Use it. + (AC_MSG_RESULT): Use it. + (AC_VERBOSE): Use it. + (AC_MSG_WARN): Use it. + (AC_MSG_ERROR): Use it. + + * acgeneral.m4 (_AC_MESSAGE): New macro to report message at m4 + time. + (AC_WARNING): New macro to report warnings at m4 runtime. + (AC_FATAL): New macro, to report fatal error at m4 runtime. + + * acspecific.m4 (AC_RSH): Use AC_FATAL. + (AC_ARG_ARRAY): Idem. + (AC_HAVE_BOUNDBANG): Idem. + + * acgeneral.m4 (AC_VAR_IF_INDIR): New macro. + (AC_VAR_SET): Likewise. + (AC_VAR_GET): Likewise. + +1999-05-30 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * autoheader.m4 (AC_DEFINE): Ignore CPP macro arguments. + (AC_DEFINE_UNQUOTED): Likewise. + + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS): Change sed regexps to + recognize CPP macros that take arguments. Reported, and based on + a patch, by Steven G. Johnson. + (AC_OUTPUT_HEADER): Likewise. + + * autoconf.texi (Fortran 77 Compiler Characteristics): Document + new AC_F77_NAME_MANGLING macro. + +1999-05-30 Steven G. Johnson <stevenj@alum.mit.edu> + + * autoconf.texi (Fortran 77 Compiler Characteristics): Document + new AC_F77_FUNC_WRAPPER macro. + + * acspecific.m4 (AC_F77_WRAPPERS): New macro to define the + F77_FUNC and F77_FUNC_ CPP macros to properly mangle the names of + C identifiers so that they match the name mangling scheme used by + the Fortran 77 compiler. + (AC_F77_NAME_MANGLING): New macro to test for the name mangling + scheme used by the Fortran 77 compiler. + +1999-05-27 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * acgeneral.m4 (AC_CHECK_LIB): Translate the ":" character to a + "_", which allows checking for member functions in C++ libraries. + +1999-05-25 H.J. Lu <hjl@gnu.org> + + * config.guess (dummy): Changed to $dummy. + +1999-05-22 Ben Elliston <bje@cygnus.com> + + * config.guess: Handle NEC UX/4800. Contributed by Jiro Takabatake. + +1999-05-17 Ben Elliston <bje@cygnus.com> + + Merge with the EGCS source tree. + + * config.guess: Add detection for Interix and UWIN on Windows NT, + OpenBSD on PA-RISC and UnixWare version 7.x. + Improve usage of `tr' where sets are concerned. + Detect all HP 9000 machines. + Determine machine types more completely on older UnixWare systems. + Determine C library version on GNU/Linux for the PowerPC. + * config.sub: Numerous additions. Some cleanup. + +1999-04-29 Ben Elliston <bje@cygnus.com> + + * config.sub: Handle `t3e' alias for Cray T3E. Contributed by + James A. Lupo. + +1999-04-19 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * acgeneral.m4 (AC_TRY_LINK_FUNC): Add support for Fortran 77. + +1999-04-17 Paul Eggert <eggert@twinsun.com> + + * autoconf.texi, acspecific.m4 (AC_FUNC_MKTIME): New macro. + taken from automake's AM_FUNC_MKTIME. + * acfunctions: mktime now belongs to AC_FUNC_MKTIME. + +1999-04-11 Philipp Thomas <kthomas@gwdg.de> + + * config.sub: Set basic_machine to i586 when target_alias = k6-*. + +1999-04-11 Pavel Roskin <pavel_roskin@geocities.com> + + * autoheader.m4: Do not complain about using AC_TRY_RUN without a + cross-compilation action--only autoconf should do this. + +1999-04-11 Paul Eggert <eggert@twinsun.com> + + * acgeneral.m4 (AC_CHECK_TYPE): Allow first argument to be a + shell variable. + +1999-04-11 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (AC_C_STRUCT_MEMBER): New macro. + * acspecific.m4 (AC_STRUCT_TIMEZONE): Rewrite in terms of + AC_C_STRUCT_MEMBER. + (AC_STRUCT_ST_BLOCKS): Likewise. + (AC_STRUCT_ST_BLKSIZE): Likewise. + (AC_STRUCT_ST_RDEV): Likewise. + * autoconf.texi (Structures): Update. Add menu for subnodes. + (Particular Structures): New node. + (Generic Structures): New node. + (AC_C_STRUCT_MEMBER): Document. + +1999-04-10 Ben Elliston <bje@cygnus.com> + + * mkinstalldirs: Add `-m' flag to specify the mode of a newly + created directory. Add command line usage and `-h', `--help' + options. Contributed by Jeff Garzik. + +1999-04-08 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_PROG_CC): Try using the `cl' C compiler under + Cygwin. Contributed by Scott Stanton. + + * config.sub: Handle MPE/iX. + +1999-04-07 Ben Elliston <bje@cygnus.com> + + * config.guess: Add more CLIX machines. From Thomas Dickey. + +1999-04-06 Ben Elliston <bje@cygnus.com> + + * config.guess: Avoid the possibility of `ld' on GNU/Linux systems + being something other than the GNU linker (such as a directory, in + the case of GNU binutils). + +1999-04-05 Ben Elliston <bje@cygnus.com> + + * config.sub: Add modern Alpha processors. Reorganise. + + * acspecific.m4 (AC_CYGWIN): Do not remove conftest*; let + AC_TRY_COMPILE clean up after itself. + (AC_MINGW32): Likewise. + (AC_EMXOS2): Likewise. + + * acspecific.m4 (AC_EMXOS2): New macro. Contributed by Ryuji Abe. + (AC_EXEEXT): Handle case for OS/2. + (AC_PROG_CC_WORKS): Show $CPPFLAGS when running the compiler. + (AC_PROG_CXX_WORKS): Likewise. + + * autoconf.texi (AC_EMXOS2): Document. + (AC_EXEEXT): Mention OS/2. + (AC_MINGW32): Move. + (UPDATED): Update. + +1999-04-02 Mike Stump <mrs@wrs.com> + + * acgeneral.m4 (AC_ARG_PROGRAM): Remove spaces, as there is one + more pass through sh than you think. + +1999-04-01 Ben Elliston <bje@cygnus.com> + + * standards.texi: Update from FSF. + + * acspecific.m4 (AC_PROG_INSTALL): Avoid using the installation + script belonging to HP `pwplus' when running the install + program. Contributed by Steven G. Johnson and Dave Adams. + (AC_EXEEXT): Do not consider `.xcoff' as a possible executable + filename extension. Contributed by Robert S. Maier. + +1999-03-28 Tom Tromey <tromey@cygnus.com> + + * autoconf.texi (AC_OUTPUT_COMMANDS): Add to macro index. + +1999-03-22 Ben Elliston <bje@cygnus.com> + + * config.guess: Rename BUILD_CC to CC_FOR_BUILD; there is a + precedent for the usual name of this environment variable. + +1999-03-22 Pavel Roskin <pavel_roskin@geocities.com> + + * autoheader.sh: Report an error if AC_CONFIG_HEADER is not + present in the configure input file. + +1999-03-21 Ben Elliston <bje@cygnus.com> + + * config.guess: Correct typo for detecting ELF on FreeBSD. + +1999-03-14 Alexandre Oliva <oliva@dcc.unicamp.br> + + * config.guess: Recognise HP 9000/8x0 machines. + +1999-03-11 Ben Elliston <bje@cygnus.com> + + * config.sub: Recognise hppa2.0w. Contributed by Erez Zadok. + +1999-03-11 Pavel Roskin <pavel_roskin@geocities.com> + + * config.guess: Prefer $HOST_CC over $CC when deciding on a C + compiler to compile stub programs. Allow this to be overridden + with the value of $BUILD_CC in cross-compilation environments + where the native compiler must be used for running tests on the + host. + +1999-03-11 Ben Elliston <bje@cygnus.com> + + * config.guess: Recognise MiNT and TOS on Atari machines. + Contributed by Guido Flohr. + + * config.sub: Add aliases for MiNT. + +1999-03-10 Ben Elliston <bje@cygnus.com> + + * config.guess: Recognise HP 9000/800. Merged from the master + FSF version of this file. + +1999-03-01 Gordon Matzigkeit <gord@trick.fig.org> + + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS): Don't require that macro + symbols be valid C identifiers. + +1999-02-28 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_FUNC_VFORK): Allow test to behave correctly + when $ac_cv_func_vfork_works is the empty string. Contributed by + <red@nym.alias.net>. + + * config.sub: Add `oskit' as a basic system type. From Godmar Back. + +1999-02-26 Ben Elliston <bje@cygnus.com> + + * install-sh: Avoid trailing whitespace. + + * autoscan.pl (parse_args): Make compatible with Perl version 4. + +1999-02-24 Ben Elliston <bje@cygnus.com> + + * config.guess: Detect LynxOS 3.x. Contributed by Giuseppe + Guerrini. + +1999-02-23 Ben Elliston <bje@cygnus.com> + + * config.guess: Detect ReliantUNIX on MIPS. Contributed by Andrej + Borsenkow. + Also remove random trailing whitespace. + +1999-02-22 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (System Services): Explain the semantics of the + AC_SYS_RESTARTABLE_SYSCALLS macro in greater detail. Suggested by + Franc,ois Pinard. + +1999-02-22 Stu Grossman <grossman@cygnus.com> + + * acgeneral.m4 (AC_CANONICAL_SYSTEM): Explicitly require + AC_CANONICAL_HOST, AC_CANONICAL_TARGET and AC_CONICAL_BUILD. + (AC_CONFIG_AUX_DIR): Run auxillary shell scripts through $SHELL. + Do not rely on their magic number. + (AC_CANONICAL_THING): New macro. Cache results. + (AC_CANONICAL_HOST): Reimplement; use AC_CANONICAL_THING. + (AC_CANONICAL_TARGET): Likewise. + (AC_CANONICAL_BUILD): Likewise. + (AC_OUTPUT): Use $SHELL. + (AC_OUTPUT_SUBDIRS): Likewise. + +1999-02-19 Ben Elliston <bje@cygnus.com> + + * config.guess: Make C code clean for C++ compilers. Contributed + by Markus Oberhumer. + +1999-02-19 Ben Elliston <bje@cygnus.com> + + * config.guess: Automatically recognise ELF on FreeBSD. From Niall + Smart and improved by Andrew Cagney. + +1999-02-19 Felix Lee <flee@cygnus.com> + + * acgeneral.m4 (AC_CACHE_VAL): Don't need backticks. This is a + performance enhancement for about a 5% reduction in the runtime of + the generated configure script. + +1999-02-18 Ben Elliston <bje@cygnus.com> + + * config.guess: Detect NEC EWS4800. Contributed by Koji Arai. + +1999-02-11 Ben Elliston <bje@cygnus.com> + + * standards.texi: Update from FSF. + +1999-02-10 Tom Tromey <tromey@cygnus.com> + + * acgeneral.m4 (AC_CACHE_LOAD): Avoid sourcing special files. + Works around bug in some versions of bash. + +1999-02-02 Pavel Roskin <pavel_roskin@geocities.com> + + * autoconf.texi: Corrected definitions for AC_CONFIG_AUX_DIR and + AC_PROG_F77. Duplicated descriptions for AC_SEARCH_LIBS and + AC_TRY_LINK_FUNC removed. + +1999-01-29 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_EXEEXT): Ignore C++ source files. + +1999-01-28 Gary V. Vaughan <gvaughan@oranda.demon.co.uk> + + * acspecific.m4 (AC_PROG_INSTALL): set INSTALL_SCRIPT to + ${INSTALL} so that automake doesn't propogate install time flags + for INSTALL_PROGRAM into INSTALL_SCRIPT. + +1999-01-25 Ben Elliston <bje@cygnus.com> + + * install-sh: Use $mkdirprog, not `mkdir' directly. Contributed by + Jeff Garzik. + + * Makefile.in (clean mostlyclean distclean maintainer-clean): + Remove .m4f files. + + * config.guess: Synchronise with master FSF version. Add detection + for HP MPE/iX. + + * config.sub: Likewise. + +1999-01-23 Ben Elliston <bje@cygnus.com> + + * config.guess: Catch more NILE system models. Contributed by + Akim Demaille and Graham Jenkins. + + * autoheader.sh: Force $tmpout to close to avoid Windows file + sharing conflicts. From Mark Elbrecht. + +1999-01-21 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (Introduction): Update bug reporting address. + + * config.guess: Likewise. + +1999-01-19 Pavel Roskin <pavel_roskin@geocities.com> + + * ifnames.sh: Source lines ending with backslash are prepended to + the following line before further processing. + +1999-01-19 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_PROG_CXXCPP): Substitute @CXXCPP@ correctly + when $CXXCPP is overridden in the supervisory shell. Contributed + by Michael Schoene. + +1999-01-16 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (AC_ACVERSION): Bump to 2.14.1 for prereleases. + +1999-01-14 Scott Bambrough <scottb@corelcomputer.com> + + * config.guess: Recognise armv[234][lb] types (ie. `armv*'). + +1999-01-13 Ben Elliston <bje@cygnus.com> + + * autoconf.sh: Remove -v and --verbose from the command line usage + help. They do not exist. + +1999-01-12 Scott Bambrough <scottb@corelcomputer.com> + + * config.sub: Recognize armv[234][lb] types (ie. `armv*'). Add + alias for the NetWinder; set company to `corel'. + +1999-01-11 Akim Demaille <demaille@inf.enst.fr> + + * autoreconf.sh (verbose): use either `:' or `echo'. + (aclocal_m4): Renamed from aclocal. + (aclocal_flags): New var. + Run aclocal using $aclocal_flags. + Redirect ls' stderr to /dev/null to avoid spurious messages. + +1999-01-11 Ben Elliston <bje@cygnus.com> + + * config.guess: Detect HP-UX on MPE/iX machines. + + * acgeneral.m4 (AC_ACVERSION): Increment to 2.14. + + * autoconf.texi (EDITION): Likewise. + (VERSION): Likewise. + +1999-01-10 Ben Elliston <bje@cygnus.com> + + * config.guess: Detect Rhapsody on PowerPC and other machines. + Contributed by Wilfredo Sanchez. + + * config.sub: Add rhapsody and openstep aliases. + +1999-01-09 Ben Elliston <bje@cygnus.com> + + * Makefile.in (html): New target. Generate HTML documentation. + (install-strip): Add. + Contributed by Wilfredo Sanchez. + + * autoconf.texi (AC_CHECK_LIB): Explain more. Contributed by Bob + Friesenhahn. + (UPDATED): Bump to 1999. + + * config.guess: Distinguish between OpenStep and NeXTStep + platforms. Contributed by Wilfredo Sanchez. + +1999-01-09 J"orn Rennecke <amylaar@cygnus.co.uk> + + * acgeneral.m4 (AC_CHECK_FUNC): Don't actually call the function. + +1999-01-09 H.J. Lu <hjl@lucon.org> + + * config.guess: Permit multiple concurrent instances by including + the process ID of the shell running this script in temporary + filenames. + +1999-01-08 Ben Elliston <bje@cygnus.com> + + * autoconf.sh: More useful and up-to-date help from the --help + option. Contributed by Akim Demaille. + + * autoheader.sh: Likewise. + + * autoreconf.sh: Likewise. + + * autoscan.pl: Likewise. + + * autoupdate.sh: Likewise. + + * ifnames.sh: Likewise. + + * config.guess: Detect Cray T3E and NEC SX-4, SX-5 machines. + Contributed by Andreas Schott. + +1999-01-06 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (AC_OBJEXT): Correct documentation. + +1999-01-05 Ben Elliston <bje@cygnus.com> + + * Version 2.13. + +1999-01-04 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (AC_CHECK_FILE): Document. + (AC_CHECK_FILES): Likewise. + (AC_SEARCH_LIBS): Likewise. + (AC_FUNC_SELECT_ARGTYPES): Use Jeff Garzik's version. + (AC_C_STRINGIZE): Likewise. + (AC_CYGWIN): Document. + (AC_EXEEXT): Likewise. + (AC_OBJEXT): Likewise. + (AC_MINGW32): Likewise. + (AC_TRY_LINK_FUNC): Likewise. + (AC_VALIDATE_CACHED_SYSTEM_TUPLE): Likewise. + +1999-01-01 Ben Elliston <bje@cygnus.com> + + * NEWS: Update. + + * acspecific.m4 (AC_PROG_CXX_WORKS): Specify an explicit return + type for `main' to keep modern C++ compilers happy. + +1998-12-28 Jeff Garzik <jgarzik@pobox.com> + + * autoconf.texi: + (AC_SEARCH_LIBS, AC_CHECK_FILE, AC_CHECK_FILES, + AC_TRY_LINK_FUNC): Document. + (AC_CHECK_LIB): Indicate the absence of + action-if-not-found will not kill default action. + (AC_SYS_INTERPRETER): Alphabetize with rest of section, + s/ac_cv_sys_interpreter/interpval/ + + * acgeneral.m4: + (AC_TRY_LINK_FUNC): Fix arg transposition. + (AC_SEARCH_LIBS): Require autoconf 2.13, add other-libs arg. + (AC_CHECK_FILES): Add underscore to HAVE_file define. + + * acspecific.m4: + (AC_SYS_INTERPRETER): New shell var 'interpval' stores + internal var ac_cv_sys_interpreter. + +1998-12-27 Ben Elliston <bje@cygnus.com> + + * autoconf.texi (AC_PROG_INSTALL): Update. + (AC_FUNC_ALLOCA): Correct code fragment. + (AC_FUNC_SELECT_ARGTYPES): Document. + (AC_C_STRINGIZE): Likewise. + (AC_VALIDATE_CACHED_SYSTEM_TUPLE): Likewise. + + * acspecific.m4 (AC_CYGWIN): Rename from `AC_CYGWIN32'. + (AC_CYGWIN32): Warn about deprecated usage. Forward to AC_CYGWIN. + + * config.sub: Drop `32' from `Cygwin32'. + + * config.guess: Likewise. + Handle BSD/OS variants for non-x86 machines. Contributed by Chris + P. Ross. + + * NEWS: Update. + + * configure: Rebuild. + +1998-12-26 Ben Elliston <bje@cygnus.com> + + * autoreconf.sh (stamp): Add missing quote. + + * mkinstalldirs: Write output which is not diagnostic to standard + output and not standard error. Suggested by Steve Robbins. + +1998-12-11 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * acconfig.h, acgeneral.m4, acspecific.m4, autoconf.texi: Change + all of the Fortran 77 code to use the new `F77' prefix instead of + the older `FC' prefix. + +1998-12-11 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (AC_ACVERSION): Bump to 2.13. + + * autoconf.texi (EDITION): Likewise. + (VERSION): Likewise. + +1998-10-30 Jeff Garzik <jgarzik@pobox.com> + + * autoconf.texi: Document AC_CACHE_LOAD and AC_CACHE_SAVE. Explain + how AC_CACHE_SAVE can be used as a means of syncing the cache to + disk prior to doing something potentially fatal in configure. + +1998-10-29 Alexandre Oliva <oliva@dcc.unicamp.br> + + * autoreconf.sh: Support several automake command line options, + and run aclocal and automake when needed. Also, create stamp files + just like automake's Makefiles would do for config headers. + Additional contributions from Tom Tromey. + +1998-10-24 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * acgeneral.m4 (AC_LANG_FORTRAN77): Remove [] (i.e. the m4 quotes) + since it was confusing the test suite. Also make `f77' the default + for FC, otherwise the test suite fails. + + * autoconf.texi (Fortran 77 Compiler Characteristics): Added new + node documenting the new AC_F77_LIBRARY_LDFLAGS macro. + + * acspecific.m4 (AC_F77_LIBRARY_LDFLAGS): New macro to determine + the linker flags (e.g. `-L' and `-l') for the Fortran 77 intrinsic + and run-time libraries. + +1998-10-24 Ben Elliston <bje@cygnus.com> + + * acspecific.m4 (AC_FUNC_SELECT_ARGTYPES): New macro. Detects the + types of formal arguments to select(). Contributed by Lars Hecking. + + * acconfig.h (SELECT_TYPE_ARG1): Add. + (SELECT_TYPE_ARG234): Likewise. + (SELECT_TYPE_ARG5): Likewise. + + * config.guess: Hide warnings emitted by the HP linker when + generating a PA 2.0 object file. Contributed by Marcus Thiessel. + +1998-10-20 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (AC_LANG_RESTORE): Fix a typo spotted by Noah + Elliott. + +1998-10-09 Tom Tromey <tromey@cygnus.com> + + * Makefile.in (autoconf.m4f): New target. + (autoheader.m4f): Likewise. + +1998-10-08 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (AC_TRY_LINK_FUNC): Fix macro ordering. + +Sun Oct 4 21:57:20 1998 Tom Tromey <tromey@cygnus.com> + + * autoconf.texi (Defining Symbols): Documented third argument to + AC_DEFINE. + * autoheader.m4 (AC_DEFINE_UNQUOTED): Generate `verbatim' + assignment if third argument given. + (AC_DEFINE): Likewise. + * acgeneral.m4 (AC_DEFINE): Handle case where $# is 3. + (AC_DEFINE_UNQUOTED): Likewise. + * autoheader.sh: Echo $verbatim if not empty. + +1998-10-03 Ben Elliston <bje@cygnus.com> + + * acconfig.h (FC_NO_MINUS_C_MINUS_O): Add to complete the Fortran + 77 support. + + * README: Update bug reporting address. Include maintainer info. + +1998-10-02 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (AC_VALIDATE_CACHED_SYSTEM_TUPLE): New macro. This + macro can be used to ensure that a configure script will not run + on a second system without removing the cache and re-running + configure. Contributed by Alexandre Oliva. + +1998-09-29 Ben Elliston <bje@cygnus.com> + + * acgeneral.m4 (AC_SEARCH_LIBS): New macro. Searches a series of + libraries for a given function. Contributed by Jim Blandy. + (AC_TRY_LINK_FUNC): New macro. Again, from Jim. + +1998-09-28 Ben Elliston <bje@cygnus.com> + + * config.guess: Detect multiprocessor DC/OSx running on Pyramid + MIServer machines. Contributed by Graham K. Jenkins. + + * acgeneral.m4 (AC_CHECK_PROG): Fix a bug if the supplied path + contains colons. This was observed with some versions of NetBSD + `sh' and some versions of `bash'. + (AC_PATH_PROG): Likewise. Contributed by Tom Yu. + +1998-09-27 Ben Elliston <bje@cygnus.com> + + * Makefile.in (all): Generate frozen .m4 files at build time. + (install): Do not freeze .m4 files. Install pre-frozen .m4f files + using $(INSTALL_DATA). + (.m4.m4f): Freeze files if m4 supports stored internal state. + Contributed by Karl Heuer. + + * install-sh: Import latest version from the FSF. + + * mkinstalldirs: Likewise. + + * config.guess: Apply the sysconf(2) test to HP 9000/600-series, + 9000/802, 9000/804 and 9000/892 machines. Contributed by Pavel + Roskin. + Detect UnixWare 7. Contributed by Paul Gampe. + + * acspecific.m4 (AC_PROG_INSTALL): Substitute `INSTALL_SCRIPT'. + Contributed by Franc,ois Pinard + (AC_C_STRINGIZE): New macro to test the availability of the + stringizing operator in the C preprocessor. Contributed by Arnold + Robbins on behalf of the GNU AWK project. + + * acconfig.h (HAVE_STRINGIZE): Add for the AC_C_STRINGIZE macro. + + * testsuite/Makefile.in (check): If DejaGNU is not installed, + print a warning and skip the `dejacheck' target (which will fail). + (site.exp): Use tests to guard commands from generating error + messages if `site.exp' or `site.bak' do not exist. Contributed by + Karl Heuer. + (dejacheck): Remove unused target. + +1998-09-26 Ben Elliston <bje@cygnus.com> + + * texinfo.tex: Import latest version from the FSF. + + * config.guess: Treat all SPARC variant processors running BSD/OS + as just `sparc' for compatibility reasons. Contributed by Chris + Torek. + + * acgeneral.m4 (AC_CHECK_FILE): New macro. Checks for the + existence of a file in the file system (native only). + Contributed by Ken Raeburn. + (AC_CHECK_FILES): Likewise. + +1998-09-15 Didier Verna <verna@inf.enst.fr> + + * acspecific.m4 (AC_PATH_XTRA): use X_EXTRA_LIBS add-on libraries + in the test for libICE. It is needed at least under Solaris. + +1998-09-15 Ben Elliston <bje@cygnus.com> + + * config.guess: Handle strange processor ID assignments on AIX + machines. Contributed by Didier Desseaux. + +Sat Sep 12 16:25:00 1998 Aaron Crane <aaronc@pobox.com> + + * acgeneral.m4 (AC_CHECK_TYPE): Changed the egrep regex to avoid + incorrectly assuming that if foobar_t is defined, then so is + bar_t. + +Tue Sep 8 14:06:04 1998 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * acgeneral.m4: Make the following macros Fortran 77 aware + (i.e. conditionalize whether to `#include "confdefs.h"', etc.): + (AC_TRY_COMPILE) + (AC_TRY_LINK) + (AC_CHECK_LIB) + + * acgeneral.m4 (AC_LANG_FORTRAN77): Rename `AC_LANG_FORTRAN' to + `AC_LANG_FORTRAN77'. Change the Fortran 77 language macro from + `FORTRAN' to `FORTRAN77'. + (AC_LANG_RESTORE): Change the Fortran 77 language macro from + `FORTRAN' to `FORTRAN77' + + * autoconf.texi: Updated Fortran 77 documentation, particularly + for `AC_TRY_COMPILE', `AC_TRY_LINK' and `AC_CHECK_LIB'. + +Thu Sep 3 09:34:39 1998 Matthew D. Langston <langston@SLAC.Stanford.EDU> + + * autoconf.texi: Added Fortran 77 documentation. + + * acspecific.m4 (AC_PROG_FC): New macro. Determine a Fortran + compiler to use. + (AC_PROG_FC_WORKS): New macro. + (AC_PROG_FC_GNU): New macro. + (AC_PROG_FC_G): New macro. + (AC_PROG_FC_C_O): New macro. + + * acgeneral.m4: Add FFLAGS (Fortran 77 flags). + (AC_LANG_FORTRAN): New macro. + (AC_LANG_RESTORE): Make Fortran 77 aware. + (AC_TRY_COMPILER): Make Fortran 77 aware (i.e. conditionalize + whether to `#include "confdefs.h"'). + +Thu Jun 18 12:13:27 1998 Ian Lance Taylor <ian@cygnus.com> + + * acspecific.m4 (AC_EXEEXT): Correct setting of ac_exeext when + there is no extension. + +Mon Jun 1 12:30:39 1998 Ian Lance Taylor <ian@cygnus.com> + + * acgeneral.m4 (AC_CHECK_PROG): Set IFS to just ":" when searching + through PATH. + (AC_PATH_PROG): Likewise. + * acspecific.m4 (AC_PROG_INSTALL): Likewise. + (AC_PROG_CC): On cygwin32, if neither gcc nor cc + are found, look for cl. + (AC_PROG_CXX): Look for cl after all other choices. + * configure: Rebuild. + +Thu May 28 18:37:36 1998 Ian Lance Taylor <ian@cygnus.com> + + * acgeneral.m4 (AC_ACVERSION): Bump to 2.12.2. + + Add support for Visual C++: + * acgeneral.m4 (ac_exeext, ac_objext): New variables. + (ac_link): Use ac_exeext. + (AC_TRY_COMPILER, AC_TRY_LINK, AC_TRY_RUN_NATIVE): Likewise. + (AC_TRY_CPP): Remove lines from stderr which contain only the name + of the file. + (AC_REPLACE_FUNCS): Use ac_objext. + * acspecific.m4 (AC_PROG_CC): Check whether compiler supports -g + even if it is not gcc. + (AC_PROG_CXX): Likewise. + (AC_PROG_CPP): Try running the compiler with the -nologo option. + (AC_FUNC_ALLOCA): Check for _MSC_VER. Use ac_objext. + (AC_FUNC_MEMCMP): Use ac_objext. + (AC_STRUCT_ST_BLOCKS): Likewise. + (AC_OBJEXT): New macro. + (AC_CYGWIN32, AC_MINGW32, AC_EXEEXT): New macros. + * configure: Rebuild. + + * Makefile.in (editsh): Substitute for SHELL. + (Makefile, config.status): Use $(SHELL) when running + config.status. + * autoconf.sh: Change initial /bin/sh to @SHELL@. + * autoheader.sh: Likewise. + * autoreconf.sh: Likewise. + * autoupdate.sh: Likewise. + * ifnames.sh: Likewise. + +Thu Apr 30 16:29:00 1998 Syd Polk <spolk@cygnus.com> + + * acspecific.m4 (SETPGRP_VOID): The test for setpgrp needs + to have unistd.h included or the DEC compiler does not + flag the error that triggers setting the variable. + +Tue Nov 18 14:21:38 1997 Eric Mumpower <nocturne@cygnus.com> + + * autoreconf.sh: Do the right thing when AC_CONFIG_HEADER is + given more than one filename. As noted in the "Invoking + autoheader" node of the info files, autoheader will use the first + file argument given to AC_CONFIG_HEADER. Prior to this patch, + autoreconf would end up executing incorrect shell code (e.g. + "test ! -f 1.h 2.h.in") in such cases. + Patch submitted in parallel to bug-gnu-utils@prep.ai.mit.edu. + +Fri Oct 3 18:10:39 1997 Ian Lance Taylor <ian@cygnus.com> + + * acgeneral.m4 (AC_CACHE_SAVE): Add a grep when checking whether + set quotes correctly, to avoid a cache overflow on HP-UX 9. + * configure: Rebuild. + +Wed Sep 11 15:35:19 1997 Chris Provenzano <proven@cygnus.com> + + * acgeneral.m4 : Always set SHELL and substitute SHELL. + When looking for a path for an executable allow the + user to override with an DOS path. + * configure : New configure generated by autoconf. + +Thu Sep 4 22:30:40 1997 Jeffrey A Law (law@cygnus.com) + + * acspecific (AC_PROC_INSTALL): Don't use installbsd on OSF. + +Wed Sep 3 23:00:44 1997 Chris Provenzano <proven@cygnus.com> + + * configure : New configure generated by autoconf. + * Makefile.in : Set SHELL=@SHELL@. configure now substiutes + ${CONFIG_SHELL-/bin/sh} in for @SHELL@ at configure time. + +Mon Aug 11 01:40:37 1997 Jason Molenda <crash@cygnus.co.jp> + + * acspecific (AC_FUNC_VFORK): If cross-compiling, set + $ac_cv_func_vfork_works to $ac_cv_func_vfork (assume vfork works + if present). + +Tue Aug 5 23:00:05 1997 Ian Lance Taylor <ian@cygnus.com> + + * acgeneral.m4 (AC_VERSION): Set to 2.12.1. + (AC_CANONICAL_HOST): Use CONFIG_SHELL to run $ac_config_sub and + $ac_config_guess. + (AC_CANONICAL_TARGET, AC_CANONICAL_BUILD): Likewise. + +Tue Dec 10 19:38:59 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_CACHE_SAVE): Use grep to prevent overflowing + HP-UX 9.05 /bin/sh buffer in case statement. From Eric Backus. + +Mon Dec 9 23:39:17 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Add a semicolon between + shell variable assignments; the evaluation order varies between + implementations. + +Tue Nov 26 13:00:28 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * Version 2.12. + +Wed Nov 20 13:00:21 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * Test release 2.11.2. + + * acgeneral.m4 (AC_OUTPUT): Remove a now-wrong test for whether to + make an unquoted here document. + (AC_CACHE_SAVE): Double-up backslashes in double quotes. + From Paul Eggert. + + * Test release 2.11.1. + + * acgeneral.m4 (AC_TRY_COMPILE, AC_TRY_LINK): Make the final + newline consistent with the other AC_TRY_* macros: no final dnl + is needed to avoid extraneous blank lines. + (AC_CHECK_LIB, AC_HAVE_LIBRARY, AC_COMPILE_CHECK): Remove + extraneous dnl's. + (AC_DIVERSION_CMDS, AC_DIVERSION_ICMDS): New macros. + (AC_OUTPUT_COMMANDS, AC_OUTPUT): Use them instead of appending to + list macros. + + * acgeneral.m4 (AC_CACHE_SAVE): Handle cache variable values + correctly even if they contain single quote, or are quoted by + the shell. From Paul Eggert. + (AC_INIT_PREPARE): Set LC_MESSAGES to C if set. + From Hans Olsson. + Set LC_CTYPE to C if set. + From Thomas Winder. + * autoconf.sh, autoheader.sh: Likewise set LC_MESSAGES and LC_CTYPE. + +Tue Nov 19 10:29:06 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * testsuite/autoconf.g/sizeof.exp: Use the v2 macro name. + + * acgeneral.m4 (AC_OUTPUT_FILES, AC_OUTPUT_HEADER): Support + creating output files from multiple pieces, concatenated. + Suggested by Theodore Ts'o. + (AC_LINK_FILES): If called more than once, concatenate the + arguments. From Roland McGrath. + (AC_CONFIG_SUBDIRS): Likewise. + (AC_OUTPUT_COMMANDS): New macro. Suggested by + Tom Tromey. + (AC_OUTPUT): Use the lists it sets. + + * acgeneral.m4 (AC_TRY_RUN_NATIVE): Fail if linking fails, like + AC_TRY_LINK. + (AC_TRY_RUN): Don't require AC_C_CROSS. + (AC_TRY_COMPILER): New macro. + (AC_LANG_C, AC_LANG_CPLUSPLUS): Set cross_compiling. + * acspecific.m4 (AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS): Use + AC_TRY_COMPILER instead of AC_TRY_LINK. + (AC_PROG_CC_GNU, AC_PROG_CC_G): Split out of AC_PROG_CC. + (AC_PROG_CXX_GNU, AC_PROG_CXX_G): Split out of AC_PROG_CXX. + For the *_G macros, make the cache variable names non-GNU-specific. + (AC_C_CROSS): Mark obsolete, and otherwise a no-op. + + * AUTHORS: New file. + * Makefile.in (DISTFILES): Add it. + + * acspecific.m4 (AC_FUNC_MMAP): Update the getpagesize + declarations from getpagesize.h. Check for unistd.h. + + * acgeneral.m4 (AC_OUTPUT_FILES): Run the eval in a subshell. + + * acfunctions: Map fnmatch, strftime, getpgrp, setpgrp to their + own macros. + + * acgeneral.m4 (AC_OUTPUT_HEADER): Check that $CONFIG_HEADERS is + unset, not that it's empty. + +Mon Nov 18 10:24:50 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * Version 2.11. + +Sun Nov 17 20:12:05 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acspecific.m4 (AC_FUNC_STRCOLL): Make the checking message more + accurate. + +Thu Nov 14 11:15:27 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acheaders: Add entry for malloc.h. Make the strings.h entry + suggest AC_CHECK_HEADERS instead of AC_HEADER_STDC. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Move initialization of + ac_max_here_lines here from AC_OUTPUT_HEADER. + + * autoheader.sh: Take the multiple-include protection back out. + It's not needed for a file that just #defines stuff, and, as Ken + Raeburn pointed out in Apr 1994: + Since you don't make it optional, and you don't give the writer of + configure.in much control over the name of the symbol, it also would + prevent one "config.h" file in a subdirectory from including + "../config.h" as a way to avoid duplicating some common tests. + + * acspecific.m4 (AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS): Don't try + running a program, just try linking. + (AC_C_CROSS): Make the wording clearer. + +Wed Nov 13 10:07:14 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acspecific.m4 (AC_PROG_CC, AC_PROG_CXX): Check whether the + compiler works before checking whether it's a GNU compiler. + (AC_FUNC_VFORK): Call _exit after perror. + (AC_PATH_XTRA): Go back to using -R, as setting an env var as part + of CC doesn't get eval'd correctly to actually work. + Directly test whether a space is needed after -R. + Don't add "-L" to LDFLAGS if $x_libraries is empty. + (AC_FUNC_STRFTIME): Check for it in -lintl only if it's not in the + normal libraries. + + * Test release 2.10.3. + + * testsuite/Makefile.in (dejacheck): New target, suggested by Tom + Tromey. + (check): Depend on dejacheck. + +Tue Nov 12 00:06:14 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_OUTPUT_FILES): Split the list of sed commands in + conftest.subs into multiple files named conftest.s[1-9][0-9]*. + Create a pipeline of sed commands that use these files, then delete + the temporary files. From John W. Eaton. + + * acspecific.m4 (AC_AIX, AC_MINIX): Remove warnings about AC_TRY_LINK. + These macros don't change the linkage options. + + * Test release 2.10.2. + + * acspecific.m4 (AC_PROG_CC, AC_PROG_CXX) [GCC]: Use -O2 instead + of -O. Suggested by fnf@ninemoons.com (Fred Fish). + + * acgeneral.m4 (AC_OUTPUT_HEADER): Support passing + AC_CONFIG_HEADER a value containing shell variables. Suggested by + Markku Savela and Julian Onions. + * acgeneral.m4 (AC_TRY_RUN_NATIVE, AC_TRY_LINK, AC_TRY_COMPILE, + AC_TRY_CPP): Show the test program in config.log if the test fails. + From Karl Berry. + + * testsuite/config/unix.exp: Run the configure script as "./script" + in case the user doesn't have "." in their PATH. + +Mon Nov 11 18:02:58 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_TRY_COMPILE, AC_TRY_LINK): Deal with smart + compilers that know that an unused function doesn't have to be + linked in: call the function directly from main(). + (Removing a legacy from when they tried to run the code, I think-djm.) + From fnf@ninemoons.com (Fred Fish). + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Rename ac_save_LIBS to avoid + a clash with AC_CHECK_LIB. + From Jim Meyering. + (AC_FUNC_FNMATCH, AC_FUNC_MMAP, AC_FUNC_VFORK, AC_FUNC_WAIT3, + AC_FUNC_STRCOLL, AC_FUNC_MEMCMP): Rename cache variables to avoid + wrong results if someone calls AC_CHECK_FUNC for these functions. + + * autoheader.sh: Don't cmp with config.h.in if it doesn't exist yet. + Don't frob lines 1-@TOP@ or @BOTTOM@-end of acconfig.h's. + Accept TAB as well as SPC after #undef in acconfig.h's. + +Sat Nov 9 01:54:04 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * Test release 2.10.1. + + * acspecific.m4 (AC_PROG_CC_WORKS, AC_PROG_CXX_WORKS): New macros + adapted from Bruno Haible. + (AC_PROG_CC, AC_PROG_CXX): Use them. + * acgeneral.m4 (AC_TRY_RUN_NATIVE): Split out of AC_TRY_RUN. + (AC_TRY_LINK): Check that the executable exists after linking. + (AC_EGREP_CPP): Disable m4 quote chars around egrep, so [] in regexps + isn't eaten. + + * autoheader.sh: Add multiple-inclusion protection for config.h. + + * acgeneral.m4 (AC_PREFIX_PROGRAM): Pretty up the output. + (AC_CHECK_LIB): Include the function being tested in the message. + (AC_CHECK_PROG, AC_PATH_PROG): Add a dummy variable to force word + splitting on the path. + + * acspecific.m4 (AC_FUNC_MMAP): Remove check and uses of valloc. + It turns out it's a separate issue, for GNU grep. + Replace the test program with a new version from Mike Haertel. + + * acgeneral.m4 (AC_CACHE_SAVE): Accept the HP-UX sh 'set' output + format. From Marcus Daniels. + + * acgeneral.m4 (AC_MSG_CHECKING, AC_CHECKING): Write a message to + config.log also. From T.E.Dickey. + (AC_CHECK_LIB, AC_CHECK_HEADER, AC_CHECK_HEADERS): Replace use of + tr with sed, to avoid a bug in the AIX 4.1.3.0 tr reported by + Alain Knaff. He says that version of tr interprets \055 as a + range specifier, like an unquoted -. + * acspecific.m4 (AC_PROG_MAKE_SET, AC_CHECK_HEADER_DIRENT, + AC_CHECK_HEADERS_DIRENT): Ditto. + + * acspecific.m4 (AC_FUNC_SETPGRP): New macro. + * acconfig.h (SETPGRP_VOID): New entry. + From T.E.Dickey. + + * acspecific.m4 (AC_PATH_X_DIRECT): Try /lib/usr/lib/X11 for A/UX. + From Guillermo Gomez. + (AC_PATH_XTRA): Replace -R with adding LD_RUN_PATH to CC in the + Solaris kludge. Suggested by Paul Eggert. + Define X_DISPLAY_MISSING with AC_DEFINE, and + if not using X, clear out the X variables. + Check system-dependent libs before system-independent ones. + Check for more system-dependent libs. + From Karl Berry. + Use AC_CHECK_FUNC in the system-dependent libs tests. + From Larry Schwimmer. + Wart removal: Don't require AC_ISC_POSIX. + (AC_ISC_POSIX): Require AC_PROG_CC, since it uses $GCC. + From gvran@uddeborg.pp.se. + Don't blather about being called before AC_TRY_LINK, + which is now called in AC_PROG_CC. Don't encourage using this macro. + * acconfig.h (X_DISPLAY_MISSING): Add entry. + +Fri Nov 8 16:02:08 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acspecific.m4 (AC_PATH_X_DIRECT): Search for /usr/X11 before + /usr/X11Rn, etc. From bostic@bsdi.com (Keith Bostic). + + * acgeneral.m4 (AC_CHECK_TYPE) [STDC_HEADERS]: Check in stddef.h, too. + From Glenn P. Davis. + Don't require the second char after the type name to be a space. + (AC_TRY_RUN): Remove the test files before executing the "failure" + case code. + + * acspecific.m4 (AC_PROG_CXX): Check for cc++ for NexT. + From Carl Edman. + (AC_PROG_CC, AC_PROG_CXX): Check whether -g works even if + C[XX]FLAGS is set. From T.E.Dickey. + (AC_FUNC_FNMATCH): New macro. + * acconfig.h (HAVE_FNMATCH): New entry. + + * acgeneral.m4 (AC_REPLACE_FUNCS): Call AC_CHECK_FUNCS to do the work. + +Tue Oct 29 13:03:44 1996 Doug Evans <dje@canuck.cygnus.com> + + * acgeneral.m4 (AC_OUTPUT_SUBDIRS): Fix thinko in computation of + ac_sub_srcdir in relative but not "." case. + +Thu Oct 10 22:29:37 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_CANONICAL_HOST, AC_CANONICAL_TARGET, + AC_CANONICAL_BUILD): Allow the os part of the string returned by + config.sub to contain dashes, as in "linux-gnu". + +Fri Jul 19 16:59:00 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_TYPE): Add dnl so regexp doesn't have a + leading newline. + +Wed Jun 12 13:56:57 1996 David J MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_CHECK_TYPE): Remove extra ')'. + + * Many files: Update the FSF street address. + +Sun Jun 9 17:54:23 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_LIB): Add missing \ in last change. + +Fri Jun 7 11:54:58 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_LIB): Identifierize lib name in $ac_tr_lib. + +Mon May 27 13:49:02 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + + * acspecific.m4 (AC_SYS_LONG_FILE_NAMES): If $TMPDIR names an + existing, writable directory, then test it instead of /tmp, /var/tmp, + and /usr/tmp for long file name support. + + * acgeneral.m4 (AC_PREREQ): Prepend "FATAL ERROR: " to msg. + +Sun May 26 19:07:15 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + + * acspecific.m4 (AC_PROG_MAKE_SET): Sanitize $MAKE for use as + identifier. + + * acgeneral.m4 (AC_CHECK_TYPE): Tighten regexp so ulong doesn't match + ulong_t. + + * autoheader.sh: Put $syms in a temporary file and use fgrep -f. + +Tue May 7 13:20:33 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> + + * acgeneral.m4: Version 2.10 released. + +Tue Mar 26 13:03:12 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_OUTPUT_HEADER): Make subdir if necessary. + +Thu Mar 21 10:52:03 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Fix name of -lelf cache variable + name in test of it. + (AC_PATH_XTRA): Fix name of -ldnet cache variable name in test of it. + +Wed Mar 20 09:37:31 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_LIB): Use \055 for -; leading and trailing + both lose with some tr. + + * acspecific.m4 (AC_C_CONST): Remove check for gcc 2.7 bug. + RMS wants everyone to lose until gcc is fixed. + + * acgeneral.m4 (AC_CHECK_LIB): Put - last in tr set so it is not + considered a range. + + * acspecific.m4 (AC_C_CONST): Add check for gcc 2.7 bug. + From Paul Eggert and Jim Meyering. + + * acgeneral.m4 (AC_CHECK_LIB): Omit `char $2' decl when $2 is `main'. + +Wed Mar 13 22:10:42 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * acgeneral.m4 (AC_CHECK_LIB): Put quotes around _ when + constructing cache variable name, to separate it from preceding + text. + +Sat Mar 16 15:53:22 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * Version 2.9 released. + * acgeneral.m4 (AC_ACVERSION): Updated to 2.9. + +Wed Mar 13 12:49:51 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_OUTPUT_HEADER): Undo last change to $ac_dB, + and instead change the code written into conftest.hdr. + +Tue Mar 12 02:51:24 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_OUTPUT_HEADER): Apply Jan 15 fix to + AC_OUTPUT_MAKE_DEFS here too: Match `#define foo' without trailing + space in confdefs.h. Before configure would lose if all its trailing + whitespace got stripped, and that can happen in mail. + +Sun Mar 10 20:30:09 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_INIT_NOTICE): Add 95 and 96 to copyright years. + +Sat Mar 9 18:28:42 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_LIB): Add missing [. + +Fri Mar 8 15:06:48 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_LIB): Declare $2 to override gcc2 internal + prototype. + + * Version 2.8 released. + +Wed Mar 6 14:38:31 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_LIB): Use a cache variable name containing + both the library and function name. + +Tue Jan 16 16:39:21 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_PROG): Take optional 6th arg, full name + of program to reject if found in search path. + * acspecific.m4 (AC_PROG_CC): If gcc not found use AC_CHECK_PROG + for cc, rejecting /usr/ucb/cc. + Fatal configure error if no $CC found at all. + +Mon Jan 15 15:57:36 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS): Match `#define foo' without + trailing space in confdefs.h. Before configure would lose if + all its trailing whitespace got stripped, and that can happen in mail. + +Fri Jan 12 14:38:37 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_TRY_CPP): Use "" instead of '' when setting + ac_try; we need one level of expansion there for $ac_cpp, then + AC_TRY_EVAL does one more for its the expansion of $ac_cpp. + +Thu Jan 11 10:38:19 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_LANG_C, AC_LANG_CPLUSPLUS): Removed echo cmds + from $ac_cpp, $ac_compile, and $ac_link. + (AC_TRY_EVAL, AC_TRY_COMMAND): New macros for running tests' commands. + Always put the configure source line and command line into config.log. + (AC_TRY_CPP, AC_TRY_COMPILE, AC_TRY_LINK): Use them. + * acspecific.m4: Use AC_TRY_EVAL and AC_TRY_COMMAND for running + all tests. + +Fri Jan 5 17:50:28 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acspecific.m4 (AC_PATH_X, AC_PATH_X_XMKMF, AC_PATH_X_DIRECT): + Rearrange logic: do no tests if $with_x=no; make incl and lib + tests independent, and distinguish unset from empty. + + * autoconf.sh (undefined macro check): \ sed \s inside "". If + grep $name in $infile misses, give error message that there must + be an Autoconf bug. + +Tue Dec 19 10:49:20 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * autoconf.sh: Ignore undefined macros in shell comments. + +Mon Dec 11 22:12:54 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acspecific.m4 (AC_PROG_CC_C_O): Rearrange logic to get the right + answer for cc. + +Fri Nov 24 17:26:38 1995 Miles Bader <miles@gnu.ai.mit.edu> + + * autoconf.sh: Define $AWK from the subst @AWK@, and use it. + +Wed Nov 22 11:01:16 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * Version 2.7. + + * autoheader.m4 (AC_CHECK_FUNCS, AC_CHECK_HEADERS): Expand the + optional action args. From jj@jfch.vc.cvut.cz (Jakub Jelinek). + + * acgeneral.m4 (AC_CHECK_LIB): Translate - in library names to _. + (AC_ARG_PROGRAM): Use cat instead of echo to avoid SysV echo + interpreting backslashes. From kim@tac.nyc.ny.US (Kimmo Suominen). + (AC_OUTPUT_FILES): Quote $ and \ for being in an unquoted here + document. From Paul Eggert. + + * acspecific.m4 (AC_PATH_X_XMKMF): Use ${MAKE-make}, not plain make. + (AC_C_CONST): Avoid a warning from g++. + From tgl@sss.pgh.pa.us (Tom Lane). + (AC_FUNC_MMAP): Check for valloc and getpagesize; don't rely on + predefines. + (AC_HEADER_STDC): If cross-compiling, assume the ctype macros are + ANSI. From dje@cygnus.com (Doug Evans). + (AC_TYPE_SIGNAL) [__cplusplus]: Give a full prototype. + From churritz@cts.com (Chad Hurwitz). + (AC_FUNC_VFORK): If cross-compiling, use AC_CHECK_FUNC instead. + From Steve Chamberlain. + +Tue Sep 5 20:37:48 1995 Paul Eggert <eggert@twinsun.com> + + * acspecific.m4 (X_LIBS): Use `-R lib', not `-Rlib', since Sun + CC 3.0 requires this. + +Tue Aug 8 20:10:12 1995 Paul Eggert <eggert@twinsun.com> + + * acgeneral.m4: When creating config.status, start a new + here-script just before building conftest.subs, to work around + a bug in the HP-UX 9 HP9000-800 sh. + +Tue Nov 21 17:36:41 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * Makefile.in (install): Undo last ASCRIPTS panic change. + The bug reporter hadn't cleaned up his source dir. + +Mon Nov 20 15:26:50 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * Version 2.6. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Prettify usage message somewhat. + + * Makefile.in: Use @bindir@, @datadir@, @infodir@. + (install): Find ASCRIPTS in $(srcdir). + +Sat Nov 18 14:21:55 1995 Karl Berry <karl@cs.umb.edu> + + * autoconf.sh: Allow lowercase letters in the undefined-macro name. + +Fri Nov 17 15:05:44 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * Version 2.5 released. + +Fri Nov 17 15:23:04 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_CHECK_LIB): Don't start tr argument with '+', + so as not to confuse old GNU tr's. From + Ian Lance Taylor. + (AC_INIT_PARSE_ARGS): Make sure MFLAGS and MAKEFLAGS are empty. + From Paul Townsend (aab@cc.purdue.edu). + (AC_CHECK_LIB, AC_CHECK_HEADERS, AC_CHECK_FUNC): Remove + duplicate `d' from alphabets. + + * acspecific.m4 (AC_USG): Define USG if we don't have rindex and + bzero, not if we do have them. + From Viktor Dukhovni. + +Sun Oct 29 15:13:37 1995 Richard Stallman <rms@mole.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_PROG): Use arg 5 as search list, not arg 4. + +Wed Aug 30 17:34:48 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acspecific.m4 (AC_PROG_CC_C_O): If $CC groks it and cc doesn't + exist, choose yes. + +Wed Jul 26 00:03:26 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * Test release 2.4.2. + + * acgeneral.m4 (AC_CHECK_SIZEOF): Take an optional size to + use when cross-compiling. + + * acspecific.m4 (AC_FUNC_CLOSEDIR_VOID, AC_DIR_HEADER): If + cross-compiling, assume it returns void. It's not a big loss. + From Karl Berry. + + * acgeneral.m4 autoheader.sh: Change tr [a-z] [A-Z] into expansion + of the full alphabet, to combat losing AIX 4.1.1 tr when LANG + isn't set the way it likes. + + * acspecific.m4 (AC_FUNC_GETMNTENT): Check in -lgen for Unixware. + From miguel@roxanne.nuclecu.unam.mx (Miguel de Icaza). + + * autoheader.m4 (AC_CONFIG_HEADER): Set config_h to the first + argument. From ghudson@mit.edu (Greg Hudson). + + * Makefile.in (all): Depend on info. + + * acgeneral.m4 (AC_CHECK_PROG, AC_PATH_PROG, AC_CHECK_PROGS, + AC_PATH_PROGS, AC_CHECK_TOOL): Add optional PATH + parameter. + +Mon Jul 24 17:27:11 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_CHECK_LIB): Don't enclose tr args in [], for + SysV and POSIX. From Karl Heuer. + +Wed Jul 19 17:43:44 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_CHECK_LIB): Translate + to p in lib name. + +Wed Jun 28 13:45:16 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_ARG_ENABLE, AC_ARG_WITH): Allow an empty value + for --enable and --with args. + (AC_CACHE_CHECK): New macro. + * acspecific.m4: Use it where possible. + +Tue Jun 27 13:29:54 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_INIT_PARSE_ARGS, AC_INIT_PREPARE): Add options + --bindir, --libdir, etc. + +Mon Jun 26 20:54:36 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_LANG_C, AC_LANG_CPLUSPLUS): Put the command + being run into the log file. + +Thu Jun 22 22:33:23 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acspecific.m4 (AC_PROG_INSTALL): Don't cache a shell script path. + + * acgeneral.m4 (AC_CHECK_LIB): Allow lib name to contain a . or /, + by fixing the cache variable name. + +Wed Jun 14 23:07:20 1995 David J. MacKenzie <djm@geech.gnu.ai.mit.edu> + + * Version 2.4. + +Sun May 7 08:09:12 1995 David J. MacKenzie <djm@geech.gnu.ai.mit.edu> + + * acspecific.m4 (AC_PATH_X_XMKMF): Check for libX11.{so,sl} as + well as .a when seeing whether LIBDIR or USRLIBDIR is right. + +Sat May 6 17:29:07 1995 David J. MacKenzie <djm@geech.gnu.ai.mit.edu> + + * acspecific.m4 (AC_PROG_CPP): If CPP is already set, use that as + the value and set the cache variable to it. + +Mon Mar 27 10:48:36 1995 David J. MacKenzie <djm@churchy.gnu.ai.mit.edu> + + * Version 2.3. + + * acgeneral.m4 (AC_OUTPUT): Add quotes around the echo arguments + in the trap, so backslashes aren't required for multiline input. + From G.Wilford@ee.surrey.ac.uk. + Also use the sed trick when not using a config header file. + +Thu Mar 23 18:02:25 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_LANG_C, AC_LANG_CPLUSPLUS): Put "-c" right + after compiler name. Same for "-o conftest". + + * ifnames.sh (AC_MACRODIR): Default to @datadir@, not a hardcoded + path. + + * Test release 2.2.1. + + * acgeneral.m4 (AC_OUTPUT): Use sed, not tr, so we only remove the + output config header, not the input one too. From + muessig@ipf.bau-verm.uni-karlsruhe.DE (Peter Muessig). + (AC_LANG_C): Undo Feb 7 change. According to Roland McGrath, + most compilers require all options but -l... and -o to come first. + + * Makefile.in (uninstall): Don't use $@, since the cd makes it + invalid when srcdir is relative. + +Wed Mar 8 17:05:06 1995 David J. MacKenzie <djm@geech.gnu.ai.mit.edu> + + * Version 2.2. + +Wed Mar 8 12:44:34 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * Makefile.in: Follow cd commands with &&, not ;. + From Franc,ois Pinard. + +Tue Mar 7 11:48:19 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acspecific.m4 (AC_FUNC_ALLOCA): Keep sh variable name space + clean. Put newline after AC_DEFINE_UNQUOTED call to avoid Irix + syntax error. + +Mon Mar 6 15:07:00 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * Test release 2.1.3. + + * acspecific.m4 (AC_FUNC_ALLOCA): Replace nested AC_FUNC_CHECK + calls with a loop. + + * acspecific.m4 (AC_FUNC_VPRINTF): Don't check for signal munging. + From Paul Eggert. + + * acgeneral.m4 (AC_CACHE_SAVE): Tell the user whether the cache + changed or not. From gnu@toad.com (John Gilmore). + + * Makefile.in (install-info): Don't cd, to avoid breaking + install-sh references. + +Fri Mar 3 11:41:01 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * Makefile.in (autoconf.info, standards.info): Use --no-split to + avoid creating filenames > 14 chars. + + * acgeneral.m4 (AC_CHECK_FUNC): Use assert.h, + to avoid protype conflicts from ctype.h (!!) on OSF/1 3.0. + +Sat Feb 25 01:56:57 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acspecific.m4 (AC_C_BIGENDIAN): Check for BYTE_ORDER macro from + sys/param.h before trying the test program which cannot be + cross-compiled. + +Fri Feb 24 20:02:08 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_FUNC): Include errno.h instead of ctype.h + in test program. + +Wed Feb 22 18:01:27 1995 David J. MacKenzie <djm@geech.gnu.ai.mit.edu> + + * Test release 2.1.2. + +Tue Feb 21 13:00:07 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_CACHE_VAL): Add extra quotes to work around AIX + 4.1 bug reported by hyc@locus.com (Howard Chu). + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Check for -lelf before -lkvm. + Reported by Kaveh R. Ghazi. + (AC_HEADER_STAT): Check whether S_IFDIR is defined, to work around + ISC bug reported by rick@anasazi.com (Rick Coupland). + + * autoheader.sh: Better solution to @BOTTOM@ printing. + From Paul Eggert. + +Mon Feb 13 18:13:11 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acspecific.m4 (AC_PROG_CC_C_O): Use sed filter to make sure + ${ac_cc} is always a valid shell variable name. + (AC_PROG_MAKE_SET): Remove gratuitous backslashes in checking message. + +Sun Feb 12 18:42:35 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_TOOL_PREFIX): Require AC_CANONICAL_BUILD, + so both $build and $host are definitely set before we compare + them. + +Sat Feb 11 04:37:30 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_TOOL): Rewritten. Take optional third + arg VALUE-IF-NOT-FOUND. Check for + ${ac_tool_prefix}PROG-TO-CHECK-FOR first. If not found and third + arg given, and ${ac_tool_prefix} is nonempty, check for unadorned + PROG-TO-CHECK-FOR as well. Last choice use VALUE-IF-NOT-FOUND. + +Fri Feb 10 17:45:53 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_OUTPUT): Fix sed command to produce $ac_dots + for subdir configures. + +Thu Feb 9 14:42:20 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * testsuite/config/unix.exp (autoconf_load): Run the script with + /dev/null as the cache. + + * acgeneral.m4 (AC_CHECK_TOOL_PREFIX, AC_CHECK_TOOL): New macros, + from Roland McGrath. + + * acspecific.m4 (AC_DECL_YYTEXT): Cache the output file root. + (AC_C_INLINE): If the compiler doesn't recognize it, define it + away. Try __inline__ too. From Jim Avera. + (AC_FUNC_GETPGRP): New macro. From Arnold Robbins. + * acconfig.h: New entry for it. + + * configure.in: Check for new awk. + * Makefile.in (editsh): Substitute in AWK. + + * acspecific.m4 (AC_PROG_INSTALL): Allow trailing slashes in PATH + elements. + * acgeneral.m4 (AC_PREFIX_PROGRAM): Ditto. + +Tue Feb 7 11:32:09 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_CHECK_LIB, AC_HAVE_LIBRARY): Check and add the new + library before existing libs, not after, in case it uses them. + * acspecific.m4 (AC_FUNC_GETLOADAVG, AC_FUNC_GETMNTENT, + AC_FUNC_STRFTIME, AC_DYNIX_SEQ, AC_IRIX_SUN, AC_SCO_INTL): Ditto. + + * autoheader.sh: Allow @BOTTOM@ to be the first line in + acconfig.h. From iwj10@cus.cam.ac.uk (Ian Jackson). + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Add semicolons before + AC_DEFINE. Check for -lkvm before -lutil. Assume it needs setgid + if using -lutil. + + * acgeneral.m4 (ac_compile, ac_link): Put the file name before the + variables, so they can contain -l options. + + * acspecific.m4 (AC_FUNC_WAIT3): Sleep longer for HPUX. + (AC_TYPE_SIGNAL): Declare signal as extern "C" for C++. + + * Makefile.in testsuite/Makefile.in (maintainer-clean): Renamed + from realclean. + + * autoconf.sh (TMPDIR): Inherit from environment, or set if not. + + * acgeneral.m4 (AC_PREFIX_PROGRAM): Say we're checking the prefix. + + * acspecific.m4 (AC_ISC_POSIX): Fix typo. + (AC_PATH_X): Screen out bogus values from imake. + (AC_PROG_LEX): Check for yywrap, not main, in the library. + +Thu Feb 2 11:32:07 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acconfig.h (__CHAR_UNSIGNED): Protect with #ifndef. + From marcus@ee.pdx.edu (Marcus Daniels). + + * acgeneral.m4 (AC_CACHE_SAVE): Workaround Ultrix and 4.3BSD sh + bug in setting the high bit on variable values. + From Ken Raeburn. + (AC_OUTPUT_FILES, AC_OUTPUT_SUBDIRS): Ignore initial "./" to + avoid messing up the dot-dot counts. + (AC_OUTPUT_SUBDIRS): Pass INSTALL magic to subdirectories. + From Karl Berry. + + * ifnames.sh: Speed up drastically by folding 3N+2 processes into 2. + From Paul Eggert. + +Wed Feb 1 11:58:27 1995 David J. MacKenzie <djm@catapult.va.pubnix.com> + + * acgeneral.m4 (AC_ARG_ENABLE, AC_ARG_WITH): Add additional + quoting for internal consistency. + From junio@twinsun.COM (Jun Hamano). + + * acspecific.m4 (AC_PATH_XTRA): R6 function name was wrong. + From Karl Berry. + (AC_C_CROSS): Fix typo in cache var name. + From tgl@sss.pgh.pa.us (Tom Lane). + (AC_PROG_MAKE_SET): Change / in the make program name into _ so it + can be part of a shell variable name. + (AC_DECL_YYTEXT): Fix arguments to AC_TRY_LINK. + From interran@uluru.stanford.edu (John Interrante). + + * acgeneral.m4 (AC_CHECK_SIZEOF): If test program fails, set the + variable to 0 as the doc sez. + From eisen@cc.gatech.edu (Greg Eisenhauer). + + * acgeneral.m4, acspecific.m4: Remove *.core and core.* as well as + core, for recent BSD's. + + * acspecific.m4 (AC_SYS_INTERPRETER): Use `#! /' instead of `#!/'. + * acgeneral.m4 (AC_INIT_BINSH): Likewise. + * All scripts: likewise. + From woods@kuma.web.net (Greg A. Woods). + + * acgeneral.m4 (AC_INIT_PREPARE): Use fd 6 instead of 4, to + prevent a conflict on the Kubota Titan. From + muessig@ipf.bau-verm.uni-karlsruhe.DE (Peter Muessig). + + * autoconf.sh: Use a more concise syntax to set variables. + From Karl Berry. + + * acspecific.m4 (AC_FUNC_WAIT3): Check page fault measurements to + catch Linux. From tobias@server.et-inf.fho-emden.de (Peter Tobias). + + * acgeneral.m4 (AC_OUTPUT): If running config.status + fails, exit with a nonzero status. From Ken Raeburn. + +Tue Dec 6 19:07:07 1994 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Use elf_begin in -lelf + check, not elf_read. + +Mon Nov 7 18:18:11 1994 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acspecific.m4 (AC_PROG_MAKE_SET): Fix msg; $MAKE is not useful + Make syntax. + +Fri Nov 4 09:08:33 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * Version 2.1. + + * autoreconf.sh: Add -f --force option. + From Theodore Ts'o. + +Thu Nov 3 10:24:08 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_TRY_RUN): Reword warning. + + * acspecific.m4 (AC_PROG_CXX): Notify the user of the check for + GNU C++. + (AC_PROG_CXX, AC_PROG_CXXCPP): Use g++, not gcc, as default C++ + compiler. + * acgeneral.m4 (AC_LANG_CPLUSPLUS): Ditto. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Move ac_usage string directly + into the here document to work around A/UX shell limitation. + + * acgeneral.m4 (AC_COMPILE_CHECK): Mention the MSG macros in the + obsolete warning. + + * autoscan.pl (output_programs): Use AC_CHECK_LIB, not + AC_HAVE_LIBRARY. + + * acgeneral.m4 (AC_CHECK_FUNC): Move prototype outside of function + so it works with C++. From ejb@era.COM (E. Jay Berkenbilt). + +Fri Oct 28 11:23:30 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * acspecific.m4 (AC_CHECK_HEADERS_DIRENT): Use define, not + AC_DEFUN, so the test suite doesn't call it with no arguments, + leading to a syntax error in the real Bourne shell. + +Wed Oct 26 18:40:41 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * Version 2.0. + +Tue Oct 25 11:04:16 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_CHECK_HEADER, AC_CHECK_HEADERS): Change - + in file names to _. + * acspecific.m4 (AC_CHECK_HEADER_DIRENT, AC_CHECK_HEADERS_DIRENT): + Likewise. + +Mon Oct 24 11:28:20 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * Makefile.in (uninstall): Remove the transformed names. + (SCRIPTS): Rename from PROGS. + * configure.in: Likewise. + +Fri Oct 21 07:14:23 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_TRY_COMPILE): New macro. + (AC_LANG_C, AC_LANG_CPLUSPLUS): Set $ac_compile. + (AC_TRY_LINK): Don't declare exit. + * acspecific.m4 (AC_C_INLINE, AC_C_CONST, AC_CHECK_HEADER_DIRENT, + AC_DECL_SYS_SIGLIST, AC_HEADER_SYS_WAIT, AC_TYPE_SIGNAL, + AC_FUNC_GETLOADAVG, AC_HEADER_TIME, AC_STRUCT_TM, + AC_STRUCT_TIMEZONE, AC_STRUCT_ST_BLOCKS, AC_STRUCT_ST_BLKSIZE, + AC_STRUCT_ST_RDEV): Use AC_TRY_COMPILE instead of AC_TRY_LINK. + (AC_AIX, AC_MINIX, AC_ISC_POSIX): Must come before AC_TRY_COMPILE. + + * acspecific.m4 (AC_PROG_LEX): Don't assume -ll if using lex; + check for it. From Mark Eichin. + +Thu Oct 20 07:11:22 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_PARSE_ARGS): Ignore --site. + + * autoscan.pl: Add more blank lines to the output. Pacify perl -w. + +Wed Oct 19 09:14:50 1994 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_PREREQ_COMPARE): Allow secondary and ternary + numbers >99. From John Eaton. + +Wed Oct 19 00:06:40 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * ifnames.sh: Take comments out of sed script. + +Tue Oct 18 00:20:04 1994 David J. MacKenzie <djm@duality.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_INIT_NOTICE): Set ac_default_prefix. + (AC_INIT_PARSE_ARGS, AC_SITE_LOAD, AC_OUTPUT): Use it. + (AC_PREFIX_DEFAULT): New macro. + From Ken Raeburn. + + * testsuite/autoconf.s/syntax.exp: Renamed from specific.exp. + + * acgeneral.m4 (AC_SITE_LOAD): Change where to look for config.site. + + * configure.in: Call AC_ARG_PROGRAM. + * Makefile.in (install): Use program_transform_name. + + * acgeneral.m4 acspecific.m4 acoldnames.m4: Clarify copying terms. + + * acgeneral.m4 (AC_CANONICAL_BUILD): Default build to host, not empty. + + * acspecific.m4 (AC_PROG_CC): Recognize NeXT cpp as GNU C. + From tom@basil.icce.rug.NL (Tom R.Hageman). + +Mon Oct 17 18:25:53 1994 David J. MacKenzie (djm@duality.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PROG_CPP): Use assert.h (comes with gcc), not + stdio.h (loses for new cross-compilers). From Roland McGrath. + +Tue Oct 11 13:22:22 1994 David J. MacKenzie (djm@duality.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PATH_XTRA): Add X_PRE_LIBS variable and assume + -lSM if -lICE is found. From Karl Berry. + +Mon Oct 3 20:12:36 1994 David J. MacKenzie (djm@duality.gnu.ai.mit.edu) + + * testsuite/Makefile.in (AUTOCONF, AUTOCONFFLAGS): Test + ../autoconf, not installed autoconf. + +Sat Oct 1 04:43:43 1994 Paul Eggert <eggert@twinsun.com> + + * acspecific.m4: Catch `const' bug in NEC SVR4.0.2 mips cc. + + * Makefile.in (.sh, .pl, configure): Do chmod before mv. + + * acheaders, acspecific.m4 (AC_HEADER_SYS_WAIT): New entry. + + * acconfig.h (HAVE_SYS_WAIT_H): New entry. + +Wed Sep 28 08:59:01 1994 David MacKenzie <djm@geech.gnu.ai.mit.edu> + + * Makefile.in: Set datadir to $(prefix)/share. + +Tue Sep 27 08:00:38 1994 David MacKenzie <djm@geech.gnu.ai.mit.edu> + + * Makefile.in: Use implicit rules to make scripts. + From Jim Meyering. + + * acconfig.h: Remove #undefs of unused symbols. + From Paul Eggert. + * testsuite/autoconf.s/defines.exp: New file. + * testsuite/autoconf.s/specific.exp: Extract the list of macros to + test from acspecific.m4 instead of hardcoding it. + * acspecific.m4 (AC_PROG_CXXCPP): Default CXX to gcc, not c++. + +Mon Sep 26 12:32:46 1994 David MacKenzie <djm@churchy.gnu.ai.mit.edu> + + * acspecific.m4 (AC_HEADER_DIRENT): Only check for -lx if not + using dirent. + * autoreconf.sh: Shorten sed label for OSF/1. + * acgeneral.m4 acspecific.m4: Change licensing terms for output. + +Thu Sep 22 15:36:56 1994 David MacKenzie <djm@churchy.gnu.ai.mit.edu> + + * autoconf.sh (tmpin): Always set. + +Wed Sep 21 13:12:10 1994 David MacKenzie <djm@geech.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_INIT_PREPARE): Remove trailing slashes from + srcdir. + +Mon Sep 19 17:11:39 1994 David MacKenzie <djm@geech.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_INIT, AC_INIT_PARSE_ARGS, AC_CANONICAL_SYSTEM, + AC_ARG_PROGRAM): Make the default for program_transform_name be + a valid sed script, and substitute it always. + +Sat Sep 17 08:27:58 1994 David MacKenzie <djm@geech.gnu.ai.mit.edu> + + * autoheader.sh: Protect `for' loop from checking empty $syms. + + * ifnames.sh: Use % instead of , as sed s separator. + + * autoscan.pl: Update output comments. + +Fri Sep 16 11:20:02 1994 David MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_TYPE_GETGROUPS): Provide a cross compiling + default. From Jim Meyering. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Document + --program-transform-name. + +Thu Sep 15 16:26:36 1994 David MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_INIT_NOTICE): Clarify copying notice. + Fix up comments between sections. + + * acspecific.m4 (AC_PROG_LEX): Omit extra checking message. + + * autoreconf.sh: Give usage if non-option args are given. + * autoconf.sh autoheader.sh: Define AC_LOCALDIR for configure.in. + +Thu Sep 15 11:31:13 1994 Ian Lance Taylor (ian@airs.com) + + * Makefile.in (check): Set AUTOCONFFLAGS from srcdir, not objdir. + +Thu Sep 15 09:06:40 1994 David MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_MSG_ERROR): Say that it's an error in the message. + + * Makefile.in (check): Copy install-sh from srcdir if needed. + + * autoreconf.sh: Only regenerate autoheader-generated header file + templates. Pass relative macrodir properly. + * autoconf.sh autoheader.sh autoreconf.sh: Add -l --localdir option. + Based on work by Mark Eichin. + + * ifnames.sh: Add -h option. + * autoconf.sh autoheader.sh: Remove -v option. + + * acgeneral.m4 (AC_CHECK_TYPE): Require AC_HEADER_STDC and check + stdlib.h if present. + + * acgeneral.m4 (AC_OUTPUT): Protect cache save from interruptions. + +Tue Sep 13 09:46:23 1994 David J. MacKenzie (djm@churchy.gnu.ai.mit.edu) + + * Makefile.in (install): Use srcdir. From Mark Eichin. + + * acgeneral.m4 (AC_OUTPUT_FILES): Automatically add + configure_input comment to Makefiles again. + * Makefile.in testsuite/Makefile.in: Remove configure_input ref. + + * acgeneral.m4 (AC_LINK_FILES, AC_OUTPUT_LINKS): Reverse the order + of the arguments. Support relative symlinks. + + * acgeneral.m4 acspecific.m4: Remove some gratuitous {} in shell + variable references. + + * acgeneral.m4 (AC_OUTPUT_FILES): New output variable + configure_input replaces big kludge for adding output comment. + * Makefile.in, testsuite/Makefile.in: Use it. + +Mon Sep 12 23:06:08 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_INIT_PREPARE, AC_OUTPUT_SUBDIRS): Make command + line quoting work for shell metachars besides blanks. + +Sun Sep 11 23:34:24 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_PATH_XTRA): Link with X_EXTRA_LIBS when + checking for -lSM. + + * acfunctions (memcmp): Use AC_FUNC_MEMCMP. From Paul Eggert. + + * acgeneral.m4 (AC_COMPILE_CHECK): Mark obsolete. + +Sat Sep 10 10:59:19 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * Makefile.in (DISTFILES): Include install-sh, not install.sh. + + * autoscan.pl: Check AC_MACRODIR. + + * acgeneral.m4 (AC_INIT_PARSE_ARGS, AC_INIT_PREPARE, + AC_CONFIG_SUBDIRS, AC_OUTPUT_SUBDIRS): Make quoting of command + line options work. + (AC_CONFIG_AUX_DIRS): Check for install-sh over install.sh. + + * acspecific.m4 (AC_FUNC_GETMNTENT): Only check for second lib if + first lib isn't found. From Jim Meyering. + +Fri Sep 9 10:41:42 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_FUNC_MEMCMP): New macro, from Jim Meyering. + * testsuite/autoconf.s/specific.exp: Test it. + + * testsuite/Makefile.in (site.exp): Simplify. + + * acgeneral.m4 (AC_CACHE_SAVE): Use a shorter syntax for setting + the variables. Idea from Karl Berry. + (AC_CHECK_FUNCS, AC_CHECK_HEADERS): Take an action-if-not-found. + From Jim Meyering. + + * acconfig.h: Add entries for getmntent and strftime. + * acspecific.m4 (AC_C_CHAR_UNSIGNED): If GCC, don't run a test + program. + +Thu Sep 8 10:53:53 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_USG): Was passing too many args to AC_TRY_LINK. + (AC_FUNC_STRFTIME, AC_FUNC_GETMNTENT): New macros. + (AC_HEADER_DIRENT): Check for Xenix dir libs. + (AC_XENIX_DIR, AC_SCO_INTL, AC_IRIX_SUN, AC_DYNIX_SEQ, AC_AIX, + AC_ISC_POSIX, AC_MINIX): Go back to the v1 names. + * acoldnames.m4: Delete their aliases. + * testsuite/autoconf.s/specific.exp: Check them. + + * acgeneral.m4 (AC_ARG_PROGRAM): Use `;' instead of `-e' to + separate sed arguments, to simplify Makefile usage and support + sed arguments containing spaces. + (AC_CANONICAL_HOST): Move check for config.sub here from + AC_CANONICAL_SYSTEM. + + * autoheader.m4 (AC_CHECK_HEADERS_DIRENT): Redefine. From Paul Eggert. + (AC_CHECK_SIZEOF): Redefine this, not the old name. + (AC_HAVE_LIBRARY): Redefine. + +Wed Sep 7 09:32:31 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * testsuite/lib/common.exp: Ignore warnings about test programs. + * testsuite/autoconf.s/specific.exp: Check AC_FUNC_CLOSEDIR_VOID. + + * Makefile.in (*clean): Remove the new index. + (dist): Undo adding write perms. Screws up RCS. + * acgeneral.m4 (AC_OUTPUT_MAKE_DEFS): Remove comments from sed + program. + * acoldnames.m4: Change a couple of AC_DEFUN to define. + +Wed Sep 7 01:27:19 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_SITE_LOAD): Check whether $CONFIG_SITE is empty. + +Tue Sep 6 09:55:30 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_ARG_PROGRAM): New macro. + (AC_INIT_PARSE_ARGS, AC_CANONICAL_SYSTEM): Do a little setup for it. + + * acspecific.m4 (AC_PROG_INSTALL): Clarify comment. Remove check + for bsdinst, since it's no better than our install.sh. + (AC_CHECK_HEADER_DIRENT, AC_CHECK_HEADERS_DIRENT): New macros. + (AC_HEADER_DIRENT, AC_DIR_HEADER): Use them. + (AC_PROG_CC, AC_PROG_CXX): Check whether GCC accepts -g. + + * acgeneral.m4 (AC_INIT_PREPARE): Call AC_PROG_ECHO_N. + Use define instead of AC_DEFUN for some frequently called or + internal macros that aren't involved in ordering constraints. + +Mon Sep 5 17:37:36 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acspecific.m4 (AC_C_CROSS): Provide default argument to AC_TRY_RUN. + +Fri Sep 2 09:30:41 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_TRY_CPP): Use a temp file so sh -x works. + From Mark Nudelman. + + * acgeneral.m4: --norecursion -> --no-recursion. + (AC_OUTPUT_LINKS): Reset srcdir to ac_given_srcdir. + + * acspecific.m4 (AC_PATH_X): Call AC_ARG_WITH(x, ...). + (AC_PROG_INSTALL): Search for bsdinst too. + + * Makefile.in (dist): Make distribution files writable. + + * acgeneral.m4 (AC_OUTPUT): Move trap 0 commands to near the end + of configure, to work around shell bug in failing to execute the + trap when there are commands after AC_OUTPUT. + +Sat Sep 3 19:47:06 1994 Roland McGrath <roland@churchy.gnu.ai.mit.edu> + + * acgeneral.m4 (AC_OUTPUT_FILES): Write CONFIG_FILES defn + unquoted, so $1 can contain references to shell variables in configure. + +Thu Sep 1 15:34:15 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_TRY_RUN): Always warn if no cross-compile + default is given. + * acspecific.m4 (AC_FUNC_MMAP, AC_FUNC_VFORK, AC_FUNC_WAIT3, + AC_FUNC_UTIME_NULL, AC_FUNC_STRCOLL): Provide a default + for AC_TRY_RUN. + (AC_FUNC_CLOSEDIR_VOID): New macro, broken out of AC_HEADER_DIRENT. + +Thu Sep 1 00:06:38 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acgeneral.m4 acspecific.m4: Discard all output until AC_INIT is + called. Remove now-unnecessary dnl's between macro definitions. + (AC_OUTPUT): Add exit 0 and optional unquoted here document to + end of config.status. + +Wed Aug 31 00:11:28 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acspecific.m4 (AC_PATH_X_DIRECT): Use AC_TRY_LINK instead of + AC_CHECK_LIB, so we don't add the library to $LIBS or print anything. + (AC_PATH_XTRA): Remove initial checking message. + (AC_HEADER_STDC): In test program, default to no STDC headers if + cross compiling. + +Tue Aug 30 16:16:29 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * autoreconf.sh: Add -h option. + * autoupdate.sh: Remove -v option. + + * acgeneral.m4 (AC_EGREP_CPP, AC_TRY_CPP): Add parens around eval + for old shells. From Kaveh Ghazi. + (AC_TRY_RUN): Warn when generating configure, if called without + a default parameter and AC_CANONICAL_SYSTEM has been called. + + * autoheader.sh: Don't run `for' loops on empty lists. + From Ken Raeburn. + + * autoconf.sh autoheader.sh: Print the version number using grep + like the other scripts, not using m4. + * acgeneral.m4: Remove conditional for printing version number. + It broke with frozen files. + + * autoheader.m4: New file. + * autoheader.sh: Use it; the frozen version if possible. + * Makefile.in (install): Install a frozen autoheader.m4f if possible. + * autoconf.m4: Don't sinclude acsite.m4 here. + * acgeneral.m4 (AC_INIT): Include it here. + +Tue Aug 30 14:02:07 1994 David J. MacKenzie (djm@mole.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_CHECK_LIB): Use AC_DEFINE_UNQUOTED. + From Jim Meyering. + + * acgeneral.m4: Revise diversions, to topologically order + macros called via AC_REQUIRE. + (AC_DIVERT_PUSH, AC_DIVERT_POP): New macros. + (AC_INIT, AC_ARG_ENABLE, AC_ARG_WITH, AC_SUBST, AC_SUBST_FILE, + AC_REQUIRE): Use them. + From Franc,ois Pinard (bless his soul!). + (AC_PRO, AC_EPI): New macros. + (AC_DEFUN): Use them. + (AC_INIT): sinclude aclocal.m4 herea. + * autoconf.m4: Not here. + + * autoconf.sh: Use a freeze file if available and m4 can do it. + * Makefile.in (install): Install a freeze file if m4 supports it. + +Mon Aug 29 16:18:22 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_TRY_CPP): Remove subshell and move quotes. + +Sun Aug 28 17:37:26 1994 David J. MacKenzie (djm@bennett.eng.umd.edu) + + * acspecific.m4 (AC_C_CHAR_UNSIGNED, AC_C_LONG_DOUBLE, + AC_C_INLINE): Don't AC_REQUIRE AC_PROG_CC. + + * acspecific.m4 (AC_RSH, AC_ARG_ARRAY, AC_HAVE_POUNDBANG): Define + to print error messages. + + * acgeneral.m4 (AC_OUTPUT_LINKS): Insert ac_links and ac_files + into config.status using an *un*quoted here document. + From Ken Raeburn. + +Sat Aug 27 13:31:58 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT_HEADER): Remove comments from within sed + script. From Kaveh Ghazi. + +Fri Aug 26 17:03:18 1994 David J. MacKenzie (djm@geech.gnu.ai.mit.edu) + + * autoconf.sh, acgeneral.m4: __LINE__ -> __oline__. + + * acgeneral.m4 (AC_TRY_CPP, AC_EGREP_CPP): Append any error output + to config.log. + (AC_EGREP_CPP): Don't use a temp file. + + * acspecific.m4 (AC_FUNC_ALLOCA): Require CPP. + + * acgeneral.m4 (AC_INIT_PREPARE): Replace AC_SUBST_DEFAULT calls + with AC_SUBST. + (AC_SUBST_DEFAULT): Macro removed. + * acspecific.m4 (AC_PROG_CC, AC_PROG_CXX): If CFLAGS or CXXFLAGS + was not set already, give it a default value according to whether + we have gcc. + + * acspecific.m4 (AC_PATH_XTRA): Use AC_CHECK_LIB, not AC_HAVE_LIBRARY. + +Fri Aug 26 00:34:11 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acconfig.h (HAVE_UNION_WAIT): Entry removed; it wasn't defined + anywhere. + + * acgeneral.m4 (AC_OUTPUT_HEADER): rm files before mv onto them. + (AC_OUTPUT): Remove explicit exit at end of configure, to allow + code after AC_OUTPUT (needed for Emacs). + + * acgeneral.m4 (AC_CANONICAL_SYSTEM): Move setting of alias vars + into submacros. + + * acspecific.m4 (AC_PROG_CPP): If $CPP is set and is a directory, + ignore it. + +Thu Aug 25 09:26:36 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acspecific.m4 (AC_SYS_INTERPRETER): Move hash mark out of macro + call. + (AC_FUNC_MMAP): If C++, put malloc decls in extern "C". + + * acgeneral.m4 (AC_INIT_PARSE_ARGS): Untabify help message + and indent options. + + * Makefile.in (DISTFILES): Remove ChangeLog.0. + + * acgeneral.m4 (AC_CHECK_LIB): Do uppercasing of library name at + runtime. + (AC_HAVE_LIBRARY): Retain old behavior. + + * acspecific.m4 (AC_FUNC_VFORK): If C++, use a prototype for the + function in the test program. + (AC_C_ARG_ARRAY): Macro deleted. + * acoldnames.m4, acconfig.h, testsuite/autoconf.s/specific.exp: + Remove references to it. + + * autoupdate.sh: Make sure $infile can be read, and $tmpout has + the same permissions. Make sure $infile can be written. From + Paul Eggert. + + * acgeneral.m4 (AC_INIT*): Remove now-incorrect AC_BEFORE calls. + (AC_CHECK_FUNC): If C++, use extern "C". + (AC_TRY_LINK, AC_TRY_RUN): If C++, declare exit. + + * acspecific.m4 (AC_PATH_XTRA): Check for more libraries. + From Karl Berry. + + * acgeneral.m4 (AC_INIT_PREPARE): Substitute CPPFLAGS. + (AC_LANG_C, AC_LANG_CPLUSPLUS): Include CPPFLAGS in the commands. + + * acgeneral.m4 (AC_OUTPUT_FILES): Move protection for right side + of sed substitution here from AC_MAKE_DEFS, so it applies to all + AC_SUBST'd variables. + + * Makefile.in (install): Use for loops. From Jim Meyering. + + * acgeneral.m4: Revise diversions to rely on implicit flushing at + the end of the m4 run. Idea from Franc,ois Pinard. + (AC_INIT_PREPARE, AC_ARG_ENABLE, AC_ARG_WITH, AC_PREFIX_PROGRAM): + Write to the appropriate diversions. + (AC_ENABLE, AC_WITH): Supply default help string. + (AC_ENABLE_INTERNAL, AC_WITH_INTERNAL, AC_PREFIX_INTERNAL): + Macros removed. + (AC_CONFIG_SUBDIRS): Set `subdirs' here instead of in + AC_INIT_PREPARE. + (AC_PREFIX): Macro removed. + * acoldnames.m4 (AC_PREFIX): Make it an alias for AC_PREFIX_PROGRAM. + + * acoldnames.m4: We don't officially support calling + the subroutines of AC_INIT directly, or replacing them, so don't + document it. + +Wed Aug 24 00:19:05 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acgeneral.m4 (AC_EGREP_CPP, AC_TRY_LINK, AC_TRY_RUN, + AC_TRY_CPP): Add #line directives. + * autoconf.sh: Make the #line directives accurate. + From Franc,ois Pinard. + + * acgeneral.m4 (AC_OUTPUT): Set ac_given_INSTALL from INSTALL. + (AC_SUBST_FILE): Replace with what was AC_INSERT_FILE. + (AC_SUBST_DEFAULT): New macro. + (AC_INIT_BINSH): Renamed from AC_BINSH. + (AC_INIT_PREPARE): Call AC_SUBST_DEFAULT for CFLAGS, CXXFLAGS, and + LDFLAGS. + + * acspecific.m4 (AC_HEADER_MAJOR): Don't nest caching tests. + + * Makefile.in (clean): Remove the new index files. + + * configure.in: Check for gm4 before gnum4. + + * acspecific.m4 (AC_PROG_RSH): Macro removed. + + * Makefile.in (install): Install autoconf.m4. + + * acspecific.m4 (AC_SYS_INTERPRETER): New name and calling + convention for AC_HAVE_POUNDBANG. + (AC_OS_XENIX): Check ac_header_dir instead of DEFS. + + * testsuite/autoconf.s/specific.exp: Add AC_HEADER_DIRENT. + Remove AC_SYS_REMOTE_TAPE. Replace AC_HAVE_POUNDBANG with + AC_SYS_INTERPRETER. + + * acspecific.m4 (AC_INT_16_BITS, AC_LONG_64_BITS): Reword messages. + + * acgeneral.m4 (AC_CHECK_LIB): Use our standard alternate m4 quote + characters << and >> instead of /. + + * acspecific.m4 (AC_C_CONST, AC_TYPE_GETGROUPS, + AC_PROG_GCC_TRADITIONAL): Don't put the test program in a + temporary variable. + + * acgeneral.m4 (AC_CHECK_HEADERS, AC_CHECK_FUNCS): Use + AC_DEFINE_UNQUOTED. + * autoheader.sh (AC_DEFINE_UNQUOTED): Define. + +Tue Aug 23 00:03:06 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acgeneral.m4: Improve comments on some macros. + Fix improperly quoted undefine calls. + (AC_QUOTE_DQUOTE, AC_QUOTE_SQUOTE, AC_QUOTE_HERE, AC_QUOTE_SED, + AC_QUOTE_TOKEN, AC_DEFINE_QUOTE, AC_DEFINE_SEDQUOTE, + AC_QUOTE_IDENTITY): Macros removed. + (AC_DEFINE, AC_DEFINE_UNQUOTED): Only write the (correct) value to + confdefs.h. + (AC_OUTPUT_MAKE_DEFS): New macro. + (AC_OUTPUT): Call it. Move AC_SUBST calls to AC_INIT_PREPARE. + (AC_OUTPUT_FILES): Put most variable substitutions in a here document + instead of a string, to avoid unwanted changes to the values. + (AC_OUTPUT_HEADER): Generate the sed script to transform + config.h.in from conftest.h. Only split up the sed script in + configure, not also in config.status. + + * acspecific.m4 (AC_PROG_ECHO_N): Work around some greps lacking -e. + + * acspecific.m4 (AC_PATH_X, AC_PATH_X_XMKMF, AC_PATH_X_DIRECT, + AC_PATH_XTRA): Fix cache use and message printing. + + * acgeneral.m4 (AC_SITE_LOAD): Check env var CONFIG_SITE first. + (AC_OUTPUT_HEADER): New macro broken out of AC_OUTPUT. + + * acgeneral.m4, acspecific.m4 (AC_FD_MSG, AC_FD_CC): New + symbolic constants. + + * acgeneral.m4, acoldnames.m4 (AC_INIT_PARSE_ARGS): Renamed from + AC_INIT_PARSEARGS. + + * autoupdate.sh: Use $SIMPLE_BACKUP_SUFFIX, if set. + + * autoheader.sh (AC_CHECK_LIB): Reflect the added arg. + + * autoconf.m4: New file. + * Makefile.in (DISTFILES): Add it. + * autoconf.sh, autoheader.sh, Makefile.in: Use it. + + * acspecific.m4 (AC_SYS_REMOTE_TAPE): Macro removed. + + * acfunctions, acheaders, acidentifiers, acmakevars, acprograms, + autoscan.pl: Use new macro names. + + * acgeneral.m4 (AC_MSG_ERROR): Enclose within {} so it acts like a + single statement. From mjshield@nyx.cs.du.edu (Michael Shields). + (AC_CHECK_FUNCS, AC_CHECK_HEADERS): Only compute the uppercase + name if we're going to define that symbol. + (global): Remove AC_DIVERSION_VAR. + (AC_OUTPUT): Adjust quoting and substitutions to replace most + variable values directly in the sed script. Handle srcdir, + top_srcdir, and INSTALL specially. + Add .cpp and .hpp to c-ish suffixes list. + + * configure.in: Use the new macro names. + + * ChangeLog.0: New file, broken out of ChangeLog.1. + * Makefile.in (DISTFILES): Add it. + + * autoupdate.sh: Update the regexps to account for changes to + acoldnames.m4. + +Mon Aug 22 23:57:18 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * testsuite/autoconf.s/specific.exp: Use new macro names. + +Fri Aug 12 10:15:51 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acspecific.m4 (AC_HEADER_DIRENT, AC_DIR_HEADER): Use one cache + variable for each header file, not one for all of them. + + * acgeneral.m4 (AC_CACHE_SAVE): Print a message noting when cache + is unwritable. + (AC_CHECK_FUNCS, AC_CHECK_HEADERS): Take an optional arg to + execute on a match. + + * acspecific (AC_OS_AIX, AC_OS_MINIX, AC_OS_ISC): Don't need to be + called before AC_TRY_CPP, since that doesn't use CFLAGS. + + * acgeneral.m4 (AC_CHECK_PROG, AC_PATH_PROG): Print a result + whether or not we found the program. + (AC_CHECKING): Not obsolete. + (AC_WITH, AC_ENABLE, AC_INIT_PREPARE): Merge the --enable and + --with diversions. + + * acgeneral.m4 (AC_DEFUN): New macro. + Use it globally to define macros that are used as functions, + as opposed to macros that are used as variables. Remove calls to + AC_PROVIDE. + +Thu Aug 11 08:25:08 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acspecific.m4 (AC_OS_XENIX): Fix assignments. From Franc,ois + Pinard. + (AC_SYS_REMOTE_TAPE): Fix typo. + +Wed Aug 10 09:30:11 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acspecific.m4 (AC_C_CHAR_UNSIGNED): Don't lie about the result + if gcc, just ignore it. + + * acgeneral.m4 (AC_CHECK_LIB): Add a function argument. + * acgeneral.m4 (AC_HAVE_LIBRARY): Make it a wrapper around + AC_CHECK_LIB. + * acoldnames.m4: Remove its alias. + * acspecific.m4: Add argument to callers. + + * acspecific.m4 (AC_PROG_ECHO_N): Move from acgeneral.m4 AC_MSG_ECHO_N. + * acgeneral.m4: Callers changed. + + * acgeneral.m4 (AC_CACHE_LOAD, AC_CACHE_SAVE, AC_SITE_LOAD, + AC_MSG_CHECKING): Aesthetic changes to messages, suggested by + Franc,ois Pinard. + + * acspecific.m4 acgeneral.m4 acoldnames.m4: Rename + AC_TRY_CROSS to AC_C_CROSS. + + * acgeneral.m4 (AC_INIT_PARSEARGS): Don't mention --verbose in + help message. + (AC_INIT_PREPARE): Use file descriptor 5 for config.log, and 6 for + nothing. --verbose no longer does anything. + (AC_MSG_ECHO_N): New macro. + (AC_MSG_CHECKING, AC_MSG_RESULT, AC_CACHE_VAL): Require it and use + the shell variables it sets. + (AC_MSG_RESULT, AC_VERBOSE): Print unless --silent/--quiet is given, + not only when --verbose is given. + (AC_DEFINE): Don't echo anything. + (AC_CACHE_VAL): Use a custom echo instead of AC_MSG_RESULT. + * acgeneral.m4 (AC_CHECKING, AC_VERBOSE): Put back real versions, + marked obsolete. + * acoldnames.m4: Delete their aliases. + * acgeneral.m4, acspecific.m4 (many macros): Make sure each call + to AC_MSG_CHECKING has exactly one matching AC_MSG_RESULT, and + make the result messages make sense with the checking messages. + + * acgeneral.m4 (AC_OUTPUT_SUBDIRS): Use echo, not AC_MSG_RESULT, + to print recursion notice. + +Tue Aug 9 00:17:28 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acgeneral.m4 (AC_OUTPUT): Add comment mentioning config.log. + + * ChangeLog.1: File split out of ChangeLog. + * Makefile.in (DISTFILES): Add it. + + * acgeneral.m4 (AC_OUTPUT, AC_OUTPUT_HEADER), autoheader.sh: + Support optional input-file specification in output-file names. + * autoheader.sh: Support top and bottom comments for config.h.in + in acconfig.h. + + * acgeneral.m4, README: Say more about requiring GNU m4. + + * autoheader.sh: In the list of symbols to get template entries + for, start each symbol with a blank. + + * autoupdate.sh: Add sed substitutions for replacing macro + calls without parameters. + + * acgeneral.m4 (AC_CACHE_VAL): Omit the cache var name from the + result message. + + * acspecific.m4 (AC_DIR_HEADER): Define to be similar to + AC_HEADER_DIRENT, but only define the old cpp macros. + (AC_HEADER_DIRENT): Only define the new ones. + * acoldnames.m4: Don't say that those two macros are synonyms. + * acconfig.h: Add the new cpp macros. Add <> to some comments. + + * acgeneral.m4 (AC_OUTPUT): Don't mess with $INSTALL if it starts + with a $, due to user intervention. + + * Makefile.in, testsuite/Makefile.in: Fix *clean targets. + + * acgeneral.m4 (AC_CACHE_SAVE, AC_CACHE_LOAD, AC_SITE_LOAD): + Use echo instead of AC_MSG_RESULT. + (AC_INIT_PARSEARGS): Group options by topic in help message. Idea + from Franc,ois Pinard. + + * TODO: New file. + +Mon Aug 8 23:04:01 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acgeneral.m4 (AC_OUTPUT): Tighten up srcdir handling code slightly. + Add one or more ../ to $INSTALL when it's a relative path and + creating a file in a subdirectory. + +Tue Aug 2 19:54:26 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * autoheader.sh: Read acoldnames.m4. Redefine the new macro names. + Only define HAVE_LIBFOO where AC_CHECK_LIB is called with only one + argument. + +Sat Jul 30 09:53:38 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acgeneral.m4 acspecific.m4: The Great Renaming. + (Well, I think it's great. You may have your own opinion.) + + * acspecific.m4 (AC_DIR_HEADER): Define HAVE_<path>_H as well as + the old DIRENT, SYSDIR, etc. + + * acgeneral.m4 acspecific.m4: Add missing spaces between arguments + to m4 calls. From Franc,ois Pinard. + + * autoconf.sh: Read acoldnames.m4. + * Makefile.in (DISTFILES, PROGS, install, clean): Add + acoldnames.m4 and autoupdate.sh. + +Tue Jul 26 08:52:17 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * testsuite/Makefile.in (check): Print a message noting that + runtest is part of DejaGNU. + + * autoscan.pl: Remove unneeded backslash. + +Sun Jul 24 23:30:27 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * Makefile.in (clean mostlyclean distclean realclean): Recurse + into testsuite directory. + +Wed Jul 20 09:38:29 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * Makefile.in (install): Add missing else and fi. + * acspecific.m4 (GETGROUPS_T, RETSIGTYPE, STACK_DIRECTION): Use + AC_DEFINE_UNQUOTED rather than AC_DEFINE. + From Jim Meyering. + +Tue Jul 19 14:49:02 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acspecific.m4 (AC_MEMORY_H): Add more quotes. + + * acgeneral.m4 (AC_TEST_RUN): Check for cross_compiling = yes, not + whether it's non-empty. + + * acspecific.m4 (AC_MINUS_C_MINUS_O, AC_SET_MAKE): Eval the cache var + assignments. + (AC_YYTEXT_POINTER): Fix typo. + + * testsuite/autoconf.s/specific.exp, + testsuite/autoconf.g/sizeof_type.exp, + testsuite/autoconf.g/init.exp: New files. + * testsuite/lib/common.exp, testsuite/config/unix.exp: Many + changes to make them work. + + * acgeneral.m4 (AC_DEFINE): Use redirection for echo, not $verbose. + +Sat Jul 2 22:07:18 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acspecific.m4 (AC_REMOTE_TAPE): Substitute PROGS. + +Thu Jun 30 16:29:15 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acgeneral.m4 (AC_SUBST_FILE): New version from Ken Raeburn. + + * ifnames: Add --help, --version, --macrodir options. + +Fri Jun 24 06:03:35 1994 Paul Eggert (eggert@twinsun.com) + + * acspecific.m4 (AC_VFORK): Improve test for the gcc-sparc vfork bug. + +Thu Jun 30 09:47:17 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * acgeneral.m4 (AC_OUTPUT_SUBDIRS): Pass correct --srcdir option + to sub configures. Quote args containing spaces. + (AC_PREPARE): Set and substitute `subdirs'. Quote args containing + spaces. + (AC_CANONICAL_HOST, AC_CANONICAL_TARGET, AC_CANONICAL_BUILD): + Substitute the cpu, vendor, os variables. + + * acspecific.m4 (AC_PROG_INSTALL): Look for ginstall before other + names. + + * acgeneral.m4 (AC_TEST_LINK): Add newlines around argument code. + From mjshield@nyx.cs.du.edu (Michael Shields). + +Wed Jun 29 16:56:28 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * autoscan.pl: Add --macrodir option. + + * acgeneral.m4 (AC_CACHE_SAVE): Capture stderr for Ultrix sh. + +Tue Jun 28 18:05:00 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * Makefile.in: Make INSTALL from install.texi. + +Thu Jun 23 02:03:19 1994 David J. MacKenzie (djm@vortex.eng.umd.edu) + + * ifnames.sh: New file. + * Makefile.in: Add it in various places. + +Tue Jun 14 12:58:38 1994 David J. MacKenzie (djm@bleen.eng.umd.edu) + + * Makefile.in (DISTFILES): Add testsuite files. + + * autoconf.sh: Print version number on stdout, not stderr. + * acgeneral.m4: Ditto. + + * acgeneral.m4 (AC_HAVE_LIBRARY): Add OTHER-LIBRARIES arg. + Treat empty commands args as if they weren't given. + +Thu Jun 9 11:39:14 1994 David J. MacKenzie (djm@bleen.eng.umd.edu) + + * acgeneral.m4 (AC_CHECK_TYPE): New macro. + + * acspecific.m4 (AC_PROG_CPP, AC_PROG_CXXCPP, AC_YYTEXT_POINTER, + AC_LN_S, AC_RSH, AC_STDC_HEADERS, AC_MAJOR_HEADER, AC_DIR_HEADER, + AC_STAT_MACROS_BROKEN, AC_SYS_SIGLIST_DECLARED, AC_GETGROUPS_T, + AC_UID_T, AC_RETSIGTYPE, AC_MMAP, AC_VFORK, AC_WAIT3, AC_ALLOCA, + AC_GETLOADAVG, AC_UTIME_NULL, AC_STRCOLL, AC_SETVBUF_REVERSED, + AC_STRUCT_TM, AC_TIME_WITH_SYS_TIME, AC_TIMEZONE, AC_ST_BLOCKS, + AC_ST_BLKSIZE, AC_ST_RDEV, AC_CROSS_CHECK, AC_CHAR_UNSIGNED, + AC_LONG_DOUBLE, AC_WORDS_BIGENDIAN, AC_ARG_ARRAY, AC_INLINE, + AC_CONST, AC_HAVE_POUNDBANG, AC_REMOTE_TAPE, AC_LONG_FILE_NAMES, + AC_RESTARTABLE_SYSCALLS, AC_FIND_X, AC_FIND_X_XMKMF, + AC_FIND_X_DIRECT): Cache results. + (AC_SIZE_T, AC_PID_T, AC_OFF_T, AC_MODE_T): Use AC_CHECK_TYPE. + (AC_DIR_HEADER_CHECK): Macro removed. + +Wed Jun 8 18:03:45 1994 David J. MacKenzie (djm@bleen.eng.umd.edu) + + * acspecific.m4 (AC_MINUS_C_MINUS_O): Cache results. + +Thu May 26 09:43:37 1994 David J. Mackenzie (djm@poseidon.cygnus.com) + + * acspecific.m4 (AC_PROG_CC, AC_PROG_CXX): Cache results. + Eliminate temp file in gcc test. + (AC_GCC_TRADITIONAL): Cache results. + +Wed May 25 14:45:44 1994 David J. Mackenzie (djm@poseidon.cygnus.com) + + * acspecific.m4 (AC_VPRINTF): Use AC_FUNC_CHECK. + + * acgeneral.m4 (AC_CONFIG_AUX_DIR): Renamed from AC_CONFIG_AUXDIR. + (AC_SUBST_FILE): Macro deleted; didn't work, not clear it's needed. + + * acgeneral.m4 (AC_SITE_LOAD): New macro. + (AC_PREPARE): Call it. + +Wed May 25 08:18:07 1994 David J. Mackenzie (djm@rtl.cygnus.com) + + * acgeneral.m4: m4exit if --version, to reduce needless delay. + + * acgeneral.m4 (AC_PREPARE): Redirect file descriptor 6 to + config.log. + (AC_LANG_C, AC_LANG_CPLUSPLUS): Send compiler messages to desc 6. + * acspecific.m4 (AC_MINUS_C_MINUS_O): Likewise. + * Makefile.in (distclean): Remove config.log. + + * acgeneral.m4 (AC_PREPARE): Add AC_BEFORE calls for AC_CONFIG_HEADER, + AC_REVISION, AC_PREREQ, and AC_CONFIG_SUBDIRS. + Add AC_PROVIDE calls to those macros and AC_ARG_ENABLE and AC_ARG_WITH. + + * acgeneral.m4 (AC_CANONICAL_SYSTEM, AC_CANONICAL_HOST, + AC_CANONICAL_TARGET, AC_CANONICAL_BUILD): Add "ICAL" to names. + (AC_LINK_FILES): Renamed from AC_MAKE_LINKS. + (AC_TEST_RUN): Renamed from AC_TEST_PROGRAM, which is now an alias. + * acspecific.m4: Change callers to use new name. + + * acgeneral.m4 (AC_PREFIX_INTERNAL): Renamed from AC_PREFIX. + (AC_PREFIX): Obsolete wrapper for it. + (AC_PREFIX_PROGRAM): Define a variable. + (AC_PREPARE): Call AC_PREFIX_INTERNAL if that variable is set. + +Tue May 24 18:49:35 1994 David J. Mackenzie (djm@rtl.cygnus.com) + + * acspecific.m4 (AC_ALLOCA): Don't declare alloca if it's already + defined. From Bill Sommerfeld. + + * acgeneral.m4 (AC_TEST_PROGRAM): Verbosely note when using the + cross-compiling default. + (AC_CACHE_WRITE): Set the cache values only if not already set. + (AC_PARSEARGS, AC_OUTPUT): Allow giving an empty prefix or exec_prefix. + + * acgeneral.m4, acspecific.m4: Rename AC_CONFIG_AUX* to + AC_CONFIG_AUXDIR*. + + * acgeneral.m4 (AC_OUTPUT, AC_OUTPUT_HEADER): Add an env var + CONFIG_STATUS to allow overriding the name of config.status. + + * acspecific.m4 (AC_MINUS_C_MINUS_O): If $CC=cc, don't duplicate + the check. From Jim Meyering. + + * acgeneral.m4 (AC_TEST_PROGRAM): Add missing newline. + Always include 'fi' for cross-compiling if. + From Jim Meyering. + + * Makefile.in (prefix, exec_prefix): Use @ substitutions. + + * acgeneral.m4: Make default cache file ./config.cache, + so PATH is not used by "." command. From Jim Meyering. + +Thu May 19 06:05:07 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acspecific.m4 (AC_STRUCT_TM): Fixed checking message to be less + confusing. + +Wed May 18 22:11:45 1994 Roland McGrath (roland@churchy.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_BINSH): New macro. + (AC_INIT, AC_REVISION): Require AC_BINSH first thing. + +Wed May 18 09:08:39 1994 David J. MacKenzie (djm@burnout.eng.umd.edu) + + * acgeneral.m4: Rename some internal macros. + Give the diversions symbolic names. + (AC_ARG_ENABLE, AC_ARG_WITH, AC_ENABLE_INTERNAL, AC_WITH_INTERNAL): + New macros. + (AC_PARSEARGS): Print --with and --enable help strings. + (AC_ENABLE, AC_WITH): Make wrappers around _INTERNAL functions. + Mark obsolete. + (AC_PREPARE): Execute any saved up --with or --enable code. + +Tue May 17 15:18:00 1994 David J. MacKenzie (djm@bleen.eng.umd.edu) + + * acgeneral.m4 (AC_REVISION): Move quotes around to make it work + again. + +Sat May 14 07:30:57 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acgeneral.m4, acspecific.m4: Clean up some comments. + +Tue May 10 09:50:12 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acspecific.m4 (AC_PROG_INSTALL): set the _path_ cache variable, + not the _program_ one. + * acgeneral.m4 (AC_PREFIX): Call AC_PROGRAM_PATH instead of + duplicating it. + (AC_PROGRAM_CHECK, AC_PROGRAM_PATH): If the user set the variable + in the environment, cache that value. + (AC_PREPARE, AC_CHECKING, AC_VERBOSE): Use file descriptors 4 and + 5 for checking and results messages. Idea from metaconfig 3.0. + +Mon May 9 08:20:14 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acgeneral.m4 (AC_TEST_PROGRAM): If no default for + cross-compiling is given, but we are cross-compiling, give an error. + (AC_PROGRAM_EGREP, AC_TEST_LINK, AC_TEST_PROGRAM, AC_TEST_CPP): + Don't add an extra blank line after the if-clause. + (AC_REVISION): Merge AC_DOREV into this macro. + Rename some macros: + AC_SYSTEM_TYPE -> AC_CANON_SYSTEM + AC_HOST_TYPE -> AC_CANON_HOST + AC_TARGET_TYPE -> AC_CANON_TARGET + AC_BUILD_TYPE -> AC_CANON_BUILD + (AC_OUTPUT): Don't do Cygnus-style magic + substitutions on prefix and exec_prefix, just initialize and + substitute them normally. + +Sun May 8 01:09:42 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acspecific.m4 (AC_AIX, AC_MINIX, AC_ISC_POSIX): Don't call + AC_BEFORE for AC_HEADER_EGREP, to avoid require loops. + * acgeneral.m4 (AC_HEADER_EGREP): Call AC_PROGRAM_EGREP instead of + duplicating most of it. + +Fri May 6 15:26:48 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acspecific.m4 (AC_YYTEXT_POINTER): Use AC_TEST_LINK, not + AC_TEST_PROGRAM. + +Fri May 6 00:45:29 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acspecific.m4, acgeneral.m4: Add dnl after AC_PROVIDE, + AC_REQUIRE, and AC_BEFORE calls. + Use AC_CHECKING and AC_TEST_LINK instead of AC_COMPILE_CHECK. + + * acgeneral.m4 (AC_TEST_LINK): New macro. + (AC_COMPILE_CHECK): Mark obsolete. Call AC_CHECKING and + AC_TEST_LINK. + (AC_PROGRAM_CHECK, AC_PROGRAM_PATH, AC_HAVE_LIBRARY, AC_HEADER_CHECK, + AC_FUNC_CHECK, AC_SIZEOF_TYPE): Print "checking" messages even if + using cached values. Use AC_TEST_LINK instead of AC_COMPILE_CHECK. + * acspecific.m4 (AC_PROG_INSTALL): Ditto. + + * acgeneral.m4 (AC_PROGRAM_CHECK, AC_PROGRAM_PATH): Fix nesting in + cache use. + + * acspecific.m4 (AC_PROG_INSTALL): Ditto. + + * acgeneral.m4 (AC_OUTPUT_CONFIG_SUBDIRS): Adjust relative cache + file paths before passing them to sub-configures. Omit existing + --cache-file arguments. + +Thu May 5 21:38:51 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acgeneral.m4 (AC_FUNC_CHECK, AC_HEADER_CHECK): Combine redundant + code. Use AC_CACHE_VAL. + (AC_SIZEOF_TYPE): Use AC_CACHE_VAL. + +Thu May 5 12:51:32 1994 David J. MacKenzie (djm@gamera.eng.umd.edu) + + * Makefile.in (all): Don't depend on info files. + (install): Don't install INSTALL. + (installcheck, install-info): New targets. + +Thu May 5 08:49:39 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * Makefile.in (dist): chmod the dist directory, not the current + directory. Don't depend on DISTFILES. + + * autoconf.sh: Go back to old way of doing NLS nuisance test. + * autoheader.sh: Ditto. + * acgeneral.m4: Ditto. + +Thu May 5 08:36:19 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acgeneral.m4: Use "yes" and "no" or "" uniformly for boolean + variables' values. Don't assume default values. + (AC_PROGRAM_CHECK, AC_PROGRAM_PATH): Always set the cache variable + and use different ones. + + * acspecific.m4: Use "yes" and "no" or "" uniformly for boolean + variables' values. Don't assume default values. + (AC_STDC_HEADERS, AC_ALLOCA): Untangle nested tests. + +Thu May 5 07:51:38 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * Makefile.in (distclean): Remove config.cache. + +Wed May 4 19:41:35 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_HAVE_LIBRARY): Use AC_CACHE_VAL. + + * Makefile.in (install): Depend on all again. + (install-info): Depend on info again. + +Wed May 4 15:05:11 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acspecific.m4 (AC_PROG_INSTALL): Use AC_CACHE_VAL. + * acgeneral.m4 (AC_PROGRAM_CHECK, AC_PROGRAM_PATH): Use AC_CACHE_VAL. + (AC_REPLACE_FUNCS): Use AC_FUNC_CHECK. + Rearrange general tests into 4 categories: + Checking for files - fundamental (caching) + Checking for files - derived (caching) + Checking for C features - fundamental (no caching) + Checking for C features - derived (caching) + + * acgeneral.m4 (AC_CACHE_LOAD, AC_CACHE_SAVE, AC_CACHE_VAL): + New macros. + (AC_PREPARE): Call AC_CACHE_LOAD. + (AC_OUTPUT): Call AC_CACHE_SAVE. + (AC_PARSEARGS): Add --cache-file=FILE option. + (AC_CONFIG_SUBDIRS): Pass --cache-file to subdirectory configures. + + * acgeneral.m4 (AC_OUTPUT_CONFIG_SUBDIRS): Renamed from + AC_CONFIG_SUBDIRS. + (AC_CONFIG_SUBDIRS): Just define AC_SUBDIR_LIST. + (AC_OUTPUT): Call AC_OUTPUT_CONFIG_SUBDIRS if AC_SUBDIR_LIST is + defined. + Make config.status --recheck pass --norecursion to configure. + + * acspecific.m4 (AC_SETVBUF_REVERSED): Print "checking" message. + +Wed May 4 10:40:56 1994 David J. MacKenzie (djm@burnout.eng.umd.edu) + + * autoreconf.sh: Add options [--help] [--macrodir=dir] [--verbose] + [--version]. + + * acspecific.m4 (AC_GCC_TRADITIONAL, AC_SET_MAKE, AC_RSH, + AC_GETLOADAVG, AC_CROSS_CHECK): Print results verbosely. + (AC_GETLOADAVG): Name space cleanup. + +Wed May 4 09:32:04 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * autoheader.sh, autoconf.sh, acgeneral.m4: Make the NLS + nuisance test actually do something. + +Mon May 2 16:31:33 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * configure.in: Check for standards.texi. + * Makefile.in: Put everything back into one directory. + Don't assume standards.* exist. + +Sat Apr 30 09:37:06 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * acgeneral.m4 (AC_OUTPUT): Change >> to > in sed command. + +Fri Apr 29 21:56:33 1994 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu) + + * Makefile.in (all): Make autoreconf too. + +Fri Apr 29 21:03:48 1994 David J. MacKenzie (djm@aria.eng.umd.edu) + + * acgeneral.m4 (AC_OUTPUT): When doing substitutions on files, if + the file starts with "#!", put the "automatically generated" + comment on the second line instead of the first. + +Fri Apr 29 12:53:53 1994 David J. MacKenzie (djm@burnout.eng.umd.edu) + + * acgeneral.m4 (AC_CONFIG_AUX, AC_CONFIG_AUX_DEFAULT, + AC_CONFIG_AUX_DIRS, AC_SYSTEM_TYPE, AC_HOST_TYPE, AC_TARGET_TYPE, + AC_BUILD_TYPE, AC_SUBST_FILE, AC_MAKE_LINKS, AC_OUTPUT_MAKE_LINKS, + AC_CONFIG_SUBDIRS): New macros. + + * acspecific.m4 (AC_PROG_INSTALL): Use install.sh from ac_aux_dir. + + * Makefile.in: Remove references to standards.*. + Add autoreconf. + +Thu Apr 28 12:01:01 1994 David J. MacKenzie (djm@burnout.eng.umd.edu) + + * Makefile.in (dist): Add .., ../etc, and ../texinfo files. + + * acspecific.m4 (AC_LN_S): Add verbose messages. + + * Makefile.in, configure.in: Add autoscan and its data files. + Check for perl. diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..0c5a071 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,32 @@ +# Having a separate GNUmakefile lets me `include' the dynamically +# generated rules created via Makefile.maint as well as Makefile.maint itself. +# This makefile is used only if you run GNU Make. +# It is necessary if you want to build targets usually of interest +# only to the maintainer. + +# Systems where /bin/sh is not the default shell need this. The $(shell) +# command below won't work with e.g. stock DOS/Windows shells. +SHELL = /bin/sh + +have-Makefile := $(shell test -f Makefile && echo yes) + +# If the user runs GNU make but has not yet run ./configure, +# give them a diagnostic. +ifeq ($(have-Makefile),yes) + +include Makefile +include $(srcdir)/Makefile.maint + +else + +all: + @echo There seems to be no Makefile in this directory. + @echo "You must run ./configure before running \`make'." + @exit 1 + +endif + +# Tell version 3.79 and up of GNU make to not build goals in this +# directory in parallel. This is necessary in case someone tries to +# build multiple targets on one command line. +.NOTPARALLEL: @@ -0,0 +1,223 @@ +1 Basic Installation +==================== + +These are generic installation instructions. + + The 'configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a 'Makefile' in each directory of the package. +It may also create one or more '.h' files containing system-dependent +definitions. Finally, it creates a shell script 'config.status' that +you can run in the future to recreate the current configuration, and a +file 'config.log' containing compiler output (useful mainly for +debugging 'configure'). + + It can also use an optional file (typically called 'config.cache' and +enabled with '--cache-file=config.cache' or simply '-C') that saves the +results of its tests to speed up reconfiguring. (Caching is disabled by +default to prevent problems with accidental use of stale cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how 'configure' could check whether to do them, and mail +diffs or instructions to the address given in the 'README' so they can +be considered for the next release. If you are using the cache, and at +some point 'config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file 'configure.ac' (or 'configure.in') is used to create +'configure' by a program called 'autoconf'. You only need +'configure.ac' if you want to change it or regenerate 'configure' using +a newer version of 'autoconf'. + +The simplest way to compile this package is: + + 1. 'cd' to the directory containing the package's source code and type + './configure' to configure the package for your system. If you're + using 'csh' on an old version of System V, you might need to type + 'sh ./configure' instead to prevent 'csh' from trying to execute + 'configure' itself. + + Running 'configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type 'make' to compile the package. + + 3. Optionally, type 'make check' to run any self-tests that come with + the package. + + 4. Type 'make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing 'make clean'. To also remove the + files that 'configure' created (so you can compile the package for + a different kind of computer), type 'make distclean'. There is + also a 'make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +2 Compilers and Options +======================= + +Some systems require unusual options for compilation or linking that the +'configure' script does not know about. Run './configure --help' for +details on some of the pertinent environment variables. + + You can give 'configure' initial values for variables by setting them +in the environment. You can do that on the command line like this: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Environment Variables::, for more details. + +3 Compiling For Multiple Architectures +====================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of 'make' that +supports the 'VPATH' variable, such as GNU 'make'. 'cd' to the +directory where you want the object files and executables to go and run +the 'configure' script. 'configure' automatically checks for the source +code in the directory that 'configure' is in and in '..'. + + If you have to use a 'make' that does not support the 'VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use 'make distclean' before reconfiguring for another +architecture. + +4 Installation Names +==================== + +By default, 'make install' will install the package's files in +'/usr/local/bin', '/usr/local/man', etc. You can specify an +installation prefix other than '/usr/local' by giving 'configure' the +option '--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give 'configure' the option '--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. Documentation +and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like '--bindir=PATH' to specify different values for particular +kinds of files. Run 'configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving 'configure' the +option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. + +5 Optional Features +=================== + +Some packages pay attention to '--enable-FEATURE' options to +'configure', where FEATURE indicates an optional part of the package. +They may also pay attention to '--with-PACKAGE' options, where PACKAGE +is something like 'gnu-as' or 'x' (for the X Window System). The +'README' should mention any '--enable-' and '--with-' options that the +package recognizes. + + For packages that use the X Window System, 'configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the 'configure' options '--x-includes=DIR' and +'--x-libraries=DIR' to specify their locations. + +6 Specifying the System Type +============================ + +There may be some features 'configure' cannot figure out automatically, +but needs to determine by the type of host the package will run on. +Usually 'configure' can figure that out, but if it prints a message +saying it cannot guess the host type, give it the '--build=TYPE' option. +TYPE can either be a short name for the system type, such as 'sun4', or +a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file 'config.sub' for the possible values of each field. If +'config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are _building_ compiler tools for cross-compiling, you should +use the '--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the host +platform (i.e., that on which the generated programs will eventually be +run) with '--host=TYPE'. In this case, you should also specify the +build platform with '--build=TYPE', because, in this case, it may not be +possible to guess the build platform (it sometimes involves compiling +and running simple test programs, and this can't be done if the compiler +is a cross compiler). + +7 Sharing Defaults +================== + +If you want to set default values for 'configure' scripts to share, you +can create a site shell script called 'config.site' that gives default +values for variables like 'CC', 'cache_file', and 'prefix'. 'configure' +looks for 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Or, you can set the +'CONFIG_SITE' environment variable to the location of the site script. +A warning: not all 'configure' scripts look for a site script. + +8 Environment Variables +======================= + +Variables not defined in a site shell script can be set in the +environment passed to configure. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the 'configure' command line, using 'VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +9 'configure' Invocation +======================== + +'configure' recognizes the following options to control how it operates. + +'--help' +'-h' + Print a summary of the options to 'configure', and exit. + +'--version' +'-V' + Print the version of Autoconf used to generate the 'configure' + script, and exit. + +'--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally 'config.cache'. FILE defaults to '/dev/null' to + disable caching. + +'--config-cache' +'-C' + Alias for '--cache-file=config.cache'. + +'--quiet' +'--silent' +'-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to '/dev/null' (any error + messages will still be shown). + +'--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + 'configure' can determine that directory automatically. + +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. diff --git a/INSTALL.txt b/INSTALL.txt new file mode 100644 index 0000000..eac2710 --- /dev/null +++ b/INSTALL.txt @@ -0,0 +1,223 @@ +1 Basic Installation +==================== + +These are generic installation instructions. + + The 'configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a 'Makefile' in each directory of the package. +It may also create one or more '.h' files containing system-dependent +definitions. Finally, it creates a shell script 'config.status' that +you can run in the future to recreate the current configuration, and a +file 'config.log' containing compiler output (useful mainly for +debugging 'configure'). + + It can also use an optional file (typically called 'config.cache' and +enabled with '--cache-file=config.cache' or simply '-C') that saves the +results of its tests to speed up reconfiguring. (Caching is disabled by +default to prevent problems with accidental use of stale cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how 'configure' could check whether to do them, and mail +diffs or instructions to the address given in the 'README' so they can +be considered for the next release. If you are using the cache, and at +some point 'config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file 'configure.ac' (or 'configure.in') is used to create +'configure' by a program called 'autoconf'. You only need +'configure.ac' if you want to change it or regenerate 'configure' using +a newer version of 'autoconf'. + +The simplest way to compile this package is: + + 1. 'cd' to the directory containing the package's source code and type + './configure' to configure the package for your system. If you're + using 'csh' on an old version of System V, you might need to type + 'sh ./configure' instead to prevent 'csh' from trying to execute + 'configure' itself. + + Running 'configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type 'make' to compile the package. + + 3. Optionally, type 'make check' to run any self-tests that come with + the package. + + 4. Type 'make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing 'make clean'. To also remove the + files that 'configure' created (so you can compile the package for + a different kind of computer), type 'make distclean'. There is + also a 'make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +2 Compilers and Options +======================= + +Some systems require unusual options for compilation or linking that the +'configure' script does not know about. Run './configure --help' for +details on some of the pertinent environment variables. + + You can give 'configure' initial values for variables by setting them +in the environment. You can do that on the command line like this: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Environment Variables::, for more details. + +3 Compiling For Multiple Architectures +====================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of 'make' that +supports the 'VPATH' variable, such as GNU 'make'. 'cd' to the +directory where you want the object files and executables to go and run +the 'configure' script. 'configure' automatically checks for the source +code in the directory that 'configure' is in and in '..'. + + If you have to use a 'make' that does not support the 'VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use 'make distclean' before reconfiguring for another +architecture. + +4 Installation Names +==================== + +By default, 'make install' will install the package's files in +'/usr/local/bin', '/usr/local/man', etc. You can specify an +installation prefix other than '/usr/local' by giving 'configure' the +option '--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give 'configure' the option '--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. Documentation +and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like '--bindir=PATH' to specify different values for particular +kinds of files. Run 'configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving 'configure' the +option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. + +5 Optional Features +=================== + +Some packages pay attention to '--enable-FEATURE' options to +'configure', where FEATURE indicates an optional part of the package. +They may also pay attention to '--with-PACKAGE' options, where PACKAGE +is something like 'gnu-as' or 'x' (for the X Window System). The +'README' should mention any '--enable-' and '--with-' options that the +package recognizes. + + For packages that use the X Window System, 'configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the 'configure' options '--x-includes=DIR' and +'--x-libraries=DIR' to specify their locations. + +6 Specifying the System Type +============================ + +There may be some features 'configure' cannot figure out automatically, +but needs to determine by the type of host the package will run on. +Usually 'configure' can figure that out, but if it prints a message +saying it cannot guess the host type, give it the '--build=TYPE' option. +TYPE can either be a short name for the system type, such as 'sun4', or +a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file 'config.sub' for the possible values of each field. If +'config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are _building_ compiler tools for cross-compiling, you should +use the '--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the host +platform (i.e., that on which the generated programs will eventually be +run) with '--host=TYPE'. In this case, you should also specify the +build platform with '--build=TYPE', because, in this case, it may not be +possible to guess the build platform (it sometimes involves compiling +and running simple test programs, and this can't be done if the compiler +is a cross compiler). + +7 Sharing Defaults +================== + +If you want to set default values for 'configure' scripts to share, you +can create a site shell script called 'config.site' that gives default +values for variables like 'CC', 'cache_file', and 'prefix'. 'configure' +looks for 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Or, you can set the +'CONFIG_SITE' environment variable to the location of the site script. +A warning: not all 'configure' scripts look for a site script. + +8 Environment Variables +======================= + +Variables not defined in a site shell script can be set in the +environment passed to configure. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the 'configure' command line, using 'VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + +9 'configure' Invocation +======================== + +'configure' recognizes the following options to control how it operates. + +'--help' +'-h' + Print a summary of the options to 'configure', and exit. + +'--version' +'-V' + Print the version of Autoconf used to generate the 'configure' + script, and exit. + +'--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally 'config.cache'. FILE defaults to '/dev/null' to + disable caching. + +'--config-cache' +'-C' + Alias for '--cache-file=config.cache'. + +'--quiet' +'--silent' +'-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to '/dev/null' (any error + messages will still be shown). + +'--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + 'configure' can determine that directory automatically. + +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..259a54a --- /dev/null +++ b/Makefile.in @@ -0,0 +1,604 @@ +# Copyright 2010-2022,2023 Thomas E. Dickey +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datarootdir = @datarootdir@ +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 = . + +AUTOCONF = @AUTOCONF@ +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 = : +AWK = @AWK@ +HELP2MAN = @HELP2MAN@ +M4 = @M4@ +PACKAGE = @PACKAGE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_BUGREPORT_PL = @PACKAGE_BUGREPORT_PL@ +PERL = @PERL@ +PERLSCRIPTS = @PERLSCRIPTS@ +VERSION = @VERSION@ + +EGREP = @EGREP@ +FGREP = @FGREP@ + +SUBDIRS = . config m4 man doc tests + +SUFFIXES = .m4 .m4f +WGET = wget + +bin_SCRIPTS = autoconf autoheader autoreconf ifnames @PERLSCRIPTS@ +EXTRA_SCRIPTS = autoscan autoupdate + + +# FIXME: +# s/distpackageDATA/dist_pkgdata_DATA/ +# s/nodistpackageDATA/nodist_pkgdata_DATA/ +# and adapt dependencies once we use a more recent Automake +m4sources = m4sugar.m4 m4sh.m4 \ + $(srcdir)/acversion.m4 \ + autoconf.m4 \ + acgeneral.m4 acoldnames.m4 acspecific.m4 aclang.m4 \ + acfunctions.m4 acheaders.m4 actypes.m4 + + +distpkgdataDATA = acfunctions acheaders acidentifiers acmakevars acprograms \ + aclibraries $(m4sources) + + +nodistpkgdataDATA = autoconf.m4f + +pkgdata_DATA = $(distpkgdataDATA) $(nodistpkgdataDATA) + +EXTRA_DIST = ChangeLog.0 ChangeLog.1 ChangeLog.2 \ + BUGS INSTALL.txt \ + acversion.in \ + autoconf.in autoheader.in autoreconf.in autoupdate.in ifnames.in \ + autoscan.in \ + $(distpkgdataDATA) \ + GNUmakefile Makefile.maint + + +# Files that should be removed, but which Automake does not know: +# the frozen files and the scripts. +CLEANFILES = autoconf.m4f \ + $(bin_SCRIPTS) + + +MAKEINFO = @MAKEINFO@ --no-headers --no-validate --no-split + +MAINTAINERCLEANFILES = acversion.m4 INSTALL.txt + +edit_sh = sed \ + -e 's,@SHELL\@,$(SHELL),g' \ + -e 's,@PERL\@,$(PERL),g' \ + -e 's,@datadir\@,$(pkgdatadir),g' \ + -e 's,@bindir\@,$(bindir),g' \ + -e 's,@autoconf-name\@,'`echo autoconf | sed '$(transform)'`',g' \ + -e 's,@autoheader-name\@,'`echo autoheader | sed '$(transform)'`',g' \ + -e 's,@M4\@,$(M4),g' \ + -e 's,@AWK\@,$(AWK),g' \ + -e 's,@EGREP\@,$(EGREP),g' \ + -e 's,@FGREP\@,$(FGREP),g' \ + -e 's,@VERSION\@,$(VERSION),g' \ + -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \ + -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT),g' + +edit_pl = sed \ + -e 's,@SHELL\@,$(SHELL),g' \ + -e 's,@PERL\@,$(PERL),g' \ + -e 's,@datadir\@,$(pkgdatadir),g' \ + -e 's,@bindir\@,$(bindir),g' \ + -e 's,@autoconf-name\@,'`echo autoconf | sed '$(transform)'`',g' \ + -e 's,@autoheader-name\@,'`echo autoheader | sed '$(transform)'`',g' \ + -e 's,@M4\@,$(M4),g' \ + -e 's,@AWK\@,$(AWK),g' \ + -e 's,@EGREP\@,$(EGREP),g' \ + -e 's,@FGREP\@,$(FGREP),g' \ + -e 's,@VERSION\@,$(VERSION),g' \ + -e 's,@PACKAGE_NAME\@,$(PACKAGE_NAME),g' \ + -e 's,@PACKAGE_BUGREPORT\@,$(PACKAGE_BUGREPORT_PL),g' + + +prev_version_file = $(srcdir)/config/prev-version.txt +release_archive_dir = releases + +# Uploading betas. +hosts = alpha +alpha_host = alpha.gnu.org +alpha_url_dir = gnu/autoconf + +# Files to update automatically. +wget_files = $(srcdir)/config/config.guess $(srcdir)/config/config.sub \ + $(srcdir)/config/texinfo.tex \ + $(srcdir)/doc/standards.texi $(srcdir)/doc/make-stds.texi + +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +CONFIG_CLEAN_FILES = +SCRIPTS = $(bin_SCRIPTS) + +DIST_SOURCES = +DATA = $(pkgdata_DATA) + + +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 AUTHORS COPYING ChangeLog INSTALL Makefile.am \ + Makefile.in NEWS THANKS TODO aclocal.m4 configure configure.ac +DIST_SUBDIRS = $(SUBDIRS) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .m4 .m4f + +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.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) +install-binSCRIPTS: $(bin_SCRIPTS) + @$(NORMAL_INSTALL) + mkdir -p $(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 +uninstall-info-am: +install-pkgdataDATA: $(pkgdata_DATA) + @$(NORMAL_INSTALL) + mkdir -p $(DESTDIR)$(pkgdatadir) + @list='$(pkgdata_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f"; \ + $(INSTALL_DATA) $$d$$p $(DESTDIR)$(pkgdatadir)/$$f; \ + done + +uninstall-pkgdataDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgdata_DATA)'; for p in $$list; do \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " rm -f $(DESTDIR)$(pkgdatadir)/$$f"; \ + rm -f $(DESTDIR)$(pkgdatadir)/$$f; \ + done + +# 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) $(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)$$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 = . +# Avoid unsightly `./'. +distdir = $(PACKAGE)-$(VERSION) + +GZIP_ENV = --best + +distdir: $(DISTFILES) + @if sed 15q $(srcdir)/NEWS | $(FGREP) -e "$(VERSION)" >/dev/null; \ + then :; else \ + echo "NEWS not updated; not releasing" 1>&2; \ + exit 1; \ + fi + -chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir) + mkdir $(distdir) + mkdir -p $(distdir)/$(srcdir) $(distdir)/tests + @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 \ + mkdir -p "$(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 + -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 \ + && $(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 +check: check-recursive +all-am: Makefile $(SCRIPTS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + mkdir -p $(DESTDIR)$(bindir) $(DESTDIR)$(pkgdatadir) + +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: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic 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-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: install-pkgdataDATA + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook + +install-exec-am: install-binSCRIPTS + +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-generic + +uninstall-am: uninstall-binSCRIPTS uninstall-info-am \ + uninstall-pkgdataDATA + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ + clean-generic clean-recursive dist dist-all distcheck distclean \ + distclean-generic distclean-recursive distclean-tags distdir \ + dvi dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-binSCRIPTS 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-pkgdataDATA \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive tags tags-recursive uninstall \ + uninstall-am uninstall-binSCRIPTS uninstall-info-am \ + uninstall-info-recursive uninstall-pkgdataDATA \ + uninstall-recursive + + +# - acversion.m4 needs to be updated only once, since it depends on +# configure.ac, not on the results of a 'configure' run. +# - It is guaranteed (with GNU Make) that when the version in configure.ac +# is changed, acversion.m4 is built only after the new version number is +# propagated to the Makefile. (Libtool uses the same guarantee.) + +$(srcdir)/acversion.m4: $(srcdir)/acversion.in $(srcdir)/configure.ac + sed 's,@VERSION\@,$(VERSION),g' $(srcdir)/acversion.in >acversion.tm4 + mv acversion.tm4 $(srcdir)/acversion.m4 +INSTALL.txt: $(top_srcdir)/doc/install.texi + $(MAKEINFO) $(top_srcdir)/doc/install.texi --output=$(srcdir)/INSTALL.txt + cp $(srcdir)/INSTALL.txt $(srcdir)/INSTALL + +maintainer-check: maintainer-check-tests +maintainer-check-tests: + cd tests && make maintainer-check + +install-data-hook: INSTALL.txt + @$(NORMAL_INSTALL) + @list='INSTALL'; for p in $$list; do \ + if test -f "$$p.txt"; then d= ; else d="$(srcdir)/"; fi; \ + f="`echo $$p | sed -e 's|^.*/||'`"; \ + echo " $(INSTALL_DATA) $$d$$p.txt $(DESTDIR)$(pkgdatadir)/$$f"; \ + $(INSTALL_DATA) $$d$$p.txt $(DESTDIR)$(pkgdatadir)/$$f; \ + done + +autoconf: $(srcdir)/autoconf.in $(srcdir)/configure.ac + rm -f $@ $@.tmp + $(edit_sh) $(srcdir)/$@.in >$@.tmp + chmod +x $@.tmp + mv $@.tmp $@ + +autoheader: $(srcdir)/autoheader.in $(srcdir)/configure.ac + rm -f $@ $@.tmp + $(edit_sh) $(srcdir)/$@.in >$@.tmp + chmod +x $@.tmp + mv $@.tmp $@ + +autoreconf: $(srcdir)/autoreconf.in $(srcdir)/configure.ac + rm -f $@ $@.tmp + $(edit_sh) $(srcdir)/$@.in >$@.tmp + chmod +x $@.tmp + mv $@.tmp $@ + +autoupdate: $(srcdir)/autoupdate.in $(srcdir)/configure.ac + rm -f $@ $@.tmp + $(edit_pl) $(srcdir)/$@.in >$@.tmp + chmod +x $@.tmp + mv $@.tmp $@ + +ifnames: $(srcdir)/ifnames.in $(srcdir)/configure.ac + rm -f $@ $@.tmp + $(edit_sh) $(srcdir)/$@.in >$@.tmp + chmod +x $@.tmp + mv $@.tmp $@ + +autoscan: $(srcdir)/autoscan.in $(srcdir)/configure.ac + rm -f $@ $@.tmp + $(edit_pl) $(srcdir)/$@.in >$@.tmp + chmod +x $@.tmp + mv $@.tmp $@ + +# When processing the file with diversion disabled, there must be no +# output but comments and empty lines. +# If freezing produces output, something went wrong: a bad `divert', +# or an improper paren etc. +# It may happen that the output does not end with a end of line, hence +# force an end of line when reporting errors. +.m4.m4f: + $(M4) --include $(srcdir) --fatal-warning --define divert \ + $(srcdir)/$*.m4 2>error.log | \ + sed 's/#.*//;/^$$/d' >process.log + if grep . error.log >/dev/null 2>&1; then \ + echo "ERROR: Processing $(srcdir)/$*.m4 produced errors:" >&2; \ + sed "s,^,$(srcdir)/$*.m4: ," <error.log >&2; \ + echo >&2; \ + exit 1; \ + else \ + rm -f error.log; \ + fi + if grep . process.log >/dev/null 2>&1; then \ + echo "ERROR: Processing $(srcdir)/$*.m4 produced output:" >&2; \ + sed "s,^,$(srcdir)/$*.m4: ," <process.log >&2; \ + echo >&2; \ + exit 1; \ + else \ + rm -f process.log; \ + fi + $(M4) --include $(srcdir) --fatal-warning --freeze-state=$*.m4f \ + $(srcdir)/$*.m4 >freeze.log + if grep . freeze.log >/dev/null 2>&1; then \ + echo "ERROR: Freezing $(srcdir)/$*.m4 produced output:" >&2; \ + sed "s,^,$(srcdir)/$*.m4: ," <freeze.log >&2; \ + echo >&2; \ + exit 1; \ + else \ + rm -f freeze.log; \ + fi + +autoconf.m4f: $(m4sources) +# 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 --git a/Makefile.maint b/Makefile.maint new file mode 100644 index 0000000..af0d794 --- /dev/null +++ b/Makefile.maint @@ -0,0 +1,274 @@ +# -*-Makefile-*- +# This Makefile fragment is shared between fileutils, sh-utils, textutils, +# and Autoconf. + +prev_version_file ?= .prev-version + +THIS_VERSION_REGEXP = $(subst .,\.,$(VERSION)) +PREV_VERSION := $(shell cat $(prev_version_file)) +PREV_VERSION_REGEXP := $(shell echo $(PREV_VERSION)|sed 's/\./\\./g') + +tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]') +tag-this-version = $(subst .,_,$(VERSION)) +tag-prev-version = $(subst .,_,$(PREV_VERSION)) +this-cvs-tag = $(tag-package)-$(tag-this-version) +prev-cvs-tag = $(tag-package)-$(tag-prev-version) +my_distdir = $(PACKAGE)-$(VERSION) + +# Old releases are stored here. +# Used for diffs and xdeltas. +release_archive_dir ?= ../release + + + +## --------------- ## +## Sanity checks. ## +## --------------- ## + +# Checks that don't require cvs. +local-check: changelog-check po-check writable-files copyright-check + +changelog-check: + if head ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \ + :; \ + else \ + echo "$(VERSION) not in ChangeLog" 1>&2; \ + exit 1; \ + fi + +# Verify that all source files using _() are listed in po/POTFILES.in. +po-check: + if test -f po/POTFILES.in; then \ + grep -E -v '^(#|$$)' po/POTFILES.in | sort > $@-1; \ + grep -E -l '\b_\(' lib/*.c src/*.c | sort > $@-2; \ + diff -u $@-1 $@-2 || exit 1; \ + rm -f $@-1 $@-2; \ + fi + +# Check that `make alpha' will not fail at the end of the process. +writable-files: + if test -d $(release_archive_dir); then :; else \ + mkdir $(release_archive_dir); \ + fi + for file in $(distdir).tar.gz $(xd-delta) \ + $(release_archive_dir)/$(distdir).tar.gz \ + $(release_archive_dir)/$(xd-delta); do \ + test -e $$file || continue; \ + test -w $$file \ + || { echo ERROR: $$file is not writable; fail=1; }; \ + done; \ + test "$$fail" && exit 1 || : + +# Make sure that the copyright date in lib/version-etc.c is up to date. +copyright-check: + @if test -f lib/version-etc.c; then \ + grep 'N_("Copyright (C) $(shell date +%Y) Free' lib/version-etc.c \ + >/dev/null \ + || { echo 'out of date copyright in $<; update it' 1>&2; exit 1; }; \ + fi + + +# Sanity checks with the CVS repository. +cvs-tag-check: + echo $(this-cvs-tag); \ + if cvs -n log -h README | grep -e $(this-cvs-tag): >/dev/null; then \ + echo "$(this-cvs-tag) as already been used; not tagging" 1>&2; \ + exit 1; \ + else :; fi + +cvs-diff-check: + if cvs diff >cvs-diffs; then \ + rm cvs-diffs; \ + else \ + echo "Some files are locally modified:" 1>&2; \ + cat cvs-diffs; \ + exit 1; \ + fi + +cvs-check: cvs-diff-check cvs-tag-check + +maintainer-distcheck: changelog-check + $(MAKE) distcheck + $(MAKE) my-distcheck + + +# Do not save the original name or timestamp in the .tar.gz file. +GZIP_ENV = '--no-name --best' + +# Automake 1.4 does not define AMTAR. +AMTAR ?= $(TAR) + +# Tag before making distribution. Also, don't make a distribution if +# checks fail. Also, make sure the NEWS file is up-to-date. +# FIXME: use dist-hook/my-dist like distcheck-hook/my-distcheck. +cvs-dist: cvs-check maintainer-distcheck + cvs update po + cvs tag -c $(this-cvs-tag) + $(MAKE) dist + +# Use this to make sure we don't run these programs when building +# from a virgin tgz file, below. +null_AM_MAKEFLAGS = \ + AUTOCONF=false \ + AUTOHEADER=false \ + MAKEINFO=false + +# Detect format-string/arg-list mismatches that would normally be obscured +# by the use of _(). The --disable-nls effectively defines away that macro, +# and building with CFLAGS='-Wformat -Werror' causes any format warning to be +# treated as a failure. +t=./=test +my-distcheck: writable-files po-check + -rm -rf $(t) + mkdir $(t) + GZIP=$(GZIP_ENV) $(AMTAR) -C $(t) -zxf $(distdir).tar.gz + cd $(t)/$(distdir) \ + && ./configure --disable-nls \ + && $(MAKE) CFLAGS='-Wformat -Werror' \ + AM_MAKEFLAGS='$(null_AM_MAKEFLAGS)' \ + && $(MAKE) dvi \ + && $(MAKE) check \ + && $(MAKE) distclean + cd $(t) && mv $(distdir) $(distdir).old \ + && $(AMTAR) -zxf ../$(distdir).tar.gz + diff -ur $(t)/$(distdir).old $(t)/$(distdir) + -rm -rf $(t) + @echo "========================"; \ + echo "$(distdir).tar.gz is ready for distribution"; \ + echo "========================" + +# This must be the same name on both hosts. +# Make it a symlink that points to the right place. +real_dir = fetish-ftp + +url_dir_list = $(foreach x,$(hosts),ftp://$($(x)_host)/$($(x)_url_dir)) + +tgz-md5 = $(shell md5sum < $(my_distdir).tar.gz|sed 's/ -//') +tgz-sha1 = $(shell sha1sum < $(my_distdir).tar.gz|sed 's/ -//') +bz2-md5 = $(shell md5sum < $(my_distdir).tar.bz2|sed 's/ -//') +bz2-sha1 = $(shell sha1sum < $(my_distdir).tar.bz2|sed 's/ -//') +tgz-size = $(shell du --human $(my_distdir).tar.gz|sed 's/\([Mk]\).*/ \1B/') +bz2-size = $(shell du --human $(my_distdir).tar.bz2|sed 's/\([Mk]\).*/ \1B/') +xd-size = $(shell du --human $(xd-delta)|sed 's/\([Mk]\).*/ \1B/') + +rel-check: + tarz=/tmp/rel-check-tarz-$$$$; \ + md5_tmp=/tmp/rel-check-md5-$$$$; \ + set -e; \ + trap 'status=$$?; rm -f $$tarz $$md5_tmp; exit $$status' 0 1 2 3 15; \ + wget -q --output-document=$$tarz $(url); \ + echo "$(md5) -" > $$md5_tmp; \ + md5sum -c $$md5_tmp < $$tarz + +prev-tgz = $(PACKAGE)-$(PREV_VERSION).tar.gz +xd-delta = $(PACKAGE)-$(PREV_VERSION)-$(VERSION).xdelta + +GZIP = gzip +BZIP2 = bzip2 +$(my_distdir).tar.bz2: $(my_distdir).tar.gz + $(GZIP) -dc $< > $(my_distdir).tar + rm -f $@ + $(BZIP2) -9 $(my_distdir).tar + +rel-files = $(xd-delta) $(distdir).tar.bz2 $(distdir).tar.gz +announcement: NEWS ChangeLog $(rel-files) + @( \ + echo Subject: $(my_distdir) released; \ + echo; \ + echo FIXME: put comments here; \ + echo; \ + for url in $(url_dir_list); do \ + echo " $$url/$(my_distdir).tar.gz ($(tgz-size))"; \ + echo " $$url/$(my_distdir).tar.bz2 ($(bz2-size))"; \ + done; \ + echo; \ + echo And here are xdelta-style diffs; \ + echo; \ + for url in $(url_dir_list); do \ + echo " $$url/$(xd-delta) ($(xd-size))"; \ + done; \ + echo; \ + echo "Here are the MD5 and SHA1 signatures for the compressed tar files:"; \ + echo; \ + echo "$(tgz-md5) $(my_distdir).tar.gz"; \ + echo "$(bz2-md5) $(my_distdir).tar.bz2"; \ + echo "$(tgz-sha1) $(my_distdir).tar.gz"; \ + echo "$(bz2-sha1) $(my_distdir).tar.bz2"; \ + echo; \ + echo NEWS:; \ + sed -n "/$(THIS_VERSION_REGEXP)[]:]/,/$(PREV_VERSION_REGEXP)[]:]/p" NEWS \ + | grep -v '^\['; \ + echo; \ + echo ChangeLog entries:; \ + find . -name ChangeLog -maxdepth 2 \ + | xargs cvs diff -up -r$(prev-cvs-tag) -rHEAD \ + | sed -n 's/^+//p' \ + | perl -ne 'm!^\+\+ (\./)?! or print,next;' \ + -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; \ + ) + +WGET = wget +ftp-gnu = ftp://ftp.gnu.org/gnu + +# Use mv, if you don't have/want move-if-change. +move_if_change ?= move-if-change + +# The following pseudo table associates a local directory and a URL +# with each of the files that belongs to some other package and is +# regularly updated from the specified URL. +wget_files ?= $(srcdir)/config.guess $(srcdir)/config.sub \ + $(srcdir)/src/ansi2knr.c \ + $(srcdir)/doc/texinfo.tex +get-targets = $(patsubst %, get-%, $(wget_files)) + +config.guess-url_prefix = $(ftp-gnu)/config/ +config.sub-url_prefix = $(ftp-gnu)/config/ + +ansi2knr.c-url_prefix = ftp://ftp.cs.wisc.edu/ghost/ + +texinfo.tex-url_prefix = $(ftp-gnu)/texinfo/ + +standards.texi-url_prefix = $(ftp-gnu)/GNUinfo/ +make-stds.texi-url_prefix = $(ftp-gnu)/GNUinfo/ + +target = $(patsubst get-%, %, $@) +url = $($(notdir $(target))-url_prefix)$(notdir $(target)) + +.PHONY: $(get-targets) +$(get-targets): + $(WGET) $(url) -O $(target).t \ + && $(move_if_change) $(target).t $(target) + +automake_repo=:pserver:anoncvs@anoncvs.cygnus.com:/cvs/automake +.PHONY: wget-update +wget-update: $(get-targets) + for f in depcomp missing; do \ + test -f $$f || continue; \ + echo checking out $$f...; \ + cvs -d $(automake_repo) co -p automake/lib/$$f > $$f.t \ + && $(move_if_change) $$f.t $$f; \ + done + +define emit-rsync-commands + echo ===================================== + echo ===================================== + echo 'for host in $(a_host) $(b_host); do \' + echo ' rsync -e ssh --pro -av $(xd-delta) $(my_distdir).tar.bz2 \' + echo ' $(my_distdir).tar.gz $$host:$(real_dir); done' + echo '# send the /tmp/announcement e-mail' + echo ===================================== + echo ===================================== +endef + +$(xd-delta): $(release_archive_dir)/$(prev-tgz) $(distdir).tar.gz + xdelta delta -9 $^ $@ || : + +alpha: local-check + $(MAKE) cvs-dist + $(MAKE) $(xd-delta) + $(MAKE) -s announcement > /tmp/announce-$(my_distdir) + ln $(rel-files) $(release_archive_dir) + chmod a-w $(rel-files) + echo $(VERSION) > $(prev_version_file) + cvs ci -m. $(prev_version_file) + @$(emit-rsync-commands) @@ -0,0 +1,660 @@ +* Major changes in Autoconf 2.52 -*- outline -*- +** Documentation +- AC_ARG_VAR +- Quadrigraphs + This feature was present in autoconf 2.50 but was not documented. + For example, `@<:@' is translated to `[' just before output. This + is useful when writing strings that contain unbalanced quotes, or + other hard-to-quote constructs. +- m4_pattern_forbid, m4_pattern_allow +- Tips for upgrading from 2.13. +- Using autoscan to maintain a configure.ac. + +** Default includes +- Now include stdint.h. +- sys/types.h and sys/stat.h are guarded. +- strings.h is included if available, and not conflicting with string.h. + +** Bug fixes +- The test suite is more robust and presents less false failures. +- Invocation of GNU M4 now robust to POSIXLY_CORRECT. +- configure accepts --prefix='' again. +- AC_CHECK_LIB works properly when its first argument is not a + literal. +- HAVE_INTTYPES_H is defined only if not conflicting with sys/types.h. +- build_, host_, and target_alias are AC_SUBST as in 2.13. +- AC_ARG_VAR properly propagates precious variables inherited from the + environment to ./config.status. +- Using --program-suffix/--program-prefix is portable. +- Failures to detect the default compiler's output extension are less + likely. +- `config.status foo' works properly when `foo' depends on variables + set in an AC_CONFIG_THING INIT-CMD. +- autoheader is more robust to broken input. +- Fixed Fortran name-mangling and link tests on a number of systems, + e.g. NetBSD; see AC_F77_DUMMY_MAIN, below. + +** Generic macros +- AC_CHECK_HEADER and AC_CHECK_HEADERS support a fourth argument to + specify pre-includes. In this case, the headers are compiled with + cc, not merely preprocessed by cpp. Therefore it is the _usability_ + of a header which is checked for, not just its availability. +- AC_ARG_VAR refuses to run configure when precious variables have + changed. +- Versions of compilers are dumped in the logs. +- AC_CHECK_TYPE recognizes use of `foo_t' as a replacement type. + +** Specific Macros +- AC_PATH_XTRA only adds -ldnet to $LIBS if it's needed to link. +- AC_FUNC_WAIT3 and AC_SYS_RESTARTABLE_SYSCALLS are obsoleted. +- AM_FUNC_ERROR_AT_LINE, AM_FUNC_FNMATCH, AM_FUNC_MKTIME, + AM_FUNC_OBSTACK, and AM_FUNC_STRTOD are now activated. + Be sure to read `Upgrading from Version 2.13' to understand why + running `autoupdate' is needed. +- AC_F77_DUMMY_MAIN, AC_F77_MAIN: new macros to detect whether + a main-like routine is required/possible when linking C/C++ with + Fortran. Users of e.g. AC_F77_WRAPPERS should be aware of these. +- AC_FUNC_GETPGRG behaves better when cross-compiling. + +* Major changes in Autoconf 2.50 + +** Lots of bug fixes +There have been far too many to enumerate them here. Check out +ChangeLog if you really want to know more. + +** Improved documentation +In particular, portability issues are better covered. + +** Use of Automake +All the standard GNU Makefile targets are supported. The layout has +changed: m4/ holds the m4 extensions Autoconf needs for its +configuration, doc/ contains the documentation, and tests/ contains +the test suite. + +** Man pages are provided +For autoconf, autoreconf, autoupdate, autoheader, autoscan, ifnames, +config.guess, config.sub. + +** autoconf +- --trace + Provides a safe and powerful means to trace the macro uses. This + provide the parsing layer for tools which need to `study' + configure.in. + +- --warnings + Specify what category of warnings should be enabled. + +- When recursing into subdirectories, try for configure.gnu before + configure to adapt for packages not using autoconf on case-insensitive + filesystems. + +- Diagnostics + More errors are now caught (circular AC_REQUIRE dependencies, + AC_DEFINE in the action part of an AC_CACHE_CHECK, too many pops + etc.). In addition, their location and call stack are given. + +** autoupdate +autoupdate is much more powerful, and is able to provide the glue code +which might be needed to move from an old macro to its newer +equivalent. + +You are strongly encouraged to use it to modernize both your +`configure.in' and your .m4 extension files. + +** autoheader +The internal machinery of autoheader has completely changed. As a +result, using `acconfig.h' should be considered to be obsoleted, and +you are encouraged to get rid of it using the AH macros. + +** autoreconf +Extensive overhaul. + +** Fortran 77 compilers +Globally, the support for Fortran 77 is considerably improved. + +Support for automatically determining a Fortran 77 compiler's +name-mangling scheme. New CPP macros F77_FUNC and F77_FUNC_ are +provided to wrap C/C++ identifiers, thus making it easier and more +transparent for C/C++ to call Fortran 77 routines, and Fortran 77 to +call C/C++ routines. See the Texinfo documentation for details. + +** Test suite +The test suite no longer uses DejaGNU. It should be easy to submit +test cases in this new framework. + +** configure +- --help, --help=long, -hl + no longer dumps useless items. +- --help=short, -hs + lists only specific options. +- --help=recursive, -hr + displays the help of all the embedded packages. +- Remembers environment variables when reconfiguring. + The previous scheme to set envvar before running configure was + ENV=VAL ./configure + what prevented configure from remembering the environment in which + it was run, therefore --recheck was run in an inconsistent + environment. Now, one should run + ./configure ENV=VAR + and then --recheck will work properly. Variables declared with + AC_ARG_VAR are also preserved. +- cross-compilation + $build defaults to `config.guess`, $host to $build, and then $target + to $host. + Cross-compilation is a global status of the package, it no longer + depends upon the current language. + Cross compilation is enabled iff the user specified `--host'. + `configure' now fails if it can't run the executables it compiles, + unless cross-compilation is enabled. +- Cache file + The cache file is disabled by default. The new options + `--config-cache', `-C' set the cache to `config.cache'. + +** config.status +- faster + Much faster on most architectures. +- concurrent executions + It is safe to use `make -j' with config.status. +- human interface improved + It is possible to invoke + ./config.status foobar + instead of the former form (still valid) + CONFIG_COMMANDS= CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=foobar:foo.in:bar.in \ + ./config.status + The same holds for configuration headers and links. + You can instantiate unknown files and headers: + ./config.status --header foo.h:foo.h.in --file bar:baz +- has a useful --help +- accepts special file name "-" for stdin/stdout + + +** Identity Macros +- AC_COPYRIGHT + Specify additional copyright information. + +- AC_INIT + Now expects the identity of the package as argument. + +** General changes. +- Uniform quotation + Most macros, if not all, now strictly follow the `one quotation + level' rule. This results in a more predictable expansion. + +- AC_REQUIRE + A sly bug in the AC_REQUIRE machinery, which could produce incorrect + configure scripts, was fixed by Axel Thimm. + +** Setup Macros +- AC_ARG_VAR + Document and ask for the registration of an envvar. + +- AC_CONFIG_SRCDIR + Specifies the file which `configure' should look for when trying to + find the source tree (used to be handled by AC_INIT). + +- AC_CONFIG_COMMANDS + To add new actions to config.status. Should be used instead of + AC_OUTPUT_COMMANDS. + +- AC_CONFIG_LINKS + Replaces AC_LINK_FILES. + +- AC_CONFIG_HEADERS, AC_CONFIG_COMMANDS, AC_CONFIG_SUBDIRS, + AC_CONFIG_LINKS, and AC_CONFIG_FILES + They now obey sh: you should no longer use shell variables as + argument. Instead of + + test "$package_foo_enabled" = yes && $my_subdirs="$my_subdirs foo" + AC_CONFIG_SUBDIRS($my_subdirs) + + write + + if test "$package_foo_enabled" = yes; then + AC_CONFIG_SUBDIRS(foo) + fi + +- AC_HELP_STRING + To format an Autoconf macro's help string so that it looks pretty + when the user executes `configure --help'. + + +** Generic Test Macros +- AC_CHECK families + The interface of the AC_CHECK families of macros (decl, header, + type, member, func) is now uniform. They support the same set of + default includes. + +- AC_CHECK_DECL, AC_CHECK_DECLS + To check whether a symbol is declared. + +- AC_CHECK_SIZEOF, AC_C_CHAR_UNSIGNED. + No longer need a cross-compilation default. + +- AC_CHECK_TYPE + The test it performs is much more robust than previously, and makes + it possible to test builtin types in addition to typedefs. + It is now schizophrenic: + - AC_CHECK_TYPE(TYPE, REPLACEMENT) + remains for backward compatibility, but its use is discouraged. + - AC_CHECK_TYPE(TYPE, IF-FOUND, IF-NOT-FOUND, INCLUDES) + behaves exactly like the other AC_CHECK macros. + +- AC_CHECK_TYPES + Checks whether given types are supported by the system. + +- AC_CHECK_MEMBER, AC_CHECK_MEMBERS + Check for given members in aggregates (e.g., pw_gecos in struct + passwd). + +- AC_PROG_CC_STDC + Checks if the compiler supports ISO C, included when needs special + options. + +- AC_PROG_CPP + Checking whether the preprocessor indicates missing includes by the + error code. stderr is checked by AC_TRY_CPP only as a fallback. + +- AC_LANG + Takes a language as argument and replaces AC_LANG_C, + AC_LANG_CPLUSPLUS and AC_LANG_FORTRAN77. + +- AC_LANG_PUSH, AC_LANG_POP + Are preferred to AC_LANG_SAVE, AC_LANG_RESTORE. + +** Specific Macros +- AC_FUNC_CHOWN, AC_FUNC_MALLOC, AC_FUNC_STRERROR_R, + AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, AC_FUNC_STAT, AC_FUNC_LSTAT, + AC_FUNC_ERROR_AT_LINE, AC_FUNC_OBSTACK, AC_FUNC_STRTOD, AC_FUNC_FSEEKO. + New. + +- AC_FUNC_GETGROUPS + Sets GETGROUPS_LIBS. + +- AC_FUNC_GETLOADAVG + Defines `HAVE_STRUCT_NLIST_N_UN_N_NAME' instead of `NLIST_NAME_UNION'. + +- AC_PROG_LEX + Now integrates `AC_DECL_YYTEXT' which is obsoleted. + +- AC_SYS_LARGEFILE + Arrange for large-file support. + +- AC_EXEEXT, AC_OBJEXT + You are no longer expected to use them: their computation is + performed by default. + +** C++ compatibility + Every macro has been revisited in order to support at best CC=c++. + +Major changes in Autoconf 2.14: + There was no release of GNU Autoconf 2.14. + +Major changes in Autoconf 2.13: + +* Support for building on Win32 systems where the only available C or + C++ compiler is the Microsoft Visual C++ command line compiler + (`cl'). Additional support for building on Win32 systems which are + using the Cygwin or Mingw32 environments. +* Support for alternative object file and executable file extensions. + On Win32, for example, these are .obj and .exe. These are discovered + using AC_OBJEXT and AC_EXEEXT, which substitute @OBJEXT@ and + @EXEEXT@ in the output, respectively. +* New macros: AC_CACHE_LOAD, AC_CACHE_SAVE, AC_FUNC_SELECT_ARGTYPES, + AC_VALIDATE_CACHED_SYSTEM_TUPLE, AC_SEARCH_LIBS, AC_TRY_LINK_FUNC, + AC_C_STRINGIZE, AC_CHECK_FILE(S), AC_PROG_F77 (and friends). +* AC_DEFINE now has an optional third argument for a description to be + placed in the config header input file (e.g. config.h.in). +* The C++ code fragment compiled for the C++ compiler test had to be + improved to include an explicit return type for main(). This was + causing failures on systems using recent versions of the EGCS C++ + compiler. +* Fixed an important bug in AC_CHECK_TYPE that would cause a configure + script to report that `sometype_t' was present when only `type_t' + was defined. +* Merge of the FSF version of config.guess and config.sub to modernise + these scripts. Add support for a few new hosts in config.guess. + Incorporate latest versions of install-sh, mkinstalldirs and + texinfo.tex from the FSF. +* autoreconf is capable of running automake if necessary (and + applicable). +* Support for Fortran 77. See the Texinfo documentation for details. +* Bug fixes and workarounds for quirky bugs in vendor utilities. + +Major changes in Autoconf 2.12: + +* AC_OUTPUT and AC_CONFIG_HEADER can create output files by + concatenating multiple input files separated by colons, like so: + AC_CONFIG_HEADER(config.h:conf.pre:config.h.in:conf.post) + AC_OUTPUT(Makefile:Makefile.in:Makefile.rules) + The arguments may be shell variables, to compute the lists on the fly. +* AC_LINK_FILES and AC_CONFIG_SUBDIRS may be called multiple times. +* New macro AC_OUTPUT_COMMANDS adds more commands to run in config.status. +* Bug fixes. + +Major changes in Autoconf 2.11: + +* AC_PROG_CC and AC_PROG_CXX check whether the compiler works. + They also default CFLAGS/CXXFLAGS to "-g -O2" for gcc, instead of "-g -O". +* AC_REPLACE_FUNCS defines HAVE_foo if the system has the function `foo'. +* AC_CONFIG_HEADER expands shell variables in its argument. +* New macros: AC_FUNC_FNMATCH, AC_FUNC_SETPGRP. +* The "checking..." messages and the source code for test programs that + fail are saved in config.log. +* Another workaround has been added for seds with small command length limits. +* config.sub and config.guess recognize more system types. +* Bug fixes. + +Major changes in Autoconf 2.10: + +* Bug fixes. +* The cache variable names used by `AC_CHECK_LIB(LIB, FUNC, ...)' has + changed: now $ac_cv_lib_LIB_FUNC, previously $ac_cv_lib_LIB. + +Major changes in Autoconfs 2.6 through 2.9: + +* Bug fixes. + +Major changes in Autoconf 2.5: + +* New configure options --bindir, --libdir, --datadir, etc., with + corresponding output variables. +* New macro: AC_CACHE_CHECK, to make using the cache easier. +* config.log contains the command being run as well as any output from it. +* AC_CHECK_LIB can check for libraries with "." or "/" or "+" in their name. +* AC_PROG_INSTALL doesn't cache a path to install-sh, for sharing caches. +* AC_CHECK_PROG, AC_PATH_PROG, AC_CHECK_PROGS, AC_PATH_PROGS, and + AC_CHECK_TOOL can search a path other than $PATH. +* AC_CHECK_SIZEOF takes an optional size to use when cross-compiling. + +Major changes in Autoconf 2.4: + +* Fix a few bugs found by Emacs testers. + +Major changes in Autoconf 2.3: + +* Fix the cleanup trap in several ways. +* Handle C compilers that are picky about option placement. +* ifnames gets the version number from the right directory. + +Major changes in Autoconf 2.2: + +* The ifnames utility is much faster but requires a "new awk" interpreter. +* AC_CHECK_LIB and AC_HAVE_LIBRARY check and add the new + library before existing libs, not after, in case it uses them. +* New macros: AC_FUNC_GETPGRP, AC_CHECK_TOOL. +* Lots of bug fixes. +* Many additions to the TODO file :-) + +Major changes in Autoconf 2.1: + +* Fix C++ problems. +* More explanations in the manual. +* Fix a spurious failure in the testsuite. +* Clarify some warning messages. +* autoreconf by default only rebuilds configure and config.h.in files + that are older than any of their particular input files; there is a + --force option to use after installing a new version of Autoconf. + +Thanks to everybody who's submitted changes and additions to Autoconf! +I've incorporated many of them, and am still considering others for +future releases -- but I didn't want to postpone this release indefinitely. + +Caution: don't indiscriminately rebuild configure scripts with +Autoconf version 2. Some configure.in files need minor adjustments to +work with it; the documentation has a chapter on upgrading. A few +configure.in files, including those for GNU Emacs and the GNU C +Library, need major changes because they relied on undocumented +internals of version 1. Future releases of those packages will have +updated configure.in files. + +It's best to use GNU m4 1.3 (or later) with Autoconf version 2. +Autoconf now makes heavy use of m4 diversions, which were implemented +inefficiently in GNU m4 releases before 1.3. + +Major changes in Autoconf 2.0: + +** New copyright terms: +* There are no restrictions on distribution or use of configure scripts. + +** Documentation: +* Autoconf manual is reorganized to make information easier to find + and has several new indexes. +* INSTALL is reorganized and clearer and is now made from Texinfo source. + +** New utilities: +* autoscan to generate a preliminary configure.in for a package by + scanning its source code for commonly used nonportable functions, + programs, and header files. +* ifnames to list the symbols used in #if and #ifdef directives in a + source tree. +* autoupdate to update a configure.in to use the version 2 macro names. +* autoreconf to recursively remake configure and configuration header + files in a source tree. + +** Changed utilities: +* autoheader can take pieces of acconfig.h to replace config.h.{top,bot}. +* autoconf and autoheader can look for package-local definition files + in an alternate directory. + +** New macros: +* AC_CACHE_VAL to share results of tests between configure runs. +* AC_DEFUN to define macros, automatically AC_PROVIDE them, and ensure + that macros invoked with AC_REQUIRE don't interrupt other macros. +* AC_CONFIG_AUX_DIR, AC_CANONICAL_SYSTEM, AC_CANONICAL_HOST, AC_LINK_FILES to + support deciding unguessable features based on the host and target types. +* AC_CONFIG_SUBDIRS to recursively configure a source tree. +* AC_ARG_PROGRAM to use the options --program-prefix, + --program-suffix, and --program-transform-name to change the names + of programs being installed. +* AC_PREFIX_DEFAULT to change the default installation prefix. +* AC_TRY_COMPILE to compile a test program without linking it. +* AC_CHECK_TYPE to check whether sys/types.h or stdlib.h defines a given type. +* AC_CHECK_LIB to check for a particular function and library. +* AC_MSG_CHECKING and AC_MSG_RESULT to print test results, on a single line, + whether or not the test succeeds. They obsolete AC_CHECKING and AC_VERBOSE. +* AC_SUBST_FILE to insert one file into another. +* AC_FUNC_MEMCMP to check whether memcmp is 8-bit clean. +* AC_FUNC_STRFTIME to find strftime even if it's in -lintl. +* AC_FUNC_GETMNTENT to find getmntent even if it's in -lsun or -lseq. +* AC_HEADER_SYS_WAIT to check whether sys/wait.h is POSIX.1 compatible. + +** Changed macros: +* Many macros renamed systematically, but old names are accepted for + backward compatibility. +* AC_OUTPUT adds the "automatically generated" comment to + non-Makefiles where it finds @configure_input@ in an input file, to + support files with various comment syntaxes. +* AC_OUTPUT does not replace "prefix" and "exec_prefix" in generated + files when they are not enclosed in @ signs. +* AC_OUTPUT allows the optional environment variable CONFIG_STATUS to + override the file name "config.status". +* AC_OUTPUT takes an optional argument for passing variables from + configure to config.status. +* AC_OUTPUT and AC_CONFIG_HEADER allow you to override the input-file names. +* AC_OUTPUT automatically substitutes the values of CFLAGS, CXXFLAGS, + CPPFLAGS, and LDFLAGS from the environment. +* AC_PROG_CC and AC_PROG_CXX now set CFLAGS and CXXFLAGS, respectively. +* AC_PROG_INSTALL looks for install-sh or install.sh in the directory + specified by AC_CONFIG_AUXDIR, or srcdir or srcdir/.. or + srcdir/../.. by default. +* AC_DEFINE, AC_DEFINE_UNQUOTED, and AC_SUBST are more robust and smaller. +* AC_DEFINE no longer prints anything, because of the new result reporting + mechanism (AC_MSG_CHECKING and AC_MSG_RESULT). +* AC_VERBOSE pays attention to --quiet/--silent, not --verbose. +* AC_ARG_ENABLE and AC_ARG_WITH support whitespace in the arguments to + --enable- and --with- options. +* AC_CHECK_FUNCS and AC_CHECK_HEADERS take optional shell commands to + execute on success or failure. +* Checking for C functions in C++ works. + +** Removed macros: +* AC_REMOTE_TAPE and AC_RSH removed; too specific to tar and cpio, and + better maintained with them. +* AC_ARG_ARRAY removed because no one was likely using it. +* AC_HAVE_POUNDBANG replaced with AC_SYS_INTERPRETER, which doesn't + take arguments, for consistency with all of the other specific checks. + +** New files: +* Comes with config.sub and config.guess, and uses them optionally. +* Uses config.cache to cache test results. An alternate cache file + can be selected with the --cache-file=FILE option. +* Uses optional shell scripts $prefix/share/config.site and + $prefix/etc/config.site to perform site or system specific initializations. +* configure saves compiler output to ./config.log for debugging. +* New files autoconf.m4 and autoheader.m4 load the other Autoconf macros. +* acsite.m4 is the new name for the system-wide aclocal.m4. +* Has a DejaGnu test suite. + +Major changes in Autoconf 1.11: + +* AC_PROG_INSTALL calls install.sh with the -c option. +* AC_SET_MAKE cleans up after itself. +* AC_OUTPUT sets prefix and exec_prefix if they weren't set already. +* AC_OUTPUT prevents shells from looking in PATH for config.status. + +Plus a few other bug fixes. + +Major changes in Autoconf 1.10: + +* autoheader uses config.h.bot if present, analogous to config.h.top. +* AC_PROG_INSTALL looks for install.sh in srcdir or srcdir/.. and + never uses cp. +* AC_PROG_CXX looks for cxx as a C++ compiler. + +Plus several bugs fixed. + +Major changes in Autoconf 1.9: + +* AC_YYTEXT_POINTER replaces AC_DECLARE_YYTEXT. +* AC_SIZEOF_TYPE generates the cpp symbol name automatically, + and autoheader generates entries for those names automatically. +* AC_FIND_X gets the result from xmkmf correctly. +* AC_FIND_X assumes no X if --without-x was given. +* AC_FIND_XTRA adds libraries to the variable X_EXTRA_LIBS. +* AC_PROG_INSTALL finds OSF/1 installbsd. + +Major changes in Autoconf 1.8: + +** New macros: +* New macros AC_LANG_C, AC_LANG_CPLUSPLUS, AC_LANG_SAVE, AC_LANG_RESTORE, + AC_PROG_CXX, AC_PROG_CXXCPP, AC_REQUIRE_CPP + for checking both C++ and C features in one configure script. +* New macros AC_CHECKING, AC_VERBOSE, AC_WARN, AC_ERROR for printing messages. +* New macros AC_FIND_XTRA, AC_MMAP, AC_SIZEOF_TYPE, AC_PREREQ, + AC_SET_MAKE, AC_ENABLE. + +** Changed macros: +* AC_FIND_X looks for X in more places. +* AC_PROG_INSTALL defaults to install.sh instead of cp, if it's in srcdir. + install.sh is distributed with Autoconf. +* AC_DECLARE_YYTEXT has been removed because it can't work, pending + a rewrite of quoting in AC_DEFINE. +* AC_OUTPUT adds its comments in C format when substituting in C files. +* AC_COMPILE_CHECK protects its ECHO-TEXT argument with double quotes. + +** New or changed command line options: +* configure accepts --enable-FEATURE[=ARG] and --disable-FEATURE options. +* configure accepts --without-PACKAGE, which sets withval=no. +* configure accepts --x-includes=DIR and --x-libraries=DIR. +* Giving --with-PACKAGE no argument sets withval=yes instead of withval=1. +* configure accepts --help, --version, --silent/--quiet, --no-create options. +* configure accepts and ignores most other Cygnus configure options, and + warns about unknown options. +* config.status accepts --help, --version options. + +** Paths and other changes: +* Relative srcdir values are not made absolute. +* The values of @prefix@ and @exec_prefix@ and @top_srcdir@ get substituted. +* Autoconf library files are installed in ${datadir}/autoconf, not ${datadir}. +* autoheader optionally copies config.h.top to the beginning of config.h.in. +* The example Makefile dependencies for configure et al. work better. +* Namespace cleanup: all shell variables used internally by Autoconf + have names beginning with `ac_'. + +More big improvements are in process for future releases, but have not +yet been (variously) finished, integrated, tested, or documented enough +to release yet. + +Major changes in Autoconf 1.7: + +* New macro AC_OBSOLETE. +* Bugs in Makefile.in fixed. +* AC_LONG_FILE_NAMES improved. + +Major changes in Autoconf 1.6: + +* New macro AC_LONG_64_BITS. +* Multiple .h files can be created. +* AC_FIND_X looks for X files directly if it doesn't find xmkmf. +* AC_ALLOCA defines C_ALLOCA if using alloca.c. +* --with-NAME can take a value, e.g., --with-targets=sun4,hp300bsd. +* Unused --no-create option to configure removed. +* autoheader doesn't change the timestamp of its output file if + the file didn't change. +* All macros that look for libraries now use AC_HAVE_LIBRARY. +* config.status checks three optional environment variables to + modify its behavior. +* The usual bug fixes. + +Major changes in Autoconf 1.5: + +* New macros AC_FIND_X, AC_OFF_T, AC_STAT_MACROS_BROKEN, AC_REVISION. +* autoconf and autoheader scripts have GNU standards conforming + --version and --help options (they print their message and exit). +* Many bug fixes. + +Major changes in Autoconf 1.4: + +* New macros AC_HAVE_POUNDBANG, AC_TIME_WITH_SYS_TIME, AC_LONG_DOUBLE, + AC_GETGROUPS_T, AC_DEFINE_UNQUOTED. +* autoconf and autoheader use the M4 environment variable to determine the + path of the m4 program to use. +* The --macrodir option to autoconf and autoheader specifies the directory + in which acspecific.m4, acgeneral.m4, etc. reside if not the default. +* autoconf and autoheader can take `-' as their file names, which means to + read stdin as input. +* Resulting configure scripts can take a --verbose option which causes them + to print the results of their tests. +* AC_DEFINE quotes its second argument in such a way that spaces, magic + shell characters, etc. will be preserved during various stages of + expansion done by the shell. If you don't want this, use + AC_DEFINE_UNQUOTED instead. +* Much textual processing done with external calls to tr and sed have been + internalized with builtin m4 `patsubst' and `translit' calls. +* AC_OUTPUT doesn't hardwire the filenames it outputs. Instead, you can + set the shell variables `gen_files' and `gen_config' to the list of + filenames to output. +* AC_DECLARE_YYTEXT does an AC_SUBST of `LEX_OUTPUT_ROOT', which may be + "lex.yy" or "lexyy", depending on the system. +* AC_PROGRAMS_CHECK takes an optional third arg. If given, it is used as + the default value. +* If AC_ALLOCA chooses alloca.c, it also defines STACK_DIRECTION. +* AC_CONST works much more reliably on more systems. +* Many bug fixes. + +Major changes in Autoconf 1.3: + +configure no longer requires awk for packages that use a config.h. +Support handling --with-PACKAGE options. +New `autoheader' script to create `config.h.in' from `configure.in'. +Ignore troublesome -lucb and -lPW when searching for alloca. +Rename --exec_prefix to --exec-prefix for GNU standards conformance. +Improve detection of STDC library. +Add AC_HAVE_LIBRARY to check for non-default libraries. +Function checking should work with future GNU libc releases. + +Major changes in Autoconf 1.2: + +The --srcdir option is now usually unnecessary. +Add a file containing sample comments describing CPP macros. +A comment in config.status tells which host it was configured on. +Substituted variable values can now contain commas. +Fix bugs in various feature checks. + +Major changes in Autoconf 1.1: + +Added AC_STRCOLL macro. +Made AC_GETLOADAVG check for more things. +AC_OUTPUT argument is now optional. +Various bug fixes. @@ -0,0 +1,34 @@ +-*- text -*- + +Autoconf + +Autoconf is an extensible package of M4 macros that produce shell +scripts to automatically configure software source code packages. +These scripts can adapt the packages to many kinds of UNIX-like +systems without manual user intervention. Autoconf creates a +configuration script for a package from a template file that lists the +operating system features that the package can use, in the form of M4 +macro calls. + +Producing configuration scripts using Autoconf requires GNU M4. You +must install GNU M4 (version 1.4 or later) before configuring +Autoconf, so that Autoconf's configure script can find it. The +configuration scripts produced by Autoconf are self-contained, so +their users do not need to have Autoconf (or GNU M4). + +Some optional utilities that come with Autoconf, autoscan and +autoupdate, use Perl 5.5. However, it is not required in order to use +the main Autoconf programs. If it is not present, the affected +Autoconf utilities will not be installed. + +The file INSTALL should be distributed with packages that use +Autoconf-generated configure scripts and Makefiles that conform to the +GNU coding standards. The package's README can just give an overview +of the package, where to report bugs, and a pointer to INSTALL for +instructions on compilation and installation. This removes the need +to maintain many similar sets of installation instructions. + +Mail bug reports to dickey@invisible-island.net + +Please include the Autoconf version number, which you can get by +running `autoconf --version'. @@ -0,0 +1,168 @@ +Autoconf was originally written by David J. MacKenzie <djm@uunet.uu.net>. +It would not be what it is today without the invaluable help of these +people: + +Aaron Crane aaronc@pobox.com +Aharon Robbins arnold@gnu.org +Akim Demaille akim@freefriends.org +Alain Knaff Alain.Knaff@imag.fr +Alec Wolman wolman@cs.washington.edu +Alexandre Oliva oliva@lsd.ic.unicamp.br +Andreas Jaeger aj@suse.de +Andreas Schott schott@rzg.mpg.de +Andreas Schwab schwab@issan.informatik.uni-dortmund.de +Andrej Borsenkow borsenkow.msk@sni.de +Artur Frysiak wiget@pld.org.pl +Assar Westerlund assar@sics.se +Axel Thimm Axel.Thimm@physik.fu-berlin.de +Ben Elliston bje@redhat.com +Bill Sommerfeld sommerfeld@apollo.hp.com +Bob Friesenhahn bfriesen@simple.dallas.tx.us +Bob Wilson bwilson@tensilica.com +Bram Moolenaar bram@vim.org +Bruno Haible haible@ilog.fr +Carl Edman cedman@princeton.edu +Chad R. Larson chad@anasazi.com +Chris P. Ross cross@uu.net +Chris Provenzano proven@cygnus.com +Christian Krackowizer ckrackowiz@std.schuler-ag.com +Christian Krone krischan@sql.de +Christopher Lee chrislee@ri.cmu.edu +Chris Torek torek@bsdi.com +Cort Dougan cort@cs.nmt.edu +Daniel Carroll dan@mesastate.edu +Daniele Arena daniele@ripe.net +Dave Adams adams@hpesdwa.fc.hp.com +Dave Love fx@gnu.org +David Carter david@carter.net +David Morgan dmorgan@symark.com +Derek R. Price derek.price@openavenue.com +Didier Desseaux didess@infonie.fr +Didier Verna didier@xemacs.org +Dietmar P. Schindler schd@mra.man.de +Doug Evans dje@canuck.cygnus.com +Eli Zaretskii eliz@gnu.org +Enrique Robledo Arnuncio enrique.robledo@wanadoo.es +Erez Zadok ezk@cs.columbia.edu +Eric Backus ericb@lsid.hp.com +Eric Mumpower nocturne@mit.edu +Ezra Peisach epeisach@zif.mit.edu +Felix Lee flee@cygnus.com +Franc,ois Pinard pinard@iro.umontreal.ca +Gary V. Vaughan gvaughan@oranda.demon.co.uk +Giuseppe Guerrini guisguerrini@racine.ra.it +Glenn P. Davis davis@unidata.ucar.edu +Godmar Back gback@cs.utah.edu +Gordon Matzigkeit gord@trick.fig.org +Graham Jenkins c714553@vus415.telstra.com.au +Greg A. Woods woods@weird.com +Guido Flohr gufl0000@stud.uni-sb.de +Guillermo Gomez gomez@mi.uni-erlangen.de +Hans Olsson Hans.Olsson@dna.lth.se +Harlan Stenn stenn@whimsy.udel.edu +H.J. Lu hjl@gnu.org +Ian Lance Taylor ian@cygnus.com +James A. Lupo lupoja@feynman.ml.wpafb.af.mil +Jason Molenda jsm@cygnus.com +Jeff Garzik jgarzik@pobox.com +Jeffrey A Law law@cygnus.com +Jens Petersen petersen@redhat.com +Jim Blandy jimb@wookumz.gnu.ai.mit.edu +Jim Meyering meyering@ascend.com +Jiro Takabatake jiro@din.or.jp +Johan Danielsson joda@pdc.kth.se +John David Anglin dave@hiauly1.hia.nrc.ca +John Fortin fortinj@attglobal.net +John Interrante interran@uluru.stanford.edu +John W. Eaton jwe@bevo.che.wisc.edu +J"orn Rennecke amylaar@cygnus.co.uk +Joseph S. Myers jsm28@cam.ac.uk +Julian Onions j.onions@nexor.co.uk +Karl Berry karl@cs.umb.edu +Karl Heuer kwzh@gnu.org +Kathryn Hargreaves kathryn@deas.harvard.edu +Kaveh R. Ghazi ghazi@caip.rutgers.edu +Kelly Anderson tgcorp@attglobal.net +Ken Pizzini ken@halcyon.com +Ken Raeburn raeburn@cygnus.com +Kevin Ryde user42@zip.com.au +Koji Arai JCA02266@nifty.ne.jp +Kurt D. Zeilenga kurt@openldap.org +Larry Schwimmer rosebud@cyclone.stanford.edu +Lars Hecking lhecking@nmrc.ucc.ie +Lars J. Aas larsa@sim.no +Marc Espie Marc.Espie@liafa.jussieu.fr +Marcus Daniels marcus@sysc.pdx.edu +Marcus Thiessel marcus@xemacs.org +Mark Elbrecht snowball3@usa.net +Mark Kettenis kettenis@gnu.org +Markku Savela msa@msa.tte.vtt.fi +Markus Oberhumer markus.oberhumer@jk.uni-linz.ac.at +Martin Buchholz martin@xemacs.org +Martin Wilck martin@tropos.de +Martyn Johnson Martyn.Johnson@cl.cam.ac.uk +Matthew D. Langston langston@SLAC.Stanford.EDU +Michael Elizabeth Chastain chastain@cygnus.com +Michael Schoene mrs@mlc.de +Mike Hopkirk hops@sco.com +Mike Stump mrs@wrs.com +Miles Bader miles@gnu.ai.mit.edu +Mo DeJong mdejong@cygnus.com +Morten Eriksen mortene@sim.no +Motoyuki Kasahara m-kasahr@sra.co.jp +Nicolas Joly njoly@pasteur.fr +Noah Elliott elliott@hera.llnl.gov +Noah Friedman friedman@gnu.ai.mit.edu +Ossama Othman ossama@debian.org +Patrick Tullmann tullmann@cs.utah.edu +Patrick Welche prlw1@newn.cam.ac.uk +Paul Berrevoets paul@swi.com +Paul Eggert eggert@twinsun.com +Paul Gampe paulg@apnic.net +Paul Martinolich martinol@datasync.com +Pavel Roskin pavel_roskin@geocities.com +Peter Eisentraut peter_e@gmx.net +Peter Simons simons@research.cys.de +Philipp Thomas kthomas@gwdg.de +Rainer Orth ro@TechFak.Uni-Bielefeld.DE +Raja R Harinath harinath@cs.umn.edu +Ralf Corsepius corsepiu@faw.uni-ulm.de +Ralf S. Engelschall rse@engelschall.com +Richard Stallman rms@gnu.org +Robert Lipe robertlipe@usa.net +Robert S. Maier rsm@math.arizona.edu +Roland McGrath roland@gnu.org +Rüdiger Kuhlmann info@ruediger-kuhlmann.de +Ruediger Kuhlmann uck4@rz.uni-karlsruhe.de +Russ Allbery rra@stanford.edu +Ryuji Abe raeva@t3.rim.or.jp +Scott Bambrough scottb@corelcomputer.com +Scott Stanton stanton@scriptics.com +Simon Leinen simon@lia.di.epfl.ch +Stephen Gildea gildea@alum.mit.edu +Steve Chamberlain sac@cygnus.com +Steven G. Johnson stevenj@alum.mit.edu +Steve Robbins steve@nyongwa.montreal.qc.ca +Stu Grossman grossman@cygnus.com +Syd Polk spolk@cygnus.com +T.E. Dickey dickey@invisible-island.net +Theodore Ts'o" tytso@mit.edu +Thomas Winder tom@vlsivie.tuwien.ac.at +Tim Van Holder tim.van.holder@pandora.be +Tom Lane tgl@sss.pgh.pa.us +Tom Purcell Tom.Purcell@wang.com +Tom Tromey tromey@cygnus.com +Tom Yu tlyu@mit.edu +Tony Leneis tony@plaza.ds.adp.com +Viktor Dukhovni viktor@anaheim.esm.com +Volker Borchert bt@teknon.de +Wilfredo Sanchez wsanchez@apple.com +Wolfgang Mueller Wolfgang.Mueller@cui.unige.ch + +Many people are not named here because we lost track of them. We +thank them! Please, help us keep this list up to date. + +Local Variables: +mode: text +End: +-- vile:fk=utf-8 diff --git a/acfunctions b/acfunctions new file mode 100644 index 0000000..4e3d4c3 --- /dev/null +++ b/acfunctions @@ -0,0 +1,172 @@ +# acfunctions -- autoscan's mapping from functions to Autoconf macros +# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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. + +# Ones that have their own macros. +alloca AC_FUNC_ALLOCA +bcmp AC_HEADER_STDC +bcopy AC_HEADER_STDC +bzero AC_HEADER_STDC +bzero AC_CHECK_FUNCS +chown AC_FUNC_CHOWN +error AC_FUNC_ERROR_AT_LINE +error_at_line AC_FUNC_ERROR_AT_LINE +fnmatch AC_FUNC_FNMATCH +fork AC_FUNC_FORK +fseeko AC_FUNC_FSEEKO +ftello AC_FUNC_FSEEKO +getgroups AC_FUNC_GETGROUPS +getloadavg AC_FUNC_GETLOADAVG +getpgrp AC_FUNC_GETPGRP +index AC_HEADER_STDC +ioctl AC_PROG_GCC_TRADITIONAL +lstat AC_FUNC_LSTAT +major AC_HEADER_MAJOR +malloc AC_FUNC_MALLOC +makedev AC_HEADER_MAJOR +memchr AC_HEADER_STDC +memchr AC_CHECK_FUNCS +memcmp AC_FUNC_MEMCMP +memcpy AC_HEADER_STDC +memmove AC_HEADER_STDC +memmove AC_CHECK_FUNCS +memset AC_HEADER_STDC +memset AC_CHECK_FUNCS +minor AC_HEADER_MAJOR +mktime AC_FUNC_MKTIME +mmap AC_FUNC_MMAP +obstack_init AC_FUNC_OBSTACK +rindex AC_HEADER_STDC +setpgrp AC_FUNC_SETPGRP +setvbuf AC_FUNC_SETVBUF_REVERSED +signal AC_TYPE_SIGNAL +stat AC_FUNC_STAT +strcoll AC_FUNC_STRCOLL +strerror_r AC_FUNC_STRERROR_R +strftime AC_FUNC_STRFTIME +strtod AC_FUNC_STRTOD +utime AC_FUNC_UTIME_NULL +utime AC_CHECK_FUNCS +vfork AC_FUNC_FORK +vfprintf AC_FUNC_VPRINTF +vprintf AC_FUNC_VPRINTF +vsprintf AC_FUNC_VPRINTF +wait3 AC_FUNC_WAIT3 + +# Others, checked with AC_CHECK_FUNCS. +__argz_count +__argz_next +__argz_stringify +__fpending +acl +alarm +atexit +btowc +clock_gettime +dcgettext +doprnt +dup2 +endgrent +endpwent +euidaccess +fchdir +fdatasync +fesetround +floor +fs_stat_dev +ftime +ftruncate +getcwd +getdelim +gethostbyaddr +gethostbyname +gethostname +gethrtime +getmntent +getmntinfo +getpagesize +getpass +getspnam +gettimeofday +getusershell +getwd +hasmntopt +inet_ntoa +isascii +iswprint +lchown +listmntent +localeconv +localtime_r +mblen +mbrlen +mbrtowc +mempcpy +mkdir +mkfifo +modf +munmap +next_dev +nl_langinfo +pathconf +pow +pstat_getdynamic +putenv +re_comp +realpath +regcmp +regcomp +resolvepath +rint +rmdir +rpmatch +select +setenv +sethostname +setlocale +socket +sqrt +stime +stpcpy +strcasecmp +strchr +strcspn +strdup +strerror +strncasecmp +strndup +strnlen +strpbrk +strrchr +strspn +strstr +strtol +strtoul +strtoull +strtoumax +strverscmp +sysinfo +tzset +uname +utmpname +utmpxname +wcwidth + +# Local Variables: +# mode: shell-script +# End: diff --git a/acfunctions.m4 b/acfunctions.m4 new file mode 100644 index 0000000..3b37899 --- /dev/null +++ b/acfunctions.m4 @@ -0,0 +1,1687 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# vile:fk=utf-8 +# Checking for functions. +#------------------------------------------------------------------------------ +# Copyright 2020-2022,2023 Thomas E. Dickey +# Copyright 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by David MacKenzie, with help from +# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +# Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +# Table of contents +# +# 1. Generic tests for functions. +# 2. Tests for specific functions. + + +## -------------------------------- ## +## 1. Generic tests for functions. ## +## -------------------------------- ## + + +# AC_CHECK_FUNC(FUNCTION, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------------------- +AC_DEFUN([AC_CHECK_FUNC], +[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl +AC_CACHE_CHECK([for $1], ac_var, +[AC_LINK_IFELSE([AC_LANG_FUNC_LINK_TRY([$1])], + [AS_VAR_SET(ac_var, yes)], + [AS_VAR_SET(ac_var, no)])]) +AS_IF([test "AS_VAR_GET(ac_var)" = yes], [$2], [$3])dnl +AS_VAR_POPDEF([ac_var])dnl +])# AC_CHECK_FUNC + + +# AC_CHECK_FUNCS(FUNCTION..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------- +AC_DEFUN([AC_CHECK_FUNCS], +[AC_FOREACH([AC_Func], [$1], + [AH_TEMPLATE(AS_TR_CPP(HAVE_[]AC_Func), + [Define if you have the `]AC_Func[' function.])])dnl +for ac_func in $1 +do +AC_CHECK_FUNC($ac_func, + [AC_DEFINE_UNQUOTED([AS_TR_CPP([HAVE_$ac_func])]) $2], + [$3])dnl +done +]) + + +# AC_REPLACE_FUNCS(FUNCTION...) +# ----------------------------- +AC_DEFUN([AC_REPLACE_FUNCS], +[AC_FOREACH([AC_Func], [$1], [AC_LIBSOURCE(AC_Func.c)])dnl +AC_CHECK_FUNCS([$1], , [_AC_LIBOBJ($ac_func)]) +]) + + +# AU::AC_FUNC_CHECK +# ----------------- +AU_ALIAS([AC_FUNC_CHECK], [AC_CHECK_FUNC]) + + +# AU::AC_HAVE_FUNCS +# ----------------- +AU_ALIAS([AC_HAVE_FUNCS], [AC_CHECK_FUNCS]) + + + + +## --------------------------------- ## +## 2. Tests for specific functions. ## +## --------------------------------- ## + + +# The macros are sorted: +# +# 1. AC_FUNC_* macros are sorted by alphabetical order. +# +# 2. Helping macros such as _AC_LIBOBJ_* are before the macro that +# uses it. +# +# 3. Obsolete macros are right after the modern macro. + + + +# _AC_LIBOBJ_ALLOCA +# ----------------- +# Set up the LIBOBJ replacement of `alloca'. Well, not exactly +# AC_LIBOBJ since we actually set the output variable `ALLOCA'. +# Nevertheless, for Automake, AC_LIBSOURCES it. +m4_define([_AC_LIBOBJ_ALLOCA], +[# 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. +AC_LIBSOURCES(alloca.c) +AC_SUBST(ALLOCA, "alloca.$ac_objext")dnl +AC_DEFINE(C_ALLOCA, 1, [Define if using `alloca.c'.]) + +AC_CACHE_CHECK(whether `alloca.c' needs Cray hooks, ac_cv_os_cray, +[AC_EGREP_CPP(webecray, +[#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif +], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + AC_CHECK_FUNC($ac_func, + [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func, + [Define to one of `_getb67', `GETB67', + `getb67' for Cray-2 and Cray-YMP + systems. This function is required for + `alloca.c' support on those systems.]) + break]) + done +fi + +AC_CACHE_CHECK([stack direction for C alloca], + [ac_cv_c_stack_direction], +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[int +find_stack_direction (void) +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main (void) +{ + $ac_main_return (find_stack_direction () < 0); +}])], + [ac_cv_c_stack_direction=1], + [ac_cv_c_stack_direction=-1], + [ac_cv_c_stack_direction=0])]) +AH_VERBATIM([STACK_DIRECTION], +[/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +@%:@undef STACK_DIRECTION])dnl +AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) +])# _AC_LIBOBJ_ALLOCA + + +# AC_FUNC_ALLOCA +# -------------- +AC_DEFUN([AC_FUNC_ALLOCA], +[# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +AC_CACHE_CHECK([for working alloca.h], ac_cv_working_alloca_h, +[AC_TRY_LINK([@%:@include <alloca.h>], + [char *p = (char *) alloca (2 * sizeof (int));], + ac_cv_working_alloca_h=yes, ac_cv_working_alloca_h=no)]) +if test $ac_cv_working_alloca_h = yes; then + AC_DEFINE(HAVE_ALLOCA_H, 1, + [Define if you have <alloca.h> and it should be used + (not on Ultrix).]) +fi + +AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works, +[AC_TRY_LINK( +[#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif +], [char *p = (char *) alloca (1);], + ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)]) + +if test $ac_cv_func_alloca_works = yes; then + AC_DEFINE(HAVE_ALLOCA, 1, + [Define if you have `alloca', as a function or macro.]) +else + _AC_LIBOBJ_ALLOCA +fi +])# AC_FUNC_ALLOCA + + +# AU::AC_ALLOCA +# ------------- +AU_ALIAS([AC_ALLOCA], [AC_FUNC_ALLOCA]) + + +# AC_FUNC_CHOWN +# ------------- +# Determine whether chown accepts arguments of -1 for uid and gid. +AC_DEFUN([AC_FUNC_CHOWN], +[AC_REQUIRE([AC_TYPE_UID_T])dnl +AC_CHECK_HEADERS(unistd.h) +AC_CACHE_CHECK([for working chown], ac_cv_func_chown_works, +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT +#include <fcntl.h> +], +[[ char *f = "conftest.chown"; + struct stat before, after; + + if (creat (f, 0600) < 0) + $ac_main_return (1); + if (stat (f, &before) < 0) + $ac_main_return (1); + if (chown (f, (uid_t) -1, (gid_t) -1) == -1) + $ac_main_return (1); + if (stat (f, &after) < 0) + $ac_main_return (1); + $ac_main_return ((before.st_uid == after.st_uid + && before.st_gid == after.st_gid) ? 0 : 1); +]])], + [ac_cv_func_chown_works=yes], + [ac_cv_func_chown_works=no], + [ac_cv_func_chown_works=no]) +rm -f conftest.chown +]) +if test $ac_cv_func_chown_works = yes; then + AC_DEFINE(HAVE_CHOWN, 1, + [Define if your system has a working `chown' function.]) +fi +])# AC_FUNC_CHOWN + + +# AC_FUNC_CLOSEDIR_VOID +# --------------------- +# Check whether closedir returns void, and #define CLOSEDIR_VOID in +# that case. +AC_DEFUN([AC_FUNC_CLOSEDIR_VOID], +[AC_REQUIRE([AC_HEADER_DIRENT])dnl +AC_CACHE_CHECK([whether closedir returns void], + [ac_cv_func_closedir_void], +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT +#include <$ac_header_dirent> +#ifndef __cplusplus +int closedir (DIR *); +#endif +], + [[$ac_main_return (closedir (opendir (".")) != 0);]])], + [ac_cv_func_closedir_void=no], + [ac_cv_func_closedir_void=yes], + [ac_cv_func_closedir_void=yes])]) +if test $ac_cv_func_closedir_void = yes; then + AC_DEFINE(CLOSEDIR_VOID, 1, + [Define if the `closedir' function returns void instead of `int'.]) +fi +]) + + +# AC_FUNC_ERROR_AT_LINE +# --------------------- +AC_DEFUN([AC_FUNC_ERROR_AT_LINE], +[AC_LIBSOURCES([error.h, error.c])dnl +AC_CACHE_CHECK([for error_at_line], ac_cv_lib_error_at_line, +[AC_TRY_LINK([],[error_at_line (0, 0, "", 0, "");], + [ac_cv_lib_error_at_line=yes], + [ac_cv_lib_error_at_line=no])]) +if test $ac_cv_lib_error_at_line = no; then + AC_LIBOBJ(error) +fi +]) + + +# AU::AM_FUNC_ERROR_AT_LINE +# ------------------------- +AU_ALIAS([AM_FUNC_ERROR_AT_LINE], [AC_FUNC_ERROR_AT_LINE]) + + +# AC_FUNC_FNMATCH +# --------------- +# We look for fnmatch.h to avoid that the test fails in C++. +AC_DEFUN([AC_FUNC_FNMATCH], +[AC_CACHE_CHECK([for working GNU-style fnmatch], + [ac_cv_func_fnmatch_works], +# Some versions of Solaris, SCO, and the GNU C Library +# have a broken or incompatible fnmatch. +# So we run a test program. If we are cross-compiling, take no chance. +# Thanks to John Oleynick, Franc,ois Pinard, and Paul Eggert for this test. +[AC_RUN_IFELSE([AC_LANG_PROGRAM([@%:@include <fnmatch.h>], + [$ac_main_return (fnmatch ("a*", "abc", 0) != 0 + || fnmatch ("d*/*1", "d/s/1", FNM_FILE_NAME) != FNM_NOMATCH + || fnmatch ("*", "x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0 + || fnmatch ("x*", "x/y/z", FNM_FILE_NAME | FNM_LEADING_DIR) != 0 + || fnmatch ("*c*", "c/x", FNM_FILE_NAME | FNM_LEADING_DIR) != 0);])], + [ac_cv_func_fnmatch_works=yes], + [ac_cv_func_fnmatch_works=no], + [ac_cv_func_fnmatch_works=no])]) +if test $ac_cv_func_fnmatch_works = yes; then + AC_DEFINE(HAVE_FNMATCH, 1, + [Define if your system has a working `fnmatch' function.]) +fi +])# AC_FUNC_FNMATCH + + +# AU::AM_FUNC_FNMATCH +# AU::fp_FUNC_FNMATCH +# ------------------- +AU_ALIAS([AM_FUNC_FNMATCH], [AC_FUNC_FNMATCH]) +AU_ALIAS([fp_FUNC_FNMATCH], [AC_FUNC_FNMATCH]) + + +# AC_FUNC_FSEEKO +# -------------- +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 <stdio.h> + @%:@include <sys/types.h>], [ + int (*my_fseeko)(FILE *, off_t, int) = fseeko; + return my_fseeko(stdin, 0, 0);]) + +# 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_TRY_LINK([@%:@include <stdio.h> + @%:@include <sys/types.h>], + [int (*my_fseeko)(FILE *, off_t, int) = fseeko; + return my_fseeko && my_fseeko (stdin, 0, 0);], + [ac_cv_func_fseeko=yes], + [ac_cv_func_fseeko=no])]) +if test $ac_cv_func_fseeko = yes; then + AC_DEFINE(HAVE_FSEEKO, 1, + [Define if fseeko (and presumably ftello) exists and is declared.]) +fi +])# AC_FUNC_FSEEKO + + +# AC_FUNC_GETGROUPS +# ----------------- +# Try to find `getgroups', and check that it works. +# When crosscompiling, assume getgroups is broken. +AC_DEFUN([AC_FUNC_GETGROUPS], +[AC_REQUIRE([AC_TYPE_GETGROUPS])dnl +AC_REQUIRE([AC_TYPE_SIZE_T])dnl +AC_CHECK_FUNC(getgroups) + +# If we don't yet have getgroups, see if it's in -lbsd. +# This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1. +ac_save_LIBS=$LIBS +if test $ac_cv_func_getgroups = no; then + AC_CHECK_LIB(bsd, getgroups, [GETGROUPS_LIB=-lbsd]) +fi + +# Run the program to test the functionality of the system-supplied +# getgroups function only if there is such a function. +if test $ac_cv_func_getgroups = yes; then + AC_CACHE_CHECK([for working getgroups], ac_cv_func_getgroups_works, + [AC_RUN_IFELSE([AC_LANG_PROGRAM([], + [[/* On Ultrix 4.3, getgroups (0, 0) always fails. */ + $ac_main_return (getgroups (0, 0) == -1 ? 1 : 0);]])], + [ac_cv_func_getgroups_works=yes], + [ac_cv_func_getgroups_works=no], + [ac_cv_func_getgroups_works=no]) + ]) + if test $ac_cv_func_getgroups_works = yes; then + AC_DEFINE(HAVE_GETGROUPS, 1, + [Define if your system has a working `getgroups' function.]) + fi +fi +LIBS=$ac_save_LIBS +])# AC_FUNC_GETGROUPS + + +# _AC_LIBOBJ_GETLOADAVG +# --------------------- +# Set up the AC_LIBOBJ replacement of `getloadavg'. +m4_define([_AC_LIBOBJ_GETLOADAVG], +[AC_LIBOBJ(getloadavg) +AC_DEFINE(C_GETLOADAVG, 1, [Define if using `getloadavg.c'.]) +# Figure out what our getloadavg.c needs. +ac_have_func=no +AC_CHECK_HEADER(sys/dg_sys_info.h, +[ac_have_func=yes + AC_DEFINE(DGUX, 1, [Define for DGUX with <sys/dg_sys_info.h>.]) + AC_CHECK_LIB(dgc, dg_sys_info)]) + +AC_CHECK_HEADER(locale.h) +AC_CHECK_FUNCS(setlocale) + +# We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it +# uses stabs), but it is still SVR4. We cannot check for <elf.h> because +# Irix 4.0.5F has the header but not the library. +if test $ac_have_func = no && test "$ac_cv_lib_elf_elf_begin" = yes; then + ac_have_func=yes + AC_DEFINE(SVR4, 1, [Define on System V Release 4.]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADER(inq_stats/cpustats.h, + [ac_have_func=yes + AC_DEFINE(UMAX, 1, [Define for Encore UMAX.]) + AC_DEFINE(UMAX4_3, 1, + [Define for Encore UMAX 4.3 that has <inq_status/cpustats.h> + instead of <sys/cpustats.h>.])]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADER(sys/cpustats.h, + [ac_have_func=yes; AC_DEFINE(UMAX)]) +fi + +if test $ac_have_func = no; then + AC_CHECK_HEADERS(mach/mach.h) +fi + +AC_CHECK_HEADERS(nlist.h, +[AC_CHECK_MEMBERS([struct nlist.n_un.n_name], + [AC_DEFINE(NLIST_NAME_UNION, 1, + [Define if your `struct nlist' has an + `n_un' member. Obsolete, depend on + `HAVE_STRUCT_NLIST_N_UN_N_NAME])], [], + [@%:@include <nlist.h>]) +])dnl +])# _AC_LIBOBJ_GETLOADAVG + + +# AC_FUNC_GETLOADAVG +# ------------------ +AC_DEFUN([AC_FUNC_GETLOADAVG], +[ac_have_func=no # yes means we've found a way to get the load average. + +ac_save_LIBS=$LIBS + +# Check for getloadavg, but be sure not to touch the cache variable. +(AC_CHECK_FUNC(getloadavg, exit 0, exit 1)) && ac_have_func=yes + +# On HPUX9, an unprivileged user can get load averages through this function. +AC_CHECK_FUNCS(pstat_getdynamic) + +# Solaris has libkstat which does not require root. +AC_CHECK_LIB(kstat, kstat_open) +test $ac_cv_lib_kstat_kstat_open = yes && ac_have_func=yes + +# Some systems with -lutil have (and need) -lkvm as well, some do not. +# On Solaris, -lkvm requires nlist from -lelf, so check that first +# to get the right answer into the cache. +# For kstat on solaris, we need libelf to force the definition of SVR4 below. +if test $ac_have_func = no; then + AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS") +fi +if test $ac_have_func = no; then + AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS") + # Check for the 4.4BSD definition of getloadavg. + AC_CHECK_LIB(util, getloadavg, + [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes]) +fi + +if test $ac_have_func = no; then + # There is a commonly available library for RS/6000 AIX. + # Since it is not a standard part of AIX, it might be installed locally. + ac_getloadavg_LIBS=$LIBS + LIBS="-L/usr/local/lib $LIBS" + AC_CHECK_LIB(getloadavg, getloadavg, + [LIBS="-lgetloadavg $LIBS"], [LIBS=$ac_getloadavg_LIBS]) +fi + +# Make sure it is really in the library, if we think we found it, +# otherwise set up the replacement function. +AC_CHECK_FUNCS(getloadavg, [], + [_AC_LIBOBJ_GETLOADAVG]) + +# Some definitions of getloadavg require that the program be installed setgid. +dnl FIXME: Don't hardwire the path of getloadavg.c in the top-level directory. +AC_CACHE_CHECK(whether getloadavg requires setgid, + ac_cv_func_getloadavg_setgid, +[AC_EGREP_CPP([Yowza Am I SETGID yet], +[#include "$srcdir/getloadavg.c" +#ifdef LDAV_PRIVILEGED +Yowza Am I SETGID yet +@%:@endif], + ac_cv_func_getloadavg_setgid=yes, + ac_cv_func_getloadavg_setgid=no)]) +if test $ac_cv_func_getloadavg_setgid = yes; then + NEED_SETGID=true + AC_DEFINE(GETLOADAVG_PRIVILEGED, 1, + [Define if the `getloadavg' function needs to be run setuid + or setgid.]) +else + NEED_SETGID=false +fi +AC_SUBST(NEED_SETGID)dnl + +if test $ac_cv_func_getloadavg_setgid = yes; then + AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem, +[ # On Solaris, /dev/kmem is a symlink. Get info on the real file. + ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null` + # If we got an error (system does not support symlinks), try without -L. + test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem` + ac_cv_group_kmem=`echo $ac_ls_output \ + | sed -ne ['s/[ ][ ]*/ /g; + s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/; + / /s/.* //;p;']` +]) + AC_SUBST(KMEM_GROUP, $ac_cv_group_kmem)dnl +fi +if test "x$ac_save_LIBS" = x; then + GETLOADAVG_LIBS=$LIBS +else + GETLOADAVG_LIBS=`echo "$LIBS" | sed "s!$ac_save_LIBS!!"` +fi +LIBS=$ac_save_LIBS + +AC_SUBST(GETLOADAVG_LIBS)dnl +])# AC_FUNC_GETLOADAVG + + +# AU::AC_GETLOADAVG +# ----------------- +AU_ALIAS([AC_GETLOADAVG], [AC_FUNC_GETLOADAVG]) + + +# AC_FUNC_GETMNTENT +# ----------------- +AC_DEFUN([AC_FUNC_GETMNTENT], +[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware. +AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS", + [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS", + [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])]) +AC_CHECK_FUNC(getmntent, + [AC_DEFINE(HAVE_GETMNTENT, 1, + [Define if you have the `getmntent' function.])])]) + + +# _AC_FUNC_GETPGRP_TEST +# --------------------- +# A program that exits with success iff `getpgrp' seems to ignore its +# argument. +m4_define([_AC_FUNC_GETPGRP_TEST], +[AC_LANG_SOURCE([AC_INCLUDES_DEFAULT] +[[ +/* + * If this system has a BSD-style getpgrp(), + * which takes a pid argument, exit unsuccessfully. + * + * Snarfed from Chet Ramey's bash pgrp.c test program + */ + +int pid; +int pg1, pg2, pg3, pg4; +int ng, np, s, child; + +int +main (void) +{ + 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) + $ac_main_return (0); + + child = fork (); + if (child < 0) + $ac_main_return(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) + $ac_main_return (1); + else + $ac_main_return (0); + } + else + { + wait (&s); + $ac_main_return (s>>8); + } +}]]) +])# _AC_FUNC_GETPGRP_TEST + + +# AC_FUNC_GETPGRP +# --------------- +# Figure out whether getpgrp takes an argument or not. Try first using +# prototypes (AC_COMPILE), and if the compiler is of no help, try a runtime +# test. +AC_DEFUN([AC_FUNC_GETPGRP], +[AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void, +[# Use it with a single arg. +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [getpgrp (0);])], + [ac_func_getpgrp_1=yes], + [ac_func_getpgrp_1=no]) +# Use it with no arg. +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], [getpgrp ();])], + [ac_func_getpgrp_0=yes], + [ac_func_getpgrp_0=no]) +# If both static checks agree, we are done. +case $ac_func_getpgrp_0:$ac_func_getpgrp_1 in + yes:no) ac_cv_func_getpgrp_void=yes;; + no:yes) ac_cv_func_getpgrp_void=false;; + *) AC_RUN_IFELSE([_AC_FUNC_GETPGRP_TEST], + [ac_cv_func_getpgrp_void=yes], + [ac_cv_func_getpgrp_void=no], + [AC_MSG_ERROR([cannot check getpgrp if cross compiling])]);; +esac # $ac_func_getpgrp_0:$ac_func_getpgrp_1 +]) +if test $ac_cv_func_getpgrp_void = yes; then + AC_DEFINE(GETPGRP_VOID, 1, + [Define if the `getpgrp' function takes no argument.]) +fi +])# AC_FUNC_GETPGRP + + +# AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +# ------------------------------------- +# When crosscompiling, be pessimistic so we will end up using the +# replacement version of lstat that checks for trailing slashes and +# calls lstat a second time when necessary. +AC_DEFUN([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK], +[AC_CACHE_CHECK( + [whether lstat dereferences a symlink specified with a trailing slash], + [ac_cv_func_lstat_dereferences_slashed_symlink], +[rm -f conftest.sym conftest.file +echo >conftest.file +if ln -s conftest.file conftest.sym; then + AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], + [struct stat sbuf; + /* Linux will dereference the symlink and fail. + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ + $ac_main_return (lstat ("conftest.sym/", &sbuf) ? 0 : 1);])], + [ac_cv_func_lstat_dereferences_slashed_symlink=yes], + [ac_cv_func_lstat_dereferences_slashed_symlink=no], + [ac_cv_func_lstat_dereferences_slashed_symlink=no]) +else + # If the `ln -s' command failed, then we probably don't even + # have an lstat function. + ac_cv_func_lstat_dereferences_slashed_symlink=no +fi +rm -f conftest.sym conftest.file +]) + +test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && + AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, 1, + [Define if `lstat' dereferences a symlink specified + with a trailing slash.]) + +if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then + AC_LIBOBJ(lstat) +fi +]) + + +# AC_FUNC_MALLOC +# -------------- +# Is `malloc (0)' properly handled? +AC_DEFUN([AC_FUNC_MALLOC], +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_CHECK_HEADERS(stdlib.h) +AC_CACHE_CHECK([for working malloc], ac_cv_func_malloc_works, +[AC_RUN_IFELSE( +[AC_LANG_PROGRAM( +[[#if STDC_HEADERS || HAVE_STDLIB_H +# include <stdlib.h> +#else +char *malloc (); +#endif +]], + [$ac_main_return (malloc (0) ? 0 : 1);])], + [ac_cv_func_malloc_works=yes], + [ac_cv_func_malloc_works=no], + [ac_cv_func_malloc_works=no])]) +if test $ac_cv_func_malloc_works = yes; then + AC_DEFINE(HAVE_MALLOC, 1, + [Define if your system has a working `malloc' function.]) +fi +])# AC_FUNC_MALLOC + + +# AC_FUNC_MEMCMP +# -------------- +AC_DEFUN([AC_FUNC_MEMCMP], +[AC_CACHE_CHECK([for working memcmp], ac_cv_func_memcmp_working, +[AC_RUN_IFELSE([AC_LANG_PROGRAM([], [[ + /* Some versions of memcmp are not 8-bit clean. */ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0) + $ac_main_return (1); + + /* The Next x86 OpenStep bug shows up only when comparing 16 bytes + or more and with at least one buffer not starting on a 4-byte boundary. + William Lewis provided this test program. */ + { + char foo[21]; + char bar[21]; + int i; + for (i = 0; i < 4; i++) + { + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + if (memcmp (a, b, 16) >= 0) + $ac_main_return (1); + } + $ac_main_return (0); + } +]])], + [ac_cv_func_memcmp_working=yes], + [ac_cv_func_memcmp_working=no], + [ac_cv_func_memcmp_working=no])]) +test $ac_cv_func_memcmp_working = no && AC_LIBOBJ([memcmp]) +])# AC_FUNC_MEMCMP + + +# AC_FUNC_MKTIME +# -------------- +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_RUN_IFELSE([AC_LANG_SOURCE( +[[/* Test program from Paul Eggert and Tony Leneis. */ +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif + +#if HAVE_UNISTD_H +# include <unistd.h> +#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 int +spring_forward_gap (void) +{ + /* 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) + return 1; + return 0; +} + +static int +mktime_test (time_t now) +{ + struct tm *lt; + if ((lt = localtime (&now)) && mktime (lt) != now) + return 1; + now = time_t_max - now; + if ((lt = localtime (&now)) && mktime (lt) != now) + return 1; + return 0; +} + +static int +irix_6_4_bug (void) +{ + /* 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) + return 1; + return 0; +} + +static int +bigtime_test (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)))) + return 1; + } + return 0; +} + +int +main (void) +{ + 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 <<= 1) + 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) + { + if (mktime_test (t)) + $ac_main_return (1); + } + if (mktime_test ((time_t) 60 * 60) + || mktime_test ((time_t) 60 * 60 * 24)) + { + $ac_main_return (1); + } + + for (j = 1; 0 < j; j <<= 1) + { + if (bigtime_test (j)) + $ac_main_return (1); + } + if (bigtime_test (j - 1)) + $ac_main_return (1); + } + if (irix_6_4_bug () + || spring_forward_gap ()) + $ac_main_return (1); + $ac_main_return (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 + AC_LIBOBJ([mktime]) +fi +])# AC_FUNC_MKTIME + + +# AU::AM_FUNC_MKTIME +# ------------------ +AU_ALIAS([AM_FUNC_MKTIME], [AC_FUNC_MKTIME]) + + +# AC_FUNC_MMAP +# ------------ +AC_DEFUN([AC_FUNC_MMAP], +[AC_CHECK_HEADERS(stdlib.h unistd.h) +AC_CHECK_FUNCS(getpagesize) +AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, +[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT] +[[/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the file system buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propagated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ + +#include <fcntl.h> +#include <sys/mman.h> + +#if !STDC_HEADERS && !HAVE_STDLIB_H +char *malloc (); +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#if !HAVE_GETPAGESIZE +/* Assume that all systems that can run configure have sys/param.h. */ +# if !HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# if HAVE_SYS_PARAM_H +# include <sys/param.h> +# 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 */ + +int +main (void) +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize (); + + /* First, make a file with some known garbage in it. */ + data = (char *) malloc (pagesize); + if (!data) + $ac_main_return (1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand (); + umask (0); + fd = creat ("conftest.mmap", 0600); + if (fd < 0) + $ac_main_return (1); + if (write (fd, data, pagesize) != pagesize) + $ac_main_return (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 ("conftest.mmap", O_RDWR); + if (fd < 0) + $ac_main_return (1); + data2 = (char *) malloc (2 * pagesize); + if (!data2) + $ac_main_return (1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + $ac_main_return (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + $ac_main_return (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 = (char *) malloc (pagesize); + if (!data3) + $ac_main_return (1); + if (read (fd, data3, pagesize) != pagesize) + $ac_main_return (1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + $ac_main_return (1); + close (fd); + $ac_main_return (0); +}]])], + [ac_cv_func_mmap_fixed_mapped=yes], + [ac_cv_func_mmap_fixed_mapped=no], + [ac_cv_func_mmap_fixed_mapped=no])]) +if test $ac_cv_func_mmap_fixed_mapped = yes; then + AC_DEFINE(HAVE_MMAP, 1, + [Define if you have a working `mmap' system call.]) +fi +rm -f conftest.mmap +])# AC_FUNC_MMAP + + +# AU::AC_MMAP +# ----------- +AU_ALIAS([AC_MMAP], [AC_FUNC_MMAP]) + + +# AC_FUNC_OBSTACK +# --------------- +# Ensure obstack support. Yeah, this is not exactly a `FUNC' check. +AC_DEFUN([AC_FUNC_OBSTACK], +[AC_LIBSOURCES([obstack.h, obstack.c])dnl +AC_CACHE_CHECK([for obstacks], ac_cv_func_obstack, +[AC_TRY_LINK([@%:@include "obstack.h"], + [struct obstack *mem; obstack_free(mem,(char *) 0)], + [ac_cv_func_obstack=yes], + [ac_cv_func_obstack=no])]) +if test $ac_cv_func_obstack = yes; then + AC_DEFINE(HAVE_OBSTACK, 1, [Define if libc includes obstacks.]) +else + AC_LIBOBJ(obstack) +fi +])# AC_FUNC_OBSTACK + + +# AU::AM_FUNC_OBSTACK +# ------------------- +AU_ALIAS([AM_FUNC_OBSTACK], [AC_FUNC_OBSTACK]) + + +# AC_FUNC_SELECT_ARGTYPES +# ----------------------- +# Determine the correct type to be passed to each of the `select' +# function's arguments, and define those types in `SELECT_TYPE_ARG1', +# `SELECT_TYPE_ARG234', and `SELECT_TYPE_ARG5'. +AC_DEFUN([AC_FUNC_SELECT_ARGTYPES], +[AC_CHECK_HEADERS(sys/select.h sys/socket.h) +AC_CACHE_CHECK([types of arguments for select], +[ac_cv_func_select_args], +[for ac_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do + for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( +[AC_INCLUDES_DEFAULT +#if HAVE_SYS_SELECT_H +# include <sys/select.h> +#endif +#if HAVE_SYS_SOCKET_H +# include <sys/socket.h> +#endif +], + [extern int select ($ac_arg1, + $ac_arg234, $ac_arg234, $ac_arg234, + $ac_arg5);])], + [ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3]) + done + done +done +# Provide a safe default value. +: "${ac_cv_func_select_args='int,int *,struct timeval *'}" +]) +ac_save_IFS=$IFS; IFS=',' +set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` +IFS=$ac_save_IFS +shift +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1, $[1], + [Define to the type of arg 1 for `select'.]) +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234, ($[2]), + [Define to the type of args 2, 3 and 4 for `select'.]) +AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5, ($[3]), + [Define to the type of arg 5 for `select'.]) +rm -rf conftest* +])# AC_FUNC_SELECT_ARGTYPES + + +# AC_FUNC_SETPGRP +# --------------- +AC_DEFUN([AC_FUNC_SETPGRP], +[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, +[AC_RUN_IFELSE( +[AC_LANG_PROGRAM( +[#if HAVE_UNISTD_H +# include <unistd.h> +#endif +], +[/* If this system has a BSD-style setpgrp, which takes arguments, exit + successfully. */ + $ac_main_return (setpgrp (1,1) == -1);])], + [ac_cv_func_setpgrp_void=no], + [ac_cv_func_setpgrp_void=yes], + [AC_MSG_ERROR([cannot check setpgrp if cross compiling])])]) +if test $ac_cv_func_setpgrp_void = yes; then + AC_DEFINE(SETPGRP_VOID, 1, + [Define if the `setpgrp' function takes no argument.]) +fi +])# AC_FUNC_SETPGRP + + +# _AC_FUNC_STAT(STAT | LSTAT) +# --------------------------- +# Determine whether stat or lstat have the bug that it succeeds when +# given the zero-length file name argument. The stat and lstat from +# SunOS4.1.4 and the Hurd (as of 1998-11-01) do this. +# +# If it does, then define HAVE_STAT_EMPTY_STRING_BUG (or +# HAVE_LSTAT_EMPTY_STRING_BUG) and arrange to compile the wrapper +# function. +m4_define([_AC_FUNC_STAT], +[AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])dnl +AC_CACHE_CHECK([whether $1 accepts an empty string], + [ac_cv_func_$1_empty_string_bug], +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], +[[struct stat sbuf; + $ac_main_return ($1 ("", &sbuf) ? 1 : 0);]])], + [ac_cv_func_$1_empty_string_bug=yes], + [ac_cv_func_$1_empty_string_bug=no], + [ac_cv_func_$1_empty_string_bug=yes])]) +if test $ac_cv_func_$1_empty_string_bug = yes; then + AC_LIBOBJ([$1]) + AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_$1_EMPTY_STRING_BUG]), 1, + [Define if `$1' has the bug that it succeeds when + given the zero-length file name argument.]) +fi +])# _AC_FUNC_STAT + + +# AC_FUNC_STAT & AC_FUNC_LSTAT +# ---------------------------- +AC_DEFUN([AC_FUNC_STAT], [_AC_FUNC_STAT(stat)]) +AC_DEFUN([AC_FUNC_LSTAT], [_AC_FUNC_STAT(lstat)]) + + +# _AC_LIBOBJ_STRTOD +# ----------------- +m4_define([_AC_LIBOBJ_STRTOD], +[AC_LIBOBJ(strtod) +AC_CHECK_FUNC(pow) +if test $ac_cv_func_pow = no; then + AC_CHECK_LIB(m, pow, + [POW_LIB=-lm], + [AC_MSG_WARN([can't find library containing definition of pow])]) +fi +])# _AC_LIBOBJ_STRTOD + + +# AC_FUNC_STRTOD +# -------------- +AC_DEFUN([AC_FUNC_STRTOD], +[AC_CACHE_CHECK(for working strtod, ac_cv_func_strtod, +[AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#if STDC_HEADERS || HAVE_STDLIB_H +#include <stdlib.h> +#else +double strtod (); +#endif +int +main(void) +{ + { + /* Some versions of Linux strtod mis-parse strings with leading '+'. */ + static char string[] = " +69"; + char *term; + double value; + value = strtod (string, &term); + if (value != 69 || term != (string + 4)) + $ac_main_return (1); + } + + { + /* Under Solaris 2.4, strtod returns the wrong value for the + terminating character under some conditions. */ + static char string[] = "NaN"; + char *term; + strtod (string, &term); + if (term != string && *(term - 1) == 0) + $ac_main_return (1); + } + $ac_main_return (0); +} +]])], + ac_cv_func_strtod=yes, + ac_cv_func_strtod=no, + ac_cv_func_strtod=no)]) +if test $ac_cv_func_strtod = no; then + _AC_LIBOBJ_STRTOD +fi +]) + + +# AU::AM_FUNC_STRTOD +# ------------------ +AU_ALIAS([AM_FUNC_STRTOD], [AC_FUNC_STRTOD]) + + +# AC_FUNC_STRERROR_R +# ------------------ +AC_DEFUN([AC_FUNC_STRERROR_R], +[AC_CHECK_DECLS([strerror_r]) +AC_CHECK_FUNCS([strerror_r]) +if test $ac_cv_func_strerror_r = yes; then + AC_CACHE_CHECK([for working strerror_r], + ac_cv_func_strerror_r_works, + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], + [[ + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + ]])], + ac_cv_func_strerror_r_works=yes, + ac_cv_func_strerror_r_works=no) + if test $ac_cv_func_strerror_r_works = no; then + # strerror_r seems not to work, but now we have to choose between + # systems that have relatively inaccessible declarations for the + # function. BeOS and DEC UNIX 4.0 fall in this category, but the + # former has a strerror_r that returns char*, while the latter + # has a strerror_r that returns `int'. + # This test should segfault on the DEC system. + AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT + extern char *strerror_r ();], + [[char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + $ac_main_return (!isalpha (x));]])], + ac_cv_func_strerror_r_works=yes, + ac_cv_func_strerror_r_works=no, + ac_cv_func_strerror_r_works=no) + fi + ]) + if test $ac_cv_func_strerror_r_works = yes; then + AC_DEFINE_UNQUOTED([HAVE_WORKING_STRERROR_R], 1, + [Define to 1 if `strerror_r' returns a string.]) + fi +fi +])# AC_FUNC_STRERROR_R + + +# AC_FUNC_STRFTIME +# ---------------- +AC_DEFUN([AC_FUNC_STRFTIME], +[AC_CHECK_FUNCS(strftime, [], +[# strftime is in -lintl on SCO UNIX. +AC_CHECK_LIB(intl, strftime, + [AC_DEFINE(HAVE_STRFTIME) +LIBS="-lintl $LIBS"])])dnl +])# AC_FUNC_STRFTIME + + +# AC_FUNC_SETVBUF_REVERSED +# ------------------------ +AC_DEFUN([AC_FUNC_SETVBUF_REVERSED], +[AC_CACHE_CHECK(whether setvbuf arguments are reversed, + ac_cv_func_setvbuf_reversed, +[AC_TRY_RUN([#include <stdio.h> +/* If setvbuf has the reversed format, exit 0. */ +int +main (void) +{ + /* This call has the arguments reversed. + A reversed system may check and see that the address of main + is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ + if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0) + $ac_main_return(1); + putc('\r', stdout); + $ac_main_return(0); /* Non-reversed systems segv here. */ +}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no) +rm -f core ./core.* ./*.core]) +if test $ac_cv_func_setvbuf_reversed = yes; then + AC_DEFINE(SETVBUF_REVERSED, 1, + [Define if the `setvbuf' function takes the buffering type as + its second argument and the buffer pointer as the third, as on + System V before release 3.]) +fi +])# AC_FUNC_SETVBUF_REVERSED + + +# AU::AC_SETVBUF_REVERSED +# ----------------------- +AU_ALIAS([AC_SETVBUF_REVERSED], [AC_FUNC_SETVBUF_REVERSED]) + + +# AC_FUNC_STRCOLL +# --------------- +AC_DEFUN([AC_FUNC_STRCOLL], +[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works, +[AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], + [[$ac_main_return (strcoll ("abc", "def") >= 0 || + strcoll ("ABC", "DEF") >= 0 || + strcoll ("123", "456") >= 0)]])], + ac_cv_func_strcoll_works=yes, + ac_cv_func_strcoll_works=no, + ac_cv_func_strcoll_works=no)]) +if test $ac_cv_func_strcoll_works = yes; then + AC_DEFINE(HAVE_STRCOLL, 1, + [Define if you have the `strcoll' function and it is properly + defined.]) +fi +])# AC_FUNC_STRCOLL + + +# AU::AC_STRCOLL +# -------------- +AU_ALIAS([AC_STRCOLL], [AC_FUNC_STRCOLL]) + + +# AC_FUNC_UTIME_NULL +# ------------------ +AC_DEFUN([AC_FUNC_UTIME_NULL], +[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null, +[rm -f conftest.data; >conftest.data +# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. +AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT], +[[struct stat s, t; + $ac_main_return (!(stat ("conftest.data", &s) == 0 + && utime ("conftest.data", (long *)0) == 0 + && stat ("conftest.data", &t) == 0 + && t.st_mtime >= s.st_mtime + && t.st_mtime - s.st_mtime < 120));]])], + ac_cv_func_utime_null=yes, + ac_cv_func_utime_null=no, + ac_cv_func_utime_null=no) +rm -f core ./core.* ./*.core]) +if test $ac_cv_func_utime_null = yes; then + AC_DEFINE(HAVE_UTIME_NULL, 1, + [Define if `utime(file, NULL)' sets file's timestamp to the + present.]) +fi +rm -f conftest.data +])# AC_FUNC_UTIME_NULL + + +# AU::AC_UTIME_NULL +# ----------------- +AU_ALIAS([AC_UTIME_NULL], [AC_FUNC_UTIME_NULL]) + + +# AC_FUNC_FORK +# ------------- +AC_DEFUN([AC_FUNC_FORK], +[AC_REQUIRE([AC_TYPE_PID_T])dnl +AC_CHECK_HEADERS(unistd.h vfork.h) +AC_CHECK_FUNCS(fork vfork) +ac_cv_func_fork_works=$ac_cv_func_fork +if test "x$ac_cv_func_fork" = xyes; then + _AC_FUNC_FORK +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + AC_MSG_WARN(CROSS: Result $ac_cv_func_fork_works guessed due to cross-compiling.) +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + _AC_FUNC_VFORK +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=ac_cv_func_vfork + AC_MSG_WARN(CROSS: Result $ac_cv_func_vfork_works guessed due to cross-compiling.) +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + AC_DEFINE(HAVE_WORKING_VFORK, 1, [Define if `vfork' works.]) +else + AC_DEFINE(vfork, fork, [Define as `fork' if `vfork' does not work.]) +fi +if test "x$ac_cv_func_fork_works" = xyes; then + AC_DEFINE(HAVE_WORKING_FORK, 1, [Define if `fork' works.]) +fi +])# AC_FUNC_FORK + + +# _AC_FUNC_FORK +# ------------- +AC_DEFUN([_AC_FUNC_FORK], + [AC_CACHE_CHECK(for working fork, ac_cv_func_fork_works, + [AC_RUN_IFELSE([/* By Rüdiger Kuhlmann. */ + #include <sys/types.h> + #if HAVE_UNISTD_H + # include <unistd.h> + #endif + /* Some systems only have a dummy stub for fork() */ + int main (void) + { + if (fork() < 0) + $ac_main_return (1); + $ac_main_return (0); + }], + [ac_cv_func_fork_works=yes], + [ac_cv_func_fork_works=no], + [ac_cv_func_fork_works=cross])])] +)# _AC_FUNC_FORK + + +# _AC_FUNC_VFORK +# ------------- +AC_DEFUN([_AC_FUNC_VFORK], +[AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, +[AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */ +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +#if HAVE_VFORK_H +# include <vfork.h> +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include <vfork.h>, but some compilers + (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static +sparc_address_test (int arg) +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} + +int +main (void) +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + $ac_main_return( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +}], + [ac_cv_func_vfork_works=yes], + [ac_cv_func_vfork_works=no], + [ac_cv_func_vfork_works=cross])]) +])# _AC_FUNC_VFORK + + +# AU::AC_FUNC_VFORK +# ------------ +AU_ALIAS([AC_FUNC_VFORK], [AC_FUNC_FORK]) + +# AU::AC_VFORK +# ------------ +AU_ALIAS([AC_VFORK], [AC_FUNC_FORK]) + + +# AC_FUNC_VPRINTF +# --------------- +# Why the heck is that _doprnt does not define HAVE__DOPRNT??? +# That the logical name! +AC_DEFUN([AC_FUNC_VPRINTF], +[AC_CHECK_FUNCS(vprintf, [] +[AC_CHECK_FUNC(_doprnt, + [AC_DEFINE(HAVE_DOPRNT, 1, + [Define if you don't have `vprintf' but do have + `_doprnt.'])])]) +]) + + +# AU::AC_VPRINTF +# -------------- +AU_ALIAS([AC_VPRINTF], [AC_FUNC_VPRINTF]) + + +# AC_FUNC_WAIT3 +# ------------- +# Don't bother too hard maintaining this macro, as it's obsoleted. +# We don't AU define it, since we don't have any alternative to propose, +# any invocation should be removed, and the code adjusted. +AC_DEFUN([AC_FUNC_WAIT3], +[AC_DIAGNOSE([obsolete], +[$0: `wait3' is being removed from the Open Group standards. +Remove this `AC_FUNC_WAIT3' and adjust your code to use `waitpid' instead.])dnl +AC_CACHE_CHECK([for wait3 that fills in rusage], + [ac_cv_func_wait3_rusage], +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[[#include <sys/types.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <stdio.h> +/* HP-UX has wait3 but does not fill in rusage at all. */ +int +main (void) +{ + struct rusage r; + int i; + /* Use a field that we can force nonzero -- + voluntary context switches. + For systems like NeXT and OSF/1 that don't set it, + also use the system CPU time. And page faults (I/O) for Linux. */ + r.ru_nvcsw = 0; + r.ru_stime.tv_sec = 0; + r.ru_stime.tv_usec = 0; + r.ru_majflt = r.ru_minflt = 0; + switch (fork ()) + { + case 0: /* Child. */ + sleep(1); /* Give up the CPU. */ + _exit(0); + break; + case -1: /* What can we do? */ + _exit(0); + break; + default: /* Parent. */ + wait3(&i, 0, &r); + /* Avoid "text file busy" from rm on fast HP-UX machines. */ + sleep(2); + $ac_main_return (r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0 + && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0); + } +}]])], + [ac_cv_func_wait3_rusage=yes], + [ac_cv_func_wait3_rusage=no], + [ac_cv_func_wait3_rusage=no])]) +if test $ac_cv_func_wait3_rusage = yes; then + AC_DEFINE(HAVE_WAIT3, 1, + [Define if you have the `wait3' system call. + Deprecated, you should no longer depend upon `wait3'.]) +fi +])# AC_FUNC_WAIT3 + + +# AU::AC_WAIT3 +# ------------ +AU_ALIAS([AC_WAIT3], [AC_FUNC_WAIT3]) diff --git a/acgeneral.m4 b/acgeneral.m4 new file mode 100644 index 0000000..5f8aa69 --- /dev/null +++ b/acgeneral.m4 @@ -0,0 +1,4744 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# Parameterized macros. +#------------------------------------------------------------------------------ +# Copyright 2003-2022,2023 Thomas E. Dickey +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by David MacKenzie, with help from +# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +# Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +## ---------------- ## +## The diversions. ## +## ---------------- ## + + +# We heavily use m4's diversions both for the initializations and for +# required macros (see AC_REQUIRE), because in both cases we have to +# issue high in `configure' something which is discovered late. +# +# KILL is only used to suppress output. +# +# The layers of `configure'. We let m4 undivert them by itself, when +# it reaches the end of `configure.ac'. +# +# - BINSH +# AC_REQUIRE'd #! /bin/sh line +# - REVISION +# Sent by AC_REVISION +# - NOTICE +# copyright notice(s) +# - DEFAULTS +# early initializations (defaults) +# - PARSE_ARGS +# initialization code, option handling loop. +# +# - HELP_BEGIN +# Handling `configure --help'. +# - HELP_CANON +# Help msg for AC_CANONICAL_* +# - HELP_INTRO +# Overview help msg from AC_ARG_ENABLE, AC_ARG_WITH. +# - HELP_DETAIL +# Detailed help msg from AC_ARG_ENABLE, AC_ARG_WITH. +# - HELP_VAR +# Help msg from AC_ARG_VAR. +# - HELP_VAR_END +# A small paragraph on the use of the variables. +# - HELP_END +# Tail of the handling of --help. +# +# - VERSION_BEGIN +# Head of the handling of --version. +# - VERSION_FSF +# FSF copyright notice for --version. +# - VERSION_USER +# User copyright notice for --version. +# - VERSION_END +# Tail of the handling of --version. +# +# - INIT_PREPARE +# Tail of initialization code. +# +# - SHFUN_BEGIN +# Add beginning comment-marker for shell-functions, if enabled. +# - SHFUN_OURS +# Add autoconf shell-functions, if enabled rather than inline. +# - SHFUN_USER +# Add user-defined shell-functions, if enabled rather than inline. +# - SHFUN_END +# Add closing comment-marker for shell-functions, if enabled. +# +# - BODY +# the tests and output code +# + + +# _m4_divert(DIVERSION-NAME) +# -------------------------- +# Convert a diversion name into its number. Otherwise, return +# DIVERSION-NAME which is supposed to be an actual diversion number. +# Of course it would be nicer to use m4_case here, instead of zillions +# of little macros, but it then takes twice longer to run `autoconf'! +m4_define([_m4_divert(BINSH)], 0) +m4_define([_m4_divert(REVISION)], 1) +m4_define([_m4_divert(NOTICE)], 2) +m4_define([_m4_divert(DEFAULTS)], 3) +m4_define([_m4_divert(PARSE_ARGS)], 4) + +m4_define([_m4_divert(HELP_BEGIN)], 10) +m4_define([_m4_divert(HELP_CANON)], 11) +m4_define([_m4_divert(HELP_INTRO)], 12) +m4_define([_m4_divert(HELP_DETAIL)], 13) +m4_define([_m4_divert(HELP_VAR)], 14) +m4_define([_m4_divert(HELP_VAR_END)], 15) +m4_define([_m4_divert(HELP_END)], 16) + +m4_define([_m4_divert(VERSION_BEGIN)], 20) +m4_define([_m4_divert(VERSION_FSF)], 21) +m4_define([_m4_divert(VERSION_USER)], 22) +m4_define([_m4_divert(VERSION_END)], 23) + +m4_define([_m4_divert(INIT_PREPARE)], 30) + +m4_define([_m4_divert(SHFUN_BEGIN)], 40) +m4_define([_m4_divert(SHFUN_OURS)], 41) +m4_define([_m4_divert(SHFUN_USER)], 42) +m4_define([_m4_divert(SHFUN_END)], 43) + +m4_define([_m4_divert(BODY)], 50) + +m4_define([_m4_divert(PREPARE)], 100) + + + +# AC_DIVERT_PUSH(DIVERSION-NAME) +# AC_DIVERT_POP +# ------------------------------ +m4_copy([m4_divert_push],[AC_DIVERT_PUSH]) +m4_copy([m4_divert_pop], [AC_DIVERT_POP]) + + +## ------------------------------- ## +## Defining macros in autoconf::. ## +## ------------------------------- ## + + +# AC_DEFUN(NAME, EXPANSION) +# ------------------------- +# Same as `m4_define' but equip the macro with the needed machinery +# for `AC_REQUIRE'. +# +# We don't use this macro to define some frequently called macros that +# are not involved in ordering constraints, to save m4 processing. +m4_define([AC_DEFUN], +[m4_defun([$1], [$2[]AC_PROVIDE([$1])])]) + + +# AC_DEFUN_ONCE(NAME, EXPANSION) +# ------------------------------ +# As AC_DEFUN, but issues the EXPANSION only once, and warns if used +# several times. +m4_define([AC_DEFUN_ONCE], +[m4_defun_once([$1], [$2[]AC_PROVIDE([$1])])]) + + +# AC_OBSOLETE(THIS-MACRO-NAME, [SUGGESTION]) +# ------------------------------------------ +m4_define([AC_OBSOLETE], +[AC_DIAGNOSE([obsolete], [$1 is obsolete$2])]) + + + + + + +## ----------------------------- ## +## Dependencies between macros. ## +## ----------------------------- ## + + +# AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME) +# --------------------------------------------- +m4_define([AC_BEFORE], +[AC_PROVIDE_IFELSE([$2], [AC_DIAGNOSE([syntax], [$2 was called before $1])])]) + + +# AC_REQUIRE(STRING) +# ------------------ +# If STRING has never been AC_PROVIDE'd, then expand it. A macro must +# be AC_DEFUN'd if either it is AC_REQUIRE'd, or it AC_REQUIRE's. +m4_copy([m4_require], [AC_REQUIRE]) + + +# AC_PROVIDE(MACRO-NAME) +# ---------------------- +# Ideally we should just use `m4_provide($1)', but unfortunately many +# third party macros know that we use `AC_PROVIDE_$1' and they depend +# on it. +m4_define([AC_PROVIDE], +[m4_define([AC_PROVIDE_$1])m4_provide([$1])]) + + +# 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. +m4_define([AC_PROVIDE_IFELSE], +[m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])]) + + + + +## --------------------------------- ## +## Defining macros in autoupdate::. ## +## --------------------------------- ## + + +# AU_DEFINE(NAME, GLUE-CODE, [MESSAGE]) +# ------------------------------------- +# +# Declare `autoupdate::NAME' to be `GLUE-CODE', with all the needed +# wrapping actions required by `autoupdate'. +# We do not define anything in `autoconf::'. +m4_define([AU_DEFINE], +[AC_DEFUN([$1], [$2])]) + + +# AU_DEFUN(NAME, NEW-CODE, [MESSAGE]) +# ----------------------------------- +# Declare that the macro NAME is now obsoleted, and should be replaced +# by NEW-CODE. Tell the user she should run autoupdate, and include +# the additional MESSAGE. +# +# Also define NAME as a macro which code is NEW-CODE. +# +# This allows to share the same code for both supporting obsoleted macros, +# and to update a configure.ac. +# See `acobsolete.m4' for a longer description. +m4_define([AU_DEFUN], +[AU_DEFINE([$1], + [AC_DIAGNOSE([obsolete], [The macro `$1' is obsolete. +You should run autoupdate.])dnl +$2], + [$3])dnl +]) + + +# AU_ALIAS(OLD-NAME, NEW-NAME) +# ---------------------------- +# The OLD-NAME is no longer used, just use NEW-NAME instead. There is +# little difference with using AU_DEFUN but the fact there is little +# interest in running the test suite on both OLD-NAME and NEW-NAME. +# This macro makes it possible to distinguish such cases. +# +# Do not use `defn' since then autoupdate would replace an old macro +# call with the new macro body instead of the new macro call. +m4_define([AU_ALIAS], +[AU_DEFUN([$1], [$2($][@)])]) + + + +## ------------------------- ## +## Interface to autoheader. ## +## ------------------------- ## + + +# AH_OUTPUT(KEY, TEXT) +# -------------------- +# Pass TEXT to autoheader. +# This macro is `read' only via `autoconf --trace', it outputs nothing. +m4_define([AH_OUTPUT], []) + + +# AH_VERBATIM(KEY, TEMPLATE) +# -------------------------- +# If KEY is direct (i.e., no indirection such as in KEY=$my_func which +# may occur if there is AC_CHECK_FUNCS($my_func)), issue an autoheader +# TEMPLATE associated to the KEY. Otherwise, do nothing. TEMPLATE is +# output as is, with no formatting. +m4_define([AH_VERBATIM], +[AS_LITERAL_IF([$1], + [AH_OUTPUT([$1], AS_ESCAPE([[$2]]))]) +]) + + +# _AH_VERBATIM_OLD(KEY, TEMPLATE) +# ------------------------------- +# Same as above, but with bugward compatibility. +m4_define([_AH_VERBATIM_OLD], +[AS_LITERAL_IF([$1], + [AH_OUTPUT([$1], _AS_QUOTE([[$2]]))]) +]) + + +# AH_TEMPLATE(KEY, DESCRIPTION) +# ----------------------------- +# Issue an autoheader template for KEY, i.e., a comment composed of +# DESCRIPTION (properly wrapped), and then #undef KEY. +m4_define([AH_TEMPLATE], +[AH_VERBATIM([$1], + m4_text_wrap([$2 */], [ ], [/* ])[ +#undef $1])]) + + +# _AH_TEMPLATE_OLD(KEY, DESCRIPTION) +# ---------------------------------- +# Same as above, but with bugward compatibility. +m4_define([_AH_TEMPLATE_OLD], +[_AH_VERBATIM_OLD([$1], + m4_text_wrap([$2 */], [ ], [/* ])[ +#undef $1])]) + + +# AH_TOP(TEXT) +# ------------ +# Output TEXT at the top of `config.h.in'. +m4_define([AH_TOP], +[m4_define([_AH_COUNTER], m4_incr(_AH_COUNTER))dnl +AH_VERBATIM([0000]_AH_COUNTER, [$1])]) + + +# AH_BOTTOM(TEXT) +# --------------- +# Output TEXT at the bottom of `config.h.in'. +m4_define([AH_BOTTOM], +[m4_define([_AH_COUNTER], m4_incr(_AH_COUNTER))dnl +AH_VERBATIM([zzzz]_AH_COUNTER, [$1])]) + +# Initialize. +m4_define([_AH_COUNTER], [0]) + + + + +## ----------------------------- ## +## Implementing Autoconf loops. ## +## ----------------------------- ## + + +# AC_FOREACH(VARIABLE, LIST, EXPRESSION) +# -------------------------------------- +# +# Compute EXPRESSION assigning to VARIABLE each value of the LIST. +# LIST is a /bin/sh list, i.e., it has the form ` item_1 item_2 +# ... item_n ': white spaces are separators, and leading and trailing +# spaces are meaningless. +# +# This macro is robust to active symbols: +# AC_FOREACH([Var], [ active +# b act\ +# ive ], [-Var-])end +# => -active--b--active-end +m4_define([AC_FOREACH], +[m4_foreach([$1], m4_split(m4_normalize([$2])), [$3])]) + + + + +## ----------------------------------- ## +## Helping macros to display strings. ## +## ----------------------------------- ## + + +# AC_HELP_STRING(LHS, RHS, [COLUMN]) +# ---------------------------------- +# +# Format an Autoconf macro's help string so that it looks pretty when +# the user executes "configure --help". This macro takes three +# arguments, a "left hand side" (LHS), a "right hand side" (RHS), and +# the COLUMN which is a string of white spaces which leads to the +# the RHS column (default: 26 white spaces). +# +# The resulting string is suitable for use in other macros that require +# a help string (e.g. AC_ARG_WITH). +# +# Here is the sample string from the Autoconf manual (Node: External +# Software) which shows the proper spacing for help strings. +# +# --with-readline support fancy command line editing +# ^ ^ ^ +# | | | +# | column 2 column 26 +# | +# column 0 +# +# A help string is made up of a "left hand side" (LHS) and a "right +# hand side" (RHS). In the example above, the LHS is +# "--with-readline", while the RHS is "support fancy command line +# editing". +# +# If the LHS extends past column 24, then the LHS is terminated with a +# newline so that the RHS is on a line of its own beginning in column +# 26. +# +# Therefore, if the LHS were instead "--with-readline-blah-blah-blah", +# then the AC_HELP_STRING macro would expand into: +# +# +# --with-readline-blah-blah-blah +# ^ ^ support fancy command line editing +# | | ^ +# | column 2 | +# column 0 column 26 +# +m4_define([AC_HELP_STRING], +[m4_pushdef([AC_Prefix], m4_default([$3], [ ]))dnl +m4_pushdef([AC_Prefix_Format], + [ %-]m4_eval(m4_len(AC_Prefix) - 3)[s ])dnl [ %-23s ] +m4_text_wrap([$2], AC_Prefix, m4_format(AC_Prefix_Format, [$1]))dnl +m4_popdef([AC_Prefix_Format])dnl +m4_popdef([AC_Prefix])dnl +]) + + + + +## ---------------------------------------------- ## +## Information on the package being Autoconf'ed. ## +## ---------------------------------------------- ## + + +# It is suggested that the macros in this section appear before +# AC_INIT in `configure.ac'. Nevertheless, this is just stylistic, +# and from the implementation point of, AC_INIT *must* be expanded +# beforehand: it puts data in diversions which must appear before the +# data provided by the macros of this section. + +# The solution is to require AC_INIT in each of these macros. AC_INIT +# has the needed magic so that it can't be expanded twice. + + + +# _AC_INIT_PACKAGE(PACKAGE-NAME, VERSION, +# [BUG-REPORT], +# [TAR-NAME = unGNU'd lower case PACKAGE-NAME]) +# -------------------------------------------------------------- +m4_define([_AC_INIT_PACKAGE], +[m4_define([AC_PACKAGE_NAME], [$1]) +m4_define([AC_PACKAGE_TARNAME], + m4_tolower(m4_patsubst([[[$1]]], [GNU ]))) +m4_define([AC_PACKAGE_VERSION], [$2]) +m4_define([AC_PACKAGE_STRING], [$1 $2]) +m4_define([AC_PACKAGE_BUGREPORT], [$3]) +]) + + +# AC_COPYRIGHT(TEXT, [VERSION-DIVERSION = VERSION_USER]) +# ------------------------------------------------------ +# Append Copyright information in the top of `configure'. TEXT is +# evaluated once, hence TEXT can use macros. Note that we do not +# prepend `# ' but `@%:@ ', since m4 does not evaluate the comments. +# Had we used `# ', the Copyright sent in the beginning of `configure' +# would have not been evaluated. Another solution, a bit fragile, +# would have be to use m4_quote to force an evaluation: +# +# m4_patsubst(m4_quote($1), [^], [# ]) +m4_define([AC_COPYRIGHT], +[m4_divert_text([NOTICE], +[m4_patsubst([ +$1], [^], [@%:@ ])])dnl +m4_divert_text(m4_default([$2], [VERSION_USER]), +[ +$1])dnl +])# AC_COPYRIGHT + + +# AC_REVISION(REVISION-INFO) +# -------------------------- +# The second quote in the translit is just to cope with font-lock-mode +# which sees the opening of a string. +m4_define([AC_REVISION], +[m4_divert_text([REVISION], + [@%:@ From __file__ m4_translit([$1], [$""]).])dnl +]) + + + + +## ---------------------------------------- ## +## Requirements over the Autoconf version. ## +## ---------------------------------------- ## + + +# AU::AC_PREREQ(VERSION) +# ---------------------- +# Update this `AC_PREREQ' statement to require the current version of +# Autoconf. But fail if ever this autoupdate is too old. +# +# Note that `m4_defn([AC_ACVERSION])' below are expanded before calling +# `AU_DEFUN', i.e., it is hard coded. Otherwise it would be quite +# complex for autoupdate to import the value of `AC_ACVERSION'. We +# could `AU_DEFUN' `AC_ACVERSION', but this would replace all its +# occurrences with the current version of Autoconf, which is certainly +# not what mean the user. +AU_DEFUN([AC_PREREQ], +[m4_if(m4_version_compare(]m4_defn([AC_ACVERSION])[, [$1]), -1, + [m4_fatal([Autoconf version $1 or higher is required for this script])])dnl +[AC_PREREQ(]]m4_defn([AC_ACVERSION])[[)]]) + + +# AC_PREREQ(VERSION) +# ------------------ +# Complain and exit if the Autoconf version is less than VERSION. +m4_define([AC_PREREQ], +[m4_if(m4_version_compare(m4_defn([AC_ACVERSION]), [$1]), -1, + [AC_FATAL([Autoconf version $1 or higher is required for this script])])]) + + + + + + +## ---------------- ## +## Initialization. ## +## ---------------- ## + + +# All the following macros are used by AC_INIT. Ideally, they should +# be presented in the order in which they are output. Please, help us +# sorting it, or at least, don't augment the entropy. + + +# _AC_INIT_NOTICE +# --------------- +m4_define([_AC_INIT_NOTICE], +[m4_divert_text([NOTICE], +[@%:@ Guess values for system-dependent variables and create Makefiles. +@%:@ Generated by Autoconf AC_ACVERSION[]dnl +m4_ifset([AC_PACKAGE_STRING], [ for AC_PACKAGE_STRING]).]) + +m4_ifset([AC_PACKAGE_BUGREPORT], + [m4_divert_text([NOTICE], + [@%:@ +@%:@ Report bugs to <AC_PACKAGE_BUGREPORT>.])]) +]) + + +# _AC_INIT_COPYRIGHT +# ------------------ +# We dump to VERSION_FSF to make sure we are inserted before the +# user copyrights, and after the setup of the --version handling. +m4_define([_AC_INIT_COPYRIGHT], +[AC_COPYRIGHT( +[Copyright 2003-2022,2023 Thomas E. Dickey +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it.], + [VERSION_FSF])dnl +]) + + +# File Descriptors +# ---------------- +# Set up the file descriptors used by `configure'. +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# AS_MESSAGE_LOG_FD compiler messages saved in config.log +# AS_MESSAGE_FD checking for... messages and results + +m4_define([AS_MESSAGE_FD], 6) +# That's how they used to be named. +AU_ALIAS([AC_FD_CC], [AS_MESSAGE_LOG_FD]) +AU_ALIAS([AC_FD_MSG], [AS_MESSAGE_FD]) + + +# _AC_INIT_DEFAULTS +# ----------------- +# Values which defaults can be set from `configure.ac'. +# `/bin/machine' is used in `glibcbug'. The others are used in config.* +m4_define([_AC_INIT_DEFAULTS], +[m4_divert_push([DEFAULTS])dnl + +AS_SHELL_SANITIZE + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec AS_MESSAGE_FD>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +AC_SUBST(SHELL, ${CONFIG_SHELL-/bin/sh})dnl + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: "${ac_max_here_lines=38}" + +m4_divert_pop([DEFAULTS])dnl +])# _AC_INIT_DEFAULTS + + +# AC_PREFIX_DEFAULT(PREFIX) +# ------------------------- +AC_DEFUN([AC_PREFIX_DEFAULT], +[m4_divert_text([DEFAULTS], [ac_default_prefix=$1])]) + + +# AC_CONFIG_SRCDIR([UNIQUE-FILE-IN-SOURCE-DIR]) +# --------------------------------------------- +# UNIQUE-FILE-IN-SOURCE-DIR is 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_DEFUN([AC_CONFIG_SRCDIR], +[m4_divert_text([DEFAULTS], [ac_unique_file="$1"])]) + + +# _AC_INIT_SRCDIR +# --------------- +# Compute `srcdir' based on `$ac_unique_file'. +m4_define([_AC_INIT_SRCDIR], +[m4_divert_push([PARSE_ARGS])dnl + +# 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] +dnl FIXME: should use AS_DIRNAME here once it is made DOS-friendly. + 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 + AC_MSG_ERROR([cannot find sources in $ac_confdir or ..]) + else + AC_MSG_ERROR([cannot find sources in $srcdir]) + fi +fi +dnl Double slashes in pathnames in object file debugging info +dnl mess up M-x gdb in Emacs. +srcdir=`echo "$srcdir" | sed 's%\([[^\\/]]\)[[\\/]]*$%\1%'` +m4_divert_pop([PARSE_ARGS])dnl +])# _AC_INIT_SRCDIR + + +# _AC_INIT_PARSE_ARGS +# ------------------- +m4_define([_AC_INIT_PARSE_ARGS], +[m4_divert_push([PARSE_ARGS])dnl + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +AC_SUBST(exec_prefix, NONE)dnl +no_create= +no_recursion= +AC_SUBST(prefix, NONE)dnl +program_prefix=NONE +program_suffix=NONE +AC_SUBST(program_transform_name, [s,x,x,])dnl +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +AC_SUBST([bindir], ['${exec_prefix}/bin'])dnl +AC_SUBST([sbindir], ['${exec_prefix}/sbin'])dnl +AC_SUBST([libexecdir], ['${exec_prefix}/libexec'])dnl +AC_SUBST([datarootdir], ['${prefix}/share'])dnl +AC_SUBST([datadir], ['${datarootdir}'])dnl +AC_SUBST([sysconfdir], ['${prefix}/etc'])dnl +AC_SUBST([sharedstatedir], ['${prefix}/com'])dnl +AC_SUBST([localstatedir], ['${prefix}/var'])dnl +AC_SUBST([runstatedir], ['${localstatedir}/run'])dnl +AC_SUBST([libdir], ['${exec_prefix}/lib'])dnl +AC_SUBST([includedir], ['${prefix}/include'])dnl +AC_SUBST([oldincludedir], ['/usr/include'])dnl +AC_SUBST([infodir], ['${datarootdir}/info'])dnl +AC_SUBST([mandir], ['${datarootdir}/man'])dnl + +# Identity of this package. +AC_SUBST([PACKAGE_NAME], + [m4_ifdef([AC_PACKAGE_NAME], ['AC_PACKAGE_NAME'])])dnl +AC_SUBST([PACKAGE_TARNAME], + [m4_ifdef([AC_PACKAGE_TARNAME], ['AC_PACKAGE_TARNAME'])])dnl +AC_SUBST([PACKAGE_VERSION], + [m4_ifdef([AC_PACKAGE_VERSION], ['AC_PACKAGE_VERSION'])])dnl +AC_SUBST([PACKAGE_STRING], + [m4_ifdef([AC_PACKAGE_STRING], ['AC_PACKAGE_STRING'])])dnl +AC_SUBST([PACKAGE_BUGREPORT], + [m4_ifdef([AC_PACKAGE_BUGREPORT], ['AC_PACKAGE_BUGREPORT'])])dnl + +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 + + ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'` + + # 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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null && + AC_MSG_ERROR([invalid feature name: $ac_feature]) + ac_feature=`echo "$ac_feature" | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([[^=]]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : "[.*[^-_$as_cr_alnum]]" >/dev/null && + AC_MSG_ERROR([invalid feature name: $ac_feature]) + ac_feature=`echo "$ac_feature" | sed 's/-/_/g'` + case "$ac_option" in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) 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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$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 ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst \ + | --runs | --run | --ru) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* \ + | --runs=* | --run=* | --ru=*) + runstatedir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([[^=]]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null && + AC_MSG_ERROR([invalid package name: $ac_package]) + ac_package=`echo "$ac_package" | sed 's/-/_/g'` + case "$ac_option" in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : "[.*[^-_$as_cr_alnum]]" >/dev/null && + AC_MSG_ERROR([invalid package name: $ac_package]) + 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 ;; + + -*) AC_MSG_ERROR([unrecognized option: $ac_option +Try `$[0] --help' for more information.]) + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([[^=]]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : "[.*[^_$as_cr_alnum]]" >/dev/null && + AC_MSG_ERROR([invalid variable name: $ac_envvar]) + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export "$ac_envvar" ;; + + *) + # FIXME: should be removed in autoconf 3.0. + AC_MSG_WARN([you should use --build, --host, --target]) + expr "x$ac_option" : "[.*[^-._$as_cr_alnum]]" >/dev/null && + AC_MSG_WARN([invalid host type: $ac_option]) + : "${build_alias=$ac_option}" "${host_alias=$ac_option}" "${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo "$ac_prev" | sed 's/_/-/g'` + AC_MSG_ERROR([missing argument to $ac_option]) +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo "$ac_var"` + case "$ac_val" in + [[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;; + *) AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo "$ac_var"` + case "$ac_val" in + [[\\/$]]* | ?:[[\\/]]* ) ;; + *) AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + AC_MSG_WARN([If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used.]) + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec AS_MESSAGE_FD>/dev/null + +m4_divert_pop([PARSE_ARGS])dnl +])# _AC_INIT_PARSE_ARGS + + +# _AC_INIT_HELP +# ------------- +# Handle the `configure --help' message. +m4_define([_AC_INIT_HELP], +[m4_divert_push([HELP_BEGIN])dnl + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # 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 +\`configure' configures m4_ifset([AC_PACKAGE_STRING], + [AC_PACKAGE_STRING], + [this package]) to adapt to many kinds of systems. + +Usage: $[0] [[OPTION]]... [[VAR=VALUE]]... + +[To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +EOF + + cat <<EOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datarootdir=DIR read-only architecture-independent data [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR extra definition of runtime data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [DATAROOTDIR/info] + --mandir=DIR man documentation [DATAROOTDIR/man] +EOF + + cat <<\EOF] +m4_divert_pop([HELP_BEGIN])dnl +dnl The order of the diversions here is +dnl - HELP_BEGIN +dnl which may be prolongated by extra generic options such as with X or +dnl AC_ARG_PROGRAM. Displayed only in long --help. +dnl +dnl - HELP_CANON +dnl Support for cross compilation (--build, --host and --target). +dnl Display only in long --help. +dnl +dnl - HELP_INTRO +dnl which starts with the trailer of the HELP_BEGIN, HELP_CANON section, +dnl then implements the header of the non generic options. +dnl +dnl - HELP_DETAIL +dnl +dnl - HELP_VAR +dnl +dnl - HELP_VAR_END +dnl +dnl - HELP_END +dnl initialized below, in which we dump the trailer (handling of the +dnl recursion for instance). +m4_divert_push([HELP_INTRO])dnl +EOF +fi + +if test -n "$ac_init_help"; then +m4_ifset([AC_PACKAGE_STRING], +[ case "$ac_init_help" in + short | recursive ) echo "Configuration of AC_PACKAGE_STRING:";; + esac]) + cat <<\EOF +m4_divert_pop([HELP_INTRO])dnl +m4_divert_push([HELP_END])dnl +m4_ifset([AC_PACKAGE_BUGREPORT], [ +Report bugs to <AC_PACKAGE_BUGREPORT>.]) +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd "$ac_subdir" + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo "$ac_subdir" | + sed 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir="$srcdir" ;; + [[\\/]]* | ?:[[\\/]]* ) # Absolute path. + ac_sub_srcdir="$srcdir/$ac_subdir" ;; + *) # Relative path. + ac_sub_srcdir="$ac_dots$srcdir/$ac_subdir" ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_sub_srcdir/configure.gnu"; then + echo + $SHELL "$ac_sub_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_sub_srcdir/configure"; then + echo + $SHELL "$ac_sub_srcdir/configure" --help=recursive + elif test -f "$ac_sub_srcdir/configure.ac" || + test -f "$ac_sub_srcdir/configure.in"; then + echo + "$ac_configure" --help + else + AC_MSG_WARN([no configuration information is in $ac_subdir]) + fi + cd "$ac_popdir" + done +fi + +test -n "$ac_init_help" && exit 0 +m4_divert_pop([HELP_END])dnl +])# _AC_INIT_HELP + + +# _AC_INIT_VERSION +# ---------------- +# Handle the `configure --version' message. +m4_define([_AC_INIT_VERSION], +[m4_divert_text([VERSION_BEGIN], +[if "$ac_init_version"; then + cat <<\EOF])dnl +m4_ifset([AC_PACKAGE_STRING], + [m4_divert_text([VERSION_BEGIN], + [dnl +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])configure[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +generated by GNU Autoconf AC_ACVERSION])]) +m4_divert_text([VERSION_END], +[EOF + exit 0 +fi])dnl +])# _AC_INIT_VERSION + + +# _AC_INIT_CONFIG_LOG +# ------------------- +# Initialize the config.log file descriptor and write header to it. +m4_define([_AC_INIT_CONFIG_LOG], +[m4_divert_text([INIT_PREPARE], +[m4_define([AS_MESSAGE_LOG_FD], 5)dnl +exec AS_MESSAGE_LOG_FD>config.log +cat >&AS_MESSAGE_LOG_FD <<EOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by m4_ifset([AC_PACKAGE_NAME], + [AC_PACKAGE_NAME ])dnl +$as_me[]m4_ifset([AC_PACKAGE_VERSION], + [ AC_PACKAGE_VERSION]), which was +generated by GNU Autoconf AC_ACVERSION. Invocation command line was + + $ $[0] $[@] + +EOF +AS_UNAME >&AS_MESSAGE_LOG_FD + +cat >&AS_MESSAGE_LOG_FD <<EOF +## ------------ ## +## Core tests. ## +## ------------ ## + +EOF +])])# _AC_INIT_CONFIG_LOG + +# _AC_INIT_PREPARE_FS_SEPARATORS +# ------------------------------ +# Compute the directory and path separators. +# FIXME: Full version should include dir separator, documentation about +# AC_SUBST'ed variables etc. +m4_define([_AC_INIT_PREPARE_FS_SEPARATORS], +[echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if AC_RUN_LOG([PATH=".;."; conftest.sh]); then + ac_path_separator=';' +else + ac_path_separator=: +fi +AC_SUBST([PATH_SEPARATOR], "$ac_path_separator")dnl +rm -f conftest.sh +]) + + +# _AC_INIT_PREPARE +# ---------------- +# Called by AC_INIT to build the preamble of the `configure' scripts. +# 1. Trap and clean up various tmp files. +# 2. Set up the fd and output files +# 3. Remember the options given to `configure' for `config.status --recheck'. +# 4. Ensure a correct environment +# 5. Required macros (cache, default AC_SUBST etc.) +m4_define([_AC_INIT_PREPARE], +[m4_divert_push([INIT_PREPARE])dnl + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +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) ;; +dnl If you change this globbing pattern, test it on an old shell -- +dnl it's sensitive. Putting any kind of quote in it causes syntax errors. +[ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)] + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&AS_MESSAGE_LOG_FD + echo ["## ----------------- ##"] >&AS_MESSAGE_LOG_FD + echo ["## Cache variables. ##"] >&AS_MESSAGE_LOG_FD + echo ["## ----------------- ##"] >&AS_MESSAGE_LOG_FD + echo >&AS_MESSAGE_LOG_FD + m4_patsubst(m4_patsubst(m4_dquote(m4_defn([_AC_CACHE_DUMP])), + [^ *\(#.*\)? +]), + ['], ['"'"']) >&AS_MESSAGE_LOG_FD + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&AS_MESSAGE_LOG_FD + echo ["## ------------ ##"] >&AS_MESSAGE_LOG_FD + echo ["## confdefs.h. ##"] >&AS_MESSAGE_LOG_FD + echo ["## ------------ ##"] >&AS_MESSAGE_LOG_FD + echo >&AS_MESSAGE_LOG_FD + cat conftest.log >&AS_MESSAGE_LOG_FD + fi + (echo; echo) >&AS_MESSAGE_LOG_FD + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&AS_MESSAGE_LOG_FD + echo "$as_me: exit $exit_status" >&AS_MESSAGE_LOG_FD + rm -rf conftest* confdefs* core core.* *.core conf$[$]* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; AS_EXIT([1])' "$ac_signal" +done +ac_signal=0 + +# 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 + +# Let the site file select an alternate cache file if it wants to. +AC_SITE_LOAD +AC_CACHE_LOAD +_AC_ARG_VAR_VALIDATE +_AC_ARG_VAR_PRECIOUS(build_alias)dnl +_AC_ARG_VAR_PRECIOUS(host_alias)dnl +_AC_ARG_VAR_PRECIOUS(target_alias)dnl +AC_LANG_PUSH(C) + +_AC_PROG_ECHO()dnl +_AC_INIT_PREPARE_FS_SEPARATORS + +dnl Substitute for predefined variables. +AC_SUBST(DEFS)dnl +AC_SUBST(LIBS)dnl +m4_divert_pop([INIT_PREPARE])dnl +])# _AC_INIT_PREPARE + + +# AU::AC_INIT([UNIQUE-FILE-IN-SOURCE-DIR]) +# ---------------------------------------- +# This macro is used only for Autoupdate. +AU_DEFUN([AC_INIT], +[m4_ifval([$2], [[AC_INIT($@)]], + [m4_ifval([$1], +[[AC_INIT] +AC_CONFIG_SRCDIR([$1])], [[AC_INIT]])])[]dnl +]) + + +# AC_PLAIN_SCRIPT +# --------------- +# Simulate AC_INIT, i.e., pretend this is the beginning of the `configure' +# generation. This is used by some tests, and let `autoconf' be used to +# generate other scripts than `configure'. +m4_define([AC_PLAIN_SCRIPT], +[AS_INIT + +# Forbidden tokens and exceptions. +m4_pattern_forbid([^_?A[CHUM]_]) +m4_pattern_forbid([_AC_]) +# Actually reserved by M4sh. +m4_pattern_allow([^AS_FLAGS$]) + +m4_divert_push([BODY])dnl +m4_wrap([m4_divert_pop([BODY])[]])dnl +]) + + + +# AC_INIT([PACKAGE, VERSION, [BUG-REPORT]) +# ---------------------------------------- +# Include the user macro files, prepare the diversions, and output the +# preamble of the `configure' script. +# Note that the order is important: first initialize, then set the +# AC_CONFIG_SRCDIR. +m4_define([AC_INIT], +[AC_PLAIN_SCRIPT +m4_ifval([$2], [_AC_INIT_PACKAGE($@)]) +m4_divert_text([BINSH], [@%:@! /bin/sh]) +_AC_INIT_DEFAULTS +_AC_INIT_PARSE_ARGS +_AC_INIT_SRCDIR +_AC_INIT_HELP +_AC_INIT_VERSION +_AC_INIT_CONFIG_LOG +_AC_INIT_PREPARE +_AC_INIT_NOTICE +_AC_INIT_COPYRIGHT +_AC_INIT_SHFUN +m4_ifval([$2], , [m4_ifval([$1], [AC_CONFIG_SRCDIR([$1])])])dnl +]) + + + + +# _AC_HELP_INTRO +# -------------- +# Put the generic descriptions of AC_ARG_ENABLE and AC_ARG_WITH into a separate +# paragraph to make it more readable. The help-text for those macros falls +# into the same list, making it simple to organize. +m4_define([_AC_HELP_INTRO], +[m4_divert_once([HELP_INTRO], [$1]) +m4_divert_once([HELP_DETAIL], [[ +Options recognized by this package (as ordered in configure.in)]])dnl +]) + + +# Utility macro to add text to the enable/with options list. +m4_define([AC_DIVERT_HELP], +[m4_divert_once([HELP_DETAIL], [[$1]]) +]) + + +# _AC_INIT_SHFUN +# -------------- +# FIXME: this should be invoked on demand by the first shell function to be +# stored. +m4_define([_AC_INIT_SHFUN], +[m4_ifdef([_OPT_SHFUN],[ +m4_divert_once([SHFUN_BEGIN], [ +## Begin shell-functions: +])dnl +m4_divert_once([SHFUN_END], [ +## End of shell-functions +])dnl +])])# _AC_INIT_SHFUN + + +## ----------------------------- ## +## Selecting optional features. ## +## ----------------------------- ## + + +# AC_ARG_ENABLE(FEATURE, HELP-STRING, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ------------------------------------------------------------------------ +AC_DEFUN([AC_ARG_ENABLE], +[m4_divert_once([HELP_INTRO], [[ +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes]]] +) +m4_divert_once([HELP_DETAIL], [$2])dnl +# Check whether --enable-$1 or --disable-$1 was given. +if test "[${enable_]m4_patsubst([$1], -, _)+set}" = set; then + enableval="[$enable_]m4_patsubst([$1], -, _)" + $3 +m4_ifvaln([$4], [else + $4])dnl +fi; dnl +])# AC_ARG_ENABLE + + +AU_DEFUN([AC_ENABLE], +[AC_ARG_ENABLE([$1], [ --enable-$1], [$2], [$3])]) + + +## ------------------------------ ## +## Working with optional software ## +## ------------------------------ ## + + + +# AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE, [ACTION-IF-FALSE]) +# -------------------------------------------------------------------- +AC_DEFUN([AC_ARG_WITH], +[m4_divert_once([HELP_INTRO], [[ +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)]] +) +m4_divert_once([HELP_DETAIL], [$2])dnl +# Check whether --with-$1 or --without-$1 was given. +if test "[${with_]m4_patsubst([$1], -, _)+set}" = set; then + withval="[$with_]m4_patsubst([$1], -, _)" + $3 +m4_ifvaln([$4], [else + $4])dnl +fi; dnl +])# AC_ARG_WITH + +AU_DEFUN([AC_WITH], +[AC_ARG_WITH([$1], [ --with-$1], [$2], [$3])]) + + + +## ----------------------------------------- ## +## Remembering variables for reconfiguring. ## +## ----------------------------------------- ## + + +# _AC_ARG_VAR_PRECIOUS(VARNAME) +# ----------------------------- +# Declare VARNAME is precious. +# +# We try to diagnose when precious variables have changed. To do this, +# make two early snapshots (after the option processing to take +# explicit variables into account) of those variables: one (ac_env_) +# which represents the current run, and a second (ac_cv_env_) which, +# at the first run, will be saved in the cache. As an exception to +# the cache mechanism, its loading will override these variables (non +# `ac_cv_env_' cache value are only set when unset). +# +# In subsequent runs, after having loaded the cache, compare +# ac_cv_env_foo against ac_env_foo. See _AC_ARG_VAR_VALIDATE. +m4_define([_AC_ARG_VAR_PRECIOUS], +[AC_SUBST([$1])dnl +m4_divert_once([PARSE_ARGS], +[ac_env_$1_set=${$1+set} +ac_env_$1_value=$$1 +ac_cv_env_$1_set=${$1+set} +ac_cv_env_$1_value=$$1])dnl +]) + + +# _AC_ARG_VAR_VALIDATE +# -------------------- +# The precious variables are saved twice at the beginning of +# configure. E.g., PRECIOUS, is saved as `ac_env_PRECIOUS_SET' and +# `ac_env_PRECIOUS_VALUE' on the one hand and `ac_cv_env_PRECIOUS_SET' +# and `ac_cv_env_PRECIOUS_VALUE' on the other hand. +# +# Now the cache has just been load, so `ac_cv_env_' represents the +# content of the cached values, while `ac_env_' represents that of the +# current values. +# +# So we check that `ac_env_' and `ac_cv_env_' are consistent. If +# they aren't, die. +m4_define([_AC_ARG_VAR_VALIDATE], +[# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([[a-zA-Z_0-9]]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case "$ac_old_set,$ac_new_set" in + set,) + AS_MESSAGE([error: `$ac_var' was set to `$ac_old_val' in the previous run], 2) + ac_cache_corrupted=: ;; + ,set) + AS_MESSAGE([error: `$ac_var' was not set in the previous run], 2) + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + AS_MESSAGE([error: `$ac_var' has changed since the previous run:], 2) + AS_MESSAGE([ former value: $ac_old_val], 2) + AS_MESSAGE([ current value: $ac_new_val], 2) + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case "$ac_new_val" in +dnl If you change this globbing pattern, test it on an old shell -- +dnl it's sensitive. Putting any kind of quote in it causes syntax errors. +[ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)] + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if "$ac_cache_corrupted"; then + AS_MESSAGE([error: changes in the environment can compromise the build], 2) + AS_ERROR([run `make distclean' and/or `rm $cache_file' and start over]) +fi +])# _AC_ARG_VAR_VALIDATE + + +# AC_ARG_VAR(VARNAME, DOCUMENTATION) +# ---------------------------------- +# Register VARNAME as a precious variable, and document it in +# `configure --help' (but only once). +AC_DEFUN([AC_ARG_VAR], +[m4_divert_once([HELP_VAR], [[ +Some influential environment variables:]])dnl +m4_divert_once([HELP_VAR_END], [[ +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations.]])dnl +m4_expand_once([m4_divert_once([HELP_VAR], + [AC_HELP_STRING([$1], [$2], [ ])])], + [$0($1)])dnl +_AC_ARG_VAR_PRECIOUS([$1])dnl +])# AC_ARG_VAR + + + + + +## ---------------------------- ## +## Transforming program names. ## +## ---------------------------- ## + + +# AC_ARG_PROGRAM +# -------------- +# This macro is expanded only once, to avoid that `foo' ends up being +# installed as `ggfoo'. +AC_DEFUN_ONCE([AC_ARG_PROGRAM], +[dnl Document the options. +m4_divert_push([HELP_BEGIN])dnl + +Program names: + --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 +m4_divert_pop([HELP_BEGIN])dnl +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" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +[s/[\\$]/&&/g;s/;s,x,x,$//] +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed +])# AC_ARG_PROGRAM + + + + + +## ------------------------- ## +## Finding auxiliary files. ## +## ------------------------- ## + + +# AC_CONFIG_AUX_DIR(DIR) +# ---------------------- +# Find install-sh, config.sub, config.guess, and Cygnus configure +# in directory DIR. These are auxiliary files used in configuration. +# DIR can be either absolute or relative to $srcdir. +AC_DEFUN([AC_CONFIG_AUX_DIR], +[AC_CONFIG_AUX_DIRS($1 $srcdir/$1)]) + + +# AC_CONFIG_AUX_DIR_DEFAULT +# ------------------------- +# The default is `$srcdir' or `$srcdir/..' or `$srcdir/../..'. +# There's no need to call this macro explicitly; just AC_REQUIRE it. +AC_DEFUN([AC_CONFIG_AUX_DIR_DEFAULT], +[AC_CONFIG_AUX_DIRS($srcdir $srcdir/.. $srcdir/../..)]) + + +# AC_CONFIG_AUX_DIRS(DIR ...) +# --------------------------- +# Internal subroutine. +# Search for the configuration auxiliary files in directory list $1. +# We look only for install-sh, so users of AC_PROG_INSTALL +# do not automatically need to distribute the other auxiliary files. +AC_DEFUN([AC_CONFIG_AUX_DIRS], +[ac_aux_dir= +for ac_dir in $1; 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 + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + AC_MSG_ERROR([cannot find install-sh or install.sh in $1]) +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. +AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +])# AC_CONFIG_AUX_DIRS + + + + +## ----------------------------------- ## +## Getting the canonical system type. ## +## ----------------------------------- ## + +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD +# +# The rules are: +# 1. Build defaults to the current platform, as determined by config.guess. +# 2. Host defaults to build. +# 3. Target defaults to host. + + +# _AC_CANONICAL_SPLIT(THING) +# -------------------------- +# Generate the variables THING, THING_{alias cpu vendor os}. +m4_define([_AC_CANONICAL_SPLIT], +[AC_SUBST([$1], [$ac_cv_$1])dnl +dnl FIXME: AC_SUBST([$1_alias], [$ac_cv_$1_alias])dnl +AC_SUBST([$1_cpu], + [`echo "$ac_cv_$1" | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\1/'`])dnl +AC_SUBST([$1_vendor], + [`echo "$ac_cv_$1" | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\2/'`])dnl +AC_SUBST([$1_os], + [`echo "$ac_cv_$1" | sed 's/^\([[^-]]*\)-\([[^-]]*\)-\(.*\)$/\3/'`])dnl +])# _AC_CANONICAL_SPLIT + + +# AC_CANONICAL_BUILD +# ------------------ +AC_DEFUN_ONCE([AC_CANONICAL_BUILD], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +m4_divert_text([HELP_CANON], +[[ +System types: + --build=BUILD configure for building on BUILD [guessed]]])dnl +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + AC_MSG_ERROR([cannot run $ac_config_sub]) + +AC_CACHE_CHECK([build system type], [ac_cv_build], +[ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + AC_MSG_ERROR([cannot guess build type; you must specify one]) +ac_cv_build=`$ac_config_sub "$ac_cv_build_alias"` || + AC_MSG_ERROR([$ac_config_sub $ac_cv_build_alias failed.]) +]) +_AC_CANONICAL_SPLIT(build) +])# AC_CANONICAL_BUILD + + +# AC_CANONICAL_HOST +# ----------------- +AC_DEFUN_ONCE([AC_CANONICAL_HOST], +[AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_divert_text([HELP_CANON], +[[ --host=HOST build programs to run on HOST [BUILD]]])dnl +AC_CACHE_CHECK([host system type], [ac_cv_host], +[ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub "$ac_cv_host_alias"` || + AC_MSG_ERROR([$ac_config_sub $ac_cv_host_alias failed]) +]) +_AC_CANONICAL_SPLIT([host]) +])# AC_CANONICAL_HOST + + +# AC_CANONICAL_TARGET +# ------------------- +AC_DEFUN_ONCE([AC_CANONICAL_TARGET], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_BEFORE([$0], [AC_ARG_PROGRAM])dnl +m4_divert_text([HELP_CANON], +[[ --target=TARGET configure for building compilers for TARGET [HOST]]])dnl +AC_CACHE_CHECK([target system type], [ac_cv_target], +[dnl Set target_alias. +ac_cv_target_alias=$target_alias +test "x$ac_cv_target_alias" = "x" && + ac_cv_target_alias=$ac_cv_host_alias +ac_cv_target=`$ac_config_sub "$ac_cv_target_alias"` || + AC_MSG_ERROR([$ac_config_sub $ac_cv_target_alias failed]) +]) +_AC_CANONICAL_SPLIT([target]) + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}-[]dnl +])# AC_CANONICAL_TARGET + + +AU_ALIAS([AC_CANONICAL_SYSTEM], [AC_CANONICAL_TARGET]) + + +# AU::AC_VALIDATE_CACHED_SYSTEM_TUPLE([CMD]) +# ------------------------------------------ +# If the cache file is inconsistent with the current host, +# target and build system types, execute CMD or print a default +# error message. Now handled via _AC_ARG_VAR_PRECIOUS. +AU_DEFUN([AC_VALIDATE_CACHED_SYSTEM_TUPLE], []) + + +## ---------------------- ## +## Caching test results. ## +## ---------------------- ## + + +# AC_SITE_LOAD +# ------------ +# Look for site or system specific initialization scripts. +m4_define([AC_SITE_LOAD], +[# 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 + AC_MSG_NOTICE([loading site script $ac_site_file]) + cat "$ac_site_file" >&AS_MESSAGE_LOG_FD + . "$ac_site_file" + fi +done +]) + + +# AC_CACHE_LOAD +# ------------- +m4_define([AC_CACHE_LOAD], +[if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + AC_MSG_NOTICE([loading cache $cache_file]) + case $cache_file in + [[\\/]]* | ?:[[\\/]]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + AC_MSG_NOTICE([creating cache $cache_file]) + >$cache_file +fi +])# AC_CACHE_LOAD + + +# _AC_CACHE_DUMP +# -------------- +# Dump the cache to stdout. It can be in a pipe (this is a requirement). +m4_define([_AC_CACHE_DUMP], +[# 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 \ + ["s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"] + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + ["s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"] + ;; + esac; +}dnl +])# _AC_CACHE_DUMP + + +# AC_CACHE_SAVE +# ------------- +# Save the cache. +# Allow a site initialization script to override cache values. +m4_define([AC_CACHE_SAVE], +[cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +_AC_CACHE_DUMP() | + sed [' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end'] >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache[]dnl +])# AC_CACHE_SAVE + + +# AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT) +# ------------------------------------------ +# The name of shell var CACHE-ID must contain `_cv_' in order to get saved. +# Should be dnl'ed. Try to catch common mistakes. +m4_define([AC_CACHE_VAL], +[m4_if(m4_regexp([$2], [AC_DEFINE]), [-1], [], + [AC_DIAGNOSE(syntax, +[$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl +[where no actions should be taken])])dnl +AS_VAR_SET_IF([$1], + [echo $ECHO_N "(cached) $ECHO_C" >&AS_MESSAGE_FD], + [$2])]) + + +# AC_CACHE_CHECK(MESSAGE, CACHE-ID, COMMANDS) +# ------------------------------------------- +# Do not call this macro with a dnl right behind. +m4_define([AC_CACHE_CHECK], +[AC_MSG_CHECKING([$1]) +AC_CACHE_VAL([$2], [$3])dnl +AC_MSG_RESULT_UNQUOTED([AS_VAR_GET([$2])])]) + + + +## ---------------------- ## +## Defining CPP symbols. ## +## ---------------------- ## + + +# AC_DEFINE_TRACE_LITERAL(LITERAL-CPP-SYMBOL) +# ------------------------------------------- +# This macro is useless, it is used only with --trace to collect the +# list of *literals* CPP values passed to AC_DEFINE/AC_DEFINE_UNQUOTED. +m4_define([AC_DEFINE_TRACE_LITERAL]) + + +# AC_DEFINE_TRACE(CPP-SYMBOL) +# --------------------------- +# This macro is a wrapper around AC_DEFINE_TRACE_LITERAL which filters +# out non literal symbols. +m4_define([AC_DEFINE_TRACE], +[AS_LITERAL_IF([$1], [AC_DEFINE_TRACE_LITERAL([$1])])]) + + +# AC_DEFINE(VARIABLE, [VALUE], [DESCRIPTION]) +# ------------------------------------------- +# Set VARIABLE to VALUE, verbatim, or 1. Remember the value +# and if VARIABLE is affected the same VALUE, do nothing, else +# die. The third argument is used by autoheader. +m4_define([AC_DEFINE], +[AC_DEFINE_TRACE([$1])dnl +m4_ifval([$3], [_AH_TEMPLATE_OLD([$1], [$3])])dnl +cat >>confdefs.h <<\EOF +[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1) +EOF +]) + + +# AC_DEFINE_UNQUOTED(VARIABLE, [VALUE], [DESCRIPTION]) +# ---------------------------------------------------- +# Similar, but perform shell substitutions $ ` \ once on VALUE. +m4_define([AC_DEFINE_UNQUOTED], +[AC_DEFINE_TRACE([$1])dnl +m4_ifval([$3], [_AH_TEMPLATE_OLD([$1], [$3])])dnl +cat >>confdefs.h <<EOF +[@%:@define] $1 m4_if($#, 2, [$2], $#, 3, [$2], 1) +EOF +]) + + + +## -------------------------- ## +## Setting output variables. ## +## -------------------------- ## + + +# _AC_SUBST(VARIABLE, PROGRAM) +# ---------------------------- +# If VARIABLE has not already been AC_SUBST'ed, append the sed PROGRAM +# to `_AC_SUBST_SED_PROGRAM'. +m4_define([_AC_SUBST], +[m4_expand_once([m4_append([_AC_SUBST_SED_PROGRAM], +[$2 +])])dnl +]) + +# Initialize. +m4_define([_AC_SUBST_SED_PROGRAM]) + + +# AC_SUBST(VARIABLE, [VALUE]) +# --------------------------- +# Create an output variable from a shell VARIABLE. If VALUE is given +# assign it to VARIABLE. Use `""' is you want to set VARIABLE to an +# empty value, not an empty second argument. +# +# Beware that if you change this macro, you also have to change the +# sed script at the top of _AC_OUTPUT_FILES. +m4_define([AC_SUBST], +[m4_ifvaln([$2], [$1=$2])[]dnl +_AC_SUBST([$1], [s,@$1@,[$]$1,;t t])dnl +])# AC_SUBST + + +# AC_SUBST_FILE(VARIABLE) +# ----------------------- +# Read the comments of the preceding macro. +m4_define([AC_SUBST_FILE], +[_AC_SUBST([$1], [/@$1@/r [$]$1 +s,@$1@,,;t t])]) + + + +## --------------------------------------- ## +## Printing messages at autoconf runtime. ## +## --------------------------------------- ## + +# In fact, I think we should promote the use of m4_warn and m4_fatal +# directly. This will also avoid to some people to get it wrong +# between AC_FATAL and AC_MSG_ERROR. + + +# AC_DIAGNOSE(CATEGORY, MESSAGE) +# AC_FATAL(MESSAGE, [EXIT-STATUS]) +# -------------------------------- +m4_copy([m4_warn], [AC_DIAGNOSE]) +m4_copy([m4_fatal], [AC_FATAL]) + + +# AC_WARNING(MESSAGE) +# ------------------- +# Report a MESSAGE to the user of autoconf if `-W' or `-W all' was +# specified. +m4_define([AC_WARNING], +[AC_DIAGNOSE([syntax], [$1])]) + + + + +## ---------------------------------------- ## +## Printing messages at configure runtime. ## +## ---------------------------------------- ## + + +# _AC_ECHO_N(STRING, [FD = AS_MESSAGE_FD]) +# ------------------------------------ +# Same as _AS_ECHO, but echo doesn't return to a new line. +m4_define([_AC_ECHO_N], +[echo $ECHO_N "_AS_QUOTE([$1])$ECHO_C" >&m4_default([$2], + [AS_MESSAGE_FD])]) + + +# AC_MSG_CHECKING(FEATURE) +# ------------------------ +m4_define([AC_MSG_CHECKING], +[_AS_ECHO([$as_me:__oline__: checking $1], AS_MESSAGE_LOG_FD) +_AC_ECHO_N([checking $1... ])[]dnl +]) + + +# AC_MSG_RESULT(RESULT) +# --------------------- +m4_define([AC_MSG_RESULT], +[_AS_ECHO([$as_me:__oline__: result: $1], AS_MESSAGE_LOG_FD) +_AS_ECHO([${ECHO_T}$1])[]dnl +]) + + +# AC_MSG_RESULT_UNQUOTED(RESULT) +# ------------------------------ +# Likewise, but perform $ ` \ shell substitutions. +m4_define([AC_MSG_RESULT_UNQUOTED], +[_AS_ECHO_UNQUOTED([$as_me:__oline__: result: $1], AS_MESSAGE_LOG_FD) +_AS_ECHO_UNQUOTED([${ECHO_T}$1])[]dnl +]) + + +# AC_MSG_WARN(PROBLEM) +# AC_MSG_NOTICE(STRING) +# AC_MSG_ERROR(ERROR, [EXIT-STATUS = 1]) +# -------------------------------------- +m4_copy([AS_WARN], [AC_MSG_WARN]) +m4_copy([AS_MESSAGE], [AC_MSG_NOTICE]) +m4_copy([AS_ERROR], [AC_MSG_ERROR]) + + +# AU::AC_CHECKING(FEATURE) +# ------------------------ +AU_DEFUN([AC_CHECKING], +[AS_MESSAGE([checking $1...])]) + + +# AU::AC_VERBOSE(STRING) +# ---------------------- +AU_ALIAS([AC_VERBOSE], [AC_MSG_RESULT]) + + + + + + +## ---------------------------- ## +## Compiler-running mechanics. ## +## ---------------------------- ## + + +# _AC_RUN_LOG(COMMAND, LOG-COMMANDS) +# ---------------------------------- +# Eval COMMAND, save the exit status in ac_status, and log it. +AC_DEFUN([_AC_RUN_LOG], +[{ ($2) >&AS_MESSAGE_LOG_FD + ($1) 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit "$ac_status"); }]) + + +# _AC_RUN_LOG_STDERR(COMMAND, LOG-COMMANDS) +# ----------------------------------------- +# Eval COMMAND, save its stderr into conftest.err, save the exit status +# in ac_status, and log it. +# Note that when tracing, most shells will leave the traces in stderr +AC_DEFUN([_AC_RUN_LOG_STDERR], +[AC_REQUIRE([AC_PROG_EGREP])dnl +m4_ifdef([_OPT_SHFUN],dnl +[m4_divert_once([SHFUN_OURS], [# arg1=lineno, arg2=command, arg3=message +eval_stderr() { + as_eval="$as_me:[$]1"; shift + (eval "[$]2") >&AS_MESSAGE_LOG_FD + (eval "[$]1") 2>conftest.er1 + ac_status=$? + $EGREP -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_eval: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit "$ac_status"); +}])dnl +{ eval_stderr __oline__ '$1' '$2'; }],dnl +[{ ($2) >&AS_MESSAGE_LOG_FD + ($1) 2>conftest.er1 + ac_status=$? + $EGREP -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit "$ac_status"); }])]) + + +# _AC_EVAL(COMMAND) +# ----------------- +# Eval COMMAND, save the exit status in ac_status, and log it. +AC_DEFUN([_AC_EVAL], +[m4_ifdef([_OPT_SHFUN],dnl +[m4_divert_once([SHFUN_OURS], [# arg1=lineno, arg2=command, etc +eval_command() { + as_eval="$as_me:[$]1"; shift + (eval echo "$as_eval: \"[$]* >&AS_MESSAGE_LOG_FD\"") >&AS_MESSAGE_LOG_FD + (eval "[$]@" </dev/null >&AS_MESSAGE_LOG_FD) 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_eval: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit "$ac_status"); +}])dnl +{ eval_command __oline__ "$1"; }],dnl +[_AC_RUN_LOG([eval $1], + [eval echo "$as_me:__oline__: \"$1\""])])]) + + +# _AC_EVAL_STDERR(COMMAND) +# ------------------------ +# Eval COMMAND, save its stderr into conftest.err, save the exit status +# in ac_status, and log it. +# Note that when tracing, most shells will leave the traces in stderr +AC_DEFUN([_AC_EVAL_STDERR], +[_AC_RUN_LOG_STDERR([eval $1], + [eval echo "$as_me:__oline__: \"$1\""])]) + + +# AC_TRY_EVAL(VARIABLE) +# --------------------- +# The purpose of this macro is to "configure:123: command line" +# written into config.log for every test run. +AC_DEFUN([AC_TRY_EVAL], +[_AC_EVAL([$$1])]) + + +# AC_TRY_COMMAND(COMMAND) +# ----------------------- +AC_DEFUN([AC_TRY_COMMAND], +[{ ac_try='$1' + _AC_EVAL([$ac_try]); }]) + + +# AC_RUN_LOG(COMMAND) +# ------------------- +AC_DEFUN([AC_RUN_LOG], +[_AC_RUN_LOG([$1], + [echo "$as_me:__oline__: AS_ESCAPE([$1])"])]) + + +## ------------------ ## +## Default includes. ## +## ------------------ ## + +# Always use the same set of default headers for all the generic +# macros. It is easier to document, to extend, and to understand than +# having specific defaults for each macro. + +# _AC_INCLUDES_DEFAULT_REQUIREMENTS +# --------------------------------- +# Required when AC_INCLUDES_DEFAULT uses its default branch. +AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS], +[m4_divert_text([DEFAULTS], +[# Factoring default headers for most tests. +dnl If ever you change this variable, please keep autoconf.texi in sync. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" +])dnl +AC_REQUIRE([AC_HEADER_STDC])dnl +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +AC_CHECK_HEADERS([sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h], + [], [], $ac_includes_default) +])# _AC_INCLUDES_DEFAULT_REQUIREMENTS + + +# AC_INCLUDES_DEFAULT([INCLUDES]) +# ------------------------------- +# If INCLUDES is empty, expand in default includes, otherwise in +# INCLUDES. +# In most cases INCLUDES is not double quoted as it should, and if +# for instance INCLUDES = `#include <stdio.h>' then unless we force +# a newline, the hash will swallow the closing paren etc. etc. +# The usual failure. +# Take no risk: for the newline. +AC_DEFUN([AC_INCLUDES_DEFAULT], +[m4_ifval([$1], [$1 +], + [AC_REQUIRE([_AC_INCLUDES_DEFAULT_REQUIREMENTS])dnl +$ac_includes_default])]) + + + + +## ----------------------- ## +## Checking for programs. ## +## ----------------------- ## + + +# AC_SHELL_PATH_WALK([PATH = $PATH], BODY) +# ---------------------------------------- +# Walk through PATH running BODY for each `ac_dir'. +# +# `$ac_dummy' forces splitting on constant user-supplied paths. +# POSIX.2 word splitting is done only on the output of word +# expansions, not every word. This closes a longstanding sh security +# hole. +m4_define([AC_SHELL_PATH_WALK], +[ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="m4_default([$1], [$PATH])" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $2 +done +]) + + +# AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, +# [VALUE-IF-FOUND], [VALUE-IF-NOT-FOUND], +# [PATH], [REJECT]) +# ----------------------------------------------------- +AC_DEFUN([AC_CHECK_PROG], +[# 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_prog_$1, +[if test -n "$$1"; then + ac_cv_prog_$1="$$1" # Let the user override the test. +else +m4_ifvaln([$6], +[ ac_prog_rejected=no])dnl + AC_SHELL_PATH_WALK([$5], +[AS_EXECUTABLE_P("$ac_dir/$ac_word") || continue +m4_ifvaln([$6], +[if test "$ac_dir/$ac_word" = "$6"; then + ac_prog_rejected=yes + continue +fi])dnl +ac_cv_prog_$1="$3" +echo "$as_me:__oline__: found $ac_dir/$ac_word" >&AS_MESSAGE_LOG_FD +break]) +m4_ifvaln([$6], +[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_$1 + shift + if test $[@%:@] != 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 $1 to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$[@]"} + shift + ac_cv_prog_$1="$[@]" +m4_if([$2], [$4], +[ else + # Default is a loser. + AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl +m4_default([$5], [\$PATH])]) +])dnl + fi +fi])dnl +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_CHECK_PROGS will keep looking. +m4_ifvaln([$4], +[ test -z "$ac_cv_prog_$1" && ac_cv_prog_$1="$4"])dnl +fi])dnl +$1=$ac_cv_prog_$1 +if test -n "$$1"; then + AC_MSG_RESULT([$$1]) +else + AC_MSG_RESULT([no]) +fi +AC_SUBST($1)dnl +])# AC_CHECK_PROG + + +# AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], +# [PATH]) +# ------------------------------------------------------------------ +AC_DEFUN([AC_CHECK_PROGS], +[for ac_prog in $2 +do + AC_CHECK_PROG([$1], [$ac_prog], [$ac_prog], , [$4]) + test -n "$$1" && break +done +m4_ifvaln([$3], [test -n "$$1" || $1="$3"])]) + + +# AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH]) +# ----------------------------------------------------------------------- +AC_DEFUN([AC_PATH_PROG], +[# 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. + ;; + *) + AC_SHELL_PATH_WALK([$4], +[if AS_EXECUTABLE_P("$ac_dir/$ac_word"); then + ac_cv_path_$1="$ac_dir/$ac_word" + echo "$as_me:__oline__: found $ac_dir/$ac_word" >&AS_MESSAGE_LOG_FD + break +fi]) +dnl If no 3rd arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +m4_ifvaln([$3], +[ test -z "$ac_cv_path_$1" && ac_cv_path_$1="$3"])dnl + ;; +esac])dnl +AC_SUBST([$1], [$ac_cv_path_$1]) +if test -n "$$1"; then + AC_MSG_RESULT([$$1]) +else + AC_MSG_RESULT([no]) +fi +])# AC_PATH_PROG + + +# AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], +# [PATH]) +# ----------------------------------------------------------------- +AC_DEFUN([AC_PATH_PROGS], +[for ac_prog in $2 +do + AC_PATH_PROG([$1], [$ac_prog], , [$4]) + test -n "$$1" && break +done +m4_ifvaln([$3], [test -n "$$1" || $1="$3"])dnl +]) + + + + +## -------------------- ## +## Checking for tools. ## +## -------------------- ## + + +# AC_CHECK_TOOL_PREFIX +# -------------------- +AU_DEFUN([AC_CHECK_TOOL_PREFIX]) + + +# AC_PATH_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH]) +# ----------------------------------------------------------------------- +# (Use different variables $1 and ac_pt_$1 so that cache vars don't conflict.) +AC_DEFUN([AC_PATH_TOOL], +[if test -n "$ac_tool_prefix"; then + AC_PATH_PROG([$1], [${ac_tool_prefix}$2], , [$4]) +fi +if test -z "$ac_cv_path_$1"; then + ac_pt_$1=$$1 + AC_PATH_PROG([ac_pt_$1], [$2], [$3], [$4]) + $1=$ac_pt_$1 +else + $1="$ac_cv_path_$1" +fi +])# AC_PATH_TOOL + + +# AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], [PATH]) +# ------------------------------------------------------------------------ +# (Use different variables $1 and ac_ct_$1 so that cache vars don't conflict.) +AC_DEFUN([AC_CHECK_TOOL], +[if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG([$1], [${ac_tool_prefix}$2], [${ac_tool_prefix}$2], , [$4]) +fi +if test -z "$ac_cv_prog_$1"; then + ac_ct_$1=$$1 + AC_CHECK_PROG([ac_ct_$1], [$2], [$2], [$3], [$4]) + $1=$ac_ct_$1 +else + $1="$ac_cv_prog_$1" +fi +])# AC_CHECK_TOOL + + +# AC_CHECK_TOOLS(VARIABLE, PROGS-TO-CHECK-FOR, [VALUE-IF-NOT-FOUND], +# [PATH]) +# ------------------------------------------------------------------ +# Check for each tool in PROGS-TO-CHECK-FOR with the cross prefix. If +# none can be found with a cross prefix, then use the first one that +# was found without the cross prefix. +AC_DEFUN([AC_CHECK_TOOLS], +[if test -n "$ac_tool_prefix"; then + for ac_prog in $2 + do + AC_CHECK_PROG([$1], + [$ac_tool_prefix$ac_prog], [$ac_tool_prefix$ac_prog],, + [$4]) + test -n "$$1" && break + done +fi +if test -z "$$1"; then + ac_ct_$1=$$1 + AC_CHECK_PROGS([ac_ct_$1], [$2], [$3], [$4]) + $1=$ac_ct_$1 +fi +])# AC_CHECK_TOOLS + + +# AC_PREFIX_PROGRAM(PROGRAM) +# -------------------------- +# Guess the value for the `prefix' variable by looking for +# the argument program along PATH and taking its parent. +# Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc, +# set `prefix' to /usr/local/gnu. +# This comes too late to find a site file based on the prefix, +# and it might use a cached value for the path. +# No big loss, I think, since most configures don't use this macro anyway. +AC_DEFUN([AC_PREFIX_PROGRAM], +[dnl Get an upper case version of $[1]. +m4_pushdef([AC_Prog], m4_toupper([$1]))dnl +if test "x$prefix" = xNONE; then +dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle. + echo $ECHO_N "checking for prefix by $ECHO_C" >&AS_MESSAGE_FD + AC_PATH_PROG(m4_quote(AC_Prog), [$1]) + if test -n "$ac_cv_path_[]AC_Prog"; then + prefix=`AS_DIRNAME(["$ac_cv_path_[]AC_Prog"])` + fi +fi +m4_popdef([AC_Prog])dnl +])# AC_PREFIX_PROGRAM + + + + +## ------------------------ ## +## Checking for libraries. ## +## ------------------------ ## + + +# AC_TRY_LINK_FUNC(FUNC, ACTION-IF-FOUND, ACTION-IF-NOT-FOUND) +# ------------------------------------------------------------ +# Try to link a program that calls FUNC, handling GCC builtins. If +# the link succeeds, execute ACTION-IF-FOUND; otherwise, execute +# ACTION-IF-NOT-FOUND. +AC_DEFUN([AC_TRY_LINK_FUNC], +[AC_LINK_IFELSE([AC_LANG_CALL([], [$1])], [$2], [$3])]) + + +# AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [OTHER-LIBRARIES]) +# -------------------------------------------------------- +# Search for a library defining FUNC, if it's not already available. +AC_DEFUN([AC_SEARCH_LIBS], +[AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1], +[ac_func_search_save_LIBS=$LIBS +ac_cv_search_$1=no +AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"]) +if test "$ac_cv_search_$1" = no; then + for ac_lib in $2; do + LIBS="-l$ac_lib $5 $ac_func_search_save_LIBS" + AC_TRY_LINK_FUNC([$1], + [ac_cv_search_$1="-l$ac_lib" +break]) + done +fi +LIBS=$ac_func_search_save_LIBS]) +AS_IF([test "$ac_cv_search_$1" != no], + [test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS" + $3], + [$4])dnl +]) + + + +# AC_CHECK_LIB(LIBRARY, FUNCTION, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [OTHER-LIBRARIES]) +# ------------------------------------------------------ +# +# Use a cache variable name containing both the library and function name, +# because the test really is for library $1 defining function $2, not +# just for library $1. Separate tests with the same $1 and different $2s +# may have different results. +# +# Note that using directly AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2]) +# is asking for troubles, since AC_CHECK_LIB($lib, fun) would give +# ac_cv_lib_$lib_fun, which is definitely not what was meant. Hence +# the AS_LITERAL_IF indirection. +# +# FIXME: This macro is extremely suspicious. It DEFINEs unconditionally, +# whatever the FUNCTION, in addition to not being a *S macro. Note +# that the cache does depend upon the function we are looking for. +# +# It is on purpose we used `ac_check_lib_save_LIBS' and not just +# `ac_save_LIBS': there are many macros which don't want to see `LIBS' +# changed but still want to use AC_CHECK_LIB, so they save `LIBS'. +# And ``ac_save_LIBS' is too tempting a name, so let's leave them some +# freedom. +AC_DEFUN([AC_CHECK_LIB], +[m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl +AS_LITERAL_IF([$1], + [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])], + [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1''_$2])])dnl +AC_CACHE_CHECK([for $2 in -l$1], ac_Lib, +[ac_check_lib_save_LIBS=$LIBS +LIBS="-l$1 $5 $LIBS" +AC_TRY_LINK_FUNC([$2], + [AS_VAR_SET(ac_Lib, yes)], + [AS_VAR_SET(ac_Lib, no)]) +LIBS=$ac_check_lib_save_LIBS]) +AS_IF([test "AS_VAR_GET(ac_Lib)" = yes], + [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIB$1)) + LIBS="-l$1 $LIBS" +])], + [$4])dnl +AS_VAR_POPDEF([ac_Lib])dnl +])# AC_CHECK_LIB + + +# AH_CHECK_LIB(LIBNAME) +# --------------------- +m4_define([AH_CHECK_LIB], +[AH_TEMPLATE(AS_TR_CPP(HAVE_LIB$1), + [Define if you have the `]$1[' library (-l]$1[).])]) + + +# AC_HAVE_LIBRARY(LIBRARY, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [OTHER-LIBRARIES]) +# --------------------------------------------------------- +# +# This macro is equivalent to calling `AC_CHECK_LIB' with a FUNCTION +# argument of `main'. In addition, LIBRARY can be written as any of +# `foo', `-lfoo', or `libfoo.a'. In all of those cases, the compiler +# is passed `-lfoo'. However, LIBRARY cannot be a shell variable; +# it must be a literal name. +AU_DEFUN([AC_HAVE_LIBRARY], +[m4_pushdef([AC_Lib_Name], + m4_patsubst(m4_patsubst([[$1]], + [lib\([^\.]*\)\.a], [\1]), + [-l], []))dnl +AC_CHECK_LIB(AC_Lib_Name, main, [$2], [$3], [$4])dnl +ac_cv_lib_[]AC_Lib_Name()=ac_cv_lib_[]AC_Lib_Name()_main +m4_popdef([AC_Lib_Name])dnl +]) + + + +## ------------------------ ## +## Examining declarations. ## +## ------------------------ ## + + + +# _AC_PREPROC_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ---------------------------------------------------------------- +# Try to preprocess PROGRAM. +# +# This macro can be used during the selection of a preprocessor. +# Run cpp and set ac_cpp_err to "yes" for an error, to +# "$ac_(c,cxx)_preproc_warn_flag" if there are warnings or to "" if +# neither warnings nor errors have been detected. eval is necessary +# to expand ac_cpp. +AC_DEFUN([_AC_PREPROC_IFELSE], +[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl +if _AC_EVAL_STDERR([$ac_cpp "conftest.$ac_ext"]) >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + m4_default([$2], :) +else + echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD + cat "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD + $3 +fi +rm -f conftest.err m4_ifval([$1], ["conftest.$ac_ext"])[]dnl +])# _AC_PREPROC_IFELSE + + +# AC_PREPROC_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------- +# Try to preprocess PROGRAM. Requires that the preprocessor for the +# current language was checked for, hence do not use this macro in macros +# looking for a preprocessor. +AC_DEFUN([AC_PREPROC_IFELSE], +[AC_LANG_PREPROC_REQUIRE()dnl +_AC_PREPROC_IFELSE($@)]) + + +# AC_TRY_CPP(INCLUDES, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------- +# AC_TRY_CPP is used to check whether particular header files exist. +# (But it actually tests whether INCLUDES produces no CPP errors.) +# +# INCLUDES are not defaulted and are double quoted. +AC_DEFUN([AC_TRY_CPP], +[AC_PREPROC_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3])]) + + +# AC_EGREP_CPP(PATTERN, PROGRAM, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------ +# Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must +# come early, it is not included in AC_BEFORE checks. +AC_DEFUN([AC_EGREP_CPP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_LANG_PREPROC_REQUIRE()dnl +AC_LANG_CONFTEST([AC_LANG_SOURCE([[$2]])]) +dnl eval is necessary to expand ac_cpp. +dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. +if (eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | +dnl Quote $1 to prevent m4 from eating character classes + $EGREP "[$1]" >/dev/null 2>&1; then + m4_default([$3], :) +m4_ifvaln([$4], [else + $4])dnl +fi +rm -rf conftest* +])# AC_EGREP_CPP + + +# AC_EGREP_HEADER(PATTERN, HEADER-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------- +AC_DEFUN([AC_EGREP_HEADER], +[AC_EGREP_CPP([$1], +[#include <$2> +], [$3], [$4])]) + + + + +## ------------------ ## +## Examining syntax. ## +## ------------------ ## + + +# _AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# --------------------------------------------------------------------- +# Try to compile PROGRAM. +# This macro can be used during the selection of a compiler. +m4_define([_AC_COMPILE_IFELSE], +[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl +rm -f "conftest.$ac_objext" +AS_IF([AC_TRY_EVAL(ac_compile) && + AC_TRY_COMMAND([test -s "conftest.$ac_objext"])], + [$2], + [echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD +cat "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD +m4_ifvaln([$3],[$3])dnl])dnl +rm -f "conftest.$ac_objext" m4_ifval([$1], ["conftest.$ac_ext"])[]dnl +])# _AC_COMPILE_IFELSE + + +# AC_COMPILE_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# -------------------------------------------------------------------- +# Try to compile PROGRAM. Requires that the compiler for the current +# language was checked for, hence do not use this macro in macros looking +# for a compiler. +AC_DEFUN([AC_COMPILE_IFELSE], +[AC_LANG_COMPILER_REQUIRE()dnl +_AC_COMPILE_IFELSE($@)]) + + +# AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# -------------------------------------------------------- +AC_DEFUN([AC_TRY_COMPILE], +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])]) + + + +## --------------------- ## +## Examining libraries. ## +## --------------------- ## + + +# _AC_LINK_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------------ +# Try to link PROGRAM. +# This macro can be used during the selection of a compiler. +m4_define([_AC_LINK_IFELSE], +[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl +rm -f "conftest.$ac_objext" "conftest$ac_exeext" +AS_IF([AC_TRY_EVAL(ac_link) && + AC_TRY_COMMAND([test -s "conftest$ac_exeext"])], + [$2], + [echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD +cat "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD +m4_ifvaln([$3], [$3])dnl])[]dnl +rm -f "conftest.$ac_objext" "conftest$ac_exeext" m4_ifval([$1], ["conftest.$ac_ext"])[]dnl +])# _AC_LINK_IFELSE + + +# AC_LINK_IFELSE(PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------------------- +# Try to link PROGRAM. Requires that the compiler for the current +# language was checked for, hence do not use this macro in macros looking +# for a compiler. +AC_DEFUN([AC_LINK_IFELSE], +[AC_LANG_COMPILER_REQUIRE()dnl +_AC_LINK_IFELSE($@)]) + + +# AC_TRY_LINK(INCLUDES, FUNCTION-BODY, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------- +# Should the INCLUDES be defaulted here? +# Contrarily to AC_LINK_IFELSE, this macro double quote its first two args. +# FIXME: WARNING: The code to compile was different in the case of +# Fortran between AC_TRY_COMPILE and AC_TRY_LINK, though they should +# equivalent as far as I can tell from the semantics and the docs. In +# the former, $[2] is used as is, in the latter, it is `call' ed. +# Remove these FIXME: once truth established. +AC_DEFUN([AC_TRY_LINK], +[AC_LINK_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])]) + + +# AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY, +# ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]) +# -------------------------------------------------------- +AU_DEFUN([AC_COMPILE_CHECK], +[m4_ifvaln([$1], [AC_CHECKING([for $1])])dnl +AC_LINK_IFELSE([AC_LANG_PROGRAM([[$2]], [[$3]])], [$4], [$5]) +]) + + + + +## -------------------------------- ## +## Checking for run-time features. ## +## -------------------------------- ## + + +# _AC_RUN_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# ------------------------------------------------------------ +# Compile, link, and run. +# This macro can be used during the selection of a compiler. +# We also remove conftest.o as if the compilation fails, some compilers +# don't remove it. +m4_define([_AC_RUN_IFELSE], +[m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl +rm -f "conftest$ac_exeext" +AS_IF([AC_TRY_EVAL(ac_link) && AC_TRY_COMMAND("./conftest$ac_exeext")], + [$2], + [echo "$as_me: program exited with status $ac_status" >&AS_MESSAGE_LOG_FD +echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD +cat "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD +m4_ifvaln([$3], [$3])dnl])[]dnl +rm -f core ./core.* ./*.core "conftest$ac_exeext" "conftest.$ac_objext" m4_ifval([$1], + ["conftest.$ac_ext"])[]dnl +])# _AC_RUN_IFELSE + + +# AC_RUN_IFELSE(PROGRAM, +# [ACTION-IF-TRUE], [ACTION-IF-FALSE], +# [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR]) +# ---------------------------------------------------------- +# Compile, link, and run. Requires that the compiler for the current +# language was checked for, hence do not use this macro in macros looking +# for a compiler. +AC_DEFUN([AC_RUN_IFELSE], +[AC_LANG_COMPILER_REQUIRE()dnl +m4_ifval([$4], [], + [AC_DIAGNOSE([cross], + [$0 called without default to allow cross compiling])])dnl +if test "$cross_compiling" = yes; then + m4_default([$4], + [AC_MSG_ERROR([cannot run test program while cross compiling])]) +else + _AC_RUN_IFELSE($@) +fi]) + + +# AC_TRY_RUN(PROGRAM, +# [ACTION-IF-TRUE], [ACTION-IF-FALSE], +# [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR]) +# -------------------------------------------------------- +AC_DEFUN([AC_TRY_RUN], +[AC_RUN_IFELSE([AC_LANG_SOURCE([[$1]])], [$2], [$3], [$4])]) + + + +## ------------------------------------- ## +## Checking for the existence of files. ## +## ------------------------------------- ## + +# AC_CHECK_FILE(FILE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------- +# +# Check for the existence of FILE. +AC_DEFUN([AC_CHECK_FILE], +[AC_DIAGNOSE([cross], + [cannot check for file existence when cross compiling])dnl +AS_VAR_PUSHDEF([ac_File], [ac_cv_file_$1])dnl +AC_CACHE_CHECK([for $1], ac_File, +[test "$cross_compiling" = yes && + AC_MSG_ERROR([cannot check for file existence when cross compiling]) +if test -r "$1"; then + AS_VAR_SET(ac_File, yes) +else + AS_VAR_SET(ac_File, no) +fi]) +AS_IF([test "AS_VAR_GET(ac_File)" = yes], [$2], [$3])[]dnl +AS_VAR_POPDEF([ac_File])dnl +])# AC_CHECK_FILE + + +# AC_CHECK_FILES(FILE..., [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------------------- +AC_DEFUN([AC_CHECK_FILES], +[AC_FOREACH([AC_FILE_NAME], [$1], + [AC_CHECK_FILE(AC_FILE_NAME, + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_FILE_NAME), 1, + [Define if you have the file `]AC_File['.]) +$2], + [$3])])]) + + +## ------------------------------- ## +## Checking for declared symbols. ## +## ------------------------------- ## + + +# AC_CHECK_DECL(SYMBOL, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# ------------------------------------------------------- +# Check if SYMBOL (a variable or a function) is declared. +AC_DEFUN([AC_CHECK_DECL], +[AS_VAR_PUSHDEF([ac_Symbol], [ac_cv_have_decl_$1])dnl +AC_CACHE_CHECK([whether $1 is declared], ac_Symbol, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])], +[#ifndef $1 + (void) $1; +#endif +])], + [AS_VAR_SET(ac_Symbol, yes)], + [AS_VAR_SET(ac_Symbol, no)])]) +AS_IF([test "AS_VAR_GET(ac_Symbol)" = yes], [$2], [$3])[]dnl +AS_VAR_POPDEF([ac_Symbol])dnl +])# AC_CHECK_DECL + + +# AC_CHECK_DECLS(SYMBOLS, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# -------------------------------------------------------- +# Defines HAVE_DECL_SYMBOL to 1 if declared, 0 otherwise. See the +# documentation for a detailed explanation of this difference with +# other AC_CHECK_*S macros. SYMBOLS is an m4 list. +AC_DEFUN([AC_CHECK_DECLS], +[m4_foreach([AC_Symbol], [$1], + [AC_CHECK_DECL(AC_Symbol, + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_DECL_]AC_Symbol), 1, + [Define to 1 if you have the declaration + of `]AC_Symbol[', and to 0 if you don't.]) +$2], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_DECL_]AC_Symbol), 0) +$3], + [$4])]) +])# AC_CHECK_DECLS + + +## -------------------------------- ## +## Checking for library functions. ## +## -------------------------------- ## + + +# AC_LIBSOURCE(FILENAME) +# ---------------------- +# Announce we might need the file `FILENAME'. +m4_define([AC_LIBSOURCE], []) + + +# AC_LIBSOURCES([FILENAME1, ...]) +# ------------------------------- +# Announce we might need these files. +m4_define([AC_LIBSOURCES], +[m4_foreach([_AC_FILENAME], [$1], + [AC_LIBSOURCE(_AC_FILENAME)])]) + + +# _AC_LIBOBJ(FILENAME-NOEXT, ACTION-IF-INDIR) +# ------------------------------------------- +# We need `FILENAME-NOEXT.o', save this into `LIBOBJS'. +# We don't use AC_SUBST/2 because it forces an unneeded eol. +m4_define([_AC_LIBOBJ], +[AS_LITERAL_IF([$1], + [AC_LIBSOURCE([$1.c])], + [$2])dnl +AC_SUBST([LIBOBJS])dnl +LIBOBJS="$LIBOBJS $1.$ac_objext"]) + + +# AC_LIBOBJ(FILENAME-NOEXT) +# ------------------------- +# We need `FILENAME-NOEXT.o', save this into `LIBOBJS'. +# We don't use AC_SUBST/2 because it forces an unneeded eol. +m4_define([AC_LIBOBJ], +[_AC_LIBOBJ([$1], + [AC_DIAGNOSE(syntax, + [$0($1): you should use literals])])dnl +]) + + + +## ----------------------------------- ## +## Checking compiler characteristics. ## +## ----------------------------------- ## + + +# _AC_COMPUTE_INT_COMPILE(EXPRESSION, VARIABLE, [INCLUDES]) +# --------------------------------------------------------- +# Compute the integer EXPRESSION and store the result in the VARIABLE. +# Works OK if cross compiling. +m4_define([_AC_COMPUTE_INT_COMPILE], +[# Depending upon the size, compute the lo and hi bounds. +AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= 0])], + [ac_lo=0 ac_mid=0 + while :; do + AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_mid])], + [ac_hi=$ac_mid; break], + [ac_lo=`expr "$ac_mid" + 1`; ac_mid=`expr 2 '*' "$ac_mid" + 1`]) + done], + [ac_hi=-1 ac_mid=-1 + while :; do + AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) >= $ac_mid])], + [ac_lo=$ac_mid; break], + [ac_hi=`expr "$ac_mid" - 1`; ac_mid=`expr 2 '*' "$ac_mid"`]) + done]) +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' "$ac_hi" - "$ac_lo" ')' / 2 + "$ac_lo"` + AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([$3], [($1) <= $ac_mid])], + [ac_hi=$ac_mid], [ac_lo=`expr "$ac_mid" + 1`]) +done +$2=$ac_lo[]dnl +])# _AC_COMPUTE_INT_COMPILE + + +# _AC_COMPUTE_INT_RUN(EXPRESSION, VARIABLE, [INCLUDES], [IF-FAILS]) +# ----------------------------------------------------------------- +# Store the evaluation of the integer EXPRESSION in VARIABLE. +m4_define([_AC_COMPUTE_INT_RUN], +[AC_RUN_IFELSE([AC_LANG_INT_SAVE([$3], [$1])], + [$2=`cat conftest.val`], [$4])]) + + +# _AC_COMPUTE_INT(EXPRESSION, VARIABLE, INCLUDES, IF-FAILS) +# --------------------------------------------------------- +m4_define([_AC_COMPUTE_INT], +[if test "$cross_compiling" = yes; then + _AC_COMPUTE_INT_COMPILE([$1], [$2], [$3]) +else + _AC_COMPUTE_INT_RUN([$1], [$2], [$3], [$4]) +fi +rm -f conftest.val[]dnl +])# _AC_COMPUTE_INT + + +## ----------------------- ## +## Creating output files. ## +## ----------------------- ## + + +# This section handles about all the preparation aspects for +# `config.status': registering the configuration files, the headers, +# the links, and the commands `config.status' will run. There is a +# little mixture though of things actually handled by `configure', +# such as running the `configure' in the sub directories. Minor +# detail. +# +# There are two kinds of commands: +# +# COMMANDS: +# +# They are output into `config.status' via a quoted here doc. These +# commands are always associated to a tag which the user can use to +# tell `config.status' what are the commands she wants to run. +# +# INIT-CMDS: +# +# They are output via an *unquoted* here-doc. As a consequence $var +# will be output as the value of VAR. This is typically used by +# `configure' to give `config,.status' some variables it needs to run +# the COMMANDS. At the difference of `COMMANDS', the INIT-CMDS are +# always run. +# +# +# Some uniformity exists around here, please respect it! +# +# A macro named AC_CONFIG_FOOS has three args: the `TAG...' (or +# `FILE...' when it applies), the `COMMANDS' and the `INIT-CMDS'. It +# first checks that TAG was not registered elsewhere thanks to +# AC_CONFIG_UNIQUE. Then it registers `TAG...' in AC_LIST_FOOS, and for +# each `TAG', a special line in AC_LIST_FOOS_COMMANDS which is used in +# `config.status' like this: +# +# case $ac_tag in +# AC_LIST_FOOS_COMMANDS +# esac +# +# Finally, the `INIT-CMDS' are dumped into a special diversion, via +# `_AC_CONFIG_COMMANDS_INIT'. While `COMMANDS' are output once per TAG, +# `INIT-CMDS' are dumped only once per call to AC_CONFIG_FOOS. +# +# It also leave the TAG in the shell variable ac_config_foo which contains +# those which will actually be executed. In other words: +# +# if false; then +# AC_CONFIG_FOOS(bar, [touch bar]) +# fi +# +# will not create bar. +# +# AC_CONFIG_FOOS can be called several times (with different TAGs of +# course). +# +# Because these macros should not output anything, there should be `dnl' +# everywhere. A pain my friend, a pain. So instead in each macro we +# divert(-1) and restore the diversion at the end. +# +# +# Honorable members of this family are AC_CONFIG_FILES, +# AC_CONFIG_HEADERS, AC_CONFIG_LINKS and AC_CONFIG_COMMANDS. Bad boys +# are AC_LINK_FILES, AC_OUTPUT_COMMANDS and AC_OUTPUT when used with +# arguments. False members are AC_CONFIG_SRCDIR, AC_CONFIG_SUBDIRS +# and AC_CONFIG_AUX_DIR. Cousins are AC_CONFIG_COMMANDS_PRE and +# AC_CONFIG_COMMANDS_POST. + + + +# AC_CONFIG_IF_MEMBER(DEST, LIST, ACTION-IF-TRUE, ACTION-IF-FALSE) +# ---------------------------------------------------------------- +# If DEST is member of LIST, expand to ACTION-IF-TRUE, else ACTION-IF-FALSE. +# +# LIST is an AC_CONFIG list, i.e., a list of DEST[:SOURCE], separated +# with spaces. +# +# FIXME: This macro is badly designed, but I'm not guilty: m4 is. There +# is just no way to simply compare two strings in m4, but to use pattern +# matching. The big problem is then that the active characters should +# be quoted. Currently `+*.' are quoted. +m4_define([AC_CONFIG_IF_MEMBER], +[m4_if(m4_regexp($2, [\(^\| \)]m4_patsubst([$1], + [\([+*.]\)], [\\\1])[\(:\| \|$\)]), + -1, [$4], [$3])]) + + +# AC_FILE_DEPENDENCY_TRACE(DEST, SOURCE1, [SOURCE2...]) +# ----------------------------------------------------- +# This macro does nothing, it's a hook to be read with `autoconf --trace'. +# It announces DEST depends upon the SOURCE1 etc. +m4_define([AC_FILE_DEPENDENCY_TRACE], []) + + +# _AC_CONFIG_DEPENDENCY(DEST, [SOURCE1], [SOURCE2...]) +# ---------------------------------------------------- +# Be sure that a missing dependency is expressed as a dependency upon +# `DEST.in'. +m4_define([_AC_CONFIG_DEPENDENCY], +[m4_ifval([$2], + [AC_FILE_DEPENDENCY_TRACE($@)], + [AC_FILE_DEPENDENCY_TRACE([$1], [$1.in])])]) + + +# _AC_CONFIG_DEPENDENCIES(DEST[:SOURCE1[:SOURCE2...]]...) +# ------------------------------------------------------- +# Declare the DESTs depend upon their SOURCE1 etc. +m4_define([_AC_CONFIG_DEPENDENCIES], +[m4_divert_push([KILL]) +AC_FOREACH([AC_File], [$1], + [_AC_CONFIG_DEPENDENCY(m4_patsubst(AC_File, [:], [,]))]) +m4_divert_pop([KILL])dnl +]) + + +# _AC_CONFIG_UNIQUE(DEST[:SOURCE]...) +# ----------------------------------- +# +# Verify that there is no double definition of an output file +# (precisely, guarantees there is no common elements between +# CONFIG_HEADERS, CONFIG_FILES, CONFIG_LINKS, and CONFIG_SUBDIRS). +# +# Note that this macro does not check if the list $[1] itself +# contains doubles. +m4_define([_AC_CONFIG_UNIQUE], +[m4_divert_push([KILL]) +AC_FOREACH([AC_File], [$1], +[m4_pushdef([AC_Dest], m4_patsubst(AC_File, [:.*])) +AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_HEADERS], + [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_HEADER or AC_CONFIG_HEADERS.])]) + AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_LINKS], + [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_LINKS.])]) + AC_CONFIG_IF_MEMBER(AC_Dest, [_AC_LIST_SUBDIRS], + [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_SUBDIRS.])]) + AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_COMMANDS], + [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_COMMANDS.])]) + AC_CONFIG_IF_MEMBER(AC_Dest, [AC_LIST_FILES], + [AC_FATAL(`AC_Dest' [is already registered with AC_CONFIG_FILES or AC_OUTPUT.])]) +m4_popdef([AC_Dest])]) +m4_divert_pop([KILL])dnl +]) + + +# _AC_CONFIG_COMMANDS_INIT([INIT-COMMANDS]) +# ----------------------------------------- +# +# Register INIT-COMMANDS as command pasted *unquoted* in +# `config.status'. This is typically used to pass variables from +# `configure' to `config.status'. Note that $[1] is not over quoted as +# was the case in AC_OUTPUT_COMMANDS. +m4_define([_AC_CONFIG_COMMANDS_INIT], +[m4_ifval([$1], + [m4_append([_AC_OUTPUT_COMMANDS_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_AC_OUTPUT_COMMANDS_INIT]) + + +# AC_CONFIG_COMMANDS(NAME...,[COMMANDS], [INIT-CMDS]) +# --------------------------------------------------- +# +# Specify additional commands to be run by config.status. This +# commands must be associated with a NAME, which should be thought +# as the name of a file the COMMANDS create. +AC_DEFUN([AC_CONFIG_COMMANDS], +[m4_divert_push([KILL]) +_AC_CONFIG_UNIQUE([$1]) +m4_append([AC_LIST_COMMANDS], [ $1]) + +m4_if([$2],,, [AC_FOREACH([AC_Name], [$1], +[m4_append([AC_LIST_COMMANDS_COMMANDS], +[ ]m4_patsubst(AC_Name, [:.*])[ ) $2 ;; +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +m4_divert_pop([KILL])dnl +ac_config_commands="$ac_config_commands $1" +])dnl + +# Initialize the lists. +m4_define([AC_LIST_COMMANDS]) +m4_define([AC_LIST_COMMANDS_COMMANDS]) + + +# AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) +# ----------------------------------------- +# +# Add additional commands for AC_OUTPUT to put into config.status. +# +# This macro is an obsolete version of AC_CONFIG_COMMANDS. The only +# difficulty in mapping AC_OUTPUT_COMMANDS to AC_CONFIG_COMMANDS is +# to give a unique key. The scheme we have chosen is `default-1', +# `default-2' etc. for each call. +# +# Unfortunately this scheme is fragile: bad things might happen +# if you update an included file and configure.ac: you might have +# clashes :( On the other hand, I'd like to avoid weird keys (e.g., +# depending upon __file__ or the pid). +AU_DEFUN([AC_OUTPUT_COMMANDS], +[m4_define([_AC_OUTPUT_COMMANDS_CNT], m4_incr(_AC_OUTPUT_COMMANDS_CNT))dnl +dnl Double quoted since that was the case in the original macro. +AC_CONFIG_COMMANDS([default-]_AC_OUTPUT_COMMANDS_CNT, [[$1]], [[$2]])dnl +]) + +# Initialize. +AU_DEFUN([_AC_OUTPUT_COMMANDS_CNT], 0) + + +# AC_CONFIG_COMMANDS_PRE(CMDS) +# ---------------------------- +# Commands to run right before config.status is created. Accumulates. +AC_DEFUN([AC_CONFIG_COMMANDS_PRE], +[m4_append([AC_OUTPUT_COMMANDS_PRE], [$1 +])]) + +# Initialize. +m4_define([AC_OUTPUT_COMMANDS_PRE]) + + +# AC_CONFIG_COMMANDS_POST(CMDS) +# ----------------------------- +# Commands to run after config.status was created. Accumulates. +AC_DEFUN([AC_CONFIG_COMMANDS_POST], +[m4_append([AC_OUTPUT_COMMANDS_POST], [$1 +])]) + +# Initialize. +m4_define([AC_OUTPUT_COMMANDS_POST]) + + +# AC_SETUP_DEFS([SAVE-DEFS]) +AC_DEFUN([AC_SETUP_DEFS], +[ +m4_ifset([AC_LIST_HEADERS], +[m4_if($1,,,[define(AC_SAVE_DEFS,$1)])dnl +DEFS=-DHAVE_CONFIG_H], +[m4_if($1,,,AC_MSG_WARN(ignored save-defs parameter)) +AC_OUTPUT_MAKE_DEFS()]) +])dnl + + +# AC_CONFIG_HEADERS(HEADERS..., [COMMANDS], [INIT-CMDS]) +# ------------------------------------------------------ +# Specify that the HEADERS are to be created by instantiation of the +# AC_DEFINEs. Associate the COMMANDS to the HEADERS. This macro +# accumulates if called several times. +# +# The commands are stored in a growing string AC_LIST_HEADERS_COMMANDS +# which should be used like this: +# +# case $ac_file in +# AC_LIST_HEADERS_COMMANDS +# esac +AC_DEFUN([AC_CONFIG_HEADERS], +[m4_divert_push([KILL]) +_AC_CONFIG_UNIQUE([$1]) +_AC_CONFIG_DEPENDENCIES([$1]) +m4_append([AC_LIST_HEADERS], [ $1]) +dnl Register the commands +m4_ifval([$2], [AC_FOREACH([AC_File], [$1], +[m4_append([AC_LIST_HEADERS_COMMANDS], +[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +m4_divert_pop([KILL])dnl +ac_config_headers="$ac_config_headers m4_normalize([$1])" +])dnl + +# Initialize to empty. It is much easier and uniform to have a config +# list expand to empty when undefined, instead of special casing when +# not defined (since in this case, AC_CONFIG_FOO expands to AC_CONFIG_FOO). +m4_define([AC_LIST_HEADERS]) +m4_define([AC_LIST_HEADERS_COMMANDS]) + + +# AC_CONFIG_HEADER(HEADER-TO-CREATE ...) +# -------------------------------------- +# FIXME: Make it obsolete? +AC_DEFUN([AC_CONFIG_HEADER], +[AC_CONFIG_HEADERS([$1])]) + + +# AC_CONFIG_LINKS(DEST:SOURCE..., [COMMANDS], [INIT-CMDS]) +# -------------------------------------------------------- +# Specify that config.status should establish a (symbolic if possible) +# link from TOP_SRCDIR/SOURCE to TOP_SRCDIR/DEST. +# Reject DEST=., because it is makes it hard for ./config.status +# to guess the links to establish (`./config.status .'). +AC_DEFUN([AC_CONFIG_LINKS], +[m4_divert_push([KILL]) +_AC_CONFIG_UNIQUE([$1]) +_AC_CONFIG_DEPENDENCIES([$1]) +m4_if(m4_regexp([$1], [^\.:\| \.:]), -1,, + [AC_FATAL([$0: invalid destination: `.'])]) +m4_append([AC_LIST_LINKS], [ $1]) +dnl Register the commands +m4_ifval([$2], [AC_FOREACH([AC_File], [$1], +[m4_append([AC_LIST_LINKS_COMMANDS], +[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +m4_divert_pop([KILL])dnl +ac_config_links="$ac_config_links m4_normalize([$1])" +])dnl + + +# Initialize the list. +m4_define([AC_LIST_LINKS]) +m4_define([AC_LIST_LINKS_COMMANDS]) + + +# AC_LINK_FILES(SOURCE..., DEST...) +# --------------------------------- +# Link each of the existing files SOURCE... to the corresponding +# link name in DEST... +# +# Unfortunately we can't provide a very good autoupdate service here, +# since in `AC_LINK_FILES($from, $to)' it is possible that `$from' +# and `$to' are actually lists. It would then be completely wrong to +# replace it with `AC_CONFIG_LINKS($to:$from). It is possible in the +# case of literal values though, but because I don't think there is any +# interest in creating config links with literal values, no special +# mechanism is implemented to handle them. +# +# _AC_LINK_CNT is used to be robust to multiple calls. +AU_DEFUN([AC_LINK_FILES], +[m4_if($#, 2, , + [m4_fatal([$0: incorrect number of arguments])])dnl +m4_define([_AC_LINK_FILES_CNT], m4_incr(_AC_LINK_FILES_CNT))dnl +ac_sources="$1" +ac_dests="$2" +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=$[1]; shift; ac_dests=$[*] + set $ac_sources; ac_source=$[1]; shift; ac_sources=$[*] + [ac_config_links_]_AC_LINK_FILES_CNT="$[ac_config_links_]_AC_LINK_FILES_CNT $ac_dest:$ac_source" +done +AC_CONFIG_LINKS($[ac_config_links_]_AC_LINK_FILES_CNT)dnl +], +[ + It is technically impossible to `autoupdate' cleanly from AC_LINK_FILES + to AC_CONFIG_FILES. `autoupdate' provides a functional but inelegant + update, you should probably tune the result yourself.])# AC_LINK_FILES + + +# Initialize. +AU_DEFUN([_AC_LINK_FILES_CNT], 0) + + + +# AC_CONFIG_FILES(FILE..., [COMMANDS], [INIT-CMDS]) +# --------------------------------------------------------------- +# Specify output files, as with AC_OUTPUT, i.e., files that are +# configured with AC_SUBST. Associate the COMMANDS to each FILE, +# i.e., when config.status creates FILE, run COMMANDS afterwards. +# +# The commands are stored in a growing string AC_LIST_FILES_COMMANDS +# which should be used like this: +# +# case $ac_file in +# AC_LIST_FILES_COMMANDS +# esac +AC_DEFUN([AC_CONFIG_FILES], +[m4_divert_push([KILL]) +_AC_CONFIG_UNIQUE([$1]) +_AC_CONFIG_DEPENDENCIES([$1]) +m4_append([AC_LIST_FILES], [ $1]) +dnl Register the commands. +m4_ifval([$2], [AC_FOREACH([AC_File], [$1], +[m4_append([AC_LIST_FILES_COMMANDS], +[ ]m4_patsubst(AC_File, [:.*])[ ) $2 ;; +])])]) +_AC_CONFIG_COMMANDS_INIT([$3]) +m4_divert_pop([KILL])dnl +ac_config_files="$ac_config_files m4_normalize([$1])" +])dnl + +# Initialize the lists. +m4_define([AC_LIST_FILES]) +m4_define([AC_LIST_FILES_COMMANDS]) + + +# AC_CONFIG_SUBDIRS(DIR ...) +# -------------------------- +# We define two variables: +# - ac_subdirs_all +# is built in the `default' section, and should contain *all* +# the arguments of AC_CONFIG_SUBDIRS. It is used for --help=recursive. +# It makes no sense for arguments which are sh variables. +# - subdirs +# which is built at runtime, so some of these dirs might not be +# included, if for instance the user refused a part of the tree. +# This is used in _AC_OUTPUT_SUBDIRS. +# _AC_LIST_SUBDIRS is used only for _AC_CONFIG_UNIQUE. +AC_DEFUN([AC_CONFIG_SUBDIRS], +[_AC_CONFIG_UNIQUE([$1])dnl +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +m4_append([_AC_LIST_SUBDIRS], [ $1])dnl +AS_LITERAL_IF([$1], [], + [AC_DIAGNOSE(syntax, [$0: you should use literals])]) +m4_divert_text([DEFAULTS], + [ac_subdirs_all="$ac_subdirs_all m4_normalize([$1])"]) +AC_SUBST(subdirs, "$subdirs $1")dnl +]) + +# Initialize the list. +m4_define([_AC_LIST_SUBDIRS]) + + +# autoupdate::AC_OUTPUT([CONFIG_FILES...], [EXTRA-CMDS], [INIT-CMDS] [, SAVE-DEFS]) +# --------------------------------------------------------------------------------- +# +# If there are arguments given to AC_OUTPUT, dispatch them to the +# proper modern macros. +AC_DEFUN([AC_OUTPUT], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +m4_ifvaln([$1], + [AC_CONFIG_FILES([$1])])dnl +m4_ifvaln([$2$3], + [AC_CONFIG_COMMANDS(default, [[$2]], [[$3]])])dnl +m4_ifvaln([$4], + [AC_SETUP_DEFS([$4])])dnl +[AC_OUTPUT]]) + + +# AC_OUTPUT([CONFIG_FILES...], [EXTRA-CMDS], [INIT-CMDS] [, SAVE-DEFS]) +# --------------------------------------------------------------------- +# The big finish. +# Produce config.status, config.h, and links; and configure subdirs. +# The CONFIG_HEADERS are defined in the m4 variable AC_LIST_HEADERS. +# Pay special attention not to have too long here docs: some old +# shells die. Unfortunately the limit is not known precisely... +m4_define([AC_OUTPUT], +[dnl Dispatch the extra arguments to their native macros. +m4_ifval([$1], + [AC_CONFIG_FILES([$1])])dnl +m4_ifval([$2$3$4], + [AC_CONFIG_COMMANDS(default, [$2], [$3], [$4])])dnl +m4_ifval([$1$2$3], + [AC_DIAGNOSE([obsolete], + [$0 should be used without arguments. +You should run autoupdate.])])dnl +AC_CACHE_SAVE + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub=['/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}'] +fi + +AC_SETUP_DEFS([$4]) + +dnl Commands to run before creating config.status. +AC_OUTPUT_COMMANDS_PRE()dnl + +: "${CONFIG_STATUS=./config.status}" +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +_AC_OUTPUT_CONFIG_STATUS()dnl +ac_clean_files=$ac_clean_files_save + +dnl Commands to run after config.status was created +AC_OUTPUT_COMMANDS_POST()dnl + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec AS_MESSAGE_LOG_FD>/dev/null + $SHELL "$CONFIG_STATUS" || ac_cs_success=false + exec AS_MESSAGE_LOG_FD>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + "$ac_cs_success" || AS_EXIT([1]) +fi +dnl config.status should not do recursion. +AC_PROVIDE_IFELSE([AC_CONFIG_SUBDIRS], [_AC_OUTPUT_SUBDIRS()])dnl +])# AC_OUTPUT + + +# _AC_OUTPUT_CONFIG_STATUS +# ------------------------ +# Produce config.status. Called by AC_OUTPUT. +# Pay special attention not to have too long here docs: some old +# shells die. Unfortunately the limit is not known precisely... +m4_define([_AC_OUTPUT_CONFIG_STATUS], +[AC_MSG_NOTICE([creating $CONFIG_STATUS]) +cat >"$CONFIG_STATUS" <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +me=\`echo "\[$]0" | sed -e 's,.*[\\/],,'\` + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$[0] \$[@]" + +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS +_ACEOF + +cat >>"$CONFIG_STATUS" <<\_ACEOF +AS_SHELL_SANITIZE +exec AS_MESSAGE_FD>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>"$CONFIG_STATUS" +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>"$CONFIG_STATUS" +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>"$CONFIG_STATUS" +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>"$CONFIG_STATUS" +fi + +cat >>"$CONFIG_STATUS" <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $[0] [[OPTIONS]] [[FILE]]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions +m4_ifset([AC_LIST_FILES], +[[ --file=FILE[:TEMPLATE] + instantiate the configuration file FILE +]])dnl +m4_ifset([AC_LIST_HEADERS], +[[ --header=FILE[:TEMPLATE] + instantiate the configuration header FILE +]])dnl + +m4_ifset([AC_LIST_FILES], +[Configuration files: +$config_files + +])dnl +m4_ifset([AC_LIST_HEADERS], +[Configuration headers: +$config_headers + +])dnl +m4_ifset([AC_LIST_LINKS], +[Configuration links: +$config_links + +])dnl +m4_ifset([AC_LIST_COMMANDS], +[Configuration commands: +$config_commands + +])dnl +Report bugs to <dickey@invisible-island.net>." +EOF + +cat >>"$CONFIG_STATUS" <<EOF +ac_cs_version="\\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.status[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by [$]0, generated by GNU Autoconf AC_ACVERSION, + with options \\"`echo "$ac_configure_args" | sed 's/[[\\""\`\$]]/\\\\&/g'`\\" + +Copyright 2003-2022,2023 Thomas E. Dickey +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir="$srcdir" +AC_PROVIDE_IFELSE([AC_PROG_INSTALL], +[dnl Leave those double quotes here: this $INSTALL is evaluated in a +dnl here document, which might result in `INSTALL=/bin/install -c'. +INSTALL="$INSTALL" +])dnl +EOF + +cat >>"$CONFIG_STATUS" <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $[#] != 0 +do + case $[1] in + --*=*) + ac_option=`expr "x$[1]" : 'x\([[^=]]*\)='` + ac_optarg=`expr "x$[1]" : 'x[[^=]]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$[@]"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $[1] in + # Handling of the options. +EOF +cat >>"$CONFIG_STATUS" <<EOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $[0] " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $[0] $ac_configure_args --no-create --no-recursion ;; +EOF +cat >>"$CONFIG_STATUS" <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + AC_MSG_ERROR([ambiguous option: $[1] +Try `$[0] --help' for more information.]);; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $[1]" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $[1]" + ac_need_defaults=false;; + + # This is an error. + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try `$[0] --help' for more information.]) ;; + + *) ac_config_targets="$ac_config_targets $[1]" ;; + + esac + shift +done + +exec AS_MESSAGE_LOG_FD>>config.log +cat >&AS_MESSAGE_LOG_FD << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me m4_ifset([AC_PACKAGE_STRING], + [(AC_PACKAGE_STRING) ])AC_ACVERSION, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > "$ac_cs_invocation" +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +dnl We output the INIT-CMDS first for obvious reasons :) +m4_ifset([_AC_OUTPUT_COMMANDS_INIT], +[cat >>"$CONFIG_STATUS" <<EOF +# +# INIT-COMMANDS section. +# + +_AC_OUTPUT_COMMANDS_INIT() +EOF]) + + +dnl Issue this section only if there were actually config files. +dnl This checks if one of AC_LIST_HEADERS, AC_LIST_FILES, AC_LIST_COMMANDS, +dnl or AC_LIST_LINKS is set. +m4_ifval(AC_LIST_HEADERS()AC_LIST_LINKS()AC_LIST_FILES()AC_LIST_COMMANDS(), +[ +cat >>"$CONFIG_STATUS" <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. +AC_FOREACH([AC_File], AC_LIST_FILES, +[ "m4_patsubst(AC_File, [:.*])" )dnl + CONFIG_FILES="$CONFIG_FILES AC_File" ;; +])dnl +AC_FOREACH([AC_File], AC_LIST_LINKS, +[ "m4_patsubst(AC_File, [:.*])" )dnl + CONFIG_LINKS="$CONFIG_LINKS AC_File" ;; +])dnl +AC_FOREACH([AC_File], AC_LIST_COMMANDS, +[ "m4_patsubst(AC_File, [:.*])" )dnl + CONFIG_COMMANDS="$CONFIG_COMMANDS AC_File" ;; +])dnl +AC_FOREACH([AC_File], AC_LIST_HEADERS, +[ "m4_patsubst(AC_File, [:.*])" )dnl + CONFIG_HEADERS="$CONFIG_HEADERS AC_File" ;; +])dnl + *) AC_MSG_ERROR([invalid argument: $ac_config_target]);; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if "$ac_need_defaults"; then +m4_ifset([AC_LIST_FILES], +[ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +])dnl +m4_ifset([AC_LIST_HEADERS], +[ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +])dnl +m4_ifset([AC_LIST_LINKS], +[ test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links +])dnl +m4_ifset([AC_LIST_COMMANDS], +[ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +])dnl +fi + +AS_TMPDIR(cs) + +EOF +])[]dnl m4_ifval + +dnl The following four sections are in charge of their own here +dnl documenting into $CONFIG_STATUS. +m4_ifset([AC_LIST_FILES], [_AC_OUTPUT_FILES()])dnl +m4_ifset([AC_LIST_HEADERS], [_AC_OUTPUT_HEADERS()])dnl +m4_ifset([AC_LIST_LINKS], [_AC_OUTPUT_LINKS()])dnl +m4_ifset([AC_LIST_COMMANDS], [_AC_OUTPUT_COMMANDS()])dnl + +cat >>"$CONFIG_STATUS" <<\EOF + +AS_EXIT(0) +EOF +chmod +x "$CONFIG_STATUS" +])# _AC_OUTPUT_CONFIG_STATUS + + +# AC_OUTPUT_MAKE_DEFS +# ------------------- +# Set the DEFS variable to the -D options determined earlier. +# This is a subroutine of AC_OUTPUT. +# It is called inside configure, outside of config.status. +# Using a here document instead of a string reduces the quoting nightmare. +m4_define([AC_OUTPUT_MAKE_DEFS], +[[# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\EOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +EOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed +]])# AC_OUTPUT_MAKE_DEFS + + +# _AC_OUTPUT_FILES +# ---------------- +# Do the variable substitutions to create the Makefiles or whatever. +# This is a subroutine of AC_OUTPUT. +# +# It has to send itself into $CONFIG_STATUS (eg, via here documents). +# Upon exit, no here document shall be opened. +m4_define([_AC_OUTPUT_FILES], +[cat >>"$CONFIG_STATUS" <<EOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. +dnl Please, pay attention that this sed code depends a lot on the shape +dnl of the sed commands issued by AC_SUBST. So if you change one, change +dnl the other too. +[ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >"\$tmp"/subs.sed <<\\CEOF] +dnl These here document variables are unquoted when configure runs +dnl but quoted when config.status runs, so variables are expanded once. +dnl Insert the sed substitutions of variables. +_AC_SUBST_SED_PROGRAM()dnl +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. +dnl One cannot portably go further than 100 commands because of HP-UX. +dnl Here, there are 2 cmd per line, and two cmd are added later. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # 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" "$tmp"/subs.sed >"$tmp"/subs.frag + else + sed "${ac_end}q" "$tmp"/subs.sed >"$tmp"/subs.frag + fi + if test ! -s "$tmp"/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo [':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b'] && cat "$tmp"/subs.frag) >"$tmp"/subs-$ac_sed_frag.sed + # It is possible to make a multiline substitution using escaped newlines. + # Ensure that we do not split the substitution between script fragments. + ac_BEG=$ac_end + ac_END=`expr "$ac_end" + "$ac_max_sed_lines"` + sed "1,${ac_BEG}d; ${ac_END}p; q" "$tmp"/subs.sed >"$tmp"/subs.next + if test -s "$tmp"/subs.next; then + grep '^s,@[[^@,]][[^@,]]*@,.*\\$' "$tmp"/subs.next >"$tmp"/subs.edit + if test ! -s "$tmp"/subs.edit; then + grep "^s,@[[^@,]][[^@,]]*@,.*,;t t$" "$tmp"/subs.next >"$tmp"/subs.edit + if test ! -s "$tmp"/subs.edit; then + if test "$ac_beg" -gt 1; then + ac_end=`expr "$ac_end" - 1` + continue + fi + fi + fi + fi + + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f \"$tmp\"/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f \"$tmp\"/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr "$ac_sed_frag" + 1` + ac_beg=$ac_end + ac_end=`expr "$ac_end" + "$ac_max_sed_lines"` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="cat" + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>"$CONFIG_STATUS" <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + - | *:- | *:-:* ) # input from stdin + cat >"$tmp"/stdin + ac_file_in=`echo "$ac_file" | sed 's,[[^:]]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[[^:]]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`AS_DIRNAME(["$ac_file"])` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + AS_MKDIR_P(["$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 "$srcdir" in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo "$ac_dots" | sed 's,/$,,'` + fi ;; + [[\\/]]* | ?:[[\\/]]* ) + ac_srcdir="$srcdir$ac_dir_suffix"; + ac_top_srcdir="$srcdir" ;; + *) # Relative path. + ac_srcdir="$ac_dots$srcdir$ac_dir_suffix" + ac_top_srcdir="$ac_dots$srcdir" ;; + esac + +AC_PROVIDE_IFELSE([AC_PROG_INSTALL], +[ case $INSTALL in + [[\\/$]]* | ?:[[\\/]]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac +])dnl + + if test x"$ac_file" != x-; then + AC_MSG_NOTICE([creating $ac_file]) + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo "$tmp"/stdin ;; + [[\\/$]]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || AC_MSG_ERROR([cannot find input file: $f]) + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + AC_MSG_ERROR([cannot find input file: $f]) + fi;; + esac + done` || AS_EXIT([1]) +EOF +cat >>"$CONFIG_STATUS" <<\EOF +dnl check for breakage with datarootdir + ac_warn_datarootdir=no + if test x"$ac_file" != x-; then + for ac_item in $ac_file_inputs + do + ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' "$ac_item"` + if test -n "$ac_seen"; then + ac_used=`grep '@datarootdir@' "$ac_item"` + if test -z "$ac_used"; then + AC_MSG_WARN(datarootdir was used implicitly but not set: +$ac_seen) + ac_warn_datarootdir=yes + fi + fi + ac_seen=`grep '${datarootdir}' "$ac_item"` + if test -n "$ac_seen"; then + AC_MSG_WARN(datarootdir was used explicitly but not set: +$ac_seen) + ac_warn_datarootdir=yes + fi + done + fi + +if test "x$ac_warn_datarootdir" = xyes; then + ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" +fi + +EOF +cat >>"$CONFIG_STATUS" <<EOF +dnl Neutralize VPATH when `$srcdir' = `.'. + sed "$ac_vpsub +dnl Shell code in configure.ac might set extrasub. +dnl FIXME: do we really want to maintain this feature? +$extrasub +EOF +cat >>"$CONFIG_STATUS" <<\EOF +:t +[/@[a-zA-Z_][a-zA-Z_0-9]*@/!b] +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +AC_PROVIDE_IFELSE([AC_PROG_INSTALL], [s,@INSTALL@,$ac_INSTALL,;t t +])dnl +dnl The parens around the eval prevent an "illegal io" in Ultrix sh. +" $ac_file_inputs | (eval "$ac_sed_cmds") >"$tmp"/out + rm -f "$tmp"/stdin +EOF +test -n "${FGREP}" || FGREP="grep -F" +test -n "${EGREP}" || EGREP="grep -E" +cat >>"$CONFIG_STATUS" <<EOF + test -n "\${FGREP}" || FGREP="$FGREP" + test -n "\${EGREP}" || EGREP="$EGREP" +EOF +cat >>"$CONFIG_STATUS" <<\EOF + if test x"$ac_file" != x-; then + cp "$tmp/out" "$ac_file" + + for ac_name in prefix exec_prefix datarootdir + do + ac_seen=`$FGREP -n '${'$ac_name'[[:=]].*}' "$ac_file"` + if test -n "$ac_seen"; then + ac_init=`$EGREP '[[ ]]*'$ac_name'[[ ]]*=' "$ac_file"` + if test -z "$ac_init"; then + ac_seen=`echo "$ac_seen" |sed -e 's,^,'"$ac_file"':,'` + AC_MSG_WARN(Variable $ac_name is used but was not set: +$ac_seen) + fi + fi + done + $EGREP -n '@[[a-z_]][[a-z_0-9]]+@' "$ac_file" >"$tmp"/out + $EGREP -n '@[[A-Z_]][[A-Z_0-9]]+@' "$ac_file" >>"$tmp"/out + if test -s "$tmp"/out; then + ac_seen=`sed -e 's,^,'"$ac_file"':,' < "$tmp"/out` + AC_MSG_WARN(Some variables may not be substituted: +$ac_seen) + fi + else + cat "$tmp"/out + fi + rm -f "$tmp"/out + +m4_ifset([AC_LIST_FILES_COMMANDS], +[ # Run the commands associated with the file. + case "$ac_file" in +AC_LIST_FILES_COMMANDS()dnl + esac +])dnl +done +EOF +])# _AC_OUTPUT_FILES + + +# _AC_OUTPUT_HEADERS +# ------------------ +# +# Output the code which instantiates the `config.h' files from their +# `config.h.in'. +# +# This is a subroutine of _AC_OUTPUT_CONFIG_STATUS. It has to send +# itself into $CONFIG_STATUS (eg, via here documents). Upon exit, no +# here document shall be opened. +# +# +# The code produced used to be extremely costly: there are was a +# single sed script (n lines) handling both `#define' templates, +# `#undef' templates with trailing space, and `#undef' templates +# without trailing spaces. The full script was run on each of the m +# lines of `config.h.in', i.e., about n x m. +# +# Now there are two scripts: `conftest.defines' for the `#define' +# templates, and `conftest.undef' for the `#undef' templates. +# +# Optimization 1. It is incredibly costly to run two `#undef' +# scripts, so just remove trailing spaces first. Removes about a +# third of the cost. +# +# Optimization 2. Since `#define' are rare and obsoleted, +# `conftest.defines' is built and run only if grep says there are +# `#define'. Improves by at least a factor 2, since in addition we +# avoid the cost of *producing* the sed script. +# +# Optimization 3. In each script, first check that the current input +# line is a template. This avoids running the full sed script on +# empty lines and comments (divides the cost by about 3 since each +# template chunk is typically a comment, a template, an empty line). +# +# Optimization 4. Once a substitution performed, since there can be +# only one per line, immediately restart the script on the next input +# line (using the `t' sed instruction). Divides by about 2. +# *Note:* In the case of the AC_SUBST sed script (_AC_OUTPUT_FILES) +# this optimization cannot be applied as is, because there can be +# several substitutions per line. +# +# +# The result is about, hm, ... times blah... plus.... Ahem. The +# result is about much faster. +m4_define([_AC_OUTPUT_HEADERS], +[cat >>"$CONFIG_STATUS" <<\EOF + +# +# CONFIG_HEADER section. +# + +# 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. +dnl Double quote for the `[ ]' and `define'. +[ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_i turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_iA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_iB='\([ ]\),\1#\2define\3' +ac_iC=' ' +ac_iD='\4,;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t'] + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + - | *:- | *:-:* ) # input from stdin + cat >"$tmp"/stdin + ac_file_in=`echo "$ac_file" | sed 's,[[^:]]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[[^:]]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && AC_MSG_NOTICE([creating $ac_file]) + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo "$tmp"/stdin ;; + [[\\/$]]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || AC_MSG_ERROR([cannot find input file: $f]) + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + AC_MSG_ERROR([cannot find input file: $f]) + fi;; + esac + done` || AS_EXIT([1]) + # Remove the trailing spaces. + sed 's/[[ ]]*$//' $ac_file_inputs >"$tmp"/in + +EOF + +ifdef([AC_SAVE_DEFS], +[ +# Transform confdefs.h into a list of #define's. We won't use it as a sed +# script, but as data to insert where we see @DEFS@. We expect AC_SAVE_DEFS to +# be either 'cat' or 'sort'. +AC_SAVE_DEFS confdefs.h | uniq >conftest.vals + +# 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 +echo ' rm -f conftest.frag' >> "$CONFIG_STATUS" +while grep . conftest.vals >/dev/null +do + # Write chunks of a limited-size here document to conftest.frag. + echo ' cat >> conftest.frag <<CEOF' >> "$CONFIG_STATUS" + sed "${ac_max_here_lines}q" conftest.vals | sed -e 's/#ifdef.*/#if 0/' >> "$CONFIG_STATUS" + echo 'CEOF' >> "$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 + +# Run sed to substitute the contents of conftest.frag into $tmp/in at the +# marker @DEFS@. +echo ' cat >> conftest.edit <<CEOF +/@DEFS@/r conftest.frag +/@DEFS@/d +CEOF +sed -f conftest.edit "$tmp"/in > "$tmp"/out +rm -f "$tmp"/in +mv "$tmp"/out "$tmp"/in +rm -f conftest.edit conftest.frag +' >> "$CONFIG_STATUS" +],[ +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# 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.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +dnl Double quote for `[ ]' and `define'. +[s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end] +EOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +sed 's/ac_d/ac_i/g' conftest.defines >>conftest.undefs +rm -f confdef2sed.sed + +# 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.undefs <<\EOF +[s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,] +EOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>"$CONFIG_STATUS" +echo ' test -n "${EGREP}" || EGREP="grep -E"' >>"$CONFIG_STATUS" +echo ' if ${EGREP} ["^[ ]*#[ ]*define"] "$tmp"/in >/dev/null; then' >>"$CONFIG_STATUS" +echo ' # If there are no defines, we may have an empty if/fi' >>"$CONFIG_STATUS" +echo ' :' >>"$CONFIG_STATUS" +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to "$tmp"/defines.sed. + echo ' cat >"$tmp"/defines.sed <<CEOF' >>"$CONFIG_STATUS" + # Speed up: don't consider the non `#define' lines. + echo ['/^[ ]*#[ ]*define/!b'] >>"$CONFIG_STATUS" + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>"$CONFIG_STATUS" + echo ': clr' >>"$CONFIG_STATUS" + sed "${ac_max_here_lines}q" conftest.defines >>"$CONFIG_STATUS" + echo 'CEOF + sed -f "$tmp"/defines.sed "$tmp"/in >"$tmp"/out + rm -f "$tmp"/in + mv "$tmp"/out "$tmp"/in +' >>"$CONFIG_STATUS" + sed "1,${ac_max_here_lines}d" conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>"$CONFIG_STATUS" +echo >>"$CONFIG_STATUS" + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>"$CONFIG_STATUS" +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to "$tmp"/undefs.sed. + echo ' cat >"$tmp"/undefs.sed <<CEOF' >>"$CONFIG_STATUS" + # Speed up: don't consider the non `#undef' + echo ['/^[ ]*#[ ]*undef/!b'] >>"$CONFIG_STATUS" + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>"$CONFIG_STATUS" + echo ': clr' >>"$CONFIG_STATUS" + sed "${ac_max_here_lines}q" conftest.undefs >>"$CONFIG_STATUS" + echo 'CEOF + sed -f "$tmp"/undefs.sed "$tmp"/in >"$tmp"/out + rm -f "$tmp"/in + mv "$tmp"/out "$tmp"/in +' >>"$CONFIG_STATUS" + sed "1,${ac_max_here_lines}d" conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs +]) + +dnl Now back to your regularly scheduled config.status. +cat >>"$CONFIG_STATUS" <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >"$tmp"/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >"$tmp"/config.h + fi + cat "$tmp"/in >>"$tmp"/config.h + rm -f "$tmp"/in + if test x"$ac_file" != x-; then + if cmp -s "$ac_file" "$tmp/config.h" 2>/dev/null; then + AC_MSG_NOTICE([$ac_file is unchanged]) + else + ac_dir=`AS_DIRNAME(["$ac_file"])` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + AS_MKDIR_P(["$ac_dir"]) + fi + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" + fi + else + cat "$tmp"/config.h + rm -f "$tmp"/config.h + fi +m4_ifset([AC_LIST_HEADERS_COMMANDS], +[ # Run the commands associated with the file. + case "$ac_file" in +AC_LIST_HEADERS_COMMANDS()dnl + esac +])dnl +done +EOF +])# _AC_OUTPUT_HEADERS + + +# _AC_OUTPUT_LINKS +# ---------------- +# This is a subroutine of AC_OUTPUT. +# +# It has to send itself into $CONFIG_STATUS (eg, via here documents). +# Upon exit, no here document shall be opened. +m4_define([_AC_OUTPUT_LINKS], +[cat >>"$CONFIG_STATUS" <<\EOF + +# +# CONFIG_LINKS section. +# + +dnl Here we use : instead of .. because if AC_LINK_FILES was used +dnl with empty parameters (as in gettext.m4), then we obtain here +dnl `:', which we want to skip. So let's keep a single exception: `:'. +for ac_file in : $CONFIG_LINKS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[[^:]]*:,,'` + + AC_MSG_NOTICE([linking $srcdir/$ac_source to $ac_dest]) + + if test ! -r "$srcdir/$ac_source"; then + AC_MSG_ERROR([$srcdir/$ac_source: File not found]) + fi + rm -f "$ac_dest" + + # Make relative symlinks. + ac_dest_dir=`AS_DIRNAME(["$ac_dest"])` + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + AS_MKDIR_P(["$ac_dest_dir"]) + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dest_dir_suffix. + ac_dots=`echo "$ac_dest_dir_suffix" | sed 's,/[[^/]]*,../,g'` + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in + [[\\/$]]* | ?:[[\\/]]* ) ac_rel_source="$srcdir/$ac_source" ;; + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + ln -s "$ac_rel_source" "$ac_dest" 2>/dev/null || + ln "$srcdir/$ac_source" "$ac_dest" || + AC_MSG_ERROR([cannot link $ac_dest to $srcdir/$ac_source]) +m4_ifset([AC_LIST_LINKS_COMMANDS], +[ # Run the commands associated with the file. + case "$ac_file" in +AC_LIST_LINKS_COMMANDS()dnl + esac +])dnl +done +EOF +])# _AC_OUTPUT_LINKS + + +# _AC_OUTPUT_COMMANDS +# ------------------- +# This is a subroutine of AC_OUTPUT, in charge of issuing the code +# related to AC_CONFIG_COMMANDS. +# +# It has to send itself into $CONFIG_STATUS (eg, via here documents). +# Upon exit, no here document shall be opened. +m4_define([_AC_OUTPUT_COMMANDS], +[m4_ifset([AC_LIST_COMMANDS_COMMANDS],[cat >>"$CONFIG_STATUS" <<\EOF +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[[^:]]*:,,'` + +dnl FIXME: Until Automake uses the new features of config.status, we +dnl should keep this silent. Otherwise, because Automake runs this in +dnl each directory, it quickly becomes annoying. +dnl echo "executing commands of $ac_dest" + case "$ac_dest" in +AC_LIST_COMMANDS_COMMANDS()dnl + esac +done +EOF +])])# _AC_OUTPUT_COMMANDS + + +# _AC_OUTPUT_SUBDIRS +# ------------------ +# This is a subroutine of AC_OUTPUT, but it does not go into +# config.status, rather, it is called after running config.status. +m4_define([_AC_OUTPUT_SUBDIRS], +[ +# +# CONFIG_SUBDIRS section. +# +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -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=*) + ;; + --config-cache | -C) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_subdir in : $subdirs; do test "x$ac_subdir" = x: && continue + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + test -d "$srcdir/$ac_subdir" || continue + + AC_MSG_NOTICE([configuring in $ac_subdir]) + case "$srcdir" in + .) ;; + *) AS_MKDIR_P(["./$ac_subdir"]) + if test -d ./$ac_subdir; then :; + else + AC_MSG_ERROR([cannot create `pwd`/$ac_subdir]) + fi + ;; + esac + + ac_popdir=`pwd` + cd "$ac_subdir" + + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo "$ac_subdir" | + sed 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir="$srcdir" ;; + [[\\/]]* | ?:[[\\/]]* ) # Absolute path. + ac_sub_srcdir="$srcdir/$ac_subdir" ;; + *) # Relative path. + ac_sub_srcdir="$ac_dots$srcdir/$ac_subdir" ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_sub_srcdir/configure.gnu"; then + ac_sub_configure="$SHELL '$ac_sub_srcdir/configure.gnu'" + elif test -f "$ac_sub_srcdir/configure"; then + ac_sub_configure="$SHELL '$ac_sub_srcdir/configure'" + elif test -f "$ac_sub_srcdir/configure.in"; then + ac_sub_configure=$ac_configure + else + AC_MSG_WARN([no configuration information is in $ac_subdir]) + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + # Make the cache file name correct relative to the subdirectory. + case $cache_file in + [[\\/]]* | ?:[[\\/]]* ) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file=$ac_dots$cache_file ;; + esac + + AC_MSG_NOTICE([running $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir]) + # The eval makes quoting arguments work. + eval "$ac_sub_configure" $ac_sub_configure_args \ + --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir || + AC_MSG_ERROR([$ac_sub_configure failed for $ac_subdir]) + fi + + cd "$ac_popdir" + done +fi +])# _AC_OUTPUT_SUBDIRS + + +# AC_LINKER_OPTION(LINKER-OPTIONS, SHELL-VARIABLE) +# ------------------------------------------------ +# +# Specifying options to the compiler (whether it be the C, C++ or +# Fortran 77 compiler) that are meant for the linker is compiler +# dependent. This macro lets you give options to the compiler that +# are meant for the linker in a portable, compiler-independent way. +# +# This macro take two arguments, a list of linker options that the +# compiler should pass to the linker (LINKER-OPTIONS) and the name of +# a shell variable (SHELL-VARIABLE). The list of linker options are +# appended to the shell variable in a compiler-dependent way. +# +# For example, if the selected language is C, then this: +# +# AC_LINKER_OPTION([-R /usr/local/lib/foo], foo_LDFLAGS) +# +# will expand into this if the selected C compiler is gcc: +# +# foo_LDFLAGS="-Xlinker -R -Xlinker /usr/local/lib/foo" +# +# otherwise, it will expand into this: +# +# foo_LDFLAGS"-R /usr/local/lib/foo" +# +# You are encouraged to add support for compilers that this macro +# doesn't currently support. +# FIXME: Get rid of this macro. +AC_DEFUN([AC_LINKER_OPTION], +[if test "$ac_compiler_gnu" = yes; then + for ac_link_opt in $1; do + $2="[$]$2 -Xlinker $ac_link_opt" + done +else + $2="[$]$2 $1" +fi]) + + +# AC_LIST_MEMBER_OF(ELEMENT, LIST, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# -------------------------------------------------------------------------- +# +# Processing the elements of a list is tedious in shell programming, +# as lists tend to be implemented as space delimited strings. +# +# This macro searches LIST for ELEMENT, and executes ACTION-IF-FOUND +# if ELEMENT is a member of LIST, otherwise it executes +# ACTION-IF-NOT-FOUND. +AC_DEFUN([AC_LIST_MEMBER_OF], +[dnl Do some sanity checking of the arguments. +m4_if([$1], , [AC_FATAL([$0]: missing argument 1)])dnl +m4_if([$2], , [AC_FATAL([$0]: missing argument 2)])dnl + + ac_exists=false + for ac_i in $2; do + if test x"$1" = x"$ac_i"; then + ac_exists=true + break + fi + done + + AS_IF([test x"$ac_exists" = xtrue], [$3], [$4])[]dnl +]) diff --git a/acheaders b/acheaders new file mode 100644 index 0000000..a5b8404 --- /dev/null +++ b/acheaders @@ -0,0 +1,101 @@ +# acheaders -- autoscan's mapping from headers to Autoconf macros +# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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. + +# FIXME: The case of AC_HEADER_STDC + AC_CHECK_HEADERS headers is +# unclear to me --akim. + +# Ones that have their own macros. +X11/Xlib.h AC_PATH_X +dirent.h AC_HEADER_DIRENT +float.h AC_HEADER_STDC +float.h AC_CHECK_HEADERS +ndir.h AC_HEADER_DIRENT +stdarg.h AC_HEADER_STDC +stddef.h AC_HEADER_STDC +stddef.h AC_CHECK_HEADERS +stdlib.h AC_HEADER_STDC +stdlib.h AC_CHECK_HEADERS +string.h AC_HEADER_STDC +string.h AC_CHECK_HEADERS +sys/dir.h AC_HEADER_DIRENT +sys/mkdev.h AC_HEADER_MAJOR +sys/ndir.h AC_HEADER_DIRENT +sys/wait.h AC_HEADER_SYS_WAIT + +# Others, checked with AC_CHECK_HEADERS. +OS.h +alloca.h +argz.h +arpa/inet.h +errno.h +fcntl.h +fenv.h +fs_info.h +inttypes.h +langinfo.h +libintl.h +limits.h +locale.h +mach/mach.h +malloc.h +memory.h +mntent.h +mnttab.h +netdb.h +netinet/in.h +nl_types.h +nlist.h +paths.h +sgtty.h +shadow.h +stdint.h +stdio_ext.h +strings.h +sys/acl.h +sys/file.h +sys/filsys.h +sys/fs/s5param.h +sys/fs_types.h +sys/fstyp.h +sys/ioctl.h +sys/mntent.h +sys/mount.h +sys/param.h +sys/socket.h +sys/statfs.h +sys/statvfs.h +sys/systeminfo.h +sys/time.h +sys/timeb.h +sys/vfs.h +sys/window.h +syslog.h +termio.h +termios.h +unistd.h +utime.h +utmp.h +utmpx.h +values.h +wchar.h +wctype.h + +# Local Variables: +# mode: shell-script +# End: diff --git a/acheaders.m4 b/acheaders.m4 new file mode 100644 index 0000000..af10a34 --- /dev/null +++ b/acheaders.m4 @@ -0,0 +1,456 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# Checking for headers. +#------------------------------------------------------------------------------ +# Copyright 2020-2021,2023 Thomas E. Dickey +# Copyright 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by David MacKenzie, with help from +# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +# Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +# Table of contents +# +# 1. Generic tests for headers +# 2. Tests for specific headers + + +## ------------------------------ ## +## 1. Generic tests for headers. ## +## ------------------------------ ## + + +# AC_CHECK_HEADER(HEADER-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# --------------------------------------------------------- +# If INCLUDES is empty and strictly empty, use the preprocessor to +# check whether HEADER-FILE exists. If INCLUDES is set, then use the +# compiler to check whether INCLUDES followed by HEADER-FILE compiles +# with success. +AC_DEFUN([AC_CHECK_HEADER], +[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl +AC_CACHE_CHECK([for $1], ac_Header, + [m4_ifval([$4], + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([$4 +@%:@include <$1>])], + [AS_VAR_SET(ac_Header, yes)], + [AS_VAR_SET(ac_Header, no)])], + [AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include <$1>])], + [AS_VAR_SET(ac_Header, yes)], + [AS_VAR_SET(ac_Header, no)])])]) +AS_IF([test "AS_VAR_GET(ac_Header)" = yes], [$2], [$3])[]dnl +AS_VAR_POPDEF([ac_Header])dnl +])# AC_CHECK_HEADER + + +# AH_CHECK_HEADERS(HEADER-FILE...) +# -------------------------------- +m4_define([AH_CHECK_HEADERS], +[AC_FOREACH([AC_Header], [$1], + [AH_TEMPLATE(AS_TR_CPP(HAVE_[]AC_Header), + [Define if you have the <]AC_Header[> header file.])])]) + + +# AC_CHECK_HEADERS(HEADER-FILE... +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# ---------------------------------------------------------- +AC_DEFUN([AC_CHECK_HEADERS], +[AH_CHECK_HEADERS([$1])dnl +for ac_header in $1 +do +AC_CHECK_HEADER($ac_header, + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$ac_header)) $2], + [$3], + [$4])dnl +done +])# AC_CHECK_HEADERS + + + + + +## ------------------------------- ## +## 2. Tests for specific headers. ## +## ------------------------------- ## + + +# _AC_CHECK_HEADER_DIRENT(HEADER-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT_FOUND]) +# ----------------------------------------------------------------- +# Like AC_CHECK_HEADER, except also make sure that HEADER-FILE +# defines the type `DIR'. dirent.h on NextStep 3.2 doesn't. +m4_define([_AC_CHECK_HEADER_DIRENT], +[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_dirent_$1])dnl +AC_CACHE_CHECK([for $1 that defines DIR], ac_Header, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h> +#include <$1> +], + [if ((DIR *) 0) +return 0;])], + [AS_VAR_SET(ac_Header, yes)], + [AS_VAR_SET(ac_Header, no)])]) +AS_IF([test "AS_VAR_GET(ac_Header)" = yes], [$2], [$3])[]dnl +AS_VAR_POPDEF([ac_Header])dnl +])# _AC_CHECK_HEADER_DIRENT + + +# AH_CHECK_HEADERS_DIRENT(HEADERS...) +# ----------------------------------- +m4_define([AH_CHECK_HEADERS_DIRENT], +[AC_FOREACH([AC_Header], [$1], + [AH_TEMPLATE(AS_TR_CPP(HAVE_[]AC_Header), + [Define if you have the <]AC_Header[> header file, and + it defines `DIR'.])])]) + + +# AC_HEADER_DIRENT +# ---------------- +AC_DEFUN([AC_HEADER_DIRENT], +[AH_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h) +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + _AC_CHECK_HEADER_DIRENT($ac_hdr, + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_$ac_hdr), 1) +ac_header_dirent=$ac_hdr; break]) +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then + AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir") +else + AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx") +fi +])# AC_HEADER_DIRENT + + +# AC_HEADER_MAJOR +# --------------- +AC_DEFUN([AC_HEADER_MAJOR], +[AC_CACHE_CHECK(whether sys/types.h defines makedev, + ac_cv_header_sys_types_h_makedev, +[AC_TRY_LINK([#include <sys/types.h> +], [return makedev(0, 0);], + ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no) +]) + +if test $ac_cv_header_sys_types_h_makedev = no; then +AC_CHECK_HEADER(sys/mkdev.h, + [AC_DEFINE(MAJOR_IN_MKDEV, 1, + [Define if `major', `minor', and `makedev' are + declared in <mkdev.h>.])]) + + if test $ac_cv_header_sys_mkdev_h = no; then + AC_CHECK_HEADER(sys/sysmacros.h, + [AC_DEFINE(MAJOR_IN_SYSMACROS, 1, + [Define if `major', `minor', and `makedev' are + declared in <sysmacros.h>.])]) + fi +fi +])# AC_HEADER_MAJOR + + +# AC_HEADER_STAT +# -------------- +# FIXME: Shouldn't this be named AC_HEADER_SYS_STAT? +AC_DEFUN([AC_HEADER_STAT], +[AC_CACHE_CHECK(whether stat file-mode macros are broken, + ac_cv_header_stat_broken, +[AC_EGREP_CPP([You lose], [#include <sys/types.h> +#include <sys/stat.h> + +#if defined(S_ISBLK) && defined(S_IFDIR) +# if S_ISBLK (S_IFDIR) +You lose. +# endif +#endif + +#if defined(S_ISBLK) && defined(S_IFCHR) +# if S_ISBLK (S_IFCHR) +You lose. +# endif +#endif + +#if defined(S_ISLNK) && defined(S_IFREG) +# if S_ISLNK (S_IFREG) +You lose. +# endif +#endif + +#if defined(S_ISSOCK) && defined(S_IFREG) +# if S_ISSOCK (S_IFREG) +You lose. +# endif +#endif +], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)]) +if test $ac_cv_header_stat_broken = yes; then + AC_DEFINE(STAT_MACROS_BROKEN, 1, + [Define if the `S_IS*' macros in <sys/stat.h> do not + work properly.]) +fi +])# AC_HEADER_STAT + + +# AC_HEADER_STDC +# -------------- +AC_DEFUN([AC_HEADER_STDC], +[AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc, +[AC_TRY_CPP([#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +], ac_cv_header_stdc=yes, ac_cv_header_stdc=no) + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no) +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no) +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + AC_TRY_RUN( +[#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main (void) +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + $ac_main_return(2); + $ac_main_return (0); +}], , ac_cv_header_stdc=no, :) +fi]) +if test $ac_cv_header_stdc = yes; then + AC_DEFINE(STDC_HEADERS, 1, [Define if you have the ANSI C header files.]) +fi +])# AC_HEADER_STDC + + +# AC_HEADER_SYS_WAIT +# ------------------ +AC_DEFUN([AC_HEADER_SYS_WAIT], +[AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible], + ac_cv_header_sys_wait_h, +[AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([#include <sys/types.h> +#include <sys/wait.h> +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +], +[ int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;])], + [ac_cv_header_sys_wait_h=yes], + [ac_cv_header_sys_wait_h=no])]) +if test $ac_cv_header_sys_wait_h = yes; then + AC_DEFINE(HAVE_SYS_WAIT_H, 1, + [Define if you have <sys/wait.h> that is POSIX.1 compatible.]) +fi +])# AC_HEADER_SYS_WAIT + + +# AC_HEADER_TIME +# -------------- +AC_DEFUN([AC_HEADER_TIME], +[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included], + ac_cv_header_time, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h> +#include <sys/time.h> +#include <time.h> +], +[if ((struct tm *) 0) +return 0;])], + [ac_cv_header_time=yes], + [ac_cv_header_time=no])]) +if test $ac_cv_header_time = yes; then + AC_DEFINE(TIME_WITH_SYS_TIME, 1, + [Define if you can safely include both <sys/time.h> and <time.h>.]) +fi +])# AC_HEADER_TIME + + +# _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H +# ---------------------------------- +m4_define([_AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H], +[AC_CACHE_CHECK([whether termios.h defines TIOCGWINSZ], + ac_cv_sys_tiocgwinsz_in_termios_h, +[AC_EGREP_CPP([yes], + [#include <sys/types.h> +#include <termios.h> +#ifdef TIOCGWINSZ + yes +#endif +], + ac_cv_sys_tiocgwinsz_in_termios_h=yes, + ac_cv_sys_tiocgwinsz_in_termios_h=no)]) +])# _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H + + +# _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL +# ---------------------------------- +m4_define([_AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL], +[AC_CACHE_CHECK([whether sys/ioctl.h defines TIOCGWINSZ], + ac_cv_sys_tiocgwinsz_in_sys_ioctl_h, +[AC_EGREP_CPP([yes], + [#include <sys/types.h> +#include <sys/ioctl.h> +#ifdef TIOCGWINSZ + yes +#endif +], + ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes, + ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no)]) +])# _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL + + +# AC_HEADER_TIOCGWINSZ +# -------------------- +# Look for a header that defines TIOCGWINSZ. +# FIXME: Is this the proper name? Is this the proper implementation? +# I need more help. +AC_DEFUN([AC_HEADER_TIOCGWINSZ], +[AC_REQUIRE([AC_SYS_POSIX_TERMIOS])dnl +if test $ac_cv_sys_posix_termios = yes; then + _AC_HEADER_TIOCGWINSZ_IN_TERMIOS_H +fi +if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then + _AC_HEADER_TIOCGWINSZ_IN_SYS_IOCTL + if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then + AC_DEFINE(GWINSZ_IN_SYS_IOCTL,1, + [Define if `TIOCGWINSZ' requires <sys/ioctl.h>]) + fi +fi +])# AC_HEADER_TIOCGWINSZ + + +# AU::AC_UNISTD_H +# --------------- +AU_DEFUN([AC_UNISTD_H], +[AC_CHECK_HEADERS(unistd.h)]) + + +# AU::AC_USG +# ---------- +# Define `USG' if string functions are in strings.h. +AU_DEFUN([AC_USG], +[AC_DIAGNOSE([obsolete], +[$0: Remove `AC_MSG_CHECKING', `AC_TRY_LINK' and this `AC_WARNING' +when you adjust your code to use HAVE_STRING_H.])dnl +AC_MSG_CHECKING([for BSD string and memory functions]) +AC_TRY_LINK([@%:@include <strings.h>], [rindex(0, 0); bzero(0, 0);], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_DEFINE(USG, 1, + [Define if you do not have <strings.h>, index, bzero, etc... + This symbol is obsolete, you should not depend upon it.])]) +AC_CHECK_HEADERS(string.h)]) + + +# AU::AC_MEMORY_H +# --------------- +# To be precise this macro used to be: +# +# | AC_MSG_CHECKING(whether string.h declares mem functions) +# | AC_EGREP_HEADER(memchr, string.h, ac_found=yes, ac_found=no) +# | AC_MSG_RESULT($ac_found) +# | if test $ac_found = no; then +# | AC_CHECK_HEADER(memory.h, [AC_DEFINE(NEED_MEMORY_H)]) +# | fi +# +# But it is better to check for both headers, and alias NEED_MEMORY_H to +# HAVE_MEMORY_H. +AU_DEFUN([AC_MEMORY_H], +[AC_DIAGNOSE([obsolete], [$0: Remove this warning and +`AC_CHECK_HEADER(memory.h, AC_DEFINE(...))' when you adjust your code to +use and HAVE_STRING_H and HAVE_MEMORY_H, not NEED_MEMORY_H.])dnl +AC_CHECK_HEADER(memory.h, + [AC_DEFINE([NEED_MEMORY_H], 1, + [Same as `HAVE_MEMORY_H', don't depend on me.])]) +AC_CHECK_HEADERS(string.h memory.h) +]) + + +# AU::AC_DIR_HEADER +# ----------------- +# Like calling `AC_HEADER_DIRENT' and `AC_FUNC_CLOSEDIR_VOID', but +# defines a different set of C preprocessor macros to indicate which +# header file is found. +AU_DEFUN([AC_DIR_HEADER], +[AC_HEADER_DIRENT +AC_FUNC_CLOSEDIR_VOID +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the four `AC_DEFINE' when you +adjust your code to use `AC_HEADER_DIRENT'.]) +test ac_cv_header_dirent_dirent_h && + AC_DEFINE([DIRENT], 1, [Same as `HAVE_DIRENT_H', don't depend on me.]) +test ac_cv_header_dirent_sys_ndir_h && + AC_DEFINE([SYSNDIR], 1, [Same as `HAVE_SYS_NDIR_H', don't depend on me.]) +test ac_cv_header_dirent_sys_dir_h && + AC_DEFINE([SYSDIR], 1, [Same as `HAVE_SYS_DIR_H', don't depend on me.]) +test ac_cv_header_dirent_ndir_h && + AC_DEFINE([NDIR], 1, [Same as `HAVE_NDIR_H', don't depend on me.]) +]) diff --git a/acidentifiers b/acidentifiers new file mode 100644 index 0000000..8c6059b --- /dev/null +++ b/acidentifiers @@ -0,0 +1,57 @@ +# acindentifiers -- autoscan's mapping from identifiers which are not +# involved in function calls to Autoconf macros. +# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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. + +# Keywords. +const AC_C_CONST +inline AC_C_INLINE + +# Variables. +sys_siglist AC_DECL_SYS_SIGLIST + +# Types. +gid_t AC_TYPE_UID_T +mode_t AC_TYPE_MODE_T +obstack AC_FUNC_OBSTACK +off_t AC_TYPE_OFF_T +pid_t AC_TYPE_PID_T +ptrdiff_t AC_CHECK_TYPES +size_t AC_TYPE_SIZE_T +timeval AC_HEADER_TIME +tm AC_STRUCT_TM +uid_t AC_TYPE_UID_T + +# Macros. +S_ISBLK AC_HEADER_STAT +S_ISCHR AC_HEADER_STAT +S_ISDIR AC_HEADER_STAT +S_ISFIFO AC_HEADER_STAT +S_ISLNK AC_HEADER_STAT +S_ISREG AC_HEADER_STAT +S_ISSOCK AC_HEADER_STAT + +# Members of structures. +st_blksize AC_CHECK_MEMBERS([struct stat.st_blksize]) +st_blocks AC_STRUCT_ST_BLOCKS +st_rdev AC_CHECK_MEMBERS([struct stat.st_rdev]) +tm_zone AC_STRUCT_TIMEZONE + +# Local Variables: +# mode: shell-script +# End: diff --git a/aclang.m4 b/aclang.m4 new file mode 100644 index 0000000..0cbd799 --- /dev/null +++ b/aclang.m4 @@ -0,0 +1,2194 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# Programming languages support. +#------------------------------------------------------------------------------ +# Copyright 2020-2021,2023 Thomas E. Dickey +# Copyright 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by David MacKenzie, with help from +# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +# Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +# Table of Contents: +# +# 1. Language selection +# and routines to produce programs in a given language. +# a. generic routines +# b. C +# c. C++ +# d. Fortran 77 +# +# 2. Producing programs in a given language. +# a. generic routines +# b. C +# c. C++ +# d. Fortran 77 +# +# 3. Looking for a compiler +# And possibly the associated preprocessor. +# a. Generic routines. +# b. C +# c. C++ +# d. Fortran 77 +# +# 4. Compilers' characteristics. +# a. Generic routines. +# b. C +# c. C++ +# d. Fortran 77 + + + +## ----------------------- ## +## 1. Language selection. ## +## ----------------------- ## + + + +# -------------------------------- # +# 1a. Generic language selection. # +# -------------------------------- # + +# AC_LANG_CASE(LANG1, IF-LANG1, LANG2, IF-LANG2, ..., DEFAULT) +# ------------------------------------------------------------ +# Expand into IF-LANG1 if the current language is LANG1 etc. else +# into default. +m4_define([AC_LANG_CASE], +[m4_case(_AC_LANG, $@)]) + + +# _AC_LANG_DISPATCH(MACRO, LANG, ARGS) +# ------------------------------------ +# Call the specialization of MACRO for LANG with ARGS. Complain if +# unavailable. +m4_define([_AC_LANG_DISPATCH], +[m4_ifdef([$1($2)], + [m4_indir([$1($2)], m4_shiftn(2, $@))], + [AC_FATAL([$1: unknown language: $2])])]) + + +# _AC_LANG_SET(OLD, NEW) +# ---------------------- +# Output the shell code needed to switch from OLD language to NEW language. +# Do not try to optimize like this: +# +# m4_defun([_AC_LANG_SET], +# [m4_if([$1], [$2], [], +# [_AC_LANG_DISPATCH([AC_LANG], [$2])])]) +# +# as it can introduce differences between the sh-current language and the +# m4-current-language when m4_require is used. Something more subtle +# might be possible, but at least for the time being, play it safe. +m4_defun([_AC_LANG_SET], +[_AC_LANG_DISPATCH([AC_LANG], [$2])]) + + +# AC_LANG(LANG) +# ------------- +# Set the current language to LANG. +m4_defun([AC_LANG], +[_AC_LANG_SET(m4_ifdef([_AC_LANG], [m4_defn([_AC_LANG])]), + [$1])dnl +m4_define([_AC_LANG], [$1])]) + + +# AC_LANG_PUSH(LANG) +# ------------------ +# Save the current language, and use LANG. +m4_defun([AC_LANG_PUSH], +[_AC_LANG_SET(m4_ifdef([_AC_LANG], [m4_defn([_AC_LANG])]), + [$1])dnl +m4_pushdef([_AC_LANG], [$1])]) + + +# AC_LANG_POP([LANG]) +# ------------------- +# If given, check that the current language is LANG, and restore the +# previous language. +m4_defun([AC_LANG_POP], +[m4_ifval([$1], + [m4_if([$1], m4_defn([_AC_LANG]), [], + [m4_fatal([$0($1): unexpected current language: ]m4_defn([_AC_LANG]))])])dnl +m4_pushdef([$0 OLD], m4_defn([_AC_LANG]))dnl +m4_popdef([_AC_LANG])dnl +_AC_LANG_SET(m4_defn([$0 OLD]), m4_defn([_AC_LANG]))dnl +m4_popdef([$0 OLD])dnl +]) + + +# AC_LANG_SAVE +# ------------ +# Save the current language, but don't change language. +AU_DEFUN([AC_LANG_SAVE], +[AC_DIAGNOSE([obsolete], + [instead of using `AC_LANG', `AC_LANG_SAVE', +and `AC_LANG_RESTORE', you should use `AC_LANG_PUSH' and `AC_LANG_POP'.]) +m4_pushdef([_AC_LANG], _AC_LANG)]) + + +# AC_LANG_RESTORE +# --------------- +# Restore the current language from the stack. +AU_DEFUN([AC_LANG_RESTORE], [AC_LANG_POP($@)]) + + +# _AC_LANG_ABBREV +# --------------- +# Return a short signature of _AC_LANG which can be used in shell +# variable names, or in M4 macro names. +m4_defun([_AC_LANG_ABBREV], +[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) + + +# AC_LANG_ASSERT(LANG) +# -------------------- +# Current language must be LANG. +m4_defun([AC_LANG_ASSERT], +[m4_if(_AC_LANG, $1, [], + [m4_fatal([$0: current language is not $1: ] _AC_LANG)])]) + + + +# -------------------- # +# 1b. The C language. # +# -------------------- # + + +# AC_LANG(C) +# ---------- +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +m4_define([AC_LANG(C)], +[ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD' +ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&AS_MESSAGE_LOG_FD' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return="return" +]) + + +# AC_LANG_C +# --------- +AU_DEFUN([AC_LANG_C], [AC_LANG(C)]) + + +# _AC_LANG_ABBREV(C) +# ------------------ +m4_define([_AC_LANG_ABBREV(C)], [c]) + + +# ---------------------- # +# 1c. The C++ language. # +# ---------------------- # + + +# AC_LANG(C++) +# ------------ +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +m4_define([AC_LANG(C++)], +[ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD' +ac_link='$CXX -o "conftest$ac_exeext" $CXXFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&AS_MESSAGE_LOG_FD' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +ac_main_return="return" +]) + + +# AC_LANG_CPLUSPLUS +# ----------------- +AU_DEFUN([AC_LANG_CPLUSPLUS], [AC_LANG(C++)]) + + +# _AC_LANG_ABBREV(C++) +# -------------------- +m4_define([_AC_LANG_ABBREV(C++)], [cxx]) + + +# ----------------------------- # +# 1d. The Fortran 77 language. # +# ----------------------------- # + + +# AC_LANG(Fortran 77) +# ------------------- +m4_define([AC_LANG(Fortran 77)], +[ac_ext=f +ac_compile='$F77 -c $FFLAGS "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD' +ac_link='$F77 -o "conftest$ac_exeext" $FFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&AS_MESSAGE_LOG_FD' +ac_compiler_gnu=$ac_cv_f77_compiler_gnu +]) + + +# AC_LANG_FORTRAN77 +# ----------------- +AU_DEFUN([AC_LANG_FORTRAN77], [AC_LANG(Fortran 77)]) + + +# _AC_LANG_ABBREV(Fortran 77) +# --------------------------- +m4_define([_AC_LANG_ABBREV(Fortran 77)], [f77]) + + + +## ---------------------- ## +## 2.Producing programs. ## +## ---------------------- ## + + +# ---------------------- # +# 2a. Generic routines. # +# ---------------------- # + + +# AC_LANG_CONFTEST(BODY) +# ---------------------- +# Save the BODY in `conftest.$ac_ext'. Add a trailing new line. +m4_define([AC_LANG_CONFTEST], +[cat >"conftest.$ac_ext" <<_ACEOF +$1 +_ACEOF]) + + +# AC_LANG_SOURCE(BODY) +# -------------------- +# Produce a valid source for the current language, which includes the +# BODY, and as much as possible `confdefs.h' and the `#line' sync +# lines. +AC_DEFUN([AC_LANG_SOURCE], +[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) + + +# AC_LANG_PROGRAM([PROLOGUE], [BODY]) +# ----------------------------------- +# Produce a valid source for the current language. Prepend the +# PROLOGUE (typically CPP directives and/or declarations) to an +# execution the BODY (typically glued inside the `main' function, or +# equivalent). +AC_DEFUN([AC_LANG_PROGRAM], +[AC_LANG_SOURCE([_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])]) + + +# AC_LANG_CALL(PROLOGUE, FUNCTION) +# -------------------------------- +# Call the FUNCTION. +AC_DEFUN([AC_LANG_CALL], +[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) + + +# AC_LANG_FUNC_LINK_TRY(FUNCTION) +# ------------------------------- +# Produce a source which links correctly iff the FUNCTION exists. +AC_DEFUN([AC_LANG_FUNC_LINK_TRY], +[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) + + +# AC_LANG_BOOL_COMPILE_TRY(PROLOGUE, EXPRESSION) +# ---------------------------------------------- +# Produce a program that compiles with success iff the boolean EXPRESSION +# evaluates to true at compile time. +AC_DEFUN([AC_LANG_BOOL_COMPILE_TRY], +[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) + + +# AC_LANG_INT_SAVE(PROLOGUE, EXPRESSION) +# -------------------------------------- +# Produce a program that saves the runtime evaluation of the integer +# EXPRESSION into `conftest.val'. +AC_DEFUN([AC_LANG_INT_SAVE], +[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) + + +# --------------- # +# 2b. C sources. # +# --------------- # + +# AC_LANG_SOURCE(C)(BODY) +# ----------------------- +# This sometimes fails to find confdefs.h, for some reason. +# #line __oline__ "$[0]" +m4_define([AC_LANG_SOURCE(C)], +[#line __oline__ "configure" +#include "confdefs.h" +$1]) + + +# AC_LANG_PROGRAM(C)([PROLOGUE], [BODY]) +# -------------------------------------- +# If AC_F77_DUMMY_MAIN was run, then any C/C++ program might be linked +# against Fortran code, hence a dummy main might be needed. +m4_define([AC_LANG_PROGRAM(C)], +[$1 +m4_ifdef([_AC_LANG_PROGRAM_C_F77_HOOKS], [_AC_LANG_PROGRAM_C_F77_HOOKS()])dnl +int +main (void) +{ +dnl Do *not* indent the following line: there may be CPP directives. +dnl Don't move the `;' right after for the same reason. +$2 + ; + return 0; +}]) + + +# AC_LANG_CALL(C)(PROLOGUE, FUNCTION) +# ----------------------------------- +# Avoid conflicting decl of main. +m4_define([AC_LANG_CALL(C)], +[AC_LANG_PROGRAM([$1 +m4_if([$2], [main], , +[/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $2 (void);])], [$2 ();])]) + + +# AC_LANG_FUNC_LINK_TRY(C)(FUNCTION) +# ---------------------------------- +# This test used to merely assign f=$1 in main(), but that was optimized away +# by HP unbundled cc A.05.36 for ia64 under +O3, presumably because the program +# is about to exit. Conversely, the AIX linker optimizes an unused external +# declaration that initializes f=$1. Therefore, the test program has both an +# external initialization of f, as well as using f in a way that affects the +# exit status. +# +m4_define([AC_LANG_FUNC_LINK_TRY(C)], +[AC_LANG_PROGRAM( +[#define $1 autoconf_temporary +#include <limits.h> /* least-intrusive standard header which defines gcc2 __stub macros */ +#undef $1 + +#ifdef __cplusplus +extern "C" +#endif + +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $1 (void); +],[ +/* The GNU C library defines stubs 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_$1) || defined (__stub___$1) +#error found stub for $1 +#endif + + return $1 ();])]) + + +# AC_LANG_BOOL_COMPILE_TRY(C)(PROLOGUE, EXPRESSION) +# ------------------------------------------------- +m4_define([AC_LANG_BOOL_COMPILE_TRY(C)], +[AC_LANG_PROGRAM([$1], [int _array_ @<:@1 - 2 * !($2)@:>@])]) + + +# AC_LANG_INT_SAVE(C)(PROLOGUE, EXPRESSION) +# ----------------------------------------- +# We need `stdio.h' to open a `FILE', so the prologue defaults to the +# inclusion of `stdio.h'. +m4_define([AC_LANG_INT_SAVE(C)], +[AC_LANG_PROGRAM([m4_default([$1], [@%:@include <stdio.h>])], +[FILE *f = fopen ("conftest.val", "w"); +if (!f) + $ac_main_return (1); +fprintf (f, "%ld", (long)($2)); +fclose (f);])]) + + +# ----------------- # +# 2c. C++ sources. # +# ----------------- # + +# AC_LANG_SOURCE(C++)(BODY) +# ------------------------- +m4_copy([AC_LANG_SOURCE(C)], [AC_LANG_SOURCE(C++)]) + + +# AC_LANG_PROGRAM(C++)([PROLOGUE], [BODY]) +# ---------------------------------------- +m4_copy([AC_LANG_PROGRAM(C)], [AC_LANG_PROGRAM(C++)]) + + +# AC_LANG_CALL(C++)(PROLOGUE, FUNCTION) +# ------------------------------------- +m4_copy([AC_LANG_CALL(C)], [AC_LANG_CALL(C++)]) + + +# AC_LANG_FUNC_LINK_TRY(C++)(FUNCTION) +# ------------------------------------ +m4_copy([AC_LANG_FUNC_LINK_TRY(C)], [AC_LANG_FUNC_LINK_TRY(C++)]) + + +# AC_LANG_BOOL_COMPILE_TRY(C++)(PROLOGUE, EXPRESSION) +# --------------------------------------------------- +m4_copy([AC_LANG_BOOL_COMPILE_TRY(C)], [AC_LANG_BOOL_COMPILE_TRY(C++)]) + + +# AC_LANG_INT_SAVE(C++)(PROLOGUE, EXPRESSION) +# ------------------------------------------- +m4_copy([AC_LANG_INT_SAVE(C)], [AC_LANG_INT_SAVE(C++)]) + + + +# ------------------------ # +# 2d. Fortran 77 sources. # +# ------------------------ # + +# AC_LANG_SOURCE(Fortran 77)(BODY) +# -------------------------------- +# FIXME: Apparently, according to former AC_TRY_COMPILER, the CPP +# directives must not be included. But AC_TRY_RUN_NATIVE was not +# avoiding them, so? +m4_define([AC_LANG_SOURCE(Fortran 77)], +[$1]) + + +# AC_LANG_PROGRAM(Fortran 77)([PROLOGUE], [BODY]) +# ----------------------------------------------- +# Yes, we discard the PROLOGUE. +m4_define([AC_LANG_PROGRAM(Fortran 77)], +[m4_ifval([$1], + [m4_warn([syntax], [$0: ignoring PROLOGUE: $1])])dnl + program main +$2 + end]) + + +# AC_LANG_CALL(Fortran 77)(PROLOGUE, FUNCTION) +# -------------------------------------------- +# FIXME: This is a guess, help! +m4_define([AC_LANG_CALL(Fortran 77)], +[AC_LANG_PROGRAM([$1], +[ call $2])]) + + + + +## -------------------------------------------- ## +## 3. Looking for Compilers and Preprocessors. ## +## -------------------------------------------- ## + +# ----------------------------------------------------- # +# 3a. Generic routines in compilers and preprocessors. # +# ----------------------------------------------------- # + +# AC_LANG_COMPILER +# ---------------- +# Find a compiler for the current LANG. Be sure to be run before +# AC_LANG_PREPROC. +# +# Note that because we might AC_REQUIRE `AC_LANG_COMPILER(C)' for +# instance, the latter must be AC_DEFUN'd, not just define'd. +m4_define([AC_LANG_COMPILER], +[AC_BEFORE([AC_LANG_COMPILER(]_AC_LANG[)], + [AC_LANG_PREPROC(]_AC_LANG[)])dnl +_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) + + +# AC_LANG_COMPILER_REQUIRE +# ------------------------ +# Ensure we have a compiler for the current LANG. +AC_DEFUN([AC_LANG_COMPILER_REQUIRE], +[m4_require([AC_LANG_COMPILER(]_AC_LANG[)], + [AC_LANG_COMPILER])]) + + + +# _AC_LANG_COMPILER_GNU +# --------------------- +# Check whether the compiler for the current language is GNU. +# +# It doesn't seem necessary right now to have a different source +# according to the current language, since this works fine. Some day +# it might be needed. Nevertheless, pay attention to the fact that +# the position of `choke me' on the seventh column is meant: otherwise +# some Fortran compilers (e.g., SGI) might consider it's a +# continuation line, and warn instead of reporting an error. +m4_define([_AC_LANG_COMPILER_GNU], +[AC_CACHE_CHECK([whether we are using the GNU _AC_LANG compiler], + [ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu], +[_AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[#ifndef __GNUC__ + choke me +#endif +]])], + [ac_compiler_gnu=yes], + [ac_compiler_gnu=no]) +ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu=$ac_compiler_gnu +])])# _AC_LANG_COMPILER_GNU + + +# AC_LANG_PREPROC +# --------------- +# Find a preprocessor for the current language. Note that because we +# might AC_REQUIRE `AC_LANG_PREPROC(C)' for instance, the latter must +# be AC_DEFUN'd, not just define'd. Since the preprocessor depends +# upon the compiler, look for the compiler. +m4_define([AC_LANG_PREPROC], +[AC_LANG_COMPILER_REQUIRE()dnl +_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) + + +# AC_LANG_PREPROC_REQUIRE +# ----------------------- +# Ensure we have a preprocessor for the current language. +AC_DEFUN([AC_LANG_PREPROC_REQUIRE], +[m4_require([AC_LANG_PREPROC(]_AC_LANG[)], + [AC_LANG_PREPROC])]) + + +# AC_REQUIRE_CPP +# -------------- +# Require the preprocessor for the current language. +# FIXME: AU_ALIAS once AC_LANG is officially documented (2.51?). +AC_DEFUN([AC_REQUIRE_CPP], +[AC_LANG_PREPROC_REQUIRE]) + + + +# AC_NO_EXECUTABLES +# ----------------- +# FIXME: The GCC team has specific needs which the current Autoconf +# framework cannot solve elegantly. This macro implements a dirty +# hack until Autoconf is able to provide the services its users +# needs. +# +# Several of the support libraries that are often built with GCC can't +# assume the tool-chain is already capable of linking a program: the +# compiler often expects to be able to link with some of such +# libraries. +# +# In several of these libraries, work-arounds have been introduced to +# avoid the AC_PROG_CC_WORKS test, that would just abort their +# configuration. The introduction of AC_EXEEXT, enabled either by +# libtool or by CVS autoconf, have just made matters worse. +AC_DEFUN_ONCE([AC_NO_EXECUTABLES], +[m4_divert_push([KILL]) + +AC_BEFORE([$0], [_AC_COMPILER_EXEEXT_WORKS]) +AC_BEFORE([$0], [_AC_COMPILER_EXEEXT]) + +m4_define([_AC_COMPILER_EXEEXT_WORKS], +[cross_compiling=maybe +]) + +m4_define([_AC_COMPILER_EXEEXT], +[EXEEXT= +]) + +m4_define([AC_LINK_IFELSE], +[AC_FATAL([All the tests involving linking were disabled by $0])]) + +m4_divert_pop()dnl +])# AC_NO_EXECUTABLES + + + +# ----------------------------- # +# Computing EXEEXT and OBJEXT. # +# ----------------------------- # + + +# Files to ignore +# --------------- +# Ignore .d files produced by CFLAGS=-MD. +# +# On UWIN (which uses a cc wrapper for MSVC), the compiler also generates +# a .pdb file +# +# When the w32 free Borland C++ command line compiler links a program +# (conftest.exe), it also produces a file named `conftest.tds' in +# addition to `conftest.obj' + + +# We must not AU define them, because autoupdate would then remove +# them, which is right, but Automake 1.4 would remove the support for +# $(EXEEXT) etc. +# FIXME: Remove this once Automake fixed. +AC_DEFUN([AC_EXEEXT], []) +AC_DEFUN([AC_OBJEXT], []) + + +# _AC_COMPILER_EXEEXT_DEFAULT +# --------------------------- +# Check for the extension used for the default name for executables. +# Beware of `expr' that may return `0' or `'. Since this macro is +# the first one in touch with the compiler, it should also check that +# it compiles properly. +m4_define([_AC_COMPILER_EXEEXT_DEFAULT], +[# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +AC_MSG_CHECKING([for _AC_LANG compiler default output]) +ac_link_default=`echo "$ac_link" | sed ['s/ -o *"conftest[^"]*"//']` +AS_IF([AC_TRY_EVAL(ac_link_default)], +[# Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. +for ac_file in `ls a.exe conftest.exe 2>/dev/null; + ls a.out conftest 2>/dev/null; + ls a.* conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']` + # FIXME: I believe we export ac_cv_exeext for Libtool --akim. + export ac_cv_exeext + break;; + * ) break;; + esac +done], + [echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD +cat "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD +AC_MSG_ERROR([_AC_LANG compiler cannot create executables], 77)]) +ac_exeext=$ac_cv_exeext +AC_MSG_RESULT([$ac_file]) +])# _AC_COMPILER_EXEEXT_DEFAULT + + +# _AC_COMPILER_EXEEXT_WORKS +# ------------------------- +m4_define([_AC_COMPILER_EXEEXT_WORKS], +[# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +AC_MSG_CHECKING([whether the _AC_LANG compiler works]) +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if AC_TRY_COMMAND([./$ac_file]); then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + AC_MSG_ERROR([cannot run _AC_LANG compiled programs. +If you meant to cross compile, use `--host'.]) + fi + fi +fi +AC_MSG_RESULT([yes]) +])# _AC_COMPILER_EXEEXT_WORKS + + +# _AC_COMPILER_EXEEXT_CROSS +# ------------------------- +m4_define([_AC_COMPILER_EXEEXT_CROSS], +[# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +AC_MSG_CHECKING([whether we are cross compiling]) +AC_MSG_RESULT([$cross_compiling]) +])# _AC_COMPILER_EXEEXT_CROSS + + +# _AC_COMPILER_EXEEXT_O +# --------------------- +# Check for the extension used when `-o foo'. Try to see if ac_cv_exeext, +# as computed by _AC_COMPILER_EXEEXT_DEFAULT is OK. +m4_define([_AC_COMPILER_EXEEXT_O], +[AC_MSG_CHECKING([for executable suffix]) +AS_IF([AC_TRY_EVAL(ac_link)], +[# If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : ['[^.]*\(\..*\)']` + export ac_cv_exeext + break;; + * ) break;; + esac +done], + [AC_MSG_ERROR([cannot compute EXEEXT: cannot compile and link])]) +rm -f "conftest$ac_cv_exeext" +AC_MSG_RESULT([$ac_cv_exeext]) +])# _AC_COMPILER_EXEEXT_O + + +# _AC_COMPILER_EXEEXT +# ------------------- +# Check for the extension used for executables. It compiles a test +# executable. If this is called, the executable extensions will be +# automatically used by link commands run by the configure script. +# +# Note that some compilers (cross or not), strictly obey to `-o foo' while +# the host requires `foo.exe', so we should not depend upon `-o' to +# test EXEEXT. But then, be sure no to destroy user files. +# +# Must be run before _AC_COMPILER_OBJEXT because _AC_COMPILER_EXEEXT_DEFAULT +# checks whether the compiler works. +m4_define([_AC_COMPILER_EXEEXT], +[AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +_AC_COMPILER_EXEEXT_DEFAULT +_AC_COMPILER_EXEEXT_WORKS +rm -f a.out a.exe "conftest$ac_cv_exeext" +ac_clean_files=$ac_clean_files_save +_AC_COMPILER_EXEEXT_CROSS +_AC_COMPILER_EXEEXT_O +rm -f "conftest.$ac_ext" +AC_SUBST([EXEEXT], [$ac_cv_exeext])dnl +ac_exeext=$EXEEXT +])# _AC_COMPILER_EXEEXT + + +# _AC_COMPILER_OBJEXT +# ------------------- +# Check the object extension used by the compiler: typically `.o' or +# `.obj'. If this is called, some other behaviour will change, +# determined by ac_objext. +# +# This macro is called by AC_LANG_COMPILER, the latter being required +# by the AC_COMPILE_IFELSE macros, so use _AC_COMPILE_IFELSE. And in fact, +# don't, since _AC_COMPILE_IFELSE needs to know ac_objext for the `test -s' +# it includes. So do it by hand. +m4_define([_AC_COMPILER_OBJEXT], +[AC_CACHE_CHECK([for object suffix], ac_cv_objext, +[AC_LANG_CONFTEST([AC_LANG_PROGRAM()]) +rm -f conftest.o conftest.obj +AS_IF([AC_TRY_EVAL(ac_compile)], +[for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.dbg | *.pdb | *.xSYM | *.map | *.inf ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done], + [echo "$as_me: failed program was:" >&AS_MESSAGE_LOG_FD +cat "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD +AC_MSG_ERROR([cannot compute OBJEXT: cannot compile])]) +rm -f "conftest.$ac_cv_objext" "conftest.$ac_ext"]) +AC_SUBST([OBJEXT], [$ac_cv_objext])dnl +ac_objext=$OBJEXT +])# _AC_COMPILER_OBJEXT + + +# -------------------- # +# 3b. The C compiler. # +# -------------------- # + + +# _AC_ARG_VAR_CPPFLAGS +# -------------------- +# Document and register CPPFLAGS, which is used by +# AC_PROG_{CC, CPP, CXX, CXXCPP}. +AC_DEFUN([_AC_ARG_VAR_CPPFLAGS], +[AC_ARG_VAR([CPPFLAGS], + [C/C++ preprocessor flags, e.g. -I<include dir> if you have + headers in a nonstandard directory <include dir>])]) + + +# _AC_ARG_VAR_LDFLAGS +# ------------------- +# Document and register LDFLAGS, which is used by +# AC_PROG_{CC, CXX, F77}. +AC_DEFUN([_AC_ARG_VAR_LDFLAGS], +[AC_ARG_VAR([LDFLAGS], + [linker flags, e.g. -L<lib dir> if you have libraries in a + nonstandard directory <lib dir>])]) + + + +# AC_LANG_PREPROC(C) +# ------------------- +# Find the C preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able. +AC_DEFUN([AC_LANG_PREPROC(C)], +[AC_REQUIRE([AC_PROG_CPP])]) + + +# _AC_PROG_PREPROC_WORKS_IFELSE(IF-WORKS, IF-NOT) +# ----------------------------------------------- +# Check if $ac_cpp is a working preprocessor that can flag absent +# includes either by the exit status or by warnings. +# Set ac_cpp_err to a non-empty value if the preprocessor failed. +# This macro is for all languages, not only C. +AC_DEFUN([_AC_PROG_PREPROC_WORKS_IFELSE], +[ac_preproc_ok=false +for ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <assert.h> + Syntax error]])], + [], + [# Broken: fails on valid input. +continue]) + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + _AC_PREPROC_IFELSE([AC_LANG_SOURCE([[@%:@include <ac_nonexistent.h>]])], + [# Broken: success on invalid input. +continue], + [# Passes both tests. +ac_preproc_ok=: +break]) + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err "conftest.$ac_ext" +AS_IF([$ac_preproc_ok], [$1], [$2])])# _AC_PROG_PREPROC_WORKS_IFELSE + + +# AC_PROG_CPP +# ----------- +# Find a working C preprocessor. +# We shouldn't have to require AC_PROG_CC, but this is due to the concurrency +# between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_CC. +AC_DEFUN([AC_PROG_CPP], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_ARG_VAR([CPP], [C preprocessor])dnl +_AC_ARG_VAR_CPPFLAGS()dnl +AC_LANG_PUSH(C)dnl +AC_MSG_CHECKING([how to run the C preprocessor]) +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + AC_CACHE_VAL([ac_cv_prog_CPP], + [dnl + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + _AC_PROG_PREPROC_WORKS_IFELSE([break]) + done + ac_cv_prog_CPP=$CPP + ])dnl + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +AC_MSG_RESULT([$CPP]) +_AC_PROG_PREPROC_WORKS_IFELSE([], + [AC_MSG_ERROR([C preprocessor "$CPP" fails sanity check])]) +AC_SUBST(CPP)dnl +AC_LANG_POP(C)dnl +])# AC_PROG_CPP + + +# AC_LANG_COMPILER(C) +# ------------------- +# Find the C compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able. +AC_DEFUN([AC_LANG_COMPILER(C)], +[AC_REQUIRE([AC_PROG_CC])]) + + +# ac_cv_prog_gcc +# -------------- +# We used to name the cache variable this way. +AU_DEFUN([ac_cv_prog_gcc], +[ac_cv_c_compiler_gnu]) + + +# AC_PROG_CC([COMPILER ...]) +# -------------------------- +# COMPILER ... is a space separated list of C compilers to search for. +# This just gives the user an opportunity to specify an alternative +# search list for the C compiler. +AC_DEFUN([AC_PROG_CC], +[AC_LANG_PUSH(C)dnl +AC_ARG_VAR([CC], [C compiler command])dnl +AC_ARG_VAR([CFLAGS], [C compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +_AC_ARG_VAR_CPPFLAGS()dnl +m4_ifval([$1], + [AC_CHECK_TOOLS(CC, [$1])], +[AC_CHECK_TOOL(CC, gcc) +if test -z "$CC"; then + AC_CHECK_TOOL(CC, cc) +fi +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) +fi +if test -z "$CC"; then + AC_CHECK_TOOLS(CC, cl) +fi +]) + +test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) + +# Provide some information about the compiler. +echo "$as_me:__oline__:" \ + "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD +ac_compiler=`set X $ac_compile; echo "$[2]"` +_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD]) +_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD]) +_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD]) + +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl +_AC_LANG_COMPILER_GNU +GCC=`test $ac_compiler_gnu = yes && echo yes` +_AC_PROG_CC_G +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +_AC_COMPILE_IFELSE([@%:@ifndef __cplusplus + choke me +@%:@endif], + [_AC_PROG_CXX_EXIT_DECLARATION]) +AC_LANG_POP(C)dnl +])# AC_PROG_CC + + +# _AC_PROG_CC_G +# ------------- +# Check whether -g works, even if CFLAGS is set, in case the package +# plays around with CFLAGS (such as to build both debugging and normal +# versions of a library), tasteless as that idea is. +m4_define([_AC_PROG_CC_G], +[ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +AC_CACHE_CHECK(whether $CC accepts -g, ac_cv_prog_cc_g, + [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [ac_cv_prog_cc_g=yes], + [ac_cv_prog_cc_g=no])]) +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[]dnl +])# _AC_PROG_CC_G + + +# AC_PROG_GCC_TRADITIONAL +# ----------------------- +AC_DEFUN([AC_PROG_GCC_TRADITIONAL], +[if test $ac_cv_c_compiler_gnu = yes; then + AC_CACHE_CHECK(whether $CC needs -traditional, + ac_cv_prog_gcc_traditional, +[ ac_pattern="Autoconf.*'x'" + AC_EGREP_CPP($ac_pattern, [#include <sgtty.h> +int Autoconf = TIOCGETP;], + ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no) + + if test $ac_cv_prog_gcc_traditional = no; then + AC_EGREP_CPP($ac_pattern, [#include <termio.h> +int Autoconf = TCGETA;], + ac_cv_prog_gcc_traditional=yes) + fi]) + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi +])# AC_PROG_GCC_TRADITIONAL + + +# AC_PROG_CC_C_O +# -------------- +AC_DEFUN([AC_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC])dnl +if test "x$CC" != xcc; then + AC_MSG_CHECKING([whether $CC and cc understand -c and -o together]) +else + AC_MSG_CHECKING([whether cc understands -c and -o together]) +fi +set dummy $CC; ac_cc=`echo $[2] | + sed 's/[[^a-zA-Z0-9_]]/_/g;s/^[[0-9]]/_/'` +AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o, +[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c "conftest.$ac_ext" -o "conftest.$ac_objext" >&AS_MESSAGE_LOG_FD' +if AC_TRY_EVAL(ac_try) && + test -f "conftest.$ac_objext" && AC_TRY_EVAL(ac_try); +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if AC_TRY_COMMAND(cc -c "conftest.$ac_ext" >&AS_MESSAGE_LOG_FD); then + ac_try='cc -c "conftest.$ac_ext" -o "conftest.$ac_objext" >&AS_MESSAGE_LOG_FD' + if AC_TRY_EVAL(ac_try) && + test -f "conftest.$ac_objext" && AC_TRY_EVAL(ac_try); + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -rf conftest* +])dnl +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) + AC_DEFINE(NO_MINUS_C_MINUS_O, 1, + [Define if your C compiler doesn't accept -c and -o together.]) +fi +])# AC_PROG_CC_C_O + + +# ---------------------- # +# 3c. The C++ compiler. # +# ---------------------- # + + +# AC_LANG_PREPROC(C++) +# --------------------- +# Find the C++ preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able. +AC_DEFUN([AC_LANG_PREPROC(C++)], +[AC_REQUIRE([AC_PROG_CXXCPP])]) + + +# AC_PROG_CXXCPP +# -------------- +# Find a working C++ preprocessor. +# We shouldn't have to require AC_PROG_CC, but this is due to the concurrency +# between the AC_LANG_COMPILER_REQUIRE family and that of AC_PROG_CXX. +AC_DEFUN([AC_PROG_CXXCPP], +[AC_REQUIRE([AC_PROG_CXX])dnl +AC_ARG_VAR([CXXCPP], [C++ preprocessor])dnl +_AC_ARG_VAR_CPPFLAGS()dnl +AC_LANG_PUSH(C++)dnl +AC_MSG_CHECKING([how to run the C++ preprocessor]) +if test -z "$CXXCPP"; then + AC_CACHE_VAL(ac_cv_prog_CXXCPP, + [dnl + # Double quotes because CXXCPP needs to be expanded + for CXXCPP in "$CXX -E" "/lib/cpp" + do + _AC_PROG_PREPROC_WORKS_IFELSE([break]) + done + ac_cv_prog_CXXCPP=$CXXCPP + ])dnl + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +AC_MSG_RESULT([$CXXCPP]) +_AC_PROG_PREPROC_WORKS_IFELSE([], + [AC_MSG_ERROR([C++ preprocessor "$CXXCPP" fails sanity check])]) +AC_SUBST(CXXCPP)dnl +AC_LANG_POP(C++)dnl +])# AC_PROG_CXXCPP + + +# AC_LANG_COMPILER(C++) +# --------------------- +# Find the C++ compiler. Must be AC_DEFUN'd to be AC_REQUIRE'able. +AC_DEFUN([AC_LANG_COMPILER(C++)], +[AC_REQUIRE([AC_PROG_CXX])]) + + +# ac_cv_prog_gxx +# -------------- +# We used to name the cache variable this way. +AU_DEFUN([ac_cv_prog_gxx], +[ac_cv_cxx_compiler_gnu]) + + +# AC_PROG_CXX([LIST-OF-COMPILERS]) +# -------------------------------- +# LIST-OF-COMPILERS is a space separated list of C++ compilers to search +# for (if not specified, a default list is used). This just gives the +# user an opportunity to specify an alternative search list for the C++ +# compiler. +# aCC HP-UX C++ compiler much better than `CC', so test before. +# FCC Fujitsu C++ compiler +# KCC KAI C++ compiler +# RCC Rational C++ +# xlC_r AIX C Set++ (with support for reentrant code) +# xlC AIX C Set++ +AC_DEFUN([AC_PROG_CXX], +[AC_LANG_PUSH(C++)dnl +AC_ARG_VAR([CXX], [C++ compiler command])dnl +AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +_AC_ARG_VAR_CPPFLAGS()dnl +AC_CHECK_TOOLS(CXX, + [$CCC m4_default([$1], + [g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC])], + g++) + +# Provide some information about the compiler. +echo "$as_me:__oline__:" \ + "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD +ac_compiler=`set X $ac_compile; echo $[2]` +_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD]) +_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD]) +_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD]) + +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl +_AC_LANG_COMPILER_GNU +GXX=`test $ac_compiler_gnu = yes && echo yes` +_AC_PROG_CXX_G +_AC_PROG_CXX_EXIT_DECLARATION +AC_LANG_POP(C++)dnl +])# AC_PROG_CXX + + +# _AC_PROG_CXX_G +# -------------- +# Check whether -g works, even if CXXFLAGS is set, in case the package +# plays around with CXXFLAGS (such as to build both debugging and +# normal versions of a library), tasteless as that idea is. +m4_define([_AC_PROG_CXX_G], +[ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +AC_CACHE_CHECK(whether $CXX accepts -g, ac_cv_prog_cxx_g, + [_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + [ac_cv_prog_cxx_g=yes], + [ac_cv_prog_cxx_g=no])]) +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi[]dnl +])# _AC_PROG_CXX_G + + +# _AC_PROG_CXX_EXIT_DECLARATION +# ----------------------------- +# Find a valid prototype for exit and declare it in confdefs.h. +m4_define([_AC_PROG_CXX_EXIT_DECLARATION], +[for ac_declaration in \ + ''\ + '#include <stdlib.h>' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <stdlib.h> +$ac_declaration], + [exit (42);])], + [], + [continue]) + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$ac_declaration], + [exit (42);])], + [break]) +done +rm -rf conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo "$ac_declaration" >>confdefs.h + echo '#endif' >>confdefs.h +fi +])# _AC_PROG_CXX_EXIT_DECLARATION + + +# ----------------------------- # +# 3d. The Fortran 77 compiler. # +# ----------------------------- # + + +# AC_LANG_PREPROC(Fortran 77) +# --------------------------- +# Find the Fortran 77 preprocessor. Must be AC_DEFUN'd to be AC_REQUIRE'able. +AC_DEFUN([AC_LANG_PREPROC(Fortran 77)], +[m4_warn([syntax], + [$0: No preprocessor defined for ]_AC_LANG)]) + + +# AC_LANG_COMPILER(Fortran 77) +# ---------------------------- +# Find the Fortran 77 compiler. Must be AC_DEFUN'd to be +# AC_REQUIRE'able. +AC_DEFUN([AC_LANG_COMPILER(Fortran 77)], +[AC_REQUIRE([AC_PROG_F77])]) + + +# ac_cv_prog_g77 +# -------------- +# We used to name the cache variable this way. +AU_DEFUN([ac_cv_prog_g77], +[ac_cv_f77_compiler_gnu]) + + +# AC_PROG_F77([COMPILERS...]) +# --------------------------- +# COMPILERS is a space separated list of Fortran 77 compilers to search +# for. +# Fortran 95 isn't strictly backwards-compatible with Fortran 77, but +# `f95' is worth trying. +# +# Compilers are ordered by +# 1. F77, F90, F95 +# 2. Good/tested native compilers, bad/untested native compilers +# 3. Wrappers around f2c go last. +# +# `fort77' and `fc' are wrappers around `f2c', `fort77' being better. +# It is believed that under HP-UX `fort77' is the name of the native +# compiler. On some Cray systems, fort77 is a native compiler. +# cf77 and cft77 are (older) Cray F77 compilers. +# frt is the Fujitsu F77 compiler. +# pgf77 and pgf90 are the Portland Group F77 and F90 compilers. +# xlf/xlf90/xlf95 are IBM (AIX) F77/F90/F95 compilers. +# lf95 is the Lahey-Fujitsu compiler. +# fl32 is the Microsoft Fortran "PowerStation" compiler. +# af77 is the Apogee F77 compiler for Intergraph hardware running CLIX. +# epcf90 is the "Edinburgh Portable Compiler" F90. +# fort is the Compaq Fortran 90 (now 95) compiler for Tru64 and Linux/Alpha. +AC_DEFUN([AC_PROG_F77], +[AC_LANG_PUSH(Fortran 77)dnl +AC_ARG_VAR([F77], [Fortran 77 compiler command])dnl +AC_ARG_VAR([FFLAGS], [Fortran 77 compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOLS(F77, + [m4_default([$1], + [g77 f77 xlf cf77 cft77 frt pgf77 fl32 af77 fort77 f90 xlf90 pgf90 epcf90 f95 fort xlf95 lf95 g95])]) + +# Provide some information about the compiler. +echo "$as_me:__oline__:" \ + "checking for _AC_LANG compiler version" >&AS_MESSAGE_LOG_FD +ac_compiler=`set X $ac_compile; echo $[2]` +_AC_EVAL([$ac_compiler --version </dev/null >&AS_MESSAGE_LOG_FD]) +_AC_EVAL([$ac_compiler -v </dev/null >&AS_MESSAGE_LOG_FD]) +_AC_EVAL([$ac_compiler -V </dev/null >&AS_MESSAGE_LOG_FD]) + +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl +# If we don't use `.F' as extension, the preprocessor is not run on the +# input file. +ac_save_ext=$ac_ext +ac_ext=F +_AC_LANG_COMPILER_GNU +ac_ext=$ac_save_ext +G77=`test $ac_compiler_gnu = yes && echo yes` +_AC_PROG_F77_G +AC_LANG_POP(Fortran 77)dnl +])# AC_PROG_F77 + + +# _AC_PROG_F77_G +# -------------- +# Check whether -g works, even if FFLAGS is set, in case the package +# plays around with FFLAGS (such as to build both debugging and normal +# versions of a library), tasteless as that idea is. +m4_define([_AC_PROG_F77_G], +[ac_test_FFLAGS=${FFLAGS+set} +ac_save_FFLAGS=$FFLAGS +FFLAGS= +AC_CACHE_CHECK(whether $F77 accepts -g, ac_cv_prog_f77_g, +[FFLAGS=-g +_AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], +[ac_cv_prog_f77_g=yes], +[ac_cv_prog_f77_g=no]) +]) +if test "$ac_test_FFLAGS" = set; then + FFLAGS=$ac_save_FFLAGS +elif test $ac_cv_prog_f77_g = yes; then + if test "$G77" = yes; then + FFLAGS="-g -O2" + else + FFLAGS="-g" + fi +else + if test "$G77" = yes; then + FFLAGS="-O2" + else + FFLAGS= + fi +fi[]dnl +])# _AC_PROG_F77_G + + +# AC_PROG_F77_C_O +# --------------- +# Test if the Fortran 77 compiler accepts the options `-c' and `-o' +# simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not. +# +# The usefulness of this macro is questionable, as I can't really see +# why anyone would use it. The only reason I include it is for +# completeness, since a similar test exists for the C compiler. +AC_DEFUN([AC_PROG_F77_C_O], +[AC_REQUIRE([AC_PROG_F77])dnl +AC_CACHE_CHECK([whether $F77 understand -c and -o together], + [ac_cv_prog_f77_c_o], +[AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) +# We test twice because some compilers refuse to overwrite an existing +# `.o' file with `-o', although they will create one. +ac_try='$F77 $FFLAGS -c "conftest.$ac_ext" -o "conftest.$ac_objext" >&AS_MESSAGE_LOG_FD' +if AC_TRY_EVAL(ac_try) && + test -f "conftest.$ac_objext" && + AC_TRY_EVAL(ac_try); then + ac_cv_prog_f77_c_o=yes +else + ac_cv_prog_f77_c_o=no +fi +rm -rf conftest*]) +if test $ac_cv_prog_f77_c_o = no; then + AC_DEFINE(F77_NO_MINUS_C_MINUS_O, 1, + [Define if your Fortran 77 compiler doesn't accept -c and -o together.]) +fi +])# AC_PROG_F77_C_O + + + + + +## ------------------------------- ## +## 4. Compilers' characteristics. ## +## ------------------------------- ## + + +# -------------------------------- # +# 4b. C compiler characteristics. # +# -------------------------------- # + +# AC_PROG_CC_STDC +# --------------- +# 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. +AC_DEFUN([AC_PROG_CC_STDC], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_BEFORE([$0], [AC_C_INLINE])dnl +AC_BEFORE([$0], [AC_C_CONST])dnl +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 option to accept ANSI C]) +AC_CACHE_VAL(ac_cv_prog_cc_stdc, +[ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +AC_LANG_CONFTEST([AC_LANG_PROGRAM( +[[#include <stdarg.h> +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +/* 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 (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];]])]) +# 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_COMPILE_IFELSE([], + [ac_cv_prog_cc_stdc=$ac_arg +break]) +done +rm -f "conftest.$ac_ext" "conftest.$ac_objext" +CC=$ac_save_CC +]) +case "x$ac_cv_prog_cc_stdc" in + x|xno) + AC_MSG_RESULT([none needed]) ;; + *) + AC_MSG_RESULT([$ac_cv_prog_cc_stdc]) + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac +])# AC_PROG_CC_STDC + + +# AC_C_CROSS +# ---------- +# Has been merged into AC_PROG_CC. +AU_DEFUN([AC_C_CROSS], []) + + +# AC_C_CHAR_UNSIGNED +# ------------------ +AC_DEFUN([AC_C_CHAR_UNSIGNED], +[AH_VERBATIM([__CHAR_UNSIGNED__], +[/* Define if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +# undef __CHAR_UNSIGNED__ +#endif])dnl +AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, +[AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([])], + [((char) -1) < 0])], + ac_cv_c_char_unsigned=no, ac_cv_c_char_unsigned=yes)]) +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + AC_DEFINE(__CHAR_UNSIGNED__) +fi +])# AC_C_CHAR_UNSIGNED + + +# AC_C_LONG_DOUBLE +# ---------------- +AC_DEFUN([AC_C_LONG_DOUBLE], +[AC_CACHE_CHECK(for long double, ac_cv_c_long_double, +[if test "$GCC" = yes; then + ac_cv_c_long_double=yes +else +AC_TRY_RUN( +[int +main (void) +{ + /* The Stardent Vistra knows sizeof(long double), but does not + support it. */ + long double foo = 0.0; + /* On Ultrix 4.3 cc, long double is 4 and double is 8. */ + $ac_main_return (sizeof (long double) < sizeof (double)); +}], +ac_cv_c_long_double=yes, ac_cv_c_long_double=no) +fi]) +if test $ac_cv_c_long_double = yes; then + AC_DEFINE(HAVE_LONG_DOUBLE, 1, + [Define if the `long double' type works.]) +fi +])# AC_C_LONG_DOUBLE + + +# AC_C_BIGENDIAN +# -------------- +AC_DEFUN([AC_C_BIGENDIAN], +[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, +[ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h> +#include <sys/param.h> +], +[#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif +])], +[# It does; now see whether it defined to BIG_ENDIAN or not. +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h> +#include <sys/param.h> +], [#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif +])], [ac_cv_c_bigendian=yes], + [ac_cv_c_bigendian=no])]) +if test $ac_cv_c_bigendian = unknown; then +AC_TRY_RUN( +[int +main (void) +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + $ac_main_return (u.c[sizeof (long) - 1] == 1); +}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes) +fi]) +if test $ac_cv_c_bigendian = yes; then + AC_DEFINE(WORDS_BIGENDIAN, 1, + [Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX).]) +fi +])# AC_C_BIGENDIAN + + +# AC_C_INLINE +# ----------- +# Do nothing if the compiler accepts the inline keyword. +# Otherwise define inline to __inline__ or __inline if one of those work, +# otherwise define inline to be empty. +AC_DEFUN([AC_C_INLINE], +[AC_REQUIRE([AC_PROG_CC_STDC])dnl +AC_CACHE_CHECK([for inline], ac_cv_c_inline, +[ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + AC_COMPILE_IFELSE([AC_LANG_SOURCE( +[#ifndef __cplusplus +static $ac_kw int static_foo (void) {return 0; } +$ac_kw int foo (void) {return 0; } +#endif +])], + [ac_cv_c_inline=$ac_kw; break]) +done +]) +case $ac_cv_c_inline in + inline | yes) ;; + no) AC_DEFINE(inline,, + [Define as `__inline' if that's what the C compiler calls it, + or to nothing if it is not supported.]) ;; + *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;; +esac +])# AC_C_INLINE + + +# AC_C_CONST +# ---------- +AC_DEFUN([AC_C_CONST], +[AC_REQUIRE([AC_PROG_CC_STDC])dnl +AC_CACHE_CHECK([for an ANSI C-conforming const], ac_cv_c_const, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], +[[/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset x; (void)x; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *ccp; + char **p; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; (void)zero; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + ccp = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++ccp; + p = (char**) ccp; + ccp = (char const *const *) p; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + (void)s; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + (void)foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + (void)p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + (void)foo; + } +#endif +]])], + [ac_cv_c_const=yes], + [ac_cv_c_const=no])]) +if test $ac_cv_c_const = no; then + AC_DEFINE(const,, + [Define to empty if `const' does not conform to ANSI C.]) +fi +])# AC_C_CONST + + +# AC_C_VOLATILE +# ------------- +# Note that, unlike const, #defining volatile to be the empty string can +# actually turn a correct program into an incorrect one, since removing +# uses of volatile actually grants the compiler permission to perform +# optimizations that could break the user's code. So, do not #define +# volatile away unless it is really necessary to allow the user's code +# to compile cleanly. Benign compiler failures should be tolerated. +AC_DEFUN([AC_C_VOLATILE], +[AC_REQUIRE([AC_PROG_CC_STDC])dnl +AC_CACHE_CHECK([for working volatile], ac_cv_c_volatile, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ +volatile int x; +int * volatile y;])], + [ac_cv_c_volatile=yes], + [ac_cv_c_volatile=no])]) +if test $ac_cv_c_volatile = no; then + AC_DEFINE(volatile,, + [Define to empty if the keyword `volatile' does not work. + Warning: valid code using `volatile' can become incorrect + without. Disable with care.]) +fi +])# AC_C_VOLATILE + + +# AC_C_STRINGIZE +# -------------- +# Checks if `#' can be used to glue strings together at the CPP level. +# Defines HAVE_STRINGIZE if positive. +AC_DEFUN([AC_C_STRINGIZE], +[AC_CACHE_CHECK([for preprocessor stringizing operator], + [ac_cv_c_stringize], +[AC_EGREP_CPP([@%:@teststring], + [@%:@define x(y) #y + +char *s = x(teststring);], + [ac_cv_c_stringize=no], + [ac_cv_c_stringize=yes])]) +if test $ac_cv_c_stringize = yes; then + AC_DEFINE(HAVE_STRINGIZE, 1, + [Define if cpp supports the ANSI @%:@ stringizing operator.]) +fi +])# AC_C_STRINGIZE + + +# AC_C_PROTOTYPES +# --------------- +# Check if the C compiler supports prototypes, included if it needs +# options. +AC_DEFUN([AC_C_PROTOTYPES], +[AC_REQUIRE([AC_PROG_CC_STDC])dnl +AC_MSG_CHECKING([for function prototypes]) +if test "$ac_cv_prog_cc_stdc" != no; then + AC_MSG_RESULT([yes]) + AC_DEFINE(PROTOTYPES, 1, + [Define if the C compiler supports function prototypes.]) +else + AC_MSG_RESULT([no]) +fi +])# AC_C_PROTOTYPES + + + + +# ---------------------------------------- # +# 4d. Fortran 77 compiler characteristics. # +# ---------------------------------------- # + + +# _AC_PROG_F77_V_OUTPUT([FLAG = $ac_cv_prog_f77_v]) +# ------------------------------------------------- +# Link a trivial Fortran program, compiling with a verbose output FLAG +# (which default value, $ac_cv_prog_f77_v, is computed by +# _AC_PROG_F77_V), and return the output in $ac_f77_v_output. This +# output is processed in the way expected by AC_F77_LIBRARY_LDFLAGS, +# so that any link flags that are echoed by the compiler appear as +# space-separated items. +AC_DEFUN([_AC_PROG_F77_V_OUTPUT], +[AC_REQUIRE([AC_PROG_F77])dnl +AC_LANG_PUSH(Fortran 77)dnl + +AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + +# Compile and link our simple test program by passing a flag (argument +# 1 to this macro) to the Fortran 77 compiler in order to get +# "verbose" output that we can then parse for the Fortran 77 linker +# flags. +ac_save_FFLAGS=$FFLAGS +FFLAGS="$FFLAGS m4_default([$1], [$ac_cv_prog_f77_v])" +(eval echo $as_me:__oline__: \"$ac_link\") >&AS_MESSAGE_LOG_FD +ac_f77_v_output=`eval $ac_link AS_MESSAGE_LOG_FD>&1 2>&1 | grep -v 'Driving:'` +echo "$ac_f77_v_output" >&AS_MESSAGE_LOG_FD +FFLAGS=$ac_save_FFLAGS + +rm -rf conftest* +AC_LANG_POP(Fortran 77)dnl + +# If we are using xlf then replace all the commas with spaces. +if echo $ac_f77_v_output | grep xlfentry >/dev/null 2>&1; then + ac_f77_v_output=`echo $ac_f77_v_output | sed 's/,/ /g'` +fi + +# If we are using Cray Fortran then delete quotes. +# Use "\"" instead of '"' for font-lock-mode. +# FIXME: a more general fix for quoted arguments with spaces? +if echo $ac_f77_v_output | grep cft90 >/dev/null 2>&1; then + ac_f77_v_output=`echo $ac_f77_v_output | sed "s/\"//g"` +fi[]dnl +])# _AC_PROG_F77_V_OUTPUT + + +# _AC_PROG_F77_V +# -------------- +# +# Determine the flag that causes the Fortran 77 compiler to print +# information of library and object files (normally -v) +# Needed for AC_F77_LIBRARY_FLAGS +# Some compilers don't accept -v (Lahey: -verbose, xlf: -V, Fujitsu: -###) +AC_DEFUN([_AC_PROG_F77_V], +[AC_CACHE_CHECK([how to get verbose linking output from $F77], + [ac_cv_prog_f77_v], +[AC_LANG_ASSERT(Fortran 77) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], +[ac_cv_prog_f77_v= +# Try some options frequently used verbose output +for ac_verb in -v -verbose --verbose -V -\#\#\#; do + _AC_PROG_F77_V_OUTPUT($ac_verb) + # look for -l* and *.a constructs in the output + for ac_arg in $ac_f77_v_output; do + case $ac_arg in + [[\\/]]*.a | ?:[[\\/]]*.a | -[[lLRu]]*) + ac_cv_prog_f77_v=$ac_verb + break 2 ;; + esac + done +done +if test -z "$ac_cv_prog_f77_v"; then + AC_MSG_WARN([cannot determine how to obtain linking information from $F77]) +fi], + [AC_MSG_WARN([compilation failed])]) +])])# _AC_PROG_F77_V + + +# AC_F77_LIBRARY_LDFLAGS +# ---------------------- +# +# Determine the linker flags (e.g. "-L" and "-l") for the Fortran 77 +# intrinsic and run-time libraries that are required to successfully +# link a Fortran 77 program or shared library. The output variable +# FLIBS is set to these flags. +# +# This macro is intended to be used in those situations when it is +# necessary to mix, e.g. C++ and Fortran 77, source code into a single +# program or shared library. +# +# For example, if object files from a C++ and Fortran 77 compiler must +# be linked together, then the C++ compiler/linker must be used for +# linking (since special C++-ish things need to happen at link time +# like calling global constructors, instantiating templates, enabling +# exception support, etc.). +# +# However, the Fortran 77 intrinsic and run-time libraries must be +# linked in as well, but the C++ compiler/linker doesn't know how to +# add these Fortran 77 libraries. Hence, the macro +# "AC_F77_LIBRARY_LDFLAGS" was created to determine these Fortran 77 +# libraries. +# +# This macro was packaged in its current form by Matthew D. Langston. +# However, nearly all of this macro came from the "OCTAVE_FLIBS" macro +# in "octave-2.0.13/aclocal.m4", and full credit should go to John +# W. Eaton for writing this extremely useful macro. Thank you John. +AC_DEFUN([AC_F77_LIBRARY_LDFLAGS], +[AC_LANG_PUSH(Fortran 77)dnl +_AC_PROG_F77_V +AC_CACHE_CHECK([for Fortran 77 libraries], ac_cv_flibs, +[if test "x$FLIBS" != "x"; then + ac_cv_flibs="$FLIBS" # Let the user override the test. +else + +_AC_PROG_F77_V_OUTPUT + +ac_cv_flibs= + +# Save positional arguments (if any) +ac_save_positional="$[@]" + +set X $ac_f77_v_output +while test $[@%:@] != 1; do + shift + ac_arg=$[1] + case $ac_arg in + [[\\/]]*.a | ?:[[\\/]]*.a) + AC_LIST_MEMBER_OF($ac_arg, $ac_cv_flibs, , + ac_cv_flibs="$ac_cv_flibs $ac_arg") + ;; + -bI:*) + AC_LIST_MEMBER_OF($ac_arg, $ac_cv_flibs, , + [AC_LINKER_OPTION([$ac_arg], ac_cv_flibs)]) + ;; + # Ignore these flags. + -lang* | -lcrt0.o | -lc | -lgcc | -LANG:=*) + ;; + -lkernel32) + test x"$CYGWIN" != xyes && ac_cv_flibs="$ac_cv_flibs $ac_arg" + ;; + -[[LRuY]]) + # These flags, when seen by themselves, take an argument. + # We remove the space between option and argument and re-iterate + # unless we find an empty arg or a new option (starting with -) + case $[2] in + "" | -*);; + *) + ac_arg="$ac_arg$[2]" + shift; shift + set X $ac_arg "$[@]" + ;; + esac + ;; + -YP,*) + for ac_j in `echo $ac_arg | sed -e 's/-YP,/-L/;s/:/ -L/g'`; do + AC_LIST_MEMBER_OF($ac_j, $ac_cv_flibs, , + [ac_arg="$ac_arg $ac_j" + ac_cv_flibs="$ac_cv_flibs $ac_j"]) + done + ;; + -[[lLR]]*) + AC_LIST_MEMBER_OF($ac_arg, $ac_cv_flibs, , + ac_cv_flibs="$ac_cv_flibs $ac_arg") + ;; + # Ignore everything else. + esac +done +# restore positional arguments +set X $ac_save_positional; shift + +# We only consider "LD_RUN_PATH" on Solaris systems. If this is seen, +# then we insist that the "run path" must be an absolute path (i.e. it +# must begin with a "/"). +case `(uname -sr) 2>/dev/null` in + "SunOS 5"*) + ac_ld_run_path=`echo $ac_f77_v_output | + sed -n 's,^.*LD_RUN_PATH *= *\(/[[^ ]]*\).*$,-R\1,p'` + test "x$ac_ld_run_path" != x && + AC_LINKER_OPTION([$ac_ld_run_path], ac_cv_flibs) + ;; +esac +fi # test "x$FLIBS" = "x" +]) +FLIBS="$ac_cv_flibs" +AC_SUBST(FLIBS) +AC_LANG_POP(Fortran 77)dnl +])# AC_F77_LIBRARY_LDFLAGS + + +# AC_F77_DUMMY_MAIN([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------------- +# +# Detect name of dummy main routine required by the Fortran libraries, +# (if any) and define F77_DUMMY_MAIN to this name (which should be +# used for a dummy declaration, if it is defined). On some systems, +# linking a C program to the Fortran library does not work unless you +# supply a dummy function called something like MAIN__. +# +# Execute ACTION-IF-NOT-FOUND if no way of successfully linking a C +# program with the F77 libs is found; default to exiting with an error +# message. Execute ACTION-IF-FOUND if a dummy routine name is needed +# and found or if it is not needed (default to defining F77_DUMMY_MAIN +# when needed). +# +# What is technically happening is that the Fortran libraries provide +# their own main() function, which usually initializes Fortran I/O and +# similar stuff, and then calls MAIN__, which is the entry point of +# your program. Usually, a C program will override this with its own +# main() routine, but the linker sometimes complain if you don't +# provide a dummy (never-called) MAIN__ routine anyway. +# +# Of course, programs that want to allow Fortran subroutines to do +# I/O, etcetera, should call their main routine MAIN__() (or whatever) +# instead of main(). A separate autoconf test (AC_F77_MAIN) checks +# for the routine to use in this case (since the semantics of the test +# are slightly different). To link to e.g. purely numerical +# libraries, this is normally not necessary, however, and most C/C++ +# programs are reluctant to turn over so much control to Fortran. =) +# +# The name variants we check for are (in order): +# MAIN__ (g77, MAIN__ required on some systems; IRIX, MAIN__ optional) +# MAIN_, __main (SunOS) +# MAIN _MAIN __MAIN main_ main__ _main (we follow DDD and try these too) +AC_DEFUN([AC_F77_DUMMY_MAIN], +[AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnl +m4_define([_AC_LANG_PROGRAM_C_F77_HOOKS], +[#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() { return 1; } +#endif +]) +AC_CACHE_CHECK([for dummy main to link with Fortran 77 libraries], + ac_cv_f77_dummy_main, +[AC_LANG_PUSH(C)dnl + ac_f77_dm_save_LIBS=$LIBS + LIBS="$LIBS $FLIBS" + + # First, try linking without a dummy main: + AC_TRY_LINK([], [], + ac_cv_f77_dummy_main=none, + ac_cv_f77_dummy_main=unknown) + + if test $ac_cv_f77_dummy_main = unknown; then + for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do + AC_TRY_LINK([@%:@define F77_DUMMY_MAIN $ac_func], + [], [ac_cv_f77_dummy_main=$ac_func; break]) + done + fi + rm -rf conftest* + LIBS=$ac_f77_dm_save_LIBS + AC_LANG_POP(C)dnl +]) +F77_DUMMY_MAIN=$ac_cv_f77_dummy_main +AS_IF([test "$F77_DUMMY_MAIN" != unknown], + [m4_default([$1], +[if test $F77_DUMMY_MAIN != none; then + AC_DEFINE_UNQUOTED([F77_DUMMY_MAIN], $F77_DUMMY_MAIN, + [Define to dummy `main' function (if any) required to + link to the Fortran 77 libraries.]) +fi])], + [m4_default([$2], + [AC_MSG_ERROR([Linking to Fortran libraries from C fails.])])]) +])# AC_F77_DUMMY_MAIN + + +# AC_F77_MAIN +# ----------- +# Define F77_MAIN to name of alternate main() function for use with +# the Fortran libraries. (Typically, the libraries may define their +# own main() to initialize I/O, etcetera, that then call your own +# routine called MAIN__ or whatever.) See AC_F77_DUMMY_MAIN, above. +# If no such alternate name is found, just define F77_MAIN to main. +# +AC_DEFUN([AC_F77_MAIN], +[AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnl +AC_CACHE_CHECK([for alternate main to link with Fortran 77 libraries], + ac_cv_f77_main, +[AC_LANG_PUSH(C)dnl + ac_f77_m_save_LIBS=$LIBS + LIBS="$LIBS $FLIBS" + ac_cv_f77_main="main" # default entry point name + + for ac_func in MAIN__ MAIN_ __main MAIN _MAIN __MAIN main_ main__ _main; do + AC_TRY_LINK([#undef F77_DUMMY_MAIN +@%:@define main $ac_func], [], [ac_cv_f77_main=$ac_func; break]) + done + rm -rf conftest* + LIBS=$ac_f77_m_save_LIBS + AC_LANG_POP(C)dnl +]) +AC_DEFINE_UNQUOTED([F77_MAIN], $ac_cv_f77_main, + [Define to alternate name for `main' routine that is + called from a `main' in the Fortran libraries.]) +])# AC_F77_MAIN + + +# _AC_F77_NAME_MANGLING +# --------------------- +# Test for the name mangling scheme used by the Fortran 77 compiler. +# +# Sets ac_cv_f77_mangling. The value contains three fields, separated +# by commas: +# +# lower case / upper case: +# case translation of the Fortran 77 symbols +# underscore / no underscore: +# whether the compiler appends "_" to symbol names +# extra underscore / no extra underscore: +# whether the compiler appends an extra "_" to symbol names already +# containing at least one underscore +# +AC_DEFUN([_AC_F77_NAME_MANGLING], +[AC_REQUIRE([AC_F77_LIBRARY_LDFLAGS])dnl +AC_REQUIRE([AC_F77_DUMMY_MAIN])dnl +AC_CACHE_CHECK([for Fortran 77 name-mangling scheme], + ac_cv_f77_mangling, +[AC_LANG_PUSH(Fortran 77)dnl +AC_COMPILE_IFELSE( +[ subroutine foobar() + return + end + subroutine foo_bar() + return + end], +[mv "conftest.$ac_objext" "cf77_test.$ac_objext" + + AC_LANG_PUSH(C)dnl + + ac_save_LIBS=$LIBS + LIBS="cf77_test.$ac_objext $LIBS $FLIBS" + + ac_success=no + for ac_foobar in foobar FOOBAR; do + for ac_underscore in "" "_"; do + ac_func="$ac_foobar$ac_underscore" + AC_TRY_LINK_FUNC($ac_func, + [ac_success=yes; break 2]) + done + done + + if test "$ac_success" = "yes"; then + case $ac_foobar in + foobar) + ac_case=lower + ac_foo_bar=foo_bar + ;; + FOOBAR) + ac_case=upper + ac_foo_bar=FOO_BAR + ;; + esac + + ac_success_extra=no + for ac_extra in "" "_"; do + ac_func="$ac_foo_bar$ac_underscore$ac_extra" + AC_TRY_LINK_FUNC($ac_func, + [ac_success_extra=yes; break]) + done + + if test "$ac_success_extra" = "yes"; then + ac_cv_f77_mangling="$ac_case case" + if test -z "$ac_underscore"; then + ac_cv_f77_mangling="$ac_cv_f77_mangling, no underscore" + else + ac_cv_f77_mangling="$ac_cv_f77_mangling, underscore" + fi + if test -z "$ac_extra"; then + ac_cv_f77_mangling="$ac_cv_f77_mangling, no extra underscore" + else + ac_cv_f77_mangling="$ac_cv_f77_mangling, extra underscore" + fi + else + ac_cv_f77_mangling="unknown" + fi + else + ac_cv_f77_mangling="unknown" + fi + + LIBS=$ac_save_LIBS + AC_LANG_POP(C)dnl + rm -rf cf77_test* conftest*]) +AC_LANG_POP(Fortran 77)dnl +]) +])# _AC_F77_NAME_MANGLING + +# The replacement is empty. +AU_DEFUN([AC_F77_NAME_MANGLING], []) + + +# AC_F77_WRAPPERS +# --------------- +# Defines C macros F77_FUNC(name,NAME) and F77_FUNC_(name,NAME) to +# properly mangle the names of C identifiers, and C identifiers with +# underscores, respectively, so that they match the name mangling +# scheme used by the Fortran 77 compiler. +AC_DEFUN([AC_F77_WRAPPERS], +[AC_REQUIRE([_AC_F77_NAME_MANGLING])dnl +AH_TEMPLATE([F77_FUNC], + [Define to a macro mangling the given C identifier (in lower and upper + case), which must not contain underscores, for linking with Fortran.])dnl +AH_TEMPLATE([F77_FUNC_], + [As F77_FUNC, but for C identifiers containing underscores.])dnl +case $ac_cv_f77_mangling in + "lower case, no underscore, no extra underscore") + AC_DEFINE([F77_FUNC(name,NAME)], [name]) + AC_DEFINE([F77_FUNC_(name,NAME)], [name]) ;; + "lower case, no underscore, extra underscore") + AC_DEFINE([F77_FUNC(name,NAME)], [name]) + AC_DEFINE([F77_FUNC_(name,NAME)], [name ## _]) ;; + "lower case, underscore, no extra underscore") + AC_DEFINE([F77_FUNC(name,NAME)], [name ## _]) + AC_DEFINE([F77_FUNC_(name,NAME)], [name ## _]) ;; + "lower case, underscore, extra underscore") + AC_DEFINE([F77_FUNC(name,NAME)], [name ## _]) + AC_DEFINE([F77_FUNC_(name,NAME)], [name ## __]) ;; + "upper case, no underscore, no extra underscore") + AC_DEFINE([F77_FUNC(name,NAME)], [NAME]) + AC_DEFINE([F77_FUNC_(name,NAME)], [NAME]) ;; + "upper case, no underscore, extra underscore") + AC_DEFINE([F77_FUNC(name,NAME)], [NAME]) + AC_DEFINE([F77_FUNC_(name,NAME)], [NAME ## _]) ;; + "upper case, underscore, no extra underscore") + AC_DEFINE([F77_FUNC(name,NAME)], [NAME ## _]) + AC_DEFINE([F77_FUNC_(name,NAME)], [NAME ## _]) ;; + "upper case, underscore, extra underscore") + AC_DEFINE([F77_FUNC(name,NAME)], [NAME ## _]) + AC_DEFINE([F77_FUNC_(name,NAME)], [NAME ## __]) ;; + *) + AC_MSG_WARN([unknown Fortran 77 name-mangling scheme]) + ;; +esac +])# AC_F77_WRAPPERS + + +# AC_F77_FUNC(NAME, [SHELLVAR = NAME]) +# ------------------------------------ +# For a Fortran subroutine of given NAME, define a shell variable +# $SHELLVAR to the Fortran-77 mangled name. If the SHELLVAR +# argument is not supplied, it defaults to NAME. +AC_DEFUN([AC_F77_FUNC], +[AC_REQUIRE([_AC_F77_NAME_MANGLING])dnl +case $ac_cv_f77_mangling in + upper*) ac_val="m4_toupper([$1])" ;; + lower*) ac_val="m4_tolower([$1])" ;; + *) ac_val="unknown" ;; +esac +case $ac_cv_f77_mangling in *," underscore"*) ac_val="$ac_val"_ ;; esac +m4_if(m4_index([$1],[_]),-1,[], +[case $ac_cv_f77_mangling in *," extra underscore"*) ac_val="$ac_val"_ ;; esac +]) +m4_default([$2],[$1])="$ac_val" +])# AC_F77_FUNC diff --git a/aclibraries b/aclibraries new file mode 100644 index 0000000..251d763 --- /dev/null +++ b/aclibraries @@ -0,0 +1,26 @@ +# aclibraries -- autoscan's mapping from libraries to Autoconf macros +# Copyright 2001 +# 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 +# the Free Software Foundation; either version 2, 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. + +# Ones that have their own macros. + +# Others, checked with AC_CHECK_LIB. + +# Local Variables: +# mode: shell-script +# End: diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..61d205c --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,5 @@ +m4_include([m4/init.m4]) +m4_include([m4/missing.m4]) +m4_include([m4/sanity.m4]) +m4_include([m4/atconfig.m4]) +m4_include([m4/m4.m4]) diff --git a/acmakevars b/acmakevars new file mode 100644 index 0000000..d19760d --- /dev/null +++ b/acmakevars @@ -0,0 +1,34 @@ +# acmakevars -- autoscan's mapping from Make variables to Autoconf macros +# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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. + +LN AC_PROG_LN_S +AWK AC_PROG_AWK +CC AC_PROG_CC +CPP AC_PROG_CPP +CXX AC_PROG_CXX +INSTALL AC_PROG_INSTALL +LEX AC_PROG_LEX +RANLIB AC_PROG_RANLIB +YACC AC_PROG_YACC +BISON AC_PROG_YACC +MAKE AC_PROG_MAKE_SET + +# Local Variables: +# mode: shell-script +# End: diff --git a/acoldnames.m4 b/acoldnames.m4 new file mode 100644 index 0000000..b992dee --- /dev/null +++ b/acoldnames.m4 @@ -0,0 +1,86 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# Support old macros, and provide automated updates. +# Copyright 1994, 1999, 2000, 2001 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 +# the Free Software Foundation; either version 2, 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. +# +# Originally written by David J. MacKenzie. + + +## ---------------------------- ## +## General macros of autoconf. ## +## ---------------------------- ## + +AU_ALIAS([AC_WARN], [AC_MSG_WARN]) +AU_ALIAS([AC_ERROR], [AC_MSG_ERROR]) +AU_ALIAS([AC_HAVE_HEADERS], [AC_CHECK_HEADERS]) +AU_ALIAS([AC_HEADER_CHECK], [AC_CHECK_HEADER]) +AU_ALIAS([AC_HEADER_EGREP], [AC_EGREP_HEADER]) +AU_ALIAS([AC_PREFIX], [AC_PREFIX_PROGRAM]) +AU_ALIAS([AC_PROGRAMS_CHECK], [AC_CHECK_PROGS]) +AU_ALIAS([AC_PROGRAMS_PATH], [AC_PATH_PROGS]) +AU_ALIAS([AC_PROGRAM_CHECK], [AC_CHECK_PROG]) +AU_ALIAS([AC_PROGRAM_EGREP], [AC_EGREP_CPP]) +AU_ALIAS([AC_PROGRAM_PATH], [AC_PATH_PROG]) +AU_ALIAS([AC_SIZEOF_TYPE], [AC_CHECK_SIZEOF]) +AU_ALIAS([AC_TEST_CPP], [AC_TRY_CPP]) +AU_ALIAS([AC_TEST_PROGRAM], [AC_TRY_RUN]) + + + +## ----------------------------- ## +## Specific macros of autoconf. ## +## ----------------------------- ## + +AU_ALIAS([AC_CHAR_UNSIGNED], [AC_C_CHAR_UNSIGNED]) +AU_ALIAS([AC_CONST], [AC_C_CONST]) +AU_ALIAS([AC_CROSS_CHECK], [AC_C_CROSS]) +AU_ALIAS([AC_FIND_X], [AC_PATH_X]) +AU_ALIAS([AC_FIND_XTRA], [AC_PATH_XTRA]) +AU_ALIAS([AC_GCC_TRADITIONAL], [AC_PROG_GCC_TRADITIONAL]) +AU_ALIAS([AC_GETGROUPS_T], [AC_TYPE_GETGROUPS]) +AU_ALIAS([AC_INLINE], [AC_C_INLINE]) +AU_ALIAS([AC_LN_S], [AC_PROG_LN_S]) +AU_ALIAS([AC_LONG_DOUBLE], [AC_C_LONG_DOUBLE]) +AU_ALIAS([AC_LONG_FILE_NAMES], [AC_SYS_LONG_FILE_NAMES]) +AU_ALIAS([AC_MAJOR_HEADER], [AC_HEADER_MAJOR]) +AU_ALIAS([AC_MINUS_C_MINUS_O], [AC_PROG_CC_C_O]) +AU_ALIAS([AC_MODE_T], [AC_TYPE_MODE_T]) +AU_ALIAS([AC_OFF_T], [AC_TYPE_OFF_T]) +AU_ALIAS([AC_PID_T], [AC_TYPE_PID_T]) +AU_ALIAS([AC_RESTARTABLE_SYSCALLS], [AC_SYS_RESTARTABLE_SYSCALLS]) +AU_ALIAS([AC_RETSIGTYPE], [AC_TYPE_SIGNAL]) +AU_ALIAS([AC_SET_MAKE], [AC_PROG_MAKE_SET]) +AU_ALIAS([AC_SIZE_T], [AC_TYPE_SIZE_T]) +AU_ALIAS([AC_STAT_MACROS_BROKEN], [AC_HEADER_STAT]) +AU_ALIAS([AC_STDC_HEADERS], [AC_HEADER_STDC]) +AU_ALIAS([AC_ST_BLKSIZE], [AC_STRUCT_ST_BLKSIZE]) +AU_ALIAS([AC_ST_BLOCKS], [AC_STRUCT_ST_BLOCKS]) +AU_ALIAS([AC_ST_RDEV], [AC_STRUCT_ST_RDEV]) +AU_ALIAS([AC_SYS_SIGLIST_DECLARED], [AC_DECL_SYS_SIGLIST]) +AU_ALIAS([AC_TIMEZONE], [AC_STRUCT_TIMEZONE]) +AU_ALIAS([AC_TIME_WITH_SYS_TIME], [AC_HEADER_TIME]) +AU_ALIAS([AC_UID_T], [AC_TYPE_UID_T]) +AU_ALIAS([AC_WORDS_BIGENDIAN], [AC_C_BIGENDIAN]) +AU_ALIAS([AC_YYTEXT_POINTER], [AC_DECL_YYTEXT]) +AU_ALIAS([AM_CYGWIN32], [AC_CYGWIN32]) +AU_ALIAS([AC_CYGWIN32], [AC_CYGWIN]) +AU_ALIAS([AM_EXEEXT], [AC_EXEEXT]) +# We cannot do this, because in libtool.m4 yet they provide +# this update. Some solution is needed. +# AU_ALIAS([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AU_ALIAS([AM_MINGW32], [AC_MINGW32]) +AU_ALIAS([AM_PROG_INSTALL], [AC_PROG_INSTALL]) diff --git a/acprograms b/acprograms new file mode 100644 index 0000000..d6c0163 --- /dev/null +++ b/acprograms @@ -0,0 +1,42 @@ +# acprograms -- autoscan's mapping from programs to Autoconf macros +# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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. + +ln AC_PROG_LN_S +awk AC_PROG_AWK +nawk AC_PROG_AWK +gawk AC_PROG_AWK +mawk AC_PROG_AWK +cc AC_PROG_CC +gcc AC_PROG_CC +cpp AC_PROG_CPP +CC AC_PROG_CXX +c++ AC_PROG_CXX +g++ AC_PROG_CXX +install AC_PROG_INSTALL +lex AC_PROG_LEX +flex AC_PROG_LEX +ranlib AC_PROG_RANLIB +yacc AC_PROG_YACC +byacc AC_PROG_YACC +bison AC_PROG_YACC +make AC_PROG_MAKE_SET + +# Local Variables: +# mode: shell-script +# End: diff --git a/acspecific.m4 b/acspecific.m4 new file mode 100644 index 0000000..13a891f --- /dev/null +++ b/acspecific.m4 @@ -0,0 +1,1112 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# Macros that test for specific features. +#------------------------------------------------------------------------------ +# Copyright 2006-2020,2021 Thomas E. Dickey +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by David MacKenzie, with help from +# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +# Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +## --------------------- ## +## Checks for programs. ## +## --------------------- ## + + +# _AC_PROG_ECHO +# ------------- +# Check whether to use -n, \c, or newline-tab to separate +# checking messages from result messages. +# Don't try to cache, since the results of this macro are needed to +# display the checking message. In addition, caching something used once +# has little interest. +# Idea borrowed from dist 3.0. Use `*c*,', not `*c,' because if `\c' +# failed there is also a new-line to match. +m4_define([_AC_PROG_ECHO], +[case `echo "testing\c" 2>/dev/null; echo 1,2,3`,`echo -n testing 2>/dev/null; echo 1,2,3` in + *c*,-n*) ECHO_N= + ECHO_C= # newlines do not sed ;-) only broken shells would use this case anyway + ECHO_T=' ' + ;; + *c*,* ) ECHO_N=-n + ECHO_C= + ECHO_T= + ;; + *) ECHO_N= + ECHO_C='\c' + ECHO_T= + ;; +esac +AC_SUBST(ECHO_C)dnl +AC_SUBST(ECHO_N)dnl +AC_SUBST(ECHO_T)dnl +])# _AC_PROG_ECHO + + +# AC_PROG_MAKE_SET +# ---------------- +# Define SET_MAKE to set ${MAKE} if make doesn't. +AC_DEFUN([AC_PROG_MAKE_SET], +[AC_MSG_CHECKING([whether ${MAKE-make} sets \${MAKE}]) +set dummy ${MAKE-make}; ac_make=`echo "$[2]" | sed 'y,./+-,__p_,'` +AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set, +[cat >conftest.make <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 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 conftest.make])dnl +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + AC_MSG_RESULT([yes]) + SET_MAKE= +else + AC_MSG_RESULT([no]) + SET_MAKE="MAKE=${MAKE-make}" +fi +AC_SUBST([SET_MAKE])dnl +])# AC_PROG_MAKE_SET + + +# AC_PROG_RANLIB +# -------------- +AC_DEFUN([AC_PROG_RANLIB], +[AC_CHECK_TOOL(RANLIB, ranlib, :)]) + + +# AC_PROG_AWK +# ----------- +# Check for mawk first since it's generally faster. +AC_DEFUN([AC_PROG_AWK], +[AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )]) + + +# AC_PROG_EGREP +# ------------- +AC_DEFUN([AC_PROG_EGREP], +[AC_REQUIRE([AC_PROG_GREP])dnl +AC_CACHE_CHECK([for egrep], ac_cv_path_EGREP, + [if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + AC_PATH_PROGS(EGREP, gegrep egrep, : ) + test "x$ac_cv_path_EGREP" = "x:" && AC_MSG_ERROR([cannot find workable egrep]) + fi]) + EGREP="$ac_cv_path_EGREP" + AC_SUBST([EGREP]) +])# AC_PROG_EGREP + + +# AC_PROG_FGREP +# ------------- +AC_DEFUN([AC_PROG_FGREP], +[AC_REQUIRE([AC_PROG_GREP])dnl +AC_CACHE_CHECK([for fgrep], ac_cv_path_FGREP, + [if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + AC_PATH_PROGS(FGREP, gfgrep fgrep, : ) + test "x$ac_cv_path_FGREP" = "x:" && AC_MSG_ERROR([cannot find workable fgrep]) + fi]) + FGREP="$ac_cv_path_FGREP" + AC_SUBST([FGREP]) +])# AC_PROG_FGREP + + +# AC_PROG_GREP +# ------------ +AC_DEFUN([AC_PROG_GREP], +[AC_CHECK_PROGS(GREP, ggrep grep, : ) + AC_SUBST([GREP]) +]) + + +# AC_PROG_YACC +# ------------ +AC_DEFUN([AC_PROG_YACC], +[AC_CHECK_PROGS(YACC, byacc 'bison -y', yacc)]) + + +# AC_PROG_LEX +# ----------- +# Look for flex or lex. Set its associated library to LEXLIB. +# Check if lex declares yytext as a char * by default, not a char[]. +AC_DEFUN_ONCE([AC_PROG_LEX], +[AC_CHECK_PROGS(LEX, reflex flex lex, :) +if test -z "$LEXLIB" +then + AC_CHECK_LIB(fl, yywrap, LEXLIB="-lfl", + [AC_CHECK_LIB(l, yywrap, LEXLIB="-ll")]) +fi +AC_SUBST(LEXLIB) +if test "x$LEX" != "x:"; then + _AC_DECL_YYTEXT +fi]) + + +# _AC_DECL_YYTEXT +# --------------- +# Check if lex declares yytext as a char * by default, not a char[]. +m4_define([_AC_DECL_YYTEXT], +[AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root, +[# The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +echo '%% +%%' | $LEX +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + AC_MSG_ERROR([cannot find output from $LEX; giving up]) +fi]) +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root +AC_SUBST(LEX_OUTPUT_ROOT)dnl + +AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer, +[# POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +ac_save_LIBS=$LIBS +LIBS="$LIBS $LEXLIB" +AC_LINK_IFELSE([`cat $LEX_OUTPUT_ROOT.c`], ac_cv_prog_lex_yytext_pointer=yes) +LIBS=$ac_save_LIBS +rm -f "${LEX_OUTPUT_ROOT}.c" +]) +dnl +if test $ac_cv_prog_lex_yytext_pointer = yes; then + AC_DEFINE(YYTEXT_POINTER, 1, + [Define if `lex' declares `yytext' as a `char *' by default, + not a `char[]'.]) +fi +])# _AC_DECL_YYTEXT + + +# Require AC_PROG_LEX in case some people were just calling this macro. +AU_DEFUN([AC_DECL_YYTEXT], +[AC_PROG_LEX]) + + +# AC_PROG_INSTALL +# --------------- +AC_DEFUN([AC_PROG_INSTALL], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# 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 +# AmigaOS /C/install, which installs bootblocks on floppy discs +# 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. +AC_MSG_CHECKING([for a BSD compatible install]) +if test -z "$INSTALL"; then +AC_CACHE_VAL(ac_cv_path_install, +[ ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /[cC]/* \ + | /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 AS_EXECUTABLE_P(["$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. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done +])dnl + 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 +dnl We do special magic for INSTALL instead of AC_SUBST, to get +dnl relative paths right. +AC_MSG_RESULT([$INSTALL]) + +# 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}' +AC_SUBST(INSTALL_PROGRAM)dnl + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' +AC_SUBST(INSTALL_SCRIPT)dnl + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +AC_SUBST(INSTALL_DATA)dnl +])# AC_PROG_INSTALL + + +# AC_PROG_LN_S +# ------------ +AC_DEFUN([AC_PROG_LN_S], +[AC_MSG_CHECKING([whether ln -s works]) +AC_SUBST([LN_S], [$as_ln_s])dnl +if test "$LN_S" = "ln -s"; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no, using $LN_S]) +fi +])# AC_PROG_LN_S + + +# AC_RSH +# ------ +# I don't know what it used to do, but it no longer does. +AU_DEFUN([AC_RSH], +[AC_DIAGNOSE([obsolete], [$0: is no longer supported. +Remove this warning when you adjust the code.])]) + + + +## ------------------------- ## +## Checks for declarations. ## +## ------------------------- ## + + +# AC_DECL_SYS_SIGLIST +# ------------------- +AC_DEFUN([AC_DECL_SYS_SIGLIST], +[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h], + ac_cv_decl_sys_siglist, +[AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([#include <sys/types.h> +#include <signal.h> +/* NetBSD declares sys_siglist in unistd.h. */ +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +], [char *msg = *(sys_siglist + 1);])], + [ac_cv_decl_sys_siglist=yes], + [ac_cv_decl_sys_siglist=no])]) +if test $ac_cv_decl_sys_siglist = yes; then + AC_DEFINE(SYS_SIGLIST_DECLARED, 1, + [Define if `sys_siglist' is declared by <signal.h> or <unistd.h>.]) +fi +])# AC_DECL_SYS_SIGLIST + + + + +## -------------------------------------- ## +## Checks for operating system services. ## +## -------------------------------------- ## + + +# AC_SYS_INTERPRETER +# ------------------ +AC_DEFUN([AC_SYS_INTERPRETER], +[AC_CACHE_CHECK(whether @%:@! works in shell scripts, ac_cv_sys_interpreter, +[echo '#! /bin/cat +exit 69 +' >conftest +chmod u+x conftest +(SHELL=/bin/sh; export SHELL; ./conftest >/dev/null) +if test $? -ne 69; then + ac_cv_sys_interpreter=yes +else + ac_cv_sys_interpreter=no +fi +rm -f conftest]) +interpval=$ac_cv_sys_interpreter +]) + + +AU_DEFUN([AC_HAVE_POUNDBANG], +[AC_SYS_INTERPRETER +AC_DIAGNOSE([obsolete], +[$0: Remove this warning when you adjust your code to use + `AC_SYS_INTERPRETER'.])]) + + +AU_DEFUN([AC_ARG_ARRAY], +[AC_DIAGNOSE([obsolete], +[$0: no longer implemented: don't do unportable things +with arguments. Remove this warning when you adjust your code.])]) + + +# _AC_SYS_LARGEFILE_TEST_INCLUDES +# ------------------------------- +m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], +[@%:@include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 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 +]) + + +# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, +# CACHE-VAR, +# DESCRIPTION, +# [INCLUDES], [FUNCTION-BODY]) +# ---------------------------------------------------------- +m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], +[AC_CACHE_CHECK([for $1 value needed for large files], [$3], +[while :; do + $3=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$5], [$6])], + [break]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@define $1 $2 +$5], [$6])], + [$3=$2; break]) + break +done]) +if test "$$3" != no; then + AC_DEFINE_UNQUOTED([$1], [$$3], [$4]) +fi +rm -rf conftest*[]dnl +])# _AC_SYS_LARGEFILE_MACRO_VALUE + + +# AC_SYS_LARGEFILE +# ---------------- +# By default, many hosts won't let programs access large files; +# one must use special compiler options to get large-file access to work. +# For more details about this brain damage please see: +# http://www.sas.com/standards/large.file/x_open.20Mar96.html +AC_DEFUN([AC_SYS_LARGEFILE], +[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 + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])]) + AC_COMPILE_IFELSE([], [break]) + CC="$CC -n32" + AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break]) + break + done + CC=$ac_save_CC + rm -f "conftest.$ac_ext" + 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_SYS_LARGEFILE + + +# AC_SYS_LONG_FILE_NAMES +# ---------------------- +# Security: use a temporary directory as the most portable way of +# creating files in /tmp securely. Removing them leaves a race +# condition, set -C is not portably guaranteed to use O_EXCL, so still +# leaves a race, and not all systems have the `mktemp' utility. We +# still test for existence first in case of broken systems where the +# mkdir succeeds even when the directory exists. Broken systems may +# retain a race, but they probably have other security problems +# anyway; this should be secure on well-behaved systems. In any case, +# use of `mktemp' is probably inappropriate here since it would fail in +# attempting to create different file names differing after the 14th +# character on file systems without long file names. +AC_DEFUN([AC_SYS_LONG_FILE_NAMES], +[AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names, +[ac_cv_sys_long_file_names=yes +# Test for long file names in all the places we know might matter: +# . the current directory, where building will happen +# $prefix/lib where we will be installing things +# $exec_prefix/lib likewise +# eval it to expand exec_prefix. +# $TMPDIR if set, where it might want to write temporary files +# if $TMPDIR is not set: +# /tmp where it might want to write temporary files +# /var/tmp likewise +# /usr/tmp likewise +if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then + ac_tmpdirs=$TMPDIR +else + ac_tmpdirs='/tmp /var/tmp /usr/tmp' +fi +for ac_dir in . $ac_tmpdirs `eval echo "$prefix/lib" "$exec_prefix/lib"` ; do + test -d "$ac_dir" || continue + test -w "$ac_dir" || continue # It is less confusing to not echo anything here. + ac_xdir=$ac_dir/cf$$ + (umask 077 && mkdir "$ac_xdir" 2>/dev/null) || continue + ac_tf1=$ac_xdir/conftest9012345 + ac_tf2=$ac_xdir/conftest9012346 + (echo 1 >"$ac_tf1") 2>/dev/null + (echo 2 >"$ac_tf2") 2>/dev/null + ac_val=`cat "$ac_tf1" 2>/dev/null` + if test ! -f "$ac_tf1" || test "$ac_val" != 1; then + ac_cv_sys_long_file_names=no + rm -rf "$ac_xdir" 2>/dev/null + break + fi + rm -rf "$ac_xdir" 2>/dev/null +done]) +if test "$ac_cv_sys_long_file_names" = yes; then + AC_DEFINE(HAVE_LONG_FILE_NAMES, 1, + [Define if you support file names longer than 14 characters.]) +fi +]) + + +# AC_SYS_RESTARTABLE_SYSCALLS +# --------------------------- +# If the system automatically restarts a system call that is +# interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'. +AC_DEFUN([AC_SYS_RESTARTABLE_SYSCALLS], +[AC_DIAGNOSE([obsolete], +[$0: System call restartability is now typically set at runtime. +Remove this `AC_SYS_RESTARTABLE_SYSCALLS' +and adjust your code to use `sigaction' with `SA_RESTART' instead.])dnl +AC_REQUIRE([AC_HEADER_SYS_WAIT])dnl +AC_CHECK_HEADERS(unistd.h) +AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls, +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[/* Exit 0 (true) if wait returns something other than -1, + i.e. the pid of the child, which means that wait was restarted + after getting the signal. */ + +#include <sys/types.h> +#include <signal.h> +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +#if HAVE_SYS_WAIT_H +# include <sys/wait.h> +#endif + +/* Some platforms explicitly require an extern "C" signal handler + when using C++. */ +#ifdef __cplusplus +extern "C" void ucatch (int dummy) { } +#else +void ucatch (dummy) int dummy; { } +#endif + +int +main (void) +{ + int i = fork (), status; + + if (i == 0) + { + sleep (3); + kill (getppid (), SIGINT); + sleep (3); + $ac_main_return (0); + } + + signal (SIGINT, ucatch); + + status = wait (&i); + if (status == -1) + wait (&i); + + $ac_main_return (status == -1); +}])], + [ac_cv_sys_restartable_syscalls=yes], + [ac_cv_sys_restartable_syscalls=no])]) +if test $ac_cv_sys_restartable_syscalls = yes; then + AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS, 1, + [Define if system calls automatically restart after interruption + by a signal.]) +fi +])# AC_SYS_RESTARTABLE_SYSCALLS + + +# AC_SYS_POSIX_TERMIOS +# -------------------- +AC_DEFUN([AC_SYS_POSIX_TERMIOS], +[AC_CACHE_CHECK([POSIX termios], ac_cv_sys_posix_termios, +[AC_TRY_LINK([#include <sys/types.h> +#include <unistd.h> +@%:@include <termios.h>], + [/* SunOS 4.0.3 has termios.h but not the library calls. */ + tcgetattr(0, 0);], + ac_cv_sys_posix_termios=yes, + ac_cv_sys_posix_termios=no)]) +])# AC_SYS_POSIX_TERMIOS + + + +## --------------------- ## +## Checks for X window. ## +## --------------------- ## + + +# _AC_PATH_X_XMKMF +# ---------------- +# Internal subroutine of _AC_PATH_X. +# Set ac_x_includes and/or ac_x_libraries. +m4_define([_AC_PATH_X_XMKMF], +[rm -fr conftest.dir +if mkdir conftest.dir; then + cd conftest.dir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat >Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval "`${MAKE-make} acfindx 2>/dev/null | grep -v make`" + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl dylib dll; do + if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && + test -f "$ac_im_libdir/libX11.$ac_extension"; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case $ac_im_incroot in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; + esac + case $ac_im_usrlibdir in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; + esac + fi + cd .. + rm -fr conftest.dir +fi +])# _AC_PATH_X_XMKMF + + +# _AC_PATH_X_DIRECT +# ----------------- +# Internal subroutine of _AC_PATH_X. +# Set ac_x_includes and/or ac_x_libraries. +m4_define([_AC_PATH_X_DIRECT], +[# Standard set of common directories for X headers. +# Check X11 before X11Rn because it is often a symlink to the current release. +ac_x_header_dirs=' +/usr/X11/include +/usr/X11R7/include +/usr/X11R6/include +/usr/X11R5/include +/usr/X11R4/include + +/opt/local/include +/opt/X11/include + +/usr/include/X11 +/usr/include/X11R7 +/usr/include/X11R6 +/usr/include/X11R5 +/usr/include/X11R4 + +/usr/local/X11/include +/usr/local/X11R7/include +/usr/local/X11R6/include +/usr/local/X11R5/include +/usr/local/X11R4/include + +/usr/local/include/X11 +/usr/local/include/X11R7 +/usr/local/include/X11R6 +/usr/local/include/X11R5 +/usr/local/include/X11R4 + +/usr/X386/include +/usr/x386/include +/usr/XFree86/include/X11 + +/usr/include +/usr/local/include +/usr/unsupported/include +/usr/athena/include +/usr/local/x11r5/include +/usr/lpp/Xamples/include + +/usr/openwin/include +/usr/openwin/share/include' + +if test "$ac_x_includes" = no; then + # Guess where to find include files, by looking for Intrinsic.h. + # First, try using that file with no special directory specified. + AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include <X11/Intrinsic.h>])], +[# We can compile using X headers with no special include directory. +ac_x_includes=], +[for ac_dir in $ac_x_header_dirs; do + if test -r "$ac_dir/X11/Intrinsic.h"; then + ac_x_includes=$ac_dir + break + fi +done]) +fi # $ac_x_includes = no + +if test "$ac_x_libraries" = no; then + # Check for the libraries. + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS=$LIBS + LIBS="-lXt $LIBS" + AC_TRY_LINK([@%:@include <X11/Intrinsic.h>], [XtMalloc (0)], +[LIBS=$ac_save_LIBS +# We can link X programs with no special library path. +ac_x_libraries=], +[LIBS=$ac_save_LIBS +for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` +do + # Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl dylib dll; do + if test -r "$ac_dir/libXt.$ac_extension"; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done]) +fi # $ac_x_libraries = no +])# _AC_PATH_X_DIRECT + + +# _AC_PATH_X +# ---------- +# Compute ac_cv_have_x. +AC_DEFUN([_AC_PATH_X], +[AC_CACHE_VAL(ac_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +ac_x_includes=no ac_x_libraries=no +_AC_PATH_X_XMKMF +_AC_PATH_X_DIRECT +if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi])dnl +]) + + +# AC_PATH_X +# --------- +# If we find X, set shell vars x_includes and x_libraries to the +# paths, otherwise set no_x=yes. +# Uses ac_ vars as temps to allow command line to override cache and checks. +# --without-x overrides everything else, but does not touch the cache. +AC_DEFUN([AC_PATH_X], +[dnl Document the X abnormal options inherited from history. +m4_divert_once([HELP_BEGIN], [ +X features: + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR])dnl +AC_MSG_CHECKING([for X]) + +AC_ARG_WITH(x, [ --with-x use the X Window System]) +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else + _AC_PATH_X + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + AC_MSG_RESULT([$have_x]) + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) +fi +])# AC_PATH_X + + + +# AC_PATH_XTRA +# ------------ +# Find additional X libraries, magic flags, etc. +AC_DEFUN([AC_PATH_XTRA], +[AC_REQUIRE([AC_PATH_X])dnl +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + AC_DEFINE([X_DISPLAY_MISSING], 1, + [Define if the X Window System is missing or not being used.]) + X_CFLAGS= + X_PRE_LIBS= + X_LIBS= + X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" +dnl FIXME: banish uname from this macro! + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + case `(uname -sr) 2>/dev/null` in + "SunOS 5"*) + AC_MSG_CHECKING([whether -R must be followed by a space]) + ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_R_nospace=yes, ac_R_nospace=no) + if test $ac_R_nospace = yes; then + AC_MSG_RESULT([no]) + X_LIBS="$X_LIBS -R$x_libraries" + else + LIBS="$ac_xsave_LIBS -R $x_libraries" + AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_R_space=yes, ac_R_space=no) + if test $ac_R_space = yes; then + AC_MSG_RESULT([yes]) + X_LIBS="$X_LIBS -R $x_libraries" + else + AC_MSG_RESULT([neither works]) + fi + fi + LIBS=$ac_xsave_LIBS + esac + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn Johnson says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And Karl Berry says + # the Alpha needs dnet_stub (dnet does not exist). + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" + AC_TRY_LINK_FUNC(XOpenDisplay, , + [AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi]) + LIBS="$ac_xsave_LIBS" + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to T.E. Dickey. + # The functions gethostbyname, getservbyname, and inet_addr are + # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. + AC_CHECK_FUNC(gethostbyname) + if test $ac_cv_func_gethostbyname = no; then + AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + if test $ac_cv_lib_nsl_gethostbyname = no; then + AC_CHECK_LIB(bsd, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd") + 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 Leinen: 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, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + # Guillermo Gomez says -lposix is necessary on A/UX. + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat) + if test $ac_cv_func_shmat = no; then + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc") + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS=$LDFLAGS + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # John Interrante, Karl Berry + AC_CHECK_LIB(ICE, IceConnectionNumber, + [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"], , $X_EXTRA_LIBS) + LDFLAGS=$ac_save_LDFLAGS + +fi +AC_SUBST(X_CFLAGS)dnl +AC_SUBST(X_PRE_LIBS)dnl +AC_SUBST(X_LIBS)dnl +AC_SUBST(X_EXTRA_LIBS)dnl +])# AC_PATH_XTRA + + + +## ------------------------------------ ## +## Checks for not-quite-Unix variants. ## +## ------------------------------------ ## + + +# AC_CYGWIN +# --------- +# Check for Cygwin. This is a way to set the right value for +# EXEEXT. +AU_DEFUN([AC_CYGWIN], +[AC_REQUIRE([AC_CANONICAL_HOST])[]dnl +AC_DIAGNOSE([obsolete], + [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl +case $host_os in + *cygwin* ) CYGWIN=yes;; + * ) CYGWIN=no;; +esac +])# AC_CYGWIN + + +# AC_EMXOS2 +# --------- +# Check for EMX on OS/2. This is another way to set the right value +# for EXEEXT. +AU_DEFUN([AC_EMXOS2], +[AC_REQUIRE([AC_CANONICAL_HOST])[]dnl +AC_DIAGNOSE([obsolete], + [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl +case $host_os in + *emx* ) EMXOS2=yes;; + * ) EMXOS2=no;; +esac +])# AC_EMXOS2 + + +# AC_MINGW32 +# ---------- +# Check for mingw32. This is another way to set the right value for +# EXEEXT. +AU_DEFUN([AC_MINGW32], +[AC_REQUIRE([AC_CANONICAL_HOST])[]dnl +AC_DIAGNOSE([obsolete], + [$0 is obsolete: use AC_CANONICAL_HOST and $host_os])dnl +case $host_os in + *mingw32* ) MINGW32=yes;; + * ) MINGW32=no;; +esac +])# AC_MINGW32 + + + + +## -------------------------- ## +## Checks for UNIX variants. ## +## -------------------------- ## + + +# These are kludges which should be replaced by a single POSIX check. +# They aren't cached, to discourage their use. + +# AC_AIX +# ------ +AC_DEFUN([AC_AIX], +[AH_VERBATIM([_ALL_SOURCE], +[/* Define if on AIX 3. + System headers sometimes define this. + We just want to avoid a redefinition error message. */ +@%:@ifndef _ALL_SOURCE +@%:@ undef _ALL_SOURCE +@%:@endif])dnl +AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl +AC_MSG_CHECKING([for AIX]) +AC_EGREP_CPP(yes, +[#ifdef _AIX + yes +#endif +], +[AC_MSG_RESULT([yes]) +AC_DEFINE(_ALL_SOURCE)], +[AC_MSG_RESULT([no])]) +])# AC_AIX + + +# AC_MINIX +# -------- +AC_DEFUN([AC_MINIX], +[AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl +AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=) +if test "$MINIX" = yes; then + AC_DEFINE(_POSIX_SOURCE, 1, + [Define if you need to in order for `stat' and other things to + work.]) + AC_DEFINE(_POSIX_1_SOURCE, 2, + [Define if the system does not provide POSIX.1 features except + with this defined.]) + AC_DEFINE(_MINIX, 1, + [Define if on MINIX.]) +fi +])# AC_MINIX + + +# AC_ISC_POSIX +# ------------ +AC_DEFUN([AC_ISC_POSIX], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl +AC_MSG_CHECKING([for POSIXized ISC]) +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION [/usr/include/sys/unistd.h] >/dev/null 2>&1 +then + AC_MSG_RESULT([yes]) + ISC=yes # If later tests want to check for ISC. + AC_DEFINE(_POSIX_SOURCE, 1, + [Define if you need to in order for stat and other things to + work.]) + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + AC_MSG_RESULT([no]) + ISC= +fi +])# AC_ISC_POSIX + + +# AC_XENIX_DIR +# ------------ +AU_DEFUN(AC_XENIX_DIR, +[# You shouldn't need to depend upon XENIX. Remove this test if useless. +AC_MSG_CHECKING([for Xenix]) +AC_EGREP_CPP(yes, +[#if defined(M_XENIX) && !defined(M_UNIX) + yes +@%:@endif], + [AC_MSG_RESULT([yes]); XENIX=yes], + [AC_MSG_RESULT([no]); XENIX=]) + +AC_HEADER_DIRENT[]dnl +]) + + +# AC_DYNIX_SEQ +# ------------ +AU_DEFUN([AC_DYNIX_SEQ], [AC_FUNC_GETMNTENT]) + + +# AC_IRIX_SUN +# ----------- +AU_DEFUN([AC_IRIX_SUN], +[AC_FUNC_GETMNTENT +AC_CHECK_LIB(sun, getpwnam)]) + + +# AC_SCO_INTL +# ----------- +AU_DEFUN([AC_SCO_INTL], [AC_FUNC_STRFTIME]) diff --git a/actypes.m4 b/actypes.m4 new file mode 100644 index 0000000..48a4d07 --- /dev/null +++ b/actypes.m4 @@ -0,0 +1,562 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# Type related macros: existence, sizeof, and structure members. +#------------------------------------------------------------------------------ +# Copyright 2020-2022,2023 Thomas E. Dickey +# Copyright 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by David MacKenzie, with help from +# Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +# Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +## ---------------- ## +## Type existence. ## +## ---------------- ## + +# ---------------- # +# General checks. # +# ---------------- # + +# Up to 2.13 included, Autoconf used to provide the macro +# +# AC_CHECK_TYPE(TYPE, DEFAULT) +# +# Since, it provides another version which fits better with the other +# AC_CHECK_ families: +# +# AC_CHECK_TYPE(TYPE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# +# In order to provide backward compatibility, the new scheme is +# implemented as _AC_CHECK_TYPE_NEW, the old scheme as _AC_CHECK_TYPE_OLD, +# and AC_CHECK_TYPE branches to one or the other, depending upon its +# arguments. + + + +# _AC_CHECK_TYPE_NEW(TYPE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# ------------------------------------------------------------ +# Check whether the type TYPE is supported by the system, maybe via the +# the provided includes. This macro implements the former task of +# AC_CHECK_TYPE, with one big difference though: AC_CHECK_TYPE was +# grepping in the headers, which, BTW, led to many problems until +# the egrep expression was correct and did not given false positives. +# It turned out there are even portability issues with egrep... +# +# The most obvious way to check for a TYPE is just to compile a variable +# definition: +# +# TYPE my_var; +# +# Unfortunately this does not work for const qualified types in C++, +# where you need an initializer. So you think of +# +# TYPE my_var = (TYPE) 0; +# +# Unfortunately, again, this is not valid for some C++ classes. +# +# Then you look for another scheme. For instance you think of declaring +# a function which uses a parameter of type TYPE: +# +# int foo (TYPE param); +# +# but of course you soon realize this does not make it with K&R +# compilers. And by no ways you want to +# +# int foo (param) +# TYPE param +# { ; } +# +# since this time it's C++ who is not happy. +# +# Don't even think of the return type of a function, since K&R cries +# there too. So you start thinking of declaring a *pointer* to this TYPE: +# +# TYPE *p; +# +# but you know fairly well that this is legal in C for aggregates which +# are unknown (TYPE = struct does-not-exist). +# +# Then you think of using sizeof to make sure the TYPE is really +# defined: +# +# sizeof (TYPE); +# +# But this succeeds if TYPE is a variable: you get the size of the +# variable's type!!! +# +# This time you tell yourself the last two options *together* will make +# it. And indeed this is the solution invented by Alexandre Oliva. +# +# Also note that we use +# +# if (sizeof (TYPE)) +# +# to `read' sizeof (to avoid warnings), while not depending on its type +# (not necessarily size_t etc.). Equally, instead of defining an unused +# variable, we just use a cast to avoid warnings from the compiler. +# Suggested by Paul Eggert. +m4_define([_AC_CHECK_TYPE_NEW], +[AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl +AC_CACHE_CHECK([for $1], ac_Type, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])], +[if (($1 *) 0) + return 0; +if (sizeof ($1)) + return 0;])], + [AS_VAR_SET(ac_Type, yes)], + [AS_VAR_SET(ac_Type, no)])]) +AS_IF([test "AS_VAR_GET(ac_Type)" = yes], [$2], [$3])[]dnl +AS_VAR_POPDEF([ac_Type])dnl +])# _AC_CHECK_TYPE_NEW + + +# AC_CHECK_TYPES(TYPES, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# -------------------------------------------------------- +# TYPES is an m4 list. There are no ambiguities here, we mean the newer +# AC_CHECK_TYPE. +AC_DEFUN([AC_CHECK_TYPES], +[m4_foreach([AC_Type], [$1], + [_AC_CHECK_TYPE_NEW(AC_Type, + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Type), 1, + [Define if the system has the type + `]AC_Type['.]) +$2], + [$3], + [$4])])]) + + +# _AC_CHECK_TYPE_OLD(TYPE, DEFAULT) +# --------------------------------- +# FIXME: This is an extremely badly chosen name, since this +# macro actually performs an AC_REPLACE_TYPE. Some day we +# have to clean this up. +m4_define([_AC_CHECK_TYPE_OLD], +[_AC_CHECK_TYPE_NEW([$1],, + [AC_DEFINE_UNQUOTED([$1], [$2], + [Define to `$2' if <sys/types.h> does not define.])])dnl +])# _AC_CHECK_TYPE_OLD + + +# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P(STRING) +# ----------------------------------------- +# Return `1' if STRING seems to be a builtin C/C++ type, i.e., if it +# starts with `_Bool', `bool', `char', `double', `float', `int', +# `long', `short', `signed', or `unsigned' followed by characters +# that are defining types. +# Because many people have used `off_t' and `size_t' too, they are added +# for better common-useward backward compatibility. +m4_define([_AC_CHECK_TYPE_REPLACEMENT_TYPE_P], +[m4_if(m4_regexp([$1], + [^\(_Bool\|bool\|char\|double\|float\|int\|long\|short\|\(un\)?signed\|[_a-zA-Z][_a-zA-Z0-9]*_t\)[][_a-zA-Z0-9() *]*$]), + 0, 1, 0)dnl +])# _AC_CHECK_TYPE_REPLACEMENT_TYPE_P + + +# _AC_CHECK_TYPE_MAYBE_TYPE_P(STRING) +# ----------------------------------- +# Return `1' if STRING looks like a C/C++ type. +m4_define([_AC_CHECK_TYPE_MAYBE_TYPE_P], +[m4_if(m4_regexp([$1], [^[_a-zA-Z0-9 ]+\([_a-zA-Z0-9() *]\|\[\|\]\)*$]), + 0, 1, 0)dnl +])# _AC_CHECK_TYPE_MAYBE_TYPE_P + + +# AC_CHECK_TYPE(TYPE, DEFAULT) +# or +# AC_CHECK_TYPE(TYPE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# ------------------------------------------------------- +# +# Dispatch respectively to _AC_CHECK_TYPE_OLD or _AC_CHECK_TYPE_NEW. +# 1. More than two arguments => NEW +# 2. $2 seems to be replacement type => OLD +# See _AC_CHECK_TYPE_REPLACEMENT_TYPE_P for `replacement type'. +# 3. $2 seems to be a type => NEW plus a warning +# 4. default => NEW +AC_DEFUN([AC_CHECK_TYPE], +[m4_if($#, 3, + [_AC_CHECK_TYPE_NEW($@)], + $#, 4, + [_AC_CHECK_TYPE_NEW($@)], + _AC_CHECK_TYPE_REPLACEMENT_TYPE_P([$2]), 1, + [_AC_CHECK_TYPE_OLD($@)], + _AC_CHECK_TYPE_MAYBE_TYPE_P([$2]), 1, + [AC_DIAGNOSE([syntax], + [$0: assuming `$2' is not a type])_AC_CHECK_TYPE_NEW($@)], + [_AC_CHECK_TYPE_NEW($@)])[]dnl +])# AC_CHECK_TYPE + + + +# ----------------- # +# Specific checks. # +# ----------------- # + +# AC_TYPE_GETGROUPS +# ----------------- +AC_DEFUN([AC_TYPE_GETGROUPS], +[AC_REQUIRE([AC_TYPE_UID_T])dnl +AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups, +[AC_RUN_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT] +[[/* Thanks to Mike Rendell for this test. */ +#include <sys/types.h> +#define NGID 256 +#undef MAX +#define MAX(x, y) ((x) > (y) ? (x) : (y)) + +int +main (void) +{ + 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. */ + $ac_main_return ((n > 0 && gidset[n] != val.gval) ? 1 : 0); +}]])], + [ac_cv_type_getgroups=gid_t], + [ac_cv_type_getgroups=int], + [ac_cv_type_getgroups=cross]) +if test $ac_cv_type_getgroups = cross; then + dnl When we can't run the test program (we are cross compiling), presume + dnl that <unistd.h> has either an accurate prototype for getgroups or none. + dnl Old systems without prototypes probably use int. + AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h, + ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int) +fi]) +AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups, + [Define to the type of elements in the array set by + `getgroups'. Usually this is either `int' or `gid_t'.]) +])# AC_TYPE_GETGROUPS + + +# AU::AM_TYPE_PTRDIFF_T +AU_DEFUN([AM_TYPE_PTRDIFF_T], +[AC_CHECK_TYPES(ptrdiff_t)]) + + +# AC_TYPE_UID_T +# ------------- +# FIXME: Rewrite using AC_CHECK_TYPE. +AC_DEFUN([AC_TYPE_UID_T], +[AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t, +[AC_EGREP_HEADER(uid_t, sys/types.h, + ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)]) +if test $ac_cv_type_uid_t = no; then + AC_DEFINE(uid_t, int, [Define to `int' if <sys/types.h> doesn't define.]) + AC_DEFINE(gid_t, int, [Define to `int' if <sys/types.h> doesn't define.]) +fi +]) + + +AC_DEFUN([AC_TYPE_SIZE_T], [AC_CHECK_TYPE(size_t, unsigned)]) +AC_DEFUN([AC_TYPE_PID_T], [AC_CHECK_TYPE(pid_t, int)]) +AC_DEFUN([AC_TYPE_OFF_T], [AC_CHECK_TYPE(off_t, long)]) +AC_DEFUN([AC_TYPE_MODE_T], [AC_CHECK_TYPE(mode_t, int)]) + + +# AC_TYPE_SIGNAL +# -------------- +# Note that identifiers starting with SIG are reserved by ANSI C. +AC_DEFUN([AC_TYPE_SIGNAL], +[AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal, +[AC_COMPILE_IFELSE( +[AC_LANG_PROGRAM([#include <sys/types.h> +#include <signal.h> +#ifdef signal +# undef signal +#endif +extern void (*signal (int, void (*)(int)))(int); +], + [int i; (void) i])], + [ac_cv_type_signal=void], + [ac_cv_type_signal=int])]) +AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal, + [Define as the return type of signal handlers + (`int' or `void').]) +]) + + +## ------------------------ ## +## Checking size of types. ## +## ------------------------ ## + +# ---------------- # +# Generic checks. # +# ---------------- # + + +# AC_CHECK_SIZEOF(TYPE, [IGNORED], [INCLUDES]) +# -------------------------------------------- +AC_DEFUN([AC_CHECK_SIZEOF], +[AS_LITERAL_IF([$1], [], + [AC_FATAL([$0: requires literal arguments])])dnl +AC_CHECK_TYPE([$1], [], [], [$3]) +AC_CACHE_CHECK([size of $1], AS_TR_SH([ac_cv_sizeof_$1]), +[if test "$AS_TR_SH([ac_cv_type_$1])" = yes; then + _AC_COMPUTE_INT([sizeof ($1)], + [AS_TR_SH([ac_cv_sizeof_$1])], + [AC_INCLUDES_DEFAULT([$3])]) +else + AS_TR_SH([ac_cv_sizeof_$1])=0 +fi])dnl +AC_DEFINE_UNQUOTED(AS_TR_CPP(sizeof_$1), $AS_TR_SH([ac_cv_sizeof_$1]), + [The size of a `$1', as computed by sizeof.]) +])# AC_CHECK_SIZEOF + + + +# ---------------- # +# Generic checks. # +# ---------------- # + +# AU::AC_INT_16_BITS +# ------------------ +# What a great name :) +AU_DEFUN([AC_INT_16_BITS], +[AC_CHECK_SIZEOF([int]) +AC_DIAGNOSE([obsolete], [$0: + your code should no longer depend upon `INT_16_BITS', but upon + `SIZEOF_INT'. Remove this warning and the `AC_DEFINE' when you + adjust the code.])dnl +test $ac_cv_sizeof_int = 2 && + AC_DEFINE(INT_16_BITS, 1, + [Define if `sizeof (int)' = 2. Obsolete, use `SIZEOF_INT'.]) +]) + + +# AU::AC_LONG_64_BITS +# ------------------- +AU_DEFUN([AC_LONG_64_BITS], +[AC_CHECK_SIZEOF([long int]) +AC_DIAGNOSE([obsolete], [$0: + your code should no longer depend upon `LONG_64_BITS', but upon + `SIZEOF_LONG_INT'. Remove this warning and the `AC_DEFINE' when + you adjust the code.])dnl +test $ac_cv_sizeof_long_int = 8 && + AC_DEFINE(LONG_64_BITS, 1, + [Define if `sizeof (long int)' = 8. Obsolete, use + `SIZEOF_LONG_INT'.]) +]) + + + +## -------------------------- ## +## Generic structure checks. ## +## -------------------------- ## + + +# ---------------- # +# Generic checks. # +# ---------------- # + +# AC_CHECK_MEMBER(AGGREGATE.MEMBER, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES]) +# --------------------------------------------------------- +# AGGREGATE.MEMBER is for instance `struct passwd.pw_gecos', shell +# variables are not a valid argument. +AC_DEFUN([AC_CHECK_MEMBER], +[AS_LITERAL_IF([$1], [], + [AC_FATAL([$0: requires literal arguments])])dnl +m4_if(m4_regexp([$1], [\.]), -1, + [AC_FATAL([$0: Did not see any dot in `$1'])])dnl +AS_VAR_PUSHDEF([ac_Member], [ac_cv_member_$1])dnl +dnl Extract the aggregate name, and the member name +AC_CACHE_CHECK([for $1], ac_Member, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])], +[dnl AGGREGATE ac_aggr; +static m4_patsubst([$1], [\..*]) ac_aggr; +dnl ac_aggr.MEMBER; +if (ac_aggr.m4_patsubst([$1], [^[^.]*\.])) +return 0;])], + [AS_VAR_SET(ac_Member, yes)], + [AS_VAR_SET(ac_Member, no)])]) +AS_IF([test "AS_VAR_GET(ac_Member)" = yes], [$2], [$3])dnl +AS_VAR_POPDEF([ac_Member])dnl +])# AC_CHECK_MEMBER + + +# AC_CHECK_MEMBERS([AGGREGATE.MEMBER, ...], +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND] +# [INCLUDES]) +# --------------------------------------------------------- +# The first argument is an m4 list. +AC_DEFUN([AC_CHECK_MEMBERS], +[m4_foreach([AC_Member], [$1], + [AC_CHECK_MEMBER(AC_Member, + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]AC_Member), 1, + [Define if `]m4_patsubst(AC_Member, + [^[^.]*\.])[' is + member of `]m4_patsubst(AC_Member, [\..*])['.]) +$2], + [$3], + [$4])])]) + + +# ----------------- # +# Specific checks. # +# ----------------- # + +# Alphabetic order, please. + +# AC_STRUCT_ST_BLKSIZE +# -------------------- +AU_DEFUN([AC_STRUCT_ST_BLKSIZE], +[AC_DIAGNOSE([obsolete], [$0: + your code should no longer depend upon `HAVE_ST_BLKSIZE', but + `HAVE_STRUCT_STAT_ST_BLKSIZE'. Remove this warning and + the `AC_DEFINE' when you adjust the code.]) +AC_CHECK_MEMBERS([struct stat.st_blksize], + [AC_DEFINE(HAVE_ST_BLKSIZE, 1, + [Define if your `struct stat' has + `st_blksize'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLKSIZE' instead.])]) +])# AC_STRUCT_ST_BLKSIZE + + +# AC_STRUCT_ST_BLOCKS +# ------------------- +# If `struct stat' contains an `st_blocks' member, define +# HAVE_STRUCT_STAT_ST_BLOCKS. Otherwise, add `fileblocks.o' to the +# output variable LIBOBJS. We still define HAVE_ST_BLOCKS for backward +# compatibility. In the future, we will activate specializations for +# this macro, so don't obsolete it right now. +# +# AC_OBSOLETE([$0], [; replace it with +# AC_CHECK_MEMBERS([struct stat.st_blocks], +# [AC_LIBOBJ([fileblocks])]) +# Please note that it will define `HAVE_STRUCT_STAT_ST_BLOCKS', +# and not `HAVE_ST_BLOCKS'.])dnl +# +AC_DEFUN([AC_STRUCT_ST_BLOCKS], +[AC_CHECK_MEMBERS([struct stat.st_blocks], + [AC_DEFINE(HAVE_ST_BLOCKS, 1, + [Define if your `struct stat' has + `st_blocks'. Deprecated, use + `HAVE_STRUCT_STAT_ST_BLOCKS' instead.])], + [AC_LIBOBJ([fileblocks])]) +])# AC_STRUCT_ST_BLOCKS + + +# AC_STRUCT_ST_RDEV +# ----------------- +AU_DEFUN([AC_STRUCT_ST_RDEV], +[AC_DIAGNOSE([obsolete], [$0: + your code should no longer depend upon `HAVE_ST_RDEV', but + `HAVE_STRUCT_STAT_ST_RDEV'. Remove this warning and + the `AC_DEFINE' when you adjust the code.]) +AC_CHECK_MEMBERS([struct stat.st_rdev], + [AC_DEFINE(HAVE_ST_RDEV, 1, + [Define if your `struct stat' has `st_rdev'. + Deprecated, use `HAVE_STRUCT_STAT_ST_RDEV' + instead.])]) +])# AC_STRUCT_ST_RDEV + + +# AC_STRUCT_TM +# ------------ +# FIXME: This macro is badly named, it should be AC_CHECK_TYPE_STRUCT_TM. +# Or something else, but what? AC_CHECK_TYPE_STRUCT_TM_IN_SYS_TIME? +AC_DEFUN([AC_STRUCT_TM], +[AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h], + ac_cv_struct_tm, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h> +#include <time.h> +], + [static struct tm tp; long xx = tp.tm_sec; (void)xx])], + [ac_cv_struct_tm=time.h], + [ac_cv_struct_tm=sys/time.h])]) +if test $ac_cv_struct_tm = sys/time.h; then + AC_DEFINE(TM_IN_SYS_TIME, 1, + [Define if your <sys/time.h> declares `struct tm'.]) +fi +])# AC_STRUCT_TM + + +# AC_STRUCT_TIMEZONE +# ------------------ +# Figure out how to get the current timezone. If `struct tm' has a +# `tm_zone' member, define `HAVE_TM_ZONE'. Otherwise, if the +# external array `tzname' is found, define `HAVE_TZNAME'. +AC_DEFUN([AC_STRUCT_TIMEZONE], +[AC_REQUIRE([AC_STRUCT_TM])dnl +AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <sys/types.h> +#include <$ac_cv_struct_tm> +]) +if test "$ac_cv_member_struct_tm_tm_zone" = yes; then + AC_DEFINE(HAVE_TM_ZONE, 1, + [Define if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead.]) +else + AC_CACHE_CHECK(for tzname, ac_cv_var_tzname, +[AC_TRY_LINK( +[#include <time.h> +#ifndef tzname /* For SGI. */ +extern char *tzname[]; /* RS6000 and others reject char **tzname. */ +#endif +], +[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)]) + if test $ac_cv_var_tzname = yes; then + AC_DEFINE(HAVE_TZNAME, 1, + [Define if you don't have `tm_zone' but do have the external + array `tzname'.]) + fi +fi +])# AC_STRUCT_TIMEZONE diff --git a/acversion.in b/acversion.in new file mode 100644 index 0000000..6e4469f --- /dev/null +++ b/acversion.in @@ -0,0 +1,7 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# Version of Autoconf. +#------------------------------------------------------------------------------ +# Copyright 2003-2022,2023 Thomas E. Dickey +# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + +m4_define([AC_ACVERSION], [@VERSION@]) diff --git a/acversion.m4 b/acversion.m4 new file mode 100644 index 0000000..2aebe18 --- /dev/null +++ b/acversion.m4 @@ -0,0 +1,7 @@ +# This file is part of Autoconf. -*- Autoconf -*- +# Version of Autoconf. +#------------------------------------------------------------------------------ +# Copyright 2003-2022,2023 Thomas E. Dickey +# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + +m4_define([AC_ACVERSION], [2.52.20231210]) diff --git a/autoconf.in b/autoconf.in new file mode 100644 index 0000000..1140ff9 --- /dev/null +++ b/autoconf.in @@ -0,0 +1,801 @@ +#! @SHELL@ +# -*- shell-script -*- +# vile:shmode: +# autoconf -- create `configure' using m4 macros +#------------------------------------------------------------------------------ +# Copyright 2003-2022,2023 Thomas E. Dickey +# Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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. + +me=`echo "$0" | sed -e 's,.*[\\/],,'` + +usage="\ +Usage: $0 [OPTION] ... [TEMPLATE-FILE] + +Generate a configuration script from a TEMPLATE-FILE if given, or +\`configure.ac' if present, or else \`configure.in'. Output is sent +to the standard output if TEMPLATE-FILE is given, else into +\`configure'. + +Operation modes: + -h, --help print this help, then exit + -V, --version print version number, then exit + -v, --verbose verbosely report processing + -d, --debug don't remove temporary files + -o, --output=FILE save output in FILE (stdout is the default) + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax] + +Options: + -opt-functions use shell-functions to reduce repetition + +Warning categories include: + \`cross' cross compilation issues + \`obsolete' obsolete constructs + \`syntax' dubious syntactic constructs + \`all' all the warnings + \`no-CATEGORY' turn off the warnings on CATEGORY + \`none' turn off all the warnings + \`error' warnings are error + +The environment variable \`WARNINGS' is honored. + +Library directories: + -A, --autoconf-dir=ACDIR Autoconf's macro files location (rarely needed) + -l, --localdir=DIR location of the \`aclocal.m4' file + +Tracing: + -t, --trace=MACRO report the list of calls to MACRO + -i, --initialization also trace Autoconf's initialization process + +In tracing mode, no configuration script is created. + +Report bugs to <@PACKAGE_BUGREPORT@>." + +version="\ +autoconf (@PACKAGE_NAME@) @VERSION@ +Written by David J. MacKenzie. + +Copyright 2003-2022,2023 Thomas E. Dickey +Copyright 1992, 1993, 1994, 1996, 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." + +exit_missing_arg="\ +echo \"$me: option \\\`\$1' requires an argument\" >&2 +echo \"\$help\" >&2 +exit 1" + +# NLS nuisances. +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_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi + +# ac_LF_and_DOT +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` + +# Find GNU m4. +# Handle the case that m4 has moved since we were configured. +# It may have been found originally in a build directory. +: ${M4=@M4@} +case "$M4" in + [\\/]* | ?:[\\/]*) test -f "$M4" || M4=m4 ;; +esac +# Some non-GNU m4's don't reject the --help option, so give them /dev/null. +case `$M4 --help </dev/null 2>&1` in +*reload-state*);; +*) echo "$me: Autoconf requires GNU m4 1.4 or later" >&2; exit 1 ;; +esac + +# Set some high recursion limit as the default limit, 250, has already +# been hit with AC_OUTPUT. +case " $M4 " in + *" --nesting-limit"* | *" -L"* ) + # Don't override the user's choice + ;; + *) M4="$M4 --nesting-limit=1024" + ;; +esac + + +# Find a good AWK. +: ${AWK=@AWK@} +if echo xfoo | $AWK '/foo|^bar$/ { print }' | grep xfoo >/dev/null; then :; else + echo "$me: the regex engine of $AWK is too broken to be used" >&2 + echo "$me: you might want to install GNU AWK" >&2 + exit 1 +fi + + +# Variables. +: ${autoconf_dir=${AC_MACRODIR=@datadir@}} +debug=false +# Trace Autoconf's initialization? +initialization=false +localdir=. +outfile= +# Options: +autoconf_opts= +# Exit status. +status=0 +# Tasks: +# - trace +# Trace the first arguments of some macros +# - script +# Produce the configure script (default) +task=script +tmp= +verbose=: + +# Parse command line. +while test $# -gt 0 ; do + optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \ + "x$1" : 'x-.\(.*\)'` + case $1 in + --version | -V ) + echo "$version" ; exit 0 ;; + --help | -h ) + echo "$usage"; exit 0 ;; + + --debug | -d ) + debug=:; shift ;; + --verbose | -v ) + verbose=echo + shift;; + + --localdir=* | -l?* ) + localdir=$optarg + shift ;; + --localdir | -l ) + test $# = 1 && eval "$exit_missing_arg" + shift + localdir=$1 + shift ;; + + --autoconf-dir=* | -A?* ) + autoconf_dir=$optarg + shift ;; + --autoconf-dir | -A ) + test $# = 1 && eval "$exit_missing_arg" + shift + autoconf_dir=$1 + shift ;; + --macrodir=* | -m?* ) + echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2 + autoconf_dir=$optarg + shift ;; + --macrodir | -m ) + echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2 + test $# = 1 && eval "$exit_missing_arg" + shift + autoconf_dir=$1 + shift ;; + + --opt-functions ) + autoconf_opts="$autoconf_opts -D_OPT_SHFUN" + shift ;; + + --trace=* | -t?* ) + task=trace + traces="$traces '"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'" + shift ;; + --trace | -t ) + test $# = 1 && eval "$exit_missing_arg" + task=trace + shift + traces="$traces '"`echo "$1" | sed "s/'/'\\\\\\\\''/g"`"'" + shift ;; + --initialization | -i ) + initialization=: + shift;; + + --output=* | -o?* ) + outfile=$optarg + shift ;; + --output | -o ) + test $# = 1 && eval "$exit_missing_arg" + shift + outfile=$1 + shift ;; + + --warnings=* | -W?* ) + warnings=$warnings,$optarg + shift ;; + --warnings | -W ) + test $# = 1 && eval "$exit_missing_arg" + shift + warnings=$warnings,$1 + shift ;; + + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + exec >&2 + echo "$me: invalid option $1" + echo "$help" + exit 1 ;; + * ) + break ;; + esac +done + +# The warnings are the concatenation of 1. application's defaults, +# 2. $WARNINGS, $3 command line options, in that order. +# Set them in the order expected by the M4 macros: the converse. +alphabet='abcdefghijklmnopqrstuvwxyz' +ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +NUMBERS='0123456789' +WORDCHAR=_$alphabet$ALPHABET$NUMBERS + +m4_warnings= +for warning in `IFS=,; echo syntax $WARNINGS $warnings | + tr $ALPHABET $alphabet` +do + test -n $warning || continue + m4_warnings="$warning"`test -n "$m4_warnings" && echo ",$m4_warnings"` +done + + +# Trap on 0 to stop playing with `rm'. +$debug || +{ + trap 'status=$?; rm -rf $tmp && exit $status' 0 + trap '(exit 1); exit 1' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/acXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/ac$$ + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + (exit 1); exit 1; +} + +# Running m4. +test -f "$autoconf_dir/acsite.m4" && acsite_m4="$autoconf_dir/acsite.m4" +test -f "$localdir/aclocal.m4" && aclocal_m4="$localdir/aclocal.m4" +m4_common="-I $autoconf_dir -I $localdir -Dm4_tmpdir=$tmp $autoconf_opts" +m4_prefiles=" $autoconf_dir/autoconf.m4 $acsite_m4 $aclocal_m4" +m4f_prefiles="--reload-state=$autoconf_dir/autoconf.m4f $acsite_m4 $aclocal_m4" +run_m4="$M4 $m4_common" + +# Find the input file. +case $# in + 0) + case `ls configure.ac configure.in 2>/dev/null` in + *ac*in ) + echo "$me: warning: both \`configure.ac' and \`configure.in' are present." >&2 + echo "$me: warning: proceeding with \`configure.ac'." >&2 + infile=configure.ac;; + *ac ) infile=configure.ac;; + *in ) infile=configure.in;; + * ) + echo "$me: no input file" >&2 + exit 1;; + esac + test $task = script && test -z "$outfile" && outfile=configure;; + 1) infile=$1 ;; + *) exec >&2 + echo "$me: invalid number of arguments." + echo "$help" + (exit 1); exit 1 ;; +esac + +# Unless specified, the output is stdout. +test -z "$outfile" && outfile=- + +# We need an actual file. +if test z$infile = z-; then + infile=$tmp/stdin + cat >$infile +elif test ! -r "$infile"; then + echo "$me: $infile: No such file or directory" >&2 + (exit 1); exit 1 +fi + +# Output is produced into FD 4. Prepare it. +case $outfile in + -) # Output to stdout + exec 4>&1 ;; + * ) + exec 4>$outfile;; +esac + +# Initializations are performed. Proceed to the main task. +case $task in + + ## --------------------------------- ## + ## Generate the `configure' script. ## + ## --------------------------------- ## + script) + # M4 expansion. + : >$tmp/forbidden.rx + : >$tmp/allowed.rx + $verbose "$me: running $run_m4 -Dm4_warnings=$m4_warnings $m4f_prefiles $infile" >&2 + $run_m4 -Dm4_warnings=$m4_warnings $m4f_prefiles $infile >$tmp/configure || + { (exit 1); exit 1; } + + if test "x$outfile" != x-; then + chmod +x $outfile + fi + + # Put the real line numbers into configure to make config.log more + # helpful. Because quoting can sometimes get really painful in m4, + # there are special @tokens@ to substitute. + sed 's/^ //' >"$tmp/finalize.awk" <<EOF + # Load the list of tokens which escape the forbidden patterns. + BEGIN { + # Be sure to read the GAWK documentation to understand the parens + # around \`tmp "/forbidden.rx"'. + while ((getline pattern < (tmp "/forbidden.rx")) > 0) + forbidden = (forbidden ? forbidden "|" : "") pattern + close (tmp "/forbidden.rx") + if (verbose) + errprint("$me: forbidden: " forbidden) + + while ((getline pattern < (tmp "/allowed.rx")) > 0) + allowed = (allowed ? allowed "|" : "") pattern + if (!allowed) + allowed = "^$" + close (tmp "/allowed.rx") + if (verbose) + errprint("$me: allowed: " allowed) + } + + function errprint (message) + { + # BAD! the pipe to 'cat >&2' doesn't work for DJGPP. + # print message | "cat >&2" + # Use normal redirection instead: + print message > "$tmp/finalize.err" + } + + function undefined (file, line, macro) + { + errprint(file ":" line ": error: possibly undefined macro: " macro) + } + + # Body. + { + sub (/[ \t]*$/, "") + if (\$0 == "") + { + if (!duplicate) + { + oline++ + print + } + duplicate = 1 + next + } + duplicate = 0 + oline++ + if (\$0 ~ /__oline__/) + while (sub (/__oline__/, oline)) + continue + while (sub (/@<:@/, "[")) + continue + while (sub (/@:>@/, "]")) + continue + while (sub (/@S\|@/, "$")) + continue + while (sub (/@%:@/, "#")) + continue + + print + + # Dubious feature: we tolerate macro names when commented. + sub (/#.*/, "") + + # Get the tokens. + split (\$0, tokens, /[^$WORDCHAR]*/) + + for (token in tokens) + if (match (tokens[token], forbidden) && + !match (tokens[token], allowed)) + { + macros [tokens [token]] = oline + some_macros_were_not_expanded = 1 + } + } + + # If there are some macros which are left unexpanded in the output, + # try to find the input which is responsible. Otherwise, try to help. + END { + if (some_macros_were_not_expanded) + { + line = 0 + while (getline < "$infile") + { + line++ + for (macro in macros) + if (index (\$0, macro)) + { + delete macros [macro] + undefined("$infile", line, macro) + } + } + close ("$infile") + for (macro in macros) + undefined("$outfile", macros [macro], macro) + exit 1 + } + } +EOF + $AWK -v tmp="$tmp" \ + `$verbose "-v verbose=1"` \ + -f "$tmp/finalize.awk" <$tmp/configure >&4 || + { test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 + (exit 1); exit 1; } + test -f "$tmp/finalize.err" && cat "$tmp/finalize.err" >&2 + ;; # End of the task script. + + + + ## -------------- ## + ## Trace macros. ## + ## -------------- ## + trace) + + # trace.m4 + # -------- + # Routines to process formatted m4 traces. + sed 's/^ //' >$tmp/trace.m4 <<\EOF + divert(-1) + changequote([, ]) + # _at_MODE(SEPARATOR, ELT1, ELT2...) + # ---------------------------------- + # List the elements, separating then with SEPARATOR. + # MODE can be: + # `at' -- the elements are enclosed in brackets. + # `star' -- the elements are listed as are. + # `percent' -- the elements are `flattened': spaces are singled out, + # and no new line remains. + define([_at_at], + [at_ifelse([$#], [1], [], + [$#], [2], [[[$2]]], + [[[$2]][$1]$0([$1], at_shift(at_shift($@)))])]) + define([_at_percent], + [at_ifelse([$#], [1], [], + [$#], [2], [at_flatten([$2])], + [at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) + define([_at_star], + [at_ifelse([$#], [1], [], + [$#], [2], [[$2]], + [[$2][$1]$0([$1], at_shift(at_shift($@)))])]) + + # FLATTEN quotes its result. + define([at_flatten], + [at_patsubst(at_patsubst(at_patsubst([[[$1]]], + [\\ + ]), + [[ + ]+], + [ ]), + [^ *\(.*\) *$], [[\1]])]) + + define([at_args], [at_shift(at_shift(at_shift(at_shift(at_shift($@)))))]) + define([at_at], [_$0([$1], at_args($@))]) + define([at_percent], [_$0([$1], at_args($@))]) + define([at_star], [_$0([$1], at_args($@))]) + +EOF + + # If you trace `define', then on `define([m4_exit], defn([m4exit])' you + # will produce + # + # AT_define([m4sugar.m4], [115], [1], [define], [m4_exit], <m4exit>) + # + # Since `<m4exit>' is not quoted, the outer m4, when processing + # `trace.m4' will exit prematurely. Hence, move all the builtins to + # the `at_' name space. + echo '# Copy the builtins.' >>$tmp/trace.m4 + echo "dumpdef" | + $M4 2>&1 >/dev/null | + sed 's/^\([^:]*\):.*/define([at_\1], defn([\1]))/' >>$tmp/trace.m4 + echo >>$tmp/trace.m4 + + echo '# Disable the builtins.' >>$tmp/trace.m4 + echo "dumpdef" | + $M4 2>&1 >/dev/null | + sed 's/^\([^:]*\):.*/at_undefine([\1])/' >>$tmp/trace.m4 + echo >>$tmp/trace.m4 + + + # trace2m4.sed + # ------------ + # Transform the traces from m4 into an m4 input file. + # Typically, transform: + # + # | m4trace:configure.ac:3: -1- AC_SUBST([exec_prefix], [NONE]) + # + # into + # + # | AT_AC_SUBST([configure.ac], [3], [1], [AC_SUBST], [exec_prefix], [NONE]) + # + # Pay attention that the file name might include colons, if under DOS + # for instance, so we don't use `[^:][^:]*'. + # The first s/// catches multiline traces, the second, traces as above. + preamble='m4trace:\(..*\):\([0-9][0-9]*\): -\([0-9][0-9]*\)-' + cat >$tmp/trace2m4.sed <<EOF + s/^$preamble \([^(][^(]*\)(\(.*\)$/AT_\4([\1], [\2], [\3], [\4], \5/ + s/^$preamble \(.*\)$/AT_\4([\1], [\2], [\3], [\4])/ +EOF + + # translate.awk + # ------------- + # Translate user tracing requests into m4 macros. + cat >$tmp/translate.awk <<\EOF + function trans (arg, sep) + { + # File name. + if (arg == "f") + return "$1" + # Line number. + if (arg == "l") + return "$2" + # Depth. + if (arg == "d") + return "$3" + # Name (also available as $0). + if (arg == "n") + return "$4" + # Escaped dollar. + if (arg == "$") + return "$" + + # $@, list of quoted effective arguments. + if (arg == "@") + return "]at_at([" (separator ? separator : ",") "], $@)[" + # $*, list of unquoted effective arguments. + if (arg == "*") + return "]at_star([" (separator ? separator : ",") "], $@)[" + # $%, list of flattened unquoted effective arguments. + if (arg == "%") + return "]at_percent([" (separator ? separator : ":") "], $@)[" + } + + function error (message) + { + print message | "cat >&2" + exit 1 + } + + { + # Accumulate the whole input. + request = request $0 "\n" + } + + END { + # Chomp. + request = substr (request, 1, length (request) - 1) + # The default request is `$f:$l:$n:$*'. + colon = index (request, ":") + macro = colon ? substr (request, 1, colon - 1) : request + request = colon ? substr (request, colon + 1) : "$f:$l:$n:$%" + + res = "" + + for (cp = request; cp; cp = substr (cp, 2)) + { + char = substr (cp, 1, 1) + if (char == "$") + { + if (match (cp, /^\$[0-9]+/)) + { + # $n -> $(n + 4) + res = res "$" (substr (cp, 2, RLENGTH - 1) + 4) + cp = substr (cp, RLENGTH) + } + else if (substr (cp, 2, 1) ~ /[fldn$@%*]/) + { + # $x, no separator given. + res = res trans(substr (cp, 2, 1)) + cp = substr (cp, 2) + } + else if (substr (cp, 2, 1) == "{") + { + # ${sep}x, long separator. + end = index (cp, "}") + if (!end) + error("invalid escape: " cp) + separator = substr (cp, 3, end - 3) + if (substr (cp, end + 1, 1) ~ /[*@%]/) + res = res trans(substr (cp, end + 1, 1), separator) + else + error("invalid escape: " cp) + cp = substr (cp, end + 1) + } + else if (substr (cp, 3, 1) ~ /[*@%]/) + { + # $sx, short separator `s'. + res = res trans(substr (cp, 3, 1), substr (cp, 2, 1)) + cp = substr(cp, 3) + } + else + { + error("invalid escape: " substr (cp, 1, 2)) + } + } + else + res = res char + } + + # Produce the definition of AT_<MACRO> = the translation of the request. + print "at_define([AT_" macro "]," + print "[[" res "]])" + print "" + close("cat >&2") + } +EOF + + + # Extract both the m4 program and the m4 options from TRACES. + echo "## ------------------------- ##" >>$tmp/trace.m4 + echo "## Trace processing macros. ##" >>$tmp/trace.m4 + echo "## ------------------------- ##" >>$tmp/trace.m4 + echo >>$tmp/trace.m4 + + eval set dummy "$traces" + shift + for trace + do + echo "# $trace" >>$tmp/trace.m4 + + # The request may be several lines long, hence sed has to quit. + macro_name=`echo "$trace" | sed 's/:.*//;q'` + # If for instance TRACE is `define', be sure to have an empty + # TRACE_FORMAT. + case $trace in + $macro_name:* ) + trace_format=`echo "$trace" | sed "1s/^$macro_name:/:/"`;; + * ) + trace_format=;; + esac + + # GNU M4 1.4's tracing of builtins is buggy. When run on this input: + # + # | divert(-1) + # | changequote([, ]) + # | define([m4_eval], defn([eval])) + # | eval(1) + # | m4_eval(2) + # | undefine([eval]) + # | m4_eval(3) + # + # it behaves this way: + # + # | % m4 input.m4 -da -t eval + # | m4trace: -1- eval(1) + # | m4trace: -1- m4_eval(2) + # | m4trace: -1- m4_eval(3) + # | % + # + # Conversely: + # + # | % m4 input.m4 -da -t m4_eval + # | % + # + # So we will merge them, i.e. tracing `BUILTIN' or tracing + # `m4_BUILTIN' will be the same: tracing both, but honoring the + # *last* trace specification. + # FIXME: This is not enough: in the output `$0' will be `BUILTIN' + # sometimes and `m4_BUILTIN' at others. We should render a unique name, + # the one specified by the user. + base_name=`echo "$macro_name" | sed 's/^m4_//'` + if echo "ifdef(\`$base_name', \`', \`m4exit(1)')" | $M4; then + # BASE_NAME is a builtin. + trace_opt="$trace_opt -t $base_name -t m4_$base_name" + echo "$base_name$trace_format" | + $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || + { (exit 1); exit 1; } + echo "m4_$base_name$trace_format" | + $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || + { (exit 1); exit 1; } + else + # MACRO_NAME is not a builtin. + trace_opt="$trace_opt -t $macro_name" + echo "$trace" | + $AWK -f $tmp/translate.awk >>$tmp/trace.m4 || + { (exit 1); exit 1; } + fi + echo >>$tmp/trace.m4 + done + + echo "## ------------------- ##" >>$tmp/trace.m4 + echo "## Traces to process. ##" >>$tmp/trace.m4 + echo "## ------------------- ##" >>$tmp/trace.m4 + echo >>$tmp/trace.m4 + echo "at_divert(0)at_dnl" >>$tmp/trace.m4 + + # Do we trace the initialization? + # `errprint' must be silent, otherwise there can be warnings mixed + # with traces in m4's stderr. + run_m4_trace="$run_m4 $trace_opt -daflq -Derrprint" + if $initialization; then + trace_prefiles="$m4_prefiles" + else + trace_prefiles="$m4f_prefiles" + fi + + # Run m4 on the input file to get traces. + # + # We used to have a simple pipe, which was very convenient as it + # allows to use traces on never ending expansions (i.e., when + # debugging :) but it is requires to keep error messages *and* + # traces in stderr. This is too fragile, as it results in + # unexpected data in the output. autoheader has been fragile to + # this. + $verbose "$me: running $run_m4_trace $trace_prefiles $infile -o $tmp/traces" >&2 + $run_m4_trace $trace_prefiles $infile -o $tmp/traces >/dev/null || + { + echo "$me: tracing failed" >&2 + (exit 1); exit 1 + } + + $verbose "$me: running $M4 $tmp/trace.m4" >&2 + sed -f $tmp/trace2m4.sed $tmp/traces | + # Now we are ready to run m4 to process the trace file. + if $debug; then + cat >>$tmp/trace.m4 + $M4 $tmp/trace.m4 + else + $M4 $tmp/trace.m4 - + fi | + # It makes no sense to try to transform __oline__. + sed ' + s/@<:@/[/g + s/@:>@/]/g + s/@S|@/$/g + s/@%:@/#/g + ' >&4 || + { + echo "$me: traces formatting failed" >&2 + (exit 1); exit 1 + } + ;; + + + ## ------------ ## + ## Unknown task ## + ## ------------ ## + + *) echo "$me: internal error: unknown task: $task" >&2 + (exit 1); exit 1 +esac + +(exit $status); exit $status diff --git a/autoconf.m4 b/autoconf.m4 new file mode 100644 index 0000000..0ea9c43 --- /dev/null +++ b/autoconf.m4 @@ -0,0 +1,67 @@ +include(m4sh.m4)# -*- Autoconf -*- +# This file is part of Autoconf. +# Driver that loads the Autoconf macro files. +# Copyright 1994, 1999, 2000, 2001 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 +# the Free Software Foundation; either version 2, 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. +# +# Written by David MacKenzie. +# +# Do not sinclude acsite.m4 here, because it may not be installed +# yet when Autoconf is frozen. +# Do not sinclude ./aclocal.m4 here, to prevent it from being frozen. + +m4_include([acversion.m4]) +m4_include([acgeneral.m4]) +m4_include([aclang.m4]) +m4_include([acfunctions.m4]) +m4_include([acheaders.m4]) +m4_include([actypes.m4]) +m4_include([acspecific.m4]) +m4_include([acoldnames.m4]) + +# We discourage the use of the non prefixed macro names: M4sugar maps +# all the builtins into `m4_'. Autoconf has been converted to these +# names too. But users may still depend upon these, so reestablish +# them. + +m4_copy_unm4([m4_builtin]) +m4_copy_unm4([m4_changequote]) +m4_copy_unm4([m4_decr]) +m4_copy_unm4([m4_define]) +m4_copy_unm4([m4_defn]) +m4_copy_unm4([m4_divert]) +m4_copy_unm4([m4_divnum]) +m4_copy_unm4([m4_errprint]) +m4_copy_unm4([m4_esyscmd]) +m4_copy_unm4([m4_ifdef]) +m4_copy([m4_if], [ifelse]) +m4_copy_unm4([m4_incr]) +m4_copy_unm4([m4_index]) +m4_copy_unm4([m4_indir]) +m4_copy_unm4([m4_len]) +m4_copy_unm4([m4_patsubst]) +m4_copy_unm4([m4_popdef]) +m4_copy_unm4([m4_pushdef]) +m4_copy_unm4([m4_regexp]) +m4_copy_unm4([m4_sinclude]) +m4_copy_unm4([m4_syscmd]) +m4_copy_unm4([m4_sysval]) +m4_copy_unm4([m4_traceoff]) +m4_copy_unm4([m4_traceon]) +m4_copy_unm4([m4_translit]) +m4_copy_unm4([m4_undefine]) +m4_copy_unm4([m4_undivert]) diff --git a/autoheader.in b/autoheader.in new file mode 100644 index 0000000..028fe20 --- /dev/null +++ b/autoheader.in @@ -0,0 +1,368 @@ +#! @SHELL@ +# -*- shell-script -*- +# autoheader -- create `config.h.in' from `configure.ac' +#------------------------------------------------------------------------------ +# Copyright 2010-2021,2022 Thomas E. Dickey +# Copyright 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001 +# 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 +# the Free Software Foundation; either version 2, 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. + +# Written by Roland McGrath. + +me=`echo "$0" | sed -e 's,.*[/\\],,'` + +usage="\ +Usage: $0 [OPTION] ... [TEMPLATE-FILE] + +Create a template file of C \`#define' statements for \`configure' to +use. To this end, scan TEMPLATE-FILE, or \`configure.ac' if present, +or else \`configure.in'. + + -h, --help print this help, then exit + -V, --version print version number, then exit + -v, --verbose verbosely report processing + -d, --debug don't remove temporary files + -W, --warnings=CATEGORY report the warnings falling in CATEGORY + +Warning categories include: + \`obsolete' obsolete constructs + \`all' all the warnings + \`no-CATEGORY' turn off the warnings on CATEGORY + \`none' turn off all the warnings + \`error' warnings are error + +Library directories: + -A, --autoconf-dir=ACDIR Autoconf's macro files location (rarely needed) + -l, --localdir=DIR location of \`aclocal.m4' and \`acconfig.h' + +Report bugs to <@PACKAGE_BUGREPORT@>." + +version="\ +autoheader (@PACKAGE_NAME@) @VERSION@ +Written by Roland McGrath. + +Copyright 2010-2012,2021 Thomas E. Dickey +Copyright 1992, 1993, 1994, 1996, 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." + +exit_missing_arg="\ +echo \"$me: option \\\`\$1' requires an argument\" >&2 +echo \"\$help\" >&2 +exit 1" + +# 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 + +# Variables. +: ${autoconf_dir=${AC_MACRODIR=@datadir@}} +dir=`echo "$0" | sed -e 's,[^/]*$,,'` +# We test "$dir/autoconf" in case we are in the build tree, in which case +# the names are not transformed yet. +for autoconf in "$AUTOCONF" \ + "$dir/@autoconf-name@" \ + "$dir/autoconf" \ + "@bindir@/@autoconf-name@"; do + test -f "$autoconf" && break +done +debug=false +localdir=. +status=0 +tmp= +verbose=: +warning_all=false +warning_error=false +warning_obsolete=false + +# Parse command line. +while test $# -gt 0 ; do + optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \ + "x$1" : 'x-.\(.*\)'` + case $1 in + --version | -V ) + echo "$version" ; exit 0 ;; + --help | -h ) + echo "$usage"; exit 0 ;; + + --debug | -d ) + debug=:; shift ;; + --verbose | -v ) + verbose=echo + shift;; + + --localdir=* | -l?* ) + localdir=$optarg + shift ;; + --localdir | -l ) + test $# = 1 && eval "$exit_missing_arg" + shift + localdir=$1 + shift ;; + + --autoconf-dir=* | -A?* ) + autoconf_dir=$optarg + shift ;; + --autoconf-dir | -A ) + test $# = 1 && eval "$exit_missing_arg" + shift + autoconf_dir=$1 + shift ;; + --macrodir=* | -m?* ) + echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2 + autoconf_dir=$optarg + shift ;; + --macrodir | -m ) + echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2 + test $# = 1 && eval "$exit_missing_arg" + shift + autoconf_dir=$1 + shift ;; + + --warnings=* | -W?* ) + warnings=$warnings,$optarg + shift ;; + --warnings | -W ) + test $# = 1 && eval "$exit_missing_arg" + shift + warnings=$warnings,$1 + shift ;; + + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + exec >&2 + echo "$me: invalid option $1" + echo "$help" + exit 1 ;; + * ) + break ;; + esac +done + +# The warnings are the concatenation of 1. application's defaults +# (here, none), 2. $WARNINGS, $3 command line options, in that order. +alphabet='abcdefghijklmnopqrstuvwxyz' +ALPHABET='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +_ac_warnings= +for warning in `IFS=,; echo $WARNINGS,$warnings | tr $ALPHABET $alphabet` +do + case $warning in + '' | ,) continue;; + no-*) eval warning_`expr x$warning : 'xno-\(.*\)'`=false;; + *) eval warning_$warning=:;; + esac +done + +# Trap on 0 to stop playing with `rm'. +$debug || +{ + trap 'status=$?; rm -rf $tmp && exit $status' 0 + trap '(exit 1); exit 1' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/ahXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/ah$$ + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + (exit 1); exit 1 +} + +# Preach. +if ($warning_all || $warning_obsolete) && + (test -f $config_h.top || + test -f $config_h.bot || + test -f $localdir/acconfig.h); then + sed -e "s/^ /$me: WARNING: /" >&2 <<\EOF + Using auxiliary files such as `acconfig.h', `config.h.bot' + and `config.h.top', to define templates for `config.h.in' + is deprecated and discouraged. + + Using the third argument of `AC_DEFINE' and + `AC_DEFINE_UNQUOTED' allows to define a template without + `acconfig.h': + + AC_DEFINE([NEED_MAIN], 1, + [Define if a function `main' is needed.]) + + More sophisticated templates can also be produced, see the + documentation. +EOF + $warning_error && { (exit 1); exit 1; } +fi + +acconfigs= +test -r $localdir/acconfig.h && acconfigs="$acconfigs $localdir/acconfig.h" + +# Find the input file. +case $# in + 0) + case `ls configure.ac configure.in 2>/dev/null` in + *ac*in ) + echo "$me: warning: both \`configure.ac' and \`configure.in' are present." >&2 + echo "$me: warning: proceeding with \`configure.ac'." >&2 + infile=configure.ac;; + *ac ) infile=configure.ac;; + *in ) infile=configure.in;; + * ) + echo "$me: no input file" >&2 + (exit 1); exit 1;; + esac;; + 1) infile=$1 ;; + *) exec >&2 + echo "$me: invalid number of arguments." + echo "$help" + (exit 1); exit 1;; +esac + +# Set up autoconf. +autoconf="$autoconf -l $localdir" +export autoconf_dir + +# ----------------------- # +# Real work starts here. # +# ----------------------- # + +# Source what the traces are trying to tell us. +$verbose $me: running $autoconf to trace from $infile >&2 +$autoconf \ + --trace AC_CONFIG_HEADERS:': $${config_h="$1"}' \ + --trace AH_OUTPUT:'ac_verbatim_$1="\ +$2"' \ + --trace AC_DEFINE_TRACE_LITERAL:'syms="$$syms $1"' \ + $infile | \ + sed \ + -e 's/\(syms="$syms [a-zA-Z_][a-zA-Z0-9_]*\)([^)]*)"/\1"/g' \ + -e 's/\(#undef [a-zA-Z_][a-zA-Z0-9_]*\)([^)]*)/\1/g' \ + -e 's/^\(ac_verbatim_[^(=]*\)([^)]*)/\1/g' \ + >$tmp/traces.sh || { (exit 1); exit 1; } + +$verbose $me: sourcing $tmp/traces.sh >&2 +if (set -e && . $tmp/traces.sh) >/dev/null 2>&1; then + . $tmp/traces.sh +else + echo "$me: error: shell error while sourcing $tmp/traces.sh" >&2 + (exit 1); exit 1 +fi + + +# Make SYMS newline-separated rather than blank-separated, and remove dups. +# Start each symbol with a blank (to match the blank after "#undef") +# to reduce the possibility of mistakenly matching another symbol that +# is a substring of it. +# Beware that some of the symbols might actually be macro with arguments: +# keep only their name. +syms=`for sym in $syms; do echo $sym; done | + sed -e 's/(.*//' | + sort | + uniq | + sed -e 's@^@ @'` + + +# We template only the first CONFIG_HEADER. +config_h=`set X $config_h; echo $2` +# Support "outfile[:infile]", defaulting infile="outfile.in". +case "$config_h" in +"") echo "$me: error: AC_CONFIG_HEADERS not found in $infile" >&2 + (exit 1); exit 1 ;; +*:*) config_h_in=`echo "$config_h" | sed 's/.*://'` + config_h=`echo "$config_h" | sed 's/:.*//'` ;; +*) config_h_in="$config_h.in" ;; +esac + +# Don't write "do not edit" -- it will get copied into the +# config.h, which it's ok to edit. +cat <<EOF >$tmp/config.hin +/* $config_h_in. Generated automatically from $infile by autoheader. */ +EOF + +# Dump the top. +test -r $config_h.top && cat $config_h.top >>$tmp/config.hin + +# Dump `acconfig.h' but its bottom. +test -r $localdir/acconfig.h && + sed '/@BOTTOM@/,$d;s/@TOP@//' $localdir/acconfig.h >>$tmp/config.hin + +# Dump the templates from `configure.ac'. +for verb in `(set) 2>&1 | sed -n -e '/^ac_verbatim/s/^\([^=]*\)=.*$/\1/p' | sort`; do + eval value=\$$verb + cat >>$tmp/config.hin <<EOF + +$value +EOF +done + +# Handle the case where @BOTTOM@ is the first line of acconfig.h. +test -r $localdir/acconfig.h && + grep @BOTTOM@ $localdir/acconfig.h >/dev/null && + sed -n '/@BOTTOM@/,${/@BOTTOM@/!p;}' $localdir/acconfig.h >>$tmp/config.hin +test -f $config_h.bot && cat $config_h.bot >>$tmp/config.hin + + +# Check that all the symbols have a template. +$verbose $me: checking completeness of the template >&2 +# Regexp for a white space. +w='[ ]' +if test -n "$syms"; then + for sym in $syms; do + if @EGREP@ "^#$w*[a-z]*$w$w*$sym($w*|$w.*)$" $tmp/config.hin >/dev/null; then + : # All is well. + else + echo "$me: No template for symbol \`$sym'" >&2 + status=1 + fi + done +fi + + +# If the run was successful, output the result. +if test $status = 0; then + if test $# = 0; then + # Output is a file + if test -f $config_h_in && cmp -s $tmp/config.hin $config_h_in; then + # File didn't change, so don't update its mod time. + echo "$me: $config_h_in is unchanged" >&2 + else + mv -f $tmp/config.hin $config_h_in + fi + else + # Output is stdout + cat $tmp/config.hin + fi +fi + +(exit $status); exit $status diff --git a/autoreconf.in b/autoreconf.in new file mode 100644 index 0000000..a5d7a44 --- /dev/null +++ b/autoreconf.in @@ -0,0 +1,334 @@ +#! @SHELL@ +# -*- shell-script -*- +# autoreconf - remake all Autoconf configure scripts in a directory tree +# Copyright 2010,2023 Thomas E. Dickey +# Copyright 1994, 1999, 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 +# the Free Software Foundation; either version 2, 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. + +me=`echo "$0" | sed -e 's,.*[\\/],,'` + +usage="\ +Usage: $0 [OPTION] ... [TEMPLATE-FILE] + +Run \`autoconf' and \`autoheader' where appropriate) repeatedly to +remake the Autoconf \`configure' scripts and configuration header +templates in the directory tree rooted at the current directory. + +By default, it only remakes those files that are older than their +predecessors. If you install a new version of Autoconf, running +\`autoreconf' remakes all of the files by giving it the \`--force' +option. + +Operation modes: + -h, --help print this help, then exit + -V, --version print version number, then exit + -v, --verbose verbosely report processing + -d, --debug don't remove temporary files + -f, --force consider every files are obsolete + -i, --install copy missing auxiliary files + -s, --symlink instead of copying, install symbolic links + +The option \`--install' is similar to the option \`--add-missing' in +other tools. + +Library directories: + -A, --autoconf-dir=ACDIR Autoconf's macro files location (rarely needed) + -l, --localdir=DIR location of \`aclocal.m4' and \`acconfig.h' + -M, --m4dir=M4DIR this package's Autoconf extensions + +Unless specified, heuristics try to compute \`M4DIR' from the \`Makefile.am', +or defaults to \`m4' if it exists. + +The environment variables AUTOCONF and AUTOHEADER are honored. + +Report bugs to <@PACKAGE_BUGREPORT@>." + +version="\ +autoreconf (@PACKAGE_NAME@) @VERSION@ +Written by David J. MacKenzie. + +Copyright 1994, 1999, 2000 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." + +exit_missing_arg="\ +echo \"$me: option \\\`\$1' requires an argument\" >&2 +echo \"\$help\" >&2 +exit 1" + +# 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 + +# Variables. +: ${autoconf_dir=${AC_MACRODIR=@datadir@}} +debug=false +dir=`echo "$0" | sed -e 's,[^\\/]*$,,'` +force=false +# --install -- as --add-missing in other tools. +install=false +localdir=. +# m4dir -- local Autoconf extensions. Typically `m4'. +m4dir= +status=0 +# symlink -- when --install, use symlinks instead. +symlink=false +verbose=: + +# Looking for autoconf. +# We test "$dir/autoconf" in case we are in the build tree, in which case +# the names are not transformed yet. +for autoconf in "$AUTOCONF" \ + "$dir/@autoconf-name@" \ + "$dir/autoconf" \ + "@bindir@/@autoconf-name@"; do + test -f "$autoconf" && break +done + +# Looking for autoheader. +for autoheader in "$AUTOHEADER" \ + "$dir/@autoheader-name@" \ + "$dir/autoheader" \ + "@bindir@/@autoheader-name@"; do + test -f "$autoheader" && break +done + +# Parse command line. +while test $# -gt 0; do + optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \ + "x$1" : 'x-.\(.*\)'` + case "$1" in + --version | -V ) + echo "$version" ; exit 0 ;; + --help | -h ) + echo "$usage"; exit 0 ;; + + --verbose | -v ) + verbose=echo + shift;; + --debug | -d ) + debug=:; shift ;; + + --localdir=* | -l?* ) + localdir=$optarg + shift ;; + --localdir | -l ) + test $# = 1 && eval "$exit_missing_arg" + shift + localdir=$1 + shift ;; + + --autoconf-dir=* | -A?* ) + autoconf_dir=$optarg + shift ;; + --autoconf-dir | -A ) + test $# = 1 && eval "$exit_missing_arg" + shift + autoconf_dir=$1 + shift ;; + --macrodir=* | -m?* ) + echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2 + autoconf_dir=$optarg + shift ;; + --macrodir | -m ) + echo "$me: warning: --macrodir is obsolete, use --autoconf-dir" >&2 + test $# = 1 && eval "$exit_missing_arg" + shift + autoconf_dir=$1 + shift ;; + + --m4dir=* | -M?* ) + m4dir=$optarg + shift ;; + --m4dir | -M ) + test $# = 1 && eval "$exit_missing_arg" + shift + m4dir=$1 + shift ;; + + --force | -f ) + force=:; shift ;; + + --install | -i ) + install=:; shift ;; + --symlink | -s ) + symlink=:; shift ;; + + -- ) # Stop option processing. + shift; break ;; + -* ) + exec >&2 + echo "$me: invalid option $1" + echo "$help" + exit 1 ;; + * ) + break ;; + esac +done + +# Find the input file. +if test $# -ne 0; then + exec >&2 + echo "$me: invalid number of arguments" + echo "$help" + exit 1 +fi + +# If verbose, say what you are going to use. +if test $verbose = echo; then + $autoconf --version | + sed "s,.*)\(.*\)$,$me: using autoconf\1: $autoconf,;1q" >&2 + $autoheader --version | + sed "s,.*)\(.*\)$,$me: using autoheader\1: $autoheader,;1q" >&2 +fi + +# Dispatch autoreconf's option to the tools. +# --localdir +autoconf="$autoconf -l $localdir" +autoheader="$autoheader -l $localdir" +# --verbose +autoconf="$autoconf `$verbose --verbose`" +autoheader="$autoheader `$verbose --verbose`" +# --debug +$debug && +{ + autoconf="$autoconf --debug" + autoheader="$autoheader --debug" +} +# --macrodir +export autoconf_dir + +# Trap on 0 to stop playing with `rm'. +$debug || +{ + trap 'status=$?; rm -rf $tmp && exit $status' 0 + trap '(exit 1); exit 1' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/arXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/ar$$ + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + (exit 1); exit 1 +} + +# When debugging, it is convenient that all the related temporary +# files be at the same place. +TMPDIR=$tmp +export TMPDIR + +# update.sh -- +# Exit 0 if the first argument is not the most recent of all or is missing. +cat >$tmp/update.sh <<\EOF +test -f "$1" || { :; exit; } +test x`ls -1dt "$@" 2>/dev/null | sed 1q` != x"$1" +EOF +update="@SHELL@ $tmp/update.sh" + + +# ----------------------- # +# Real work starts here. # +# ----------------------- # + +# Make a list of directories to process. +# The xargs grep filters out Cygnus configure.in files. +find . '(' -name configure.ac -o -name configure.in ')' -print | +xargs grep -l AC_INIT | +sed 's,/configure\.ac$,,;s,/configure\.in$,,;s,^./,,' | +while read dir; do + ( + cd $dir || continue + + + # ------------------ # + # Running autoconf. # + # ------------------ # + + if $force || + $update configure configure.ac $localdir/aclocal.m4 || + $update configure configure.in $localdir/aclocal.m4; then + $verbose $me: running $autoconf in $dir >&2 + $autoconf + fi + + + # -------------------- # + # Running autoheader. # + # -------------------- # + + # templates -- arguments of AC_CONFIG_HEADERS. + $verbose $me: running $autoconf -t 'AC_CONFIG_HEADERS:$1' >&2 + templates=`$autoconf -t 'AC_CONFIG_HEADERS:$1'` + if test -n "$templates"; then + tcount=`set -- $templates; echo $#` + template=`set -- $templates; echo $1 | sed ' + s/.*:// + t colon + s/$/.in/ + : colon + s/:.*// + '` + template_dir=`echo $template | sed -e 's,[\\/]*[^\\/]*$,,;s,^$,.,'` + stamp_num=`test "$tcount" -gt 1 && echo "$tcount"` + stamp=$template_dir/stamp-h$stamp_num.in + # If config.hin exists, don't override it unless it was really + # created by autoheader (users are allowed to write them by hand!). + uses_autoheader=false + grep autoheader "$template" >/dev/null 2>&1 && + uses_autoheader=: + test -f "$template" || + uses_autoheader=: + if $uses_autoheader && + { $force || + $update $template \ + configure.ac $localdir/aclocal.m4 $localdir/acconfig.h || + $update $template \ + configure.in $localdir/aclocal.m4 $localdir/acconfig.h || + $update $stamp \ + configure.ac $localdir/aclocal.m4 $localdir/acconfig.h || + $update $stamp \ + configure.in $localdir/aclocal.m4 $localdir/acconfig.h; } then + $verbose $me: running $autoheader in $dir >&2 + $autoheader && + $verbose "touching $stamp" >&2 && + touch $stamp + fi + fi + ) +done + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# End: diff --git a/autoscan.in b/autoscan.in new file mode 100644 index 0000000..8511100 --- /dev/null +++ b/autoscan.in @@ -0,0 +1,660 @@ +#! @PERL@ -w +# -*- perl -*- +# autoscan - Create configure.scan (a preliminary configure.ac) for a package. +# Copyright 2010,2023 Thomas E. Dickey +# Copyright 1994, 1999, 2000, 2001 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 +# the Free Software Foundation; either version 2, 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. + +# Written by David MacKenzie <djm@gnu.ai.mit.edu>. + +use 5.005; +use File::Basename; +use File::Find; +use Getopt::Long; +use IO::File; +use strict; + +use vars qw(@cfiles @makefiles @shfiles %c_keywords %printed); + +my $me = basename ($0); +my $verbose = 0; + +# $USED{KIND}{ITEM} is set if ITEM is used in the program. +# It is set to its list of locations. +my %used = (); + +# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM. +my %macro = (); + +# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO. +my %needed_macros = (); + +my @kinds = qw (functions headers identifiers programs makevars libraries); + +# For each kind, the default macro. +my %generic_macro = + ( + 'functions' => 'AC_CHECK_FUNCS', + 'headers' => 'AC_CHECK_HEADERS', + 'identifiers' => 'AC_CHECK_TYPES', + 'programs' => 'AC_CHECK_PROGS', + 'libraries' => 'AC_CHECK_LIB' + ); + +my %kind_comment = + ( + 'functions' => 'Checks for library functions.', + 'headers' => 'Checks for header files.', + 'identifiers' => 'Checks for typedefs, structures, and compiler characteristics.', + 'programs' => 'Checks for programs.', + ); + +my $configure_scan = 'configure.scan'; +my $log = new IO::File ">$me.log" + or die "$me: cannot open $me.log: $!\n"; + +# Autoconf and lib files. +my $autoconf; +my $datadir = $ENV{"AC_MACRODIR"} || "@datadir@"; + +# Exit nonzero whenever closing STDOUT fails. +sub END +{ + use POSIX qw (_exit); + # This is required if the code might send any output to stdout + # E.g., even --version or --help. So it's best to do it unconditionally. + close STDOUT + or (warn "$me: closing standard output: $!\n"), _exit (1); +} + + +## ------------------------ ## +## Command line interface. ## +## ------------------------ ## + + +# print_usage () +# -------------- +# Display usage (--help). +sub print_usage () +{ + print "Usage: $0 [OPTION] ... [SRCDIR] + +Examine source files in the directory tree rooted at SRCDIR, or the +current directory if none is given. Search the source files for +common portability problems, check for incompleteness of +`configure.ac', and create a file `$configure_scan' which is a +preliminary `configure.ac' for that package. + + -h, --help print this help, then exit + -V, --version print version number, then exit + -v, --verbose verbosely report processing + +Library directories: + -A, --autoconf-dir=ACDIR Autoconf's files location (rarely needed) + -l, --localdir=DIR location of `aclocal.m4' and `acconfig.h' + +Report bugs to <@PACKAGE_BUGREPORT@>.\n"; + exit 0; +} + + +# print_version () +# ---------------- +# Display version (--version). +sub print_version +{ + print "autoscan (@PACKAGE_NAME@) @VERSION@ +Written by David J. MacKenzie. + +Copyright 1994, 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.\n"; + exit 0; +} + + +# parse_args () +# ------------- +# Process any command line arguments. +sub parse_args () +{ + my $srcdir; + Getopt::Long::config ("bundling"); + Getopt::Long::GetOptions ("A|autoconf-dir|m|macrodir=s" => \$datadir, + "h|help" => \&print_usage, + "V|version" => \&print_version, + "v|verbose" => \$verbose) + or exit 1; + + die "$me: too many arguments +Try `$me --help' for more information.\n" + if (@ARGV > 1); + ($srcdir) = @ARGV; + $srcdir = "." + if !defined $srcdir; + + print "srcdir=$srcdir\n" if $verbose; + chdir $srcdir || die "$me: cannot cd to $srcdir: $!\n"; +} + + +# find_autoconf +# ------------- +# Find the lib files and autoconf. +sub find_autoconf +{ + my $dir = dirname ($0); + # We test "$dir/autoconf" in case we are in the build tree, in which case + # the names are not transformed yet. + foreach my $file ($ENV{"AUTOCONF"} || '', + "$dir/@autoconf-name@", + "$dir/autoconf", + "@bindir@/@autoconf-name@") + { + if (-x $file) + { + $autoconf = $file; + last; + } + } +} + + +# $CONFIGURE_AC +# &find_configure_ac () +# --------------------- +sub find_configure_ac () +{ + if (-f 'configure.ac') + { + if (-f 'configure.in') + { + warn "warning: `configure.ac' and `configure.in' both present.\n"; + warn "warning: proceeding with `configure.ac'.\n"; + } + return 'configure.ac'; + } + elsif (-f 'configure.in') + { + return 'configure.in'; + } + return; +} + + +# init_tables () +# -------------- +# Put values in the tables of what to do with each token. +sub init_tables () +{ + # Initialize a table of C keywords (to ignore). + # Taken from K&R 1st edition p. 180. + # ANSI C, GNU C, and C++ keywords can introduce portability problems, + # so don't ignore them. + + foreach (qw (int char float double struct union long short unsigned + auto extern register typedef static goto return sizeof break + continue if else for do while switch case default)) + { + $c_keywords{$_} = 0; + } + + # The data file format supports only one line of macros per function. + # If more than that is required for a common portability problem, + # a new Autoconf macro should probably be written for that case, + # instead of duplicating the code in lots of configure.ac files. + my $tables_are_consistent = 1; + foreach my $kind (@kinds) + { + my $file = "$datadir/ac$kind"; + my $table = new IO::File $file + or die "$me: cannot open $file: $!\n"; + while ($_ = $table->getline) + { + # Ignore blank lines and comments. + next + if /^\s*$/ || /^\s*\#/; + unless (/^(\S+)\s+(\S.*)$/ || /^(\S+)\s*$/) + { + die "$me: cannot parse definition in $file:\n$_\n"; + } + my $word = $1; + my $macro = $2 || $generic_macro{$kind}; + # The default macro must be explicitly listed for words + # which have a specific macros. This allows to enforce + # consistency checks. + if (!defined $2 && exists $macro{$kind}{$word}) + { + warn ("$datadir/ac$kind:$.: " + . "ignoring implicit call to the generic macro for $word\n"); + $tables_are_consistent = 0; + } + else + { + push @{$macro{$kind}{$word}}, $macro; + } + } + $table->close + or die "$me: cannot close $file: $!\n"; + } + + die "$me: some tables are inconsistent\n" + if !$tables_are_consistent; +} + + + +## ----------------------- ## +## Scanning source files. ## +## ----------------------- ## + + +# scan_c_file(FILENAME) +# --------------------- +sub scan_c_file ($) +{ + my ($filename) = @_; + + push (@cfiles, $File::Find::name); + + # Nonzero if in a multiline comment. + my $in_comment = 0; + + my $file = new IO::File "<$filename" + or die "$me: cannot open $filename: $!\n"; + + while ($_ = $file->getline) + { + # Strip out comments, approximately. + # Ending on this line. + if ($in_comment && m,\*/,) + { + s,.*\*/,,; + $in_comment = 0; + } + # All on one line. + s,/\*.*\*/,,g; + # Starting on this line. + if (m,/\*,) + { + $in_comment = 1; + } + # Continuing on this line. + next if $in_comment; + + # Preprocessor directives. + if (/^\s*\#\s*include\s*<([^>]*)>/) + { + push (@{$used{'headers'}{$1}}, "$File::Find::name:$."); + } + # Ignore other preprocessor directives. + next if /^\s*\#/; + + # Remove string and character constants. + s,\"[^\"]*\",,g; + s,\'[^\']*\',,g; + + # Tokens in the code. + # Maybe we should ignore function definitions (in column 0)? + while (s/\b([a-zA-Z_]\w*)\s*\(/ /) + { + push (@{$used{'functions'}{$1}}, "$File::Find::name:$.") + if !defined $c_keywords{$1}; + } + while (s/\b([a-zA-Z_]\w*)\b/ /) + { + push (@{$used{'identifiers'}{$1}}, "$File::Find::name:$.") + if !defined $c_keywords{$1}; + } + } + + $file->close + or die "$me: cannot close $filename: $!\n"; +} + + +# scan_makefile(MAKEFILE-NAME) +# ---------------------------- +sub scan_makefile ($) +{ + my ($filename) = @_; + push (@makefiles, $File::Find::name); + + my $file = new IO::File "<$filename" + or die "$me: cannot open $filename: $!\n"; + + while ($_ = $file->getline) + { + # Strip out comments and variable references. + s/#.*//; + s/\$\([^\)]*\)//g; + s/\$\{[^\}]*\}//g; + s/@[^@]*@//g; + + # Variable assignments. + while (s/\b([a-zA-Z_]\w*)\s*=/ /) + { + push (@{$used{'makevars'}{$1}}, "$File::Find::name:$."); + } + # Libraries. + while (s/\B-l([a-zA-Z_]\w*)\b/ /) + { + push (@{$used{'libraries'}{$1}}, "$File::Find::name:$."); + } + # Tokens in the code. + while (s/(?<![-\w.])([a-zA-Z_][\w+.-]+)/ /) + { + push (@{$used{'programs'}{$1}}, "$File::Find::name:$."); + } + } + + $file->close + or die "$me: cannot close $filename: $!\n"; +} + + +# scan_sh_file(SHELL-SCRIPT-NAME) +# ------------------------------- +sub scan_sh_file ($) +{ + my ($filename) = @_; + push (@shfiles, $File::Find::name); + + my $file = new IO::File "<$filename" + or die "$me: cannot open $filename: $!\n"; + + while ($_ = $file->getline) + { + # Strip out comments and variable references. + s/#.*//; + s/#.*//; + s/\$\{[^\}]*\}//g; + s/@[^@]*@//g; + + # Tokens in the code. + while (s/\b([a-zA-Z_]\w*)\b/ /) + { + push (@{$used{'programs'}{$1}}, "$File::Find::name:$."); + } + } + + $file->close + or die "$me: cannot close $filename: $!\n"; +} + + +# scan_file () +# ------------ +# Called by &find on each file. $_ contains the current filename with +# the current directory of the walk through. +sub scan_file () +{ + # Wanted only if there is no corresponding FILE.in. + return + if -f "$_.in"; + + # Save $_ as Find::File requires it to be preserved. + my $underscore = $_; + + # Strip a useless leading `./'. + $File::Find::name =~ s,^\./,,; + + if (/\.[chlym](\.in)?$/) + { + push (@{$used{'programs'}{"cc"}}, $File::Find::name); + scan_c_file ($_); + } + elsif (/\.(cc|cpp|cxx|CC|C|hh|hpp|hxx|HH|H|yy|ypp|ll|lpp)(\.in)?$/) + { + push (@{$used{'programs'}{"c++"}}, $File::Find::name); + scan_c_file ($_); + } + elsif (/^[Mm]akefile(\.in)?$/ || /^GNUmakefile(\.in)?$/) + { + scan_makefile ($_); + } + elsif (/\.sh(\.in)?$/) + { + scan_sh_file ($_); + } + + $_ = $underscore; +} + + +# scan_files () +# ------------- +# Read through the files and collect lists of tokens in them +# that might create nonportabilities. +sub scan_files () +{ + find (\&scan_file, '.'); + + if ($verbose) + { + print "cfiles:", join(" ", @cfiles), "\n"; + print "makefiles:", join(" ", @makefiles), "\n"; + print "shfiles:", join(" ", @shfiles), "\n"; + + foreach my $kind (@kinds) + { + print "\n$kind:\n"; + foreach my $word (sort keys %{$used{$kind}}) + { + print "$word: @{$used{$kind}{$word}}\n"; + } + } + } +} + + +## ----------------------- ## +## Output configure.scan. ## +## ----------------------- ## + + +# output_kind ($FILE, $KIND) +# -------------------------- +sub output_kind ($$) +{ + my ($file, $kind) = @_; + # Lists of words to be checked with the generic macro. + my @have; + + print $file "\n# $kind_comment{$kind}\n" + if exists $kind_comment{$kind}; + foreach my $word (sort keys %{$used{$kind}}) + { + # Words that were caught, but not to be checked according to + # the autoscan library files. + next + if ! exists $macro{$kind}{$word}; + + # Output the needed macro invocations in $configure_scan if not + # already printed, and remember these macros are needed. + foreach my $macro (@{$macro{$kind}{$word}}) + { + if (exists $generic_macro{$kind} + && $macro eq $generic_macro{$kind}) + { + push (@have, $word); + push (@{$needed_macros{"$generic_macro{$kind}([$word])"}}, + @{$used{$kind}{$word}}); + } + else + { + if (! $printed{$macro}) + { + print $file "$macro\n"; + $printed{$macro} = 1; + } + push (@{$needed_macros{$macro}}, + @{$used{$kind}{$word}}); + } + } + } + print $file "$generic_macro{$kind}([" . join(' ', sort(@have)) . "])\n" + if @have; +} + + +# output_libraries ($FILE) +# ------------------------ +sub output_libraries ($) +{ + my ($file) = @_; + + print $file "\n# Checks for libraries.\n"; + foreach my $word (sort keys %{$used{'libraries'}}) + { + print $file "# FIXME: Replace `main' with a function in `-l$word':\n"; + print $file "AC_CHECK_LIB([$word], [main])\n"; + } +} + + +# output (CONFIGURE_SCAN) +# ----------------------- +# Print a proto configure.ac. +sub output ($) +{ + my $configure_scan = shift; + my %unique_makefiles; + + my $file = new IO::File ">$configure_scan" + or die "$me: cannot create $configure_scan: $!\n"; + + print $file "# Process this file with autoconf to produce a configure script.\n"; + print $file "AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)\n"; + if (defined $cfiles[0]) + { + print $file "AC_CONFIG_SRCDIR([$cfiles[0]])\n"; + print $file "AC_CONFIG_HEADER([config.h])\n"; + } + + output_kind ($file, 'programs'); + output_kind ($file, 'makevars'); + output_libraries ($file); + output_kind ($file, 'headers'); + output_kind ($file, 'identifiers'); + output_kind ($file, 'functions'); + + # Change DIR/Makefile.in to DIR/Makefile. + foreach my $m (@makefiles) + { + $m =~ s/\.in$//; + $unique_makefiles{$m}++; + } + print $file "\nAC_CONFIG_FILES([", + join ("\n ", sort keys %unique_makefiles), "])\n"; + print $file "AC_OUTPUT\n"; + + $file->close + or die "$me: cannot close $configure_scan: $!\n"; +} + + + +## --------------------------------------- ## +## Checking the accuracy of configure.ac. ## +## --------------------------------------- ## + + +# check_configure_ac (CONFIGURE_AC) +# --------------------------------- +# Use autoconf to check if all the suggested macros are included +# in CONFIGURE_AC. +sub check_configure_ac ($) +{ + my ($configure_ac) = @_; + my ($trace_option) = ''; + + # Find what needed macros are invoked in CONFIGURE_AC. + foreach my $macro (sort keys %needed_macros) + { + $macro =~ s/\(.*//; + $trace_option .= " -t $macro"; + } + + my $traces = + new IO::File "$autoconf -A $datadir $trace_option $configure_ac|" + or die "$me: cannot create read traces: $!\n"; + + while ($_ = $traces->getline) + { + chomp; + my ($file, $line, $macro, @args) = split (/:/, $_); + if ($macro =~ /^AC_CHECK_(HEADER|FUNC|TYPE|MEMBER)S$/) + { + # To be rigorous, we should distinguish between space and comma + # separated macros. But there is no point. + foreach my $word (split (/\s|,/, $args[0])) + { + # AC_CHECK_MEMBERS wants `struct' or `union'. + if ($macro eq "AC_CHECK_MEMBERS" + && $word =~ /^stat.st_/) + { + $word = "struct " . $word; + } + delete ($needed_macros{"$macro([$word])"}); + } + } + else + { + delete ($needed_macros{$macro}); + } + } + + $traces->close + or die "$me: cannot close: $!\n"; + + # Report the missing macros. + foreach my $macro (sort keys %needed_macros) + { + warn ("$configure_ac: warning: missing $macro wanted by: " + . (${$needed_macros{$macro}}[0]) + . "\n"); + print $log "$me: warning: missing $macro wanted by: \n"; + foreach my $need (@{$needed_macros{$macro}}) + { + print $log "\t$need\n"; + } + } +} + + +## -------------- ## +## Main program. ## +## -------------- ## + +parse_args; +# Find the lib files and autoconf. +find_autoconf; +my $configure_ac = find_configure_ac; +init_tables; +scan_files; +output ('configure.scan'); +if ($configure_ac) + { + check_configure_ac ($configure_ac); + } + +$log->close + or die "$me: cannot close $me.log: $!\n"; + +exit 0; diff --git a/autoupdate.in b/autoupdate.in new file mode 100644 index 0000000..7ab3f28 --- /dev/null +++ b/autoupdate.in @@ -0,0 +1,1136 @@ +#! @PERL@ -w +# -*- perl -*- +# autoupdate - modernize an Autoconf file. +# Copyright 2010-2022,2023 Thomas E. Dickey +# Copyright 1994, 1999, 2000, 2001 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 +# the Free Software Foundation; either version 2, 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. + +# Originally written by David MacKenzie <djm@gnu.ai.mit.edu>. +# Rewritten by Akim Demaille <akim@freefriends.org>. + +use 5.005; +use Getopt::Long; +use File::Basename; +use strict; + +(my $me = $0) =~ s,.*[\\/],,; + +# Lib files. +my $autoconf_dir = $ENV{"AC_MACRODIR"} || "@datadir@"; +my $autoconf = ''; +my $debug = 0; +my $localdir = '.'; +# m4. +my $m4 = $ENV{"M4"} || "@M4@"; +my $verbose = 0; +my $SIMPLE_BACKUP_SUFFIX = $ENV{'SIMPLE_BACKUP_SUFFIX'} || '~'; +my $tmp = ''; + + +## ---------- ## +## Routines. ## +## ---------- ## + + +# &mktmpdir () +# ------------ +sub mktmpdir () +{ + my $TMPDIR = $ENV{'TMPDIR'} || '/tmp'; + + # If mktemp supports dirs, use it to please Marc E. + $tmp = `(umask 077 && mktemp -d -q "$TMPDIR/auXXXXXX") 2>/dev/null`; + chomp $tmp; + + if (!$tmp || !-d $tmp) + { + $tmp = "$TMPDIR/au" . int (rand 10000) . ".$$"; + mkdir $tmp, 0700 + or die "$me: cannot create $tmp: $!\n"; + } + + print STDERR "$me:$$: working in $tmp\n" + if $debug; +} + + +# END +# --- +# Exit nonzero whenever closing STDOUT fails. +sub END +{ + use POSIX qw (_exit); + + my ($q) = ($?); + + # FIXME: Heelp! Can't find a means to properly catch system's + # exit status (without hair I mean). + # my $status = $? >> 8; + + if (!$debug && -d $tmp) + { + unlink <$tmp/*> + or warn ("$me: cannot empty $tmp: $!\n"), _exit (1); + rmdir $tmp + or warn ("$me: cannot remove $tmp: $!\n"), _exit (1); + } + + # This is required if the code might send any output to stdout + # E.g., even --version or --help. So it's best to do it unconditionally. + close STDOUT + or (warn "$me: closing standard output: $!\n"), _exit (1); + + ($!, $?) = (0, $q); +} + + +# print_usage () +# -------------- +# Display usage (--help). +sub print_usage () +{ + print <<"END"; +Usage: $0 [OPTION] ... [TEMPLATE-FILE...] + +Update the TEMPLATE-FILE... if given, or \`configure.ac' if present, +or else \`configure.in', to the syntax of the current version of +Autoconf. The original files are backed up. + +Operation modes: + -h, --help print this help, then exit + -V, --version print version number, then exit + -v, --verbose verbosely report processing + -d, --debug don't remove temporary files + +Library directories: + -A, --autoconf-dir=ACDIR Autoconf's macro files location (rarely needed) + -l, --localdir=DIR location of \`aclocal.m4' + +Environment variables: + M4 GNU M4 1.4 or above + AUTOCONF autoconf @VERSION@ + +Report bugs to <@PACKAGE_BUGREPORT@>. +END + exit 0; +} + + +# print_version () +# ---------------- +# Display version (--version). +sub print_version +{ + print <<END; +autoupdate (@PACKAGE_NAME@) @VERSION@ +Written by David J. MacKenzie and Akim Demaille. + +Copyright 1994, 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. +END + exit 0; +} + + +# $CONFIGURE_AC +# &find_configure_ac () +# --------------------- +sub find_configure_ac () +{ + if (-f 'configure.ac') + { + if (-f 'configure.in') + { + warn "warning: `configure.ac' and `configure.in' both present.\n"; + warn "warning: proceeding with `configure.ac'.\n"; + } + return 'configure.ac'; + } + elsif (-f 'configure.in') + { + return 'configure.in'; + } + return; +} + + +# parse_args () +# ------------- +# Process any command line arguments. +sub parse_args () +{ + my $srcdir; + # F*k. Getopt seems bogus and dies when given `-' with `bundling'. + # If fixed some day, use this: '' => sub { push @ARGV, "-" } + my $update_stdin = grep /^-$/, @ARGV; + @ARGV = grep !/^-$/, @ARGV; + Getopt::Long::config ("bundling"); + Getopt::Long::GetOptions ('A|autoconf-dir|m|macrodir=s' => \$autoconf_dir, + 'l|localdir=s' => \$localdir, + 'd|debug' => \$debug, + 'h|help' => \&print_usage, + 'V|version' => \&print_version, + 'v|verbose' => \$verbose) + or exit 1; + push @ARGV, '-' + if $update_stdin; + if (! @ARGV) + { + my $configure_ac = find_configure_ac; + die 'no input file' + unless $configure_ac; + push @ARGV, $configure_ac; + } +} + + +# find_slaves +# ----------- +# Find the lib files and autoconf. +sub find_slaves () +{ + # Some non-GNU m4's don't reject the --help option, so give them /dev/null. + die "Autoconf requires GNU m4 1.4 or later\n" + if system "$m4 --help </dev/null 2>&1 | @FGREP@ reload-state >/dev/null"; + + # autoconf. + (my $dir = $0) =~ s,[^\\/]*$,,; + + # We test "$dir/autoconf" in case we are in the build tree, in which case + # the names are not transformed yet. + foreach my $file ($ENV{"AUTOCONF"} || '', + "$dir/@autoconf-name@", + "$dir/autoconf", + "@bindir@/@autoconf-name@") + { + if (-x $file) + { + $autoconf = $file; + last; + } + } + + # This is needed because perl's '-x' isn't a smart as bash's; that + # is, it won't find autoconf.sh. + $autoconf = 'autoconf' + if !$autoconf; +} + + +## -------------- ## +## Main program. ## +## -------------- ## +find_slaves; +parse_args; +mktmpdir; +$autoconf .= " --autoconf-dir $autoconf_dir --localdir $localdir"; + + +# @M4_BUILTINS -- M4 builtins and a useful comment. +my @m4_builtins = `echo dumpdef | $m4 2>&1 >/dev/null`; +map { s/:.*//;s/\W// } @m4_builtins; + + +# m4.m4 -- enable the m4 builtins. +# unm4.m4 -- disable the m4 builtins. +# savem4.m4 -- save the m4 builtins. +open M4_M4, ">$tmp/m4.m4" + or die "$me: cannot open: $!\n"; +open UNM4_M4, ">$tmp/unm4.m4" + or die "$me: cannot open: $!\n"; +open M4SAVE_M4, ">$tmp/m4save.m4" + or die "$me: cannot open: $!\n"; +foreach (@m4_builtins) + { + print M4_M4 "_au_define([$_], _au_defn([_au_$_]))\n"; + print UNM4_M4 "_au_undefine([$_])\n"; + print M4SAVE_M4 "define([_au_$_], defn([$_]))\n"; + } +close M4SAVE_M4 + or die "$me: cannot close: $!\n"; +close UNM4_M4 + or die "$me: cannot close: $!\n"; +close M4_M4 + or die "$me: cannot close: $!\n"; + + +# @AU_MACROS & AC_MACROS -- AU and AC macros and yet another useful comment. +open MACROS, ("$autoconf " + . "--trace AU_DEFUN:'AU:\$f:\$1' --trace define:'AC:\$f:\$1' " + . "-i /dev/null |") + or die "$me: cannot open: $!\n"; +my (%ac_macros, %au_macros); +while (<MACROS>) + { + chomp; + /^(AC|AU):(.*):([^:]*)$/ or next; + my $filename = basename ($2); + if ($1 eq "AC") + { + $ac_macros{$3} = $filename; + } + else + { + $au_macros{$3} = $filename; + } + } +close MACROS + or die "$me: cannot close: $!\n"; +# Don't keep AU macros in @AC_MACROS. +delete $ac_macros{$_} + foreach (keys %au_macros); +if ($debug) + { + print STDERR "Current Autoconf macros:\n"; + print STDERR join (' ', sort keys %ac_macros) . "\n\n"; + print STDERR "Obsolete Autoconf macros:\n"; + print STDERR join (' ', sort keys %au_macros) . "\n\n"; + } + +# $au_changequote -- enable the quote `[', `]' right before any AU macro. +my $au_changequote = + 's/\b(' . join ('|', keys %au_macros) . ')\b/_au_changequote([,])$1/g'; + +# au.m4 -- definitions the AU macros. +system ("$autoconf --trace AU_DEFUN:'_au_defun(\@<:\@\$1\@:>\@, +\@<:\@\$2\@:>\@)' -i /dev/null " + . ">$tmp/au.m4"); + +# ac.m4 -- autoquoting definitions of the AC macros (M4sugar excluded). +# disable.m4 -- undefine the macros of AC and m4sugar. +open AC_M4, ">$tmp/ac.m4" + or die "$me: cannot open: $!\n"; +open DISABLE_M4, ">$tmp/disable.m4" + or die "$me: cannot open: $!\n"; +foreach (sort keys %ac_macros) + { + print AC_M4 "_au_define([$_], [[\$0(\$\@)]])\n" + unless $ac_macros{$_} eq "m4sugar.m4"; + print DISABLE_M4 "_au_undefine([$_])\n"; + } +close DISABLE_M4 + or die "$me: cannot close: $!\n"; +close AC_M4 + or die "$me: cannot close: $!\n"; + + + +## ------------------- ## +## Process the files. ## +## ------------------- ## + +foreach my $file (@ARGV) + { + my $filename = $file; + # We need an actual file. + if ($file eq '-') + { + $file = "$tmp/stdin"; + system "cat >$file"; + } + elsif (! -r "$file") + { + die "$me: $file: No such file or directory"; + } + + # input.m4 -- m4 program to produce the updated file. + # Load the values, the dispatcher, neutralize m4, and the prepared + # input file. + my $input_m4 = <<EOF; + divert(-1) -*- Autoconf -*- + changequote([, ]) + + # Move all the builtins into the \`_au_' pseudo namespace + include([$tmp/m4save.m4]) + + # _au_defun(NAME, BODY) + # --------------------- + # Define NAME to BODY, plus AU activation/deactivation. + _au_define([_au_defun], + [_au_define([\$1], + [_au_enable()dnl + \$2[]dnl + _au_disable()])]) + + # Import the definition of the obsolete macros. + _au_include([$tmp/au.m4]) + + + ## ------------------------ ## + ## _au_enable/_au_disable. ## + ## ------------------------ ## + + # They work by pair: each time an AU macro is activated, it runs + # _au_enable, and at its end its runs _au_disable (see _au_defun + # above). But since AU macros might use AU macros, which should + # enable/disable only for the outer AU macros. + # + # \`_au_enabled' is used to this end, condionning whether we really + # enable/disable. + + + # __au_enable + # ----------- + # Reenable the builtins, and m4sugar. + _au_define([__au_enable], + [_au_divert(-1) + # Enable special characters. + _au_changecom([#]) + + # Enable the m4 builtins, m4sugar and the autoquoting AC macros. + _au_include([$tmp/m4.m4]) + _au_include([$autoconf_dir/m4sugar.m4]) + _au_include([$tmp/ac.m4]) + + _au_divert(0)]) + + # _au_enable + # ---------- + # Called at the beginning of all the obsolete macros. Reenable the + # builtins, and m4sugar if needed. + _au_define([_au_enable], + [_au_ifdef([_au_enabled], + [], + [__au_enable()])_au_dnl + _au_pushdef([_au_enabled])]) + + + # __au_disable + # ------------ + # Disable the builtins, and m4sugar. + _au_define([__au_disable], + [_au_divert(-1) + # Disable m4sugar, the AC autoquoting macros, and m4. + _au_include([$tmp/disable.m4]) + _au_include([$tmp/unm4.m4]) + + # Disable special characters. + _au_changequote() + _au_changecom() + + _au_divert(0)]) + + # _au_disable + # ----------- + # Called at the end of all the obsolete macros. Disable the + # builtins, and m4sugar if needed.. + _au_define([_au_disable], + [_au_popdef([_au_enabled])_au_dnl + _au_ifdef([_au_enabled], + [], + [__au_disable()])]) + + + ## ------------------------------- ## + ## Disable, and process the file. ## + ## ------------------------------- ## + _au_disable()_au_dnl +EOF + + $input_m4 =~ s/^ //mg; + + # prepared input -- input, but reenables the quote before each AU macro. + open INPUT_M4, ">$tmp/input.m4" + or die "$me: cannot open: $!\n"; + open FILE, "<$file" + or die "$me: cannot open: $!\n"; + print INPUT_M4 "$input_m4"; + while (<FILE>) + { + eval $au_changequote; + print INPUT_M4; + } + close FILE + or die "$me: cannot close: $!\n"; + close INPUT_M4 + or die "$me: cannot close: $!\n"; + + # Now ask m4 to perform the update. + print STDERR "$me: running $m4 $tmp/input.m4\n" + if $verbose; + if (system ("$m4 $tmp/input.m4 >$tmp/updated")) + { + # Exit status of system() is in the upper byte. + $! >>= 8; + die "$me: cannot update \`$filename'\n"; + }; + + if ("$file" eq "$tmp/stdin") + { + system ("cat $tmp/updated"); + } + elsif (! system ("cmp -s $tmp/updated $file")) + { + # File didn't change, so don't update its mod time. + print STDERR "$me: \`$file' is unchanged\n" + } + else + { + # Back up and install the new one. + if (system ("mv $file $file${SIMPLE_BACKUP_SUFFIX} && " + . "mv $tmp/updated $file") == 0) + { + print STDERR "$me: \`$file' is updated\n"; + } + else + { + die "$me: cannot update \`$file'\n"; + } + } + } + +exit 0; + + +# ## ---------------------------- ## +# ## How `autoupdate' functions. ## +# ## ---------------------------- ## +# +# The task of `autoupdate' is not trivial: the biggest difficulty being +# that you must limit the changes to the parts that really need to be +# updated. Finding a satisfying implementation proved to be quite hard, +# as this is the fourth implementation of `autoupdate'. +# +# Below, we will use a simple example of obsolete macro: +# +# AU_DEFUN([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))]) +# AC_DEFUN([NEW], [echo "sum($1) = $2"]) +# +# the input file contains +# +# dnl The Unbelievable Truth +# OLD(1, 2) +# NEW([0, 0], [0]) +# +# Of course the expected output is +# +# dnl The Unbelievable Truth +# NEW([1, 2], [3]) +# NEW([0, 0], [0]) +# +# +# # First implementation: sed +# # ========================= +# +# The first implementation was only able to change the name of obsolete +# macros. +# +# The file `acoldnames.m4' defined the old names based on the new names. +# It was simple then to produce a sed script such as: +# +# s/OLD/NEW/g +# +# Updating merely consisted in running this script on the file to +# update. +# +# This scheme suffers an obvious limitation: that `autoupdate' was +# unable to cope with new macros that just swap some of its arguments +# compared to the old macro. Fortunately, that was enough to upgrade +# from Autoconf 1 to Autoconf 2. (But I have no idea whether the +# changes in Autoconf 2 were precisely limited by this constraint.) +# +# +# # Second implementation: hooks +# # ============================ +# +# The version 2.15 of Autoconf brought a vast number of changes compared +# to 2.13, so a solution was needed. One could think to extend the +# `sed' scripts with specialized code for complex macros. But this +# approach is of course full of flaws: +# +# a. the Autoconf maintainers have to write these snippets, which we +# just don't want to, +# +# b. I really don't think you'll ever manage to handle the quoting of +# m4 from sed. +# +# To satisfy a., let's remark that the code which implements the old +# features in term of the new feature is exactly the code which should +# replace the old code. +# +# To answer point b, as usual in the history of Autoconf, the answer, at +# least on the paper, is simple: m4 is the best tool to parse m4, so +# let's use m4. +# +# Therefore the specification is: +# +# I want to be able to tell Autoconf, well, m4, that the macro I +# am currently defining is an obsolete macro (so that the user is +# warned), which code is the code to use when running autoconf, +# but that the very same code has to be used when running +# autoupdate. To summarize, the interface I want is +# `AU_DEFUN(OLD-NAME, NEW-CODE)'. +# +# +# Now for the technical details. +# +# When running autoconf, except for the warning, AU_DEFUN is basically +# AC_DEFUN. +# +# When running autoupdate, we want *only* OLD-NAMEs to be expanded. +# This obviously means that acgeneral.m4 and acspecific.m4 must not be +# loaded. Nonetheless, because we want to use a rich set of m4 +# features, m4sugar.m4 is needed. Please note that the fact that +# Autoconf's macros are not loaded is positive on two points: +# +# - we do get an updated `configure.ac', not a `configure'! +# +# - the old macros are replaced by *calls* to the new-macros, not the +# body of the new macros, since their body is not defined!!! +# (Whoa, that's really beautiful!). +# +# Additionally we need to disable the quotes when reading the input for +# two reasons: first because otherwise `m4' will swallow the quotes of +# other macros: +# +# NEW([1, 2], 3) +# => NEW(1, 2, 3) +# +# and second, because we want to update the macro calls which are +# quoted, i.e., we want +# +# FOO([OLD(1, 2)]) +# => FOO([NEW([1, 2], [3])]) +# +# If we don't disable the quotes, only the macros called at the top +# level would be updated. +# +# So, let's disable the quotes. +# +# Well, not quite: m4sugar.m4 still needs to use quotes for some macros. +# Well, in this case, when running in autoupdate code, each macro first +# reestablishes the quotes, expands itself, and disables the quotes. +# +# Thinking a bit more, you realize that in fact, people may use `define' +# `ifelse' etc. in their files, and you certainly don't want to process +# them. Another example is `dnl': you don't want to remove the +# comments. You then realize you don't want exactly to import m4sugar: +# you want to specify when it is enabled (macros active), and disabled. +# m4sugar provides m4_disable/m4_enable to this end. +# +# You're getting close to it. Now remains one task: how to handle +# twofold definitions? +# +# Remember that the same AU_DEFUN must be understood in two different +# ways, the AC way, and the AU way. +# +# One first solution is to check whether acgeneral.m4 was loaded. But +# that's definitely not cute. Another is simply to install `hooks', +# that is to say, to keep in some place m4 knows, late `define' to be +# triggered *only* in AU mode. +# +# You first think to design AU_DEFUN like this: +# +# 1. AC_DEFUN(OLD-NAME, +# [Warn the user OLD-NAME is obsolete. +# NEW-CODE]) +# +# 2. Store for late AU binding([define(OLD_NAME, +# [Reestablish the quotes. +# NEW-CODE +# Disable the quotes.])]) +# +# but this will not work: NEW-CODE has probably $1, $2 etc. and these +# guys will be replaced with the argument of `Store for late AU binding' +# when you call it. +# +# I don't think there is a means to avoid this using this technology +# (remember that $1 etc. are *always* expanded in m4). You may also try +# to replace them with $[1] to preserve them for a later evaluation, but +# if `Store for late AU binding' is properly written, it will remain +# quoted till the end... +# +# You have to change technology. Since the problem is that `$1' +# etc. should be `consumed' right away, one solution is to define now a +# second macro, `AU_OLD-NAME', and to install a hook than binds OLD-NAME +# to AU_OLD-NAME. Then, autoupdate.m4 just need to run the hooks. By +# the way, the same method was used in autoheader. +# +# +# # Third implementation: m4 namespaces by m4sugar +# # ============================================== +# +# Actually, this implementation was just a clean up of the previous +# implementation: instead of defining hooks by hand, m4sugar was equipped +# with `namespaces'. What are they? +# +# Sometimes we want to disable some *set* of macros, and restore them +# later. We provide support for this via namespaces. +# +# There are basically three characters playing this scene: defining a +# macro in a namespace, disabling a namespace, and restoring a namespace +# (i.e., all the definitions it holds). +# +# Technically, to define a MACRO in NAMESPACE means to define the macro +# named `NAMESPACE::MACRO' to the VALUE. At the same time, we append +# `undefine(NAME)' in the macro named `m4_disable(NAMESPACE)', and +# similarly a binding of NAME to the value of `NAMESPACE::MACRO' in +# `m4_enable(NAMESPACE)'. These mechanisms allow to bind the macro of +# NAMESPACE and to unbind them at will. +# +# Of course this implementation is really inefficient: m4 has to grow +# strings which can become quickly huge, which slows it significantly. +# +# In particular one should avoid as much as possible to use `define' for +# temporaries. Now that `define' as quite a complex meaning, it is an +# expensive operations that should be limited to macros. Use +# `m4_define' for temporaries. +# +# Private copies of the macros we used in entering / exiting the m4sugar +# namespace. It is much more convenient than fighting with the renamed +# version of define etc. +# +# +# +# Those two implementations suffered from serious problems: +# +# - namespaces were really expensive, and incurred a major performance +# loss on `autoconf' itself, not only `autoupdate'. One solution +# would have been the limit the use of namespaces to `autoupdate', but +# that's again some complications on m4sugar, which really doesn't need +# this. So we wanted to get rid of the namespaces. +# +# - since the quotes were disabled, autoupdate was sometimes making +# wrong guesses, for instance on: +# +# foo([1, 2]) +# +# m4 saw 2 arguments: `[1'and `2]'. A simple solution, somewhat +# fragile, is to reestablish the quotes right before all the obsolete +# macros, i.e., to use sed so that the previous text becomes +# +# changequote([, ])foo([1, 2]) +# +# To this end, one wants to trace the definition of obsolete macros. +# +# It was there that the limitations of the namespace approach became +# painful: because it was a complex machinery playing a lot with the +# builtins of m4 (hence, quite fragile), tracing was almost impossible. +# +# +# So this approach was dropped. +# +# +# # The fourth implementation: two steps +# # ==================================== +# +# If you drop the uses of namespaces, you no longer can compute the +# updated value, and replace the old call with it simultaneously. +# +# Obviously you will use m4 to compute the updated values, but you may +# use some other tool to achieve the replacement. Personally, I trust +# nobody but m4 to parse m4, so below, m4 will perform the two tasks. +# +# How can m4 be used to replace *some* macros calls with newer values. +# Well, that's dead simple: m4 should learn the definitions of obsolete +# macros, forget its builtins, disable the quotes, and then run on the +# input file, which amounts to doing this: +# +# divert(-1)dnl +# changequote([, ]) +# define([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))changequote()]) +# undefine([dnl]) +# undefine([m4_eval]) +# # Some more undefines... +# changequote() +# divert(0)dnl +# dnl The Unbelievable Truth +# changequote([, ])OLD(1, 2) +# NEW([0, 0], +# 0) +# +# which will result in +# +# dnl The Unbelievable Truth +# NEW(1, 2, m4_eval(1 + 2)) +# NEW([0, 0], +# 0) +# +# Grpmh. Two problems. A minor problem: it would have been much better +# to have the `m4_eval' computed, and a major problem: you lost the +# quotation in the result. +# +# Let's address the big problem first. One solution is to define any +# modern macro to rewrite its calls with the proper quotation, thanks to +# `$@'. Again, tracing the `define's makes it possible to know which +# are these macros, so you input is: +# +# divert(-1)dnl +# changequote([, ]) +# define([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))changequote()]) +# define([NEW], [[NEW($@)]changequote()]) +# undefine([dnl]) +# undefine([m4_eval]) +# # Some more undefines... +# changequote() +# divert(0)dnl +# dnl The Unbelievable Truth +# changequote([, ])OLD(1, 2) +# changequote([, ])NEW([0, 0], +# 0) +# +# which results in +# +# dnl The Unbelievable Truth +# NEW([1, 2],[m4_eval(1 + 2)]) +# NEW([0, 0],[0]) +# +# Our problem is solved, i.e., the first call to `NEW' is properly +# quoted, but introduced another problem: we changed the layout of the +# second calls, which can be a drama in the case of huge macro calls +# (think of `AC_TRY_RUN' for instance). This example didn't show it, +# but we also introduced parens to macros which did not have some: +# +# AC_INIT +# => AC_INIT() +# +# No big deal for the semantics (unless the macro depends upon $#, which +# is bad), but the users would not be happy. +# +# Additionally, we introduced quotes that we not there before, which is +# OK in most cases, but could change the semantics of the file. +# +# Cruel dilemma: we do want the auto-quoting definition of `NEW' when +# evaluating `OLD', but we don't when we evaluate the second `NEW'. +# Back to namespaces? +# +# No. +# +# +# # Second step: replacement +# # ------------------------ +# +# No, as announced above, we will work in two steps: in a first step we +# compute the updated values, and in a second step we replace them. Our +# goal is something like this: +# +# divert(-1)dnl +# changequote([, ]) +# define([OLD], [NEW([1, 2], [3])changequote()]) +# undefine([dnl]) +# undefine([m4_eval]) +# # Some more undefines... +# changequote() +# divert(0)dnl +# dnl The Unbelievable Truth +# changequote([, ])OLD(1, 2) +# NEW([0, 0], +# 0) +# +# i.e., the new value of `OLD' is precomputed using the auto-quoting +# definition of `NEW' and the m4 builtins. We'll see how afterwards, +# let's finish with the replacement. +# +# Of course the solution above is wrong: if there were other calls to +# `OLD' with different values, we would smash them to the same value. +# But it is quite easy to generalize the scheme above: +# +# divert(-1)dnl +# changequote([, ]) +# define([OLD([1],[2])], [NEW([1, 2], [3])]) +# define([OLD], [defn([OLD($@)])changequote()]) +# undefine([dnl]) +# undefine([m4_eval]) +# # Some more undefines... +# changequote() +# divert(0)dnl +# dnl The Unbelievable Truth +# changequote([, ])OLD(1, 2) +# NEW([0, 0], +# 0) +# +# i.e., for each call to obsolete macros, we build an array `call => +# value', and use a macro to dispatch these values. This results in: +# +# dnl The Unbelievable Truth +# NEW([1, 2], [3]) +# NEW([0, 0], +# 0) +# +# In French, we say `Youpi !', which you might roughly translate as +# `yipeee!'. +# +# +# # First step: computation +# # ----------------------- +# +# Let's study the anatomy of the file, and name its sections: +# +# prologue +# divert(-1)dnl +# changequote([, ]) +# values +# define([OLD([1],[2])], [NEW([1, 2], [3])]) +# dispatcher +# define([OLD], [defn([OLD($@)])changequote()]) +# disabler +# undefine([dnl]) +# undefine([m4_eval]) +# # Some more undefines... +# changequote() +# divert(0)dnl +# input +# dnl The Unbelievable Truth +# changequote([, ])OLD(1, 2) +# NEW([0, 0], +# 0) +# +# +# # Computing the `values' section +# # .............................. +# +# First we need to get the list of all the AU macro uses. To this end, +# first get the list of all the AU macros names by tracing `AU_DEFUN' in +# the initialization of autoconf. This list is computed in the file +# `au.txt' below. +# +# Then use this list to trace all the AU macro uses in the input. The +# goal is obtain in the case of our example: +# +# [define([OLD([1],[2])],]@<<@OLD([1],[2])@>>@[)] +# +# This is the file `values.in' below. +# +# We want to evaluate this with only the builtins (in fact m4sugar), the +# auto-quoting definitions of the new macros (`new.m4'), and the +# definition of the old macros (`old.m4'). Computing these last two +# files is easy: it's just a matter of using the right `--trace' option. +# +# So the content of `values.in' is: +# +# include($autoconf_dir/m4sugar.m4) +# m4_include(new.m4) +# m4_include(old.m4) +# divert(0)dnl +# [define([OLD([1],[2])],]@<<@OLD([1],[2])@>>@[)] +# +# We run m4 on it, which yields: +# +# define([OLD([1],[2])],@<<@NEW([1, 2], [3])@>>@) +# +# Transform `@<<@' and `@>>@' into quotes and we get +# +# define([OLD([1],[2])],[NEW([1, 2], [3])]) +# +# This is `values.m4'. +# +# +# # Computing the `dispatcher' section +# # .................................. +# +# The `prologue', and the `disabler' are simple and need no commenting. +# +# To compute the `dispatcher' (`dispatch.m4'), again, it is a simple +# matter of using the right `--trace'. +# +# Finally, the input is not exactly the input file, rather it is the +# input file with the added `changequote'. To this end, we build +# `quote.sed'. +# +# +# # Putting it all together +# # ....................... +# +# We build the file `input.m4' which contains: +# +# divert(-1)dnl +# changequote([, ]) +# include(values.m4) +# include(dispatch.m4) +# undefine([dnl]) +# undefine([eval]) +# # Some more undefines... +# changequote() +# divert(0)dnl +# dnl The Unbelievable Truth +# changequote([, ])OLD(1, 2) +# NEW([0, 0], +# 0) +# +# And we just run m4 on it. Et voila`, Monsieur ! Mais oui, mais oui. +# +# Well, there are a few additional technicalities. For instance, we +# rely on `changequote', `ifelse' and `defn', but we don't want to +# interpret the changequotes of the user, so we simply use another name: +# `_au_changequote' etc. +# +# +# # Failure of the fourth approach +# # ------------------------------ +# +# This approach is heavily based on traces, but then there is an obvious +# problem: non expanded code will never be seen/ In particular, the body +# of a `define' definition is not seen, so on the input +# +# define([idem], [OLD(0, [$1])]) +# +# autoupdate would never see the `OLD', and wouldn't have updated it. +# Worse yet, if `idem(0)' was used later, then autoupdate sees that +# `OLD' is used, computes the result for `OLD(0, 0)' and sets up a +# dispatcher for `OLD'. Since there was no computed value for `OLD(0, +# [$1])', the dispatcher would have replaced with... nothinhg, leading +# to +# +# define([idem], []) +# +# With some more thinking, you see that the two step approach is wrong, +# the namespace approach was much saner. +# +# But you learned a lot, in particular you realized that using traces +# can make it possible to simulate namespaces! +# +# +# +# # The fifth implementation: m4 namespaces by files +# # ================================================ +# +# The fourth implementation demonstrated something unsurprising: you +# cannot precompute, i.e., the namespace approach was the right one. +# Still, we no longer want them, they're too expensive. Let's have a +# look at the way it worked. +# +# When updating +# +# dnl The Unbelievable Truth +# OLD(1, 2) +# NEW([0, 0], [0]) +# +# you evaluate `input.m4': +# +# divert(-1) +# changequote([, ]) +# define([OLD], +# [m4_enable()NEW([$1, $2], m4_eval([$1 + $2]))m4_disable()]) +# ... +# m4_disable() +# dnl The Unbelievable Truth +# OLD(1, 2) +# NEW([0, 0], [0]) +# +# where `m4_disable' undefines the m4 and m4sugar, and disables the quotes +# and comments: +# +# define([m4_disable], +# [undefine([__file__]) +# ... +# changecom(#) +# changequote()]) +# +# `m4_enable' does the converse: reestablish quotes and comments +# --easy--, reestablish m4sugar --easy: just load `m4sugar.m4' again-- and +# reenable the builtins. This later task requires that you first save +# the builtins. And BTW, the definition above of `m4_disable' cannot +# work: you undefined `changequote' before using it! So you need to use +# your privates copies of the builtins. Let's introduce three files for +# this: +# +# `m4save.m4' +# moves the m4 builtins into the `_au_' pseudo namespace +# `unm4.m4' +# undefines the builtins +# `m4.m4' +# restores them +# +# So `input.m4' is: +# +# divert(-1) +# changequote([, ]) +# +# include([m4save.m4]) +# +# # Import AU. +# define([OLD], +# [m4_enable()NEW([$1, $2], m4_eval([$1 + $2]))m4_disable()]) +# +# define([_au_enable], +# [_au_changecom([#]) +# _au_include([m4.m4]) +# _au_include(m4sugar.m4)]) +# +# define([_au_disable], +# [# Disable m4sugar. +# # Disable the m4 builtins. +# _au_include([unm4.m4]) +# # 1. Disable special characters. +# _au_changequote() +# _au_changecom()]) +# +# m4_disable() +# dnl The Unbelievable Truth +# OLD(1, 2) +# NEW([0, 0], [0]) +# +# Based on what we learned in the fourth implementation we know that we +# have to enable the quotes *before* any AU macro, and we know we need +# to build autoquoting versions of the AC macros. But the autoquoting +# AC definitions must be disabled in the rest of the file, and enabled +# inside AU macros. +# +# Using `autoconf --trace' it is easy to build the files +# +# `ac.m4' +# define the autoquoting AC fake macros +# `disable.m4' +# undefine the m4sugar and AC autoquoting macros. +# `au.m4' +# definitions of the AU macros (such as `OLD' above). +# +# Now, `input.m4' is: +# +# divert(-1) +# changequote([, ]) +# +# include([m4save.m4]) +# # Import AU. +# include([au.m4]) +# +# define([_au_enable], +# [_au_changecom([#]) +# _au_include([m4.m4]) +# _au_include(m4sugar.m4) +# _au_include(ac.m4)]) +# +# define([_au_disable], +# [_au_include([disable.m4]) +# _au_include([unm4.m4]) +# # 1. Disable special characters. +# _au_changequote() +# _au_changecom()]) +# +# m4_disable() +# dnl The Unbelievable Truth +# _au_changequote([, ])OLD(1, 2) +# NEW([0, 0], [0]) +# +# Finally, version V is ready. +# +# Well... almost. +# +# There is a slight problem that remains: if an AU macro OUTER includes +# an AU macro INNER, then _au_enable will be run when entering OUTER +# and when entering INNER (not good, but not too bad yet). But when +# getting out of INNER, _au_disable will disable everything while we +# were still in OUTER. Badaboom. +# +# Therefore _au_enable and _au_disable have to be written to work by +# pairs: each _au_enable pushdef's _au_enabled, and each _au_disable +# popdef's _au_enabled. And of course _au_enable and _au_disable are +# effective when _au_enabled is *not* defined. +# +# Finally, version V' is ready. And there is much rejoicing. (And I +# have free time again. I think. Yeah, right.) diff --git a/config/Makefile.in b/config/Makefile.in new file mode 100644 index 0000000..6dff819 --- /dev/null +++ b/config/Makefile.in @@ -0,0 +1,181 @@ +# Copyright 2010-2012,2023 Thomas E. Dickey +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datarootdir = @datarootdir@ +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 = .. + +AUTOCONF = @AUTOCONF@ +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 = : +AWK = @AWK@ +EXPR = @EXPR@ +HELP2MAN = @HELP2MAN@ +M4 = @M4@ +PACKAGE = @PACKAGE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PERL = @PERL@ +PERLSCRIPTS = @PERLSCRIPTS@ +VERSION = @VERSION@ + +EXTRA_DIST = move-if-change prev-version.txt +subdir = config +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in config.guess config.sub \ + install-sh mdate-sh missing texinfo.tex +all: all-am + +.SUFFIXES: + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +uninstall-info-am: +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 \ + mkdir -p "$(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 + +installdirs: + +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: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +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-generic + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic 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-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic uninstall uninstall-am uninstall-info-am + +# 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 --git a/config/config.guess b/config/config.guess new file mode 100755 index 0000000..cdfc439 --- /dev/null +++ b/config/config.guess @@ -0,0 +1,1807 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2023 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2023-08-22' + +# 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 3 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, see <https://www.gnu.org/licenses/>. +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to <config-patches@gnu.org>. + + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system '$me' is run on. + +Options: + -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 <config-patches@gnu.org>." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2023 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 ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # 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 + +# Just in case it came from the environment. +GUESS= + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, 'CC_FOR_BUILD' used to be named 'HOST_CC'. We still +# use 'HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039,SC3028 + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD=$driver + break + fi + done + 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 ; 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 + +case $UNAME_SYSTEM in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #if defined(__ANDROID__) + LIBC=android + #else + #include <features.h> + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #else + #include <stdarg.h> + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + #endif + EOF + cc_set_libc=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + eval "$cc_set_libc" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# 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 tuples: *-*-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". + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)` + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-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) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + 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 + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case $UNAME_VERSION in + Debian*) + release='-gnu' + ;; + *) + release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + GUESS=$machine-${os}${release}${abi-} + ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-bitrig$UNAME_RELEASE + ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-openbsd$UNAME_RELEASE + ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/SecBSD.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-secbsd$UNAME_RELEASE + ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + GUESS=$UNAME_MACHINE_ARCH-unknown-libertybsd$UNAME_RELEASE + ;; + *:MidnightBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-midnightbsd$UNAME_RELEASE + ;; + *:ekkoBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-ekkobsd$UNAME_RELEASE + ;; + *:SolidBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-solidbsd$UNAME_RELEASE + ;; + *:OS108:*:*) + GUESS=$UNAME_MACHINE-unknown-os108_$UNAME_RELEASE + ;; + macppc:MirBSD:*:*) + GUESS=powerpc-unknown-mirbsd$UNAME_RELEASE + ;; + *:MirBSD:*:*) + GUESS=$UNAME_MACHINE-unknown-mirbsd$UNAME_RELEASE + ;; + *:Sortix:*:*) + GUESS=$UNAME_MACHINE-unknown-sortix + ;; + *:Twizzler:*:*) + GUESS=$UNAME_MACHINE-unknown-twizzler + ;; + *:Redox:*:*) + GUESS=$UNAME_MACHINE-unknown-redox + ;; + mips:OSF1:*.*) + GUESS=mips-dec-osf1 + ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case $ALPHA_CPU_TYPE in + "EV4 (21064)") + UNAME_MACHINE=alpha ;; + "EV4.5 (21064)") + UNAME_MACHINE=alpha ;; + "LCA4 (21066/21068)") + UNAME_MACHINE=alpha ;; + "EV5 (21164)") + UNAME_MACHINE=alphaev5 ;; + "EV5.6 (21164A)") + UNAME_MACHINE=alphaev56 ;; + "EV5.6 (21164PC)") + UNAME_MACHINE=alphapca56 ;; + "EV5.7 (21164PC)") + UNAME_MACHINE=alphapca57 ;; + "EV6 (21264)") + UNAME_MACHINE=alphaev6 ;; + "EV6.7 (21264A)") + UNAME_MACHINE=alphaev67 ;; + "EV6.8CB (21264C)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8AL (21264B)") + UNAME_MACHINE=alphaev68 ;; + "EV6.8CX (21264D)") + UNAME_MACHINE=alphaev68 ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE=alphaev69 ;; + "EV7 (21364)") + UNAME_MACHINE=alphaev7 ;; + "EV7.9 (21364A)") + UNAME_MACHINE=alphaev79 ;; + esac + # A Pn.n version is a patched version. + # 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. + OSF_REL=`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + GUESS=$UNAME_MACHINE-dec-osf$OSF_REL + ;; + Amiga*:UNIX_System_V:4.0:*) + GUESS=m68k-unknown-sysv4 + ;; + *:[Aa]miga[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-amigaos + ;; + *:[Mm]orph[Oo][Ss]:*:*) + GUESS=$UNAME_MACHINE-unknown-morphos + ;; + *:OS/390:*:*) + GUESS=i370-ibm-openedition + ;; + *:z/VM:*:*) + GUESS=s390-ibm-zvmoe + ;; + *:OS400:*:*) + GUESS=powerpc-ibm-os400 + ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + GUESS=arm-acorn-riscix$UNAME_RELEASE + ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + GUESS=arm-unknown-riscos + ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + GUESS=hppa1.1-hitachi-hiuxmpp + ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + case `(/bin/universe) 2>/dev/null` in + att) GUESS=pyramid-pyramid-sysv3 ;; + *) GUESS=pyramid-pyramid-bsd ;; + esac + ;; + NILE*:*:*:dcosx) + GUESS=pyramid-pyramid-svr4 + ;; + DRS?6000:unix:4.0:6*) + GUESS=sparc-icl-nx6 + ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) GUESS=sparc-icl-nx7 ;; + esac + ;; + s390x:SunOS:*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$UNAME_MACHINE-ibm-solaris2$SUN_REL + ;; + sun4H:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-hal-solaris2$SUN_REL + ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris2$SUN_REL + ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + GUESS=i386-pc-auroraux$UNAME_RELEASE + ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -m64 -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=$SUN_ARCH-pc-solaris2$SUN_REL + ;; + 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. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=sparc-sun-solaris3$SUN_REL + ;; + 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'. + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/'` + GUESS=sparc-sun-sunos$SUN_REL + ;; + sun3*:SunOS:*:*) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + 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) + GUESS=m68k-sun-sunos$UNAME_RELEASE + ;; + sun4) + GUESS=sparc-sun-sunos$UNAME_RELEASE + ;; + esac + ;; + aushp:SunOS:*:*) + GUESS=sparc-auspex-sunos$UNAME_RELEASE + ;; + # 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:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + GUESS=m68k-atari-mint$UNAME_RELEASE + ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + GUESS=m68k-milan-mint$UNAME_RELEASE + ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + GUESS=m68k-hades-mint$UNAME_RELEASE + ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + GUESS=m68k-unknown-mint$UNAME_RELEASE + ;; + m68k:machten:*:*) + GUESS=m68k-apple-machten$UNAME_RELEASE + ;; + powerpc:machten:*:*) + GUESS=powerpc-apple-machten$UNAME_RELEASE + ;; + RISC*:Mach:*:*) + GUESS=mips-dec-mach_bsd4.3 + ;; + RISC*:ULTRIX:*:*) + GUESS=mips-dec-ultrix$UNAME_RELEASE + ;; + VAX*:ULTRIX*:*:*) + GUESS=vax-dec-ultrix$UNAME_RELEASE + ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + GUESS=clipper-intergraph-clix$UNAME_RELEASE + ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include <stdio.h> /* 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 -o "$dummy" "$dummy.c" && + dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`"$dummy" "$dummyarg"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=mips-mips-riscos$UNAME_RELEASE + ;; + Motorola:PowerMAX_OS:*:*) + GUESS=powerpc-motorola-powermax + ;; + Motorola:*:4.3:PL8-*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + GUESS=powerpc-harris-powermax + ;; + Night_Hawk:Power_UNIX:*:*) + GUESS=powerpc-harris-powerunix + ;; + m88k:CX/UX:7*:*) + GUESS=m88k-harris-cxux7 + ;; + m88k:*:4*:R4*) + GUESS=m88k-motorola-sysv4 + ;; + m88k:*:3*:R3*) + GUESS=m88k-motorola-sysv3 + ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$TARGET_BINARY_INTERFACE"x = x + then + GUESS=m88k-dg-dgux$UNAME_RELEASE + else + GUESS=m88k-dg-dguxbcs$UNAME_RELEASE + fi + else + GUESS=i586-dg-dgux$UNAME_RELEASE + fi + ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + GUESS=m88k-dolphin-sysv3 + ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + GUESS=m88k-motorola-sysv3 + ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + GUESS=m88k-tektronix-sysv3 + ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + GUESS=m68k-tektronix-bsd + ;; + *:IRIX*:*:*) + IRIX_REL=`echo "$UNAME_RELEASE" | sed -e 's/-/_/g'` + GUESS=mips-sgi-irix$IRIX_REL + ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + GUESS=romp-ibm-aix # uname -m gives an 8 hex-code CPU id + ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + GUESS=i386-ibm-aix + ;; + ia64:AIX:*:*) + if test -x /usr/bin/oslevel ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$UNAME_MACHINE-ibm-aix$IBM_REV + ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + then + GUESS=$SYSTEM_NAME + else + GUESS=rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + GUESS=rs6000-ibm-aix3.2.4 + else + GUESS=rs6000-ibm-aix3.2 + fi + ;; + *:AIX:*:[4567]) + 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 test -x /usr/bin/lslpp ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | \ + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + else + IBM_REV=$UNAME_VERSION.$UNAME_RELEASE + fi + GUESS=$IBM_ARCH-ibm-aix$IBM_REV + ;; + *:AIX:*:*) + GUESS=rs6000-ibm-aix + ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + GUESS=romp-ibm-bsd4.4 + ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + GUESS=romp-ibm-bsd$UNAME_RELEASE # 4.3 with uname added to + ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + GUESS=rs6000-bull-bosx + ;; + DPX/2?00:B.O.S.:*:*) + GUESS=m68k-bull-sysv3 + ;; + 9000/[34]??:4.3bsd:1.*:*) + GUESS=m68k-hp-bsd + ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + GUESS=m68k-hp-bsd4.4 + ;; + 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 test -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 test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include <stdlib.h> + #include <unistd.h> + + 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 -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + GUESS=$HP_ARCH-hp-hpux$HPUX_REV + ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*.[0B]*//'` + GUESS=ia64-hp-hpux$HPUX_REV + ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include <unistd.h> + 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 -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + GUESS=unknown-hitachi-hiuxwe2 + ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + GUESS=hppa1.1-hp-bsd + ;; + 9000/8??:4.3bsd:*:*) + GUESS=hppa1.0-hp-bsd + ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + GUESS=hppa1.0-hp-mpeix + ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + GUESS=hppa1.1-hp-osf + ;; + hp8??:OSF1:*:*) + GUESS=hppa1.0-hp-osf + ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + GUESS=$UNAME_MACHINE-unknown-osf1mk + else + GUESS=$UNAME_MACHINE-unknown-osf1 + fi + ;; + parisc*:Lites*:*:*) + GUESS=hppa1.1-hp-lites + ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + GUESS=c1-convex-bsd + ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + GUESS=c34-convex-bsd + ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + GUESS=c38-convex-bsd + ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + GUESS=c4-convex-bsd + ;; + CRAY*Y-MP:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=ymp-cray-unicos$CRAY_REL + ;; + 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 ;; + CRAY*TS:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=t90-cray-unicos$CRAY_REL + ;; + CRAY*T3E:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=alphaev5-cray-unicosmk$CRAY_REL + ;; + CRAY*SV1:*:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=sv1-cray-unicos$CRAY_REL + ;; + *:UNICOS/mp:*:*) + CRAY_REL=`echo "$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/'` + GUESS=craynv-cray-unicosmp$CRAY_REL + ;; + 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/ /_/'` + GUESS=${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + GUESS=sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL} + ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + GUESS=$UNAME_MACHINE-pc-bsdi$UNAME_RELEASE + ;; + sparc*:BSD/OS:*:*) + GUESS=sparc-unknown-bsdi$UNAME_RELEASE + ;; + *:BSD/OS:*:*) + GUESS=$UNAME_MACHINE-unknown-bsdi$UNAME_RELEASE + ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabi + else + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL-gnueabihf + fi + ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + FREEBSD_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_PROCESSOR-unknown-freebsd$FREEBSD_REL + ;; + i*:CYGWIN*:*) + GUESS=$UNAME_MACHINE-pc-cygwin + ;; + *:MINGW64*:*) + GUESS=$UNAME_MACHINE-pc-mingw64 + ;; + *:MINGW*:*) + GUESS=$UNAME_MACHINE-pc-mingw32 + ;; + *:MSYS*:*) + GUESS=$UNAME_MACHINE-pc-msys + ;; + i*:PW*:*) + GUESS=$UNAME_MACHINE-pc-pw32 + ;; + *:SerenityOS:*:*) + GUESS=$UNAME_MACHINE-pc-serenity + ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + GUESS=i586-pc-interix$UNAME_RELEASE + ;; + authenticamd | genuineintel | EM64T) + GUESS=x86_64-unknown-interix$UNAME_RELEASE + ;; + IA64) + GUESS=ia64-unknown-interix$UNAME_RELEASE + ;; + esac ;; + i*:UWIN*:*) + GUESS=$UNAME_MACHINE-pc-uwin + ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + GUESS=x86_64-pc-cygwin + ;; + prep*:SunOS:5.*:*) + SUN_REL=`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'` + GUESS=powerpcle-unknown-solaris2$SUN_REL + ;; + *:GNU:*:*) + # the GNU system + GNU_ARCH=`echo "$UNAME_MACHINE" | sed -e 's,[-/].*$,,'` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's,/.*$,,'` + GUESS=$GNU_ARCH-unknown-$LIBC$GNU_REL + ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + GNU_SYS=`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"` + GNU_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-$GNU_SYS$GNU_REL-$LIBC + ;; + x86_64:[Mm]anagarm:*:*|i?86:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-pc-managarm-mlibc" + ;; + *:[Mm]anagarm:*:*) + GUESS="$UNAME_MACHINE-unknown-managarm-mlibc" + ;; + *:Minix:*:*) + GUESS=$UNAME_MACHINE-unknown-minix + ;; + aarch64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __ARM_EABI__ + #ifdef __ARM_PCS_VFP + ABI=eabihf + #else + ABI=eabi + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + eabi | eabihf) CPU=armv8l; LIBCABI=$LIBC$ABI ;; + esac + fi + GUESS=$CPU-unknown-linux-$LIBCABI + ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null` 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 -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arc:Linux:*:* | arceb:Linux:*:* | arc32:Linux:*:* | arc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabi + else + GUESS=$UNAME_MACHINE-unknown-linux-${LIBC}eabihf + fi + fi + ;; + avr32*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + cris:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + crisv32:Linux:*:*) + GUESS=$UNAME_MACHINE-axis-linux-$LIBC + ;; + e2k:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + frv:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + hexagon:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + i*86:Linux:*:*) + GUESS=$UNAME_MACHINE-pc-linux-$LIBC + ;; + ia64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + k1om:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m32r*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + m68*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + cc_set_vars=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI'` + eval "$cc_set_vars" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + openrisc*:Linux:*:*) + GUESS=or1k-unknown-linux-$LIBC + ;; + or32:Linux:*:* | or1k*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + padre:Linux:*:*) + GUESS=sparc-unknown-linux-$LIBC + ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + GUESS=hppa64-unknown-linux-$LIBC + ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) GUESS=hppa1.1-unknown-linux-$LIBC ;; + PA8*) GUESS=hppa2.0-unknown-linux-$LIBC ;; + *) GUESS=hppa-unknown-linux-$LIBC ;; + esac + ;; + ppc64:Linux:*:*) + GUESS=powerpc64-unknown-linux-$LIBC + ;; + ppc:Linux:*:*) + GUESS=powerpc-unknown-linux-$LIBC + ;; + ppc64le:Linux:*:*) + GUESS=powerpc64le-unknown-linux-$LIBC + ;; + ppcle:Linux:*:*) + GUESS=powerpcle-unknown-linux-$LIBC + ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + s390:Linux:*:* | s390x:Linux:*:*) + GUESS=$UNAME_MACHINE-ibm-linux-$LIBC + ;; + sh64*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sh*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + tile*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + vax:Linux:*:*) + GUESS=$UNAME_MACHINE-dec-linux-$LIBC + ;; + x86_64:Linux:*:*) + set_cc_for_build + CPU=$UNAME_MACHINE + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + ABI=64 + sed 's/^ //' << EOF > "$dummy.c" + #ifdef __i386__ + ABI=x86 + #else + #ifdef __ILP32__ + ABI=x32 + #endif + #endif +EOF + cc_set_abi=`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^ABI' | sed 's, ,,g'` + eval "$cc_set_abi" + case $ABI in + x86) CPU=i686 ;; + x32) LIBCABI=${LIBC}x32 ;; + esac + fi + GUESS=$CPU-pc-linux-$LIBCABI + ;; + xtensa*:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + 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. + GUESS=i386-sequent-sysv4 + ;; + 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. + GUESS=$UNAME_MACHINE-pc-sysv4.2uw$UNAME_VERSION + ;; + i*86:OS/2:*:*) + # If we were able to find 'uname', then EMX Unix compatibility + # is probably installed. + GUESS=$UNAME_MACHINE-pc-os2-emx + ;; + i*86:XTS-300:*:STOP) + GUESS=$UNAME_MACHINE-unknown-stop + ;; + i*86:atheos:*:*) + GUESS=$UNAME_MACHINE-unknown-atheos + ;; + i*86:syllable:*:*) + GUESS=$UNAME_MACHINE-pc-syllable + ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + GUESS=i386-unknown-lynxos$UNAME_RELEASE + ;; + i*86:*DOS:*:*) + GUESS=$UNAME_MACHINE-pc-msdosdjgpp + ;; + i*86:*:4.*:*) + UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + GUESS=$UNAME_MACHINE-univel-sysv$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv$UNAME_REL + fi + ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + GUESS=$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + GUESS=$UNAME_MACHINE-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + GUESS=$UNAME_MACHINE-pc-sco$UNAME_REL + else + GUESS=$UNAME_MACHINE-pc-sysv32 + fi + ;; + 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 i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + GUESS=i586-pc-msdosdjgpp + ;; + Intel:Mach:3*:*) + GUESS=i386-pc-mach3 + ;; + paragon:*:*:*) + GUESS=i860-intel-osf1 + ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + GUESS=i860-stardent-sysv$UNAME_RELEASE # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + GUESS=i860-unknown-sysv$UNAME_RELEASE # Unknown i860-SVR4 + fi + ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + GUESS=m68010-convergent-sysv + ;; + mc68k:UNIX:SYSTEM5:3.51m) + GUESS=m68k-convergent-sysv + ;; + M680?0:D-NIX:5.3:*) + GUESS=m68k-diab-dnix + ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*: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; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + 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; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + GUESS=m68k-unknown-lynxos$UNAME_RELEASE + ;; + mc68030:UNIX_System_V:4.*:*) + GUESS=m68k-atari-sysv4 + ;; + TSUNAMI:LynxOS:2.*:*) + GUESS=sparc-unknown-lynxos$UNAME_RELEASE + ;; + rs6000:LynxOS:2.*:*) + GUESS=rs6000-unknown-lynxos$UNAME_RELEASE + ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + GUESS=powerpc-unknown-lynxos$UNAME_RELEASE + ;; + SM[BE]S:UNIX_SV:*:*) + GUESS=mips-dde-sysv$UNAME_RELEASE + ;; + RM*:ReliantUNIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + RM*:SINIX-*:*:*) + GUESS=mips-sni-sysv4 + ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + GUESS=$UNAME_MACHINE-sni-sysv4 + else + GUESS=ns32k-sni-sysv + fi + ;; + PENTIUM:*:4.0*:*) # Unisys 'ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + GUESS=i586-unisys-sysv4 + ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + GUESS=hppa1.1-stratus-sysv4 + ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + GUESS=i860-stratus-sysv4 + ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=$UNAME_MACHINE-stratus-vos + ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + GUESS=hppa1.1-stratus-vos + ;; + mc68*:A/UX:*:*) + GUESS=m68k-apple-aux$UNAME_RELEASE + ;; + news*:NEWS-OS:6*:*) + GUESS=mips-sony-newsos6 + ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + GUESS=mips-nec-sysv$UNAME_RELEASE + else + GUESS=mips-unknown-sysv$UNAME_RELEASE + fi + ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + GUESS=powerpc-be-beos + ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + GUESS=powerpc-apple-beos + ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + GUESS=i586-pc-beos + ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + GUESS=i586-pc-haiku + ;; + ppc:Haiku:*:*) # Haiku running on Apple PowerPC + GUESS=powerpc-apple-haiku + ;; + *:Haiku:*:*) # Haiku modern gcc (not bound by BeOS compat) + GUESS=$UNAME_MACHINE-unknown-haiku + ;; + SX-4:SUPER-UX:*:*) + GUESS=sx4-nec-superux$UNAME_RELEASE + ;; + SX-5:SUPER-UX:*:*) + GUESS=sx5-nec-superux$UNAME_RELEASE + ;; + SX-6:SUPER-UX:*:*) + GUESS=sx6-nec-superux$UNAME_RELEASE + ;; + SX-7:SUPER-UX:*:*) + GUESS=sx7-nec-superux$UNAME_RELEASE + ;; + SX-8:SUPER-UX:*:*) + GUESS=sx8-nec-superux$UNAME_RELEASE + ;; + SX-8R:SUPER-UX:*:*) + GUESS=sx8r-nec-superux$UNAME_RELEASE + ;; + SX-ACE:SUPER-UX:*:*) + GUESS=sxace-nec-superux$UNAME_RELEASE + ;; + Power*:Rhapsody:*:*) + GUESS=powerpc-apple-rhapsody$UNAME_RELEASE + ;; + *:Rhapsody:*:*) + GUESS=$UNAME_MACHINE-apple-rhapsody$UNAME_RELEASE + ;; + arm64:Darwin:*:*) + GUESS=aarch64-apple-darwin$UNAME_RELEASE + ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + GUESS=$UNAME_PROCESSOR-apple-darwin$UNAME_RELEASE + ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = x86; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + GUESS=$UNAME_PROCESSOR-$UNAME_MACHINE-nto-qnx$UNAME_RELEASE + ;; + *:QNX:*:4*) + GUESS=i386-pc-qnx + ;; + NEO-*:NONSTOP_KERNEL:*:*) + GUESS=neo-tandem-nsk$UNAME_RELEASE + ;; + NSE-*:NONSTOP_KERNEL:*:*) + GUESS=nse-tandem-nsk$UNAME_RELEASE + ;; + NSR-*:NONSTOP_KERNEL:*:*) + GUESS=nsr-tandem-nsk$UNAME_RELEASE + ;; + NSV-*:NONSTOP_KERNEL:*:*) + GUESS=nsv-tandem-nsk$UNAME_RELEASE + ;; + NSX-*:NONSTOP_KERNEL:*:*) + GUESS=nsx-tandem-nsk$UNAME_RELEASE + ;; + *:NonStop-UX:*:*) + GUESS=mips-compaq-nonstopux + ;; + BS2000:POSIX*:*:*) + GUESS=bs2000-siemens-sysv + ;; + DS/*:UNIX_System_V:*:*) + GUESS=$UNAME_MACHINE-$UNAME_SYSTEM-$UNAME_RELEASE + ;; + *: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 + elif test "x${cputype-}" != x; then + UNAME_MACHINE=$cputype + fi + GUESS=$UNAME_MACHINE-unknown-plan9 + ;; + *:TOPS-10:*:*) + GUESS=pdp10-unknown-tops10 + ;; + *:TENEX:*:*) + GUESS=pdp10-unknown-tenex + ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + GUESS=pdp10-dec-tops20 + ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + GUESS=pdp10-xkl-tops20 + ;; + *:TOPS-20:*:*) + GUESS=pdp10-unknown-tops20 + ;; + *:ITS:*:*) + GUESS=pdp10-unknown-its + ;; + SEI:*:*:SEIUX) + GUESS=mips-sei-seiux$UNAME_RELEASE + ;; + *:DragonFly:*:*) + DRAGONFLY_REL=`echo "$UNAME_RELEASE" | sed -e 's/[-(].*//'` + GUESS=$UNAME_MACHINE-unknown-dragonfly$DRAGONFLY_REL + ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case $UNAME_MACHINE in + A*) GUESS=alpha-dec-vms ;; + I*) GUESS=ia64-dec-vms ;; + V*) GUESS=vax-dec-vms ;; + esac ;; + *:XENIX:*:SysV) + GUESS=i386-pc-xenix + ;; + i*86:skyos:*:*) + SKYOS_REL=`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'` + GUESS=$UNAME_MACHINE-pc-skyos$SKYOS_REL + ;; + i*86:rdos:*:*) + GUESS=$UNAME_MACHINE-pc-rdos + ;; + i*86:Fiwix:*:*) + GUESS=$UNAME_MACHINE-pc-fiwix + ;; + *:AROS:*:*) + GUESS=$UNAME_MACHINE-unknown-aros + ;; + x86_64:VMkernel:*:*) + GUESS=$UNAME_MACHINE-unknown-esx + ;; + amd64:Isilon\ OneFS:*:*) + GUESS=x86_64-unknown-onefs + ;; + *:Unleashed:*:*) + GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE + ;; +esac + +# Do we have a guess based on uname results? +if test "x$GUESS" != x; then + echo "$GUESS" + exit +fi + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" <<EOF +#ifdef _SEQUENT_ +#include <sys/types.h> +#include <sys/utsname.h> +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include <signal.h> +#if defined(_SIZE_T_) || defined(SIGLOST) +#include <sys/utsname.h> +#endif +#endif +#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 <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#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 <sys/param.h> +#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 +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`"$dummy"` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <<EOF + +NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize +the system type. Please install a C compiler and try again. +EOF + ;; +esac + +cat >&2 <<EOF + +This script (version $timestamp), has failed to recognize the +operating system you are using. If your script is old, overwrite *all* +copies of config.guess and config.sub with the latest versions from: + + https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +and + https://git.savannah.gnu.org/cgit/config.git/plain/config.sub +EOF + +our_year=`echo $timestamp | sed 's,-.*,,'` +thisyear=`date +%Y` +# shellcheck disable=SC2003 +script_age=`expr "$thisyear" - "$our_year"` +if test "$script_age" -lt 3 ; then + cat >&2 <<EOF + +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary 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 +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/config.sub b/config/config.sub new file mode 100755 index 0000000..51394d3 --- /dev/null +++ b/config/config.sub @@ -0,0 +1,1960 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2023 Free Software Foundation, Inc. + +# shellcheck disable=SC2006,SC2268 # see below for rationale + +timestamp='2023-09-15' + +# 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 3 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, see <https://www.gnu.org/licenses/>. +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to <config-patches@gnu.org>. +# +# 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. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# 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. + +# The "shellcheck disable" line above the timestamp inhibits complaints +# about features and limitations of the classic Bourne shell that were +# superseded or lifted in POSIX. However, this script identifies a wide +# variety of pre-POSIX systems that do not have POSIX shells at all, and +# even some reasonably current systems (Solaris 10 as case-in-point) still +# have a pre-POSIX /bin/sh. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS + +Canonicalize a configuration name. + +Options: + -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 <config-patches@gnu.org>." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2023 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 ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + 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 + +# Split fields of configuration type +# shellcheck disable=SC2162 +saved_IFS=$IFS +IFS="-" read field1 field2 field3 field4 <<EOF +$1 +EOF +IFS=$saved_IFS + +# Separate into logical components for further validation +case $1 in + *-*-*-*-*) + echo "Invalid configuration '$1': more than four components" >&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ + | windows-* ) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + zephyr*) + basic_machine=$field1-unknown + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | 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 | knuth | cray \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # 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) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=`echo "$1" | sed -e 's/86.*/86/'` + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=`echo "$basic_machine" | sed 's/-.*//'` + ;; + + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read cpu vendor <<EOF +$basic_machine +EOF + IFS=$saved_IFS + ;; + # 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) + cpu=$basic_machine + vendor=pc + ;; + # These rules are duplicated from below for sake of the special case above; + # i.e. things that normalized to x86 arches should also default to "pc" + pc98) + cpu=i386 + vendor=pc + ;; + x64 | amd64) + cpu=x86_64 + vendor=pc + ;; + # Recognize the basic CPU types without company name. + *) + cpu=$basic_machine + vendor=unknown + ;; +esac + +unset -v basic_machine + +# Decode basic machines in the full and proper CPU-Company form. +case $cpu-$vendor in + # Here we handle the default manufacturer of certain CPU types in canonical form. It is in + # some cases the only manufacturer, in others, it is the most popular. + craynv-unknown) + vendor=cray + basic_os=${basic_os:-unicosmp} + ;; + c90-unknown | c90-cray) + vendor=cray + basic_os=${Basic_os:-unicos} + ;; + fx80-unknown) + vendor=alliant + ;; + romp-unknown) + vendor=ibm + ;; + mmix-unknown) + vendor=knuth + ;; + microblaze-unknown | microblazeel-unknown) + vendor=xilinx + ;; + rs6000-unknown) + vendor=ibm + ;; + vax-unknown) + vendor=dec + ;; + pdp11-unknown) + vendor=dec + ;; + we32k-unknown) + vendor=att + ;; + cydra-unknown) + vendor=cydrome + ;; + i370-ibm*) + vendor=ibm + ;; + orion-unknown) + vendor=highlevel + ;; + xps-unknown | xps100-unknown) + cpu=xps100 + vendor=honeywell + ;; + + # Here we normalize CPU types with a missing or matching vendor + armh-unknown | armh-alt) + cpu=armv7l + vendor=alt + basic_os=${basic_os:-linux-gnueabihf} + ;; + dpx20-unknown | dpx20-bull) + cpu=rs6000 + vendor=bull + basic_os=${basic_os:-bosx} + ;; + + # Here we normalize CPU types irrespective of the vendor + amd64-*) + cpu=x86_64 + ;; + blackfin-*) + cpu=bfin + basic_os=linux + ;; + c54x-*) + cpu=tic54x + ;; + c55x-*) + cpu=tic55x + ;; + c6x-*) + cpu=tic6x + ;; + e500v[12]-*) + cpu=powerpc + basic_os=${basic_os}"spe" + ;; + mips3*-*) + cpu=mips64 + ;; + ms1-*) + cpu=mt + ;; + m68knommu-*) + cpu=m68k + basic_os=linux + ;; + m9s12z-* | m68hcs12z-* | hcs12z-* | s12z-*) + cpu=s12z + ;; + openrisc-*) + cpu=or32 + ;; + parisc-*) + cpu=hppa + basic_os=linux + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + cpu=i586 + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-* | athlon_*-*) + cpu=i686 + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + cpu=i686 + ;; + pentium4-*) + cpu=i786 + ;; + pc98-*) + cpu=i386 + ;; + ppc-* | ppcbe-*) + cpu=powerpc + ;; + ppcle-* | powerpclittle-*) + cpu=powerpcle + ;; + ppc64-*) + cpu=powerpc64 + ;; + ppc64le-* | powerpc64little-*) + cpu=powerpc64le + ;; + sb1-*) + cpu=mipsisa64sb1 + ;; + sb1el-*) + cpu=mipsisa64sb1el + ;; + sh5e[lb]-*) + cpu=`echo "$cpu" | sed 's/^\(sh.\)e\(.\)$/\1\2e/'` + ;; + spur-*) + cpu=spur + ;; + strongarm-* | thumb-*) + cpu=arm + ;; + tx39-*) + cpu=mipstx39 + ;; + tx39el-*) + cpu=mipstx39el + ;; + x64-*) + cpu=x86_64 + ;; + xscale-* | xscalee[bl]-*) + cpu=`echo "$cpu" | sed 's/^xscale/arm/'` + ;; + arm64-* | aarch64le-*) + cpu=aarch64 + ;; + + # Recognize the canonical CPU Types that limit and/or modify the + # company names they are paired with. + cr16-*) + basic_os=${basic_os:-elf} + ;; + crisv32-* | etraxfs*-*) + cpu=crisv32 + vendor=axis + ;; + cris-* | etrax*-*) + cpu=cris + vendor=axis + ;; + crx-*) + basic_os=${basic_os:-elf} + ;; + neo-tandem) + cpu=neo + vendor=tandem + ;; + nse-tandem) + cpu=nse + vendor=tandem + ;; + nsr-tandem) + cpu=nsr + vendor=tandem + ;; + nsv-tandem) + cpu=nsv + vendor=tandem + ;; + nsx-tandem) + cpu=nsx + vendor=tandem + ;; + mipsallegrexel-sony) + cpu=mipsallegrexel + vendor=sony + ;; + tile*-*) + basic_os=${basic_os:-linux-gnu} + ;; + + *) + # Recognize the canonical CPU types that are allowed with any + # company name. + case $cpu in + 1750a | 580 \ + | a29k \ + | aarch64 | aarch64_be | aarch64c | arm64ec \ + | abacus \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ + | am33_2.0 \ + | amdgcn \ + | arc | arceb | arc32 | arc64 \ + | arm | arm[lb]e | arme[lb] | armv* \ + | avr | avr32 \ + | asmjs \ + | ba \ + | be32 | be64 \ + | bfin | bpf | bs2000 \ + | c[123]* | c30 | [cjt]90 | c4x \ + | c8051 | clipper | craynv | csky | cydra \ + | d10v | d30v | dlx | dsp16xx \ + | e2k | elxsi | epiphany \ + | f30[01] | f700 | fido | fr30 | frv | ft32 | fx80 \ + | javascript \ + | h8300 | h8500 \ + | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | hexagon \ + | i370 | i*86 | i860 | i960 | ia16 | ia64 \ + | ip2k | iq2000 \ + | k1om \ + | kvx \ + | le32 | le64 \ + | lm32 \ + | loongarch32 | loongarch64 \ + | m32c | m32r | m32rle \ + | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | m68k \ + | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \ + | m88110 | m88k | maxq | mb | mcore | mep | metag \ + | microblaze | microblazeel \ + | mips* \ + | mmix \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nds32 | nds32le | nds32be \ + | nfp \ + | nios | nios2 | nios2eb | nios2el \ + | none | np1 | ns16k | ns32k | nvptx \ + | open8 \ + | or1k* \ + | or32 \ + | orion \ + | picochip \ + | pdp10 | pdp11 | pj | pjl | pn | power \ + | powerpc | powerpc64 | powerpc64le | powerpcle | powerpcspe \ + | pru \ + | pyramid \ + | riscv | riscv32 | riscv32be | riscv64 | riscv64be \ + | rl78 | romp | rs6000 | rx \ + | s390 | s390x \ + | score \ + | sh | shl \ + | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] | sh[lb]e \ + | sh[1234]e[lb] | sh[12345][lb]e | sh[23]ele | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet \ + | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v | sv1 | sx* \ + | spu \ + | tahoe \ + | thumbv7* \ + | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \ + | tron \ + | ubicom32 \ + | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ + | vax \ + | visium \ + | w65 \ + | wasm32 | wasm64 \ + | we32k \ + | x86 | x86_64 | xc16x | xgate | xps100 \ + | xstormy16 | xtensa* \ + | ymp \ + | z8k | z80) + ;; + + *) + echo "Invalid configuration '$1': machine '$cpu-$vendor' not recognized" 1>&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x"$basic_os" != x +then + +# First recognize some ad-hoc cases, or perhaps split kernel-os, or else just +# set os. +obj= +case $basic_os in + gnu/linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|gnu/linux|gnu|'` + ;; + os2-emx) + kernel=os2 + os=`echo "$basic_os" | sed -e 's|os2-emx|emx|'` + ;; + nto-qnx*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto-qnx|qnx|'` + ;; + *-*) + # shellcheck disable=SC2162 + saved_IFS=$IFS + IFS="-" read kernel os <<EOF +$basic_os +EOF + IFS=$saved_IFS + ;; + # Default OS when just kernel was specified + nto*) + kernel=nto + os=`echo "$basic_os" | sed -e 's|nto|qnx|'` + ;; + linux*) + kernel=linux + os=`echo "$basic_os" | sed -e 's|linux|gnu|'` + ;; + managarm*) + kernel=managarm + os=`echo "$basic_os" | sed -e 's|managarm|mlibc|'` + ;; + *) + kernel= + os=$basic_os + ;; +esac + +# Now, normalize the OS (knowing we just have one component, it's not a kernel, +# etc.) +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. + auroraux) + os=auroraux + ;; + bluegene*) + os=cnk + ;; + solaris1 | solaris1.*) + os=`echo "$os" | sed -e 's|solaris1|sunos4|'` + ;; + solaris) + os=solaris2 + ;; + unixware*) + os=sysv4.2uw + ;; + # es1800 is here to avoid being matched by es* (a different OS) + es1800*) + os=ose + ;; + # Some version numbers need modification + chorusos*) + os=chorusos + ;; + isc) + os=isc2.2 + ;; + sco6) + os=sco5v6 + ;; + sco5) + os=sco3.2v5 + ;; + sco4) + os=sco3.2v4 + ;; + sco3.2.[4-9]*) + os=`echo "$os" | sed -e 's/sco3.2./sco3.2v/'` + ;; + sco*v* | scout) + # Don't match below + ;; + sco*) + os=sco3.2v2 + ;; + psos*) + os=psos + ;; + qnx*) + os=qnx + ;; + hiux*) + os=hiuxwe2 + ;; + lynx*178) + os=lynxos178 + ;; + lynx*5) + os=lynxos5 + ;; + lynxos*) + # don't get caught up in next wildcard + ;; + lynx*) + os=lynxos + ;; + mac[0-9]*) + os=`echo "$os" | sed -e 's|mac|macos|'` + ;; + opened*) + os=openedition + ;; + os400*) + os=os400 + ;; + sunos5*) + os=`echo "$os" | sed -e 's|sunos5|solaris2|'` + ;; + sunos6*) + os=`echo "$os" | sed -e 's|sunos6|solaris3|'` + ;; + wince*) + os=wince + ;; + utek*) + os=bsd + ;; + dynix*) + os=bsd + ;; + acis*) + os=aos + ;; + atheos*) + os=atheos + ;; + syllable*) + os=syllable + ;; + 386bsd) + os=bsd + ;; + ctix* | uts*) + os=sysv + ;; + nova*) + os=rtmk-nova + ;; + ns2) + os=nextstep2 + ;; + # Preserve the version number of sinix5. + sinix5.*) + os=`echo "$os" | sed -e 's|sinix|sysv|'` + ;; + sinix*) + os=sysv4 + ;; + tpf*) + os=tpf + ;; + triton*) + os=sysv3 + ;; + oss*) + os=sysv3 + ;; + svr4*) + os=sysv4 + ;; + svr3) + os=sysv3 + ;; + sysvr4) + os=sysv4 + ;; + ose*) + os=ose + ;; + *mint | mint[0-9]* | *MiNT | MiNT[0-9]*) + os=mint + ;; + dicos*) + os=dicos + ;; + pikeos*) + # Until real need of OS specific support for + # particular features comes up, bare metal + # configurations are quite functional. + case $cpu in + arm*) + os=eabi + ;; + *) + os= + obj=elf + ;; + esac + ;; + aout* | coff* | elf* | pe*) + # These are machine code file formats, not OSes + obj=$os + os= + ;; + *) + # No normalization, but not necessarily accepted, that comes below. + ;; +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. + +kernel= +obj= +case $cpu-$vendor in + score-*) + os= + obj=elf + ;; + spu-*) + os= + obj=elf + ;; + *-acorn) + os=riscix1.2 + ;; + arm*-rebel) + kernel=linux + os=gnu + ;; + arm*-semi) + os= + obj=aout + ;; + c4x-* | tic4x-*) + os= + obj=coff + ;; + c8051-*) + os= + obj=elf + ;; + clipper-intergraph) + os=clix + ;; + hexagon-*) + os= + obj=elf + ;; + tic54x-*) + os= + obj=coff + ;; + tic55x-*) + os= + obj=coff + ;; + tic6x-*) + os= + obj=coff + ;; + # 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 + ;; + m68*-cisco) + os= + obj=aout + ;; + mep-*) + os= + obj=elf + ;; + mips*-cisco) + os= + obj=elf + ;; + mips*-*) + os= + obj=elf + ;; + or32-*) + os= + obj=coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=sysv3 + ;; + sparc-* | *-sun) + os=sunos4.1.1 + ;; + pru-*) + os= + obj=elf + ;; + *-be) + os=beos + ;; + *-ibm) + os=aix + ;; + *-knuth) + os=mmixware + ;; + *-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 + ;; + *-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= + obj=coff + ;; + *-*bug) + os= + obj=coff + ;; + *-apple) + os=macos + ;; + *-atari*) + os=mint + ;; + *-wrs) + os=vxworks + ;; + *) + os=none + ;; +esac + +fi + +# Now, validate our (potentially fixed-up) individual pieces (OS, OBJ). + +case $os in + # Sometimes we do "kernel-libc", so those need to count as OSes. + musl* | newlib* | relibc* | uclibc*) + ;; + # Likewise for "kernel-abi" + eabi* | gnueabi*) + ;; + # VxWorks passes extra cpu info in the 4th filed. + simlinux | simwindows | spe) + ;; + # See `case $cpu-$os` validation below + ghcjs) + ;; + # Now accept the basic system types. + # The portable systems comes first. + # Each alternative MUST end in a * to match a version number. + gnu* | android* | bsd* | mach* | minix* | genix* | ultrix* | irix* \ + | *vms* | esix* | aix* | cnk* | sunos | sunos[34]* \ + | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \ + | sym* | plan9* | psp* | sim* | xray* | os68k* | v88r* \ + | hiux* | abug | nacl* | netware* | windows* \ + | os9* | macos* | osx* | ios* | tvos* | watchos* \ + | mpw* | magic* | mmixware* | mon960* | lnews* \ + | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \ + | aos* | aros* | cloudabi* | sortix* | twizzler* \ + | nindy* | vxsim* | vxworks* | ebmon* | hms* | mvs* \ + | clix* | riscos* | uniplus* | iris* | isc* | rtu* | xenix* \ + | mirbsd* | netbsd* | dicos* | openedition* | ose* \ + | bitrig* | openbsd* | secbsd* | solidbsd* | libertybsd* | os108* \ + | ekkobsd* | freebsd* | riscix* | lynxos* | os400* \ + | bosx* | nextstep* | cxux* | oabi* \ + | ptx* | ecoff* | winnt* | domain* | vsta* \ + | udi* | lites* | ieee* | go32* | aux* | hcos* \ + | chorusrdb* | cegcc* | glidix* | serenity* \ + | cygwin* | msys* | moss* | proelf* | rtems* \ + | midipix* | mingw32* | mingw64* | mint* \ + | uxpv* | beos* | mpeix* | udk* | moxiebox* \ + | interix* | uwin* | mks* | rhapsody* | darwin* \ + | openstep* | oskit* | conix* | pw32* | nonstopux* \ + | storm-chaos* | tops10* | tenex* | tops20* | its* \ + | os2* | vos* | palmos* | uclinux* | nucleus* | morphos* \ + | scout* | superux* | sysv* | rtmk* | tpf* | windiss* \ + | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \ + | skyos* | haiku* | rdos* | toppers* | drops* | es* \ + | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ + | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ + | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ + | fiwix* | mlibc* | cos* | mbr* ) + ;; + # This one is extra strict with allowed versions + sco3.2v2 | sco3.2v[4-9]* | sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + ;; + none) + ;; + kernel* | msvc* ) + # Restricted further below + ;; + '') + if test x"$obj" = x + then + echo "Invalid configuration '$1': Blank OS only allowed with explicit machine code file format" 1>&2 + fi + ;; + *) + echo "Invalid configuration '$1': OS '$os' not recognized" 1>&2 + exit 1 + ;; +esac + +case $obj in + aout* | coff* | elf* | pe*) + ;; + '') + # empty is fine + ;; + *) + echo "Invalid configuration '$1': Machine code format '$obj' not recognized" 1>&2 + exit 1 + ;; +esac + +# Here we handle the constraint that a (synthetic) cpu and os are +# valid only in combination with each other and nowhere else. +case $cpu-$os in + # The "javascript-unknown-ghcjs" triple is used by GHC; we + # accept it here in order to tolerate that, but reject any + # variations. + javascript-ghcjs) + ;; + javascript-* | *-ghcjs) + echo "Invalid configuration '$1': cpu '$cpu' is not valid with os '$os$obj'" 1>&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os-$obj in + linux-gnu*- | linux-dietlibc*- | linux-android*- | linux-newlib*- \ + | linux-musl*- | linux-relibc*- | linux-uclibc*- | linux-mlibc*- ) + ;; + uclinux-uclibc*- ) + ;; + managarm-mlibc*- | managarm-kernel*- ) + ;; + windows*-gnu*- | windows*-msvc*-) + ;; + -dietlibc*- | -newlib*- | -musl*- | -relibc*- | -uclibc*- | -mlibc*- ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 + exit 1 + ;; + -kernel*- ) + echo "Invalid configuration '$1': '$os' needs explicit kernel." 1>&2 + exit 1 + ;; + *-kernel*- ) + echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 + exit 1 + ;; + *-msvc*- ) + echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 + exit 1 + ;; + kfreebsd*-gnu*- | kopensolaris*-gnu*-) + ;; + vxworks-simlinux- | vxworks-simwindows- | vxworks-spe-) + ;; + nto-qnx*-) + ;; + os2-emx-) + ;; + *-eabi*- | *-gnueabi*-) + ;; + none--*) + # None (no kernel, i.e. freestanding / bare metal), + # can be paired with an machine code file format + ;; + -*-) + # Blank kernel with real OS is always fine. + ;; + --*) + # Blank kernel and OS with real machine code file format is always fine. + ;; + *-*-*) + echo "Invalid configuration '$1': Kernel '$kernel' not known to work with OS '$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-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 + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + vendor=ibm + ;; + *-ptx*) + vendor=sequent + ;; + *-tpf*) + vendor=ibm + ;; + *-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 + ;; +esac + +echo "$cpu-$vendor${kernel:+-$kernel}${os:+-$os}${obj:+-$obj}" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config/install-sh b/config/install-sh new file mode 100755 index 0000000..ec298b5 --- /dev/null +++ b/config/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# 'make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/config/mdate-sh b/config/mdate-sh new file mode 100644 index 0000000..0c88e75 --- /dev/null +++ b/config/mdate-sh @@ -0,0 +1,92 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. +# Copyright 1995, 1996, 1997 Free Software Foundation, Inc. +# written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, June 1995 +# +# 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, 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. + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +# Get the extended ls output of the file or directory. +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +if ls -L /dev/null 1>/dev/null 2>&1; then + set - x`ls -L -l -d $1` +else + set - x`ls -l -d $1` +fi +# The month is at least the fourth argument +# (3 shifts here, the next inside the loop). +shift +shift +shift + +# Find the month. Next argument is day, followed by the year or time. +month= +until test $month +do + shift + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +day=$2 + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year diff --git a/config/missing b/config/missing new file mode 100755 index 0000000..c589da4 --- /dev/null +++ b/config/missing @@ -0,0 +1,262 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright 2010-2017,2023 Thomas E. Dickey +# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 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, 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. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'int main(void) { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'int main(void) { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version > /dev/null 2>&1); then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar ${1+"$@"} && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar ${1+"$@"} && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" ${1+"$@"} && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/config/move-if-change b/config/move-if-change new file mode 100755 index 0000000..66d8b8a --- /dev/null +++ b/config/move-if-change @@ -0,0 +1,17 @@ +#!/bin/sh +# Like mv $1 $2, but if the files are the same, just delete $1. +# Status is 0 if $2 is changed, 1 otherwise. +if +test -r $2 +then +if +cmp -s $1 $2 +then +echo $2 is unchanged +rm -f $1 +else +mv -f $1 $2 +fi +else +mv -f $1 $2 +fi diff --git a/config/prev-version.txt b/config/prev-version.txt new file mode 100644 index 0000000..f02fc20 --- /dev/null +++ b/config/prev-version.txt @@ -0,0 +1 @@ +2.50 diff --git a/config/texinfo.tex b/config/texinfo.tex new file mode 100644 index 0000000..2896248 --- /dev/null +++ b/config/texinfo.tex @@ -0,0 +1,6284 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2001-06-21.10} +% +% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, +% 2000, 01 Free Software Foundation, Inc. +% +% This texinfo.tex 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, or (at +% your option) any later version. +% +% This texinfo.tex file 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 texinfo.tex file; see the file COPYING. If not, write +% to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +% Boston, MA 02111-1307, USA. +% +% In other words, you are welcome to use, share and improve this program. +% You are forbidden to forbid anyone else to use, share and improve +% what you give them. Help stamp out software-hoarding! +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% ftp://ftp.gnu.org/gnu/texinfo.tex +% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) +% ftp://texinfo.org/tex/texinfo.tex +% ftp://us.ctan.org/macros/texinfo/texinfo.tex +% (and all CTAN mirrors, finger ctan@us.ctan.org for a list). +% /home/gd/gnu/doc/texinfo.tex on the GNU machines. +% The texinfo.tex in any given Texinfo distribution could well be out +% of date, so if that's what you're using, please check. +% Texinfo has a small home page at http://texinfo.org/. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever, to process the dvi file; this makes foo.ps. +% The extra runs of TeX get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages. You can get +% the existing language-specific files from ftp://ftp.gnu.org/gnu/texinfo/. + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + +% Save some parts of plain tex whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexi=\i +\let\ptexlbrace=\{ +\let\ptexrbrace=\} +\let\ptexstar=\* +\let\ptext=\t + +% We never want plain's outer \+ definition in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +\message{Basics,} +\chardef\other=12 + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeftypevar\undefined\gdef\putwordDeftypevar{Variable}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi +\ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi + +% Ignore a token. +% +\def\gobble#1{} + +\hyphenation{ap-pen-dix} +\hyphenation{mini-buf-fer mini-buf-fers} +\hyphenation{eshell} +\hyphenation{white-space} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen \bindingoffset +\newdimen \normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\ifx\eTeXversion\undefined +\def\loggingall{\tracingcommands2 \tracingstats2 + \tracingpages1 \tracingoutput1 \tracinglostchars1 + \tracingmacros2 \tracingparagraphs1 \tracingrestores1 + \showboxbreadth\maxdimen\showboxdepth\maxdimen +}% +\else +\def\loggingall{\tracingcommands3 \tracingstats2 + \tracingpages1 \tracingoutput1 \tracinglostchars1 + \tracingmacros2 \tracingparagraphs1 \tracingrestores1 + \tracingscantokens1 \tracingassigns1 \tracingifs1 + \tracinggroups1 \tracingnesting2 + \showboxbreadth\maxdimen\showboxdepth\maxdimen +}% +\fi + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% For @cropmarks command. +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \escapechar = `\\ % use backslash in output files. + \indexdummies % don't expand commands in the output. + \normalturnoffactive % \ in index entries must not stay \, e.g., if + % the page break happens to be in the middle of an example. + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfmkdest{\the\pageno} \fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingxxx.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 2\baselineskip + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \turnoffactive + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1 \unvbox#1 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg#1{% + \let\next = #1% + \begingroup + \obeylines + \futurelet\temp\parseargx +} + +% If the next token is an obeyed space (from an @example environment or +% the like), remove it and recurse. Otherwise, we're done. +\def\parseargx{% + % \obeyedspace is defined far below, after the definition of \sepspaces. + \ifx\obeyedspace\temp + \expandafter\parseargdiscardspace + \else + \expandafter\parseargline + \fi +} + +% Remove a single space (as the delimiter token to the macro call). +{\obeyspaces % + \gdef\parseargdiscardspace {\futurelet\temp\parseargx}} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + % + % First remove any @c comment, then any @comment. + % Result of each macro is put in \toks0. + \argremovec #1\c\relax % + \expandafter\argremovecomment \the\toks0 \comment\relax % + % + % Call the caller's macro, saved as \next in \parsearg. + \expandafter\next\expandafter{\the\toks0}% + }% +} + +% Since all \c{,omment} does is throw away the argument, we can let TeX +% do that for us. The \relax here is matched by the \relax in the call +% in \parseargline; it could be more or less anything, its purpose is +% just to delimit the argument to the \c. +\def\argremovec#1\c#2\relax{\toks0 = {#1}} +\def\argremovecomment#1\comment#2\relax{\toks0 = {#1}} + +% \argremovec{,omment} might leave us with trailing spaces, though; e.g., +% @end itemize @c foo +% will have two active spaces as part of the argument with the +% `itemize'. Here we remove all active spaces from #1, and assign the +% result to \toks0. +% +% This loses if there are any *other* active characters besides spaces +% in the argument -- _ ^ +, for example -- since they get expanded. +% Fortunately, Texinfo does not define any such commands. (If it ever +% does, the catcode of the characters in questionwill have to be changed +% here.) But this means we cannot call \removeactivespaces as part of +% \argremovec{,omment}, since @c uses \parsearg, and thus the argument +% that \parsearg gets might well have any character at all in it. +% +\def\removeactivespaces#1{% + \begingroup + \ignoreactivespaces + \edef\temp{#1}% + \global\toks0 = \expandafter{\temp}% + \endgroup +} + +% Change the active space to expand to nothing. +% +\begingroup + \obeyspaces + \gdef\ignoreactivespaces{\obeyspaces\let =\empty} +\endgroup + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +%% These are used to keep @begin/@end levels from running away +%% Call \inENV within environments (after a \begingroup) +\newif\ifENV \ENVfalse \def\inENV{\ifENV\relax\else\ENVtrue\fi} +\def\ENVcheck{% +\ifENV\errmessage{Still within an environment; press RETURN to continue} +\endgroup\fi} % This is not perfect, but it should reduce lossage + +% @begin foo is the same as @foo, for now. +\newhelp\EMsimple{Press RETURN to continue.} + +\outer\def\begin{\parsearg\beginxxx} + +\def\beginxxx #1{% +\expandafter\ifx\csname #1\endcsname\relax +{\errhelp=\EMsimple \errmessage{Undefined command @begin #1}}\else +\csname #1\endcsname\fi} + +% @end foo executes the definition of \Efoo. +% +\def\end{\parsearg\endxxx} +\def\endxxx #1{% + \removeactivespaces{#1}% + \edef\endthing{\the\toks0}% + % + \expandafter\ifx\csname E\endthing\endcsname\relax + \expandafter\ifx\csname \endthing\endcsname\relax + % There's no \foo, i.e., no ``environment'' foo. + \errhelp = \EMsimple + \errmessage{Undefined command `@end \endthing'}% + \else + \unmatchedenderror\endthing + \fi + \else + % Everything's ok; the right environment has been started. + \csname E\endthing\endcsname + \fi +} + +% There is an environment #1, but it hasn't been started. Give an error. +% +\def\unmatchedenderror#1{% + \errhelp = \EMsimple + \errmessage{This `@end #1' doesn't have a matching `@#1'}% +} + +% Define the control sequence \E#1 to give an unmatched @end error. +% +\def\defineunmatchedend#1{% + \expandafter\def\csname E#1\endcsname{\unmatchedenderror{#1}}% +} + + +% Single-spacing is done by various environments (specifically, in +% \nonfillstart and \quotations). +\newskip\singlespaceskip \singlespaceskip = 12.5pt +\def\singlespace{% + % Why was this kern here? It messes up equalizing space above and below + % environments. --karl, 6may93 + %{\advance \baselineskip by -\singlespaceskip + %\kern \baselineskip}% + \setleading\singlespaceskip +} + +%% Simple single-character @ commands + +% @@ prints an @ +% Kludge this until the fonts are right (grr). +\def\@{{\tt\char64}} + +% This is turned off because it was never documented +% and you can use @w{...} around a quote to suppress ligatures. +%% Define @` and @' to be the same as ` and ' +%% but suppressing ligatures. +%\def\`{{`}} +%\def\'{{'}} + +% Used to generate quoted braces. +\def\mylbrace {{\tt\char123}} +\def\myrbrace {{\tt\char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce actual \{ & \} command in an index. + \catcode`\{ = 12 \catcode`\} = 12 + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\@ = 0 \catcode`\\ = 12 + @gdef@lbracecmd[\{]% + @gdef@rbracecmd[\}]% +@endgroup + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. +\let\, = \c +\let\dotaccent = \. +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \t +\let\ubaraccent = \b +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown +% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ptexi + \else\ifx\temp\jmacro \j + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=3000 } + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=3000 } + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=3000 } + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +\def\group{\begingroup + \ifnum\catcode13=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + % + % The \vtop we start below produces a box with normal height and large + % depth; thus, TeX puts \baselineskip glue before it, and (when the + % next line of text is done) \lineskip glue after it. (See p.82 of + % the TeXbook.) Thus, space below is not quite equal to space + % above. But it's pretty close. + \def\Egroup{% + \egroup % End the \vtop. + \endgroup % End the \group. + }% + % + \vtop\bgroup + % We have to put a strut on the last line in case the @group is in + % the midst of an example, rather than completely enclosing it. + % Otherwise, the interline space between the last line of the group + % and the first line afterwards is too small. But we can't put the + % strut in \Egroup, since there it would be on a line by itself. + % Hence this just inserts a strut at the beginning of each line. + \everypar = {\strut}% + % + % Since we have a strut on every line, we don't need any of TeX's + % normal interline spacing. + \offinterlineskip + % + % OK, but now we have to do something about blank + % lines in the input in @example-like environments, which normally + % just turn into \lisppar, which will insert no space now that we've + % turned off the interline space. Simplest is to make them be an + % empty paragraph. + \ifx\par\lisppar + \edef\par{\leavevmode \par}% + % + % Reset ^^M's definition to new definition of \par. + \obeylines + \fi + % + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +\def\need{\parsearg\needx} + +% Old definition--didn't work. +%\def\needx #1{\par % +%% This method tries to make TeX break the page naturally +%% if the depth of the box does not fit. +%{\baselineskip=0pt% +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak +%\prevdepth=-1000pt +%}} + +\def\needx#1{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break + +\let\br = \par + +% @dots{} output an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in a typewriter +% font as three actual period characters. +% +\def\dots{% + \leavevmode + \hbox to 1.5em{% + \hskip 0pt plus 0.25fil minus 0.25fil + .\hss.\hss.% + \hskip 0pt plus 0.5fil minus 0.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \leavevmode + \hbox to 2em{% + \hskip 0pt plus 0.25fil minus 0.25fil + .\hss.\hss.\hss.% + \hskip 0pt plus 0.5fil minus 0.5fil + }% + \spacefactor=3000 +} + + +% @page forces the start of a new page +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\def\exdent{\parsearg\exdentyyy} +\def\exdentyyy #1{{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break}} + +% This defn is used inside nofill environments such as @example. +\def\nofillexdent{\parsearg\nofillexdentyyy} +\def\nofillexdentyyy #1{{\advance \leftskip by -\exdentamount +\leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @include file insert text of that file as input. +% Allow normal characters that we make active in the argument (a file name). +\def\include{\begingroup + \catcode`\\=12 + \catcode`~=12 + \catcode`^=12 + \catcode`_=12 + \catcode`|=12 + \catcode`<=12 + \catcode`>=12 + \catcode`+=12 + \parsearg\includezzz} +% Restore active chars for included file. +\def\includezzz#1{\endgroup\begingroup + % Read the included file in a group so nested @include's work. + \def\thisfile{#1}% + \input\thisfile +\endgroup} + +\def\thisfile{} + +% @center line outputs that line, centered + +\def\center{\parsearg\centerzzz} +\def\centerzzz #1{{\advance\hsize by -\leftskip +\advance\hsize by -\rightskip +\centerline{#1}}} + +% @sp n outputs n lines of vertical space + +\def\sp{\parsearg\spxxx} +\def\spxxx #1{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% We cannot implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\def\paragraphindent{\parsearg\doparagraphindent} +\def\doparagraphindent#1{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\def\exampleindent{\parsearg\doexampleindent} +\def\doexampleindent#1{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math means output in math mode. +% We don't use $'s directly in the definition of \math because control +% sequences like \math are expanded when the toc file is written. Then, +% we read the toc file back, the $'s will be normal characters (as they +% should be, according to the definition of Texinfo). So we must use a +% control sequence to switch into and out of math mode. +% +% This isn't quite enough for @math to work properly in indices, but it +% seems unlikely it will ever be needed there. +% +\let\implicitmath = $ +\def\math#1{\implicitmath #1\implicitmath} + +% @bullet and @minus need the same treatment as @math, just above. +\def\bullet{\implicitmath\ptexbullet\implicitmath} +\def\minus{\implicitmath-\implicitmath} + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \iflinks + \readauxfile + \fi % \openindices needs to do some work in any case. + \openindices + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \global\let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + % Just to be on the safe side, close the input stream before the \input. + \openin 1 texinfo.cnf + \ifeof1 \let\temp=\relax \else \def\temp{\input texinfo.cnf }\fi + \closein1 + \temp + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +\ifx\pdfoutput\undefined + \pdffalse + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\else + \pdftrue + \pdfoutput = 1 + \input pdfcolor + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}% + \def\imageheight{#3}% + \ifnum\pdftexversion < 14 + \pdfimage + \else + \pdfximage + \fi + \ifx\empty\imagewidth\else width \imagewidth \fi + \ifx\empty\imageheight\else height \imageheight \fi + \ifnum\pdftexversion<13 + #1.pdf% + \else + {#1.pdf}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + \def\pdfmkdest#1{{\normalturnoffactive \pdfdest name{#1} xyz}} + \def\pdfmkpgn#1{#1@} + \let\linkcolor = \Blue % was Cyan, but that seems light? + \def\endlink{\Black\pdfendlink} + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + \def\pdfmakeoutlines{{% + \openin 1 \jobname.toc + \ifeof 1\else\bgroup + \closein 1 + \indexnofonts + \def\tt{} + \let\_ = \normalunderscore + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + \def\chapentry ##1##2##3{} + \def\unnumbchapentry ##1##2{} + \def\secentry ##1##2##3##4{\advancenumber{chap##2}} + \def\unnumbsecentry ##1##2{} + \def\subsecentry ##1##2##3##4##5{\advancenumber{sec##2.##3}} + \def\unnumbsubsecentry ##1##2{} + \def\subsubsecentry ##1##2##3##4##5##6{\advancenumber{subsec##2.##3.##4}} + \def\unnumbsubsubsecentry ##1##2{} + \input \jobname.toc + \def\chapentry ##1##2##3{% + \pdfoutline goto name{\pdfmkpgn{##3}}count-\expnumber{chap##2}{##1}} + \def\unnumbchapentry ##1##2{% + \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} + \def\secentry ##1##2##3##4{% + \pdfoutline goto name{\pdfmkpgn{##4}}count-\expnumber{sec##2.##3}{##1}} + \def\unnumbsecentry ##1##2{% + \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} + \def\subsecentry ##1##2##3##4##5{% + \pdfoutline goto name{\pdfmkpgn{##5}}count-\expnumber{subsec##2.##3.##4}{##1}} + \def\unnumbsubsecentry ##1##2{% + \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} + \def\subsubsecentry ##1##2##3##4##5##6{% + \pdfoutline goto name{\pdfmkpgn{##6}}{##1}} + \def\unnumbsubsubsecentry ##1##2{% + \pdfoutline goto name{\pdfmkpgn{##2}}{##1}} + \input \jobname.toc + \egroup\fi + }} + \def\makelinks #1,{% + \def\params{#1}\def\E{END}% + \ifx\params\E + \let\nextmakelinks=\relax + \else + \let\nextmakelinks=\makelinks + \ifnum\lnkcount>0,\fi + \picknum{#1}% + \startlink attr{/Border [0 0 0]} + goto name{\pdfmkpgn{\the\pgn}}% + \linkcolor #1% + \advance\lnkcount by 1% + \endlink + \fi + \nextmakelinks + } + \def\picknum#1{\expandafter\pn#1} + \def\pn#1{% + \def\p{#1}% + \ifx\p\lbrace + \let\nextpn=\ppn + \else + \let\nextpn=\ppnn + \def\first{#1} + \fi + \nextpn + } + \def\ppn#1{\pgn=#1\gobble} + \def\ppnn{\pgn=\first} + \def\pdfmklnk#1{\lnkcount=0\makelinks #1,END,} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + \def\pdfurl#1{% + \begingroup + \normalturnoffactive\def\@{@}% + \let\value=\expandablevalue + \leavevmode\Red + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + % #1 + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS| + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \linkcolor #1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\fi % \ifx\pdfoutput + + +\message{fonts,} +% Font-change commands. + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf analogous to plain's \rm, etc. +\newfam\sffam +\def\sf{\fam=\sffam \tensf} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this one. +\def\ttsl{\tenttsl} + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +\def\setleading#1{% + \normalbaselineskip = #1\relax + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% Use Computer Modern fonts at \magstephalf (11pt). +\newcount\mainmagstep \mainmagstep=\magstephalf + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\undefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +\ifx\bigger\relax +\let\mainmagstep=\magstep1 +\setfont\textrm\rmshape{12}{1000} +\setfont\texttt\ttshape{12}{1000} +\else +\setfont\textrm\rmshape{10}{\mainmagstep} +\setfont\texttt\ttshape{10}{\mainmagstep} +\fi +% Instead of cmb10, you many want to use cmbx10. +% cmbx10 is a prettier font on its own, but cmb10 +% looks better when embedded in a line with cmr10. +\setfont\textbf\bfshape{10}{\mainmagstep} +\setfont\textit\itshape{10}{\mainmagstep} +\setfont\textsl\slshape{10}{\mainmagstep} +\setfont\textsf\sfshape{10}{\mainmagstep} +\setfont\textsc\scshape{10}{\mainmagstep} +\setfont\textttsl\ttslshape{10}{\mainmagstep} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep + +% A few fonts for @defun, etc. +\setfont\defbf\bxshape{10}{\magstep1} %was 1314 +\setfont\deftt\ttshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\setfont\smallrm\rmshape{9}{1000} +\setfont\smalltt\ttshape{9}{1000} +\setfont\smallbf\bfshape{10}{900} +\setfont\smallit\itshape{9}{1000} +\setfont\smallsl\slshape{9}{1000} +\setfont\smallsf\sfshape{9}{1000} +\setfont\smallsc\scshape{10}{900} +\setfont\smallttsl\ttslshape{10}{900} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 + +% Fonts for small examples (8pt). +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + +% Fonts for title page: +\setfont\titlerm\rmbshape{12}{\magstep3} +\setfont\titleit\itbshape{10}{\magstep4} +\setfont\titlesl\slbshape{10}{\magstep4} +\setfont\titlett\ttbshape{12}{\magstep3} +\setfont\titlettsl\ttslshape{10}{\magstep4} +\setfont\titlesf\sfbshape{17}{\magstep1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} + +% Chapter (and unnumbered) fonts (17.28pt). +\setfont\chaprm\rmbshape{12}{\magstep2} +\setfont\chapit\itbshape{10}{\magstep3} +\setfont\chapsl\slbshape{10}{\magstep3} +\setfont\chaptt\ttbshape{12}{\magstep2} +\setfont\chapttsl\ttslshape{10}{\magstep3} +\setfont\chapsf\sfbshape{17}{1000} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 + +% Section fonts (14.4pt). +\setfont\secrm\rmbshape{12}{\magstep1} +\setfont\secit\itbshape{10}{\magstep2} +\setfont\secsl\slbshape{10}{\magstep2} +\setfont\sectt\ttbshape{12}{\magstep1} +\setfont\secttsl\ttslshape{10}{\magstep2} +\setfont\secsf\sfbshape{12}{\magstep1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 + +% \setfont\ssecrm\bxshape{10}{\magstep1} % This size an font looked bad. +% \setfont\ssecit\itshape{10}{\magstep1} % The letters were too crowded. +% \setfont\ssecsl\slshape{10}{\magstep1} +% \setfont\ssectt\ttshape{10}{\magstep1} +% \setfont\ssecsf\sfshape{10}{\magstep1} + +%\setfont\ssecrm\bfshape{10}{1315} % Note the use of cmb rather than cmbx. +%\setfont\ssecit\itshape{10}{1315} % Also, the size is a little larger than +%\setfont\ssecsl\slshape{10}{1315} % being scaled magstep1. +%\setfont\ssectt\ttshape{10}{1315} +%\setfont\ssecsf\sfshape{10}{1315} + +%\let\ssecbf=\ssecrm + +% Subsection fonts (13.15pt). +\setfont\ssecrm\rmbshape{12}{\magstephalf} +\setfont\ssecit\itbshape{10}{1315} +\setfont\ssecsl\slbshape{10}{1315} +\setfont\ssectt\ttbshape{12}{\magstephalf} +\setfont\ssecttsl\ttslshape{10}{1315} +\setfont\ssecsf\sfbshape{12}{\magstephalf} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{\magstep1} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 +% The smallcaps and symbol fonts should actually be scaled \magstep1.5, +% but that is not a standard magnification. + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts, we +% don't bother to reset \scriptfont and \scriptscriptfont (which would +% also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0 = \tenrm \textfont1 = \teni \textfont2 = \tensy + \textfont\itfam = \tenit \textfont\slfam = \tensl \textfont\bffam = \tenbf + \textfont\ttfam = \tentt \textfont\sffam = \tensf +} + + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this so that font changes will continue to work +% in math mode, where it is the current \fam that is relevant in most +% cases, not the current font. Plain TeX does \def\bf{\fam=\bffam +% \tenbf}, for example. By redefining \tenbf, we obviate the need to +% redefine \bf itself. +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy \let\tenttsl=\textttsl + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts\rm #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy \let\tenttsl=\chapttsl + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy \let\tenttsl=\secttsl + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy \let\tenttsl=\ssecttsl + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts % Maybe make sssec fonts scaled magstephalf? +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \resetmathfonts \setleading{9.5pt}} +\let\smallexamplefonts = \smallerfonts + +% Set up the default fonts, so we can use them for creating boxes. +% +\textfonts + +% Define these so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000} +\setfont\shortcontbf\bxshape{12}{1000} +\setfont\shortcontsl\slshape{12}{1000} + +%% Add scribe-like font environments, plus @l for inline lisp (usually sans +%% serif) and @ii for TeX italic + +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction +% unless the following character is such as not to need one. +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} +\def\smartslanted#1{{\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\it #1}\futurelet\next\smartitalicx} + +\let\i=\smartitalic +\let\var=\smartslanted +\let\dfn=\smartslanted +\let\emph=\smartitalic +\let\cite=\smartslanted + +\def\b#1{{\bf #1}} +\let\strong=\b + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +\def\t#1{% + {\tt \rawbackslash \frenchspacing #1}% + \null +} +\let\ttfont=\t +\def\samp#1{`\tclose{#1}'\null} +\setfont\keyrm\rmshape{8}{1000} +\font\keysy=cmsy9 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% + \vbox{\hrule\kern-0.4pt + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% + \kern-0.4pt\hrule}% + \kern-.06em\raise0.4pt\hbox{\angleright}}}} +% The old definition, with no lozenge: +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \frenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in \code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active + \catcode`\_=\active + % + \global\def\code{\begingroup + \catcode`\-=\active \let-\codedash + \catcode`\_=\active \let_\codeunder + \codex + } + % + % If we end up with any active - characters when handling the index, + % just treat them as a normal -. + \global\def\indexbreaks{\catcode`\-=\active \let-\realdash} +} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{\ifusingtt{\normalunderscore\discretionary{}{}{}}{\_}} +\def\codex #1{\tclose{#1}\endgroup} + +%\let\exp=\tclose %Was temporary + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\def\kbdinputstyle{\parsearg\kbdinputstylexxx} +\def\kbdinputstylexxx#1{% + \def\arg{#1}% + \ifx\arg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\arg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\arg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is kbdinputdistinct. (Too much of a hassle to call the macro, +% the catcodes are wrong for parsearg to work.) +\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\look}}\fi +\else{\tclose{\kbdfont\look}}\fi} + +% For @url, @env, @command quotes seem unnecessary, so use \code. +\let\url=\code +\let\env=\code +\let\command=\code + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @acronym downcases the argument and prints in smallcaps. +\def\acronym#1{{\smallcaps \lowercase{#1}}} + +% @pounds{} is a sterling sign. +\def\pounds{{\it\$}} + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\def\shorttitlepage{\parsearg\shorttitlepagezzz} +\def\shorttitlepagezzz #1{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\def\titlepage{\begingroup \parindent=0pt \textfonts + \let\subtitlerm=\tenrm + \def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines}% + % + \def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines}% + % + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % + % Now you can print the title using @title. + \def\title{\parsearg\titlezzz}% + \def\titlezzz##1{\leftline{\titlefonts\rm ##1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt}% + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Now you can put text using @subtitle. + \def\subtitle{\parsearg\subtitlezzz}% + \def\subtitlezzz##1{{\subtitlefont \rightline{##1}}}% + % + % @author should come last, but may come many times. + \def\author{\parsearg\authorzzz}% + \def\authorzzz##1{\ifseenauthor\else\vskip 0pt plus 1filll\seenauthortrue\fi + {\authorfont \leftline{##1}}}% + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \oldpage + \let\page = \oldpage + \hbox{}}% +% \def\page{\oldpage \hbox{}} +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi + % + \ifpdf \pdfmakepagedesttrue \fi + % + \HEADINGSon +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +%%% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make Tex use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + +\def\evenheading{\parsearg\evenheadingxxx} +\def\oddheading{\parsearg\oddheadingxxx} +\def\everyheading{\parsearg\everyheadingxxx} + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\oddfooting{\parsearg\oddfootingxxx} +\def\everyfooting{\parsearg\everyfootingxxx} + +{\catcode`\@=0 % + +\gdef\evenheadingxxx #1{\evenheadingyyy #1@|@|@|@|\finish} +\gdef\evenheadingyyy #1@|#2@|#3@|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\gdef\oddheadingxxx #1{\oddheadingyyy #1@|@|@|@|\finish} +\gdef\oddheadingyyy #1@|#2@|#3@|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\gdef\everyheadingxxx#1{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\gdef\evenfootingxxx #1{\evenfootingyyy #1@|@|@|@|\finish} +\gdef\evenfootingyyy #1@|#2@|#3@|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\gdef\oddfootingxxx #1{\oddfootingyyy #1@|@|@|@|\finish} +\gdef\oddfootingyyy #1@|#2@|#3@|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -\baselineskip + \global\advance\vsize by -\baselineskip +} + +\gdef\everyfootingxxx#1{\oddfootingxxx{#1}\evenfootingxxx{#1}} +% +}% unbind the catcode of @. + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\HEADINGSoff{ +\global\evenheadline={\hfil} \global\evenfootline={\hfil} +\global\oddheadline={\hfil} \global\oddfootline={\hfil}} +\HEADINGSoff +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{ +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{ +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg\settitlezzz} +\def\settitlezzz #1{\gdef\thistitle{#1}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x), @kitem(x), @xitem(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @vtable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\internalBxitem "#1"{\def\xitemsubtopix{#1} \smallbreak \parsearg\xitemzzz} +\def\internalBxitemx "#1"{\def\xitemsubtopix{#1} \itemxpar \parsearg\xitemzzz} + +\def\internalBkitem{\smallbreak \parsearg\kitemzzz} +\def\internalBkitemx{\itemxpar \parsearg\kitemzzz} + +\def\kitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \lastfunction}}% + \itemzzz {#1}} + +\def\xitemzzz #1{\dosubind {kw}{\code{#1}}{for {\bf \xitemsubtopic}}% + \itemzzz {#1}} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemfont{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. Unfortunately + % we can't prevent a possible page break at the following + % \baselineskip glue. + \nobreak + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a table}} +\def\itemx{\errmessage{@itemx while not in a table}} +\def\kitem{\errmessage{@kitem while not in a table}} +\def\kitemx{\errmessage{@kitemx while not in a table}} +\def\xitem{\errmessage{@xitem while not in a table}} +\def\xitemx{\errmessage{@xitemx while not in a table}} + +% Contains a kludge to get @end[description] to work. +\def\description{\tablez{\dontindex}{1}{}{}{}{}} + +% @table, @ftable, @vtable. +\def\table{\begingroup\inENV\obeylines\obeyspaces\tablex} +{\obeylines\obeyspaces% +\gdef\tablex #1^^M{% +\tabley\dontindex#1 \endtabley}} + +\def\ftable{\begingroup\inENV\obeylines\obeyspaces\ftablex} +{\obeylines\obeyspaces% +\gdef\ftablex #1^^M{% +\tabley\fnitemindex#1 \endtabley +\def\Eftable{\endgraf\afterenvbreak\endgroup}% +\let\Etable=\relax}} + +\def\vtable{\begingroup\inENV\obeylines\obeyspaces\vtablex} +{\obeylines\obeyspaces% +\gdef\vtablex #1^^M{% +\tabley\vritemindex#1 \endtabley +\def\Evtable{\endgraf\afterenvbreak\endgroup}% +\let\Etable=\relax}} + +\def\dontindex #1{} +\def\fnitemindex #1{\doind {fn}{\code{#1}}}% +\def\vritemindex #1{\doind {vr}{\code{#1}}}% + +{\obeyspaces % +\gdef\tabley#1#2 #3 #4 #5 #6 #7\endtabley{\endgroup% +\tablez{#1}{#2}{#3}{#4}{#5}{#6}}} + +\def\tablez #1#2#3#4#5#6{% +\aboveenvbreak % +\begingroup % +\def\Edescription{\Etable}% Necessary kludge. +\let\itemindex=#1% +\ifnum 0#3>0 \advance \leftskip by #3\mil \fi % +\ifnum 0#4>0 \tableindent=#4\mil \fi % +\ifnum 0#5>0 \advance \rightskip by #5\mil \fi % +\def\itemfont{#2}% +\itemmax=\tableindent % +\advance \itemmax by -\itemmargin % +\advance \leftskip by \tableindent % +\exdentamount=\tableindent +\parindent = 0pt +\parskip = \smallskipamount +\ifdim \parskip=0pt \parskip=2pt \fi% +\def\Etable{\endgraf\afterenvbreak\endgroup}% +\let\item = \internalBitem % +\let\itemx = \internalBitemx % +\let\kitem = \internalBkitem % +\let\kitemx = \internalBkitemx % +\let\xitem = \internalBxitem % +\let\xitemx = \internalBxitemx % +} + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\def\itemize{\parsearg\itemizezzz} + +\def\itemizezzz #1{% + \begingroup % ended by the @end itemize + \itemizey {#1}{\Eitemize} +} + +\def\itemizey #1#2{% +\aboveenvbreak % +\itemmax=\itemindent % +\advance \itemmax by -\itemmargin % +\advance \leftskip by \itemindent % +\exdentamount=\itemindent +\parindent = 0pt % +\parskip = \smallskipamount % +\ifdim \parskip=0pt \parskip=2pt \fi% +\def#2{\endgraf\afterenvbreak\endgroup}% +\def\itemcontents{#1}% +\let\item=\itemizeitem} + +% Set sfcode to normal for the chars that usually have another value. +% These are `.?!:;,' +\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 + \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\def\enumerate{\parsearg\enumeratezzz} +\def\enumeratezzz #1{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + \begingroup % ended by the @end enumerate + % + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a <number>. + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call itemizey, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \itemizey{#1.}\Eenumerate\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + +% Definition of @item while inside @itemize. + +\def\itemizeitem{% +\advance\itemno by 1 +{\let\par=\endgraf \smallbreak}% +\ifhmode \errmessage{In hmode at itemizeitem}\fi +{\parskip=0in \hskip 0pt +\hbox to 0pt{\hss \itemcontents\hskip \itemmargin}% +\vadjust{\penalty 1200}}% +\flushcr} + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. +% +% For those who want to use more than one line's worth of words in +% the preamble, break the line within one argument and it +% will parse correctly, i.e., +% +% @multitable {Column 1 template} {Column 2 template} {Column 3 +% template} +% Not: +% @multitable {Column 1 template} {Column 2 template} +% {Column 3 template} + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab, @multitable or @end multitable do not need to be on their +% own lines, but it will not hurt if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the part of the @columnfraction before the decimal point, which +% is presumably either 0 or the empty string (but we don't check, we +% just throw it away). #2 is the decimal part, which we use as the +% percent of \hsize for this column. +\def\pickupwholefraction#1.#2 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{.#2\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; + % typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% This used to have \hskip1sp. But then the space in a template line is +% not enough. That is bad. So let's go back to just & until we +% encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{&} + +% @multitable ... @end multitable definitions: +% +\def\multitable{\parsearg\dotable} +\def\dotable#1{\bgroup + \vskip\parskip + \let\item\crcr + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% + % + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % \everycr will reset column counter, \colcount, at the end of + % each line. Every column entry will cause \colcount to advance by one. + % The table preamble + % looks at the current \colcount to find the correct column width. + \everycr{\noalign{% + % + % \filbreak%% keeps underfull box messages off when table breaks over pages. + % Maybe so, but it also creates really weird page breaks when the table + % breaks over pages. Wouldn't \vfil be better? Wait until the problem + % manifests itself, so it can be fixed for real --karl. + \global\colcount=0\relax}}% + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup&\global\advance\colcount by 1\relax + \multistrut\vtop{\hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively marking + % characters. + \noindent\ignorespaces##\unskip\multistrut}\cr +} + +\def\setmultitablespacing{% test to see if user has set \multitablelinespace. +% If so, do nothing. If not, give it an appropriate dimension based on +% current baselineskip. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +%% strut to put in table in case some entry doesn't have descenders, +%% to keep lines equally spaced +\let\multistrut = \strut +\else +%% FIXME: what is \box0 supposed to be? +\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 +width0pt\relax} \fi +%% Test to see if parskip is larger than space between lines of +%% table. If not, do nothing. +%% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} +% Prevent errors for section commands. +% Used in @ignore and in failing conditionals. +\def\ignoresections{% + \let\chapter=\relax + \let\unnumbered=\relax + \let\top=\relax + \let\unnumberedsec=\relax + \let\unnumberedsection=\relax + \let\unnumberedsubsec=\relax + \let\unnumberedsubsection=\relax + \let\unnumberedsubsubsec=\relax + \let\unnumberedsubsubsection=\relax + \let\section=\relax + \let\subsec=\relax + \let\subsubsec=\relax + \let\subsection=\relax + \let\subsubsection=\relax + \let\appendix=\relax + \let\appendixsec=\relax + \let\appendixsection=\relax + \let\appendixsubsec=\relax + \let\appendixsubsection=\relax + \let\appendixsubsubsec=\relax + \let\appendixsubsubsection=\relax + \let\contents=\relax + \let\smallbook=\relax + \let\titlepage=\relax +} + +% Used in nested conditionals, where we have to parse the Texinfo source +% and so want to turn off most commands, in case they are used +% incorrectly. +% +\def\ignoremorecommands{% + \let\defcodeindex = \relax + \let\defcv = \relax + \let\deffn = \relax + \let\deffnx = \relax + \let\defindex = \relax + \let\defivar = \relax + \let\defmac = \relax + \let\defmethod = \relax + \let\defop = \relax + \let\defopt = \relax + \let\defspec = \relax + \let\deftp = \relax + \let\deftypefn = \relax + \let\deftypefun = \relax + \let\deftypeivar = \relax + \let\deftypeop = \relax + \let\deftypevar = \relax + \let\deftypevr = \relax + \let\defun = \relax + \let\defvar = \relax + \let\defvr = \relax + \let\ref = \relax + \let\xref = \relax + \let\printindex = \relax + \let\pxref = \relax + \let\settitle = \relax + \let\setchapternewpage = \relax + \let\setchapterstyle = \relax + \let\everyheading = \relax + \let\evenheading = \relax + \let\oddheading = \relax + \let\everyfooting = \relax + \let\evenfooting = \relax + \let\oddfooting = \relax + \let\headings = \relax + \let\include = \relax + \let\lowersections = \relax + \let\down = \relax + \let\raisesections = \relax + \let\up = \relax + \let\set = \relax + \let\clear = \relax + \let\item = \relax +} + +% Ignore @ignore ... @end ignore. +% +\def\ignore{\doignore{ignore}} + +% Ignore @ifinfo, @ifhtml, @ifnottex, @html, @menu, and @direntry text. +% +\def\ifinfo{\doignore{ifinfo}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifnottex{\doignore{ifnottex}} +\def\html{\doignore{html}} +\def\menu{\doignore{menu}} +\def\direntry{\doignore{direntry}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory = \comment + +% Ignore text until a line `@end #1'. +% +\def\doignore#1{\begingroup + % Don't complain about control sequences we have declared \outer. + \ignoresections + % + % Define a command to swallow text until we reach `@end #1'. + % This @ is a catcode 12 token (that is the normal catcode of @ in + % this texinfo.tex file). We change the catcode of @ below to match. + \long\def\doignoretext##1@end #1{\enddoignore}% + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \catcode32 = 10 + % + % Ignore braces, too, so mismatched braces don't cause trouble. + \catcode`\{ = 9 + \catcode`\} = 9 + % + % We must not have @c interpreted as a control sequence. + \catcode`\@ = 12 + % + % Make the letter c a comment character so that the rest of the line + % will be ignored. This way, the document can have (for example) + % @c @end ifinfo + % and the @end ifinfo will be properly ignored. + % (We've just changed @ to catcode 12.) + \catcode`\c = 14 + % + % And now expand that command. + \doignoretext +} + +% What we do to finish off ignored text. +% +\def\enddoignore{\endgroup\ignorespaces}% + +\newif\ifwarnedobs\warnedobsfalse +\def\obstexwarn{% + \ifwarnedobs\relax\else + % We need to warn folks that they may have trouble with TeX 3.0. + % This uses \immediate\write16 rather than \message to get newlines. + \immediate\write16{} + \immediate\write16{WARNING: for users of Unix TeX 3.0!} + \immediate\write16{This manual trips a bug in TeX version 3.0 (tex hangs).} + \immediate\write16{If you are running another version of TeX, relax.} + \immediate\write16{If you are running Unix TeX 3.0, kill this TeX process.} + \immediate\write16{ Then upgrade your TeX installation if you can.} + \immediate\write16{ (See ftp://ftp.gnu.org/pub/gnu/TeX.README.)} + \immediate\write16{If you are stuck with version 3.0, run the} + \immediate\write16{ script ``tex3patch'' from the Texinfo distribution} + \immediate\write16{ to use a workaround.} + \immediate\write16{} + \global\warnedobstrue + \fi +} + +% **In TeX 3.0, setting text in \nullfont hangs tex. For a +% workaround (which requires the file ``dummy.tfm'' to be installed), +% uncomment the following line: +%%%%%\font\nullfont=dummy\let\obstexwarn=\relax + +% Ignore text, except that we keep track of conditional commands for +% purposes of nesting, up to an `@end #1' command. +% +\def\nestedignore#1{% + \obstexwarn + % We must actually expand the ignored text to look for the @end + % command, so that nested ignore constructs work. Thus, we put the + % text into a \vbox and then do nothing with the result. To minimize + % the change of memory overflow, we follow the approach outlined on + % page 401 of the TeXbook: make the current font be a dummy font. + % + \setbox0 = \vbox\bgroup + % Don't complain about control sequences we have declared \outer. + \ignoresections + % + % Define `@end #1' to end the box, which will in turn undefine the + % @end command again. + \expandafter\def\csname E#1\endcsname{\egroup\ignorespaces}% + % + % We are going to be parsing Texinfo commands. Most cause no + % trouble when they are used incorrectly, but some commands do + % complicated argument parsing or otherwise get confused, so we + % undefine them. + % + % We can't do anything about stray @-signs, unfortunately; + % they'll produce `undefined control sequence' errors. + \ignoremorecommands + % + % Set the current font to be \nullfont, a TeX primitive, and define + % all the font commands to also use \nullfont. We don't use + % dummy.tfm, as suggested in the TeXbook, because not all sites + % might have that installed. Therefore, math mode will still + % produce output, but that should be an extremely small amount of + % stuff compared to the main input. + % + \nullfont + \let\tenrm=\nullfont \let\tenit=\nullfont \let\tensl=\nullfont + \let\tenbf=\nullfont \let\tentt=\nullfont \let\smallcaps=\nullfont + \let\tensf=\nullfont + % Similarly for index fonts. + \let\smallrm=\nullfont \let\smallit=\nullfont \let\smallsl=\nullfont + \let\smallbf=\nullfont \let\smalltt=\nullfont \let\smallsc=\nullfont + \let\smallsf=\nullfont + % Similarly for smallexample fonts. + \let\smallerrm=\nullfont \let\smallerit=\nullfont \let\smallersl=\nullfont + \let\smallerbf=\nullfont \let\smallertt=\nullfont \let\smallersc=\nullfont + \let\smallersf=\nullfont + % + % Don't complain when characters are missing from the fonts. + \tracinglostchars = 0 + % + % Don't bother to do space factor calculations. + \frenchspacing + % + % Don't report underfull hboxes. + \hbadness = 10000 + % + % Do minimal line-breaking. + \pretolerance = 10000 + % + % Do not execute instructions in @tex + \def\tex{\doignore{tex}}% + % Do not execute macro definitions. + % `c' is a comment character, so the word `macro' will get cut off. + \def\macro{\doignore{ma}}% +} + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. Make sure the catcode of space is correct to avoid +% losing inside @example, for instance. +% +\def\set{\begingroup\catcode` =10 + \catcode`\-=12 \catcode`\_=12 % Allow - and _ in VAR. + \parsearg\setxxx} +\def\setxxx#1{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + \def\temp{#2}% + \ifx\temp\empty \global\expandafter\let\csname SET#1\endcsname = \empty + \else \setzzz{#1}#2\endsetzzz % Remove the trailing space \setxxx inserted. + \fi + \endgroup +} +% Can't use \xdef to pre-expand #2 and save some time, since \temp or +% \next or other control sequences that we've defined might get us into +% an infinite loop. Consider `@set foo @cite{bar}'. +\def\setzzz#1#2 \endsetzzz{\expandafter\gdef\csname SET#1\endcsname{#2}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\def\clear{\parsearg\clearxxx} +\def\clearxxx#1{\global\expandafter\let\csname SET#1\endcsname=\relax} + +% @value{foo} gets the text saved in variable foo. +{ + \catcode`\_ = \active + % + % We might end up with active _ or - characters in the argument if + % we're called from @code, as @code{@value{foo-bar_}}. So \let any + % such active characters to their normal equivalents. + \gdef\value{\begingroup + \catcode`\-=12 \catcode`\_=12 + \indexbreaks \let_\normalunderscore + \valuexxx} +} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we \let\value to this in \indexdummies). Ones +% whose names contain - or _ still won't work, but we can't do anything +% about that. The command has to be fully expandable, since the result +% winds up in the index file. This means that if the variable's value +% contains other Texinfo commands, it's almost certain it will fail +% (although perhaps we could fix that with sufficient work to do a +% one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +\def\ifset{\parsearg\ifsetxxx} +\def\ifsetxxx #1{% + \expandafter\ifx\csname SET#1\endcsname\relax + \expandafter\ifsetfail + \else + \expandafter\ifsetsucceed + \fi +} +\def\ifsetsucceed{\conditionalsucceed{ifset}} +\def\ifsetfail{\nestedignore{ifset}} +\defineunmatchedend{ifset} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +\def\ifclear{\parsearg\ifclearxxx} +\def\ifclearxxx #1{% + \expandafter\ifx\csname SET#1\endcsname\relax + \expandafter\ifclearsucceed + \else + \expandafter\ifclearfail + \fi +} +\def\ifclearsucceed{\conditionalsucceed{ifclear}} +\def\ifclearfail{\nestedignore{ifclear}} +\defineunmatchedend{ifclear} + +% @iftex, @ifnothtml, @ifnotinfo always succeed; we read the text +% following, through the first @end iftex (etc.). Make `@end iftex' +% (etc.) valid only after an @iftex. +% +\def\iftex{\conditionalsucceed{iftex}} +\def\ifnothtml{\conditionalsucceed{ifnothtml}} +\def\ifnotinfo{\conditionalsucceed{ifnotinfo}} +\defineunmatchedend{iftex} +\defineunmatchedend{ifnothtml} +\defineunmatchedend{ifnotinfo} + +% We can't just want to start a group at @iftex (for example) and end it +% at @end iftex, since then @set commands inside the conditional have no +% effect (they'd get reverted at the end of the group). So we must +% define \Eiftex to redefine itself to be its previous value. (We can't +% just define it to fail again with an ``unmatched end'' error, since +% the @ifset might be nested.) +% +\def\conditionalsucceed#1{% + \edef\temp{% + % Remember the current value of \E#1. + \let\nece{prevE#1} = \nece{E#1}% + % + % At the `@end #1', redefine \E#1 to be its previous value. + \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% + }% + \temp +} + +% We need to expand lots of \csname's, but we don't want to expand the +% control sequences after we've constructed them. +% +\def\nece#1{\expandafter\noexpand\csname#1\endcsname} + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within \newindex. +{\catcode`\@=11 +\gdef\newwrite{\alloc@7\write\chardef\sixt@@n}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +\def\indexdummies{% +\def\ { }% +% Take care of the plain tex accent commands. +\def\"{\realbackslash "}% +\def\`{\realbackslash `}% +\def\'{\realbackslash '}% +\def\^{\realbackslash ^}% +\def\~{\realbackslash ~}% +\def\={\realbackslash =}% +\def\b{\realbackslash b}% +\def\c{\realbackslash c}% +\def\d{\realbackslash d}% +\def\u{\realbackslash u}% +\def\v{\realbackslash v}% +\def\H{\realbackslash H}% +% Take care of the plain tex special European modified letters. +\def\oe{\realbackslash oe}% +\def\ae{\realbackslash ae}% +\def\aa{\realbackslash aa}% +\def\OE{\realbackslash OE}% +\def\AE{\realbackslash AE}% +\def\AA{\realbackslash AA}% +\def\o{\realbackslash o}% +\def\O{\realbackslash O}% +\def\l{\realbackslash l}% +\def\L{\realbackslash L}% +\def\ss{\realbackslash ss}% +% Take care of texinfo commands likely to appear in an index entry. +% (Must be a way to avoid doing expansion at all, and thus not have to +% laboriously list every single command here.) +\def\@{@}% will be @@ when we switch to @ as escape char. +% Need these in case \tex is in effect and \{ is a \delimiter again. +% But can't use \lbracecmd and \rbracecmd because texindex assumes +% braces and backslashes are used only as delimiters. +\let\{ = \mylbrace +\let\} = \myrbrace +\def\_{{\realbackslash _}}% +\def\w{\realbackslash w }% +\def\bf{\realbackslash bf }% +%\def\rm{\realbackslash rm }% +\def\sl{\realbackslash sl }% +\def\sf{\realbackslash sf}% +\def\tt{\realbackslash tt}% +\def\gtr{\realbackslash gtr}% +\def\less{\realbackslash less}% +\def\hat{\realbackslash hat}% +\def\TeX{\realbackslash TeX}% +\def\dots{\realbackslash dots }% +\def\result{\realbackslash result}% +\def\equiv{\realbackslash equiv}% +\def\expansion{\realbackslash expansion}% +\def\print{\realbackslash print}% +\def\error{\realbackslash error}% +\def\point{\realbackslash point}% +\def\copyright{\realbackslash copyright}% +\def\tclose##1{\realbackslash tclose {##1}}% +\def\code##1{\realbackslash code {##1}}% +\def\uref##1{\realbackslash uref {##1}}% +\def\url##1{\realbackslash url {##1}}% +\def\env##1{\realbackslash env {##1}}% +\def\command##1{\realbackslash command {##1}}% +\def\option##1{\realbackslash option {##1}}% +\def\dotless##1{\realbackslash dotless {##1}}% +\def\samp##1{\realbackslash samp {##1}}% +\def\,##1{\realbackslash ,{##1}}% +\def\t##1{\realbackslash t {##1}}% +\def\r##1{\realbackslash r {##1}}% +\def\i##1{\realbackslash i {##1}}% +\def\b##1{\realbackslash b {##1}}% +\def\sc##1{\realbackslash sc {##1}}% +\def\cite##1{\realbackslash cite {##1}}% +\def\key##1{\realbackslash key {##1}}% +\def\file##1{\realbackslash file {##1}}% +\def\var##1{\realbackslash var {##1}}% +\def\kbd##1{\realbackslash kbd {##1}}% +\def\dfn##1{\realbackslash dfn {##1}}% +\def\emph##1{\realbackslash emph {##1}}% +\def\acronym##1{\realbackslash acronym {##1}}% +% +% Handle some cases of @value -- where the variable name does not +% contain - or _, and the value does not contain any +% (non-fully-expandable) commands. +\let\value = \expandablevalue +% +\unsepspaces +% Turn off macro expansion +\turnoffmacros +} + +% If an index command is used in an @example environment, any spaces +% therein should become regular spaces in the raw index file, not the +% expansion of \tie (\\leavevmode \penalty \@M \ ). +{\obeyspaces + \gdef\unsepspaces{\obeyspaces\let =\space}} + +% \indexnofonts no-ops all font-change commands. +% This is used when outputting the strings to sort the index by. +\def\indexdummyfont#1{#1} +\def\indexdummytex{TeX} +\def\indexdummydots{...} + +\def\indexnofonts{% +% Just ignore accents. +\let\,=\indexdummyfont +\let\"=\indexdummyfont +\let\`=\indexdummyfont +\let\'=\indexdummyfont +\let\^=\indexdummyfont +\let\~=\indexdummyfont +\let\==\indexdummyfont +\let\b=\indexdummyfont +\let\c=\indexdummyfont +\let\d=\indexdummyfont +\let\u=\indexdummyfont +\let\v=\indexdummyfont +\let\H=\indexdummyfont +\let\dotless=\indexdummyfont +% Take care of the plain tex special European modified letters. +\def\oe{oe}% +\def\ae{ae}% +\def\aa{aa}% +\def\OE{OE}% +\def\AE{AE}% +\def\AA{AA}% +\def\o{o}% +\def\O{O}% +\def\l{l}% +\def\L{L}% +\def\ss{ss}% +\let\w=\indexdummyfont +\let\t=\indexdummyfont +\let\r=\indexdummyfont +\let\i=\indexdummyfont +\let\b=\indexdummyfont +\let\emph=\indexdummyfont +\let\strong=\indexdummyfont +\let\cite=\indexdummyfont +\let\sc=\indexdummyfont +%Don't no-op \tt, since it isn't a user-level command +% and is used in the definitions of the active chars like <, >, |... +%\let\tt=\indexdummyfont +\let\tclose=\indexdummyfont +\let\code=\indexdummyfont +\let\url=\indexdummyfont +\let\uref=\indexdummyfont +\let\env=\indexdummyfont +\let\acronym=\indexdummyfont +\let\command=\indexdummyfont +\let\option=\indexdummyfont +\let\file=\indexdummyfont +\let\samp=\indexdummyfont +\let\kbd=\indexdummyfont +\let\key=\indexdummyfont +\let\var=\indexdummyfont +\let\TeX=\indexdummytex +\let\dots=\indexdummydots +\def\@{@}% +} + +% To define \realbackslash, we must make \ not be an escape. +% We must first make another character (@) an escape +% so we do not become unable to do a definition. + +{\catcode`\@=0 \catcode`\\=\other + @gdef@realbackslash{\}} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% For \ifx comparisons. +\def\emptymacro{\empty} + +% Most index entries go through here, but \dosubind is the general case. +% +\def\doind#1#2{\dosubind{#1}{#2}\empty} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% \empty if called from \doind, as we usually are. The main exception +% is with defuns, which call us directly. +% +\def\dosubind#1#2#3{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt #2}}% + \fi + {% + \count255=\lastpenalty + {% + \indexdummies % Must do this here, since \bf, etc expand at this stage + \escapechar=`\\ + {% + \let\folio = 0% We will expand all macros now EXCEPT \folio. + \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + \def\thirdarg{#3}% + % + % If third arg is present, precede it with space in sort key. + \ifx\thirdarg\emptymacro + \let\subentry = \empty + \else + \def\subentry{ #3}% + \fi + % + % First process the index entry with all font commands turned + % off to get the string to sort by. + {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% + % + % Now the real index entry with the fonts. + \toks0 = {#2}% + % + % If the third (subentry) arg is present, add it to the index + % line to write. + \ifx\thirdarg\emptymacro \else + \toks0 = \expandafter{\the\toks0{#3}}% + \fi + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\csname#1indfile\endcsname{% + \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% + }% + % + % If a skip is the last thing on the list now, preserve it + % by backing up by \lastskip, doing the \write, then inserting + % the skip again. Otherwise, the whatsit generated by the + % \write will make \lastskip zero. The result is that sequences + % like this: + % @end defun + % @tindex whatever + % @defun ... + % will have extra space inserted, because the \medbreak in the + % start of the @defun won't see the skip inserted by the @end of + % the previous defun. + % + % But don't do any of this if we're not in vertical mode. We + % don't want to do a \vskip and prematurely end a paragraph. + % + % Avoid page breaks due to these extra skips, too. + % + \iflinks + \ifvmode + \skip0 = \lastskip + \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi + \fi + % + \temp % do the write + % + % + \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi + \fi + }% + }% + \penalty\count255 + }% +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\def\printindex{\parsearg\doprintindex} +\def\doprintindex#1{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \indexbreaks + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\rawbackslashxx}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \penalty -300 + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + \vskip .33\baselineskip plus .1\baselineskip + % + % Do our best not to break after the initial. + \nobreak +}} + +% This typesets a paragraph consisting of #1, dot leaders, and then #2 +% flush to the right margin. It is used for index and table of contents +% entries. The paragraph is indented by \leftskip. +% +\def\entry#1#2{\begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing columns. + \vskip 0pt plus1pt + % + % Start a ``paragraph'' for the index entry so the line breaking + % parameters we've set above will have an effect. + \noindent + % + % Insert the text of the index entry. TeX will do line-breaking on it. + #1% + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \def\tempa{{\rm }}% + \def\tempb{#2}% + \edef\tempc{\tempa}% + \edef\tempd{\tempb}% + \ifx\tempc\tempd\ \else% + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + \ #2% The page number ends the paragraph. + \fi + \fi% + \par +\endgroup} + +% Like \dotfill except takes at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% \def\appendixletter{\char\the\appendixno} +% We do the following for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines this as the name of the chapter. +% page headings and footings can use it. @section does likewise. +\def\thischapter{} +\def\thissection{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raise/lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% Choose a numbered-heading macro +% #1 is heading level if unmodified by @raisesections or @lowersections +% #2 is text for heading +\def\numhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 +\ifcase\absseclevel + \chapterzzz{#2} +\or + \seczzz{#2} +\or + \numberedsubseczzz{#2} +\or + \numberedsubsubseczzz{#2} +\else + \ifnum \absseclevel<0 + \chapterzzz{#2} + \else + \numberedsubsubseczzz{#2} + \fi +\fi +} + +% like \numhead, but chooses appendix heading levels +\def\apphead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 +\ifcase\absseclevel + \appendixzzz{#2} +\or + \appendixsectionzzz{#2} +\or + \appendixsubseczzz{#2} +\or + \appendixsubsubseczzz{#2} +\else + \ifnum \absseclevel<0 + \appendixzzz{#2} + \else + \appendixsubsubseczzz{#2} + \fi +\fi +} + +% like \numhead, but chooses numberless heading levels +\def\unnmhead#1#2{\absseclevel=\secbase\advance\absseclevel by #1 +\ifcase\absseclevel + \unnumberedzzz{#2} +\or + \unnumberedseczzz{#2} +\or + \unnumberedsubseczzz{#2} +\or + \unnumberedsubsubseczzz{#2} +\else + \ifnum \absseclevel<0 + \unnumberedzzz{#2} + \else + \unnumberedsubsubseczzz{#2} + \fi +\fi +} + +% @chapter, @appendix, @unnumbered. +\def\thischaptername{No Chapter Title} +\outer\def\chapter{\parsearg\chapteryyy} +\def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz #1{% +\secno=0 \subsecno=0 \subsubsecno=0 +\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% +\chapmacro {#1}{\the\chapno}% +\gdef\thissection{#1}% +\gdef\thischaptername{#1}% +% We don't substitute the actual chapter name into \thischapter +% because we don't want its macros evaluated now. +\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% + {\the\chapno}}}% +\temp +\donoderef +\global\let\section = \numberedsec +\global\let\subsection = \numberedsubsec +\global\let\subsubsection = \numberedsubsubsec +} + +\outer\def\appendix{\parsearg\appendixyyy} +\def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz #1{% +\secno=0 \subsecno=0 \subsubsecno=0 +\global\advance \appendixno by 1 +\message{\putwordAppendix\space \appendixletter}% +\chapmacro {#1}{\putwordAppendix{} \appendixletter}% +\gdef\thissection{#1}% +\gdef\thischaptername{#1}% +\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% + {\putwordAppendix{} \appendixletter}}}% +\temp +\appendixnoderef +\global\let\section = \appendixsec +\global\let\subsection = \appendixsubsec +\global\let\subsubsection = \appendixsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\def\centerchap{\parsearg\centerchapyyy} +\def\centerchapyyy #1{{\let\unnumbchapmacro=\centerchapmacro \unnumberedyyy{#1}}} + +% @top is like @unnumbered. +\outer\def\top{\parsearg\unnumberedyyy} + +\outer\def\unnumbered{\parsearg\unnumberedyyy} +\def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz #1{% +\secno=0 \subsecno=0 \subsubsecno=0 +% +% This used to be simply \message{#1}, but TeX fully expands the +% argument to \message. Therefore, if #1 contained @-commands, TeX +% expanded them. For example, in `@unnumbered The @cite{Book}', TeX +% expanded @cite (which turns out to cause errors because \cite is meant +% to be executed, not expanded). +% +% Anyway, we don't want the fully-expanded definition of @cite to appear +% as a result of the \message, we just want `@cite' itself. We use +% \the<toks register> to achieve this: TeX expands \the<toks> only once, +% simply yielding the contents of <toks register>. (We also do this for +% the toc entries.) +\toks0 = {#1}\message{(\the\toks0)}% +% +\unnumbchapmacro {#1}% +\gdef\thischapter{#1}\gdef\thissection{#1}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}}}% +\temp +\unnumbnoderef +\global\let\section = \unnumberedsec +\global\let\subsection = \unnumberedsubsec +\global\let\subsubsection = \unnumberedsubsubsec +} + +% Sections. +\outer\def\numberedsec{\parsearg\secyyy} +\def\secyyy #1{\numhead1{#1}} % normally calls seczzz +\def\seczzz #1{% +\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % +\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% + {\the\chapno}{\the\secno}}}% +\temp +\donoderef +\nobreak +} + +\outer\def\appendixsection{\parsearg\appendixsecyyy} +\outer\def\appendixsec{\parsearg\appendixsecyyy} +\def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz #1{% +\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % +\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% + {\appendixletter}{\the\secno}}}% +\temp +\appendixnoderef +\nobreak +} + +\outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} +\def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz #1{% +\plainsecheading {#1}\gdef\thissection{#1}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry{\the\toks0}}}% +\temp +\unnumbnoderef +\nobreak +} + +% Subsections. +\outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} +\def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz #1{% +\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % +\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% + {\the\chapno}{\the\secno}{\the\subsecno}}}% +\temp +\donoderef +\nobreak +} + +\outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} +\def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz #1{% +\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % +\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% + {\appendixletter}{\the\secno}{\the\subsecno}}}% +\temp +\appendixnoderef +\nobreak +} + +\outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} +\def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz #1{% +\plainsubsecheading {#1}\gdef\thissection{#1}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% + {\the\toks0}}}% +\temp +\unnumbnoderef +\nobreak +} + +% Subsubsections. +\outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} +\def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz #1{% +\gdef\thissection{#1}\global\advance \subsubsecno by 1 % +\subsubsecheading {#1} + {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% + {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% +\temp +\donoderef +\nobreak +} + +\outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} +\def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz #1{% +\gdef\thissection{#1}\global\advance \subsubsecno by 1 % +\subsubsecheading {#1} + {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% + {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% +\temp +\appendixnoderef +\nobreak +} + +\outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} +\def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz #1{% +\plainsubsubsecheading {#1}\gdef\thissection{#1}% +\toks0 = {#1}% +\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% + {\the\toks0}}}% +\temp +\unnumbnoderef +\nobreak +} + +% These are variants which are not "outer", so they can appear in @ifinfo. +% Actually, they should now be obsolete; ordinary section commands should work. +\def\infotop{\parsearg\unnumberedzzz} +\def\infounnumbered{\parsearg\unnumberedzzz} +\def\infounnumberedsec{\parsearg\unnumberedseczzz} +\def\infounnumberedsubsec{\parsearg\unnumberedsubseczzz} +\def\infounnumberedsubsubsec{\parsearg\unnumberedsubsubseczzz} + +\def\infoappendix{\parsearg\appendixzzz} +\def\infoappendixsec{\parsearg\appendixseczzz} +\def\infoappendixsubsec{\parsearg\appendixsubseczzz} +\def\infoappendixsubsubsec{\parsearg\appendixsubsubseczzz} + +\def\infochapter{\parsearg\chapterzzz} +\def\infosection{\parsearg\sectionzzz} +\def\infosubsection{\parsearg\subsectionzzz} +\def\infosubsubsection{\parsearg\subsubsectionzzz} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\global\let\section = \numberedsec +\global\let\subsection = \numberedsubsec +\global\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + + +\def\majorheading{\parsearg\majorheadingzzz} +\def\majorheadingzzz #1{% +{\advance\chapheadingskip by 10pt \chapbreak }% +{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\penalty 200} + +\def\chapheading{\parsearg\chapheadingzzz} +\def\chapheadingzzz #1{\chapbreak % +{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\penalty 200} + +% @heading, @subheading, @subsubheading. +\def\heading{\parsearg\plainsecheading} +\def\subheading{\parsearg\plainsubsecheading} +\def\subsubheading{\parsearg\plainsubsubsecheading} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +%%% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} + +%%% Define plain chapter starts, and page on/off switching for it +% Parameter controlling skip before chapter headings (if needed) + +\newskip\chapheadingskip + +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{ +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +\def\CHAPFplain{ +\global\let\chapmacro=\chfplain +\global\let\unnumbchapmacro=\unnchfplain +\global\let\centerchapmacro=\centerchfplain} + +% Plain chapter opening. +% #1 is the text, #2 the chapter number or empty if unnumbered. +\def\chfplain#1#2{% + \pchapsepmacro + {% + \chapfonts \rm + \def\chapnum{#2}% + \setbox0 = \hbox{#2\ifx\chapnum\empty\else\enspace\fi}% + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent = \wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% Plain opening for unnumbered. +\def\unnchfplain#1{\chfplain{#1}{}} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerchfplain#1{{% + \def\centerparametersmaybe{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt + }% + \chfplain{#1}{}% +}} + +\CHAPFplain % The default + +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\nobreak +} + +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} + +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak +} + +\def\CHAPFopen{ +\global\let\chapmacro=\chfopen +\global\let\unnumbchapmacro=\unnchfopen +\global\let\centerchapmacro=\centerchfopen} + + +% Section titles. +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip {-1000}} +\def\secheading#1#2#3{\sectionheading{sec}{#2.#3}{#1}} +\def\plainsecheading#1{\sectionheading{sec}{}{#1}} + +% Subsection titles. +\newskip \subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip {-500}} +\def\subsecheading#1#2#3#4{\sectionheading{subsec}{#2.#3.#4}{#1}} +\def\plainsubsecheading#1{\sectionheading{subsec}{}{#1}} + +% Subsubsection titles. +\let\subsubsecheadingskip = \subsecheadingskip +\let\subsubsecheadingbreak = \subsecheadingbreak +\def\subsubsecheading#1#2#3#4#5{\sectionheading{subsubsec}{#2.#3.#4.#5}{#1}} +\def\plainsubsubsecheading#1{\sectionheading{subsubsec}{}{#1}} + + +% Print any size section title. +% +% #1 is the section type (sec/subsec/subsubsec), #2 is the section +% number (maybe empty), #3 the text. +\def\sectionheading#1#2#3{% + {% + \expandafter\advance\csname #1headingskip\endcsname by \parskip + \csname #1headingbreak\endcsname + }% + {% + % Switch to the right set of fonts. + \csname #1fonts\endcsname \rm + % + % Only insert the separating space if we have a section number. + \def\secnum{#2}% + \setbox0 = \hbox{#2\ifx\secnum\empty\else\enspace\fi}% + % + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent = \wd0 % zero if no section number + \unhbox0 #3}% + }% + \ifdim\parskip<10pt \nobreak\kern10pt\nobreak\kern-\parskip\fi \nobreak +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. We supply {\folio} at the end of the +% argument, which will end up as the last argument to the \...entry macro. +% +% We open the .toc file here instead of at @setfilename or any other +% given time so that @contents can be put in the document anywhere. +% +\newif\iftocfileopened +\def\writetocentry#1{% + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + \iflinks \write\tocfile{#1{\folio}}\fi +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Finish up the main text and prepare to read what we've written +% to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund <tege@matematik.su.se> + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \unnumbchapmacro{#1}\def\thischapter{}% + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \catcode`\\=0 \catcode`\{=1 \catcode`\}=2 \catcode`\@=11 + % We can't do this, because then an actual ^ in a section + % title fails, e.g., @chapter ^ -- exponentiation. --karl, 9jul97. + %\catcode`\^=7 % to see ^^e4 as \"a etc. juha@piuha.ydi.vtt.fi + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \pageno = \lastnegativepageno \fi +} + + +% Normal (long) toc. +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \closein 1 + \input \jobname.toc + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \pdfmakeoutlines + \endgroup + \lastnegativepageno = \pageno + \pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\chapentry = \shortchapentry + \let\unnumbchapentry = \shortunnumberedentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf \let\sl=\shortcontsl + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\secentry ##1##2##3##4{} + \def\unnumbsecentry ##1##2{} + \def\subsecentry ##1##2##3##4##5{} + \def\unnumbsubsecentry ##1##2{} + \def\subsubsecentry ##1##2##3##4##5##6{} + \def\unnumbsubsubsecentry ##1##2{} + \openin 1 \jobname.toc + \ifeof 1 \else + \closein 1 + \input \jobname.toc + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \pageno = \savepageno +} +\let\shortcontents = \summarycontents + +\ifpdf + \pdfcatalog{/PageMode /UseOutlines}% +\fi + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapter-level things, for both the long and short contents. +\def\chapentry#1#2#3{\dochapentry{#2\labelspace#1}{#3}} + +% See comments in \dochapentry re vbox and related settings +\def\shortchapentry#1#2#3{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#3\egroup}% +} + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g. `Appendix A' for an appendix, or `3' for a chapter. +% We could simplify the code here by writing out an \appendixentry +% command in the toc file for appendices, instead of using \chapentry +% for both, but it doesn't seem worth it. +% +\newdimen\shortappendixwidth +% +\def\shortchaplabel#1{% + % Compute width of word "Appendix", may change with language. + \setbox0 = \hbox{\shortcontrm \putwordAppendix}% + \shortappendixwidth = \wd0 + % + % We typeset #1 in a box of constant width, regardless of the text of + % #1, so the chapter titles will come out aligned. + \setbox0 = \hbox{#1}% + \dimen0 = \ifdim\wd0 > \shortappendixwidth \shortappendixwidth \else 0pt \fi + % + % This space should be plenty, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + \advance\dimen0 by 1.1em + \hbox to \dimen0{#1\hfil}% +} + +\def\unnumbchapentry#1#2{\dochapentry{#1}{#2}} +\def\shortunnumberedentry#1#2{\tocentry{#1}{\doshortpageno\bgroup#2\egroup}} + +% Sections. +\def\secentry#1#2#3#4{\dosecentry{#2.#3\labelspace#1}{#4}} +\def\unnumbsecentry#1#2{\dosecentry{#1}{#2}} + +% Subsections. +\def\subsecentry#1#2#3#4#5{\dosubsecentry{#2.#3.#4\labelspace#1}{#5}} +\def\unnumbsubsecentry#1#2{\dosubsecentry{#1}{#2}} + +% And subsubsections. +\def\subsubsecentry#1#2#3#4#5#6{% + \dosubsubsecentry{#2.#3.#4.#5\labelspace#1}{#6}} +\def\unnumbsubsubsecentry#1#2{\dosubsubsecentry{#1}{#2}} + +% This parameter controls the indentation of the various levels. +\newdimen\tocindent \tocindent = 3pc + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% Final typesetting of a toc entry; we use the same \entry macro as for +% the index entries, but we want to suppress hyphenation here. (We +% can't do that in the \entry macro, since index entries might consist +% of hyphenated-identifiers-that-do-not-fit-on-a-line-and-nothing-else.) +\def\tocentry#1#2{\begingroup + \vskip 0pt plus1pt % allow a little stretch for the sake of nice page breaks + % Do not use \turnoffactive in these arguments. Since the toc is + % typeset in cmr, so characters such as _ would come out wrong; we + % have to do the usual translation tricks. + \entry{#1}{#2}% +\endgroup} + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\let\subsecentryfonts = \textfonts +\let\subsubsecentryfonts = \textfonts + + +\message{environments,} +% @foo ... @end foo. + +% Since these characters are used in examples, it should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% Furthermore, these definitions must come after we define our fonts. +\newbox\dblarrowbox \newbox\longdblarrowbox +\newbox\pushcharbox \newbox\bullbox +\newbox\equivbox \newbox\errorbox + +%{\tentt +%\global\setbox\dblarrowbox = \hbox to 1em{\hfil$\Rightarrow$\hfil} +%\global\setbox\longdblarrowbox = \hbox to 1em{\hfil$\mapsto$\hfil} +%\global\setbox\pushcharbox = \hbox to 1em{\hfil$\dashv$\hfil} +%\global\setbox\equivbox = \hbox to 1em{\hfil$\ptexequiv$\hfil} +% Adapted from the manmac format (p.420 of TeXbook) +%\global\setbox\bullbox = \hbox to 1em{\kern.15em\vrule height .75ex width .85ex +% depth .1ex\hfil} +%} + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +\def\point{$\star$} +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% Adapted from the TeXbook's \boxit. +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} + +\global\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{ + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} + +% The @error{} command. +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @tex ... @end tex escapes into raw Tex temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain tex @ character. + +\def\tex{\begingroup + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie + \catcode `\%=14 + \catcode 43=12 % plus + \catcode`\"=12 + \catcode`\==12 + \catcode`\|=12 + \catcode`\<=12 + \catcode`\>=12 + \escapechar=`\\ + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\*=\ptexstar + \let\t=\ptext + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +\let\Etex=\endgroup} + +% Define @lisp ... @endlisp. +% @lisp does a \begingroup so it can rebind things, +% including the definition of @endlisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% Make each space character in the input produce a normal interword +% space in the output. Don't allow a line break at this space, as this +% is used only in environments like @example, where each line of input +% should produce a line of output anyway. +% +{\obeyspaces % +\gdef\sepspaces{\obeyspaces\let =\tie}} + +% Define \obeyedspace to be our active space, whatever it is. This is +% for use in \parsearg. +{\sepspaces% +\global\let\obeyedspace= } + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip +% +\def\aboveenvbreak{{% + \ifnum\lastpenalty < 10000 + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + \penalty-50 + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\long\def\cartouche{% +\begingroup + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt %we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either +% side, and for 6pt waste from +% each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing=\comment + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \hsize=\cartinner + \kern3pt + \begingroup + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip +\def\Ecartouche{% + \endgroup + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup +\endgroup +}} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \inENV % This group ends at the end of the body + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \singlespace + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + % @cartouche defines \nonarrowing to inhibit narrowing + % at next level down. + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \let\exdent=\nofillexdent + \let\nonarrowing=\relax + \fi +} + +% Define the \E... control sequence only if we are inside the particular +% environment, so the error checking in \end will work. +% +% To end an @example-like environment, we first end the paragraph (via +% \afterenvbreak's vertical glue), and then the group. That way we keep +% the zero \parskip that the environments set -- \parskip glue will be +% inserted at the beginning of the next paragraph in the document, after +% the environment. +% +\def\nonfillfinish{\afterenvbreak\endgroup} + +% @lisp: indented, narrowed, typewriter font. +\def\lisp{\begingroup + \nonfillstart + \let\Elisp = \nonfillfinish + \tt + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} + +% @example: Same as @lisp. +\def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} + +% @small... is usually equivalent to the non-small (@smallbook +% redefines). We must call \example (or whatever) last in the +% definition, since it reads the return following the @example (or +% whatever) command. +% +% This actually allows (for example) @end display inside an +% @smalldisplay. Too bad, but makeinfo will catch the error anyway. +% +\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} +\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} +\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} +\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} + +% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. +% Originally contributed by Pavel@xerox. +\def\smalllispx{\begingroup + \def\Esmalllisp{\nonfillfinish\endgroup}% + \def\Esmallexample{\nonfillfinish\endgroup}% + \smallexamplefonts + \lisp +} + +% @display: same as @lisp except keep current font. +% +\def\display{\begingroup + \nonfillstart + \let\Edisplay = \nonfillfinish + \gobble +} +% +% @smalldisplay (when @smallbook): @display plus smaller fonts. +% +\def\smalldisplayx{\begingroup + \def\Esmalldisplay{\nonfillfinish\endgroup}% + \smallexamplefonts \rm + \display +} + +% @format: same as @display except don't narrow margins. +% +\def\format{\begingroup + \let\nonarrowing = t + \nonfillstart + \let\Eformat = \nonfillfinish + \gobble +} +% +% @smallformat (when @smallbook): @format plus smaller fonts. +% +\def\smallformatx{\begingroup + \def\Esmallformat{\nonfillfinish\endgroup}% + \smallexamplefonts \rm + \format +} + +% @flushleft (same as @format). +% +\def\flushleft{\begingroup \def\Eflushleft{\nonfillfinish\endgroup}\format} + +% @flushright. +% +\def\flushright{\begingroup + \let\nonarrowing = t + \nonfillstart + \let\Eflushright = \nonfillfinish + \advance\leftskip by 0pt plus 1fill + \gobble +} + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. +% +\def\quotation{% + \begingroup\inENV %This group ends at the end of the @quotation body + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \singlespace + \parindent=0pt + % We have retained a nonzero parskip for the environment, since we're + % doing normal filling. So to avoid extra space below the environment... + \def\Equotation{\parskip = 0pt \nonfillfinish}% + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \let\nonarrowing = \relax + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} +% If we want to allow any <char> as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p. 344; only we need to do '@' too +\def\dospecials{% + \do\ \do\\\do\@\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=12}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } +\endgroup +\def\setupverbatim{% + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'<char>#1<char>'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=12\catcode`\}=12 + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}' +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +%% Include LaTeX hack for completeness -- never know +%% \begingroup +%% \catcode`|=0 \catcode`[=1 +%% \catcode`]=2\catcode`\{=12\catcode`\}=12\catcode`\ =\active +%% \catcode`\\=12|gdef|doverbatim#1@end verbatim[ +%% #1|endgroup|def|Everbatim[]|end[verbatim]] +%% |endgroup +\begingroup + \catcode`\ =\active + \gdef\doverbatim#1@end verbatim{#1\end{verbatim}} +\endgroup +% +\def\verbatim{% + \def\Everbatim{\nonfillfinish\endgroup}% + \begingroup + \nonfillstart + \advance\leftskip by -\defbodyindent + \begingroup\setupverbatim\doverbatim +} + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +% Allow normal characters that we make active in the argument (a file name). +\def\verbatiminclude{% + \begingroup + \catcode`\\=12 + \catcode`~=12 + \catcode`^=12 + \catcode`_=12 + \catcode`|=12 + \catcode`<=12 + \catcode`>=12 + \catcode`+=12 + \parsearg\doverbatiminclude +} +\def\setupverbatiminclude{% + \begingroup + \nonfillstart + \advance\leftskip by -\defbodyindent + \begingroup\setupverbatim +} +% +\def\doverbatiminclude#1{% + % Restore active chars for included file. + \endgroup + \begingroup + \def\thisfile{#1}% + \expandafter\expandafter\setupverbatiminclude\input\thisfile + \endgroup\nonfillfinish\endgroup +} + + +\message{defuns,} +% @defun etc. + +% Allow user to change definition object font (\df) internally +\def\setdeffont #1 {\csname DEF#1\endcsname} + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deftypemargin \deftypemargin=12pt +\newskip\deflastargmargin \deflastargmargin=18pt + +\newcount\parencount +% define \functionparens, which makes ( and ) and & do special things. +% \functionparens affects the group it is contained in. +\def\activeparens{% +\catcode`\(=\active \catcode`\)=\active \catcode`\&=\active +\catcode`\[=\active \catcode`\]=\active} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +{\activeparens % Now, smart parens don't turn on until &foo (see \amprm) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +\global\let(=\lparen \global\let)=\rparen +\global\let[=\lbrack \global\let]=\rbrack + +\gdef\functionparens{\boldbrax\let&=\amprm\parencount=0 } +\gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} +% This is used to turn on special parens +% but make & act ordinary (given that it's active). +\gdef\boldbraxnoamp{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb\let&=\ampnr} + +% Definitions of (, ) and & used in args for functions. +% This is the definition of ( outside of all parentheses. +\gdef\oprm#1 {{\rm\char`\(}#1 \bf \let(=\opnested + \global\advance\parencount by 1 +} +% +% This is the definition of ( when already inside a level of parens. +\gdef\opnested{\char`\(\global\advance\parencount by 1 } +% +\gdef\clrm{% Print a paren in roman if it is taking us back to depth of 0. + % also in that case restore the outer-level definition of (. + \ifnum \parencount=1 {\rm \char `\)}\sl \let(=\oprm \else \char `\) \fi + \global\advance \parencount by -1 } +% If we encounter &foo, then turn on ()-hacking afterwards +\gdef\amprm#1 {{\rm\}\let(=\oprm \let)=\clrm\ } +% +\gdef\normalparens{\boldbrax\let&=\ampnr} +} % End of definition inside \activeparens +%% These parens (in \boldbrax) actually are a little bolder than the +%% contained text. This is especially needed for [ and ] +\def\opnr{{\sf\char`\(}\global\advance\parencount by 1 } +\def\clnr{{\sf\char`\)}\global\advance\parencount by -1 } +\let\ampnr = \& +\def\lbrb{{\bf\char`\[}} +\def\rbrb{{\bf\char`\]}} + +% Active &'s sneak into the index arguments, so make sure it's defined. +{ + \catcode`& = 13 + \global\let& = \ampnr +} + +% First, defname, which formats the header line itself. +% #1 should be the function name. +% #2 should be the type of definition, such as "Function". + +\def\defname #1#2{% +% Get the values of \leftskip and \rightskip as they were +% outside the @def... +\dimen2=\leftskip +\advance\dimen2 by -\defbodyindent +\noindent +\setbox0=\hbox{\hskip \deflastargmargin{\rm #2}\hskip \deftypemargin}% +\dimen0=\hsize \advance \dimen0 by -\wd0 % compute size for first line +\dimen1=\hsize \advance \dimen1 by -\defargsindent %size for continuations +\parshape 2 0in \dimen0 \defargsindent \dimen1 +% Now output arg 2 ("Function" or some such) +% ending at \deftypemargin from the right margin, +% but stuck inside a box of width 0 so it does not interfere with linebreaking +{% Adjust \hsize to exclude the ambient margins, +% so that \rightline will obey them. +\advance \hsize by -\dimen2 +\rlap{\rightline{{\rm #2}\hskip -1.25pc }}}% +% Make all lines underfull and no complaints: +\tolerance=10000 \hbadness=10000 +\advance\leftskip by -\defbodyindent +\exdentamount=\defbodyindent +{\df #1}\enskip % Generate function name +} + +% Actually process the body of a definition +% #1 should be the terminating control sequence, such as \Edefun. +% #2 should be the "another name" control sequence, such as \defunx. +% #3 should be the control sequence that actually processes the header, +% such as \defunheader. + +\def\defparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody +\medbreak % +% Define the end token that this defining construct specifies +% so that it will exit this group. +\def#1{\endgraf\endgroup\medbreak}% +\def#2{\begingroup\obeylines\activeparens\spacesplit#3}% +\parindent=0in +\advance\leftskip by \defbodyindent +\exdentamount=\defbodyindent +\begingroup % +\catcode 61=\active % 61 is `=' +\obeylines\activeparens\spacesplit#3} + +% #1 is the \E... control sequence to end the definition (which we define). +% #2 is the \...x control sequence for consecutive fns (which we define). +% #3 is the control sequence to call to resume processing. +% #4, delimited by the space, is the class name. +% +\def\defmethparsebody#1#2#3#4 {\begingroup\inENV % +\medbreak % +% Define the end token that this defining construct specifies +% so that it will exit this group. +\def#1{\endgraf\endgroup\medbreak}% +\def#2##1 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}}}% +\parindent=0in +\advance\leftskip by \defbodyindent +\exdentamount=\defbodyindent +\begingroup\obeylines\activeparens\spacesplit{#3{#4}}} + +% Used for @deftypemethod and @deftypeivar. +% #1 is the \E... control sequence to end the definition (which we define). +% #2 is the \...x control sequence for consecutive fns (which we define). +% #3 is the control sequence to call to resume processing. +% #4, delimited by a space, is the class name. +% #5 is the method's return type. +% +\def\deftypemethparsebody#1#2#3#4 #5 {\begingroup\inENV + \medbreak + \def#1{\endgraf\endgroup\medbreak}% + \def#2##1 ##2 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent + \begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} + +% Used for @deftypeop. The change from \deftypemethparsebody is an +% extra argument at the beginning which is the `category', instead of it +% being the hardwired string `Method' or `Instance Variable'. We have +% to account for this both in the \...x definition and in parsing the +% input at hand. Thus also need a control sequence (passed as #5) for +% the \E... definition to assign the category name to. +% +\def\deftypeopparsebody#1#2#3#4#5 #6 {\begingroup\inENV + \medbreak + \def#1{\endgraf\endgroup\medbreak}% + \def#2##1 ##2 ##3 {% + \def#4{##1}% + \begingroup\obeylines\activeparens\spacesplit{#3{##2}{##3}}}% + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent + \begingroup\obeylines\activeparens\spacesplit{#3{#5}{#6}}} + +\def\defopparsebody #1#2#3#4#5 {\begingroup\inENV % +\medbreak % +% Define the end token that this defining construct specifies +% so that it will exit this group. +\def#1{\endgraf\endgroup\medbreak}% +\def#2##1 ##2 {\def#4{##1}% +\begingroup\obeylines\activeparens\spacesplit{#3{##2}}}% +\parindent=0in +\advance\leftskip by \defbodyindent +\exdentamount=\defbodyindent +\begingroup\obeylines\activeparens\spacesplit{#3{#5}}} + +% These parsing functions are similar to the preceding ones +% except that they do not make parens into active characters. +% These are used for "variables" since they have no arguments. + +\def\defvarparsebody #1#2#3{\begingroup\inENV% Environment for definitionbody +\medbreak % +% Define the end token that this defining construct specifies +% so that it will exit this group. +\def#1{\endgraf\endgroup\medbreak}% +\def#2{\begingroup\obeylines\spacesplit#3}% +\parindent=0in +\advance\leftskip by \defbodyindent +\exdentamount=\defbodyindent +\begingroup % +\catcode 61=\active % +\obeylines\spacesplit#3} + +% This is used for \def{tp,vr}parsebody. It could probably be used for +% some of the others, too, with some judicious conditionals. +% +\def\parsebodycommon#1#2#3{% + \begingroup\inENV % + \medbreak % + % Define the end token that this defining construct specifies + % so that it will exit this group. + \def#1{\endgraf\endgroup\medbreak}% + \def#2##1 {\begingroup\obeylines\spacesplit{#3{##1}}}% + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent + \begingroup\obeylines +} + +\def\defvrparsebody#1#2#3#4 {% + \parsebodycommon{#1}{#2}{#3}% + \spacesplit{#3{#4}}% +} + +% This loses on `@deftp {Data Type} {struct termios}' -- it thinks the +% type is just `struct', because we lose the braces in `{struct +% termios}' when \spacesplit reads its undelimited argument. Sigh. +% \let\deftpparsebody=\defvrparsebody +% +% So, to get around this, we put \empty in with the type name. That +% way, TeX won't find exactly `{...}' as an undelimited argument, and +% won't strip off the braces. +% +\def\deftpparsebody #1#2#3#4 {% + \parsebodycommon{#1}{#2}{#3}% + \spacesplit{\parsetpheaderline{#3{#4}}}\empty +} + +% Fine, but then we have to eventually remove the \empty *and* the +% braces (if any). That's what this does. +% +\def\removeemptybraces\empty#1\relax{#1} + +% After \spacesplit has done its work, this is called -- #1 is the final +% thing to call, #2 the type name (which starts with \empty), and #3 +% (which might be empty) the arguments. +% +\def\parsetpheaderline#1#2#3{% + #1{\removeemptybraces#2\relax}{#3}% +}% + +\def\defopvarparsebody #1#2#3#4#5 {\begingroup\inENV % +\medbreak % +% Define the end token that this defining construct specifies +% so that it will exit this group. +\def#1{\endgraf\endgroup\medbreak}% +\def#2##1 ##2 {\def#4{##1}% +\begingroup\obeylines\spacesplit{#3{##2}}}% +\parindent=0in +\advance\leftskip by \defbodyindent +\exdentamount=\defbodyindent +\begingroup\obeylines\spacesplit{#3{#5}}} + +% Split up #2 at the first space token. +% call #1 with two arguments: +% the first is all of #2 before the space token, +% the second is all of #2 after that space token. +% If #2 contains no space token, all of it is passed as the first arg +% and the second is passed as empty. + +{\obeylines +\gdef\spacesplit#1#2^^M{\endgroup\spacesplitfoo{#1}#2 \relax\spacesplitfoo}% +\long\gdef\spacesplitfoo#1#2 #3#4\spacesplitfoo{% +\ifx\relax #3% +#1{#2}{}\else #1{#2}{#3#4}\fi}} + +% So much for the things common to all kinds of definitions. + +% Define @defun. + +% First, define the processing that is wanted for arguments of \defun +% Use this to expand the args and terminate the paragraph they make up + +\def\defunargs#1{\functionparens \sl +% Expand, preventing hyphenation at `-' chars. +% Note that groups don't affect changes in \hyphenchar. +% Set the font temporarily and use \font in case \setfont made \tensl a macro. +{\tensl\hyphenchar\font=0}% +#1% +{\tensl\hyphenchar\font=45}% +\ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% +\interlinepenalty=10000 +\advance\rightskip by 0pt plus 1fil +\endgraf\nobreak\vskip -\parskip\nobreak +} + +\def\deftypefunargs #1{% +% Expand, preventing hyphenation at `-' chars. +% Note that groups don't affect changes in \hyphenchar. +% Use \boldbraxnoamp, not \functionparens, so that & is not special. +\boldbraxnoamp +\tclose{#1}% avoid \code because of side effects on active chars +\interlinepenalty=10000 +\advance\rightskip by 0pt plus 1fil +\endgraf\nobreak\vskip -\parskip\nobreak +} + +% Do complete processing of one @defun or @defunx line already parsed. + +% @deffn Command forward-char nchars + +\def\deffn{\defmethparsebody\Edeffn\deffnx\deffnheader} + +\def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% +\begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % +\catcode 61=\other % Turn off change made in \defparsebody +} + +% @defun == @deffn Function + +\def\defun{\defparsebody\Edefun\defunx\defunheader} + +\def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index +\begingroup\defname {#1}{\putwordDeffunc}% +\defunargs {#2}\endgroup % +\catcode 61=\other % Turn off change made in \defparsebody +} + +% @deftypefun int foobar (int @var{foo}, float @var{bar}) + +\def\deftypefun{\defparsebody\Edeftypefun\deftypefunx\deftypefunheader} + +% #1 is the data type. #2 is the name and args. +\def\deftypefunheader #1#2{\deftypefunheaderx{#1}#2 \relax} +% #1 is the data type, #2 the name, #3 the args. +\def\deftypefunheaderx #1#2 #3\relax{% +\doind {fn}{\code{#2}}% Make entry in function index +\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypefun}% +\deftypefunargs {#3}\endgroup % +\catcode 61=\other % Turn off change made in \defparsebody +} + +% @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) + +\def\deftypefn{\defmethparsebody\Edeftypefn\deftypefnx\deftypefnheader} + +% \defheaderxcond#1\relax$$$ +% puts #1 in @code, followed by a space, but does nothing if #1 is null. +\def\defheaderxcond#1#2$$${\ifx#1\relax\else\code{#1#2} \fi} + +% #1 is the classification. #2 is the data type. #3 is the name and args. +\def\deftypefnheader #1#2#3{\deftypefnheaderx{#1}{#2}#3 \relax} +% #1 is the classification, #2 the data type, #3 the name, #4 the args. +\def\deftypefnheaderx #1#2#3 #4\relax{% +\doind {fn}{\code{#3}}% Make entry in function index +\begingroup +\normalparens % notably, turn off `&' magic, which prevents +% at least some C++ text from working +\defname {\defheaderxcond#2\relax$$$#3}{#1}% +\deftypefunargs {#4}\endgroup % +\catcode 61=\other % Turn off change made in \defparsebody +} + +% @defmac == @deffn Macro + +\def\defmac{\defparsebody\Edefmac\defmacx\defmacheader} + +\def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index +\begingroup\defname {#1}{\putwordDefmac}% +\defunargs {#2}\endgroup % +\catcode 61=\other % Turn off change made in \defparsebody +} + +% @defspec == @deffn Special Form + +\def\defspec{\defparsebody\Edefspec\defspecx\defspecheader} + +\def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index +\begingroup\defname {#1}{\putwordDefspec}% +\defunargs {#2}\endgroup % +\catcode 61=\other % Turn off change made in \defparsebody +} + +% @defop CATEGORY CLASS OPERATION ARG... +% +\def\defop #1 {\def\defoptype{#1}% +\defopparsebody\Edefop\defopx\defopheader\defoptype} +% +\def\defopheader#1#2#3{% +\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index +\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% +\defunargs {#3}\endgroup % +} + +% @deftypeop CATEGORY CLASS TYPE OPERATION ARG... +% +\def\deftypeop #1 {\def\deftypeopcategory{#1}% + \deftypeopparsebody\Edeftypeop\deftypeopx\deftypeopheader + \deftypeopcategory} +% +% #1 is the class name, #2 the data type, #3 the operation name, #4 the args. +\def\deftypeopheader#1#2#3#4{% + \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index + \begingroup + \defname{\defheaderxcond#2\relax$$$#3} + {\deftypeopcategory\ \putwordon\ \code{#1}}% + \deftypefunargs{#4}% + \endgroup +} + +% @deftypemethod CLASS TYPE METHOD ARG... +% +\def\deftypemethod{% + \deftypemethparsebody\Edeftypemethod\deftypemethodx\deftypemethodheader} +% +% #1 is the class name, #2 the data type, #3 the method name, #4 the args. +\def\deftypemethodheader#1#2#3#4{% + \dosubind{fn}{\code{#3}}{\putwordon\ \code{#1}}% entry in function index + \begingroup + \defname{\defheaderxcond#2\relax$$$#3}{\putwordMethodon\ \code{#1}}% + \deftypefunargs{#4}% + \endgroup +} + +% @deftypeivar CLASS TYPE VARNAME +% +\def\deftypeivar{% + \deftypemethparsebody\Edeftypeivar\deftypeivarx\deftypeivarheader} +% +% #1 is the class name, #2 the data type, #3 the variable name. +\def\deftypeivarheader#1#2#3{% + \dosubind{vr}{\code{#3}}{\putwordof\ \code{#1}}% entry in variable index + \begingroup + \defname{\defheaderxcond#2\relax$$$#3} + {\putwordInstanceVariableof\ \code{#1}}% + \defvarargs{#3}% + \endgroup +} + +% @defmethod == @defop Method +% +\def\defmethod{\defmethparsebody\Edefmethod\defmethodx\defmethodheader} +% +% #1 is the class name, #2 the method name, #3 the args. +\def\defmethodheader#1#2#3{% + \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% entry in function index + \begingroup + \defname{#2}{\putwordMethodon\ \code{#1}}% + \defunargs{#3}% + \endgroup +} + +% @defcv {Class Option} foo-class foo-flag + +\def\defcv #1 {\def\defcvtype{#1}% +\defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} + +\def\defcvarheader #1#2#3{% +\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index +\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% +\defvarargs {#3}\endgroup % +} + +% @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME +% +\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} +% +\def\defivarheader#1#2#3{% + \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index + \begingroup + \defname{#2}{\putwordInstanceVariableof\ #1}% + \defvarargs{#3}% + \endgroup +} + +% @defvar +% First, define the processing that is wanted for arguments of @defvar. +% This is actually simple: just print them in roman. +% This must expand the args and terminate the paragraph they make up +\def\defvarargs #1{\normalparens #1% +\interlinepenalty=10000 +\endgraf\nobreak\vskip -\parskip\nobreak} + +% @defvr Counter foo-count + +\def\defvr{\defvrparsebody\Edefvr\defvrx\defvrheader} + +\def\defvrheader #1#2#3{\doind {vr}{\code{#2}}% +\begingroup\defname {#2}{#1}\defvarargs{#3}\endgroup} + +% @defvar == @defvr Variable + +\def\defvar{\defvarparsebody\Edefvar\defvarx\defvarheader} + +\def\defvarheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index +\begingroup\defname {#1}{\putwordDefvar}% +\defvarargs {#2}\endgroup % +} + +% @defopt == @defvr {User Option} + +\def\defopt{\defvarparsebody\Edefopt\defoptx\defoptheader} + +\def\defoptheader #1#2{\doind {vr}{\code{#1}}% Make entry in var index +\begingroup\defname {#1}{\putwordDefopt}% +\defvarargs {#2}\endgroup % +} + +% @deftypevar int foobar + +\def\deftypevar{\defvarparsebody\Edeftypevar\deftypevarx\deftypevarheader} + +% #1 is the data type. #2 is the name, perhaps followed by text that +% is actually part of the data type, which should not be put into the index. +\def\deftypevarheader #1#2{% +\dovarind#2 \relax% Make entry in variables index +\begingroup\defname {\defheaderxcond#1\relax$$$#2}{\putwordDeftypevar}% +\interlinepenalty=10000 +\endgraf\nobreak\vskip -\parskip\nobreak +\endgroup} +\def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} + +% @deftypevr {Global Flag} int enable + +\def\deftypevr{\defvrparsebody\Edeftypevr\deftypevrx\deftypevrheader} + +\def\deftypevrheader #1#2#3{\dovarind#3 \relax% +\begingroup\defname {\defheaderxcond#2\relax$$$#3}{#1} +\interlinepenalty=10000 +\endgraf\nobreak\vskip -\parskip\nobreak +\endgroup} + +% Now define @deftp +% Args are printed in bold, a slight difference from @defvar. + +\def\deftpargs #1{\bf \defvarargs{#1}} + +% @deftp Class window height width ... + +\def\deftp{\deftpparsebody\Edeftp\deftpx\deftpheader} + +\def\deftpheader #1#2#3{\doind {tp}{\code{#2}}% +\begingroup\defname {#2}{#1}\deftpargs{#3}\endgroup} + +% These definitions are used if you use @defunx (etc.) +% anywhere other than immediately after a @defun or @defunx. +% +\def\defcvx#1 {\errmessage{@defcvx in invalid context}} +\def\deffnx#1 {\errmessage{@deffnx in invalid context}} +\def\defivarx#1 {\errmessage{@defivarx in invalid context}} +\def\defmacx#1 {\errmessage{@defmacx in invalid context}} +\def\defmethodx#1 {\errmessage{@defmethodx in invalid context}} +\def\defoptx #1 {\errmessage{@defoptx in invalid context}} +\def\defopx#1 {\errmessage{@defopx in invalid context}} +\def\defspecx#1 {\errmessage{@defspecx in invalid context}} +\def\deftpx#1 {\errmessage{@deftpx in invalid context}} +\def\deftypefnx#1 {\errmessage{@deftypefnx in invalid context}} +\def\deftypefunx#1 {\errmessage{@deftypefunx in invalid context}} +\def\deftypeivarx#1 {\errmessage{@deftypeivarx in invalid context}} +\def\deftypemethodx#1 {\errmessage{@deftypemethodx in invalid context}} +\def\deftypeopx#1 {\errmessage{@deftypeopx in invalid context}} +\def\deftypevarx#1 {\errmessage{@deftypevarx in invalid context}} +\def\deftypevrx#1 {\errmessage{@deftypevrx in invalid context}} +\def\defunx#1 {\errmessage{@defunx in invalid context}} +\def\defvarx#1 {\errmessage{@defvarx in invalid context}} +\def\defvrx#1 {\errmessage{@defvrx in invalid context}} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\undefined + \newwrite\macscribble + \def\scanmacro#1{% + \begingroup \newlinechar`\^^M + % Undo catcode changes of \startcontents and \doprintindex + \catcode`\@=0 \catcode`\\=12 \escapechar=`\@ + % Append \endinput to make sure that TeX does not see the ending newline. + \toks0={#1\endinput}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \let\xeatspaces\eatspaces + \input \jobname.tmp + \endgroup +} +\else +\def\scanmacro#1{% +\begingroup \newlinechar`\^^M +% Undo catcode changes of \startcontents and \doprintindex +\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ +\let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} +\fi + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? +\def\macrolist{} % List of all defined macros in the form + % \do\macro1\do\macro2... + +% Utility routines. +% Thisdoes \let #1 = #2, except with \csnames. +\def\cslet#1#2{% +\expandafter\expandafter +\expandafter\let +\expandafter\expandafter +\csname#1\endcsname +\csname#2\endcsname} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=12\catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \. + +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. + +\def\macrobodyctxt{% + \catcode`\~=12 + \catcode`\^=12 + \catcode`\_=12 + \catcode`\|=12 + \catcode`\<=12 + \catcode`\>=12 + \catcode`\+=12 + \catcode`\{=12 + \catcode`\}=12 + \catcode`\@=12 + \catcode`\^^M=12 + \usembodybackslash} + +\def\macroargctxt{% + \catcode`\~=12 + \catcode`\^=12 + \catcode`\_=12 + \catcode`\|=12 + \catcode`\<=12 + \catcode`\>=12 + \catcode`\+=12 + \catcode`\@=12 + \catcode`\\=12} + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. + +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0% + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{The name \the\macname\space is reserved}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + % Add the macroname to \macrolist + \toks0 = \expandafter{\macrolist\do}% + \xdef\macrolist{\the\toks0 + \expandafter\noexpand\csname\the\macname\endcsname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\def\unmacro{\parsearg\unmacroxxx} +\def\unmacroxxx#1{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist + \begingroup + \edef\tempa{\expandafter\noexpand\csname#1\endcsname}% + \def\do##1{% + \def\tempb{##1}% + \ifx\tempa\tempb + % remove this + \else + \toks0 = \expandafter{\newmacrolist\do}% + \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% + \fi}% + \def\newmacrolist{}% + % Execute macro list to define \newmacrolist + \macrolist + \global\let\macrolist\newmacrolist + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% <parameter list> is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list, to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). + +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{\paramno=0\def\paramlist{}% + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1% + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) + +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg) +\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \next} + +% We mant to disable all macros during \shipout so that they are not +% expanded by \write. +\def\turnoffmacros{\begingroup \def\do##1{\let\noexpand##1=\relax}% + \edef\next{\macrolist}\expandafter\endgroup\next} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\begingroup\obeyspaces\parsearg\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{\ignoreactivespaces +\edef\next{\global\let\expandafter\noexpand\csname#1\endcsname=% + \expandafter\noexpand\csname#2\endcsname}% +\expandafter\endgroup\next} + + +\message{cross references,} +% @xref etc. + +\newwrite\auxfile + +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's job is to define \lastnode. +\def\node{\ENVcheck\parsearg\nodezzz} +\def\nodezzz#1{\nodexxx [#1,]} +\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} +\let\nwnode=\node +\let\lastnode=\relax + +% The sectioning commands (@chapter, etc.) call these. +\def\donoderef{% + \ifx\lastnode\relax\else + \expandafter\expandafter\expandafter\setref{\lastnode}% + {Ysectionnumberandtype}% + \global\let\lastnode=\relax + \fi +} +\def\unnumbnoderef{% + \ifx\lastnode\relax\else + \expandafter\expandafter\expandafter\setref{\lastnode}{Ynothing}% + \global\let\lastnode=\relax + \fi +} +\def\appendixnoderef{% + \ifx\lastnode\relax\else + \expandafter\expandafter\expandafter\setref{\lastnode}% + {Yappendixletterandtype}% + \global\let\lastnode=\relax + \fi +} + + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +\gdef\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME, namely +% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have +% to set \indexdummies so commands such as @code in a section title +% aren't expanded. It would be nicer not to expand the titles in the +% first place, but there's so many layers that that is hard to do. +% +\def\setref#1#2{{% + \indexdummies + \pdfmkdest{#1}% + \dosetq{#1-title}{Ytitle}% + \dosetq{#1-pg}{Ypagenumber}% + \dosetq{#1-snt}{#2}% +}} + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printednodename{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual}% + \setbox0=\hbox{\printednodename}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax + % Use the node name inside the square brackets. + \def\printednodename{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printednodename{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printednodename{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printednodename{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifpdf + \leavevmode + \getfilename{#4}% + {\normalturnoffactive + \ifnum\filenamelength>0 + \startlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{#1}% + \else + \startlink attr{/Border [0 0 0]}% + goto name{#1}% + \fi + }% + \linkcolor + \fi + % + \ifdim \wd1 > 0pt + \putwordsection{} ``\printednodename'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\normalturnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % [mynode], + [\printednodename],\space + % page 3 + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi + \endlink +\endgroup} + +% \dosetq is the interface for calls from other macros + +% Use \normalturnoffactive so that punctuation chars such as underscore +% and backslash work in node names. (\turnoffactive doesn't do \.) +\def\dosetq#1#2{% + {\let\folio=0% + \normalturnoffactive + \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% + \iflinks + \next + \fi + }% +} + +% \internalsetq {foo}{page} expands into +% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} +% When the aux file is read, ' is the escape character + +\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} + +% Things to be expanded by \internalsetq + +\def\Ypagenumber{\folio} + +\def\Ytitle{\thissection} + +\def\Ynothing{} + +\def\Ysectionnumberandtype{% +\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % +\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % +\else \ifnum \subsubsecno=0 % +\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % +\else % +\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % +\fi \fi \fi } + +\def\Yappendixletterandtype{% +\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% +\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % +\else \ifnum \subsubsecno=0 % +\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % +\else % +\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % +\fi \fi \fi } + +\gdef\xreftie{'tie} + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Non-3.0. +\else + \def\linenumber{\the\inputlineno:\space} +\fi + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. + +\def\refx#1#2{% + \expandafter\ifx\csname X#1\endcsname\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + \message{\linenumber Undefined cross reference `#1'.}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \csname X#1\endcsname + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. +% +\def\xrdef#1{\begingroup + % Reenable \ as an escape while reading the second argument. + \catcode`\\ = 0 + \afterassignment\endgroup + \expandafter\gdef\csname X#1\endcsname +} + +% Read the last existing aux file, if any. No error if none exists. +\def\readauxfile{\begingroup + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + \catcode`\@=\other + \catcode`\^=\other + % It was suggested to define this as 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % Make the characters 128-255 be printing characters + {% + \count 1=128 + \def\loop{% + \catcode\count 1=\other + \advance\count 1 by 1 + \ifnum \count 1<256 \loop \fi + }% + }% + % The aux file uses ' as the escape (for now). + % Turn off \ as an escape so we do not lose on + % entries which were dumped with control sequences in their names. + % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ + % Reference to such entries still does not work the way one would wish, + % but at least they do not bomb out when the aux file is read in. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\%=\other + \catcode`\'=0 + \catcode`\\=\other + % + \openin 1 \jobname.aux + \ifeof 1 \else + \closein 1 + \input \jobname.aux + \global\havexrefstrue + \global\warnedobstrue + \fi + % Open the new aux file. TeX will close it automatically at exit. + \openout\auxfile=\jobname.aux +\endgroup} + + +% Footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +\let\ptexfootnote=\footnote + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \footnotezzz +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset and anything else that uses +% \parseargline fail inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\long\gdef\footnotezzz{\insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Hang the footnote text off the number. + \hang + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t + \else\let\next\f@t\fi \next} +\def\f@@t{\bgroup\aftergroup\@foot\let\next} +\def\f@t#1{#1\@foot} +\def\@foot{\strut\par\egroup} + +}%end \catcode `\@=11 + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + \closein 1 + % Do not bother showing banner with post-v2.7 epsf.tex (available in + % doc/epsf.tex until it shows up on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{% + \ifpdf + \centerline{\dopdfimage{#1}{#2}{#3}}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \nobreak\bigskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \centerline{\epsfbox{#1.eps}}% + \bigbreak + \else + % In the middle of a paragraph, no extra space. + \epsfbox{#1.eps}% + \fi + \endgroup + \fi +} + + +\message{localization,} +% and i18n. + +% @documentlanguage is usually given very early, just after +% @setfilename. If done too late, it may not override everything +% properly. Single argument is the language abbreviation. +% It would be nice if we could set up a hyphenation file here. +% +\def\documentlanguage{\parsearg\dodocumentlanguage} +\def\dodocumentlanguage#1{% + \tex % read txi-??.tex file in plain TeX. + % Read the file if it exists. + \openin 1 txi-#1.tex + \ifeof1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \let\temp = \relax + \else + \def\temp{\input txi-#1.tex }% + \fi + \temp + \endgroup +} +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? In the current directory +should work if nowhere else does.} + + +% @documentencoding should change something in TeX eventually, most +% likely, but for now just recognize it. +\let\documentencoding = \comment + + +% Page size parameters. +% +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be so finicky about underfull hboxes, either. +\hbadness = 2000 + +% Following George Bush, just get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; +% 4) hoffset; 5) binding offset; 6) topskip. We also call +% \setleading{\textleading}, so the caller should define \textleading. +% The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% Use `small' versions. +% +\def\smallenvironments{% + \let\smalldisplay = \smalldisplayx + \let\smallexample = \smalllispx + \let\smallformat = \smallformatx + \let\smalllisp = \smalllispx +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{46\baselineskip}{6in}{\voffset}{.25in}{\bindingoffset}{36pt}% +}} + +% Use @smallbook to reset parameters for 7x9.5 (or so) format. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \deftypemargin = 0pt + \defbodyindent = .5cm + \smallenvironments +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 12pt + % + \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% + % + \tolerance = 700 + \hfuzz = 1pt +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{166mm}{120mm}{\voffset}{-8mm}{\bindingoffset}{8pt}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0mm + \deftypemargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm + % + \smallenvironments +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. Top margin +% 29mm, hence bottom margin 28mm, nominal side margin 3cm. +\def\afourlatex{{\globaldefs = 1 + \textleading = 13.6pt + % + \afourpaper + \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% +}} + +% Use @afourwide to print on European A4 paper in wide format. +\def\afourwide{% + \afourpaper + \internalpagesizes{6.5in}{9.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% +} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\def\pagesizes{\parsearg\pagesizesxxx} +\def\pagesizesxxx#1{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \internalpagesizes{#1}{\hsize}{\voffset}{\normaloffset}{\bindingoffset}{44pt}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other +\catcode`\~=\other +\catcode`\^=\other +\catcode`\_=\other +\catcode`\|=\other +\catcode`\<=\other +\catcode`\>=\other +\catcode`\+=\other +\catcode`\$=\other +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} +\def\normaldollar{$} + +% This macro is used to make a character print one way in ttfont +% where it can probably just be output, and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar} +%\catcode 27=\active +%\def^^[{$\diamondsuit$} + +% Set up an active definition for =, but don't enable it most of the time. +{\catcode`\==\active +\global\def={{\tt \char 61}}} + +\catcode`+=\active +\catcode`\_=\active + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +\catcode`\@=0 + +% \rawbackslashxx output one backslash character in current font +\global\chardef\rawbackslashxx=`\\ +%{\catcode`\\=\other +%@gdef@rawbackslashxx{\}} + +% \rawbackslash redefines \ as input to do \rawbackslashxx. +{\catcode`\\=\active +@gdef@rawbackslash{@let\=@rawbackslashxx }} + +% \normalbackslash outputs one backslash in fixed width font. +\def\normalbackslash{{\tt\rawbackslashxx}} + +% \catcode 17=0 % Define control-q +\catcode`\\=\active + +% Used sometimes to turn off (effectively) the active characters +% even after parsing them. +@def@turnoffactive{@let"=@normaldoublequote +@let\=@realbackslash +@let~=@normaltilde +@let^=@normalcaret +@let_=@normalunderscore +@let|=@normalverticalbar +@let<=@normalless +@let>=@normalgreater +@let+=@normalplus +@let$=@normaldollar} + +@def@normalturnoffactive{@let"=@normaldoublequote +@let\=@normalbackslash +@let~=@normaltilde +@let^=@normalcaret +@let_=@normalunderscore +@let|=@normalverticalbar +@let<=@normalless +@let>=@normalgreater +@let+=@normalplus +@let$=@normaldollar} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\{ in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also back turn on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other + +@c Set initial fonts. +@textfonts +@rm + + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: diff --git a/configure b/configure new file mode 100755 index 0000000..07ee6b5 --- /dev/null +++ b/configure @@ -0,0 +1,2416 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.52.20231210 for GNU Autoconf 2.52.20231210. +# +# Report bugs to <dickey@invisible-island.net>. +# +# Copyright 2003-2022,2023 Thomas E. Dickey +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr="expr" +else + as_expr="false" +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln' +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset="unset" +else + as_unset="false" +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: "${ac_max_here_lines=38}" + +ac_unique_file="acgeneral.m4" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${datarootdir}/info' +mandir='${datarootdir}/man' + +# Identity of this package. +PACKAGE_NAME='GNU Autoconf' +PACKAGE_TARNAME='autoconf' +PACKAGE_VERSION='2.52.20231210' +PACKAGE_STRING='GNU Autoconf 2.52.20231210' +PACKAGE_BUGREPORT='dickey@invisible-island.net' + +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 + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # 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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo "$ac_feature" | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo "$ac_feature" | sed 's/-/_/g'` + case "$ac_option" in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) 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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$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 ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst \ + | --runs | --run | --ru) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* \ + | --runs=* | --run=* | --ru=*) + runstatedir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo "$ac_package" | sed 's/-/_/g'` + case "$ac_option" in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + 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 "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export "$ac_envvar" ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option}" "${host_alias=$ac_option}" "${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo "$ac_prev" | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo "$ac_var"` + case "$ac_val" in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo "$ac_var"` + case "$ac_val" in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# 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 "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # 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 +\`configure' configures GNU Autoconf 2.52.20231210 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +EOF + + cat <<EOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datarootdir=DIR read-only architecture-independent data [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --runstatedir=DIR extra definition of runtime data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [DATAROOTDIR/info] + --mandir=DIR man documentation [DATAROOTDIR/man] +EOF + + cat <<\EOF + +Program names: + --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 +fi + +if test -n "$ac_init_help"; then + case "$ac_init_help" in + short | recursive ) echo "Configuration of GNU Autoconf 2.52.20231210:";; + esac + cat <<\EOF + +Report bugs to <dickey@invisible-island.net>. +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd "$ac_subdir" + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo "$ac_subdir" | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir="$srcdir" ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir="$srcdir/$ac_subdir" ;; + *) # Relative path. + ac_sub_srcdir="$ac_dots$srcdir/$ac_subdir" ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f "$ac_sub_srcdir/configure.gnu"; then + echo + $SHELL "$ac_sub_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_sub_srcdir/configure"; then + echo + $SHELL "$ac_sub_srcdir/configure" --help=recursive + elif test -f "$ac_sub_srcdir/configure.ac" || + test -f "$ac_sub_srcdir/configure.in"; then + echo + "$ac_configure" --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd "$ac_popdir" + done +fi + +test -n "$ac_init_help" && exit 0 +if "$ac_init_version"; then + cat <<\EOF +GNU Autoconf configure 2.52.20231210 +generated by GNU Autoconf 2.52.20231210 + +Copyright 2003-2022,2023 Thomas E. Dickey +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 <<EOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by GNU Autoconf $as_me 2.52.20231210, which was +generated by GNU Autoconf 2.52.20231210. Invocation command line was + + $ $0 $@ + +EOF +{ +cat <<_ASUNAME +## ---------- ## +## Platform. ## +## ---------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +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 || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <<EOF +## ------------ ## +## Core tests. ## +## ------------ ## + +EOF + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell meta-characters. +ac_configure_args= +ac_sep= +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_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' "$ac_signal" +done +ac_signal=0 + +# 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 + +# Let the site file select an alternate cache file if it wants to. +# 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 "$as_me:822: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:833: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:841: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case "$ac_old_set,$ac_new_set" in + set,) + { echo "$as_me:857: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:861: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:867: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:869: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:871: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. It doesn't matter if + # we pass some twice (in addition to the command line arguments). + if test "$ac_new_set" = set; then + case "$ac_new_val" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + *) ac_configure_args="$ac_configure_args $ac_var=$ac_new_val" + ;; + esac + fi +done +if "$ac_cache_corrupted"; then + { echo "$as_me:890: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:892: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS "conftest.$ac_ext" >&5' +ac_link='$CC -o "conftest$ac_exeext" $CFLAGS $CPPFLAGS $LDFLAGS "conftest.$ac_ext" $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +ac_main_return="return" + +case `echo "testing\c" 2>/dev/null; echo 1,2,3`,`echo -n testing 2>/dev/null; echo 1,2,3` in + *c*,-n*) ECHO_N= + ECHO_C= # newlines do not sed ;-) only broken shells would use this case anyway + ECHO_T=' ' + ;; + *c*,* ) ECHO_N=-n + ECHO_C= + ECHO_T= + ;; + *) ECHO_N= + ECHO_C='\c' + ECHO_T= + ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:921: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:924: \$? = $ac_status" >&5 + (exit "$ac_status"); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_aux_dir= +for ac_dir in config $srcdir/config; 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 + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:950: error: cannot find install-sh or install.sh in config $srcdir/config" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# 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 +# AmigaOS /C/install, which installs bootblocks on floppy discs +# 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 "$as_me:970: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /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 $as_executable_p "$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. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +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 "$as_me:1019: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&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}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:1030: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# 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 + 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 "$as_me:1053: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:1066: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest* +echo "$as_me:1073: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +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" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +test x"${MISSING+set}" = xset || + MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + am_backtick='`' + { echo "$as_me:1096: WARNING: ${am_backtick}missing' script is too old or missing" >&5 +echo "$as_me: WARNING: ${am_backtick}missing' script is too old or missing" >&2;} +fi + +echo "$as_me:1100: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 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 conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:1120: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:1124: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +PACKAGE=autoconf + +VERSION=2.52.20231210 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { { echo "$as_me:1134: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +cat >>confdefs.h <<EOF +#define PACKAGE "$PACKAGE" +EOF + +cat >>confdefs.h <<EOF +#define VERSION "$VERSION" +EOF + +missing_dir=`cd $ac_aux_dir && pwd` +# +ac_prog_editor=`echo $program_transform_name| sed -e 's/\\$\\$/$/g'` +# +ac_prog_actual=`echo autoconf|sed -e $ac_prog_editor` + +AUTOCONF=${AUTOCONF-"${am_missing_run}$ac_prog_actual"} + +# +ac_prog_actual=`echo autoheader|sed -e $ac_prog_editor` + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}$ac_prog_actual"} + +# + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# Initialize the test suite. +AUTOTEST_PATH=.. + +# Extract the first word of "expr", so it can be a program name with args. +set dummy expr; ac_word=$2 +echo "$as_me:1169: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_EXPR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $EXPR in + [\\/]* | ?:[\\/]*) + ac_cv_path_EXPR="$EXPR" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_EXPR="$ac_dir/$ac_word" + echo "$as_me:1186: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +EXPR=$ac_cv_path_EXPR + +if test -n "$EXPR"; then + echo "$as_me:1197: result: $EXPR" >&5 +echo "${ECHO_T}$EXPR" >&6 +else + echo "$as_me:1200: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +# We use a path for GNU m4 so even if users have another m4 first in +# their path, the installer can configure with a path that has GNU m4 +# first and get that path embedded in the installed autoconf and +# autoheader scripts. +for ac_prog in gm4 gnum4 m4 +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 "$as_me:1212: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_M4+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $M4 in + [\\/]* | ?:[\\/]*) + ac_cv_path_M4="$M4" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_M4="$ac_dir/$ac_word" + echo "$as_me:1229: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +M4=$ac_cv_path_M4 + +if test -n "$M4"; then + echo "$as_me:1240: result: $M4" >&5 +echo "${ECHO_T}$M4" >&6 +else + echo "$as_me:1243: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$M4" && break +done +test -n "$M4" || M4="m4" + +echo "$as_me:1251: checking version of $M4" >&5 +echo $ECHO_N "checking version of $M4... $ECHO_C" >&6 +if test "${ac_cv_m4_version+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + ac_cv_m4_version=`$M4 --version | head -n 1 | sed -E -e 's/^.*[ ]([1-9][0-9]*\.)/\1/g' -e 's/[^0-9.]*$//' 2>/dev/null` + test -z "$ac_cv_m4_version" && ac_cv_m4_version=unknown + +fi +echo "$as_me:1261: result: $ac_cv_m4_version" >&5 +echo "${ECHO_T}$ac_cv_m4_version" >&6 +echo "$as_me:1263: checking whether $M4 supports frozen files" >&5 +echo $ECHO_N "checking whether $M4 supports frozen files... $ECHO_C" >&6 +if test "${ac_cv_prog_gnu_m4+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_gnu_m4=no +if test x"$M4" != x; then + case `$M4 --help < /dev/null 2>&1` in + *reload-state*) ac_cv_prog_gnu_m4=yes ;; + esac +fi +fi +echo "$as_me:1275: result: $ac_cv_prog_gnu_m4" >&5 +echo "${ECHO_T}$ac_cv_prog_gnu_m4" >&6 +if test x"$ac_cv_prog_gnu_m4" != xyes; then + { { echo "$as_me:1278: error: GNU m4 1.4 is required" >&5 +echo "$as_me: error: GNU m4 1.4 is required" >&2;} + { (exit 1); exit 1; }; } +fi +# This is needed because Automake does not seem to realize there is +# a AC-SUBST inside AC-PROG-GNU-M4. Grmph! + +# `autoconf' and `ifnames' use AWK. And we need decent RE support. +for ac_prog in mawk gawk 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 "$as_me:1290: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_AWK="$ac_prog" +echo "$as_me:1305: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:1313: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:1316: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +# Some AWK fail +if echo xfoo | $AWK '/foo|^bar$/ { print }' | grep xfoo >/dev/null; then :; else + { { echo "$as_me:1325: error: the regex engine of $AWK is too broken to be used + you might want to install GNU AWK" >&5 +echo "$as_me: error: the regex engine of $AWK is too broken to be used + you might want to install GNU AWK" >&2;} + { (exit 1); exit 1; }; } +fi + +# The "make check" needs a working egrep. +for ac_prog in ggrep grep +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 "$as_me:1337: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$GREP"; then + ac_cv_prog_GREP="$GREP" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_GREP="$ac_prog" +echo "$as_me:1352: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +GREP=$ac_cv_prog_GREP +if test -n "$GREP"; then + echo "$as_me:1360: result: $GREP" >&5 +echo "${ECHO_T}$GREP" >&6 +else + echo "$as_me:1363: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$GREP" && break +done +test -n "$GREP" || GREP=": " + +echo "$as_me:1371: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + for ac_prog in gegrep egrep +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 "$as_me:1383: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $EGREP in + [\\/]* | ?:[\\/]*) + ac_cv_path_EGREP="$EGREP" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_EGREP="$ac_dir/$ac_word" + echo "$as_me:1400: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +EGREP=$ac_cv_path_EGREP + +if test -n "$EGREP"; then + echo "$as_me:1411: result: $EGREP" >&5 +echo "${ECHO_T}$EGREP" >&6 +else + echo "$as_me:1414: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$EGREP" && break +done +test -n "$EGREP" || EGREP=": " + + test "x$ac_cv_path_EGREP" = "x:" && { { echo "$as_me:1422: error: cannot find workable egrep" >&5 +echo "$as_me: error: cannot find workable egrep" >&2;} + { (exit 1); exit 1; }; } + fi +fi +echo "$as_me:1427: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6 + EGREP="$ac_cv_path_EGREP" + +# Generating man pages. + +HELP2MAN=${HELP2MAN-"${am_missing_run}help2man"} + +# We use a path for perl so the #! line in autoscan will work. +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +echo "$as_me:1438: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_PERL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PERL in + [\\/]* | ?:[\\/]*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_PERL="$ac_dir/$ac_word" + echo "$as_me:1455: found $ac_dir/$ac_word" >&5 + break +fi +done + + test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no" + ;; +esac +fi +PERL=$ac_cv_path_PERL + +if test -n "$PERL"; then + echo "$as_me:1467: result: $PERL" >&5 +echo "${ECHO_T}$PERL" >&6 +else + echo "$as_me:1470: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +if test "$PERL" != no; then + PERLSCRIPTS="autoscan autoupdate" +else + { echo "$as_me:1477: WARNING: autoscan and autoupdate will not be built since perl is not found" >&5 +echo "$as_me: WARNING: autoscan and autoupdate will not be built since perl is not found" >&2;} +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 +# AmigaOS /C/install, which installs bootblocks on floppy discs +# 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 "$as_me:1493: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /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 $as_executable_p "$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. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +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 "$as_me:1542: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&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}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:1553: checking for fgrep" >&5 +echo $ECHO_N "checking for fgrep... $ECHO_C" >&6 +if test "${ac_cv_path_FGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + for ac_prog in gfgrep fgrep +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 "$as_me:1565: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_FGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $FGREP in + [\\/]* | ?:[\\/]*) + ac_cv_path_FGREP="$FGREP" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_FGREP="$ac_dir/$ac_word" + echo "$as_me:1582: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +FGREP=$ac_cv_path_FGREP + +if test -n "$FGREP"; then + echo "$as_me:1593: result: $FGREP" >&5 +echo "${ECHO_T}$FGREP" >&6 +else + echo "$as_me:1596: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$FGREP" && break +done +test -n "$FGREP" || FGREP=": " + + test "x$ac_cv_path_FGREP" = "x:" && { { echo "$as_me:1604: error: cannot find workable fgrep" >&5 +echo "$as_me: error: cannot find workable fgrep" >&2;} + { (exit 1); exit 1; }; } + fi +fi +echo "$as_me:1609: result: $ac_cv_path_FGREP" >&5 +echo "${ECHO_T}$ac_cv_path_FGREP" >&6 + FGREP="$ac_cv_path_FGREP" + +for ac_prog in ginstall-info install-info +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 "$as_me:1617: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_INSTALL_INFO+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $INSTALL_INFO in + [\\/]* | ?:[\\/]*) + ac_cv_path_INSTALL_INFO="$INSTALL_INFO" # Let the user override the test with a path. + ;; + *) + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH:/sbin:/usr/sbin" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + if $as_executable_p "$ac_dir/$ac_word"; then + ac_cv_path_INSTALL_INFO="$ac_dir/$ac_word" + echo "$as_me:1634: found $ac_dir/$ac_word" >&5 + break +fi +done + + ;; +esac +fi +INSTALL_INFO=$ac_cv_path_INSTALL_INFO + +if test -n "$INSTALL_INFO"; then + echo "$as_me:1645: result: $INSTALL_INFO" >&5 +echo "${ECHO_T}$INSTALL_INFO" >&6 +else + echo "$as_me:1648: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$INSTALL_INFO" && break +done +test -n "$INSTALL_INFO" || INSTALL_INFO="no" + +if test "$INSTALL_INFO" != no; then + if $INSTALL_INFO --version && \ + ( $INSTALL_INFO --version | $FGREP -i -v debian ) >/dev/null 2>&1; then + : + else + { echo "$as_me:1661: WARNING: install-info utility not found" >&5 +echo "$as_me: WARNING: install-info utility not found" >&2;} + INSTALL_INFO=no + fi +fi + +# Automake can't see inner AC_SUBSTS (`aclocal' is bypassed), so we tag the +# AC_SUBSTS here too. + +# Provide a properly-escaped bug-report address for the perl scripts. +PACKAGE_BUGREPORT_PL=`echo "$PACKAGE_BUGREPORT" | sed -e 's/@/\\\\\\\\@/g'` + +ac_config_files="$ac_config_files Makefile m4/Makefile man/Makefile doc/Makefile config/Makefile tests/Makefile tests/atconfig tests/mktests.sh:tests/mktests.in" + +cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# 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 \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +# +# If the first sed substitution is executed (which looks for macros that +# take arguments), then we branch to the quote section. Otherwise, +# look for a macro that doesn't take arguments. +cat >confdef2opt.sed <<\EOF +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g +t quote +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g +t quote +d +: quote +s,[ `~#$^&*(){}\\|;'"<>?],\\&,g +s,\[,\\&,g +s,\],\\&,g +s,\$,$$,g +p +EOF +# We use echo to avoid assuming a particular line-breaking character. +# The extra dot is to prevent the shell from consuming trailing +# line-breaks from the sub-command output. A line-break within +# single-quotes doesn't work because, if this script is created in a +# platform that uses two characters for line-breaks (e.g., DOS), tr +# would break. +ac_LF_and_DOT=`echo; echo .` +DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'` +rm -f confdef2opt.sed + +: "${CONFIG_STATUS=./config.status}" +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:1784: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >"$CONFIG_STATUS" <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +me=\`echo "\$0" | sed -e 's,.*\\/,,'\` + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS +_ACEOF + +cat >>"$CONFIG_STATUS" <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr="expr" +else + as_expr="false" +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln' +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset="unset" +else + as_unset="false" +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>"$CONFIG_STATUS" +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>"$CONFIG_STATUS" +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>"$CONFIG_STATUS" +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>"$CONFIG_STATUS" +fi + +cat >>"$CONFIG_STATUS" <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + +Configuration files: +$config_files + +Report bugs to <dickey@invisible-island.net>." +EOF + +cat >>"$CONFIG_STATUS" <<EOF +ac_cs_version="\\ +GNU Autoconf config.status 2.52.20231210 +configured by $0, generated by GNU Autoconf 2.52.20231210, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright 2003-2022,2023 Thomas E. Dickey +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir="$srcdir" +INSTALL="$INSTALL" +EOF + +cat >>"$CONFIG_STATUS" <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>"$CONFIG_STATUS" <<EOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" + exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; +EOF +cat >>"$CONFIG_STATUS" <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:1957: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # This is an error. + -*) { { echo "$as_me:1976: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me (GNU Autoconf 2.52.20231210) 2.52.20231210, executed with + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + > "$ac_cs_invocation" +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>"$CONFIG_STATUS" <<\EOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "m4/Makefile" ) CONFIG_FILES="$CONFIG_FILES m4/Makefile" ;; + "man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; + "config/Makefile" ) CONFIG_FILES="$CONFIG_FILES config/Makefile" ;; + "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; + "tests/atconfig" ) CONFIG_FILES="$CONFIG_FILES tests/atconfig" ;; + "tests/mktests.sh" ) CONFIG_FILES="$CONFIG_FILES tests/mktests.sh:tests/mktests.in" ;; + *) { { echo "$as_me:2019: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if "$ac_need_defaults"; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: "${TMPDIR=/tmp}" +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>"$CONFIG_STATUS" <<EOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >"\$tmp"/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datarootdir@,$datarootdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@runstatedir@,$runstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@AUTOTEST_PATH@,$AUTOTEST_PATH,;t t +s,@EXPR@,$EXPR,;t t +s,@M4@,$M4,;t t +s,@AWK@,$AWK,;t t +s,@GREP@,$GREP,;t t +s,@EGREP@,$EGREP,;t t +s,@HELP2MAN@,$HELP2MAN,;t t +s,@PERL@,$PERL,;t t +s,@PERLSCRIPTS@,$PERLSCRIPTS,;t t +s,@FGREP@,$FGREP,;t t +s,@INSTALL_INFO@,$INSTALL_INFO,;t t +s,@PACKAGE_BUGREPORT_PL@,$PACKAGE_BUGREPORT_PL,;t t +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_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # 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" "$tmp"/subs.sed >"$tmp"/subs.frag + else + sed "${ac_end}q" "$tmp"/subs.sed >"$tmp"/subs.frag + fi + if test ! -s "$tmp"/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat "$tmp"/subs.frag) >"$tmp"/subs-$ac_sed_frag.sed + # It is possible to make a multiline substitution using escaped newlines. + # Ensure that we do not split the substitution between script fragments. + ac_BEG=$ac_end + ac_END=`expr "$ac_end" + "$ac_max_sed_lines"` + sed "1,${ac_BEG}d; ${ac_END}p; q" "$tmp"/subs.sed >"$tmp"/subs.next + if test -s "$tmp"/subs.next; then + grep '^s,@[^@,][^@,]*@,.*\\$' "$tmp"/subs.next >"$tmp"/subs.edit + if test ! -s "$tmp"/subs.edit; then + grep "^s,@[^@,][^@,]*@,.*,;t t$" "$tmp"/subs.next >"$tmp"/subs.edit + if test ! -s "$tmp"/subs.edit; then + if test "$ac_beg" -gt 1; then + ac_end=`expr "$ac_end" - 1` + continue + fi + fi + fi + fi + + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f \"$tmp\"/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f \"$tmp\"/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr "$ac_sed_frag" + 1` + ac_beg=$ac_end + ac_end=`expr "$ac_end" + "$ac_max_sed_lines"` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="cat" + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>"$CONFIG_STATUS" <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + - | *:- | *:-:* ) # input from stdin + cat >"$tmp"/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + 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 "$srcdir" in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo "$ac_dots" | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir="$srcdir$ac_dir_suffix"; + ac_top_srcdir="$srcdir" ;; + *) # Relative path. + ac_srcdir="$ac_dots$srcdir$ac_dir_suffix" + ac_top_srcdir="$ac_dots$srcdir" ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:2254: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo "$tmp"/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:2272: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:2285: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>"$CONFIG_STATUS" <<\EOF + ac_warn_datarootdir=no + if test x"$ac_file" != x-; then + for ac_item in $ac_file_inputs + do + ac_seen=`grep '@\(datadir\|mandir\|infodir\)@' "$ac_item"` + if test -n "$ac_seen"; then + ac_used=`grep '@datarootdir@' "$ac_item"` + if test -z "$ac_used"; then + { echo "$as_me:2301: WARNING: datarootdir was used implicitly but not set: +$ac_seen" >&5 +echo "$as_me: WARNING: datarootdir was used implicitly but not set: +$ac_seen" >&2;} + ac_warn_datarootdir=yes + fi + fi + ac_seen=`grep '${datarootdir}' "$ac_item"` + if test -n "$ac_seen"; then + { echo "$as_me:2310: WARNING: datarootdir was used explicitly but not set: +$ac_seen" >&5 +echo "$as_me: WARNING: datarootdir was used explicitly but not set: +$ac_seen" >&2;} + ac_warn_datarootdir=yes + fi + done + fi + +if test "x$ac_warn_datarootdir" = xyes; then + ac_sed_cmds="$ac_sed_cmds | sed -e 's,@datarootdir@,\${prefix}/share,g' -e 's,\${datarootdir},\${prefix}/share,g'" +fi + +EOF +cat >>"$CONFIG_STATUS" <<EOF + sed "$ac_vpsub +$extrasub +EOF +cat >>"$CONFIG_STATUS" <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >"$tmp"/out + rm -f "$tmp"/stdin +EOF +test -n "${FGREP}" || FGREP="grep -F" +test -n "${EGREP}" || EGREP="grep -E" +cat >>"$CONFIG_STATUS" <<EOF + test -n "\${FGREP}" || FGREP="$FGREP" + test -n "\${EGREP}" || EGREP="$EGREP" +EOF +cat >>"$CONFIG_STATUS" <<\EOF + if test x"$ac_file" != x-; then + cp "$tmp/out" "$ac_file" + + for ac_name in prefix exec_prefix datarootdir + do + ac_seen=`$FGREP -n '${'$ac_name'[:=].*}' "$ac_file"` + if test -n "$ac_seen"; then + ac_init=`$EGREP '[ ]*'$ac_name'[ ]*=' "$ac_file"` + if test -z "$ac_init"; then + ac_seen=`echo "$ac_seen" |sed -e 's,^,'"$ac_file"':,'` + { echo "$as_me:2355: WARNING: Variable $ac_name is used but was not set: +$ac_seen" >&5 +echo "$as_me: WARNING: Variable $ac_name is used but was not set: +$ac_seen" >&2;} + fi + fi + done + $EGREP -n '@[a-z_][a-z_0-9]+@' "$ac_file" >"$tmp"/out + $EGREP -n '@[A-Z_][A-Z_0-9]+@' "$ac_file" >>"$tmp"/out + if test -s "$tmp"/out; then + ac_seen=`sed -e 's,^,'"$ac_file"':,' < "$tmp"/out` + { echo "$as_me:2366: WARNING: Some variables may not be substituted: +$ac_seen" >&5 +echo "$as_me: WARNING: Some variables may not be substituted: +$ac_seen" >&2;} + fi + else + cat "$tmp"/out + fi + rm -f "$tmp"/out + +done +EOF + +cat >>"$CONFIG_STATUS" <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x "$CONFIG_STATUS" +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL "$CONFIG_STATUS" || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + "$ac_cs_success" || { (exit 1); exit 1; } +fi + +# Report the state of this version of Autoconf if this is a beta. +case 2.52.20231210 in + *[a-z]*) + cat <<EOF + +You are about to use an experimental version of Autoconf. Be sure to +read the relevant mailing lists, most importantly <autoconf@gnu.org>. + +Below you will find information on the status of this version of Autoconf. + +EOF + sed -n '/^\* Status/,$p' $srcdir/BUGS;; +esac diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..1235c3b --- /dev/null +++ b/configure.ac @@ -0,0 +1,93 @@ +# -*- Autoconf -*- +# Copyright 2008-2022,2023 Thomas E. Dickey +#------------------------------------------------------------------------------ +# Process this file with autoconf to produce a configure script. +AC_PREREQ(2.50) +AC_INIT(GNU Autoconf, [2.52.20231210], dickey@invisible-island.net) +AC_CONFIG_SRCDIR(acgeneral.m4) +AC_CONFIG_AUX_DIR(config) +AM_INIT_AUTOMAKE(autoconf, [2.52.20231210]) + +# Initialize the test suite. +AT_CONFIG(..) +AC_PATH_PROG(EXPR, expr) + +# We use a path for GNU m4 so even if users have another m4 first in +# their path, the installer can configure with a path that has GNU m4 +# first and get that path embedded in the installed autoconf and +# autoheader scripts. +AC_PROG_GNU_M4 +if test x"$ac_cv_prog_gnu_m4" != xyes; then + AC_MSG_ERROR([GNU m4 1.4 is required]) +fi +# This is needed because Automake does not seem to realize there is +# a AC-SUBST inside AC-PROG-GNU-M4. Grmph! +AC_SUBST(M4) + +# `autoconf' and `ifnames' use AWK. And we need decent RE support. +AC_PROG_AWK +# Some AWK fail +if echo xfoo | $AWK '/foo|^bar$/ { print }' | grep xfoo >/dev/null; then :; else + AC_MSG_ERROR([the regex engine of $AWK is too broken to be used + you might want to install GNU AWK]) +fi + +# The "make check" needs a working egrep. +AC_PROG_EGREP + +# Generating man pages. +AM_MISSING_PROG(HELP2MAN, help2man) + +# We use a path for perl so the #! line in autoscan will work. +AC_PATH_PROG(PERL, perl, no) +AC_SUBST(PERL)dnl +AC_SUBST(PERLSCRIPTS)dnl +if test "$PERL" != no; then + PERLSCRIPTS="autoscan autoupdate" +else + AC_MSG_WARN([autoscan and autoupdate will not be built since perl is not found]) +fi + +AC_PROG_INSTALL +AC_PROG_FGREP + +AC_PATH_PROGS(INSTALL_INFO, ginstall-info install-info, no, $PATH:/sbin:/usr/sbin) +if test "$INSTALL_INFO" != no; then + if $INSTALL_INFO --version && \ + ( $INSTALL_INFO --version | $FGREP -i -v debian ) >/dev/null 2>&1; then + : + else + AC_MSG_WARN(install-info utility not found) + INSTALL_INFO=no + fi +fi + +# Automake can't see inner AC_SUBSTS (`aclocal' is bypassed), so we tag the +# AC_SUBSTS here too. +AC_SUBST(PACKAGE_NAME) +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) + +# Provide a properly-escaped bug-report address for the perl scripts. +PACKAGE_BUGREPORT_PL=`echo "$PACKAGE_BUGREPORT" | sed -e 's/@/\\\\\\\\@/g'` +AC_SUBST(PACKAGE_BUGREPORT_PL) + +AC_CONFIG_FILES(Makefile m4/Makefile man/Makefile doc/Makefile config/Makefile + tests/Makefile tests/atconfig tests/mktests.sh:tests/mktests.in) + +AC_OUTPUT + +# Report the state of this version of Autoconf if this is a beta. +case AC_PACKAGE_VERSION in + *[[a-z]]*) + cat <<EOF + +You are about to use an experimental version of Autoconf. Be sure to +read the relevant mailing lists, most importantly <autoconf@gnu.org>. + +Below you will find information on the status of this version of Autoconf. + + +EOF + sed -n '/^\* Status/,$p' $srcdir/BUGS;; +esac diff --git a/doc/Makefile.in b/doc/Makefile.in new file mode 100644 index 0000000..db3130e --- /dev/null +++ b/doc/Makefile.in @@ -0,0 +1,341 @@ +# Copyright 2010-2012,2023 Thomas E. Dickey +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datarootdir = @datarootdir@ +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 = .. + +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL_INFO = @INSTALL_INFO@ + +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 = : +AWK = @AWK@ +EXPR = @EXPR@ +HELP2MAN = @HELP2MAN@ +M4 = @M4@ +PACKAGE = @PACKAGE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PERL = @PERL@ +PERLSCRIPTS = @PERLSCRIPTS@ +VERSION = @VERSION@ + +MAKEINFO = @MAKEINFO@ --no-split +TEXI2HTML = texi2html + +info_TEXINFOS = autoconf.texi standards.texi +autoconf_TEXINFOS = install.texi +standards_TEXINFOS = make-stds.texi + +# Files from texi2dvi that should be removed, but which Automake does +# not know. +CLEANFILES = autoconf.cvs autoconf.ev autoconf.evs autoconf.ma autoconf.mas \ + autoconf.ov autoconf.ovs autoconf.ms autoconf.mss autoconf.tmp + +subdir = doc +CONFIG_CLEAN_FILES = +DIST_SOURCES = +TEXINFO_TEX = $(top_srcdir)/config/texinfo.tex +INFO_DEPS = autoconf.info standards.info +DVIS = autoconf.dvi standards.dvi +TEXINFOS = autoconf.texi standards.texi +DIST_COMMON = $(autoconf_TEXINFOS) $(standards_TEXINFOS) Makefile.am \ + Makefile.in stamp-vti version.texi +all: all-am + +.SUFFIXES: +.SUFFIXES: .dvi .info .ps .texi + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status + +$(srcdir)/version.texi: $(srcdir)/stamp-vti + @: +$(srcdir)/stamp-vti: autoconf.texi $(top_srcdir)/configure.ac + @(set `$(SHELL) $(top_srcdir)/config/mdate-sh $(srcdir)/autoconf.texi`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > vti.tmp + @cmp -s vti.tmp $(srcdir)/version.texi \ + || (echo "Updating $(srcdir)/version.texi"; \ + cp vti.tmp $(srcdir)/version.texi) + -@rm -f vti.tmp + @cp $(srcdir)/version.texi $@ + +mostlyclean-vti: + -rm -f vti.tmp + +maintainer-clean-vti: + -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi + +autoconf.info: autoconf.texi $(srcdir)/version.texi $(autoconf_TEXINFOS) +autoconf.dvi: autoconf.texi $(srcdir)/version.texi $(autoconf_TEXINFOS) + +standards.info: standards.texi $(standards_TEXINFOS) +standards.dvi: standards.texi $(standards_TEXINFOS) + +.texi.info: + @cd $(srcdir) && rm -f $@ $@-[0-9] $@-[0-9][0-9] + cd $(srcdir) \ + && $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) \ + `echo $< | sed 's,.*/,,'` + +.texi.dvi: + TEXINPUTS=$(top_srcdir)/config:$$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 test $(INSTALL_INFO) != no; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + name=`basename "$$file" .info | sed -e '$(transform)'`; \ + FILE=$$name.info; \ + 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 \ + name=`basename "$$file" .info | sed -e '$(transform)'`; \ + FILE=$$name.info; \ + (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 autoconf.aux autoconf.cp autoconf.cps autoconf.cv autoconf.dvi \ + autoconf.ev autoconf.fn autoconf.fns autoconf.ky autoconf.log \ + autoconf.ma autoconf.ms autoconf.ov autoconf.pg autoconf.ps \ + autoconf.toc autoconf.tp autoconf.vr autoconf.vrs \ + standards.aux standards.cp standards.cps standards.dvi \ + standards.fn standards.ky standards.log standards.pg \ + standards.ps standards.toc standards.tp standards.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 +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 \ + mkdir -p "$(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) + +installdirs: + mkdir -p $(DESTDIR)$(infodir) + +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: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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-exec-am: + +install-info: install-info-am + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + mkdir -p $(DESTDIR)$(infodir) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + name=`basename "$$file" .info | sed -e '$(transform)'`; \ + FILE=$$name.info; \ + 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 \ + $(SHELL) $$d/rename.sh $$d/$$ifile $$FILE; \ + echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$FILE"; \ + $(INSTALL_DATA) $$FILE $(DESTDIR)$(infodir)/$$FILE; \ + test "$$file" != "$$FILE" && rm -f "$$FILE"; \ + break; \ + else : ; fi; \ + done; \ + done + @$(POST_INSTALL) + @if test $(INSTALL_INFO) != no; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + name=`basename "$$file" .info | sed -e '$(transform)'`; \ + FILE=$$name.info; \ + echo " $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$FILE";\ + $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$FILE || :;\ + done; \ + else : ; fi +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-aminfo mostlyclean-generic mostlyclean-vti + +uninstall-am: uninstall-info-am + +.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-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti mostlyclean \ + mostlyclean-aminfo mostlyclean-generic mostlyclean-vti \ + uninstall uninstall-am uninstall-info-am + + +# The documentation + +html: autoconf_1.html standards_1.html + +autoconf_1.html: autoconf.texi install.texi + $(TEXI2HTML) -split_chapter $(srcdir)/autoconf.texi + +standards_1.html: standards.texi make-stds.texi + $(TEXI2HTML) -split_chapter $(srcdir)/standards.texi +# 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 --git a/doc/autoconf.info b/doc/autoconf.info new file mode 100644 index 0000000..d64dd17 --- /dev/null +++ b/doc/autoconf.info @@ -0,0 +1,10852 @@ +This is autoconf.info, produced by makeinfo version 6.7 from +autoconf.texi. + +INFO-DIR-SECTION GNU admin +START-INFO-DIR-ENTRY +* Autoconf: (autoconf). Create source code configuration scripts +END-INFO-DIR-ENTRY + +INFO-DIR-SECTION Individual utilities +START-INFO-DIR-ENTRY +* autoscan: (autoconf)autoscan Invocation. + Semi-automatic 'configure.ac' writing +* ifnames: (autoconf)ifnames Invocation. + Listing the conditionals in source code +* autoconf: (autoconf)autoconf Invocation. + How to create configuration scripts +* autoreconf: (autoconf)autoreconf Invocation. + Remaking multiple 'configure' scripts +* configure: (autoconf)configure Invocation. + Configuring a package +* config.status: (autoconf)config.status Invocation. + Recreating a configuration +END-INFO-DIR-ENTRY + +Autoconf: Creating Automatic Configuration Scripts, by David MacKenzie. + + This file documents the GNU Autoconf package for creating scripts to +configure source code packages using templates and an 'm4' macro +package. + + Copyright 2003-2022,2023 Thomas E. Dickey +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free +Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, provided that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions, except that this permission notice may be stated in a +translation approved by the Foundation. + + +File: autoconf.info, Node: Top, Next: Introduction, Prev: (dir), Up: (dir) + +This file documents the GNU Autoconf package for creating scripts to +configure source code packages using templates and the GNU M4 macro +package. This is edition 2.52.20231210, for Autoconf version +2.52.20231210. + +* Menu: + +* Introduction:: Autoconf's purpose, strengths, and weaknesses +* The GNU build system:: A set of tools for portable software packages +* Making configure Scripts:: How to organize and produce Autoconf scripts +* Setup:: Initialization and output +* Existing Tests:: Macros that check for particular features +* Writing Tests:: How to write new feature checks +* Results:: What to do with results from feature checks +* Programming in M4:: Layers on top of which Autoconf is written +* Writing Autoconf Macros:: Adding new macros to Autoconf +* Portable Shell:: Shell script portability pitfalls +* Manual Configuration:: Selecting features that can't be guessed +* Site Configuration:: Local defaults for 'configure' +* Running configure scripts:: How to use the Autoconf output +* config.status Invocation:: Recreating a configuration +* Obsolete Constructs:: Kept for backward compatibility +* Questions:: Questions about Autoconf, with answers +* History:: History of Autoconf +* Environment Variable Index:: Index of environment variables used +* Output Variable Index:: Index of variables set in output files +* Preprocessor Symbol Index:: Index of C preprocessor symbols defined +* Autoconf Macro Index:: Index of Autoconf macros +* M4 Macro Index:: Index of M4, M4sugar, and M4sh macros +* Concept Index:: General index + + +The GNU build system + +* Automake:: Escaping Makefile hell +* Libtool:: Building libraries portably +* Pointers:: More info on the GNU build system + +Making 'configure' Scripts + +* Writing configure.ac:: What to put in an Autoconf input file +* autoscan Invocation:: Semi-automatic 'configure.ac' writing +* ifnames Invocation:: Listing the conditionals in source code +* autoconf Invocation:: How to create configuration scripts +* autoreconf Invocation:: Remaking multiple 'configure' scripts + +Writing 'configure.ac' + +* Shell Script Compiler:: Autoconf as solution of a problem +* Autoconf Language:: Programming in Autoconf +* configure.ac Layout:: Standard organization of configure.ac + +Initialization and Output Files + +* Notices:: Copyright, version numbers in 'configure' +* Input:: Where Autoconf should find files +* Output:: Outputting results from the configuration +* Configuration Actions:: Preparing the output based on results +* Configuration Files:: Creating output files +* Makefile Substitutions:: Using output variables in 'Makefile's +* Configuration Headers:: Creating a configuration header file +* Configuration Commands:: Running arbitrary instantiation commands +* Configuration Links:: Links depending from the configuration +* Subdirectories:: Configuring independent packages together +* Default Prefix:: Changing the default installation prefix + +Substitutions in Makefiles + +* Preset Output Variables:: Output variables that are always set +* Installation Directory Variables:: Other preset output variables +* Build Directories:: Supporting multiple concurrent compiles +* Automatic Remaking:: Makefile rules for configuring + +Configuration Header Files + +* Header Templates:: Input for the configuration headers +* autoheader Invocation:: How to create configuration templates +* Autoheader Macros:: How to specify CPP templates + +Existing Tests + +* Common Behavior:: Macros' standard schemes +* Alternative Programs:: Selecting between alternative programs +* Files:: Checking for the existence of files +* Libraries:: Library archives that might be missing +* Library Functions:: C library functions that might be missing +* Header Files:: Header files that might be missing +* Declarations:: Declarations that may be missing +* Structures:: Structures or members that might be missing +* Types:: Types that might be missing +* Compilers and Preprocessors:: Checking for compiling programs +* System Services:: Operating system services +* UNIX Variants:: Special kludges for specific UNIX variants + +Common Behavior + +* Standard Symbols:: Symbols defined by the macros +* Default Includes:: Includes used by the generic macros + +Alternative Programs + +* Particular Programs:: Special handling to find certain programs +* Generic Programs:: How to find other programs + +Library Functions + +* Function Portability:: Pitfalls with usual functions +* Particular Functions:: Special handling to find certain functions +* Generic Functions:: How to find other functions + +Header Files + +* Particular Headers:: Special handling to find certain headers +* Generic Headers:: How to find other headers + +Declarations + +* Particular Declarations:: Macros to check for certain declarations +* Generic Declarations:: How to find other declarations + +Structures + +* Particular Structures:: Macros to check for certain structure members +* Generic Structures:: How to find other structure members + +Types + +* Particular Types:: Special handling to find certain types +* Generic Types:: How to find other types + +Compilers and Preprocessors + +* Generic Compiler Characteristics:: Language independent tests +* C Compiler:: Checking its characteristics +* C++ Compiler:: Likewise +* Fortran 77 Compiler:: Likewise + +Writing Tests + +* Examining Declarations:: Detecting header files and declarations +* Examining Syntax:: Detecting language syntax features +* Examining Libraries:: Detecting functions and global variables +* Run Time:: Testing for run-time features +* Systemology:: A zoology of operating systems +* Multiple Cases:: Tests for several possible values +* Language Choice:: Selecting which language to use for testing + +Checking Run Time Behavior + +* Test Programs:: Running test programs +* Guidelines:: General rules for writing test programs +* Test Functions:: Avoiding pitfalls in test programs + +Results of Tests + +* Defining Symbols:: Defining C preprocessor symbols +* Setting Output Variables:: Replacing variables in output files +* Caching Results:: Speeding up subsequent 'configure' runs +* Printing Messages:: Notifying 'configure' users + +Caching Results + +* Cache Variable Names:: Shell variables used in caches +* Cache Files:: Files 'configure' uses for caching +* Cache Checkpointing:: Loading and saving the cache file + +Programming in M4 + +* M4 Quotation:: Protecting macros from unwanted expansion +* Programming in M4sugar:: Convenient pure M4 macros + +M4 Quotation + +* Active Characters:: Characters that change the behavior of m4 +* One Macro Call:: Quotation and one macro call +* Quotation and Nested Macros:: Macros calling macros +* Quadrigraphs:: Another way to escape special characters +* Quotation Rule Of Thumb:: One parenthesis, one quote + +Programming in M4sugar + +* Redefined M4 Macros:: M4 builtins changed in M4sugar +* Forbidden Patterns:: Catching unexpanded macros + +Writing Autoconf Macros + +* Macro Definitions:: Basic format of an Autoconf macro +* Macro Names:: What to call your new macros +* Reporting Messages:: Notifying 'autoconf' users +* Dependencies Between Macros:: What to do when macros depend on other macros +* Obsoleting Macros:: Warning about old ways of doing things +* Coding Style:: Writing Autoconf macros à la Autoconf + +Dependencies Between Macros + +* Prerequisite Macros:: Ensuring required information +* Suggested Ordering:: Warning about possible ordering problems + +Portable Shell Programming + +* Shellology:: A zoology of shells +* Here-Documents:: Quirks and tricks +* File Descriptors:: FDs and redirections +* File System Conventions:: File- and pathnames +* Shell Substitutions:: Variable and command expansions +* Assignments:: Varying side effects of assignments +* Special Shell Variables:: Variables you should not change +* Limitations of Builtins:: Portable use of not so portable /bin/sh +* Limitations of Usual Tools:: Portable use of portable tools +* Limitations of Make:: Portable Makefiles + +Manual Configuration + +* Specifying Names:: Specifying the system type +* Canonicalizing:: Getting the canonical system type +* Using System Type:: What to do with the system type + +Site Configuration + +* External Software:: Working with other optional software +* Package Options:: Selecting optional features +* Pretty Help Strings:: Formatting help string +* Site Details:: Configuring site details +* Transforming Names:: Changing program names when installing +* Site Defaults:: Giving 'configure' local defaults + +Transforming Program Names When Installing + +* Transformation Options:: 'configure' options to transform names +* Transformation Examples:: Sample uses of transforming names +* Transformation Rules:: 'Makefile' uses of transforming names + +Running 'configure' Scripts + +* Basic Installation:: Instructions for typical cases +* Compilers and Options:: Selecting compilers and optimization +* Multiple Architectures:: Compiling for multiple architectures at once +* Installation Names:: Installing in different directories +* Optional Features:: Selecting optional features +* System Type:: Specifying the system type +* Sharing Defaults:: Setting site-wide defaults for 'configure' +* Environment Variables:: Defining environment variables. +* configure Invocation:: Changing how 'configure' runs + +Obsolete Constructs + +* Obsolete config.status Use:: Different calling convention +* acconfig.h:: Additional entries in 'config.h.in' +* autoupdate Invocation:: Automatic update of 'configure.ac' +* Obsolete Macros:: Backward compatibility macros +* Autoconf 1:: Tips for upgrading your files +* Autoconf 2.13:: Some fresher tips + +Upgrading From Version 1 + +* Changed File Names:: Files you might rename +* Changed Makefiles:: New things to put in 'Makefile.in' +* Changed Macros:: Macro calls you might replace +* Changed Results:: Changes in how to check test results +* Changed Macro Writing:: Better ways to write your own macros + +Upgrading From Version 2.13 + +* Changed Quotation:: Broken code which used to work +* New Macros:: Interaction with foreign macros + +Questions About Autoconf + +* Distributing:: Distributing 'configure' scripts +* Why GNU m4:: Why not use the standard M4? +* Bootstrapping:: Autoconf and GNU M4 require each other? +* Why Not Imake:: Why GNU uses 'configure' instead of Imake + +History of Autoconf + +* Genesis:: Prehistory and naming of 'configure' +* Exodus:: The plagues of M4 and Perl +* Leviticus:: The priestly code of portability arrives +* Numbers:: Growth and contributors +* Deuteronomy:: Approaching the promises of easy configuration + + + +File: autoconf.info, Node: Introduction, Next: The GNU build system, Prev: Top, Up: Top + +1 Introduction +************** + + A physicist, an engineer, and a computer scientist were discussing the + nature of God. "Surely a Physicist," said the physicist, "because + early in the Creation, God made Light; and you know, Maxwell's + equations, the dual nature of electromagnetic waves, the relativistic + consequences..." "An Engineer!," said the engineer, "because +before making Light, God split the Chaos into Land and Water; it takes a + hell of an engineer to handle that big amount of mud, and orderly + separation of solids from liquids..." The computer scientist + shouted: "And the Chaos, where do you think it was coming from, hmm?" + + --Anonymous + + Autoconf is a tool for producing shell scripts that automatically +configure software source code packages to adapt to many kinds of +UNIX-like systems. The configuration scripts produced by Autoconf are +independent of Autoconf when they are run, so their users do not need to +have Autoconf. + + The configuration scripts produced by Autoconf require no manual user +intervention when run; they do not normally even need an argument +specifying the system type. Instead, they individually test for the +presence of each feature that the software package they are for might +need. (Before each check, they print a one-line message stating what +they are checking for, so the user doesn't get too bored while waiting +for the script to finish.) As a result, they deal well with systems +that are hybrids or customized from the more common UNIX variants. +There is no need to maintain files that list the features supported by +each release of each variant of UNIX. + + For each software package that Autoconf is used with, it creates a +configuration script from a template file that lists the system features +that the package needs or can use. After the shell code to recognize +and respond to a system feature has been written, Autoconf allows it to +be shared by many software packages that can use (or need) that feature. +If it later turns out that the shell code needs adjustment for some +reason, it needs to be changed in only one place; all of the +configuration scripts can be regenerated automatically to take advantage +of the updated code. + + The Metaconfig package is similar in purpose to Autoconf, but the +scripts it produces require manual user intervention, which is quite +inconvenient when configuring large source trees. Unlike Metaconfig +scripts, Autoconf scripts can support cross-compiling, if some care is +taken in writing them. + + Autoconf does not solve all problems related to making portable +software packages--for a more complete solution, it should be used in +concert with other GNU build tools like Automake and Libtool. These +other tools take on jobs like the creation of a portable, recursive +'Makefile' with all of the standard targets, linking of shared +libraries, and so on. *Note The GNU build system::, for more +information. + + Autoconf imposes some restrictions on the names of macros used with +'#if' in C programs (*note Preprocessor Symbol Index::). + + Autoconf requires GNU M4 in order to generate the scripts. It uses +features that some UNIX versions of M4, including GNU M4 1.3, do not +have. You must use version 1.4 or later of GNU M4. + + *Note Autoconf 1::, for information about upgrading from version 1. +*Note History::, for the story of Autoconf's development. *Note +Questions::, for answers to some common questions about Autoconf. + + See the Autoconf web page(1) for up-to-date information, details on +the mailing lists, pointers to a list of known bugs, etc. + + Mail suggestions to the Autoconf mailing list <autoconf@gnu.org>. + + Bug reports should be preferably submitted to the Autoconf Gnats +database(2), or sent to the Autoconf Bugs mailing list +<bug-autoconf@gnu.org>. If possible, first check that your bug is not +already solved in current development versions, and that it has not been +reported yet. Be sure to include all the needed information and a short +'configure.ac' that demonstrates the problem. + + Autoconf's development tree is accessible via CVS; see the Autoconf +web page for details. There is also a CVSweb interface to the Autoconf +development tree(3). Patches relative to the current CVS version can be +sent for review to the Autoconf Patches mailing list +<autoconf-patches@gnu.org>. + + Because of its mission, Autoconf includes only a set of often-used +macros that have already demonstrated their usefulness. Nevertheless, +if you wish to share your macros, or find existing ones, see the +Autoconf Macro Archive(4), which is kindly run by Peter Simons +<simons@computer.org>. + + ---------- Footnotes ---------- + + (1) Autoconf web page, +<http://www.gnu.org/software/autoconf/autoconf.html>. + + (2) Autoconf Gnats database, +<http://sources.redhat.com/cgi-bin/gnatsweb.pl?database=autoconf>. + + (3) CVSweb interface to the Autoconf development tree, +<http://subversions.gnu.org/cgi-bin/cvsweb/autoconf/>. + + (4) Autoconf Macro Archive, +<http://www.gnu.org/software/ac-archive/>. + + +File: autoconf.info, Node: The GNU build system, Next: Making configure Scripts, Prev: Introduction, Up: Top + +2 The GNU build system +********************** + +Autoconf solves an important problem--reliable discovery of +system-specific build and runtime information--but this is only one +piece of the puzzle for the development of portable software. To this +end, the GNU project has developed a suite of integrated utilities to +finish the job Autoconf started: the GNU build system, whose most +important components are Autoconf, Automake, and Libtool. In this +chapter, we introduce you to those tools, point you to sources of more +information, and try to convince you to use the entire GNU build system +for your software. + +* Menu: + +* Automake:: Escaping Makefile hell +* Libtool:: Building libraries portably +* Pointers:: More info on the GNU build system + + +File: autoconf.info, Node: Automake, Next: Libtool, Prev: The GNU build system, Up: The GNU build system + +2.1 Automake +============ + +The ubiquity of 'make' means that a 'Makefile' is almost the only viable +way to distribute automatic build rules for software, but one quickly +runs into 'make''s numerous limitations. Its lack of support for +automatic dependency tracking, recursive builds in subdirectories, +reliable timestamps (e.g. for network filesystems), and so on, mean +that developers must painfully (and often incorrectly) reinvent the +wheel for each project. Portability is non-trivial, thanks to the +quirks of 'make' on many systems. On top of all this is the manual +labor required to implement the many standard targets that users have +come to expect ('make install', 'make distclean', 'make uninstall', +etc.). Since you are, of course, using Autoconf, you also have to +insert repetitive code in your 'Makefile.in' to recognize '@CC@', +'@CFLAGS@', and other substitutions provided by 'configure'. Into this +mess steps "Automake". + + Automake allows you to specify your build needs in a 'Makefile.am' +file with a vastly simpler and more powerful syntax than that of a plain +'Makefile', and then generates a portable 'Makefile.in' for use with +Autoconf. For example, the 'Makefile.am' to build and install a simple +"Hello world" program might look like: + + bin_PROGRAMS = hello + hello_SOURCES = hello.c + +The resulting 'Makefile.in' (~400 lines) automatically supports all the +standard targets, the substitutions provided by Autoconf, automatic +dependency tracking, 'VPATH' building, and so on. 'make' will build the +'hello' program, and 'make install' will install it in '/usr/local/bin' +(or whatever prefix was given to 'configure', if not '/usr/local'). + + Automake may require that additional tools be present on the +_developer's_ machine. For example, the 'Makefile.in' that the +developer works with may not be portable (e.g. it might use special +features of your compiler to automatically generate dependency +information). Running 'make dist', however, produces a +'hello-1.0.tar.gz' package (or whatever the program/version is) with a +'Makefile.in' that will work on any system. + + The benefits of Automake increase for larger packages (especially +ones with subdirectories), but even for small programs the added +convenience and portability can be substantial. And that's not all... + + +File: autoconf.info, Node: Libtool, Next: Pointers, Prev: Automake, Up: The GNU build system + +2.2 Libtool +=========== + +Very often, one wants to build not only programs, but libraries, so that +other programs can benefit from the fruits of your labor. Ideally, one +would like to produce _shared_ (dynamically-linked) libraries, which can +be used by multiple programs without duplication on disk or in memory +and can be updated independently of the linked programs. Producing +shared libraries portably, however, is the stuff of nightmares--each +system has its own incompatible tools, compiler flags, and magic +incantations. Fortunately, GNU provides a solution: "Libtool". + + Libtool handles all the requirements of building shared libraries for +you, and at this time seems to be the _only_ way to do so with any +portability. It also handles many other headaches, such as: the +interaction of 'Makefile' rules with the variable suffixes of shared +libraries, linking reliably to shared libraries before they are +installed by the superuser, and supplying a consistent versioning system +(so that different versions of a library can be installed or upgraded +without breaking binary compatibility). Although Libtool, like +Autoconf, can be used on its own, it is most simply utilized in +conjunction with Automake--there, Libtool is used automatically whenever +shared libraries are needed, and you need not know its syntax. + + +File: autoconf.info, Node: Pointers, Prev: Libtool, Up: The GNU build system + +2.3 Pointers +============ + +Developers who are used to the simplicity of 'make' for small projects +on a single system might be daunted at the prospect of learning to use +Automake and Autoconf. As your software is distributed to more and more +users, however, you will otherwise quickly find yourself putting lots of +effort into reinventing the services that the GNU build tools provide, +and making the same mistakes that they once made and overcame. +(Besides, since you're already learning Autoconf, Automake will be a +piece of cake.) + + There are a number of places that you can go to for more information +on the GNU build tools. + + - Web + + The home pages for Autoconf(1), and Libtool(2). + + - Books + + The book 'GNU Autoconf, Automake and Libtool'(3) describes the + complete GNU build environment. You can also find the entire book + on-line at "The Goat Book" home page(4). + + - Tutorials and Examples + + The Autoconf Developer Page(5) maintains links to a number of + Autoconf/Automake tutorials online, and also links to the Autoconf + Macro Archive(6). + + ---------- Footnotes ---------- + + (1) Autoconf, <http://www.gnu.org/software/autoconf/>. + + (2) Libtool, <http://www.gnu.org/software/libtool/>. + + (3) 'GNU Autoconf, Automake and Libtool', by G. V. Vaughan, B. +Elliston, T. Tromey, and I. L. Taylor. New Riders, 2000, ISBN +1578701902. + + (4) "The Goat Book" home page, <http://sources.redhat.com/autobook/>. + + (5) Autoconf Developer Page, <http://sources.redhat.com/autoconf/>. + + (6) Autoconf Macro Archive, +<http://www.gnu.org/software/ac-archive/>. + + +File: autoconf.info, Node: Making configure Scripts, Next: Setup, Prev: The GNU build system, Up: Top + +3 Making 'configure' Scripts +**************************** + +The configuration scripts that Autoconf produces are by convention +called 'configure'. When run, 'configure' creates several files, +replacing configuration parameters in them with appropriate values. The +files that 'configure' creates are: + + - one or more 'Makefile' files, one in each subdirectory of the + package (*note Makefile Substitutions::); + + - optionally, a C header file, the name of which is configurable, + containing '#define' directives (*note Configuration Headers::); + + - a shell script called 'config.status' that, when run, will recreate + the files listed above (*note config.status Invocation::); + + - an optional shell script normally called 'config.cache' (created + when using 'configure --config-cache') that saves the results of + running many of the tests (*note Cache Files::); + + - a file called 'config.log' containing any messages produced by + compilers, to help debugging if 'configure' makes a mistake. + + To create a 'configure' script with Autoconf, you need to write an +Autoconf input file 'configure.ac' (or 'configure.in') and run +'autoconf' on it. If you write your own feature tests to supplement +those that come with Autoconf, you might also write files called +'aclocal.m4' and 'acsite.m4'. If you use a C header file to contain +'#define' directives, you might also run 'autoheader', and you will +distribute the generated file 'config.h.in' with the package. + + Here is a diagram showing how the files that can be used in +configuration are produced. Programs that are executed are suffixed by +'*'. Optional files are enclosed in square brackets ('[]'). 'autoconf' +and 'autoheader' also read the installed Autoconf macro files (by +reading 'autoconf.m4'). + +Files used in preparing a software package for distribution: + your source files --> [autoscan*] --> [configure.scan] --> configure.ac + + configure.ac --. + | .------> autoconf* -----> configure + [aclocal.m4] --+---+ + | `-----> [autoheader*] --> [config.h.in] + [acsite.m4] ---' + + Makefile.in -------------------------------> Makefile.in + +Files used in configuring a software package: + .-------------> [config.cache] + configure* ------------+-------------> config.log + | + [config.h.in] -. v .-> [config.h] -. + +--> config.status* -+ +--> make* + Makefile.in ---' `-> Makefile ---' + +* Menu: + +* Writing configure.ac:: What to put in an Autoconf input file +* autoscan Invocation:: Semi-automatic 'configure.ac' writing +* ifnames Invocation:: Listing the conditionals in source code +* autoconf Invocation:: How to create configuration scripts +* autoreconf Invocation:: Remaking multiple 'configure' scripts + + +File: autoconf.info, Node: Writing configure.ac, Next: autoscan Invocation, Prev: Making configure Scripts, Up: Making configure Scripts + +3.1 Writing 'configure.ac' +========================== + +To produce a 'configure' script for a software package, create a file +called 'configure.ac' that contains invocations of the Autoconf macros +that test the system features your package needs or can use. Autoconf +macros already exist to check for many features; see *note Existing +Tests::, for their descriptions. For most other features, you can use +Autoconf template macros to produce custom checks; see *note Writing +Tests::, for information about them. For especially tricky or +specialized features, 'configure.ac' might need to contain some +hand-crafted shell commands; see *note Portable Shell::. The 'autoscan' +program can give you a good start in writing 'configure.ac' (*note +autoscan Invocation::, for more information). + + Previous versions of Autoconf promoted the name 'configure.in', which +is somewhat ambiguous (the tool needed to produce this file is not +described by its extension), and introduces a slight confusion with +'config.h.in' and so on (for which '.in' means "to be processed by +'configure'"). Using 'configure.ac' is now preferred. + +* Menu: + +* Shell Script Compiler:: Autoconf as solution of a problem +* Autoconf Language:: Programming in Autoconf +* configure.ac Layout:: Standard organization of configure.ac + + +File: autoconf.info, Node: Shell Script Compiler, Next: Autoconf Language, Prev: Writing configure.ac, Up: Writing configure.ac + +3.1.1 A Shell Script Compiler +----------------------------- + +Just as for any other computer language, in order to properly program +'configure.ac' in Autoconf you must understand _what_ problem the +language tries to address and _how_ it does so. + + The problem Autoconf addresses is that the world is a mess. After +all, you are using Autoconf in order to have your package compile easily +on all sorts of different systems, some of them being extremely hostile. +Autoconf itself bears the price for these differences: 'configure' must +run on all those systems, and thus 'configure' must limit itself to +their lowest common denominator of features. + + Naturally, you might then think of shell scripts; who needs +'autoconf'? A set of properly written shell functions is enough to make +it easy to write 'configure' scripts by hand. Sigh! Unfortunately, +shell functions do not belong to the least common denominator; +therefore, where you would like to define a function and use it ten +times, you would instead need to copy its body ten times. + + So, what is really needed is some kind of compiler, 'autoconf', that +takes an Autoconf program, 'configure.ac', and transforms it into a +portable shell script, 'configure'. + + How does 'autoconf' perform this task? + + There are two obvious possibilities: creating a brand new language or +extending an existing one. The former option is very attractive: all +sorts of optimizations could easily be implemented in the compiler and +many rigorous checks could be performed on the Autoconf program (e.g. +rejecting any non-portable construct). Alternatively, you can extend an +existing language, such as the 'sh' (Bourne shell) language. + + Autoconf does the latter: it is a layer on top of 'sh'. It was +therefore most convenient to implement 'autoconf' as a macro expander: a +program that repeatedly performs "macro expansions" on text input, +replacing macro calls with macro bodies and producing a pure 'sh' script +in the end. Instead of implementing a dedicated Autoconf macro +expander, it is natural to use an existing general-purpose macro +language, such as M4, and implement the extensions as a set of M4 +macros. + + +File: autoconf.info, Node: Autoconf Language, Next: configure.ac Layout, Prev: Shell Script Compiler, Up: Writing configure.ac + +3.1.2 The Autoconf Language +--------------------------- + +The Autoconf language is very different from many other computer +languages because it treats actual code the same as plain text. Whereas +in C, for instance, data and instructions have very different syntactic +status, in Autoconf their status is rigorously the same. Therefore, we +need a means to distinguish literal strings from text to be expanded: +quotation. + + When calling macros that take arguments, there must not be any blank +space between the macro name and the open parenthesis. Arguments should +be enclosed within the M4 quote characters '[' and ']', and be separated +by commas. Any leading spaces in arguments are ignored, unless they are +quoted. You may safely leave out the quotes when the argument is simple +text, but _always_ quote complex arguments such as other macro calls. +This rule applies recursively for every macro call, including macros +called from other macros. + + For instance: + + AC_CHECK_HEADER([stdio.h], + [AC_DEFINE([HAVE_STDIO_H])], + [AC_MSG_ERROR([Sorry, can't do anything for you])]) + +is quoted properly. You may safely simplify its quotation to: + + AC_CHECK_HEADER(stdio.h, + [AC_DEFINE(HAVE_STDIO_H)], + [AC_MSG_ERROR([Sorry, can't do anything for you])]) + +Notice that the argument of 'AC_MSG_ERROR' is still quoted; otherwise, +its comma would have been interpreted as an argument separator. + + The following example is wrong and dangerous, as it is underquoted: + + AC_CHECK_HEADER(stdio.h, + AC_DEFINE(HAVE_STDIO_H), + AC_MSG_ERROR([Sorry, can't do anything for you])) + + In other cases, you may have to use text that also resembles a macro +call. You must quote that text even when it is not passed as a macro +argument: + + echo "Hard rock was here! --[AC_DC]" + +which will result in + + echo "Hard rock was here! --AC_DC" + +When you use the same text in a macro argument, you must therefore have +an extra quotation level (since one is stripped away by the macro +substitution). In general, then, it is a good idea to _use double +quoting for all literal string arguments_: + + AC_MSG_WARN([[AC_DC stinks --Iron Maiden]]) + + You are now able to understand one of the constructs of Autoconf that +has been continually misunderstood... The rule of thumb is that +_whenever you expect macro expansion, expect quote expansion_; i.e., +expect one level of quotes to be lost. For instance: + + AC_COMPILE_IFELSE([char b[10];],, [AC_MSG_ERROR([you lose])]) + +is incorrect: here, the first argument of 'AC_COMPILE_IFELSE' is 'char +b[10];' and will be expanded once, which results in 'char b10;'. (There +was an idiom common in Autoconf's past to address this issue via the M4 +'changequote' primitive, but do not use it!) Let's take a closer look: +the author meant the first argument to be understood as a literal, and +therefore it must be quoted twice: + + AC_COMPILE_IFELSE([[char b[10];]],, [AC_MSG_ERROR([you lose])]) + +Voilà , you actually produce 'char b[10];' this time! + + The careful reader will notice that, according to these guidelines, +the "properly" quoted 'AC_CHECK_HEADER' example above is actually +lacking three pairs of quotes! Nevertheless, for the sake of +readability, double quotation of literals is used only where needed in +this manual. + + Some macros take optional arguments, which this documentation +represents as [ARG] (not to be confused with the quote characters). You +may just leave them empty, or use '[]' to make the emptiness of the +argument explicit, or you may simply omit the trailing commas. The +three lines below are equivalent: + + AC_CHECK_HEADERS(stdio.h, [], [], []) + AC_CHECK_HEADERS(stdio.h,,,) + AC_CHECK_HEADERS(stdio.h) + + It is best to put each macro call on its own line in 'configure.ac'. +Most of the macros don't add extra newlines; they rely on the newline +after the macro call to terminate the commands. This approach makes the +generated 'configure' script a little easier to read by not inserting +lots of blank lines. It is generally safe to set shell variables on the +same line as a macro call, because the shell allows assignments without +intervening newlines. + + You can include comments in 'configure.ac' files by starting them +with the '#'. For example, it is helpful to begin 'configure.ac' files +with a line like this: + + # Process this file with autoconf to produce a configure script. + + +File: autoconf.info, Node: configure.ac Layout, Prev: Autoconf Language, Up: Writing configure.ac + +3.1.3 Standard 'configure.ac' Layout +------------------------------------ + +The order in which 'configure.ac' calls the Autoconf macros is not +important, with a few exceptions. Every 'configure.ac' must contain a +call to 'AC_INIT' before the checks, and a call to 'AC_OUTPUT' at the +end (*note Output::). Additionally, some macros rely on other macros +having been called first, because they check previously set values of +some variables to decide what to do. These macros are noted in the +individual descriptions (*note Existing Tests::), and they also warn you +when 'configure' is created if they are called out of order. + + To encourage consistency, here is a suggested order for calling the +Autoconf macros. Generally speaking, the things near the end of this +list are those that could depend on things earlier in it. For example, +library functions could be affected by types and libraries. + + Autoconf requirements + 'AC_INIT(PACKAGE, VERSION, BUG-REPORT-ADDRESS)' + information on the package + checks for programs + checks for libraries + checks for header files + checks for types + checks for structures + checks for compiler characteristics + checks for library functions + checks for system services + 'AC_CONFIG_FILES([FILE...])' + 'AC_OUTPUT' + + +File: autoconf.info, Node: autoscan Invocation, Next: ifnames Invocation, Prev: Writing configure.ac, Up: Making configure Scripts + +3.2 Using 'autoscan' to Create 'configure.ac' +============================================= + +The 'autoscan' program can help you create and/or maintain a +'configure.ac' file for a software package. 'autoscan' examines source +files in the directory tree rooted at a directory given as a command +line argument, or the current directory if none is given. It searches +the source files for common portability problems and creates a file +'configure.scan' which is a preliminary 'configure.ac' for that package, +and checks a possibly existing 'configure.ac' for completeness. + + When using 'autoscan' to create a 'configure.ac', you should manually +examine 'configure.scan' before renaming it to 'configure.ac'; it will +probably need some adjustments. Occasionally, 'autoscan' outputs a +macro in the wrong order relative to another macro, so that 'autoconf' +produces a warning; you need to move such macros manually. Also, if you +want the package to use a configuration header file, you must add a call +to 'AC_CONFIG_HEADERS' (*note Configuration Headers::). You might also +have to change or add some '#if' directives to your program in order to +make it work with Autoconf (*note ifnames Invocation::, for information +about a program that can help with that job). + + When using 'autoscan' to maintain a 'configure.ac', simply consider +adding its suggestions. The file 'autoscan.log' will contain detailed +information on why a macro is requested. + + 'autoscan' uses several data files (installed along with Autoconf) to +determine which macros to output when it finds particular symbols in a +package's source files. These data files all have the same format: each +line consists of a symbol, whitespace, and the Autoconf macro to output +if that symbol is encountered. Lines starting with '#' are comments. + + 'autoscan' is only installed if you already have Perl installed. +'autoscan' accepts the following options: + +'--help' +'-h' + Print a summary of the command line options and exit. + +'--version' +'-V' + Print the version number of Autoconf and exit. + +'--verbose' +'-v' + Print the names of the files it examines and the potentially + interesting symbols it finds in them. This output can be + voluminous. + +'--autoconf-dir=DIR' +'-A DIR' + Override the location where the installed Autoconf data files are + looked for. You can also set the 'AC_MACRODIR' environment + variable to a directory; this option overrides the environment + variable. + + This option is rarely needed and dangerous; it is only used when + one plays with different versions of Autoconf simultaneously. + + +File: autoconf.info, Node: ifnames Invocation, Next: autoconf Invocation, Prev: autoscan Invocation, Up: Making configure Scripts + +3.3 Using 'ifnames' to List Conditionals +======================================== + +'ifnames' can help you write 'configure.ac' for a software package. It +prints the identifiers that the package already uses in C preprocessor +conditionals. If a package has already been set up to have some +portability, 'ifnames' can thus help you figure out what its 'configure' +needs to check for. It may help fill in some gaps in a 'configure.ac' +generated by 'autoscan' (*note autoscan Invocation::). + + 'ifnames' scans all of the C source files named on the command line +(or the standard input, if none are given) and writes to the standard +output a sorted list of all the identifiers that appear in those files +in '#if', '#elif', '#ifdef', or '#ifndef' directives. It prints each +identifier on a line, followed by a space-separated list of the files in +which that identifier occurs. + +'ifnames' accepts the following options: + +'--help' +'-h' + Print a summary of the command line options and exit. + +'--version' +'-V' + Print the version number of Autoconf and exit. + + +File: autoconf.info, Node: autoconf Invocation, Next: autoreconf Invocation, Prev: ifnames Invocation, Up: Making configure Scripts + +3.4 Using 'autoconf' to Create 'configure' +========================================== + +To create 'configure' from 'configure.ac', run the 'autoconf' program +with no arguments. 'autoconf' processes 'configure.ac' with the 'm4' +macro processor, using the Autoconf macros. If you give 'autoconf' an +argument, it reads that file instead of 'configure.ac' and writes the +configuration script to the standard output instead of to 'configure'. +If you give 'autoconf' the argument '-', it reads from the standard +input instead of 'configure.ac' and writes the configuration script to +the standard output. + + The Autoconf macros are defined in several files. Some of the files +are distributed with Autoconf; 'autoconf' reads them first. Then it +looks for the optional file 'acsite.m4' in the directory that contains +the distributed Autoconf macro files, and for the optional file +'aclocal.m4' in the current directory. Those files can contain your +site's or the package's own Autoconf macro definitions (*note Writing +Autoconf Macros::, for more information). If a macro is defined in more +than one of the files that 'autoconf' reads, the last definition it +reads overrides the earlier ones. + + 'autoconf' accepts the following options: + +'--help' +'-h' + Print a summary of the command line options and exit. + +'--version' +'-V' + Print the version number of Autoconf and exit. + +'--verbose' +'-v' + Report processing steps. + +'--debug' +'-d' + Don't remove the temporary files. + +'--autoconf-dir=DIR' +'-A DIR' + Override the location where the installed Autoconf data files are + looked for. You can also set the 'AC_MACRODIR' environment + variable to a directory; this option overrides the environment + variable. + + This option is rarely needed and dangerous; it is only used when + one plays with different versions of Autoconf simultaneously. + +'--localdir=DIR' +'-l DIR' + Look for the package file 'aclocal.m4' in directory DIR instead of + in the current directory. + +'--output=FILE' +'-o FILE' + Save output (script or trace) to FILE. The file '-' stands for the + standard output. + +'--warnings=CATEGORY' +'-W CATEGORY' + Report the warnings related to CATEGORY (which can actually be a + comma separated list). *Note Reporting Messages::, macro + 'AC_DIAGNOSE', for a comprehensive list of categories. Special + values include: + + 'all' + report all the warnings + + 'none' + report none + + 'error' + treats warnings as errors + + 'no-CATEGORY' + disable warnings falling into CATEGORY + + Warnings about 'syntax' are enabled by default, and the environment + variable 'WARNINGS', a comma separated list of categories, is + honored. 'autoconf -W CATEGORY' will actually behave as if you had + run: + + autoconf --warnings=syntax,$WARNINGS,CATEGORY + + If you want to disable 'autoconf''s defaults and 'WARNINGS', but + (for example) enable the warnings about obsolete constructs, you + would use '-W none,obsolete'. + + 'autoconf' displays a back trace for errors, but not for warnings; + if you want them, just pass '-W error'. For instance, on this + 'configure.ac': + + AC_DEFUN([INNER], + [AC_TRY_RUN([true])]) + + AC_DEFUN([OUTER], + [INNER]) + + AC_INIT + OUTER + + you get: + + $ autoconf -Wcross + configure.ac:8: warning: AC_TRY_RUN called without default \ + to allow cross compiling + $ autoconf -Wcross,error + configure.ac:8: error: AC_TRY_RUN called without default \ + to allow cross compiling + acgeneral.m4:3044: AC_TRY_RUN is expanded from... + configure.ac:2: INNER is expanded from... + configure.ac:5: OUTER is expanded from... + configure.ac:8: the top level + +'--trace=MACRO[:FORMAT]' +'-t MACRO[:FORMAT]' + Do not create the 'configure' script, but list the calls to MACRO + according to the FORMAT. Multiple '--trace' arguments can be used + to list several macros. Multiple '--trace' arguments for a single + macro are not cumulative; instead, you should just make FORMAT as + long as needed. + + The FORMAT is a regular string, with newlines if desired, and + several special escape codes. It defaults to '$f:$l:$n:$%'; see + below for details on the FORMAT. + +'--initialization' +'-i' + By default, '--trace' does not trace the initialization of the + Autoconf macros (typically the 'AC_DEFUN' definitions). This + results in a noticeable speedup, but can be disabled by this + option. + + It is often necessary to check the content of a 'configure.ac' file, +but parsing it yourself is extremely fragile and error-prone. It is +suggested that you rely upon '--trace' to scan 'configure.ac'. + + The FORMAT of '--trace' can use the following special escapes: + +'$$' + The character '$'. + +'$f' + The filename from which MACRO is called. + +'$l' + The line number from which MACRO is called. + +'$d' + The depth of the MACRO call. This is an M4 technical detail that + you probably don't want to know about. + +'$n' + The name of the MACRO. + +'$NUM' + The NUMth argument of the call to MACRO. + +'$@' +'$SEP@' +'${SEPARATOR}@' + All the arguments passed to MACRO, separated by the character SEP + or the string SEPARATOR (',' by default). Each argument is quoted, + i.e. enclosed in a pair of square brackets. + +'$*' +'$SEP*' +'${SEPARATOR}*' + As above, but the arguments are not quoted. + +'$%' +'$SEP%' +'${SEPARATOR}%' + As above, but the arguments are not quoted, all new line characters + in the arguments are smashed, and the default separator is ':'. + + The escape '$%' produces single-line trace outputs (unless you put + newlines in the 'separator'), while '$@' and '$*' do not. + + For instance, to find the list of variables that are substituted, +use: + + $ autoconf -t AC_SUBST + configure.ac:2:AC_SUBST:ECHO_C + configure.ac:2:AC_SUBST:ECHO_N + configure.ac:2:AC_SUBST:ECHO_T + More traces deleted + +The example below highlights the difference between '$@', '$*', and +*$%*. + + $ cat configure.ac + AC_DEFINE(This, is, [an + [example]]) + $ autoconf -t 'AC_DEFINE:@: $@ + *: $* + $: $%' + @: [This],[is],[an + [example]] + *: This,is,an + [example] + $: This:is:an [example] + +The FORMAT gives you a lot of freedom: + + $ autoconf -t 'AC_SUBST:$$ac_subst{"$1"} = "$f:$l";' + $ac_subst{"ECHO_C"} = "configure.ac:2"; + $ac_subst{"ECHO_N"} = "configure.ac:2"; + $ac_subst{"ECHO_T"} = "configure.ac:2"; + More traces deleted + +A long SEPARATOR can be used to improve the readability of complex +structures, and to ease its parsing (for instance when no single +character is suitable as a separator)): + + $ autoconf -t 'AM_MISSING_PROG:${|:::::|}*' + AUTOCONF|:::::|autoconf|:::::|$missing_dir + More traces deleted + + +File: autoconf.info, Node: autoreconf Invocation, Prev: autoconf Invocation, Up: Making configure Scripts + +3.5 Using 'autoreconf' to Update 'configure' Scripts +==================================================== + +If you have a lot of Autoconf-generated 'configure' scripts, the +'autoreconf' program can save you some work. It runs 'autoconf' (and +'autoheader', where appropriate) repeatedly to remake the Autoconf +'configure' scripts and configuration header templates in the directory +tree rooted at the current directory. By default, it only remakes those +files that are older than their 'configure.ac' or (if present) +'aclocal.m4'. Since 'autoheader' does not change the timestamp of its +output file if the file wouldn't be changing, this is not necessarily +the minimum amount of work. If you install a new version of Autoconf, +you can make 'autoreconf' remake _all_ of the files by giving it the +'--force' option. + + If you give 'autoreconf' the '--autoconf-dir=DIR' or '--localdir=DIR' +options, it passes them down to 'autoconf' and 'autoheader' (with +relative paths adjusted properly). + + 'autoreconf' does not support having, in the same directory tree, +both directories that are parts of a larger package (sharing +'aclocal.m4' and 'acconfig.h') and directories that are independent +packages (each with their own 'aclocal.m4' and 'acconfig.h'). It +assumes that they are all part of the same package if you use +'--localdir', or that each directory is a separate package if you don't +use it. This restriction may be removed in the future. + + *Note Automatic Remaking::, for 'Makefile' rules to automatically +remake 'configure' scripts when their source files change. That method +handles the timestamps of configuration header templates properly, but +does not pass '--autoconf-dir=DIR' or '--localdir=DIR'. + +'autoreconf' accepts the following options: + +'--help' +'-h' + Print a summary of the command line options and exit. + +'--version' +'-V' + Print the version number of Autoconf and exit. + +'--verbose' + Print the name of each directory where 'autoreconf' runs 'autoconf' + (and 'autoheader', if appropriate). + +'--debug' +'-d' + Don't remove the temporary files. + +'--force' +'-f' + Remake even 'configure' scripts and configuration headers that are + newer than their input files ('configure.ac' and, if present, + 'aclocal.m4'). + +'--install' +'-i' + Copy missing auxiliary files. This option is similar to the option + '--add-missing' in other tools. + +'--symlink' +'-s' + Instead of copying missing auxiliary files, install symbolic links. + +'--localdir=DIR' +'-l DIR' + Have 'autoconf' and 'autoheader' look for the package files + 'aclocal.m4' and ('autoheader' only) 'acconfig.h' (but not + 'FILE.top' and 'FILE.bot') in directory DIR instead of in the + directory containing each 'configure.ac'. + +'--autoconf-dir=DIR' +'-A DIR' + Override the location where the installed Autoconf data files are + looked for. You can also set the 'AC_MACRODIR' environment + variable to a directory; this option overrides the environment + variable. + + This option is rarely needed and dangerous; it is only used when + one plays with different versions of Autoconf simultaneously. + +'--m4dir=DIR' +'-M DIR' + Specify location of additional macro files ('m4' by default). + + +File: autoconf.info, Node: Setup, Next: Existing Tests, Prev: Making configure Scripts, Up: Top + +4 Initialization and Output Files +********************************* + +Autoconf-generated 'configure' scripts need some information about how +to initialize, such as how to find the package's source files; and about +the output files to produce. The following sections describe +initialization and the creation of output files. + +* Menu: + +* Notices:: Copyright, version numbers in 'configure' +* Input:: Where Autoconf should find files +* Output:: Outputting results from the configuration +* Configuration Actions:: Preparing the output based on results +* Configuration Files:: Creating output files +* Makefile Substitutions:: Using output variables in 'Makefile's +* Configuration Headers:: Creating a configuration header file +* Configuration Commands:: Running arbitrary instantiation commands +* Configuration Links:: Links depending from the configuration +* Subdirectories:: Configuring independent packages together +* Default Prefix:: Changing the default installation prefix + + +File: autoconf.info, Node: Notices, Next: Input, Prev: Setup, Up: Setup + +4.1 Notices in 'configure' +========================== + +The following macros manage version numbers for 'configure' scripts. +Using them is optional. + + -- Macro: AC_PREREQ (VERSION) + Ensure that a recent enough version of Autoconf is being used. If + the version of Autoconf being used to create 'configure' is earlier + than VERSION, print an error message to the standard error output + and do not create 'configure'. For example: + + AC_PREREQ(2.52.20231210) + + This macro is the only macro that may be used before 'AC_INIT', but + for consistency, you are invited not to do so. + + -- Macro: AC_COPYRIGHT (COPYRIGHT-NOTICE) + State that, in addition to the Free Software Foundation's copyright + on the Autoconf macros, parts of your 'configure' are covered by + the COPYRIGHT-NOTICE. + + The COPYRIGHT-NOTICE will show up in both the head of 'configure' + and in 'configure --version'. + + -- Macro: AC_REVISION (REVISION-INFO) + Copy revision stamp REVISION-INFO into the 'configure' script, with + any dollar signs or double-quotes removed. This macro lets you put + a revision stamp from 'configure.ac' into 'configure' without RCS + or 'cvs' changing it when you check in 'configure'. That way, you + can determine easily which revision of 'configure.ac' a particular + 'configure' corresponds to. + + For example, this line in 'configure.ac': + + AC_REVISION($Revision: 1.77 $) + + produces this in 'configure': + + #! /bin/sh + # From configure.ac Revision: 1.30 + + +File: autoconf.info, Node: Input, Next: Output, Prev: Notices, Up: Setup + +4.2 Finding 'configure' Input +============================= + +Every 'configure' script must call 'AC_INIT' before doing anything else. +The only other required macro is 'AC_OUTPUT' (*note Output::). + + -- Macro: AC_INIT (PACKAGE, VERSION, [BUG-REPORT-ADDRESS]) + Process any command-line arguments and perform various + initializations and verifications. Set the name of the PACKAGE and + its VERSION. The optional argument BUG-REPORT-ADDRESS should be + the email to which users should send bug reports. + + -- Macro: AC_CONFIG_SRCDIR (UNIQUE-FILE-IN-SOURCE-DIR) + UNIQUE-FILE-IN-SOURCE-DIR is some file that is in the package's + source directory; 'configure' checks for this file's existence to + make sure that the directory that it is told contains the source + code in fact does. Occasionally people accidentally specify the + wrong directory with '--srcdir'; this is a safety check. *Note + configure Invocation::, for more information. + + Packages that do manual configuration or use the 'install' program +might need to tell 'configure' where to find some other shell scripts by +calling 'AC_CONFIG_AUX_DIR', though the default places it looks are +correct for most cases. + + -- Macro: AC_CONFIG_AUX_DIR (DIR) + Use the auxiliary build tools (e.g., 'install-sh', 'config.sub', + 'config.guess', Cygnus 'configure', Automake and Libtool scripts + etc.) that are in directory DIR. These are auxiliary files used + in configuration. DIR can be either absolute or relative to + 'SRCDIR'. The default is 'SRCDIR' or 'SRCDIR/..' or + 'SRCDIR/../..', whichever is the first that contains 'install-sh'. + The other files are not checked for, so that using + 'AC_PROG_INSTALL' does not automatically require distributing the + other auxiliary files. It checks for 'install.sh' also, but that + name is obsolete because some 'make' have a rule that creates + 'install' from it if there is no 'Makefile'. + + +File: autoconf.info, Node: Output, Next: Configuration Actions, Prev: Input, Up: Setup + +4.3 Outputting Files +==================== + +Every Autoconf-generated 'configure' script must finish by calling +'AC_OUTPUT'. It is the macro that generates 'config.status', which will +create the 'Makefile's and any other files resulting from configuration. +The only other required macro is 'AC_INIT' (*note Input::). + + -- Macro: AC_OUTPUT + Generate 'config.status' and launch it. Call this macro once, at + the end of 'configure.ac'. + + 'config.status' will take all the configuration actions: all the + output files (see *note Configuration Files::, macro + 'AC_CONFIG_FILES'), header files (see *note Configuration + Headers::, macro 'AC_CONFIG_HEADERS'), commands (see *note + Configuration Commands::, macro 'AC_CONFIG_COMMANDS'), links (see + *note Configuration Links::, macro 'AC_CONFIG_LINKS'), + subdirectories to configure (see *note Subdirectories::, macro + 'AC_CONFIG_SUBDIRS') are honored. + + Historically, the usage of 'AC_OUTPUT' was somewhat different. *Note +Obsolete Macros::, for a description of the arguments that 'AC_OUTPUT' +used to support. + + If you run 'make' on subdirectories, you should run it using the +'make' variable 'MAKE'. Most versions of 'make' set 'MAKE' to the name +of the 'make' program plus any options it was given. (But many do not +include in it the values of any variables set on the command line, so +those are not passed on automatically.) Some old versions of 'make' do +not set this variable. The following macro allows you to use it even +with those versions. + + -- Macro: AC_PROG_MAKE_SET + If 'make' predefines the variable 'MAKE', define output variable + 'SET_MAKE' to be empty. Otherwise, define 'SET_MAKE' to contain + 'MAKE=make'. Calls 'AC_SUBST' for 'SET_MAKE'. + + To use this macro, place a line like this in each 'Makefile.in' that +runs 'MAKE' on other directories: + + @SET_MAKE@ + + +File: autoconf.info, Node: Configuration Actions, Next: Configuration Files, Prev: Output, Up: Setup + +4.4 Taking Configuration Actions +================================ + +'configure' is designed so that it appears to do everything itself, but +there is actually a hidden slave: 'config.status'. 'configure' is in +charge of examining your system, but it is 'config.status' that actually +takes the proper actions based on the results of 'configure'. The most +typical task of 'config.status' is to _instantiate_ files. + + This section describes the common behavior of the four standard +instantiating macros: 'AC_CONFIG_FILES', 'AC_CONFIG_HEADERS', +'AC_CONFIG_COMMANDS' and 'AC_CONFIG_LINKS'. They all have this +prototype: + + AC_CONFIG_FOOS(TAG..., [COMMANDS], [INIT-CMDS]) + +where the arguments are: + +TAG... + A whitespace-separated list of tags, which are typically the names + of the files to instantiate. + +COMMANDS + Shell commands output literally into 'config.status', and + associated with a tag that the user can use to tell 'config.status' + which the commands to run. The commands are run each time a TAG + request is given to 'config.status'; typically, each time the file + 'TAG' is created. + +INIT-CMDS + Shell commands output _unquoted_ near the beginning of + 'config.status', and executed each time 'config.status' runs + (regardless of the tag). Because they are unquoted, for example, + '$var' will be output as the value of 'var'. INIT-CMDS is + typically used by 'configure' to give 'config.status' some + variables it needs to run the COMMANDS. + + All these macros can be called multiple times, with different TAGs, +of course! + + You are encouraged to use literals as TAGS. In particular, you +should avoid + + ... && my_foos="$my_foos fooo" + ... && my_foos="$my_foos foooo" + AC_CONFIG_FOOS($my_foos) + +and use this instead: + + ... && AC_CONFIG_FOOS(fooo) + ... && AC_CONFIG_FOOS(foooo) + + The macro 'AC_CONFIG_FILES' and 'AC_CONFIG_HEADERS' use specials +TAGs: they may have the form 'OUTPUT' or 'OUTPUT:INPUTS'. The file +OUTPUT is instantiated from its templates, INPUTS if specified, +defaulting to 'OUTPUT.in'. + + For instance 'AC_CONFIG_FILES(Makefile:boiler/top.mk:boiler/bot.mk)' +asks for the creation of 'Makefile' that will be the expansion of the +output variables in the concatenation of 'boiler/top.mk' and +'boiler/bot.mk'. + + The special value '-' might be used to denote the standard output +when used in OUTPUT, or the standard input when used in the INPUTS. You +most probably don't need to use this in 'configure.ac', but it is +convenient when using the command line interface of './config.status', +see *note config.status Invocation::, for more details. + + The INPUTS may be absolute or relative filenames. In the latter case +they are first looked for in the build tree, and then in the source +tree. + + +File: autoconf.info, Node: Configuration Files, Next: Makefile Substitutions, Prev: Configuration Actions, Up: Setup + +4.5 Creating Configuration Files +================================ + +Be sure to read the previous section, *note Configuration Actions::. + + -- Macro: AC_CONFIG_FILES (FILE..., [CMDS], [INIT-CMDS]) + Make 'AC_OUTPUT' create each 'FILE' by copying an input file (by + default 'FILE.in'), substituting the output variable values. This + macro is one of the instantiating macros, see *note Configuration + Actions::. *Note Makefile Substitutions::, for more information on + using output variables. *Note Setting Output Variables::, for more + information on creating them. This macro creates the directory + that the file is in if it doesn't exist. Usually, 'Makefile's are + created this way, but other files, such as '.gdbinit', can be + specified as well. + + Typical calls to 'AC_CONFIG_FILES' look like this: + + AC_CONFIG_FILES(Makefile src/Makefile man/Makefile X/Imakefile) + AC_CONFIG_FILES(autoconf, chmod +x autoconf) + + You can override an input file name by appending to FILE a + colon-separated list of input files. Examples: + + AC_CONFIG_FILES(Makefile:boiler/top.mk:boiler/bot.mk + lib/Makefile:boiler/lib.mk) + + Doing this allows you to keep your file names acceptable to MS-DOS, + or to prepend and/or append boilerplate to the file. + + +File: autoconf.info, Node: Makefile Substitutions, Next: Configuration Headers, Prev: Configuration Files, Up: Setup + +4.6 Substitutions in Makefiles +============================== + +Each subdirectory in a distribution that contains something to be +compiled or installed should come with a file 'Makefile.in', from which +'configure' will create a 'Makefile' in that directory. To create a +'Makefile', 'configure' performs a simple variable substitution, +replacing occurrences of '@VARIABLE@' in 'Makefile.in' with the value +that 'configure' has determined for that variable. Variables that are +substituted into output files in this way are called "output variables". +They are ordinary shell variables that are set in 'configure'. To make +'configure' substitute a particular variable into the output files, the +macro 'AC_SUBST' must be called with that variable name as an argument. +Any occurrences of '@VARIABLE@' for other variables are left unchanged. +*Note Setting Output Variables::, for more information on creating +output variables with 'AC_SUBST'. + + A software package that uses a 'configure' script should be +distributed with a file 'Makefile.in', but no 'Makefile'; that way, the +user has to properly configure the package for the local system before +compiling it. + + *Note Makefile Conventions: (standards)Makefile Conventions, for more +information on what to put in 'Makefile's. + +* Menu: + +* Preset Output Variables:: Output variables that are always set +* Installation Directory Variables:: Other preset output variables +* Build Directories:: Supporting multiple concurrent compiles +* Automatic Remaking:: Makefile rules for configuring + + +File: autoconf.info, Node: Preset Output Variables, Next: Installation Directory Variables, Prev: Makefile Substitutions, Up: Makefile Substitutions + +4.6.1 Preset Output Variables +----------------------------- + +Some output variables are preset by the Autoconf macros. Some of the +Autoconf macros set additional output variables, which are mentioned in +the descriptions for those macros. *Note Output Variable Index::, for a +complete list of output variables. *Note Installation Directory +Variables::, for the list of the preset ones related to installation +directories. Below are listed the other preset ones. They all are +precious variables (*note Setting Output Variables::, 'AC_ARG_VAR'). + + -- Variable: CFLAGS + Debugging and optimization options for the C compiler. If it is + not set in the environment when 'configure' runs, the default value + is set when you call 'AC_PROG_CC' (or empty if you don't). + 'configure' uses this variable when compiling programs to test for + C features. + + -- Variable: configure_input + A comment saying that the file was generated automatically by + 'configure' and giving the name of the input file. 'AC_OUTPUT' + adds a comment line containing this variable to the top of every + 'Makefile' it creates. For other files, you should reference this + variable in a comment at the top of each input file. For example, + an input shell script should begin like this: + + #! /bin/sh + # @configure_input@ + + The presence of that line also reminds people editing the file that + it needs to be processed by 'configure' in order to be used. + + -- Variable: CPPFLAGS + Header file search directory ('-IDIR') and any other miscellaneous + options for the C and C++ preprocessors and compilers. If it is + not set in the environment when 'configure' runs, the default value + is empty. 'configure' uses this variable when compiling or + preprocessing programs to test for C and C++ features. + + -- Variable: CXXFLAGS + Debugging and optimization options for the C++ compiler. If it is + not set in the environment when 'configure' runs, the default value + is set when you call 'AC_PROG_CXX' (or empty if you don't). + 'configure' uses this variable when compiling programs to test for + C++ features. + + -- Variable: DEFS + '-D' options to pass to the C compiler. If 'AC_CONFIG_HEADERS' is + called, 'configure' replaces '@DEFS@' with '-DHAVE_CONFIG_H' + instead (*note Configuration Headers::). This variable is not + defined while 'configure' is performing its tests, only when + creating the output files. *Note Setting Output Variables::, for + how to check the results of previous tests. + + -- Variable: ECHO_C + -- Variable: ECHO_N + -- Variable: ECHO_T + How does one suppress the trailing newline from 'echo' for + question-answer message pairs? These variables provide a way: + + echo $ECHO_N "And the winner is... $ECHO_C" + sleep 100000000000 + echo "${ECHO_T}dead." + + Some old and uncommon 'echo' implementations offer no means to + achieve this, in which case 'ECHO_T' is set to tab. You might not + want to use it. + + -- Variable: FFLAGS + Debugging and optimization options for the Fortran 77 compiler. If + it is not set in the environment when 'configure' runs, the default + value is set when you call 'AC_PROG_F77' (or empty if you don't). + 'configure' uses this variable when compiling programs to test for + Fortran 77 features. + + -- Variable: LDFLAGS + Stripping ('-s'), path ('-L'), and any other miscellaneous options + for the linker. Don't use this variable to pass library names + ('-l') to the linker, use 'LIBS' instead. If it is not set in the + environment when 'configure' runs, the default value is empty. + 'configure' uses this variable when linking programs to test for C, + C++ and Fortran 77 features. + + -- Variable: LIBS + '-l' options to pass to the linker. The default value is empty, + but some Autoconf macros may prepend extra libraries to this + variable if those libraries are found and provide necessary + functions, see *note Libraries::. 'configure' uses this variable + when linking programs to test for C, C++ and Fortran 77 features. + + -- Variable: srcdir + The directory that contains the source code for that 'Makefile'. + + -- Variable: top_srcdir + The top-level source code directory for the package. In the + top-level directory, this is the same as 'srcdir'. + + +File: autoconf.info, Node: Installation Directory Variables, Next: Build Directories, Prev: Preset Output Variables, Up: Makefile Substitutions + +4.6.2 Installation Directory Variables +-------------------------------------- + +The following variables specify the directories where the package will +be installed, see *note Variables for Installation Directories: +(standards)Directory Variables, for more information. See the end of +this section for details on when and how to use these variables. + + -- Variable: bindir + The directory for installing executables that users run. + + -- Variable: datadir + The directory for installing read-only architecture-independent + data. + + -- Variable: exec_prefix + The installation prefix for architecture-dependent files. By + default it's the same as PREFIX. You should avoid installing + anything directly to EXEC_PREFIX. However, the default value for + directories containing architecture-dependent files should be + relative to EXEC_PREFIX. + + -- Variable: includedir + The directory for installing C header files. + + -- Variable: infodir + The directory for installing documentation in Info format. + + -- Variable: libdir + The directory for installing object code libraries. + + -- Variable: libexecdir + The directory for installing executables that other programs run. + + -- Variable: localstatedir + The directory for installing modifiable single-machine data. + + -- Variable: mandir + The top-level directory for installing documentation in man format. + + -- Variable: oldincludedir + The directory for installing C header files for non-gcc compilers. + + -- Variable: prefix + The common installation prefix for all files. If EXEC_PREFIX is + defined to a different value, PREFIX is used only for + architecture-independent files. + + -- Variable: sbindir + The directory for installing executables that system administrators + run. + + -- Variable: sharedstatedir + The directory for installing modifiable architecture-independent + data. + + -- Variable: sysconfdir + The directory for installing read-only single-machine data. + + Most of these variables have values that rely on 'prefix' or +'exec_prefix'. It is on purpose that the directory output variables +keep them unexpanded: typically '@datadir@' will be replaced by +'${prefix}/share', not '/usr/local/share'. + + This behavior is mandated by the GNU coding standards, so that when +the user runs: + +'make' + she can still specify a different prefix from the one specified to + 'configure', in which case, if needed, the package shall hard code + dependencies to her late desires. + +'make install' + she can specify a different installation location, in which case + the package _must_ still depend on the location which was compiled + in (i.e., never recompile when 'make install' is run). This is an + extremely important feature, as many people may decide to install + all the files of a package grouped together, and then install links + from the final locations to there. + + In order to support these features, it is essential that 'datadir' +remains being defined as '${prefix}/share' to depend upon the current +value of 'prefix'. + + A corollary is that you should not use these variables but in +Makefiles. For instance, instead of trying to evaluate 'datadir' in +'configure' and hardcoding it in Makefiles using e.g. +'AC_DEFINE_UNQUOTED(DATADIR, "$datadir")', you should add +'-DDATADIR="$(datadir)"' to your 'CPPFLAGS'. + + Similarly you should not rely on 'AC_OUTPUT_FILES' to replace +'datadir' and friends in your shell scripts and other files, rather let +'make' manage their replacement. For instance Autoconf ships templates +of its shell scripts ending with '.sh', and uses this Makefile snippet: + + .sh: + rm -f $@ $@.tmp + sed 's,@datadir\@,$(pkgdatadir),g' $< >$@.tmp + chmod +x $@.tmp + mv $@.tmp $@ + + Three things are noteworthy: + +'@datadir\@' + The backslash prevents 'configure' from replacing '@datadir@' in + the sed expression itself. + +'$(pkgdatadir)' + Don't use '@pkgdatadir@'! Use the matching makefile variable + instead. + +',' + Don't use '/' in the sed expression(s) since most probably the + variables you use, such as '$(pkgdatadir)', will contain some. + + +File: autoconf.info, Node: Build Directories, Next: Automatic Remaking, Prev: Installation Directory Variables, Up: Makefile Substitutions + +4.6.3 Build Directories +----------------------- + +You can support compiling a software package for several architectures +simultaneously from the same copy of the source code. The object files +for each architecture are kept in their own directory. + + To support doing this, 'make' uses the 'VPATH' variable to find the +files that are in the source directory. GNU 'make' and most other +recent 'make' programs can do this. Older 'make' programs do not +support 'VPATH'; when using them, the source code must be in the same +directory as the object files. + + To support 'VPATH', each 'Makefile.in' should contain two lines that +look like: + + srcdir = @srcdir@ + VPATH = @srcdir@ + + Do not set 'VPATH' to the value of another variable, for example +'VPATH = $(srcdir)', because some versions of 'make' do not do variable +substitutions on the value of 'VPATH'. + + 'configure' substitutes in the correct value for 'srcdir' when it +produces 'Makefile'. + + Do not use the 'make' variable '$<', which expands to the file name +of the file in the source directory (found with 'VPATH'), except in +implicit rules. (An implicit rule is one such as '.c.o', which tells +how to create a '.o' file from a '.c' file.) Some versions of 'make' do +not set '$<' in explicit rules; they expand it to an empty value. + + Instead, 'Makefile' command lines should always refer to source files +by prefixing them with '$(srcdir)/'. For example: + + time.info: time.texinfo + $(MAKEINFO) $(srcdir)/time.texinfo + + +File: autoconf.info, Node: Automatic Remaking, Prev: Build Directories, Up: Makefile Substitutions + +4.6.4 Automatic Remaking +------------------------ + +You can put rules like the following in the top-level 'Makefile.in' for +a package to automatically update the configuration information when you +change the configuration files. This example includes all of the +optional files, such as 'aclocal.m4' and those related to configuration +header files. Omit from the 'Makefile.in' rules for any of these files +that your package does not use. + + The '$(srcdir)/' prefix is included because of limitations in the +'VPATH' mechanism. + + The 'stamp-' files are necessary because the timestamps of +'config.h.in' and 'config.h' will not be changed if remaking them does +not change their contents. This feature avoids unnecessary +recompilation. You should include the file 'stamp-h.in' your package's +distribution, so 'make' will consider 'config.h.in' up to date. Don't +use 'touch' (*note Limitations of Usual Tools::), rather use 'echo' +(using 'date' would cause needless differences, hence CVS conflicts +etc.). + + $(srcdir)/configure: configure.ac aclocal.m4 + cd $(srcdir) && autoconf + + # autoheader might not change config.h.in, so touch a stamp file. + $(srcdir)/config.h.in: stamp-h.in + $(srcdir)/stamp-h.in: configure.ac aclocal.m4 + cd $(srcdir) && autoheader + echo timestamp > $(srcdir)/stamp-h.in + + config.h: stamp-h + stamp-h: config.h.in config.status + ./config.status + + Makefile: Makefile.in config.status + ./config.status + + config.status: configure + ./config.status --recheck + +(Be careful if you copy these lines directly into your Makefile, as you +will need to convert the indented lines to start with the tab +character.) + + In addition, you should use 'AC_CONFIG_FILES(stamp-h, echo timestamp +> stamp-h)' so 'config.status' will ensure that 'config.h' is considered +up to date. *Note Output::, for more information about 'AC_OUTPUT'. + + *Note config.status Invocation::, for more examples of handling +configuration-related dependencies. + + +File: autoconf.info, Node: Configuration Headers, Next: Configuration Commands, Prev: Makefile Substitutions, Up: Setup + +4.7 Configuration Header Files +============================== + +When a package tests more than a few C preprocessor symbols, the command +lines to pass '-D' options to the compiler can get quite long. This +causes two problems. One is that the 'make' output is hard to visually +scan for errors. More seriously, the command lines can exceed the +length limits of some operating systems. As an alternative to passing +'-D' options to the compiler, 'configure' scripts can create a C header +file containing '#define' directives. The 'AC_CONFIG_HEADERS' macro +selects this kind of output. It should be called right after 'AC_INIT'. + + The package should '#include' the configuration header file before +any other header files, to prevent inconsistencies in declarations (for +example, if it redefines 'const'). Use '#include <config.h>' instead of +'#include "config.h"', and pass the C compiler a '-I.' option (or +'-I..'; whichever directory contains 'config.h'). That way, even if the +source directory is configured itself (perhaps to make a distribution), +other build directories can also be configured without finding the +'config.h' from the source directory. + + -- Macro: AC_CONFIG_HEADERS (HEADER ..., [CMDS], [INIT-CMDS]) + This macro is one of the instantiating macros, see *note + Configuration Actions::. Make 'AC_OUTPUT' create the file(s) in + the whitespace-separated list HEADER containing C preprocessor + '#define' statements, and replace '@DEFS@' in generated files with + '-DHAVE_CONFIG_H' instead of the value of 'DEFS'. The usual name + for HEADER is 'config.h'. + + If HEADER already exists and its contents are identical to what + 'AC_OUTPUT' would put in it, it is left alone. Doing this allows + some changes in configuration without needlessly causing object + files that depend on the header file to be recompiled. + + Usually the input file is named 'HEADER.in'; however, you can + override the input file name by appending to HEADER, a + colon-separated list of input files. Examples: + + AC_CONFIG_HEADERS(config.h:config.hin) + AC_CONFIG_HEADERS(defines.h:defs.pre:defines.h.in:defs.post) + + Doing this allows you to keep your file names acceptable to MS-DOS, + or to prepend and/or append boilerplate to the file. + + *Note Configuration Actions::, for more details on HEADER. + +* Menu: + +* Header Templates:: Input for the configuration headers +* autoheader Invocation:: How to create configuration templates +* Autoheader Macros:: How to specify CPP templates + + +File: autoconf.info, Node: Header Templates, Next: autoheader Invocation, Prev: Configuration Headers, Up: Configuration Headers + +4.7.1 Configuration Header Templates +------------------------------------ + +Your distribution should contain a template file that looks as you want +the final header file to look, including comments, with '#undef' +statements which are used as hooks. For example, suppose your +'configure.ac' makes these calls: + + AC_CONFIG_HEADERS(conf.h) + AC_CHECK_HEADERS(unistd.h) + +Then you could have code like the following in 'conf.h.in'. On systems +that have 'unistd.h', 'configure' will '#define' 'HAVE_UNISTD_H' to 1. +On other systems, the whole line will be commented out (in case the +system predefines that symbol). + + /* Define as 1 if you have unistd.h. */ + #undef HAVE_UNISTD_H + + You can then decode the configuration header using the preprocessor +directives: + + #include <conf.h> + + #if HAVE_UNISTD_H + # include <unistd.h> + #else + /* We are in trouble. */ + #endif + + The use of old form templates, with '#define' instead of '#undef' is +strongly discouraged. + + Since it is a tedious task to keep a template header up to date, you +may use 'autoheader' to generate it, see *note autoheader Invocation::. + + +File: autoconf.info, Node: autoheader Invocation, Next: Autoheader Macros, Prev: Header Templates, Up: Configuration Headers + +4.7.2 Using 'autoheader' to Create 'config.h.in' +------------------------------------------------ + +The 'autoheader' program can create a template file of C '#define' +statements for 'configure' to use. If 'configure.ac' invokes +'AC_CONFIG_HEADERS(FILE)', 'autoheader' creates 'FILE.in'; if multiple +file arguments are given, the first one is used. Otherwise, +'autoheader' creates 'config.h.in'. + + In order to do its job, 'autoheader' needs you to document all of the +symbols that you might use; i.e., there must be at least one 'AC_DEFINE' +or one 'AC_DEFINE_UNQUOTED' using its third argument for each symbol +(*note Defining Symbols::). An additional constraint is that the first +argument of 'AC_DEFINE' must be a literal. Note that all symbols +defined by Autoconf's built-in tests are already documented properly; +you only need to document those that you define yourself. + + You might wonder why 'autoheader' is needed: after all, why would +'configure' need to "patch" a 'config.h.in' to produce a 'config.h' +instead of just creating 'config.h' from scratch? Well, when everything +rocks, the answer is just that we are wasting our time maintaining +'autoheader': generating 'config.h' directly is all that is needed. +When things go wrong, however, you'll be thankful for the existence of +'autoheader'. + + The fact that the symbols are documented is important in order to +_check_ that 'config.h' makes sense. The fact that there is a well +defined list of symbols that should be '#define''d (or not) is also +important for people who are porting packages to environments where +'configure' cannot be run: they just have to _fill in the blanks_. + + But let's come back to the point: 'autoheader''s invocation... + + If you give 'autoheader' an argument, it uses that file instead of +'configure.ac' and writes the header file to the standard output instead +of to 'config.h.in'. If you give 'autoheader' an argument of '-', it +reads the standard input instead of 'configure.ac' and writes the header +file to the standard output. + + 'autoheader' accepts the following options: + +'--help' +'-h' + Print a summary of the command line options and exit. + +'--version' +'-V' + Print the version number of Autoconf and exit. + +'--debug' +'-d' + Don't remove the temporary files. + +'--verbose' +'-v' + Report processing steps. + +'--autoconf-dir=DIR' +'-A DIR' + Override the location where the installed Autoconf data files are + looked for. You can also set the 'AC_MACRODIR' environment + variable to a directory; this option overrides the environment + variable. + + This option is rarely needed and dangerous; it is only used when + one plays with different versions of Autoconf simultaneously. + +'--localdir=DIR' +'-l DIR' + Look for the package files 'aclocal.m4' and 'acconfig.h' (but not + 'FILE.top' and 'FILE.bot') in directory DIR instead of in the + current directory. + +'--warnings=CATEGORY' +'-W CATEGORY' + Report the warnings related to CATEGORY (which can actually be a + comma separated list). Current categories include: + + 'obsolete' + report the uses of obsolete constructs + + 'all' + report all the warnings + + 'none' + report none + + 'error' + treats warnings as errors + + 'no-CATEGORY' + disable warnings falling into CATEGORY + + +File: autoconf.info, Node: Autoheader Macros, Prev: autoheader Invocation, Up: Configuration Headers + +4.7.3 Autoheader Macros +----------------------- + +'autoheader' scans 'configure.ac' and figures out which C preprocessor +symbols it might define. It knows how to generate templates for symbols +defined by 'AC_CHECK_HEADERS', 'AC_CHECK_FUNCS' etc., but if you +'AC_DEFINE' any additional symbol, you must define a template for it. +If there are missing templates, 'autoheader' fails with an error +message. + + The simplest way to create a template for a SYMBOL is to supply the +DESCRIPTION argument to an 'AC_DEFINE(SYMBOL)'; see *note Defining +Symbols::. You may also use one of the following macros. + + -- Macro: AH_VERBATIM (KEY, TEMPLATE) + Tell 'autoheader' to include the TEMPLATE as-is in the header + template file. This TEMPLATE is associated with the KEY, which is + used to sort all the different templates and guarantee their + uniqueness. It should be the symbol that can be 'AC_DEFINE''d. + + For example: + + AH_VERBATIM([_GNU_SOURCE], + [/* Enable GNU extensions on systems that have them. */ + #ifndef _GNU_SOURCE + # define _GNU_SOURCE + #endif]) + + -- Macro: AH_TEMPLATE (KEY, DESCRIPTION) + Tell 'autoheader' to generate a template for KEY. This macro + generates standard templates just like 'AC_DEFINE' when a + DESCRIPTION is given. + + For example: + + AH_TEMPLATE([CRAY_STACKSEG_END], + [Define to one of _getb67, GETB67, getb67 + for Cray-2 and Cray-YMP systems. This + function is required for alloca.c support + on those systems.]) + + will generate the following template, with the description properly + justified. + + /* Define to one of _getb67, GETB67, getb67 for Cray-2 and + Cray-YMP systems. This function is required for alloca.c + support on those systems. */ + #undef CRAY_STACKSEG_END + + -- Macro: AH_TOP (TEXT) + Include TEXT at the top of the header template file. + + -- Macro: AH_BOTTOM (TEXT) + Include TEXT at the bottom of the header template file. + + +File: autoconf.info, Node: Configuration Commands, Next: Configuration Links, Prev: Configuration Headers, Up: Setup + +4.8 Running Arbitrary Configuration Commands +============================================ + +You execute arbitrary commands either before, during and after +'config.status' is run. The three following macros accumulate the +commands to run when they are called multiple times. +'AC_CONFIG_COMMANDS' replaces the obsolete macro 'AC_OUTPUT_COMMANDS', +see *note Obsolete Macros::, for details. + + -- Macro: AC_CONFIG_COMMANDS (TAG..., [CMDS], [INIT-CMDS]) + Specify additional shell commands to run at the end of + 'config.status', and shell commands to initialize any variables + from 'configure'. Associate the commands to the TAG. Since + typically the CMDS create a file, TAG should naturally be the name + of that file. This macro is one of the instantiating macros, see + *note Configuration Actions::. + + Here is an unrealistic example: + fubar=42 + AC_CONFIG_COMMANDS(fubar, + [echo this is extra $fubar, and so on.], + [fubar=$fubar]) + + Here is a better one: + AC_CONFIG_COMMANDS(time-stamp, [date >time-stamp]) + + -- Macro: AC_CONFIG_COMMANDS_PRE (CMDS) + Execute the CMDS right before creating 'config.status'. A typical + use is computing values derived from variables built during the + execution of 'configure': + + AC_CONFIG_COMMANDS_PRE( + [LTLIBOBJS=`echo $LIBOBJS | sed 's/\.o/\.lo/g'` + AC_SUBST(LTLIBOBJS)]) + + -- Macro: AC_CONFIG_COMMANDS_POST (CMDS) + Execute the CMDS right after creating 'config.status'. + + +File: autoconf.info, Node: Configuration Links, Next: Subdirectories, Prev: Configuration Commands, Up: Setup + +4.9 Creating Configuration Links +================================ + +You may find it convenient to create links whose destinations depend +upon results of tests. One can use 'AC_CONFIG_COMMANDS' but the +creation of relative symbolic links can be delicate when the package is +built in another directory than its sources. + + -- Macro: AC_CONFIG_LINKS (DEST:SOURCE..., [CMDS], [INIT-CMDS]) + Make 'AC_OUTPUT' link each of the existing files SOURCE to the + corresponding link name DEST. Makes a symbolic link if possible, + otherwise a hard link. The DEST and SOURCE names should be + relative to the top level source or build directory. This macro is + one of the instantiating macros, see *note Configuration Actions::. + + For example, this call: + + AC_CONFIG_LINKS(host.h:config/$machine.h + object.h:config/$obj_format.h) + + creates in the current directory 'host.h' as a link to + 'SRCDIR/config/$machine.h', and 'object.h' as a link to + 'SRCDIR/config/$obj_format.h'. + + The tempting value '.' for DEST is invalid: it makes it impossible + for 'config.status' to guess the links to establish. + + One can then run: + ./config.status host.h object.h + to create the links. + + +File: autoconf.info, Node: Subdirectories, Next: Default Prefix, Prev: Configuration Links, Up: Setup + +4.10 Configuring Other Packages in Subdirectories +================================================= + +In most situations, calling 'AC_OUTPUT' is sufficient to produce +'Makefile's in subdirectories. However, 'configure' scripts that +control more than one independent package can use 'AC_CONFIG_SUBDIRS' to +run 'configure' scripts for other packages in subdirectories. + + -- Macro: AC_CONFIG_SUBDIRS (DIR ...) + Make 'AC_OUTPUT' run 'configure' in each subdirectory DIR in the + given whitespace-separated list. Each DIR should be a literal, + i.e., please do not use: + + if test "$package_foo_enabled" = yes; then + $my_subdirs="$my_subdirs foo" + fi + AC_CONFIG_SUBDIRS($my_subdirs) + + because this prevents './configure --help=recursive' from + displaying the options of the package 'foo'. Rather, you should + write: + + if test "$package_foo_enabled" = yes then; + AC_CONFIG_SUBDIRS(foo) + fi + + If a given DIR is not found, no error is reported, so a 'configure' + script can configure whichever parts of a large source tree are + present. If a given DIR contains 'configure.gnu', it is run + instead of 'configure'. This is for packages that might use a + non-autoconf script 'Configure', which can't be called through a + wrapper 'configure' since it would be the same file on + case-insensitive filesystems. Likewise, if a DIR contains + 'configure.ac' but no 'configure', the Cygnus 'configure' script + found by 'AC_CONFIG_AUX_DIR' is used. + + The subdirectory 'configure' scripts are given the same command + line options that were given to this 'configure' script, with minor + changes if needed (e.g., to adjust a relative path for the cache + file or source directory). This macro also sets the output + variable 'subdirs' to the list of directories 'DIR ...'. + 'Makefile' rules can use this variable to determine which + subdirectories to recurse into. This macro may be called multiple + times. + + +File: autoconf.info, Node: Default Prefix, Prev: Subdirectories, Up: Setup + +4.11 Default Prefix +=================== + +By default, 'configure' sets the prefix for files it installs to +'/usr/local'. The user of 'configure' can select a different prefix +using the '--prefix' and '--exec-prefix' options. There are two ways to +change the default: when creating 'configure', and when running it. + + Some software packages might want to install in a directory besides +'/usr/local' by default. To accomplish that, use the +'AC_PREFIX_DEFAULT' macro. + + -- Macro: AC_PREFIX_DEFAULT (PREFIX) + Set the default installation prefix to PREFIX instead of + '/usr/local'. + + It may be convenient for users to have 'configure' guess the +installation prefix from the location of a related program that they +have already installed. If you wish to do that, you can call +'AC_PREFIX_PROGRAM'. + + -- Macro: AC_PREFIX_PROGRAM (PROGRAM) + If the user did not specify an installation prefix (using the + '--prefix' option), guess a value for it by looking for PROGRAM in + 'PATH', the way the shell does. If PROGRAM is found, set the + prefix to the parent of the directory containing PROGRAM; otherwise + leave the prefix specified in 'Makefile.in' unchanged. For + example, if PROGRAM is 'gcc' and the 'PATH' contains + '/usr/local/gnu/bin/gcc', set the prefix to '/usr/local/gnu'. + + +File: autoconf.info, Node: Existing Tests, Next: Writing Tests, Prev: Setup, Up: Top + +5 Existing Tests +**************** + +These macros test for particular system features that packages might +need or want to use. If you need to test for a kind of feature that +none of these macros check for, you can probably do it by calling +primitive test macros with appropriate arguments (*note Writing +Tests::). + + These tests print messages telling the user which feature they're +checking for, and what they find. They cache their results for future +'configure' runs (*note Caching Results::). + + Some of these macros set output variables. *Note Makefile +Substitutions::, for how to get their values. The phrase "define NAME" +is used below as a shorthand to mean "define C preprocessor symbol NAME +to the value 1". *Note Defining Symbols::, for how to get those symbol +definitions into your program. + +* Menu: + +* Common Behavior:: Macros' standard schemes +* Alternative Programs:: Selecting between alternative programs +* Files:: Checking for the existence of files +* Libraries:: Library archives that might be missing +* Library Functions:: C library functions that might be missing +* Header Files:: Header files that might be missing +* Declarations:: Declarations that may be missing +* Structures:: Structures or members that might be missing +* Types:: Types that might be missing +* Compilers and Preprocessors:: Checking for compiling programs +* System Services:: Operating system services +* UNIX Variants:: Special kludges for specific UNIX variants + + +File: autoconf.info, Node: Common Behavior, Next: Alternative Programs, Prev: Existing Tests, Up: Existing Tests + +5.1 Common Behavior +=================== + +Much effort has been expended to make Autoconf easy to learn. The most +obvious way to reach this goal is simply to enforce standard interfaces +and behaviors, avoiding exceptions as much as possible. Because of +history and inertia, unfortunately, there are still too many exceptions +in Autoconf; nevertheless, this section describes some of the common +rules. + +* Menu: + +* Standard Symbols:: Symbols defined by the macros +* Default Includes:: Includes used by the generic macros + + +File: autoconf.info, Node: Standard Symbols, Next: Default Includes, Prev: Common Behavior, Up: Common Behavior + +5.1.1 Standard Symbols +---------------------- + +All the generic macros that 'AC_DEFINE' a symbol as a result of their +test transform their ARGUMENTs to a standard alphabet. First, ARGUMENT +is converted to upper case and any asterisks ('*') are each converted to +'P'. Any remaining characters that are not alphanumeric are converted +to underscores. + + For instance, + + AC_CHECK_TYPES(struct $Expensive*) + +will define the symbol 'HAVE_STRUCT__EXPENSIVEP' if the check succeeds. + + +File: autoconf.info, Node: Default Includes, Prev: Standard Symbols, Up: Common Behavior + +5.1.2 Default Includes +---------------------- + +Several tests depend upon a set of header files. Since these headers +are not universally available, tests actually have to provide a set of +protected includes, such as: + + #if TIME_WITH_SYS_TIME + # include <sys/time.h> + # include <time.h> + #else + # if HAVE_SYS_TIME_H + # include <sys/time.h> + # else + # include <time.h> + # endif + #endif + +Unless you know exactly what you are doing, you should avoid using +unconditional includes, and check the existence of the headers you +include beforehand (*note Header Files::). + + Most generic macros provide the following default set of includes: + + #include <stdio.h> + #if HAVE_SYS_TYPES_H + # include <sys/types.h> + #endif + #if HAVE_SYS_STAT_H + # include <sys/stat.h> + #endif + #if STDC_HEADERS + # include <stdlib.h> + # include <stddef.h> + #else + # if HAVE_STDLIB_H + # include <stdlib.h> + # endif + #endif + #if HAVE_STRING_H + # if !STDC_HEADERS && HAVE_MEMORY_H + # include <memory.h> + # endif + # include <string.h> + #endif + #if HAVE_STRINGS_H + # include <strings.h> + #endif + #if HAVE_INTTYPES_H + # include <inttypes.h> + #else + # if HAVE_STDINT_H + # include <stdint.h> + # endif + #endif + #if HAVE_UNISTD_H + # include <unistd.h> + #endif + + If the default includes are used, then Autoconf will automatically +check for the presence of these headers and their compatibility, i.e., +you don't need to run 'AC_HEADERS_STDC', nor check for 'stdlib.h' etc. + + These headers are checked for in the same order as they are included. +For instance, on some systems 'string.h' and 'strings.h' both exist, but +conflict. Then 'HAVE_STRING_H' will be defined, but 'HAVE_STRINGS_H' +won't. + + +File: autoconf.info, Node: Alternative Programs, Next: Files, Prev: Common Behavior, Up: Existing Tests + +5.2 Alternative Programs +======================== + +These macros check for the presence or behavior of particular programs. +They are used to choose between several alternative programs and to +decide what to do once one has been chosen. If there is no macro +specifically defined to check for a program you need, and you don't need +to check for any special properties of it, then you can use one of the +general program-check macros. + +* Menu: + +* Particular Programs:: Special handling to find certain programs +* Generic Programs:: How to find other programs + + +File: autoconf.info, Node: Particular Programs, Next: Generic Programs, Prev: Alternative Programs, Up: Alternative Programs + +5.2.1 Particular Program Checks +------------------------------- + +These macros check for particular programs--whether they exist, and in +some cases whether they support certain features. + + -- Macro: AC_PROG_AWK + Check for 'mawk', 'gawk', 'nawk', and 'awk', in that order, and set + output variable 'AWK' to the first one that is found. It tries + 'mawk' first because that is reported to be the fastest + implementation. + + -- Macro: AC_PROG_EGREP + Check for 'grep -E', 'egrep' in that order, and set output variable + 'EGREP' to the first one that is found. + + -- Macro: AC_PROG_FGREP + Check for 'grep -F', 'fgrep' in that order, and set output variable + 'FGREP' to the first one that is found. + + -- Macro: AC_PROG_GREP + Check for 'grep', 'ggrep' in that order, and set output variable + 'GREP' to the first one that is found. + + -- Macro: AC_PROG_INSTALL + Set output variable 'INSTALL' to the path of a BSD compatible + 'install' program, if one is found in the current 'PATH'. + Otherwise, set 'INSTALL' to 'DIR/install-sh -c', checking the + directories specified to 'AC_CONFIG_AUX_DIR' (or its default + directories) to determine DIR (*note Output::). Also set the + variables 'INSTALL_PROGRAM' and 'INSTALL_SCRIPT' to '${INSTALL}' + and 'INSTALL_DATA' to '${INSTALL} -m 644'. + + This macro screens out various instances of 'install' known not to + work. It prefers to find a C program rather than a shell script, + for speed. Instead of 'install-sh', it can also use 'install.sh', + but that name is obsolete because some 'make' programs have a rule + that creates 'install' from it if there is no 'Makefile'. + + Autoconf comes with a copy of 'install-sh' that you can use. If + you use 'AC_PROG_INSTALL', you must include either 'install-sh' or + 'install.sh' in your distribution, or 'configure' will produce an + error message saying it can't find them--even if the system you're + on has a good 'install' program. This check is a safety measure to + prevent you from accidentally leaving that file out, which would + prevent your package from installing on systems that don't have a + BSD-compatible 'install' program. + + If you need to use your own installation program because it has + features not found in standard 'install' programs, there is no + reason to use 'AC_PROG_INSTALL'; just put the file name of your + program into your 'Makefile.in' files. + + -- Macro: AC_PROG_LEX + If 'flex' is found, set output variable 'LEX' to 'flex' and + 'LEXLIB' to '-lfl', if that library is in a standard place. + Otherwise set 'LEX' to 'lex' and 'LEXLIB' to '-ll'. + + Define 'YYTEXT_POINTER' if 'yytext' is a 'char *' instead of a + 'char []'. Also set output variable 'LEX_OUTPUT_ROOT' to the base + of the file name that the lexer generates; usually 'lex.yy', but + sometimes something else. These results vary according to whether + 'lex' or 'flex' is being used. + + You are encouraged to use Flex in your sources, since it is both + more pleasant to use than plain Lex and the C source it produces is + portable. In order to ensure portability, however, you must either + provide a function 'yywrap' or, if you don't use it (e.g., your + scanner has no '#include'-like feature), simply include a + '%noyywrap' statement in the scanner's source. Once this done, the + scanner is portable (unless _you_ felt free to use nonportable + constructs) and does not depend on any library. In this case, and + in this case only, it is suggested that you use this Autoconf + snippet: + + AC_PROG_LEX + if test "$LEX" != flex; then + LEX="$SHELL $missing_dir/missing flex" + AC_SUBST(LEX_OUTPUT_ROOT, lex.yy) + AC_SUBST(LEXLIB, '') + fi + + The shell script 'missing' can be found in the Automake + distribution. + + To ensure backward compatibility, Automake's 'AM_PROG_LEX' invokes + (indirectly) this macro twice, which will cause an annoying but + benign "'AC_PROG_LEX' invoked multiple times" warning. Future + versions of Automake will fix this issue, meanwhile, just ignore + this message. + + -- Macro: AC_PROG_LN_S + If 'ln -s' works on the current file system (the operating system + and file system support symbolic links), set the output variable + 'LN_S' to 'ln -s'; otherwise, if 'ln' works, set 'LN_S' to 'ln' and + otherwise set it to 'cp -p'. + + If you make a link a directory other than the current directory, + its meaning depends on whether 'ln' or 'ln -s' is used. To safely + create links using '$(LN_S)', either find out which form is used + and adjust the arguments, or always invoke 'ln' in the directory + where the link is to be created. + + In other words, it does not work to do: + $(LN_S) foo /x/bar + + Instead, do: + + (cd /x && $(LN_S) foo bar) + + -- Macro: AC_PROG_RANLIB + Set output variable 'RANLIB' to 'ranlib' if 'ranlib' is found, and + otherwise to ':' (do nothing). + + -- Macro: AC_PROG_YACC + If 'byacc' is found, set 'YACC' to 'byacc'. Otherwise, if 'bison' + is found, set output variable 'YACC' to 'bison -y'. Finally, if + neither 'byacc' or 'bison' is found, set 'YACC' to 'yacc'. + + +File: autoconf.info, Node: Generic Programs, Prev: Particular Programs, Up: Alternative Programs + +5.2.2 Generic Program and File Checks +------------------------------------- + +These macros are used to find programs not covered by the "particular" +test macros. If you need to check the behavior of a program as well as +find out whether it is present, you have to write your own test for it +(*note Writing Tests::). By default, these macros use the environment +variable 'PATH'. If you need to check for a program that might not be +in the user's 'PATH', you can pass a modified path to use instead, like +this: + + AC_PATH_PROG(INETD, inetd, /usr/libexec/inetd, + $PATH:/usr/libexec:/usr/sbin:/usr/etc:etc) + + You are strongly encouraged to declare the VARIABLE passed to +'AC_CHECK_PROG' etc. as precious, *Note Setting Output Variables::, +'AC_ARG_VAR', for more details. + + -- Macro: AC_CHECK_PROG (VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND, + [VALUE-IF-NOT-FOUND], [PATH], [REJECT]) + Check whether program PROG-TO-CHECK-FOR exists in 'PATH'. If it is + found, set VARIABLE to VALUE-IF-FOUND, otherwise to + VALUE-IF-NOT-FOUND, if given. Always pass over REJECT (an absolute + file name) even if it is the first found in the search path; in + that case, set VARIABLE using the absolute file name of the + PROG-TO-CHECK-FOR found that is not REJECT. If VARIABLE was + already set, do nothing. Calls 'AC_SUBST' for VARIABLE. + + -- Macro: AC_CHECK_PROGS (VARIABLE, PROGS-TO-CHECK-FOR, + [VALUE-IF-NOT-FOUND], [PATH]) + Check for each program in the whitespace-separated list + PROGS-TO-CHECK-FOR exists on the 'PATH'. If it is found, set + VARIABLE to the name of that program. Otherwise, continue checking + the next program in the list. If none of the programs in the list + are found, set VARIABLE to VALUE-IF-NOT-FOUND; if + VALUE-IF-NOT-FOUND is not specified, the value of VARIABLE is not + changed. Calls 'AC_SUBST' for VARIABLE. + + -- Macro: AC_CHECK_TOOL (VARIABLE, PROG-TO-CHECK-FOR, + [VALUE-IF-NOT-FOUND], [PATH]) + Like 'AC_CHECK_PROG', but first looks for PROG-TO-CHECK-FOR with a + prefix of the host type as determined by 'AC_CANONICAL_HOST', + followed by a dash (*note Canonicalizing::). For example, if the + user runs 'configure --host=i386-gnu', then this call: + AC_CHECK_TOOL(RANLIB, ranlib, :) + sets 'RANLIB' to 'i386-gnu-ranlib' if that program exists in + 'PATH', or otherwise to 'ranlib' if that program exists in 'PATH', + or to ':' if neither program exists. + + -- Macro: AC_CHECK_TOOLS (VARIABLE, PROGS-TO-CHECK-FOR, + [VALUE-IF-NOT-FOUND], [PATH]) + Like 'AC_CHECK_TOOL', each of the tools in the list + PROGS-TO-CHECK-FOR are checked with a prefix of the host type as + determined by 'AC_CANONICAL_HOST', followed by a dash (*note + Canonicalizing::). If none of the tools can be found with a + prefix, then the first one without a prefix is used. If a tool is + found, set VARIABLE to the name of that program. If none of the + tools in the list are found, set VARIABLE to VALUE-IF-NOT-FOUND; if + VALUE-IF-NOT-FOUND is not specified, the value of VARIABLE is not + changed. Calls 'AC_SUBST' for VARIABLE. + + -- Macro: AC_PATH_PROG (VARIABLE, PROG-TO-CHECK-FOR, + [VALUE-IF-NOT-FOUND], [PATH]) + Like 'AC_CHECK_PROG', but set VARIABLE to the entire path of + PROG-TO-CHECK-FOR if found. + + -- Macro: AC_PATH_PROGS (VARIABLE, PROGS-TO-CHECK-FOR, + [VALUE-IF-NOT-FOUND], [PATH]) + Like 'AC_CHECK_PROGS', but if any of PROGS-TO-CHECK-FOR are found, + set VARIABLE to the entire path of the program found. + + -- Macro: AC_PATH_TOOL (VARIABLE, PROG-TO-CHECK-FOR, + [VALUE-IF-NOT-FOUND], [PATH]) + Like 'AC_CHECK_TOOL', but set VARIABLE to the entire path of the + program if it is found. + + +File: autoconf.info, Node: Files, Next: Libraries, Prev: Alternative Programs, Up: Existing Tests + +5.3 Files +========= + +You might also need to check for the existence of files. Before using +these macros, ask yourself whether a run time test might not be a better +solution. Be aware that, like most Autoconf macros, they test a feature +of the host machine, and therefore, they die when cross-compiling. + + -- Macro: AC_CHECK_FILE (FILE, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND]) + Check whether file FILE exists on the native system. If it is + found, execute ACTION-IF-FOUND, otherwise do ACTION-IF-NOT-FOUND, + if given. + + -- Macro: AC_CHECK_FILES (FILES, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND]) + Executes 'AC_CHECK_FILE' once for each file listed in FILES. + Additionally, defines 'HAVE_FILE' (*note Standard Symbols::) for + each file found. + + +File: autoconf.info, Node: Libraries, Next: Library Functions, Prev: Files, Up: Existing Tests + +5.4 Library Files +================= + +The following macros check for the presence of certain C, C++ or Fortran +77 library archive files. + + -- Macro: AC_CHECK_LIB (LIBRARY, FUNCTION, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES]) + Depending on the current language(*note Language Choice::), try to + ensure that the C, C++, or Fortran 77 function FUNCTION is + available by checking whether a test program can be linked with the + library LIBRARY to get the function. LIBRARY is the base name of + the library; e.g., to check for '-lmp', use 'mp' as the LIBRARY + argument. + + ACTION-IF-FOUND is a list of shell commands to run if the link with + the library succeeds; ACTION-IF-NOT-FOUND is a list of shell + commands to run if the link fails. If ACTION-IF-FOUND is not + specified, the default action will prepend '-lLIBRARY' to 'LIBS' + and define 'HAVE_LIBLIBRARY' (in all capitals). This macro is + intended to support building of 'LIBS' in a right-to-left + (least-dependent to most-dependent) fashion such that library + dependencies are satisfied as a natural side-effect of consecutive + tests. Some linkers are very sensitive to library ordering so the + order in which 'LIBS' is generated is important to reliable + detection of libraries. + + If linking with LIBRARY results in unresolved symbols that would be + resolved by linking with additional libraries, give those libraries + as the OTHER-LIBRARIES argument, separated by spaces: e.g. '-lXt + -lX11'. Otherwise, this macro will fail to detect that LIBRARY is + present, because linking the test program will always fail with + unresolved symbols. The OTHER-LIBRARIES argument should be limited + to cases where it is desirable to test for one library in the + presence of another that is not already in 'LIBS'. + + -- Macro: AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES]) + Search for a library defining FUNCTION if it's not already + available. This equates to calling 'AC_TRY_LINK_FUNC' first with + no libraries, then for each library listed in SEARCH-LIBS. + + Add '-lLIBRARY' to 'LIBS' for the first library found to contain + FUNCTION, and run ACTION-IF-FOUND. If the function is not found, + run ACTION-IF-NOT-FOUND. + + If linking with LIBRARY results in unresolved symbols that would be + resolved by linking with additional libraries, give those libraries + as the OTHER-LIBRARIES argument, separated by spaces: e.g. '-lXt + -lX11'. Otherwise, this macro will fail to detect that FUNCTION is + present, because linking the test program will always fail with + unresolved symbols. + + +File: autoconf.info, Node: Library Functions, Next: Header Files, Prev: Libraries, Up: Existing Tests + +5.5 Library Functions +===================== + +The following macros check for particular C library functions. If there +is no macro specifically defined to check for a function you need, and +you don't need to check for any special properties of it, then you can +use one of the general function-check macros. + +* Menu: + +* Function Portability:: Pitfalls with usual functions +* Particular Functions:: Special handling to find certain functions +* Generic Functions:: How to find other functions + + +File: autoconf.info, Node: Function Portability, Next: Particular Functions, Prev: Library Functions, Up: Library Functions + +5.5.1 Portability of Classical Functions +---------------------------------------- + +Most usual functions can either be missing, or be buggy, or be limited +on some architectures. This section tries to make an inventory of these +portability issues. By definition, this list will always require +additions, please help us keeping it as complete as possible + +'unlink' + The POSIX spec says that 'unlink' causes the given files to be + removed only after there are no more open file handles for it. Not + all OS's support this behaviour though. So even on systems that + provide 'unlink', you cannot portably assume it is OK to call it on + files that are open. For example, on Windows 9x and ME, such a + call would fail; on DOS it could even lead to file system + corruption, as the file might end up being written to after the OS + has removed it. + + +File: autoconf.info, Node: Particular Functions, Next: Generic Functions, Prev: Function Portability, Up: Library Functions + +5.5.2 Particular Function Checks +-------------------------------- + +These macros check for particular C functions--whether they exist, and +in some cases how they respond when given certain arguments. + + -- Macro: AC_FUNC_ALLOCA + Check how to get 'alloca'. Tries to get a builtin version by + checking for 'alloca.h' or the predefined C preprocessor macros + '__GNUC__' and '_AIX'. If this macro finds 'alloca.h', it defines + 'HAVE_ALLOCA_H'. + + If those attempts fail, it looks for the function in the standard C + library. If any of those methods succeed, it defines + 'HAVE_ALLOCA'. Otherwise, it sets the output variable 'ALLOCA' to + 'alloca.o' and defines 'C_ALLOCA' (so programs can periodically + call 'alloca(0)' to garbage collect). This variable is separate + from 'LIBOBJS' so multiple programs can share the value of 'ALLOCA' + without needing to create an actual library, in case only some of + them use the code in 'LIBOBJS'. + + This macro does not try to get 'alloca' from the System V R3 + 'libPW' or the System V R4 'libucb' because those libraries contain + some 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'. + + Source files that use 'alloca' should start with a piece of code + like the following, to declare it properly. In some versions of + AIX, the declaration of 'alloca' must precede everything else + except for comments and preprocessor directives. The '#pragma' + directive is indented so that pre-ANSI C compilers will ignore it, + rather than choke on it. + + /* AIX requires this to be the first thing in the file. */ + #ifndef __GNUC__ + # if HAVE_ALLOCA_H + # include <alloca.h> + # else + # ifdef _AIX + #pragma alloca + # else + # ifndef alloca /* predefined by HP cc +Olibcalls */ + char *alloca (); + # endif + # endif + # endif + #endif + + -- Macro: AC_FUNC_CHOWN + If the 'chown' function is available and works (in particular, it + should accept '-1' for 'uid' and 'gid'), define 'HAVE_CHOWN'. + + -- Macro: AC_FUNC_CLOSEDIR_VOID + If the 'closedir' function does not return a meaningful value, + define 'CLOSEDIR_VOID'. Otherwise, callers ought to check its + return value for an error indicator. + + -- Macro: AC_FUNC_ERROR_AT_LINE + If the 'error_at_line' function is not found, require an + 'AC_LIBOBJ' replacement of 'error'. + + -- Macro: AC_FUNC_FNMATCH + If the 'fnmatch' function is available and works (unlike the one on + Solaris 2.4), define 'HAVE_FNMATCH'. + + -- Macro: AC_FUNC_FORK + This macro checks for the 'fork' and 'vfork' functions. If a + working 'fork' is found, define 'HAVE_WORKING_FORK'. This macro + checks whether 'fork' is just a stub by trying to run it. + + If 'vfork.h' is found, define 'HAVE_VFORK_H'. If a working 'vfork' + is found, define 'HAVE_WORKING_VFORK'. Otherwise, define 'vfork' + to be 'fork' for backward compatibility with previous versions of + 'autoconf'. This macro checks for several known errors in + implementations of 'vfork' and considers the system to not have a + working 'vfork' if it detects any of them. It is not considered to + be an implementation error if a child's invocation of 'signal' + modifies the parent's signal handler, since child processes rarely + change their signal handlers. + + Since this macro defines 'vfork' only for backward compatibility + with previous versions of 'autoconf' you're encouraged to define it + yourself in new code: + #if !HAVE_WORKING_VFORK + # define vfork fork + #endif + + -- Macro: AC_FUNC_FSEEKO + If the 'fseeko' function is available, define 'HAVE_FSEEKO'. + Define '_LARGEFILE_SOURCE' if necessary. + + -- Macro: AC_FUNC_GETGROUPS + If the 'getgroups' function is available and works (unlike on + Ultrix 4.3, where 'getgroups (0, 0)' always fails), define + 'HAVE_GETGROUPS'. Set 'GETGROUPS_LIBS' to any libraries needed to + get that function. This macro runs 'AC_TYPE_GETGROUPS'. + + -- Macro: AC_FUNC_GETLOADAVG + Check how to get the system load averages. If the system has the + 'getloadavg' function, define 'HAVE_GETLOADAVG', and set + 'GETLOADAVG_LIBS' to any libraries needed to get that function. + Also add 'GETLOADAVG_LIBS' to 'LIBS'. + + Otherwise, require an 'AC_LIBOBJ' replacement ('getloadavg.c') of + 'getloadavg', and possibly define several other C preprocessor + macros and output variables: + + 1. Define 'C_GETLOADAVG'. + + 2. Define 'SVR4', 'DGUX', 'UMAX', or 'UMAX4_3' if on those + systems. + + 3. If 'nlist.h' is found, define 'NLIST_STRUCT'. + + 4. If 'struct nlist' has an 'n_un.n_name' member, define + 'HAVE_STRUCT_NLIST_N_UN_N_NAME'. The obsolete symbol + 'NLIST_NAME_UNION' is still defined, but do not depend upon + it. + + 5. Programs may need to be installed setgid (or setuid) for + 'getloadavg' to work. In this case, define + 'GETLOADAVG_PRIVILEGED', set the output variable 'NEED_SETGID' + to 'true' (and otherwise to 'false'), and set 'KMEM_GROUP' to + the name of the group that should own the installed program. + + -- Macro: AC_FUNC_GETMNTENT + Check for 'getmntent' in the 'sun', 'seq', and 'gen' libraries, for + Irix 4, PTX, and Unixware, respectively. Then, if 'getmntent' is + available, define 'HAVE_GETMNTENT'. + + -- Macro: AC_FUNC_GETPGRP + If 'getpgrp' takes no argument (the POSIX.1 version), define + 'GETPGRP_VOID'. Otherwise, it is the BSD version, which takes a + process ID as an argument. This macro does not check whether + 'getpgrp' exists at all; if you need to work in that situation, + first call 'AC_CHECK_FUNC' for 'getpgrp'. + + -- Macro: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK + If 'link' is a symbolic link, then 'lstat' should treat 'link/' the + same as 'link/.'. However, many older 'lstat' implementations + incorrectly ignore trailing slashes. + + It is safe to assume that if 'lstat' incorrectly ignores trailing + slashes, then other symbolic-link-aware functions like 'unlink' and + 'unlink' also incorrectly ignore trailing slashes. + + If 'lstat' behaves properly, define + 'LSTAT_FOLLOWS_SLASHED_SYMLINK', otherwise require an 'AC_LIBOBJ' + replacement of 'lstat'. + + -- Macro: AC_FUNC_MALLOC + If the 'malloc' works correctly ('malloc (0)' returns a valid + pointer), define 'HAVE_MALLOC'. + + -- Macro: AC_FUNC_MEMCMP + If the 'memcmp' function is not available, or does not work on + 8-bit data (like the one on SunOS 4.1.3), or fails when comparing + 16 bytes or more and with at least one buffer not starting on a + 4-byte boundary (such as the one on NeXT x86 OpenStep), require an + 'AC_LIBOBJ' replacement for 'memcmp'. + + -- Macro: AC_FUNC_MKTIME + If the 'mktime' function is not available, or does not work + correctly, require an 'AC_LIBOBJ' replacement for 'mktime'. + + -- Macro: AC_FUNC_MMAP + If the 'mmap' function exists and works correctly, define + 'HAVE_MMAP'. Only checks private fixed mapping of already-mapped + memory. + + -- Macro: AC_FUNC_OBSTACK + If the obstacks are found, define 'HAVE_OBSTACK', else require an + 'AC_LIBOBJ' replacement for 'obstack'. + + -- Macro: AC_FUNC_SELECT_ARGTYPES + Determines the correct type to be passed for each of the 'select' + function's arguments, and defines those types in + 'SELECT_TYPE_ARG1', 'SELECT_TYPE_ARG234', and 'SELECT_TYPE_ARG5' + respectively. 'SELECT_TYPE_ARG1' defaults to 'int', + 'SELECT_TYPE_ARG234' defaults to 'int *', and 'SELECT_TYPE_ARG5' + defaults to 'struct timeval *'. + + -- Macro: AC_FUNC_SETPGRP + If 'setpgrp' takes no argument (the POSIX.1 version), define + 'SETPGRP_VOID'. Otherwise, it is the BSD version, which takes two + process IDs as arguments. This macro does not check whether + 'setpgrp' exists at all; if you need to work in that situation, + first call 'AC_CHECK_FUNC' for 'setpgrp'. + + -- Macro: AC_FUNC_STAT + -- Macro: AC_FUNC_LSTAT + Determine whether 'stat' or 'lstat' have the bug that it succeeds + when given the zero-length file name argument. The 'stat' and + 'lstat' from SunOS 4.1.4 and the Hurd (as of 1998-11-01) do this. + + If it does, then define 'HAVE_STAT_EMPTY_STRING_BUG' (or + 'HAVE_LSTAT_EMPTY_STRING_BUG') and ask for an 'AC_LIBOBJ' + replacement of it. + + -- Macro: AC_FUNC_SETVBUF_REVERSED + If 'setvbuf' takes the buffering type as its second argument and + the buffer pointer as the third, instead of the other way around, + define 'SETVBUF_REVERSED'. + + -- Macro: AC_FUNC_STRCOLL + If the 'strcoll' function exists and works correctly, define + 'HAVE_STRCOLL'. This does a bit more than + 'AC_CHECK_FUNCS(strcoll)', because some systems have incorrect + definitions of 'strcoll' that should not be used. + + -- Macro: AC_FUNC_STRTOD + If the 'strtod' function does not exist or doesn't work correctly, + ask for an 'AC_LIBOBJ' replacement of 'strtod'. In this case, + because 'strtod.c' is likely to need 'pow', set the output variable + 'POW_LIB' to the extra library needed. + + -- Macro: AC_FUNC_STRERROR_R + If 'strerror_r' is available, define 'HAVE_STRERROR_R'. If its + implementation correctly returns a 'char *', define + 'HAVE_WORKING_STRERROR_R'. On at least DEC UNIX 4.0[A-D] and HP-UX + B.10.20, 'strerror_r' returns 'int'. Actually, this tests only + whether it returns a scalar or an array, but that should be enough. + This is used by the common 'error.c'. + + -- Macro: AC_FUNC_STRFTIME + Check for 'strftime' in the 'intl' library, for SCO UNIX. Then, if + 'strftime' is available, define 'HAVE_STRFTIME'. + + -- Macro: AC_FUNC_UTIME_NULL + If 'utime(FILE, NULL)' sets FILE's timestamp to the present, define + 'HAVE_UTIME_NULL'. + + -- Macro: AC_FUNC_VPRINTF + If 'vprintf' is found, define 'HAVE_VPRINTF'. Otherwise, if + '_doprnt' is found, define 'HAVE_DOPRNT'. (If 'vprintf' is + available, you may assume that 'vfprintf' and 'vsprintf' are also + available.) + + +File: autoconf.info, Node: Generic Functions, Prev: Particular Functions, Up: Library Functions + +5.5.3 Generic Function Checks +----------------------------- + +These macros are used to find functions not covered by the "particular" +test macros. If the functions might be in libraries other than the +default C library, first call 'AC_CHECK_LIB' for those libraries. If +you need to check the behavior of a function as well as find out whether +it is present, you have to write your own test for it (*note Writing +Tests::). + + -- Macro: AC_CHECK_FUNC (FUNCTION, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND]) + If C function FUNCTION is available, run shell commands + ACTION-IF-FOUND, otherwise ACTION-IF-NOT-FOUND. If you just want + to define a symbol if the function is available, consider using + 'AC_CHECK_FUNCS' instead. This macro checks for functions with C + linkage even when 'AC_LANG(C++)' has been called, since C is more + standardized than C++. (*note Language Choice::, for more + information about selecting the language for checks.) + + -- Macro: AC_CHECK_FUNCS (FUNCTION..., [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND]) + For each FUNCTION in the whitespace-separated argument list, define + 'HAVE_FUNCTION' (in all capitals) if it is available. If + ACTION-IF-FOUND is given, it is additional shell code to execute + when one of the functions is found. You can give it a value of + 'break' to break out of the loop on the first match. If + ACTION-IF-NOT-FOUND is given, it is executed when one of the + functions is not found. + + Autoconf follows a philosophy that was formed over the years by those +who have struggled for portability: isolate the portability issues in +specific files, and then program as if you were in a POSIX environment. +Some functions may be missing or unfixable, and your package must be +ready to replace them. + + Use the first three of the following macros to specify a function to +be replaced, and the last one ('AC_REPLACE_FUNCS') to check for and +replace the function if needed. + + -- Macro: AC_LIBOBJ (FUNCTION) + Specify that 'FUNCTION.c' must be included in the executables to + replace a missing or broken implementation of FUNCTION. + + Technically, it adds 'FUNCTION.$ac_objext' to the output variable + 'LIBOBJS' and calls 'AC_LIBSOURCE' for 'FUNCTION.c'. You should + not directly change 'LIBOBJS', since this is not traceable. + + -- Macro: AC_LIBSOURCE (FILE) + Specify that FILE might be needed to compile the project. If you + need to know what files might be needed by a 'configure.ac', you + should trace 'AC_LIBSOURCE'. FILE must be a literal. + + This macro is called automatically from 'AC_LIBOBJ', but you must + call it explicitly if you pass a shell variable to 'AC_LIBOBJ'. In + that case, since shell variables cannot be traced statically, you + must pass to 'AC_LIBSOURCE' any possible files that the shell + variable might cause 'AC_LIBOBJ' to need. For example, if you want + to pass a variable '$foo_or_bar' to 'AC_LIBOBJ' that holds either + '"foo"' or '"bar"', you should do: + + AC_LIBSOURCE(foo.c) + AC_LIBSOURCE(bar.c) + AC_LIBOBJ($foo_or_bar) + + There is usually a way to avoid this, however, and you are + encouraged to simply call 'AC_LIBOBJ' with literal arguments. + + Note that this macro replaces the obsolete 'AC_LIBOBJ_DECL', with + slightly different semantics: the old macro took the function name, + e.g. 'foo', as its argument rather than the file name. + + -- Macro: AC_LIBSOURCES (FILES) + Like 'AC_LIBSOURCE', but accepts one or more FILES in a + comma-separated M4 list. Thus, the above example might be + rewritten: + + AC_LIBSOURCES([foo.c, bar.c]) + AC_LIBOBJ($foo_or_bar) + + -- Macro: AC_REPLACE_FUNCS (FUNCTION...) + Like 'AC_CHECK_FUNCS', but uses 'AC_LIBOBJ(FUNCTION)' as + ACTION-IF-NOT-FOUND. You can declare your replacement function by + enclosing the prototype in '#if !HAVE_FUNCTION'. If the system has + the function, it probably declares it in a header file you should + be including, so you shouldn't redeclare it lest your declaration + conflict. + + +File: autoconf.info, Node: Header Files, Next: Declarations, Prev: Library Functions, Up: Existing Tests + +5.6 Header Files +================ + +The following macros check for the presence of certain C header files. +If there is no macro specifically defined to check for a header file you +need, and you don't need to check for any special properties of it, then +you can use one of the general header-file check macros. + +* Menu: + +* Particular Headers:: Special handling to find certain headers +* Generic Headers:: How to find other headers + + +File: autoconf.info, Node: Particular Headers, Next: Generic Headers, Prev: Header Files, Up: Header Files + +5.6.1 Particular Header Checks +------------------------------ + +These macros check for particular system header files--whether they +exist, and in some cases whether they declare certain symbols. + + -- Macro: AC_HEADER_DIRENT + Check for the following header files. For the first one that is + found and defines 'DIR', define the listed C preprocessor macro: + + 'dirent.h' 'HAVE_DIRENT_H' + 'sys/ndir.h' 'HAVE_SYS_NDIR_H' + 'sys/dir.h' 'HAVE_SYS_DIR_H' + 'ndir.h' 'HAVE_NDIR_H' + + The directory-library declarations in your source code should look + something like the following: + + #if HAVE_DIRENT_H + # include <dirent.h> + # define NAMLEN(dirent) strlen((dirent)->d_name) + #else + # define dirent direct + # define NAMLEN(dirent) (dirent)->d_namlen + # if HAVE_SYS_NDIR_H + # include <sys/ndir.h> + # endif + # if HAVE_SYS_DIR_H + # include <sys/dir.h> + # endif + # if HAVE_NDIR_H + # include <ndir.h> + # endif + #endif + + Using the above declarations, the program would declare variables + to be of type 'struct dirent', not 'struct direct', and would + access the length of a directory entry name by passing a pointer to + a 'struct dirent' to the 'NAMLEN' macro. + + This macro also checks for the SCO Xenix 'dir' and 'x' libraries. + + -- Macro: AC_HEADER_MAJOR + If 'sys/types.h' does not define 'major', 'minor', and 'makedev', + but 'sys/mkdev.h' does, define 'MAJOR_IN_MKDEV'; otherwise, if + 'sys/sysmacros.h' does, define 'MAJOR_IN_SYSMACROS'. + + -- Macro: AC_HEADER_STAT + If the macros 'S_ISDIR', 'S_ISREG' et al. defined in 'sys/stat.h' + do not work properly (returning false positives), define + 'STAT_MACROS_BROKEN'. This is the case on Tektronix UTekV, Amdahl + UTS and Motorola System V/88. + + -- Macro: AC_HEADER_STDC + Define 'STDC_HEADERS' if the system has ANSI C header files. + Specifically, this macro checks for 'stdlib.h', 'stdarg.h', + 'string.h', and 'float.h'; if the system has those, it probably has + the rest of the ANSI C header files. This macro also checks + whether 'string.h' declares 'memchr' (and thus presumably the other + 'mem' functions), whether 'stdlib.h' declare 'free' (and thus + presumably 'malloc' and other related functions), and whether the + 'ctype.h' macros work on characters with the high bit set, as ANSI + C requires. + + Use 'STDC_HEADERS' instead of '__STDC__' to determine whether the + system has ANSI-compliant header files (and probably C library + functions) because many systems that have GCC do not have ANSI C + header files. + + On systems without ANSI C headers, there is so much variation that + it is probably easier to declare the functions you use than to + figure out exactly what the system header files declare. Some + systems contain a mix of functions ANSI and BSD; some are mostly + ANSI but lack 'memmove'; some define the BSD functions as macros in + 'string.h' or 'strings.h'; some have only the BSD functions but + 'string.h'; some declare the memory functions in 'memory.h', some + in 'string.h'; etc. It is probably sufficient to check for one + string function and one memory function; if the library has the + ANSI versions of those then it probably has most of the others. If + you put the following in 'configure.ac': + + AC_HEADER_STDC + AC_CHECK_FUNCS(strchr memcpy) + + then, in your code, you can put declarations like this: + + #if STDC_HEADERS + # include <string.h> + #else + # if !HAVE_STRCHR + # define strchr index + # define strrchr rindex + # endif + char *strchr (), *strrchr (); + # if !HAVE_MEMCPY + # define memcpy(d, s, n) bcopy ((s), (d), (n)) + # define memmove(d, s, n) bcopy ((s), (d), (n)) + # endif + #endif + + If you use a function like 'memchr', 'memset', 'strtok', or + 'strspn', which have no BSD equivalent, then macros won't suffice; + you must provide an implementation of each function. An easy way + to incorporate your implementations only when needed (since the + ones in system C libraries may be hand optimized) is to, taking + 'memchr' for example, put it in 'memchr.c' and use + 'AC_REPLACE_FUNCS(memchr)'. + + -- Macro: AC_HEADER_SYS_WAIT + If 'sys/wait.h' exists and is compatible with POSIX.1, define + 'HAVE_SYS_WAIT_H'. Incompatibility can occur if 'sys/wait.h' does + not exist, or if it uses the old BSD 'union wait' instead of 'int' + to store a status value. If 'sys/wait.h' is not POSIX.1 + compatible, then instead of including it, define the POSIX.1 macros + with their usual interpretations. Here is an example: + + #include <sys/types.h> + #if HAVE_SYS_WAIT_H + # include <sys/wait.h> + #endif + #ifndef WEXITSTATUS + # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) + #endif + #ifndef WIFEXITED + # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) + #endif + + '_POSIX_VERSION' is defined when 'unistd.h' is included on POSIX.1 +systems. If there is no 'unistd.h', it is definitely not a POSIX.1 +system. However, some non-POSIX.1 systems do have 'unistd.h'. + + The way to check if the system supports POSIX.1 is: + + #if HAVE_UNISTD_H + # include <sys/types.h> + # include <unistd.h> + #endif + + #ifdef _POSIX_VERSION + /* Code for POSIX.1 systems. */ + #endif + + -- Macro: AC_HEADER_TIME + If a program may include both 'time.h' and 'sys/time.h', define + 'TIME_WITH_SYS_TIME'. On some older systems, 'sys/time.h' includes + 'time.h', but 'time.h' is not protected against multiple inclusion, + so programs should not explicitly include both files. This macro + is useful in programs that use, for example, 'struct timeval' or + 'struct timezone' as well as 'struct tm'. It is best used in + conjunction with 'HAVE_SYS_TIME_H', which can be checked for using + 'AC_CHECK_HEADERS(sys/time.h)'. + + #if TIME_WITH_SYS_TIME + # include <sys/time.h> + # include <time.h> + #else + # if HAVE_SYS_TIME_H + # include <sys/time.h> + # else + # include <time.h> + # endif + #endif + + -- Macro: AC_HEADER_TIOCGWINSZ + If the use of 'TIOCGWINSZ' requires '<sys/ioctl.h>', then define + 'GWINSZ_IN_SYS_IOCTL'. Otherwise 'TIOCGWINSZ' can be found in + '<termios.h>'. + + Use: + + #if HAVE_TERMIOS_H + # include <termios.h> + #endif + + #if GWINSZ_IN_SYS_IOCTL + # include <sys/ioctl.h> + #endif + + +File: autoconf.info, Node: Generic Headers, Prev: Particular Headers, Up: Header Files + +5.6.2 Generic Header Checks +--------------------------- + +These macros are used to find system header files not covered by the +"particular" test macros. If you need to check the contents of a header +as well as find out whether it is present, you have to write your own +test for it (*note Writing Tests::). + + -- Macro: AC_CHECK_HEADER (HEADER-FILE, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [INCLUDES]) + If the system header file HEADER-FILE is usable, execute shell + commands ACTION-IF-FOUND, otherwise execute ACTION-IF-NOT-FOUND. + If you just want to define a symbol if the header file is + available, consider using 'AC_CHECK_HEADERS' instead. + + The meaning of "usable" depends upon the content of INCLUDES: + + if INCLUDES is empty + check whether + + HEADER-FILE + + can be _preprocessed_ without error. + + if INCLUDE is set + Check whether + + INCLUDES + #include <HEADER-FILE> + + can be _compiled_ without error. You may use + 'AC_CHECK_HEADER' (and 'AC_CHECK_HEADERS') to check whether + two headers are compatible. + + You may pass any kind of dummy content for INCLUDES, such as a + single space, a comment, to check whether HEADER-FILE compiles with + success. + + -- Macro: AC_CHECK_HEADERS (HEADER-FILE..., [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [INCLUDES]) + For each given system header file HEADER-FILE in the + whitespace-separated argument list that exists, define + 'HAVE_HEADER-FILE' (in all capitals). If ACTION-IF-FOUND is given, + it is additional shell code to execute when one of the header files + is found. You can give it a value of 'break' to break out of the + loop on the first match. If ACTION-IF-NOT-FOUND is given, it is + executed when one of the header files is not found. + + Be sure to read the documentation of 'AC_CHECK_HEADER' to + understand the influence of INCLUDES. + + +File: autoconf.info, Node: Declarations, Next: Structures, Prev: Header Files, Up: Existing Tests + +5.7 Declarations +================ + +The following macros check for the declaration of variables and +functions. If there is no macro specifically defined to check for a +symbol you need, then you can use the general macros (*note Generic +Declarations::) or, for more complex tests, you may use 'AC_TRY_COMPILE' +(*note Examining Syntax::). + +* Menu: + +* Particular Declarations:: Macros to check for certain declarations +* Generic Declarations:: How to find other declarations + + +File: autoconf.info, Node: Particular Declarations, Next: Generic Declarations, Prev: Declarations, Up: Declarations + +5.7.1 Particular Declaration Checks +----------------------------------- + +The following macros check for certain declarations. + + -- Macro: AC_DECL_SYS_SIGLIST + Define 'SYS_SIGLIST_DECLARED' if the variable 'sys_siglist' is + declared in a system header file, either 'signal.h' or 'unistd.h'. + + +File: autoconf.info, Node: Generic Declarations, Prev: Particular Declarations, Up: Declarations + +5.7.2 Generic Declaration Checks +-------------------------------- + +These macros are used to find declarations not covered by the +"particular" test macros. + + -- Macro: AC_CHECK_DECL (SYMBOL, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [INCLUDES]) + If SYMBOL (a function or a variable) is not declared in INCLUDES + and a declaration is needed, run the shell commands + ACTION-IF-NOT-FOUND, otherwise ACTION-IF-FOUND. If no INCLUDES are + specified, the default includes are used (*note Default + Includes::). + + This macro actually tests whether it is valid to use SYMBOL as an + r-value, not if it is really declared, because it is much safer to + avoid introducing extra declarations when they are not needed. + + -- Macro: AC_CHECK_DECLS (SYMBOLS, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [INCLUDES]) + For each of the SYMBOLS (_comma_-separated list), define + 'HAVE_DECL_SYMBOL' (in all capitals) to '1' if SYMBOL is declared, + otherwise to '0'. If ACTION-IF-NOT-FOUND is given, it is + additional shell code to execute when one of the function + declarations is needed, otherwise ACTION-IF-FOUND is executed. + + This macro uses an m4 list as first argument: + AC_CHECK_DECLS(strdup) + AC_CHECK_DECLS([strlen]) + AC_CHECK_DECLS([malloc, realloc, calloc, free]) + + Unlike the other 'AC_CHECK_*S' macros, when a SYMBOL is not + declared, 'HAVE_DECL_SYMBOL' is defined to '0' instead of leaving + 'HAVE_DECL_SYMBOL' undeclared. When you are _sure_ that the check + was performed, use 'HAVE_DECL_SYMBOL' just like any other result of + Autoconf: + + #if !HAVE_DECL_SYMBOL + extern char *symbol; + #endif + + If the test may have not been performed, however, because it is + safer _not_ to declare a symbol than to use a declaration that + conflicts with the system's one, you should use: + + #if defined HAVE_DECL_MALLOC && !HAVE_DECL_MALLOC + char *malloc (size_t *s); + #endif + + You fall into the second category only in extreme situations: + either your files may be used without being configured, or they are + used during the configuration. In most cases the traditional + approach is enough. + + +File: autoconf.info, Node: Structures, Next: Types, Prev: Declarations, Up: Existing Tests + +5.8 Structures +============== + +The following macros check for the presence of certain members in C +structures. If there is no macro specifically defined to check for a +member you need, then you can use the general structure-member macro +(*note Generic Structures::) or, for more complex tests, you may use +'AC_TRY_COMPILE' (*note Examining Syntax::). + +* Menu: + +* Particular Structures:: Macros to check for certain structure members +* Generic Structures:: How to find other structure members + + +File: autoconf.info, Node: Particular Structures, Next: Generic Structures, Prev: Structures, Up: Structures + +5.8.1 Particular Structure Checks +--------------------------------- + +The following macros check for certain structures or structure members. + + -- Macro: AC_STRUCT_ST_BLKSIZE + If 'struct stat' contains an 'st_blksize' member, define + 'HAVE_STRUCT_STAT_ST_BLKSIZE'. The former name, 'HAVE_ST_BLKSIZE' + is to be avoided, as its support will cease in the future. This + macro is obsoleted, and should be replaced by + + AC_CHECK_MEMBERS([struct stat.st_blksize]) + + -- Macro: AC_STRUCT_ST_BLOCKS + If 'struct stat' contains an 'st_blocks' member, define + 'HAVE_STRUCT STAT_ST_BLOCKS'. Otherwise, require an 'AC_LIBOBJ' + replacement of 'fileblocks'. The former name, 'HAVE_ST_BLOCKS' is + to be avoided, as its support will cease in the future. + + -- Macro: AC_STRUCT_ST_RDEV + If 'struct stat' contains an 'st_rdev' member, define + 'HAVE_STRUCT_STAT_ST_RDEV'. The former name for this macro, + 'HAVE_ST_RDEV', is to be avoided as it will cease to be supported + in the future. Actually, even the new macro is obsolete, and + should be replaced by: + AC_CHECK_MEMBERS([struct stat.st_rdev]) + + -- Macro: AC_STRUCT_TM + If 'time.h' does not define 'struct tm', define 'TM_IN_SYS_TIME', + which means that including 'sys/time.h' had better define 'struct + tm'. + + -- Macro: AC_STRUCT_TIMEZONE + Figure out how to get the current timezone. If 'struct tm' has a + 'tm_zone' member, define 'HAVE_STRUCT_TM_TM_ZONE' (and the + obsoleted 'HAVE_TM_ZONE'). Otherwise, if the external array + 'tzname' is found, define 'HAVE_TZNAME'. + + +File: autoconf.info, Node: Generic Structures, Prev: Particular Structures, Up: Structures + +5.8.2 Generic Structure Checks +------------------------------ + +These macros are used to find structure members not covered by the +"particular" test macros. + + -- Macro: AC_CHECK_MEMBER (AGGREGATE.MEMBER, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [INCLUDES]) + Check whether MEMBER is a member of the aggregate AGGREGATE. If no + INCLUDES are specified, the default includes are used (*note + Default Includes::). + + AC_CHECK_MEMBER(struct passwd.pw_gecos,, + [AC_MSG_ERROR([We need `passwd.pw_gecos'!])], + [#include <pwd.h>]) + + You can use this macro for sub-members: + + AC_CHECK_MEMBER(struct top.middle.bot) + + -- Macro: AC_CHECK_MEMBERS (MEMBERS, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [INCLUDES]) + Check for the existence of each 'AGGREGATE.MEMBER' of MEMBERS using + the previous macro. When MEMBER belongs to AGGREGATE, define + 'HAVE_AGGREGATE_MEMBER' (in all capitals, with spaces and dots + replaced by underscores). + + This macro uses m4 lists: + AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize]) + + +File: autoconf.info, Node: Types, Next: Compilers and Preprocessors, Prev: Structures, Up: Existing Tests + +5.9 Types +========= + +The following macros check for C types, either builtin or typedefs. If +there is no macro specifically defined to check for a type you need, and +you don't need to check for any special properties of it, then you can +use a general type-check macro. + +* Menu: + +* Particular Types:: Special handling to find certain types +* Generic Types:: How to find other types + + +File: autoconf.info, Node: Particular Types, Next: Generic Types, Prev: Types, Up: Types + +5.9.1 Particular Type Checks +---------------------------- + +These macros check for particular C types in 'sys/types.h', 'stdlib.h' +and others, if they exist. + + -- Macro: AC_TYPE_GETGROUPS + Define 'GETGROUPS_T' to be whichever of 'gid_t' or 'int' is the + base type of the array argument to 'getgroups'. + + -- Macro: AC_TYPE_MODE_T + Equivalent to 'AC_CHECK_TYPE(mode_t, int)'. + + -- Macro: AC_TYPE_OFF_T + Equivalent to 'AC_CHECK_TYPE(off_t, long)'. + + -- Macro: AC_TYPE_PID_T + Equivalent to 'AC_CHECK_TYPE(pid_t, int)'. + + -- Macro: AC_TYPE_SIGNAL + If 'signal.h' declares 'signal' as returning a pointer to a + function returning 'void', define 'RETSIGTYPE' to be 'void'; + otherwise, define it to be 'int'. + + Define signal handlers as returning type 'RETSIGTYPE': + + RETSIGTYPE + hup_handler () + { + ... + } + + -- Macro: AC_TYPE_SIZE_T + Equivalent to 'AC_CHECK_TYPE(size_t, unsigned)'. + + -- Macro: AC_TYPE_UID_T + If 'uid_t' is not defined, define 'uid_t' to be 'int' and 'gid_t' + to be 'int'. + + +File: autoconf.info, Node: Generic Types, Prev: Particular Types, Up: Types + +5.9.2 Generic Type Checks +------------------------- + +These macros are used to check for types not covered by the "particular" +test macros. + + -- Macro: AC_CHECK_TYPE (TYPE, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [INCLUDES]) + Check whether TYPE is defined. It may be a compiler builtin type + or defined by the [INCLUDES] (*note Default Includes::). + + -- Macro: AC_CHECK_TYPES (TYPES, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [INCLUDES]) + For each TYPE of the TYPES that is defined, define 'HAVE_TYPE' (in + all capitals). If no INCLUDES are specified, the default includes + are used (*note Default Includes::). If ACTION-IF-FOUND is given, + it is additional shell code to execute when one of the types is + found. If ACTION-IF-NOT-FOUND is given, it is executed when one of + the types is not found. + + This macro uses m4 lists: + AC_CHECK_TYPES(ptrdiff_t) + AC_CHECK_TYPES([unsigned long long, uintmax_t]) + + Autoconf, up to 2.13, used to provide to another version of +'AC_CHECK_TYPE', broken by design. In order to keep backward +compatibility, a simple heuristics, quite safe but not totally, is +implemented. In case of doubt, read the documentation of the former +'AC_CHECK_TYPE', see *note Obsolete Macros::. + + +File: autoconf.info, Node: Compilers and Preprocessors, Next: System Services, Prev: Types, Up: Existing Tests + +5.10 Compilers and Preprocessors +================================ + +All the tests for compilers ('AC_PROG_CC', 'AC_PROG_CXX', 'AC_PROG_F77') +define the output variable 'EXEEXT' based on the output of the compiler, +typically to the empty string if Unix and '.exe' if Win32 or OS/2. + + They also define the output variable 'OBJEXT' based on the output of +the compiler, after .c files have been excluded, typically to 'o' if +Unix, 'obj' if Win32. + + If the compiler being used does not produce executables, they fail. +If the executables can't be run, and cross-compilation is not enabled, +they fail too. *Note Manual Configuration::, for more on support for +cross compiling. + +* Menu: + +* Generic Compiler Characteristics:: Language independent tests +* C Compiler:: Checking its characteristics +* C++ Compiler:: Likewise +* Fortran 77 Compiler:: Likewise + + +File: autoconf.info, Node: Generic Compiler Characteristics, Next: C Compiler, Prev: Compilers and Preprocessors, Up: Compilers and Preprocessors + +5.10.1 Generic Compiler Characteristics +--------------------------------------- + + -- Macro: AC_CHECK_SIZEOF (TYPE, [UNUSED], [INCLUDES]) + Define 'SIZEOF_TYPE' (*note Standard Symbols::) to be the size in + bytes of TYPE. If 'type' is unknown, it gets a size of 0. If no + INCLUDES are specified, the default includes are used (*note + Default Includes::). If you provide INCLUDE, make sure to include + 'stdio.h' which is required for this macro to run. + + This macro now works even when cross-compiling. The UNUSED + argument was used when cross-compiling. + + For example, the call + + AC_CHECK_SIZEOF(int *) + + defines 'SIZEOF_INT_P' to be 8 on DEC Alpha AXP systems. + + +File: autoconf.info, Node: C Compiler, Next: C++ Compiler, Prev: Generic Compiler Characteristics, Up: Compilers and Preprocessors + +5.10.2 C Compiler Characteristics +--------------------------------- + + -- Macro: AC_PROG_CC ([COMPILER-SEARCH-LIST]) + Determine a C compiler to use. If 'CC' is not already set in the + environment, check for 'gcc' and 'cc', then for other C compilers. + Set output variable 'CC' to the name of the compiler found. + + This macro may, however, be invoked with an optional first argument + which, if specified, must be a space separated list of C compilers + to search for. This just gives the user an opportunity to specify + an alternative search list for the C compiler. For example, if you + didn't like the default order, then you could invoke 'AC_PROG_CC' + like this: + + AC_PROG_CC(cl egcs gcc cc) + + If using the GNU C compiler, set shell variable 'GCC' to 'yes'. If + output variable 'CFLAGS' was not already set, set it to '-g -O2' + for the GNU C compiler ('-O2' on systems where GCC does not accept + '-g'), or '-g' for other compilers. + + -- Macro: AC_PROG_CC_C_O + If the C compiler does not accept the '-c' and '-o' options + simultaneously, define 'NO_MINUS_C_MINUS_O'. This macro actually + tests both the compiler found by 'AC_PROG_CC', and, if different, + the first 'cc' in the path. The test fails if one fails. This + macro was created for GNU Make to choose the default C compilation + rule. + + -- Macro: AC_PROG_CC_STDC + If the C compiler is not in ANSI C mode by default, try to add an + option to output variable '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 'ac_cv_prog_cc_stdc' is set to 'no'. If you wrote your + source code in ANSI C, you can make an un-ANSIfied copy of it by + using the program 'ansi2knr', which comes with Automake. + + -- Macro: AC_PROG_CPP + Set output variable 'CPP' to a command that runs the C + preprocessor. If '$CC -E' doesn't work, '/lib/cpp' is used. It is + only portable to run 'CPP' on files with a '.c' extension. + + If the current language is C (*note Language Choice::), many of the + specific test macros use the value of 'CPP' indirectly by calling + 'AC_TRY_CPP', 'AC_CHECK_HEADER', 'AC_EGREP_HEADER', or + 'AC_EGREP_CPP'. + + Some preprocessors don't indicate missing include files by the + error status. For such preprocessors an internal variable is set + that causes other macros to check the standard error from the + preprocessor and consider the test failed if any warnings have been + reported. + + The following macros check for C compiler or machine architecture +features. To check for characteristics not listed here, use +'AC_TRY_COMPILE' (*note Examining Syntax::) or 'AC_TRY_RUN' (*note Run +Time::) + + -- Macro: AC_C_BIGENDIAN + If words are stored with the most significant byte first (like + Motorola and SPARC, but not Intel and VAX, CPUs), define + 'WORDS_BIGENDIAN'. + + -- Macro: AC_C_CONST + If the C compiler does not fully support the ANSI C qualifier + 'const', define 'const' to be empty. Some C compilers that do not + define '__STDC__' do support 'const'; some compilers that define + '__STDC__' do not completely support 'const'. Programs can simply + use 'const' as if every C compiler supported it; for those that + don't, the 'Makefile' or configuration header file will define it + as empty. + + Occasionally installers use a C++ compiler to compile C code, + typically because they lack a C compiler. This causes problems + with 'const', because C and C++ treat 'const' differently. For + example: + + const int foo; + + is valid in C but not in C++. These differences unfortunately + cannot be papered over by defining 'const' to be empty. + + If 'autoconf' detects this situation, it leaves 'const' alone, as + this generally yields better results in practice. However, using a + C++ compiler to compile C code is not recommended or supported, and + installers who run into trouble in this area should get a C + compiler like GCC to compile their C code. + + -- Macro: AC_C_VOLATILE + If the C compiler does not understand the keyword 'volatile', + define 'volatile' to be empty. Programs can simply use 'volatile' + as if every C compiler supported it; for those that do not, the + 'Makefile' or configuration header will define it as empty. + + If the correctness of your program depends on the semantics of + 'volatile', simply defining it to be empty does, in a sense, break + your code. However, given that the compiler does not support + 'volatile', you are at its mercy anyway. At least your program + will compile, when it wouldn't before. + + In general, the 'volatile' keyword is a feature of ANSI C, so you + might expect that 'volatile' is available only when '__STDC__' is + defined. However, Ultrix 4.3's native compiler does support + volatile, but does not defined '__STDC__'. + + -- Macro: AC_C_INLINE + If the C compiler supports the keyword 'inline', do nothing. + Otherwise define 'inline' to '__inline__' or '__inline' if it + accepts one of those, otherwise define 'inline' to be empty. + + -- Macro: AC_C_CHAR_UNSIGNED + If the C type 'char' is unsigned, define '__CHAR_UNSIGNED__', + unless the C compiler predefines it. + + -- Macro: AC_C_LONG_DOUBLE + If the C compiler supports the 'long double' type, define + 'HAVE_LONG_DOUBLE'. Some C compilers that do not define '__STDC__' + do support the 'long double' type; some compilers that define + '__STDC__' do not support 'long double'. + + -- Macro: AC_C_STRINGIZE + If the C preprocessor supports the stringizing operator, define + 'HAVE_STRINGIZE'. The stringizing operator is '#' and is found in + macros such as this: + + #define x(y) #y + + -- Macro: AC_C_PROTOTYPES + Check to see if function prototypes are understood by the compiler. + If so, define 'PROTOTYPES'. In the case the compiler does not + handle prototypes, you should use 'ansi2knr', which comes with the + Automake distribution, to unprotoize function definitions. For + function prototypes, you should first define 'PARAMS': + + #ifndef PARAMS + # if PROTOTYPES + # define PARAMS(protos) protos + # else /* no PROTOTYPES */ + # define PARAMS(protos) () + # endif /* no PROTOTYPES */ + #endif + + then use it this way: + + size_t my_strlen PARAMS ((const char *)); + + -- Macro: AC_PROG_GCC_TRADITIONAL + Add '-traditional' to output variable 'CC' if using the GNU C + compiler and 'ioctl' does not work properly without '-traditional'. + That usually happens when the fixed header files have not been + installed on an old system. Since recent versions of the GNU C + compiler fix the header files automatically when installed, this is + becoming a less prevalent problem. + + +File: autoconf.info, Node: C++ Compiler, Next: Fortran 77 Compiler, Prev: C Compiler, Up: Compilers and Preprocessors + +5.10.3 C++ Compiler Characteristics +----------------------------------- + + -- Macro: AC_PROG_CXX ([COMPILER-SEARCH-LIST]) + Determine a C++ compiler to use. Check if the environment variable + 'CXX' or 'CCC' (in that order) is set; if so, then set output + variable 'CXX' to its value. + + Otherwise, if the macro is invoked without an argument, then search + for a C++ compiler under the likely names (first 'g++' and 'c++' + then other names). If none of those checks succeed, then as a last + resort set 'CXX' to 'g++'. + + This macro may, however, be invoked with an optional first argument + which, if specified, must be a space separated list of C++ + compilers to search for. This just gives the user an opportunity + to specify an alternative search list for the C++ compiler. For + example, if you didn't like the default order, then you could + invoke 'AC_PROG_CXX' like this: + + AC_PROG_CXX(cl KCC CC cxx cc++ xlC aCC c++ g++ egcs gcc) + + If using the GNU C++ compiler, set shell variable 'GXX' to 'yes'. + If output variable 'CXXFLAGS' was not already set, set it to '-g + -O2' for the GNU C++ compiler ('-O2' on systems where G++ does not + accept '-g'), or '-g' for other compilers. + + -- Macro: AC_PROG_CXXCPP + Set output variable 'CXXCPP' to a command that runs the C++ + preprocessor. If '$CXX -E' doesn't work, '/lib/cpp' is used. It + is only portable to run 'CXXCPP' on files with a '.c', '.C', or + '.cc' extension. + + If the current language is C++ (*note Language Choice::), many of + the specific test macros use the value of 'CXXCPP' indirectly by + calling 'AC_TRY_CPP', 'AC_CHECK_HEADER', 'AC_EGREP_HEADER', or + 'AC_EGREP_CPP'. + + Some preprocessors don't indicate missing include files by the + error status. For such preprocessors an internal variable is set + that causes other macros to check the standard error from the + preprocessor and consider the test failed if any warnings have been + reported. However, it is not known whether such broken + preprocessors exist for C++. + + +File: autoconf.info, Node: Fortran 77 Compiler, Prev: C++ Compiler, Up: Compilers and Preprocessors + +5.10.4 Fortran 77 Compiler Characteristics +------------------------------------------ + + -- Macro: AC_PROG_F77 ([COMPILER-SEARCH-LIST]) + Determine a Fortran 77 compiler to use. If 'F77' is not already + set in the environment, then check for 'g77' and 'f77', and then + some other names. Set the output variable 'F77' to the name of the + compiler found. + + This macro may, however, be invoked with an optional first argument + which, if specified, must be a space separated list of Fortran 77 + compilers to search for. This just gives the user an opportunity + to specify an alternative search list for the Fortran 77 compiler. + For example, if you didn't like the default order, then you could + invoke 'AC_PROG_F77' like this: + + AC_PROG_F77(fl32 f77 fort77 xlf cf77 g77 f90 xlf90) + + If using 'g77' (the GNU Fortran 77 compiler), then 'AC_PROG_F77' + will set the shell variable 'G77' to 'yes'. If the output variable + 'FFLAGS' was not already set in the environment, then set it to '-g + -02' for 'g77' (or '-O2' where 'g77' does not accept '-g'). + Otherwise, set 'FFLAGS' to '-g' for all other Fortran 77 compilers. + + -- Macro: AC_PROG_F77_C_O + Test if the Fortran 77 compiler accepts the options '-c' and '-o' + simultaneously, and define 'F77_NO_MINUS_C_MINUS_O' if it does not. + + The following macros check for Fortran 77 compiler characteristics. +To check for characteristics not listed here, use 'AC_TRY_COMPILE' +(*note Examining Syntax::) or 'AC_TRY_RUN' (*note Run Time::), making +sure to first set the current language to Fortran 77 'AC_LANG(Fortran +77)' (*note Language Choice::). + + -- Macro: AC_F77_LIBRARY_LDFLAGS + Determine the linker flags (e.g. '-L' and '-l') for the "Fortran + 77 intrinsic and run-time libraries" that are required to + successfully link a Fortran 77 program or shared library. The + output variable 'FLIBS' is set to these flags. + + This macro is intended to be used in those situations when it is + necessary to mix, e.g. C++ and Fortran 77 source code into a + single program or shared library (*note (automake)Mixing Fortran 77 + With C and C++::). + + For example, if object files from a C++ and Fortran 77 compiler + must be linked together, then the C++ compiler/linker must be used + for linking (since special C++-ish things need to happen at link + time like calling global constructors, instantiating templates, + enabling exception support, etc.). + + However, the Fortran 77 intrinsic and run-time libraries must be + linked in as well, but the C++ compiler/linker doesn't know by + default how to add these Fortran 77 libraries. Hence, the macro + 'AC_F77_LIBRARY_LDFLAGS' was created to determine these Fortran 77 + libraries. + + The macro 'AC_F77_DUMMY_MAIN' or 'AC_F77_MAIN' will probably also + be necessary to link C/C++ with Fortran; see below. + + -- Macro: AC_F77_DUMMY_MAIN ([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) + With many compilers, the Fortran libraries detected by + 'AC_F77_LIBRARY_LDFLAGS' provide their own 'main' entry function + that initializes things like Fortran I/O, and which then calls a + user-provided entry function named e.g. 'MAIN__' to run the user's + program. The 'AC_F77_DUMMY_MAIN' or 'AC_F77_MAIN' macro figures + out how to deal with this interaction. + + When using Fortran for purely numerical functions (no I/O, + etcetera), users often prefer to provide their own 'main' and skip + the Fortran library initializations. In this case, however, one + may still need to provide a dummy 'MAIN__' routine in order to + prevent linking errors on some systems. 'AC_F77_DUMMY_MAIN' + detects whether any such routine is _required_ for linking, and + what its name is; the shell variable 'F77_DUMMY_MAIN' holds this + name, 'unknown' when no solution was found, and 'none' when no such + dummy main is needed. + + By default, ACTION-IF-FOUND defines 'F77_DUMMY_MAIN' to the name of + this routine (e.g. 'MAIN__') _if_ it is required. + [ACTION-IF-NOT-FOUND] defaults to exiting with an error. + + In order to link with Fortran routines, the user's C/C++ program + should then include the following code to define the dummy main if + it is needed: + + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + + Note that 'AC_F77_DUMMY_MAIN' is called automatically from + 'AC_F77_WRAPPERS'; there is generally no need to call it explicitly + unless one wants to change the default actions. + + -- Macro: AC_F77_MAIN + As discussed above for 'AC_F77_DUMMY_MAIN', many Fortran libraries + allow you to provide an entry point called e.g. 'MAIN__' instead + of the usual 'main', which is then called by a 'main' function in + the Fortran libraries that initializes things like Fortran I/O. The + 'AC_F77_MAIN' macro detects whether it is _possible_ to utilize + such an alternate main function, and defines 'F77_MAIN' to the name + of the function. (If no alternate main function name is found, + 'F77_MAIN' is simply defined to 'main'.) + + Thus, when calling Fortran routines from C that perform things like + I/O, one should use this macro and name the "main" function + 'F77_MAIN' instead of 'main'. + + -- Macro: AC_F77_WRAPPERS + Defines C macros 'F77_FUNC(name,NAME)' and 'F77_FUNC_(name,NAME)' + to properly mangle the names of C/C++ identifiers, and identifiers + with underscores, respectively, so that they match the + name-mangling scheme used by the Fortran 77 compiler. + + Fortran 77 is case-insensitive, and in order to achieve this the + Fortran 77 compiler converts all identifiers into a canonical case + and format. To call a Fortran 77 subroutine from C or to write a C + function that is callable from Fortran 77, the C program must + explicitly use identifiers in the format expected by the Fortran 77 + compiler. In order to do this, one simply wraps all C identifiers + in one of the macros provided by 'AC_F77_WRAPPERS'. For example, + suppose you have the following Fortran 77 subroutine: + + subroutine foobar(x,y) + double precision x, y + y = 3.14159 * x + return + end + + You would then declare its prototype in C or C++ as: + + #define FOOBAR_F77 F77_FUNC(foobar,FOOBAR) + #ifdef __cplusplus + extern "C" /* prevent C++ name mangling */ + #endif + void FOOBAR_F77(double *x, double *y); + + Note that we pass both the lowercase and uppercase versions of the + function name to 'F77_FUNC' so that it can select the right one. + Note also that all parameters to Fortran 77 routines are passed as + pointers (*note (automake)Mixing Fortran 77 With C and C++::). + + Although Autoconf tries to be intelligent about detecting the + name-mangling scheme of the Fortran 77 compiler, there may be + Fortran 77 compilers that it doesn't support yet. In this case, + the above code will generate a compile-time error, but some other + behavior (e.g. disabling Fortran-related features) can be induced + by checking whether the 'F77_FUNC' macro is defined. + + Now, to call that routine from a C program, we would do something + like: + + { + double x = 2.7183, y; + FOOBAR_F77(&x, &y); + } + + If the Fortran 77 identifier contains an underscore (e.g. + 'foo_bar'), you should use 'F77_FUNC_' instead of 'F77_FUNC' (with + the same arguments). This is because some Fortran 77 compilers + mangle names differently if they contain an underscore. + + -- Macro: AC_F77_FUNC (NAME, [SHELLVAR]) + Given an identifier NAME, set the shell variable SHELLVAR to hold + the mangled version NAME according to the rules of the Fortran 77 + linker (see also 'AC_F77_WRAPPERS'). SHELLVAR is optional; if it + is not supplied, the shell variable will be simply NAME. The + purpose of this macro is to give the caller a way to access the + name-mangling information other than through the C preprocessor as + above; for example, to call Fortran routines from some language + other than C/C++. + + +File: autoconf.info, Node: System Services, Next: UNIX Variants, Prev: Compilers and Preprocessors, Up: Existing Tests + +5.11 System Services +==================== + +The following macros check for operating system services or +capabilities. + + -- Macro: AC_PATH_X + Try to locate the X Window System include files and libraries. If + the user gave the command line options '--x-includes=DIR' and + '--x-libraries=DIR', use those directories. If either or both were + not given, get the missing values by running 'xmkmf' on a trivial + 'Imakefile' and examining the 'Makefile' that it produces. If that + fails (such as if 'xmkmf' is not present), look for them in several + directories where they often reside. If either method is + successful, set the shell variables 'x_includes' and 'x_libraries' + to their locations, unless they are in directories the compiler + searches by default. + + If both methods fail, or the user gave the command line option + '--without-x', set the shell variable 'no_x' to 'yes'; otherwise + set it to the empty string. + + -- Macro: AC_PATH_XTRA + An enhanced version of 'AC_PATH_X'. It adds the C compiler flags + that X needs to output variable 'X_CFLAGS', and the X linker flags + to 'X_LIBS'. Define 'X_DISPLAY_MISSING' if X is not available. + + This macro also checks for special libraries that some systems need + in order to compile X programs. It adds any that the system needs + to output variable 'X_EXTRA_LIBS'. And it checks for special X11R6 + libraries that need to be linked with before '-lX11', and adds any + found to the output variable 'X_PRE_LIBS'. + + -- Macro: AC_SYS_INTERPRETER + Check whether the system supports starting scripts with a line of + the form '#! /bin/csh' to select the interpreter to use for the + script. After running this macro, shell code in 'configure.ac' can + check the shell variable 'interpval'; it will be set to 'yes' if + the system supports '#!', 'no' if not. + + -- Macro: AC_SYS_LARGEFILE + Arrange for large-file support(1). On some hosts, one must use + special compiler options to build programs that can access large + files. Append any such options to the output variable 'CC'. + Define '_FILE_OFFSET_BITS' and '_LARGE_FILES' if necessary. + + Large-file support can be disabled by configuring with the + '--disable-largefile' option. + + If you use this macro, check that your program works even when + 'off_t' is longer than 'long', since this is common when large-file + support is enabled. For example, it is not correct to print an + arbitrary 'off_t' value 'X' with 'printf ("%ld", (long) X)'. + + -- Macro: AC_SYS_LONG_FILE_NAMES + If the system supports file names longer than 14 characters, define + 'HAVE_LONG_FILE_NAMES'. + + -- Macro: AC_SYS_POSIX_TERMIOS + Check to see if POSIX termios headers and functions are available + on the system. If so, set the shell variable + 'am_cv_sys_posix_termios' to 'yes'. If not, set the variable to + 'no'. + + ---------- Footnotes ---------- + + (1) large-file support, +<http://www.sas.com/standards/large.file/x_open.20Mar96.html>. + + +File: autoconf.info, Node: UNIX Variants, Prev: System Services, Up: Existing Tests + +5.12 UNIX Variants +================== + +The following macros check for certain operating systems that need +special treatment for some programs, due to exceptional oddities in +their header files or libraries. These macros are warts; they will be +replaced by a more systematic approach, based on the functions they make +available or the environments they provide. + + -- Macro: AC_AIX + If on AIX, define '_ALL_SOURCE'. Allows the use of some BSD + functions. Should be called before any macros that run the C + compiler. + + -- Macro: AC_ISC_POSIX + If on a POSIXized ISC UNIX, define '_POSIX_SOURCE' and add '-posix' + (for the GNU C compiler) or '-Xp' (for other C compilers) to output + variable 'CC'. This allows the use of POSIX facilities. Must be + called after 'AC_PROG_CC' and before any other macros that run the + C compiler. + + -- Macro: AC_MINIX + If on Minix, define '_MINIX' and '_POSIX_SOURCE' and define + '_POSIX_1_SOURCE' to be 2. This allows the use of POSIX + facilities. Should be called before any macros that run the C + compiler. + + +File: autoconf.info, Node: Writing Tests, Next: Results, Prev: Existing Tests, Up: Top + +6 Writing Tests +*************** + +If the existing feature tests don't do something you need, you have to +write new ones. These macros are the building blocks. They provide +ways for other macros to check whether various kinds of features are +available and report the results. + + This chapter contains some suggestions and some of the reasons why +the existing tests are written the way they are. You can also learn a +lot about how to write Autoconf tests by looking at the existing ones. +If something goes wrong in one or more of the Autoconf tests, this +information can help you understand the assumptions behind them, which +might help you figure out how to best solve the problem. + + These macros check the output of the C compiler system. They do not +cache the results of their tests for future use (*note Caching +Results::), because they don't know enough about the information they +are checking for to generate a cache variable name. They also do not +print any messages, for the same reason. The checks for particular +kinds of C features call these macros and do cache their results and +print messages about what they're checking for. + + When you write a feature test that could be applicable to more than +one software package, the best thing to do is encapsulate it in a new +macro. *Note Writing Autoconf Macros::, for how to do that. + +* Menu: + +* Examining Declarations:: Detecting header files and declarations +* Examining Syntax:: Detecting language syntax features +* Examining Libraries:: Detecting functions and global variables +* Run Time:: Testing for run-time features +* Systemology:: A zoology of operating systems +* Multiple Cases:: Tests for several possible values +* Language Choice:: Selecting which language to use for testing + + +File: autoconf.info, Node: Examining Declarations, Next: Examining Syntax, Prev: Writing Tests, Up: Writing Tests + +6.1 Examining Declarations +========================== + +The macro 'AC_TRY_CPP' is used to check whether particular header files +exist. You can check for one at a time, or more than one if you need +several header files to all exist for some purpose. + + -- Macro: AC_TRY_CPP (INCLUDES, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) + INCLUDES is C or C++ '#include' statements and declarations, on + which shell variable, back quote, and backslash substitutions are + performed. (Actually, it can be any C program, but other + statements are probably not useful.) If the preprocessor produces + no error messages while processing it, run shell commands + ACTION-IF-TRUE. Otherwise run shell commands ACTION-IF-FALSE. + + This macro uses 'CPPFLAGS', but not 'CFLAGS', because '-g', '-O', + etc. are not valid options to many C preprocessors. + + Here is how to find out whether a header file contains a particular +declaration, such as a typedef, a structure, a structure member, or a +function. Use 'AC_EGREP_HEADER' instead of running 'grep' directly on +the header file; on some systems the symbol might be defined in another +header file that the file you are checking '#include's. + + -- Macro: AC_EGREP_HEADER (PATTERN, HEADER-FILE, ACTION-IF-FOUND, + [ACTION-IF-NOT-FOUND]) + If the output of running the preprocessor on the system header file + HEADER-FILE matches the 'egrep' regular expression PATTERN, execute + shell commands ACTION-IF-FOUND, otherwise execute + ACTION-IF-NOT-FOUND. + + To check for C preprocessor symbols, either defined by header files +or predefined by the C preprocessor, use 'AC_EGREP_CPP'. Here is an +example of the latter: + + AC_EGREP_CPP(yes, + [#ifdef _AIX + yes + #endif + ], is_aix=yes, is_aix=no) + + -- Macro: AC_EGREP_CPP (PATTERN, PROGRAM, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND]) + PROGRAM is the text of a C or C++ program, on which shell variable, + back quote, and backslash substitutions are performed. If the + output of running the preprocessor on PROGRAM matches the 'egrep' + regular expression PATTERN, execute shell commands ACTION-IF-FOUND, + otherwise execute ACTION-IF-NOT-FOUND. + + This macro calls 'AC_PROG_CPP' or 'AC_PROG_CXXCPP' (depending on + which language is current, *note Language Choice::), if it hasn't + been called already. + + +File: autoconf.info, Node: Examining Syntax, Next: Examining Libraries, Prev: Examining Declarations, Up: Writing Tests + +6.2 Examining Syntax +==================== + +To check for a syntax feature of the C, C++ or Fortran 77 compiler, such +as whether it recognizes a certain keyword, use 'AC_TRY_COMPILE' to try +to compile a small program that uses that feature. You can also use it +to check for structures and structure members that are not present on +all systems. + + -- Macro: AC_TRY_COMPILE (INCLUDES, FUNCTION-BODY, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND]) + Create a C, C++ or Fortran 77 test program (depending on which + language is current, *note Language Choice::), to see whether a + function whose body consists of FUNCTION-BODY can be compiled. + + For C and C++, INCLUDES is any '#include' statements needed by the + code in FUNCTION-BODY (INCLUDES will be ignored if the currently + selected language is Fortran 77). This macro also uses 'CFLAGS' or + 'CXXFLAGS' if either C or C++ is the currently selected language, + as well as 'CPPFLAGS', when compiling. If Fortran 77 is the + currently selected language then 'FFLAGS' will be used when + compiling. + + If the file compiles successfully, run shell commands + ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND. + + This macro does not try to link; use 'AC_TRY_LINK' if you need to + do that (*note Examining Libraries::). + + +File: autoconf.info, Node: Examining Libraries, Next: Run Time, Prev: Examining Syntax, Up: Writing Tests + +6.3 Examining Libraries +======================= + +To check for a library, a function, or a global variable, Autoconf +'configure' scripts try to compile and link a small program that uses +it. This is unlike Metaconfig, which by default uses 'nm' or 'ar' on +the C library to try to figure out which functions are available. +Trying to link with the function is usually a more reliable approach +because it avoids dealing with the variations in the options and output +formats of 'nm' and 'ar' and in the location of the standard libraries. +It also allows configuring for cross-compilation or checking a +function's runtime behavior if needed. On the other hand, it can be +slower than scanning the libraries once. + + A few systems have linkers that do not return a failure exit status +when there are unresolved functions in the link. This bug makes the +configuration scripts produced by Autoconf unusable on those systems. +However, some of them can be given options that make the exit status +correct. This is a problem that Autoconf does not currently handle +automatically. If users encounter this problem, they might be able to +solve it by setting 'LDFLAGS' in the environment to pass whatever +options the linker needs (for example, '-Wl,-dn' on MIPS RISC/OS). + + 'AC_TRY_LINK' is used to compile test programs to test for functions +and global variables. It is also used by 'AC_CHECK_LIB' to check for +libraries (*note Libraries::), by adding the library being checked for +to 'LIBS' temporarily and trying to link a small program. + + -- Macro: AC_TRY_LINK (INCLUDES, FUNCTION-BODY, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND]) + Depending on the current language (*note Language Choice::), create + a test program to see whether a function whose body consists of + FUNCTION-BODY can be compiled and linked. + + For C and C++, INCLUDES is any '#include' statements needed by the + code in FUNCTION-BODY (INCLUDES will be ignored if the currently + selected language is Fortran 77). This macro also uses 'CFLAGS' or + 'CXXFLAGS' if either C or C++ is the currently selected language, + as well as 'CPPFLAGS', when compiling. If Fortran 77 is the + currently selected language then 'FFLAGS' will be used when + compiling. However, both 'LDFLAGS' and 'LIBS' will be used during + linking in all cases. + + If the file compiles and links successfully, run shell commands + ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND. + + -- Macro: AC_TRY_LINK_FUNC (FUNCTION, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND]) + Depending on the current language (*note Language Choice::), create + a test program to see whether a program whose body consists of a + prototype of and a call to FUNCTION can be compiled and linked. + + If the file compiles and links successfully, run shell commands + ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND. + + +File: autoconf.info, Node: Run Time, Next: Systemology, Prev: Examining Libraries, Up: Writing Tests + +6.4 Checking Run Time Behavior +============================== + +Sometimes you need to find out how a system performs at run time, such +as whether a given function has a certain capability or bug. If you +can, make such checks when your program runs instead of when it is +configured. You can check for things like the machine's endianness when +your program initializes itself. + + If you really need to test for a run-time behavior while configuring, +you can write a test program to determine the result, and compile and +run it using 'AC_TRY_RUN'. Avoid running test programs if possible, +because this prevents people from configuring your package for +cross-compiling. + +* Menu: + +* Test Programs:: Running test programs +* Guidelines:: General rules for writing test programs +* Test Functions:: Avoiding pitfalls in test programs + + +File: autoconf.info, Node: Test Programs, Next: Guidelines, Prev: Run Time, Up: Run Time + +6.4.1 Running Test Programs +--------------------------- + +Use the following macro if you need to test run-time behavior of the +system while configuring. + + -- Macro: AC_TRY_RUN (PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE], + [ACTION-IF-CROSS-COMPILING]) + PROGRAM is the text of a C program, on which shell variable and + back quote substitutions are performed. If it compiles and links + successfully and returns an exit status of 0 when executed, run + shell commands ACTION-IF-TRUE. Otherwise, run shell commands + ACTION-IF-FALSE; the exit status of the program is available in the + shell variable '$?'. This macro uses 'CFLAGS' or 'CXXFLAGS', + 'CPPFLAGS', 'LDFLAGS', and 'LIBS' when compiling. + + If the C compiler being used does not produce executables that run + on the system where 'configure' is being run, then the test program + is not run. If the optional shell commands + ACTION-IF-CROSS-COMPILING are given, they are run instead. + Otherwise, 'configure' prints an error message and exits. + + Try to provide a pessimistic default value to use when +cross-compiling makes run-time tests impossible. You do this by passing +the optional last argument to 'AC_TRY_RUN'. 'autoconf' prints a warning +message when creating 'configure' each time it encounters a call to +'AC_TRY_RUN' with no ACTION-IF-CROSS-COMPILING argument given. You may +ignore the warning, though users will not be able to configure your +package for cross-compiling. A few of the macros distributed with +Autoconf produce this warning message. + + To configure for cross-compiling you can also choose a value for +those parameters based on the canonical system name (*note Manual +Configuration::). Alternatively, set up a test results cache file with +the correct values for the host system (*note Caching Results::). + + To provide a default for calls of 'AC_TRY_RUN' that are embedded in +other macros, including a few of the ones that come with Autoconf, you +can call 'AC_PROG_CC' before running them. Then, if the shell variable +'cross_compiling' is set to 'yes', use an alternate method to get the +results instead of calling the macros. + + +File: autoconf.info, Node: Guidelines, Next: Test Functions, Prev: Test Programs, Up: Run Time + +6.4.2 Guidelines for Test Programs +---------------------------------- + +Test programs should not write anything to the standard output. They +should return 0 if the test succeeds, nonzero otherwise, so that success +can be distinguished easily from a core dump or other failure; +segmentation violations and other failures produce a nonzero exit +status. Test programs should 'exit', not 'return', from 'main', because +on some systems (old Suns, at least) the argument to 'return' in 'main' +is ignored. + + Test programs can use '#if' or '#ifdef' to check the values of +preprocessor macros defined by tests that have already run. For +example, if you call 'AC_HEADER_STDC', then later on in 'configure.ac' +you can have a test program that includes an ANSI C header file +conditionally: + + #if STDC_HEADERS + # include <stdlib.h> + #endif + + If a test program needs to use or create a data file, give it a name +that starts with 'conftest', such as 'conftest.data'. The 'configure' +script cleans up by running 'rm -rf conftest*' after running test +programs and if the script is interrupted. + + +File: autoconf.info, Node: Test Functions, Prev: Guidelines, Up: Run Time + +6.4.3 Test Functions +-------------------- + +Function declarations in test programs should have a prototype +conditionalized for C++. In practice, though, test programs rarely need +functions that take arguments. + + #ifdef __cplusplus + foo (int i) + #else + foo (i) int i; + #endif + + Functions that test programs declare should also be conditionalized +for C++, which requires 'extern "C"' prototypes. Make sure to not +include any header files containing clashing prototypes. + + #ifdef __cplusplus + extern "C" void *malloc (size_t); + #else + char *malloc (); + #endif + + If a test program calls a function with invalid parameters (just to +see whether it exists), organize the program to ensure that it never +invokes that function. You can do this by calling it in another +function that is never invoked. You can't do it by putting it after a +call to 'exit', because GCC version 2 knows that 'exit' never returns +and optimizes out any code that follows it in the same block. + + If you include any header files, make sure to call the functions +relevant to them with the correct number of arguments, even if they are +just 0, to avoid compilation errors due to prototypes. GCC version 2 +has internal prototypes for several functions that it automatically +inlines; for example, 'memcpy'. To avoid errors when checking for them, +either pass them the correct number of arguments or redeclare them with +a different return type (such as 'char'). + + +File: autoconf.info, Node: Systemology, Next: Multiple Cases, Prev: Run Time, Up: Writing Tests + +6.5 Systemology +=============== + +This section aims at presenting some systems and pointers to +documentation. It may help you addressing particular problems reported +by users. + +QNX 4.25 + QNX is a realtime operating system running on Intel architecture + meant to be scalable from the small embedded systems to hundred + processor super-computer. It claims to be POSIX certified. More + information is available on the QNX home page(1), including the QNX + man pages(2). + + ---------- Footnotes ---------- + + (1) QNX home page, <www.qnx.com>. + + (2) QNX man pages, <http://support.qnx.com/support/docs/qnx4/>. + + +File: autoconf.info, Node: Multiple Cases, Next: Language Choice, Prev: Systemology, Up: Writing Tests + +6.6 Multiple Cases +================== + +Some operations are accomplished in several possible ways, depending on +the UNIX variant. Checking for them essentially requires a "case +statement". Autoconf does not directly provide one; however, it is easy +to simulate by using a shell variable to keep track of whether a way to +perform the operation has been found yet. + + Here is an example that uses the shell variable 'fstype' to keep +track of whether the remaining cases need to be checked. + + AC_MSG_CHECKING([how to get file system type]) + fstype=no + # The order of these tests is important. + AC_TRY_CPP([#include <sys/statvfs.h> + #include <sys/fstyp.h>], + [AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4]) + if test $fstype = no; then + AC_TRY_CPP([#include <sys/statfs.h> + #include <sys/fstyp.h>], + [AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3]) + fi + if test $fstype = no; then + AC_TRY_CPP([#include <sys/statfs.h> + #include <sys/vmount.h>], + [AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX]) + fi + # (more cases omitted here) + AC_MSG_RESULT([$fstype]) + + +File: autoconf.info, Node: Language Choice, Prev: Multiple Cases, Up: Writing Tests + +6.7 Language Choice +=================== + +Autoconf-generated 'configure' scripts check for the C compiler and its +features by default. Packages that use other programming languages +(maybe more than one, e.g. C and C++) need to test features of the +compilers for the respective languages. The following macros determine +which programming language is used in the subsequent tests in +'configure.ac'. + + -- Macro: AC_LANG (LANGUAGE) + Do compilation tests using the compiler, preprocessor and file + extensions for the specified LANGUAGE. + + Supported languages are: + + 'C' + Do compilation tests using 'CC' and 'CPP' and use extension + '.c' for test programs. + + 'C++' + Do compilation tests using 'CXX' and 'CXXCPP' and use + extension '.C' for test programs. + + 'Fortran 77' + Do compilation tests using 'F77' and use extension '.f' for + test programs. + + -- Macro: AC_LANG_PUSH (LANGUAGE) + Remember the current language (as set by 'AC_LANG') on a stack, and + then select the LANGUAGE. Use this macro and 'AC_LANG_POP' in + macros that need to temporarily switch to a particular language. + + -- Macro: AC_LANG_POP ([LANGUAGE]) + Select the language that is saved on the top of the stack, as set + by 'AC_LANG_PUSH', and remove it from the stack. + + If given, LANGUAGE specifies the language we just _quit_. It is a + good idea to specify it when it's known (which should be the + case...), since Autoconf will detect inconsistencies. + + AC_LANG_PUSH(Fortran 77) + # Perform some tests on Fortran 77. + # ... + AC_LANG_POP(Fortran 77) + + -- Macro: AC_REQUIRE_CPP + Ensure that whichever preprocessor would currently be used for + tests has been found. Calls 'AC_REQUIRE' (*note Prerequisite + Macros::) with an argument of either 'AC_PROG_CPP' or + 'AC_PROG_CXXCPP', depending on which language is current. + + +File: autoconf.info, Node: Results, Next: Programming in M4, Prev: Writing Tests, Up: Top + +7 Results of Tests +****************** + +Once 'configure' has determined whether a feature exists, what can it do +to record that information? There are four sorts of things it can do: +define a C preprocessor symbol, set a variable in the output files, save +the result in a cache file for future 'configure' runs, and print a +message letting the user know the result of the test. + +* Menu: + +* Defining Symbols:: Defining C preprocessor symbols +* Setting Output Variables:: Replacing variables in output files +* Caching Results:: Speeding up subsequent 'configure' runs +* Printing Messages:: Notifying 'configure' users + + +File: autoconf.info, Node: Defining Symbols, Next: Setting Output Variables, Prev: Results, Up: Results + +7.1 Defining C Preprocessor Symbols +=================================== + +A common action to take in response to a feature test is to define a C +preprocessor symbol indicating the results of the test. That is done by +calling 'AC_DEFINE' or 'AC_DEFINE_UNQUOTED'. + + By default, 'AC_OUTPUT' places the symbols defined by these macros +into the output variable 'DEFS', which contains an option +'-DSYMBOL=VALUE' for each symbol defined. Unlike in Autoconf version 1, +there is no variable 'DEFS' defined while 'configure' is running. To +check whether Autoconf macros have already defined a certain C +preprocessor symbol, test the value of the appropriate cache variable, +as in this example: + + AC_CHECK_FUNC(vprintf, [AC_DEFINE(HAVE_VPRINTF)]) + if test "$ac_cv_func_vprintf" != yes; then + AC_CHECK_FUNC(_doprnt, [AC_DEFINE(HAVE_DOPRNT)]) + fi + + If 'AC_CONFIG_HEADERS' has been called, then instead of creating +'DEFS', 'AC_OUTPUT' creates a header file by substituting the correct +values into '#define' statements in a template file. *Note +Configuration Headers::, for more information about this kind of output. + + -- Macro: AC_DEFINE (VARIABLE, [VALUE], [DESCRIPTION]) + Define C preprocessor variable VARIABLE. If VALUE is given, set + VARIABLE to that value (verbatim), otherwise set it to 1. VALUE + should not contain literal newlines, and if you are not using + 'AC_CONFIG_HEADERS' it should not contain any '#' characters, as + 'make' tends to eat them. To use a shell variable (which you need + to do in order to define a value containing the M4 quote characters + '[' or ']'), use 'AC_DEFINE_UNQUOTED' instead. DESCRIPTION is only + useful if you are using 'AC_CONFIG_HEADERS'. In this case, + DESCRIPTION is put into the generated 'config.h.in' as the comment + before the macro define. The following example defines the C + preprocessor variable 'EQUATION' to be the string constant '"$a > + $b"': + + AC_DEFINE(EQUATION, "$a > $b") + + -- Macro: AC_DEFINE_UNQUOTED (VARIABLE, [VALUE], [DESCRIPTION]) + Like 'AC_DEFINE', but three shell expansions are + performed--once--on VARIABLE and VALUE: variable expansion ('$'), + command substitution ('`'), and backslash escaping ('\'). Single + and double quote characters in the value have no special meaning. + Use this macro instead of 'AC_DEFINE' when VARIABLE or VALUE is a + shell variable. Examples: + + AC_DEFINE_UNQUOTED(config_machfile, "$machfile") + AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups) + AC_DEFINE_UNQUOTED($ac_tr_hdr) + + Due to the syntactical bizarreness of the Bourne shell, do not use +semicolons to separate 'AC_DEFINE' or 'AC_DEFINE_UNQUOTED' calls from +other macro calls or shell code; that can cause syntax errors in the +resulting 'configure' script. Use either spaces or newlines. That is, +do this: + + AC_CHECK_HEADER(elf.h, [AC_DEFINE(SVR4) LIBS="$LIBS -lelf"]) + +or this: + + AC_CHECK_HEADER(elf.h, + [AC_DEFINE(SVR4) + LIBS="$LIBS -lelf"]) + +instead of this: + + AC_CHECK_HEADER(elf.h, [AC_DEFINE(SVR4); LIBS="$LIBS -lelf"]) + + +File: autoconf.info, Node: Setting Output Variables, Next: Caching Results, Prev: Defining Symbols, Up: Results + +7.2 Setting Output Variables +============================ + +Another way to record the results of tests is to set "output variables", +which are shell variables whose values are substituted into files that +'configure' outputs. The two macros below create new output variables. +*Note Preset Output Variables::, for a list of output variables that are +always available. + + -- Macro: AC_SUBST (VARIABLE, [VALUE]) + Create an output variable from a shell variable. Make 'AC_OUTPUT' + substitute the variable VARIABLE into output files (typically one + or more 'Makefile's). This means that 'AC_OUTPUT' will replace + instances of '@VARIABLE@' in input files with the value that the + shell variable VARIABLE has when 'AC_OUTPUT' is called. This value + of VARIABLE should not contain literal newlines. + + If VALUE is given, in addition assign it to 'variable'. + + -- Macro: AC_SUBST_FILE (VARIABLE) + Another way to create an output variable from a shell variable. + Make 'AC_OUTPUT' insert (without substitutions) the contents of the + file named by shell variable VARIABLE into output files. This + means that 'AC_OUTPUT' will replace instances of '@VARIABLE@' in + output files (such as 'Makefile.in') with the contents of the file + that the shell variable VARIABLE names when 'AC_OUTPUT' is called. + Set the variable to '/dev/null' for cases that do not have a file + to insert. + + This macro is useful for inserting 'Makefile' fragments containing + special dependencies or other 'make' directives for particular host + or target types into 'Makefile's. For example, 'configure.ac' + could contain: + + AC_SUBST_FILE(host_frag) + host_frag=$srcdir/conf/sun4.mh + + and then a 'Makefile.in' could contain: + + @host_frag@ + + Running 'configure' in different environments can be extremely +dangerous. If for instance the user runs 'CC=bizarre-cc ./configure', +then the cache, 'config.h' and many other output files will depend upon +'bizarre-cc' being the C compiler. If for some reason the user runs +'/configure' again, or if it is run via './config.status --recheck', +(*Note Automatic Remaking::, and *note config.status Invocation::), then +the configuration can be inconsistent, composed of results depending +upon two different compilers. + + Such variables are named "precious variables", and can be declared as +such by 'AC_ARG_VAR'. + + -- Macro: AC_ARG_VAR (VARIABLE, DESCRIPTION) + Declare VARIABLE is a precious variable, and include its + DESCRIPTION in the variable section of './configure --help'. + + Being precious means that + - VARIABLE is 'AC_SUBST''d. + + - VARIABLE is kept in the cache including if it was not + specified on the './configure' command line. Indeed, while + 'configure' can notice the definition of 'CC' in './configure + CC=bizarre-cc', it is impossible to notice it in + 'CC=bizarre-cc ./configure', which, unfortunately, is what + most users do. + + - VARIABLE is checked for consistency between two 'configure' + runs. For instance: + + $ ./configure --silent --config-cache + $ CC=cc ./configure --silent --config-cache + configure: error: `CC' was not set in the previous run + configure: error: changes in the environment can compromise \ + the build + configure: error: run `make distclean' and/or \ + `rm config.cache' and start over + + and similarly if the variable is unset, or if its content is + changed. + + - VARIABLE is kept during automatic reconfiguration (*note + config.status Invocation::) as if it had been passed as a + command line argument, including when no cache is used: + + $ CC=/usr/bin/cc ./configure undeclared_var=raboof --silent + $ ./config.status --recheck + running /bin/sh ./configure undeclared_var=raboof --silent \ + CC=/usr/bin/cc --no-create --no-recursion + + +File: autoconf.info, Node: Caching Results, Next: Printing Messages, Prev: Setting Output Variables, Up: Results + +7.3 Caching Results +=================== + +To avoid checking for the same features repeatedly in various +'configure' scripts (or in repeated runs of one script), 'configure' can +optionally save the results of many checks in a "cache file" (*note +Cache Files::). If a 'configure' script runs with caching enabled and +finds a cache file, it reads the results of previous runs from the cache +and avoids rerunning those checks. As a result, 'configure' can then +run much faster than if it had to perform all of the checks every time. + + -- Macro: AC_CACHE_VAL (CACHE-ID, COMMANDS-TO-SET-IT) + Ensure that the results of the check identified by CACHE-ID are + available. If the results of the check were in the cache file that + was read, and 'configure' was not given the '--quiet' or '--silent' + option, print a message saying that the result was cached; + otherwise, run the shell commands COMMANDS-TO-SET-IT. If the shell + commands are run to determine the value, the value will be saved in + the cache file just before 'configure' creates its output files. + *Note Cache Variable Names::, for how to choose the name of the + CACHE-ID variable. + + The COMMANDS-TO-SET-IT _must have no side effects_ except for + setting the variable CACHE-ID, see below. + + -- Macro: AC_CACHE_CHECK (MESSAGE, CACHE-ID, COMMANDS-TO-SET-IT) + A wrapper for 'AC_CACHE_VAL' that takes care of printing the + messages. This macro provides a convenient shorthand for the most + common way to use these macros. It calls 'AC_MSG_CHECKING' for + MESSAGE, then 'AC_CACHE_VAL' with the CACHE-ID and COMMANDS + arguments, and 'AC_MSG_RESULT' with CACHE-ID. + + The COMMANDS-TO-SET-IT _must have no side effects_ except for + setting the variable CACHE-ID, see below. + + It is very common to find buggy macros using 'AC_CACHE_VAL' or +'AC_CACHE_CHECK', because people are tempted to call 'AC_DEFINE' in the +COMMANDS-TO-SET-IT. Instead, the code that _follows_ the call to +'AC_CACHE_VAL' should call 'AC_DEFINE', by examining the value of the +cache variable. For instance, the following macro is broken: + + AC_DEFUN([AC_SHELL_TRUE], + [AC_CACHE_CHECK([whether true(1) works], [ac_cv_shell_true_works], + [ac_cv_shell_true_works=no + true && ac_cv_shell_true_works=yes + if test $ac_cv_shell_true_works = yes; then + AC_DEFINE([TRUE_WORKS], 1 + [Define if `true(1)' works properly.]) + fi]) + ]) + +This fails if the cache is enabled: the second time this macro is run, +'TRUE_WORKS' _will not be defined_. The proper implementation is: + + AC_DEFUN([AC_SHELL_TRUE], + [AC_CACHE_CHECK([whether true(1) works], [ac_cv_shell_true_works], + [ac_cv_shell_true_works=no + true && ac_cv_shell_true_works=yes]) + if test $ac_cv_shell_true_works = yes; then + AC_DEFINE([TRUE_WORKS], 1 + [Define if `true(1)' works properly.]) + fi + ]) + + Also, COMMANDS-TO-SET-IT should not print any messages, for example +with 'AC_MSG_CHECKING'; do that before calling 'AC_CACHE_VAL', so the +messages are printed regardless of whether the results of the check are +retrieved from the cache or determined by running the shell commands. + +* Menu: + +* Cache Variable Names:: Shell variables used in caches +* Cache Files:: Files 'configure' uses for caching +* Cache Checkpointing:: Loading and saving the cache file + + +File: autoconf.info, Node: Cache Variable Names, Next: Cache Files, Prev: Caching Results, Up: Caching Results + +7.3.1 Cache Variable Names +-------------------------- + +The names of cache variables should have the following format: + + PACKAGE-PREFIX_cv_VALUE-TYPE_SPECIFIC-VALUE_[ADDITIONAL-OPTIONS] + +for example, 'ac_cv_header_stat_broken' or 'ac_cv_prog_gcc_traditional'. +The parts of the variable name are: + +PACKAGE-PREFIX + An abbreviation for your package or organization; the same prefix + you begin local Autoconf macros with, except lowercase by + convention. For cache values used by the distributed Autoconf + macros, this value is 'ac'. + +'_cv_' + Indicates that this shell variable is a cache value. This string + _must_ be present in the variable name, including the leading + underscore. + +VALUE-TYPE + A convention for classifying cache values, to produce a rational + naming system. The values used in Autoconf are listed in *note + Macro Names::. + +SPECIFIC-VALUE + Which member of the class of cache values this test applies to. + For example, which function ('alloca'), program ('gcc'), or output + variable ('INSTALL'). + +ADDITIONAL-OPTIONS + Any particular behavior of the specific member that this test + applies to. For example, 'broken' or 'set'. This part of the name + may be omitted if it does not apply. + + The values assigned to cache variables may not contain newlines. +Usually, their values will be boolean ('yes' or 'no') or the names of +files or functions; so this is not an important restriction. + + +File: autoconf.info, Node: Cache Files, Next: Cache Checkpointing, Prev: Cache Variable Names, Up: Caching Results + +7.3.2 Cache Files +----------------- + +A cache file is a shell script that caches the results of configure +tests run on one system so they can be shared between configure scripts +and configure runs. It is not useful on other systems. If its contents +are invalid for some reason, the user may delete or edit it. + + By default, 'configure' uses no cache file (technically, it uses +'--cache-file=/dev/null'), to avoid problems caused by accidental use of +stale cache files. + + To enable caching, 'configure' accepts '--config-cache' (or '-C') to +cache results in the file 'config.cache'. Alternatively, +'--cache-file=FILE' specifies that FILE be the cache file. The cache +file is created if it does not exist already. When 'configure' calls +'configure' scripts in subdirectories, it uses the '--cache-file' +argument so that they share the same cache. *Note Subdirectories::, for +information on configuring subdirectories with the 'AC_CONFIG_SUBDIRS' +macro. + + 'config.status' only pays attention to the cache file if it is given +the '--recheck' option, which makes it rerun 'configure'. + + It is wrong to try to distribute cache files for particular system +types. There is too much room for error in doing that, and too much +administrative overhead in maintaining them. For any features that +can't be guessed automatically, use the standard method of the canonical +system type and linking files (*note Manual Configuration::). + + The site initialization script can specify a site-wide cache file to +use, instead of the usual per-program cache. In this case, the cache +file will gradually accumulate information whenever someone runs a new +'configure' script. (Running 'configure' merges the new cache results +with the existing cache file.) This may cause problems, however, if the +system configuration (e.g. the installed libraries or compilers) +changes and the stale cache file is not deleted. + + +File: autoconf.info, Node: Cache Checkpointing, Prev: Cache Files, Up: Caching Results + +7.3.3 Cache Checkpointing +------------------------- + +If your configure script, or a macro called from configure.ac, happens +to abort the configure process, it may be useful to checkpoint the cache +a few times at key points using 'AC_CACHE_SAVE'. Doing so will reduce +the amount of time it takes to re-run the configure script with +(hopefully) the error that caused the previous abort corrected. + + -- Macro: AC_CACHE_LOAD + Loads values from existing cache file, or creates a new cache file + if a cache file is not found. Called automatically from 'AC_INIT'. + + -- Macro: AC_CACHE_SAVE + Flushes all cached values to the cache file. Called automatically + from 'AC_OUTPUT', but it can be quite useful to call + 'AC_CACHE_SAVE' at key points in configure.ac. + + For instance: + + ... AC_INIT, etc. ... + # Checks for programs. + AC_PROG_CC + AC_PROG_GCC_TRADITIONAL + ... more program checks ... + AC_CACHE_SAVE + + # Checks for libraries. + AC_CHECK_LIB(nsl, gethostbyname) + AC_CHECK_LIB(socket, connect) + ... more lib checks ... + AC_CACHE_SAVE + + # Might abort... + AM_PATH_GTK(1.0.2,, (exit 1); exit) + AM_PATH_GTKMM(0.9.5,, (exit 1); exit) + ... AC_OUTPUT, etc. ... + + +File: autoconf.info, Node: Printing Messages, Prev: Caching Results, Up: Results + +7.4 Printing Messages +===================== + +'configure' scripts need to give users running them several kinds of +information. The following macros print messages in ways appropriate +for each kind. The arguments to all of them get enclosed in shell +double quotes, so the shell performs variable and back-quote +substitution on them. + + These macros are all wrappers around the 'echo' shell command. +'configure' scripts should rarely need to run 'echo' directly to print +messages for the user. Using these macros makes it easy to change how +and when each kind of message is printed; such changes need only be made +to the macro definitions and all of the callers will change +automatically. + + To diagnose static issues, i.e., when 'autoconf' is run, see *note +Reporting Messages::. + + -- Macro: AC_MSG_CHECKING (FEATURE-DESCRIPTION) + Notify the user that 'configure' is checking for a particular + feature. This macro prints a message that starts with 'checking ' + and ends with '...' and no newline. It must be followed by a call + to 'AC_MSG_RESULT' to print the result of the check and the + newline. The FEATURE-DESCRIPTION should be something like 'whether + the Fortran compiler accepts C++ comments' or 'for c89'. + + This macro prints nothing if 'configure' is run with the '--quiet' + or '--silent' option. + + -- Macro: AC_MSG_RESULT (RESULT-DESCRIPTION) + Notify the user of the results of a check. RESULT-DESCRIPTION is + almost always the value of the cache variable for the check, + typically 'yes', 'no', or a file name. This macro should follow a + call to 'AC_MSG_CHECKING', and the RESULT-DESCRIPTION should be the + completion of the message printed by the call to 'AC_MSG_CHECKING'. + + This macro prints nothing if 'configure' is run with the '--quiet' + or '--silent' option. + + -- Macro: AC_MSG_NOTICE (MESSAGE) + Deliver the MESSAGE to the user. It is useful mainly to print a + general description of the overall purpose of a group of feature + checks, e.g., + + AC_MSG_NOTICE([checking if stack overflow is detectable]) + + This macro prints nothing if 'configure' is run with the '--quiet' + or '--silent' option. + + -- Macro: AC_MSG_ERROR (ERROR-DESCRIPTION, [EXIT-STATUS]) + Notify the user of an error that prevents 'configure' from + completing. This macro prints an error message to the standard + error output and exits 'configure' with EXIT-STATUS (1 by default). + ERROR-DESCRIPTION should be something like 'invalid value $HOME for + \$HOME'. + + The ERROR-DESCRIPTION should start with a lower-case letter, and + "cannot" is preferred to "can't". + + -- Macro: AC_MSG_WARN (PROBLEM-DESCRIPTION) + Notify the 'configure' user of a possible problem. This macro + prints the message to the standard error output; 'configure' + continues running afterward, so macros that call 'AC_MSG_WARN' + should provide a default (back-up) behavior for the situations they + warn about. PROBLEM-DESCRIPTION should be something like 'ln -s + seems to make hard links'. + + +File: autoconf.info, Node: Programming in M4, Next: Writing Autoconf Macros, Prev: Results, Up: Top + +8 Programming in M4 +******************* + +Autoconf is written on top of two layers: "M4sugar", which provides +convenient macros for pure M4 programming, and "M4sh", which provides +macros dedicated to shell script generation. + + As of this version of Autoconf, these two layers are still +experimental, and their interface might change in the future. As a +matter of fact, _anything that is not documented must not be used_. + +* Menu: + +* M4 Quotation:: Protecting macros from unwanted expansion +* Programming in M4sugar:: Convenient pure M4 macros + + +File: autoconf.info, Node: M4 Quotation, Next: Programming in M4sugar, Prev: Programming in M4, Up: Programming in M4 + +8.1 M4 Quotation +================ + +The most common brokenness of existing macros is an improper quotation. +This section, which users of Autoconf can skip, but which macro writers +_must_ read, first justifies the quotation scheme that was chosen for +Autoconf and then ends with a rule of thumb. Understanding the former +helps one to follow the latter. + +* Menu: + +* Active Characters:: Characters that change the behavior of m4 +* One Macro Call:: Quotation and one macro call +* Quotation and Nested Macros:: Macros calling macros +* Quadrigraphs:: Another way to escape special characters +* Quotation Rule Of Thumb:: One parenthesis, one quote + + +File: autoconf.info, Node: Active Characters, Next: One Macro Call, Prev: M4 Quotation, Up: M4 Quotation + +8.1.1 Active Characters +----------------------- + +To fully understand where proper quotation is important, you first need +to know what are the special characters in Autoconf: '#' introduces a +comment inside which no macro expansion is performed, ',' separates +arguments, '[' and ']' are the quotes themselves, and finally '(' and +')' (which 'm4' tries to match by pairs). + + In order to understand the delicate case of macro calls, we first +have to present some obvious failures. Below they are "obvious-ified", +although you find them in real life, they are usually in disguise. + + Comments, introduced by a hash and running up to the newline, are +opaque tokens to the top level: active characters are turned off, and +there is no macro expansion: + + # define([def], ine) + =># define([def], ine) + + Each time there can be a macro expansion, there is a quotation +expansion; i.e., one level of quotes is stripped: + + int tab[10]; + =>int tab10; + [int tab[10];] + =>int tab[10]; + + Without this in mind, the reader will try hopelessly to use her macro +'array': + + define([array], [int tab[10];]) + array + =>int tab10; + [array] + =>array + +How can you correctly output the intended results(1)? + + ---------- Footnotes ---------- + + (1) Using 'defn'. + + +File: autoconf.info, Node: One Macro Call, Next: Quotation and Nested Macros, Prev: Active Characters, Up: M4 Quotation + +8.1.2 One Macro Call +-------------------- + +Let's proceed on the interaction between active characters and macros +with this small macro, which just returns its first argument: + + define([car], [$1]) + +The two pairs of quotes above are not part of the arguments of 'define'; +rather, they are understood by the top level when it tries to find the +arguments of 'define'. Therefore, it is equivalent to write: + + define(car, $1) + +But, while it is acceptable for a 'configure.ac' to avoid unneeded +quotes, it is bad practice for Autoconf macros which must both be more +robust and also advocate perfect style. + + At the top level, there are only two possible quotings: either you +quote or you don't: + + car(foo, bar, baz) + =>foo + [car(foo, bar, baz)] + =>car(foo, bar, baz) + + Let's pay attention to the special characters: + + car(#) + error->EOF in argument list + + The closing parenthesis is hidden in the comment; with a hypothetical +quoting, the top level understood it this way: + + car([#)] + +Proper quotation, of course, fixes the problem: + + car([#]) + =># + + The reader will easily understand the following examples: + + car(foo, bar) + =>foo + car([foo, bar]) + =>foo, bar + car((foo, bar)) + =>(foo, bar) + car([(foo], [bar)]) + =>(foo + car([], []) + => + car([[]], [[]]) + =>[] + + With this in mind, we can explore the cases where macros invoke +macros... + + +File: autoconf.info, Node: Quotation and Nested Macros, Next: Quadrigraphs, Prev: One Macro Call, Up: M4 Quotation + +8.1.3 Quotation and Nested Macros +--------------------------------- + +The examples below use the following macros: + + define([car], [$1]) + define([active], [ACT, IVE]) + define([array], [int tab[10]]) + + Each additional embedded macro call introduces other possible +interesting quotations: + + car(active) + =>ACT + car([active]) + =>ACT, IVE + car([[active]]) + =>active + + In the first case, the top level looks for the arguments of 'car', +and finds 'active'. Because 'm4' evaluates its arguments before +applying the macro, 'active' is expanded, which results in: + + car(ACT, IVE) + =>ACT + +In the second case, the top level gives 'active' as first and only +argument of 'car', which results in: + + active + =>ACT, IVE + +i.e., the argument is evaluated _after_ the macro that invokes it. In +the third case, 'car' receives '[active]', which results in: + + [active] + =>active + +exactly as we already saw above. + + The example above, applied to a more realistic example, gives: + + car(int tab[10];) + =>int tab10; + car([int tab[10];]) + =>int tab10; + car([[int tab[10];]]) + =>int tab[10]; + +Huh? The first case is easily understood, but why is the second wrong, +and the third right? To understand that, you must know that after 'm4' +expands a macro, the resulting text is immediately subjected to macro +expansion and quote removal. This means that the quote removal occurs +twice--first before the argument is passed to the 'car' macro, and +second after the 'car' macro expands to the first argument. + + As the author of the Autoconf macro 'car', you then consider it to be +incorrect that your users have to double-quote the arguments of 'car', +so you "fix" your macro. Let's call it 'qar' for quoted car: + + define([qar], [[$1]]) + +and check that 'qar' is properly fixed: + + qar([int tab[10];]) + =>int tab[10]; + +Ahhh! That's much better. + + But note what you've done: now that the arguments are literal +strings, if the user wants to use the results of expansions as +arguments, she has to use an _unquoted_ macro call: + + qar(active) + =>ACT + +where she wanted to reproduce what she used to do with 'car': + + car([active]) + =>ACT, IVE + +Worse yet: she wants to use a macro that produces a set of 'cpp' macros: + + define([my_includes], [#include <stdio.h>]) + car([my_includes]) + =>#include <stdio.h> + qar(my_includes) + error->EOF in argument list + + This macro, 'qar', because it double quotes its arguments, forces its +users to leave their macro calls unquoted, which is dangerous. Commas +and other active symbols are interpreted by 'm4' before they are given +to the macro, often not in the way the users expect. Also, because +'qar' behaves differently from the other macros, it's an exception that +should be avoided in Autoconf. + + +File: autoconf.info, Node: Quadrigraphs, Next: Quotation Rule Of Thumb, Prev: Quotation and Nested Macros, Up: M4 Quotation + +8.1.4 Quadrigraphs +------------------ + +When writing an autoconf macro you may occasionally need to generate +special characters that are difficult to express with the standard +autoconf quoting rules. For example, you may need to output the regular +expression '[^[]', which matches any character other than '['. This +expression contains unbalanced brackets so it cannot be put easily into +an M4 macro. + + You can work around this problem by using one of the following +"quadrigraphs": + +'@<:@' + '[' +'@:>@' + ']' +'@S|@' + '$' +'@%:@' + '#' + + Quadrigraphs are replaced at a late stage of the translation process, +after 'm4' is run, so they do not get in the way of M4 quoting. For +example, the string '[^@<:@]', if properly quoted, will appear as '[^[]' +in the 'configure' script. + + +File: autoconf.info, Node: Quotation Rule Of Thumb, Prev: Quadrigraphs, Up: M4 Quotation + +8.1.5 Quotation Rule Of Thumb +----------------------------- + +To conclude, the quotation rule of thumb is: + + _One pair of quotes per pair of parentheses._ + + Never over-quote, never under-quote, in particular in the definition +of macros. In the few places where the macros need to use brackets +(usually in C program text or regular expressions), properly quote _the +arguments_! + + It is common to read Autoconf programs with snippets like: + + AC_TRY_LINK( + changequote(<<, >>)dnl + <<#include <time.h> + #ifndef tzname /* For SGI. */ + extern char *tzname[]; /* RS6000 and others reject char **tzname. */ + #endif>>, + changequote([, ])dnl + [atoi (*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no) + +which is incredibly useless since 'AC_TRY_LINK' is _already_ double +quoting, so you just need: + + AC_TRY_LINK( + [#include <time.h> + #ifndef tzname /* For SGI. */ + extern char *tzname[]; /* RS6000 and others reject char **tzname. */ + #endif], + [atoi (*tzname);], + [ac_cv_var_tzname=yes], + [ac_cv_var_tzname=no]) + +The M4-fluent reader will note that these two examples are rigorously +equivalent, since 'm4' swallows both the 'changequote(<<, >>)' and '<<' +'>>' when it "collects" the arguments: these quotes are not part of the +arguments! + + Simplified, the example above is just doing this: + + changequote(<<, >>)dnl + <<[]>> + changequote([, ])dnl + +instead of simply: + + [[]] + + With macros that do not double quote their arguments (which is the +rule), double-quote the (risky) literals: + + AC_LINK_IFELSE([AC_LANG_PROGRAM( + [[#include <time.h> + #ifndef tzname /* For SGI. */ + extern char *tzname[]; /* RS6000 and others reject char **tzname. */ + #endif]], + [atoi (*tzname);])], + [ac_cv_var_tzname=yes], + [ac_cv_var_tzname=no]) + + See *Note Quadrigraphs::, for what to do if you run into a hopeless +case where quoting does not suffice. + + When you create a 'configure' script using newly written macros, +examine it carefully to check whether you need to add more quotes in +your macros. If one or more words have disappeared in the 'm4' output, +you need more quotes. When in doubt, quote. + + However, it's also possible to put on too many layers of quotes. If +this happens, the resulting 'configure' script will contain unexpanded +macros. The 'autoconf' program checks for this problem by doing 'grep +AC_ configure'. + + +File: autoconf.info, Node: Programming in M4sugar, Prev: M4 Quotation, Up: Programming in M4 + +8.2 Programming in M4sugar +========================== + +M4 by itself provides only a small, but sufficient, set of all-purpose +macros. M4sugar introduces additional generic macros. Its name was +coined by Lars J. Aas: "Readability And Greater Understanding Stands 4 +M4sugar". + +* Menu: + +* Redefined M4 Macros:: M4 builtins changed in M4sugar +* Forbidden Patterns:: Catching unexpanded macros + + +File: autoconf.info, Node: Redefined M4 Macros, Next: Forbidden Patterns, Prev: Programming in M4sugar, Up: Programming in M4sugar + +8.2.1 Redefined M4 Macros +------------------------- + +All the M4 native macros are moved in the 'm4_' pseudo-namespace, e.g., +M4sugar renames 'define' as 'm4_define' etc. There is one exception: +'dnl' kept its original name, and no 'm4_dnl' is defined. + + M4sugar redefines some M4 macros, and made them slightly incompatible +with their native equivalent. + + -- Macro: m4_defn (MACRO) + Contrary to the M4 builtin, this macro fails if MACRO is not + defined. See 'm4_undefine'. + + -- Macro: m4_undefine (MACRO) + Contrary to the M4 builtin, this macro fails if MACRO is not + defined. Use + + m4_ifdef([MACRO], [m4_undefine([MACRO])]) + + to recover the behavior of the builtin. + + -- Macro: m4_popdef (MACRO) + Contrary to the M4 builtin, this macro fails if MACRO is not + defined. See 'm4_undefine'. + + +File: autoconf.info, Node: Forbidden Patterns, Prev: Redefined M4 Macros, Up: Programming in M4sugar + +8.2.2 Forbidden Patterns +------------------------ + +M4sugar provides a means to define suspicious patterns, patterns +describing tokens which should not be found in the output. For +instance, if an Autoconf 'configure' script includes tokens such as +'AC_DEFINE', or 'dnl', then most probably something went wrong +(typically a macro was not evaluated because of over quotation). + + M4sugar forbids all the tokens matching '^m4_' and '^dnl$'. + + -- Macro: m4_pattern_forbid (PATTERN) + Declare no token matching PATTERN must be found in the output. + Comments are not checked; this can be a problem if, for instance, + you have some macro left unexpanded after an '#include'. No + consensus is currently found in the Autoconf community, as some + people consider it should be valid to name macros in comments + (which doesn't makes sense to the author of this documentation, as + '#'-comments should document the output, not the input, documented + vy 'dnl'-comments). + + Of course, you might encounter exceptions to these generic rules, for +instance you might have to refer to '$m4_flags'. + + -- Macro: m4_pattern_allow (PATTERN) + Any token matching PATTERN is allowed, including if it matches an + 'm4_pattern_forbid' pattern. + + +File: autoconf.info, Node: Writing Autoconf Macros, Next: Portable Shell, Prev: Programming in M4, Up: Top + +9 Writing Autoconf Macros +************************* + +When you write a feature test that could be applicable to more than one +software package, the best thing to do is encapsulate it in a new macro. +Here are some instructions and guidelines for writing Autoconf macros. + +* Menu: + +* Macro Definitions:: Basic format of an Autoconf macro +* Macro Names:: What to call your new macros +* Reporting Messages:: Notifying 'autoconf' users +* Dependencies Between Macros:: What to do when macros depend on other macros +* Obsoleting Macros:: Warning about old ways of doing things +* Coding Style:: Writing Autoconf macros à la Autoconf + + +File: autoconf.info, Node: Macro Definitions, Next: Macro Names, Prev: Writing Autoconf Macros, Up: Writing Autoconf Macros + +9.1 Macro Definitions +===================== + +Autoconf macros are defined using the 'AC_DEFUN' macro, which is similar +to the M4 builtin 'define' macro. In addition to defining a macro, +'AC_DEFUN' adds to it some code that is used to constrain the order in +which macros are called (*note Prerequisite Macros::). + + An Autoconf macro definition looks like this: + + AC_DEFUN(MACRO-NAME, MACRO-BODY) + + You can refer to any arguments passed to the macro as '$1', '$2', +etc. *Note How to define new macros: (m4.info)Definitions, for more +complete information on writing M4 macros. + + Be sure to properly quote both the MACRO-BODY _and_ the MACRO-NAME to +avoid any problems if the macro happens to have been previously defined. + + Each macro should have a header comment that gives its prototype, and +a brief description. When arguments have default values, display them +in the prototype. For example: + + # AC_MSG_ERROR(ERROR, [EXIT-STATUS = 1]) + # -------------------------------------- + define([AC_MSG_ERROR], + [{ _AC_ECHO([configure: error: $1], 2); exit m4_default([$2], 1); }]) + + Comments about the macro should be left in the header comment. Most +other comments will make their way into 'configure', so just keep using +'#' to introduce comments. + + If you have some very special comments about pure M4 code, comments +that make no sense in 'configure' and in the header comment, then use +the builtin 'dnl': it causes 'm4' to discard the text through the next +newline. + + Keep in mind that 'dnl' is rarely needed to introduce comments; 'dnl' +is more useful to get rid of the newlines following macros that produce +no output, such as 'AC_REQUIRE'. + + +File: autoconf.info, Node: Macro Names, Next: Reporting Messages, Prev: Macro Definitions, Up: Writing Autoconf Macros + +9.2 Macro Names +=============== + +All of the Autoconf macros have all-uppercase names starting with 'AC_' +to prevent them from accidentally conflicting with other text. All +shell variables that they use for internal purposes have +mostly-lowercase names starting with 'ac_'. To ensure that your macros +don't conflict with present or future Autoconf macros, you should prefix +your own macro names and any shell variables they use with some other +sequence. Possibilities include your initials, or an abbreviation for +the name of your organization or software package. + + Most of the Autoconf macros' names follow a structured naming +convention that indicates the kind of feature check by the name. The +macro names consist of several words, separated by underscores, going +from most general to most specific. The names of their cache variables +use the same convention (*note Cache Variable Names::, for more +information on them). + + The first word of the name after 'AC_' usually tells the category of +feature being tested. Here are the categories used in Autoconf for +specific test macros, the kind of macro that you are more likely to +write. They are also used for cache variables, in all-lowercase. Use +them where applicable; where they're not, invent your own categories. + +'C' + C language builtin features. +'DECL' + Declarations of C variables in header files. +'FUNC' + Functions in libraries. +'GROUP' + UNIX group owners of files. +'HEADER' + Header files. +'LIB' + C libraries. +'PATH' + The full path names to files, including programs. +'PROG' + The base names of programs. +'MEMBER' + Members of aggregates. +'SYS' + Operating system features. +'TYPE' + C builtin or declared types. +'VAR' + C variables in libraries. + + After the category comes the name of the particular feature being +tested. Any further words in the macro name indicate particular aspects +of the feature. For example, 'AC_FUNC_UTIME_NULL' checks the behavior +of the 'utime' function when called with a 'NULL' pointer. + + An internal macro should have a name that starts with an underscore; +Autoconf internals should therefore start with '_AC_'. Additionally, a +macro that is an internal subroutine of another macro should have a name +that starts with an underscore and the name of that other macro, +followed by one or more words saying what the internal macro does. For +example, 'AC_PATH_X' has internal macros '_AC_PATH_X_XMKMF' and +'_AC_PATH_X_DIRECT'. + + +File: autoconf.info, Node: Reporting Messages, Next: Dependencies Between Macros, Prev: Macro Names, Up: Writing Autoconf Macros + +9.3 Reporting Messages +====================== + +When macros statically diagnose abnormal situations, benign or fatal, +they should report them using these macros. For dynamic issues, i.e., +when 'configure' is run, see *note Printing Messages::. + + -- Macro: AC_DIAGNOSE (CATEGORY, MESSAGE) + Report MESSAGE as a warning (or as an error if requested by the + user) if it falls into the CATEGORY. You are encouraged to use + standard categories, which currently include: + + 'all' + messages that don't fall into one of the following category. + Use of an empty CATEGORY is equivalent. + + 'cross' + related to cross compilation issues. + + 'obsolete' + use of an obsolete construct. + + 'syntax' + dubious syntactic constructs, incorrectly ordered macro calls. + + -- Macro: AC_WARNING (MESSAGE) + Equivalent to 'AC_DIAGNOSE([syntax], MESSAGE)', but you are + strongly encouraged to use a finer grained category. + + -- Macro: AC_FATAL (MESSAGE) + Report a severe error MESSAGE, and have 'autoconf' die. + + When the user runs 'autoconf -W error', warnings from 'AC_DIAGNOSE' +and 'AC_WARNING' are reported as error, see *note autoconf Invocation::. + + +File: autoconf.info, Node: Dependencies Between Macros, Next: Obsoleting Macros, Prev: Reporting Messages, Up: Writing Autoconf Macros + +9.4 Dependencies Between Macros +=============================== + +Some Autoconf macros depend on other macros having been called first in +order to work correctly. Autoconf provides a way to ensure that certain +macros are called if needed and a way to warn the user if macros are +called in an order that might cause incorrect operation. + +* Menu: + +* Prerequisite Macros:: Ensuring required information +* Suggested Ordering:: Warning about possible ordering problems + + +File: autoconf.info, Node: Prerequisite Macros, Next: Suggested Ordering, Prev: Dependencies Between Macros, Up: Dependencies Between Macros + +9.4.1 Prerequisite Macros +------------------------- + +A macro that you write might need to use values that have previously +been computed by other macros. For example, 'AC_DECL_YYTEXT' examines +the output of 'flex' or 'lex', so it depends on 'AC_PROG_LEX' having +been called first to set the shell variable 'LEX'. + + Rather than forcing the user of the macros to keep track of the +dependencies between them, you can use the 'AC_REQUIRE' macro to do it +automatically. 'AC_REQUIRE' can ensure that a macro is only called if +it is needed, and only called once. + + -- Macro: AC_REQUIRE (MACRO-NAME) + If the M4 macro MACRO-NAME has not already been called, call it + (without any arguments). Make sure to quote MACRO-NAME with square + brackets. MACRO-NAME must have been defined using 'AC_DEFUN' or + else contain a call to 'AC_PROVIDE' to indicate that it has been + called. + + 'AC_REQUIRE' must be used inside an 'AC_DEFUN''d macro; it must not + be called from the top level. + + 'AC_REQUIRE' is often misunderstood. It really implements +dependencies between macros in the sense that if one macro depends upon +another, the latter will be expanded _before_ the body of the former. +In particular, 'AC_REQUIRE(FOO)' is not replaced with the body of 'FOO'. +For instance, this definition of macros: + + AC_DEFUN([TRAVOLTA], + [test "$body_temparature_in_celsius" -gt "38" && + dance_floor=occupied]) + AC_DEFUN([NEWTON_JOHN], + [test "$hair_style" = "curly" && + dance_floor=occupied]) + + AC_DEFUN([RESERVE_DANCE_FLOOR], + [if date | grep '^Sat.*pm' >/dev/null 2>&1; then + AC_REQUIRE([TRAVOLTA]) + AC_REQUIRE([NEWTON_JOHN]) + fi]) + +with this 'configure.ac' + + AC_INIT + RESERVE_DANCE_FLOOR + if test "$dance_floor" = occupied; then + AC_MSG_ERROR([cannot pick up here, let's move]) + fi + +will not leave you with a better chance to meet a kindred soul at other +times than Saturday night since it expands into: + + test "$body_temperature_in_Celsius" -gt "38" && + dance_floor=occupied + test "$hair_style" = "curly" && + dance_floor=occupied + fi + if date | grep '^Sat.*pm' >/dev/null 2>&1; then + + + fi + + This behavior was chosen on purpose: (i) it prevents messages in +required macros from interrupting the messages in the requiring macros; +(ii) it avoids bad surprises when shell conditionals are used, as in: + + if ...; then + AC_REQUIRE([SOME_CHECK]) + fi + ... + SOME_CHECK + + You are encouraged to put all 'AC_REQUIRE's at the beginning of a +macro. You can use 'dnl' to avoid the empty lines they leave. + + +File: autoconf.info, Node: Suggested Ordering, Prev: Prerequisite Macros, Up: Dependencies Between Macros + +9.4.2 Suggested Ordering +------------------------ + +Some macros should be run before another macro if both are called, but +neither _requires_ that the other be called. For example, a macro that +changes the behavior of the C compiler should be called before any +macros that run the C compiler. Many of these dependencies are noted in +the documentation. + + Autoconf provides the 'AC_BEFORE' macro to warn users when macros +with this kind of dependency appear out of order in a 'configure.ac' +file. The warning occurs when creating 'configure' from 'configure.ac', +not when running 'configure'. + + For example, 'AC_PROG_CPP' checks whether the C compiler can run the +C preprocessor when given the '-E' option. It should therefore be +called after any macros that change which C compiler is being used, such +as 'AC_PROG_CC'. So 'AC_PROG_CC' contains: + + AC_BEFORE([$0], [AC_PROG_CPP])dnl + +This warns the user if a call to 'AC_PROG_CPP' has already occurred when +'AC_PROG_CC' is called. + + -- Macro: AC_BEFORE (THIS-MACRO-NAME, CALLED-MACRO-NAME) + Make 'm4' print a warning message to the standard error output if + CALLED-MACRO-NAME has already been called. THIS-MACRO-NAME should + be the name of the macro that is calling 'AC_BEFORE'. The macro + CALLED-MACRO-NAME must have been defined using 'AC_DEFUN' or else + contain a call to 'AC_PROVIDE' to indicate that it has been called. + + +File: autoconf.info, Node: Obsoleting Macros, Next: Coding Style, Prev: Dependencies Between Macros, Up: Writing Autoconf Macros + +9.5 Obsoleting Macros +===================== + +Configuration and portability technology has evolved over the years. +Often better ways of solving a particular problem are developed, or +ad-hoc approaches are systematized. This process has occurred in many +parts of Autoconf. One result is that some of the macros are now +considered "obsolete"; they still work, but are no longer considered the +best thing to do, hence they should be replaced with more modern macros. +Ideally, 'autoupdate' should substitute the old macro calls with their +modern implementation. + + Autoconf provides a simple means to obsolete a macro. + + -- Macro: AU_DEFUN (OLD-MACRO, IMPLEMENTATION, [MESSAGE]) + Define OLD-MACRO as IMPLEMENTATION. The only difference with + 'AC_DEFUN' is that the user will be warned that OLD-MACRO is now + obsolete. + + If she then uses 'autoupdate', the call to OLD-MACRO will be + replaced by the modern IMPLEMENTATION. The additional MESSAGE is + then printed. + + +File: autoconf.info, Node: Coding Style, Prev: Obsoleting Macros, Up: Writing Autoconf Macros + +9.6 Coding Style +================ + +The Autoconf macros follow a strict coding style. You are encouraged to +follow this style, especially if you intend to distribute your macro, +either by contributing it to Autoconf itself, or via other means. + + The first requirement is to pay great attention to the quotation, for +more details, see *note Autoconf Language::, and *note M4 Quotation::. + + Do not try to invent new interfaces. It is likely that there is a +macro in Autoconf that resembles the macro you are defining: try to +stick to this existing interface (order of arguments, default values, +etc.). We _are_ conscious that some of these interfaces are not +perfect; nevertheless, when harmless, homogeneity should be preferred +over creativity. + + Be careful about clashes both between M4 symbols and between shell +variables. + + If you stick to the suggested M4 naming scheme (*note Macro Names::), +you are unlikely to generate conflicts. Nevertheless, when you need to +set a special value, _avoid using a regular macro name_; rather, use an +"impossible" name. For instance, up to version 2.13, the macro +'AC_SUBST' used to remember what SYMBOLs were already defined by setting +'AC_SUBST_SYMBOL', which is a regular macro name. But since there is a +macro named 'AC_SUBST_FILE', it was just impossible to 'AC_SUBST(FILE)'! +In this case, 'AC_SUBST(SYMBOL)' or '_AC_SUBST(SYMBOL)' should have been +used (yes, with the parentheses)...or better yet, high-level macros such +as 'AC_EXPAND_ONCE'. + + No Autoconf macro should ever enter the user-variable name space; +i.e., except for the variables that are the actual result of running the +macro, all shell variables should start with 'ac_'. In addition, small +macros or any macro that is likely to be embedded in other macros should +be careful not to use obvious names. + + Do not use 'dnl' to introduce comments: most of the comments you are +likely to write are either header comments which are not output anyway, +or comments that should make their way into 'configure'. There are +exceptional cases where you do want to comment special M4 constructs, in +which case 'dnl' is right, but keep in mind that it is unlikely. + + M4 ignores the leading spaces before each argument, use this feature +to indent in such a way that arguments are (more or less) aligned with +the opening parenthesis of the macro being called. For instance, +instead of + + AC_CACHE_CHECK(for EMX OS/2 environment, + ac_cv_emxos2, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __EMX__;])], + [ac_cv_emxos2=yes], [ac_cv_emxos2=no])]) + +write + + AC_CACHE_CHECK([for EMX OS/2 environment], [ac_cv_emxos2], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __EMX__;])], + [ac_cv_emxos2=yes], + [ac_cv_emxos2=no])]) + +or even + + AC_CACHE_CHECK([for EMX OS/2 environment], + [ac_cv_emxos2], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], + [return __EMX__;])], + [ac_cv_emxos2=yes], + [ac_cv_emxos2=no])]) + + When using 'AC_TRY_RUN' or any macro that cannot work when +cross-compiling, provide a pessimistic value (typically 'no'). + + Feel free to use various tricks to prevent auxiliary tools, such as +syntax-highlighting editors, from behaving improperly. For instance, +instead of: + + patsubst([$1], [$"]) + +use + + patsubst([$1], [$""]) + +so that Emacsen do not open a endless "string" at the first quote. For +the same reasons, avoid: + + test $[#] != 0 + +and use: + + test $[@%:@] != 0 + +Otherwise, the closing bracket would be hidden inside a '#'-comment, +breaking the bracket-matching highlighting from Emacsen. Note the +preferred style to escape from M4: '$[1]', '$[@]', etc. Do not escape +when it is unneeded. Common examples of useless quotation are '[$]$1' +(write '$$1'), '[$]var' (use '$var'), etc. If you add portability +issues to the picture, you'll prefer '${1+"$[@]"}' to '"[$]@"', and +you'll prefer do something better than hacking Autoconf ':-)'. + + When using 'sed', don't use '-e' except for indenting purpose. With +the 's' command, the preferred separator is '/' unless '/' itself is +used in the command, in which case you should use ','. + + *Note Macro Definitions::, for details on how to define a macro. If +a macro doesn't use 'AC_REQUIRE' and it is expected to never be the +object of an 'AC_REQUIRE' directive, then use 'define'. In case of +doubt, use 'AC_DEFUN'. All the 'AC_REQUIRE' statements should be at the +beginning of the macro, 'dnl''ed. + + You should not rely on the number of arguments: instead of checking +whether an argument is missing, test that it is not empty. It provides +both a simpler and a more predictable interface to the user, and saves +room for further arguments. + + Unless the macro is short, try to leave the closing '])' at the +beginning of a line, followed by a comment that repeats the name of the +macro being defined. This introduces an additional newline in +'configure'; normally, that is not a problem, but if you want to remove +it you can use '[]dnl' on the last line. You can similarly use '[]dnl' +after a macro call to remove its newline. '[]dnl' is recommended +instead of 'dnl' to ensure that M4 does not interpret the 'dnl' as being +attached to the preceding text or macro output. For example, instead +of: + + AC_DEFUN([AC_PATH_X], + [AC_MSG_CHECKING([for X]) + AC_REQUIRE_CPP() + # ...omitted... + AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) + fi]) + +you would write: + + AC_DEFUN([AC_PATH_X], + [AC_REQUIRE_CPP()[]dnl + AC_MSG_CHECKING([for X]) + # ...omitted... + AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) + fi[]dnl + ])# AC_PATH_X + + If the macro is long, try to split it into logical chunks. +Typically, macros that check for a bug in a function and prepare its +'AC_LIBOBJ' replacement should have an auxiliary macro to perform this +setup. Do not hesitate to introduce auxiliary macros to factor your +code. + + In order to highlight the recommended coding style, here is a macro +written the old way: + + dnl Check for EMX on OS/2. + dnl _AC_EMXOS2 + AC_DEFUN(_AC_EMXOS2, + [AC_CACHE_CHECK(for EMX OS/2 environment, ac_cv_emxos2, + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, return __EMX__;)], + ac_cv_emxos2=yes, ac_cv_emxos2=no)]) + test "$ac_cv_emxos2" = yes && EMXOS2=yes]) + +and the new way: + + # _AC_EMXOS2 + # ---------- + # Check for EMX on OS/2. + define([_AC_EMXOS2], + [AC_CACHE_CHECK([for EMX OS/2 environment], [ac_cv_emxos2], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __EMX__;])], + [ac_cv_emxos2=yes], + [ac_cv_emxos2=no])]) + test "$ac_cv_emxos2" = yes && EMXOS2=yes[]dnl + ])# _AC_EMXOS2 + + +File: autoconf.info, Node: Portable Shell, Next: Manual Configuration, Prev: Writing Autoconf Macros, Up: Top + +10 Portable Shell Programming +***************************** + +When writing your own checks, there are some shell-script programming +techniques you should avoid in order to make your code portable. The +Bourne shell and upward-compatible shells like the Korn shell and Bash +have evolved over the years, but to prevent trouble, do not take +advantage of features that were added after UNIX version 7, circa 1977. +You should not use shell functions, aliases, negated character classes, +or other features that are not found in all Bourne-compatible shells; +restrict yourself to the lowest common denominator. Even 'unset' is not +supported by all shells! Also, include a space after the exclamation +point in interpreter specifications, like this: + + #! /usr/bin/perl + +If you omit the space before the path, then 4.2BSD based systems (such +as Sequent DYNIX) will ignore the line, because they interpret '#! /' as +a 4-byte magic number. + + The set of external programs you should run in a 'configure' script +is fairly small. *Note Utilities in Makefiles: (standards)Utilities in +Makefiles, for the list. This restriction allows users to start out +with a fairly small set of programs and build the rest, avoiding too +many interdependencies between packages. + + Some of these external utilities have a portable subset of features; +see *note Limitations of Usual Tools::. + +* Menu: + +* Shellology:: A zoology of shells +* Here-Documents:: Quirks and tricks +* File Descriptors:: FDs and redirections +* File System Conventions:: File- and pathnames +* Shell Substitutions:: Variable and command expansions +* Assignments:: Varying side effects of assignments +* Special Shell Variables:: Variables you should not change +* Limitations of Builtins:: Portable use of not so portable /bin/sh +* Limitations of Usual Tools:: Portable use of portable tools +* Limitations of Make:: Portable Makefiles + + +File: autoconf.info, Node: Shellology, Next: Here-Documents, Prev: Portable Shell, Up: Portable Shell + +10.1 Shellology +=============== + +There are several families of shells, most prominently the Bourne family +and the C shell family which are deeply incompatible. If you want to +write portable shell scripts, avoid members of the C shell family. + + Below we describe some of the members of the Bourne shell family. + +Ash + 'ash' is often used on GNU/Linux and BSD systems as a light-weight + Bourne-compatible shell. Ash 0.2 has some bugs that are fixed in + the 0.3.x series, but portable shell scripts should workaround + them, since version 0.2 is still shipped with many GNU/Linux + distributions. + + To be compatible with Ash 0.2: + + - don't use '$?' after expanding empty or unset variables: + + foo= + false + $foo + echo "Don't use it: $?" + + - don't use command substitution within variable expansion: + + cat ${FOO=`bar`} + + - beware that single builtin substitutions are not performed by + a sub shell, hence their effect applies to the current shell! + *Note Shell Substitutions::, item "Command Substitution". + +Bash + To detect whether you are running 'bash', test if 'BASH_VERSION' is + set. To disable its extensions and require POSIX compatibility, + run 'set -o posix'. *Note Bash POSIX Mode: (bash)Bash POSIX Mode, + for details. + +'/usr/xpg4/bin/sh' on Solaris + The POSIX-compliant Bourne shell on a Solaris system is + '/usr/xpg4/bin/sh' and is part of an extra optional package. There + is no extra charge for this package, but it is also not part of a + minimal OS install and therefore some folks may not have it. + +Zsh + To detect whether you are running 'zsh', test if 'ZSH_VERSION' is + set. By default 'zsh' is _not_ compatible with the Bourne shell: + you have to run 'emulate sh' and set 'NULLCMD' to ':'. *Note + Compatibility: (zsh)Compatibility, for details. + + Zsh 3.0.8 is the native '/bin/sh' on Mac OS X 10.0.3. + + The following discussion between Russ Allbery and Robert Lipe is +worth reading: + +Russ Allbery: + + The GNU assumption that '/bin/sh' is the one and only shell leads + to a permanent deadlock. Vendors don't want to break user's + existent shell scripts, and there are some corner cases in the + Bourne shell that are not completely compatible with a POSIX shell. + Thus, vendors who have taken this route will _never_ (OK..."never + say never") replace the Bourne shell (as '/bin/sh') with a POSIX + shell. + +Robert Lipe: + + This is exactly the problem. While most (at least most System V's) + do have a bourne shell that accepts shell functions most vendor + '/bin/sh' programs are not the POSIX shell. + + So while most modern systems do have a shell _somewhere_ that meets + the POSIX standard, the challenge is to find it. + + +File: autoconf.info, Node: Here-Documents, Next: File Descriptors, Prev: Shellology, Up: Portable Shell + +10.2 Here-Documents +=================== + +Don't rely on '\' being preserved just because it has no special meaning +together with the next symbol. in the native '/bin/sh' on OpenBSD 2.7 +'\"' expands to '"' in here-documents with unquoted delimiter. As a +general rule, if '\\' expands to '\' use '\\' to get '\'. + + With OpenBSD 2.7's '/bin/sh' + + $ cat <<EOF + > \" \\ + > EOF + " \ + +and with Bash: + + bash-2.04$ cat <<EOF + > \" \\ + > EOF + \" \ + + Many older shells (including the Bourne shell) implement +here-documents inefficiently. Users can generally speed things up by +using a faster shell, e.g., by using the command 'bash ./configure' +rather than plain './configure'. + + Some shells can be extremely inefficient when there are a lot of +here-documents inside a single statement. For instance if your +'configure.ac' includes something like: + + if <cross_compiling>; then + assume this and that + else + check this + check that + check something else + ... + on and on forever + ... + fi + + A shell parses the whole 'if'/'fi' construct, creating temporary +files for each here document in it. Some shells create links for such +here-documents on every 'fork', so that the clean-up code they had +installed correctly removes them. It is creating the links that the +shell can take forever. + + Moving the tests out of the 'if'/'fi', or creating multiple 'if'/'fi' +constructs, would improve the performance significantly. Anyway, this +kind of construct is not exactly the typical use of Autoconf. In fact, +it's even not recommended, because M4 macros can't look into shell +conditionals, so we may fail to expand a macro when it was expanded +before in a conditional path, and the condition turned out to be false +at run-time, and we end up not executing the macro at all. + + +File: autoconf.info, Node: File Descriptors, Next: File System Conventions, Prev: Here-Documents, Up: Portable Shell + +10.3 File Descriptors +===================== + +Some file descriptors shall not be used, since some systems, admittedly +arcane, use them for special purpose: + +3 + some systems may open it to '/dev/tty'. + +4 + used on the Kubota Titan. + + Don't redirect several times the same file descriptor, as you are +doomed to failure under Ultrix. + + ULTRIX V4.4 (Rev. 69) System #31: Thu Aug 10 19:42:23 GMT 1995 + UWS V4.4 (Rev. 11) + $ eval 'echo matter >fullness' >void + illegal io + $ eval '(echo matter >fullness)' >void + illegal io + $ (eval '(echo matter >fullness)') >void + Ambiguous output redirect. + +In each case the expected result is of course 'fullness' containing +'matter' and 'void' being empty. + + Don't try to redirect the standard error of a command substitution: +it must be done _inside_ the command substitution: when running ': `cd +/zorglub` 2>/dev/null' expect the error message to escape, while ': `cd +/zorglub 2>/dev/null`' works properly. + + It is worth noting that Zsh (but not Ash nor Bash) makes it possible +in assignments though: 'foo=`cd /zorglub` 2>/dev/null'. + + Most shells, if not all (including Bash, Zsh, Ash), output traces on +stderr, even for sub-shells. This might result in undesired content if +you meant to capture the standard-error output of the inner command: + + $ ash -x -c '(eval "echo foo >&2") 2>stderr' + $ cat stderr + + eval echo foo >&2 + + echo foo + foo + $ bash -x -c '(eval "echo foo >&2") 2>stderr' + $ cat stderr + + eval 'echo foo >&2' + ++ echo foo + foo + $ zsh -x -c '(eval "echo foo >&2") 2>stderr' + # Traces on startup files deleted here. + $ cat stderr + +zsh:1> eval echo foo >&2 + +zsh:1> echo foo + foo + +You'll appreciate the various levels of detail... + + One workaround is to grep out uninteresting lines, hoping not to +remove good ones... + + +File: autoconf.info, Node: File System Conventions, Next: Shell Substitutions, Prev: File Descriptors, Up: Portable Shell + +10.4 File System Conventions +============================ + +While 'autoconf' and friends will usually be run on some Unix variety, +it can and will be used on other systems, most notably DOS variants. +This impacts several assumptions regarding file and path names. + +For example, the following code: + + case $foo_dir in + /*) # Absolute + ;; + *) + foo_dir=$dots$foo_dir ;; + esac + +will fail to properly detect absolute paths on those systems, because +they can use a drivespec, and will usually use a backslash as directory +separator. The canonical way to check for absolute paths is: + + case $foo_dir in + [\\/]* | ?:[\\/]* ) # Absolute + ;; + *) + foo_dir=$dots$foo_dir ;; + esac + +Make sure you quote the brackets if appropriate and keep the backslash +as first character (*note Limitations of Builtins::). + + Also, because the colon is used as part of a drivespec, these systems +don't use it as path separator. When creating or accessing paths, use +'$ac_path_separator' instead (or the 'PATH_SEPARATOR' output variable). +'autoconf' sets this to the appropriate value (':' or ';') when it +starts up. + + File names need extra care as well. While DOS-based environments +that are Unixy enough to run 'autoconf' (such as DJGPP) will usually be +able to handle long file names properly, there are still limitations +that can seriously break packages. Several of these issues can be +easily detected by the doschk(1) package. + + A short overview follows; problems are marked with SFN/LFN to +indicate where they apply: SFN means the issues are only relevant to +plain DOS, not to DOS boxes under Windows, while LFN identifies problems +that exist even under Windows. + +No multiple dots (SFN) + DOS cannot handle multiple dots in filenames. This is an + especially important thing to remember when building a portable + configure script, as 'autoconf' uses a .in suffix for template + files. + + This is perfectly OK on Unices: + + AC_CONFIG_HEADER(config.h) + AC_CONFIG_FILES([source.c foo.bar]) + AC_OUTPUT + + but it causes problems on DOS, as it requires 'config.h.in', + 'source.c.in' and 'foo.bar.in'. To make your package more portable + to DOS-based environments, you should use this instead: + + AC_CONFIG_HEADER(config.h:config.hin) + AC_CONFIG_FILES([source.c:source.cin foo.bar:foobar.in]) + AC_OUTPUT + +No leading dot (SFN) + DOS cannot handle filenames that start with a dot. This is usually + not a very important issue for 'autoconf'. + +Case insensitivity (LFN) + DOS is case insensitive, so you cannot, for example, have both a + file called 'INSTALL' and a directory called 'install'. This also + affects 'make'; if there's a file called 'INSTALL' in the + directory, 'make install' will do nothing (unless the 'install' + target is marked as PHONY). + +The 8+3 limit (SFN) + Because the DOS file system only stores the first 8 characters of + the filename and the first 3 of the extension, those must be + unique. That means that 'foobar-part1.c', 'foobar-part2.c' and + 'foobar-prettybird.c' all resolve to the same filename + ('FOOBAR-P.C'). The same goes for 'foo.bar' and 'foo.bartender'. + + Note: This is not usually a problem under Windows, as it uses + numeric tails in the short version of filenames to make them + unique. However, a registry setting can turn this behaviour off. + While this makes it possible to share file trees containing long + file names between SFN and LFN environments, it also means the + above problem applies there as well. + +Invalid characters + Some characters are invalid in DOS filenames, and should therefore + be avoided. In a LFN environment, these are '/', '\', '?', '*', + ':', '<', '>', '|' and '"'. In a SFN environment, other characters + are also invalid. These include '+', ',', '[' and ']'. + + ---------- Footnotes ---------- + + (1) doschk, <ftp://ftp.gnu.org/gnu/non-gnu/doschk/doschk-1.1.tar.gz>. + + +File: autoconf.info, Node: Shell Substitutions, Next: Assignments, Prev: File System Conventions, Up: Portable Shell + +10.5 Shell Substitutions +======================== + +Contrary to a persistent urban legend, the Bourne shell does not +systematically split variables and backquoted expressions, in particular +on the right-hand side of assignments and in the argument of 'case'. +For instance, the following code: + + case "$given_srcdir" in + .) top_srcdir="`echo "$dots" | sed 's,/$,,'`" + *) top_srcdir="$dots$given_srcdir" ;; + esac + +is more readable when written as: + + case $given_srcdir in + .) top_srcdir=`echo "$dots" | sed 's,/$,,'` + *) top_srcdir=$dots$given_srcdir ;; + esac + +and in fact it is even _more_ portable: in the first case of the first +attempt, the computation of 'top_srcdir' is not portable, since not all +shells properly understand '"`..."..."...`"'. Worse yet, not all shells +understand '"`...\"...\"...`"' the same way. There is just no portable +way to use double-quoted strings inside double-quoted backquoted +expressions (pfew!). + +'$@' + One of the most famous shell-portability issues is related to + '"$@"': when there are no positional arguments, it is supposed to + be equivalent to nothing. But some shells, for instance under + Digital Unix 4.0 and 5.0, will then replace it with an empty + argument. To be portable, use '${1+"$@"}'. + +'${VAR:-VALUE}' + Old BSD shells, including the Ultrix 'sh', don't accept the colon + for any shell substitution, and complain and die. + +'${VAR=LITERAL}' + Be sure to quote: + + : ${var='Some words'} + + otherwise some shells, such as on Digital Unix V 5.0, will die + because of a "bad substitution". + + Solaris' '/bin/sh' has a frightening bug in its interpretation of + this. Imagine you need set a variable to a string containing '}'. + This '}' character confuses Solaris' '/bin/sh' when the affected + variable was already set. This bug can be exercised by running: + + $ unset foo + $ foo=${foo='}'} + $ echo $foo + } + $ foo=${foo='}' # no error; this hints to what the bug is + $ echo $foo + } + $ foo=${foo='}'} + $ echo $foo + }} + ^ ugh! + + It seems that '}' is interpreted as matching '${', even though it + is enclosed in single quotes. The problem doesn't happen using + double quotes. + +'${VAR=EXPANDED-VALUE}' + On Ultrix, running + + default="yu,yaa" + : ${var="$default"} + + will set VAR to 'M-yM-uM-,M-yM-aM-a', i.e., the 8th bit of each + char will be set. You won't observe the phenomenon using a simple + 'echo $var' since apparently the shell resets the 8th bit when it + expands $var. Here are two means to make this shell confess its + sins: + + $ cat -v <<EOF + $var + EOF + + and + + $ set | grep '^var=' | cat -v + + One classic incarnation of this bug is: + + default="a b c" + : ${list="$default"} + for c in $list; do + echo $c + done + + You'll get 'a b c' on a single line. Why? Because there are no + spaces in '$list': there are 'M- ', i.e., spaces with the 8th bit + set, hence no IFS splitting is performed!!! + + One piece of good news is that Ultrix works fine with ': + ${list=$default}'; i.e., if you _don't_ quote. The bad news is + then that QNX 4.25 then sets LIST to the _last_ item of DEFAULT! + + The portable way out consists in using a double assignment, to + switch the 8th bit twice on Ultrix: + + list=${list="$default"} + + ...but beware of the '}' bug from Solaris (see above). For safety, + use: + + test "${var+set}" = set || var={VALUE} + +'`COMMANDS`' + While in general it makes no sense, do not substitute a single + builtin with side effects as Ash 0.2, trying to optimize, does not + fork a sub-shell to perform the command. + + For instance, if you wanted to check that 'cd' is silent, do not + use 'test -z "`cd /`"' because the following can happen: + + $ pwd + /tmp + $ test -n "`cd /`" && pwd + / + + The result of 'foo=`exit 1`' is left as an exercise to the reader. + +'$(COMMANDS)' + This construct is meant to replace '`COMMANDS`'; they can be nested + while this is impossible to do portably with back quotes. + Unfortunately it is not yet widely supported. Most notably, even + recent releases of Solaris don't support it: + + $ showrev -c /bin/sh | grep version + Command version: SunOS 5.8 Generic 109324-02 February 2001 + $ echo $(echo blah) + syntax error: `(' unexpected + + nor does IRIX 6.5's Bourne shell: + $ uname -a + IRIX firebird-image 6.5 07151432 IP22 + $ echo $(echo blah) + $(echo blah) + + +File: autoconf.info, Node: Assignments, Next: Special Shell Variables, Prev: Shell Substitutions, Up: Portable Shell + +10.6 Assignments +================ + +When setting several variables in a row, be aware that the order of the +evaluation is undefined. For instance 'foo=1 foo=2; echo $foo' gives +'1' with sh on Solaris, but '2' with Bash. You must use ';' to enforce +the order: 'foo=1; foo=2; echo $foo'. + + Don't rely on the exit status of an assignment: Ash 0.2 does not +change the status and propagates that of the last statement: + + $ false || foo=bar; echo $? + 1 + $ false || foo=`:`; echo $? + 0 + +and to make things even worse, QNX 4.25 just sets the exit status to 0 +in any case: + + $ foo=`exit 1`; echo $? + 0 + + To assign default values, follow this algorithm: + + 1. If the default value is a literal and does not contain any closing + brace, use: + + : ${var='my literal'} + + 2. If the default value contains no closing brace, has to be expanded, + and the variable being initialized will never be IFS-split (i.e., + it's not a list), then use: + + : ${var="$default"} + + 3. If the default value contains no closing brace, has to be expanded, + and the variable being initialized will be IFS-split (i.e., it's a + list), then use: + + var=${var="$default"} + + 4. If the default value contains a closing brace, then use: + + test "${var+set}" = set || var='${indirection}' + + In most cases 'var=${var="$default"}' is fine, but in case of doubt, +just use the latter. *Note Shell Substitutions::, items '${VAR:-VALUE}' +and '${VAR=VALUE}' for the rationale. + + +File: autoconf.info, Node: Special Shell Variables, Next: Limitations of Builtins, Prev: Assignments, Up: Portable Shell + +10.7 Special Shell Variables +============================ + +Some shell variables should not be used, since they can have a deep +influence on the behavior of the shell. In order to recover a sane +behavior from the shell, some variables should be unset, but 'unset' is +not portable (*note Limitations of Builtins::) and a fallback value is +needed. We list these values below. + +'CDPATH' + When this variable is set 'cd' is verbose, so idioms such as + 'abs=`cd $rel && pwd`' break because 'abs' receives the path twice. + + Setting 'CDPATH' to the empty value is not enough for most shells. + A simple colon is enough except for 'zsh', which prefers a leading + dot: + + zsh-3.1.6 % mkdir foo && (CDPATH=: cd foo) + /tmp/foo + zsh-3.1.6 % (CDPATH=:. cd foo) + /tmp/foo + zsh-3.1.6 % (CDPATH=.: cd foo) + zsh-3.1.6 % + + (of course we could just 'unset' 'CDPATH', since it also behaves + properly if set to the empty string). + + Life wouldn't be so much fun if 'bash' and 'zsh' had the same + behavior: + + bash-2.02 % (CDPATH=:. cd foo) + bash-2.02 % (CDPATH=.: cd foo) + /tmp/foo + + Therefore, a portable solution to neutralize 'CDPATH' is + + CDPATH=${ZSH_VERSION+.}: + + Note that since 'zsh' supports 'unset', you may unset 'CDPATH' + using ':' as a fallback, see *note Limitations of Builtins::. + +'IFS' + Don't set the first character of 'IFS' to backslash. Indeed, + Bourne shells use the first character (backslash) when joining the + components in '"$@"' and some shells then re-interpret (!) the + backslash escapes, so you can end up with backspace and other + strange characters. + +'LANG' +'LC_ALL' +'LC_TIME' +'LC_CTYPE' +'LANGUAGE' +'LC_COLLATE' +'LC_NUMERIC' +'LC_MESSAGES' + + 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. Fixing 'LC_COLLATE' makes + scripts more portable in some cases. For example, it causes the + regular expression '[a-z]' to match only lower-case letters on + ASCII platforms. However, '[a-z]' does not work in general even + when 'LC_COLLATE' is fixed; for example, it does not work for + EBCDIC platforms. For maximum portability, you should use regular + expressions like '[abcdefghijklmnopqrstuvwxyz]' that list + characters explicitly instead of relying on ranges. + + _If_ one of these variables is set, you should try to unset it, + using 'C' as a fall back value. see *note Limitations of + Builtins::, builtin 'unset', for more details. + +'NULLCMD' + When executing the command '>foo', 'zsh' executes '$NULLCMD >foo'. + The Bourne shell considers 'NULLCMD' is ':', while 'zsh', even in + Bourne shell compatibility mode, sets 'NULLCMD' to 'cat'. If you + forgot to set 'NULLCMD', your script might be suspended waiting for + data on its standard input. + +'status' + This variable is an alias to '$?' for 'zsh' (at least 3.1.6), hence + read-only. Do not use it. + +'PATH_SEPARATOR' + On DJGPP systems, the 'PATH_SEPARATOR' variable can be set to + either ':' or ';' to control the path separator 'bash' uses to set + up certain environment variables (such as 'PATH'). Since this only + works inside bash, you want autoconf to detect the regular DOS path + separator ';', so it can be safely substituted in files that may + not support ';' as path separator. So either unset this variable + or set it to ';'. + +'RANDOM' + Many shells provide 'RANDOM', a variable that returns a different + integer when used. Most of the time, its value does not change + when it is not used, but on IRIX 6.5 the value changes all the + time. This can be observed by using 'set'. + + +File: autoconf.info, Node: Limitations of Builtins, Next: Limitations of Usual Tools, Prev: Special Shell Variables, Up: Portable Shell + +10.8 Limitations of Shell Builtins +================================== + +No, no, we are serious: some shells do have limitations! :) + + You should always keep in mind that any built-in or command may +support options, and therefore have a very different behavior with +arguments starting with a dash. For instance, the innocent 'echo +"$word"' can give unexpected results when 'word' starts with a dash. It +is often possible to avoid this problem using 'echo "x$word"', taking +the 'x' into account later in the pipe. + +'!' + You can't use '!', you'll have to rewrite your code. + +'break' + The use of 'break 2', etcetera, is safe. + +'case' + You don't need to quote the argument; no splitting is performed. + + You don't need the final ';;', but you should use it. + + Because of a bug in its 'fnmatch', 'bash' fails to properly handle + backslashes in character classes: + + bash-2.02$ case /tmp in [/\\]*) echo OK;; esac + bash-2.02$ + + This is extremely unfortunate, since you are likely to use this + code to handle UNIX or MS-DOS absolute paths. To work around this + bug, always put the backslash first: + + bash-2.02$ case '\TMP' in [\\/]*) echo OK;; esac + OK + bash-2.02$ case /tmp in [\\/]*) echo OK;; esac + OK + +'echo' + The simple 'echo' is probably the most surprising source of + portability troubles. It is not possible to use 'echo' portably + unless both options and escape sequences are omitted. New + applications which are not aiming at portability should use + 'printf' instead of 'echo'. + + Don't expect any option. *Note Preset Output Variables::, 'ECHO_N' + etc. for a means to simulate '-c'. + + Do not use backslashes in the arguments, as there is no consensus + on their handling. On 'echo '\n' | wc -l', the 'sh' of Digital + Unix 4.0, MIPS RISC/OS 4.52, answer 2, but the Solaris' 'sh', Bash + and Zsh (in 'sh' emulation mode) report 1. Please note that the + problem is truly 'echo': all the shells understand ''\n'' as the + string composed of a backslash and an 'n'. + + Because of these problems, do not pass a string containing + arbitrary characters to 'echo'. For example, 'echo "$foo"' is safe + if you know that FOO's value cannot contain backslashes and cannot + start with '-', but otherwise you should use a here-document like + this: + + cat <<EOF + $foo + EOF + +'exit' + The default value of 'exit' is supposed to be '$?'; unfortunately, + some shells, such as the DJGPP port of Bash 2.04, just perform + 'exit 0'. + + bash-2.04$ foo=`exit 1` || echo fail + fail + bash-2.04$ foo=`(exit 1)` || echo fail + fail + bash-2.04$ foo=`(exit 1); exit` || echo fail + bash-2.04$ + + Using 'exit $?' restores the expected behavior. + + Some shell scripts, such as those generated by 'autoconf', use a + trap to clean up before exiting. If the last shell command exited + with nonzero status, the trap also exits with nonzero status so + that the invoker can tell that an error occurred. + + Unfortunately, in some shells, such as Solaris 8 'sh', an exit trap + ignores the 'exit' command's status. In these shells, a trap + cannot determine whether it was invoked by plain 'exit' or by 'exit + 1'. Instead of calling 'exit' directly, use the 'AC_MSG_ERROR' + macro that has a workaround for this problem. + +'export' + The builtin 'export' dubs "environment variable" a shell variable. + Each update of exported variables corresponds to an update of the + environment variables. Conversely, each environment variable + received by the shell when it is launched should be imported as a + shell variable marked as exported. + + Alas, many shells, such as Solaris 2.5, IRIX 6.3, IRIX 5.2, AIX + 4.1.5 and DU 4.0, forget to 'export' the environment variables they + receive. As a result, two variables are coexisting: the + environment variable and the shell variable. The following code + demonstrates this failure: + + #! /bin/sh + echo $FOO + FOO=bar + echo $FOO + exec /bin/sh $0 + + when run with 'FOO=foo' in the environment, these shells will print + alternately 'foo' and 'bar', although it should only print 'foo' + and then a sequence of 'bar's. + + Therefore you should 'export' again each environment variable that + you update. + +'false' + Don't expect 'false' to exit with status 1: in the native Bourne + shell of Solaris 8, it exits with status 255. + +'for' + To loop over positional arguments, use: + + for arg + do + echo "$arg" + done + + You may _not_ leave the 'do' on the same line as 'for', since some + shells improperly grok: + + for arg; do + echo "$arg" + done + + If you want to explicitly refer to the positional arguments, given + the '$@' bug (*note Shell Substitutions::), use: + + for arg in ${1+"$@"}; do + echo "$arg" + done + +'if' + Using '!' is not portable. Instead of: + + if ! cmp -s file file.new; then + mv file.new file + fi + + use: + + if cmp -s file file.new; then :; else + mv file.new file + fi + + There are shells that do not reset the exit status from an 'if': + + $ if (exit 42); then true; fi; echo $? + 42 + + whereas a proper shell should have printed '0'. This is especially + bad in Makefiles since it produces false failures. This is why + properly written Makefiles, such as Automake's, have such hairy + constructs: + + if test -f "$file"; then + install "$file" "$dest" + else + : + fi + +'set' + This builtin faces the usual problem with arguments starting with a + dash. Modern shells such as Bash or Zsh understand '--' to specify + the end of the options (any argument after '--' is a parameters, + even '-x' for instance), but most shells simply stop the option + processing as soon as a non-option argument is found. Therefore, + use 'dummy' or simply 'x' to end the option processing, and use + 'shift' to pop it out: + + set x $my_list; shift + +'shift' + Not only is 'shift'ing a bad idea when there is nothing left to + shift, but in addition it is not portable: the shell of MIPS + RISC/OS 4.52 refuses to do it. + +'test' + The 'test' program is the way to perform many file and string + tests. It is often invoked by the alternate name '[', but using + that name in Autoconf code is asking for trouble since it is an M4 + quote character. + + If you need to make multiple checks using 'test', combine them with + the shell operators '&&' and '||' instead of using the 'test' + operators '-a' and '-o'. On System V, the precedence of '-a' and + '-o' is wrong relative to the unary operators; consequently, POSIX + does not specify them, so using them is nonportable. If you + combine '&&' and '||' in the same statement, keep in mind that they + have equal precedence. + + You may use '!' with 'test', but not with 'if': 'test ! -r foo || + exit 1'. + +'test' (files) + To enable 'configure' scripts to support cross-compilation, they + shouldn't do anything that tests features of the build system + instead of the host system. But occasionally you may find it + necessary to check whether some arbitrary file exists. To do so, + use 'test -f' or 'test -r'. Do not use 'test -x', because 4.3BSD + does not have it. Do not use 'test -e' either, because Solaris 2.5 + does not have it. + +'test' (strings) + Avoid 'test "STRING"', in particular if STRING might start with a + dash, since 'test' might interpret its argument as an option (e.g., + 'STRING = "-n"'). + + Contrary to a common belief, 'test -n STRING' and 'test -z STRING' + *are* portable, nevertheless many shells (such as Solaris 2.5, AIX + 3.2, UNICOS 10.0.0.6, Digital Unix 4 etc.) have bizarre precedence + and may be confused if STRING looks like an operator: + + $ test -n = + test: argument expected + + If there are risks, use 'test "xSTRING" = x' or 'test "xSTRING" != + x' instead. + + It is frequent to find variations of the following idiom: + + test -n "`echo $ac_feature | sed 's/[-a-zA-Z0-9_]//g'`" && + ACTION + + to take an action when a token matches a given pattern. Such + constructs should always be avoided by using: + + echo "$ac_feature" | grep '[^-a-zA-Z0-9_]' >/dev/null 2>&1 && + ACTION + + Use 'case' where possible since it is faster, being a shell + builtin: + + case $ac_feature in + *[!-a-zA-Z0-9_]*) ACTION;; + esac + + Alas, negated character classes are probably not portable, although + no shell is known to not support the POSIX.2 syntax '[!...]' (when + in interactive mode, 'zsh' is confused by the '[!...]' syntax and + looks for an event in its history because of '!'). Many shells do + not support the alternative syntax '[^...]' (Solaris, Digital Unix, + etc.). + + One solution can be: + + expr "$ac_feature" : '.*[^-a-zA-Z0-9_]' >/dev/null && + ACTION + + or better yet + + expr "x$ac_feature" : '.*[^-a-zA-Z0-9_]' >/dev/null && + ACTION + + 'expr "XFOO" : "XBAR"' is more robust than 'echo "XFOO" | grep + "^XBAR"', because it avoids problems when 'FOO' contains + backslashes. + +'trap' + It is safe to trap at least the signals 1, 2, 13 and 15. You can + also trap 0, i.e., have the 'trap' run when the script ends (either + via an explicit 'exit', or the end of the script). + + Although POSIX is not absolutely clear on this point, it is widely + admitted that when entering the trap '$?' should be set to the exit + status of the last command run before the trap. The ambiguity can + be summarized as: "when the trap is launched by an 'exit', what is + the _last_ command run: that before 'exit', or 'exit' itself?" + + Bash considers 'exit' to be the last command, while Zsh and Solaris + 8 'sh' consider that when the trap is run it is _still_ in the + 'exit', hence it is the previous exit status that the trap + receives: + + $ cat trap.sh + trap 'echo $?' 0 + (exit 42); exit 0 + $ zsh trap.sh + 42 + $ bash trap.sh + 0 + + The portable solution is then simple: when you want to 'exit 42', + run '(exit 42); exit 42', the first 'exit' being used to set the + exit status to 42 for Zsh, and the second to trigger the trap and + pass 42 as exit status for Bash. + + The shell in FreeBSD 4.0 has the following bug: '$?' is reset to 0 + by empty lines if the code is inside 'trap'. + + $ trap 'false + + echo $?' 0 + $ exit + 0 + + Fortunately, this bug only affects 'trap'. + +'true' + Don't worry: as far as we know 'true' is portable. Nevertheless, + it's not always a builtin (e.g., Bash 1.x), and the portable shell + community tends to prefer using ':'. This has a funny side effect: + when asked whether 'false' is more portable than 'true' Alexandre + Oliva answered: + + In a sense, yes, because if it doesn't exist, the shell will + produce an exit status of failure, which is correct for + 'false', but not for 'true'. + +'unset' + You cannot assume the support of 'unset', nevertheless, because it + is extremely useful to disable embarrassing variables such as + 'CDPATH' or 'LANG', you can test for its existence and use it + _provided_ you give a neutralizing value when 'unset' is not + supported: + + if (unset FOO) >/dev/null 2>&1; then + unset=unset + else + unset=false + fi + $unset CDPATH || CDPATH=: + + *Note Special Shell Variables::, for some neutralizing values. + Also, see *note Limitations of Builtins::, documentation of + 'export', for the case of environment variables. + + +File: autoconf.info, Node: Limitations of Usual Tools, Next: Limitations of Make, Prev: Limitations of Builtins, Up: Portable Shell + +10.9 Limitations of Usual Tools +=============================== + +The small set of tools you can expect to find on any machine can still +include some limitations you should be aware of. + +'awk' + Don't leave white spaces before the parentheses in user functions + calls, GNU awk will reject it: + + $ gawk 'function die () { print "Aaaaarg!" } + BEGIN { die () }' + gawk: cmd. line:2: BEGIN { die () } + gawk: cmd. line:2: ^ parse error + $ gawk 'function die () { print "Aaaaarg!" } + BEGIN { die() }' + Aaaaarg! + + If you want your program to be deterministic, don't depend on 'for' + on arrays: + + $ cat for.awk + END { + arr["foo"] = 1 + arr["bar"] = 1 + for (i in arr) + print i + } + $ gawk -f for.awk </dev/null + foo + bar + $ nawk -f for.awk </dev/null + bar + foo + + Some AWK, such as HPUX 11.0's native one, have regex engines + fragile to inner anchors: + + $ echo xfoo | $AWK '/foo|^bar/ { print }' + $ echo bar | $AWK '/foo|^bar/ { print }' + bar + $ echo xfoo | $AWK '/^bar|foo/ { print }' + xfoo + $ echo bar | $AWK '/^bar|foo/ { print }' + bar + + Either do not depend on such patterns (i.e., use '/^(.*foo|bar)/', + or use a simple test to reject such AWK. + +'cat' + Don't rely on any option. The option '-v', which displays + non-printing characters, _seems_ portable, though. + +'cc' + When a compilation such as 'cc foo.c -o foo' fails, some compilers + (such as CDS on Reliant UNIX) leave a 'foo.o'. + +'cmp' + 'cmp' performs a raw data comparison of two files, while 'diff' + compares two text files. Therefore, if you might compare DOS + files, even if only checking whether two files are different, use + 'diff' to avoid spurious differences due to differences of newline + encoding. + +'cp' + SunOS 'cp' does not support '-f', although its 'mv' does. It's + possible to deduce why 'mv' and 'cp' are different with respect to + '-f'. 'mv' prompts by default before overwriting a read-only file. + 'cp' does not. Therefore, 'mv' requires a '-f' option, but 'cp' + does not. 'mv' and 'cp' behave differently with respect to + read-only files because the simplest form of 'cp' cannot overwrite + a read-only file, but the simplest form of 'mv' can. This is + because 'cp' opens the target for write access, whereas 'mv' simply + calls 'link' (or, in newer systems, 'rename'). + +'diff' + Option '-u' is nonportable. + + Some implementations, such as Tru64's, fail when comparing to + '/dev/null'. Use an empty file instead. + +'dirname' + Not all hosts have 'dirname', but it is reasonably easy to emulate, + e.g.: + + dir=`expr "x$file" : 'x\(.*\)/[^/]*' \| + '.' : '.' + + But there are a few subtilities, e.g., under UN*X, should '//1' + give '/'? Paul Eggert answers: + + No, under some older flavors of Unix, leading '//' is a + special path name: it refers to a "super-root" and is used to + access other machines' files. Leading '///', '////', etc. + are equivalent to '/'; but leading '//' is special. I think + this tradition started with Apollo Domain/OS, an OS that is + still in use on some older hosts. + + POSIX.2 allows but does not require the special treatment for + '//'. It says that the behavior of dirname on path names of + the form '//([^/]+/*)?' is implementation defined. In these + cases, GNU 'dirname' returns '/', but it's more portable to + return '//' as this works even on those older flavors of Unix. + + I have heard rumors that this special treatment of '//' may be + dropped in future versions of POSIX, but for now it's still + the standard. + +'egrep' + The empty alternative is not portable, use '?' instead. For + instance with Digital Unix v5.0: + + > printf "foo\n|foo\n" | egrep '^(|foo|bar)$' + |foo + > printf "bar\nbar|\n" | egrep '^(foo|bar|)$' + bar| + > printf "foo\nfoo|\n|bar\nbar\n" | egrep '^(foo||bar)$' + foo + |bar + + 'egrep' also suffers the limitations of 'grep'. + +'expr' + No 'expr' keyword starts with 'x', so use 'expr x"WORD" : 'xREGEX'' + to keep 'expr' from misinterpreting WORD. + + Don't use 'length', 'substr', 'match' and 'index'. + +'expr' ('|') + You can use '|'. Although POSIX does require that 'expr ''' return + the empty string, it does not specify the result when you '|' + together the empty string (or zero) with the empty string. For + example: + + expr '' \| '' + + GNU/Linux and POSIX.2-1992 return the empty string for this case, + but traditional Unix returns '0' (Solaris is one such example). In + the latest POSIX draft, the specification has been changed to match + traditional Unix's behavior (which is bizarre, but it's too late to + fix this). Please note that the same problem does arise when the + empty string results from a computation, as in: + + expr bar : foo \| foo : bar + + Avoid this portability problem by avoiding the empty string. + +'expr' (':') + Don't use '\?', '\+' and '\|' in patterns, they are not supported + on Solaris. + + The POSIX.2-1992 standard is ambiguous as to whether 'expr a : b' + (and 'expr 'a' : '\(b\)'') output '0' or the empty string. In + practice, it outputs the empty string on most platforms, but + portable scripts should not assume this. For instance, the QNX + 4.25 native 'expr' returns '0'. + + You may believe that one means to get a uniform behavior would be + to use the empty string as a default value: + + expr a : b \| '' + + unfortunately this behaves exactly as the original expression, see + the ''expr' (':')' entry for more information. + + Older 'expr' implementations (e.g. SunOS 4 'expr' and Solaris 8 + '/usr/ucb/expr') have a silly length limit that causes 'expr' to + fail if the matched substring is longer than 120 bytes. In this + case, you might want to fall back on 'echo|sed' if 'expr' fails. + + Don't leave, there is some more! + + The QNX 4.25 'expr', in addition of preferring '0' to the empty + string, has a funny behavior in its exit status: it's always 1 when + parentheses are used! + + $ val=`expr 'a' : 'a'`; echo "$?: $val" + 0: 1 + $ val=`expr 'a' : 'b'`; echo "$?: $val" + 1: 0 + + $ val=`expr 'a' : '\(a\)'`; echo "?: $val" + 1: a + $ val=`expr 'a' : '\(b\)'`; echo "?: $val" + 1: 0 + + In practice this can be a big problem if you are ready to catch + failures of 'expr' programs with some other method (such as using + 'sed'), since you may get twice the result. For instance + + $ expr 'a' : '\(a\)' || echo 'a' | sed 's/^\(a\)$/\1/' + + will output 'a' on most hosts, but 'aa' on QNX 4.25. A simple work + around consists in testing 'expr' and use a variable set to 'expr' + or to 'false' according to the result. + +'find' + The option '-maxdepth' seems to be GNU specific. Tru64 v5.1, + NetBSD 1.5 and Solaris 2.5 'find' commands do not understand it. + +'grep' + Don't use 'grep -s' to suppress output, because 'grep -s' on System + V does not suppress output, only error messages. Instead, redirect + the standard output and standard error (in case the file doesn't + exist) of 'grep' to '/dev/null'. Check the exit status of 'grep' + to determine whether it found a match. + + Don't use multiple regexps with '-e', as some 'grep' will only + honor the last pattern (eg., IRIX 6.5 and Solaris 2.5.1). Anyway, + Stardent Vistra SVR4 'grep' lacks '-e'... Instead, use alternation + and 'egrep'. + +'ln' + Don't rely on 'ln' having a '-f' option. Symbolic links are not + available on old systems, use 'ln' as a fall back. + + For versions of the DJGPP before 2.04, 'ln' emulates soft links for + executables by generating a stub that in turn calls the real + program. This feature also works with nonexistent files like in + the Unix spec. So 'ln -s file link' will generate 'link.exe', + which will attempt to call 'file.exe' if run. But this feature + only works for executables, so 'cp -p' is used instead for these + systems. DJGPP versions 2.04 and later have full symlink support. + +'mv' + The only portable options are '-f' and '-i'. + + Moving individual files between file systems is portable (it was in + V6), but it is not always atomic: when doing 'mv new existing', + there's a critical section where neither the old nor the new + version of 'existing' actually exists. + + Moving directories across mount points is not portable, use 'cp' + and 'rm'. + +'sed' + Patterns should not include the separator (unless escaped), even as + part of a character class. In conformance with POSIX, the Cray + 'sed' will reject 's/[^/]*$//': use 's,[^/]*$,,'. + + Sed scripts should not use branch labels longer than 8 characters + and should not contain comments. + + Don't include extra ';', as some 'sed', such as NetBSD 1.4.2's, try + to interpret the second as a command: + + $ echo a | sed 's/x/x/;;s/x/x/' + sed: 1: "s/x/x/;;s/x/x/": invalid command code ; + + Input should have reasonably long lines, since some 'sed' have an + input buffer limited to 4000 bytes. + + Alternation, '\|', is common but not portable. Anchors ('^' and + '$') inside groups are not portable. + + Nested groups are extremely portable, but there is at least one + 'sed' (System V/68 Base Operating System R3V7.1) that does not + support it. + + Of course the option '-e' is portable, but it is not needed. No + valid Sed program can start with a dash, so it does not help + disambiguating. Its sole usefulness is helping enforcing indenting + as in: + + sed -e INSTRUCTION-1 \ + -e INSTRUCTION-2 + + as opposed to + + sed INSTRUCTION-1;INSTRUCTION-2 + + Contrary to yet another urban legend, you may portably use '&' in + the replacement part of the 's' command to mean "what was matched". + +'sed' ('t') + Some old systems have 'sed' that "forget" to reset their 't' flag + when starting a new cycle. For instance on MIPS RISC/OS, and on + IRIX 5.3, if you run the following 'sed' script (the line numbers + are not actual part of the texts): + + s/keep me/kept/g # a + t end # b + s/.*/deleted/g # c + : end # d + + on + + delete me # 1 + delete me # 2 + keep me # 3 + delete me # 4 + + you get + + deleted + delete me + kept + deleted + + instead of + + deleted + deleted + kept + deleted + + Why? When processing 1, a matches, therefore sets the t flag, b + jumps to d, and the output is produced. When processing line 2, + the t flag is still set (this is the bug). Line a fails to match, + but 'sed' is not supposed to clear the t flag when a substitution + fails. Line b sees that the flag is set, therefore it clears it, + and jumps to d, hence you get 'delete me' instead of 'deleted'. + When processing 3 t is clear, a matches, so the flag is set, hence + b clears the flags and jumps. Finally, since the flag is clear, 4 + is processed properly. + + There are two things one should remind about 't' in 'sed'. + Firstly, always remember that 't' jumps if _some_ substitution + succeeded, not only the immediately preceding substitution, + therefore, always use a fake 't clear; : clear' to reset the t flag + where indeed. + + Secondly, you cannot rely on 'sed' to clear the flag at each new + cycle. + + One portable implementation of the script above is: + + t clear + : clear + s/keep me/kept/g + t end + s/.*/deleted/g + : end + +'touch' + On some old BSD systems, 'touch' or any command that results in an + empty file does not update the timestamps, so use a command like + 'echo' as a workaround. + + GNU 'touch' 3.16r (and presumably all before that) fails to work on + SunOS 4.1.3 when the empty file is on an NFS-mounted 4.2 volume. + + +File: autoconf.info, Node: Limitations of Make, Prev: Limitations of Usual Tools, Up: Portable Shell + +10.10 Limitations of Make +========================= + +Make itself suffers a great number of limitations, only a few of which +being listed here. First of all, remember that since commands are +executed by the shell, all its weaknesses are inherited... + +Leading underscore in macro names + Some Make don't support leading underscores in macro names, such as + on NEWS-OS 4.2R. + + $ cat Makefile + _am_include = # + _am_quote = + all:; @echo this is test + + % make + Make: Must be a separator on rules line 2. Stop. + + $ cat Makefile2 + am_include = # + am_quote = + all:; @echo this is test + + $ make -f Makefile2 + this is test + +'VPATH' + Don't use it! For instance any assignment to 'VPATH' causes Sun + 'make' to only execute the first set of double-colon rules. + + +File: autoconf.info, Node: Manual Configuration, Next: Site Configuration, Prev: Portable Shell, Up: Top + +11 Manual Configuration +*********************** + +A few kinds of features can't be guessed automatically by running test +programs. For example, the details of the object-file format, or +special options that need to be passed to the compiler or linker. You +can check for such features using ad-hoc means, such as having +'configure' check the output of the 'uname' program, or looking for +libraries that are unique to particular systems. However, Autoconf +provides a uniform method for handling unguessable features. + +* Menu: + +* Specifying Names:: Specifying the system type +* Canonicalizing:: Getting the canonical system type +* Using System Type:: What to do with the system type + + +File: autoconf.info, Node: Specifying Names, Next: Canonicalizing, Prev: Manual Configuration, Up: Manual Configuration + +11.1 Specifying the System Type +=============================== + +Like other GNU 'configure' scripts, Autoconf-generated 'configure' +scripts can make decisions based on a canonical name for the system +type, which has the form: 'CPU-VENDOR-OS', where OS can be 'SYSTEM' or +'KERNEL-SYSTEM' + + 'configure' can usually guess the canonical name for the type of +system it's running on. To do so it runs a script called +'config.guess', which infers the name using the 'uname' command or +symbols predefined by the C preprocessor. + + Alternately, the user can specify the system type with command line +arguments to 'configure'. Doing so is necessary when cross-compiling. +In the most complex case of cross-compiling, three system types are +involved. The options to specify them are(1): + +'--build=BUILD-TYPE' + the type of system on which the package is being configured and + compiled. + +'--host=HOST-TYPE' + the type of system on which the package will run. + +'--target=TARGET-TYPE' + the type of system for which any compiler tools in the package will + produce code (rarely needed). By default, it is the same as host. + + They all default to the result of running 'config.guess', unless you +specify either '--build' or '--host'. In this case, the default becomes +the system type you specified. If you specify both, and they're +different, 'configure' will enter cross compilation mode, so it won't +run any tests that require execution. + + Hint: if you mean to override the result of 'config.guess', prefer +'--build' over '--host'. In the future, '--host' will not override the +name of the build system type. Also, if you specify '--host', but not +'--build', when 'configure' performs the first compiler test it will try +to run an executable produced by the compiler. If the execution fails, +it will enter cross-compilation mode. Note, however, that it won't +guess the build-system type, since this may require running test +programs. Moreover, by the time the compiler test is performed, it may +be too late to modify the build-system type: other tests may have +already been performed. Therefore, whenever you specify '--host', be +sure to specify '--build' too. + + ./configure --build=i686-pc-linux-gnu --host=m68k-coff + +will enter cross-compilation mode, but 'configure' will fail if it can't +run the code generated by the specified compiler if you configure as +follows: + + ./configure CC=m68k-coff-gcc + + 'configure' recognizes short aliases for many system types; for +example, 'decstation' can be used instead of 'mips-dec-ultrix4.2'. +'configure' runs a script called 'config.sub' to canonicalize system +type aliases. + + ---------- Footnotes ---------- + + (1) For backward compatibility, 'configure' will accept a system type +as an option by itself. Such an option will override the defaults for +build, host and target system types. The following configure statement +will configure a cross toolchain that will run on NetBSD/alpha but +generate code for GNU Hurd/sparc, which is also the build platform. + + ./configure --host=alpha-netbsd sparc-gnu + + +File: autoconf.info, Node: Canonicalizing, Next: Using System Type, Prev: Specifying Names, Up: Manual Configuration + +11.2 Getting the Canonical System Type +====================================== + +The following macros make the system type available to 'configure' +scripts. + + The variables 'build_alias', 'host_alias', and 'target_alias' are +always exactly the arguments of '--build', '--host', and '--target'; in +particular, they are left empty if the user did not use them, even if +the corresponding 'AC_CANONICAL' macro was run. Any configure script +may use these variables anywhere. These are the variables that should +be used when in interaction with the user. + + If you need to recognize some special environments based on their +system type, run the following macros to get canonical system names. +These variables are not set before the macro call. + + If you use these macros, you must distribute 'config.guess' and +'config.sub' along with your source code. *Note Output::, for +information about the 'AC_CONFIG_AUX_DIR' macro which you can use to +control in which directory 'configure' looks for those scripts. + + -- Macro: AC_CANONICAL_BUILD + Compute the canonical build-system type variable, 'build', and its + three individual parts 'build_cpu', 'build_vendor', and 'build_os'. + + If '--build' was specified, then 'build' is the canonicalization of + 'build_alias' by 'config.sub', otherwise it is determined by the + shell script 'config.guess'. + + -- Macro: AC_CANONICAL_HOST + Compute the canonical host-system type variable, 'host', and its + three individual parts 'host_cpu', 'host_vendor', and 'host_os'. + + If '--host' was specified, then 'host' is the canonicalization of + 'host_alias' by 'config.sub', otherwise it defaults to 'build'. + + For temporary backward-compatibility, when '--host' is specified by + '--build' isn't, the build system will be assumed to be the same as + '--host', and 'build_alias' will be set to that value. Eventually, + this historically incorrect behavior will go away. + + -- Macro: AC_CANONICAL_TARGET + Compute the canonical target-system type variable, 'target', and + its three individual parts 'target_cpu', 'target_vendor', and + 'target_os'. + + If '--target' was specified, then 'target' is the canonicalization + of 'target_alias' by 'config.sub', otherwise it defaults to 'host'. + + +File: autoconf.info, Node: Using System Type, Prev: Canonicalizing, Up: Manual Configuration + +11.3 Using the System Type +========================== + +How do you use a canonical system type? Usually, you use it in one or +more 'case' statements in 'configure.ac' to select system-specific C +files. Then, using 'AC_CONFIG_LINKS', link those files which have names +based on the system name, to generic names, such as 'host.h' or +'target.c' (*note Configuration Links::). The 'case' statement patterns +can use shell wild cards to group several cases together, like in this +fragment: + + case "$target" in + i386-*-mach* | i386-*-gnu*) + obj_format=aout emulation=mach bfd_gas=yes ;; + i960-*-bout) obj_format=bout ;; + esac + +and in 'configure.ac', use: + + AC_CONFIG_LINKS(host.h:config/$machine.h + object.h:config/$obj_format.h) + + You can also use the host system type to find cross-compilation +tools. *Note Generic Programs::, for information about the +'AC_CHECK_TOOL' macro which does that. + + +File: autoconf.info, Node: Site Configuration, Next: Running configure scripts, Prev: Manual Configuration, Up: Top + +12 Site Configuration +********************* + +'configure' scripts support several kinds of local configuration +decisions. There are ways for users to specify where external software +packages are, include or exclude optional features, install programs +under modified names, and set default values for 'configure' options. + +* Menu: + +* External Software:: Working with other optional software +* Package Options:: Selecting optional features +* Pretty Help Strings:: Formatting help string +* Site Details:: Configuring site details +* Transforming Names:: Changing program names when installing +* Site Defaults:: Giving 'configure' local defaults + + +File: autoconf.info, Node: External Software, Next: Package Options, Prev: Site Configuration, Up: Site Configuration + +12.1 Working With External Software +=================================== + +Some packages require, or can optionally use, other software packages +that are already installed. The user can give 'configure' command line +options to specify which such external software to use. The options +have one of these forms: + + --with-PACKAGE=[ARG] + --without-PACKAGE + + For example, '--with-gnu-ld' means work with the GNU linker instead +of some other linker. '--with-x' means work with The X Window System. + + The user can give an argument by following the package name with '=' +and the argument. Giving an argument of 'no' is for packages that are +used by default; it says to _not_ use the package. An argument that is +neither 'yes' nor 'no' could include a name or number of a version of +the other package, to specify more precisely which other package this +program is supposed to work with. If no argument is given, it defaults +to 'yes'. '--without-PACKAGE' is equivalent to '--with-PACKAGE=no'. + + 'configure' scripts do not complain about '--with-PACKAGE' options +that they do not support. This behavior permits configuring a source +tree containing multiple packages with a top-level 'configure' script +when the packages support different options, without spurious error +messages about options that some of the packages support. An +unfortunate side effect is that option spelling errors are not +diagnosed. No better approach to this problem has been suggested so +far. + + For each external software package that may be used, 'configure.ac' +should call 'AC_ARG_WITH' to detect whether the 'configure' user asked +to use it. Whether each package is used or not by default, and which +arguments are valid, is up to you. + + -- Macro: AC_ARG_WITH (PACKAGE, HELP-STRING, [ACTION-IF-GIVEN], + [ACTION-IF-NOT-GIVEN]) + If the user gave 'configure' the option '--with-PACKAGE' or + '--without-PACKAGE', run shell commands ACTION-IF-GIVEN. If + neither option was given, run shell commands ACTION-IF-NOT-GIVEN. + The name PACKAGE indicates another software package that this + program should work with. It should consist only of alphanumeric + characters and dashes. + + The option's argument is available to the shell commands + ACTION-IF-GIVEN in the shell variable 'withval', which is actually + just the value of the shell variable 'with_PACKAGE', with any '-' + characters changed into '_'. You may use that variable instead, if + you wish. + + The argument HELP-STRING is a description of the option that looks + like this: + --with-readline support fancy command line editing + + HELP-STRING may be more than one line long, if more detail is + needed. Just make sure the columns line up in 'configure --help'. + Avoid tabs in the help string. You'll need to enclose it in '[' + and ']' in order to produce the leading spaces. + + You should format your HELP-STRING with the macro 'AC_HELP_STRING' + (*note Pretty Help Strings::). + + -- Macro: AC_WITH (PACKAGE, ACTION-IF-GIVEN, [ACTION-IF-NOT-GIVEN]) + This is an obsolete version of 'AC_ARG_WITH' that does not support + providing a help string. + + +File: autoconf.info, Node: Package Options, Next: Pretty Help Strings, Prev: External Software, Up: Site Configuration + +12.2 Choosing Package Options +============================= + +If a software package has optional compile-time features, the user can +give 'configure' command line options to specify whether to compile +them. The options have one of these forms: + + --enable-FEATURE=[ARG] + --disable-FEATURE + + These options allow users to choose which optional features to build +and install. '--enable-FEATURE' options should never make a feature +behave differently or cause one feature to replace another. They should +only cause parts of the program to be built rather than left out. + + The user can give an argument by following the feature name with '=' +and the argument. Giving an argument of 'no' requests that the feature +_not_ be made available. A feature with an argument looks like +'--enable-debug=stabs'. If no argument is given, it defaults to 'yes'. +'--disable-FEATURE' is equivalent to '--enable-FEATURE=no'. + + 'configure' scripts do not complain about '--enable-FEATURE' options +that they do not support. This behavior permits configuring a source +tree containing multiple packages with a top-level 'configure' script +when the packages support different options, without spurious error +messages about options that some of the packages support. An +unfortunate side effect is that option spelling errors are not +diagnosed. No better approach to this problem has been suggested so +far. + + For each optional feature, 'configure.ac' should call 'AC_ARG_ENABLE' +to detect whether the 'configure' user asked to include it. Whether +each feature is included or not by default, and which arguments are +valid, is up to you. + + -- Macro: AC_ARG_ENABLE (FEATURE, HELP-STRING, [ACTION-IF-GIVEN], + [ACTION-IF-NOT-GIVEN]) + If the user gave 'configure' the option '--enable-FEATURE' or + '--disable-FEATURE', run shell commands ACTION-IF-GIVEN. If + neither option was given, run shell commands ACTION-IF-NOT-GIVEN. + The name FEATURE indicates an optional user-level facility. It + should consist only of alphanumeric characters and dashes. + + The option's argument is available to the shell commands + ACTION-IF-GIVEN in the shell variable 'enableval', which is + actually just the value of the shell variable 'enable_FEATURE', + with any '-' characters changed into '_'. You may use that + variable instead, if you wish. The HELP-STRING argument is like + that of 'AC_ARG_WITH' (*note External Software::). + + You should format your HELP-STRING with the macro 'AC_HELP_STRING' + (*note Pretty Help Strings::). + + -- Macro: AC_ENABLE (FEATURE, ACTION-IF-GIVEN, [ACTION-IF-NOT-GIVEN]) + This is an obsolete version of 'AC_ARG_ENABLE' that does not + support providing a help string. + + +File: autoconf.info, Node: Pretty Help Strings, Next: Site Details, Prev: Package Options, Up: Site Configuration + +12.3 Making Your Help Strings Look Pretty +========================================= + +Properly formatting the 'help strings' which are used in 'AC_ARG_WITH' +(*note External Software::) and 'AC_ARG_ENABLE' (*note Package +Options::) can be challenging. Specifically, you want your own 'help +strings' to line up in the appropriate columns of 'configure --help' +just like the standard Autoconf 'help strings' do. This is the purpose +of the 'AC_HELP_STRING' macro. + + -- Macro: AC_HELP_STRING (LEFT-HAND-SIDE, RIGHT-HAND-SIDE) + + Expands into an help string that looks pretty when the user + executes 'configure --help'. It is typically used in 'AC_ARG_WITH' + (*note External Software::) or 'AC_ARG_ENABLE' (*note Package + Options::). The following example will make this clearer. + + AC_DEFUN(TEST_MACRO, + [AC_ARG_WITH(foo, + AC_HELP_STRING([--with-foo], + [use foo (default is NO)]), + ac_cv_use_foo=$withval, ac_cv_use_foo=no), + AC_CACHE_CHECK(whether to use foo, + ac_cv_use_foo, ac_cv_use_foo=no)]) + + Please note that the call to 'AC_HELP_STRING' is *unquoted*. Then + the last few lines of 'configure --help' will appear like this: + + --enable and --with options recognized: + --with-foo use foo (default is NO) + + The 'AC_HELP_STRING' macro is particularly helpful when the + LEFT-HAND-SIDE and/or RIGHT-HAND-SIDE are composed of macro + arguments, as shown in the following example. + + AC_DEFUN(MY_ARG_WITH, + [AC_ARG_WITH([$1], + AC_HELP_STRING([--with-$1], [use $1 (default is $2)]), + ac_cv_use_$1=$withval, ac_cv_use_$1=no), + AC_CACHE_CHECK(whether to use $1, ac_cv_use_$1, ac_cv_use_$1=$2)]) + + +File: autoconf.info, Node: Site Details, Next: Transforming Names, Prev: Pretty Help Strings, Up: Site Configuration + +12.4 Configuring Site Details +============================= + +Some software packages require complex site-specific information. Some +examples are host names to use for certain services, company names, and +email addresses to contact. Since some configuration scripts generated +by Metaconfig ask for such information interactively, people sometimes +wonder how to get that information in Autoconf-generated configuration +scripts, which aren't interactive. + + Such site configuration information should be put in a file that is +edited _only by users_, not by programs. The location of the file can +either be based on the 'prefix' variable, or be a standard location such +as the user's home directory. It could even be specified by an +environment variable. The programs should examine that file at run +time, rather than at compile time. Run time configuration is more +convenient for users and makes the configuration process simpler than +getting the information while configuring. *Note Variables for +Installation Directories: (standards)Directory Variables, for more +information on where to put data files. + + +File: autoconf.info, Node: Transforming Names, Next: Site Defaults, Prev: Site Details, Up: Site Configuration + +12.5 Transforming Program Names When Installing +=============================================== + +Autoconf supports changing the names of programs when installing them. +In order to use these transformations, 'configure.ac' must call the +macro 'AC_ARG_PROGRAM'. + + -- Macro: AC_ARG_PROGRAM + Place in output variable 'program_transform_name' a sequence of + 'sed' commands for changing the names of installed programs. + + If any of the options described below are given to 'configure', + program names are transformed accordingly. Otherwise, if + 'AC_CANONICAL_TARGET' has been called and a '--target' value is + given that differs from the host type (specified with '--host'), + the target type followed by a dash is used as a prefix. Otherwise, + no program name transformation is done. + +* Menu: + +* Transformation Options:: 'configure' options to transform names +* Transformation Examples:: Sample uses of transforming names +* Transformation Rules:: 'Makefile' uses of transforming names + + +File: autoconf.info, Node: Transformation Options, Next: Transformation Examples, Prev: Transforming Names, Up: Transforming Names + +12.5.1 Transformation Options +----------------------------- + +You can specify name transformations by giving 'configure' these command +line options: + +'--program-prefix=PREFIX' + prepend PREFIX to the names; + +'--program-suffix=SUFFIX' + append SUFFIX to the names; + +'--program-transform-name=EXPRESSION' + perform 'sed' substitution EXPRESSION on the names. + + +File: autoconf.info, Node: Transformation Examples, Next: Transformation Rules, Prev: Transformation Options, Up: Transforming Names + +12.5.2 Transformation Examples +------------------------------ + +These transformations are useful with programs that can be part of a +cross-compilation development environment. For example, a +cross-assembler running on a Sun 4 configured with +'--target=i960-vxworks' is normally installed as 'i960-vxworks-as', +rather than 'as', which could be confused with a native Sun 4 assembler. + + You can force a program name to begin with 'g', if you don't want GNU +programs installed on your system to shadow other programs with the same +name. For example, if you configure GNU 'diff' with +'--program-prefix=g', then when you run 'make install' it is installed +as '/usr/local/bin/gdiff'. + + As a more sophisticated example, you could use + + --program-transform-name='s/^/g/; s/^gg/g/; s/^gless/less/' + + to prepend 'g' to most of the program names in a source tree, +excepting those like 'gdb' that already have one and those like 'less' +and 'lesskey' that aren't GNU programs. (That is assuming that you have +a source tree containing those programs that is set up to use this +feature.) + + One way to install multiple versions of some programs simultaneously +is to append a version number to the name of one or both. For example, +if you want to keep Autoconf version 1 around for awhile, you can +configure Autoconf version 2 using '--program-suffix=2' to install the +programs as '/usr/local/bin/autoconf2', '/usr/local/bin/autoheader2', +etc. Nevertheless, pay attention that only the binaries are renamed, +therefore you'd have problems with the library files which might +overlap. + + +File: autoconf.info, Node: Transformation Rules, Prev: Transformation Examples, Up: Transforming Names + +12.5.3 Transformation Rules +--------------------------- + +Here is how to use the variable 'program_transform_name' in a +'Makefile.in': + + transform = @program_transform_name@ + install: all + $(INSTALL_PROGRAM) myprog $(bindir)/`echo myprog | \ + sed '$(transform)'` + + uninstall: + rm -f $(bindir)/`echo myprog | sed '$(transform)'` + +If you have more than one program to install, you can do it in a loop: + + PROGRAMS = cp ls rm + install: + for p in $(PROGRAMS); do \ + $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p | \ + sed '$(transform)'`; \ + done + + uninstall: + for p in $(PROGRAMS); do \ + rm -f $(bindir)/`echo $$p | sed '$(transform)'`; \ + done + + It is guaranteed that 'program_transform_name' is never empty, and +that there are no useless separators. Therefore you may safely embed +'program_transform_name' within a sed program using ';': + + transform = @program_transform_name@ + transform_exe = s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/ + + Whether to do the transformations on documentation files (Texinfo or +'man') is a tricky question; there seems to be no perfect answer, due to +the several reasons for name transforming. Documentation is not usually +particular to a specific architecture, and Texinfo files do not conflict +with system documentation. But they might conflict with earlier +versions of the same files, and 'man' pages sometimes do conflict with +system documentation. As a compromise, it is probably best to do name +transformations on 'man' pages but not on Texinfo manuals. + + +File: autoconf.info, Node: Site Defaults, Prev: Transforming Names, Up: Site Configuration + +12.6 Setting Site Defaults +========================== + +Autoconf-generated 'configure' scripts allow your site to provide +default values for some configuration values. You do this by creating +site- and system-wide initialization files. + + If the environment variable 'CONFIG_SITE' is set, 'configure' uses +its value as the name of a shell script to read. Otherwise, it reads +the shell script 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Thus, settings in +machine-specific files override those in machine-independent ones in +case of conflict. + + Site files can be arbitrary shell scripts, but only certain kinds of +code are really appropriate to be in them. Because 'configure' reads +any cache file after it has read any site files, a site file can define +a default cache file to be shared between all Autoconf-generated +'configure' scripts run on that system (*note Cache Files::). If you +set a default cache file in a site file, it is a good idea to also set +the output variable 'CC' in that site file, because the cache file is +only valid for a particular compiler, but many systems have several +available. + + You can examine or override the value set by a command line option to +'configure' in a site file; options set shell variables that have the +same names as the options, with any dashes turned into underscores. The +exceptions are that '--without-' and '--disable-' options are like +giving the corresponding '--with-' or '--enable-' option and the value +'no'. Thus, '--cache-file=localcache' sets the variable 'cache_file' to +the value 'localcache'; '--enable-warnings=no' or '--disable-warnings' +sets the variable 'enable_warnings' to the value 'no'; '--prefix=/usr' +sets the variable 'prefix' to the value '/usr'; etc. + + Site files are also good places to set default values for other +output variables, such as 'CFLAGS', if you need to give them non-default +values: anything you would normally do, repetitively, on the command +line. If you use non-default values for PREFIX or EXEC_PREFIX (wherever +you locate the site file), you can set them in the site file if you +specify it with the 'CONFIG_SITE' environment variable. + + You can set some cache values in the site file itself. Doing this is +useful if you are cross-compiling, so it is impossible to check features +that require running a test program. You could "prime the cache" by +setting those values correctly for that system in +'PREFIX/etc/config.site'. To find out the names of the cache variables +you need to set, look for shell variables with '_cv_' in their names in +the affected 'configure' scripts, or in the Autoconf M4 source code for +those macros. + + The cache file is careful to not override any variables set in the +site files. Similarly, you should not override command-line options in +the site files. Your code should check that variables such as 'prefix' +and 'cache_file' have their default values (as set near the top of +'configure') before changing them. + + Here is a sample file '/usr/share/local/gnu/share/config.site'. The +command 'configure --prefix=/usr/share/local/gnu' would read this file +(if 'CONFIG_SITE' is not set to a different file). + + # config.site for configure + # + # Change some defaults. + test "$prefix" = NONE && prefix=/usr/share/local/gnu + test "$exec_prefix" = NONE && exec_prefix=/usr/local/gnu + test "$sharedstatedir" = '$prefix/com' && sharedstatedir=/var + test "$localstatedir" = '$prefix/var' && localstatedir=/var + + # Give Autoconf 2.x generated configure scripts a shared default + # cache file for feature test results, architecture-specific. + if test "$cache_file" = /dev/null; then + cache_file="$prefix/var/config.cache" + # A cache file is only valid for one C compiler. + CC=gcc + fi + + +File: autoconf.info, Node: Running configure scripts, Next: config.status Invocation, Prev: Site Configuration, Up: Top + +13 Running 'configure' Scripts +****************************** + +Below are instructions on how to configure a package that uses a +'configure' script, suitable for inclusion as an 'INSTALL' file in the +package. A plain-text version of 'INSTALL' which you may use comes with +Autoconf. + +* Menu: + +* Basic Installation:: Instructions for typical cases +* Compilers and Options:: Selecting compilers and optimization +* Multiple Architectures:: Compiling for multiple architectures at once +* Installation Names:: Installing in different directories +* Optional Features:: Selecting optional features +* System Type:: Specifying the system type +* Sharing Defaults:: Setting site-wide defaults for 'configure' +* Environment Variables:: Defining environment variables. +* configure Invocation:: Changing how 'configure' runs + + +File: autoconf.info, Node: Basic Installation, Next: Compilers and Options, Up: Running configure scripts + +13.1 Basic Installation +======================= + +These are generic installation instructions. + + The 'configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a 'Makefile' in each directory of the package. +It may also create one or more '.h' files containing system-dependent +definitions. Finally, it creates a shell script 'config.status' that +you can run in the future to recreate the current configuration, and a +file 'config.log' containing compiler output (useful mainly for +debugging 'configure'). + + It can also use an optional file (typically called 'config.cache' and +enabled with '--cache-file=config.cache' or simply '-C') that saves the +results of its tests to speed up reconfiguring. (Caching is disabled by +default to prevent problems with accidental use of stale cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how 'configure' could check whether to do them, and mail +diffs or instructions to the address given in the 'README' so they can +be considered for the next release. If you are using the cache, and at +some point 'config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file 'configure.ac' (or 'configure.in') is used to create +'configure' by a program called 'autoconf'. You only need +'configure.ac' if you want to change it or regenerate 'configure' using +a newer version of 'autoconf'. + +The simplest way to compile this package is: + + 1. 'cd' to the directory containing the package's source code and type + './configure' to configure the package for your system. If you're + using 'csh' on an old version of System V, you might need to type + 'sh ./configure' instead to prevent 'csh' from trying to execute + 'configure' itself. + + Running 'configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type 'make' to compile the package. + + 3. Optionally, type 'make check' to run any self-tests that come with + the package. + + 4. Type 'make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing 'make clean'. To also remove the + files that 'configure' created (so you can compile the package for + a different kind of computer), type 'make distclean'. There is + also a 'make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + + +File: autoconf.info, Node: Compilers and Options, Next: Multiple Architectures, Prev: Basic Installation, Up: Running configure scripts + +13.2 Compilers and Options +========================== + +Some systems require unusual options for compilation or linking that the +'configure' script does not know about. Run './configure --help' for +details on some of the pertinent environment variables. + + You can give 'configure' initial values for variables by setting them +in the environment. You can do that on the command line like this: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Environment Variables::, for more details. + + +File: autoconf.info, Node: Multiple Architectures, Next: Installation Names, Prev: Compilers and Options, Up: Running configure scripts + +13.3 Compiling For Multiple Architectures +========================================= + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of 'make' that +supports the 'VPATH' variable, such as GNU 'make'. 'cd' to the +directory where you want the object files and executables to go and run +the 'configure' script. 'configure' automatically checks for the source +code in the directory that 'configure' is in and in '..'. + + If you have to use a 'make' that does not support the 'VPATH' +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use 'make distclean' before reconfiguring for another +architecture. + + +File: autoconf.info, Node: Installation Names, Next: Optional Features, Prev: Multiple Architectures, Up: Running configure scripts + +13.4 Installation Names +======================= + +By default, 'make install' will install the package's files in +'/usr/local/bin', '/usr/local/man', etc. You can specify an +installation prefix other than '/usr/local' by giving 'configure' the +option '--prefix=PATH'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +give 'configure' the option '--exec-prefix=PATH', the package will use +PATH as the prefix for installing programs and libraries. Documentation +and other data files will still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like '--bindir=PATH' to specify different values for particular +kinds of files. Run 'configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving 'configure' the +option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. + + +File: autoconf.info, Node: Optional Features, Next: System Type, Prev: Installation Names, Up: Running configure scripts + +13.5 Optional Features +====================== + +Some packages pay attention to '--enable-FEATURE' options to +'configure', where FEATURE indicates an optional part of the package. +They may also pay attention to '--with-PACKAGE' options, where PACKAGE +is something like 'gnu-as' or 'x' (for the X Window System). The +'README' should mention any '--enable-' and '--with-' options that the +package recognizes. + + For packages that use the X Window System, 'configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the 'configure' options '--x-includes=DIR' and +'--x-libraries=DIR' to specify their locations. + + +File: autoconf.info, Node: System Type, Next: Sharing Defaults, Prev: Optional Features, Up: Running configure scripts + +13.6 Specifying the System Type +=============================== + +There may be some features 'configure' cannot figure out automatically, +but needs to determine by the type of host the package will run on. +Usually 'configure' can figure that out, but if it prints a message +saying it cannot guess the host type, give it the '--build=TYPE' option. +TYPE can either be a short name for the system type, such as 'sun4', or +a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS + KERNEL-OS + + See the file 'config.sub' for the possible values of each field. If +'config.sub' isn't included in this package, then this package doesn't +need to know the host type. + + If you are _building_ compiler tools for cross-compiling, you should +use the '--target=TYPE' option to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the host +platform (i.e., that on which the generated programs will eventually be +run) with '--host=TYPE'. In this case, you should also specify the +build platform with '--build=TYPE', because, in this case, it may not be +possible to guess the build platform (it sometimes involves compiling +and running simple test programs, and this can't be done if the compiler +is a cross compiler). + + +File: autoconf.info, Node: Sharing Defaults, Next: Environment Variables, Prev: System Type, Up: Running configure scripts + +13.7 Sharing Defaults +===================== + +If you want to set default values for 'configure' scripts to share, you +can create a site shell script called 'config.site' that gives default +values for variables like 'CC', 'cache_file', and 'prefix'. 'configure' +looks for 'PREFIX/share/config.site' if it exists, then +'PREFIX/etc/config.site' if it exists. Or, you can set the +'CONFIG_SITE' environment variable to the location of the site script. +A warning: not all 'configure' scripts look for a site script. + + +File: autoconf.info, Node: Environment Variables, Next: configure Invocation, Prev: Sharing Defaults, Up: Running configure scripts + +13.8 Environment Variables +========================== + +Variables not defined in a site shell script can be set in the +environment passed to configure. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the 'configure' command line, using 'VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + + +File: autoconf.info, Node: configure Invocation, Prev: Environment Variables, Up: Running configure scripts + +13.9 'configure' Invocation +=========================== + +'configure' recognizes the following options to control how it operates. + +'--help' +'-h' + Print a summary of the options to 'configure', and exit. + +'--version' +'-V' + Print the version of Autoconf used to generate the 'configure' + script, and exit. + +'--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally 'config.cache'. FILE defaults to '/dev/null' to + disable caching. + +'--config-cache' +'-C' + Alias for '--cache-file=config.cache'. + +'--quiet' +'--silent' +'-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to '/dev/null' (any error + messages will still be shown). + +'--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + 'configure' can determine that directory automatically. + +'configure' also accepts some other, not widely useful, options. Run +'configure --help' for more details. + + +File: autoconf.info, Node: config.status Invocation, Next: Obsolete Constructs, Prev: Running configure scripts, Up: Top + +14 Recreating a Configuration +***************************** + +The 'configure' script creates a file named 'config.status', which +actually configures, "instantiates", the template files. It also +records the configuration options that were specified when the package +was last configured in case reconfiguring is needed. + + Synopsis: + ./config.status OPTION... [FILE...] + + It configures the FILES, if none are specified, all the templates are +instantiated. The files must be specified without their dependencies, +as in + + ./config.status foobar + +not + + ./config.status foobar:foo.in:bar.in + + The supported OPTIONs are: + +'--help' +'-h' + Print a summary of the command line options, the list of the + template files and exit. + +'--version' +'-V' + Print the version number of Autoconf and exit. + +'--debug' +'-d' + Don't remove the temporary files. + +'--file=FILE[:TEMPLATE]' + Require that FILE be instantiated as if + 'AC_CONFIG_FILES(FILE:TEMPLATE)' was used. Both FILE and TEMPLATE + may be '-' in which case the standard output and/or standard input, + respectively, is used. If a TEMPLATE filename is relative, it is + first looked for in the build tree, and then in the source tree. + *Note Configuration Actions::, for more details. + + This option and the following ones provide one way for separately + distributed packages to share the values computed by 'configure'. + Doing so can be useful if some of the packages need a superset of + the features that one of them, perhaps a common library, does. + These options allow a 'config.status' file to create files other + than the ones that its 'configure.ac' specifies, so it can be used + for a different package. + +'--header=FILE[:TEMPLATE]' + Same as '--file' above, but with 'AC_CONFIG_HEADERS'. + +'--recheck' + Ask 'config.status' to update itself and exit (no instantiation). + This option is useful if you change 'configure', so that the + results of some tests might be different from the previous run. + The '--recheck' option re-runs 'configure' with the same arguments + you used before, plus the '--no-create' option, which prevents + 'configure' from running 'config.status' and creating 'Makefile' + and other files, and the '--no-recursion' option, which prevents + 'configure' from running other 'configure' scripts in + subdirectories. (This is so other 'Makefile' rules can run + 'config.status' when it changes; *note Automatic Remaking::, for an + example). + + 'config.status' checks several optional environment variables that +can alter its behavior: + + -- Variable: CONFIG_SHELL + The shell with which to run 'configure' for the '--recheck' option. + It must be Bourne-compatible. The default is '/bin/sh'. + + -- Variable: CONFIG_STATUS + The file name to use for the shell script that records the + configuration. The default is './config.status'. This variable is + useful when one package uses parts of another and the 'configure' + scripts shouldn't be merged because they are maintained separately. + + You can use './config.status' in your Makefiles. For example, in the +dependencies given above (*note Automatic Remaking::), 'config.status' +is run twice when 'configure.ac' has changed. If that bothers you, you +can make each run only regenerate the files for that rule: + config.h: stamp-h + stamp-h: config.h.in config.status + ./config.status config.h + echo > stamp-h + + Makefile: Makefile.in config.status + ./config.status Makefile + + The calling convention of 'config.status' has changed, see *note +Obsolete config.status Use::, for details. + + +File: autoconf.info, Node: Obsolete Constructs, Next: Questions, Prev: config.status Invocation, Up: Top + +15 Obsolete Constructs +********************** + +Autoconf changes, and throughout the years some constructs are +obsoleted. Most of the changes involve the macros, but the tools +themselves, or even some concepts, are now considered obsolete. + + You may completely skip this chapter if you are new to Autoconf, its +intention is mainly to help maintainers updating their packages by +understanding how to move to more modern constructs. + +* Menu: + +* Obsolete config.status Use:: Different calling convention +* acconfig.h:: Additional entries in 'config.h.in' +* autoupdate Invocation:: Automatic update of 'configure.ac' +* Obsolete Macros:: Backward compatibility macros +* Autoconf 1:: Tips for upgrading your files +* Autoconf 2.13:: Some fresher tips + + +File: autoconf.info, Node: Obsolete config.status Use, Next: acconfig.h, Prev: Obsolete Constructs, Up: Obsolete Constructs + +15.1 Obsolete 'config.status' Invocation +======================================== + +'config.status' now supports arguments to specify the files to +instantiate, see *note config.status Invocation::, for more details. +Before, environment variables had to be used. + + -- Variable: CONFIG_COMMANDS + The tags of the commands to execute. The default is the arguments + given to 'AC_OUTPUT' and 'AC_CONFIG_COMMANDS' in 'configure.ac'. + + -- Variable: CONFIG_FILES + The files in which to perform '@VARIABLE@' substitutions. The + default is the arguments given to 'AC_OUTPUT' and 'AC_CONFIG_FILES' + in 'configure.ac'. + + -- Variable: CONFIG_HEADERS + The files in which to substitute C '#define' statements. The + default is the arguments given to 'AC_CONFIG_HEADERS'; if that + macro was not called, 'config.status' ignores this variable. + + -- Variable: CONFIG_LINKS + The symbolic links to establish. The default is the arguments + given to 'AC_CONFIG_LINKS'; if that macro was not called, + 'config.status' ignores this variable. + + In *note config.status Invocation::, using this old interface, the +example would be: + + config.h: stamp-h + stamp-h: config.h.in config.status + CONFIG_COMMANDS= CONFIG_LINKS= CONFIG_FILES= \ + CONFIG_HEADERS=config.h ./config.status + echo > stamp-h + + Makefile: Makefile.in config.status + CONFIG_COMMANDS= CONFIG_LINKS= CONFIG_HEADERS= \ + CONFIG_FILES=Makefile ./config.status + +(If 'configure.ac' does not call 'AC_CONFIG_HEADERS', there is no need +to set 'CONFIG_HEADERS' in the 'make' rules, equally for +'CONFIG_COMMANDS' etc.) + + +File: autoconf.info, Node: acconfig.h, Next: autoupdate Invocation, Prev: Obsolete config.status Use, Up: Obsolete Constructs + +15.2 'acconfig.h' +================= + +In order to produce 'config.h.in', 'autoheader' needs to build or to +find templates for each symbol. Modern releases of Autoconf use +'AH_VERBATIM' and 'AH_TEMPLATE' (*note Autoheader Macros::), but in +older releases a file, 'acconfig.h', contained the list of needed +templates. 'autoheader' copies comments and '#define' and '#undef' +statements from 'acconfig.h' in the current directory, if present. This +file used to be mandatory if you 'AC_DEFINE' any additional symbols. + + Modern releases of Autoconf also provide 'AH_TOP' and 'AH_BOTTOM' if +you need to prepend/append some information to 'config.h.in'. Ancient +versions of Autoconf had a similar feature: if './acconfig.h' contains +the string '@TOP@', 'autoheader' copies the lines before the line +containing '@TOP@' into the top of the file that it generates. +Similarly, if './acconfig.h' contains the string '@BOTTOM@', +'autoheader' copies the lines after that line to the end of the file it +generates. Either or both of those strings may be omitted. An even +older alternate way to produce the same effect in jurasik versions of +Autoconf is to create the files 'FILE.top' (typically 'config.h.top') +and/or 'FILE.bot' in the current directory. If they exist, 'autoheader' +copies them to the beginning and end, respectively, of its output. + + In former versions of Autoconf, the files used in preparing a +software package for distribution were: + configure.ac --. .------> autoconf* -----> configure + +---+ + [aclocal.m4] --+ `---. + [acsite.m4] ---' | + +--> [autoheader*] -> [config.h.in] + [acconfig.h] ----. | + +-----' + [config.h.top] --+ + [config.h.bot] --' + + Use only the 'AH_' macros, 'configure.ac' should be self-contained, +and should not depend upon 'acconfig.h' etc. + + +File: autoconf.info, Node: autoupdate Invocation, Next: Obsolete Macros, Prev: acconfig.h, Up: Obsolete Constructs + +15.3 Using 'autoupdate' to Modernize 'configure.ac' +=================================================== + +The 'autoupdate' program updates a 'configure.ac' file that calls +Autoconf macros by their old names to use the current macro names. In +version 2 of Autoconf, most of the macros were renamed to use a more +uniform and descriptive naming scheme. *Note Macro Names::, for a +description of the new scheme. Although the old names still work (*note +Obsolete Macros::, for a list of the old macros and the corresponding +new names), you can make your 'configure.ac' files more readable and +make it easier to use the current Autoconf documentation if you update +them to use the new macro names. + + If given no arguments, 'autoupdate' updates 'configure.ac', backing +up the original version with the suffix '~' (or the value of the +environment variable 'SIMPLE_BACKUP_SUFFIX', if that is set). If you +give 'autoupdate' an argument, it reads that file instead of +'configure.ac' and writes the updated file to the standard output. + +'autoupdate' accepts the following options: + +'--help' +'-h' + Print a summary of the command line options and exit. + +'--version' +'-V' + Print the version number of Autoconf and exit. + +'--verbose' +'-v' + Report processing steps. + +'--debug' +'-d' + Don't remove the temporary files. + +'--autoconf-dir=DIR' +'-A DIR' + Override the location where the installed Autoconf data files are + looked for. You can also set the 'AC_MACRODIR' environment + variable to a directory; this option overrides the environment + variable. + + This option is rarely needed and dangerous; it is only used when + one plays with different versions of Autoconf simultaneously. + +'--localdir=DIR' +'-l DIR' + Look for the package file 'aclocal.m4' in directory DIR instead of + in the current directory. + + +File: autoconf.info, Node: Obsolete Macros, Next: Autoconf 1, Prev: autoupdate Invocation, Up: Obsolete Constructs + +15.4 Obsolete Macros +==================== + +Several macros are obsoleted in Autoconf, for various reasons (typically +they failed to quote properly, couldn't be extended for more recent +issues etc.). They are still supported, but deprecated: their use +should be avoided. + + During the jump from Autoconf version 1 to version 2, most of the +macros were renamed to use a more uniform and descriptive naming scheme, +but their signature did not change. *Note Macro Names::, for a +description of the new naming scheme. Below, there is just the mapping +from old names to new names for these macros, the reader is invited to +refer to the definition of the new macro for the signature and the +description. + + -- Macro: AC_ALLOCA + 'AC_FUNC_ALLOCA' + + -- Macro: AC_ARG_ARRAY + removed because of limited usefulness + + -- Macro: AC_C_CROSS + This macro is obsolete; it does nothing. + + -- Macro: AC_CANONICAL_SYSTEM + Determine the system type and set output variables to the names of + the canonical system types. *Note Canonicalizing::, for details + about the variables this macro sets. + + The user is encouraged to use either 'AC_CANONICAL_BUILD', or + 'AC_CANONICAL_HOST', or 'AC_CANONICAL_TARGET', depending on the + needs. Using 'AC_CANONICAL_TARGET' is enough to run the two other + macros. + + -- Macro: AC_CHAR_UNSIGNED + 'AC_C_CHAR_UNSIGNED' + + -- Macro: AC_CHECK_TYPE (TYPE, DEFAULT) + Autoconf, up to 2.13, used to provide this version of + 'AC_CHECK_TYPE', deprecated because of its flaws. Firstly, + although it is a member of the 'CHECK' clan, singular sub-family, + it does more than just checking. Second, missing types are not + 'typedef''d, they are '#define''d, which can lead to incompatible + code in the case of pointer types. + + This use of 'AC_CHECK_TYPE' is obsolete and discouraged, see *note + Generic Types::, for the description of the current macro. + + If the type TYPE is not defined, define it to be the C (or C++) + builtin type DEFAULT; e.g., 'short' or 'unsigned'. + + This macro is equivalent to: + + AC_CHECK_TYPE([TYPE], + [AC_DEFINE([TYPE], [DEFAULT], + [Define to `DEFAULT' if <sys/types.h> + does not define.])]) + + In order to keep backward compatibility, the two versions of + 'AC_CHECK_TYPE' are implemented, selected by a simple heuristics: + + 1. If there are three or four arguments, the modern version is + used. + + 2. If the second argument appears to be a C or C++ type, then the + obsolete version is used. This happens if the argument is a C + or C++ _builtin_ type or a C identifier ending in '_t', + optionally followed by one of '[(* ' and then by a string of + zero or more characters taken from the set '[]()* _a-zA-Z0-9'. + + 3. If the second argument is spelled with the alphabet of valid C + and C++ types, the user is warned and the modern version is + used. + + 4. Otherwise, the modern version is used. + + You are encouraged either to use a valid builtin type, or to use + the equivalent modern code (see above), or better yet, to use + 'AC_CHECK_TYPES' together with + + #if !HAVE_LOFF_T + typedef loff_t off_t; + #endif + + -- Macro: AC_CHECKING (FEATURE-DESCRIPTION) + Same as 'AC_MSG_NOTICE([checking FEATURE-DESCRIPTION...]'. + + -- Macro: AC_COMPILE_CHECK (ECHO-TEXT, INCLUDES, FUNCTION-BODY, + ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]) + This is an obsolete version of 'AC_TRY_LINK' (*note Examining + Libraries::), with the addition that it prints 'checking for + ECHO-TEXT' to the standard output first, if ECHO-TEXT is non-empty. + Use 'AC_MSG_CHECKING' and 'AC_MSG_RESULT' instead to print messages + (*note Printing Messages::). + + -- Macro: AC_CONST + 'AC_C_CONST' + + -- Macro: AC_CROSS_CHECK + Same as 'AC_C_CROSS', which is obsolete too, and does nothing + ':-)'. + + -- Macro: AC_CYGWIN + Check for the Cygwin environment in which case the shell variable + 'CYGWIN' is set to 'yes'. Don't use this macro, the dignified + means to check the nature of the host is using 'AC_CANONICAL_HOST'. + As a matter of fact this macro is defined as: + + AC_REQUIRE([AC_CANONICAL_HOST])[]dnl + case $host_os in + *cygwin* ) CYGWIN=yes;; + * ) CYGWIN=no;; + esac + + Beware that the variable 'CYGWIN' has a very special meaning when + running CygWin32, and should not be changed. That's yet another + reason not to use this macro. + + -- Macro: AC_DECL_YYTEXT + Does nothing, now integrated in 'AC_PROG_LEX'. + + -- Macro: AC_DIR_HEADER + Like calling 'AC_FUNC_CLOSEDIR_VOID' and'AC_HEADER_DIRENT', but + defines a different set of C preprocessor macros to indicate which + header file is found: + + Header Old Symbol New Symbol + 'dirent.h' 'DIRENT' 'HAVE_DIRENT_H' + 'sys/ndir.h' 'SYSNDIR' 'HAVE_SYS_NDIR_H' + 'sys/dir.h' 'SYSDIR' 'HAVE_SYS_DIR_H' + 'ndir.h' 'NDIR' 'HAVE_NDIR_H' + + -- Macro: AC_DYNIX_SEQ + If on Dynix/PTX (Sequent UNIX), add '-lseq' to output variable + 'LIBS'. This macro used to be defined as + + AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS") + + now it is just 'AC_FUNC_GETMNTENT'. + + -- Macro: AC_EXEEXT + Defined the output variable 'EXEEXT' based on the output of the + compiler, which is now done automatically. Typically set to empty + string if Unix and '.exe' if Win32 or OS/2. + + -- Macro: AC_EMXOS2 + Similar to 'AC_CYGWIN' but checks for the EMX environment on OS/2 + and sets 'EMXOS2'. + + -- Macro: AC_ERROR + 'AC_MSG_ERROR' + + -- Macro: AC_FIND_X + 'AC_PATH_X' + + -- Macro: AC_FIND_XTRA + 'AC_PATH_XTRA' + + -- Macro: AC_FUNC_CHECK + 'AC_CHECK_FUNC' + + -- Macro: AC_FUNC_WAIT3 + If 'wait3' is found and fills in the contents of its third argument + (a 'struct rusage *'), which HP-UX does not do, define + 'HAVE_WAIT3'. + + These days portable programs should use 'waitpid', not 'wait3', as + 'wait3' is being removed from the Open Group standards, and will + not appear in the next revision of POSIX. + + -- Macro: AC_GCC_TRADITIONAL + 'AC_PROG_GCC_TRADITIONAL' + + -- Macro: AC_GETGROUPS_T + 'AC_TYPE_GETGROUPS' + + -- Macro: AC_GETLOADAVG + 'AC_FUNC_GETLOADAVG' + + -- Macro: AC_HAVE_FUNCS + 'AC_CHECK_FUNCS' + + -- Macro: AC_HAVE_HEADERS + 'AC_CHECK_HEADERS' + + -- Macro: AC_HAVE_LIBRARY (LIBRARY, [ACTION-IF-FOUND], + [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES]) + This macro is equivalent to calling 'AC_CHECK_LIB' with a FUNCTION + argument of 'main'. In addition, LIBRARY can be written as any of + 'foo', '-lfoo', or 'libfoo.a'. In all of those cases, the compiler + is passed '-lfoo'. However, LIBRARY cannot be a shell variable; it + must be a literal name. + + -- Macro: AC_HAVE_POUNDBANG + 'AC_SYS_INTERPRETER' (different calling convention) + + -- Macro: AC_HEADER_CHECK + 'AC_CHECK_HEADER' + + -- Macro: AC_HEADER_EGREP + 'AC_EGREP_HEADER' + + -- Macro: AC_INIT (UNIQUE-FILE-IN-SOURCE-DIR) + Formerly 'AC_INIT' used to have a single argument, and was + equivalent to: + + AC_INIT + AC_CONFIG_SRCDIR(UNIQUE-FILE-IN-SOURCE-DIR) + + -- Macro: AC_INLINE + 'AC_C_INLINE' + + -- Macro: AC_INT_16_BITS + If the C type 'int' is 16 bits wide, define 'INT_16_BITS'. Use + 'AC_CHECK_SIZEOF(int)' instead. + + -- Macro: AC_IRIX_SUN + If on IRIX (Silicon Graphics UNIX), add '-lsun' to output 'LIBS'. + If you were using it to get 'getmntent', use 'AC_FUNC_GETMNTENT' + instead. If you used it for the NIS versions of the password and + group functions, use 'AC_CHECK_LIB(sun, getpwnam)'. Up to Autoconf + 2.13, it used to be + + AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS") + + now it is defined as + + AC_FUNC_GETMNTENT + AC_CHECK_LIB(sun, getpwnam) + + -- Macro: AC_LANG_C + Same as 'AC_LANG(C)'. + + -- Macro: AC_LANG_CPLUSPLUS + Same as 'AC_LANG(C++)'. + + -- Macro: AC_LANG_FORTRAN77 + Same as 'AC_LANG(Fortran 77)'. + + -- Macro: AC_LANG_RESTORE + Select the LANGUAGE that is saved on the top of the stack, as set + by 'AC_LANG_SAVE', remove it from the stack, and call + 'AC_LANG(LANGUAGE)'. + + -- Macro: AC_LANG_SAVE + Remember the current language (as set by 'AC_LANG') on a stack. + The current language does not change. 'AC_LANG_PUSH' is preferred. + + -- Macro: AC_LINK_FILES (SOURCE..., DEST...) + This is an obsolete version of 'AC_CONFIG_LINKS'. An updated + version of: + + AC_LINK_FILES(config/$machine.h config/$obj_format.h, + host.h object.h) + + is: + + AC_CONFIG_LINKS(host.h:config/$machine.h + object.h:config/$obj_format.h) + + -- Macro: AC_LN_S + 'AC_PROG_LN_S' + + -- Macro: AC_LONG_64_BITS + Define 'LONG_64_BITS' if the C type 'long int' is 64 bits wide. + Use the generic macro 'AC_CHECK_SIZEOF([long int])' instead. + + -- Macro: AC_LONG_DOUBLE + 'AC_C_LONG_DOUBLE' + + -- Macro: AC_LONG_FILE_NAMES + 'AC_SYS_LONG_FILE_NAMES' + + -- Macro: AC_MAJOR_HEADER + 'AC_HEADER_MAJOR' + + -- Macro: AC_MEMORY_H + Used to define 'NEED_MEMORY_H' if the 'mem' functions were defined + in 'memory.h'. Today it is equivalent to + 'AC_CHECK_HEADERS(memory.h)'. Adjust your code to depend upon + 'HAVE_MEMORY_H', not 'NEED_MEMORY_H', see *Note Standard Symbols::. + + -- Macro: AC_MINGW32 + Similar to 'AC_CYGWIN' but checks for the MingW32 compiler + environment and sets 'MINGW32'. + + -- Macro: AC_MINUS_C_MINUS_O + 'AC_PROG_CC_C_O' + + -- Macro: AC_MMAP + 'AC_FUNC_MMAP' + + -- Macro: AC_MODE_T + 'AC_TYPE_MODE_T' + + -- Macro: AC_OBJEXT + Defined the output variable 'OBJEXT' based on the output of the + compiler, after .c files have been excluded. Typically set to 'o' + if Unix, 'obj' if Win32. Now the compiler checking macros handle + this automatically. + + -- Macro: AC_OBSOLETE (THIS-MACRO-NAME, [SUGGESTION]) + Make 'm4' print a message to the standard error output warning that + THIS-MACRO-NAME is obsolete, and giving the file and line number + where it was called. THIS-MACRO-NAME should be the name of the + macro that is calling 'AC_OBSOLETE'. If SUGGESTION is given, it is + printed at the end of the warning message; for example, it can be a + suggestion for what to use instead of THIS-MACRO-NAME. + + For instance + + AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl + + You are encouraged to use 'AU_DEFUN' instead, since it gives better + services to the user. + + -- Macro: AC_OFF_T + 'AC_TYPE_OFF_T' + + -- Macro: AC_OUTPUT ([FILE]..., [EXTRA-CMDS], [INIT-CMDS], [SAVE-DEFS]) + The use of 'AC_OUTPUT' with argument is deprecated, this obsoleted + interface is equivalent to: + + AC_CONFIG_FILES(FILE...) + AC_CONFIG_COMMANDS([default], + EXTRA-CMDS, INIT-CMDS) + AC_SETUP_DEFS(SAVE-DEFS) + AC_OUTPUT + + If you specify SAVE-DEFS, autoconf will save the '#define's in a + different form, for use in the files specified in + 'AC_CONFIG_HEADERS'. In this case, autoconf substitutes the + C-style '#define's where it finds '@DEFS@'. This runs faster, and + is simpler to maintain than building a file of '#undef's, since + autoconf will automatically generate a '#define' for each + 'AC_DEFINE' that you execute in the 'configure' script. The value + for SAVE-DEFS should be either 'cat', or 'sort'; this value is used + to filter the list of '#define's before editing. Sorted lists are + easier to read, but you may wish to see the definitions in the + order that they were processed. + + -- Macro: AC_OUTPUT_COMMANDS (EXTRA-CMDS, [INIT-CMDS]) + Specify additional shell commands to run at the end of + 'config.status', and shell commands to initialize any variables + from 'configure'. This macro may be called multiple times. It is + obsolete, replaced by 'AC_CONFIG_COMMANDS'. + + Here is an unrealistic example: + + fubar=27 + AC_OUTPUT_COMMANDS([echo this is extra $fubar, and so on.], + fubar=$fubar) + AC_OUTPUT_COMMANDS([echo this is another, extra, bit], + [echo init bit]) + + Aside from the fact that 'AC_CONFIG_COMMANDS' requires an + additional key, an important difference is that + 'AC_OUTPUT_COMMANDS' is quoting its arguments twice, while + 'AC_CONFIG_COMMANDS'. This means that 'AC_CONFIG_COMMANDS' can + safely be given macro calls as arguments: + + AC_CONFIG_COMMANDS(foo, [my_FOO()]) + + conversely, where one level of quoting was enough for literal + strings with 'AC_OUTPUT_COMMANDS', you need two with + 'AC_CONFIG_COMMANDS'. The following lines are equivalent: + + AC_OUTPUT_COMMANDS([echo "Square brackets: []"]) + AC_CONFIG_COMMANDS(default, [[echo "Square brackets: []"]]) + + -- Macro: AC_PID_T + 'AC_TYPE_PID_T' + + -- Macro: AC_PREFIX + 'AC_PREFIX_PROGRAM' + + -- Macro: AC_PROGRAMS_CHECK + 'AC_CHECK_PROGS' + + -- Macro: AC_PROGRAMS_PATH + 'AC_PATH_PROGS' + + -- Macro: AC_PROGRAM_CHECK + 'AC_CHECK_PROG' + + -- Macro: AC_PROGRAM_EGREP + 'AC_EGREP_CPP' + + -- Macro: AC_PROGRAM_PATH + 'AC_PATH_PROG' + + -- Macro: AC_REMOTE_TAPE + removed because of limited usefulness + + -- Macro: AC_RESTARTABLE_SYSCALLS + 'AC_SYS_RESTARTABLE_SYSCALLS' + + -- Macro: AC_RETSIGTYPE + 'AC_TYPE_SIGNAL' + + -- Macro: AC_RSH + Removed because of limited usefulness. + + -- Macro: AC_SCO_INTL + If on SCO UNIX, add '-lintl' to output variable 'LIBS'. This macro + used to + + AC_CHECK_LIB(intl, strftime, LIBS="-lintl $LIBS") + + now it just calls 'AC_FUNC_STRFTIME' instead. + + -- Macro: AC_SETVBUF_REVERSED + 'AC_FUNC_SETVBUF_REVERSED' + + -- Macro: AC_SET_MAKE + 'AC_PROG_MAKE_SET' + + -- Macro: AC_SIZEOF_TYPE + 'AC_CHECK_SIZEOF' + + -- Macro: AC_SIZE_T + 'AC_TYPE_SIZE_T' + + -- Macro: AC_STAT_MACROS_BROKEN + 'AC_HEADER_STAT' + + -- Macro: AC_STDC_HEADERS + 'AC_HEADER_STDC' + + -- Macro: AC_STRCOLL + 'AC_FUNC_STRCOLL' + + -- Macro: AC_ST_BLKSIZE + 'AC_STRUCT_ST_BLKSIZE' + + -- Macro: AC_ST_BLOCKS + 'AC_STRUCT_ST_BLOCKS' + + -- Macro: AC_ST_RDEV + 'AC_STRUCT_ST_RDEV' + + -- Macro: AC_SYS_RESTARTABLE_SYSCALLS + If the system automatically restarts a system call that is + interrupted by a signal, define 'HAVE_RESTARTABLE_SYSCALLS'. This + macro does not check if system calls are restarted in general-it + tests whether a signal handler installed with 'signal' (but not + 'sigaction') causes system calls to be restarted. It does not test + if system calls can be restarted when interrupted by signals that + have no handler. + + These days portable programs should use 'sigaction' with + 'SA_RESTART' if they want restartable system calls. They should + not rely on 'HAVE_RESTARTABLE_SYSCALLS', since nowadays whether a + system call is restartable is a dynamic issue, not a + configuration-time issue. + + -- Macro: AC_SYS_SIGLIST_DECLARED + 'AC_DECL_SYS_SIGLIST' + + -- Macro: AC_TEST_CPP + 'AC_TRY_CPP' + + -- Macro: AC_TEST_PROGRAM + 'AC_TRY_RUN' + + -- Macro: AC_TIMEZONE + 'AC_STRUCT_TIMEZONE' + + -- Macro: AC_TIME_WITH_SYS_TIME + 'AC_HEADER_TIME' + + -- Macro: AC_UID_T + 'AC_TYPE_UID_T' + + -- Macro: AC_UNISTD_H + Same as 'AC_CHECK_HEADERS(unistd.h)'. + + -- Macro: AC_USG + Define 'USG' if the BSD string functions are defined in + 'strings.h'. You should no longer depend upon 'USG', but on + 'HAVE_STRING_H', see *Note Standard Symbols::. + + -- Macro: AC_UTIME_NULL + 'AC_FUNC_UTIME_NULL' + + -- Macro: AC_VALIDATE_CACHED_SYSTEM_TUPLE ([CMD]) + If the cache file is inconsistent with the current host, target and + build system types, it used to execute CMD or print a default error + message. + + This is now handled by default. + + -- Macro: AC_VERBOSE (RESULT-DESCRIPTION) + 'AC_MSG_RESULT'. + + -- Macro: AC_VFORK + 'AC_FUNC_VFORK' + + -- Macro: AC_VPRINTF + 'AC_FUNC_VPRINTF' + + -- Macro: AC_WAIT3 + 'AC_FUNC_WAIT3' + + -- Macro: AC_WARN + 'AC_MSG_WARN' + + -- Macro: AC_WORDS_BIGENDIAN + 'AC_C_BIGENDIAN' + + -- Macro: AC_XENIX_DIR + This macro used to add '-lx' to output variable 'LIBS' if on Xenix. + Also, if 'dirent.h' is being checked for, added '-ldir' to 'LIBS'. + Now it is merely an alias of 'AC_HEADER_DIRENT' instead, plus some + code to detect whether running XENIX on which you should not + depend: + + AC_MSG_CHECKING([for Xenix]) + AC_EGREP_CPP(yes, + [#if defined M_XENIX && !defined M_UNIX + yes + #endif], + [AC_MSG_RESULT([yes]); XENIX=yes], + [AC_MSG_RESULT([no]); XENIX=]) + + -- Macro: AC_YYTEXT_POINTER + 'AC_DECL_YYTEXT' + + +File: autoconf.info, Node: Autoconf 1, Next: Autoconf 2.13, Prev: Obsolete Macros, Up: Obsolete Constructs + +15.5 Upgrading From Version 1 +============================= + +Autoconf version 2 is mostly backward compatible with version 1. +However, it introduces better ways to do some things, and doesn't +support some of the ugly things in version 1. So, depending on how +sophisticated your 'configure.ac' files are, you might have to do some +manual work in order to upgrade to version 2. This chapter points out +some problems to watch for when upgrading. Also, perhaps your +'configure' scripts could benefit from some of the new features in +version 2; the changes are summarized in the file 'NEWS' in the Autoconf +distribution. + +* Menu: + +* Changed File Names:: Files you might rename +* Changed Makefiles:: New things to put in 'Makefile.in' +* Changed Macros:: Macro calls you might replace +* Changed Results:: Changes in how to check test results +* Changed Macro Writing:: Better ways to write your own macros + + +File: autoconf.info, Node: Changed File Names, Next: Changed Makefiles, Prev: Autoconf 1, Up: Autoconf 1 + +15.5.1 Changed File Names +------------------------- + +If you have an 'aclocal.m4' installed with Autoconf (as opposed to in a +particular package's source directory), you must rename it to +'acsite.m4'. *Note autoconf Invocation::. + + If you distribute 'install.sh' with your package, rename it to +'install-sh' so 'make' builtin rules won't inadvertently create a file +called 'install' from it. 'AC_PROG_INSTALL' looks for the script under +both names, but it is best to use the new name. + + If you were using 'config.h.top', 'config.h.bot', or 'acconfig.h', +you still can, but you will have less clutter if you use the 'AH_' +macros. *Note Autoheader Macros::. + + +File: autoconf.info, Node: Changed Makefiles, Next: Changed Macros, Prev: Changed File Names, Up: Autoconf 1 + +15.5.2 Changed Makefiles +------------------------ + +Add '@CFLAGS@', '@CPPFLAGS@', and '@LDFLAGS@' in your 'Makefile.in' +files, so they can take advantage of the values of those variables in +the environment when 'configure' is run. Doing this isn't necessary, +but it's a convenience for users. + + Also add '@configure_input@' in a comment to each input file for +'AC_OUTPUT', so that the output files will contain a comment saying they +were produced by 'configure'. Automatically selecting the right comment +syntax for all the kinds of files that people call 'AC_OUTPUT' on became +too much work. + + Add 'config.log' and 'config.cache' to the list of files you remove +in 'distclean' targets. + + If you have the following in 'Makefile.in': + + prefix = /usr/local + exec_prefix = $(prefix) + +you must change it to: + + prefix = @prefix@ + exec_prefix = @exec_prefix@ + +The old behavior of replacing those variables without '@' characters +around them has been removed. + + +File: autoconf.info, Node: Changed Macros, Next: Changed Results, Prev: Changed Makefiles, Up: Autoconf 1 + +15.5.3 Changed Macros +--------------------- + +Many of the macros were renamed in Autoconf version 2. You can still +use the old names, but the new ones are clearer, and it's easier to find +the documentation for them. *Note Obsolete Macros::, for a table +showing the new names for the old macros. Use the 'autoupdate' program +to convert your 'configure.ac' to using the new macro names. *Note +autoupdate Invocation::. + + Some macros have been superseded by similar ones that do the job +better, but are not call-compatible. If you get warnings about calling +obsolete macros while running 'autoconf', you may safely ignore them, +but your 'configure' script will generally work better if you follow the +advice it prints about what to replace the obsolete macros with. In +particular, the mechanism for reporting the results of tests has +changed. If you were using 'echo' or 'AC_VERBOSE' (perhaps via +'AC_COMPILE_CHECK'), your 'configure' script's output will look better +if you switch to 'AC_MSG_CHECKING' and 'AC_MSG_RESULT'. *Note Printing +Messages::. Those macros work best in conjunction with cache variables. +*Note Caching Results::. + + +File: autoconf.info, Node: Changed Results, Next: Changed Macro Writing, Prev: Changed Macros, Up: Autoconf 1 + +15.5.4 Changed Results +---------------------- + +If you were checking the results of previous tests by examining the +shell variable 'DEFS', you need to switch to checking the values of the +cache variables for those tests. 'DEFS' no longer exists while +'configure' is running; it is only created when generating output files. +This difference from version 1 is because properly quoting the contents +of that variable turned out to be too cumbersome and inefficient to do +every time 'AC_DEFINE' is called. *Note Cache Variable Names::. + + For example, here is a 'configure.ac' fragment written for Autoconf +version 1: + + AC_HAVE_FUNCS(syslog) + case "$DEFS" in + *-DHAVE_SYSLOG*) ;; + *) # syslog is not in the default libraries. See if it's in some other. + saved_LIBS="$LIBS" + for lib in bsd socket inet; do + AC_CHECKING(for syslog in -l$lib) + LIBS="$saved_LIBS -l$lib" + AC_HAVE_FUNCS(syslog) + case "$DEFS" in + *-DHAVE_SYSLOG*) break ;; + *) ;; + esac + LIBS="$saved_LIBS" + done ;; + esac + + Here is a way to write it for version 2: + + AC_CHECK_FUNCS(syslog) + if test $ac_cv_func_syslog = no; then + # syslog is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG) + LIBS="$LIBS -l$lib"; break]) + done + fi + + If you were working around bugs in 'AC_DEFINE_UNQUOTED' by adding +backslashes before quotes, you need to remove them. It now works +predictably, and does not treat quotes (except back quotes) specially. +*Note Setting Output Variables::. + + All of the boolean shell variables set by Autoconf macros now use +'yes' for the true value. Most of them use 'no' for false, though for +backward compatibility some use the empty string instead. If you were +relying on a shell variable being set to something like 1 or 't' for +true, you need to change your tests. + + +File: autoconf.info, Node: Changed Macro Writing, Prev: Changed Results, Up: Autoconf 1 + +15.5.5 Changed Macro Writing +---------------------------- + +When defining your own macros, you should now use 'AC_DEFUN' instead of +'define'. 'AC_DEFUN' automatically calls 'AC_PROVIDE' and ensures that +macros called via 'AC_REQUIRE' do not interrupt other macros, to prevent +nested 'checking...' messages on the screen. There's no actual harm in +continuing to use the older way, but it's less convenient and +attractive. *Note Macro Definitions::. + + You probably looked at the macros that came with Autoconf as a guide +for how to do things. It would be a good idea to take a look at the new +versions of them, as the style is somewhat improved and they take +advantage of some new features. + + If you were doing tricky things with undocumented Autoconf internals +(macros, variables, diversions), check whether you need to change +anything to account for changes that have been made. Perhaps you can +even use an officially supported technique in version 2 instead of +kludging. Or perhaps not. + + To speed up your locally written feature tests, add caching to them. +See whether any of your tests are of general enough usefulness to +encapsulate into macros that you can share. + + +File: autoconf.info, Node: Autoconf 2.13, Prev: Autoconf 1, Up: Obsolete Constructs + +15.6 Upgrading From Version 2.13 +================================ + +The introduction of the previous section (*note Autoconf 1::) perfectly +suits this section... + + Autoconf version 2.50 is mostly backward compatible with version + 2.13. However, it introduces better ways to do some things, and + doesn't support some of the ugly things in version 2.13. So, + depending on how sophisticated your 'configure.ac' files are, you + might have to do some manual work in order to upgrade to version + 2.50. This chapter points out some problems to watch for when + upgrading. Also, perhaps your 'configure' scripts could benefit + from some of the new features in version 2.50; the changes are + summarized in the file 'NEWS' in the Autoconf distribution. + +* Menu: + +* Changed Quotation:: Broken code which used to work +* New Macros:: Interaction with foreign macros + + +File: autoconf.info, Node: Changed Quotation, Next: New Macros, Prev: Autoconf 2.13, Up: Autoconf 2.13 + +15.6.1 Changed Quotation +------------------------ + +The most important changes are invisible to you: the implementation of +most macros have completely changed. This allowed more factorization of +the code, better error messages, a higher uniformity of the user's +interface etc. Unfortunately, as a side effect, some construct which +used to (miraculously) work might break starting with Autoconf 2.50. +The most common culprit is bad quotation. + + For instance, in the following example, the message is not properly +quoted: + + AC_INIT + AC_CHECK_HEADERS(foo.h,, + AC_MSG_ERROR(cannot find foo.h, bailing out)) + AC_OUTPUT + +Autoconf 2.13 simply ignores it: + + $ autoconf-2.13; ./configure --silent + creating cache ./config.cache + configure: error: cannot find foo.h + $ + +while Autoconf 2.50 will produce a broken 'configure': + + $ autoconf-2.50; ./configure --silent + configure: error: cannot find foo.h + ./configure: exit: bad non-numeric arg `bailing' + ./configure: exit: bad non-numeric arg `bailing' + $ + + The message needs to be quoted, and the 'AC_MSG_ERROR' invocation +too! + + AC_INIT + AC_CHECK_HEADERS(foo.h,, + [AC_MSG_ERROR([cannot find foo.h, bailing out])]) + AC_OUTPUT + + Many many (and many more) Autoconf macros were lacking proper +quotation, including no less than... 'AC_DEFUN' itself! + + $ cat configure.in + AC_DEFUN([AC_PROG_INSTALL], + [# My own much better version + ]) + AC_INIT + AC_PROG_INSTALL + AC_OUTPUT + $ autoconf-2.13 + autoconf: Undefined macros: + ***BUG in Autoconf--please report*** AC_FD_MSG + ***BUG in Autoconf--please report*** AC_EPI + configure.in:1:AC_DEFUN([AC_PROG_INSTALL], + configure.in:5:AC_PROG_INSTALL + $ autoconf-2.50 + $ + + +File: autoconf.info, Node: New Macros, Prev: Changed Quotation, Up: Autoconf 2.13 + +15.6.2 New Macros +----------------- + +Because Autoconf has been dormant for years, Automake provided +Autoconf-like macros for a while. Autoconf 2.50 now provides better +versions of these macros, integrated in the 'AC_' namespace, instead of +'AM_'. But in order to ease the upgrading via 'autoupdate', bindings to +such 'AM_' macros are provided. + + Unfortunately Automake did not quote the name of these macros! +Therefore, when 'm4' find in 'aclocal.m4' something like +'AC_DEFUN(AM_TYPE_PTRDIFF_T, ...)', 'AM_TYPE_PTRDIFF_T' is expanded, +replaced with its Autoconf definition. + + Fortunately Autoconf catches pre-'AC_INIT' expansions, and will +complain, in its own words: + + $ cat configure.in + AC_INIT + AM_TYPE_PTRDIFF_T + $ aclocal-1.4 + $ autoconf + ./aclocal.m4:17: error: m4_defn: undefined macro: _m4_divert_diversion + actypes.m4:289: AM_TYPE_PTRDIFF_T is expanded from... + ./aclocal.m4:17: the top level + $ + + Future versions of Automake will simply no longer define most of +these macros, and will properly quote the names of the remaining macros. +But you don't have to wait for it to happen to do the right thing right +now: do not depend upon macros from Automake as it is simply not its job +to provide macros (but the one it requires by itself): + + $ cat configure.in + AC_INIT + AM_TYPE_PTRDIFF_T + $ rm aclocal.m4 + $ autoupdate + autoupdate: `configure.in' is updated + $ cat configure.in + AC_INIT + AC_CHECK_TYPES([ptrdiff_t]) + $ aclocal-1.4 + $ autoconf + $ + + +File: autoconf.info, Node: Questions, Next: History, Prev: Obsolete Constructs, Up: Top + +16 Questions About Autoconf +*************************** + +Several questions about Autoconf come up occasionally. Here some of +them are addressed. + +* Menu: + +* Distributing:: Distributing 'configure' scripts +* Why GNU m4:: Why not use the standard M4? +* Bootstrapping:: Autoconf and GNU M4 require each other? +* Why Not Imake:: Why GNU uses 'configure' instead of Imake + + +File: autoconf.info, Node: Distributing, Next: Why GNU m4, Prev: Questions, Up: Questions + +16.1 Distributing 'configure' Scripts +===================================== + + What are the restrictions on distributing 'configure' + scripts that Autoconf generates? How does that affect my + programs that use them? + + There are no restrictions on how the configuration scripts that +Autoconf produces may be distributed or used. In Autoconf version 1, +they were covered by the GNU General Public License. We still encourage +software authors to distribute their work under terms like those of the +GPL, but doing so is not required to use Autoconf. + + Of the other files that might be used with 'configure', 'config.h.in' +is under whatever copyright you use for your 'configure.ac'. +'config.sub' and 'config.guess' have an exception to the GPL when they +are used with an Autoconf-generated 'configure' script, which permits +you to distribute them under the same terms as the rest of your package. +'install-sh' is from the X Consortium and is not copyrighted. + + +File: autoconf.info, Node: Why GNU m4, Next: Bootstrapping, Prev: Distributing, Up: Questions + +16.2 Why Require GNU M4? +======================== + + Why does Autoconf require GNU M4? + + Many M4 implementations have hard-coded limitations on the size and +number of macros that Autoconf exceeds. They also lack several builtin +macros that it would be difficult to get along without in a +sophisticated application like Autoconf, including: + + builtin + indir + patsubst + __file__ + __line__ + + Autoconf requires version 1.4 or above of GNU M4 because it uses +frozen state files. + + Since only software maintainers need to use Autoconf, and since GNU +M4 is simple to configure and install, it seems reasonable to require +GNU M4 to be installed also. Many maintainers of GNU and other free +software already have most of the GNU utilities installed, since they +prefer them. + + +File: autoconf.info, Node: Bootstrapping, Next: Why Not Imake, Prev: Why GNU m4, Up: Questions + +16.3 How Can I Bootstrap? +========================= + + If Autoconf requires GNU M4 and GNU M4 has an Autoconf + 'configure' script, how do I bootstrap? It seems like a chicken + and egg problem! + + This is a misunderstanding. Although GNU M4 does come with a +'configure' script produced by Autoconf, Autoconf is not required in +order to run the script and install GNU M4. Autoconf is only required +if you want to change the M4 'configure' script, which few people have +to do (mainly its maintainer). + + +File: autoconf.info, Node: Why Not Imake, Prev: Bootstrapping, Up: Questions + +16.4 Why Not Imake? +=================== + + Why not use Imake instead of 'configure' scripts? + + Several people have written addressing this question, so I include +adaptations of their explanations here. + + The following answer is based on one written by Richard Pixley: + + Autoconf generated scripts frequently work on machines that it has + never been set up to handle before. That is, it does a good job of + inferring a configuration for a new system. Imake cannot do this. + + Imake uses a common database of host specific data. For X11, this + makes sense because the distribution is made as a collection of + tools, by one central authority who has control over the database. + + GNU tools are not released this way. Each GNU tool has a + maintainer; these maintainers are scattered across the world. + Using a common database would be a maintenance nightmare. Autoconf + may appear to be this kind of database, but in fact it is not. + Instead of listing host dependencies, it lists program + requirements. + + If you view the GNU suite as a collection of native tools, then the + problems are similar. But the GNU development tools can be + configured as cross tools in almost any host+target permutation. + All of these configurations can be installed concurrently. They + can even be configured to share host independent files across + hosts. Imake doesn't address these issues. + + Imake templates are a form of standardization. The GNU coding + standards address the same issues without necessarily imposing the + same restrictions. + + Here is some further explanation, written by Per Bothner: + + One of the advantages of Imake is that it easy to generate large + Makefiles using 'cpp''s '#include' and macro mechanisms. However, + 'cpp' is not programmable: it has limited conditional facilities, + and no looping. And 'cpp' cannot inspect its environment. + + All of these problems are solved by using 'sh' instead of 'cpp'. + The shell is fully programmable, has macro substitution, can + execute (or source) other shell scripts, and can inspect its + environment. + + Paul Eggert elaborates more: + + With Autoconf, installers need not assume that Imake itself is + already installed and working well. This may not seem like much of + an advantage to people who are accustomed to Imake. But on many + hosts Imake is not installed or the default installation is not + working well, and requiring Imake to install a package hinders the + acceptance of that package on those hosts. For example, the Imake + template and configuration files might not be installed properly on + a host, or the Imake build procedure might wrongly assume that all + source files are in one big directory tree, or the Imake + configuration might assume one compiler whereas the package or the + installer needs to use another, or there might be a version + mismatch between the Imake expected by the package and the Imake + supported by the host. These problems are much rarer with + Autoconf, where each package comes with its own independent + configuration processor. + + Also, Imake often suffers from unexpected interactions between + 'make' and the installer's C preprocessor. The fundamental problem + here is that the C preprocessor was designed to preprocess C + programs, not 'Makefile's. This is much less of a problem with + Autoconf, which uses the general-purpose preprocessor 'm4', and + where the package's author (rather than the installer) does the + preprocessing in a standard way. + + Finally, Mark Eichin notes: + + Imake isn't all that extensible, either. In order to add new + features to Imake, you need to provide your own project template, + and duplicate most of the features of the existing one. This means + that for a sophisticated project, using the vendor-provided Imake + templates fails to provide any leverage--since they don't cover + anything that your own project needs (unless it is an X11 program). + + On the other side, though: + + The one advantage that Imake has over 'configure': 'Imakefile's + tend to be much shorter (likewise, less redundant) than + 'Makefile.in's. There is a fix to this, however--at least for the + Kerberos V5 tree, we've modified things to call in common 'post.in' + and 'pre.in' 'Makefile' fragments for the entire tree. This means + that a lot of common things don't have to be duplicated, even + though they normally are in 'configure' setups. + + +File: autoconf.info, Node: History, Next: Environment Variable Index, Prev: Questions, Up: Top + +17 History of Autoconf +********************** + +You may be wondering, Why was Autoconf originally written? How did it +get into its present form? (Why does it look like gorilla spit?) If +you're not wondering, then this chapter contains no information useful +to you, and you might as well skip it. If you _are_ wondering, then let +there be light... + +* Menu: + +* Genesis:: Prehistory and naming of 'configure' +* Exodus:: The plagues of M4 and Perl +* Leviticus:: The priestly code of portability arrives +* Numbers:: Growth and contributors +* Deuteronomy:: Approaching the promises of easy configuration + + +File: autoconf.info, Node: Genesis, Next: Exodus, Prev: History, Up: History + +17.1 Genesis +============ + +In June 1991 I was maintaining many of the GNU utilities for the Free +Software Foundation. As they were ported to more platforms and more +programs were added, the number of '-D' options that users had to select +in the 'Makefile' (around 20) became burdensome. Especially for me--I +had to test each new release on a bunch of different systems. So I +wrote a little shell script to guess some of the correct settings for +the fileutils package, and released it as part of fileutils 2.0. That +'configure' script worked well enough that the next month I adapted it +(by hand) to create similar 'configure' scripts for several other GNU +utilities packages. Brian Berliner also adapted one of my scripts for +his CVS revision control system. + + Later that summer, I learned that Richard Stallman and Richard Pixley +were developing similar scripts to use in the GNU compiler tools; so I +adapted my 'configure' scripts to support their evolving interface: +using the file name 'Makefile.in' as the templates; adding '+srcdir', +the first option (of many); and creating 'config.status' files. + + +File: autoconf.info, Node: Exodus, Next: Leviticus, Prev: Genesis, Up: History + +17.2 Exodus +=========== + +As I got feedback from users, I incorporated many improvements, using +Emacs to search and replace, cut and paste, similar changes in each of +the scripts. As I adapted more GNU utilities packages to use +'configure' scripts, updating them all by hand became impractical. Rich +Murphey, the maintainer of the GNU graphics utilities, sent me mail +saying that the 'configure' scripts were great, and asking if I had a +tool for generating them that I could send him. No, I thought, but I +should! So I started to work out how to generate them. And the journey +from the slavery of hand-written 'configure' scripts to the abundance +and ease of Autoconf began. + + Cygnus 'configure', which was being developed at around that time, is +table driven; it is meant to deal mainly with a discrete number of +system types with a small number of mainly unguessable features (such as +details of the object file format). The automatic configuration system +that Brian Fox had developed for Bash takes a similar approach. For +general use, it seems to me a hopeless cause to try to maintain an +up-to-date database of which features each variant of each operating +system has. It's easier and more reliable to check for most features on +the fly--especially on hybrid systems that people have hacked on locally +or that have patches from vendors installed. + + I considered using an architecture similar to that of Cygnus +'configure', where there is a single 'configure' script that reads +pieces of 'configure.in' when run. But I didn't want to have to +distribute all of the feature tests with every package, so I settled on +having a different 'configure' made from each 'configure.in' by a +preprocessor. That approach also offered more control and flexibility. + + I looked briefly into using the Metaconfig package, by Larry Wall, +Harlan Stenn, and Raphael Manfredi, but I decided not to for several +reasons. The 'Configure' scripts it produces are interactive, which I +find quite inconvenient; I didn't like the ways it checked for some +features (such as library functions); I didn't know that it was still +being maintained, and the 'Configure' scripts I had seen didn't work on +many modern systems (such as System V R4 and NeXT); it wasn't very +flexible in what it could do in response to a feature's presence or +absence; I found it confusing to learn; and it was too big and complex +for my needs (I didn't realize then how much Autoconf would eventually +have to grow). + + I considered using Perl to generate my style of 'configure' scripts, +but decided that M4 was better suited to the job of simple textual +substitutions: it gets in the way less, because output is implicit. +Plus, everyone already has it. (Initially I didn't rely on the GNU +extensions to M4.) Also, some of my friends at the University of +Maryland had recently been putting M4 front ends on several programs, +including 'tvtwm', and I was interested in trying out a new language. + + +File: autoconf.info, Node: Leviticus, Next: Numbers, Prev: Exodus, Up: History + +17.3 Leviticus +============== + +Since my 'configure' scripts determine the system's capabilities +automatically, with no interactive user intervention, I decided to call +the program that generates them Autoconfig. But with a version number +tacked on, that name would be too long for old UNIX file systems, so I +shortened it to Autoconf. + + In the fall of 1991 I called together a group of fellow questers +after the Holy Grail of portability (er, that is, alpha testers) to give +me feedback as I encapsulated pieces of my handwritten scripts in M4 +macros and continued to add features and improve the techniques used in +the checks. Prominent among the testers were François Pinard, who came +up with the idea of making an 'autoconf' shell script to run 'm4' and +check for unresolved macro calls; Richard Pixley, who suggested running +the compiler instead of searching the file system to find include files +and symbols, for more accurate results; Karl Berry, who got Autoconf to +configure TeX and added the macro index to the documentation; and Ian +Lance Taylor, who added support for creating a C header file as an +alternative to putting '-D' options in a 'Makefile', so he could use +Autoconf for his UUCP package. The alpha testers cheerfully adjusted +their files again and again as the names and calling conventions of the +Autoconf macros changed from release to release. They all contributed +many specific checks, great ideas, and bug fixes. + + +File: autoconf.info, Node: Numbers, Next: Deuteronomy, Prev: Leviticus, Up: History + +17.4 Numbers +============ + +In July 1992, after months of alpha testing, I released Autoconf 1.0, +and converted many GNU packages to use it. I was surprised by how +positive the reaction to it was. More people started using it than I +could keep track of, including people working on software that wasn't +part of the GNU Project (such as TCL, FSP, and Kerberos V5). Autoconf +continued to improve rapidly, as many people using the 'configure' +scripts reported problems they encountered. + + Autoconf turned out to be a good torture test for M4 implementations. +UNIX 'm4' started to dump core because of the length of the macros that +Autoconf defined, and several bugs showed up in GNU 'm4' as well. +Eventually, we realized that we needed to use some features that only +GNU M4 has. 4.3BSD 'm4', in particular, has an impoverished set of +builtin macros; the System V version is better, but still doesn't +provide everything we need. + + More development occurred as people put Autoconf under more stresses +(and to uses I hadn't anticipated). Karl Berry added checks for X11. +david zuhn contributed C++ support. François Pinard made it diagnose +invalid arguments. Jim Blandy bravely coerced it into configuring GNU +Emacs, laying the groundwork for several later improvements. Roland +McGrath got it to configure the GNU C Library, wrote the 'autoheader' +script to automate the creation of C header file templates, and added a +'--verbose' option to 'configure'. Noah Friedman added the +'--autoconf-dir' option and 'AC_MACRODIR' environment variable. (He +also coined the term "autoconfiscate" to mean "adapt a software package +to use Autoconf".) Roland and Noah improved the quoting protection in +'AC_DEFINE' and fixed many bugs, especially when I got sick of dealing +with portability problems from February through June, 1993. + + +File: autoconf.info, Node: Deuteronomy, Prev: Numbers, Up: History + +17.5 Deuteronomy +================ + +A long wish list for major features had accumulated, and the effect of +several years of patching by various people had left some residual +cruft. In April 1994, while working for Cygnus Support, I began a major +revision of Autoconf. I added most of the features of the Cygnus +'configure' that Autoconf had lacked, largely by adapting the relevant +parts of Cygnus 'configure' with the help of david zuhn and Ken Raeburn. +These features include support for using 'config.sub', 'config.guess', +'--host', and '--target'; making links to files; and running 'configure' +scripts in subdirectories. Adding these features enabled Ken to convert +GNU 'as', and Rob Savoye to convert DejaGNU, to using Autoconf. + + I added more features in response to other peoples' requests. Many +people had asked for 'configure' scripts to share the results of the +checks between runs, because (particularly when configuring a large +source tree, like Cygnus does) they were frustratingly slow. Mike +Haertel suggested adding site-specific initialization scripts. People +distributing software that had to unpack on MS-DOS asked for a way to +override the '.in' extension on the file names, which produced file +names like 'config.h.in' containing two dots. Jim Avera did an +extensive examination of the problems with quoting in 'AC_DEFINE' and +'AC_SUBST'; his insights led to significant improvements. Richard +Stallman asked that compiler output be sent to 'config.log' instead of +'/dev/null', to help people debug the Emacs 'configure' script. + + I made some other changes because of my dissatisfaction with the +quality of the program. I made the messages showing results of the +checks less ambiguous, always printing a result. I regularized the +names of the macros and cleaned up coding style inconsistencies. I +added some auxiliary utilities that I had developed to help convert +source code packages to use Autoconf. With the help of François Pinard, +I made the macros not interrupt each others' messages. (That feature +revealed some performance bottlenecks in GNU 'm4', which he hastily +corrected!) I reorganized the documentation around problems people want +to solve. And I began a test suite, because experience had shown that +Autoconf has a pronounced tendency to regress when we change it. + + Again, several alpha testers gave invaluable feedback, especially +François Pinard, Jim Meyering, Karl Berry, Rob Savoye, Ken Raeburn, and +Mark Eichin. + + Finally, version 2.0 was ready. And there was much rejoicing. (And +I have free time again. I think. Yeah, right.) + + +File: autoconf.info, Node: Environment Variable Index, Next: Output Variable Index, Prev: History, Up: Top + +Environment Variable Index +************************** + +This is an alphabetical list of the environment variables that Autoconf +checks. + + +* Menu: + +* AC_MACRODIR: autoscan Invocation. (line 54) +* AC_MACRODIR <1>: autoconf Invocation. (line 45) +* AC_MACRODIR <2>: autoreconf Invocation. + (line 77) +* AC_MACRODIR <3>: autoheader Invocation. + (line 62) +* AC_MACRODIR <4>: autoupdate Invocation. + (line 42) +* CDPATH: Special Shell Variables. + (line 13) +* CONFIG_COMMANDS: Obsolete config.status Use. + (line 11) +* CONFIG_FILES: Obsolete config.status Use. + (line 15) +* CONFIG_HEADERS: Obsolete config.status Use. + (line 20) +* CONFIG_LINKS: Obsolete config.status Use. + (line 25) +* CONFIG_SHELL: config.status Invocation. + (line 75) +* CONFIG_SITE: Site Defaults. (line 10) +* CONFIG_STATUS: config.status Invocation. + (line 79) +* IFS: Special Shell Variables. + (line 45) +* LANG: Special Shell Variables. + (line 59) +* LANGUAGE: Special Shell Variables. + (line 59) +* LC_ALL: Special Shell Variables. + (line 59) +* LC_COLLATE: Special Shell Variables. + (line 59) +* LC_CTYPE: Special Shell Variables. + (line 59) +* LC_MESSAGES: Special Shell Variables. + (line 59) +* LC_NUMERIC: Special Shell Variables. + (line 59) +* LC_TIME: Special Shell Variables. + (line 59) +* NULLCMD: Special Shell Variables. + (line 77) +* PATH_SEPARATOR: Special Shell Variables. + (line 88) +* RANDOM: Special Shell Variables. + (line 97) +* SIMPLE_BACKUP_SUFFIX: autoupdate Invocation. + (line 16) +* status: Special Shell Variables. + (line 84) +* WARNINGS: autoconf Invocation. (line 65) +* WARNINGS <1>: autoheader Invocation. + (line 78) + + +File: autoconf.info, Node: Output Variable Index, Next: Preprocessor Symbol Index, Prev: Environment Variable Index, Up: Top + +Output Variable Index +********************* + +This is an alphabetical list of the variables that Autoconf can +substitute into files that it creates, typically one or more +'Makefile's. *Note Setting Output Variables::, for more information on +how this is done. + + +* Menu: + +* ALLOCA: Particular Functions. + (line 10) +* AWK: Particular Programs. (line 10) +* bindir: Installation Directory Variables. + (line 12) +* build: Canonicalizing. (line 26) +* build_alias: Canonicalizing. (line 9) +* build_cpu: Canonicalizing. (line 26) +* build_os: Canonicalizing. (line 26) +* build_vendor: Canonicalizing. (line 26) +* CC: C Compiler. (line 7) +* CC <1>: C Compiler. (line 34) +* CC <2>: C Compiler. (line 156) +* CC <3>: System Services. (line 44) +* CC <4>: UNIX Variants. (line 18) +* CFLAGS: Preset Output Variables. + (line 15) +* CFLAGS <1>: C Compiler. (line 7) +* configure_input: Preset Output Variables. + (line 22) +* CPP: C Compiler. (line 47) +* CPPFLAGS: Preset Output Variables. + (line 36) +* cross_compiling: Specifying Names. (line 26) +* CXX: C++ Compiler. (line 7) +* CXXCPP: C++ Compiler. (line 31) +* CXXFLAGS: Preset Output Variables. + (line 43) +* CXXFLAGS <1>: C++ Compiler. (line 7) +* datadir: Installation Directory Variables. + (line 15) +* DEFS: Preset Output Variables. + (line 50) +* ECHO_C: Preset Output Variables. + (line 60) +* ECHO_N: Preset Output Variables. + (line 60) +* ECHO_T: Preset Output Variables. + (line 60) +* EGREP: Particular Programs. (line 16) +* exec_prefix: Installation Directory Variables. + (line 19) +* EXEEXT: Compilers and Preprocessors. + (line 6) +* EXEEXT <1>: Obsolete Macros. (line 145) +* F77: Fortran 77 Compiler. (line 7) +* FFLAGS: Preset Output Variables. + (line 72) +* FFLAGS <1>: Fortran 77 Compiler. (line 7) +* FGREP: Particular Programs. (line 20) +* FLIBS: Fortran 77 Compiler. (line 38) +* GETGROUPS_LIBS: Particular Functions. + (line 97) +* GETLOADAVG_LIBS: Particular Functions. + (line 103) +* GREP: Particular Programs. (line 24) +* host: Canonicalizing. (line 34) +* host_alias: Canonicalizing. (line 9) +* host_cpu: Canonicalizing. (line 34) +* host_os: Canonicalizing. (line 34) +* host_vendor: Canonicalizing. (line 34) +* includedir: Installation Directory Variables. + (line 26) +* infodir: Installation Directory Variables. + (line 29) +* INSTALL: Particular Programs. (line 28) +* INSTALL_DATA: Particular Programs. (line 28) +* INSTALL_PROGRAM: Particular Programs. (line 28) +* INSTALL_SCRIPT: Particular Programs. (line 28) +* KMEM_GROUP: Particular Functions. + (line 103) +* LDFLAGS: Preset Output Variables. + (line 79) +* LEX: Particular Programs. (line 57) +* LEXLIB: Particular Programs. (line 57) +* LEX_OUTPUT_ROOT: Particular Programs. (line 57) +* libdir: Installation Directory Variables. + (line 32) +* libexecdir: Installation Directory Variables. + (line 35) +* LIBOBJS: Particular Functions. + (line 103) +* LIBOBJS <1>: Particular Functions. + (line 160) +* LIBOBJS <2>: Particular Functions. + (line 167) +* LIBOBJS <3>: Generic Functions. (line 44) +* LIBOBJS <4>: Generic Functions. (line 84) +* LIBOBJS <5>: Particular Structures. + (line 17) +* LIBS: Preset Output Variables. + (line 87) +* LIBS <1>: Obsolete Macros. (line 408) +* LIBS <2>: Obsolete Macros. (line 515) +* LN_S: Particular Programs. (line 95) +* localstatedir: Installation Directory Variables. + (line 38) +* mandir: Installation Directory Variables. + (line 41) +* NEED_SETGID: Particular Functions. + (line 103) +* OBJEXT: Compilers and Preprocessors. + (line 10) +* OBJEXT <1>: Obsolete Macros. (line 300) +* oldincludedir: Installation Directory Variables. + (line 44) +* POW_LIB: Particular Functions. + (line 216) +* prefix: Installation Directory Variables. + (line 47) +* program_transform_name: Transforming Names. (line 11) +* RANLIB: Particular Programs. (line 114) +* sbindir: Installation Directory Variables. + (line 52) +* SET_MAKE: Output. (line 37) +* sharedstatedir: Installation Directory Variables. + (line 56) +* srcdir: Preset Output Variables. + (line 94) +* subdirs: Subdirectories. (line 12) +* sysconfdir: Installation Directory Variables. + (line 60) +* target: Canonicalizing. (line 46) +* target_alias: Canonicalizing. (line 9) +* target_cpu: Canonicalizing. (line 46) +* target_os: Canonicalizing. (line 46) +* target_vendor: Canonicalizing. (line 46) +* top_srcdir: Preset Output Variables. + (line 97) +* X_CFLAGS: System Services. (line 26) +* X_EXTRA_LIBS: System Services. (line 26) +* X_LIBS: System Services. (line 26) +* X_PRE_LIBS: System Services. (line 26) +* YACC: Particular Programs. (line 118) + + +File: autoconf.info, Node: Preprocessor Symbol Index, Next: Autoconf Macro Index, Prev: Output Variable Index, Up: Top + +Preprocessor Symbol Index +************************* + +This is an alphabetical list of the C preprocessor symbols that the +Autoconf macros define. To work with Autoconf, C source code needs to +use these names in '#if' directives. + + +* Menu: + +* _ALL_SOURCE: UNIX Variants. (line 13) +* _FILE_OFFSET_BITS: System Services. (line 44) +* _LARGEFILE_SOURCE: Particular Functions. + (line 93) +* _LARGE_FILES: System Services. (line 44) +* _MINIX: UNIX Variants. (line 25) +* _POSIX_1_SOURCE: UNIX Variants. (line 25) +* _POSIX_SOURCE: UNIX Variants. (line 18) +* _POSIX_SOURCE <1>: UNIX Variants. (line 25) +* _POSIX_VERSION: Particular Headers. (line 130) +* __CHAR_UNSIGNED__: C Compiler. (line 120) +* CLOSEDIR_VOID: Particular Functions. + (line 58) +* const: C Compiler. (line 73) +* C_ALLOCA: Particular Functions. + (line 10) +* C_GETLOADAVG: Particular Functions. + (line 103) +* DGUX: Particular Functions. + (line 103) +* DIRENT: Obsolete Macros. (line 126) +* F77_DUMMY_MAIN: Fortran 77 Compiler. (line 64) +* F77_FUNC: Fortran 77 Compiler. (line 115) +* F77_FUNC_: Fortran 77 Compiler. (line 115) +* F77_MAIN: Fortran 77 Compiler. (line 101) +* F77_NO_MINUS_C_MINUS_O: Fortran 77 Compiler. (line 28) +* GETGROUPS_T: Particular Types. (line 10) +* GETLODAVG_PRIVILEGED: Particular Functions. + (line 103) +* GETPGRP_VOID: Particular Functions. + (line 136) +* gid_t: Particular Types. (line 39) +* GWINSZ_IN_SYS_IOCTL: Particular Headers. (line 167) +* HAVE_ALLOCA_H: Particular Functions. + (line 10) +* HAVE_CONFIG_H: Configuration Headers. + (line 25) +* HAVE_DECL_SYMBOL: Generic Declarations. + (line 23) +* HAVE_DIRENT_H: Particular Headers. (line 10) +* HAVE_DOPRNT: Particular Functions. + (line 238) +* HAVE_FUNCTION: Generic Functions. (line 25) +* HAVE_GETMNTENT: Particular Functions. + (line 131) +* HAVE_HEADER: Generic Headers. (line 43) +* HAVE_LONG_DOUBLE: C Compiler. (line 124) +* HAVE_LONG_FILE_NAMES: System Services. (line 58) +* HAVE_LSTAT_EMPTY_STRING_BUG: Particular Functions. + (line 196) +* HAVE_MMAP: Particular Functions. + (line 171) +* HAVE_NDIR_H: Particular Headers. (line 10) +* HAVE_OBSTACK: Particular Functions. + (line 176) +* HAVE_RESTARTABLE_SYSCALLS: Obsolete Macros. (line 446) +* HAVE_STAT_EMPTY_STRING_BUG: Particular Functions. + (line 196) +* HAVE_STRCOLL: Particular Functions. + (line 210) +* HAVE_STRERROR_R: Particular Functions. + (line 222) +* HAVE_STRFTIME: Particular Functions. + (line 230) +* HAVE_STRINGIZE: C Compiler. (line 130) +* HAVE_STRUCT_STAT_ST_BLKSIZE: Particular Structures. + (line 9) +* HAVE_STRUCT_STAT_ST_BLOCKS: Particular Structures. + (line 17) +* HAVE_STRUCT_STAT_ST_RDEV: Particular Structures. + (line 23) +* HAVE_ST_BLKSIZE: Particular Structures. + (line 9) +* HAVE_ST_BLOCKS: Particular Structures. + (line 17) +* HAVE_ST_RDEV: Particular Structures. + (line 23) +* HAVE_SYS_DIR_H: Particular Headers. (line 10) +* HAVE_SYS_NDIR_H: Particular Headers. (line 10) +* HAVE_SYS_WAIT_H: Particular Headers. (line 112) +* HAVE_TM_ZONE: Particular Structures. + (line 36) +* HAVE_TZNAME: Particular Structures. + (line 36) +* HAVE_UTIME_NULL: Particular Functions. + (line 234) +* HAVE_VFORK_H: Particular Functions. + (line 71) +* HAVE_VPRINTF: Particular Functions. + (line 238) +* HAVE_WAIT3: Obsolete Macros. (line 166) +* HAVE_WORKING_FORK: Particular Functions. + (line 71) +* HAVE_WORKING_STRERROR_R: Particular Functions. + (line 222) +* HAVE_WORKING_VFORK: Particular Functions. + (line 71) +* inline: C Compiler. (line 115) +* INT_16_BITS: Obsolete Macros. (line 217) +* LONG_64_BITS: Obsolete Macros. (line 268) +* LSTAT_FOLLOWS_SLASHED_SYMLINK: Particular Functions. + (line 143) +* MAJOR_IN_MKDEV: Particular Headers. (line 46) +* MAJOR_IN_SYSMACROS: Particular Headers. (line 46) +* mode_t: Particular Types. (line 14) +* NDIR: Obsolete Macros. (line 126) +* NEED_MEMORY_H: Obsolete Macros. (line 281) +* NEED_SETGID: Particular Functions. + (line 103) +* NLIST_NAME_UNION: Particular Functions. + (line 103) +* NLIST_STRUCT: Particular Functions. + (line 103) +* NO_MINUS_C_MINUS_O: C Compiler. (line 26) +* off_t: Particular Types. (line 17) +* PARAMS: C Compiler. (line 137) +* pid_t: Particular Types. (line 20) +* PROTOTYPES: C Compiler. (line 137) +* RETSIGTYPE: Particular Types. (line 23) +* SELECT_TYPE_ARG1: Particular Functions. + (line 180) +* SELECT_TYPE_ARG234: Particular Functions. + (line 180) +* SELECT_TYPE_ARG5: Particular Functions. + (line 180) +* SETPGRP_VOID: Particular Functions. + (line 188) +* SETVBUF_REVERSED: Particular Functions. + (line 205) +* size_t: Particular Types. (line 36) +* STDC_HEADERS: Particular Headers. (line 57) +* SVR4: Particular Functions. + (line 103) +* SYSDIR: Obsolete Macros. (line 126) +* SYSNDIR: Obsolete Macros. (line 126) +* SYS_SIGLIST_DECLARED: Particular Declarations. + (line 9) +* TIME_WITH_SYS_TIME: Particular Headers. (line 146) +* TM_IN_SYS_TIME: Particular Structures. + (line 31) +* uid_t: Particular Types. (line 39) +* UMAX: Particular Functions. + (line 103) +* UMAX4_3: Particular Functions. + (line 103) +* USG: Obsolete Macros. (line 482) +* vfork: Particular Functions. + (line 71) +* volatile: C Compiler. (line 98) +* WORDS_BIGENDIAN: C Compiler. (line 68) +* X_DISPLAY_MISSING: System Services. (line 26) +* YYTEXT_POINTER: Particular Programs. (line 57) + + +File: autoconf.info, Node: Autoconf Macro Index, Next: M4 Macro Index, Prev: Preprocessor Symbol Index, Up: Top + +Autoconf Macro Index +******************** + +This is an alphabetical list of the Autoconf macros. To make the list +easier to use, the macros are listed without their preceding 'AC_'. + + +* Menu: + +* AH_BOTTOM: Autoheader Macros. (line 56) +* AH_TEMPLATE: Autoheader Macros. (line 32) +* AH_TOP: Autoheader Macros. (line 53) +* AH_VERBATIM: Autoheader Macros. (line 18) +* AIX: UNIX Variants. (line 13) +* ALLOCA: Obsolete Macros. (line 20) +* ARG_ARRAY: Obsolete Macros. (line 23) +* ARG_ENABLE: Package Options. (line 40) +* ARG_PROGRAM: Transforming Names. (line 11) +* ARG_VAR: Setting Output Variables. + (line 57) +* ARG_WITH: External Software. (line 41) +* AU_DEFUN: Obsoleting Macros. (line 18) +* BEFORE: Suggested Ordering. (line 28) +* BOTTOM: Autoheader Macros. (line 56) +* CACHE_CHECK: Caching Results. (line 29) +* CACHE_LOAD: Cache Checkpointing. (line 13) +* CACHE_SAVE: Cache Checkpointing. (line 17) +* CACHE_VAL: Caching Results. (line 15) +* CANONICAL_BUILD: Canonicalizing. (line 26) +* CANONICAL_HOST: Canonicalizing. (line 34) +* CANONICAL_SYSTEM: Obsolete Macros. (line 29) +* CANONICAL_TARGET: Canonicalizing. (line 46) +* CHAR_UNSIGNED: Obsolete Macros. (line 39) +* CHECKING: Obsolete Macros. (line 89) +* CHECK_DECL: Generic Declarations. + (line 11) +* CHECK_DECLS: Generic Declarations. + (line 23) +* CHECK_FILE: Files. (line 13) +* CHECK_FILES: Files. (line 19) +* CHECK_FUNC: Generic Functions. (line 15) +* CHECK_FUNCS: Generic Functions. (line 25) +* CHECK_HEADER: Generic Headers. (line 13) +* CHECK_HEADERS: Generic Headers. (line 43) +* CHECK_LIB: Libraries. (line 11) +* CHECK_MEMBER: Generic Structures. (line 11) +* CHECK_MEMBERS: Generic Structures. (line 25) +* CHECK_PROG: Generic Programs. (line 23) +* CHECK_PROGS: Generic Programs. (line 33) +* CHECK_SIZEOF: Generic Compiler Characteristics. + (line 7) +* CHECK_TOOL: Generic Programs. (line 43) +* CHECK_TOOLS: Generic Programs. (line 54) +* CHECK_TYPE: Generic Types. (line 11) +* CHECK_TYPE <1>: Obsolete Macros. (line 42) +* CHECK_TYPES: Generic Types. (line 16) +* COMPILE_CHECK: Obsolete Macros. (line 93) +* CONFIG_AUX_DIR: Input. (line 29) +* CONFIG_COMMANDS: Configuration Commands. + (line 13) +* CONFIG_FILES: Configuration Files. (line 9) +* CONFIG_HEADERS: Configuration Headers. + (line 25) +* CONFIG_LINKS: Configuration Links. (line 12) +* CONFIG_SRCDIR: Input. (line 16) +* CONFIG_SUBDIRS: Subdirectories. (line 12) +* CONST: Obsolete Macros. (line 100) +* COPYRIGHT: Notices. (line 21) +* CROSS_CHECK: Obsolete Macros. (line 103) +* CYGWIN: Obsolete Macros. (line 107) +* C_BIGENDIAN: C Compiler. (line 68) +* C_CHAR_UNSIGNED: C Compiler. (line 120) +* C_CONST: C Compiler. (line 73) +* C_CROSS: Obsolete Macros. (line 26) +* C_INLINE: C Compiler. (line 115) +* C_LONG_DOUBLE: C Compiler. (line 124) +* C_PROTOTYPES: C Compiler. (line 137) +* C_STRINGIZE: C Compiler. (line 130) +* C_VOLATILE: C Compiler. (line 98) +* DECL_SYS_SIGLIST: Particular Declarations. + (line 9) +* DECL_YYTEXT: Obsolete Macros. (line 123) +* DEFINE: Defining Symbols. (line 29) +* DEFINE_UNQUOTED: Defining Symbols. (line 45) +* DEFUN: Macro Definitions. (line 6) +* DEFUN <1>: Obsoleting Macros. (line 18) +* DIAGNOSE: Reporting Messages. (line 11) +* DIR_HEADER: Obsolete Macros. (line 126) +* DYNIX_SEQ: Obsolete Macros. (line 137) +* EGREP_CPP: Examining Declarations. + (line 46) +* EGREP_HEADER: Examining Declarations. + (line 29) +* EMXOS2: Obsolete Macros. (line 150) +* ENABLE: Package Options. (line 57) +* ERROR: Obsolete Macros. (line 154) +* EXEEXT: Obsolete Macros. (line 145) +* F77_DUMMY_MAIN: Fortran 77 Compiler. (line 64) +* F77_FUNC: Fortran 77 Compiler. (line 169) +* F77_LIBRARY_LDFLAGS: Fortran 77 Compiler. (line 38) +* F77_MAIN: Fortran 77 Compiler. (line 101) +* F77_WRAPPERS: Fortran 77 Compiler. (line 115) +* FATAL: Reporting Messages. (line 33) +* FIND_X: Obsolete Macros. (line 157) +* FIND_XTRA: Obsolete Macros. (line 160) +* FUNC_ALLOCA: Particular Functions. + (line 10) +* FUNC_CHECK: Obsolete Macros. (line 163) +* FUNC_CHOWN: Particular Functions. + (line 54) +* FUNC_CLOSEDIR_VOID: Particular Functions. + (line 58) +* FUNC_ERROR_AT_LINE: Particular Functions. + (line 63) +* FUNC_FNMATCH: Particular Functions. + (line 67) +* FUNC_FORK: Particular Functions. + (line 71) +* FUNC_FSEEKO: Particular Functions. + (line 93) +* FUNC_GETGROUPS: Particular Functions. + (line 97) +* FUNC_GETLOADAVG: Particular Functions. + (line 103) +* FUNC_GETMNTENT: Particular Functions. + (line 131) +* FUNC_GETPGRP: Particular Functions. + (line 136) +* FUNC_LSTAT: Particular Functions. + (line 196) +* FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK: Particular Functions. + (line 143) +* FUNC_MALLOC: Particular Functions. + (line 156) +* FUNC_MEMCMP: Particular Functions. + (line 160) +* FUNC_MKTIME: Particular Functions. + (line 167) +* FUNC_MMAP: Particular Functions. + (line 171) +* FUNC_OBSTACK: Particular Functions. + (line 176) +* FUNC_SELECT_ARGTYPES: Particular Functions. + (line 180) +* FUNC_SETPGRP: Particular Functions. + (line 188) +* FUNC_SETVBUF_REVERSED: Particular Functions. + (line 205) +* FUNC_STAT: Particular Functions. + (line 196) +* FUNC_STRCOLL: Particular Functions. + (line 210) +* FUNC_STRERROR_R: Particular Functions. + (line 222) +* FUNC_STRFTIME: Particular Functions. + (line 230) +* FUNC_STRTOD: Particular Functions. + (line 216) +* FUNC_UTIME_NULL: Particular Functions. + (line 234) +* FUNC_VPRINTF: Particular Functions. + (line 238) +* FUNC_WAIT3: Obsolete Macros. (line 166) +* GCC_TRADITIONAL: Obsolete Macros. (line 175) +* GETGROUPS_T: Obsolete Macros. (line 178) +* GETLOADAVG: Obsolete Macros. (line 181) +* HAVE_FUNCS: Obsolete Macros. (line 184) +* HAVE_HEADERS: Obsolete Macros. (line 187) +* HAVE_LIBRARY: Obsolete Macros. (line 191) +* HAVE_POUNDBANG: Obsolete Macros. (line 198) +* HEADER_CHECK: Obsolete Macros. (line 201) +* HEADER_DIRENT: Particular Headers. (line 10) +* HEADER_EGREP: Obsolete Macros. (line 204) +* HEADER_MAJOR: Particular Headers. (line 46) +* HEADER_STAT: Particular Headers. (line 51) +* HEADER_STDC: Particular Headers. (line 57) +* HEADER_SYS_WAIT: Particular Headers. (line 112) +* HEADER_TIME: Particular Headers. (line 146) +* HEADER_TIOCGWINSZ: Particular Headers. (line 167) +* HELP_STRING: Pretty Help Strings. (line 14) +* INIT: Input. (line 10) +* INIT <1>: Obsolete Macros. (line 207) +* INLINE: Obsolete Macros. (line 214) +* INT_16_BITS: Obsolete Macros. (line 217) +* IRIX_SUN: Obsolete Macros. (line 221) +* ISC_POSIX: UNIX Variants. (line 18) +* LANG_C: Obsolete Macros. (line 235) +* LANG_CPLUSPLUS: Obsolete Macros. (line 238) +* LANG_FORTRAN77: Obsolete Macros. (line 241) +* LANG_POP: Language Choice. (line 37) +* LANG_PUSH: Language Choice. (line 32) +* LANG_RESTORE: Obsolete Macros. (line 244) +* LANG_SAVE: Obsolete Macros. (line 249) +* LIBOBJ: Generic Functions. (line 44) +* LIBSOURCE: Generic Functions. (line 52) +* LIBSOURCES: Generic Functions. (line 76) +* LINK_FILES: Obsolete Macros. (line 253) +* LN_S: Obsolete Macros. (line 265) +* LONG_64_BITS: Obsolete Macros. (line 268) +* LONG_DOUBLE: Obsolete Macros. (line 272) +* LONG_FILE_NAMES: Obsolete Macros. (line 275) +* MAJOR_HEADER: Obsolete Macros. (line 278) +* MEMORY_H: Obsolete Macros. (line 281) +* MINGW32: Obsolete Macros. (line 287) +* MINIX: UNIX Variants. (line 25) +* MINUS_C_MINUS_O: Obsolete Macros. (line 291) +* MMAP: Obsolete Macros. (line 294) +* MODE_T: Obsolete Macros. (line 297) +* MSG_CHECKING: Printing Messages. (line 23) +* MSG_ERROR: Printing Messages. (line 54) +* MSG_NOTICE: Printing Messages. (line 44) +* MSG_RESULT: Printing Messages. (line 34) +* MSG_WARN: Printing Messages. (line 64) +* OBJEXT: Obsolete Macros. (line 300) +* OBSOLETE: Obsolete Macros. (line 306) +* OFF_T: Obsolete Macros. (line 321) +* OUTPUT: Output. (line 12) +* OUTPUT <1>: Obsolete Macros. (line 324) +* OUTPUT_COMMANDS: Obsolete Macros. (line 346) +* OUTPUT_COMMANDS_POST: Configuration Commands. + (line 39) +* OUTPUT_COMMANDS_PRE: Configuration Commands. + (line 30) +* PATH_PROG: Generic Programs. (line 66) +* PATH_PROGS: Generic Programs. (line 71) +* PATH_TOOL: Generic Programs. (line 76) +* PATH_X: System Services. (line 10) +* PATH_XTRA: System Services. (line 26) +* PID_T: Obsolete Macros. (line 375) +* PREFIX: Obsolete Macros. (line 378) +* PREFIX_DEFAULT: Default Prefix. (line 16) +* PREFIX_PROGRAM: Default Prefix. (line 25) +* PREREQ: Notices. (line 10) +* PROGRAMS_CHECK: Obsolete Macros. (line 381) +* PROGRAMS_PATH: Obsolete Macros. (line 384) +* PROGRAM_CHECK: Obsolete Macros. (line 387) +* PROGRAM_EGREP: Obsolete Macros. (line 390) +* PROGRAM_PATH: Obsolete Macros. (line 393) +* PROG_AWK: Particular Programs. (line 10) +* PROG_CC: C Compiler. (line 7) +* PROG_CC_C_O: C Compiler. (line 26) +* PROG_CC_STDC: C Compiler. (line 34) +* PROG_CPP: C Compiler. (line 47) +* PROG_CXX: C++ Compiler. (line 7) +* PROG_CXXCPP: C++ Compiler. (line 31) +* PROG_F77_C_O: Fortran 77 Compiler. (line 28) +* PROG_FORTRAN: Fortran 77 Compiler. (line 7) +* PROG_GCC_TRADITIONAL: C Compiler. (line 156) +* PROG_INSTALL: Particular Programs. (line 28) +* PROG_LEX: Particular Programs. (line 57) +* PROG_LN_S: Particular Programs. (line 95) +* PROG_MAKE_SET: Output. (line 37) +* PROG_RANLIB: Particular Programs. (line 114) +* PROG_YACC: Particular Programs. (line 118) +* REMOTE_TAPE: Obsolete Macros. (line 396) +* REPLACE_FUNCS: Generic Functions. (line 84) +* REQUIRE: Prerequisite Macros. (line 17) +* REQUIRE_CPP: Language Choice. (line 50) +* RESTARTABLE_SYSCALLS: Obsolete Macros. (line 399) +* RETSIGTYPE: Obsolete Macros. (line 402) +* REVISION: Notices. (line 29) +* RSH: Obsolete Macros. (line 405) +* SCO_INTL: Obsolete Macros. (line 408) +* SEARCH_LIBS: Libraries. (line 41) +* SETVBUF_REVERSED: Obsolete Macros. (line 416) +* SET_MAKE: Obsolete Macros. (line 419) +* SIZEOF_TYPE: Obsolete Macros. (line 422) +* SIZE_T: Obsolete Macros. (line 425) +* STAT_MACROS_BROKEN: Particular Headers. (line 51) +* STAT_MACROS_BROKEN <1>: Obsolete Macros. (line 428) +* STDC_HEADERS: Obsolete Macros. (line 431) +* STRCOLL: Obsolete Macros. (line 434) +* STRUCT_ST_BLKSIZE: Particular Structures. + (line 9) +* STRUCT_ST_BLOCKS: Particular Structures. + (line 17) +* STRUCT_ST_RDEV: Particular Structures. + (line 23) +* STRUCT_TIMEZONE: Particular Structures. + (line 36) +* STRUCT_TM: Particular Structures. + (line 31) +* ST_BLKSIZE: Obsolete Macros. (line 437) +* ST_BLOCKS: Obsolete Macros. (line 440) +* ST_RDEV: Obsolete Macros. (line 443) +* SUBST: Setting Output Variables. + (line 13) +* SUBST_FILE: Setting Output Variables. + (line 23) +* SYS_INTERPRETER: System Services. (line 37) +* SYS_LARGEFILE: System Services. (line 44) +* SYS_LONG_FILE_NAMES: System Services. (line 58) +* SYS_POSIX_TERMIOS: System Services. (line 62) +* SYS_RESTARTABLE_SYSCALLS: Obsolete Macros. (line 446) +* SYS_SIGLIST_DECLARED: Obsolete Macros. (line 461) +* TEMPLATE: Autoheader Macros. (line 32) +* TEST_CPP: Obsolete Macros. (line 464) +* TEST_PROGRAM: Obsolete Macros. (line 467) +* TIMEZONE: Obsolete Macros. (line 470) +* TIME_WITH_SYS_TIME: Obsolete Macros. (line 473) +* TOP: Autoheader Macros. (line 53) +* TRY_COMPILE: Examining Syntax. (line 14) +* TRY_CPP: Examining Declarations. + (line 11) +* TRY_LINK: Examining Libraries. (line 33) +* TRY_LINK_FUNC: Examining Libraries. (line 51) +* TRY_RUN: Test Programs. (line 11) +* TYPE_GETGROUPS: Particular Types. (line 10) +* TYPE_MODE_T: Particular Types. (line 14) +* TYPE_OFF_T: Particular Types. (line 17) +* TYPE_PID_T: Particular Types. (line 20) +* TYPE_SIGNAL: Particular Types. (line 23) +* TYPE_SIZE_T: Particular Types. (line 36) +* TYPE_UID_T: Particular Types. (line 39) +* UID_T: Obsolete Macros. (line 476) +* UNISTD_H: Obsolete Macros. (line 479) +* USG: Obsolete Macros. (line 482) +* UTIME_NULL: Obsolete Macros. (line 487) +* VALIDATE_CACHED_SYSTEM_TUPLE: Obsolete Macros. (line 490) +* VERBATIM: Autoheader Macros. (line 18) +* VERBOSE: Obsolete Macros. (line 497) +* VFORK: Obsolete Macros. (line 500) +* VPRINTF: Obsolete Macros. (line 503) +* WAIT3: Obsolete Macros. (line 506) +* WARN: Obsolete Macros. (line 509) +* WARNING: Reporting Messages. (line 29) +* WITH: External Software. (line 67) +* WORDS_BIGENDIAN: Obsolete Macros. (line 512) +* XENIX_DIR: Obsolete Macros. (line 515) +* YYTEXT_POINTER: Obsolete Macros. (line 530) + + +File: autoconf.info, Node: M4 Macro Index, Next: Concept Index, Prev: Autoconf Macro Index, Up: Top + +M4 Macro Index +************** + +This is an alphabetical list of the M4, M4sugar, and M4sh macros. To +make the list easier to use, the macros are listed without their +preceding 'm4_' or 'AS_'. + + +* Menu: + +* defn: Redefined M4 Macros. (line 14) +* defn <1>: Redefined M4 Macros. (line 26) +* pattern_allow: Forbidden Patterns. (line 28) +* pattern_forbid: Forbidden Patterns. (line 15) +* undefine: Redefined M4 Macros. (line 18) + + +File: autoconf.info, Node: Concept Index, Prev: M4 Macro Index, Up: Top + +Concept Index +************* + +This is an alphabetical list of the files, tools, and concepts +introduced in this document. + + +* Menu: + +* !: Limitations of Builtins. + (line 16) +* "$@": Shell Substitutions. (line 31) +* $(COMMANDS): Shell Substitutions. (line 132) +* ${VAR:-VALUE}: Shell Substitutions. (line 38) +* ${VAR=EXPANDED-VALUE}: Shell Substitutions. (line 71) +* ${VAR=LITERAL}: Shell Substitutions. (line 42) +* /usr/xpg4/bin/sh on Solaris: Shellology. (line 43) +* :: Limitations of Builtins. + (line 312) +* @%:@: Quadrigraphs. (line 6) +* @:>@: Quadrigraphs. (line 6) +* @<:@: Quadrigraphs. (line 6) +* @S|@: Quadrigraphs. (line 6) +* 'COMMANDS': Shell Substitutions. (line 117) +* acconfig.h: acconfig.h. (line 6) +* aclocal.m4: Making configure Scripts. + (line 6) +* Ash: Shellology. (line 13) +* autoconf: autoconf Invocation. (line 6) +* autoheader: autoheader Invocation. + (line 6) +* Automake: Automake. (line 19) +* autoreconf: autoreconf Invocation. + (line 6) +* autoscan: autoscan Invocation. (line 6) +* autoupdate: autoupdate Invocation. + (line 6) +* awk: Limitations of Usual Tools. + (line 10) +* Back trace: autoconf Invocation. (line 93) +* Bash: Shellology. (line 37) +* break: Limitations of Builtins. + (line 19) +* Cache: Caching Results. (line 6) +* Cache variable: Cache Variable Names. + (line 6) +* Cache, enabling: configure Invocation. + (line 18) +* case: Limitations of Builtins. + (line 22) +* cat: Limitations of Usual Tools. + (line 53) +* cmp: Limitations of Usual Tools. + (line 61) +* Command Substitution: Shell Substitutions. (line 117) +* config.h: Configuration Headers. + (line 6) +* config.h.bot: acconfig.h. (line 6) +* config.h.in: Header Templates. (line 6) +* config.h.top: acconfig.h. (line 6) +* config.status: config.status Invocation. + (line 6) +* Configuration Header: Configuration Headers. + (line 6) +* Configuration Header Template: Header Templates. (line 6) +* configure: Making configure Scripts. + (line 6) +* configure <1>: Running configure scripts. + (line 6) +* configure.ac: Making configure Scripts. + (line 27) +* configure.in: Making configure Scripts. + (line 27) +* Copyright Notice: Notices. (line 21) +* cp: Limitations of Usual Tools. + (line 68) +* Declaration, checking: Declarations. (line 6) +* diff: Limitations of Usual Tools. + (line 79) +* dirname: Limitations of Usual Tools. + (line 85) +* dnl: Macro Definitions. (line 35) +* dnl <1>: Coding Style. (line 40) +* echo: Limitations of Builtins. + (line 42) +* egrep: Limitations of Usual Tools. + (line 112) +* Endianness: C Compiler. (line 68) +* exit: Limitations of Builtins. + (line 69) +* export: Limitations of Builtins. + (line 94) +* expr: Limitations of Usual Tools. + (line 126) +* expr <1>: Limitations of Usual Tools. + (line 151) +* expr (|): Limitations of Usual Tools. + (line 132) +* false: Limitations of Builtins. + (line 120) +* File, checking: Files. (line 6) +* for: Limitations of Builtins. + (line 124) +* Function, checking: Particular Functions. + (line 6) +* grep: Limitations of Usual Tools. + (line 204) +* Header, checking: Header Files. (line 6) +* if: Limitations of Builtins. + (line 146) +* ifnames: ifnames Invocation. (line 6) +* Includes, default: Default Includes. (line 6) +* Instantiation: Output. (line 12) +* Language: Language Choice. (line 6) +* Library, checking: Libraries. (line 6) +* Libtool: Libtool. (line 13) +* Links: Configuration Links. (line 12) +* ln: Limitations of Usual Tools. + (line 216) +* M4sugar: Programming in M4sugar. + (line 6) +* Macro invocation stack: autoconf Invocation. (line 93) +* Messages, from autoconf: Reporting Messages. (line 6) +* Messages, from configure: Printing Messages. (line 6) +* mv: Limitations of Usual Tools. + (line 228) +* obstack: Particular Functions. + (line 176) +* POSIX termios headers: System Services. (line 62) +* Previous Variable: Setting Output Variables. + (line 44) +* Programs, checking: Alternative Programs. + (line 6) +* QNX 4.25: Systemology. (line 11) +* quadrigraphs: Quadrigraphs. (line 6) +* quotation: Autoconf Language. (line 6) +* quotation <1>: M4 Quotation. (line 6) +* Revision: Notices. (line 29) +* sed: Limitations of Usual Tools. + (line 239) +* sed (t): Limitations of Usual Tools. + (line 278) +* set: Limitations of Builtins. + (line 175) +* shift: Limitations of Builtins. + (line 186) +* Structure, checking: Structures. (line 6) +* Symbolic links: Limitations of Usual Tools. + (line 216) +* termios POSIX headers: System Services. (line 62) +* test: Limitations of Builtins. + (line 191) +* touch: Limitations of Usual Tools. + (line 338) +* trap: Limitations of Builtins. + (line 272) +* true: Limitations of Builtins. + (line 312) +* undefined macro: _m4_divert_diversion: New Macros. (line 6) +* unset: Limitations of Builtins. + (line 323) +* Variable, Precious: Setting Output Variables. + (line 44) +* Version: Notices. (line 10) +* VPATH: Limitations of Make. (line 31) +* Zsh: Shellology. (line 49) + + + +Tag Table: +Node: Top1982 +Node: Introduction14243 +Ref: Introduction-Footnote-119088 +Ref: Introduction-Footnote-219169 +Ref: Introduction-Footnote-319269 +Ref: Introduction-Footnote-419383 +Node: The GNU build system19458 +Node: Automake20377 +Node: Libtool22803 +Node: Pointers24229 +Ref: Pointers-Footnote-125435 +Ref: Pointers-Footnote-225494 +Ref: Pointers-Footnote-325551 +Ref: Pointers-Footnote-425693 +Ref: Pointers-Footnote-525767 +Ref: Pointers-Footnote-625839 +Node: Making configure Scripts25914 +Node: Writing configure.ac28948 +Node: Shell Script Compiler30414 +Node: Autoconf Language32715 +Node: configure.ac Layout37347 +Node: autoscan Invocation38751 +Node: ifnames Invocation41504 +Node: autoconf Invocation42704 +Node: autoreconf Invocation49781 +Node: Setup53123 +Node: Notices54328 +Node: Input55964 +Node: Output58012 +Node: Configuration Actions59994 +Node: Configuration Files62899 +Node: Makefile Substitutions64365 +Node: Preset Output Variables66048 +Node: Installation Directory Variables70619 +Node: Build Directories74971 +Node: Automatic Remaking76624 +Node: Configuration Headers78779 +Node: Header Templates81482 +Node: autoheader Invocation82760 +Node: Autoheader Macros86228 +Node: Configuration Commands88431 +Node: Configuration Links90117 +Node: Subdirectories91489 +Node: Default Prefix93644 +Node: Existing Tests95041 +Node: Common Behavior96759 +Node: Standard Symbols97421 +Node: Default Includes98022 +Node: Alternative Programs99954 +Node: Particular Programs100640 +Node: Generic Programs106101 +Node: Files110010 +Node: Libraries110905 +Node: Library Functions113770 +Node: Function Portability114393 +Node: Particular Functions115398 +Node: Generic Functions125990 +Node: Header Files130235 +Node: Particular Headers130798 +Node: Generic Headers137767 +Node: Declarations139839 +Node: Particular Declarations140428 +Node: Generic Declarations140851 +Node: Structures143224 +Node: Particular Structures143831 +Node: Generic Structures145553 +Node: Types146797 +Node: Particular Types147317 +Node: Generic Types148487 +Node: Compilers and Preprocessors149859 +Node: Generic Compiler Characteristics150870 +Node: C Compiler151733 +Node: C++ Compiler159074 +Node: Fortran 77 Compiler161317 +Node: System Services169814 +Ref: System Services-Footnote-1172930 +Node: UNIX Variants173021 +Node: Writing Tests174203 +Node: Examining Declarations176135 +Node: Examining Syntax178635 +Node: Examining Libraries180083 +Node: Run Time183095 +Node: Test Programs184076 +Node: Guidelines186343 +Node: Test Functions187542 +Node: Systemology189098 +Ref: Systemology-Footnote-1189726 +Ref: Systemology-Footnote-2189764 +Node: Multiple Cases189832 +Node: Language Choice191089 +Node: Results193124 +Node: Defining Symbols193874 +Node: Setting Output Variables197130 +Node: Caching Results201321 +Node: Cache Variable Names205004 +Node: Cache Files206593 +Node: Cache Checkpointing208623 +Node: Printing Messages209954 +Node: Programming in M4213139 +Node: M4 Quotation213812 +Node: Active Characters214622 +Ref: Active Characters-Footnote-1216000 +Node: One Macro Call216022 +Node: Quotation and Nested Macros217584 +Node: Quadrigraphs220550 +Node: Quotation Rule Of Thumb221475 +Node: Programming in M4sugar224118 +Node: Redefined M4 Macros224626 +Node: Forbidden Patterns225596 +Node: Writing Autoconf Macros226961 +Node: Macro Definitions227762 +Node: Macro Names229570 +Node: Reporting Messages232171 +Node: Dependencies Between Macros233517 +Node: Prerequisite Macros234141 +Node: Suggested Ordering236922 +Node: Obsoleting Macros238441 +Node: Coding Style239564 +Node: Portable Shell246570 +Node: Shellology248656 +Node: Here-Documents251635 +Node: File Descriptors253597 +Node: File System Conventions255605 +Ref: File System Conventions-Footnote-1259725 +Node: Shell Substitutions259799 +Node: Assignments264708 +Node: Special Shell Variables266345 +Node: Limitations of Builtins270391 +Node: Limitations of Usual Tools282719 +Node: Limitations of Make295462 +Node: Manual Configuration296443 +Node: Specifying Names297272 +Ref: Specifying Names-Footnote-1300083 +Node: Canonicalizing300483 +Node: Using System Type302887 +Node: Site Configuration303936 +Node: External Software304769 +Node: Package Options308085 +Node: Pretty Help Strings310953 +Node: Site Details312932 +Node: Transforming Names314167 +Node: Transformation Options315315 +Node: Transformation Examples315819 +Node: Transformation Rules317541 +Node: Site Defaults319377 +Node: Running configure scripts323296 +Node: Basic Installation324313 +Node: Compilers and Options327161 +Node: Multiple Architectures327803 +Node: Installation Names328802 +Node: Optional Features330001 +Node: System Type330785 +Node: Sharing Defaults332311 +Node: Environment Variables332953 +Node: configure Invocation333639 +Node: config.status Invocation334771 +Node: Obsolete Constructs338596 +Node: Obsolete config.status Use339522 +Node: acconfig.h341321 +Node: autoupdate Invocation343337 +Node: Obsolete Macros345299 +Node: Autoconf 1362452 +Node: Changed File Names363518 +Node: Changed Makefiles364293 +Node: Changed Macros365386 +Node: Changed Results366642 +Node: Changed Macro Writing368753 +Node: Autoconf 2.13370028 +Node: Changed Quotation371037 +Node: New Macros372944 +Node: Questions374578 +Node: Distributing375102 +Node: Why GNU m4376173 +Node: Bootstrapping377071 +Node: Why Not Imake377687 +Node: History382392 +Node: Genesis383191 +Node: Exodus384387 +Node: Leviticus387438 +Node: Numbers388972 +Node: Deuteronomy390893 +Node: Environment Variable Index393565 +Node: Output Variable Index397608 +Node: Preprocessor Symbol Index407637 +Node: Autoconf Macro Index418644 +Node: M4 Macro Index441976 +Node: Concept Index442663 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: diff --git a/doc/autoconf.texi b/doc/autoconf.texi new file mode 100644 index 0000000..2728b2f --- /dev/null +++ b/doc/autoconf.texi @@ -0,0 +1,11346 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename autoconf.info +@settitle Autoconf + +@finalout +@setchapternewpage odd +@setcontentsaftertitlepage + +@include version.texi + +@c A simple macro for optional variables. +@macro ovar{varname} +@r{[}@var{\varname\}@r{]} +@end macro + +@c I don't like the way URL are displayed in TeX with @uref. +@ifhtml +@macro href{url, title} +@uref{\url\, \title\} +@end macro +@end ifhtml +@ifnothtml +@macro href{url, title} +\title\@footnote{\title\, @url{\url\}.} +@end macro +@end ifnothtml + + +@dircategory GNU admin +@direntry +* Autoconf: (autoconf). Create source code configuration scripts +@end direntry + +@dircategory Individual utilities +@direntry +* autoscan: (autoconf)autoscan Invocation. + Semi-automatic @file{configure.ac} writing +* ifnames: (autoconf)ifnames Invocation. + Listing the conditionals in source code +* autoconf: (autoconf)autoconf Invocation. + How to create configuration scripts +* autoreconf: (autoconf)autoreconf Invocation. + Remaking multiple @code{configure} scripts +* configure: (autoconf)configure Invocation. + Configuring a package +* config.status: (autoconf)config.status Invocation. + Recreating a configuration +@end direntry + +@ifinfo +Autoconf: Creating Automatic Configuration Scripts, by David MacKenzie. + +This file documents the GNU Autoconf package for creating scripts to +configure source code packages using templates and an @code{m4} macro +package. + +Copyright 2003-2022,2023 Thomas E. Dickey@* +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free +Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries copying permission notice +identical to this one except for the removal of this paragraph (this +paragraph not being relevant to the printed manual). + +@end ignore +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation +approved by the Foundation. +@end ifinfo + +@titlepage +@title Autoconf +@subtitle Creating Automatic Configuration Scripts +@subtitle Edition @value{EDITION}, for Autoconf version @value{VERSION} +@subtitle @value{UPDATED} +@author David MacKenzie and Ben Elliston +@c I think I've rewritten all of Noah and Roland's contributions by now. + +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, +2001 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation +approved by the Foundation. +@end titlepage + +@c Define an environment variable index. +@defcodeindex ev +@c Define an output variable index. +@defcodeindex ov +@c Define a CPP variable index. +@defcodeindex cv +@c Define an Autoconf macro index that @defmac doesn't write to. +@defcodeindex ma +@c Define an M4sugar macro index that @defmac doesn't write to. +@defcodeindex ms + +@node Top, Introduction, (dir), (dir) +@comment node-name, next, previous, up + +@ifinfo +This file documents the GNU Autoconf package for creating scripts to +configure source code packages using templates and the GNU M4 macro +package. This is edition @value{EDITION}, for Autoconf version +@value{VERSION}. + +@end ifinfo + +@c The master menu, created with texinfo-master-menu, goes here. + +@menu +* Introduction:: Autoconf's purpose, strengths, and weaknesses +* The GNU build system:: A set of tools for portable software packages +* Making configure Scripts:: How to organize and produce Autoconf scripts +* Setup:: Initialization and output +* Existing Tests:: Macros that check for particular features +* Writing Tests:: How to write new feature checks +* Results:: What to do with results from feature checks +* Programming in M4:: Layers on top of which Autoconf is written +* Writing Autoconf Macros:: Adding new macros to Autoconf +* Portable Shell:: Shell script portability pitfalls +* Manual Configuration:: Selecting features that can't be guessed +* Site Configuration:: Local defaults for @code{configure} +* Running configure scripts:: How to use the Autoconf output +* config.status Invocation:: Recreating a configuration +* Obsolete Constructs:: Kept for backward compatibility +* Questions:: Questions about Autoconf, with answers +* History:: History of Autoconf +* Environment Variable Index:: Index of environment variables used +* Output Variable Index:: Index of variables set in output files +* Preprocessor Symbol Index:: Index of C preprocessor symbols defined +* Autoconf Macro Index:: Index of Autoconf macros +* M4 Macro Index:: Index of M4, M4sugar, and M4sh macros +* Concept Index:: General index + +@detailmenu --- The Detailed Node Listing --- + +The GNU build system + +* Automake:: Escaping Makefile hell +* Libtool:: Building libraries portably +* Pointers:: More info on the GNU build system + +Making @code{configure} Scripts + +* Writing configure.ac:: What to put in an Autoconf input file +* autoscan Invocation:: Semi-automatic @file{configure.ac} writing +* ifnames Invocation:: Listing the conditionals in source code +* autoconf Invocation:: How to create configuration scripts +* autoreconf Invocation:: Remaking multiple @code{configure} scripts + +Writing @file{configure.ac} + +* Shell Script Compiler:: Autoconf as solution of a problem +* Autoconf Language:: Programming in Autoconf +* configure.ac Layout:: Standard organization of configure.ac + +Initialization and Output Files + +* Notices:: Copyright, version numbers in @code{configure} +* Input:: Where Autoconf should find files +* Output:: Outputting results from the configuration +* Configuration Actions:: Preparing the output based on results +* Configuration Files:: Creating output files +* Makefile Substitutions:: Using output variables in @file{Makefile}s +* Configuration Headers:: Creating a configuration header file +* Configuration Commands:: Running arbitrary instantiation commands +* Configuration Links:: Links depending from the configuration +* Subdirectories:: Configuring independent packages together +* Default Prefix:: Changing the default installation prefix + +Substitutions in Makefiles + +* Preset Output Variables:: Output variables that are always set +* Installation Directory Variables:: Other preset output variables +* Build Directories:: Supporting multiple concurrent compiles +* Automatic Remaking:: Makefile rules for configuring + +Configuration Header Files + +* Header Templates:: Input for the configuration headers +* autoheader Invocation:: How to create configuration templates +* Autoheader Macros:: How to specify CPP templates + +Existing Tests + +* Common Behavior:: Macros' standard schemes +* Alternative Programs:: Selecting between alternative programs +* Files:: Checking for the existence of files +* Libraries:: Library archives that might be missing +* Library Functions:: C library functions that might be missing +* Header Files:: Header files that might be missing +* Declarations:: Declarations that may be missing +* Structures:: Structures or members that might be missing +* Types:: Types that might be missing +* Compilers and Preprocessors:: Checking for compiling programs +* System Services:: Operating system services +* UNIX Variants:: Special kludges for specific UNIX variants + +Common Behavior + +* Standard Symbols:: Symbols defined by the macros +* Default Includes:: Includes used by the generic macros + +Alternative Programs + +* Particular Programs:: Special handling to find certain programs +* Generic Programs:: How to find other programs + +Library Functions + +* Function Portability:: Pitfalls with usual functions +* Particular Functions:: Special handling to find certain functions +* Generic Functions:: How to find other functions + +Header Files + +* Particular Headers:: Special handling to find certain headers +* Generic Headers:: How to find other headers + +Declarations + +* Particular Declarations:: Macros to check for certain declarations +* Generic Declarations:: How to find other declarations + +Structures + +* Particular Structures:: Macros to check for certain structure members +* Generic Structures:: How to find other structure members + +Types + +* Particular Types:: Special handling to find certain types +* Generic Types:: How to find other types + +Compilers and Preprocessors + +* Generic Compiler Characteristics:: Language independent tests +* C Compiler:: Checking its characteristics +* C++ Compiler:: Likewise +* Fortran 77 Compiler:: Likewise + +Writing Tests + +* Examining Declarations:: Detecting header files and declarations +* Examining Syntax:: Detecting language syntax features +* Examining Libraries:: Detecting functions and global variables +* Run Time:: Testing for run-time features +* Systemology:: A zoology of operating systems +* Multiple Cases:: Tests for several possible values +* Language Choice:: Selecting which language to use for testing + +Checking Run Time Behavior + +* Test Programs:: Running test programs +* Guidelines:: General rules for writing test programs +* Test Functions:: Avoiding pitfalls in test programs + +Results of Tests + +* Defining Symbols:: Defining C preprocessor symbols +* Setting Output Variables:: Replacing variables in output files +* Caching Results:: Speeding up subsequent @code{configure} runs +* Printing Messages:: Notifying @code{configure} users + +Caching Results + +* Cache Variable Names:: Shell variables used in caches +* Cache Files:: Files @code{configure} uses for caching +* Cache Checkpointing:: Loading and saving the cache file + +Programming in M4 + +* M4 Quotation:: Protecting macros from unwanted expansion +* Programming in M4sugar:: Convenient pure M4 macros + +M4 Quotation + +* Active Characters:: Characters that change the behavior of m4 +* One Macro Call:: Quotation and one macro call +* Quotation and Nested Macros:: Macros calling macros +* Quadrigraphs:: Another way to escape special characters +* Quotation Rule Of Thumb:: One parenthesis, one quote + +Programming in M4sugar + +* Redefined M4 Macros:: M4 builtins changed in M4sugar +* Forbidden Patterns:: Catching unexpanded macros + +Writing Autoconf Macros + +* Macro Definitions:: Basic format of an Autoconf macro +* Macro Names:: What to call your new macros +* Reporting Messages:: Notifying @code{autoconf} users +* Dependencies Between Macros:: What to do when macros depend on other macros +* Obsoleting Macros:: Warning about old ways of doing things +* Coding Style:: Writing Autoconf macros @`a la Autoconf + +Dependencies Between Macros + +* Prerequisite Macros:: Ensuring required information +* Suggested Ordering:: Warning about possible ordering problems + +Portable Shell Programming + +* Shellology:: A zoology of shells +* Here-Documents:: Quirks and tricks +* File Descriptors:: FDs and redirections +* File System Conventions:: File- and pathnames +* Shell Substitutions:: Variable and command expansions +* Assignments:: Varying side effects of assignments +* Special Shell Variables:: Variables you should not change +* Limitations of Builtins:: Portable use of not so portable /bin/sh +* Limitations of Usual Tools:: Portable use of portable tools +* Limitations of Make:: Portable Makefiles + +Manual Configuration + +* Specifying Names:: Specifying the system type +* Canonicalizing:: Getting the canonical system type +* Using System Type:: What to do with the system type + +Site Configuration + +* External Software:: Working with other optional software +* Package Options:: Selecting optional features +* Pretty Help Strings:: Formatting help string +* Site Details:: Configuring site details +* Transforming Names:: Changing program names when installing +* Site Defaults:: Giving @code{configure} local defaults + +Transforming Program Names When Installing + +* Transformation Options:: @code{configure} options to transform names +* Transformation Examples:: Sample uses of transforming names +* Transformation Rules:: @file{Makefile} uses of transforming names + +Running @code{configure} Scripts + +* Basic Installation:: Instructions for typical cases +* Compilers and Options:: Selecting compilers and optimization +* Multiple Architectures:: Compiling for multiple architectures at once +* Installation Names:: Installing in different directories +* Optional Features:: Selecting optional features +* System Type:: Specifying the system type +* Sharing Defaults:: Setting site-wide defaults for @code{configure} +* Environment Variables:: Defining environment variables. +* configure Invocation:: Changing how @code{configure} runs + +Obsolete Constructs + +* Obsolete config.status Use:: Different calling convention +* acconfig.h:: Additional entries in @file{config.h.in} +* autoupdate Invocation:: Automatic update of @file{configure.ac} +* Obsolete Macros:: Backward compatibility macros +* Autoconf 1:: Tips for upgrading your files +* Autoconf 2.13:: Some fresher tips + +Upgrading From Version 1 + +* Changed File Names:: Files you might rename +* Changed Makefiles:: New things to put in @file{Makefile.in} +* Changed Macros:: Macro calls you might replace +* Changed Results:: Changes in how to check test results +* Changed Macro Writing:: Better ways to write your own macros + +Upgrading From Version 2.13 + +* Changed Quotation:: Broken code which used to work +* New Macros:: Interaction with foreign macros + +Questions About Autoconf + +* Distributing:: Distributing @code{configure} scripts +* Why GNU m4:: Why not use the standard M4? +* Bootstrapping:: Autoconf and GNU M4 require each other? +* Why Not Imake:: Why GNU uses @code{configure} instead of Imake + +History of Autoconf + +* Genesis:: Prehistory and naming of @code{configure} +* Exodus:: The plagues of M4 and Perl +* Leviticus:: The priestly code of portability arrives +* Numbers:: Growth and contributors +* Deuteronomy:: Approaching the promises of easy configuration + +@end detailmenu +@end menu + +@c ============================================================= Introduction. + +@node Introduction, The GNU build system, Top, Top +@chapter Introduction + +@flushright +A physicist, an engineer, and a computer scientist were discussing the +nature of God. ``Surely a Physicist,'' said the physicist, ``because +early in the Creation, God made Light; and you know, Maxwell's +equations, the dual nature of electromagnetic waves, the relativistic +consequences@dots{}'' ``An Engineer!,'' said the engineer, ``because +before making Light, God split the Chaos into Land and Water; it takes a +hell of an engineer to handle that big amount of mud, and orderly +separation of solids from liquids@dots{}'' The computer scientist +shouted: ``And the Chaos, where do you think it was coming from, hmm?'' + +---Anonymous +@end flushright +@c (via Franc,ois Pinard) + +Autoconf is a tool for producing shell scripts that automatically +configure software source code packages to adapt to many kinds of +@sc{unix}-like systems. The configuration scripts produced by Autoconf +are independent of Autoconf when they are run, so their users do not +need to have Autoconf. + +The configuration scripts produced by Autoconf require no manual user +intervention when run; they do not normally even need an argument +specifying the system type. Instead, they individually test for the +presence of each feature that the software package they are for might need. +(Before each check, they print a one-line message stating what they are +checking for, so the user doesn't get too bored while waiting for the +script to finish.) As a result, they deal well with systems that are +hybrids or customized from the more common @sc{unix} variants. There is +no need to maintain files that list the features supported by each +release of each variant of @sc{unix}. + +For each software package that Autoconf is used with, it creates a +configuration script from a template file that lists the system features +that the package needs or can use. After the shell code to recognize +and respond to a system feature has been written, Autoconf allows it to +be shared by many software packages that can use (or need) that feature. +If it later turns out that the shell code needs adjustment for some +reason, it needs to be changed in only one place; all of the +configuration scripts can be regenerated automatically to take advantage +of the updated code. + +The Metaconfig package is similar in purpose to Autoconf, but the +scripts it produces require manual user intervention, which is quite +inconvenient when configuring large source trees. Unlike Metaconfig +scripts, Autoconf scripts can support cross-compiling, if some care is +taken in writing them. + +Autoconf does not solve all problems related to making portable software +packages---for a more complete solution, it should be used in concert +with other GNU build tools like Automake and Libtool. These other tools +take on jobs like the creation of a portable, recursive @file{Makefile} +with all of the standard targets, linking of shared libraries, and so +on. @xref{The GNU build system}, for more information. + +Autoconf imposes some restrictions on the names of macros used with +@code{#if} in C programs (@pxref{Preprocessor Symbol Index}). + +Autoconf requires @sc{gnu} M4 in order to generate the scripts. It uses +features that some @sc{unix} versions of M4, including @sc{gnu} M4 1.3, +do not have. You must use version 1.4 or later of @sc{gnu} M4. + +@xref{Autoconf 1}, for information about upgrading from version 1. +@xref{History}, for the story of Autoconf's development. +@xref{Questions}, for answers to some common questions about Autoconf. + + +See the @href{http://www.gnu.org/software/autoconf/autoconf.html, +Autoconf web page} for up-to-date information, details on the mailing +lists, pointers to a list of known bugs, etc. + +Mail suggestions to @email{autoconf@@gnu.org, the Autoconf mailing +list}. + +Bug reports should be preferably submitted to the +@href{http://sources.redhat.com/cgi-bin/gnatsweb.pl?database=autoconf, +Autoconf Gnats database}, or sent to @email{bug-autoconf@@gnu.org, the +Autoconf Bugs mailing list}. If possible, first check that your bug is +not already solved in current development versions, and that it has not +been reported yet. Be sure to include all the needed information and a +short @file{configure.ac} that demonstrates the problem. + +Autoconf's development tree is accessible via @sc{cvs}; see the Autoconf +web page for details. There is also a +@href{http://subversions.gnu.org/cgi-bin/cvsweb/autoconf/, @sc{cvs}web +interface to the Autoconf development tree}. Patches relative to the +current @sc{cvs} version can be sent for review to the +@email{autoconf-patches@@gnu.org, Autoconf Patches mailing list}. + +Because of its mission, Autoconf includes only a set of often-used +macros that have already demonstrated their usefulness. Nevertheless, +if you wish to share your macros, or find existing ones, see the +@href{http://www.gnu.org/software/ac-archive/, Autoconf Macro +Archive}, which is kindly run by @email{simons@@computer.org, +Peter Simons}. + + +@c ================================================= The GNU build system + +@node The GNU build system, Making configure Scripts, Introduction, Top +@chapter The GNU build system + +Autoconf solves an important problem---reliable discovery of +system-specific build and runtime information---but this is only one +piece of the puzzle for the development of portable software. To this +end, the GNU project has developed a suite of integrated utilities to +finish the job Autoconf started: the GNU build system, whose most +important components are Autoconf, Automake, and Libtool. In this +chapter, we introduce you to those tools, point you to sources of more +information, and try to convince you to use the entire GNU build system +for your software. + +@menu +* Automake:: Escaping Makefile hell +* Libtool:: Building libraries portably +* Pointers:: More info on the GNU build system +@end menu + +@node Automake, Libtool, The GNU build system, The GNU build system +@section Automake + +The ubiquity of @code{make} means that a @code{Makefile} is almost the +only viable way to distribute automatic build rules for software, but +one quickly runs into @code{make}'s numerous limitations. Its lack of +support for automatic dependency tracking, recursive builds in +subdirectories, reliable timestamps (e.g. for network filesystems), and +so on, mean that developers must painfully (and often incorrectly) +reinvent the wheel for each project. Portability is non-trivial, thanks +to the quirks of @code{make} on many systems. On top of all this is the +manual labor required to implement the many standard targets that users +have come to expect (@code{make install}, @code{make distclean}, +@code{make uninstall}, etc.). Since you are, of course, using Autoconf, +you also have to insert repetitive code in your @code{Makefile.in} to +recognize @code{@@CC@@}, @code{@@CFLAGS@@}, and other substitutions +provided by @code{configure}. Into this mess steps @dfn{Automake}. +@cindex Automake + +Automake allows you to specify your build needs in a @code{Makefile.am} +file with a vastly simpler and more powerful syntax than that of a plain +@code{Makefile}, and then generates a portable @code{Makefile.in} for +use with Autoconf. For example, the @code{Makefile.am} to build and +install a simple ``Hello world'' program might look like: + +@example +bin_PROGRAMS = hello +hello_SOURCES = hello.c +@end example + +@noindent +The resulting @code{Makefile.in} (~400 lines) automatically supports all +the standard targets, the substitutions provided by Autoconf, automatic +dependency tracking, @code{VPATH} building, and so on. @code{make} will +build the @code{hello} program, and @code{make install} will install it +in @file{/usr/local/bin} (or whatever prefix was given to +@code{configure}, if not @file{/usr/local}). + +Automake may require that additional tools be present on the +@emph{developer's} machine. For example, the @code{Makefile.in} that +the developer works with may not be portable (e.g. it might use special +features of your compiler to automatically generate dependency +information). Running @code{make dist}, however, produces a +@file{hello-1.0.tar.gz} package (or whatever the program/version is) +with a @code{Makefile.in} that will work on any system. + +The benefits of Automake increase for larger packages (especially ones +with subdirectories), but even for small programs the added convenience +and portability can be substantial. And that's not all@dots{} + +@node Libtool, Pointers, Automake, The GNU build system +@section Libtool + +Very often, one wants to build not only programs, but libraries, so that +other programs can benefit from the fruits of your labor. Ideally, one +would like to produce @emph{shared} (dynamically-linked) libraries, +which can be used by multiple programs without duplication on disk or in +memory and can be updated independently of the linked programs. +Producing shared libraries portably, however, is the stuff of +nightmares---each system has its own incompatible tools, compiler flags, +and magic incantations. Fortunately, GNU provides a solution: +@dfn{Libtool}. +@cindex Libtool + +Libtool handles all the requirements of building shared libraries for +you, and at this time seems to be the @emph{only} way to do so with any +portability. It also handles many other headaches, such as: the +interaction of @code{Makefile} rules with the variable suffixes of +shared libraries, linking reliably to shared libraries before they are +installed by the superuser, and supplying a consistent versioning system +(so that different versions of a library can be installed or upgraded +without breaking binary compatibility). Although Libtool, like +Autoconf, can be used on its own, it is most simply utilized in +conjunction with Automake---there, Libtool is used automatically +whenever shared libraries are needed, and you need not know its syntax. + +@node Pointers, , Libtool, The GNU build system +@section Pointers + +Developers who are used to the simplicity of @code{make} for small +projects on a single system might be daunted at the prospect of learning +to use Automake and Autoconf. As your software is distributed to more +and more users, however, you will otherwise quickly find yourself +putting lots of effort into reinventing the services that the GNU build +tools provide, and making the same mistakes that they once made and +overcame. (Besides, since you're already learning Autoconf, Automake +will be a piece of cake.) + +There are a number of places that you can go to for more information on +the GNU build tools. + +@itemize @minus + +@item Web + +The home pages for +@href{http://www.gnu.org/software/autoconf/,Autoconf}, and +@href{http://www.gnu.org/software/libtool/,Libtool}. + +@item Books + +The book @cite{GNU Autoconf, Automake and Libtool}@footnote{@cite{GNU +Autoconf, Automake and Libtool}, by G. V. Vaughan, B. Elliston, +T. Tromey, and I. L. Taylor. New Riders, 2000, ISBN 1578701902.} +describes the complete GNU build environment. You can also find the +entire book on-line at @href{http://sources.redhat.com/autobook/,``The +Goat Book'' home page}. + +@item Tutorials and Examples + +The @href{http://sources.redhat.com/autoconf/,Autoconf Developer Page} +maintains links to a number of Autoconf/Automake tutorials online, and +also links to the @href{http://www.gnu.org/software/ac-archive/, +Autoconf Macro Archive}. + +@end itemize + +@c ================================================= Making configure Scripts. + +@node Making configure Scripts, Setup, The GNU build system, Top +@chapter Making @code{configure} Scripts +@cindex @file{aclocal.m4} +@cindex @code{configure} + +The configuration scripts that Autoconf produces are by convention +called @code{configure}. When run, @code{configure} creates several +files, replacing configuration parameters in them with appropriate +values. The files that @code{configure} creates are: + +@itemize @minus +@item +one or more @file{Makefile} files, one in each subdirectory of the +package (@pxref{Makefile Substitutions}); + +@item +optionally, a C header file, the name of which is configurable, +containing @code{#define} directives (@pxref{Configuration Headers}); + +@item +a shell script called @file{config.status} that, when run, will recreate +the files listed above (@pxref{config.status Invocation}); + +@item +an optional shell script normally called @file{config.cache} +(created when using @samp{configure --config-cache}) that +saves the results of running many of the tests (@pxref{Cache Files}); + +@item +a file called @file{config.log} containing any messages produced by +compilers, to help debugging if @code{configure} makes a mistake. +@end itemize + +@cindex @file{configure.in} +@cindex @file{configure.ac} +To create a @code{configure} script with Autoconf, you need to write an +Autoconf input file @file{configure.ac} (or @file{configure.in}) and run +@code{autoconf} on it. If you write your own feature tests to +supplement those that come with Autoconf, you might also write files +called @file{aclocal.m4} and @file{acsite.m4}. If you use a C header +file to contain @code{#define} directives, you might also run +@code{autoheader}, and you will distribute the generated file +@file{config.h.in} with the package. + +Here is a diagram showing how the files that can be used in +configuration are produced. Programs that are executed are suffixed by +@samp{*}. Optional files are enclosed in square brackets (@samp{[]}). +@code{autoconf} and @code{autoheader} also read the installed Autoconf +macro files (by reading @file{autoconf.m4}). + +@noindent +Files used in preparing a software package for distribution: +@example +your source files --> [autoscan*] --> [configure.scan] --> configure.ac + +@group +configure.ac --. + | .------> autoconf* -----> configure +[aclocal.m4] --+---+ + | `-----> [autoheader*] --> [config.h.in] +[acsite.m4] ---' +@end group + +Makefile.in -------------------------------> Makefile.in +@end example + +@noindent +Files used in configuring a software package: +@example +@group + .-------------> [config.cache] +configure* ------------+-------------> config.log + | +[config.h.in] -. v .-> [config.h] -. + +--> config.status* -+ +--> make* +Makefile.in ---' `-> Makefile ---' +@end group +@end example + +@menu +* Writing configure.ac:: What to put in an Autoconf input file +* autoscan Invocation:: Semi-automatic @file{configure.ac} writing +* ifnames Invocation:: Listing the conditionals in source code +* autoconf Invocation:: How to create configuration scripts +* autoreconf Invocation:: Remaking multiple @code{configure} scripts +@end menu + +@node Writing configure.ac, autoscan Invocation, Making configure Scripts, Making configure Scripts +@section Writing @file{configure.ac} + +To produce a @code{configure} script for a software package, create a +file called @file{configure.ac} that contains invocations of the +Autoconf macros that test the system features your package needs or can +use. Autoconf macros already exist to check for many features; see +@ref{Existing Tests}, for their descriptions. For most other features, +you can use Autoconf template macros to produce custom checks; see +@ref{Writing Tests}, for information about them. For especially tricky +or specialized features, @file{configure.ac} might need to contain some +hand-crafted shell commands; see @ref{Portable Shell}. The +@code{autoscan} program can give you a good start in writing +@file{configure.ac} (@pxref{autoscan Invocation}, for more information). + +Previous versions of Autoconf promoted the name @file{configure.in}, +which is somewhat ambiguous (the tool needed to produce this file is not +described by its extension), and introduces a slight confusion with +@file{config.h.in} and so on (for which @samp{.in} means ``to be +processed by @code{configure}''). Using @file{configure.ac} is now +preferred. + +@menu +* Shell Script Compiler:: Autoconf as solution of a problem +* Autoconf Language:: Programming in Autoconf +* configure.ac Layout:: Standard organization of configure.ac +@end menu + +@node Shell Script Compiler, Autoconf Language, Writing configure.ac, Writing configure.ac +@subsection A Shell Script Compiler + +Just as for any other computer language, in order to properly program +@file{configure.ac} in Autoconf you must understand @emph{what} problem +the language tries to address and @emph{how} it does so. + +The problem Autoconf addresses is that the world is a mess. After all, +you are using Autoconf in order to have your package compile easily on +all sorts of different systems, some of them being extremely hostile. +Autoconf itself bears the price for these differences: @code{configure} +must run on all those systems, and thus @code{configure} must limit itself +to their lowest common denominator of features. + +Naturally, you might then think of shell scripts; who needs +@code{autoconf}? A set of properly written shell functions is enough to +make it easy to write @code{configure} scripts by hand. Sigh! +Unfortunately, shell functions do not belong to the least common +denominator; therefore, where you would like to define a function and +use it ten times, you would instead need to copy its body ten times. + +So, what is really needed is some kind of compiler, @code{autoconf}, +that takes an Autoconf program, @file{configure.ac}, and transforms it +into a portable shell script, @code{configure}. + +How does @code{autoconf} perform this task? + +There are two obvious possibilities: creating a brand new language or +extending an existing one. The former option is very attractive: all +sorts of optimizations could easily be implemented in the compiler and +many rigorous checks could be performed on the Autoconf program +(e.g. rejecting any non-portable construct). Alternatively, you can +extend an existing language, such as the @code{sh} (Bourne shell) +language. + +Autoconf does the latter: it is a layer on top of @code{sh}. It was +therefore most convenient to implement @code{autoconf} as a macro +expander: a program that repeatedly performs @dfn{macro expansions} on +text input, replacing macro calls with macro bodies and producing a pure +@code{sh} script in the end. Instead of implementing a dedicated +Autoconf macro expander, it is natural to use an existing +general-purpose macro language, such as M4, and implement the extensions +as a set of M4 macros. + + +@node Autoconf Language, configure.ac Layout, Shell Script Compiler, Writing configure.ac +@subsection The Autoconf Language +@cindex quotation + +The Autoconf language is very different from many other computer +languages because it treats actual code the same as plain text. Whereas +in C, for instance, data and instructions have very different syntactic +status, in Autoconf their status is rigorously the same. Therefore, we +need a means to distinguish literal strings from text to be expanded: +quotation. + +When calling macros that take arguments, there must not be any blank +space between the macro name and the open parenthesis. Arguments should +be enclosed within the M4 quote characters @samp{[} and @samp{]}, and be +separated by commas. Any leading spaces in arguments are ignored, +unless they are quoted. You may safely leave out the quotes when the +argument is simple text, but @emph{always} quote complex arguments such +as other macro calls. This rule applies recursively for every macro +call, including macros called from other macros. + +For instance: + +@example +AC_CHECK_HEADER([stdio.h], + [AC_DEFINE([HAVE_STDIO_H])], + [AC_MSG_ERROR([Sorry, can't do anything for you])]) +@end example + +@noindent +is quoted properly. You may safely simplify its quotation to: + +@example +AC_CHECK_HEADER(stdio.h, + [AC_DEFINE(HAVE_STDIO_H)], + [AC_MSG_ERROR([Sorry, can't do anything for you])]) +@end example + +@noindent +Notice that the argument of @code{AC_MSG_ERROR} is still quoted; +otherwise, its comma would have been interpreted as an argument separator. + +The following example is wrong and dangerous, as it is underquoted: + +@example +AC_CHECK_HEADER(stdio.h, + AC_DEFINE(HAVE_STDIO_H), + AC_MSG_ERROR([Sorry, can't do anything for you])) +@end example + +In other cases, you may have to use text that also resembles a macro +call. You must quote that text even when it is not passed as a macro +argument: + +@example +echo "Hard rock was here! --[AC_DC]" +@end example + +@noindent +which will result in + +@example +echo "Hard rock was here! --AC_DC" +@end example + +@noindent +When you use the same text in a macro argument, you must therefore have +an extra quotation level (since one is stripped away by the macro +substitution). In general, then, it is a good idea to @emph{use double +quoting for all literal string arguments}: + +@example +AC_MSG_WARN([[AC_DC stinks --Iron Maiden]]) +@end example + +You are now able to understand one of the constructs of Autoconf that +has been continually misunderstood@dots{} The rule of thumb is that +@emph{whenever you expect macro expansion, expect quote expansion}; +i.e., expect one level of quotes to be lost. For instance: + +@example +AC_COMPILE_IFELSE([char b[10];],, [AC_MSG_ERROR([you lose])]) +@end example + +@noindent +is incorrect: here, the first argument of @code{AC_COMPILE_IFELSE} is +@samp{char b[10];} and will be expanded once, which results in +@samp{char b10;}. (There was an idiom common in Autoconf's past to +address this issue via the M4 @code{changequote} primitive, but do not +use it!) Let's take a closer look: the author meant the first argument +to be understood as a literal, and therefore it must be quoted twice: + +@example +AC_COMPILE_IFELSE([[char b[10];]],, [AC_MSG_ERROR([you lose])]) +@end example + +@noindent +Voil@`a, you actually produce @samp{char b[10];} this time! + +The careful reader will notice that, according to these guidelines, the +``properly'' quoted @code{AC_CHECK_HEADER} example above is actually +lacking three pairs of quotes! Nevertheless, for the sake of readability, +double quotation of literals is used only where needed in this manual. + +Some macros take optional arguments, which this documentation represents +as @ovar{arg} (not to be confused with the quote characters). You may +just leave them empty, or use @samp{[]} to make the emptiness of the +argument explicit, or you may simply omit the trailing commas. The +three lines below are equivalent: + +@example +AC_CHECK_HEADERS(stdio.h, [], [], []) +AC_CHECK_HEADERS(stdio.h,,,) +AC_CHECK_HEADERS(stdio.h) +@end example + +It is best to put each macro call on its own line in +@file{configure.ac}. Most of the macros don't add extra newlines; they +rely on the newline after the macro call to terminate the commands. +This approach makes the generated @code{configure} script a little +easier to read by not inserting lots of blank lines. It is generally +safe to set shell variables on the same line as a macro call, because +the shell allows assignments without intervening newlines. + +You can include comments in @file{configure.ac} files by starting them +with the @samp{#}. For example, it is helpful to begin +@file{configure.ac} files with a line like this: + +@example +# Process this file with autoconf to produce a configure script. +@end example + +@node configure.ac Layout, , Autoconf Language, Writing configure.ac +@subsection Standard @file{configure.ac} Layout + +The order in which @file{configure.ac} calls the Autoconf macros is not +important, with a few exceptions. Every @file{configure.ac} must +contain a call to @code{AC_INIT} before the checks, and a call to +@code{AC_OUTPUT} at the end (@pxref{Output}). Additionally, some macros +rely on other macros having been called first, because they check +previously set values of some variables to decide what to do. These +macros are noted in the individual descriptions (@pxref{Existing +Tests}), and they also warn you when @code{configure} is created if they +are called out of order. + +To encourage consistency, here is a suggested order for calling the +Autoconf macros. Generally speaking, the things near the end of this +list are those that could depend on things earlier in it. For example, +library functions could be affected by types and libraries. + +@display +@group +Autoconf requirements +@code{AC_INIT(@var{package}, @var{version}, @var{bug-report-address})} +information on the package +checks for programs +checks for libraries +checks for header files +checks for types +checks for structures +checks for compiler characteristics +checks for library functions +checks for system services +@code{AC_CONFIG_FILES(@r{[}@var{file@dots{}}@r{]})} +@code{AC_OUTPUT} +@end group +@end display + + +@node autoscan Invocation, ifnames Invocation, Writing configure.ac, Making configure Scripts +@section Using @code{autoscan} to Create @file{configure.ac} +@cindex @code{autoscan} + +The @code{autoscan} program can help you create and/or maintain a +@file{configure.ac} file for a software package. @code{autoscan} +examines source files in the directory tree rooted at a directory given +as a command line argument, or the current directory if none is given. +It searches the source files for common portability problems and creates +a file @file{configure.scan} which is a preliminary @file{configure.ac} +for that package, and checks a possibly existing @file{configure.ac} for +completeness. + +When using @command{autoscan} to create a @file{configure.ac}, you +should manually examine @file{configure.scan} before renaming it to +@file{configure.ac}; it will probably need some adjustments. +Occasionally, @code{autoscan} outputs a macro in the wrong order +relative to another macro, so that @code{autoconf} produces a warning; +you need to move such macros manually. Also, if you want the package to +use a configuration header file, you must add a call to +@code{AC_CONFIG_HEADERS} (@pxref{Configuration Headers}). You might +also have to change or add some @code{#if} directives to your program in +order to make it work with Autoconf (@pxref{ifnames Invocation}, for +information about a program that can help with that job). + +When using @command{autoscan} to maintain a @file{configure.ac}, simply +consider adding its suggestions. The file @file{autoscan.log} will +contain detailed information on why a macro is requested. + +@code{autoscan} uses several data files (installed along with Autoconf) +to determine which macros to output when it finds particular symbols in +a package's source files. These data files all have the same format: +each line consists of a symbol, whitespace, and the Autoconf macro to +output if that symbol is encountered. Lines starting with @samp{#} are +comments. + +@code{autoscan} is only installed if you already have Perl installed. +@code{autoscan} accepts the following options: + +@table @option +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@item --version +@itemx -V +Print the version number of Autoconf and exit. + +@item --verbose +@itemx -v +Print the names of the files it examines and the potentially interesting +symbols it finds in them. This output can be voluminous. + +@item --autoconf-dir=@var{dir} +@itemx -A @var{dir} +@evindex AC_MACRODIR +Override the location where the installed Autoconf data files are looked +for. You can also set the @code{AC_MACRODIR} environment variable to a +directory; this option overrides the environment variable. + +This option is rarely needed and dangerous; it is only used when one +plays with different versions of Autoconf simultaneously. +@end table + +@node ifnames Invocation, autoconf Invocation, autoscan Invocation, Making configure Scripts +@section Using @code{ifnames} to List Conditionals +@cindex @code{ifnames} + +@code{ifnames} can help you write @file{configure.ac} for a software +package. It prints the identifiers that the package already uses in C +preprocessor conditionals. If a package has already been set up to have +some portability, @code{ifnames} can thus help you figure out what its +@code{configure} needs to check for. It may help fill in some gaps in a +@file{configure.ac} generated by @code{autoscan} (@pxref{autoscan +Invocation}). + +@code{ifnames} scans all of the C source files named on the command line +(or the standard input, if none are given) and writes to the standard +output a sorted list of all the identifiers that appear in those files +in @code{#if}, @code{#elif}, @code{#ifdef}, or @code{#ifndef} +directives. It prints each identifier on a line, followed by a +space-separated list of the files in which that identifier occurs. + +@noindent +@code{ifnames} accepts the following options: + +@table @option +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@item --version +@itemx -V +Print the version number of Autoconf and exit. +@end table + +@node autoconf Invocation, autoreconf Invocation, ifnames Invocation, Making configure Scripts +@section Using @code{autoconf} to Create @code{configure} +@cindex @code{autoconf} + +To create @code{configure} from @file{configure.ac}, run the +@code{autoconf} program with no arguments. @code{autoconf} processes +@file{configure.ac} with the @code{m4} macro processor, using the +Autoconf macros. If you give @code{autoconf} an argument, it reads that +file instead of @file{configure.ac} and writes the configuration script +to the standard output instead of to @code{configure}. If you give +@code{autoconf} the argument @option{-}, it reads from the standard +input instead of @file{configure.ac} and writes the configuration script +to the standard output. + +The Autoconf macros are defined in several files. Some of the files are +distributed with Autoconf; @code{autoconf} reads them first. Then it +looks for the optional file @file{acsite.m4} in the directory that +contains the distributed Autoconf macro files, and for the optional file +@file{aclocal.m4} in the current directory. Those files can contain +your site's or the package's own Autoconf macro definitions +(@pxref{Writing Autoconf Macros}, for more information). If a macro is defined +in more than one of the files that @code{autoconf} reads, the last +definition it reads overrides the earlier ones. + +@code{autoconf} accepts the following options: + +@table @option +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@item --version +@itemx -V +Print the version number of Autoconf and exit. + +@item --verbose +@itemx -v +Report processing steps. + +@item --debug +@itemx -d +Don't remove the temporary files. + +@item --autoconf-dir=@var{dir} +@itemx -A @var{dir} +@evindex AC_MACRODIR +Override the location where the installed Autoconf data files are looked +for. You can also set the @code{AC_MACRODIR} environment variable to a +directory; this option overrides the environment variable. + +This option is rarely needed and dangerous; it is only used when one +plays with different versions of Autoconf simultaneously. + +@item --localdir=@var{dir} +@itemx -l @var{dir} +Look for the package file @file{aclocal.m4} in directory @var{dir} +instead of in the current directory. + +@item --output=@var{file} +@itemx -o @var{file} +Save output (script or trace) to @var{file}. The file @option{-} stands +for the standard output. + +@item --warnings=@var{category} +@itemx -W @var{category} +@evindex WARNINGS +Report the warnings related to @var{category} (which can actually be a +comma separated list). @xref{Reporting Messages}, macro +@code{AC_DIAGNOSE}, for a comprehensive list of categories. Special +values include: + +@table @samp +@item all +report all the warnings + +@item none +report none + +@item error +treats warnings as errors + +@item no-@var{category} +disable warnings falling into @var{category} +@end table + +Warnings about @samp{syntax} are enabled by default, and the environment +variable @code{WARNINGS}, a comma separated list of categories, is +honored. @command{autoconf -W @var{category}} will actually +behave as if you had run: + +@example +autoconf --warnings=syntax,$WARNINGS,@var{category} +@end example + +@noindent +If you want to disable @command{autoconf}'s defaults and @code{WARNINGS}, +but (for example) enable the warnings about obsolete constructs, you +would use @option{-W none,obsolete}. + +@cindex Back trace +@cindex Macro invocation stack +@command{autoconf} displays a back trace for errors, but not for +warnings; if you want them, just pass @option{-W error}. For instance, +on this @file{configure.ac}: + +@example +AC_DEFUN([INNER], +[AC_TRY_RUN([true])]) + +AC_DEFUN([OUTER], +[INNER]) + +AC_INIT +OUTER +@end example + +@noindent +you get: + +@example +$ autoconf -Wcross +configure.ac:8: warning: AC_TRY_RUN called without default \ +to allow cross compiling +$ autoconf -Wcross,error +configure.ac:8: error: AC_TRY_RUN called without default \ +to allow cross compiling +acgeneral.m4:3044: AC_TRY_RUN is expanded from... +configure.ac:2: INNER is expanded from... +configure.ac:5: OUTER is expanded from... +configure.ac:8: the top level +@end example + +@item --trace=@var{macro}[:@var{format}] +@itemx -t @var{macro}[:@var{format}] +Do not create the @code{configure} script, but list the calls to +@var{macro} according to the @var{format}. Multiple @option{--trace} +arguments can be used to list several macros. Multiple @option{--trace} +arguments for a single macro are not cumulative; instead, you should +just make @var{format} as long as needed. + +The @var{format} is a regular string, with newlines if desired, and +several special escape codes. It defaults to @samp{$f:$l:$n:$%}; see +below for details on the @var{format}. + +@item --initialization +@itemx -i +By default, @option{--trace} does not trace the initialization of the +Autoconf macros (typically the @code{AC_DEFUN} definitions). This +results in a noticeable speedup, but can be disabled by this option. +@end table + + +It is often necessary to check the content of a @file{configure.ac} +file, but parsing it yourself is extremely fragile and error-prone. It +is suggested that you rely upon @option{--trace} to scan +@file{configure.ac}. + +The @var{format} of @option{--trace} can use the following special +escapes: + +@table @samp +@item $$ +The character @samp{$}. + +@item $f +The filename from which @var{macro} is called. + +@item $l +The line number from which @var{macro} is called. + +@item $d +The depth of the @var{macro} call. This is an M4 technical detail that +you probably don't want to know about. + +@item $n +The name of the @var{macro}. + +@item $@var{num} +The @var{num}th argument of the call to @var{macro}. + +@item $@@ +@itemx $@var{sep}@@ +@itemx $@{@var{separator}@}@@ +All the arguments passed to @var{macro}, separated by the character +@var{sep} or the string @var{separator} (@samp{,} by default). Each +argument is quoted, i.e. enclosed in a pair of square brackets. + +@item $* +@itemx $@var{sep}* +@itemx $@{@var{separator}@}* +As above, but the arguments are not quoted. + +@item $% +@itemx $@var{sep}% +@itemx $@{@var{separator}@}% +As above, but the arguments are not quoted, all new line characters in +the arguments are smashed, and the default separator is @samp{:}. + +The escape @samp{$%} produces single-line trace outputs (unless you put +newlines in the @samp{separator}), while @samp{$@@} and @samp{$*} do +not. +@end table + +For instance, to find the list of variables that are substituted, use: + +@example +@group +$ autoconf -t AC_SUBST +configure.ac:2:AC_SUBST:ECHO_C +configure.ac:2:AC_SUBST:ECHO_N +configure.ac:2:AC_SUBST:ECHO_T +@i{More traces deleted} +@end group +@end example + +@noindent +The example below highlights the difference between @samp{$@@}, +@samp{$*}, and @strong{$%}. + +@example +@group +$ cat configure.ac +AC_DEFINE(This, is, [an +[example]]) +$ autoconf -t 'AC_DEFINE:@@: $@@ +*: $* +$: $%' +@@: [This],[is],[an +[example]] +*: This,is,an +[example] +$: This:is:an [example] +@end group +@end example + +@noindent +The @var{format} gives you a lot of freedom: + +@example +@group +$ autoconf -t 'AC_SUBST:$$ac_subst@{"$1"@} = "$f:$l";' +$ac_subst@{"ECHO_C"@} = "configure.ac:2"; +$ac_subst@{"ECHO_N"@} = "configure.ac:2"; +$ac_subst@{"ECHO_T"@} = "configure.ac:2"; +@i{More traces deleted} +@end group +@end example + +@noindent +A long @var{separator} can be used to improve the readability of complex +structures, and to ease its parsing (for instance when no single +character is suitable as a separator)): + +@example +@group +$ autoconf -t 'AM_MISSING_PROG:$@{|:::::|@}*' +AUTOCONF|:::::|autoconf|:::::|$missing_dir +@i{More traces deleted} +@end group +@end example + +@node autoreconf Invocation, , autoconf Invocation, Making configure Scripts +@section Using @code{autoreconf} to Update @code{configure} Scripts +@cindex @code{autoreconf} + +If you have a lot of Autoconf-generated @code{configure} scripts, the +@code{autoreconf} program can save you some work. It runs +@code{autoconf} (and @code{autoheader}, where appropriate) repeatedly to +remake the Autoconf @code{configure} scripts and configuration header +templates in the directory tree rooted at the current directory. By +default, it only remakes those files that are older than their +@file{configure.ac} or (if present) @file{aclocal.m4}. Since +@code{autoheader} does not change the timestamp of its output file if +the file wouldn't be changing, this is not necessarily the minimum +amount of work. If you install a new version of Autoconf, you can make +@code{autoreconf} remake @emph{all} of the files by giving it the +@option{--force} option. + +If you give @code{autoreconf} the @option{--autoconf-dir=@var{dir}} or +@option{--localdir=@var{dir}} options, it passes them down to +@code{autoconf} and @code{autoheader} (with relative paths adjusted +properly). + +@code{autoreconf} does not support having, in the same directory tree, +both directories that are parts of a larger package (sharing +@file{aclocal.m4} and @file{acconfig.h}) and directories that are +independent packages (each with their own @file{aclocal.m4} and +@file{acconfig.h}). It assumes that they are all part of the same +package if you use @option{--localdir}, or that each directory is a +separate package if you don't use it. This restriction may be removed +in the future. + +@xref{Automatic Remaking}, for @file{Makefile} rules to automatically +remake @code{configure} scripts when their source files change. That +method handles the timestamps of configuration header templates +properly, but does not pass @option{--autoconf-dir=@var{dir}} or +@option{--localdir=@var{dir}}. + +@noindent +@code{autoreconf} accepts the following options: + +@table @option +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@item --version +@itemx -V +Print the version number of Autoconf and exit. + +@item --verbose +Print the name of each directory where @code{autoreconf} runs +@code{autoconf} (and @code{autoheader}, if appropriate). + +@item --debug +@itemx -d +Don't remove the temporary files. + +@item --force +@itemx -f +Remake even @file{configure} scripts and configuration headers that are +newer than their input files (@file{configure.ac} and, if present, +@file{aclocal.m4}). + +@item --install +@itemx -i +Copy missing auxiliary files. This option is similar to the option +@code{--add-missing} in other tools. + +@item --symlink +@itemx -s +Instead of copying missing auxiliary files, install symbolic links. + +@item --localdir=@var{dir} +@itemx -l @var{dir} +Have @code{autoconf} and @code{autoheader} look for the package files +@file{aclocal.m4} and (@code{autoheader} only) @file{acconfig.h} (but +not @file{@var{file}.top} and @file{@var{file}.bot}) in directory +@var{dir} instead of in the directory containing each @file{configure.ac}. + +@item --autoconf-dir=@var{dir} +@itemx -A @var{dir} +@evindex AC_MACRODIR +Override the location where the installed Autoconf data files are looked +for. You can also set the @code{AC_MACRODIR} environment variable to a +directory; this option overrides the environment variable. + +This option is rarely needed and dangerous; it is only used when one +plays with different versions of Autoconf simultaneously. + +@item --m4dir=@var{dir} +@itemx -M @var{dir} +Specify location of additional macro files (@file{m4} by default). +@end table + + +@c ========================================= Initialization and Output Files. + +@node Setup, Existing Tests, Making configure Scripts, Top +@chapter Initialization and Output Files + +Autoconf-generated @code{configure} scripts need some information about +how to initialize, such as how to find the package's source files; and +about the output files to produce. The following sections describe +initialization and the creation of output files. + +@menu +* Notices:: Copyright, version numbers in @code{configure} +* Input:: Where Autoconf should find files +* Output:: Outputting results from the configuration +* Configuration Actions:: Preparing the output based on results +* Configuration Files:: Creating output files +* Makefile Substitutions:: Using output variables in @file{Makefile}s +* Configuration Headers:: Creating a configuration header file +* Configuration Commands:: Running arbitrary instantiation commands +* Configuration Links:: Links depending from the configuration +* Subdirectories:: Configuring independent packages together +* Default Prefix:: Changing the default installation prefix +@end menu + +@node Notices, Input, Setup, Setup +@section Notices in @code{configure} + +The following macros manage version numbers for @code{configure} +scripts. Using them is optional. + +@c FIXME: AC_PREREQ should not be here, but where should it go? +@defmac AC_PREREQ (@var{version}) +@maindex PREREQ +@cindex Version +Ensure that a recent enough version of Autoconf is being used. If the +version of Autoconf being used to create @code{configure} is earlier +than @var{version}, print an error message to the standard error output +and do not create @code{configure}. For example: + +@example +AC_PREREQ(@value{VERSION}) +@end example + +This macro is the only macro that may be used before @code{AC_INIT}, but +for consistency, you are invited not to do so. +@end defmac + +@defmac AC_COPYRIGHT (@var{copyright-notice}) +@maindex COPYRIGHT +@cindex Copyright Notice +State that, in addition to the Free Software Foundation's copyright on +the Autoconf macros, parts of your @code{configure} are covered by the +@var{copyright-notice}. + +The @var{copyright-notice} will show up in both the head of +@code{configure} and in @samp{configure --version}. +@end defmac + + +@defmac AC_REVISION (@var{revision-info}) +@maindex REVISION +@cindex Revision +Copy revision stamp @var{revision-info} into the @code{configure} +script, with any dollar signs or double-quotes removed. This macro lets +you put a revision stamp from @file{configure.ac} into @code{configure} +without @sc{rcs} or @code{cvs} changing it when you check in +@code{configure}. That way, you can determine easily which revision of +@file{configure.ac} a particular @code{configure} corresponds to. + +For example, this line in @file{configure.ac}: + +@c The asis prevents RCS from changing the example in the manual. +@example +AC_REVISION($@asis{Revision: 1.30 }$) +@end example + +@noindent +produces this in @code{configure}: + +@example +#! /bin/sh +# From configure.ac Revision: 1.30 +@end example +@end defmac + + +@node Input, Output, Notices, Setup +@section Finding @code{configure} Input + +Every @code{configure} script must call @code{AC_INIT} before doing +anything else. The only other required macro is @code{AC_OUTPUT} +(@pxref{Output}). + +@defmac AC_INIT (@var{package}, @var{version}, @ovar{bug-report-address}) +@maindex INIT +Process any command-line arguments and perform various initializations +and verifications. Set the name of the @var{package} and its +@var{version}. The optional argument @var{bug-report-address} should be +the email to which users should send bug reports. +@end defmac + +@defmac AC_CONFIG_SRCDIR (@var{unique-file-in-source-dir}) +@maindex CONFIG_SRCDIR +@var{unique-file-in-source-dir} is some file that is in the package's +source directory; @code{configure} checks for this file's existence to +make sure that the directory that it is told contains the source code in +fact does. Occasionally people accidentally specify the wrong directory +with @option{--srcdir}; this is a safety check. @xref{configure +Invocation}, for more information. +@end defmac + + +@c FIXME: Remove definitively once --install explained. +@c +@c Small packages may store all their macros in @code{aclocal.m4}. As the +@c set of macros grows, or for maintenance reasons, a maintainer may prefer +@c to split the macros in several files. In this case, Autoconf must be +@c told which files to load, and in which order. +@c +@c @defmac AC_INCLUDE (@var{file}@dots{}) +@c @maindex INCLUDE +@c @c FIXME: There is no longer shell globbing. +@c Read the macro definitions that appear in the listed files. A list of +@c space-separated filenames or shell globbing patterns is expected. The +@c files will be read in the order they're listed. +@c +@c Because the order of definition of macros is important (only the last +@c definition of a macro is used), beware that it is @code{AC_INIT} that +@c loads @file{acsite.m4} and @file{aclocal.m4}. Note that +@c @code{AC_INCLUDE}ing a file before @code{AC_INIT} or within +@c @file{aclocal.m4} is different from doing so after @code{AC_INIT}: in +@c the latter case, non-macro lines from included files may end up in the +@c @file{configure} script, whereas in the former case, they'd be discarded +@c just like any text that appear before @code{AC_INIT}. +@c @end defmac + +Packages that do manual configuration or use the @code{install} program +might need to tell @code{configure} where to find some other shell +scripts by calling @code{AC_CONFIG_AUX_DIR}, though the default places +it looks are correct for most cases. + +@defmac AC_CONFIG_AUX_DIR (@var{dir}) +@maindex CONFIG_AUX_DIR +Use the auxiliary build tools (e.g., @file{install-sh}, +@file{config.sub}, @file{config.guess}, Cygnus @code{configure}, +Automake and Libtool scripts etc.) that are in directory @var{dir}. +These are auxiliary files used in configuration. @var{dir} can be +either absolute or relative to @file{@var{srcdir}}. The default is +@file{@var{srcdir}} or @file{@var{srcdir}/..} or +@file{@var{srcdir}/../..}, whichever is the first that contains +@file{install-sh}. The other files are not checked for, so that using +@code{AC_PROG_INSTALL} does not automatically require distributing the +other auxiliary files. It checks for @file{install.sh} also, but that +name is obsolete because some @command{make} have a rule that creates +@file{install} from it if there is no @file{Makefile}. +@end defmac + + +@node Output, Configuration Actions, Input, Setup +@section Outputting Files + +Every Autoconf-generated @code{configure} script must finish by calling +@code{AC_OUTPUT}. It is the macro that generates @file{config.status}, +which will create the @file{Makefile}s and any other files resulting +from configuration. The only other required macro is @code{AC_INIT} +(@pxref{Input}). + +@defmac AC_OUTPUT +@maindex OUTPUT +@cindex Instantiation +Generate @file{config.status} and launch it. Call this macro once, at +the end of @file{configure.ac}. + +@file{config.status} will take all the configuration actions: all the +output files (see @ref{Configuration Files}, macro +@code{AC_CONFIG_FILES}), header files (see @ref{Configuration Headers}, +macro @code{AC_CONFIG_HEADERS}), commands (see @ref{Configuration +Commands}, macro @code{AC_CONFIG_COMMANDS}), links (see +@ref{Configuration Links}, macro @code{AC_CONFIG_LINKS}), subdirectories +to configure (see @ref{Subdirectories}, macro @code{AC_CONFIG_SUBDIRS}) +are honored. +@end defmac + +Historically, the usage of @code{AC_OUTPUT} was somewhat different. +@xref{Obsolete Macros}, for a description of the arguments that +@code{AC_OUTPUT} used to support. + + +If you run @code{make} on subdirectories, you should run it using the +@code{make} variable @code{MAKE}. Most versions of @code{make} set +@code{MAKE} to the name of the @code{make} program plus any options it +was given. (But many do not include in it the values of any variables +set on the command line, so those are not passed on automatically.) +Some old versions of @code{make} do not set this variable. The +following macro allows you to use it even with those versions. + +@defmac AC_PROG_MAKE_SET +@maindex PROG_MAKE_SET +@ovindex SET_MAKE +If @code{make} predefines the variable @code{MAKE}, define output +variable @code{SET_MAKE} to be empty. Otherwise, define @code{SET_MAKE} +to contain @samp{MAKE=make}. Calls @code{AC_SUBST} for @code{SET_MAKE}. +@end defmac + +To use this macro, place a line like this in each @file{Makefile.in} +that runs @code{MAKE} on other directories: + +@example +@@SET_MAKE@@ +@end example + + + +@node Configuration Actions, Configuration Files, Output, Setup +@section Taking Configuration Actions + +@file{configure} is designed so that it appears to do everything itself, +but there is actually a hidden slave: @file{config.status}. +@file{configure} is in charge of examining your system, but it is +@file{config.status} that actually takes the proper actions based on the +results of @file{configure}. The most typical task of +@file{config.status} is to @emph{instantiate} files. + +This section describes the common behavior of the four standard +instantiating macros: @code{AC_CONFIG_FILES}, @code{AC_CONFIG_HEADERS}, +@code{AC_CONFIG_COMMANDS} and @code{AC_CONFIG_LINKS}. They all +have this prototype: + +@c Can't use @ovar here, Texinfo 4.0 goes lunatic and emits something +@c awful. +@example +AC_CONFIG_FOOS(@var{tag}@dots{}, [@var{commands}], [@var{init-cmds}]) +@end example + +@noindent +where the arguments are: + +@table @var +@item @var{tag}@dots{} +A whitespace-separated list of tags, which are typically the names of +the files to instantiate. + +@item commands +Shell commands output literally into @file{config.status}, and +associated with a tag that the user can use to tell @file{config.status} +which the commands to run. The commands are run each time a @var{tag} +request is given to @file{config.status}; typically, each time the file +@file{@var{tag}} is created. + +@item init-cmds +Shell commands output @emph{unquoted} near the beginning of +@file{config.status}, and executed each time @file{config.status} runs +(regardless of the tag). Because they are unquoted, for example, +@samp{$var} will be output as the value of @code{var}. @var{init-cmds} +is typically used by @file{configure} to give @file{config.status} some +variables it needs to run the @var{commands}. +@end table + +All these macros can be called multiple times, with different +@var{tag}s, of course! + +You are encouraged to use literals as @var{tags}. In particular, you +should avoid + +@example +@dots{} && my_foos="$my_foos fooo" +@dots{} && my_foos="$my_foos foooo" +AC_CONFIG_FOOS($my_foos) +@end example + +@noindent +and use this instead: + +@example +@dots{} && AC_CONFIG_FOOS(fooo) +@dots{} && AC_CONFIG_FOOS(foooo) +@end example + +The macro @code{AC_CONFIG_FILES} and @code{AC_CONFIG_HEADERS} use +specials @var{tag}s: they may have the form @samp{@var{output}} or +@samp{@var{output}:@var{inputs}}. The file @var{output} is instantiated +from its templates, @var{inputs} if specified, defaulting to +@samp{@var{output}.in}. + +For instance +@samp{AC_CONFIG_FILES(Makefile:boiler/top.mk:boiler/bot.mk)} asks for +the creation of @file{Makefile} that will be the expansion of the +output variables in the concatenation of @file{boiler/top.mk} and +@file{boiler/bot.mk}. + +The special value @samp{-} might be used to denote the standard output +when used in @var{output}, or the standard input when used in the +@var{inputs}. You most probably don't need to use this in +@file{configure.ac}, but it is convenient when using the command line +interface of @file{./config.status}, see @ref{config.status Invocation}, +for more details. + +The @var{inputs} may be absolute or relative filenames. In the latter +case they are first looked for in the build tree, and then in the source +tree. + + +@node Configuration Files, Makefile Substitutions, Configuration Actions, Setup +@section Creating Configuration Files + +Be sure to read the previous section, @ref{Configuration Actions}. + +@defmac AC_CONFIG_FILES (@var{file}@dots{}, @ovar{cmds}, @ovar{init-cmds}) +@maindex CONFIG_FILES +Make @code{AC_OUTPUT} create each @file{@var{file}} by copying an input +file (by default @file{@var{file}.in}), substituting the output variable +values. +@c Before we used to have this feature, which was later rejected +@c because it complicates the write of Makefiles: +@c If the file would be unchanged, it is left untouched, to preserve +@c timestamp. +This macro is one of the instantiating macros, see @ref{Configuration +Actions}. @xref{Makefile Substitutions}, for more information on using +output variables. @xref{Setting Output Variables}, for more information +on creating them. This macro creates the directory that the file is in +if it doesn't exist. Usually, @file{Makefile}s are created this way, +but other files, such as @file{.gdbinit}, can be specified as well. + +Typical calls to @code{AC_CONFIG_FILES} look like this: + +@example +AC_CONFIG_FILES(Makefile src/Makefile man/Makefile X/Imakefile) +AC_CONFIG_FILES(autoconf, chmod +x autoconf) +@end example + +You can override an input file name by appending to @var{file} a +colon-separated list of input files. Examples: + +@example +AC_CONFIG_FILES(Makefile:boiler/top.mk:boiler/bot.mk + lib/Makefile:boiler/lib.mk) +@end example + +@noindent +Doing this allows you to keep your file names acceptable to MS-DOS, or +to prepend and/or append boilerplate to the file. +@end defmac + + + +@node Makefile Substitutions, Configuration Headers, Configuration Files, Setup +@section Substitutions in Makefiles + +Each subdirectory in a distribution that contains something to be +compiled or installed should come with a file @file{Makefile.in}, from +which @code{configure} will create a @file{Makefile} in that directory. +To create a @file{Makefile}, @code{configure} performs a simple variable +substitution, replacing occurrences of @samp{@@@var{variable}@@} in +@file{Makefile.in} with the value that @code{configure} has determined +for that variable. Variables that are substituted into output files in +this way are called @dfn{output variables}. They are ordinary shell +variables that are set in @code{configure}. To make @code{configure} +substitute a particular variable into the output files, the macro +@code{AC_SUBST} must be called with that variable name as an argument. +Any occurrences of @samp{@@@var{variable}@@} for other variables are +left unchanged. @xref{Setting Output Variables}, for more information +on creating output variables with @code{AC_SUBST}. + +A software package that uses a @code{configure} script should be +distributed with a file @file{Makefile.in}, but no @file{Makefile}; that +way, the user has to properly configure the package for the local system +before compiling it. + +@xref{Makefile Conventions,, Makefile Conventions, standards, The +GNU Coding Standards}, for more information on what to put in +@file{Makefile}s. + +@menu +* Preset Output Variables:: Output variables that are always set +* Installation Directory Variables:: Other preset output variables +* Build Directories:: Supporting multiple concurrent compiles +* Automatic Remaking:: Makefile rules for configuring +@end menu + +@node Preset Output Variables, Installation Directory Variables, Makefile Substitutions, Makefile Substitutions +@subsection Preset Output Variables + +Some output variables are preset by the Autoconf macros. Some of the +Autoconf macros set additional output variables, which are mentioned in +the descriptions for those macros. @xref{Output Variable Index}, for a +complete list of output variables. @xref{Installation Directory +Variables}, for the list of the preset ones related to installation +directories. Below are listed the other preset ones. They all are +precious variables (@pxref{Setting Output Variables}, +@code{AC_ARG_VAR}). + +@c Just say no to ASCII sorting! We're humans, not computers. +@c These variables are listed as they would be in a dictionary: +@c actor +@c Actress +@c actress + +@defvar CFLAGS +@ovindex CFLAGS +Debugging and optimization options for the C compiler. If it is not set +in the environment when @code{configure} runs, the default value is set +when you call @code{AC_PROG_CC} (or empty if you don't). @code{configure} +uses this variable when compiling programs to test for C features. +@end defvar + +@defvar configure_input +@ovindex configure_input +A comment saying that the file was generated automatically by +@code{configure} and giving the name of the input file. +@code{AC_OUTPUT} adds a comment line containing this variable to the top +of every @file{Makefile} it creates. For other files, you should +reference this variable in a comment at the top of each input file. For +example, an input shell script should begin like this: + +@example +#! /bin/sh +# @@configure_input@@ +@end example + +@noindent +The presence of that line also reminds people editing the file that it +needs to be processed by @code{configure} in order to be used. +@end defvar + +@defvar CPPFLAGS +@ovindex CPPFLAGS +Header file search directory (@option{-I@var{dir}}) and any other +miscellaneous options for the C and C++ preprocessors and compilers. If +it is not set in the environment when @code{configure} runs, the default +value is empty. @code{configure} uses this variable when compiling or +preprocessing programs to test for C and C++ features. +@end defvar + +@defvar CXXFLAGS +@ovindex CXXFLAGS +Debugging and optimization options for the C++ compiler. If it is not +set in the environment when @code{configure} runs, the default value is +set when you call @code{AC_PROG_CXX} (or empty if you don't). +@code{configure} uses this variable when compiling programs to test for +C++ features. +@end defvar + +@defvar DEFS +@ovindex DEFS +@option{-D} options to pass to the C compiler. If @code{AC_CONFIG_HEADERS} +is called, @code{configure} replaces @samp{@@DEFS@@} with +@option{-DHAVE_CONFIG_H} instead (@pxref{Configuration Headers}). This +variable is not defined while @code{configure} is performing its tests, +only when creating the output files. @xref{Setting Output Variables}, for +how to check the results of previous tests. +@end defvar + +@defvar ECHO_C +@defvarx ECHO_N +@defvarx ECHO_T +@ovindex ECHO_C +@ovindex ECHO_N +@ovindex ECHO_T +How does one suppress the trailing newline from @code{echo} for +question-answer message pairs? These variables provide a way: + +@example +echo $ECHO_N "And the winner is... $ECHO_C" +sleep 100000000000 +echo "$@{ECHO_T@}dead." +@end example + +@noindent +Some old and uncommon @code{echo} implementations offer no means to +achieve this, in which case @code{ECHO_T} is set to tab. You might not +want to use it. +@end defvar + +@defvar FFLAGS +@ovindex FFLAGS +Debugging and optimization options for the Fortran 77 compiler. If it +is not set in the environment when @code{configure} runs, the default +value is set when you call @code{AC_PROG_F77} (or empty if you don't). +@code{configure} uses this variable when compiling programs to test for +Fortran 77 features. +@end defvar + +@defvar LDFLAGS +@ovindex LDFLAGS +Stripping (@option{-s}), path (@option{-L}), and any other miscellaneous +options for the linker. Don't use this variable to pass library names +(@option{-l}) to the linker, use @code{LIBS} instead. If it is not set +in the environment when @code{configure} runs, the default value is empty. +@code{configure} uses this variable when linking programs to test for +C, C++ and Fortran 77 features. +@end defvar + +@defvar LIBS +@ovindex LIBS +@option{-l} options to pass to the linker. The default value is empty, +but some Autoconf macros may prepend extra libraries to this variable if +those libraries are found and provide necessary functions, see +@ref{Libraries}. @code{configure} uses this variable when linking +programs to test for C, C++ and Fortran 77 features. +@end defvar + +@defvar srcdir +@ovindex srcdir +The directory that contains the source code for that @file{Makefile}. +@end defvar + +@defvar top_srcdir +@ovindex top_srcdir +The top-level source code directory for the package. In the top-level +directory, this is the same as @code{srcdir}. +@end defvar + +@node Installation Directory Variables, Build Directories, Preset Output Variables, Makefile Substitutions +@subsection Installation Directory Variables + +The following variables specify the directories where the package will +be installed, see @ref{Directory Variables,, Variables for Installation +Directories, standards, The GNU Coding Standards}, for more information. +See the end of this section for details on when and how to use these +variables. + +@defvar bindir +@ovindex bindir +The directory for installing executables that users run. +@end defvar + +@defvar datadir +@ovindex datadir +The directory for installing read-only architecture-independent data. +@end defvar + +@defvar exec_prefix +@ovindex exec_prefix +The installation prefix for architecture-dependent files. By default +it's the same as @var{prefix}. You should avoid installing anything +directly to @var{exec_prefix}. However, the default value for +directories containing architecture-dependent files should be relative +to @var{exec_prefix}. +@end defvar + +@defvar includedir +@ovindex includedir +The directory for installing C header files. +@end defvar + +@defvar infodir +@ovindex infodir +The directory for installing documentation in Info format. +@end defvar + +@defvar libdir +@ovindex libdir +The directory for installing object code libraries. +@end defvar + +@defvar libexecdir +@ovindex libexecdir +The directory for installing executables that other programs run. +@end defvar + +@defvar localstatedir +@ovindex localstatedir +The directory for installing modifiable single-machine data. +@end defvar + +@defvar mandir +@ovindex mandir +The top-level directory for installing documentation in man format. +@end defvar + +@defvar oldincludedir +@ovindex oldincludedir +The directory for installing C header files for non-gcc compilers. +@end defvar + +@defvar prefix +@ovindex prefix +The common installation prefix for all files. If @var{exec_prefix} +is defined to a different value, @var{prefix} is used only for +architecture-independent files. +@end defvar + +@defvar sbindir +@ovindex sbindir +The directory for installing executables that system +administrators run. +@end defvar + +@defvar sharedstatedir +@ovindex sharedstatedir +The directory for installing modifiable architecture-independent data. +@end defvar + +@defvar sysconfdir +@ovindex sysconfdir +The directory for installing read-only single-machine data. +@end defvar + + +Most of these variables have values that rely on @code{prefix} or +@code{exec_prefix}. It is on purpose that the directory output +variables keep them unexpanded: typically @samp{@@datadir@@} will be +replaced by @samp{$@{prefix@}/share}, not @samp{/usr/local/share}. + +This behavior is mandated by the @sc{gnu} coding standards, so that when +the user runs: + +@table @samp +@item make +she can still specify a different prefix from the one specified to +@command{configure}, in which case, if needed, the package shall hard +code dependencies to her late desires. + +@item make install +she can specify a different installation location, in which case the +package @emph{must} still depend on the location which was compiled in +(i.e., never recompile when @samp{make install} is run). This is an +extremely important feature, as many people may decide to install all +the files of a package grouped together, and then install links from +the final locations to there. +@end table + +In order to support these features, it is essential that @code{datadir} +remains being defined as @samp{$@{prefix@}/share} to depend upon the +current value of @code{prefix}. + +A corollary is that you should not use these variables but in Makefiles. +For instance, instead of trying to evaluate @code{datadir} in +@file{configure} and hardcoding it in Makefiles using +e.g. @samp{AC_DEFINE_UNQUOTED(DATADIR, "$datadir")}, you should add +@samp{-DDATADIR="$(datadir)"} to your @code{CPPFLAGS}. + +Similarly you should not rely on @code{AC_OUTPUT_FILES} to replace +@code{datadir} and friends in your shell scripts and other files, rather +let @command{make} manage their replacement. For instance Autoconf +ships templates of its shell scripts ending with @samp{.sh}, and uses +this Makefile snippet: + +@example +.sh: + rm -f $@@ $@@.tmp + sed 's,@@datadir\@@,$(pkgdatadir),g' $< >$@@.tmp + chmod +x $@@.tmp + mv $@@.tmp $@@ +@end example + +Three things are noteworthy: + +@table @samp +@item @@datadir\@@ +The backslash prevents @command{configure} from replacing +@samp{@@datadir@@} in the sed expression itself. + +@item $(pkgdatadir) +Don't use @samp{@@pkgdatadir@@}! Use the matching makefile variable +instead. + +@item , +Don't use @samp{/} in the sed expression(s) since most probably the +variables you use, such as @samp{$(pkgdatadir)}, will contain +some. +@end table + + +@node Build Directories, Automatic Remaking, Installation Directory Variables, Makefile Substitutions +@subsection Build Directories + +You can support compiling a software package for several architectures +simultaneously from the same copy of the source code. The object files +for each architecture are kept in their own directory. + +To support doing this, @code{make} uses the @code{VPATH} variable to +find the files that are in the source directory. @sc{gnu} @code{make} +and most other recent @code{make} programs can do this. Older +@code{make} programs do not support @code{VPATH}; when using them, the +source code must be in the same directory as the object files. + +To support @code{VPATH}, each @file{Makefile.in} should contain two +lines that look like: + +@example +srcdir = @@srcdir@@ +VPATH = @@srcdir@@ +@end example + +Do not set @code{VPATH} to the value of another variable, for example +@samp{VPATH = $(srcdir)}, because some versions of @code{make} do not do +variable substitutions on the value of @code{VPATH}. + +@code{configure} substitutes in the correct value for @code{srcdir} when +it produces @file{Makefile}. + +Do not use the @code{make} variable @code{$<}, which expands to the +file name of the file in the source directory (found with @code{VPATH}), +except in implicit rules. (An implicit rule is one such as @samp{.c.o}, +which tells how to create a @file{.o} file from a @file{.c} file.) Some +versions of @code{make} do not set @code{$<} in explicit rules; they +expand it to an empty value. + +Instead, @file{Makefile} command lines should always refer to source +files by prefixing them with @samp{$(srcdir)/}. For example: + +@example +time.info: time.texinfo + $(MAKEINFO) $(srcdir)/time.texinfo +@end example + +@node Automatic Remaking, , Build Directories, Makefile Substitutions +@subsection Automatic Remaking + +You can put rules like the following in the top-level @file{Makefile.in} +for a package to automatically update the configuration information when +you change the configuration files. This example includes all of the +optional files, such as @file{aclocal.m4} and those related to +configuration header files. Omit from the @file{Makefile.in} rules for +any of these files that your package does not use. + +The @samp{$(srcdir)/} prefix is included because of limitations in the +@code{VPATH} mechanism. + +The @file{stamp-} files are necessary because the timestamps of +@file{config.h.in} and @file{config.h} will not be changed if remaking +them does not change their contents. This feature avoids unnecessary +recompilation. You should include the file @file{stamp-h.in} your +package's distribution, so @command{make} will consider +@file{config.h.in} up to date. Don't use @command{touch} +(@pxref{Limitations of Usual Tools}), rather use @command{echo} (using +@command{date} would cause needless differences, hence @sc{cvs} +conflicts etc.). + +@example +@group +$(srcdir)/configure: configure.ac aclocal.m4 + cd $(srcdir) && autoconf + +# autoheader might not change config.h.in, so touch a stamp file. +$(srcdir)/config.h.in: stamp-h.in +$(srcdir)/stamp-h.in: configure.ac aclocal.m4 + cd $(srcdir) && autoheader + echo timestamp > $(srcdir)/stamp-h.in + +config.h: stamp-h +stamp-h: config.h.in config.status + ./config.status + +Makefile: Makefile.in config.status + ./config.status + +config.status: configure + ./config.status --recheck +@end group +@end example + +@noindent +(Be careful if you copy these lines directly into your Makefile, as you +will need to convert the indented lines to start with the tab character.) + +In addition, you should use @samp{AC_CONFIG_FILES(stamp-h, echo +timestamp > stamp-h)} so @file{config.status} will ensure that +@file{config.h} is considered up to date. @xref{Output}, for more +information about @code{AC_OUTPUT}. + +@xref{config.status Invocation}, for more examples of handling +configuration-related dependencies. + +@node Configuration Headers, Configuration Commands, Makefile Substitutions, Setup +@section Configuration Header Files +@cindex Configuration Header +@cindex @file{config.h} + +When a package tests more than a few C preprocessor symbols, the command +lines to pass @option{-D} options to the compiler can get quite long. +This causes two problems. One is that the @code{make} output is hard to +visually scan for errors. More seriously, the command lines can exceed +the length limits of some operating systems. As an alternative to +passing @option{-D} options to the compiler, @code{configure} scripts can +create a C header file containing @samp{#define} directives. The +@code{AC_CONFIG_HEADERS} macro selects this kind of output. It should +be called right after @code{AC_INIT}. + +The package should @samp{#include} the configuration header file before +any other header files, to prevent inconsistencies in declarations (for +example, if it redefines @code{const}). Use @samp{#include <config.h>} +instead of @samp{#include "config.h"}, and pass the C compiler a +@option{-I.} option (or @option{-I..}; whichever directory contains +@file{config.h}). That way, even if the source directory is configured +itself (perhaps to make a distribution), other build directories can +also be configured without finding the @file{config.h} from the source +directory. + +@defmac AC_CONFIG_HEADERS (@var{header} @dots{}, @ovar{cmds}, @ovar{init-cmds}) +@maindex CONFIG_HEADERS +@cvindex HAVE_CONFIG_H +This macro is one of the instantiating macros, see @ref{Configuration +Actions}. Make @code{AC_OUTPUT} create the file(s) in the +whitespace-separated list @var{header} containing C preprocessor +@code{#define} statements, and replace @samp{@@DEFS@@} in generated +files with @option{-DHAVE_CONFIG_H} instead of the value of @code{DEFS}. +The usual name for @var{header} is @file{config.h}. + +If @var{header} already exists and its contents are identical to what +@code{AC_OUTPUT} would put in it, it is left alone. Doing this allows +some changes in configuration without needlessly causing object files +that depend on the header file to be recompiled. + +Usually the input file is named @file{@var{header}.in}; however, you can +override the input file name by appending to @var{header}, a +colon-separated list of input files. Examples: + +@example +AC_CONFIG_HEADERS(config.h:config.hin) +AC_CONFIG_HEADERS(defines.h:defs.pre:defines.h.in:defs.post) +@end example + +@noindent +Doing this allows you to keep your file names acceptable to MS-DOS, or +to prepend and/or append boilerplate to the file. +@end defmac + +@xref{Configuration Actions}, for more details on @var{header}. + +@menu +* Header Templates:: Input for the configuration headers +* autoheader Invocation:: How to create configuration templates +* Autoheader Macros:: How to specify CPP templates +@end menu + +@node Header Templates, autoheader Invocation, Configuration Headers, Configuration Headers +@subsection Configuration Header Templates +@cindex Configuration Header Template +@cindex @file{config.h.in} + +Your distribution should contain a template file that looks as you want +the final header file to look, including comments, with @code{#undef} +statements which are used as hooks. For example, suppose your +@file{configure.ac} makes these calls: + +@example +AC_CONFIG_HEADERS(conf.h) +AC_CHECK_HEADERS(unistd.h) +@end example + +@noindent +Then you could have code like the following in @file{conf.h.in}. On +systems that have @file{unistd.h}, @code{configure} will @samp{#define} +@samp{HAVE_UNISTD_H} to 1. On other systems, the whole line will be +commented out (in case the system predefines that symbol). + +@example +@group +/* Define as 1 if you have unistd.h. */ +#undef HAVE_UNISTD_H +@end group +@end example + +You can then decode the configuration header using the preprocessor +directives: + +@example +@group +#include <conf.h> + +#if HAVE_UNISTD_H +# include <unistd.h> +#else +/* We are in trouble. */ +#endif +@end group +@end example + +The use of old form templates, with @samp{#define} instead of +@samp{#undef} is strongly discouraged. + +Since it is a tedious task to keep a template header up to date, you may +use @code{autoheader} to generate it, see @ref{autoheader Invocation}. + + +@node autoheader Invocation, Autoheader Macros, Header Templates, Configuration Headers +@subsection Using @code{autoheader} to Create @file{config.h.in} +@cindex @code{autoheader} + +The @command{autoheader} program can create a template file of C +@samp{#define} statements for @code{configure} to use. If +@file{configure.ac} invokes @code{AC_CONFIG_HEADERS(@var{file})}, +@command{autoheader} creates @file{@var{file}.in}; if multiple file +arguments are given, the first one is used. Otherwise, +@command{autoheader} creates @file{config.h.in}. + +In order to do its job, @command{autoheader} needs you to document all +of the symbols that you might use; i.e., there must be at least one +@code{AC_DEFINE} or one @code{AC_DEFINE_UNQUOTED} using its third +argument for each symbol (@pxref{Defining Symbols}). An additional +constraint is that the first argument of @code{AC_DEFINE} must be a +literal. Note that all symbols defined by Autoconf's built-in tests are +already documented properly; you only need to document those that you +define yourself. + +You might wonder why @command{autoheader} is needed: after all, why +would @command{configure} need to ``patch'' a @file{config.h.in} to +produce a @file{config.h} instead of just creating @file{config.h} from +scratch? Well, when everything rocks, the answer is just that we are +wasting our time maintaining @command{autoheader}: generating +@file{config.h} directly is all that is needed. When things go wrong, +however, you'll be thankful for the existence of @command{autoheader}. + +The fact that the symbols are documented is important in order to +@emph{check} that @file{config.h} makes sense. The fact that there is a +well defined list of symbols that should be @code{#define}'d (or not) is +also important for people who are porting packages to environments where +@command{configure} cannot be run: they just have to @emph{fill in the +blanks}. + +But let's come back to the point: @command{autoheader}'s invocation@dots{} + +If you give @command{autoheader} an argument, it uses that file instead +of @file{configure.ac} and writes the header file to the standard output +instead of to @file{config.h.in}. If you give @command{autoheader} an +argument of @option{-}, it reads the standard input instead of +@file{configure.ac} and writes the header file to the standard output. + +@code{autoheader} accepts the following options: + +@table @option +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@item --version +@itemx -V +Print the version number of Autoconf and exit. + +@item --debug +@itemx -d +Don't remove the temporary files. + +@item --verbose +@itemx -v +Report processing steps. + +@item --autoconf-dir=@var{dir} +@itemx -A @var{dir} +@evindex AC_MACRODIR +Override the location where the installed Autoconf data files are looked +for. You can also set the @code{AC_MACRODIR} environment variable to a +directory; this option overrides the environment variable. + +This option is rarely needed and dangerous; it is only used when one +plays with different versions of Autoconf simultaneously. + +@item --localdir=@var{dir} +@itemx -l @var{dir} +Look for the package files @file{aclocal.m4} and @file{acconfig.h} (but +not @file{@var{file}.top} and @file{@var{file}.bot}) in directory +@var{dir} instead of in the current directory. + +@item --warnings=@var{category} +@itemx -W @var{category} +@evindex WARNINGS +Report the warnings related to @var{category} (which can actually be a +comma separated list). Current categories include: + +@table @samp +@item obsolete +report the uses of obsolete constructs + +@item all +report all the warnings + +@item none +report none + +@item error +treats warnings as errors + +@item no-@var{category} +disable warnings falling into @var{category} +@end table + +@end table + + + +@node Autoheader Macros, , autoheader Invocation, Configuration Headers +@subsection Autoheader Macros + +@code{autoheader} scans @file{configure.ac} and figures out which C +preprocessor symbols it might define. It knows how to generate +templates for symbols defined by @code{AC_CHECK_HEADERS}, +@code{AC_CHECK_FUNCS} etc., but if you @code{AC_DEFINE} any additional +symbol, you must define a template for it. If there are missing +templates, @code{autoheader} fails with an error message. + +The simplest way to create a template for a @var{symbol} is to supply +the @var{description} argument to an @samp{AC_DEFINE(@var{symbol})}; see +@ref{Defining Symbols}. You may also use one of the following macros. + +@defmac AH_VERBATIM (@var{key}, @var{template}) +@maindex AH_VERBATIM +@maindex VERBATIM +Tell @code{autoheader} to include the @var{template} as-is in the header +template file. This @var{template} is associated with the @var{key}, +which is used to sort all the different templates and guarantee their +uniqueness. It should be the symbol that can be @code{AC_DEFINE}'d. + +For example: + +@example +AH_VERBATIM([_GNU_SOURCE], +[/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE +#endif]) +@end example +@end defmac + + +@defmac AH_TEMPLATE (@var{key}, @var{description}) +@maindex AH_TEMPLATE +@maindex TEMPLATE +Tell @code{autoheader} to generate a template for @var{key}. This macro +generates standard templates just like @code{AC_DEFINE} when a +@var{description} is given. + +For example: + +@example +AH_TEMPLATE([CRAY_STACKSEG_END], + [Define to one of _getb67, GETB67, getb67 + for Cray-2 and Cray-YMP systems. This + function is required for alloca.c support + on those systems.]) +@end example + +@noindent +will generate the following template, with the description properly +justified. + +@example +/* Define to one of _getb67, GETB67, getb67 for Cray-2 and + Cray-YMP systems. This function is required for alloca.c + support on those systems. */ +#undef CRAY_STACKSEG_END +@end example +@end defmac + + +@defmac AH_TOP (@var{text}) +@maindex AH_TOP +@maindex TOP +Include @var{text} at the top of the header template file. +@end defmac + + +@defmac AH_BOTTOM (@var{text}) +@maindex AH_BOTTOM +@maindex BOTTOM +Include @var{text} at the bottom of the header template file. +@end defmac + + +@node Configuration Commands, Configuration Links, Configuration Headers, Setup +@section Running Arbitrary Configuration Commands + +You execute arbitrary commands either before, during and after +@file{config.status} is run. The three following macros accumulate the +commands to run when they are called multiple times. +@code{AC_CONFIG_COMMANDS} replaces the obsolete macro +@code{AC_OUTPUT_COMMANDS}, see @ref{Obsolete Macros}, for details. + +@defmac AC_CONFIG_COMMANDS (@var{tag}@dots{}, @ovar{cmds}, @ovar{init-cmds}) +@maindex CONFIG_COMMANDS +Specify additional shell commands to run at the end of +@file{config.status}, and shell commands to initialize any variables +from @code{configure}. Associate the commands to the @var{tag}. Since +typically the @var{cmds} create a file, @var{tag} should naturally be +the name of that file. This macro is one of the instantiating macros, +see @ref{Configuration Actions}. + +Here is an unrealistic example: +@example +fubar=42 +AC_CONFIG_COMMANDS(fubar, + [echo this is extra $fubar, and so on.], + [fubar=$fubar]) +@end example + +Here is a better one: +@example +AC_CONFIG_COMMANDS(time-stamp, [date >time-stamp]) +@end example +@end defmac + +@defmac AC_CONFIG_COMMANDS_PRE (@var{cmds}) +@maindex OUTPUT_COMMANDS_PRE +Execute the @var{cmds} right before creating @file{config.status}. A +typical use is computing values derived from variables built during the +execution of @code{configure}: + +@example +AC_CONFIG_COMMANDS_PRE( +[LTLIBOBJS=`echo $LIBOBJS | sed 's/\.o/\.lo/g'` +AC_SUBST(LTLIBOBJS)]) +@end example +@end defmac + +@defmac AC_CONFIG_COMMANDS_POST (@var{cmds}) +@maindex OUTPUT_COMMANDS_POST +Execute the @var{cmds} right after creating @file{config.status}. +@end defmac + + + + +@node Configuration Links, Subdirectories, Configuration Commands, Setup +@section Creating Configuration Links + +You may find it convenient to create links whose destinations depend upon +results of tests. One can use @code{AC_CONFIG_COMMANDS} but the +creation of relative symbolic links can be delicate when the package is +built in another directory than its sources. + +@defmac AC_CONFIG_LINKS (@var{dest}:@var{source}@dots{}, @ovar{cmds}, @ovar{init-cmds}) +@maindex CONFIG_LINKS +@cindex Links +Make @code{AC_OUTPUT} link each of the existing files @var{source} to +the corresponding link name @var{dest}. Makes a symbolic link if +possible, otherwise a hard link. The @var{dest} and @var{source} names +should be relative to the top level source or build directory. This +macro is one of the instantiating macros, see @ref{Configuration +Actions}. + +For example, this call: + +@example +AC_CONFIG_LINKS(host.h:config/$machine.h + object.h:config/$obj_format.h) +@end example + +@noindent +creates in the current directory @file{host.h} as a link to +@file{@var{srcdir}/config/$machine.h}, and @file{object.h} as a +link to @file{@var{srcdir}/config/$obj_format.h}. + +The tempting value @samp{.} for @var{dest} is invalid: it makes it +impossible for @samp{config.status} to guess the links to establish. + +One can then run: +@example +./config.status host.h object.h +@end example +@noindent +to create the links. +@end defmac + + + +@node Subdirectories, Default Prefix, Configuration Links, Setup +@section Configuring Other Packages in Subdirectories + +In most situations, calling @code{AC_OUTPUT} is sufficient to produce +@file{Makefile}s in subdirectories. However, @code{configure} scripts +that control more than one independent package can use +@code{AC_CONFIG_SUBDIRS} to run @code{configure} scripts for other +packages in subdirectories. + +@defmac AC_CONFIG_SUBDIRS (@var{dir} @dots{}) +@maindex CONFIG_SUBDIRS +@ovindex subdirs +Make @code{AC_OUTPUT} run @code{configure} in each subdirectory +@var{dir} in the given whitespace-separated list. Each @var{dir} should +be a literal, i.e., please do not use: + +@example +if test "$package_foo_enabled" = yes; then + $my_subdirs="$my_subdirs foo" +fi +AC_CONFIG_SUBDIRS($my_subdirs) +@end example + +@noindent +because this prevents @samp{./configure --help=recursive} from +displaying the options of the package @code{foo}. Rather, you should +write: + +@example +if test "$package_foo_enabled" = yes then; + AC_CONFIG_SUBDIRS(foo) +fi +@end example + +If a given @var{dir} is not found, no error is reported, so a +@code{configure} script can configure whichever parts of a large source +tree are present. If a given @var{dir} contains @code{configure.gnu}, +it is run instead of @code{configure}. This is for packages that might +use a non-autoconf script @code{Configure}, which can't be called +through a wrapper @code{configure} since it would be the same file on +case-insensitive filesystems. Likewise, if a @var{dir} contains +@file{configure.ac} but no @code{configure}, the Cygnus @code{configure} +script found by @code{AC_CONFIG_AUX_DIR} is used. + +The subdirectory @code{configure} scripts are given the same command +line options that were given to this @code{configure} script, with minor +changes if needed (e.g., to adjust a relative path for the cache file or +source directory). This macro also sets the output variable +@code{subdirs} to the list of directories @samp{@var{dir} @dots{}}. +@file{Makefile} rules can use this variable to determine which +subdirectories to recurse into. This macro may be called multiple +times. +@end defmac + +@node Default Prefix, , Subdirectories, Setup +@section Default Prefix + +By default, @code{configure} sets the prefix for files it installs to +@file{/usr/local}. The user of @code{configure} can select a different +prefix using the @option{--prefix} and @option{--exec-prefix} options. +There are two ways to change the default: when creating +@code{configure}, and when running it. + +Some software packages might want to install in a directory besides +@file{/usr/local} by default. To accomplish that, use the +@code{AC_PREFIX_DEFAULT} macro. + +@defmac AC_PREFIX_DEFAULT (@var{prefix}) +@maindex PREFIX_DEFAULT +Set the default installation prefix to @var{prefix} instead of +@file{/usr/local}. +@end defmac + +It may be convenient for users to have @code{configure} guess the +installation prefix from the location of a related program that they +have already installed. If you wish to do that, you can call +@code{AC_PREFIX_PROGRAM}. + +@defmac AC_PREFIX_PROGRAM (@var{program}) +@maindex PREFIX_PROGRAM +If the user did not specify an installation prefix (using the +@option{--prefix} option), guess a value for it by looking for +@var{program} in @code{PATH}, the way the shell does. If @var{program} +is found, set the prefix to the parent of the directory containing +@var{program}; otherwise leave the prefix specified in +@file{Makefile.in} unchanged. For example, if @var{program} is +@code{gcc} and the @code{PATH} contains @file{/usr/local/gnu/bin/gcc}, +set the prefix to @file{/usr/local/gnu}. +@end defmac + + + +@c ======================================================== Existing tests + +@node Existing Tests, Writing Tests, Setup, Top +@chapter Existing Tests + +These macros test for particular system features that packages might +need or want to use. If you need to test for a kind of feature that +none of these macros check for, you can probably do it by calling +primitive test macros with appropriate arguments (@pxref{Writing +Tests}). + +These tests print messages telling the user which feature they're +checking for, and what they find. They cache their results for future +@code{configure} runs (@pxref{Caching Results}). + +Some of these macros set output variables. @xref{Makefile +Substitutions}, for how to get their values. The phrase ``define +@var{name}'' is used below as a shorthand to mean ``define C +preprocessor symbol @var{name} to the value 1''. @xref{Defining +Symbols}, for how to get those symbol definitions into your program. + +@menu +* Common Behavior:: Macros' standard schemes +* Alternative Programs:: Selecting between alternative programs +* Files:: Checking for the existence of files +* Libraries:: Library archives that might be missing +* Library Functions:: C library functions that might be missing +* Header Files:: Header files that might be missing +* Declarations:: Declarations that may be missing +* Structures:: Structures or members that might be missing +* Types:: Types that might be missing +* Compilers and Preprocessors:: Checking for compiling programs +* System Services:: Operating system services +* UNIX Variants:: Special kludges for specific UNIX variants +@end menu + +@node Common Behavior, Alternative Programs, Existing Tests, Existing Tests +@section Common Behavior + +Much effort has been expended to make Autoconf easy to learn. The most +obvious way to reach this goal is simply to enforce standard interfaces +and behaviors, avoiding exceptions as much as possible. Because of +history and inertia, unfortunately, there are still too many exceptions +in Autoconf; nevertheless, this section describes some of the common +rules. + +@menu +* Standard Symbols:: Symbols defined by the macros +* Default Includes:: Includes used by the generic macros +@end menu + +@node Standard Symbols, Default Includes, Common Behavior, Common Behavior +@subsection Standard Symbols + +All the generic macros that @code{AC_DEFINE} a symbol as a result of +their test transform their @var{argument}s to a standard alphabet. +First, @var{argument} is converted to upper case and any asterisks +(@samp{*}) are each converted to @samp{P}. Any remaining characters +that are not alphanumeric are converted to underscores. + +For instance, + +@example +AC_CHECK_TYPES(struct $Expensive*) +@end example + +@noindent +will define the symbol @samp{HAVE_STRUCT__EXPENSIVEP} if the check succeeds. + + +@node Default Includes, , Standard Symbols, Common Behavior +@subsection Default Includes +@cindex Includes, default + +Several tests depend upon a set of header files. Since these headers +are not universally available, tests actually have to provide a set of +protected includes, such as: + +@example +@group +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif +@end group +@end example + +@noindent +Unless you know exactly what you are doing, you should avoid using +unconditional includes, and check the existence of the headers you +include beforehand (@pxref{Header Files}). + +Most generic macros provide the following default set of includes: + +@example +@group +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif +@end group +@end example + +If the default includes are used, then Autoconf will automatically check +for the presence of these headers and their compatibility, i.e., you +don't need to run @code{AC_HEADERS_STDC}, nor check for @file{stdlib.h} +etc. + +These headers are checked for in the same order as they are included. +For instance, on some systems @file{string.h} and @file{strings.h} both +exist, but conflict. Then @code{HAVE_STRING_H} will be defined, but +@code{HAVE_STRINGS_H} won't. + +@node Alternative Programs, Files, Common Behavior, Existing Tests +@section Alternative Programs +@cindex Programs, checking + +These macros check for the presence or behavior of particular programs. +They are used to choose between several alternative programs and to +decide what to do once one has been chosen. If there is no macro +specifically defined to check for a program you need, and you don't need +to check for any special properties of it, then you can use one of the +general program-check macros. + +@menu +* Particular Programs:: Special handling to find certain programs +* Generic Programs:: How to find other programs +@end menu + +@node Particular Programs, Generic Programs, Alternative Programs, Alternative Programs +@subsection Particular Program Checks + +These macros check for particular programs---whether they exist, and +in some cases whether they support certain features. + +@defmac AC_PROG_AWK +@maindex PROG_AWK +@ovindex AWK +Check for @code{mawk}, @code{gawk}, @code{nawk}, and @code{awk}, in that +order, and set output variable @code{AWK} to the first one that is found. +It tries @code{mawk} first because that is reported to be the +fastest implementation. +@end defmac + + +@defmac AC_PROG_EGREP +@ovindex EGREP +Check for @code{grep -E}, @code{egrep} in that +order, and set output variable @code{EGREP} to the first one that is found. +@end defmac + + +@defmac AC_PROG_FGREP +@ovindex FGREP +Check for @code{grep -F}, @code{fgrep} in that +order, and set output variable @code{FGREP} to the first one that is found. +@end defmac + + +@defmac AC_PROG_GREP +@ovindex GREP +Check for @code{grep}, @code{ggrep} in that +order, and set output variable @code{GREP} to the first one that is found. +@end defmac + + +@defmac AC_PROG_INSTALL +@maindex PROG_INSTALL +@ovindex INSTALL +@ovindex INSTALL_PROGRAM +@ovindex INSTALL_DATA +@ovindex INSTALL_SCRIPT +Set output variable @code{INSTALL} to the path of a @sc{bsd} compatible +@code{install} program, if one is found in the current @code{PATH}. +Otherwise, set @code{INSTALL} to @samp{@var{dir}/install-sh -c}, +checking the directories specified to @code{AC_CONFIG_AUX_DIR} (or its +default directories) to determine @var{dir} (@pxref{Output}). Also set +the variables @code{INSTALL_PROGRAM} and @code{INSTALL_SCRIPT} to +@samp{$@{INSTALL@}} and @code{INSTALL_DATA} to @samp{$@{INSTALL@} -m 644}. + +This macro screens out various instances of @code{install} known not to +work. It prefers to find a C program rather than a shell script, for +speed. Instead of @file{install-sh}, it can also use @file{install.sh}, +but that name is obsolete because some @code{make} programs have a rule +that creates @file{install} from it if there is no @file{Makefile}. + +Autoconf comes with a copy of @file{install-sh} that you can use. If +you use @code{AC_PROG_INSTALL}, you must include either +@file{install-sh} or @file{install.sh} in your distribution, or +@code{configure} will produce an error message saying it can't find +them---even if the system you're on has a good @code{install} program. +This check is a safety measure to prevent you from accidentally leaving +that file out, which would prevent your package from installing on +systems that don't have a @sc{bsd}-compatible @code{install} program. + +If you need to use your own installation program because it has features +not found in standard @code{install} programs, there is no reason to use +@code{AC_PROG_INSTALL}; just put the file name of your program into your +@file{Makefile.in} files. +@end defmac + +@defmac AC_PROG_LEX +@maindex PROG_LEX +@ovindex LEX +@ovindex LEXLIB +@cvindex YYTEXT_POINTER +@ovindex LEX_OUTPUT_ROOT +If @code{flex} is found, set output variable @code{LEX} to @samp{flex} +and @code{LEXLIB} to @option{-lfl}, if that library is in a standard +place. Otherwise set @code{LEX} to @samp{lex} and @code{LEXLIB} to +@option{-ll}. + +Define @code{YYTEXT_POINTER} if @code{yytext} is a @samp{char *} instead +of a @samp{char []}. Also set output variable @code{LEX_OUTPUT_ROOT} to +the base of the file name that the lexer generates; usually +@file{lex.yy}, but sometimes something else. These results vary +according to whether @code{lex} or @code{flex} is being used. + +You are encouraged to use Flex in your sources, since it is both more +pleasant to use than plain Lex and the C source it produces is portable. +In order to ensure portability, however, you must either provide a +function @code{yywrap} or, if you don't use it (e.g., your scanner has +no @samp{#include}-like feature), simply include a @samp{%noyywrap} +statement in the scanner's source. Once this done, the scanner is +portable (unless @emph{you} felt free to use nonportable constructs) and +does not depend on any library. In this case, and in this case only, it +is suggested that you use this Autoconf snippet: + +@example +AC_PROG_LEX +if test "$LEX" != flex; then + LEX="$SHELL $missing_dir/missing flex" + AC_SUBST(LEX_OUTPUT_ROOT, lex.yy) + AC_SUBST(LEXLIB, '') +fi +@end example + +The shell script @command{missing} can be found in the Automake +distribution. + +To ensure backward compatibility, Automake's @code{AM_PROG_LEX} invokes +(indirectly) this macro twice, which will cause an annoying but benign +``@code{AC_PROG_LEX} invoked multiple times'' warning. Future versions +of Automake will fix this issue, meanwhile, just ignore this message. +@end defmac + +@defmac AC_PROG_LN_S +@maindex PROG_LN_S +@ovindex LN_S +If @samp{ln -s} works on the current file system (the operating system +and file system support symbolic links), set the output variable +@code{LN_S} to @samp{ln -s}; otherwise, if @samp{ln} works, set +@code{LN_S} to @samp{ln} and otherwise set it to @samp{cp -p}. + +If you make a link a directory other than the current directory, its +meaning depends on whether @samp{ln} or @samp{ln -s} is used. To safely +create links using @samp{$(LN_S)}, either find out which form is used +and adjust the arguments, or always invoke @code{ln} in the directory +where the link is to be created. + +In other words, it does not work to do: +@example +$(LN_S) foo /x/bar +@end example + +Instead, do: + +@example +(cd /x && $(LN_S) foo bar) +@end example +@end defmac + +@defmac AC_PROG_RANLIB +@maindex PROG_RANLIB +@ovindex RANLIB +Set output variable @code{RANLIB} to @samp{ranlib} if @code{ranlib} +is found, and otherwise to @samp{:} (do nothing). +@end defmac + +@defmac AC_PROG_YACC +@maindex PROG_YACC +@ovindex YACC +If @code{byacc} is found, set @code{YACC} to @samp{byacc}. +Otherwise, if @code{bison} is found, +set output variable @code{YACC} to @samp{bison -y}. +Finally, if neither @code{byacc} or @code{bison} is found, +set @code{YACC} to @samp{yacc}. +@end defmac + +@node Generic Programs, , Particular Programs, Alternative Programs +@subsection Generic Program and File Checks + +These macros are used to find programs not covered by the ``particular'' +test macros. If you need to check the behavior of a program as well as +find out whether it is present, you have to write your own test for it +(@pxref{Writing Tests}). By default, these macros use the environment +variable @code{PATH}. If you need to check for a program that might not +be in the user's @code{PATH}, you can pass a modified path to use +instead, like this: + +@example +AC_PATH_PROG(INETD, inetd, /usr/libexec/inetd, + $PATH:/usr/libexec:/usr/sbin:/usr/etc:etc) +@end example + +You are strongly encouraged to declare the @var{variable} passed to +@code{AC_CHECK_PROG} etc. as precious, @xref{Setting Output Variables}, +@code{AC_ARG_VAR}, for more details. + +@defmac AC_CHECK_PROG (@var{variable}, @var{prog-to-check-for}, @var{value-if-found}, @ovar{value-if-not-found}, @ovar{path}, @ovar{reject}) +@maindex CHECK_PROG +Check whether program @var{prog-to-check-for} exists in @code{PATH}. If +it is found, set @var{variable} to @var{value-if-found}, otherwise to +@var{value-if-not-found}, if given. Always pass over @var{reject} (an +absolute file name) even if it is the first found in the search path; in +that case, set @var{variable} using the absolute file name of the +@var{prog-to-check-for} found that is not @var{reject}. If +@var{variable} was already set, do nothing. Calls @code{AC_SUBST} for +@var{variable}. +@end defmac + +@defmac AC_CHECK_PROGS (@var{variable}, @var{progs-to-check-for}, @ovar{value-if-not-found}, @ovar{path}) +@maindex CHECK_PROGS +Check for each program in the whitespace-separated list +@var{progs-to-check-for} exists on the @code{PATH}. If it is found, set +@var{variable} to the name of that program. Otherwise, continue +checking the next program in the list. If none of the programs in the +list are found, set @var{variable} to @var{value-if-not-found}; if +@var{value-if-not-found} is not specified, the value of @var{variable} +is not changed. Calls @code{AC_SUBST} for @var{variable}. +@end defmac + +@defmac AC_CHECK_TOOL (@var{variable}, @var{prog-to-check-for}, @ovar{value-if-not-found}, @ovar{path}) +@maindex CHECK_TOOL +Like @code{AC_CHECK_PROG}, but first looks for @var{prog-to-check-for} +with a prefix of the host type as determined by +@code{AC_CANONICAL_HOST}, followed by a dash (@pxref{Canonicalizing}). +For example, if the user runs @samp{configure --host=i386-gnu}, then +this call: +@example +AC_CHECK_TOOL(RANLIB, ranlib, :) +@end example +@noindent +sets @code{RANLIB} to @file{i386-gnu-ranlib} if that program exists in +@code{PATH}, or otherwise to @samp{ranlib} if that program exists in +@code{PATH}, or to @samp{:} if neither program exists. +@end defmac + +@defmac AC_CHECK_TOOLS (@var{variable}, @var{progs-to-check-for}, @ovar{value-if-not-found}, @ovar{path}) +@maindex CHECK_TOOLS +Like @code{AC_CHECK_TOOL}, each of the tools in the list @var{progs-to-check-for} are +checked with a prefix of the host type as determined by @code{AC_CANONICAL_HOST}, +followed by a dash (@pxref{Canonicalizing}). If none of the tools can be found with a +prefix, then the first one without a prefix is used. If a tool is found, set +@var{variable} to the name of that program. If none of the tools in the +list are found, set @var{variable} to @var{value-if-not-found}; if +@var{value-if-not-found} is not specified, the value of @var{variable} +is not changed. Calls @code{AC_SUBST} for @var{variable}. +@end defmac + +@defmac AC_PATH_PROG (@var{variable}, @var{prog-to-check-for}, @ovar{value-if-not-found}, @ovar{path}) +@maindex PATH_PROG +Like @code{AC_CHECK_PROG}, but set @var{variable} to the entire +path of @var{prog-to-check-for} if found. +@end defmac + +@defmac AC_PATH_PROGS (@var{variable}, @var{progs-to-check-for}, @ovar{value-if-not-found}, @ovar{path}) +@maindex PATH_PROGS +Like @code{AC_CHECK_PROGS}, but if any of @var{progs-to-check-for} +are found, set @var{variable} to the entire path of the program +found. +@end defmac + +@defmac AC_PATH_TOOL (@var{variable}, @var{prog-to-check-for}, @ovar{value-if-not-found}, @ovar{path}) +@maindex PATH_TOOL +Like @code{AC_CHECK_TOOL}, but set @var{variable} to the entire +path of the program if it is found. +@end defmac + + +@node Files, Libraries, Alternative Programs, Existing Tests +@section Files +@cindex File, checking + +You might also need to check for the existence of files. Before using +these macros, ask yourself whether a run time test might not be a better +solution. Be aware that, like most Autoconf macros, they test a feature +of the host machine, and therefore, they die when cross-compiling. + +@defmac AC_CHECK_FILE (@var{file}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@maindex CHECK_FILE +Check whether file @var{file} exists on the native system. If it is +found, execute @var{action-if-found}, otherwise do +@var{action-if-not-found}, if given. +@end defmac + +@defmac AC_CHECK_FILES (@var{files}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@maindex CHECK_FILES +Executes @code{AC_CHECK_FILE} once for each file listed in @var{files}. +Additionally, defines @samp{HAVE_@var{file}} (@pxref{Standard Symbols}) +for each file found. +@end defmac + + +@node Libraries, Library Functions, Files, Existing Tests +@section Library Files +@cindex Library, checking + +The following macros check for the presence of certain C, C++ or Fortran +77 library archive files. + +@defmac AC_CHECK_LIB (@var{library}, @var{function}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{other-libraries}) +@maindex CHECK_LIB +Depending on the current language(@pxref{Language Choice}), try to +ensure that the C, C++, or Fortran 77 function @var{function} is +available by checking whether a test program can be linked with the +library @var{library} to get the function. @var{library} is the base +name of the library; e.g., to check for @option{-lmp}, use @samp{mp} as +the @var{library} argument. + +@var{action-if-found} is a list of shell commands to run if the link +with the library succeeds; @var{action-if-not-found} is a list of shell +commands to run if the link fails. If @var{action-if-found} is not +specified, the default action will prepend @option{-l@var{library}} to +@code{LIBS} and define @samp{HAVE_LIB@var{library}} (in all +capitals). This macro is intended to support building of @code{LIBS} in +a right-to-left (least-dependent to most-dependent) fashion such that +library dependencies are satisfied as a natural side-effect of +consecutive tests. Some linkers are very sensitive to library ordering +so the order in which @code{LIBS} is generated is important to reliable +detection of libraries. + +If linking with @var{library} results in unresolved symbols that would +be resolved by linking with additional libraries, give those libraries +as the @var{other-libraries} argument, separated by spaces: +e.g. @option{-lXt -lX11}. Otherwise, this macro will fail to detect +that @var{library} is present, because linking the test program will +always fail with unresolved symbols. The @var{other-libraries} argument +should be limited to cases where it is desirable to test for one library +in the presence of another that is not already in @code{LIBS}. +@end defmac + + +@defmac AC_SEARCH_LIBS (@var{function}, @var{search-libs}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{other-libraries}) +@maindex SEARCH_LIBS +Search for a library defining @var{function} if it's not already +available. This equates to calling @code{AC_TRY_LINK_FUNC} first +with no libraries, then for each library listed in @var{search-libs}. + +Add @option{-l@var{library}} to @code{LIBS} for the first library found +to contain @var{function}, and run @var{action-if-found}. If the +function is not found, run @var{action-if-not-found}. + +If linking with @var{library} results in unresolved symbols that would +be resolved by linking with additional libraries, give those libraries +as the @var{other-libraries} argument, separated by spaces: +e.g. @option{-lXt -lX11}. Otherwise, this macro will fail to detect +that @var{function} is present, because linking the test program will +always fail with unresolved symbols. +@end defmac + + + +@node Library Functions, Header Files, Libraries, Existing Tests +@section Library Functions + +The following macros check for particular C library functions. +If there is no macro specifically defined to check for a function you need, +and you don't need to check for any special properties of +it, then you can use one of the general function-check macros. + +@menu +* Function Portability:: Pitfalls with usual functions +* Particular Functions:: Special handling to find certain functions +* Generic Functions:: How to find other functions +@end menu + +@node Function Portability, Particular Functions, Library Functions, Library Functions +@subsection Portability of Classical Functions + +Most usual functions can either be missing, or be buggy, or be limited +on some architectures. This section tries to make an inventory of these +portability issues. By definition, this list will always require +additions, please help us keeping it as complete as possible + +@table @code + +@item unlink +The @sc{posix} spec says that @code{unlink} causes the given files to be +removed only after there are no more open file handles for it. Not all +OS's support this behaviour though. So even on systems that provide +@code{unlink}, you cannot portably assume it is OK to call it on files +that are open. For example, on Windows 9x and ME, such a call would fail; +on DOS it could even lead to file system corruption, as the file might end +up being written to after the OS has removed it. + +@end table + + +@node Particular Functions, Generic Functions, Function Portability, Library Functions +@subsection Particular Function Checks +@cindex Function, checking + +These macros check for particular C functions---whether they exist, and +in some cases how they respond when given certain arguments. + +@defmac AC_FUNC_ALLOCA +@maindex FUNC_ALLOCA +@cvindex C_ALLOCA +@cvindex HAVE_ALLOCA_H +@ovindex ALLOCA +Check how to get @code{alloca}. Tries to get a builtin version by +checking for @file{alloca.h} or the predefined C preprocessor macros +@code{__GNUC__} and @code{_AIX}. If this macro finds @file{alloca.h}, +it defines @code{HAVE_ALLOCA_H}. + +If those attempts fail, it looks for the function in the standard C +library. If any of those methods succeed, it defines +@code{HAVE_ALLOCA}. Otherwise, it sets the output variable +@code{ALLOCA} to @samp{alloca.o} and defines @code{C_ALLOCA} (so +programs can periodically call @samp{alloca(0)} to garbage collect). +This variable is separate from @code{LIBOBJS} so multiple programs can +share the value of @code{ALLOCA} without needing to create an actual +library, in case only some of them use the code in @code{LIBOBJS}. + +This macro does not try to get @code{alloca} from the System V R3 +@file{libPW} or the System V R4 @file{libucb} because those libraries +contain some incompatible functions that cause trouble. Some versions +do not even contain @code{alloca} or contain a buggy version. If you +still want to use their @code{alloca}, use @code{ar} to extract +@file{alloca.o} from them instead of compiling @file{alloca.c}. + +Source files that use @code{alloca} should start with a piece of code +like the following, to declare it properly. In some versions of AIX, +the declaration of @code{alloca} must precede everything else except for +comments and preprocessor directives. The @code{#pragma} directive is +indented so that pre-@sc{ansi} C compilers will ignore it, rather than +choke on it. + +@example +@group +/* AIX requires this to be the first thing in the file. */ +#ifndef __GNUC__ +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +#endif +@end group +@end example +@end defmac + +@defmac AC_FUNC_CHOWN +@maindex FUNC_CHOWN +If the @code{chown} function is available and works (in particular, it +should accept @option{-1} for @code{uid} and @code{gid}), define +@code{HAVE_CHOWN}. +@end defmac + + +@defmac AC_FUNC_CLOSEDIR_VOID +@maindex FUNC_CLOSEDIR_VOID +@cvindex CLOSEDIR_VOID +If the @code{closedir} function does not return a meaningful value, +define @code{CLOSEDIR_VOID}. Otherwise, callers ought to check its +return value for an error indicator. +@end defmac + +@defmac AC_FUNC_ERROR_AT_LINE +@maindex FUNC_ERROR_AT_LINE +If the @code{error_at_line} function is not found, require an +@code{AC_LIBOBJ} replacement of @samp{error}. +@end defmac + +@defmac AC_FUNC_FNMATCH +@maindex FUNC_FNMATCH +If the @code{fnmatch} function is available and works (unlike the one on +Solaris 2.4), define @code{HAVE_FNMATCH}. +@end defmac + +@defmac AC_FUNC_FORK +@maindex FUNC_FORK +@cvindex HAVE_VFORK_H +@cvindex HAVE_WORKING_FORK +@cvindex HAVE_WORKING_VFORK +@cvindex vfork +This macro checks for the @code{fork} and @code{vfork} functions. If a +working @code{fork} is found, define @code{HAVE_WORKING_FORK}. This macro +checks whether @code{fork} is just a stub by trying to run it. + +If @file{vfork.h} is found, define @code{HAVE_VFORK_H}. If a working +@code{vfork} is found, define @code{HAVE_WORKING_VFORK}. Otherwise, +define @code{vfork} to be @code{fork} for backward compatibility with +previous versions of @command{autoconf}. This macro checks for several known +errors in implementations of @code{vfork} and considers the system to not +have a working @code{vfork} if it detects any of them. It is not considered +to be an implementation error if a child's invocation of @code{signal} +modifies the parent's signal handler, since child processes rarely change +their signal handlers. + +Since this macro defines @code{vfork} only for backward compatibility with +previous versions of @command{autoconf} you're encouraged to define it +yourself in new code: +@example +@group +#if !HAVE_WORKING_VFORK +# define vfork fork +#endif +@end group +@end example +@end defmac + +@defmac AC_FUNC_FSEEKO +@maindex FUNC_FSEEKO +@cvindex _LARGEFILE_SOURCE +If the @code{fseeko} function is available, define @code{HAVE_FSEEKO}. +Define @code{_LARGEFILE_SOURCE} if necessary. +@end defmac + +@defmac AC_FUNC_GETGROUPS +@maindex FUNC_GETGROUPS +@ovindex GETGROUPS_LIBS +If the @code{getgroups} function is available and works (unlike on +Ultrix 4.3, where @samp{getgroups (0, 0)} always fails), define +@code{HAVE_GETGROUPS}. Set @code{GETGROUPS_LIBS} to any libraries +needed to get that function. This macro runs @code{AC_TYPE_GETGROUPS}. +@end defmac + +@defmac AC_FUNC_GETLOADAVG +@maindex FUNC_GETLOADAVG +@cvindex SVR4 +@cvindex DGUX +@cvindex UMAX +@cvindex UMAX4_3 +@cvindex NLIST_STRUCT +@cvindex NLIST_NAME_UNION +@cvindex GETLODAVG_PRIVILEGED +@cvindex NEED_SETGID +@cvindex C_GETLOADAVG +@ovindex LIBOBJS +@ovindex NEED_SETGID +@ovindex KMEM_GROUP +@ovindex GETLOADAVG_LIBS +Check how to get the system load averages. If the system has the +@code{getloadavg} function, define @code{HAVE_GETLOADAVG}, and set +@code{GETLOADAVG_LIBS} to any libraries needed to get that function. +Also add @code{GETLOADAVG_LIBS} to @code{LIBS}. + +Otherwise, require an @code{AC_LIBOBJ} replacement (@file{getloadavg.c}) +of @samp{getloadavg}, and possibly define several other C preprocessor +macros and output variables: + +@enumerate +@item +Define @code{C_GETLOADAVG}. + +@item +Define @code{SVR4}, @code{DGUX}, @code{UMAX}, or @code{UMAX4_3} if on +those systems. + +@item +If @file{nlist.h} is found, define @code{NLIST_STRUCT}. + +@item +If @samp{struct nlist} has an @samp{n_un.n_name} member, define +@code{HAVE_STRUCT_NLIST_N_UN_N_NAME}. The obsolete symbol +@code{NLIST_NAME_UNION} is still defined, but do not depend upon it. + +@item +Programs may need to be installed setgid (or setuid) for +@code{getloadavg} to work. In this case, define +@code{GETLOADAVG_PRIVILEGED}, set the output variable @code{NEED_SETGID} +to @samp{true} (and otherwise to @samp{false}), and set +@code{KMEM_GROUP} to the name of the group that should own the installed +program. +@end enumerate +@end defmac + +@defmac AC_FUNC_GETMNTENT +@maindex FUNC_GETMNTENT +@cvindex HAVE_GETMNTENT +Check for @code{getmntent} in the @file{sun}, @file{seq}, and @file{gen} +libraries, for Irix 4, PTX, and Unixware, respectively. Then, if +@code{getmntent} is available, define @code{HAVE_GETMNTENT}. +@end defmac + +@defmac AC_FUNC_GETPGRP +@maindex FUNC_GETPGRP +@cvindex GETPGRP_VOID +If @code{getpgrp} takes no argument (the @sc{posix.1} version), define +@code{GETPGRP_VOID}. Otherwise, it is the @sc{bsd} version, which takes +a process ID as an argument. This macro does not check whether +@code{getpgrp} exists at all; if you need to work in that situation, +first call @code{AC_CHECK_FUNC} for @code{getpgrp}. +@end defmac + +@defmac AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +@maindex FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK +@cvindex LSTAT_FOLLOWS_SLASHED_SYMLINK +If @file{link} is a symbolic link, then @code{lstat} should treat +@file{link/} the same as @file{link/.}. However, many older +@code{lstat} implementations incorrectly ignore trailing slashes. + +It is safe to assume that if @code{lstat} incorrectly ignores +trailing slashes, then other symbolic-link-aware functions like +@code{unlink} and @code{unlink} also incorrectly ignore trailing slashes. + +If @code{lstat} behaves properly, define +@code{LSTAT_FOLLOWS_SLASHED_SYMLINK}, otherwise require an +@code{AC_LIBOBJ} replacement of @code{lstat}. +@end defmac + +@defmac AC_FUNC_MALLOC +@maindex FUNC_MALLOC +If the @code{malloc} works correctly (@samp{malloc (0)} returns a valid +pointer), define @code{HAVE_MALLOC}. +@end defmac + +@defmac AC_FUNC_MEMCMP +@maindex FUNC_MEMCMP +@ovindex LIBOBJS +If the @code{memcmp} function is not available, or does not work on +8-bit data (like the one on SunOS 4.1.3), or fails when comparing 16 +bytes or more and with at least one buffer not starting on a 4-byte +boundary (such as the one on NeXT x86 OpenStep), require an +@code{AC_LIBOBJ} replacement for @samp{memcmp}. +@end defmac + +@defmac AC_FUNC_MKTIME +@maindex FUNC_MKTIME +@ovindex LIBOBJS +If the @code{mktime} function is not available, or does not work +correctly, require an @code{AC_LIBOBJ} replacement for @samp{mktime}. +@end defmac + +@defmac AC_FUNC_MMAP +@maindex FUNC_MMAP +@cvindex HAVE_MMAP +If the @code{mmap} function exists and works correctly, define +@code{HAVE_MMAP}. Only checks private fixed mapping of already-mapped +memory. +@end defmac + +@defmac AC_FUNC_OBSTACK +@maindex FUNC_OBSTACK +@cvindex HAVE_OBSTACK +@cindex obstack +If the obstacks are found, define @code{HAVE_OBSTACK}, else require an +@code{AC_LIBOBJ} replacement for @samp{obstack}. +@end defmac + +@defmac AC_FUNC_SELECT_ARGTYPES +@maindex FUNC_SELECT_ARGTYPES +@cvindex SELECT_TYPE_ARG1 +@cvindex SELECT_TYPE_ARG234 +@cvindex SELECT_TYPE_ARG5 +Determines the correct type to be passed for each of the +@code{select} function's arguments, and defines those types +in @code{SELECT_TYPE_ARG1}, @code{SELECT_TYPE_ARG234}, and +@code{SELECT_TYPE_ARG5} respectively. @code{SELECT_TYPE_ARG1} defaults +to @samp{int}, @code{SELECT_TYPE_ARG234} defaults to @samp{int *}, +and @code{SELECT_TYPE_ARG5} defaults to @samp{struct timeval *}. +@end defmac + +@defmac AC_FUNC_SETPGRP +@maindex FUNC_SETPGRP +@cvindex SETPGRP_VOID +If @code{setpgrp} takes no argument (the @sc{posix.1} version), define +@code{SETPGRP_VOID}. Otherwise, it is the @sc{bsd} version, which takes +two process IDs as arguments. This macro does not check whether +@code{setpgrp} exists at all; if you need to work in that situation, +first call @code{AC_CHECK_FUNC} for @code{setpgrp}. +@end defmac + +@defmac AC_FUNC_STAT +@defmacx AC_FUNC_LSTAT +@maindex FUNC_STAT +@maindex FUNC_LSTAT +@cvindex HAVE_STAT_EMPTY_STRING_BUG +@cvindex HAVE_LSTAT_EMPTY_STRING_BUG +Determine whether @code{stat} or @code{lstat} have the bug that it +succeeds when given the zero-length file name argument. The @code{stat} +and @code{lstat} from SunOS 4.1.4 and the Hurd (as of 1998-11-01) do +this. + +If it does, then define @code{HAVE_STAT_EMPTY_STRING_BUG} (or +@code{HAVE_LSTAT_EMPTY_STRING_BUG}) and ask for an @code{AC_LIBOBJ} +replacement of it. +@end defmac + +@defmac AC_FUNC_SETVBUF_REVERSED +@maindex FUNC_SETVBUF_REVERSED +@cvindex SETVBUF_REVERSED +If @code{setvbuf} takes the buffering type as its second argument and +the buffer pointer as the third, instead of the other way around, define +@code{SETVBUF_REVERSED}. +@end defmac + +@defmac AC_FUNC_STRCOLL +@maindex FUNC_STRCOLL +@cvindex HAVE_STRCOLL +If the @code{strcoll} function exists and works correctly, define +@code{HAVE_STRCOLL}. This does a bit more than +@samp{AC_CHECK_FUNCS(strcoll)}, because some systems have incorrect +definitions of @code{strcoll} that should not be used. +@end defmac + +@defmac AC_FUNC_STRTOD +@maindex FUNC_STRTOD +@ovindex POW_LIB +If the @code{strtod} function does not exist or doesn't work correctly, +ask for an @code{AC_LIBOBJ} replacement of @samp{strtod}. In this case, +because @file{strtod.c} is likely to need @samp{pow}, set the output +variable @code{POW_LIB} to the extra library needed. +@end defmac + +@defmac AC_FUNC_STRERROR_R +@maindex FUNC_STRERROR_R +@cvindex HAVE_STRERROR_R +@cvindex HAVE_WORKING_STRERROR_R +If @code{strerror_r} is available, define @code{HAVE_STRERROR_R}. If +its implementation correctly returns a @code{char *}, define +@code{HAVE_WORKING_STRERROR_R}. On at least DEC UNIX 4.0[A-D] and HP-UX +B.10.20, @code{strerror_r} returns @code{int}. Actually, this tests +only whether it returns a scalar or an array, but that should be enough. +This is used by the common @file{error.c}. +@end defmac + +@defmac AC_FUNC_STRFTIME +@maindex FUNC_STRFTIME +@cvindex HAVE_STRFTIME +Check for @code{strftime} in the @file{intl} library, for SCO @sc{unix}. +Then, if @code{strftime} is available, define @code{HAVE_STRFTIME}. +@end defmac + +@defmac AC_FUNC_UTIME_NULL +@maindex FUNC_UTIME_NULL +@cvindex HAVE_UTIME_NULL +If @samp{utime(@var{file}, NULL)} sets @var{file}'s timestamp to +the present, define @code{HAVE_UTIME_NULL}. +@end defmac + +@defmac AC_FUNC_VPRINTF +@maindex FUNC_VPRINTF +@cvindex HAVE_VPRINTF +@cvindex HAVE_DOPRNT +If @code{vprintf} is found, define @code{HAVE_VPRINTF}. Otherwise, if +@code{_doprnt} is found, define @code{HAVE_DOPRNT}. (If @code{vprintf} +is available, you may assume that @code{vfprintf} and @code{vsprintf} +are also available.) +@end defmac + +@node Generic Functions, , Particular Functions, Library Functions +@subsection Generic Function Checks + +These macros are used to find functions not covered by the ``particular'' +test macros. If the functions might be in libraries other than the +default C library, first call @code{AC_CHECK_LIB} for those libraries. +If you need to check the behavior of a function as well as find out +whether it is present, you have to write your own test for +it (@pxref{Writing Tests}). + +@defmac AC_CHECK_FUNC (@var{function}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@maindex CHECK_FUNC +If C function @var{function} is available, run shell commands +@var{action-if-found}, otherwise @var{action-if-not-found}. If you just +want to define a symbol if the function is available, consider using +@code{AC_CHECK_FUNCS} instead. This macro checks for functions with C +linkage even when @code{AC_LANG(C++)} has been called, since C is more +standardized than C++. (@pxref{Language Choice}, for more information +about selecting the language for checks.) +@end defmac + +@defmac AC_CHECK_FUNCS (@var{function}@dots{}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@maindex CHECK_FUNCS +@cvindex HAVE_@var{function} +For each @var{function} in the whitespace-separated argument list, +define @code{HAVE_@var{function}} (in all capitals) if it is available. +If @var{action-if-found} is given, it is additional shell code to +execute when one of the functions is found. You can give it a value of +@samp{break} to break out of the loop on the first match. If +@var{action-if-not-found} is given, it is executed when one of the +functions is not found. +@end defmac + +Autoconf follows a philosophy that was formed over the years by those +who have struggled for portability: isolate the portability issues in +specific files, and then program as if you were in a @sc{posix} +environment. Some functions may be missing or unfixable, and your +package must be ready to replace them. + +Use the first three of the following macros to specify a function to be +replaced, and the last one (@code{AC_REPLACE_FUNCS}) to check for and +replace the function if needed. + +@defmac AC_LIBOBJ (@var{function}) +@maindex LIBOBJ +@ovindex LIBOBJS +Specify that @samp{@var{function}.c} must be included in the executables +to replace a missing or broken implementation of @var{function}. + +Technically, it adds @samp{@var{function}.$ac_objext} to the output +variable @code{LIBOBJS} and calls @code{AC_LIBSOURCE} for +@samp{@var{function}.c}. You should not directly change @code{LIBOBJS}, +since this is not traceable. +@end defmac + +@defmac AC_LIBSOURCE (@var{file}) +@maindex LIBSOURCE +Specify that @var{file} might be needed to compile the project. If you +need to know what files might be needed by a @file{configure.ac}, you +should trace @code{AC_LIBSOURCE}. @var{file} must be a literal. + +This macro is called automatically from @code{AC_LIBOBJ}, but you must +call it explicitly if you pass a shell variable to @code{AC_LIBOBJ}. In +that case, since shell variables cannot be traced statically, you must +pass to @code{AC_LIBSOURCE} any possible files that the shell variable +might cause @code{AC_LIBOBJ} to need. For example, if you want to pass +a variable @code{$foo_or_bar} to @code{AC_LIBOBJ} that holds either +@code{"foo"} or @code{"bar"}, you should do: + +@example +AC_LIBSOURCE(foo.c) +AC_LIBSOURCE(bar.c) +AC_LIBOBJ($foo_or_bar) +@end example + +@noindent +There is usually a way to avoid this, however, and you are encouraged to +simply call @code{AC_LIBOBJ} with literal arguments. + +Note that this macro replaces the obsolete @code{AC_LIBOBJ_DECL}, with +slightly different semantics: the old macro took the function name, +e.g. @code{foo}, as its argument rather than the file name. +@end defmac + +@defmac AC_LIBSOURCES (@var{files}) +@maindex LIBSOURCES +Like @code{AC_LIBSOURCE}, but accepts one or more @var{files} in a +comma-separated M4 list. Thus, the above example might be rewritten: + +@example +AC_LIBSOURCES([foo.c, bar.c]) +AC_LIBOBJ($foo_or_bar) +@end example +@end defmac + +@defmac AC_REPLACE_FUNCS (@var{function}@dots{}) +@maindex REPLACE_FUNCS +@ovindex LIBOBJS +Like @code{AC_CHECK_FUNCS}, but uses @samp{AC_LIBOBJ(@var{function})} as +@var{action-if-not-found}. You can declare your replacement function by +enclosing the prototype in @samp{#if !HAVE_@var{function}}. If the +system has the function, it probably declares it in a header file you +should be including, so you shouldn't redeclare it lest your declaration +conflict. +@end defmac + +@node Header Files, Declarations, Library Functions, Existing Tests +@section Header Files +@cindex Header, checking + +The following macros check for the presence of certain C header files. +If there is no macro specifically defined to check for a header file you need, +and you don't need to check for any special properties of +it, then you can use one of the general header-file check macros. + +@menu +* Particular Headers:: Special handling to find certain headers +* Generic Headers:: How to find other headers +@end menu + +@node Particular Headers, Generic Headers, Header Files, Header Files +@subsection Particular Header Checks + +These macros check for particular system header files---whether they +exist, and in some cases whether they declare certain symbols. + +@defmac AC_HEADER_DIRENT +@maindex HEADER_DIRENT +@cvindex HAVE_DIRENT_H +@cvindex HAVE_NDIR_H +@cvindex HAVE_SYS_DIR_H +@cvindex HAVE_SYS_NDIR_H +Check for the following header files. For the first one that is +found and defines @samp{DIR}, define the listed C preprocessor macro: + +@multitable {@file{sys/ndir.h}} {@code{HAVE_SYS_NDIR_H}} +@item @file{dirent.h} @tab @code{HAVE_DIRENT_H} +@item @file{sys/ndir.h} @tab @code{HAVE_SYS_NDIR_H} +@item @file{sys/dir.h} @tab @code{HAVE_SYS_DIR_H} +@item @file{ndir.h} @tab @code{HAVE_NDIR_H} +@end multitable + +The directory-library declarations in your source code should look +something like the following: + +@example +@group +#if HAVE_DIRENT_H +# include <dirent.h> +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include <sys/ndir.h> +# endif +# if HAVE_SYS_DIR_H +# include <sys/dir.h> +# endif +# if HAVE_NDIR_H +# include <ndir.h> +# endif +#endif +@end group +@end example + +Using the above declarations, the program would declare variables to be +of type @code{struct dirent}, not @code{struct direct}, and would access +the length of a directory entry name by passing a pointer to a +@code{struct dirent} to the @code{NAMLEN} macro. + +This macro also checks for the SCO Xenix @file{dir} and @file{x} libraries. +@end defmac + +@defmac AC_HEADER_MAJOR +@maindex HEADER_MAJOR +@cvindex MAJOR_IN_MKDEV +@cvindex MAJOR_IN_SYSMACROS +If @file{sys/types.h} does not define @code{major}, @code{minor}, and +@code{makedev}, but @file{sys/mkdev.h} does, define +@code{MAJOR_IN_MKDEV}; otherwise, if @file{sys/sysmacros.h} does, define +@code{MAJOR_IN_SYSMACROS}. +@end defmac + + +@defmac AC_HEADER_STAT +@maindex HEADER_STAT +@maindex STAT_MACROS_BROKEN +If the macros @code{S_ISDIR}, @code{S_ISREG} et al. defined in +@file{sys/stat.h} do not work properly (returning false positives), +define @code{STAT_MACROS_BROKEN}. This is the case on Tektronix UTekV, +Amdahl UTS and Motorola System V/88. +@end defmac + + +@defmac AC_HEADER_STDC +@maindex HEADER_STDC +@cvindex STDC_HEADERS +Define @code{STDC_HEADERS} if the system has @sc{ansi} C header files. +Specifically, this macro checks for @file{stdlib.h}, @file{stdarg.h}, +@file{string.h}, and @file{float.h}; if the system has those, it +probably has the rest of the @sc{ansi} C header files. This macro also +checks whether @file{string.h} declares @code{memchr} (and thus +presumably the other @code{mem} functions), whether @file{stdlib.h} +declare @code{free} (and thus presumably @code{malloc} and other related +functions), and whether the @file{ctype.h} macros work on characters +with the high bit set, as @sc{ansi} C requires. + +Use @code{STDC_HEADERS} instead of @code{__STDC__} to determine whether +the system has @sc{ansi}-compliant header files (and probably C library +functions) because many systems that have GCC do not have @sc{ansi} C +header files. + +On systems without @sc{ansi} C headers, there is so much variation that +it is probably easier to declare the functions you use than to figure +out exactly what the system header files declare. Some systems contain +a mix of functions @sc{ansi} and @sc{bsd}; some are mostly @sc{ansi} but +lack @samp{memmove}; some define the @sc{bsd} functions as macros in +@file{string.h} or @file{strings.h}; some have only the @sc{bsd} +functions but @file{string.h}; some declare the memory functions in +@file{memory.h}, some in @file{string.h}; etc. It is probably +sufficient to check for one string function and one memory function; if +the library has the @sc{ansi} versions of those then it probably has +most of the others. If you put the following in @file{configure.ac}: + +@example +AC_HEADER_STDC +AC_CHECK_FUNCS(strchr memcpy) +@end example + +@noindent +then, in your code, you can put declarations like this: + +@example +@group +#if STDC_HEADERS +# include <string.h> +#else +# if !HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr (), *strrchr (); +# if !HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# define memmove(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif +@end group +@end example + +@noindent +If you use a function like @code{memchr}, @code{memset}, @code{strtok}, +or @code{strspn}, which have no @sc{bsd} equivalent, then macros won't +suffice; you must provide an implementation of each function. An easy +way to incorporate your implementations only when needed (since the ones +in system C libraries may be hand optimized) is to, taking @code{memchr} +for example, put it in @file{memchr.c} and use +@samp{AC_REPLACE_FUNCS(memchr)}. +@end defmac + +@defmac AC_HEADER_SYS_WAIT +@maindex HEADER_SYS_WAIT +@cvindex HAVE_SYS_WAIT_H +If @file{sys/wait.h} exists and is compatible with @sc{posix.1}, define +@code{HAVE_SYS_WAIT_H}. Incompatibility can occur if @file{sys/wait.h} +does not exist, or if it uses the old @sc{bsd} @code{union wait} instead +of @code{int} to store a status value. If @file{sys/wait.h} is not +@sc{posix.1} compatible, then instead of including it, define the +@sc{posix.1} macros with their usual interpretations. Here is an +example: + +@example +@group +#include <sys/types.h> +#if HAVE_SYS_WAIT_H +# include <sys/wait.h> +#endif +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +@end group +@end example +@end defmac + +@cvindex _POSIX_VERSION +@code{_POSIX_VERSION} is defined when @file{unistd.h} is included on +@sc{posix.1} systems. If there is no @file{unistd.h}, it is definitely +not a @sc{posix.1} system. However, some non-@sc{posix.1} systems do +have @file{unistd.h}. + +The way to check if the system supports @sc{posix.1} is: + +@example +@group +#if HAVE_UNISTD_H +# include <sys/types.h> +# include <unistd.h> +#endif + +#ifdef _POSIX_VERSION +/* Code for POSIX.1 systems. */ +#endif +@end group +@end example + +@defmac AC_HEADER_TIME +@maindex HEADER_TIME +@cvindex TIME_WITH_SYS_TIME +If a program may include both @file{time.h} and @file{sys/time.h}, +define @code{TIME_WITH_SYS_TIME}. On some older systems, +@file{sys/time.h} includes @file{time.h}, but @file{time.h} is not +protected against multiple inclusion, so programs should not explicitly +include both files. This macro is useful in programs that use, for +example, @code{struct timeval} or @code{struct timezone} as well as +@code{struct tm}. It is best used in conjunction with +@code{HAVE_SYS_TIME_H}, which can be checked for using +@code{AC_CHECK_HEADERS(sys/time.h)}. + +@example +@group +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif +@end group +@end example +@end defmac + + +@defmac AC_HEADER_TIOCGWINSZ +@maindex HEADER_TIOCGWINSZ +@cvindex GWINSZ_IN_SYS_IOCTL +@c FIXME: I need clarifications from Jim. +If the use of @code{TIOCGWINSZ} requires @file{<sys/ioctl.h>}, then +define @code{GWINSZ_IN_SYS_IOCTL}. Otherwise @code{TIOCGWINSZ} can be +found in @file{<termios.h>}. + +Use: + +@example +@group +#if HAVE_TERMIOS_H +# include <termios.h> +#endif + +#if GWINSZ_IN_SYS_IOCTL +# include <sys/ioctl.h> +#endif +@end group +@end example +@end defmac + +@node Generic Headers, , Particular Headers, Header Files +@subsection Generic Header Checks + +These macros are used to find system header files not covered by the +``particular'' test macros. If you need to check the contents of a header +as well as find out whether it is present, you have to write your own +test for it (@pxref{Writing Tests}). + +@defmac AC_CHECK_HEADER (@var{header-file}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) +@maindex CHECK_HEADER +If the system header file @var{header-file} is usable, execute shell +commands @var{action-if-found}, otherwise execute +@var{action-if-not-found}. If you just want to define a symbol if the +header file is available, consider using @code{AC_CHECK_HEADERS} +instead. + +The meaning of ``usable'' depends upon the content of @var{includes}: + +@table @asis +@item if @var{includes} is empty +check whether + +@example +@var{header-file} +@end example + +@noindent +can be @emph{preprocessed} without error. + +@item if @var{include} is set +Check whether + +@example +@var{includes} +#include <@var{header-file}> +@end example + +@noindent +can be @emph{compiled} without error. You may use +@code{AC_CHECK_HEADER} (and @code{AC_CHECK_HEADERS}) to check whether +two headers are compatible. +@end table + +You may pass any kind of dummy content for @var{includes}, such as a +single space, a comment, to check whether @var{header-file} compiles +with success. +@end defmac + +@defmac AC_CHECK_HEADERS (@var{header-file}@dots{}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) +@maindex CHECK_HEADERS +@cvindex HAVE_@var{header} +For each given system header file @var{header-file} in the +whitespace-separated argument list that exists, define +@code{HAVE_@var{header-file}} (in all capitals). If @var{action-if-found} +is given, it is additional shell code to execute when one of the header +files is found. You can give it a value of @samp{break} to break out of +the loop on the first match. If @var{action-if-not-found} is given, it +is executed when one of the header files is not found. + +Be sure to read the documentation of @code{AC_CHECK_HEADER} to +understand the influence of @var{includes}. +@end defmac + +@node Declarations, Structures, Header Files, Existing Tests +@section Declarations +@cindex Declaration, checking + +The following macros check for the declaration of variables and +functions. If there is no macro specifically defined to check for a +symbol you need, then you can use the general macros (@pxref{Generic +Declarations}) or, for more complex tests, you may use +@code{AC_TRY_COMPILE} (@pxref{Examining Syntax}). + +@menu +* Particular Declarations:: Macros to check for certain declarations +* Generic Declarations:: How to find other declarations +@end menu + +@node Particular Declarations, Generic Declarations, Declarations, Declarations +@subsection Particular Declaration Checks + +The following macros check for certain declarations. + +@defmac AC_DECL_SYS_SIGLIST +@maindex DECL_SYS_SIGLIST +@cvindex SYS_SIGLIST_DECLARED +Define @code{SYS_SIGLIST_DECLARED} if the variable @code{sys_siglist} +is declared in a system header file, either @file{signal.h} or +@file{unistd.h}. +@end defmac + +@node Generic Declarations, , Particular Declarations, Declarations +@subsection Generic Declaration Checks + +These macros are used to find declarations not covered by the ``particular'' +test macros. + +@defmac AC_CHECK_DECL (@var{symbol}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) +@maindex CHECK_DECL +If @var{symbol} (a function or a variable) is not declared in +@var{includes} and a declaration is needed, run the shell commands +@var{action-if-not-found}, otherwise @var{action-if-found}. If no +@var{includes} are specified, the default includes are used +(@pxref{Default Includes}). + +This macro actually tests whether it is valid to use @var{symbol} as an +r-value, not if it is really declared, because it is much safer to avoid +introducing extra declarations when they are not needed. +@end defmac + +@defmac AC_CHECK_DECLS (@var{symbols}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) +@maindex CHECK_DECLS +@cvindex HAVE_DECL_@var{symbol} +For each of the @var{symbols} (@emph{comma}-separated list), define +@code{HAVE_DECL_@var{symbol}} (in all capitals) to @samp{1} if +@var{symbol} is declared, otherwise to @samp{0}. If +@var{action-if-not-found} is given, it is additional shell code to +execute when one of the function declarations is needed, otherwise +@var{action-if-found} is executed. + +This macro uses an m4 list as first argument: +@example +AC_CHECK_DECLS(strdup) +AC_CHECK_DECLS([strlen]) +AC_CHECK_DECLS([malloc, realloc, calloc, free]) +@end example + +Unlike the other @samp{AC_CHECK_*S} macros, when a @var{symbol} is not +declared, @code{HAVE_DECL_@var{symbol}} is defined to @samp{0} instead +of leaving @code{HAVE_DECL_@var{symbol}} undeclared. When you are +@emph{sure} that the check was performed, use +@code{HAVE_DECL_@var{symbol}} just like any other result of Autoconf: + +@example +#if !HAVE_DECL_SYMBOL +extern char *symbol; +#endif +@end example + +@noindent +If the test may have not been performed, however, because it is safer +@emph{not} to declare a symbol than to use a declaration that conflicts +with the system's one, you should use: + +@example +#if defined HAVE_DECL_MALLOC && !HAVE_DECL_MALLOC +char *malloc (size_t *s); +#endif +@end example + +@noindent +You fall into the second category only in extreme situations: either +your files may be used without being configured, or they are used during +the configuration. In most cases the traditional approach is enough. +@end defmac + + +@node Structures, Types, Declarations, Existing Tests +@section Structures +@cindex Structure, checking + +The following macros check for the presence of certain members in C +structures. If there is no macro specifically defined to check for a +member you need, then you can use the general structure-member macro +(@pxref{Generic Structures}) or, for more complex tests, you may use +@code{AC_TRY_COMPILE} (@pxref{Examining Syntax}). + +@menu +* Particular Structures:: Macros to check for certain structure members +* Generic Structures:: How to find other structure members +@end menu + +@node Particular Structures, Generic Structures, Structures, Structures +@subsection Particular Structure Checks + +The following macros check for certain structures or structure members. + +@defmac AC_STRUCT_ST_BLKSIZE +@maindex STRUCT_ST_BLKSIZE +@cvindex HAVE_STRUCT_STAT_ST_BLKSIZE +@cvindex HAVE_ST_BLKSIZE +If @code{struct stat} contains an @code{st_blksize} member, define +@code{HAVE_STRUCT_STAT_ST_BLKSIZE}. The former name, +@code{HAVE_ST_BLKSIZE} is to be avoided, as its support will cease in +the future. This macro is obsoleted, and should be replaced by + +@example +AC_CHECK_MEMBERS([struct stat.st_blksize]) +@end example +@end defmac + +@defmac AC_STRUCT_ST_BLOCKS +@maindex STRUCT_ST_BLOCKS +@cvindex HAVE_STRUCT_STAT_ST_BLOCKS +@cvindex HAVE_ST_BLOCKS +@ovindex LIBOBJS +If @code{struct stat} contains an @code{st_blocks} member, define +@code{HAVE_STRUCT STAT_ST_BLOCKS}. Otherwise, require an +@code{AC_LIBOBJ} replacement of @samp{fileblocks}. The former name, +@code{HAVE_ST_BLOCKS} is to be avoided, as its support will cease in the +future. +@end defmac + +@defmac AC_STRUCT_ST_RDEV +@maindex STRUCT_ST_RDEV +@cvindex HAVE_ST_RDEV +@cvindex HAVE_STRUCT_STAT_ST_RDEV +If @code{struct stat} contains an @code{st_rdev} member, define +@code{HAVE_STRUCT_STAT_ST_RDEV}. The former name for this macro, +@code{HAVE_ST_RDEV}, is to be avoided as it will cease to be supported +in the future. Actually, even the new macro is obsolete, and should be +replaced by: +@example +AC_CHECK_MEMBERS([struct stat.st_rdev]) +@end example +@end defmac + +@defmac AC_STRUCT_TM +@maindex STRUCT_TM +@cvindex TM_IN_SYS_TIME +If @file{time.h} does not define @code{struct tm}, define +@code{TM_IN_SYS_TIME}, which means that including @file{sys/time.h} +had better define @code{struct tm}. +@end defmac + +@defmac AC_STRUCT_TIMEZONE +@maindex STRUCT_TIMEZONE +@cvindex HAVE_TM_ZONE +@cvindex HAVE_TZNAME +Figure out how to get the current timezone. If @code{struct tm} has a +@code{tm_zone} member, define @code{HAVE_STRUCT_TM_TM_ZONE} (and the +obsoleted @code{HAVE_TM_ZONE}). Otherwise, if the external array +@code{tzname} is found, define @code{HAVE_TZNAME}. +@end defmac + +@node Generic Structures, , Particular Structures, Structures +@subsection Generic Structure Checks + +These macros are used to find structure members not covered by the +``particular'' test macros. + +@defmac AC_CHECK_MEMBER (@var{aggregate}.@var{member}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) +@maindex CHECK_MEMBER +Check whether @var{member} is a member of the aggregate @var{aggregate}. +If no @var{includes} are specified, the default includes are used +(@pxref{Default Includes}). + +@example +AC_CHECK_MEMBER(struct passwd.pw_gecos,, + [AC_MSG_ERROR([We need `passwd.pw_gecos'!])], + [#include <pwd.h>]) +@end example + +You can use this macro for sub-members: + +@example +AC_CHECK_MEMBER(struct top.middle.bot) +@end example +@end defmac + +@defmac AC_CHECK_MEMBERS (@var{members}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) +@maindex CHECK_MEMBERS +Check for the existence of each @samp{@var{aggregate}.@var{member}} of +@var{members} using the previous macro. When @var{member} belongs to +@var{aggregate}, define @code{HAVE_@var{aggregate}_@var{member}} (in all +capitals, with spaces and dots replaced by underscores). + +This macro uses m4 lists: +@example +AC_CHECK_MEMBERS([struct stat.st_rdev, struct stat.st_blksize]) +@end example +@end defmac + + +@node Types, Compilers and Preprocessors, Structures, Existing Tests +@section Types + +The following macros check for C types, either builtin or typedefs. If +there is no macro specifically defined to check for a type you need, and +you don't need to check for any special properties of it, then you can +use a general type-check macro. + +@menu +* Particular Types:: Special handling to find certain types +* Generic Types:: How to find other types +@end menu + +@node Particular Types, Generic Types, Types, Types +@subsection Particular Type Checks + +These macros check for particular C types in @file{sys/types.h}, +@file{stdlib.h} and others, if they exist. + +@defmac AC_TYPE_GETGROUPS +@maindex TYPE_GETGROUPS +@cvindex GETGROUPS_T +Define @code{GETGROUPS_T} to be whichever of @code{gid_t} or @code{int} +is the base type of the array argument to @code{getgroups}. +@end defmac + +@defmac AC_TYPE_MODE_T +@maindex TYPE_MODE_T +@cvindex mode_t +Equivalent to @samp{AC_CHECK_TYPE(mode_t, int)}. +@end defmac + +@defmac AC_TYPE_OFF_T +@maindex TYPE_OFF_T +@cvindex off_t +Equivalent to @samp{AC_CHECK_TYPE(off_t, long)}. +@end defmac + +@defmac AC_TYPE_PID_T +@maindex TYPE_PID_T +@cvindex pid_t +Equivalent to @samp{AC_CHECK_TYPE(pid_t, int)}. +@end defmac + +@defmac AC_TYPE_SIGNAL +@maindex TYPE_SIGNAL +@cvindex RETSIGTYPE +If @file{signal.h} declares @code{signal} as returning a pointer to a +function returning @code{void}, define @code{RETSIGTYPE} to be +@code{void}; otherwise, define it to be @code{int}. + +Define signal handlers as returning type @code{RETSIGTYPE}: + +@example +@group +RETSIGTYPE +hup_handler () +@{ +@dots{} +@} +@end group +@end example +@end defmac + +@defmac AC_TYPE_SIZE_T +@maindex TYPE_SIZE_T +@cvindex size_t +Equivalent to @samp{AC_CHECK_TYPE(size_t, unsigned)}. +@end defmac + +@defmac AC_TYPE_UID_T +@maindex TYPE_UID_T +@cvindex uid_t +@cvindex gid_t +If @code{uid_t} is not defined, define @code{uid_t} to be @code{int} and +@code{gid_t} to be @code{int}. +@end defmac + +@node Generic Types, , Particular Types, Types +@subsection Generic Type Checks + +These macros are used to check for types not covered by the ``particular'' +test macros. + +@defmac AC_CHECK_TYPE (@var{type}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) +@maindex CHECK_TYPE +Check whether @var{type} is defined. It may be a compiler builtin type +or defined by the @ovar{includes} (@pxref{Default Includes}). +@end defmac + + +@defmac AC_CHECK_TYPES (@var{types}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{includes}) +@maindex CHECK_TYPES +For each @var{type} of the @var{types} that is defined, define +@code{HAVE_@var{type}} (in all capitals). If no @var{includes} are +specified, the default includes are used (@pxref{Default Includes}). If +@var{action-if-found} is given, it is additional shell code to execute +when one of the types is found. If @var{action-if-not-found} is given, +it is executed when one of the types is not found. + +This macro uses m4 lists: +@example +AC_CHECK_TYPES(ptrdiff_t) +AC_CHECK_TYPES([unsigned long long, uintmax_t]) +@end example + +@end defmac + +Autoconf, up to 2.13, used to provide to another version of +@code{AC_CHECK_TYPE}, broken by design. In order to keep backward +compatibility, a simple heuristics, quite safe but not totally, is +implemented. In case of doubt, read the documentation of the former +@code{AC_CHECK_TYPE}, see @ref{Obsolete Macros}. + + +@node Compilers and Preprocessors, System Services, Types, Existing Tests +@section Compilers and Preprocessors + +@ovindex EXEEXT +All the tests for compilers (@code{AC_PROG_CC}, @code{AC_PROG_CXX}, +@code{AC_PROG_F77}) define the output variable @code{EXEEXT} based on +the output of the compiler, typically to the empty string if Unix and +@samp{.exe} if Win32 or OS/2. + +@ovindex OBJEXT +They also define the output variable @code{OBJEXT} based on the +output of the compiler, after .c files have been excluded, typically +to @samp{o} if Unix, @samp{obj} if Win32. + +If the compiler being used does not produce executables, they fail. If +the executables can't be run, and cross-compilation is not enabled, they +fail too. @xref{Manual Configuration}, for more on support for cross +compiling. + +@menu +* Generic Compiler Characteristics:: Language independent tests +* C Compiler:: Checking its characteristics +* C++ Compiler:: Likewise +* Fortran 77 Compiler:: Likewise +@end menu + +@node Generic Compiler Characteristics, C Compiler, Compilers and Preprocessors, Compilers and Preprocessors +@subsection Generic Compiler Characteristics + +@defmac AC_CHECK_SIZEOF (@var{type}, @ovar{unused}, @ovar{includes}) +@maindex CHECK_SIZEOF +Define @code{SIZEOF_@var{type}} (@pxref{Standard Symbols}) to be the +size in bytes of @var{type}. If @samp{type} is unknown, it gets a size +of 0. If no @var{includes} are specified, the default includes are used +(@pxref{Default Includes}). If you provide @var{include}, make sure to +include @file{stdio.h} which is required for this macro to run. + +This macro now works even when cross-compiling. The @var{unused} +argument was used when cross-compiling. + +For example, the call + +@example +AC_CHECK_SIZEOF(int *) +@end example + +@noindent +defines @code{SIZEOF_INT_P} to be 8 on DEC Alpha AXP systems. +@end defmac + + +@node C Compiler, C++ Compiler, Generic Compiler Characteristics, Compilers and Preprocessors +@subsection C Compiler Characteristics + +@defmac AC_PROG_CC (@ovar{compiler-search-list}) +@maindex PROG_CC +@ovindex CC +@ovindex CFLAGS +Determine a C compiler to use. If @code{CC} is not already set in the +environment, check for @code{gcc} and @code{cc}, then for other C +compilers. Set output variable @code{CC} to the name of the compiler +found. + +This macro may, however, be invoked with an optional first argument +which, if specified, must be a space separated list of C compilers to +search for. This just gives the user an opportunity to specify an +alternative search list for the C compiler. For example, if you didn't +like the default order, then you could invoke @code{AC_PROG_CC} like +this: + +@example +AC_PROG_CC(cl egcs gcc cc) +@end example + +If using the @sc{gnu} C compiler, set shell variable @code{GCC} to +@samp{yes}. If output variable @code{CFLAGS} was not already set, set +it to @option{-g -O2} for the @sc{gnu} C compiler (@option{-O2} on systems +where GCC does not accept @option{-g}), or @option{-g} for other compilers. +@end defmac + +@defmac AC_PROG_CC_C_O +@maindex PROG_CC_C_O +@cvindex NO_MINUS_C_MINUS_O +If the C compiler does not accept the @option{-c} and @option{-o} options +simultaneously, define @code{NO_MINUS_C_MINUS_O}. This macro actually +tests both the compiler found by @code{AC_PROG_CC}, and, if different, +the first @code{cc} in the path. The test fails if one fails. This +macro was created for @sc{gnu} Make to choose the default C compilation +rule. +@end defmac + +@defmac AC_PROG_CC_STDC +@maindex PROG_CC_STDC +@ovindex CC +If the C compiler is not in @sc{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 @sc{ansi} C on some system or another. It +considers the compiler to be in @sc{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 @sc{ansi} C; if not, the shell variable +@code{ac_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source +code in @sc{ansi} C, you can make an un-@sc{ansi}fied copy of it by +using the program @code{ansi2knr}, which comes with Automake. +@end defmac + + +@defmac AC_PROG_CPP +@maindex PROG_CPP +@ovindex CPP +Set output variable @code{CPP} to a command that runs the +C preprocessor. If @samp{$CC -E} doesn't work, @file{/lib/cpp} is used. +It is only portable to run @code{CPP} on files with a @file{.c} +extension. + +If the current language is C (@pxref{Language Choice}), many of the +specific test macros use the value of @code{CPP} indirectly by calling +@code{AC_TRY_CPP}, @code{AC_CHECK_HEADER}, @code{AC_EGREP_HEADER}, or +@code{AC_EGREP_CPP}. + +Some preprocessors don't indicate missing include files by the error +status. For such preprocessors an internal variable is set that causes +other macros to check the standard error from the preprocessor and +consider the test failed if any warnings have been reported. +@end defmac + + +The following macros check for C compiler or machine architecture +features. To check for characteristics not listed here, use +@code{AC_TRY_COMPILE} (@pxref{Examining Syntax}) or @code{AC_TRY_RUN} +(@pxref{Run Time}) + +@defmac AC_C_BIGENDIAN +@maindex C_BIGENDIAN +@cvindex WORDS_BIGENDIAN +@cindex Endianness +If words are stored with the most significant byte first (like Motorola +and SPARC, but not Intel and VAX, CPUs), define @code{WORDS_BIGENDIAN}. +@end defmac + + +@defmac AC_C_CONST +@maindex C_CONST +@cvindex const +If the C compiler does not fully support the @sc{ansi} C qualifier +@code{const}, define @code{const} to be empty. Some C compilers that do +not define @code{__STDC__} do support @code{const}; some compilers that +define @code{__STDC__} do not completely support @code{const}. Programs +can simply use @code{const} as if every C compiler supported it; for +those that don't, the @file{Makefile} or configuration header file will +define it as empty. + +Occasionally installers use a C++ compiler to compile C code, typically +because they lack a C compiler. This causes problems with @code{const}, +because C and C++ treat @code{const} differently. For example: + +@example +const int foo; +@end example + +@noindent +is valid in C but not in C++. These differences unfortunately cannot be +papered over by defining @code{const} to be empty. + +If @code{autoconf} detects this situation, it leaves @code{const} alone, +as this generally yields better results in practice. However, using a +C++ compiler to compile C code is not recommended or supported, and +installers who run into trouble in this area should get a C compiler +like GCC to compile their C code. +@end defmac + +@defmac AC_C_VOLATILE +@maindex C_VOLATILE +@cvindex volatile +If the C compiler does not understand the keyword @code{volatile}, +define @code{volatile} to be empty. Programs can simply use +@code{volatile} as if every C compiler supported it; for those that do +not, the @file{Makefile} or configuration header will define it as +empty. + +If the correctness of your program depends on the semantics of +@code{volatile}, simply defining it to be empty does, in a sense, break +your code. However, given that the compiler does not support +@code{volatile}, you are at its mercy anyway. At least your +program will compile, when it wouldn't before. + +In general, the @code{volatile} keyword is a feature of @sc{ansi} C, so +you might expect that @code{volatile} is available only when +@code{__STDC__} is defined. However, Ultrix 4.3's native compiler does +support volatile, but does not defined @code{__STDC__}. +@end defmac + +@defmac AC_C_INLINE +@maindex C_INLINE +@cvindex inline +If the C compiler supports the keyword @code{inline}, do nothing. +Otherwise define @code{inline} to @code{__inline__} or @code{__inline} +if it accepts one of those, otherwise define @code{inline} to be empty. +@end defmac + +@defmac AC_C_CHAR_UNSIGNED +@maindex C_CHAR_UNSIGNED +@cvindex __CHAR_UNSIGNED__ +If the C type @code{char} is unsigned, define @code{__CHAR_UNSIGNED__}, +unless the C compiler predefines it. +@end defmac + +@defmac AC_C_LONG_DOUBLE +@maindex C_LONG_DOUBLE +@cvindex HAVE_LONG_DOUBLE +If the C compiler supports the @code{long double} type, define +@code{HAVE_LONG_DOUBLE}. Some C compilers that do not define +@code{__STDC__} do support the @code{long double} type; some compilers +that define @code{__STDC__} do not support @code{long double}. +@end defmac + +@defmac AC_C_STRINGIZE +@maindex C_STRINGIZE +@cvindex HAVE_STRINGIZE +If the C preprocessor supports the stringizing operator, define +@code{HAVE_STRINGIZE}. The stringizing operator is @samp{#} and is +found in macros such as this: + +@example +#define x(y) #y +@end example +@end defmac + +@defmac AC_C_PROTOTYPES +@maindex C_PROTOTYPES +@cvindex PROTOTYPES +@cvindex PARAMS +Check to see if function prototypes are understood by the compiler. If +so, define @samp{PROTOTYPES}. In the case the compiler does not handle +prototypes, you should use @code{ansi2knr}, which comes with the +Automake distribution, to unprotoize function definitions. For +function prototypes, you should first define @code{PARAMS}: + +@example +#ifndef PARAMS +# if PROTOTYPES +# define PARAMS(protos) protos +# else /* no PROTOTYPES */ +# define PARAMS(protos) () +# endif /* no PROTOTYPES */ +#endif +@end example + +@noindent +then use it this way: + +@example +size_t my_strlen PARAMS ((const char *)); +@end example +@end defmac + +@defmac AC_PROG_GCC_TRADITIONAL +@maindex PROG_GCC_TRADITIONAL +@ovindex CC +Add @option{-traditional} to output variable @code{CC} if using the +@sc{gnu} C compiler and @code{ioctl} does not work properly without +@option{-traditional}. That usually happens when the fixed header files +have not been installed on an old system. Since recent versions of the +@sc{gnu} C compiler fix the header files automatically when installed, +this is becoming a less prevalent problem. +@end defmac + + +@node C++ Compiler, Fortran 77 Compiler, C Compiler, Compilers and Preprocessors +@subsection C++ Compiler Characteristics + + +@defmac AC_PROG_CXX (@ovar{compiler-search-list}) +@maindex PROG_CXX +@ovindex CXX +@ovindex CXXFLAGS +Determine a C++ compiler to use. Check if the environment variable +@code{CXX} or @code{CCC} (in that order) is set; if so, then set output +variable @code{CXX} to its value. + +Otherwise, if the macro is invoked without an argument, then search for +a C++ compiler under the likely names (first @code{g++} and @code{c++} +then other names). If none of those checks succeed, then as a last +resort set @code{CXX} to @code{g++}. + +This macro may, however, be invoked with an optional first argument +which, if specified, must be a space separated list of C++ compilers to +search for. This just gives the user an opportunity to specify an +alternative search list for the C++ compiler. For example, if you +didn't like the default order, then you could invoke @code{AC_PROG_CXX} +like this: + +@example +AC_PROG_CXX(cl KCC CC cxx cc++ xlC aCC c++ g++ egcs gcc) +@end example + +If using the @sc{gnu} C++ compiler, set shell variable @code{GXX} to +@samp{yes}. If output variable @code{CXXFLAGS} was not already set, set +it to @option{-g -O2} for the @sc{gnu} C++ compiler (@option{-O2} on +systems where G++ does not accept @option{-g}), or @option{-g} for other +compilers. +@end defmac + +@defmac AC_PROG_CXXCPP +@maindex PROG_CXXCPP +@ovindex CXXCPP +Set output variable @code{CXXCPP} to a command that runs the C++ +preprocessor. If @samp{$CXX -E} doesn't work, @file{/lib/cpp} is used. +It is only portable to run @code{CXXCPP} on files with a @file{.c}, +@file{.C}, or @file{.cc} extension. + +If the current language is C++ (@pxref{Language Choice}), many of the +specific test macros use the value of @code{CXXCPP} indirectly by +calling @code{AC_TRY_CPP}, @code{AC_CHECK_HEADER}, +@code{AC_EGREP_HEADER}, or @code{AC_EGREP_CPP}. + +Some preprocessors don't indicate missing include files by the error +status. For such preprocessors an internal variable is set that causes +other macros to check the standard error from the preprocessor and +consider the test failed if any warnings have been reported. However, +it is not known whether such broken preprocessors exist for C++. +@end defmac + + + +@node Fortran 77 Compiler, , C++ Compiler, Compilers and Preprocessors +@subsection Fortran 77 Compiler Characteristics + +@defmac AC_PROG_F77 (@ovar{compiler-search-list}) +@maindex PROG_FORTRAN +@ovindex F77 +@ovindex FFLAGS +Determine a Fortran 77 compiler to use. If @code{F77} is not already +set in the environment, then check for @code{g77} and @code{f77}, and +then some other names. Set the output variable @code{F77} to the name +of the compiler found. + +This macro may, however, be invoked with an optional first argument +which, if specified, must be a space separated list of Fortran 77 +compilers to search for. This just gives the user an opportunity to +specify an alternative search list for the Fortran 77 compiler. For +example, if you didn't like the default order, then you could invoke +@code{AC_PROG_F77} like this: + +@example +AC_PROG_F77(fl32 f77 fort77 xlf cf77 g77 f90 xlf90) +@end example + +If using @code{g77} (the @sc{gnu} Fortran 77 compiler), then +@code{AC_PROG_F77} will set the shell variable @code{G77} to @samp{yes}. +If the output variable @code{FFLAGS} was not already set in the +environment, then set it to @option{-g -02} for @code{g77} (or @option{-O2} +where @code{g77} does not accept @option{-g}). Otherwise, set +@code{FFLAGS} to @option{-g} for all other Fortran 77 compilers. +@end defmac + +@defmac AC_PROG_F77_C_O +@maindex PROG_F77_C_O +@cvindex F77_NO_MINUS_C_MINUS_O +Test if the Fortran 77 compiler accepts the options @option{-c} and +@option{-o} simultaneously, and define @code{F77_NO_MINUS_C_MINUS_O} if it +does not. +@end defmac + + +The following macros check for Fortran 77 compiler characteristics. To +check for characteristics not listed here, use @code{AC_TRY_COMPILE} +(@pxref{Examining Syntax}) or @code{AC_TRY_RUN} (@pxref{Run Time}), +making sure to first set the current language to Fortran 77 +@code{AC_LANG(Fortran 77)} (@pxref{Language Choice}). + + +@defmac AC_F77_LIBRARY_LDFLAGS +@maindex F77_LIBRARY_LDFLAGS +@ovindex FLIBS +Determine the linker flags (e.g. @option{-L} and @option{-l}) for the +@dfn{Fortran 77 intrinsic and run-time libraries} that are required to +successfully link a Fortran 77 program or shared library. The output +variable @code{FLIBS} is set to these flags. + +This macro is intended to be used in those situations when it is +necessary to mix, e.g. C++ and Fortran 77 source code into a single +program or shared library (@pxref{Mixing Fortran 77 With C and C++,,, +automake, GNU Automake}). + +For example, if object files from a C++ and Fortran 77 compiler must be +linked together, then the C++ compiler/linker must be used for linking +(since special C++-ish things need to happen at link time like calling +global constructors, instantiating templates, enabling exception +support, etc.). + +However, the Fortran 77 intrinsic and run-time libraries must be linked +in as well, but the C++ compiler/linker doesn't know by default how to +add these Fortran 77 libraries. Hence, the macro +@code{AC_F77_LIBRARY_LDFLAGS} was created to determine these Fortran 77 +libraries. + +The macro @code{AC_F77_DUMMY_MAIN} or @code{AC_F77_MAIN} will probably +also be necessary to link C/C++ with Fortran; see below. +@end defmac + + +@defmac AC_F77_DUMMY_MAIN (@ovar{action-if-found}, @ovar{action-if-not-found}) +@maindex F77_DUMMY_MAIN +@cvindex F77_DUMMY_MAIN +With many compilers, the Fortran libraries detected by +@code{AC_F77_LIBRARY_LDFLAGS} provide their own @code{main} entry +function that initializes things like Fortran I/O, and which then calls +a user-provided entry function named e.g. @code{MAIN__} to run the +user's program. The @code{AC_F77_DUMMY_MAIN} or @code{AC_F77_MAIN} +macro figures out how to deal with this interaction. + +When using Fortran for purely numerical functions (no I/O, etcetera), +users often prefer to provide their own @code{main} and skip the Fortran +library initializations. In this case, however, one may still need to +provide a dummy @code{MAIN__} routine in order to prevent linking errors +on some systems. @code{AC_F77_DUMMY_MAIN} detects whether any such +routine is @emph{required} for linking, and what its name is; the shell +variable @code{F77_DUMMY_MAIN} holds this name, @code{unknown} when no +solution was found, and @code{none} when no such dummy main is needed. + +By default, @var{action-if-found} defines @code{F77_DUMMY_MAIN} to the +name of this routine (e.g. @code{MAIN__}) @emph{if} it is required. +@ovar{action-if-not-found} defaults to exiting with an error. + +In order to link with Fortran routines, the user's C/C++ program should +then include the following code to define the dummy main if it is +needed: + +@example +#ifdef F77_DUMMY_MAIN +# ifdef __cplusplus + extern "C" +# endif + int F77_DUMMY_MAIN() @{ return 1; @} +#endif +@end example + +Note that @code{AC_F77_DUMMY_MAIN} is called automatically from +@code{AC_F77_WRAPPERS}; there is generally no need to call it explicitly +unless one wants to change the default actions. +@end defmac + +@defmac AC_F77_MAIN +@maindex F77_MAIN +@cvindex F77_MAIN +As discussed above for @code{AC_F77_DUMMY_MAIN}, many Fortran libraries +allow you to provide an entry point called e.g. @code{MAIN__} instead of +the usual @code{main}, which is then called by a @code{main} function in +the Fortran libraries that initializes things like Fortran I/O. The +@code{AC_F77_MAIN} macro detects whether it is @emph{possible} to +utilize such an alternate main function, and defines @code{F77_MAIN} to +the name of the function. (If no alternate main function name is found, +@code{F77_MAIN} is simply defined to @code{main}.) + +Thus, when calling Fortran routines from C that perform things like I/O, +one should use this macro and name the "main" function @code{F77_MAIN} +instead of @code{main}. +@end defmac + +@defmac AC_F77_WRAPPERS +@maindex F77_WRAPPERS +@cvindex F77_FUNC +@cvindex F77_FUNC_ +Defines C macros @code{F77_FUNC(name,NAME)} and +@code{F77_FUNC_(name,NAME)} to properly mangle the names of C/C++ +identifiers, and identifiers with underscores, respectively, so that +they match the name-mangling scheme used by the Fortran 77 compiler. + +Fortran 77 is case-insensitive, and in order to achieve this the Fortran +77 compiler converts all identifiers into a canonical case and format. +To call a Fortran 77 subroutine from C or to write a C function that is +callable from Fortran 77, the C program must explicitly use identifiers +in the format expected by the Fortran 77 compiler. In order to do this, +one simply wraps all C identifiers in one of the macros provided by +@code{AC_F77_WRAPPERS}. For example, suppose you have the following +Fortran 77 subroutine: + +@example + subroutine foobar(x,y) + double precision x, y + y = 3.14159 * x + return + end +@end example + +You would then declare its prototype in C or C++ as: + +@example +#define FOOBAR_F77 F77_FUNC(foobar,FOOBAR) +#ifdef __cplusplus +extern "C" /* prevent C++ name mangling */ +#endif +void FOOBAR_F77(double *x, double *y); +@end example + +Note that we pass both the lowercase and uppercase versions of the +function name to @code{F77_FUNC} so that it can select the right one. +Note also that all parameters to Fortran 77 routines are passed as +pointers (@pxref{Mixing Fortran 77 With C and C++,,, automake, GNU +Automake}). + +Although Autoconf tries to be intelligent about detecting the +name-mangling scheme of the Fortran 77 compiler, there may be Fortran 77 +compilers that it doesn't support yet. In this case, the above code +will generate a compile-time error, but some other behavior +(e.g. disabling Fortran-related features) can be induced by checking +whether the @code{F77_FUNC} macro is defined. + +Now, to call that routine from a C program, we would do something like: + +@example +@{ + double x = 2.7183, y; + FOOBAR_F77(&x, &y); +@} +@end example + +If the Fortran 77 identifier contains an underscore +(e.g. @code{foo_bar}), you should use @code{F77_FUNC_} instead of +@code{F77_FUNC} (with the same arguments). This is because some Fortran +77 compilers mangle names differently if they contain an underscore. +@end defmac + +@defmac AC_F77_FUNC (@var{name}, @ovar{shellvar}) +@maindex F77_FUNC +Given an identifier @var{name}, set the shell variable @var{shellvar} to +hold the mangled version @var{name} according to the rules of the +Fortran 77 linker (see also @code{AC_F77_WRAPPERS}). @var{shellvar} is +optional; if it is not supplied, the shell variable will be simply +@var{name}. The purpose of this macro is to give the caller a way to +access the name-mangling information other than through the C +preprocessor as above; for example, to call Fortran routines from some +language other than C/C++. +@end defmac + +@node System Services, UNIX Variants, Compilers and Preprocessors, Existing Tests +@section System Services + +The following macros check for operating system services or capabilities. + +@defmac AC_PATH_X +@maindex PATH_X +Try to locate the X Window System include files and libraries. If the +user gave the command line options @option{--x-includes=@var{dir}} and +@option{--x-libraries=@var{dir}}, use those directories. If either or +both were not given, get the missing values by running @code{xmkmf} on a +trivial @file{Imakefile} and examining the @file{Makefile} that it +produces. If that fails (such as if @code{xmkmf} is not present), look +for them in several directories where they often reside. If either +method is successful, set the shell variables @code{x_includes} and +@code{x_libraries} to their locations, unless they are in directories +the compiler searches by default. + +If both methods fail, or the user gave the command line option +@option{--without-x}, set the shell variable @code{no_x} to @samp{yes}; +otherwise set it to the empty string. +@end defmac + +@defmac AC_PATH_XTRA +@maindex PATH_XTRA +@ovindex X_CFLAGS +@ovindex X_LIBS +@ovindex X_EXTRA_LIBS +@ovindex X_PRE_LIBS +@cvindex X_DISPLAY_MISSING +An enhanced version of @code{AC_PATH_X}. It adds the C compiler flags +that X needs to output variable @code{X_CFLAGS}, and the X linker flags +to @code{X_LIBS}. Define @code{X_DISPLAY_MISSING} if X is not +available. + +This macro also checks for special libraries that some systems need in +order to compile X programs. It adds any that the system needs to +output variable @code{X_EXTRA_LIBS}. And it checks for special X11R6 +libraries that need to be linked with before @option{-lX11}, and adds +any found to the output variable @code{X_PRE_LIBS}. + +@c This is an incomplete kludge. Make a real way to do it. +@c If you need to check for other X functions or libraries yourself, then +@c after calling this macro, add the contents of @code{X_EXTRA_LIBS} to +@c @code{LIBS} temporarily, like this: (FIXME - add example) +@end defmac + +@defmac AC_SYS_INTERPRETER +@maindex SYS_INTERPRETER +Check whether the system supports starting scripts with a line of the +form @samp{#! /bin/csh} to select the interpreter to use for the script. +After running this macro, shell code in @code{configure.ac} can check +the shell variable @code{interpval}; it will be set to @samp{yes} +if the system supports @samp{#!}, @samp{no} if not. +@end defmac + +@defmac AC_SYS_LARGEFILE +@maindex SYS_LARGEFILE +@cvindex _FILE_OFFSET_BITS +@cvindex _LARGE_FILES +@ovindex CC +Arrange for +@href{http://www.sas.com/standards/large.file/x_open.20Mar96.html, +large-file support}. On some hosts, one must use special compiler +options to build programs that can access large files. Append any such +options to the output variable @code{CC}. Define +@code{_FILE_OFFSET_BITS} and @code{_LARGE_FILES} if necessary. + +Large-file support can be disabled by configuring with the +@option{--disable-largefile} option. + +If you use this macro, check that your program works even when +@code{off_t} is longer than @code{long}, since this is common when +large-file support is enabled. For example, it is not correct to print +an arbitrary @code{off_t} value @code{X} with @code{printf ("%ld", +(long) X)}. +@end defmac + +@defmac AC_SYS_LONG_FILE_NAMES +@maindex SYS_LONG_FILE_NAMES +@cvindex HAVE_LONG_FILE_NAMES +If the system supports file names longer than 14 characters, define +@code{HAVE_LONG_FILE_NAMES}. +@end defmac + +@defmac AC_SYS_POSIX_TERMIOS +@maindex SYS_POSIX_TERMIOS +@cindex POSIX termios headers +@cindex termios POSIX headers +Check to see if POSIX termios headers and functions are available on the +system. If so, set the shell variable @code{am_cv_sys_posix_termios} to +@samp{yes}. If not, set the variable to @samp{no}. +@end defmac + +@node UNIX Variants, , System Services, Existing Tests +@section UNIX Variants + +The following macros check for certain operating systems that need +special treatment for some programs, due to exceptional oddities in +their header files or libraries. These macros are warts; they will be +replaced by a more systematic approach, based on the functions they make +available or the environments they provide. + +@defmac AC_AIX +@maindex AIX +@cvindex _ALL_SOURCE +If on AIX, define @code{_ALL_SOURCE}. Allows the use of some @sc{bsd} +functions. Should be called before any macros that run the C compiler. +@end defmac + +@defmac AC_ISC_POSIX +@maindex ISC_POSIX +@cvindex _POSIX_SOURCE +@ovindex CC +If on a POSIXized ISC @sc{unix}, define @code{_POSIX_SOURCE} and add +@option{-posix} (for the @sc{gnu} C compiler) or @option{-Xp} (for other C +compilers) to output variable @code{CC}. This allows the use of +@sc{posix} facilities. Must be called after @code{AC_PROG_CC} and +before any other macros that run the C compiler. +@end defmac + +@defmac AC_MINIX +@maindex MINIX +@cvindex _MINIX +@cvindex _POSIX_SOURCE +@cvindex _POSIX_1_SOURCE +If on Minix, define @code{_MINIX} and @code{_POSIX_SOURCE} and define +@code{_POSIX_1_SOURCE} to be 2. This allows the use of @sc{posix} +facilities. Should be called before any macros that run the C compiler. +@end defmac + + + + +@c ========================================================= Writing Tests + +@node Writing Tests, Results, Existing Tests, Top +@chapter Writing Tests + +If the existing feature tests don't do something you need, you have to +write new ones. These macros are the building blocks. They provide +ways for other macros to check whether various kinds of features are +available and report the results. + +This chapter contains some suggestions and some of the reasons why the +existing tests are written the way they are. You can also learn a lot +about how to write Autoconf tests by looking at the existing ones. If +something goes wrong in one or more of the Autoconf tests, this +information can help you understand the assumptions behind them, which +might help you figure out how to best solve the problem. + +These macros check the output of the C compiler system. They do +not cache the results of their tests for future use (@pxref{Caching +Results}), because they don't know enough about the information they are +checking for to generate a cache variable name. They also do not print +any messages, for the same reason. The checks for particular kinds of C +features call these macros and do cache their results and print messages +about what they're checking for. + +When you write a feature test that could be applicable to more than one +software package, the best thing to do is encapsulate it in a new macro. +@xref{Writing Autoconf Macros}, for how to do that. + +@menu +* Examining Declarations:: Detecting header files and declarations +* Examining Syntax:: Detecting language syntax features +* Examining Libraries:: Detecting functions and global variables +* Run Time:: Testing for run-time features +* Systemology:: A zoology of operating systems +* Multiple Cases:: Tests for several possible values +* Language Choice:: Selecting which language to use for testing +@end menu + +@node Examining Declarations, Examining Syntax, Writing Tests, Writing Tests +@section Examining Declarations + +The macro @code{AC_TRY_CPP} is used to check whether particular header +files exist. You can check for one at a time, or more than one if you +need several header files to all exist for some purpose. + +@defmac AC_TRY_CPP (@var{includes}, @ovar{action-if-true}, @ovar{action-if-false}) +@maindex TRY_CPP +@var{includes} is C or C++ @code{#include} statements and declarations, +on which shell variable, back quote, and backslash substitutions are +performed. (Actually, it can be any C program, but other statements are +probably not useful.) If the preprocessor produces no error messages +while processing it, run shell commands @var{action-if-true}. Otherwise +run shell commands @var{action-if-false}. + +This macro uses @code{CPPFLAGS}, but not @code{CFLAGS}, because +@option{-g}, @option{-O}, etc. are not valid options to many C +preprocessors. +@end defmac + +Here is how to find out whether a header file contains a particular +declaration, such as a typedef, a structure, a structure member, or a +function. Use @code{AC_EGREP_HEADER} instead of running @code{grep} +directly on the header file; on some systems the symbol might be defined +in another header file that the file you are checking @samp{#include}s. + +@defmac AC_EGREP_HEADER (@var{pattern}, @var{header-file}, @var{action-if-found}, @ovar{action-if-not-found}) +@maindex EGREP_HEADER +If the output of running the preprocessor on the system header file +@var{header-file} matches the @code{egrep} regular expression +@var{pattern}, execute shell commands @var{action-if-found}, otherwise +execute @var{action-if-not-found}. +@end defmac + +To check for C preprocessor symbols, either defined by header files or +predefined by the C preprocessor, use @code{AC_EGREP_CPP}. Here is an +example of the latter: + +@example +AC_EGREP_CPP(yes, +[#ifdef _AIX + yes +#endif +], is_aix=yes, is_aix=no) +@end example + +@defmac AC_EGREP_CPP (@var{pattern}, @var{program}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@maindex EGREP_CPP +@var{program} is the text of a C or C++ program, on which shell +variable, back quote, and backslash substitutions are performed. If the +output of running the preprocessor on @var{program} matches the +@code{egrep} regular expression @var{pattern}, execute shell commands +@var{action-if-found}, otherwise execute @var{action-if-not-found}. + +This macro calls @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP} (depending +on which language is current, @pxref{Language Choice}), if it hasn't +been called already. +@end defmac + +@node Examining Syntax, Examining Libraries, Examining Declarations, Writing Tests +@section Examining Syntax + +To check for a syntax feature of the C, C++ or Fortran 77 compiler, such +as whether it recognizes a certain keyword, use @code{AC_TRY_COMPILE} to +try to compile a small program that uses that feature. You can also use +it to check for structures and structure members that are not present on +all systems. + +@defmac AC_TRY_COMPILE (@var{includes}, @var{function-body}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@maindex TRY_COMPILE +Create a C, C++ or Fortran 77 test program (depending on which language +is current, @pxref{Language Choice}), to see whether a function whose +body consists of @var{function-body} can be compiled. + +For C and C++, @var{includes} is any @code{#include} statements needed +by the code in @var{function-body} (@var{includes} will be ignored if +the currently selected language is Fortran 77). This macro also uses +@code{CFLAGS} or @code{CXXFLAGS} if either C or C++ is the currently +selected language, as well as @code{CPPFLAGS}, when compiling. If +Fortran 77 is the currently selected language then @code{FFLAGS} will be +used when compiling. + +If the file compiles successfully, run shell commands +@var{action-if-found}, otherwise run @var{action-if-not-found}. + +This macro does not try to link; use @code{AC_TRY_LINK} if you need to +do that (@pxref{Examining Libraries}). +@end defmac + +@node Examining Libraries, Run Time, Examining Syntax, Writing Tests +@section Examining Libraries + +To check for a library, a function, or a global variable, Autoconf +@code{configure} scripts try to compile and link a small program that +uses it. This is unlike Metaconfig, which by default uses @code{nm} +or @code{ar} on the C library to try to figure out which functions are +available. Trying to link with the function is usually a more reliable +approach because it avoids dealing with the variations in the options +and output formats of @code{nm} and @code{ar} and in the location of the +standard libraries. It also allows configuring for cross-compilation or +checking a function's runtime behavior if needed. On the other hand, it +can be slower than scanning the libraries once. + +A few systems have linkers that do not return a failure exit status when +there are unresolved functions in the link. This bug makes the +configuration scripts produced by Autoconf unusable on those systems. +However, some of them can be given options that make the exit status +correct. This is a problem that Autoconf does not currently handle +automatically. If users encounter this problem, they might be able to +solve it by setting @code{LDFLAGS} in the environment to pass whatever +options the linker needs (for example, @option{-Wl,-dn} on @sc{mips +risc/os}). + +@code{AC_TRY_LINK} is used to compile test programs to test for +functions and global variables. It is also used by @code{AC_CHECK_LIB} +to check for libraries (@pxref{Libraries}), by adding the library being +checked for to @code{LIBS} temporarily and trying to link a small +program. + +@defmac AC_TRY_LINK (@var{includes}, @var{function-body}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@maindex TRY_LINK +Depending on the current language (@pxref{Language Choice}), create a +test program to see whether a function whose body consists of +@var{function-body} can be compiled and linked. + +For C and C++, @var{includes} is any @code{#include} statements needed +by the code in @var{function-body} (@var{includes} will be ignored if +the currently selected language is Fortran 77). This macro also uses +@code{CFLAGS} or @code{CXXFLAGS} if either C or C++ is the currently +selected language, as well as @code{CPPFLAGS}, when compiling. If +Fortran 77 is the currently selected language then @code{FFLAGS} will be +used when compiling. However, both @code{LDFLAGS} and @code{LIBS} will +be used during linking in all cases. + +If the file compiles and links successfully, run shell commands +@var{action-if-found}, otherwise run @var{action-if-not-found}. +@end defmac + +@defmac AC_TRY_LINK_FUNC (@var{function}, @ovar{action-if-found}, @ovar{action-if-not-found}) +@maindex TRY_LINK_FUNC +Depending on the current language (@pxref{Language Choice}), create a +test program to see whether a program whose body consists of +a prototype of and a call to @var{function} can be compiled and linked. + +If the file compiles and links successfully, run shell commands +@var{action-if-found}, otherwise run @var{action-if-not-found}. +@end defmac + + + +@node Run Time, Systemology, Examining Libraries, Writing Tests +@section Checking Run Time Behavior + +Sometimes you need to find out how a system performs at run time, such +as whether a given function has a certain capability or bug. If you +can, make such checks when your program runs instead of when it is +configured. You can check for things like the machine's endianness when +your program initializes itself. + +If you really need to test for a run-time behavior while configuring, +you can write a test program to determine the result, and compile and +run it using @code{AC_TRY_RUN}. Avoid running test programs if +possible, because this prevents people from configuring your package for +cross-compiling. + +@menu +* Test Programs:: Running test programs +* Guidelines:: General rules for writing test programs +* Test Functions:: Avoiding pitfalls in test programs +@end menu + +@node Test Programs, Guidelines, Run Time, Run Time +@subsection Running Test Programs + +Use the following macro if you need to test run-time behavior of the +system while configuring. + +@defmac AC_TRY_RUN (@var{program}, @ovar{action-if-true}, @ovar{action-if-false}, @ovar{action-if-cross-compiling}) +@maindex TRY_RUN +@var{program} is the text of a C program, on which shell variable and +back quote substitutions are performed. If it compiles and links +successfully and returns an exit status of 0 when executed, run shell +commands @var{action-if-true}. Otherwise, run shell commands +@var{action-if-false}; the exit status of the program is available in +the shell variable @samp{$?}. This macro uses @code{CFLAGS} or +@code{CXXFLAGS}, @code{CPPFLAGS}, @code{LDFLAGS}, and @code{LIBS} when +compiling. + +If the C compiler being used does not produce executables that run on +the system where @code{configure} is being run, then the test program is +not run. If the optional shell commands @var{action-if-cross-compiling} +are given, they are run instead. Otherwise, @code{configure} prints +an error message and exits. +@end defmac + +Try to provide a pessimistic default value to use when cross-compiling +makes run-time tests impossible. You do this by passing the optional +last argument to @code{AC_TRY_RUN}. @code{autoconf} prints a warning +message when creating @code{configure} each time it encounters a call to +@code{AC_TRY_RUN} with no @var{action-if-cross-compiling} argument +given. You may ignore the warning, though users will not be able to +configure your package for cross-compiling. A few of the macros +distributed with Autoconf produce this warning message. + +To configure for cross-compiling you can also choose a value for those +parameters based on the canonical system name (@pxref{Manual +Configuration}). Alternatively, set up a test results cache file with +the correct values for the host system (@pxref{Caching Results}). + +To provide a default for calls of @code{AC_TRY_RUN} that are embedded in +other macros, including a few of the ones that come with Autoconf, you +can call @code{AC_PROG_CC} before running them. Then, if the shell +variable @code{cross_compiling} is set to @samp{yes}, use an alternate +method to get the results instead of calling the macros. + + +@node Guidelines, Test Functions, Test Programs, Run Time +@subsection Guidelines for Test Programs + +Test programs should not write anything to the standard output. They +should return 0 if the test succeeds, nonzero otherwise, so that success +can be distinguished easily from a core dump or other failure; +segmentation violations and other failures produce a nonzero exit +status. Test programs should @code{exit}, not @code{return}, from +@code{main}, because on some systems (old Suns, at least) the argument +to @code{return} in @code{main} is ignored. + +Test programs can use @code{#if} or @code{#ifdef} to check the values of +preprocessor macros defined by tests that have already run. For +example, if you call @code{AC_HEADER_STDC}, then later on in +@file{configure.ac} you can have a test program that includes an +@sc{ansi} C header file conditionally: + +@example +@group +#if STDC_HEADERS +# include <stdlib.h> +#endif +@end group +@end example + +If a test program needs to use or create a data file, give it a name +that starts with @file{conftest}, such as @file{conftest.data}. The +@code{configure} script cleans up by running @samp{rm -rf conftest*} +after running test programs and if the script is interrupted. + +@node Test Functions, , Guidelines, Run Time +@subsection Test Functions + +Function declarations in test programs should have a prototype +conditionalized for C++. In practice, though, test programs rarely need +functions that take arguments. + +@example +#ifdef __cplusplus +foo (int i) +#else +foo (i) int i; +#endif +@end example + +Functions that test programs declare should also be conditionalized for +C++, which requires @samp{extern "C"} prototypes. Make sure to not +include any header files containing clashing prototypes. + +@example +#ifdef __cplusplus +extern "C" void *malloc (size_t); +#else +char *malloc (); +#endif +@end example + +If a test program calls a function with invalid parameters (just to see +whether it exists), organize the program to ensure that it never invokes +that function. You can do this by calling it in another function that is +never invoked. You can't do it by putting it after a call to +@code{exit}, because GCC version 2 knows that @code{exit} never returns +and optimizes out any code that follows it in the same block. + +If you include any header files, make sure to call the functions +relevant to them with the correct number of arguments, even if they are +just 0, to avoid compilation errors due to prototypes. GCC version 2 +has internal prototypes for several functions that it automatically +inlines; for example, @code{memcpy}. To avoid errors when checking for +them, either pass them the correct number of arguments or redeclare them +with a different return type (such as @code{char}). + +@node Systemology, Multiple Cases, Run Time, Writing Tests +@section Systemology + +This section aims at presenting some systems and pointers to +documentation. It may help you addressing particular problems reported +by users. + +@table @asis +@item @sc{qnx 4.25} +@cindex @sc{qnx 4.25} +@c FIXME: Please, if you feel like writing something more precise, +@c it'd be great. In particular, I can't understand the difference with +@c QNX Neutrino. +@sc{qnx} is a realtime operating system running on Intel architecture +meant to be scalable from the small embedded systems to hundred +processor super-computer. It claims to be @sc{posix} certified. More +information is available on the @href{www.qnx.com, @sc{qnx} home page}, +including the @href{http://support.qnx.com/support/docs/qnx4/, @sc{qnx} +man pages}. +@end table + + +@node Multiple Cases, Language Choice, Systemology, Writing Tests +@section Multiple Cases + +Some operations are accomplished in several possible ways, depending on +the @sc{unix} variant. Checking for them essentially requires a ``case +statement''. Autoconf does not directly provide one; however, it is +easy to simulate by using a shell variable to keep track of whether a +way to perform the operation has been found yet. + +Here is an example that uses the shell variable @code{fstype} to keep +track of whether the remaining cases need to be checked. + +@example +@group +AC_MSG_CHECKING([how to get file system type]) +fstype=no +# The order of these tests is important. +AC_TRY_CPP([#include <sys/statvfs.h> +#include <sys/fstyp.h>], + [AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4]) +if test $fstype = no; then + AC_TRY_CPP([#include <sys/statfs.h> +#include <sys/fstyp.h>], + [AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3]) +fi +if test $fstype = no; then + AC_TRY_CPP([#include <sys/statfs.h> +#include <sys/vmount.h>], + [AC_DEFINE(FSTYPE_AIX_STATFS) fstype=AIX]) +fi +# (more cases omitted here) +AC_MSG_RESULT([$fstype]) +@end group +@end example + +@node Language Choice, , Multiple Cases, Writing Tests +@section Language Choice +@cindex Language + +Autoconf-generated @code{configure} scripts check for the C compiler and +its features by default. Packages that use other programming languages +(maybe more than one, e.g. C and C++) need to test features of the +compilers for the respective languages. The following macros determine +which programming language is used in the subsequent tests in +@file{configure.ac}. + +@defmac AC_LANG (@var{language}) +Do compilation tests using the compiler, preprocessor and file +extensions for the specified @var{language}. + +Supported languages are: + +@table @samp +@item C +Do compilation tests using @code{CC} and @code{CPP} and use extension +@file{.c} for test programs. + +@item C++ +Do compilation tests using @code{CXX} and @code{CXXCPP} and use +extension @file{.C} for test programs. + +@item Fortran 77 +Do compilation tests using @code{F77} and use extension @file{.f} for +test programs. +@end table +@end defmac + +@defmac AC_LANG_PUSH (@var{language}) +@maindex LANG_PUSH +Remember the current language (as set by @code{AC_LANG}) on a stack, and +then select the @var{language}. Use this macro and @code{AC_LANG_POP} +in macros that need to temporarily switch to a particular language. +@end defmac + +@defmac AC_LANG_POP (@ovar{language}) +@maindex LANG_POP +Select the language that is saved on the top of the stack, as set by +@code{AC_LANG_PUSH}, and remove it from the stack. + +If given, @var{language} specifies the language we just @emph{quit}. It +is a good idea to specify it when it's known (which should be the +case@dots{}), since Autoconf will detect inconsistencies. + +@example +AC_LANG_PUSH(Fortran 77) +# Perform some tests on Fortran 77. +# ... +AC_LANG_POP(Fortran 77) +@end example +@end defmac + +@defmac AC_REQUIRE_CPP +@maindex REQUIRE_CPP +Ensure that whichever preprocessor would currently be used for tests has +been found. Calls @code{AC_REQUIRE} (@pxref{Prerequisite Macros}) with an +argument of either @code{AC_PROG_CPP} or @code{AC_PROG_CXXCPP}, +depending on which language is current. +@end defmac + + + +@c ====================================================== Results of Tests. + +@node Results, Programming in M4, Writing Tests, Top +@chapter Results of Tests + +Once @code{configure} has determined whether a feature exists, what can +it do to record that information? There are four sorts of things it can +do: define a C preprocessor symbol, set a variable in the output files, +save the result in a cache file for future @code{configure} runs, and +print a message letting the user know the result of the test. + +@menu +* Defining Symbols:: Defining C preprocessor symbols +* Setting Output Variables:: Replacing variables in output files +* Caching Results:: Speeding up subsequent @code{configure} runs +* Printing Messages:: Notifying @code{configure} users +@end menu + +@node Defining Symbols, Setting Output Variables, Results, Results +@section Defining C Preprocessor Symbols + +A common action to take in response to a feature test is to define a C +preprocessor symbol indicating the results of the test. That is done by +calling @code{AC_DEFINE} or @code{AC_DEFINE_UNQUOTED}. + +By default, @code{AC_OUTPUT} places the symbols defined by these macros +into the output variable @code{DEFS}, which contains an option +@option{-D@var{symbol}=@var{value}} for each symbol defined. Unlike in +Autoconf version 1, there is no variable @code{DEFS} defined while +@code{configure} is running. To check whether Autoconf macros have +already defined a certain C preprocessor symbol, test the value of the +appropriate cache variable, as in this example: + +@example +AC_CHECK_FUNC(vprintf, [AC_DEFINE(HAVE_VPRINTF)]) +if test "$ac_cv_func_vprintf" != yes; then + AC_CHECK_FUNC(_doprnt, [AC_DEFINE(HAVE_DOPRNT)]) +fi +@end example + +If @code{AC_CONFIG_HEADERS} has been called, then instead of creating +@code{DEFS}, @code{AC_OUTPUT} creates a header file by substituting the +correct values into @code{#define} statements in a template file. +@xref{Configuration Headers}, for more information about this kind of +output. + +@defmac AC_DEFINE (@var{variable}, @ovar{value}, @ovar{description}) +@maindex DEFINE +Define C preprocessor variable @var{variable}. If @var{value} is given, +set @var{variable} to that value (verbatim), otherwise set it to 1. +@var{value} should not contain literal newlines, and if you are not +using @code{AC_CONFIG_HEADERS} it should not contain any @samp{#} +characters, as @code{make} tends to eat them. To use a shell variable +(which you need to do in order to define a value containing the M4 quote +characters @samp{[} or @samp{]}), use @code{AC_DEFINE_UNQUOTED} instead. +@var{description} is only useful if you are using +@code{AC_CONFIG_HEADERS}. In this case, @var{description} is put into +the generated @file{config.h.in} as the comment before the macro define. +The following example defines the C preprocessor variable +@code{EQUATION} to be the string constant @samp{"$a > $b"}: + +@example +AC_DEFINE(EQUATION, "$a > $b") +@end example +@end defmac + +@defmac AC_DEFINE_UNQUOTED (@var{variable}, @ovar{value}, @ovar{description}) +@maindex DEFINE_UNQUOTED +Like @code{AC_DEFINE}, but three shell expansions are +performed---once---on @var{variable} and @var{value}: variable expansion +(@samp{$}), command substitution (@samp{`}), and backslash escaping +(@samp{\}). Single and double quote characters in the value have no +special meaning. Use this macro instead of @code{AC_DEFINE} when +@var{variable} or @var{value} is a shell variable. Examples: + +@example +AC_DEFINE_UNQUOTED(config_machfile, "$machfile") +AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups) +AC_DEFINE_UNQUOTED($ac_tr_hdr) +@end example +@end defmac + +Due to the syntactical bizarreness of the Bourne shell, do not use +semicolons to separate @code{AC_DEFINE} or @code{AC_DEFINE_UNQUOTED} +calls from other macro calls or shell code; that can cause syntax errors +in the resulting @code{configure} script. Use either spaces or +newlines. That is, do this: + +@example +AC_CHECK_HEADER(elf.h, [AC_DEFINE(SVR4) LIBS="$LIBS -lelf"]) +@end example + +@noindent +or this: + +@example +AC_CHECK_HEADER(elf.h, + [AC_DEFINE(SVR4) + LIBS="$LIBS -lelf"]) +@end example + +@noindent +instead of this: + +@example +AC_CHECK_HEADER(elf.h, [AC_DEFINE(SVR4); LIBS="$LIBS -lelf"]) +@end example + +@node Setting Output Variables, Caching Results, Defining Symbols, Results +@section Setting Output Variables + +Another way to record the results of tests is to set @dfn{output +variables}, which are shell variables whose values are substituted into +files that @code{configure} outputs. The two macros below create new +output variables. @xref{Preset Output Variables}, for a list of output +variables that are always available. + +@defmac AC_SUBST (@var{variable}, @ovar{value}) +@maindex SUBST +Create an output variable from a shell variable. Make @code{AC_OUTPUT} +substitute the variable @var{variable} into output files (typically one +or more @file{Makefile}s). This means that @code{AC_OUTPUT} will +replace instances of @samp{@@@var{variable}@@} in input files with the +value that the shell variable @var{variable} has when @code{AC_OUTPUT} +is called. This value of @var{variable} should not contain literal +newlines. + +If @var{value} is given, in addition assign it to @samp{variable}. +@end defmac + +@defmac AC_SUBST_FILE (@var{variable}) +@maindex SUBST_FILE +Another way to create an output variable from a shell variable. Make +@code{AC_OUTPUT} insert (without substitutions) the contents of the file +named by shell variable @var{variable} into output files. This means +that @code{AC_OUTPUT} will replace instances of +@samp{@@@var{variable}@@} in output files (such as @file{Makefile.in}) +with the contents of the file that the shell variable @var{variable} +names when @code{AC_OUTPUT} is called. Set the variable to +@file{/dev/null} for cases that do not have a file to insert. + +This macro is useful for inserting @file{Makefile} fragments containing +special dependencies or other @code{make} directives for particular host +or target types into @file{Makefile}s. For example, @file{configure.ac} +could contain: + +@example +AC_SUBST_FILE(host_frag) +host_frag=$srcdir/conf/sun4.mh +@end example + +@noindent +and then a @file{Makefile.in} could contain: + +@example +@@host_frag@@ +@end example +@end defmac + +@cindex Previous Variable +@cindex Variable, Precious +Running @command{configure} in different environments can be extremely +dangerous. If for instance the user runs @samp{CC=bizarre-cc +./configure}, then the cache, @file{config.h} and many other output +files will depend upon @command{bizarre-cc} being the C compiler. If +for some reason the user runs @command{/configure} again, or if it is +run via @samp{./config.status --recheck}, (@xref{Automatic Remaking}, +and @pxref{config.status Invocation}), then the configuration can be +inconsistent, composed of results depending upon two different +compilers. + +Such variables are named @dfn{precious variables}, and can be declared +as such by @code{AC_ARG_VAR}. + +@defmac AC_ARG_VAR (@var{variable}, @var{description}) +@maindex ARG_VAR +Declare @var{variable} is a precious variable, and include its +@var{description} in the variable section of @samp{./configure --help}. + +Being precious means that +@itemize @minus +@item +@var{variable} is @code{AC_SUBST}'d. + +@item +@var{variable} is kept in the cache including if it was not specified on +the @samp{./configure} command line. Indeed, while @command{configure} +can notice the definition of @code{CC} in @samp{./configure +CC=bizarre-cc}, it is impossible to notice it in @samp{CC=bizarre-cc +./configure}, which, unfortunately, is what most users do. + +@item +@var{variable} is checked for consistency between two +@command{configure} runs. For instance: + +@example +$ ./configure --silent --config-cache +$ CC=cc ./configure --silent --config-cache +configure: error: `CC' was not set in the previous run +configure: error: changes in the environment can compromise \ +the build +configure: error: run `make distclean' and/or \ +`rm config.cache' and start over +@end example + +@noindent +and similarly if the variable is unset, or if its content is changed. + + +@item +@var{variable} is kept during automatic reconfiguration +(@pxref{config.status Invocation}) as if it had been passed as a command +line argument, including when no cache is used: + +@example +$ CC=/usr/bin/cc ./configure undeclared_var=raboof --silent +$ ./config.status --recheck +running /bin/sh ./configure undeclared_var=raboof --silent \ + CC=/usr/bin/cc --no-create --no-recursion +@end example +@end itemize +@end defmac + + +@node Caching Results, Printing Messages, Setting Output Variables, Results +@section Caching Results +@cindex Cache + +To avoid checking for the same features repeatedly in various +@code{configure} scripts (or in repeated runs of one script), +@code{configure} can optionally save the results of many checks in a +@dfn{cache file} (@pxref{Cache Files}). If a @code{configure} script +runs with caching enabled and finds a cache file, it reads the results +of previous runs from the cache and avoids rerunning those checks. As a +result, @code{configure} can then run much faster than if it had to +perform all of the checks every time. + +@defmac AC_CACHE_VAL (@var{cache-id}, @var{commands-to-set-it}) +@maindex CACHE_VAL +Ensure that the results of the check identified by @var{cache-id} are +available. If the results of the check were in the cache file that was +read, and @code{configure} was not given the @option{--quiet} or +@option{--silent} option, print a message saying that the result was +cached; otherwise, run the shell commands @var{commands-to-set-it}. If +the shell commands are run to determine the value, the value will be +saved in the cache file just before @code{configure} creates its output +files. @xref{Cache Variable Names}, for how to choose the name of the +@var{cache-id} variable. + +The @var{commands-to-set-it} @emph{must have no side effects} except for +setting the variable @var{cache-id}, see below. +@end defmac + +@defmac AC_CACHE_CHECK (@var{message}, @var{cache-id}, @var{commands-to-set-it}) +@maindex CACHE_CHECK +A wrapper for @code{AC_CACHE_VAL} that takes care of printing the +messages. This macro provides a convenient shorthand for the most +common way to use these macros. It calls @code{AC_MSG_CHECKING} for +@var{message}, then @code{AC_CACHE_VAL} with the @var{cache-id} and +@var{commands} arguments, and @code{AC_MSG_RESULT} with @var{cache-id}. + +The @var{commands-to-set-it} @emph{must have no side effects} except for +setting the variable @var{cache-id}, see below. +@end defmac + +It is very common to find buggy macros using @code{AC_CACHE_VAL} or +@code{AC_CACHE_CHECK}, because people are tempted to call +@code{AC_DEFINE} in the @var{commands-to-set-it}. Instead, the code that +@emph{follows} the call to @code{AC_CACHE_VAL} should call +@code{AC_DEFINE}, by examining the value of the cache variable. For +instance, the following macro is broken: + +@example +@group +AC_DEFUN([AC_SHELL_TRUE], +[AC_CACHE_CHECK([whether true(1) works], [ac_cv_shell_true_works], + [ac_cv_shell_true_works=no + true && ac_cv_shell_true_works=yes + if test $ac_cv_shell_true_works = yes; then + AC_DEFINE([TRUE_WORKS], 1 + [Define if `true(1)' works properly.]) + fi]) +]) +@end group +@end example + +@noindent +This fails if the cache is enabled: the second time this macro is run, +@code{TRUE_WORKS} @emph{will not be defined}. The proper implementation +is: + +@example +@group +AC_DEFUN([AC_SHELL_TRUE], +[AC_CACHE_CHECK([whether true(1) works], [ac_cv_shell_true_works], + [ac_cv_shell_true_works=no + true && ac_cv_shell_true_works=yes]) + if test $ac_cv_shell_true_works = yes; then + AC_DEFINE([TRUE_WORKS], 1 + [Define if `true(1)' works properly.]) + fi +]) +@end group +@end example + +Also, @var{commands-to-set-it} should not print any messages, for +example with @code{AC_MSG_CHECKING}; do that before calling +@code{AC_CACHE_VAL}, so the messages are printed regardless of whether +the results of the check are retrieved from the cache or determined by +running the shell commands. + +@menu +* Cache Variable Names:: Shell variables used in caches +* Cache Files:: Files @code{configure} uses for caching +* Cache Checkpointing:: Loading and saving the cache file +@end menu + +@node Cache Variable Names, Cache Files, Caching Results, Caching Results +@subsection Cache Variable Names +@cindex Cache variable + +The names of cache variables should have the following format: + +@example +@var{package-prefix}_cv_@var{value-type}_@var{specific-value}_@ovar{additional-options} +@end example + +@noindent +for example, @samp{ac_cv_header_stat_broken} or +@samp{ac_cv_prog_gcc_traditional}. The parts of the variable name are: + +@table @asis +@item @var{package-prefix} +An abbreviation for your package or organization; the same prefix you +begin local Autoconf macros with, except lowercase by convention. +For cache values used by the distributed Autoconf macros, this value is +@samp{ac}. + +@item @code{_cv_} +Indicates that this shell variable is a cache value. This string +@emph{must} be present in the variable name, including the leading +underscore. + +@item @var{value-type} +A convention for classifying cache values, to produce a rational naming +system. The values used in Autoconf are listed in @ref{Macro Names}. + +@item @var{specific-value} +Which member of the class of cache values this test applies to. +For example, which function (@samp{alloca}), program (@samp{gcc}), or +output variable (@samp{INSTALL}). + +@item @var{additional-options} +Any particular behavior of the specific member that this test applies to. +For example, @samp{broken} or @samp{set}. This part of the name may +be omitted if it does not apply. +@end table + +The values assigned to cache variables may not contain newlines. +Usually, their values will be boolean (@samp{yes} or @samp{no}) or the +names of files or functions; so this is not an important restriction. + +@node Cache Files, Cache Checkpointing, Cache Variable Names, Caching Results +@subsection Cache Files + +A cache file is a shell script that caches the results of configure +tests run on one system so they can be shared between configure scripts +and configure runs. It is not useful on other systems. If its contents +are invalid for some reason, the user may delete or edit it. + +By default, @code{configure} uses no cache file (technically, it uses +@option{--cache-file=/dev/null}), to avoid problems caused by accidental +use of stale cache files. + +To enable caching, @code{configure} accepts @option{--config-cache} (or +@option{-C}) to cache results in the file @file{config.cache}. +Alternatively, @option{--cache-file=@var{file}} specifies that +@var{file} be the cache file. The cache file is created if it does not +exist already. When @code{configure} calls @code{configure} scripts in +subdirectories, it uses the @option{--cache-file} argument so that they +share the same cache. @xref{Subdirectories}, for information on +configuring subdirectories with the @code{AC_CONFIG_SUBDIRS} macro. + +@file{config.status} only pays attention to the cache file if it is +given the @option{--recheck} option, which makes it rerun +@code{configure}. + +It is wrong to try to distribute cache files for particular system types. +There is too much room for error in doing that, and too much +administrative overhead in maintaining them. For any features that +can't be guessed automatically, use the standard method of the canonical +system type and linking files (@pxref{Manual Configuration}). + +The site initialization script can specify a site-wide cache file to +use, instead of the usual per-program cache. In this case, the cache +file will gradually accumulate information whenever someone runs a new +@code{configure} script. (Running @code{configure} merges the new cache +results with the existing cache file.) This may cause problems, +however, if the system configuration (e.g. the installed libraries or +compilers) changes and the stale cache file is not deleted. + +@node Cache Checkpointing, , Cache Files, Caching Results +@subsection Cache Checkpointing + +If your configure script, or a macro called from configure.ac, happens +to abort the configure process, it may be useful to checkpoint the cache +a few times at key points using @code{AC_CACHE_SAVE}. Doing so will +reduce the amount of time it takes to re-run the configure script with +(hopefully) the error that caused the previous abort corrected. + +@c FIXME: Do we really want to document this guy? +@defmac AC_CACHE_LOAD +@maindex CACHE_LOAD +Loads values from existing cache file, or creates a new cache file if a +cache file is not found. Called automatically from @code{AC_INIT}. +@end defmac + +@defmac AC_CACHE_SAVE +@maindex CACHE_SAVE +Flushes all cached values to the cache file. Called automatically from +@code{AC_OUTPUT}, but it can be quite useful to call +@code{AC_CACHE_SAVE} at key points in configure.ac. +@end defmac + +For instance: + +@example +@r{ @dots{} AC_INIT, etc. @dots{}} +@group +# Checks for programs. +AC_PROG_CC +AC_PROG_GCC_TRADITIONAL +@r{ @dots{} more program checks @dots{}} +AC_CACHE_SAVE +@end group + +@group +# Checks for libraries. +AC_CHECK_LIB(nsl, gethostbyname) +AC_CHECK_LIB(socket, connect) +@r{ @dots{} more lib checks @dots{}} +AC_CACHE_SAVE +@end group + +@group +# Might abort... +AM_PATH_GTK(1.0.2,, (exit 1); exit) +AM_PATH_GTKMM(0.9.5,, (exit 1); exit) +@end group +@r{ @dots{} AC_OUTPUT, etc. @dots{}} +@end example + +@node Printing Messages, , Caching Results, Results +@section Printing Messages +@cindex Messages, from @code{configure} + +@code{configure} scripts need to give users running them several kinds +of information. The following macros print messages in ways appropriate +for each kind. The arguments to all of them get enclosed in shell +double quotes, so the shell performs variable and back-quote +substitution on them. + +These macros are all wrappers around the @code{echo} shell command. +@code{configure} scripts should rarely need to run @code{echo} directly +to print messages for the user. Using these macros makes it easy to +change how and when each kind of message is printed; such changes need +only be made to the macro definitions and all of the callers will change +automatically. + +To diagnose static issues, i.e., when @code{autoconf} is run, see +@ref{Reporting Messages}. + +@defmac AC_MSG_CHECKING (@var{feature-description}) +@maindex MSG_CHECKING +Notify the user that @code{configure} is checking for a particular +feature. This macro prints a message that starts with @samp{checking } +and ends with @samp{...} and no newline. It must be followed by a call +to @code{AC_MSG_RESULT} to print the result of the check and the +newline. The @var{feature-description} should be something like +@samp{whether the Fortran compiler accepts C++ comments} or @samp{for +c89}. + +This macro prints nothing if @code{configure} is run with the +@option{--quiet} or @option{--silent} option. +@end defmac + +@defmac AC_MSG_RESULT (@var{result-description}) +@maindex MSG_RESULT +Notify the user of the results of a check. @var{result-description} is +almost always the value of the cache variable for the check, typically +@samp{yes}, @samp{no}, or a file name. This macro should follow a call +to @code{AC_MSG_CHECKING}, and the @var{result-description} should be +the completion of the message printed by the call to +@code{AC_MSG_CHECKING}. + +This macro prints nothing if @code{configure} is run with the +@option{--quiet} or @option{--silent} option. +@end defmac + +@defmac AC_MSG_NOTICE (@var{message}) +@maindex MSG_NOTICE +Deliver the @var{message} to the user. It is useful mainly to print a +general description of the overall purpose of a group of feature checks, +e.g., + +@example +AC_MSG_NOTICE([checking if stack overflow is detectable]) +@end example + +This macro prints nothing if @code{configure} is run with the +@option{--quiet} or @option{--silent} option. +@end defmac + +@defmac AC_MSG_ERROR (@var{error-description}, @ovar{exit-status}) +@maindex MSG_ERROR +Notify the user of an error that prevents @code{configure} from +completing. This macro prints an error message to the standard error +output and exits @code{configure} with @var{exit-status} (1 by default). +@var{error-description} should be something like @samp{invalid value +$HOME for \$HOME}. + +The @var{error-description} should start with a lower-case letter, and +``cannot'' is preferred to ``can't''. +@end defmac + +@defmac AC_MSG_WARN (@var{problem-description}) +@maindex MSG_WARN +Notify the @code{configure} user of a possible problem. This macro +prints the message to the standard error output; @code{configure} +continues running afterward, so macros that call @code{AC_MSG_WARN} should +provide a default (back-up) behavior for the situations they warn about. +@var{problem-description} should be something like @samp{ln -s seems to +make hard links}. +@end defmac + + + +@c ====================================================== Programming in M4. + +@node Programming in M4, Writing Autoconf Macros, Results, Top +@chapter Programming in M4 + +Autoconf is written on top of two layers: @dfn{M4sugar}, which provides +convenient macros for pure M4 programming, and @dfn{M4sh}, which +provides macros dedicated to shell script generation. + +As of this version of Autoconf, these two layers are still experimental, +and their interface might change in the future. As a matter of fact, +@emph{anything that is not documented must not be used}. + +@menu +* M4 Quotation:: Protecting macros from unwanted expansion +* Programming in M4sugar:: Convenient pure M4 macros +@end menu + +@node M4 Quotation, Programming in M4sugar, Programming in M4, Programming in M4 +@section M4 Quotation +@cindex quotation + +@c FIXME: Grmph, yet another quoting myth: quotation has *never* +@c prevented `expansion' of $1. Unless it refers to the expansion +@c of the value of $1? Anyway, we need a rewrite here@dots{} + +The most common brokenness of existing macros is an improper quotation. +This section, which users of Autoconf can skip, but which macro writers +@emph{must} read, first justifies the quotation scheme that was chosen +for Autoconf and then ends with a rule of thumb. Understanding the +former helps one to follow the latter. + +@menu +* Active Characters:: Characters that change the behavior of m4 +* One Macro Call:: Quotation and one macro call +* Quotation and Nested Macros:: Macros calling macros +* Quadrigraphs:: Another way to escape special characters +* Quotation Rule Of Thumb:: One parenthesis, one quote +@end menu + +@node Active Characters, One Macro Call, M4 Quotation, M4 Quotation +@subsection Active Characters + +To fully understand where proper quotation is important, you first need +to know what are the special characters in Autoconf: @samp{#} introduces +a comment inside which no macro expansion is performed, @samp{,} +separates arguments, @samp{[} and @samp{]} are the quotes themselves, +and finally @samp{(} and @samp{)} (which @code{m4} tries to match by +pairs). + +In order to understand the delicate case of macro calls, we first have +to present some obvious failures. Below they are ``obvious-ified'', +although you find them in real life, they are usually in disguise. + +Comments, introduced by a hash and running up to the newline, are opaque +tokens to the top level: active characters are turned off, and there is +no macro expansion: + +@example +# define([def], ine) +@result{}# define([def], ine) +@end example + +Each time there can be a macro expansion, there is a quotation +expansion; i.e., one level of quotes is stripped: + +@example +int tab[10]; +@result{}int tab10; +[int tab[10];] +@result{}int tab[10]; +@end example + +Without this in mind, the reader will try hopelessly to use her macro +@code{array}: + +@example +define([array], [int tab[10];]) +array +@result{}int tab10; +[array] +@result{}array +@end example + +@noindent +How can you correctly output the intended results@footnote{Using +@code{defn}.}? + + +@node One Macro Call, Quotation and Nested Macros, Active Characters, M4 Quotation +@subsection One Macro Call + +Let's proceed on the interaction between active characters and macros +with this small macro, which just returns its first argument: + +@example +define([car], [$1]) +@end example + +@noindent +The two pairs of quotes above are not part of the arguments of +@code{define}; rather, they are understood by the top level when it +tries to find the arguments of @code{define}. Therefore, it is +equivalent to write: + +@example +define(car, $1) +@end example + +@noindent +But, while it is acceptable for a @file{configure.ac} to avoid unneeded +quotes, it is bad practice for Autoconf macros which must both be more +robust and also advocate perfect style. + +At the top level, there are only two possible quotings: either you +quote or you don't: + +@example +car(foo, bar, baz) +@result{}foo +[car(foo, bar, baz)] +@result{}car(foo, bar, baz) +@end example + +Let's pay attention to the special characters: + +@example +car(#) +@error{}EOF in argument list +@end example + +The closing parenthesis is hidden in the comment; with a hypothetical +quoting, the top level understood it this way: + +@example +car([#)] +@end example + +@noindent +Proper quotation, of course, fixes the problem: + +@example +car([#]) +@result{}# +@end example + +The reader will easily understand the following examples: + +@example +car(foo, bar) +@result{}foo +car([foo, bar]) +@result{}foo, bar +car((foo, bar)) +@result{}(foo, bar) +car([(foo], [bar)]) +@result{}(foo +car([], []) +@result{} +car([[]], [[]]) +@result{}[] +@end example + +With this in mind, we can explore the cases where macros invoke +macros@dots{} + + +@node Quotation and Nested Macros, Quadrigraphs, One Macro Call, M4 Quotation +@subsection Quotation and Nested Macros + +The examples below use the following macros: + +@example +define([car], [$1]) +define([active], [ACT, IVE]) +define([array], [int tab[10]]) +@end example + +Each additional embedded macro call introduces other possible +interesting quotations: + +@example +car(active) +@result{}ACT +car([active]) +@result{}ACT, IVE +car([[active]]) +@result{}active +@end example + +In the first case, the top level looks for the arguments of @code{car}, +and finds @samp{active}. Because @code{m4} evaluates its arguments +before applying the macro, @samp{active} is expanded, which results in: + +@example +car(ACT, IVE) +@result{}ACT +@end example + +@noindent +In the second case, the top level gives @samp{active} as first and only +argument of @code{car}, which results in: + +@example +active +@result{}ACT, IVE +@end example + +@noindent +i.e., the argument is evaluated @emph{after} the macro that invokes it. +In the third case, @code{car} receives @samp{[active]}, which results in: + +@example +[active] +@result{}active +@end example + +@noindent +exactly as we already saw above. + +The example above, applied to a more realistic example, gives: + +@example +car(int tab[10];) +@result{}int tab10; +car([int tab[10];]) +@result{}int tab10; +car([[int tab[10];]]) +@result{}int tab[10]; +@end example + +@noindent +Huh? The first case is easily understood, but why is the second wrong, +and the third right? To understand that, you must know that after +@code{m4} expands a macro, the resulting text is immediately subjected +to macro expansion and quote removal. This means that the quote removal +occurs twice---first before the argument is passed to the @code{car} +macro, and second after the @code{car} macro expands to the first +argument. + +As the author of the Autoconf macro @code{car}, you then consider it to +be incorrect that your users have to double-quote the arguments of +@code{car}, so you ``fix'' your macro. Let's call it @code{qar} for +quoted car: + +@example +define([qar], [[$1]]) +@end example + +@noindent +and check that @code{qar} is properly fixed: + +@example +qar([int tab[10];]) +@result{}int tab[10]; +@end example + +@noindent +Ahhh! That's much better. + +But note what you've done: now that the arguments are literal strings, +if the user wants to use the results of expansions as arguments, she has +to use an @emph{unquoted} macro call: + +@example +qar(active) +@result{}ACT +@end example + +@noindent +where she wanted to reproduce what she used to do with @code{car}: + +@example +car([active]) +@result{}ACT, IVE +@end example + +@noindent +Worse yet: she wants to use a macro that produces a set of @code{cpp} +macros: + +@example +define([my_includes], [#include <stdio.h>]) +car([my_includes]) +@result{}#include <stdio.h> +qar(my_includes) +@error{}EOF in argument list +@end example + +This macro, @code{qar}, because it double quotes its arguments, forces +its users to leave their macro calls unquoted, which is dangerous. +Commas and other active symbols are interpreted by @code{m4} before +they are given to the macro, often not in the way the users expect. +Also, because @code{qar} behaves differently from the other macros, +it's an exception that should be avoided in Autoconf. + + +@node Quadrigraphs, Quotation Rule Of Thumb, Quotation and Nested Macros, M4 Quotation +@subsection Quadrigraphs +@cindex quadrigraphs +@cindex @samp{@@<:@@} +@cindex @samp{@@:>@@} +@cindex @samp{@@S|@@} +@cindex @samp{@@%:@@} + +When writing an autoconf macro you may occasionally need to generate +special characters that are difficult to express with the standard +autoconf quoting rules. For example, you may need to output the regular +expression @samp{[^[]}, which matches any character other than @samp{[}. +This expression contains unbalanced brackets so it cannot be put easily +into an M4 macro. + +You can work around this problem by using one of the following +@dfn{quadrigraphs}: + +@table @samp +@item @@<:@@ +@samp{[} +@item @@:>@@ +@samp{]} +@item @@S|@@ +@samp{$} +@item @@%:@@ +@samp{#} +@end table + +Quadrigraphs are replaced at a late stage of the translation process, +after @command{m4} is run, so they do not get in the way of M4 quoting. +For example, the string @samp{[^@@<:@@]}, if properly quoted, will +appear as @samp{[^[]} in the @code{configure} script. + + +@node Quotation Rule Of Thumb, , Quadrigraphs, M4 Quotation +@subsection Quotation Rule Of Thumb + +To conclude, the quotation rule of thumb is: + +@center @emph{One pair of quotes per pair of parentheses.} + +Never over-quote, never under-quote, in particular in the definition of +macros. In the few places where the macros need to use brackets +(usually in C program text or regular expressions), properly quote +@emph{the arguments}! + +It is common to read Autoconf programs with snippets like: + +@example +AC_TRY_LINK( +changequote(<<, >>)dnl +<<#include <time.h> +#ifndef tzname /* For SGI. */ +extern char *tzname[]; /* RS6000 and others reject char **tzname. */ +#endif>>, +changequote([, ])dnl +[atoi (*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no) +@end example + +@noindent +which is incredibly useless since @code{AC_TRY_LINK} is @emph{already} +double quoting, so you just need: + +@example +AC_TRY_LINK( +[#include <time.h> +#ifndef tzname /* For SGI. */ +extern char *tzname[]; /* RS6000 and others reject char **tzname. */ +#endif], + [atoi (*tzname);], + [ac_cv_var_tzname=yes], + [ac_cv_var_tzname=no]) +@end example + +@noindent +The M4-fluent reader will note that these two examples are rigorously +equivalent, since @code{m4} swallows both the @samp{changequote(<<, >>)} +and @samp{<<} @samp{>>} when it @dfn{collects} the arguments: these +quotes are not part of the arguments! + +Simplified, the example above is just doing this: + +@example +changequote(<<, >>)dnl +<<[]>> +changequote([, ])dnl +@end example + +@noindent +instead of simply: + +@example +[[]] +@end example + + +With macros that do not double quote their arguments (which is the +rule), double-quote the (risky) literals: + +@example +AC_LINK_IFELSE([AC_LANG_PROGRAM( +[[#include <time.h> +#ifndef tzname /* For SGI. */ +extern char *tzname[]; /* RS6000 and others reject char **tzname. */ +#endif]], + [atoi (*tzname);])], + [ac_cv_var_tzname=yes], + [ac_cv_var_tzname=no]) +@end example + +See @xref{Quadrigraphs}, for what to do if you run into a hopeless case +where quoting does not suffice. + +When you create a @code{configure} script using newly written macros, +examine it carefully to check whether you need to add more quotes in +your macros. If one or more words have disappeared in the @code{m4} +output, you need more quotes. When in doubt, quote. + +However, it's also possible to put on too many layers of quotes. If +this happens, the resulting @code{configure} script will contain +unexpanded macros. The @code{autoconf} program checks for this problem +by doing @samp{grep AC_ configure}. + + +@node Programming in M4sugar, , M4 Quotation, Programming in M4 +@section Programming in M4sugar + +@cindex M4sugar +M4 by itself provides only a small, but sufficient, set of all-purpose +macros. M4sugar introduces additional generic macros. Its name was +coined by Lars J. Aas: ``Readability And Greater Understanding Stands 4 +M4sugar''. + +@menu +* Redefined M4 Macros:: M4 builtins changed in M4sugar +* Forbidden Patterns:: Catching unexpanded macros +@end menu + +@node Redefined M4 Macros, Forbidden Patterns, Programming in M4sugar, Programming in M4sugar +@subsection Redefined M4 Macros + +All the M4 native macros are moved in the @samp{m4_} pseudo-namespace, +e.g., M4sugar renames @code{define} as @code{m4_define} etc. There is +one exception: @code{dnl} kept its original name, and no @code{m4_dnl} +is defined. + +M4sugar redefines some M4 macros, and made them slightly incompatible +with their native equivalent. + +@defmac m4_defn (@var{macro}) +@msindex defn +Contrary to the M4 builtin, this macro fails if @var{macro} is not +defined. See @code{m4_undefine}. +@end defmac + +@defmac m4_undefine (@var{macro}) +@msindex undefine +Contrary to the M4 builtin, this macro fails if @var{macro} is not +defined. Use + +@example +m4_ifdef([@var{macro}], [m4_undefine([@var{macro}])]) +@end example + +@noindent +to recover the behavior of the builtin. +@end defmac + +@defmac m4_popdef (@var{macro}) +@msindex defn +Contrary to the M4 builtin, this macro fails if @var{macro} is not +defined. See @code{m4_undefine}. +@end defmac + +@node Forbidden Patterns, , Redefined M4 Macros, Programming in M4sugar +@subsection Forbidden Patterns + +M4sugar provides a means to define suspicious patterns, patterns +describing tokens which should not be found in the output. For +instance, if an Autoconf @file{configure} script includes tokens such as +@samp{AC_DEFINE}, or @samp{dnl}, then most probably something went +wrong (typically a macro was not evaluated because of over quotation). + +M4sugar forbids all the tokens matching @samp{^m4_} and @samp{^dnl$}. + +@defmac m4_pattern_forbid (@var{pattern}) +@msindex pattern_forbid +Declare no token matching @var{pattern} must be found in the output. +Comments are not checked; this can be a problem if, for instance, you +have some macro left unexpanded after an @samp{#include}. No consensus +is currently found in the Autoconf community, as some people consider it +should be valid to name macros in comments (which doesn't makes sense to +the author of this documentation, as @samp{#}-comments should document +the output, not the input, documented vy @samp{dnl}-comments). +@end defmac + +Of course, you might encounter exceptions to these generic rules, for +instance you might have to refer to @samp{$m4_flags}. + +@defmac m4_pattern_allow (@var{pattern}) +@msindex pattern_allow +Any token matching @var{pattern} is allowed, including if it matches an +@code{m4_pattern_forbid} pattern. +@end defmac + +@c=================================================== Writing Autoconf Macros. + +@node Writing Autoconf Macros, Portable Shell, Programming in M4, Top +@chapter Writing Autoconf Macros + +When you write a feature test that could be applicable to more than one +software package, the best thing to do is encapsulate it in a new macro. +Here are some instructions and guidelines for writing Autoconf macros. + +@menu +* Macro Definitions:: Basic format of an Autoconf macro +* Macro Names:: What to call your new macros +* Reporting Messages:: Notifying @code{autoconf} users +* Dependencies Between Macros:: What to do when macros depend on other macros +* Obsoleting Macros:: Warning about old ways of doing things +* Coding Style:: Writing Autoconf macros @`a la Autoconf +@end menu + +@node Macro Definitions, Macro Names, Writing Autoconf Macros, Writing Autoconf Macros +@section Macro Definitions + +@maindex DEFUN +Autoconf macros are defined using the @code{AC_DEFUN} macro, which is +similar to the M4 builtin @code{define} macro. In addition to defining +a macro, @code{AC_DEFUN} adds to it some code that is used to constrain +the order in which macros are called (@pxref{Prerequisite Macros}). + +An Autoconf macro definition looks like this: + +@example +AC_DEFUN(@var{macro-name}, @var{macro-body}) +@end example + +You can refer to any arguments passed to the macro as @samp{$1}, +@samp{$2}, etc. @xref{Definitions,, How to define new macros, m4.info, +GNU m4}, for more complete information on writing M4 macros. + +Be sure to properly quote both the @var{macro-body} @emph{and} the +@var{macro-name} to avoid any problems if the macro happens to have +been previously defined. + +Each macro should have a header comment that gives its prototype, and a +brief description. When arguments have default values, display them in +the prototype. For example: + +@example +# AC_MSG_ERROR(ERROR, [EXIT-STATUS = 1]) +# -------------------------------------- +define([AC_MSG_ERROR], +[@{ _AC_ECHO([configure: error: $1], 2); exit m4_default([$2], 1); @}]) +@end example + +Comments about the macro should be left in the header comment. Most +other comments will make their way into @file{configure}, so just keep +using @samp{#} to introduce comments. + +@cindex @code{dnl} +If you have some very special comments about pure M4 code, comments +that make no sense in @file{configure} and in the header comment, then +use the builtin @code{dnl}: it causes @code{m4} to discard the text +through the next newline. + +Keep in mind that @code{dnl} is rarely needed to introduce comments; +@code{dnl} is more useful to get rid of the newlines following macros +that produce no output, such as @code{AC_REQUIRE}. + + +@node Macro Names, Reporting Messages, Macro Definitions, Writing Autoconf Macros +@section Macro Names + +All of the Autoconf macros have all-uppercase names starting with +@samp{AC_} to prevent them from accidentally conflicting with other +text. All shell variables that they use for internal purposes have +mostly-lowercase names starting with @samp{ac_}. To ensure that your +macros don't conflict with present or future Autoconf macros, you should +prefix your own macro names and any shell variables they use with some +other sequence. Possibilities include your initials, or an abbreviation +for the name of your organization or software package. + +Most of the Autoconf macros' names follow a structured naming convention +that indicates the kind of feature check by the name. The macro names +consist of several words, separated by underscores, going from most +general to most specific. The names of their cache variables use the +same convention (@pxref{Cache Variable Names}, for more information on +them). + +The first word of the name after @samp{AC_} usually tells the category +of feature being tested. Here are the categories used in Autoconf for +specific test macros, the kind of macro that you are more likely to +write. They are also used for cache variables, in all-lowercase. Use +them where applicable; where they're not, invent your own categories. + +@table @code +@item C +C language builtin features. +@item DECL +Declarations of C variables in header files. +@item FUNC +Functions in libraries. +@item GROUP +@sc{unix} group owners of files. +@item HEADER +Header files. +@item LIB +C libraries. +@item PATH +The full path names to files, including programs. +@item PROG +The base names of programs. +@item MEMBER +Members of aggregates. +@item SYS +Operating system features. +@item TYPE +C builtin or declared types. +@item VAR +C variables in libraries. +@end table + +After the category comes the name of the particular feature being +tested. Any further words in the macro name indicate particular aspects +of the feature. For example, @code{AC_FUNC_UTIME_NULL} checks the +behavior of the @code{utime} function when called with a @code{NULL} +pointer. + +An internal macro should have a name that starts with an underscore; +Autoconf internals should therefore start with @samp{_AC_}. +Additionally, a macro that is an internal subroutine of another macro +should have a name that starts with an underscore and the name of that +other macro, followed by one or more words saying what the internal +macro does. For example, @code{AC_PATH_X} has internal macros +@code{_AC_PATH_X_XMKMF} and @code{_AC_PATH_X_DIRECT}. + +@node Reporting Messages, Dependencies Between Macros, Macro Names, Writing Autoconf Macros +@section Reporting Messages +@cindex Messages, from @code{autoconf} + +When macros statically diagnose abnormal situations, benign or fatal, +they should report them using these macros. For dynamic issues, i.e., +when @code{configure} is run, see @ref{Printing Messages}. + +@defmac AC_DIAGNOSE (@var{category}, @var{message}) +@maindex DIAGNOSE +Report @var{message} as a warning (or as an error if requested by the +user) if it falls into the @var{category}. You are encouraged to use +standard categories, which currently include: + +@table @samp +@item all +messages that don't fall into one of the following category. Use of an +empty @var{category} is equivalent. + +@item cross +related to cross compilation issues. + +@item obsolete +use of an obsolete construct. + +@item syntax +dubious syntactic constructs, incorrectly ordered macro calls. +@end table +@end defmac + +@defmac AC_WARNING (@var{message}) +@maindex WARNING +Equivalent to @samp{AC_DIAGNOSE([syntax], @var{message})}, but you are +strongly encouraged to use a finer grained category. +@end defmac + +@defmac AC_FATAL (@var{message}) +@maindex FATAL +Report a severe error @var{message}, and have @code{autoconf} die. +@end defmac + +When the user runs @samp{autoconf -W error}, warnings from +@code{AC_DIAGNOSE} and @code{AC_WARNING} are reported as error, see +@ref{autoconf Invocation}. + +@node Dependencies Between Macros, Obsoleting Macros, Reporting Messages, Writing Autoconf Macros +@section Dependencies Between Macros + +Some Autoconf macros depend on other macros having been called first in +order to work correctly. Autoconf provides a way to ensure that certain +macros are called if needed and a way to warn the user if macros are +called in an order that might cause incorrect operation. + +@menu +* Prerequisite Macros:: Ensuring required information +* Suggested Ordering:: Warning about possible ordering problems +@end menu + +@node Prerequisite Macros, Suggested Ordering, Dependencies Between Macros, Dependencies Between Macros +@subsection Prerequisite Macros + +A macro that you write might need to use values that have previously +been computed by other macros. For example, @code{AC_DECL_YYTEXT} +examines the output of @code{flex} or @code{lex}, so it depends on +@code{AC_PROG_LEX} having been called first to set the shell variable +@code{LEX}. + +Rather than forcing the user of the macros to keep track of the +dependencies between them, you can use the @code{AC_REQUIRE} macro to do +it automatically. @code{AC_REQUIRE} can ensure that a macro is only +called if it is needed, and only called once. + +@defmac AC_REQUIRE (@var{macro-name}) +@maindex REQUIRE +If the M4 macro @var{macro-name} has not already been called, call it +(without any arguments). Make sure to quote @var{macro-name} with +square brackets. @var{macro-name} must have been defined using +@code{AC_DEFUN} or else contain a call to @code{AC_PROVIDE} to indicate +that it has been called. + +@code{AC_REQUIRE} must be used inside an @code{AC_DEFUN}'d macro; it +must not be called from the top level. +@end defmac + +@code{AC_REQUIRE} is often misunderstood. It really implements +dependencies between macros in the sense that if one macro depends upon +another, the latter will be expanded @emph{before} the body of the +former. In particular, @samp{AC_REQUIRE(FOO)} is not replaced with the +body of @code{FOO}. For instance, this definition of macros: + +@example +@group +AC_DEFUN([TRAVOLTA], +[test "$body_temparature_in_celsius" -gt "38" && + dance_floor=occupied]) +AC_DEFUN([NEWTON_JOHN], +[test "$hair_style" = "curly" && + dance_floor=occupied]) +@end group + +@group +AC_DEFUN([RESERVE_DANCE_FLOOR], +[if date | grep '^Sat.*pm' >/dev/null 2>&1; then + AC_REQUIRE([TRAVOLTA]) + AC_REQUIRE([NEWTON_JOHN]) +fi]) +@end group +@end example + +@noindent +with this @file{configure.ac} + +@example +AC_INIT +RESERVE_DANCE_FLOOR +if test "$dance_floor" = occupied; then + AC_MSG_ERROR([cannot pick up here, let's move]) +fi +@end example + +@noindent +will not leave you with a better chance to meet a kindred soul at +other times than Saturday night since it expands into: + +@example +@group +test "$body_temperature_in_Celsius" -gt "38" && + dance_floor=occupied +test "$hair_style" = "curly" && + dance_floor=occupied +fi +if date | grep '^Sat.*pm' >/dev/null 2>&1; then + + +fi +@end group +@end example + +This behavior was chosen on purpose: (i) it prevents messages in +required macros from interrupting the messages in the requiring macros; +(ii) it avoids bad surprises when shell conditionals are used, as in: + +@example +@group +if @dots{}; then + AC_REQUIRE([SOME_CHECK]) +fi +@dots{} +SOME_CHECK +@end group +@end example + + +You are encouraged to put all @code{AC_REQUIRE}s at the beginning of a +macro. You can use @code{dnl} to avoid the empty lines they leave. + +@node Suggested Ordering, , Prerequisite Macros, Dependencies Between Macros +@subsection Suggested Ordering + +Some macros should be run before another macro if both are called, but +neither @emph{requires} that the other be called. For example, a macro +that changes the behavior of the C compiler should be called before any +macros that run the C compiler. Many of these dependencies are noted in +the documentation. + +Autoconf provides the @code{AC_BEFORE} macro to warn users when macros +with this kind of dependency appear out of order in a +@file{configure.ac} file. The warning occurs when creating +@code{configure} from @file{configure.ac}, not when running +@code{configure}. + +For example, @code{AC_PROG_CPP} checks whether the C compiler +can run the C preprocessor when given the @option{-E} option. It should +therefore be called after any macros that change which C compiler is +being used, such as @code{AC_PROG_CC}. So @code{AC_PROG_CC} contains: + +@example +AC_BEFORE([$0], [AC_PROG_CPP])dnl +@end example + +@noindent +This warns the user if a call to @code{AC_PROG_CPP} has already occurred +when @code{AC_PROG_CC} is called. + +@defmac AC_BEFORE (@var{this-macro-name}, @var{called-macro-name}) +@maindex BEFORE +Make @code{m4} print a warning message to the standard error output if +@var{called-macro-name} has already been called. @var{this-macro-name} +should be the name of the macro that is calling @code{AC_BEFORE}. The +macro @var{called-macro-name} must have been defined using +@code{AC_DEFUN} or else contain a call to @code{AC_PROVIDE} to indicate +that it has been called. +@end defmac + +@node Obsoleting Macros, Coding Style, Dependencies Between Macros, Writing Autoconf Macros +@section Obsoleting Macros + +Configuration and portability technology has evolved over the years. +Often better ways of solving a particular problem are developed, or +ad-hoc approaches are systematized. This process has occurred in many +parts of Autoconf. One result is that some of the macros are now +considered @dfn{obsolete}; they still work, but are no longer considered +the best thing to do, hence they should be replaced with more modern +macros. Ideally, @code{autoupdate} should substitute the old macro calls +with their modern implementation. + +Autoconf provides a simple means to obsolete a macro. + +@defmac AU_DEFUN (@var{old-macro}, @var{implementation}, @ovar{message}) +@maindex DEFUN +@maindex AU_DEFUN +Define @var{old-macro} as @var{implementation}. The only difference +with @code{AC_DEFUN} is that the user will be warned that +@var{old-macro} is now obsolete. + +If she then uses @code{autoupdate}, the call to @var{old-macro} will be +replaced by the modern @var{implementation}. The additional +@var{message} is then printed. +@end defmac + +@node Coding Style, , Obsoleting Macros, Writing Autoconf Macros +@section Coding Style + +The Autoconf macros follow a strict coding style. You are encouraged to +follow this style, especially if you intend to distribute your macro, +either by contributing it to Autoconf itself, or via other means. + +The first requirement is to pay great attention to the quotation, for +more details, see @ref{Autoconf Language}, and @ref{M4 Quotation}. + +Do not try to invent new interfaces. It is likely that there is a macro +in Autoconf that resembles the macro you are defining: try to stick to +this existing interface (order of arguments, default values, etc.). We +@emph{are} conscious that some of these interfaces are not perfect; +nevertheless, when harmless, homogeneity should be preferred over +creativity. + +Be careful about clashes both between M4 symbols and between shell +variables. + +If you stick to the suggested M4 naming scheme (@pxref{Macro Names}), +you are unlikely to generate conflicts. Nevertheless, when you need to +set a special value, @emph{avoid using a regular macro name}; rather, +use an ``impossible'' name. For instance, up to version 2.13, the macro +@code{AC_SUBST} used to remember what @var{symbol}s were already defined +by setting @code{AC_SUBST_@var{symbol}}, which is a regular macro name. +But since there is a macro named @code{AC_SUBST_FILE}, it was just +impossible to @samp{AC_SUBST(FILE)}! In this case, +@code{AC_SUBST(@var{symbol})} or @code{_AC_SUBST(@var{symbol})} should +have been used (yes, with the parentheses)@dots{}or better yet, high-level +macros such as @code{AC_EXPAND_ONCE}. + +No Autoconf macro should ever enter the user-variable name space; i.e., +except for the variables that are the actual result of running the +macro, all shell variables should start with @code{ac_}. In +addition, small macros or any macro that is likely to be embedded in +other macros should be careful not to use obvious names. + +@cindex @code{dnl} +Do not use @code{dnl} to introduce comments: most of the comments you +are likely to write are either header comments which are not output +anyway, or comments that should make their way into @file{configure}. +There are exceptional cases where you do want to comment special M4 +constructs, in which case @code{dnl} is right, but keep in mind that it +is unlikely. + +M4 ignores the leading spaces before each argument, use this feature to +indent in such a way that arguments are (more or less) aligned with the +opening parenthesis of the macro being called. For instance, instead of + +@example +AC_CACHE_CHECK(for EMX OS/2 environment, +ac_cv_emxos2, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, [return __EMX__;])], +[ac_cv_emxos2=yes], [ac_cv_emxos2=no])]) +@end example + +@noindent +write + +@example +AC_CACHE_CHECK([for EMX OS/2 environment], [ac_cv_emxos2], +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __EMX__;])], + [ac_cv_emxos2=yes], + [ac_cv_emxos2=no])]) +@end example + +@noindent +or even + +@example +AC_CACHE_CHECK([for EMX OS/2 environment], + [ac_cv_emxos2], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], + [return __EMX__;])], + [ac_cv_emxos2=yes], + [ac_cv_emxos2=no])]) +@end example + +When using @code{AC_TRY_RUN} or any macro that cannot work when +cross-compiling, provide a pessimistic value (typically @samp{no}). + +Feel free to use various tricks to prevent auxiliary tools, such as +syntax-highlighting editors, from behaving improperly. For instance, +instead of: + +@example +patsubst([$1], [$"]) +@end example + +@noindent +use + +@example +patsubst([$1], [$""]) +@end example + +@noindent +so that Emacsen do not open a endless ``string'' at the first quote. +For the same reasons, avoid: + +@example +test $[#] != 0 +@end example + +@noindent +and use: + +@example +test $[@@%:@@] != 0 +@end example + +@noindent +Otherwise, the closing bracket would be hidden inside a @samp{#}-comment, +breaking the bracket-matching highlighting from Emacsen. Note the +preferred style to escape from M4: @samp{$[1]}, @samp{$[@@]}, etc. Do +not escape when it is unneeded. Common examples of useless quotation +are @samp{[$]$1} (write @samp{$$1}), @samp{[$]var} (use @samp{$var}), +etc. If you add portability issues to the picture, you'll prefer +@samp{$@{1+"$[@@]"@}} to @samp{"[$]@@"}, and you'll prefer do something +better than hacking Autoconf @code{:-)}. + +When using @command{sed}, don't use @option{-e} except for indenting +purpose. With the @code{s} command, the preferred separator is @samp{/} +unless @samp{/} itself is used in the command, in which case you should +use @samp{,}. + +@xref{Macro Definitions}, for details on how to define a macro. If a +macro doesn't use @code{AC_REQUIRE} and it is expected to never be the +object of an @code{AC_REQUIRE} directive, then use @code{define}. In +case of doubt, use @code{AC_DEFUN}. All the @code{AC_REQUIRE} +statements should be at the beginning of the macro, @code{dnl}'ed. + +You should not rely on the number of arguments: instead of checking +whether an argument is missing, test that it is not empty. It provides +both a simpler and a more predictable interface to the user, and saves +room for further arguments. + +Unless the macro is short, try to leave the closing @samp{])} at the +beginning of a line, followed by a comment that repeats the name of the +macro being defined. This introduces an additional newline in +@code{configure}; normally, that is not a problem, but if you want to +remove it you can use @samp{[]dnl} on the last line. You can similarly +use @samp{[]dnl} after a macro call to remove its newline. @samp{[]dnl} +is recommended instead of @samp{dnl} to ensure that M4 does not +interpret the @samp{dnl} as being attached to the preceding text or +macro output. For example, instead of: + +@example +AC_DEFUN([AC_PATH_X], +[AC_MSG_CHECKING([for X]) +AC_REQUIRE_CPP() +@r{# @dots{}omitted@dots{}} + AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) +fi]) +@end example + +@noindent +you would write: + +@example +AC_DEFUN([AC_PATH_X], +[AC_REQUIRE_CPP()[]dnl +AC_MSG_CHECKING([for X]) +@r{# @dots{}omitted@dots{}} + AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) +fi[]dnl +])# AC_PATH_X +@end example + +If the macro is long, try to split it into logical chunks. Typically, +macros that check for a bug in a function and prepare its +@code{AC_LIBOBJ} replacement should have an auxiliary macro to perform +this setup. Do not hesitate to introduce auxiliary macros to factor +your code. + +In order to highlight the recommended coding style, here is a macro +written the old way: + +@example +dnl Check for EMX on OS/2. +dnl _AC_EMXOS2 +AC_DEFUN(_AC_EMXOS2, +[AC_CACHE_CHECK(for EMX OS/2 environment, ac_cv_emxos2, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, return __EMX__;)], +ac_cv_emxos2=yes, ac_cv_emxos2=no)]) +test "$ac_cv_emxos2" = yes && EMXOS2=yes]) +@end example + +@noindent +and the new way: + +@example +# _AC_EMXOS2 +# ---------- +# Check for EMX on OS/2. +define([_AC_EMXOS2], +[AC_CACHE_CHECK([for EMX OS/2 environment], [ac_cv_emxos2], +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [return __EMX__;])], + [ac_cv_emxos2=yes], + [ac_cv_emxos2=no])]) +test "$ac_cv_emxos2" = yes && EMXOS2=yes[]dnl +])# _AC_EMXOS2 +@end example + + + + +@c ============================================= Portable Shell Programming + +@node Portable Shell, Manual Configuration, Writing Autoconf Macros, Top +@chapter Portable Shell Programming + +When writing your own checks, there are some shell-script programming +techniques you should avoid in order to make your code portable. The +Bourne shell and upward-compatible shells like the Korn shell and Bash +have evolved over the years, but to prevent trouble, do not take +advantage of features that were added after @sc{unix} version 7, circa +1977. You should not use shell functions, aliases, negated character +classes, or other features that are not found in all Bourne-compatible +shells; restrict yourself to the lowest common denominator. Even +@code{unset} is not supported by all shells! Also, include a space +after the exclamation point in interpreter specifications, like this: + +@example +#! /usr/bin/perl +@end example + +@noindent +If you omit the space before the path, then 4.2@sc{bsd} based systems +(such as Sequent DYNIX) will ignore the line, because they interpret +@samp{#! /} as a 4-byte magic number. + +The set of external programs you should run in a @code{configure} script +is fairly small. @xref{Utilities in Makefiles,, Utilities in +Makefiles, standards, GNU Coding Standards}, for the list. This +restriction allows users to start out with a fairly small set of +programs and build the rest, avoiding too many interdependencies between +packages. + +Some of these external utilities have a portable subset of features; see +@ref{Limitations of Usual Tools}. + +@menu +* Shellology:: A zoology of shells +* Here-Documents:: Quirks and tricks +* File Descriptors:: FDs and redirections +* File System Conventions:: File- and pathnames +* Shell Substitutions:: Variable and command expansions +* Assignments:: Varying side effects of assignments +* Special Shell Variables:: Variables you should not change +* Limitations of Builtins:: Portable use of not so portable /bin/sh +* Limitations of Usual Tools:: Portable use of portable tools +* Limitations of Make:: Portable Makefiles +@end menu + +@node Shellology, Here-Documents, Portable Shell, Portable Shell +@section Shellology + +There are several families of shells, most prominently the Bourne +family and the C shell family which are deeply incompatible. If you +want to write portable shell scripts, avoid members of the C shell +family. + +Below we describe some of the members of the Bourne shell family. + +@table @asis +@item Ash +@cindex Ash +@command{ash} is often used on @sc{gnu}/Linux and @sc{bsd} systems as a +light-weight Bourne-compatible shell. Ash 0.2 has some bugs that are +fixed in the 0.3.x series, but portable shell scripts should workaround +them, since version 0.2 is still shipped with many @sc{gnu}/Linux +distributions. + +To be compatible with Ash 0.2: + +@itemize @minus +@item +don't use @samp{$?} after expanding empty or unset variables: + +@example +foo= +false +$foo +echo "Don't use it: $?" +@end example + +@item +don't use command substitution within variable expansion: + +@example +cat $@{FOO=`bar`@} +@end example + +@item +beware that single builtin substitutions are not performed by a sub +shell, hence their effect applies to the current shell! @xref{Shell +Substitutions}, item ``Command Substitution''. +@end itemize + +@item Bash +@cindex Bash +To detect whether you are running @command{bash}, test if +@code{BASH_VERSION} is set. To disable its extensions and require +@sc{posix} compatibility, run @samp{set -o posix}. @xref{Bash POSIX +Mode,, Bash @sc{posix} Mode, bash, The GNU Bash Reference Manual}, for +details. + +@item @command{/usr/xpg4/bin/sh} on Solaris +@cindex @command{/usr/xpg4/bin/sh} on Solaris +The @sc{posix}-compliant Bourne shell on a Solaris system is +@command{/usr/xpg4/bin/sh} and is part of an extra optional package. +There is no extra charge for this package, but it is also not part of a +minimal OS install and therefore some folks may not have it. + +@item Zsh +@cindex Zsh +To detect whether you are running @command{zsh}, test if +@code{ZSH_VERSION} is set. By default @command{zsh} is @emph{not} +compatible with the Bourne shell: you have to run @samp{emulate sh} and +set @code{NULLCMD} to @samp{:}. @xref{Compatibility,, Compatibility, +zsh, The Z Shell Manual}, for details. + +Zsh 3.0.8 is the native @command{/bin/sh} on Mac OS X 10.0.3. +@end table + +The following discussion between Russ Allbery and Robert Lipe is worth +reading: + +@noindent +Russ Allbery: + +@quotation +The @sc{gnu} assumption that @command{/bin/sh} is the one and only shell +leads to a permanent deadlock. Vendors don't want to break user's +existent shell scripts, and there are some corner cases in the Bourne +shell that are not completely compatible with a @sc{posix} shell. Thus, +vendors who have taken this route will @emph{never} (OK@dots{}``never say +never'') replace the Bourne shell (as @command{/bin/sh}) with a +@sc{posix} shell. +@end quotation + +@noindent +Robert Lipe: + +@quotation +This is exactly the problem. While most (at least most System V's) do +have a bourne shell that accepts shell functions most vendor +@command{/bin/sh} programs are not the @sc{posix} shell. + +So while most modern systems do have a shell _somewhere_ that meets the +@sc{posix} standard, the challenge is to find it. +@end quotation + +@node Here-Documents, File Descriptors, Shellology, Portable Shell +@section Here-Documents + +Don't rely on @samp{\} being preserved just because it has no special +meaning together with the next symbol. in the native @command{/bin/sh} +on OpenBSD 2.7 @samp{\"} expands to @samp{"} in here-documents with +unquoted delimiter. As a general rule, if @samp{\\} expands to @samp{\} +use @samp{\\} to get @samp{\}. + +With OpenBSD 2.7's @command{/bin/sh} + +@example +@group +$ cat <<EOF +> \" \\ +> EOF +" \ +@end group +@end example + +@noindent +and with Bash: + +@example +@group +bash-2.04$ cat <<EOF +> \" \\ +> EOF +\" \ +@end group +@end example + + +Many older shells (including the Bourne shell) implement here-documents +inefficiently. Users can generally speed things up by using a faster +shell, e.g., by using the command @samp{bash ./configure} rather than +plain @samp{./configure}. + +Some shells can be extremely inefficient when there are a lot of +here-documents inside a single statement. For instance if your +@file{configure.ac} includes something like: + +@example +@group +if <cross_compiling>; then + assume this and that +else + check this + check that + check something else + @dots{} + on and on forever + @dots{} +fi +@end group +@end example + +A shell parses the whole @code{if}/@code{fi} construct, creating +temporary files for each here document in it. Some shells create links +for such here-documents on every @code{fork}, so that the clean-up code +they had installed correctly removes them. It is creating the links +that the shell can take forever. + +Moving the tests out of the @code{if}/@code{fi}, or creating multiple +@code{if}/@code{fi} constructs, would improve the performance +significantly. Anyway, this kind of construct is not exactly the +typical use of Autoconf. In fact, it's even not recommended, because M4 +macros can't look into shell conditionals, so we may fail to expand a +macro when it was expanded before in a conditional path, and the +condition turned out to be false at run-time, and we end up not +executing the macro at all. + +@node File Descriptors, File System Conventions, Here-Documents, Portable Shell +@section File Descriptors + +Some file descriptors shall not be used, since some systems, admittedly +arcane, use them for special purpose: + +@table @asis +@item 3 +some systems may open it to @samp{/dev/tty}. + +@item 4 +used on the Kubota Titan. +@end table + +Don't redirect several times the same file descriptor, as you are doomed +to failure under Ultrix. + +@example +ULTRIX V4.4 (Rev. 69) System #31: Thu Aug 10 19:42:23 GMT 1995 +UWS V4.4 (Rev. 11) +$ eval 'echo matter >fullness' >void +illegal io +$ eval '(echo matter >fullness)' >void +illegal io +$ (eval '(echo matter >fullness)') >void +Ambiguous output redirect. +@end example + +@noindent +In each case the expected result is of course @file{fullness} containing +@samp{matter} and @file{void} being empty. + +Don't try to redirect the standard error of a command substitution: it +must be done @emph{inside} the command substitution: when running +@samp{: `cd /zorglub` 2>/dev/null} expect the error message to +escape, while @samp{: `cd /zorglub 2>/dev/null`} works properly. + +It is worth noting that Zsh (but not Ash nor Bash) makes it possible +in assignments though: @samp{foo=`cd /zorglub` 2>/dev/null}. + +Most shells, if not all (including Bash, Zsh, Ash), output traces on +stderr, even for sub-shells. This might result in undesired content +if you meant to capture the standard-error output of the inner command: + +@example +$ ash -x -c '(eval "echo foo >&2") 2>stderr' +$ cat stderr ++ eval echo foo >&2 ++ echo foo +foo +$ bash -x -c '(eval "echo foo >&2") 2>stderr' +$ cat stderr ++ eval 'echo foo >&2' +++ echo foo +foo +$ zsh -x -c '(eval "echo foo >&2") 2>stderr' +@i{# Traces on startup files deleted here.} +$ cat stderr ++zsh:1> eval echo foo >&2 ++zsh:1> echo foo +foo +@end example + +@noindent +You'll appreciate the various levels of detail@dots{} + +One workaround is to grep out uninteresting lines, hoping not to remove +good ones@dots{} + +@node File System Conventions, Shell Substitutions, File Descriptors, Portable Shell +@section File System Conventions + +While @command{autoconf} and friends will usually be run on some Unix +variety, it can and will be used on other systems, most notably @sc{dos} +variants. This impacts several assumptions regarding file and +path names. + +@noindent +For example, the following code: + +@example +case $foo_dir in + /*) # Absolute + ;; + *) + foo_dir=$dots$foo_dir ;; +esac +@end example + +@noindent +will fail to properly detect absolute paths on those systems, because +they can use a drivespec, and will usually use a backslash as directory +separator. The canonical way to check for absolute paths is: + +@example +case $foo_dir in + [\\/]* | ?:[\\/]* ) # Absolute + ;; + *) + foo_dir=$dots$foo_dir ;; +esac +@end example + +@noindent +Make sure you quote the brackets if appropriate and keep the backslash as +first character (@pxref{Limitations of Builtins}). + +Also, because the colon is used as part of a drivespec, these systems don't +use it as path separator. When creating or accessing paths, use +@code{$ac_path_separator} instead (or the @code{PATH_SEPARATOR} output +variable). @command{autoconf} sets this to the appropriate value (@samp{:} +or @samp{;}) when it starts up. + +File names need extra care as well. While @sc{dos}-based environments +that are Unixy enough to run @command{autoconf} (such as DJGPP) will +usually be able to handle long file names properly, there are still +limitations that can seriously break packages. Several of these issues +can be easily detected by the +@href{ftp://ftp.gnu.org/gnu/non-gnu/doschk/doschk-1.1.tar.gz, doschk} +package. + +A short overview follows; problems are marked with @sc{sfn}/@sc{lfn} to +indicate where they apply: @sc{sfn} means the issues are only relevant to +plain @sc{dos}, not to @sc{dos} boxes under Windows, while @sc{lfn} +identifies problems that exist even under Windows. + +@table @asis +@item No multiple dots (@sc{sfn}) +@sc{dos} cannot handle multiple dots in filenames. This is an especially +important thing to remember when building a portable configure script, +as @command{autoconf} uses a .in suffix for template files. + +This is perfectly OK on Unices: + +@example +AC_CONFIG_HEADER(config.h) +AC_CONFIG_FILES([source.c foo.bar]) +AC_OUTPUT +@end example + +@noindent +but it causes problems on @sc{dos}, as it requires @samp{config.h.in}, +@samp{source.c.in} and @samp{foo.bar.in}. To make your package more portable +to @sc{dos}-based environments, you should use this instead: + +@example +AC_CONFIG_HEADER(config.h:config.hin) +AC_CONFIG_FILES([source.c:source.cin foo.bar:foobar.in]) +AC_OUTPUT +@end example + +@item No leading dot (@sc{sfn}) +@sc{dos} cannot handle filenames that start with a dot. This is usually +not a very important issue for @command{autoconf}. + +@item Case insensitivity (@sc{lfn}) +@sc{dos} is case insensitive, so you cannot, for example, have both a +file called @samp{INSTALL} and a directory called @samp{install}. This +also affects @command{make}; if there's a file called @samp{INSTALL} in +the directory, @command{make install} will do nothing (unless the +@samp{install} target is marked as PHONY). + +@item The 8+3 limit (@sc{sfn}) +Because the @sc{dos} file system only stores the first 8 characters of +the filename and the first 3 of the extension, those must be unique. +That means that @file{foobar-part1.c}, @file{foobar-part2.c} and +@file{foobar-prettybird.c} all resolve to the same filename +(@file{FOOBAR-P.C}). The same goes for @file{foo.bar} and +@file{foo.bartender}. + +Note: This is not usually a problem under Windows, as it uses numeric +tails in the short version of filenames to make them unique. However, a +registry setting can turn this behaviour off. While this makes it +possible to share file trees containing long file names between @sc{sfn} +and @sc{lfn} environments, it also means the above problem applies there +as well. + +@item Invalid characters +Some characters are invalid in @sc{dos} filenames, and should therefore +be avoided. In a @sc{lfn} environment, these are @samp{/}, @samp{\}, +@samp{?}, @samp{*}, @samp{:}, @samp{<}, @samp{>}, @samp{|} and @samp{"}. +In a @sc{sfn} environment, other characters are also invalid. These +include @samp{+}, @samp{,}, @samp{[} and @samp{]}. +@end table + +@node Shell Substitutions, Assignments, File System Conventions, Portable Shell +@section Shell Substitutions + +Contrary to a persistent urban legend, the Bourne shell does not +systematically split variables and backquoted expressions, in particular +on the right-hand side of assignments and in the argument of @code{case}. +For instance, the following code: + +@example +case "$given_srcdir" in +.) top_srcdir="`echo "$dots" | sed 's,/$,,'`" +*) top_srcdir="$dots$given_srcdir" ;; +esac +@end example + +@noindent +is more readable when written as: + +@example +case $given_srcdir in +.) top_srcdir=`echo "$dots" | sed 's,/$,,'` +*) top_srcdir=$dots$given_srcdir ;; +esac +@end example + +@noindent +and in fact it is even @emph{more} portable: in the first case of the +first attempt, the computation of @code{top_srcdir} is not portable, +since not all shells properly understand @code{"`@dots{}"@dots{}"@dots{}`"}. +Worse yet, not all shells understand @code{"`@dots{}\"@dots{}\"@dots{}`"} +the same way. There is just no portable way to use double-quoted +strings inside double-quoted backquoted expressions (pfew!). + +@table @code +@item $@@ +@cindex @samp{"$@@"} +One of the most famous shell-portability issues is related to +@samp{"$@@"}: when there are no positional arguments, it is supposed to +be equivalent to nothing. But some shells, for instance under Digital +Unix 4.0 and 5.0, will then replace it with an empty argument. To be +portable, use @samp{$@{1+"$@@"@}}. + +@item $@{@var{var}:-@var{value}@} +@cindex $@{@var{var}:-@var{value}@} +Old @sc{bsd} shells, including the Ultrix @code{sh}, don't accept the +colon for any shell substitution, and complain and die. + +@item $@{@var{var}=@var{literal}@} +@cindex $@{@var{var}=@var{literal}@} +Be sure to quote: + +@example +: $@{var='Some words'@} +@end example + +@noindent +otherwise some shells, such as on Digital Unix V 5.0, will die because +of a ``bad substitution''. + +Solaris' @command{/bin/sh} has a frightening bug in its interpretation +of this. Imagine you need set a variable to a string containing +@samp{@}}. This @samp{@}} character confuses Solaris' @command{/bin/sh} +when the affected variable was already set. This bug can be exercised +by running: + +@example +$ unset foo +$ foo=$@{foo='@}'@} +$ echo $foo +@} +$ foo=$@{foo='@}' # no error; this hints to what the bug is +$ echo $foo +@} +$ foo=$@{foo='@}'@} +$ echo $foo +@}@} + ^ ugh! +@end example + +It seems that @samp{@}} is interpreted as matching @samp{$@{}, even +though it is enclosed in single quotes. The problem doesn't happen +using double quotes. + +@item $@{@var{var}=@var{expanded-value}@} +@cindex $@{@var{var}=@var{expanded-value}@} +On Ultrix, +running + +@example +default="yu,yaa" +: $@{var="$default"@} +@end example + +@noindent +will set @var{var} to @samp{M-yM-uM-,M-yM-aM-a}, i.e., the 8th bit of +each char will be set. You won't observe the phenomenon using a simple +@samp{echo $var} since apparently the shell resets the 8th bit when it +expands $var. Here are two means to make this shell confess its sins: + +@example +$ cat -v <<EOF +$var +EOF +@end example + +@noindent +and + +@example +$ set | grep '^var=' | cat -v +@end example + +One classic incarnation of this bug is: + +@example +default="a b c" +: $@{list="$default"@} +for c in $list; do + echo $c +done +@end example + +@noindent +You'll get @samp{a b c} on a single line. Why? Because there are no +spaces in @samp{$list}: there are @samp{M- }, i.e., spaces with the 8th +bit set, hence no IFS splitting is performed!!! + +One piece of good news is that Ultrix works fine with @samp{: +$@{list=$default@}}; i.e., if you @emph{don't} quote. The bad news is +then that @sc{qnx} 4.25 then sets @var{list} to the @emph{last} item of +@var{default}! + +The portable way out consists in using a double assignment, to switch +the 8th bit twice on Ultrix: + +@example +list=$@{list="$default"@} +@end example + +@noindent +@dots{}but beware of the @samp{@}} bug from Solaris (see above). For safety, +use: + +@example +test "$@{var+set@}" = set || var=@var{@{value@}} +@end example + + +@item `@var{commands}` +@cindex `@var{commands}` +@cindex Command Substitution +While in general it makes no sense, do not substitute a single builtin +with side effects as Ash 0.2, trying to optimize, does not fork a +sub-shell to perform the command. + +For instance, if you wanted to check that @command{cd} is silent, do not +use @samp{test -z "`cd /`"} because the following can happen: + +@example +$ pwd +/tmp +$ test -n "`cd /`" && pwd +/ +@end example + +@noindent +The result of @samp{foo=`exit 1`} is left as an exercise to the reader. + + +@item $(@var{commands}) +@cindex $(@var{commands}) +This construct is meant to replace @samp{`@var{commands}`}; they can be +nested while this is impossible to do portably with back quotes. +Unfortunately it is not yet widely supported. Most notably, even recent +releases of Solaris don't support it: + +@example +$ showrev -c /bin/sh | grep version +Command version: SunOS 5.8 Generic 109324-02 February 2001 +$ echo $(echo blah) +syntax error: `(' unexpected +@end example + +@noindent +nor does @sc{irix} 6.5's Bourne shell: +@example +$ uname -a +IRIX firebird-image 6.5 07151432 IP22 +$ echo $(echo blah) +$(echo blah) +@end example +@end table + + +@node Assignments, Special Shell Variables, Shell Substitutions, Portable Shell +@section Assignments + +When setting several variables in a row, be aware that the order of the +evaluation is undefined. For instance @samp{foo=1 foo=2; echo $foo} +gives @samp{1} with sh on Solaris, but @samp{2} with Bash. You must use +@samp{;} to enforce the order: @samp{foo=1; foo=2; echo $foo}. + +Don't rely on the exit status of an assignment: Ash 0.2 does not change +the status and propagates that of the last statement: + +@example +$ false || foo=bar; echo $? +1 +$ false || foo=`:`; echo $? +0 +@end example + +@noindent +and to make things even worse, @sc{qnx 4.25} just sets the exit status +to 0 in any case: + +@example +$ foo=`exit 1`; echo $? +0 +@end example + +To assign default values, follow this algorithm: + +@enumerate +@item +If the default value is a literal and does not contain any closing +brace, use: + +@example +: $@{var='my literal'@} +@end example + +@item +If the default value contains no closing brace, has to be expanded, and +the variable being initialized will never be IFS-split (i.e., it's not a +list), then use: + +@example +: $@{var="$default"@} +@end example + +@item +If the default value contains no closing brace, has to be expanded, and +the variable being initialized will be IFS-split (i.e., it's a list), +then use: + +@example +var=$@{var="$default"@} +@end example + +@item +If the default value contains a closing brace, then use: + +@example +test "$@{var+set@}" = set || var='$@{indirection@}' +@end example +@end enumerate + +In most cases @samp{var=$@{var="$default"@}} is fine, but in case of +doubt, just use the latter. @xref{Shell Substitutions}, items +@samp{$@{@var{var}:-@var{value}@}} and @samp{$@{@var{var}=@var{value}@}} +for the rationale. + + +@node Special Shell Variables, Limitations of Builtins, Assignments, Portable Shell +@section Special Shell Variables + +Some shell variables should not be used, since they can have a deep +influence on the behavior of the shell. In order to recover a sane +behavior from the shell, some variables should be unset, but +@command{unset} is not portable (@pxref{Limitations of Builtins}) and a +fallback value is needed. We list these values below. + +@c Alphabetical order, case insensitive, `A' before `a'. +@table @code +@item CDPATH +@evindex CDPATH +When this variable is set @code{cd} is verbose, so idioms such as +@samp{abs=`cd $rel && pwd`} break because @code{abs} receives the path +twice. + +@c FIXME: Which shells? How do they behave? +Setting @code{CDPATH} to the empty value is not enough for most shells. +A simple colon is enough except for @code{zsh}, which prefers a leading +dot: + +@example +zsh-3.1.6 % mkdir foo && (CDPATH=: cd foo) +/tmp/foo +zsh-3.1.6 % (CDPATH=:. cd foo) +/tmp/foo +zsh-3.1.6 % (CDPATH=.: cd foo) +zsh-3.1.6 % +@end example + +@noindent +(of course we could just @code{unset} @code{CDPATH}, since it also +behaves properly if set to the empty string). + +Life wouldn't be so much fun if @command{bash} and @command{zsh} had the +same behavior: + +@example +bash-2.02 % (CDPATH=:. cd foo) +bash-2.02 % (CDPATH=.: cd foo) +/tmp/foo +@end example + +Therefore, a portable solution to neutralize @samp{CDPATH} is + +@example +CDPATH=$@{ZSH_VERSION+.@}: +@end example + +@noindent +Note that since @command{zsh} supports @command{unset}, you may unset +@samp{CDPATH} using @samp{:} as a fallback, see +@ref{Limitations of Builtins}. + +@item IFS +@evindex IFS +Don't set the first character of @code{IFS} to backslash. Indeed, +Bourne shells use the first character (backslash) when joining the +components in @samp{"$@@"} and some shells then re-interpret (!) the +backslash escapes, so you can end up with backspace and other strange +characters. + +@item LANG +@itemx LC_ALL +@itemx LC_TIME +@itemx LC_CTYPE +@itemx LANGUAGE +@itemx LC_COLLATE +@itemx LC_NUMERIC +@itemx LC_MESSAGES +@evindex LANG +@evindex LC_ALL +@evindex LC_TIME +@evindex LC_CTYPE +@evindex LANGUAGE +@evindex LC_COLLATE +@evindex LC_NUMERIC +@evindex LC_MESSAGES + +These must not be set unconditionally because not all systems understand +e.g. @samp{LANG=C} (notably SCO). Fixing @env{LC_MESSAGES} prevents +Solaris @command{sh} from translating var values in @code{set}! Non-C +@env{LC_CTYPE} values break the ctype check. Fixing @env{LC_COLLATE} +makes scripts more portable in some cases. For example, it causes the +regular expression @samp{[a-z]} to match only lower-case letters on +@sc{ascii} platforms. However, @samp{[a-z]} does not work in general +even when @env{LC_COLLATE} is fixed; for example, it does not work for +@sc{ebcdic} platforms. For maximum portability, you should use regular +expressions like @samp{[abcdefghijklmnopqrstuvwxyz]} that list +characters explicitly instead of relying on ranges. + +@emph{If} one of these variables is set, you should try to unset it, +using @samp{C} as a fall back value. see @ref{Limitations of Builtins}, +builtin @command{unset}, for more details. + +@item NULLCMD +@evindex NULLCMD +When executing the command @samp{>foo}, @command{zsh} executes +@samp{$NULLCMD >foo}. The Bourne shell considers @code{NULLCMD} is +@samp{:}, while @command{zsh}, even in Bourne shell compatibility mode, +sets @code{NULLCMD} to @samp{cat}. If you forgot to set @code{NULLCMD}, +your script might be suspended waiting for data on its standard input. + +@item status +@evindex status +This variable is an alias to @samp{$?} for @code{zsh} (at least 3.1.6), +hence read-only. Do not use it. + +@item PATH_SEPARATOR +@evindex PATH_SEPARATOR +On DJGPP systems, the @code{PATH_SEPARATOR} variable can be set to +either @samp{:} or @samp{;} to control the path separator @command{bash} +uses to set up certain environment variables (such as +@code{PATH}). Since this only works inside bash, you want autoconf to +detect the regular @sc{dos} path separator @samp{;}, so it can be safely +substituted in files that may not support @samp{;} as path separator. So +either unset this variable or set it to @samp{;}. + +@item RANDOM +@evindex RANDOM +Many shells provide @code{RANDOM}, a variable that returns a different +integer when used. Most of the time, its value does not change when it +is not used, but on @sc{irix 6.5} the value changes all the time. This +can be observed by using @command{set}. +@end table + + +@node Limitations of Builtins, Limitations of Usual Tools, Special Shell Variables, Portable Shell +@section Limitations of Shell Builtins + +No, no, we are serious: some shells do have limitations! :) + +You should always keep in mind that any built-in or command may support +options, and therefore have a very different behavior with arguments +starting with a dash. For instance, the innocent @samp{echo "$word"} +can give unexpected results when @code{word} starts with a dash. It is +often possible to avoid this problem using @samp{echo "x$word"}, taking +the @samp{x} into account later in the pipe. + +@table @asis +@item @command{!} +@cindex @command{!} +You can't use @command{!}, you'll have to rewrite your code. + + +@item @command{break} +@c ------------------ +@cindex @command{break} +The use of @samp{break 2}, etcetera, is safe. + + +@item @command{case} +@c ----------------- +@cindex @command{case} +You don't need to quote the argument; no splitting is performed. + +You don't need the final @samp{;;}, but you should use it. + +Because of a bug in its @code{fnmatch}, @command{bash} fails to properly +handle backslashes in character classes: + +@example +bash-2.02$ case /tmp in [/\\]*) echo OK;; esac +bash-2.02$ +@end example + +@noindent +This is extremely unfortunate, since you are likely to use this code to +handle @sc{unix} or @sc{ms-dos} absolute paths. To work around this +bug, always put the backslash first: + +@example +bash-2.02$ case '\TMP' in [\\/]*) echo OK;; esac +OK +bash-2.02$ case /tmp in [\\/]*) echo OK;; esac +OK +@end example + + +@item @command{echo} +@c ----------------- +@cindex @command{echo} +The simple @code{echo} is probably the most surprising source of +portability troubles. It is not possible to use @samp{echo} portably +unless both options and escape sequences are omitted. New applications +which are not aiming at portability should use @samp{printf} instead of +@samp{echo}. + +Don't expect any option. @xref{Preset Output Variables}, @code{ECHO_N} +etc. for a means to simulate @option{-c}. + +Do not use backslashes in the arguments, as there is no consensus on +their handling. On @samp{echo '\n' | wc -l}, the @command{sh} of +Digital Unix 4.0, @sc{mips risc/os} 4.52, answer 2, but the Solaris' +@command{sh}, Bash and Zsh (in @command{sh} emulation mode) report 1. +Please note that the problem is truly @command{echo}: all the shells +understand @samp{'\n'} as the string composed of a backslash and an +@samp{n}. + +Because of these problems, do not pass a string containing arbitrary +characters to @command{echo}. For example, @samp{echo "$foo"} is safe +if you know that @var{foo}'s value cannot contain backslashes and cannot +start with @samp{-}, but otherwise you should use a here-document like +this: + +@example +cat <<EOF +$foo +EOF +@end example + + +@item @command{exit} +@c ----------------- +@cindex @command{exit} +The default value of @command{exit} is supposed to be @code{$?}; +unfortunately, some shells, such as the DJGPP port of Bash 2.04, just +perform @samp{exit 0}. + +@example +bash-2.04$ foo=`exit 1` || echo fail +fail +bash-2.04$ foo=`(exit 1)` || echo fail +fail +bash-2.04$ foo=`(exit 1); exit` || echo fail +bash-2.04$ +@end example + +Using @samp{exit $?} restores the expected behavior. + +Some shell scripts, such as those generated by @command{autoconf}, use a +trap to clean up before exiting. If the last shell command exited with +nonzero status, the trap also exits with nonzero status so that the +invoker can tell that an error occurred. + +Unfortunately, in some shells, such as Solaris 8 @command{sh}, an exit +trap ignores the @code{exit} command's status. In these shells, a trap +cannot determine whether it was invoked by plain @code{exit} or by +@code{exit 1}. Instead of calling @code{exit} directly, use the +@code{AC_MSG_ERROR} macro that has a workaround for this problem. + + +@item @command{export} +@c ------------------- +@cindex @command{export} +The builtin @command{export} dubs @dfn{environment variable} a shell +variable. Each update of exported variables corresponds to an update of +the environment variables. Conversely, each environment variable +received by the shell when it is launched should be imported as a shell +variable marked as exported. + +Alas, many shells, such as Solaris 2.5, IRIX 6.3, IRIX 5.2, AIX 4.1.5 +and DU 4.0, forget to @command{export} the environment variables they +receive. As a result, two variables are coexisting: the environment +variable and the shell variable. The following code demonstrates this +failure: + +@example +#! /bin/sh +echo $FOO +FOO=bar +echo $FOO +exec /bin/sh $0 +@end example + +@noindent +when run with @samp{FOO=foo} in the environment, these shells will print +alternately @samp{foo} and @samp{bar}, although it should only print +@samp{foo} and then a sequence of @samp{bar}s. + +Therefore you should @command{export} again each environment variable +that you update. + + +@item @command{false} +@c ------------------ +@cindex @command{false} +Don't expect @command{false} to exit with status 1: in the native Bourne +shell of Solaris 8, it exits with status 255. + + +@item @command{for} +@c ---------------- +@cindex @command{for} +To loop over positional arguments, use: + +@example +for arg +do + echo "$arg" +done +@end example + +@noindent +You may @emph{not} leave the @code{do} on the same line as @code{for}, +since some shells improperly grok: + +@example +for arg; do + echo "$arg" +done +@end example + +If you want to explicitly refer to the positional arguments, given the +@samp{$@@} bug (@pxref{Shell Substitutions}), use: + +@example +for arg in $@{1+"$@@"@}; do + echo "$arg" +done +@end example + +@item @command{if} +@c --------------- +@cindex @command{if} +Using @samp{!} is not portable. Instead of: + +@example +if ! cmp -s file file.new; then + mv file.new file +fi +@end example + +@noindent +use: + +@example +if cmp -s file file.new; then :; else + mv file.new file +fi +@end example + +There are shells that do not reset the exit status from an @command{if}: + +@example +$ if (exit 42); then true; fi; echo $? +42 +@end example + +@noindent +whereas a proper shell should have printed @samp{0}. This is especially +bad in Makefiles since it produces false failures. This is why properly +written Makefiles, such as Automake's, have such hairy constructs: + +@example +if test -f "$file"; then + install "$file" "$dest" +else + : +fi +@end example + + +@item @command{set} +@c ---------------- +@cindex @command{set} +This builtin faces the usual problem with arguments starting with a +dash. Modern shells such as Bash or Zsh understand @option{--} to specify +the end of the options (any argument after @option{--} is a parameters, +even @samp{-x} for instance), but most shells simply stop the option +processing as soon as a non-option argument is found. Therefore, use +@samp{dummy} or simply @samp{x} to end the option processing, and use +@command{shift} to pop it out: + +@example +set x $my_list; shift +@end example + +@item @command{shift} +@c ------------------ +@cindex @command{shift} +Not only is @command{shift}ing a bad idea when there is nothing left to +shift, but in addition it is not portable: the shell of @sc{mips +risc/os} 4.52 refuses to do it. + +@item @command{test} +@c ----------------- +@cindex @command{test} +The @code{test} program is the way to perform many file and string +tests. It is often invoked by the alternate name @samp{[}, but using +that name in Autoconf code is asking for trouble since it is an M4 quote +character. + +If you need to make multiple checks using @code{test}, combine them with +the shell operators @samp{&&} and @samp{||} instead of using the +@code{test} operators @option{-a} and @option{-o}. On System V, the +precedence of @option{-a} and @option{-o} is wrong relative to the unary +operators; consequently, @sc{posix} does not specify them, so using them +is nonportable. If you combine @samp{&&} and @samp{||} in the same +statement, keep in mind that they have equal precedence. + +You may use @samp{!} with @command{test}, but not with @command{if}: +@samp{test ! -r foo || exit 1}. + +@item @command{test} (files) +@c ------------------------- +To enable @code{configure} scripts to support cross-compilation, they +shouldn't do anything that tests features of the build system instead of +the host system. But occasionally you may find it necessary to check +whether some arbitrary file exists. To do so, use @samp{test -f} or +@samp{test -r}. Do not use @samp{test -x}, because @sc{4.3bsd} does not +have it. Do not use @samp{test -e} either, because Solaris 2.5 does not +have it. + +@item @command{test} (strings) +@c --------------------------- +Avoid @samp{test "@var{string}"}, in particular if @var{string} might +start with a dash, since @code{test} might interpret its argument as an +option (e.g., @samp{@var{string} = "-n"}). + +Contrary to a common belief, @samp{test -n @var{string}} and @samp{test +-z @var{string}} @strong{are} portable, nevertheless many shells (such +as Solaris 2.5, AIX 3.2, UNICOS 10.0.0.6, Digital Unix 4 etc.) have +bizarre precedence and may be confused if @var{string} looks like an +operator: + +@example +$ test -n = +test: argument expected +@end example + +If there are risks, use @samp{test "x@var{string}" = x} or @samp{test +"x@var{string}" != x} instead. + +It is frequent to find variations of the following idiom: + +@example +test -n "`echo $ac_feature | sed 's/[-a-zA-Z0-9_]//g'`" && + @var{action} +@end example + +@noindent +to take an action when a token matches a given pattern. Such constructs +should always be avoided by using: + +@example +echo "$ac_feature" | grep '[^-a-zA-Z0-9_]' >/dev/null 2>&1 && + @var{action} +@end example + +@noindent +Use @code{case} where possible since it is faster, being a shell builtin: + + +@example +case $ac_feature in + *[!-a-zA-Z0-9_]*) @var{action};; +esac +@end example + +Alas, negated character classes are probably not portable, although no +shell is known to not support the @sc{posix.2} syntax @samp{[!@dots{}]} +(when in interactive mode, @command{zsh} is confused by the +@samp{[!@dots{}]} syntax and looks for an event in its history because of +@samp{!}). Many shells do not support the alternative syntax +@samp{[^@dots{}]} (Solaris, Digital Unix, etc.). + +One solution can be: + +@example +expr "$ac_feature" : '.*[^-a-zA-Z0-9_]' >/dev/null && + @var{action} +@end example + +@noindent +or better yet + +@example +expr "x$ac_feature" : '.*[^-a-zA-Z0-9_]' >/dev/null && + @var{action} +@end example + +@samp{expr "X@var{foo}" : "X@var{bar}"} is more robust than @samp{echo +"X@var{foo}" | grep "^X@var{bar}"}, because it avoids problems when +@samp{@var{foo}} contains backslashes. + + +@item @command{trap} +@c ----------------- +@cindex @command{trap} +It is safe to trap at least the signals 1, 2, 13 and 15. You can also +trap 0, i.e., have the @command{trap} run when the script ends (either via an +explicit @command{exit}, or the end of the script). + +Although @sc{posix} is not absolutely clear on this point, it is widely +admitted that when entering the trap @samp{$?} should be set to the exit +status of the last command run before the trap. The ambiguity can be +summarized as: ``when the trap is launched by an @command{exit}, what is +the @emph{last} command run: that before @command{exit}, or +@command{exit} itself?'' + +Bash considers @command{exit} to be the last command, while Zsh and +Solaris 8 @command{sh} consider that when the trap is run it is +@emph{still} in the @command{exit}, hence it is the previous exit status +that the trap receives: + +@example +$ cat trap.sh +trap 'echo $?' 0 +(exit 42); exit 0 +$ zsh trap.sh +42 +$ bash trap.sh +0 +@end example + +The portable solution is then simple: when you want to @samp{exit 42}, +run @samp{(exit 42); exit 42}, the first @command{exit} being used to +set the exit status to 42 for Zsh, and the second to trigger the trap +and pass 42 as exit status for Bash. + +The shell in FreeBSD 4.0 has the following bug: @samp{$?} is reset to 0 +by empty lines if the code is inside @command{trap}. + +@example +$ trap 'false + +echo $?' 0 +$ exit +0 +@end example + +@noindent +Fortunately, this bug only affects @command{trap}. + +@item @command{true} +@c ----------------- +@cindex @command{true} +@cindex @command{:} +Don't worry: as far as we know @command{true} is portable. +Nevertheless, it's not always a builtin (e.g., Bash 1.x), and the +portable shell community tends to prefer using @command{:}. This has a +funny side effect: when asked whether @command{false} is more portable +than @command{true} Alexandre Oliva answered: + +@quotation +In a sense, yes, because if it doesn't exist, the shell will produce an +exit status of failure, which is correct for @command{false}, but not +for @command{true}. +@end quotation + + +@item @command{unset} +@c ------------------ +@cindex @command{unset} +You cannot assume the support of @command{unset}, nevertheless, because +it is extremely useful to disable embarrassing variables such as +@code{CDPATH} or @code{LANG}, you can test for its existence and use +it @emph{provided} you give a neutralizing value when @command{unset} is +not supported: + +@example +if (unset FOO) >/dev/null 2>&1; then + unset=unset +else + unset=false +fi +$unset CDPATH || CDPATH=: +@end example + +@xref{Special Shell Variables}, for some neutralizing values. Also, see +@ref{Limitations of Builtins}, documentation of @command{export}, for +the case of environment variables. +@end table + +@node Limitations of Usual Tools, Limitations of Make, Limitations of Builtins, Portable Shell +@section Limitations of Usual Tools + +The small set of tools you can expect to find on any machine can still +include some limitations you should be aware of. + +@table @asis +@item @command{awk} +@c ---------------- +@cindex @command{awk} +Don't leave white spaces before the parentheses in user functions calls, +@sc{gnu} awk will reject it: + +@example +$ gawk 'function die () @{ print "Aaaaarg!" @} + BEGIN @{ die () @}' +gawk: cmd. line:2: BEGIN @{ die () @} +gawk: cmd. line:2: ^ parse error +$ gawk 'function die () @{ print "Aaaaarg!" @} + BEGIN @{ die() @}' +Aaaaarg! +@end example + +If you want your program to be deterministic, don't depend on @code{for} +on arrays: + +@example +$ cat for.awk +END @{ + arr["foo"] = 1 + arr["bar"] = 1 + for (i in arr) + print i +@} +$ gawk -f for.awk </dev/null +foo +bar +$ nawk -f for.awk </dev/null +bar +foo +@end example + +Some AWK, such as HPUX 11.0's native one, have regex engines fragile to +inner anchors: + +@example +$ echo xfoo | $AWK '/foo|^bar/ @{ print @}' +$ echo bar | $AWK '/foo|^bar/ @{ print @}' +bar +$ echo xfoo | $AWK '/^bar|foo/ @{ print @}' +xfoo +$ echo bar | $AWK '/^bar|foo/ @{ print @}' +bar +@end example + +@noindent +Either do not depend on such patterns (i.e., use @samp{/^(.*foo|bar)/}, +or use a simple test to reject such AWK. + + +@item @command{cat} +@c ---------------- +@cindex @command{cat} +Don't rely on any option. The option @option{-v}, which displays +non-printing characters, @emph{seems} portable, though. + + +@item @command{cc} +@c --------------- +When a compilation such as @samp{cc foo.c -o foo} fails, some compilers +(such as @sc{cds} on Reliant @sc{unix}) leave a @file{foo.o}. + + +@item @command{cmp} +@c ---------------- +@cindex @command{cmp} +@command{cmp} performs a raw data comparison of two files, while +@command{diff} compares two text files. Therefore, if you might compare +DOS files, even if only checking whether two files are different, use +@command{diff} to avoid spurious differences due to differences of +newline encoding. + + +@item @command{cp} +@c --------------- +@cindex @command{cp} +@c This is thanks to Ian. +SunOS @command{cp} does not support @option{-f}, although its +@command{mv} does. It's possible to deduce why @command{mv} and +@command{cp} are different with respect to @option{-f}. @command{mv} +prompts by default before overwriting a read-only file. @command{cp} +does not. Therefore, @command{mv} requires a @option{-f} option, but +@command{cp} does not. @command{mv} and @command{cp} behave differently +with respect to read-only files because the simplest form of +@command{cp} cannot overwrite a read-only file, but the simplest form of +@command{mv} can. This is because @command{cp} opens the target for +write access, whereas @command{mv} simply calls @code{link} (or, in +newer systems, @code{rename}). +@c Ian said: ``I don't think -p or -r are portable''!!! How can you live +@c without -r??? + + +@item @command{diff} +@c ----------------- +@cindex @command{diff} +Option @option{-u} is nonportable. + +Some implementations, such as Tru64's, fail when comparing to +@file{/dev/null}. Use an empty file instead. + +@item @command{dirname} +@c -------------------- +@cindex @command{dirname} +Not all hosts have @command{dirname}, but it is reasonably easy to +emulate, e.g.: + +@example +dir=`expr "x$file" : 'x\(.*\)/[^/]*' \| + '.' : '.' +@end example + +@noindent +But there are a few subtilities, e.g., under UN*X, should @samp{//1} +give @samp{/}? Paul Eggert answers: + +@quotation +No, under some older flavors of Unix, leading @samp{//} is a special +path name: it refers to a ``super-root'' and is used to access other +machines' files. Leading @samp{///}, @samp{////}, etc. are equivalent +to @samp{/}; but leading @samp{//} is special. I think this tradition +started with Apollo Domain/OS, an OS that is still in use on some older +hosts. + +POSIX.2 allows but does not require the special treatment for @samp{//}. +It says that the behavior of dirname on path names of the form +@samp{//([^/]+/*)?} is implementation defined. In these cases, GNU +@command{dirname} returns @samp{/}, but it's more portable to return +@samp{//} as this works even on those older flavors of Unix. + +I have heard rumors that this special treatment of @samp{//} may be +dropped in future versions of POSIX, but for now it's still the +standard. +@end quotation + + +@item @command{egrep} +@c ------------------ +@cindex @command{egrep} +The empty alternative is not portable, use @samp{?} instead. For +instance with Digital Unix v5.0: + +@example +> printf "foo\n|foo\n" | egrep '^(|foo|bar)$' +|foo +> printf "bar\nbar|\n" | egrep '^(foo|bar|)$' +bar| +> printf "foo\nfoo|\n|bar\nbar\n" | egrep '^(foo||bar)$' +foo +|bar +@end example + +@command{egrep} also suffers the limitations of @command{grep}. + + +@item @command{expr} +@c ----------------- +@cindex @command{expr} +No @command{expr} keyword starts with @samp{x}, so use @samp{expr +x"@var{word}" : 'x@var{regex}'} to keep @command{expr} from +misinterpreting @var{word}. + +Don't use @code{length}, @code{substr}, @code{match} and @code{index}. + +@item @command{expr} (@samp{|}) +@cindex @command{expr} (@samp{|}) +You can use @samp{|}. Although @sc{posix} does require that @samp{expr +''} return the empty string, it does not specify the result when you +@samp{|} together the empty string (or zero) with the empty string. For +example: + +@example +expr '' \| '' +@end example + +@sc{gnu}/Linux and @sc{posix.2-1992} return the empty string for this +case, but traditional Unix returns @samp{0} (Solaris is one such +example). In the latest @sc{posix} draft, the specification has been +changed to match traditional Unix's behavior (which is bizarre, but it's +too late to fix this). Please note that the same problem does arise +when the empty string results from a computation, as in: + +@example +expr bar : foo \| foo : bar +@end example + +@noindent +Avoid this portability problem by avoiding the empty string. + + +@item @command{expr} (@samp{:}) +@c ---------------------------- +@cindex @command{expr} +Don't use @samp{\?}, @samp{\+} and @samp{\|} in patterns, they are +not supported on Solaris. + +The @sc{posix.2-1992} standard is ambiguous as to whether @samp{expr a : +b} (and @samp{expr 'a' : '\(b\)'}) output @samp{0} or the empty string. +In practice, it outputs the empty string on most platforms, but portable +scripts should not assume this. For instance, the @sc{qnx} 4.25 native +@command{expr} returns @samp{0}. + +You may believe that one means to get a uniform behavior would be to use +the empty string as a default value: + +@example +expr a : b \| '' +@end example + +@noindent +unfortunately this behaves exactly as the original expression, see the +@samp{@command{expr} (@samp{:})} entry for more information. + +Older @command{expr} implementations (e.g. SunOS 4 @command{expr} and +Solaris 8 @command{/usr/ucb/expr}) have a silly length limit that causes +@command{expr} to fail if the matched substring is longer than 120 +bytes. In this case, you might want to fall back on @samp{echo|sed} if +@command{expr} fails. + +Don't leave, there is some more! + +The @sc{qnx} 4.25 @command{expr}, in addition of preferring @samp{0} to +the empty string, has a funny behavior in its exit status: it's always 1 +when parentheses are used! + +@example +$ val=`expr 'a' : 'a'`; echo "$?: $val" +0: 1 +$ val=`expr 'a' : 'b'`; echo "$?: $val" +1: 0 + +$ val=`expr 'a' : '\(a\)'`; echo "?: $val" +1: a +$ val=`expr 'a' : '\(b\)'`; echo "?: $val" +1: 0 +@end example + +@noindent +In practice this can be a big problem if you are ready to catch failures +of @command{expr} programs with some other method (such as using +@command{sed}), since you may get twice the result. For instance + +@example +$ expr 'a' : '\(a\)' || echo 'a' | sed 's/^\(a\)$/\1/' +@end example + +@noindent +will output @samp{a} on most hosts, but @samp{aa} on @sc{qnx} 4.25. A +simple work around consists in testing @command{expr} and use a variable +set to @command{expr} or to @command{false} according to the result. + + +@item @command{find} +@c ----------------- +The option @option{-maxdepth} seems to be GNU specific. Tru64 v5.1, +NetBSD 1.5 and Solaris 2.5 @command{find} commands do not understand it. + + +@item @command{grep} +@c ----------------- +@cindex @command{grep} +Don't use @samp{grep -s} to suppress output, because @samp{grep -s} on +System V does not suppress output, only error messages. Instead, +redirect the standard output and standard error (in case the file +doesn't exist) of @code{grep} to @file{/dev/null}. Check the exit +status of @code{grep} to determine whether it found a match. + +Don't use multiple regexps with @option{-e}, as some @code{grep} will only +honor the last pattern (eg., IRIX 6.5 and Solaris 2.5.1). Anyway, +Stardent Vistra SVR4 @code{grep} lacks @option{-e}@dots{} Instead, use +alternation and @code{egrep}. + + +@item @command{ln} +@c --------------- +@cindex @command{ln} +@cindex Symbolic links +Don't rely on @command{ln} having a @option{-f} option. Symbolic links +are not available on old systems, use @samp{ln} as a fall back. + +For versions of the DJGPP before 2.04, @command{ln} emulates soft links +for executables by generating a stub that in turn calls the real +program. This feature also works with nonexistent files like in the +Unix spec. So @samp{ln -s file link} will generate @file{link.exe}, +which will attempt to call @file{file.exe} if run. But this feature only +works for executables, so @samp{cp -p} is used instead for these +systems. DJGPP versions 2.04 and later have full symlink support. + + +@item @command{mv} +@c --------------- +@cindex @command{mv} +The only portable options are @option{-f} and @option{-i}. + +Moving individual files between file systems is portable (it was in V6), +but it is not always atomic: when doing @samp{mv new existing}, there's +a critical section where neither the old nor the new version of +@file{existing} actually exists. + +Moving directories across mount points is not portable, use @command{cp} +and @command{rm}. + + +@item @command{sed} +@c ---------------- +@cindex @command{sed} +Patterns should not include the separator (unless escaped), even as part +of a character class. In conformance with @sc{posix}, the Cray +@command{sed} will reject @samp{s/[^/]*$//}: use @samp{s,[^/]*$,,}. + +Sed scripts should not use branch labels longer than 8 characters and +should not contain comments. + +Don't include extra @samp{;}, as some @command{sed}, such as NetBSD +1.4.2's, try to interpret the second as a command: + +@example +$ echo a | sed 's/x/x/;;s/x/x/' +sed: 1: "s/x/x/;;s/x/x/": invalid command code ; +@end example + +Input should have reasonably long lines, since some @command{sed} have +an input buffer limited to 4000 bytes. + +Alternation, @samp{\|}, is common but not portable. +@c FIXME: I know Solaris is guilty, but I don't remember how. +Anchors (@samp{^} and @samp{$}) inside groups are not portable. + +Nested groups are extremely portable, but there is at least one +@command{sed} (System V/68 Base Operating System R3V7.1) that does not +support it. + +Of course the option @option{-e} is portable, but it is not needed. No +valid Sed program can start with a dash, so it does not help +disambiguating. Its sole usefulness is helping enforcing indenting as +in: + +@example +sed -e @var{instruction-1} \ + -e @var{instruction-2} +@end example + +@noindent +as opposed to + +@example +sed @var{instruction-1};@var{instruction-2} +@end example + +Contrary to yet another urban legend, you may portably use @samp{&} in +the replacement part of the @code{s} command to mean ``what was +matched''. + + +@item @command{sed} (@samp{t}) +@c --------------------------- +@cindex @command{sed} (@samp{t}) +Some old systems have @command{sed} that ``forget'' to reset their +@samp{t} flag when starting a new cycle. For instance on @sc{mips +risc/os}, and on @sc{irix} 5.3, if you run the following @command{sed} +script (the line numbers are not actual part of the texts): + +@example +s/keep me/kept/g # a +t end # b +s/.*/deleted/g # c +: end # d +@end example + +@noindent +on + +@example +delete me # 1 +delete me # 2 +keep me # 3 +delete me # 4 +@end example + +@noindent +you get + +@example +deleted +delete me +kept +deleted +@end example + +@noindent +instead of + +@example +deleted +deleted +kept +deleted +@end example + +Why? When processing 1, a matches, therefore sets the t flag, b jumps to +d, and the output is produced. When processing line 2, the t flag is +still set (this is the bug). Line a fails to match, but @command{sed} +is not supposed to clear the t flag when a substitution fails. Line b +sees that the flag is set, therefore it clears it, and jumps to d, hence +you get @samp{delete me} instead of @samp{deleted}. When processing 3 t +is clear, a matches, so the flag is set, hence b clears the flags and +jumps. Finally, since the flag is clear, 4 is processed properly. + +There are two things one should remind about @samp{t} in @command{sed}. +Firstly, always remember that @samp{t} jumps if @emph{some} substitution +succeeded, not only the immediately preceding substitution, therefore, +always use a fake @samp{t clear; : clear} to reset the t flag where +indeed. + +Secondly, you cannot rely on @command{sed} to clear the flag at each new +cycle. + +One portable implementation of the script above is: + +@example +t clear +: clear +s/keep me/kept/g +t end +s/.*/deleted/g +: end +@end example + +@item @command{touch} +@c ------------------ +@cindex @command{touch} +On some old @sc{bsd} systems, @command{touch} or any command that +results in an empty file does not update the timestamps, so use a +command like @code{echo} as a workaround. + +GNU @command{touch} 3.16r (and presumably all before that) fails to work +on SunOS 4.1.3 when the empty file is on an @sc{nfs}-mounted 4.2 volume. + +@end table + + +@node Limitations of Make, , Limitations of Usual Tools, Portable Shell +@section Limitations of Make + +Make itself suffers a great number of limitations, only a few of which +being listed here. First of all, remember that since commands are +executed by the shell, all its weaknesses are inherited@dots{} + +@table @asis +@item Leading underscore in macro names +Some Make don't support leading underscores in macro names, such as on +NEWS-OS 4.2R. + +@example +$ cat Makefile +_am_include = # +_am_quote = +all:; @@echo this is test + +% make +Make: Must be a separator on rules line 2. Stop. + +$ cat Makefile2 +am_include = # +am_quote = +all:; @@echo this is test + +$ make -f Makefile2 +this is test +@end example + +@item @code{VPATH} +@cindex @code{VPATH} +Don't use it! For instance any assignment to @code{VPATH} causes Sun +@command{make} to only execute the first set of double-colon rules. +@end table + + + + +@c ================================================== Manual Configuration + +@node Manual Configuration, Site Configuration, Portable Shell, Top +@chapter Manual Configuration + +A few kinds of features can't be guessed automatically by running test +programs. For example, the details of the object-file format, or +special options that need to be passed to the compiler or linker. You +can check for such features using ad-hoc means, such as having +@code{configure} check the output of the @code{uname} program, or +looking for libraries that are unique to particular systems. However, +Autoconf provides a uniform method for handling unguessable features. + +@menu +* Specifying Names:: Specifying the system type +* Canonicalizing:: Getting the canonical system type +* Using System Type:: What to do with the system type +@end menu + +@node Specifying Names, Canonicalizing, Manual Configuration, Manual Configuration +@section Specifying the System Type + +Like other @sc{gnu} @code{configure} scripts, Autoconf-generated +@code{configure} scripts can make decisions based on a canonical name +for the system type, which has the form: +@samp{@var{cpu}-@var{vendor}-@var{os}}, where @var{os} can be +@samp{@var{system}} or @samp{@var{kernel}-@var{system}} + +@code{configure} can usually guess the canonical name for the type of +system it's running on. To do so it runs a script called +@code{config.guess}, which infers the name using the @code{uname} +command or symbols predefined by the C preprocessor. + +Alternately, the user can specify the system type with command line +arguments to @code{configure}. Doing so is necessary when +cross-compiling. In the most complex case of cross-compiling, three +system types are involved. The options to specify them are@footnote{For +backward compatibility, @code{configure} will accept a system type as an +option by itself. Such an option will override the defaults for build, +host and target system types. The following configure statement will +configure a cross toolchain that will run on NetBSD/alpha but generate +code for GNU Hurd/sparc, which is also the build platform. + +@example +./configure --host=alpha-netbsd sparc-gnu +@end example +}: + +@table @option +@item --build=@var{build-type} +the type of system on which the package is being configured and +compiled. + +@item --host=@var{host-type} +@ovindex cross_compiling +the type of system on which the package will run. + +@item --target=@var{target-type} +the type of system for which any compiler tools in the package will +produce code (rarely needed). By default, it is the same as host. +@end table + +They all default to the result of running @code{config.guess}, unless +you specify either @option{--build} or @option{--host}. In this case, the +default becomes the system type you specified. If you specify both, and +they're different, @code{configure} will enter cross compilation mode, +so it won't run any tests that require execution. + +Hint: if you mean to override the result of @code{config.guess}, prefer +@option{--build} over @option{--host}. In the future, @option{--host} will +not override the name of the build system type. Also, if you specify +@option{--host}, but not @option{--build}, when @code{configure} performs +the first compiler test it will try to run an executable produced by the +compiler. If the execution fails, it will enter cross-compilation mode. +Note, however, that it won't guess the build-system type, since this may +require running test programs. Moreover, by the time the compiler test +is performed, it may be too late to modify the build-system type: other +tests may have already been performed. Therefore, whenever you specify +@code{--host}, be sure to specify @code{--build} too. + +@example +./configure --build=i686-pc-linux-gnu --host=m68k-coff +@end example + +@noindent +will enter cross-compilation mode, but @code{configure} will fail if it +can't run the code generated by the specified compiler if you configure +as follows: + +@example +./configure CC=m68k-coff-gcc +@end example + +@code{configure} recognizes short aliases for many system types; for +example, @samp{decstation} can be used instead of +@samp{mips-dec-ultrix4.2}. @code{configure} runs a script called +@code{config.sub} to canonicalize system type aliases. + + + +@node Canonicalizing, Using System Type, Specifying Names, Manual Configuration +@section Getting the Canonical System Type + +The following macros make the system type available to @code{configure} +scripts. + +@ovindex build_alias +@ovindex host_alias +@ovindex target_alias + +The variables @samp{build_alias}, @samp{host_alias}, and +@samp{target_alias} are always exactly the arguments of @option{--build}, +@option{--host}, and @option{--target}; in particular, they are left empty +if the user did not use them, even if the corresponding +@code{AC_CANONICAL} macro was run. Any configure script may use these +variables anywhere. These are the variables that should be used when in +interaction with the user. + +If you need to recognize some special environments based on their system +type, run the following macros to get canonical system names. These +variables are not set before the macro call. + +If you use these macros, you must distribute @code{config.guess} and +@code{config.sub} along with your source code. @xref{Output}, for +information about the @code{AC_CONFIG_AUX_DIR} macro which you can use +to control in which directory @code{configure} looks for those scripts. + + +@defmac AC_CANONICAL_BUILD +@maindex CANONICAL_BUILD +@ovindex build +@ovindex build_cpu +@ovindex build_vendor +@ovindex build_os +Compute the canonical build-system type variable, @code{build}, and its +three individual parts @code{build_cpu}, @code{build_vendor}, and +@code{build_os}. + +If @option{--build} was specified, then @code{build} is the +canonicalization of @code{build_alias} by @command{config.sub}, +otherwise it is determined by the shell script @code{config.guess}. +@end defmac + +@defmac AC_CANONICAL_HOST +@maindex CANONICAL_HOST +@ovindex host +@ovindex host_cpu +@ovindex host_vendor +@ovindex host_os +Compute the canonical host-system type variable, @code{host}, and its +three individual parts @code{host_cpu}, @code{host_vendor}, and +@code{host_os}. + +If @option{--host} was specified, then @code{host} is the +canonicalization of @code{host_alias} by @command{config.sub}, +otherwise it defaults to @code{build}. + +For temporary backward-compatibility, when @option{--host} is specified +by @option{--build} isn't, the build system will be assumed to be the +same as @option{--host}, and @samp{build_alias} will be set to that +value. Eventually, this historically incorrect behavior will go away. + +@end defmac + +@defmac AC_CANONICAL_TARGET +@maindex CANONICAL_TARGET +@ovindex target +@ovindex target_cpu +@ovindex target_vendor +@ovindex target_os +Compute the canonical target-system type variable, @code{target}, and its +three individual parts @code{target_cpu}, @code{target_vendor}, and +@code{target_os}. + +If @option{--target} was specified, then @code{target} is the +canonicalization of @code{target_alias} by @command{config.sub}, +otherwise it defaults to @code{host}. +@end defmac + + +@node Using System Type, , Canonicalizing, Manual Configuration +@section Using the System Type + +How do you use a canonical system type? Usually, you use it in one or +more @code{case} statements in @file{configure.ac} to select +system-specific C files. Then, using @code{AC_CONFIG_LINKS}, link those +files which have names based on the system name, to generic names, such +as @file{host.h} or @file{target.c} (@pxref{Configuration Links}). The +@code{case} statement patterns can use shell wild cards to group several +cases together, like in this fragment: + +@example +case "$target" in +i386-*-mach* | i386-*-gnu*) + obj_format=aout emulation=mach bfd_gas=yes ;; +i960-*-bout) obj_format=bout ;; +esac +@end example + +@noindent +and in @file{configure.ac}, use: + +@example +AC_CONFIG_LINKS(host.h:config/$machine.h + object.h:config/$obj_format.h) +@end example + +You can also use the host system type to find cross-compilation tools. +@xref{Generic Programs}, for information about the @code{AC_CHECK_TOOL} +macro which does that. + + +@c ===================================================== Site Configuration. + +@node Site Configuration, Running configure scripts, Manual Configuration, Top +@chapter Site Configuration + +@code{configure} scripts support several kinds of local configuration +decisions. There are ways for users to specify where external software +packages are, include or exclude optional features, install programs +under modified names, and set default values for @code{configure} +options. + +@menu +* External Software:: Working with other optional software +* Package Options:: Selecting optional features +* Pretty Help Strings:: Formatting help string +* Site Details:: Configuring site details +* Transforming Names:: Changing program names when installing +* Site Defaults:: Giving @code{configure} local defaults +@end menu + +@node External Software, Package Options, Site Configuration, Site Configuration +@section Working With External Software + +Some packages require, or can optionally use, other software packages +that are already installed. The user can give @code{configure} +command line options to specify which such external software to use. +The options have one of these forms: + +@example +--with-@var{package}=@ovar{arg} +--without-@var{package} +@end example + +For example, @option{--with-gnu-ld} means work with the @sc{gnu} linker +instead of some other linker. @option{--with-x} means work with The X +Window System. + +The user can give an argument by following the package name with +@samp{=} and the argument. Giving an argument of @samp{no} is for +packages that are used by default; it says to @emph{not} use the +package. An argument that is neither @samp{yes} nor @samp{no} could +include a name or number of a version of the other package, to specify +more precisely which other package this program is supposed to work +with. If no argument is given, it defaults to @samp{yes}. +@option{--without-@var{package}} is equivalent to +@option{--with-@var{package}=no}. + +@code{configure} scripts do not complain about +@option{--with-@var{package}} options that they do not support. This +behavior permits configuring a source tree containing multiple packages +with a top-level @code{configure} script when the packages support +different options, without spurious error messages about options that +some of the packages support. An unfortunate side effect is that option +spelling errors are not diagnosed. No better approach to this problem +has been suggested so far. + +For each external software package that may be used, @file{configure.ac} +should call @code{AC_ARG_WITH} to detect whether the @code{configure} +user asked to use it. Whether each package is used or not by default, +and which arguments are valid, is up to you. + +@defmac AC_ARG_WITH (@var{package}, @var{help-string}, @ovar{action-if-given}, @ovar{action-if-not-given}) +@maindex ARG_WITH +If the user gave @code{configure} the option @option{--with-@var{package}} +or @option{--without-@var{package}}, run shell commands +@var{action-if-given}. If neither option was given, run shell commands +@var{action-if-not-given}. The name @var{package} indicates another +software package that this program should work with. It should consist +only of alphanumeric characters and dashes. + +The option's argument is available to the shell commands +@var{action-if-given} in the shell variable @code{withval}, which is +actually just the value of the shell variable @code{with_@var{package}}, +with any @option{-} characters changed into @samp{_}. You may use that +variable instead, if you wish. + +The argument @var{help-string} is a description of the option that +looks like this: +@example + --with-readline support fancy command line editing +@end example + +@noindent +@var{help-string} may be more than one line long, if more detail is +needed. Just make sure the columns line up in @samp{configure --help}. +Avoid tabs in the help string. You'll need to enclose it in @samp{[} +and @samp{]} in order to produce the leading spaces. + +You should format your @var{help-string} with the macro +@code{AC_HELP_STRING} (@pxref{Pretty Help Strings}). +@end defmac + +@defmac AC_WITH (@var{package}, @var{action-if-given}, @ovar{action-if-not-given}) +@maindex WITH +This is an obsolete version of @code{AC_ARG_WITH} that does not +support providing a help string. +@end defmac + +@node Package Options, Pretty Help Strings, External Software, Site Configuration +@section Choosing Package Options + +If a software package has optional compile-time features, the user can +give @code{configure} command line options to specify whether to +compile them. The options have one of these forms: + +@example +--enable-@var{feature}=@ovar{arg} +--disable-@var{feature} +@end example + +These options allow users to choose which optional features to build and +install. @option{--enable-@var{feature}} options should never make a +feature behave differently or cause one feature to replace another. +They should only cause parts of the program to be built rather than left +out. + +The user can give an argument by following the feature name with +@samp{=} and the argument. Giving an argument of @samp{no} requests +that the feature @emph{not} be made available. A feature with an +argument looks like @option{--enable-debug=stabs}. If no argument is +given, it defaults to @samp{yes}. @option{--disable-@var{feature}} is +equivalent to @option{--enable-@var{feature}=no}. + +@code{configure} scripts do not complain about +@option{--enable-@var{feature}} options that they do not support. +This behavior permits configuring a source tree containing multiple +packages with a top-level @code{configure} script when the packages +support different options, without spurious error messages about options +that some of the packages support. +An unfortunate side effect is that option spelling errors are not diagnosed. +No better approach to this problem has been suggested so far. + +For each optional feature, @file{configure.ac} should call +@code{AC_ARG_ENABLE} to detect whether the @code{configure} user asked +to include it. Whether each feature is included or not by default, and +which arguments are valid, is up to you. + +@defmac AC_ARG_ENABLE (@var{feature}, @var{help-string}, @ovar{action-if-given}, @ovar{action-if-not-given}) +@maindex ARG_ENABLE +If the user gave @code{configure} the option +@option{--enable-@var{feature}} or @option{--disable-@var{feature}}, run +shell commands @var{action-if-given}. If neither option was given, run +shell commands @var{action-if-not-given}. The name @var{feature} +indicates an optional user-level facility. It should consist only of +alphanumeric characters and dashes. + +The option's argument is available to the shell commands +@var{action-if-given} in the shell variable @code{enableval}, which is +actually just the value of the shell variable +@code{enable_@var{feature}}, with any @option{-} characters changed into +@samp{_}. You may use that variable instead, if you wish. The +@var{help-string} argument is like that of @code{AC_ARG_WITH} +(@pxref{External Software}). + +You should format your @var{help-string} with the macro +@code{AC_HELP_STRING} (@pxref{Pretty Help Strings}). +@end defmac + +@defmac AC_ENABLE (@var{feature}, @var{action-if-given}, @ovar{action-if-not-given}) +@maindex ENABLE +This is an obsolete version of @code{AC_ARG_ENABLE} that does not +support providing a help string. +@end defmac + + +@node Pretty Help Strings, Site Details, Package Options, Site Configuration +@section Making Your Help Strings Look Pretty + +Properly formatting the @samp{help strings} which are used in +@code{AC_ARG_WITH} (@pxref{External Software}) and @code{AC_ARG_ENABLE} +(@pxref{Package Options}) can be challenging. Specifically, you want +your own @samp{help strings} to line up in the appropriate columns of +@samp{configure --help} just like the standard Autoconf @samp{help +strings} do. This is the purpose of the @code{AC_HELP_STRING} macro. + +@defmac AC_HELP_STRING (@var{left-hand-side}, @var{right-hand-side}) +@maindex HELP_STRING + +Expands into an help string that looks pretty when the user executes +@samp{configure --help}. It is typically used in @code{AC_ARG_WITH} +(@pxref{External Software}) or @code{AC_ARG_ENABLE} (@pxref{Package +Options}). The following example will make this clearer. + +@example +AC_DEFUN(TEST_MACRO, +[AC_ARG_WITH(foo, + AC_HELP_STRING([--with-foo], + [use foo (default is NO)]), + ac_cv_use_foo=$withval, ac_cv_use_foo=no), +AC_CACHE_CHECK(whether to use foo, + ac_cv_use_foo, ac_cv_use_foo=no)]) +@end example + +Please note that the call to @code{AC_HELP_STRING} is @strong{unquoted}. +Then the last few lines of @samp{configure --help} will appear like +this: + +@example +--enable and --with options recognized: + --with-foo use foo (default is NO) +@end example + +The @code{AC_HELP_STRING} macro is particularly helpful when the +@var{left-hand-side} and/or @var{right-hand-side} are composed of macro +arguments, as shown in the following example. + +@example +AC_DEFUN(MY_ARG_WITH, +[AC_ARG_WITH([$1], + AC_HELP_STRING([--with-$1], [use $1 (default is $2)]), + ac_cv_use_$1=$withval, ac_cv_use_$1=no), +AC_CACHE_CHECK(whether to use $1, ac_cv_use_$1, ac_cv_use_$1=$2)]) +@end example +@end defmac + + +@node Site Details, Transforming Names, Pretty Help Strings, Site Configuration +@section Configuring Site Details + +Some software packages require complex site-specific information. Some +examples are host names to use for certain services, company names, and +email addresses to contact. Since some configuration scripts generated +by Metaconfig ask for such information interactively, people sometimes +wonder how to get that information in Autoconf-generated configuration +scripts, which aren't interactive. + +Such site configuration information should be put in a file that is +edited @emph{only by users}, not by programs. The location of the file +can either be based on the @code{prefix} variable, or be a standard +location such as the user's home directory. It could even be specified +by an environment variable. The programs should examine that file at +run time, rather than at compile time. Run time configuration is more +convenient for users and makes the configuration process simpler than +getting the information while configuring. @xref{Directory Variables,, +Variables for Installation Directories, standards, GNU Coding +Standards}, for more information on where to put data files. + +@node Transforming Names, Site Defaults, Site Details, Site Configuration +@section Transforming Program Names When Installing + +Autoconf supports changing the names of programs when installing them. +In order to use these transformations, @file{configure.ac} must call the +macro @code{AC_ARG_PROGRAM}. + +@defmac AC_ARG_PROGRAM +@maindex ARG_PROGRAM +@ovindex program_transform_name +Place in output variable @code{program_transform_name} a sequence of +@code{sed} commands for changing the names of installed programs. + +If any of the options described below are given to @code{configure}, +program names are transformed accordingly. Otherwise, if +@code{AC_CANONICAL_TARGET} has been called and a @option{--target} value +is given that differs from the host type (specified with @option{--host}), +the target type followed by a dash is used as a prefix. Otherwise, no +program name transformation is done. +@end defmac + +@menu +* Transformation Options:: @code{configure} options to transform names +* Transformation Examples:: Sample uses of transforming names +* Transformation Rules:: @file{Makefile} uses of transforming names +@end menu + +@node Transformation Options, Transformation Examples, Transforming Names, Transforming Names +@subsection Transformation Options + +You can specify name transformations by giving @code{configure} these +command line options: + +@table @option +@item --program-prefix=@var{prefix} +prepend @var{prefix} to the names; + +@item --program-suffix=@var{suffix} +append @var{suffix} to the names; + +@item --program-transform-name=@var{expression} +perform @code{sed} substitution @var{expression} on the names. +@end table + +@node Transformation Examples, Transformation Rules, Transformation Options, Transforming Names +@subsection Transformation Examples + +These transformations are useful with programs that can be part of a +cross-compilation development environment. For example, a +cross-assembler running on a Sun 4 configured with +@option{--target=i960-vxworks} is normally installed as +@file{i960-vxworks-as}, rather than @file{as}, which could be confused +with a native Sun 4 assembler. + +You can force a program name to begin with @file{g}, if you don't want +@sc{gnu} programs installed on your system to shadow other programs with +the same name. For example, if you configure @sc{gnu} @code{diff} with +@option{--program-prefix=g}, then when you run @samp{make install} it is +installed as @file{/usr/local/bin/gdiff}. + +As a more sophisticated example, you could use + +@example +--program-transform-name='s/^/g/; s/^gg/g/; s/^gless/less/' +@end example +@noindent + +to prepend @samp{g} to most of the program names in a source tree, +excepting those like @code{gdb} that already have one and those like +@code{less} and @code{lesskey} that aren't @sc{gnu} programs. (That is +assuming that you have a source tree containing those programs that is +set up to use this feature.) + +One way to install multiple versions of some programs simultaneously is +to append a version number to the name of one or both. For example, if +you want to keep Autoconf version 1 around for awhile, you can configure +Autoconf version 2 using @option{--program-suffix=2} to install the +programs as @file{/usr/local/bin/autoconf2}, +@file{/usr/local/bin/autoheader2}, etc. Nevertheless, pay attention +that only the binaries are renamed, therefore you'd have problems with +the library files which might overlap. + +@node Transformation Rules, , Transformation Examples, Transforming Names +@subsection Transformation Rules + +Here is how to use the variable @code{program_transform_name} in a +@file{Makefile.in}: + +@example +transform = @@program_transform_name@@ +install: all + $(INSTALL_PROGRAM) myprog $(bindir)/`echo myprog | \ + sed '$(transform)'` + +uninstall: + rm -f $(bindir)/`echo myprog | sed '$(transform)'` +@end example + +@noindent +If you have more than one program to install, you can do it in a loop: + +@example +PROGRAMS = cp ls rm +install: + for p in $(PROGRAMS); do \ + $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p | \ + sed '$(transform)'`; \ + done + +uninstall: + for p in $(PROGRAMS); do \ + rm -f $(bindir)/`echo $$p | sed '$(transform)'`; \ + done +@end example + +It is guaranteed that @code{program_transform_name} is never empty, and +that there are no useless separators. Therefore you may safely embed +@code{program_transform_name} within a sed program using @samp{;}: + +@example +transform = @@program_transform_name@@ +transform_exe = s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/ +@end example + +Whether to do the transformations on documentation files (Texinfo or +@code{man}) is a tricky question; there seems to be no perfect answer, +due to the several reasons for name transforming. Documentation is not +usually particular to a specific architecture, and Texinfo files do not +conflict with system documentation. But they might conflict with +earlier versions of the same files, and @code{man} pages sometimes do +conflict with system documentation. As a compromise, it is probably +best to do name transformations on @code{man} pages but not on Texinfo +manuals. + +@node Site Defaults, , Transforming Names, Site Configuration +@section Setting Site Defaults + +Autoconf-generated @code{configure} scripts allow your site to provide +default values for some configuration values. You do this by creating +site- and system-wide initialization files. + +@evindex CONFIG_SITE +If the environment variable @code{CONFIG_SITE} is set, @code{configure} +uses its value as the name of a shell script to read. Otherwise, it +reads the shell script @file{@var{prefix}/share/config.site} if it exists, +then @file{@var{prefix}/etc/config.site} if it exists. Thus, +settings in machine-specific files override those in machine-independent +ones in case of conflict. + +Site files can be arbitrary shell scripts, but only certain kinds of +code are really appropriate to be in them. Because @code{configure} +reads any cache file after it has read any site files, a site file can +define a default cache file to be shared between all Autoconf-generated +@code{configure} scripts run on that system (@pxref{Cache Files}). If +you set a default cache file in a site file, it is a good idea to also +set the output variable @code{CC} in that site file, because the cache +file is only valid for a particular compiler, but many systems have +several available. + +You can examine or override the value set by a command line option to +@code{configure} in a site file; options set shell variables that have +the same names as the options, with any dashes turned into underscores. +The exceptions are that @option{--without-} and @option{--disable-} options +are like giving the corresponding @option{--with-} or @option{--enable-} +option and the value @samp{no}. Thus, @option{--cache-file=localcache} +sets the variable @code{cache_file} to the value @samp{localcache}; +@option{--enable-warnings=no} or @option{--disable-warnings} sets the variable +@code{enable_warnings} to the value @samp{no}; @option{--prefix=/usr} sets the +variable @code{prefix} to the value @samp{/usr}; etc. + +Site files are also good places to set default values for other output +variables, such as @code{CFLAGS}, if you need to give them non-default +values: anything you would normally do, repetitively, on the command +line. If you use non-default values for @var{prefix} or +@var{exec_prefix} (wherever you locate the site file), you can set them +in the site file if you specify it with the @code{CONFIG_SITE} +environment variable. + +You can set some cache values in the site file itself. Doing this is +useful if you are cross-compiling, so it is impossible to check features +that require running a test program. You could ``prime the cache'' by +setting those values correctly for that system in +@file{@var{prefix}/etc/config.site}. To find out the names of the cache +variables you need to set, look for shell variables with @samp{_cv_} in +their names in the affected @code{configure} scripts, or in the Autoconf +M4 source code for those macros. + +The cache file is careful to not override any variables set in the site +files. Similarly, you should not override command-line options in the +site files. Your code should check that variables such as @code{prefix} +and @code{cache_file} have their default values (as set near the top of +@code{configure}) before changing them. + +Here is a sample file @file{/usr/share/local/gnu/share/config.site}. The +command @samp{configure --prefix=/usr/share/local/gnu} would read this +file (if @code{CONFIG_SITE} is not set to a different file). + +@example +# config.site for configure +# +# Change some defaults. +test "$prefix" = NONE && prefix=/usr/share/local/gnu +test "$exec_prefix" = NONE && exec_prefix=/usr/local/gnu +test "$sharedstatedir" = '$prefix/com' && sharedstatedir=/var +test "$localstatedir" = '$prefix/var' && localstatedir=/var + +# Give Autoconf 2.x generated configure scripts a shared default +# cache file for feature test results, architecture-specific. +if test "$cache_file" = /dev/null; then + cache_file="$prefix/var/config.cache" + # A cache file is only valid for one C compiler. + CC=gcc +fi +@end example + + +@c ============================================== Running configure Scripts. + +@node Running configure scripts, config.status Invocation, Site Configuration, Top +@chapter Running @code{configure} Scripts +@cindex @code{configure} + +Below are instructions on how to configure a package that uses a +@code{configure} script, suitable for inclusion as an @file{INSTALL} +file in the package. A plain-text version of @file{INSTALL} which you +may use comes with Autoconf. + +@menu +* Basic Installation:: Instructions for typical cases +* Compilers and Options:: Selecting compilers and optimization +* Multiple Architectures:: Compiling for multiple architectures at once +* Installation Names:: Installing in different directories +* Optional Features:: Selecting optional features +* System Type:: Specifying the system type +* Sharing Defaults:: Setting site-wide defaults for @code{configure} +* Environment Variables:: Defining environment variables. +* configure Invocation:: Changing how @code{configure} runs +@end menu + +@include install.texi + + +@c ============================================== Recreating a Configuration + +@node config.status Invocation, Obsolete Constructs, Running configure scripts, Top +@chapter Recreating a Configuration +@cindex @code{config.status} + +The @code{configure} script creates a file named @file{config.status}, +which actually configures, @dfn{instantiates}, the template files. It +also records the configuration options that were specified when the +package was last configured in case reconfiguring is needed. + +Synopsis: +@example +./config.status @var{option}@dots{} [@var{file}@dots{}] +@end example + +It configures the @var{files}, if none are specified, all the templates +are instantiated. The files must be specified without their +dependencies, as in + +@example +./config.status foobar +@end example + +@noindent +not + +@example +./config.status foobar:foo.in:bar.in +@end example + +The supported @var{option}s are: + +@table @option +@item --help +@itemx -h +Print a summary of the command line options, the list of the template +files and exit. + +@item --version +@itemx -V +Print the version number of Autoconf and exit. + +@item --debug +@itemx -d +Don't remove the temporary files. + +@item --file=@var{file}[:@var{template}] +Require that @var{file} be instantiated as if +@samp{AC_CONFIG_FILES(@var{file}:@var{template})} was used. Both +@var{file} and @var{template} may be @samp{-} in which case the standard +output and/or standard input, respectively, is used. If a +@var{template} filename is relative, it is first looked for in the build +tree, and then in the source tree. @xref{Configuration Actions}, for +more details. + +This option and the following ones provide one way for separately +distributed packages to share the values computed by @code{configure}. +Doing so can be useful if some of the packages need a superset of the +features that one of them, perhaps a common library, does. These +options allow a @file{config.status} file to create files other than the +ones that its @file{configure.ac} specifies, so it can be used for a +different package. + +@item --header=@var{file}[:@var{template}] +Same as @option{--file} above, but with @samp{AC_CONFIG_HEADERS}. + +@item --recheck +Ask @file{config.status} to update itself and exit (no instantiation). +This option is useful if you change @code{configure}, so that the +results of some tests might be different from the previous run. The +@option{--recheck} option re-runs @code{configure} with the same arguments +you used before, plus the @option{--no-create} option, which prevents +@code{configure} from running @file{config.status} and creating +@file{Makefile} and other files, and the @option{--no-recursion} option, +which prevents @code{configure} from running other @code{configure} +scripts in subdirectories. (This is so other @file{Makefile} rules can +run @file{config.status} when it changes; @pxref{Automatic Remaking}, +for an example). +@end table + +@file{config.status} checks several optional environment variables that +can alter its behavior: + +@defvar CONFIG_SHELL +@evindex CONFIG_SHELL +The shell with which to run @code{configure} for the @option{--recheck} +option. It must be Bourne-compatible. The default is @file{/bin/sh}. +@end defvar + +@defvar CONFIG_STATUS +@evindex CONFIG_STATUS +The file name to use for the shell script that records the +configuration. The default is @file{./config.status}. This variable is +useful when one package uses parts of another and the @code{configure} +scripts shouldn't be merged because they are maintained separately. +@end defvar + +You can use @file{./config.status} in your Makefiles. For example, in +the dependencies given above (@pxref{Automatic Remaking}), +@file{config.status} is run twice when @file{configure.ac} has changed. +If that bothers you, you can make each run only regenerate the files for +that rule: +@example +@group +config.h: stamp-h +stamp-h: config.h.in config.status + ./config.status config.h + echo > stamp-h + +Makefile: Makefile.in config.status + ./config.status Makefile +@end group +@end example + +The calling convention of @file{config.status} has changed, see +@ref{Obsolete config.status Use}, for details. + + +@c =================================================== Obsolete Constructs + +@node Obsolete Constructs, Questions, config.status Invocation, Top +@chapter Obsolete Constructs + +Autoconf changes, and throughout the years some constructs are obsoleted. +Most of the changes involve the macros, but the tools themselves, or +even some concepts, are now considered obsolete. + +You may completely skip this chapter if you are new to Autoconf, its +intention is mainly to help maintainers updating their packages by +understanding how to move to more modern constructs. + +@menu +* Obsolete config.status Use:: Different calling convention +* acconfig.h:: Additional entries in @file{config.h.in} +* autoupdate Invocation:: Automatic update of @file{configure.ac} +* Obsolete Macros:: Backward compatibility macros +* Autoconf 1:: Tips for upgrading your files +* Autoconf 2.13:: Some fresher tips +@end menu + +@node Obsolete config.status Use, acconfig.h, Obsolete Constructs, Obsolete Constructs +@section Obsolete @file{config.status} Invocation + +@file{config.status} now supports arguments to specify the files to +instantiate, see @ref{config.status Invocation}, for more details. +Before, environment variables had to be used. + +@defvar CONFIG_COMMANDS +@evindex CONFIG_COMMANDS +The tags of the commands to execute. The default is the arguments given +to @code{AC_OUTPUT} and @code{AC_CONFIG_COMMANDS} in +@file{configure.ac}. +@end defvar + +@defvar CONFIG_FILES +@evindex CONFIG_FILES +The files in which to perform @samp{@@@var{variable}@@} substitutions. +The default is the arguments given to @code{AC_OUTPUT} and +@code{AC_CONFIG_FILES} in @file{configure.ac}. +@end defvar + +@defvar CONFIG_HEADERS +@evindex CONFIG_HEADERS +The files in which to substitute C @code{#define} statements. The +default is the arguments given to @code{AC_CONFIG_HEADERS}; if that +macro was not called, @file{config.status} ignores this variable. +@end defvar + +@defvar CONFIG_LINKS +@evindex CONFIG_LINKS +The symbolic links to establish. The default is the arguments given to +@code{AC_CONFIG_LINKS}; if that macro was not called, +@file{config.status} ignores this variable. +@end defvar + +In @ref{config.status Invocation}, using this old interface, the example +would be: + +@example +@group +config.h: stamp-h +stamp-h: config.h.in config.status + CONFIG_COMMANDS= CONFIG_LINKS= CONFIG_FILES= \ + CONFIG_HEADERS=config.h ./config.status + echo > stamp-h + +Makefile: Makefile.in config.status + CONFIG_COMMANDS= CONFIG_LINKS= CONFIG_HEADERS= \ + CONFIG_FILES=Makefile ./config.status +@end group +@end example + +@noindent +(If @file{configure.ac} does not call @code{AC_CONFIG_HEADERS}, there is +no need to set @code{CONFIG_HEADERS} in the @code{make} rules, equally +for @code{CONFIG_COMMANDS} etc.) + + +@node acconfig.h, autoupdate Invocation, Obsolete config.status Use, Obsolete Constructs +@section @file{acconfig.h} + +@cindex @file{acconfig.h} +@cindex @file{config.h.top} +@cindex @file{config.h.bot} + +In order to produce @file{config.h.in}, @command{autoheader} needs to +build or to find templates for each symbol. Modern releases of Autoconf +use @code{AH_VERBATIM} and @code{AH_TEMPLATE} (@pxref{Autoheader +Macros}), but in older releases a file, @file{acconfig.h}, contained the +list of needed templates. @code{autoheader} copies comments and +@code{#define} and @code{#undef} statements from @file{acconfig.h} in +the current directory, if present. This file used to be mandatory if +you @code{AC_DEFINE} any additional symbols. + +Modern releases of Autoconf also provide @code{AH_TOP} and +@code{AH_BOTTOM} if you need to prepend/append some information to +@file{config.h.in}. Ancient versions of Autoconf had a similar feature: +if @file{./acconfig.h} contains the string @samp{@@TOP@@}, +@code{autoheader} copies the lines before the line containing +@samp{@@TOP@@} into the top of the file that it generates. Similarly, +if @file{./acconfig.h} contains the string @samp{@@BOTTOM@@}, +@code{autoheader} copies the lines after that line to the end of the +file it generates. Either or both of those strings may be omitted. An +even older alternate way to produce the same effect in jurasik versions +of Autoconf is to create the files @file{@var{file}.top} (typically +@file{config.h.top}) and/or @file{@var{file}.bot} in the current +directory. If they exist, @code{autoheader} copies them to the +beginning and end, respectively, of its output. + +In former versions of Autoconf, the files used in preparing a software +package for distribution were: +@example +@group +configure.ac --. .------> autoconf* -----> configure + +---+ +[aclocal.m4] --+ `---. +[acsite.m4] ---' | + +--> [autoheader*] -> [config.h.in] +[acconfig.h] ----. | + +-----' +[config.h.top] --+ +[config.h.bot] --' +@end group +@end example + +Use only the @code{AH_} macros, @file{configure.ac} should be +self-contained, and should not depend upon @file{acconfig.h} etc. + + +@node autoupdate Invocation, Obsolete Macros, acconfig.h, Obsolete Constructs +@section Using @code{autoupdate} to Modernize @file{configure.ac} +@cindex @code{autoupdate} + +The @code{autoupdate} program updates a @file{configure.ac} file that +calls Autoconf macros by their old names to use the current macro names. +In version 2 of Autoconf, most of the macros were renamed to use a more +uniform and descriptive naming scheme. @xref{Macro Names}, for a +description of the new scheme. Although the old names still work +(@pxref{Obsolete Macros}, for a list of the old macros and the corresponding +new names), you can make your @file{configure.ac} files more readable +and make it easier to use the current Autoconf documentation if you +update them to use the new macro names. + +@evindex SIMPLE_BACKUP_SUFFIX +If given no arguments, @code{autoupdate} updates @file{configure.ac}, +backing up the original version with the suffix @file{~} (or the value +of the environment variable @code{SIMPLE_BACKUP_SUFFIX}, if that is +set). If you give @code{autoupdate} an argument, it reads that file +instead of @file{configure.ac} and writes the updated file to the +standard output. + +@noindent +@code{autoupdate} accepts the following options: + +@table @option +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@item --version +@itemx -V +Print the version number of Autoconf and exit. + +@item --verbose +@itemx -v +Report processing steps. + +@item --debug +@itemx -d +Don't remove the temporary files. + +@item --autoconf-dir=@var{dir} +@itemx -A @var{dir} +@evindex AC_MACRODIR +Override the location where the installed Autoconf data files are looked +for. You can also set the @code{AC_MACRODIR} environment variable to a +directory; this option overrides the environment variable. + +This option is rarely needed and dangerous; it is only used when one +plays with different versions of Autoconf simultaneously. + +@item --localdir=@var{dir} +@itemx -l @var{dir} +Look for the package file @file{aclocal.m4} in directory @var{dir} +instead of in the current directory. +@end table + +@node Obsolete Macros, Autoconf 1, autoupdate Invocation, Obsolete Constructs +@section Obsolete Macros + +Several macros are obsoleted in Autoconf, for various reasons (typically +they failed to quote properly, couldn't be extended for more recent +issues etc.). They are still supported, but deprecated: their use +should be avoided. + +During the jump from Autoconf version 1 to version 2, most of the +macros were renamed to use a more uniform and descriptive naming scheme, +but their signature did not change. @xref{Macro Names}, for a +description of the new naming scheme. Below, there is just the mapping +from old names to new names for these macros, the reader is invited to +refer to the definition of the new macro for the signature and the +description. + +@defmac AC_ALLOCA +@maindex ALLOCA +@code{AC_FUNC_ALLOCA} +@end defmac + +@defmac AC_ARG_ARRAY +@maindex ARG_ARRAY +removed because of limited usefulness +@end defmac + +@defmac AC_C_CROSS +@maindex C_CROSS +This macro is obsolete; it does nothing. +@end defmac + +@defmac AC_CANONICAL_SYSTEM +@maindex CANONICAL_SYSTEM +Determine the system type and set output variables to the names of the +canonical system types. @xref{Canonicalizing}, for details about the +variables this macro sets. + +The user is encouraged to use either @code{AC_CANONICAL_BUILD}, or +@code{AC_CANONICAL_HOST}, or @code{AC_CANONICAL_TARGET}, depending on +the needs. Using @code{AC_CANONICAL_TARGET} is enough to run the two +other macros. +@end defmac + +@defmac AC_CHAR_UNSIGNED +@maindex CHAR_UNSIGNED +@code{AC_C_CHAR_UNSIGNED} +@end defmac + +@defmac AC_CHECK_TYPE (@var{type}, @var{default}) +@maindex CHECK_TYPE +Autoconf, up to 2.13, used to provide this version of +@code{AC_CHECK_TYPE}, deprecated because of its flaws. Firstly, although +it is a member of the @code{CHECK} clan, singular sub-family, it does +more than just checking. Second, missing types are not +@code{typedef}'d, they are @code{#define}'d, which can lead to +incompatible code in the case of pointer types. + +This use of @code{AC_CHECK_TYPE} is obsolete and discouraged, see +@ref{Generic Types}, for the description of the current macro. + +If the type @var{type} is not defined, define it to be the C (or C++) +builtin type @var{default}; e.g., @samp{short} or @samp{unsigned}. + +This macro is equivalent to: + +@example +AC_CHECK_TYPE([@var{type}], + [AC_DEFINE([@var{type}], [@var{default}], + [Define to `@var{default}' if <sys/types.h> + does not define.])]) +@end example + +In order to keep backward compatibility, the two versions of +@code{AC_CHECK_TYPE} are implemented, selected by a simple heuristics: + +@enumerate +@item +If there are three or four arguments, the modern version is used. + +@item +If the second argument appears to be a C or C++ type, then the +obsolete version is used. This happens if the argument is a C or C++ +@emph{builtin} type or a C identifier ending in @samp{_t}, optionally +followed by one of @samp{[(* } and then by a string of zero or more +characters taken from the set @samp{[]()* _a-zA-Z0-9}. + +@item +If the second argument is spelled with the alphabet of valid C and C++ +types, the user is warned and the modern version is used. + +@item +Otherwise, the modern version is used. +@end enumerate + +@noindent +You are encouraged either to use a valid builtin type, or to use the +equivalent modern code (see above), or better yet, to use +@code{AC_CHECK_TYPES} together with + +@example +#if !HAVE_LOFF_T +typedef loff_t off_t; +#endif +@end example +@end defmac +@c end of AC_CHECK_TYPE + +@defmac AC_CHECKING (@var{feature-description}) +@maindex CHECKING +Same as @samp{AC_MSG_NOTICE([checking @var{feature-description}@dots{}]}. +@end defmac + +@defmac AC_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found}, @ovar{action-if-not-found}) +@maindex COMPILE_CHECK +This is an obsolete version of @code{AC_TRY_LINK} (@pxref{Examining +Libraries}), with the addition that it prints @samp{checking for +@var{echo-text}} to the standard output first, if @var{echo-text} is +non-empty. Use @code{AC_MSG_CHECKING} and @code{AC_MSG_RESULT} instead +to print messages (@pxref{Printing Messages}). +@end defmac + +@defmac AC_CONST +@maindex CONST +@code{AC_C_CONST} +@end defmac + +@defmac AC_CROSS_CHECK +@maindex CROSS_CHECK +Same as @code{AC_C_CROSS}, which is obsolete too, and does nothing +@code{:-)}. +@end defmac + +@defmac AC_CYGWIN +@maindex CYGWIN +Check for the Cygwin environment in which case the shell variable +@code{CYGWIN} is set to @samp{yes}. Don't use this macro, the dignified +means to check the nature of the host is using +@code{AC_CANONICAL_HOST}. As a matter of fact this macro is defined as: + +@example +AC_REQUIRE([AC_CANONICAL_HOST])[]dnl +case $host_os in + *cygwin* ) CYGWIN=yes;; + * ) CYGWIN=no;; +esac +@end example + +Beware that the variable @code{CYGWIN} has a very special meaning when +running CygWin32, and should not be changed. That's yet another reason +not to use this macro. +@end defmac + +@defmac AC_DECL_YYTEXT +@maindex DECL_YYTEXT +Does nothing, now integrated in @code{AC_PROG_LEX}. +@end defmac + +@defmac AC_DIR_HEADER +@maindex DIR_HEADER +@cvindex DIRENT +@cvindex SYSNDIR +@cvindex SYSDIR +@cvindex NDIR +Like calling @code{AC_FUNC_CLOSEDIR_VOID} and@code{AC_HEADER_DIRENT}, +but defines a different set of C preprocessor macros to indicate which +header file is found: + +@multitable {@file{sys/ndir.h}} {Old Symbol} {@code{HAVE_SYS_NDIR_H}} +@item Header @tab Old Symbol @tab New Symbol +@item @file{dirent.h} @tab @code{DIRENT} @tab @code{HAVE_DIRENT_H} +@item @file{sys/ndir.h} @tab @code{SYSNDIR} @tab @code{HAVE_SYS_NDIR_H} +@item @file{sys/dir.h} @tab @code{SYSDIR} @tab @code{HAVE_SYS_DIR_H} +@item @file{ndir.h} @tab @code{NDIR} @tab @code{HAVE_NDIR_H} +@end multitable +@end defmac + +@defmac AC_DYNIX_SEQ +@maindex DYNIX_SEQ +If on Dynix/PTX (Sequent @sc{unix}), add @option{-lseq} to output variable +@code{LIBS}. This macro used to be defined as + +@example +AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS") +@end example + +@noindent +now it is just @code{AC_FUNC_GETMNTENT}. +@end defmac + +@defmac AC_EXEEXT +@maindex EXEEXT +@ovindex EXEEXT +Defined the output variable @code{EXEEXT} based on the output of the +compiler, which is now done automatically. Typically set to empty +string if Unix and @samp{.exe} if Win32 or OS/2. +@end defmac + +@defmac AC_EMXOS2 +@maindex EMXOS2 +Similar to @code{AC_CYGWIN} but checks for the EMX environment on OS/2 +and sets @code{EMXOS2}. +@end defmac + +@defmac AC_ERROR +@maindex ERROR +@code{AC_MSG_ERROR} +@end defmac + +@defmac AC_FIND_X +@maindex FIND_X +@code{AC_PATH_X} +@end defmac + +@defmac AC_FIND_XTRA +@maindex FIND_XTRA +@code{AC_PATH_XTRA} +@end defmac + +@defmac AC_FUNC_CHECK +@maindex FUNC_CHECK +@code{AC_CHECK_FUNC} +@end defmac + +@defmac AC_FUNC_WAIT3 +@maindex FUNC_WAIT3 +@cvindex HAVE_WAIT3 +If @code{wait3} is found and fills in the contents of its third argument +(a @samp{struct rusage *}), which HP-UX does not do, define +@code{HAVE_WAIT3}. + +These days portable programs should use @code{waitpid}, not +@code{wait3}, as @code{wait3} is being removed from the Open Group +standards, and will not appear in the next revision of POSIX. +@end defmac + +@defmac AC_GCC_TRADITIONAL +@maindex GCC_TRADITIONAL +@code{AC_PROG_GCC_TRADITIONAL} +@end defmac + +@defmac AC_GETGROUPS_T +@maindex GETGROUPS_T +@code{AC_TYPE_GETGROUPS} +@end defmac + +@defmac AC_GETLOADAVG +@maindex GETLOADAVG +@code{AC_FUNC_GETLOADAVG} +@end defmac + +@defmac AC_HAVE_FUNCS +@maindex HAVE_FUNCS +@code{AC_CHECK_FUNCS} +@end defmac + +@defmac AC_HAVE_HEADERS +@maindex HAVE_HEADERS +@code{AC_CHECK_HEADERS} +@end defmac + +@defmac AC_HAVE_LIBRARY (@var{library}, @ovar{action-if-found}, @ovar{action-if-not-found}, @ovar{other-libraries}) +@maindex HAVE_LIBRARY +This macro is equivalent to calling @code{AC_CHECK_LIB} with a +@var{function} argument of @code{main}. In addition, @var{library} can +be written as any of @samp{foo}, @option{-lfoo}, or @samp{libfoo.a}. In +all of those cases, the compiler is passed @option{-lfoo}. However, +@var{library} cannot be a shell variable; it must be a literal name. +@end defmac + +@defmac AC_HAVE_POUNDBANG +@maindex HAVE_POUNDBANG +@code{AC_SYS_INTERPRETER} (different calling convention) +@end defmac + +@defmac AC_HEADER_CHECK +@maindex HEADER_CHECK +@code{AC_CHECK_HEADER} +@end defmac + +@defmac AC_HEADER_EGREP +@maindex HEADER_EGREP +@code{AC_EGREP_HEADER} +@end defmac + +@defmac AC_INIT (@var{unique-file-in-source-dir}) +@maindex INIT +Formerly @code{AC_INIT} used to have a single argument, and was +equivalent to: + +@example +AC_INIT +AC_CONFIG_SRCDIR(@var{unique-file-in-source-dir}) +@end example +@end defmac + +@defmac AC_INLINE +@maindex INLINE +@code{AC_C_INLINE} +@end defmac + +@defmac AC_INT_16_BITS +@maindex INT_16_BITS +@cvindex INT_16_BITS +If the C type @code{int} is 16 bits wide, define @code{INT_16_BITS}. +Use @samp{AC_CHECK_SIZEOF(int)} instead. +@end defmac + +@defmac AC_IRIX_SUN +@maindex IRIX_SUN +If on IRIX (Silicon Graphics @sc{unix}), add @option{-lsun} to output +@code{LIBS}. If you were using it to get @code{getmntent}, use +@code{AC_FUNC_GETMNTENT} instead. If you used it for the NIS versions +of the password and group functions, use @samp{AC_CHECK_LIB(sun, +getpwnam)}. Up to Autoconf 2.13, it used to be + +@example +AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS") +@end example + +@noindent +now it is defined as + +@example +AC_FUNC_GETMNTENT +AC_CHECK_LIB(sun, getpwnam) +@end example +@end defmac + +@defmac AC_LANG_C +@maindex LANG_C +Same as @samp{AC_LANG(C)}. +@end defmac + +@defmac AC_LANG_CPLUSPLUS +@maindex LANG_CPLUSPLUS +Same as @samp{AC_LANG(C++)}. +@end defmac + +@defmac AC_LANG_FORTRAN77 +@maindex LANG_FORTRAN77 +Same as @samp{AC_LANG(Fortran 77)}. +@end defmac + +@defmac AC_LANG_RESTORE +@maindex LANG_RESTORE +Select the @var{language} that is saved on the top of the stack, as set +by @code{AC_LANG_SAVE}, remove it from the stack, and call +@code{AC_LANG(@var{language})}. +@end defmac + +@defmac AC_LANG_SAVE +@maindex LANG_SAVE +Remember the current language (as set by @code{AC_LANG}) on a stack. +The current language does not change. @code{AC_LANG_PUSH} is preferred. +@end defmac + +@defmac AC_LINK_FILES (@var{source}@dots{}, @var{dest}@dots{}) +@maindex LINK_FILES +This is an obsolete version of @code{AC_CONFIG_LINKS}. An updated +version of: + +@example +AC_LINK_FILES(config/$machine.h config/$obj_format.h, + host.h object.h) +@end example + +@noindent +is: + +@example +AC_CONFIG_LINKS(host.h:config/$machine.h + object.h:config/$obj_format.h) +@end example +@end defmac + +@defmac AC_LN_S +@maindex LN_S +@code{AC_PROG_LN_S} +@end defmac + +@defmac AC_LONG_64_BITS +@maindex LONG_64_BITS +@cvindex LONG_64_BITS +Define @code{LONG_64_BITS} if the C type @code{long int} is 64 bits wide. +Use the generic macro @samp{AC_CHECK_SIZEOF([long int])} instead. +@end defmac + +@defmac AC_LONG_DOUBLE +@maindex LONG_DOUBLE +@code{AC_C_LONG_DOUBLE} +@end defmac + +@defmac AC_LONG_FILE_NAMES +@maindex LONG_FILE_NAMES +@code{AC_SYS_LONG_FILE_NAMES} +@end defmac + +@defmac AC_MAJOR_HEADER +@maindex MAJOR_HEADER +@code{AC_HEADER_MAJOR} +@end defmac + +@defmac AC_MEMORY_H +@maindex MEMORY_H +@cvindex NEED_MEMORY_H +Used to define @code{NEED_MEMORY_H} if the @code{mem} functions were +defined in @file{memory.h}. Today it is equivalent to +@samp{AC_CHECK_HEADERS(memory.h)}. Adjust your code to depend upon +@code{HAVE_MEMORY_H}, not @code{NEED_MEMORY_H}, see @xref{Standard +Symbols}. +@end defmac + +@defmac AC_MINGW32 +@maindex MINGW32 +Similar to @code{AC_CYGWIN} but checks for the MingW32 compiler +environment and sets @code{MINGW32}. +@end defmac + +@defmac AC_MINUS_C_MINUS_O +@maindex MINUS_C_MINUS_O +@code{AC_PROG_CC_C_O} +@end defmac + +@defmac AC_MMAP +@maindex MMAP +@code{AC_FUNC_MMAP} +@end defmac + +@defmac AC_MODE_T +@maindex MODE_T +@code{AC_TYPE_MODE_T} +@end defmac + +@defmac AC_OBJEXT +@maindex OBJEXT +@ovindex OBJEXT +Defined the output variable @code{OBJEXT} based on the output of the +compiler, after .c files have been excluded. Typically set to @samp{o} +if Unix, @samp{obj} if Win32. Now the compiler checking macros handle +this automatically. +@end defmac + +@defmac AC_OBSOLETE (@var{this-macro-name}, @ovar{suggestion}) +@maindex OBSOLETE +Make @code{m4} print a message to the standard error output warning that +@var{this-macro-name} is obsolete, and giving the file and line number +where it was called. @var{this-macro-name} should be the name of the +macro that is calling @code{AC_OBSOLETE}. If @var{suggestion} is given, +it is printed at the end of the warning message; for example, it can be +a suggestion for what to use instead of @var{this-macro-name}. + +For instance + +@example +AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl +@end example + +You are encouraged to use @code{AU_DEFUN} instead, since it gives better +services to the user. +@end defmac + +@defmac AC_OFF_T +@maindex OFF_T +@code{AC_TYPE_OFF_T} +@end defmac + +@defmac AC_OUTPUT (@ovar{file}@dots{}, @ovar{extra-cmds}, @ovar{init-cmds}, @ovar{save-defs}) +@maindex OUTPUT +The use of @code{AC_OUTPUT} with argument is deprecated, this obsoleted +interface is equivalent to: + +@example +@group +AC_CONFIG_FILES(@var{file}@dots{}) +AC_CONFIG_COMMANDS([default], + @var{extra-cmds}, @var{init-cmds}) +AC_SETUP_DEFS(@var{save-defs}) +AC_OUTPUT +@end group +@end example + +If you specify @var{save-defs}, autoconf will save the @samp{#define}s in a +different form, for use in the files specified in @code{AC_CONFIG_HEADERS}. +In this case, autoconf substitutes the C-style @samp{#define}s where it finds +@samp{@@DEFS@@}. +This runs faster, and is simpler to maintain +than building a file of @samp{#undef}s, +since autoconf will automatically generate a @samp{#define} for each +@code{AC_DEFINE} that you execute in the @code{configure} script. +The value for @var{save-defs} should be +either @code{cat}, or @code{sort}; +this value is used to filter the list of @samp{#define}s before editing. +Sorted lists are easier to read, +but you may wish to see the definitions in the order that they were +processed. +@end defmac + +@defmac AC_OUTPUT_COMMANDS (@var{extra-cmds}, @ovar{init-cmds}) +@maindex OUTPUT_COMMANDS +Specify additional shell commands to run at the end of +@file{config.status}, and shell commands to initialize any variables +from @code{configure}. This macro may be called multiple times. It is +obsolete, replaced by @code{AC_CONFIG_COMMANDS}. + +Here is an unrealistic example: + +@example +fubar=27 +AC_OUTPUT_COMMANDS([echo this is extra $fubar, and so on.], + fubar=$fubar) +AC_OUTPUT_COMMANDS([echo this is another, extra, bit], + [echo init bit]) +@end example + +Aside from the fact that @code{AC_CONFIG_COMMANDS} requires an +additional key, an important difference is that +@code{AC_OUTPUT_COMMANDS} is quoting its arguments twice, while +@code{AC_CONFIG_COMMANDS}. This means that @code{AC_CONFIG_COMMANDS} +can safely be given macro calls as arguments: + +@example +AC_CONFIG_COMMANDS(foo, [my_FOO()]) +@end example + +@noindent +conversely, where one level of quoting was enough for literal strings +with @code{AC_OUTPUT_COMMANDS}, you need two with +@code{AC_CONFIG_COMMANDS}. The following lines are equivalent: + +@example +@group +AC_OUTPUT_COMMANDS([echo "Square brackets: []"]) +AC_CONFIG_COMMANDS(default, [[echo "Square brackets: []"]]) +@end group +@end example +@end defmac + +@defmac AC_PID_T +@maindex PID_T +@code{AC_TYPE_PID_T} +@end defmac + +@defmac AC_PREFIX +@maindex PREFIX +@code{AC_PREFIX_PROGRAM} +@end defmac + +@defmac AC_PROGRAMS_CHECK +@maindex PROGRAMS_CHECK +@code{AC_CHECK_PROGS} +@end defmac + +@defmac AC_PROGRAMS_PATH +@maindex PROGRAMS_PATH +@code{AC_PATH_PROGS} +@end defmac + +@defmac AC_PROGRAM_CHECK +@maindex PROGRAM_CHECK +@code{AC_CHECK_PROG} +@end defmac + +@defmac AC_PROGRAM_EGREP +@maindex PROGRAM_EGREP +@code{AC_EGREP_CPP} +@end defmac + +@defmac AC_PROGRAM_PATH +@maindex PROGRAM_PATH +@code{AC_PATH_PROG} +@end defmac + +@defmac AC_REMOTE_TAPE +@maindex REMOTE_TAPE +removed because of limited usefulness +@end defmac + +@defmac AC_RESTARTABLE_SYSCALLS +@maindex RESTARTABLE_SYSCALLS +@code{AC_SYS_RESTARTABLE_SYSCALLS} +@end defmac + +@defmac AC_RETSIGTYPE +@maindex RETSIGTYPE +@code{AC_TYPE_SIGNAL} +@end defmac + +@defmac AC_RSH +@maindex RSH +Removed because of limited usefulness. +@end defmac + +@defmac AC_SCO_INTL +@maindex SCO_INTL +@ovindex LIBS +If on SCO UNIX, add @option{-lintl} to output variable @code{LIBS}. This +macro used to + +@example +AC_CHECK_LIB(intl, strftime, LIBS="-lintl $LIBS") +@end example + +@noindent +now it just calls @code{AC_FUNC_STRFTIME} instead. +@end defmac + +@defmac AC_SETVBUF_REVERSED +@maindex SETVBUF_REVERSED +@code{AC_FUNC_SETVBUF_REVERSED} +@end defmac + +@defmac AC_SET_MAKE +@maindex SET_MAKE +@code{AC_PROG_MAKE_SET} +@end defmac + +@defmac AC_SIZEOF_TYPE +@maindex SIZEOF_TYPE +@code{AC_CHECK_SIZEOF} +@end defmac + +@defmac AC_SIZE_T +@maindex SIZE_T +@code{AC_TYPE_SIZE_T} +@end defmac + +@defmac AC_STAT_MACROS_BROKEN +@maindex STAT_MACROS_BROKEN +@code{AC_HEADER_STAT} +@end defmac + +@defmac AC_STDC_HEADERS +@maindex STDC_HEADERS +@code{AC_HEADER_STDC} +@end defmac + +@defmac AC_STRCOLL +@maindex STRCOLL +@code{AC_FUNC_STRCOLL} +@end defmac + +@defmac AC_ST_BLKSIZE +@maindex ST_BLKSIZE +@code{AC_STRUCT_ST_BLKSIZE} +@end defmac + +@defmac AC_ST_BLOCKS +@maindex ST_BLOCKS +@code{AC_STRUCT_ST_BLOCKS} +@end defmac + +@defmac AC_ST_RDEV +@maindex ST_RDEV +@code{AC_STRUCT_ST_RDEV} +@end defmac + +@defmac AC_SYS_RESTARTABLE_SYSCALLS +@maindex SYS_RESTARTABLE_SYSCALLS +@cvindex HAVE_RESTARTABLE_SYSCALLS +If the system automatically restarts a system call that is interrupted +by a signal, define @code{HAVE_RESTARTABLE_SYSCALLS}. This macro does +not check if system calls are restarted in general--it tests whether a +signal handler installed with @code{signal} (but not @code{sigaction}) +causes system calls to be restarted. It does not test if system calls +can be restarted when interrupted by signals that have no handler. + +These days portable programs should use @code{sigaction} with +@code{SA_RESTART} if they want restartable system calls. They should +not rely on @code{HAVE_RESTARTABLE_SYSCALLS}, since nowadays whether a +system call is restartable is a dynamic issue, not a configuration-time +issue. +@end defmac + +@defmac AC_SYS_SIGLIST_DECLARED +@maindex SYS_SIGLIST_DECLARED +@code{AC_DECL_SYS_SIGLIST} +@end defmac + +@defmac AC_TEST_CPP +@maindex TEST_CPP +@code{AC_TRY_CPP} +@end defmac + +@defmac AC_TEST_PROGRAM +@maindex TEST_PROGRAM +@code{AC_TRY_RUN} +@end defmac + +@defmac AC_TIMEZONE +@maindex TIMEZONE +@code{AC_STRUCT_TIMEZONE} +@end defmac + +@defmac AC_TIME_WITH_SYS_TIME +@maindex TIME_WITH_SYS_TIME +@code{AC_HEADER_TIME} +@end defmac + +@defmac AC_UID_T +@maindex UID_T +@code{AC_TYPE_UID_T} +@end defmac + +@defmac AC_UNISTD_H +@maindex UNISTD_H +Same as @samp{AC_CHECK_HEADERS(unistd.h)}. +@end defmac + +@defmac AC_USG +@maindex USG +@cvindex USG +Define @code{USG} if the @sc{bsd} string functions are defined in +@file{strings.h}. You should no longer depend upon @code{USG}, but on +@code{HAVE_STRING_H}, see @xref{Standard Symbols}. +@end defmac + +@defmac AC_UTIME_NULL +@maindex UTIME_NULL +@code{AC_FUNC_UTIME_NULL} +@end defmac + +@defmac AC_VALIDATE_CACHED_SYSTEM_TUPLE (@ovar{cmd}) +@maindex VALIDATE_CACHED_SYSTEM_TUPLE +If the cache file is inconsistent with the current host, target and +build system types, it used to execute @var{cmd} or print a default +error message. + +This is now handled by default. +@end defmac + +@defmac AC_VERBOSE (@var{result-description}) +@maindex VERBOSE +@code{AC_MSG_RESULT}. +@end defmac + +@defmac AC_VFORK +@maindex VFORK +@code{AC_FUNC_VFORK} +@end defmac + +@defmac AC_VPRINTF +@maindex VPRINTF +@code{AC_FUNC_VPRINTF} +@end defmac + +@defmac AC_WAIT3 +@maindex WAIT3 +@code{AC_FUNC_WAIT3} +@end defmac + +@defmac AC_WARN +@maindex WARN +@code{AC_MSG_WARN} +@end defmac + +@defmac AC_WORDS_BIGENDIAN +@maindex WORDS_BIGENDIAN +@code{AC_C_BIGENDIAN} +@end defmac + +@defmac AC_XENIX_DIR +@maindex XENIX_DIR +@ovindex LIBS +This macro used to add @option{-lx} to output variable @code{LIBS} if on +Xenix. Also, if @file{dirent.h} is being checked for, added +@option{-ldir} to @code{LIBS}. Now it is merely an alias of +@code{AC_HEADER_DIRENT} instead, plus some code to detect whether +running @sc{xenix} on which you should not depend: + +@example +AC_MSG_CHECKING([for Xenix]) +AC_EGREP_CPP(yes, +[#if defined M_XENIX && !defined M_UNIX + yes +#endif], + [AC_MSG_RESULT([yes]); XENIX=yes], + [AC_MSG_RESULT([no]); XENIX=]) +@end example +@end defmac + +@defmac AC_YYTEXT_POINTER +@maindex YYTEXT_POINTER +@code{AC_DECL_YYTEXT} +@end defmac + +@node Autoconf 1, Autoconf 2.13, Obsolete Macros, Obsolete Constructs +@section Upgrading From Version 1 + +Autoconf version 2 is mostly backward compatible with version 1. +However, it introduces better ways to do some things, and doesn't +support some of the ugly things in version 1. So, depending on how +sophisticated your @file{configure.ac} files are, you might have to do +some manual work in order to upgrade to version 2. This chapter points +out some problems to watch for when upgrading. Also, perhaps your +@code{configure} scripts could benefit from some of the new features in +version 2; the changes are summarized in the file @file{NEWS} in the +Autoconf distribution. + +@menu +* Changed File Names:: Files you might rename +* Changed Makefiles:: New things to put in @file{Makefile.in} +* Changed Macros:: Macro calls you might replace +* Changed Results:: Changes in how to check test results +* Changed Macro Writing:: Better ways to write your own macros +@end menu + +@node Changed File Names, Changed Makefiles, Autoconf 1, Autoconf 1 +@subsection Changed File Names + +If you have an @file{aclocal.m4} installed with Autoconf (as opposed to +in a particular package's source directory), you must rename it to +@file{acsite.m4}. @xref{autoconf Invocation}. + +If you distribute @file{install.sh} with your package, rename it to +@file{install-sh} so @code{make} builtin rules won't inadvertently +create a file called @file{install} from it. @code{AC_PROG_INSTALL} +looks for the script under both names, but it is best to use the new name. + +If you were using @file{config.h.top}, @file{config.h.bot}, or +@file{acconfig.h}, you still can, but you will have less clutter if you +use the @code{AH_} macros. @xref{Autoheader Macros}. + +@node Changed Makefiles, Changed Macros, Changed File Names, Autoconf 1 +@subsection Changed Makefiles + +Add @samp{@@CFLAGS@@}, @samp{@@CPPFLAGS@@}, and @samp{@@LDFLAGS@@} in +your @file{Makefile.in} files, so they can take advantage of the values +of those variables in the environment when @code{configure} is run. +Doing this isn't necessary, but it's a convenience for users. + +Also add @samp{@@configure_input@@} in a comment to each input file for +@code{AC_OUTPUT}, so that the output files will contain a comment saying +they were produced by @code{configure}. Automatically selecting the +right comment syntax for all the kinds of files that people call +@code{AC_OUTPUT} on became too much work. + +Add @file{config.log} and @file{config.cache} to the list of files you +remove in @code{distclean} targets. + +If you have the following in @file{Makefile.in}: + +@example +prefix = /usr/local +exec_prefix = $(prefix) +@end example + +@noindent +you must change it to: + +@example +prefix = @@prefix@@ +exec_prefix = @@exec_prefix@@ +@end example + +@noindent +The old behavior of replacing those variables without @samp{@@} +characters around them has been removed. + +@node Changed Macros, Changed Results, Changed Makefiles, Autoconf 1 +@subsection Changed Macros + +Many of the macros were renamed in Autoconf version 2. You can still +use the old names, but the new ones are clearer, and it's easier to find +the documentation for them. @xref{Obsolete Macros}, for a table showing the +new names for the old macros. Use the @code{autoupdate} program to +convert your @file{configure.ac} to using the new macro names. +@xref{autoupdate Invocation}. + +Some macros have been superseded by similar ones that do the job better, +but are not call-compatible. If you get warnings about calling obsolete +macros while running @code{autoconf}, you may safely ignore them, but +your @code{configure} script will generally work better if you follow +the advice it prints about what to replace the obsolete macros with. In +particular, the mechanism for reporting the results of tests has +changed. If you were using @code{echo} or @code{AC_VERBOSE} (perhaps +via @code{AC_COMPILE_CHECK}), your @code{configure} script's output will +look better if you switch to @code{AC_MSG_CHECKING} and +@code{AC_MSG_RESULT}. @xref{Printing Messages}. Those macros work best +in conjunction with cache variables. @xref{Caching Results}. + + + +@node Changed Results, Changed Macro Writing, Changed Macros, Autoconf 1 +@subsection Changed Results + +If you were checking the results of previous tests by examining the +shell variable @code{DEFS}, you need to switch to checking the values of +the cache variables for those tests. @code{DEFS} no longer exists while +@code{configure} is running; it is only created when generating output +files. This difference from version 1 is because properly quoting the +contents of that variable turned out to be too cumbersome and +inefficient to do every time @code{AC_DEFINE} is called. @xref{Cache +Variable Names}. + +For example, here is a @file{configure.ac} fragment written for Autoconf +version 1: + +@example +AC_HAVE_FUNCS(syslog) +case "$DEFS" in +*-DHAVE_SYSLOG*) ;; +*) # syslog is not in the default libraries. See if it's in some other. + saved_LIBS="$LIBS" + for lib in bsd socket inet; do + AC_CHECKING(for syslog in -l$lib) + LIBS="$saved_LIBS -l$lib" + AC_HAVE_FUNCS(syslog) + case "$DEFS" in + *-DHAVE_SYSLOG*) break ;; + *) ;; + esac + LIBS="$saved_LIBS" + done ;; +esac +@end example + +Here is a way to write it for version 2: + +@example +AC_CHECK_FUNCS(syslog) +if test $ac_cv_func_syslog = no; then + # syslog is not in the default libraries. See if it's in some other. + for lib in bsd socket inet; do + AC_CHECK_LIB($lib, syslog, [AC_DEFINE(HAVE_SYSLOG) + LIBS="$LIBS -l$lib"; break]) + done +fi +@end example + +If you were working around bugs in @code{AC_DEFINE_UNQUOTED} by adding +backslashes before quotes, you need to remove them. It now works +predictably, and does not treat quotes (except back quotes) specially. +@xref{Setting Output Variables}. + +All of the boolean shell variables set by Autoconf macros now use +@samp{yes} for the true value. Most of them use @samp{no} for false, +though for backward compatibility some use the empty string instead. If +you were relying on a shell variable being set to something like 1 or +@samp{t} for true, you need to change your tests. + +@node Changed Macro Writing, , Changed Results, Autoconf 1 +@subsection Changed Macro Writing + +When defining your own macros, you should now use @code{AC_DEFUN} +instead of @code{define}. @code{AC_DEFUN} automatically calls +@code{AC_PROVIDE} and ensures that macros called via @code{AC_REQUIRE} +do not interrupt other macros, to prevent nested @samp{checking@dots{}} +messages on the screen. There's no actual harm in continuing to use the +older way, but it's less convenient and attractive. @xref{Macro +Definitions}. + +You probably looked at the macros that came with Autoconf as a guide for +how to do things. It would be a good idea to take a look at the new +versions of them, as the style is somewhat improved and they take +advantage of some new features. + +If you were doing tricky things with undocumented Autoconf internals +(macros, variables, diversions), check whether you need to change +anything to account for changes that have been made. Perhaps you can +even use an officially supported technique in version 2 instead of +kludging. Or perhaps not. + +To speed up your locally written feature tests, add caching to them. +See whether any of your tests are of general enough usefulness to +encapsulate into macros that you can share. + + +@node Autoconf 2.13, , Autoconf 1, Obsolete Constructs +@section Upgrading From Version 2.13 + +The introduction of the previous section (@pxref{Autoconf 1}) perfectly +suits this section... + +@quotation +Autoconf version 2.50 is mostly backward compatible with version 2.13. +However, it introduces better ways to do some things, and doesn't +support some of the ugly things in version 2.13. So, depending on how +sophisticated your @file{configure.ac} files are, you might have to do +some manual work in order to upgrade to version 2.50. This chapter +points out some problems to watch for when upgrading. Also, perhaps +your @code{configure} scripts could benefit from some of the new +features in version 2.50; the changes are summarized in the file +@file{NEWS} in the Autoconf distribution. +@end quotation + +@menu +* Changed Quotation:: Broken code which used to work +* New Macros:: Interaction with foreign macros +@end menu + +@node Changed Quotation, New Macros, Autoconf 2.13, Autoconf 2.13 +@subsection Changed Quotation + +The most important changes are invisible to you: the implementation of +most macros have completely changed. This allowed more factorization of +the code, better error messages, a higher uniformity of the user's +interface etc. Unfortunately, as a side effect, some construct which +used to (miraculously) work might break starting with Autoconf 2.50. +The most common culprit is bad quotation. + +For instance, in the following example, the message is not properly +quoted: + +@example +AC_INIT +AC_CHECK_HEADERS(foo.h,, +AC_MSG_ERROR(cannot find foo.h, bailing out)) +AC_OUTPUT +@end example + +@noindent +Autoconf 2.13 simply ignores it: + +@example +$ autoconf-2.13; ./configure --silent +creating cache ./config.cache +configure: error: cannot find foo.h +$ +@end example + +@noindent +while Autoconf 2.50 will produce a broken @file{configure}: + +@example +$ autoconf-2.50; ./configure --silent +configure: error: cannot find foo.h +./configure: exit: bad non-numeric arg `bailing' +./configure: exit: bad non-numeric arg `bailing' +$ +@end example + +The message needs to be quoted, and the @code{AC_MSG_ERROR} invocation +too! + +@example +AC_INIT +AC_CHECK_HEADERS(foo.h,, + [AC_MSG_ERROR([cannot find foo.h, bailing out])]) +AC_OUTPUT +@end example + +Many many (and many more) Autoconf macros were lacking proper quotation, +including no less than... @code{AC_DEFUN} itself! + +@example +$ cat configure.in +AC_DEFUN([AC_PROG_INSTALL], +[# My own much better version +]) +AC_INIT +AC_PROG_INSTALL +AC_OUTPUT +$ autoconf-2.13 +autoconf: Undefined macros: +***BUG in Autoconf--please report*** AC_FD_MSG +***BUG in Autoconf--please report*** AC_EPI +configure.in:1:AC_DEFUN([AC_PROG_INSTALL], +configure.in:5:AC_PROG_INSTALL +$ autoconf-2.50 +$ +@end example + + +@node New Macros, , Changed Quotation, Autoconf 2.13 +@subsection New Macros + +@cindex @code{undefined macro: _m4_divert_diversion} + +Because Autoconf has been dormant for years, Automake provided +Autoconf-like macros for a while. Autoconf 2.50 now provides better +versions of these macros, integrated in the @code{AC_} namespace, +instead of @code{AM_}. But in order to ease the upgrading via +@command{autoupdate}, bindings to such @code{AM_} macros are provided. + +Unfortunately Automake did not quote the name of these macros! +Therefore, when @command{m4} find in @file{aclocal.m4} something like +@samp{AC_DEFUN(AM_TYPE_PTRDIFF_T, ...)}, @code{AM_TYPE_PTRDIFF_T} is +expanded, replaced with its Autoconf definition. + +Fortunately Autoconf catches pre-@code{AC_INIT} expansions, and will +complain, in its own words: + +@example +$ cat configure.in +AC_INIT +AM_TYPE_PTRDIFF_T +$ aclocal-1.4 +$ autoconf +./aclocal.m4:17: error: m4_defn: undefined macro: _m4_divert_diversion +actypes.m4:289: AM_TYPE_PTRDIFF_T is expanded from... +./aclocal.m4:17: the top level +$ +@end example + +Future versions of Automake will simply no longer define most of these +macros, and will properly quote the names of the remaining macros. +But you don't have to wait for it to happen to do the right thing right +now: do not depend upon macros from Automake as it is simply not its job +to provide macros (but the one it requires by itself): + +@example +$ cat configure.in +AC_INIT +AM_TYPE_PTRDIFF_T +$ rm aclocal.m4 +$ autoupdate +autoupdate: `configure.in' is updated +$ cat configure.in +AC_INIT +AC_CHECK_TYPES([ptrdiff_t]) +$ aclocal-1.4 +$ autoconf +$ +@end example + +@c ================================================ Questions About Autoconf. + +@node Questions, History, Obsolete Constructs, Top +@chapter Questions About Autoconf + +Several questions about Autoconf come up occasionally. Here some of them +are addressed. + +@menu +* Distributing:: Distributing @code{configure} scripts +* Why GNU m4:: Why not use the standard M4? +* Bootstrapping:: Autoconf and GNU M4 require each other? +* Why Not Imake:: Why GNU uses @code{configure} instead of Imake +@end menu + +@node Distributing, Why GNU m4, Questions, Questions +@section Distributing @code{configure} Scripts + +@display +What are the restrictions on distributing @code{configure} +scripts that Autoconf generates? How does that affect my +programs that use them? +@end display + +There are no restrictions on how the configuration scripts that Autoconf +produces may be distributed or used. In Autoconf version 1, they were +covered by the @sc{gnu} General Public License. We still encourage +software authors to distribute their work under terms like those of the +GPL, but doing so is not required to use Autoconf. + +Of the other files that might be used with @code{configure}, +@file{config.h.in} is under whatever copyright you use for your +@file{configure.ac}. @file{config.sub} and @file{config.guess} have an +exception to the GPL when they are used with an Autoconf-generated +@code{configure} script, which permits you to distribute them under the +same terms as the rest of your package. @file{install-sh} is from the X +Consortium and is not copyrighted. + +@node Why GNU m4, Bootstrapping, Distributing, Questions +@section Why Require GNU M4? + +@display +Why does Autoconf require @sc{gnu} M4? +@end display + +Many M4 implementations have hard-coded limitations on the size and +number of macros that Autoconf exceeds. They also lack several +builtin macros that it would be difficult to get along without in a +sophisticated application like Autoconf, including: + +@example +builtin +indir +patsubst +__file__ +__line__ +@end example + +Autoconf requires version 1.4 or above of @sc{gnu} M4 because it uses +frozen state files. + +Since only software maintainers need to use Autoconf, and since @sc{gnu} +M4 is simple to configure and install, it seems reasonable to require +@sc{gnu} M4 to be installed also. Many maintainers of @sc{gnu} and +other free software already have most of the @sc{gnu} utilities +installed, since they prefer them. + +@node Bootstrapping, Why Not Imake, Why GNU m4, Questions +@section How Can I Bootstrap? + +@display +If Autoconf requires @sc{gnu} M4 and @sc{gnu} M4 has an Autoconf +@code{configure} script, how do I bootstrap? It seems like a chicken +and egg problem! +@end display + +This is a misunderstanding. Although @sc{gnu} M4 does come with a +@code{configure} script produced by Autoconf, Autoconf is not required +in order to run the script and install @sc{gnu} M4. Autoconf is only +required if you want to change the M4 @code{configure} script, which few +people have to do (mainly its maintainer). + +@node Why Not Imake, , Bootstrapping, Questions +@section Why Not Imake? + +@display +Why not use Imake instead of @code{configure} scripts? +@end display + +Several people have written addressing this question, so I include +adaptations of their explanations here. + +The following answer is based on one written by Richard Pixley: + +@quotation +Autoconf generated scripts frequently work on machines that it has +never been set up to handle before. That is, it does a good job of +inferring a configuration for a new system. Imake cannot do this. + +Imake uses a common database of host specific data. For X11, this makes +sense because the distribution is made as a collection of tools, by one +central authority who has control over the database. + +@sc{gnu} tools are not released this way. Each @sc{gnu} tool has a +maintainer; these maintainers are scattered across the world. Using a +common database would be a maintenance nightmare. Autoconf may appear +to be this kind of database, but in fact it is not. Instead of listing +host dependencies, it lists program requirements. + +If you view the @sc{gnu} suite as a collection of native tools, then the +problems are similar. But the @sc{gnu} development tools can be +configured as cross tools in almost any host+target permutation. All of +these configurations can be installed concurrently. They can even be +configured to share host independent files across hosts. Imake doesn't +address these issues. + +Imake templates are a form of standardization. The @sc{gnu} coding +standards address the same issues without necessarily imposing the same +restrictions. +@end quotation + + +Here is some further explanation, written by Per Bothner: + +@quotation +One of the advantages of Imake is that it easy to generate large +Makefiles using @code{cpp}'s @samp{#include} and macro mechanisms. +However, @code{cpp} is not programmable: it has limited conditional +facilities, and no looping. And @code{cpp} cannot inspect its +environment. + +All of these problems are solved by using @code{sh} instead of +@code{cpp}. The shell is fully programmable, has macro substitution, +can execute (or source) other shell scripts, and can inspect its +environment. +@end quotation + + +Paul Eggert elaborates more: + +@quotation +With Autoconf, installers need not assume that Imake itself is already +installed and working well. This may not seem like much of an advantage +to people who are accustomed to Imake. But on many hosts Imake is not +installed or the default installation is not working well, and requiring +Imake to install a package hinders the acceptance of that package on +those hosts. For example, the Imake template and configuration files +might not be installed properly on a host, or the Imake build procedure +might wrongly assume that all source files are in one big directory +tree, or the Imake configuration might assume one compiler whereas the +package or the installer needs to use another, or there might be a +version mismatch between the Imake expected by the package and the Imake +supported by the host. These problems are much rarer with Autoconf, +where each package comes with its own independent configuration +processor. + +Also, Imake often suffers from unexpected interactions between +@code{make} and the installer's C preprocessor. The fundamental problem +here is that the C preprocessor was designed to preprocess C programs, +not @file{Makefile}s. This is much less of a problem with Autoconf, +which uses the general-purpose preprocessor @code{m4}, and where the +package's author (rather than the installer) does the preprocessing in a +standard way. +@end quotation + + +Finally, Mark Eichin notes: + +@quotation +Imake isn't all that extensible, either. In order to add new features to +Imake, you need to provide your own project template, and duplicate most +of the features of the existing one. This means that for a sophisticated +project, using the vendor-provided Imake templates fails to provide any +leverage---since they don't cover anything that your own project needs +(unless it is an X11 program). + +On the other side, though: + +The one advantage that Imake has over @code{configure}: +@file{Imakefile}s tend to be much shorter (likewise, less redundant) +than @file{Makefile.in}s. There is a fix to this, however---at least +for the Kerberos V5 tree, we've modified things to call in common +@file{post.in} and @file{pre.in} @file{Makefile} fragments for the +entire tree. This means that a lot of common things don't have to be +duplicated, even though they normally are in @code{configure} setups. +@end quotation + + + + +@c ===================================================== History of Autoconf. + +@node History, Environment Variable Index, Questions, Top +@chapter History of Autoconf + +You may be wondering, Why was Autoconf originally written? How did it +get into its present form? (Why does it look like gorilla spit?) If +you're not wondering, then this chapter contains no information useful +to you, and you might as well skip it. If you @emph{are} wondering, +then let there be light@dots{} + +@menu +* Genesis:: Prehistory and naming of @code{configure} +* Exodus:: The plagues of M4 and Perl +* Leviticus:: The priestly code of portability arrives +* Numbers:: Growth and contributors +* Deuteronomy:: Approaching the promises of easy configuration +@end menu + +@node Genesis, Exodus, History, History +@section Genesis + +In June 1991 I was maintaining many of the @sc{gnu} utilities for the +Free Software Foundation. As they were ported to more platforms and +more programs were added, the number of @option{-D} options that users +had to select in the @file{Makefile} (around 20) became burdensome. +Especially for me---I had to test each new release on a bunch of +different systems. So I wrote a little shell script to guess some of +the correct settings for the fileutils package, and released it as part +of fileutils 2.0. That @code{configure} script worked well enough that +the next month I adapted it (by hand) to create similar @code{configure} +scripts for several other @sc{gnu} utilities packages. Brian Berliner +also adapted one of my scripts for his @sc{cvs} revision control system. + +Later that summer, I learned that Richard Stallman and Richard Pixley +were developing similar scripts to use in the @sc{gnu} compiler tools; +so I adapted my @code{configure} scripts to support their evolving +interface: using the file name @file{Makefile.in} as the templates; +adding @samp{+srcdir}, the first option (of many); and creating +@file{config.status} files. + +@node Exodus, Leviticus, Genesis, History +@section Exodus + +As I got feedback from users, I incorporated many improvements, using +Emacs to search and replace, cut and paste, similar changes in each of +the scripts. As I adapted more @sc{gnu} utilities packages to use +@code{configure} scripts, updating them all by hand became impractical. +Rich Murphey, the maintainer of the @sc{gnu} graphics utilities, sent me +mail saying that the @code{configure} scripts were great, and asking if +I had a tool for generating them that I could send him. No, I thought, +but I should! So I started to work out how to generate them. And the +journey from the slavery of hand-written @code{configure} scripts to the +abundance and ease of Autoconf began. + +Cygnus @code{configure}, which was being developed at around that time, +is table driven; it is meant to deal mainly with a discrete number of +system types with a small number of mainly unguessable features (such as +details of the object file format). The automatic configuration system +that Brian Fox had developed for Bash takes a similar approach. For +general use, it seems to me a hopeless cause to try to maintain an +up-to-date database of which features each variant of each operating +system has. It's easier and more reliable to check for most features on +the fly---especially on hybrid systems that people have hacked on +locally or that have patches from vendors installed. + +I considered using an architecture similar to that of Cygnus +@code{configure}, where there is a single @code{configure} script that +reads pieces of @file{configure.in} when run. But I didn't want to have +to distribute all of the feature tests with every package, so I settled +on having a different @code{configure} made from each +@file{configure.in} by a preprocessor. That approach also offered more +control and flexibility. + +I looked briefly into using the Metaconfig package, by Larry Wall, +Harlan Stenn, and Raphael Manfredi, but I decided not to for several +reasons. The @code{Configure} scripts it produces are interactive, +which I find quite inconvenient; I didn't like the ways it checked for +some features (such as library functions); I didn't know that it was +still being maintained, and the @code{Configure} scripts I had +seen didn't work on many modern systems (such as System V R4 and NeXT); +it wasn't very flexible in what it could do in response to a feature's +presence or absence; I found it confusing to learn; and it was too big +and complex for my needs (I didn't realize then how much Autoconf would +eventually have to grow). + +I considered using Perl to generate my style of @code{configure} +scripts, but decided that M4 was better suited to the job of simple +textual substitutions: it gets in the way less, because output is +implicit. Plus, everyone already has it. (Initially I didn't rely on +the @sc{gnu} extensions to M4.) Also, some of my friends at the +University of Maryland had recently been putting M4 front ends on +several programs, including @code{tvtwm}, and I was interested in trying +out a new language. + +@node Leviticus, Numbers, Exodus, History +@section Leviticus + +Since my @code{configure} scripts determine the system's capabilities +automatically, with no interactive user intervention, I decided to call +the program that generates them Autoconfig. But with a version number +tacked on, that name would be too long for old @sc{unix} file systems, +so I shortened it to Autoconf. + +In the fall of 1991 I called together a group of fellow questers after +the Holy Grail of portability (er, that is, alpha testers) to give me +feedback as I encapsulated pieces of my handwritten scripts in M4 macros +and continued to add features and improve the techniques used in the +checks. Prominent among the testers were Fran@,cois Pinard, who came up +with the idea of making an @file{autoconf} shell script to run @code{m4} +and check for unresolved macro calls; Richard Pixley, who suggested +running the compiler instead of searching the file system to find +include files and symbols, for more accurate results; Karl Berry, who +got Autoconf to configure @TeX{} and added the macro index to the +documentation; and Ian Lance Taylor, who added support for creating a C +header file as an alternative to putting @option{-D} options in a +@file{Makefile}, so he could use Autoconf for his @sc{uucp} package. +The alpha testers cheerfully adjusted their files again and again as the +names and calling conventions of the Autoconf macros changed from +release to release. They all contributed many specific checks, great +ideas, and bug fixes. + +@node Numbers, Deuteronomy, Leviticus, History +@section Numbers + +In July 1992, after months of alpha testing, I released Autoconf 1.0, +and converted many @sc{gnu} packages to use it. I was surprised by how +positive the reaction to it was. More people started using it than I +could keep track of, including people working on software that wasn't +part of the @sc{gnu} Project (such as TCL, FSP, and Kerberos V5). +Autoconf continued to improve rapidly, as many people using the +@code{configure} scripts reported problems they encountered. + +Autoconf turned out to be a good torture test for M4 implementations. +@sc{unix} @code{m4} started to dump core because of the length of the +macros that Autoconf defined, and several bugs showed up in @sc{gnu} +@code{m4} as well. Eventually, we realized that we needed to use some +features that only @sc{gnu} M4 has. 4.3@sc{bsd} @code{m4}, in +particular, has an impoverished set of builtin macros; the System V +version is better, but still doesn't provide everything we need. + +More development occurred as people put Autoconf under more stresses +(and to uses I hadn't anticipated). Karl Berry added checks for X11. +david zuhn contributed C++ support. Fran@,cois Pinard made it diagnose +invalid arguments. Jim Blandy bravely coerced it into configuring +@sc{gnu} Emacs, laying the groundwork for several later improvements. +Roland McGrath got it to configure the @sc{gnu} C Library, wrote the +@code{autoheader} script to automate the creation of C header file +templates, and added a @option{--verbose} option to @code{configure}. +Noah Friedman added the @option{--autoconf-dir} option and +@code{AC_MACRODIR} environment variable. (He also coined the term +@dfn{autoconfiscate} to mean ``adapt a software package to use +Autoconf''.) Roland and Noah improved the quoting protection in +@code{AC_DEFINE} and fixed many bugs, especially when I got sick of +dealing with portability problems from February through June, 1993. + +@node Deuteronomy, , Numbers, History +@section Deuteronomy + +A long wish list for major features had accumulated, and the effect of +several years of patching by various people had left some residual +cruft. In April 1994, while working for Cygnus Support, I began a major +revision of Autoconf. I added most of the features of the Cygnus +@code{configure} that Autoconf had lacked, largely by adapting the +relevant parts of Cygnus @code{configure} with the help of david zuhn +and Ken Raeburn. These features include support for using +@file{config.sub}, @file{config.guess}, @option{--host}, and +@option{--target}; making links to files; and running @code{configure} +scripts in subdirectories. Adding these features enabled Ken to convert +@sc{gnu} @code{as}, and Rob Savoye to convert DejaGNU, to using +Autoconf. + +I added more features in response to other peoples' requests. Many +people had asked for @code{configure} scripts to share the results of +the checks between runs, because (particularly when configuring a large +source tree, like Cygnus does) they were frustratingly slow. Mike +Haertel suggested adding site-specific initialization scripts. People +distributing software that had to unpack on MS-DOS asked for a way to +override the @file{.in} extension on the file names, which produced file +names like @file{config.h.in} containing two dots. Jim Avera did an +extensive examination of the problems with quoting in @code{AC_DEFINE} +and @code{AC_SUBST}; his insights led to significant improvements. +Richard Stallman asked that compiler output be sent to @file{config.log} +instead of @file{/dev/null}, to help people debug the Emacs +@code{configure} script. + +I made some other changes because of my dissatisfaction with the quality +of the program. I made the messages showing results of the checks less +ambiguous, always printing a result. I regularized the names of the +macros and cleaned up coding style inconsistencies. I added some +auxiliary utilities that I had developed to help convert source code +packages to use Autoconf. With the help of Fran@,cois Pinard, I made +the macros not interrupt each others' messages. (That feature revealed +some performance bottlenecks in @sc{gnu} @code{m4}, which he hastily +corrected!) I reorganized the documentation around problems people want +to solve. And I began a test suite, because experience had shown that +Autoconf has a pronounced tendency to regress when we change it. + +Again, several alpha testers gave invaluable feedback, especially +Fran@,cois Pinard, Jim Meyering, Karl Berry, Rob Savoye, Ken Raeburn, +and Mark Eichin. + +Finally, version 2.0 was ready. And there was much rejoicing. (And I +have free time again. I think. Yeah, right.) + + +@c ========================================================== Appendices + +@node Environment Variable Index, Output Variable Index, History, Top +@unnumbered Environment Variable Index + +This is an alphabetical list of the environment variables that Autoconf +checks. + +@printindex ev + +@node Output Variable Index, Preprocessor Symbol Index, Environment Variable Index, Top +@unnumbered Output Variable Index + +This is an alphabetical list of the variables that Autoconf can +substitute into files that it creates, typically one or more +@file{Makefile}s. @xref{Setting Output Variables}, for more information +on how this is done. + +@printindex ov + +@node Preprocessor Symbol Index, Autoconf Macro Index, Output Variable Index, Top +@unnumbered Preprocessor Symbol Index + +This is an alphabetical list of the C preprocessor symbols that the +Autoconf macros define. To work with Autoconf, C source code needs to +use these names in @code{#if} directives. + +@printindex cv + +@node Autoconf Macro Index, M4 Macro Index, Preprocessor Symbol Index, Top +@unnumbered Autoconf Macro Index + +This is an alphabetical list of the Autoconf macros. To make the list +easier to use, the macros are listed without their preceding @samp{AC_}. + +@printindex ma + +@node M4 Macro Index, Concept Index, Autoconf Macro Index, Top +@unnumbered M4 Macro Index + +This is an alphabetical list of the M4, M4sugar, and M4sh macros. To +make the list easier to use, the macros are listed without their +preceding @samp{m4_} or @samp{AS_}. + +@printindex ms + +@node Concept Index, , M4 Macro Index, Top +@unnumbered Concept Index + +This is an alphabetical list of the files, tools, and concepts +introduced in this document. + +@printindex cp + +@contents +@bye + +@c Local Variables: +@c ispell-local-dictionary: "american" +@c End: diff --git a/doc/install.texi b/doc/install.texi new file mode 100644 index 0000000..19fd35e --- /dev/null +++ b/doc/install.texi @@ -0,0 +1,258 @@ +@c This file is included by autoconf.texi and is used to produce +@c the INSTALL file. + +@node Basic Installation +@section Basic Installation + +These are generic installation instructions. + +The @code{configure} shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a @file{Makefile} in each directory of the +package. It may also create one or more @file{.h} files containing +system-dependent definitions. Finally, it creates a shell script +@file{config.status} that you can run in the future to recreate the +current configuration, and a file @file{config.log} containing compiler +output (useful mainly for debugging @code{configure}). + +It can also use an optional file (typically called @file{config.cache} +and enabled with @option{--cache-file=config.cache} or simply +@option{-C}) that saves the results of its tests to speed up +reconfiguring. (Caching is disabled by default to prevent problems with +accidental use of stale cache files.) + +If you need to do unusual things to compile the package, please try to +figure out how @code{configure} could check whether to do them, and mail +diffs or instructions to the address given in the @file{README} so they +can be considered for the next release. If you are using the cache, and +at some point @file{config.cache} contains results you don't want to +keep, you may remove or edit it. + +The file @file{configure.ac} (or @file{configure.in}) is used to create +@file{configure} by a program called @code{autoconf}. You only need +@file{configure.ac} if you want to change it or regenerate +@file{configure} using a newer version of @code{autoconf}. + +@noindent +The simplest way to compile this package is: + +@enumerate +@item +@code{cd} to the directory containing the package's source code and type +@samp{./configure} to configure the package for your system. If you're +using @code{csh} on an old version of System V, you might need to type +@samp{sh ./configure} instead to prevent @code{csh} from trying to +execute @code{configure} itself. + +Running @code{configure} takes awhile. While running, it prints some +messages telling which features it is checking for. + +@item +Type @samp{make} to compile the package. + +@item +Optionally, type @samp{make check} to run any self-tests that come with +the package. + +@item +Type @samp{make install} to install the programs and any data files and +documentation. + +@item +You can remove the program binaries and object files from the source code +directory by typing @samp{make clean}. To also remove the files that +@code{configure} created (so you can compile the package for a different +kind of computer), type @samp{make distclean}. There is also a +@samp{make maintainer-clean} target, but that is intended mainly for the +package's developers. If you use it, you may have to get all sorts of +other programs in order to regenerate files that came with the distribution. +@end enumerate + +@node Compilers and Options +@section Compilers and Options + +Some systems require unusual options for compilation or linking that the +@code{configure} script does not know about. Run @samp{./configure +--help} for details on some of the pertinent environment variables. + +You can give @code{configure} initial values for variables by setting +them in the environment. You can do that on the command line like this: + +@example +./configure CC=c89 CFLAGS=-O2 LIBS=-lposix +@end example + +@xref{Environment Variables}, for more details. + + +@node Multiple Architectures +@section Compiling For Multiple Architectures + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of @code{make} that +supports the @code{VPATH} variable, such as GNU @code{make}. @code{cd} +to the directory where you want the object files and executables to go +and run the @code{configure} script. @code{configure} automatically +checks for the source code in the directory that @code{configure} is in +and in @file{..}. + +If you have to use a @code{make} that does not support the @code{VPATH} +variable, you have to compile the package for one architecture at a time +in the source code directory. After you have installed the package for +one architecture, use @samp{make distclean} before reconfiguring for +another architecture. + +@node Installation Names +@section Installation Names + +By default, @samp{make install} will install the package's files in +@file{/usr/local/bin}, @file{/usr/local/man}, etc. You can specify an +installation prefix other than @file{/usr/local} by giving +@code{configure} the option @option{--prefix=@var{path}}. + +You can specify separate installation prefixes for architecture-specific +files and architecture-independent files. If you give @code{configure} +the option @option{--exec-prefix=@var{path}}, the package will use +@var{path} as the prefix for installing programs and libraries. +Documentation and other data files will still use the regular prefix. + +In addition, if you use an unusual directory layout you can give options +like @option{--bindir=@var{path}} to specify different values for +particular kinds of files. Run @samp{configure --help} for a list of +the directories you can set and what kinds of files go in them. + +If the package supports it, you can cause programs to be installed with +an extra prefix or suffix on their names by giving @code{configure} the +option @option{--program-prefix=@var{PREFIX}} or +@option{--program-suffix=@var{SUFFIX}}. + +@node Optional Features +@section Optional Features + +Some packages pay attention to @option{--enable-@var{feature}} options +to @code{configure}, where @var{feature} indicates an optional part of +the package. They may also pay attention to +@option{--with-@var{package}} options, where @var{package} is something +like @samp{gnu-as} or @samp{x} (for the X Window System). The +@file{README} should mention any @option{--enable-} and @option{--with-} +options that the package recognizes. + +For packages that use the X Window System, @code{configure} can usually +find the X include and library files automatically, but if it doesn't, +you can use the @code{configure} options @option{--x-includes=@var{dir}} +and @option{--x-libraries=@var{dir}} to specify their locations. + +@node System Type +@section Specifying the System Type + +There may be some features @code{configure} cannot figure out +automatically, but needs to determine by the type of host the package +will run on. Usually @code{configure} can figure that out, but if it +prints a message saying it cannot guess the host type, give it the +@option{--build=@var{type}} option. @var{type} can either be a short +name for the system type, such as @samp{sun4}, or a canonical name which +has the form: + +@example +@var{cpu}-@var{company}-@var{system} +@end example + +@noindent +where @var{system} can have one of these forms: + +@example +@var{os} +@var{kernel}-@var{os} +@end example + +See the file @file{config.sub} for the possible values of each field. +If @file{config.sub} isn't included in this package, then this package +doesn't need to know the host type. + +If you are @emph{building} compiler tools for cross-compiling, you should +use the @option{--target=@var{type}} option to select the type of system +they will produce code for. + +If you want to @emph{use} a cross compiler, that generates code for a +platform different from the build platform, you should specify the host +platform (i.e., that on which the generated programs will eventually be +run) with @option{--host=@var{type}}. In this case, you should also +specify the build platform with @option{--build=@var{type}}, because, in +this case, it may not be possible to guess the build platform (it +sometimes involves compiling and running simple test programs, and this +can't be done if the compiler is a cross compiler). + +@node Sharing Defaults +@section Sharing Defaults + +If you want to set default values for @code{configure} scripts to share, +you can create a site shell script called @file{config.site} that gives +default values for variables like @code{CC}, @code{cache_file}, and +@code{prefix}. @code{configure} looks for +@file{@var{prefix}/share/config.site} if it exists, then +@file{@var{prefix}/etc/config.site} if it exists. Or, you can set the +@code{CONFIG_SITE} environment variable to the location of the site +script. A warning: not all @code{configure} scripts look for a site +script. + +@node Environment Variables +@section Environment Variables + +Variables not defined in a site shell script can be set in the +environment passed to configure. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the @code{configure} command line, using @samp{VAR=value}. For +example: + +@example +./configure CC=/usr/local2/bin/gcc +@end example + +@noindent +will cause the specified gcc to be used as the C compiler (unless it is +overridden in the site shell script). + + +@node configure Invocation +@section @code{configure} Invocation + +@code{configure} recognizes the following options to control how it +operates. + +@table @option +@item --help +@itemx -h +Print a summary of the options to @code{configure}, and exit. + +@item --version +@itemx -V +Print the version of Autoconf used to generate the @code{configure} +script, and exit. + +@item --cache-file=@var{file} +@cindex Cache, enabling +Enable the cache: use and save the results of the tests in @var{file}, +traditionally @file{config.cache}. @var{file} defaults to +@file{/dev/null} to disable caching. + +@item --config-cache +@itemx -C +Alias for @option{--cache-file=config.cache}. + +@item --quiet +@itemx --silent +@itemx -q +Do not print messages saying which checks are being made. To suppress +all normal output, redirect it to @file{/dev/null} (any error messages +will still be shown). + +@item --srcdir=@var{dir} +Look for the package's source code in directory @var{dir}. Usually +@code{configure} can determine that directory automatically. +@end table + +@noindent +@code{configure} also accepts some other, not widely useful, options. +Run @samp{configure --help} for more details. diff --git a/doc/make-stds.texi b/doc/make-stds.texi new file mode 100644 index 0000000..68faa8d --- /dev/null +++ b/doc/make-stds.texi @@ -0,0 +1,944 @@ +@comment This file is included by both standards.texi and make.texinfo. +@comment It was broken out of standards.texi on 1/6/93 by roland. + +@node Makefile Conventions +@chapter Makefile Conventions +@comment standards.texi does not print an index, but make.texinfo does. +@cindex makefile, conventions for +@cindex conventions for makefiles +@cindex standards for makefiles + +This +@ifinfo +node +@end ifinfo +@iftex +@ifset CODESTD +section +@end ifset +@ifclear CODESTD +chapter +@end ifclear +@end iftex +describes conventions for writing the Makefiles for GNU programs. +Using Automake will help you write a Makefile that follows these +conventions. + +@menu +* Makefile Basics:: General Conventions for Makefiles +* Utilities in Makefiles:: Utilities in Makefiles +* Command Variables:: Variables for Specifying Commands +* Directory Variables:: Variables for Installation Directories +* Standard Targets:: Standard Targets for Users +* Install Command Categories:: Three categories of commands in the `install' + rule: normal, pre-install and post-install. +@end menu + +@node Makefile Basics +@section General Conventions for Makefiles + +Every Makefile should contain this line: + +@example +SHELL = /bin/sh +@end example + +@noindent +to avoid trouble on systems where the @code{SHELL} variable might be +inherited from the environment. (This is never a problem with GNU +@code{make}.) + +Different @code{make} programs have incompatible suffix lists and +implicit rules, and this sometimes creates confusion or misbehavior. So +it is a good idea to set the suffix list explicitly using only the +suffixes you need in the particular Makefile, like this: + +@example +.SUFFIXES: +.SUFFIXES: .c .o +@end example + +@noindent +The first line clears out the suffix list, the second introduces all +suffixes which may be subject to implicit rules in this Makefile. + +Don't assume that @file{.} is in the path for command execution. When +you need to run programs that are a part of your package during the +make, please make sure that it uses @file{./} if the program is built as +part of the make or @file{$(srcdir)/} if the file is an unchanging part +of the source code. Without one of these prefixes, the current search +path is used. + +The distinction between @file{./} (the @dfn{build directory}) and +@file{$(srcdir)/} (the @dfn{source directory}) is important because +users can build in a separate directory using the @samp{--srcdir} option +to @file{configure}. A rule of the form: + +@smallexample +foo.1 : foo.man sedscript + sed -e sedscript foo.man > foo.1 +@end smallexample + +@noindent +will fail when the build directory is not the source directory, because +@file{foo.man} and @file{sedscript} are in the source directory. + +When using GNU @code{make}, relying on @samp{VPATH} to find the source +file will work in the case where there is a single dependency file, +since the @code{make} automatic variable @samp{$<} will represent the +source file wherever it is. (Many versions of @code{make} set @samp{$<} +only in implicit rules.) A Makefile target like + +@smallexample +foo.o : bar.c + $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o +@end smallexample + +@noindent +should instead be written as + +@smallexample +foo.o : bar.c + $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@@ +@end smallexample + +@noindent +in order to allow @samp{VPATH} to work correctly. When the target has +multiple dependencies, using an explicit @samp{$(srcdir)} is the easiest +way to make the rule work well. For example, the target above for +@file{foo.1} is best written as: + +@smallexample +foo.1 : foo.man sedscript + sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@@ +@end smallexample + +GNU distributions usually contain some files which are not source +files---for example, Info files, and the output from Autoconf, Automake, +Bison or Flex. Since these files normally appear in the source +directory, they should always appear in the source directory, not in the +build directory. So Makefile rules to update them should put the +updated files in the source directory. + +However, if a file does not appear in the distribution, then the +Makefile should not put it in the source directory, because building a +program in ordinary circumstances should not modify the source directory +in any way. + +Try to make the build and installation targets, at least (and all their +subtargets) work correctly with a parallel @code{make}. + +@node Utilities in Makefiles +@section Utilities in Makefiles + +Write the Makefile commands (and any shell scripts, such as +@code{configure}) to run in @code{sh}, not in @code{csh}. Don't use any +special features of @code{ksh} or @code{bash}. + +The @code{configure} script and the Makefile rules for building and +installation should not use any utilities directly except these: + +@c dd find +@c gunzip gzip md5sum +@c mkfifo mknod tee uname + +@example +cat cmp cp diff echo egrep expr false grep install-info +ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true +@end example + +The compression program @code{gzip} can be used in the @code{dist} rule. + +Stick to the generally supported options for these programs. For +example, don't use @samp{mkdir -p}, convenient as it may be, because +most systems don't support it. + +It is a good idea to avoid creating symbolic links in makefiles, since a +few systems don't support them. + +The Makefile rules for building and installation can also use compilers +and related programs, but should do so via @code{make} variables so that the +user can substitute alternatives. Here are some of the programs we +mean: + +@example +ar bison cc flex install ld ldconfig lex +make makeinfo ranlib texi2dvi yacc +@end example + +Use the following @code{make} variables to run those programs: + +@example +$(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX) +$(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC) +@end example + +When you use @code{ranlib} or @code{ldconfig}, you should make sure +nothing bad happens if the system does not have the program in question. +Arrange to ignore an error from that command, and print a message before +the command to tell the user that failure of this command does not mean +a problem. (The Autoconf @samp{AC_PROG_RANLIB} macro can help with +this.) + +If you use symbolic links, you should implement a fallback for systems +that don't have symbolic links. + +Additional utilities that can be used via Make variables are: + +@example +chgrp chmod chown mknod +@end example + +It is ok to use other utilities in Makefile portions (or scripts) +intended only for particular systems where you know those utilities +exist. + +@node Command Variables +@section Variables for Specifying Commands + +Makefiles should provide variables for overriding certain commands, options, +and so on. + +In particular, you should run most utility programs via variables. +Thus, if you use Bison, have a variable named @code{BISON} whose default +value is set with @samp{BISON = bison}, and refer to it with +@code{$(BISON)} whenever you need to use Bison. + +File management utilities such as @code{ln}, @code{rm}, @code{mv}, and +so on, need not be referred to through variables in this way, since users +don't need to replace them with other programs. + +Each program-name variable should come with an options variable that is +used to supply options to the program. Append @samp{FLAGS} to the +program-name variable name to get the options variable name---for +example, @code{BISONFLAGS}. (The names @code{CFLAGS} for the C +compiler, @code{YFLAGS} for yacc, and @code{LFLAGS} for lex, are +exceptions to this rule, but we keep them because they are standard.) +Use @code{CPPFLAGS} in any compilation command that runs the +preprocessor, and use @code{LDFLAGS} in any compilation command that +does linking as well as in any direct use of @code{ld}. + +If there are C compiler options that @emph{must} be used for proper +compilation of certain files, do not include them in @code{CFLAGS}. +Users expect to be able to specify @code{CFLAGS} freely themselves. +Instead, arrange to pass the necessary options to the C compiler +independently of @code{CFLAGS}, by writing them explicitly in the +compilation commands or by defining an implicit rule, like this: + +@smallexample +CFLAGS = -g +ALL_CFLAGS = -I. $(CFLAGS) +.c.o: + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< +@end smallexample + +Do include the @samp{-g} option in @code{CFLAGS}, because that is not +@emph{required} for proper compilation. You can consider it a default +that is only recommended. If the package is set up so that it is +compiled with GCC by default, then you might as well include @samp{-O} +in the default value of @code{CFLAGS} as well. + +Put @code{CFLAGS} last in the compilation command, after other variables +containing compiler options, so the user can use @code{CFLAGS} to +override the others. + +@code{CFLAGS} should be used in every invocation of the C compiler, +both those which do compilation and those which do linking. + +Every Makefile should define the variable @code{INSTALL}, which is the +basic command for installing a file into the system. + +Every Makefile should also define the variables @code{INSTALL_PROGRAM} +and @code{INSTALL_DATA}. (The default for @code{INSTALL_PROGRAM} should +be @code{$(INSTALL)}; the default for @code{INSTALL_DATA} should be +@code{$@{INSTALL@} -m 644}.) Then it should use those variables as the +commands for actual installation, for executables and nonexecutables +respectively. Use these variables as follows: + +@example +$(INSTALL_PROGRAM) foo $(bindir)/foo +$(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a +@end example + +Optionally, you may prepend the value of @code{DESTDIR} to the target +filename. Doing this allows the installer to create a snapshot of the +installation to be copied onto the real target filesystem later. Do not +set the value of @code{DESTDIR} in your Makefile, and do not include it +in any installed files. With support for @code{DESTDIR}, the above +examples become: + +@example +$(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo +$(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a +@end example + +@noindent +Always use a file name, not a directory name, as the second argument of +the installation commands. Use a separate command for each file to be +installed. + +@node Directory Variables +@section Variables for Installation Directories + +Installation directories should always be named by variables, so it is +easy to install in a nonstandard place. The standard names for these +variables are described below. They are based on a standard filesystem +layout; variants of it are used in SVR4, 4.4BSD, GNU/Linux, Ultrix v4, +and other modern operating systems. + +These two variables set the root for the installation. All the other +installation directories should be subdirectories of one of these two, +and nothing should be directly installed into these two directories. + +@table @code +@item prefix +@vindex prefix +A prefix used in constructing the default values of the variables listed +below. The default value of @code{prefix} should be @file{/usr/local}. +When building the complete GNU system, the prefix will be empty and +@file{/usr} will be a symbolic link to @file{/}. +(If you are using Autoconf, write it as @samp{@@prefix@@}.) + +Running @samp{make install} with a different value of @code{prefix} from +the one used to build the program should @emph{not} recompile the +program. + +@item exec_prefix +@vindex exec_prefix +A prefix used in constructing the default values of some of the +variables listed below. The default value of @code{exec_prefix} should +be @code{$(prefix)}. +(If you are using Autoconf, write it as @samp{@@exec_prefix@@}.) + +Generally, @code{$(exec_prefix)} is used for directories that contain +machine-specific files (such as executables and subroutine libraries), +while @code{$(prefix)} is used directly for other directories. + +Running @samp{make install} with a different value of @code{exec_prefix} +from the one used to build the program should @emph{not} recompile the +program. +@end table + +Executable programs are installed in one of the following directories. + +@table @code +@item bindir +@vindex bindir +The directory for installing executable programs that users can run. +This should normally be @file{/usr/local/bin}, but write it as +@file{$(exec_prefix)/bin}. +(If you are using Autoconf, write it as @samp{@@bindir@@}.) + +@item sbindir +@vindex sbindir +The directory for installing executable programs that can be run from +the shell, but are only generally useful to system administrators. This +should normally be @file{/usr/local/sbin}, but write it as +@file{$(exec_prefix)/sbin}. +(If you are using Autoconf, write it as @samp{@@sbindir@@}.) + +@item libexecdir +@vindex libexecdir +@comment This paragraph adjusted to avoid overfull hbox --roland 5jul94 +The directory for installing executable programs to be run by other +programs rather than by users. This directory should normally be +@file{/usr/local/libexec}, but write it as @file{$(exec_prefix)/libexec}. +(If you are using Autoconf, write it as @samp{@@libexecdir@@}.) +@end table + +Data files used by the program during its execution are divided into +categories in two ways. + +@itemize @bullet +@item +Some files are normally modified by programs; others are never normally +modified (though users may edit some of these). + +@item +Some files are architecture-independent and can be shared by all +machines at a site; some are architecture-dependent and can be shared +only by machines of the same kind and operating system; others may never +be shared between two machines. +@end itemize + +This makes for six different possibilities. However, we want to +discourage the use of architecture-dependent files, aside from object +files and libraries. It is much cleaner to make other data files +architecture-independent, and it is generally not hard. + +Therefore, here are the variables Makefiles should use to specify +directories: + +@table @samp +@item datadir +The directory for installing read-only architecture independent data +files. This should normally be @file{/usr/local/share}, but write it as +@file{$(prefix)/share}. +(If you are using Autoconf, write it as @samp{@@datadir@@}.) +As a special exception, see @file{$(infodir)} +and @file{$(includedir)} below. + +@item sysconfdir +The directory for installing read-only data files that pertain to a +single machine--that is to say, files for configuring a host. Mailer +and network configuration files, @file{/etc/passwd}, and so forth belong +here. All the files in this directory should be ordinary ASCII text +files. This directory should normally be @file{/usr/local/etc}, but +write it as @file{$(prefix)/etc}. +(If you are using Autoconf, write it as @samp{@@sysconfdir@@}.) + +Do not install executables here in this directory (they probably belong +in @file{$(libexecdir)} or @file{$(sbindir)}). Also do not install +files that are modified in the normal course of their use (programs +whose purpose is to change the configuration of the system excluded). +Those probably belong in @file{$(localstatedir)}. + +@item sharedstatedir +The directory for installing architecture-independent data files which +the programs modify while they run. This should normally be +@file{/usr/local/com}, but write it as @file{$(prefix)/com}. +(If you are using Autoconf, write it as @samp{@@sharedstatedir@@}.) + +@item localstatedir +The directory for installing data files which the programs modify while +they run, and that pertain to one specific machine. Users should never +need to modify files in this directory to configure the package's +operation; put such configuration information in separate files that go +in @file{$(datadir)} or @file{$(sysconfdir)}. @file{$(localstatedir)} +should normally be @file{/usr/local/var}, but write it as +@file{$(prefix)/var}. +(If you are using Autoconf, write it as @samp{@@localstatedir@@}.) + +@item libdir +The directory for object files and libraries of object code. Do not +install executables here, they probably ought to go in @file{$(libexecdir)} +instead. The value of @code{libdir} should normally be +@file{/usr/local/lib}, but write it as @file{$(exec_prefix)/lib}. +(If you are using Autoconf, write it as @samp{@@libdir@@}.) + +@item infodir +The directory for installing the Info files for this package. By +default, it should be @file{/usr/local/info}, but it should be written +as @file{$(prefix)/info}. +(If you are using Autoconf, write it as @samp{@@infodir@@}.) + +@item lispdir +The directory for installing any Emacs Lisp files in this package. By +default, it should be @file{/usr/local/share/emacs/site-lisp}, but it +should be written as @file{$(prefix)/share/emacs/site-lisp}. + +If you are using Autoconf, write the default as @samp{@@lispdir@@}. +In order to make @samp{@@lispdir@@} work, you need the following lines +in your @file{configure.in} file: + +@example +lispdir='$@{datadir@}/emacs/site-lisp' +AC_SUBST(lispdir) +@end example + +@item includedir +@c rewritten to avoid overfull hbox --roland +The directory for installing header files to be included by user +programs with the C @samp{#include} preprocessor directive. This +should normally be @file{/usr/local/include}, but write it as +@file{$(prefix)/include}. +(If you are using Autoconf, write it as @samp{@@includedir@@}.) + +Most compilers other than GCC do not look for header files in directory +@file{/usr/local/include}. So installing the header files this way is +only useful with GCC. Sometimes this is not a problem because some +libraries are only really intended to work with GCC. But some libraries +are intended to work with other compilers. They should install their +header files in two places, one specified by @code{includedir} and one +specified by @code{oldincludedir}. + +@item oldincludedir +The directory for installing @samp{#include} header files for use with +compilers other than GCC. This should normally be @file{/usr/include}. +(If you are using Autoconf, you can write it as @samp{@@oldincludedir@@}.) + +The Makefile commands should check whether the value of +@code{oldincludedir} is empty. If it is, they should not try to use +it; they should cancel the second installation of the header files. + +A package should not replace an existing header in this directory unless +the header came from the same package. Thus, if your Foo package +provides a header file @file{foo.h}, then it should install the header +file in the @code{oldincludedir} directory if either (1) there is no +@file{foo.h} there or (2) the @file{foo.h} that exists came from the Foo +package. + +To tell whether @file{foo.h} came from the Foo package, put a magic +string in the file---part of a comment---and @code{grep} for that string. +@end table + +Unix-style man pages are installed in one of the following: + +@table @samp +@item mandir +The top-level directory for installing the man pages (if any) for this +package. It will normally be @file{/usr/local/man}, but you should +write it as @file{$(prefix)/man}. +(If you are using Autoconf, write it as @samp{@@mandir@@}.) + +@item man1dir +The directory for installing section 1 man pages. Write it as +@file{$(mandir)/man1}. +@item man2dir +The directory for installing section 2 man pages. Write it as +@file{$(mandir)/man2} +@item @dots{} + +@strong{Don't make the primary documentation for any GNU software be a +man page. Write a manual in Texinfo instead. Man pages are just for +the sake of people running GNU software on Unix, which is a secondary +application only.} + +@item manext +The file name extension for the installed man page. This should contain +a period followed by the appropriate digit; it should normally be @samp{.1}. + +@item man1ext +The file name extension for installed section 1 man pages. +@item man2ext +The file name extension for installed section 2 man pages. +@item @dots{} +Use these names instead of @samp{manext} if the package needs to install man +pages in more than one section of the manual. +@end table + +And finally, you should set the following variable: + +@table @samp +@item srcdir +The directory for the sources being compiled. The value of this +variable is normally inserted by the @code{configure} shell script. +(If you are using Autconf, use @samp{srcdir = @@srcdir@@}.) +@end table + +For example: + +@smallexample +@c I have changed some of the comments here slightly to fix an overfull +@c hbox, so the make manual can format correctly. --roland +# Common prefix for installation directories. +# NOTE: This directory must exist when you start the install. +prefix = /usr/local +exec_prefix = $(prefix) +# Where to put the executable for the command `gcc'. +bindir = $(exec_prefix)/bin +# Where to put the directories used by the compiler. +libexecdir = $(exec_prefix)/libexec +# Where to put the Info files. +infodir = $(prefix)/info +@end smallexample + +If your program installs a large number of files into one of the +standard user-specified directories, it might be useful to group them +into a subdirectory particular to that program. If you do this, you +should write the @code{install} rule to create these subdirectories. + +Do not expect the user to include the subdirectory name in the value of +any of the variables listed above. The idea of having a uniform set of +variable names for installation directories is to enable the user to +specify the exact same values for several different GNU packages. In +order for this to be useful, all the packages must be designed so that +they will work sensibly when the user does so. + +@node Standard Targets +@section Standard Targets for Users + +All GNU programs should have the following targets in their Makefiles: + +@table @samp +@item all +Compile the entire program. This should be the default target. This +target need not rebuild any documentation files; Info files should +normally be included in the distribution, and DVI files should be made +only when explicitly asked for. + +By default, the Make rules should compile and link with @samp{-g}, so +that executable programs have debugging symbols. Users who don't mind +being helpless can strip the executables later if they wish. + +@item install +Compile the program and copy the executables, libraries, and so on to +the file names where they should reside for actual use. If there is a +simple test to verify that a program is properly installed, this target +should run that test. + +Do not strip executables when installing them. Devil-may-care users can +use the @code{install-strip} target to do that. + +If possible, write the @code{install} target rule so that it does not +modify anything in the directory where the program was built, provided +@samp{make all} has just been done. This is convenient for building the +program under one user name and installing it under another. + +The commands should create all the directories in which files are to be +installed, if they don't already exist. This includes the directories +specified as the values of the variables @code{prefix} and +@code{exec_prefix}, as well as all subdirectories that are needed. +One way to do this is by means of an @code{installdirs} target +as described below. + +Use @samp{-} before any command for installing a man page, so that +@code{make} will ignore any errors. This is in case there are systems +that don't have the Unix man page documentation system installed. + +The way to install Info files is to copy them into @file{$(infodir)} +with @code{$(INSTALL_DATA)} (@pxref{Command Variables}), and then run +the @code{install-info} program if it is present. @code{install-info} +is a program that edits the Info @file{dir} file to add or update the +menu entry for the given Info file; it is part of the Texinfo package. +Here is a sample rule to install an Info file: + +@comment This example has been carefully formatted for the Make manual. +@comment Please do not reformat it without talking to roland@gnu.ai.mit.edu. +@smallexample +$(DESTDIR)$(infodir)/foo.info: foo.info + $(POST_INSTALL) +# There may be a newer info file in . than in srcdir. + -if test -f foo.info; then d=.; \ + else d=$(srcdir); fi; \ + $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@@; \ +# Run install-info only if it exists. +# Use `if' instead of just prepending `-' to the +# line so we notice real errors from install-info. +# We use `$(SHELL) -c' because some shells do not +# fail gracefully when there is an unknown command. + if $(SHELL) -c 'install-info --version' \ + >/dev/null 2>&1; then \ + install-info --dir-file=$(DESTDIR)$(infodir)/dir \ + $(DESTDIR)$(infodir)/foo.info; \ + else true; fi +@end smallexample + +When writing the @code{install} target, you must classify all the +commands into three categories: normal ones, @dfn{pre-installation} +commands and @dfn{post-installation} commands. @xref{Install Command +Categories}. + +@item uninstall +Delete all the installed files---the copies that the @samp{install} +target creates. + +This rule should not modify the directories where compilation is done, +only the directories where files are installed. + +The uninstallation commands are divided into three categories, just like +the installation commands. @xref{Install Command Categories}. + +@item install-strip +Like @code{install}, but strip the executable files while installing +them. In simple cases, this target can use the @code{install} target in +a simple way: + +@smallexample +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ + install +@end smallexample + +But if the package installs scripts as well as real executables, the +@code{install-strip} target can't just refer to the @code{install} +target; it has to strip the executables but not the scripts. + +@code{install-strip} should not strip the executables in the build +directory which are being copied for installation. It should only strip +the copies that are installed. + +Normally we do not recommend stripping an executable unless you are sure +the program has no bugs. However, it can be reasonable to install a +stripped executable for actual execution while saving the unstripped +executable elsewhere in case there is a bug. + +@comment The gratuitous blank line here is to make the table look better +@comment in the printed Make manual. Please leave it in. +@item clean + +Delete all files from the current directory that are normally created by +building the program. Don't delete the files that record the +configuration. Also preserve files that could be made by building, but +normally aren't because the distribution comes with them. + +Delete @file{.dvi} files here if they are not part of the distribution. + +@item distclean +Delete all files from the current directory that are created by +configuring or building the program. If you have unpacked the source +and built the program without creating any other files, @samp{make +distclean} should leave only the files that were in the distribution. + +@item mostlyclean +Like @samp{clean}, but may refrain from deleting a few files that people +normally don't want to recompile. For example, the @samp{mostlyclean} +target for GCC does not delete @file{libgcc.a}, because recompiling it +is rarely necessary and takes a lot of time. + +@item maintainer-clean +Delete almost everything from the current directory that can be +reconstructed with this Makefile. This typically includes everything +deleted by @code{distclean}, plus more: C source files produced by +Bison, tags tables, Info files, and so on. + +The reason we say ``almost everything'' is that running the command +@samp{make maintainer-clean} should not delete @file{configure} even if +@file{configure} can be remade using a rule in the Makefile. More generally, +@samp{make maintainer-clean} should not delete anything that needs to +exist in order to run @file{configure} and then begin to build the +program. This is the only exception; @code{maintainer-clean} should +delete everything else that can be rebuilt. + +The @samp{maintainer-clean} target is intended to be used by a maintainer of +the package, not by ordinary users. You may need special tools to +reconstruct some of the files that @samp{make maintainer-clean} deletes. +Since these files are normally included in the distribution, we don't +take care to make them easy to reconstruct. If you find you need to +unpack the full distribution again, don't blame us. + +To help make users aware of this, the commands for the special +@code{maintainer-clean} target should start with these two: + +@smallexample +@@echo 'This command is intended for maintainers to use; it' +@@echo 'deletes files that may need special tools to rebuild.' +@end smallexample + +@item TAGS +Update a tags table for this program. +@c ADR: how? + +@item info +Generate any Info files needed. The best way to write the rules is as +follows: + +@smallexample +info: foo.info + +foo.info: foo.texi chap1.texi chap2.texi + $(MAKEINFO) $(srcdir)/foo.texi +@end smallexample + +@noindent +You must define the variable @code{MAKEINFO} in the Makefile. It should +run the @code{makeinfo} program, which is part of the Texinfo +distribution. + +Normally a GNU distribution comes with Info files, and that means the +Info files are present in the source directory. Therefore, the Make +rule for an info file should update it in the source directory. When +users build the package, ordinarily Make will not update the Info files +because they will already be up to date. + +@item dvi +Generate DVI files for all Texinfo documentation. +For example: + +@smallexample +dvi: foo.dvi + +foo.dvi: foo.texi chap1.texi chap2.texi + $(TEXI2DVI) $(srcdir)/foo.texi +@end smallexample + +@noindent +You must define the variable @code{TEXI2DVI} in the Makefile. It should +run the program @code{texi2dvi}, which is part of the Texinfo +distribution.@footnote{@code{texi2dvi} uses @TeX{} to do the real work +of formatting. @TeX{} is not distributed with Texinfo.} Alternatively, +write just the dependencies, and allow GNU @code{make} to provide the command. + +@item dist +Create a distribution tar file for this program. The tar file should be +set up so that the file names in the tar file start with a subdirectory +name which is the name of the package it is a distribution for. This +name can include the version number. + +For example, the distribution tar file of GCC version 1.40 unpacks into +a subdirectory named @file{gcc-1.40}. + +The easiest way to do this is to create a subdirectory appropriately +named, use @code{ln} or @code{cp} to install the proper files in it, and +then @code{tar} that subdirectory. + +Compress the tar file with @code{gzip}. For example, the actual +distribution file for GCC version 1.40 is called @file{gcc-1.40.tar.gz}. + +The @code{dist} target should explicitly depend on all non-source files +that are in the distribution, to make sure they are up to date in the +distribution. +@ifset CODESTD +@xref{Releases, , Making Releases}. +@end ifset +@ifclear CODESTD +@xref{Releases, , Making Releases, standards, GNU Coding Standards}. +@end ifclear + +@item check +Perform self-tests (if any). The user must build the program before +running the tests, but need not install the program; you should write +the self-tests so that they work when the program is built but not +installed. +@end table + +The following targets are suggested as conventional names, for programs +in which they are useful. + +@table @code +@item installcheck +Perform installation tests (if any). The user must build and install +the program before running the tests. You should not assume that +@file{$(bindir)} is in the search path. + +@item installdirs +It's useful to add a target named @samp{installdirs} to create the +directories where files are installed, and their parent directories. +There is a script called @file{mkinstalldirs} which is convenient for +this; you can find it in the Texinfo package. +@c It's in /gd/gnu/lib/mkinstalldirs. +You can use a rule like this: + +@comment This has been carefully formatted to look decent in the Make manual. +@comment Please be sure not to make it extend any further to the right.--roland +@smallexample +# Make sure all installation directories (e.g. $(bindir)) +# actually exist by making them if necessary. +installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ + $(libdir) $(infodir) \ + $(mandir) +@end smallexample + +@noindent +or, if you wish to support @env{DESTDIR}, + +@smallexample +# Make sure all installation directories (e.g. $(bindir)) +# actually exist by making them if necessary. +installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs \ + $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \ + $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \ + $(DESTDIR)$(mandir) +@end smallexample + +This rule should not modify the directories where compilation is done. +It should do nothing but create installation directories. +@end table + +@node Install Command Categories +@section Install Command Categories + +@cindex pre-installation commands +@cindex post-installation commands +When writing the @code{install} target, you must classify all the +commands into three categories: normal ones, @dfn{pre-installation} +commands and @dfn{post-installation} commands. + +Normal commands move files into their proper places, and set their +modes. They may not alter any files except the ones that come entirely +from the package they belong to. + +Pre-installation and post-installation commands may alter other files; +in particular, they can edit global configuration files or data bases. + +Pre-installation commands are typically executed before the normal +commands, and post-installation commands are typically run after the +normal commands. + +The most common use for a post-installation command is to run +@code{install-info}. This cannot be done with a normal command, since +it alters a file (the Info directory) which does not come entirely and +solely from the package being installed. It is a post-installation +command because it needs to be done after the normal command which +installs the package's Info files. + +Most programs don't need any pre-installation commands, but we have the +feature just in case it is needed. + +To classify the commands in the @code{install} rule into these three +categories, insert @dfn{category lines} among them. A category line +specifies the category for the commands that follow. + +A category line consists of a tab and a reference to a special Make +variable, plus an optional comment at the end. There are three +variables you can use, one for each category; the variable name +specifies the category. Category lines are no-ops in ordinary execution +because these three Make variables are normally undefined (and you +@emph{should not} define them in the makefile). + +Here are the three possible category lines, each with a comment that +explains what it means: + +@smallexample + $(PRE_INSTALL) # @r{Pre-install commands follow.} + $(POST_INSTALL) # @r{Post-install commands follow.} + $(NORMAL_INSTALL) # @r{Normal commands follow.} +@end smallexample + +If you don't use a category line at the beginning of the @code{install} +rule, all the commands are classified as normal until the first category +line. If you don't use any category lines, all the commands are +classified as normal. + +These are the category lines for @code{uninstall}: + +@smallexample + $(PRE_UNINSTALL) # @r{Pre-uninstall commands follow.} + $(POST_UNINSTALL) # @r{Post-uninstall commands follow.} + $(NORMAL_UNINSTALL) # @r{Normal commands follow.} +@end smallexample + +Typically, a pre-uninstall command would be used for deleting entries +from the Info directory. + +If the @code{install} or @code{uninstall} target has any dependencies +which act as subroutines of installation, then you should start +@emph{each} dependency's commands with a category line, and start the +main target's commands with a category line also. This way, you can +ensure that each command is placed in the right category regardless of +which of the dependencies actually run. + +Pre-installation and post-installation commands should not run any +programs except for these: + +@example +[ basename bash cat chgrp chmod chown cmp cp dd diff echo +egrep expand expr false fgrep find getopt grep gunzip gzip +hostname install install-info kill ldconfig ln ls md5sum +mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee +test touch true uname xargs yes +@end example + +@cindex binary packages +The reason for distinguishing the commands in this way is for the sake +of making binary packages. Typically a binary package contains all the +executables and other files that need to be installed, and has its own +method of installing them---so it does not need to run the normal +installation commands. But installing the binary package does need to +execute the pre-installation and post-installation commands. + +Programs to build binary packages work by extracting the +pre-installation and post-installation commands. Here is one way of +extracting the pre-installation commands: + +@smallexample +make -n install -o all \ + PRE_INSTALL=pre-install \ + POST_INSTALL=post-install \ + NORMAL_INSTALL=normal-install \ + | gawk -f pre-install.awk +@end smallexample + +@noindent +where the file @file{pre-install.awk} could contain this: + +@smallexample +$0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ @{on = 0@} +on @{print $0@} +$0 ~ /^\t[ \t]*pre_install[ \t]*$/ @{on = 1@} +@end smallexample + +The resulting file of pre-installation commands is executed as a shell +script as part of installing the binary package. diff --git a/doc/rename.sh b/doc/rename.sh new file mode 100755 index 0000000..99b248c --- /dev/null +++ b/doc/rename.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# The ac252 package renames the entries in an info directory section to avoid +# install-time conflict with the regular autoconf package. Newer versions of +# install-info have a "--name" option which appears simpler, but does not solve +# this particular problem -T.E.Dickey +SRC=`echo "$1" | sed -e 's,^./,,'` +DST=`echo "$2" | sed -e 's,^./,,'` +SRC_NAME=`basename $SRC .info` +DST_NAME=`basename $DST .info` +if test "$SRC_NAME" != "$DST_NAME" +then + PREFIX=`echo "$DST_NAME" | sed -e "s/$SRC_NAME.*$//"` + SUFFIX=`echo "$DST_NAME" | sed -e "s/^.*$SRC_NAME//"` + + sed -e "s/^\*[ ]*\([^ ][^ ]*\):[ ]*($SRC_NAME)\(.\)/* $PREFIX\1$SUFFIX: ($DST_NAME)\2/" <$SRC | \ + sed -e "s/^This is $SRC_NAME\.info,/This is $DST_NAME.info,/" | + sed -e "s/^File:[ ]*$SRC_NAME\.info/File: $DST_NAME.info/" >$DST +elif test "$SRC" != "$DST" +then + cat $SRC >$DST +fi diff --git a/doc/stamp-vti b/doc/stamp-vti new file mode 100644 index 0000000..d854139 --- /dev/null +++ b/doc/stamp-vti @@ -0,0 +1,4 @@ +@set UPDATED 2 December 2023 +@set UPDATED-MONTH December 2023 +@set EDITION 2.52.20231210 +@set VERSION 2.52.20231210 diff --git a/doc/standards.info b/doc/standards.info new file mode 100644 index 0000000..9e69fdc --- /dev/null +++ b/doc/standards.info @@ -0,0 +1,4454 @@ +This is standards.info, produced by makeinfo version 6.3 from +standards.texi. + +START-INFO-DIR-ENTRY +* Standards: (standards). GNU coding standards. +END-INFO-DIR-ENTRY + + GNU Coding Standards Copyright (C) 1992, 1993, 1994, 1995, 1996, +1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + + Permission is granted to make and distribute verbatim copies of this +manual provided the copyright notice and this permission notice are +preserved on all copies. + + Permission is granted to copy and distribute modified versions of +this manual under the conditions for verbatim copying, provided that the +entire resulting derived work is distributed under the terms of a +permission notice identical to this one. + + Permission is granted to copy and distribute translations of this +manual into another language, under the above conditions for modified +versions, except that this permission notice may be stated in a +translation approved by the Free Software Foundation. + + +File: standards.info, Node: Top, Next: Preface, Prev: (dir), Up: (dir) + +Version +******* + +Last updated March 23, 2001. + +* Menu: + +* Preface:: About the GNU Coding Standards +* Legal Issues:: Keeping Free Software Free +* Design Advice:: General Program Design +* Program Behavior:: Program Behavior for All Programs +* Writing C:: Making The Best Use of C +* Documentation:: Documenting Programs +* Managing Releases:: The Release Process +* References:: References to Non-Free Software or Documentation +* Index:: + + +File: standards.info, Node: Preface, Next: Legal Issues, Up: Top + +1 About the GNU Coding Standards +******************************** + +The GNU Coding Standards were written by Richard Stallman and other GNU +Project volunteers. Their purpose is to make the GNU system clean, +consistent, and easy to install. This document can also be read as a +guide to writing portable, robust and reliable programs. It focuses on +programs written in C, but many of the rules and principles are useful +even if you write in another programming language. The rules often +state reasons for writing in a certain way. + + This release of the GNU Coding Standards was last updated March 23, +2001. + + If you did not obtain this file directly from the GNU project and +recently, please check for a newer version. You can ftp the GNU Coding +Standards from any GNU FTP host in the directory '/pub/gnu/standards/'. +The GNU Coding Standards are available there in several different +formats: 'standards.text', 'standards.info', and 'standards.dvi', as +well as the Texinfo "source" which is divided in two files: +'standards.texi' and 'make-stds.texi'. The GNU Coding Standards are +also available on the GNU World Wide Web server: +<http://www.gnu.org/prep/standards_toc.html>. + + Corrections or suggestions for this document should be sent to +<bug-standards@gnu.org>. If you make a suggestion, please include a +suggested new wording for it; our time is limited. We prefer a context +diff to the 'standards.texi' or 'make-stds.texi' files, but if you don't +have those files, please mail your suggestion anyway. + + +File: standards.info, Node: Legal Issues, Next: Design Advice, Prev: Preface, Up: Top + +2 Keeping Free Software Free +**************************** + +This node discusses how you can make sure that GNU software avoids legal +difficulties, and other related issues. + +* Menu: + +* Reading Non-Free Code:: Referring to Proprietary Programs +* Contributions:: Accepting Contributions +* Trademarks:: How We Deal with Trademark Issues + + +File: standards.info, Node: Reading Non-Free Code, Next: Contributions, Up: Legal Issues + +2.1 Referring to Proprietary Programs +===================================== + +Don't in any circumstances refer to Unix source code for or during your +work on GNU! (Or to any other proprietary programs.) + + If you have a vague recollection of the internals of a Unix program, +this does not absolutely mean you can't write an imitation of it, but do +try to organize the imitation internally along different lines, because +this is likely to make the details of the Unix version irrelevant and +dissimilar to your results. + + For example, Unix utilities were generally optimized to minimize +memory use; if you go for speed instead, your program will be very +different. You could keep the entire input file in core and scan it +there instead of using stdio. Use a smarter algorithm discovered more +recently than the Unix program. Eliminate use of temporary files. Do +it in one pass instead of two (we did this in the assembler). + + Or, on the contrary, emphasize simplicity instead of speed. For some +applications, the speed of today's computers makes simpler algorithms +adequate. + + Or go for generality. For example, Unix programs often have static +tables or fixed-size strings, which make for arbitrary limits; use +dynamic allocation instead. Make sure your program handles NULs and +other funny characters in the input files. Add a programming language +for extensibility and write part of the program in that language. + + Or turn some parts of the program into independently usable +libraries. Or use a simple garbage collector instead of tracking +precisely when to free memory, or use a new GNU facility such as +obstacks. + + +File: standards.info, Node: Contributions, Next: Trademarks, Prev: Reading Non-Free Code, Up: Legal Issues + +2.2 Accepting Contributions +=========================== + +If the program you are working on is copyrighted by the Free Software +Foundation, then when someone else sends you a piece of code to add to +the program, we need legal papers to use it--just as we asked you to +sign papers initially. _Each_ person who makes a nontrivial +contribution to a program must sign some sort of legal papers in order +for us to have clear title to the program; the main author alone is not +enough. + + So, before adding in any contributions from other people, please tell +us, so we can arrange to get the papers. Then wait until we tell you +that we have received the signed papers, before you actually use the +contribution. + + This applies both before you release the program and afterward. If +you receive diffs to fix a bug, and they make significant changes, we +need legal papers for that change. + + This also applies to comments and documentation files. For copyright +law, comments and code are just text. Copyright applies to all kinds of +text, so we need legal papers for all kinds. + + We know it is frustrating to ask for legal papers; it's frustrating +for us as well. But if you don't wait, you are going out on a limb--for +example, what if the contributor's employer won't sign a disclaimer? +You might have to take that code out again! + + You don't need papers for changes of a few lines here or there, since +they are not significant for copyright purposes. Also, you don't need +papers if all you get from the suggestion is some ideas, not actual code +which you use. For example, if someone send you one implementation, but +you write a different implementation of the same idea, you don't need to +get papers. + + The very worst thing is if you forget to tell us about the other +contributor. We could be very embarrassed in court some day as a +result. + + We have more detailed advice for maintainers of programs; if you have +reached the stage of actually maintaining a program for GNU (whether +released or not), please ask us for a copy. + + +File: standards.info, Node: Trademarks, Prev: Contributions, Up: Legal Issues + +2.3 Trademarks +============== + +Please do not include any trademark acknowledgements in GNU software +packages or documentation. + + Trademark acknowledgements are the statements that such-and-such is a +trademark of so-and-so. The GNU Project has no objection to the basic +idea of trademarks, but these acknowledgements feel like kowtowing, so +we don't use them. There is no legal requirement for them. + + What is legally required, as regards other people's trademarks, is to +avoid using them in ways which a reader might read as naming or labeling +our own programs or activities. For example, since "Objective C" is (or +at least was) a trademark, we made sure to say that we provide a +"compiler for the Objective C language" rather than an "Objective C +compiler". The latter is meant to be short for the former, but it does +not explicitly state the relationship, so it could be misinterpreted as +using "Objective C" as a label for the compiler rather than for the +language. + + +File: standards.info, Node: Design Advice, Next: Program Behavior, Prev: Legal Issues, Up: Top + +3 General Program Design +************************ + +This node discusses some of the issues you should take into account when +designing your program. + +* Menu: + +* Source Language:: Which languages to use. +* Compatibility:: Compatibility with other implementations +* Using Extensions:: Using non-standard features +* Standard C:: Using Standard C features + + +File: standards.info, Node: Source Language, Next: Compatibility, Up: Design Advice + +3.1 Which Languages to Use +========================== + +When you want to use a language that gets compiled and runs at high +speed, the best language to use is C. Using another language is like +using a non-standard feature: it will cause trouble for users. Even if +GCC supports the other language, users may find it inconvenient to have +to install the compiler for that other language in order to build your +program. For example, if you write your program in C++, people will +have to install the GNU C++ compiler in order to compile your program. + + C has one other advantage over C++ and other compiled languages: more +people know C, so more people will find it easy to read and modify the +program if it is written in C. + + So in general it is much better to use C, rather than the comparable +alternatives. + + But there are two exceptions to that conclusion: + + * It is no problem to use another language to write a tool + specifically intended for use with that language. That is because + the only people who want to build the tool will be those who have + installed the other language anyway. + + * If an application is of interest only to a narrow part of the + community, then the question of which language it is written in has + less effect on other people, so you may as well please yourself. + + Many programs are designed to be extensible: they include an +interpreter for a language that is higher level than C. Often much of +the program is written in that language, too. The Emacs editor +pioneered this technique. + + The standard extensibility interpreter for GNU software is GUILE, +which implements the language Scheme (an especially clean and simple +dialect of Lisp). <http://www.gnu.org/software/guile/>. We don't +reject programs written in other "scripting languages" such as Perl and +Python, but using GUILE is very important for the overall consistency of +the GNU system. + + +File: standards.info, Node: Compatibility, Next: Using Extensions, Prev: Source Language, Up: Design Advice + +3.2 Compatibility with Other Implementations +============================================ + +With occasional exceptions, utility programs and libraries for GNU +should be upward compatible with those in Berkeley Unix, and upward +compatible with Standard C if Standard C specifies their behavior, and +upward compatible with POSIX if POSIX specifies their behavior. + + When these standards conflict, it is useful to offer compatibility +modes for each of them. + + Standard C and POSIX prohibit many kinds of extensions. Feel free to +make the extensions anyway, and include a '--ansi', '--posix', or +'--compatible' option to turn them off. However, if the extension has a +significant chance of breaking any real programs or scripts, then it is +not really upward compatible. So you should try to redesign its +interface to make it upward compatible. + + Many GNU programs suppress extensions that conflict with POSIX if the +environment variable 'POSIXLY_CORRECT' is defined (even if it is defined +with a null value). Please make your program recognize this variable if +appropriate. + + When a feature is used only by users (not by programs or command +files), and it is done poorly in Unix, feel free to replace it +completely with something totally different and better. (For example, +'vi' is replaced with Emacs.) But it is nice to offer a compatible +feature as well. (There is a free 'vi' clone, so we offer it.) + + Additional useful features are welcome regardless of whether there is +any precedent for them. + + +File: standards.info, Node: Using Extensions, Next: Standard C, Prev: Compatibility, Up: Design Advice + +3.3 Using Non-standard Features +=============================== + +Many GNU facilities that already exist support a number of convenient +extensions over the comparable Unix facilities. Whether to use these +extensions in implementing your program is a difficult question. + + On the one hand, using the extensions can make a cleaner program. On +the other hand, people will not be able to build the program unless the +other GNU tools are available. This might cause the program to work on +fewer kinds of machines. + + With some extensions, it might be easy to provide both alternatives. +For example, you can define functions with a "keyword" 'INLINE' and +define that as a macro to expand into either 'inline' or nothing, +depending on the compiler. + + In general, perhaps it is best not to use the extensions if you can +straightforwardly do without them, but to use the extensions if they are +a big improvement. + + An exception to this rule are the large, established programs (such +as Emacs) which run on a great variety of systems. Using GNU extensions +in such programs would make many users unhappy, so we don't do that. + + Another exception is for programs that are used as part of +compilation: anything that must be compiled with other compilers in +order to bootstrap the GNU compilation facilities. If these require the +GNU compiler, then no one can compile them without having them installed +already. That would be extremely troublesome in certain cases. + + +File: standards.info, Node: Standard C, Prev: Using Extensions, Up: Design Advice + +3.4 Standard C and Pre-Standard C +================================= + +1989 Standard C is widespread enough now that it is ok to use its +features in new programs. There is one exception: do not ever use the +"trigraph" feature of Standard C. + + 1999 Standard C is not widespread yet, so please do not require its +features in programs. It is ok to use its features if they are present. + + However, it is easy to support pre-standard compilers in most +programs, so if you know how to do that, feel free. If a program you +are maintaining has such support, you should try to keep it working. + + To support pre-standard C, instead of writing function definitions in +standard prototype form, + + int + foo (int x, int y) + ... + +write the definition in pre-standard style like this, + + int + foo (x, y) + int x, y; + ... + +and use a separate declaration to specify the argument prototype: + + int foo (int, int); + + You need such a declaration anyway, in a header file, to get the +benefit of prototypes in all the files where the function is called. +And once you have the declaration, you normally lose nothing by writing +the function definition in the pre-standard style. + + This technique does not work for integer types narrower than 'int'. +If you think of an argument as being of a type narrower than 'int', +declare it as 'int' instead. + + There are a few special cases where this technique is hard to use. +For example, if a function argument needs to hold the system type +'dev_t', you run into trouble, because 'dev_t' is shorter than 'int' on +some machines; but you cannot use 'int' instead, because 'dev_t' is +wider than 'int' on some machines. There is no type you can safely use +on all machines in a non-standard definition. The only way to support +non-standard C and pass such an argument is to check the width of +'dev_t' using Autoconf and choose the argument type accordingly. This +may not be worth the trouble. + + In order to support pre-standard compilers that do not recognize +prototypes, you may want to use a preprocessor macro like this: + + /* Declare the prototype for a general external function. */ + #if defined (__STDC__) || defined (WINDOWSNT) + #define P_(proto) proto + #else + #define P_(proto) () + #endif + + +File: standards.info, Node: Program Behavior, Next: Writing C, Prev: Design Advice, Up: Top + +4 Program Behavior for All Programs +*********************************** + +This node describes conventions for writing robust software. It also +describes general standards for error messages, the command line +interface, and how libraries should behave. + +* Menu: + +* Semantics:: Writing robust programs +* Libraries:: Library behavior +* Errors:: Formatting error messages +* User Interfaces:: Standards about interfaces generally +* Graphical Interfaces:: Standards for graphical interfaces +* Command-Line Interfaces:: Standards for command line interfaces +* Option Table:: Table of long options +* Memory Usage:: When and how to care about memory needs +* File Usage:: Which files to use, and where + + +File: standards.info, Node: Semantics, Next: Libraries, Up: Program Behavior + +4.1 Writing Robust Programs +=========================== + +Avoid arbitrary limits on the length or number of _any_ data structure, +including file names, lines, files, and symbols, by allocating all data +structures dynamically. In most Unix utilities, "long lines are +silently truncated". This is not acceptable in a GNU utility. + + Utilities reading files should not drop NUL characters, or any other +nonprinting characters _including those with codes above 0177_. The +only sensible exceptions would be utilities specifically intended for +interface to certain types of terminals or printers that can't handle +those characters. Whenever possible, try to make programs work properly +with sequences of bytes that represent multibyte characters, using +encodings such as UTF-8 and others. + + Check every system call for an error return, unless you know you wish +to ignore errors. Include the system error text (from 'perror' or +equivalent) in _every_ error message resulting from a failing system +call, as well as the name of the file if any and the name of the +utility. Just "cannot open foo.c" or "stat failed" is not sufficient. + + Check every call to 'malloc' or 'realloc' to see if it returned zero. +Check 'realloc' even if you are making the block smaller; in a system +that rounds block sizes to a power of 2, 'realloc' may get a different +block if you ask for less space. + + In Unix, 'realloc' can destroy the storage block if it returns zero. +GNU 'realloc' does not have this bug: if it fails, the original block is +unchanged. Feel free to assume the bug is fixed. If you wish to run +your program on Unix, and wish to avoid lossage in this case, you can +use the GNU 'malloc'. + + You must expect 'free' to alter the contents of the block that was +freed. Anything you want to fetch from the block, you must fetch before +calling 'free'. + + If 'malloc' fails in a noninteractive program, make that a fatal +error. In an interactive program (one that reads commands from the +user), it is better to abort the command and return to the command +reader loop. This allows the user to kill other processes to free up +virtual memory, and then try the command again. + + Use 'getopt_long' to decode arguments, unless the argument syntax +makes this unreasonable. + + When static storage is to be written in during program execution, use +explicit C code to initialize it. Reserve C initialized declarations +for data that will not be changed. + + Try to avoid low-level interfaces to obscure Unix data structures +(such as file directories, utmp, or the layout of kernel memory), since +these are less likely to work compatibly. If you need to find all the +files in a directory, use 'readdir' or some other high-level interface. +These are supported compatibly by GNU. + + The preferred signal handling facilities are the BSD variant of +'signal', and the POSIX 'sigaction' function; the alternative USG +'signal' interface is an inferior design. + + Nowadays, using the POSIX signal functions may be the easiest way to +make a program portable. If you use 'signal', then on GNU/Linux systems +running GNU libc version 1, you should include 'bsd/signal.h' instead of +'signal.h', so as to get BSD behavior. It is up to you whether to +support systems where 'signal' has only the USG behavior, or give up on +them. + + In error checks that detect "impossible" conditions, just abort. +There is usually no point in printing any message. These checks +indicate the existence of bugs. Whoever wants to fix the bugs will have +to read the source code and run a debugger. So explain the problem with +comments in the source. The relevant data will be in variables, which +are easy to examine with the debugger, so there is no point moving them +elsewhere. + + Do not use a count of errors as the exit status for a program. _That +does not work_, because exit status values are limited to 8 bits (0 +through 255). A single run of the program might have 256 errors; if you +try to return 256 as the exit status, the parent process will see 0 as +the status, and it will appear that the program succeeded. + + If you make temporary files, check the 'TMPDIR' environment variable; +if that variable is defined, use the specified directory instead of +'/tmp'. + + In addition, be aware that there is a possible security problem when +creating temporary files in world-writable directories. In C, you can +avoid this problem by creating temporary files in this manner: + + fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600); + +or by using the 'mkstemps' function from libiberty. + + In bash, use 'set -C' to avoid this problem. + + +File: standards.info, Node: Libraries, Next: Errors, Prev: Semantics, Up: Program Behavior + +4.2 Library Behavior +==================== + +Try to make library functions reentrant. If they need to do dynamic +storage allocation, at least try to avoid any nonreentrancy aside from +that of 'malloc' itself. + + Here are certain name conventions for libraries, to avoid name +conflicts. + + Choose a name prefix for the library, more than two characters long. +All external function and variable names should start with this prefix. +In addition, there should only be one of these in any given library +member. This usually means putting each one in a separate source file. + + An exception can be made when two external symbols are always used +together, so that no reasonable program could use one without the other; +then they can both go in the same file. + + External symbols that are not documented entry points for the user +should have names beginning with '_'. The '_' should be followed by the +chosen name prefix for the library, to prevent collisions with other +libraries. These can go in the same files with user entry points if you +like. + + Static functions and variables can be used as you like and need not +fit any naming convention. + + +File: standards.info, Node: Errors, Next: User Interfaces, Prev: Libraries, Up: Program Behavior + +4.3 Formatting Error Messages +============================= + +Error messages from compilers should look like this: + + SOURCE-FILE-NAME:LINENO: MESSAGE + +If you want to mention the column number, use this format: + + SOURCE-FILE-NAME:LINENO:COLUMN: MESSAGE + +Line numbers should start from 1 at the beginning of the file, and +column numbers should start from 1 at the beginning of the line. (Both +of these conventions are chosen for compatibility.) Calculate column +numbers assuming that space and all ASCII printing characters have equal +width, and assuming tab stops every 8 columns. + + Error messages from other noninteractive programs should look like +this: + + PROGRAM:SOURCE-FILE-NAME:LINENO: MESSAGE + +when there is an appropriate source file, or like this: + + PROGRAM: MESSAGE + +when there is no relevant source file. + + If you want to mention the column number, use this format: + + PROGRAM:SOURCE-FILE-NAME:LINENO:COLUMN: MESSAGE + + In an interactive program (one that is reading commands from a +terminal), it is better not to include the program name in an error +message. The place to indicate which program is running is in the +prompt or with the screen layout. (When the same program runs with +input from a source other than a terminal, it is not interactive and +would do best to print error messages using the noninteractive style.) + + The string MESSAGE should not begin with a capital letter when it +follows a program name and/or file name. Also, it should not end with a +period. + + Error messages from interactive programs, and other messages such as +usage messages, should start with a capital letter. But they should not +end with a period. + + +File: standards.info, Node: User Interfaces, Next: Graphical Interfaces, Prev: Errors, Up: Program Behavior + +4.4 Standards for Interfaces Generally +====================================== + +Please don't make the behavior of a utility depend on the name used to +invoke it. It is useful sometimes to make a link to a utility with a +different name, and that should not change what it does. + + Instead, use a run time option or a compilation switch or both to +select among the alternate behaviors. + + Likewise, please don't make the behavior of the program depend on the +type of output device it is used with. Device independence is an +important principle of the system's design; do not compromise it merely +to save someone from typing an option now and then. (Variation in error +message syntax when using a terminal is ok, because that is a side issue +that people do not depend on.) + + If you think one behavior is most useful when the output is to a +terminal, and another is most useful when the output is a file or a +pipe, then it is usually best to make the default behavior the one that +is useful with output to a terminal, and have an option for the other +behavior. + + Compatibility requires certain programs to depend on the type of +output device. It would be disastrous if 'ls' or 'sh' did not do so in +the way all users expect. In some of these cases, we supplement the +program with a preferred alternate version that does not depend on the +output device type. For example, we provide a 'dir' program much like +'ls' except that its default output format is always multi-column +format. + + +File: standards.info, Node: Graphical Interfaces, Next: Command-Line Interfaces, Prev: User Interfaces, Up: Program Behavior + +4.5 Standards for Graphical Interfaces +====================================== + +When you write a program that provides a graphical user interface, +please make it work with X Windows and the GTK toolkit unless the +functionality specifically requires some alternative (for example, +"displaying jpeg images while in console mode"). + + In addition, please provide a command-line interface to control the +functionality. (In many cases, the graphical user interface can be a +separate program which invokes the command-line program.) This is so +that the same jobs can be done from scripts. + + Please also consider providing a CORBA interface (for use from +GNOME), a library interface (for use from C), and perhaps a +keyboard-driven console interface (for use by users from console mode). +Once you are doing the work to provide the functionality and the +graphical interface, these won't be much extra work. + + +File: standards.info, Node: Command-Line Interfaces, Next: Option Table, Prev: Graphical Interfaces, Up: Program Behavior + +4.6 Standards for Command Line Interfaces +========================================= + +It is a good idea to follow the POSIX guidelines for the command-line +options of a program. The easiest way to do this is to use 'getopt' to +parse them. Note that the GNU version of 'getopt' will normally permit +options anywhere among the arguments unless the special argument '--' is +used. This is not what POSIX specifies; it is a GNU extension. + + Please define long-named options that are equivalent to the +single-letter Unix-style options. We hope to make GNU more user +friendly this way. This is easy to do with the GNU function +'getopt_long'. + + One of the advantages of long-named options is that they can be +consistent from program to program. For example, users should be able +to expect the "verbose" option of any GNU program which has one, to be +spelled precisely '--verbose'. To achieve this uniformity, look at the +table of common long-option names when you choose the option names for +your program (*note Option Table::). + + It is usually a good idea for file names given as ordinary arguments +to be input files only; any output files would be specified using +options (preferably '-o' or '--output'). Even if you allow an output +file name as an ordinary argument for compatibility, try to provide an +option as another way to specify it. This will lead to more consistency +among GNU utilities, and fewer idiosyncrasies for users to remember. + + All programs should support two standard options: '--version' and +'--help'. + +'--version' + This option should direct the program to print information about + its name, version, origin and legal status, all on standard output, + and then exit successfully. Other options and arguments should be + ignored once this is seen, and the program should not perform its + normal function. + + The first line is meant to be easy for a program to parse; the + version number proper starts after the last space. In addition, it + contains the canonical name for this program, in this format: + + GNU Emacs 19.30 + + The program's name should be a constant string; _don't_ compute it + from 'argv[0]'. The idea is to state the standard or canonical + name for the program, not its file name. There are other ways to + find out the precise file name where a command is found in 'PATH'. + + If the program is a subsidiary part of a larger package, mention + the package name in parentheses, like this: + + emacsserver (GNU Emacs) 19.30 + + If the package has a version number which is different from this + program's version number, you can mention the package version + number just before the close-parenthesis. + + If you *need* to mention the version numbers of libraries which are + distributed separately from the package which contains this + program, you can do so by printing an additional line of version + info for each library you want to mention. Use the same format for + these lines as for the first line. + + Please do not mention all of the libraries that the program uses + "just for completeness"--that would produce a lot of unhelpful + clutter. Please mention library version numbers only if you find + in practice that they are very important to you in debugging. + + The following line, after the version number line or lines, should + be a copyright notice. If more than one copyright notice is called + for, put each on a separate line. + + Next should follow a brief statement that the program is free + software, and that users are free to copy and change it on certain + conditions. If the program is covered by the GNU GPL, say so here. + Also mention that there is no warranty, to the extent permitted by + law. + + It is ok to finish the output with a list of the major authors of + the program, as a way of giving credit. + + Here's an example of output that follows these rules: + + GNU Emacs 19.34.5 + Copyright (C) 1996 Free Software Foundation, Inc. + GNU Emacs comes with NO WARRANTY, + to the extent permitted by law. + You may redistribute copies of GNU Emacs + under the terms of the GNU General Public License. + For more information about these matters, + see the files named COPYING. + + You should adapt this to your program, of course, filling in the + proper year, copyright holder, name of program, and the references + to distribution terms, and changing the rest of the wording as + necessary. + + This copyright notice only needs to mention the most recent year in + which changes were made--there's no need to list the years for + previous versions' changes. You don't have to mention the name of + the program in these notices, if that is inconvenient, since it + appeared in the first line. + +'--help' + This option should output brief documentation for how to invoke the + program, on standard output, then exit successfully. Other options + and arguments should be ignored once this is seen, and the program + should not perform its normal function. + + Near the end of the '--help' option's output there should be a line + that says where to mail bug reports. It should have this format: + + Report bugs to MAILING-ADDRESS. + + +File: standards.info, Node: Option Table, Next: Memory Usage, Prev: Command-Line Interfaces, Up: Program Behavior + +4.7 Table of Long Options +========================= + +Here is a table of long options used by GNU programs. It is surely +incomplete, but we aim to list all the options that a new program might +want to be compatible with. If you use names not already in the table, +please send <bug-standards@gnu.org> a list of them, with their meanings, +so we can update the table. + +'after-date' + '-N' in 'tar'. + +'all' + '-a' in 'du', 'ls', 'nm', 'stty', 'uname', and 'unexpand'. + +'all-text' + '-a' in 'diff'. + +'almost-all' + '-A' in 'ls'. + +'append' + '-a' in 'etags', 'tee', 'time'; '-r' in 'tar'. + +'archive' + '-a' in 'cp'. + +'archive-name' + '-n' in 'shar'. + +'arglength' + '-l' in 'm4'. + +'ascii' + '-a' in 'diff'. + +'assign' + '-v' in 'gawk'. + +'assume-new' + '-W' in Make. + +'assume-old' + '-o' in Make. + +'auto-check' + '-a' in 'recode'. + +'auto-pager' + '-a' in 'wdiff'. + +'auto-reference' + '-A' in 'ptx'. + +'avoid-wraps' + '-n' in 'wdiff'. + +'background' + For server programs, run in the background. + +'backward-search' + '-B' in 'ctags'. + +'basename' + '-f' in 'shar'. + +'batch' + Used in GDB. + +'baud' + Used in GDB. + +'before' + '-b' in 'tac'. + +'binary' + '-b' in 'cpio' and 'diff'. + +'bits-per-code' + '-b' in 'shar'. + +'block-size' + Used in 'cpio' and 'tar'. + +'blocks' + '-b' in 'head' and 'tail'. + +'break-file' + '-b' in 'ptx'. + +'brief' + Used in various programs to make output shorter. + +'bytes' + '-c' in 'head', 'split', and 'tail'. + +'c++' + '-C' in 'etags'. + +'catenate' + '-A' in 'tar'. + +'cd' + Used in various programs to specify the directory to use. + +'changes' + '-c' in 'chgrp' and 'chown'. + +'classify' + '-F' in 'ls'. + +'colons' + '-c' in 'recode'. + +'command' + '-c' in 'su'; '-x' in GDB. + +'compare' + '-d' in 'tar'. + +'compat' + Used in 'gawk'. + +'compress' + '-Z' in 'tar' and 'shar'. + +'concatenate' + '-A' in 'tar'. + +'confirmation' + '-w' in 'tar'. + +'context' + Used in 'diff'. + +'copyleft' + '-W copyleft' in 'gawk'. + +'copyright' + '-C' in 'ptx', 'recode', and 'wdiff'; '-W copyright' in 'gawk'. + +'core' + Used in GDB. + +'count' + '-q' in 'who'. + +'count-links' + '-l' in 'du'. + +'create' + Used in 'tar' and 'cpio'. + +'cut-mark' + '-c' in 'shar'. + +'cxref' + '-x' in 'ctags'. + +'date' + '-d' in 'touch'. + +'debug' + '-d' in Make and 'm4'; '-t' in Bison. + +'define' + '-D' in 'm4'. + +'defines' + '-d' in Bison and 'ctags'. + +'delete' + '-D' in 'tar'. + +'dereference' + '-L' in 'chgrp', 'chown', 'cpio', 'du', 'ls', and 'tar'. + +'dereference-args' + '-D' in 'du'. + +'device' + Specify an I/O device (special file name). + +'diacritics' + '-d' in 'recode'. + +'dictionary-order' + '-d' in 'look'. + +'diff' + '-d' in 'tar'. + +'digits' + '-n' in 'csplit'. + +'directory' + Specify the directory to use, in various programs. In 'ls', it + means to show directories themselves rather than their contents. + In 'rm' and 'ln', it means to not treat links to directories + specially. + +'discard-all' + '-x' in 'strip'. + +'discard-locals' + '-X' in 'strip'. + +'dry-run' + '-n' in Make. + +'ed' + '-e' in 'diff'. + +'elide-empty-files' + '-z' in 'csplit'. + +'end-delete' + '-x' in 'wdiff'. + +'end-insert' + '-z' in 'wdiff'. + +'entire-new-file' + '-N' in 'diff'. + +'environment-overrides' + '-e' in Make. + +'eof' + '-e' in 'xargs'. + +'epoch' + Used in GDB. + +'error-limit' + Used in 'makeinfo'. + +'error-output' + '-o' in 'm4'. + +'escape' + '-b' in 'ls'. + +'exclude-from' + '-X' in 'tar'. + +'exec' + Used in GDB. + +'exit' + '-x' in 'xargs'. + +'exit-0' + '-e' in 'unshar'. + +'expand-tabs' + '-t' in 'diff'. + +'expression' + '-e' in 'sed'. + +'extern-only' + '-g' in 'nm'. + +'extract' + '-i' in 'cpio'; '-x' in 'tar'. + +'faces' + '-f' in 'finger'. + +'fast' + '-f' in 'su'. + +'fatal-warnings' + '-E' in 'm4'. + +'file' + '-f' in 'info', 'gawk', Make, 'mt', and 'tar'; '-n' in 'sed'; '-r' + in 'touch'. + +'field-separator' + '-F' in 'gawk'. + +'file-prefix' + '-b' in Bison. + +'file-type' + '-F' in 'ls'. + +'files-from' + '-T' in 'tar'. + +'fill-column' + Used in 'makeinfo'. + +'flag-truncation' + '-F' in 'ptx'. + +'fixed-output-files' + '-y' in Bison. + +'follow' + '-f' in 'tail'. + +'footnote-style' + Used in 'makeinfo'. + +'force' + '-f' in 'cp', 'ln', 'mv', and 'rm'. + +'force-prefix' + '-F' in 'shar'. + +'foreground' + For server programs, run in the foreground; in other words, don't + do anything special to run the server in the background. + +'format' + Used in 'ls', 'time', and 'ptx'. + +'freeze-state' + '-F' in 'm4'. + +'fullname' + Used in GDB. + +'gap-size' + '-g' in 'ptx'. + +'get' + '-x' in 'tar'. + +'graphic' + '-i' in 'ul'. + +'graphics' + '-g' in 'recode'. + +'group' + '-g' in 'install'. + +'gzip' + '-z' in 'tar' and 'shar'. + +'hashsize' + '-H' in 'm4'. + +'header' + '-h' in 'objdump' and 'recode' + +'heading' + '-H' in 'who'. + +'help' + Used to ask for brief usage information. + +'here-delimiter' + '-d' in 'shar'. + +'hide-control-chars' + '-q' in 'ls'. + +'html' + In 'makeinfo', output HTML. + +'idle' + '-u' in 'who'. + +'ifdef' + '-D' in 'diff'. + +'ignore' + '-I' in 'ls'; '-x' in 'recode'. + +'ignore-all-space' + '-w' in 'diff'. + +'ignore-backups' + '-B' in 'ls'. + +'ignore-blank-lines' + '-B' in 'diff'. + +'ignore-case' + '-f' in 'look' and 'ptx'; '-i' in 'diff' and 'wdiff'. + +'ignore-errors' + '-i' in Make. + +'ignore-file' + '-i' in 'ptx'. + +'ignore-indentation' + '-I' in 'etags'. + +'ignore-init-file' + '-f' in Oleo. + +'ignore-interrupts' + '-i' in 'tee'. + +'ignore-matching-lines' + '-I' in 'diff'. + +'ignore-space-change' + '-b' in 'diff'. + +'ignore-zeros' + '-i' in 'tar'. + +'include' + '-i' in 'etags'; '-I' in 'm4'. + +'include-dir' + '-I' in Make. + +'incremental' + '-G' in 'tar'. + +'info' + '-i', '-l', and '-m' in Finger. + +'init-file' + In some programs, specify the name of the file to read as the + user's init file. + +'initial' + '-i' in 'expand'. + +'initial-tab' + '-T' in 'diff'. + +'inode' + '-i' in 'ls'. + +'interactive' + '-i' in 'cp', 'ln', 'mv', 'rm'; '-e' in 'm4'; '-p' in 'xargs'; '-w' + in 'tar'. + +'intermix-type' + '-p' in 'shar'. + +'iso-8601' + Used in 'date' + +'jobs' + '-j' in Make. + +'just-print' + '-n' in Make. + +'keep-going' + '-k' in Make. + +'keep-files' + '-k' in 'csplit'. + +'kilobytes' + '-k' in 'du' and 'ls'. + +'language' + '-l' in 'etags'. + +'less-mode' + '-l' in 'wdiff'. + +'level-for-gzip' + '-g' in 'shar'. + +'line-bytes' + '-C' in 'split'. + +'lines' + Used in 'split', 'head', and 'tail'. + +'link' + '-l' in 'cpio'. + +'lint' +'lint-old' + Used in 'gawk'. + +'list' + '-t' in 'cpio'; '-l' in 'recode'. + +'list' + '-t' in 'tar'. + +'literal' + '-N' in 'ls'. + +'load-average' + '-l' in Make. + +'login' + Used in 'su'. + +'machine' + No listing of which programs already use this; someone should check + to see if any actually do, and tell <gnu@gnu.org>. + +'macro-name' + '-M' in 'ptx'. + +'mail' + '-m' in 'hello' and 'uname'. + +'make-directories' + '-d' in 'cpio'. + +'makefile' + '-f' in Make. + +'mapped' + Used in GDB. + +'max-args' + '-n' in 'xargs'. + +'max-chars' + '-n' in 'xargs'. + +'max-lines' + '-l' in 'xargs'. + +'max-load' + '-l' in Make. + +'max-procs' + '-P' in 'xargs'. + +'mesg' + '-T' in 'who'. + +'message' + '-T' in 'who'. + +'minimal' + '-d' in 'diff'. + +'mixed-uuencode' + '-M' in 'shar'. + +'mode' + '-m' in 'install', 'mkdir', and 'mkfifo'. + +'modification-time' + '-m' in 'tar'. + +'multi-volume' + '-M' in 'tar'. + +'name-prefix' + '-a' in Bison. + +'nesting-limit' + '-L' in 'm4'. + +'net-headers' + '-a' in 'shar'. + +'new-file' + '-W' in Make. + +'no-builtin-rules' + '-r' in Make. + +'no-character-count' + '-w' in 'shar'. + +'no-check-existing' + '-x' in 'shar'. + +'no-common' + '-3' in 'wdiff'. + +'no-create' + '-c' in 'touch'. + +'no-defines' + '-D' in 'etags'. + +'no-deleted' + '-1' in 'wdiff'. + +'no-dereference' + '-d' in 'cp'. + +'no-inserted' + '-2' in 'wdiff'. + +'no-keep-going' + '-S' in Make. + +'no-lines' + '-l' in Bison. + +'no-piping' + '-P' in 'shar'. + +'no-prof' + '-e' in 'gprof'. + +'no-regex' + '-R' in 'etags'. + +'no-sort' + '-p' in 'nm'. + +'no-split' + Used in 'makeinfo'. + +'no-static' + '-a' in 'gprof'. + +'no-time' + '-E' in 'gprof'. + +'no-timestamp' + '-m' in 'shar'. + +'no-validate' + Used in 'makeinfo'. + +'no-wait' + Used in 'emacsclient'. + +'no-warn' + Used in various programs to inhibit warnings. + +'node' + '-n' in 'info'. + +'nodename' + '-n' in 'uname'. + +'nonmatching' + '-f' in 'cpio'. + +'nstuff' + '-n' in 'objdump'. + +'null' + '-0' in 'xargs'. + +'number' + '-n' in 'cat'. + +'number-nonblank' + '-b' in 'cat'. + +'numeric-sort' + '-n' in 'nm'. + +'numeric-uid-gid' + '-n' in 'cpio' and 'ls'. + +'nx' + Used in GDB. + +'old-archive' + '-o' in 'tar'. + +'old-file' + '-o' in Make. + +'one-file-system' + '-l' in 'tar', 'cp', and 'du'. + +'only-file' + '-o' in 'ptx'. + +'only-prof' + '-f' in 'gprof'. + +'only-time' + '-F' in 'gprof'. + +'options' + '-o' in 'getopt', 'fdlist', 'fdmount', 'fdmountd', and 'fdumount'. + +'output' + In various programs, specify the output file name. + +'output-prefix' + '-o' in 'shar'. + +'override' + '-o' in 'rm'. + +'overwrite' + '-c' in 'unshar'. + +'owner' + '-o' in 'install'. + +'paginate' + '-l' in 'diff'. + +'paragraph-indent' + Used in 'makeinfo'. + +'parents' + '-p' in 'mkdir' and 'rmdir'. + +'pass-all' + '-p' in 'ul'. + +'pass-through' + '-p' in 'cpio'. + +'port' + '-P' in 'finger'. + +'portability' + '-c' in 'cpio' and 'tar'. + +'posix' + Used in 'gawk'. + +'prefix-builtins' + '-P' in 'm4'. + +'prefix' + '-f' in 'csplit'. + +'preserve' + Used in 'tar' and 'cp'. + +'preserve-environment' + '-p' in 'su'. + +'preserve-modification-time' + '-m' in 'cpio'. + +'preserve-order' + '-s' in 'tar'. + +'preserve-permissions' + '-p' in 'tar'. + +'print' + '-l' in 'diff'. + +'print-chars' + '-L' in 'cmp'. + +'print-data-base' + '-p' in Make. + +'print-directory' + '-w' in Make. + +'print-file-name' + '-o' in 'nm'. + +'print-symdefs' + '-s' in 'nm'. + +'printer' + '-p' in 'wdiff'. + +'prompt' + '-p' in 'ed'. + +'proxy' + Specify an HTTP proxy. + +'query-user' + '-X' in 'shar'. + +'question' + '-q' in Make. + +'quiet' + Used in many programs to inhibit the usual output. *Note:* every + program accepting '--quiet' should accept '--silent' as a synonym. + +'quiet-unshar' + '-Q' in 'shar' + +'quote-name' + '-Q' in 'ls'. + +'rcs' + '-n' in 'diff'. + +'re-interval' + Used in 'gawk'. + +'read-full-blocks' + '-B' in 'tar'. + +'readnow' + Used in GDB. + +'recon' + '-n' in Make. + +'record-number' + '-R' in 'tar'. + +'recursive' + Used in 'chgrp', 'chown', 'cp', 'ls', 'diff', and 'rm'. + +'reference-limit' + Used in 'makeinfo'. + +'references' + '-r' in 'ptx'. + +'regex' + '-r' in 'tac' and 'etags'. + +'release' + '-r' in 'uname'. + +'reload-state' + '-R' in 'm4'. + +'relocation' + '-r' in 'objdump'. + +'rename' + '-r' in 'cpio'. + +'replace' + '-i' in 'xargs'. + +'report-identical-files' + '-s' in 'diff'. + +'reset-access-time' + '-a' in 'cpio'. + +'reverse' + '-r' in 'ls' and 'nm'. + +'reversed-ed' + '-f' in 'diff'. + +'right-side-defs' + '-R' in 'ptx'. + +'same-order' + '-s' in 'tar'. + +'same-permissions' + '-p' in 'tar'. + +'save' + '-g' in 'stty'. + +'se' + Used in GDB. + +'sentence-regexp' + '-S' in 'ptx'. + +'separate-dirs' + '-S' in 'du'. + +'separator' + '-s' in 'tac'. + +'sequence' + Used by 'recode' to chose files or pipes for sequencing passes. + +'shell' + '-s' in 'su'. + +'show-all' + '-A' in 'cat'. + +'show-c-function' + '-p' in 'diff'. + +'show-ends' + '-E' in 'cat'. + +'show-function-line' + '-F' in 'diff'. + +'show-tabs' + '-T' in 'cat'. + +'silent' + Used in many programs to inhibit the usual output. *Note:* every + program accepting '--silent' should accept '--quiet' as a synonym. + +'size' + '-s' in 'ls'. + +'socket' + Specify a file descriptor for a network server to use for its + socket, instead of opening and binding a new socket. This provides + a way to run, in a nonpriveledged process, a server that normally + needs a reserved port number. + +'sort' + Used in 'ls'. + +'source' + '-W source' in 'gawk'. + +'sparse' + '-S' in 'tar'. + +'speed-large-files' + '-H' in 'diff'. + +'split-at' + '-E' in 'unshar'. + +'split-size-limit' + '-L' in 'shar'. + +'squeeze-blank' + '-s' in 'cat'. + +'start-delete' + '-w' in 'wdiff'. + +'start-insert' + '-y' in 'wdiff'. + +'starting-file' + Used in 'tar' and 'diff' to specify which file within a directory + to start processing with. + +'statistics' + '-s' in 'wdiff'. + +'stdin-file-list' + '-S' in 'shar'. + +'stop' + '-S' in Make. + +'strict' + '-s' in 'recode'. + +'strip' + '-s' in 'install'. + +'strip-all' + '-s' in 'strip'. + +'strip-debug' + '-S' in 'strip'. + +'submitter' + '-s' in 'shar'. + +'suffix' + '-S' in 'cp', 'ln', 'mv'. + +'suffix-format' + '-b' in 'csplit'. + +'sum' + '-s' in 'gprof'. + +'summarize' + '-s' in 'du'. + +'symbolic' + '-s' in 'ln'. + +'symbols' + Used in GDB and 'objdump'. + +'synclines' + '-s' in 'm4'. + +'sysname' + '-s' in 'uname'. + +'tabs' + '-t' in 'expand' and 'unexpand'. + +'tabsize' + '-T' in 'ls'. + +'terminal' + '-T' in 'tput' and 'ul'. '-t' in 'wdiff'. + +'text' + '-a' in 'diff'. + +'text-files' + '-T' in 'shar'. + +'time' + Used in 'ls' and 'touch'. + +'timeout' + Specify how long to wait before giving up on some operation. + +'to-stdout' + '-O' in 'tar'. + +'total' + '-c' in 'du'. + +'touch' + '-t' in Make, 'ranlib', and 'recode'. + +'trace' + '-t' in 'm4'. + +'traditional' + '-t' in 'hello'; '-W traditional' in 'gawk'; '-G' in 'ed', 'm4', + and 'ptx'. + +'tty' + Used in GDB. + +'typedefs' + '-t' in 'ctags'. + +'typedefs-and-c++' + '-T' in 'ctags'. + +'typeset-mode' + '-t' in 'ptx'. + +'uncompress' + '-z' in 'tar'. + +'unconditional' + '-u' in 'cpio'. + +'undefine' + '-U' in 'm4'. + +'undefined-only' + '-u' in 'nm'. + +'update' + '-u' in 'cp', 'ctags', 'mv', 'tar'. + +'usage' + Used in 'gawk'; same as '--help'. + +'uuencode' + '-B' in 'shar'. + +'vanilla-operation' + '-V' in 'shar'. + +'verbose' + Print more information about progress. Many programs support this. + +'verify' + '-W' in 'tar'. + +'version' + Print the version number. + +'version-control' + '-V' in 'cp', 'ln', 'mv'. + +'vgrind' + '-v' in 'ctags'. + +'volume' + '-V' in 'tar'. + +'what-if' + '-W' in Make. + +'whole-size-limit' + '-l' in 'shar'. + +'width' + '-w' in 'ls' and 'ptx'. + +'word-regexp' + '-W' in 'ptx'. + +'writable' + '-T' in 'who'. + +'zeros' + '-z' in 'gprof'. + + +File: standards.info, Node: Memory Usage, Next: File Usage, Prev: Option Table, Up: Program Behavior + +4.8 Memory Usage +================ + +If a program typically uses just a few meg of memory, don't bother +making any effort to reduce memory usage. For example, if it is +impractical for other reasons to operate on files more than a few meg +long, it is reasonable to read entire input files into core to operate +on them. + + However, for programs such as 'cat' or 'tail', that can usefully +operate on very large files, it is important to avoid using a technique +that would artificially limit the size of files it can handle. If a +program works by lines and could be applied to arbitrary user-supplied +input files, it should keep only a line in memory, because this is not +very hard and users will want to be able to operate on input files that +are bigger than will fit in core all at once. + + If your program creates complicated data structures, just make them +in core and give a fatal error if 'malloc' returns zero. + + +File: standards.info, Node: File Usage, Prev: Memory Usage, Up: Program Behavior + +4.9 File Usage +============== + +Programs should be prepared to operate when '/usr' and '/etc' are +read-only file systems. Thus, if the program manages log files, lock +files, backup files, score files, or any other files which are modified +for internal purposes, these files should not be stored in '/usr' or +'/etc'. + + There are two exceptions. '/etc' is used to store system +configuration information; it is reasonable for a program to modify +files in '/etc' when its job is to update the system configuration. +Also, if the user explicitly asks to modify one file in a directory, it +is reasonable for the program to store other files in the same +directory. + + +File: standards.info, Node: Writing C, Next: Documentation, Prev: Program Behavior, Up: Top + +5 Making The Best Use of C +************************** + +This node provides advice on how best to use the C language when writing +GNU software. + +* Menu: + +* Formatting:: Formatting Your Source Code +* Comments:: Commenting Your Work +* Syntactic Conventions:: Clean Use of C Constructs +* Names:: Naming Variables and Functions +* System Portability:: Portability between different operating systems +* CPU Portability:: Supporting the range of CPU types +* System Functions:: Portability and "standard" library functions +* Internationalization:: Techniques for internationalization +* Mmap:: How you can safely use 'mmap'. + + +File: standards.info, Node: Formatting, Next: Comments, Up: Writing C + +5.1 Formatting Your Source Code +=============================== + +It is important to put the open-brace that starts the body of a C +function in column zero, and avoid putting any other open-brace or +open-parenthesis or open-bracket in column zero. Several tools look for +open-braces in column zero to find the beginnings of C functions. These +tools will not work on code not formatted that way. + + It is also important for function definitions to start the name of +the function in column zero. This helps people to search for function +definitions, and may also help certain tools recognize them. Thus, the +proper format is this: + + static char * + concat (s1, s2) /* Name starts in column zero here */ + char *s1, *s2; + { /* Open brace in column zero here */ + ... + } + +or, if you want to use Standard C syntax, format the definition like +this: + + static char * + concat (char *s1, char *s2) + { + ... + } + + In Standard C, if the arguments don't fit nicely on one line, split +it like this: + + int + lots_of_args (int an_integer, long a_long, short a_short, + double a_double, float a_float) + ... + + The rest of this section gives our recommendations for other aspects +of C formatting style, which is also the default style of the 'indent' +program in version 1.2 and newer. It corresponds to the options + + -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 + -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob + + We don't think of these recommendations as requirements, because it +causes no problems for users if two different programs have different +formatting styles. + + But whatever style you use, please use it consistently, since a +mixture of styles within one program tends to look ugly. If you are +contributing changes to an existing program, please follow the style of +that program. + + For the body of the function, our recommended style looks like this: + + if (x < foo (y, z)) + haha = bar[4] + 5; + else + { + while (z) + { + haha += foo (z, z); + z--; + } + return ++x + bar (); + } + + We find it easier to read a program when it has spaces before the +open-parentheses and after the commas. Especially after the commas. + + When you split an expression into multiple lines, split it before an +operator, not after one. Here is the right way: + + if (foo_this_is_long && bar > win (x, y, z) + && remaining_condition) + + Try to avoid having two operators of different precedence at the same +level of indentation. For example, don't write this: + + mode = (inmode[j] == VOIDmode + || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]) + ? outmode[j] : inmode[j]); + + Instead, use extra parentheses so that the indentation shows the +nesting: + + mode = ((inmode[j] == VOIDmode + || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]))) + ? outmode[j] : inmode[j]); + + Insert extra parentheses so that Emacs will indent the code properly. +For example, the following indentation looks nice if you do it by hand, + + v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000; + +but Emacs would alter it. Adding a set of parentheses produces +something that looks equally nice, and which Emacs will preserve: + + v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000); + + Format do-while statements like this: + + do + { + a = foo (a); + } + while (a > 0); + + Please use formfeed characters (control-L) to divide the program into +pages at logical places (but not within a function). It does not matter +just how long the pages are, since they do not have to fit on a printed +page. The formfeeds should appear alone on lines by themselves. + + +File: standards.info, Node: Comments, Next: Syntactic Conventions, Prev: Formatting, Up: Writing C + +5.2 Commenting Your Work +======================== + +Every program should start with a comment saying briefly what it is for. +Example: 'fmt - filter for simple filling of text'. + + Please write the comments in a GNU program in English, because +English is the one language that nearly all programmers in all countries +can read. If you do not write English well, please write comments in +English as well as you can, then ask other people to help rewrite them. +If you can't write comments in English, please find someone to work with +you and translate your comments into English. + + Please put a comment on each function saying what the function does, +what sorts of arguments it gets, and what the possible values of +arguments mean and are used for. It is not necessary to duplicate in +words the meaning of the C argument declarations, if a C type is being +used in its customary fashion. If there is anything nonstandard about +its use (such as an argument of type 'char *' which is really the +address of the second character of a string, not the first), or any +possible values that would not work the way one would expect (such as, +that strings containing newlines are not guaranteed to work), be sure to +say so. + + Also explain the significance of the return value, if there is one. + + Please put two spaces after the end of a sentence in your comments, +so that the Emacs sentence commands will work. Also, please write +complete sentences and capitalize the first word. If a lower-case +identifier comes at the beginning of a sentence, don't capitalize it! +Changing the spelling makes it a different identifier. If you don't +like starting a sentence with a lower case letter, write the sentence +differently (e.g., "The identifier lower-case is ..."). + + The comment on a function is much clearer if you use the argument +names to speak about the argument values. The variable name itself +should be lower case, but write it in upper case when you are speaking +about the value rather than the variable itself. Thus, "the inode +number NODE_NUM" rather than "an inode". + + There is usually no purpose in restating the name of the function in +the comment before it, because the reader can see that for himself. +There might be an exception when the comment is so long that the +function itself would be off the bottom of the screen. + + There should be a comment on each static variable as well, like this: + + /* Nonzero means truncate lines in the display; + zero means continue them. */ + int truncate_lines; + + Every '#endif' should have a comment, except in the case of short +conditionals (just a few lines) that are not nested. The comment should +state the condition of the conditional that is ending, _including its +sense_. '#else' should have a comment describing the condition _and +sense_ of the code that follows. For example: + + #ifdef foo + ... + #else /* not foo */ + ... + #endif /* not foo */ + #ifdef foo + ... + #endif /* foo */ + +but, by contrast, write the comments this way for a '#ifndef': + + #ifndef foo + ... + #else /* foo */ + ... + #endif /* foo */ + #ifndef foo + ... + #endif /* not foo */ + + +File: standards.info, Node: Syntactic Conventions, Next: Names, Prev: Comments, Up: Writing C + +5.3 Clean Use of C Constructs +============================= + +Please explicitly declare the types of all objects. For example, you +should explicitly declare all arguments to functions, and you should +declare functions to return 'int' rather than omitting the 'int'. + + Some programmers like to use the GCC '-Wall' option, and change the +code whenever it issues a warning. If you want to do this, then do. +Other programmers prefer not to use '-Wall', because it gives warnings +for valid and legitimate code which they do not want to change. If you +want to do this, then do. The compiler should be your servant, not your +master. + + Declarations of external functions and functions to appear later in +the source file should all go in one place near the beginning of the +file (somewhere before the first function definition in the file), or +else should go in a header file. Don't put 'extern' declarations inside +functions. + + It used to be common practice to use the same local variables (with +names like 'tem') over and over for different values within one +function. Instead of doing this, it is better declare a separate local +variable for each distinct purpose, and give it a name which is +meaningful. This not only makes programs easier to understand, it also +facilitates optimization by good compilers. You can also move the +declaration of each local variable into the smallest scope that includes +all its uses. This makes the program even cleaner. + + Don't use local variables or parameters that shadow global +identifiers. + + Don't declare multiple variables in one declaration that spans lines. +Start a new declaration on each line, instead. For example, instead of +this: + + int foo, + bar; + +write either this: + + int foo, bar; + +or this: + + int foo; + int bar; + +(If they are global variables, each should have a comment preceding it +anyway.) + + When you have an 'if'-'else' statement nested in another 'if' +statement, always put braces around the 'if'-'else'. Thus, never write +like this: + + if (foo) + if (bar) + win (); + else + lose (); + +always like this: + + if (foo) + { + if (bar) + win (); + else + lose (); + } + + If you have an 'if' statement nested inside of an 'else' statement, +either write 'else if' on one line, like this, + + if (foo) + ... + else if (bar) + ... + +with its 'then'-part indented like the preceding 'then'-part, or write +the nested 'if' within braces like this: + + if (foo) + ... + else + { + if (bar) + ... + } + + Don't declare both a structure tag and variables or typedefs in the +same declaration. Instead, declare the structure tag separately and +then use it to declare the variables or typedefs. + + Try to avoid assignments inside 'if'-conditions. For example, don't +write this: + + if ((foo = (char *) malloc (sizeof *foo)) == 0) + fatal ("virtual memory exhausted"); + +instead, write this: + + foo = (char *) malloc (sizeof *foo); + if (foo == 0) + fatal ("virtual memory exhausted"); + + Don't make the program ugly to placate 'lint'. Please don't insert +any casts to 'void'. Zero without a cast is perfectly fine as a null +pointer constant, except when calling a varargs function. + + +File: standards.info, Node: Names, Next: System Portability, Prev: Syntactic Conventions, Up: Writing C + +5.4 Naming Variables and Functions +================================== + +The names of global variables and functions in a program serve as +comments of a sort. So don't choose terse names--instead, look for +names that give useful information about the meaning of the variable or +function. In a GNU program, names should be English, like other +comments. + + Local variable names can be shorter, because they are used only +within one context, where (presumably) comments explain their purpose. + + Try to limit your use of abbreviations in symbol names. It is ok to +make a few abbreviations, explain what they mean, and then use them +frequently, but don't use lots of obscure abbreviations. + + Please use underscores to separate words in a name, so that the Emacs +word commands can be useful within them. Stick to lower case; reserve +upper case for macros and 'enum' constants, and for name-prefixes that +follow a uniform convention. + + For example, you should use names like 'ignore_space_change_flag'; +don't use names like 'iCantReadThis'. + + Variables that indicate whether command-line options have been +specified should be named after the meaning of the option, not after the +option-letter. A comment should state both the exact meaning of the +option and its letter. For example, + + /* Ignore changes in horizontal whitespace (-b). */ + int ignore_space_change_flag; + + When you want to define names with constant integer values, use +'enum' rather than '#define'. GDB knows about enumeration constants. + + You might want to make sure that none of the file names would +conflict the files were loaded onto an MS-DOS file system which shortens +the names. You can use the program 'doschk' to test for this. + + Some GNU programs were designed to limit themselves to file names of +14 characters or less, to avoid file name conflicts if they are read +into older System V systems. Please preserve this feature in the +existing GNU programs that have it, but there is no need to do this in +new GNU programs. 'doschk' also reports file names longer than 14 +characters. + + +File: standards.info, Node: System Portability, Next: CPU Portability, Prev: Names, Up: Writing C + +5.5 Portability between System Types +==================================== + +In the Unix world, "portability" refers to porting to different Unix +versions. For a GNU program, this kind of portability is desirable, but +not paramount. + + The primary purpose of GNU software is to run on top of the GNU +kernel, compiled with the GNU C compiler, on various types of CPU. So +the kinds of portability that are absolutely necessary are quite +limited. But it is important to support Linux-based GNU systems, since +they are the form of GNU that is popular. + + Beyond that, it is good to support the other free operating systems +(*BSD), and it is nice to support other Unix-like systems if you want +to. Supporting a variety of Unix-like systems is desirable, although +not paramount. It is usually not too hard, so you may as well do it. +But you don't have to consider it an obligation, if it does turn out to +be hard. + + The easiest way to achieve portability to most Unix-like systems is +to use Autoconf. It's unlikely that your program needs to know more +information about the host platform than Autoconf can provide, simply +because most of the programs that need such knowledge have already been +written. + + Avoid using the format of semi-internal data bases (e.g., +directories) when there is a higher-level alternative ('readdir'). + + As for systems that are not like Unix, such as MSDOS, Windows, the +Macintosh, VMS, and MVS, supporting them is often a lot of work. When +that is the case, it is better to spend your time adding features that +will be useful on GNU and GNU/Linux, rather than on supporting other +incompatible systems. + + It is a good idea to define the "feature test macro" '_GNU_SOURCE' +when compiling your C files. When you compile on GNU or GNU/Linux, this +will enable the declarations of GNU library extension functions, and +that will usually give you a compiler error message if you define the +same function names in some other way in your program. (You don't have +to actually _use_ these functions, if you prefer to make the program +more portable to other systems.) + + But whether or not you use these GNU extensions, you should avoid +using their names for any other meanings. Doing so would make it hard +to move your code into other GNU programs. + + +File: standards.info, Node: CPU Portability, Next: System Functions, Prev: System Portability, Up: Writing C + +5.6 Portability between CPUs +============================ + +Even GNU systems will differ because of differences among CPU types--for +example, difference in byte ordering and alignment requirements. It is +absolutely essential to handle these differences. However, don't make +any effort to cater to the possibility that an 'int' will be less than +32 bits. We don't support 16-bit machines in GNU. + + Similarly, don't make any effort to cater to the possibility that +'long' will be smaller than predefined types like 'size_t'. For +example, the following code is ok: + + printf ("size = %lu\n", (unsigned long) sizeof array); + printf ("diff = %ld\n", (long) (pointer2 - pointer1)); + + 1989 Standard C requires this to work, and we know of only one +counterexample: 64-bit programs on Microsoft Windows IA-64. We will +leave it to those who want to port GNU programs to that environment to +figure out how to do it. + + Predefined file-size types like 'off_t' are an exception: they are +longer than 'long' on many platforms, so code like the above won't work +with them. One way to print an 'off_t' value portably is to print its +digits yourself, one by one. + + Don't assume that the address of an 'int' object is also the address +of its least-significant byte. This is false on big-endian machines. +Thus, don't make the following mistake: + + int c; + ... + while ((c = getchar()) != EOF) + write(file_descriptor, &c, 1); + + When calling functions, you need not worry about the difference +between pointers of various types, or between pointers and integers. On +most machines, there's no difference anyway. As for the few machines +where there is a difference, all of them support Standard C prototypes, +so you can use prototypes (perhaps conditionalized to be active only in +Standard C) to make the code work on those systems. + + In certain cases, it is ok to pass integer and pointer arguments +indiscriminately to the same function, and use no prototype on any +system. For example, many GNU programs have error-reporting functions +that pass their arguments along to 'printf' and friends: + + error (s, a1, a2, a3) + char *s; + char *a1, *a2, *a3; + { + fprintf (stderr, "error: "); + fprintf (stderr, s, a1, a2, a3); + } + +In practice, this works on all machines, since a pointer is generally +the widest possible kind of argument; it is much simpler than any +"correct" alternative. Be sure _not_ to use a prototype for such +functions. + + If you have decided to use Standard C, then you can instead define +'error' using 'stdarg.h', and pass the arguments along to 'vfprintf'. + + Avoid casting pointers to integers if you can. Such casts greatly +reduce portability, and in most programs they are easy to avoid. In the +cases where casting pointers to integers is essential--such as, a Lisp +interpreter which stores type information as well as an address in one +word--you'll have to make explicit provisions to handle different word +sizes. You will also need to make provision for systems in which the +normal range of addresses you can get from 'malloc' starts far away from +zero. + + +File: standards.info, Node: System Functions, Next: Internationalization, Prev: CPU Portability, Up: Writing C + +5.7 Calling System Functions +============================ + +C implementations differ substantially. Standard C reduces but does not +eliminate the incompatibilities; meanwhile, many GNU packages still +support pre-standard compilers because this is not hard to do. This +chapter gives recommendations for how to use the more-or-less standard C +library functions to avoid unnecessary loss of portability. + + * Don't use the return value of 'sprintf'. It returns the number of + characters written on some systems, but not on all systems. + + * Be aware that 'vfprintf' is not always available. + + * 'main' should be declared to return type 'int'. It should + terminate either by calling 'exit' or by returning the integer + status code; make sure it cannot ever return an undefined value. + + * Don't declare system functions explicitly. + + Almost any declaration for a system function is wrong on some + system. To minimize conflicts, leave it to the system header files + to declare system functions. If the headers don't declare a + function, let it remain undeclared. + + While it may seem unclean to use a function without declaring it, + in practice this works fine for most system library functions on + the systems where this really happens; thus, the disadvantage is + only theoretical. By contrast, actual declarations have frequently + caused actual conflicts. + + * If you must declare a system function, don't specify the argument + types. Use an old-style declaration, not a Standard C prototype. + The more you specify about the function, the more likely a + conflict. + + * In particular, don't unconditionally declare 'malloc' or 'realloc'. + + Most GNU programs use those functions just once, in functions + conventionally named 'xmalloc' and 'xrealloc'. These functions + call 'malloc' and 'realloc', respectively, and check the results. + + Because 'xmalloc' and 'xrealloc' are defined in your program, you + can declare them in other files without any risk of type conflict. + + On most systems, 'int' is the same length as a pointer; thus, the + calls to 'malloc' and 'realloc' work fine. For the few exceptional + systems (mostly 64-bit machines), you can use *conditionalized* + declarations of 'malloc' and 'realloc'--or put these declarations + in configuration files specific to those systems. + + * The string functions require special treatment. Some Unix systems + have a header file 'string.h'; others have 'strings.h'. Neither + file name is portable. There are two things you can do: use + Autoconf to figure out which file to include, or don't include + either file. + + * If you don't include either strings file, you can't get + declarations for the string functions from the header file in the + usual way. + + That causes less of a problem than you might think. The newer + standard string functions should be avoided anyway because many + systems still don't support them. The string functions you can use + are these: + + strcpy strncpy strcat strncat + strlen strcmp strncmp + strchr strrchr + + The copy and concatenate functions work fine without a declaration + as long as you don't use their values. Using their values without + a declaration fails on systems where the width of a pointer differs + from the width of 'int', and perhaps in other cases. It is trivial + to avoid using their values, so do that. + + The compare functions and 'strlen' work fine without a declaration + on most systems, possibly all the ones that GNU software runs on. + You may find it necessary to declare them *conditionally* on a few + systems. + + The search functions must be declared to return 'char *'. Luckily, + there is no variation in the data type they return. But there is + variation in their names. Some systems give these functions the + names 'index' and 'rindex'; other systems use the names 'strchr' + and 'strrchr'. Some systems support both pairs of names, but + neither pair works on all systems. + + You should pick a single pair of names and use it throughout your + program. (Nowadays, it is better to choose 'strchr' and 'strrchr' + for new programs, since those are the standard names.) Declare + both of those names as functions returning 'char *'. On systems + which don't support those names, define them as macros in terms of + the other pair. For example, here is what to put at the beginning + of your file (or in a header) if you want to use the names 'strchr' + and 'strrchr' throughout: + + #ifndef HAVE_STRCHR + #define strchr index + #endif + #ifndef HAVE_STRRCHR + #define strrchr rindex + #endif + + char *strchr (); + char *strrchr (); + + Here we assume that 'HAVE_STRCHR' and 'HAVE_STRRCHR' are macros +defined in systems where the corresponding functions exist. One way to +get them properly defined is to use Autoconf. + + +File: standards.info, Node: Internationalization, Next: Mmap, Prev: System Functions, Up: Writing C + +5.8 Internationalization +======================== + +GNU has a library called GNU gettext that makes it easy to translate the +messages in a program into various languages. You should use this +library in every program. Use English for the messages as they appear +in the program, and let gettext provide the way to translate them into +other languages. + + Using GNU gettext involves putting a call to the 'gettext' macro +around each string that might need translation--like this: + + printf (gettext ("Processing file `%s'...")); + +This permits GNU gettext to replace the string '"Processing file +`%s'..."' with a translated version. + + Once a program uses gettext, please make a point of writing calls to +'gettext' when you add new strings that call for translation. + + Using GNU gettext in a package involves specifying a "text domain +name" for the package. The text domain name is used to separate the +translations for this package from the translations for other packages. +Normally, the text domain name should be the same as the name of the +package--for example, 'fileutils' for the GNU file utilities. + + To enable gettext to work well, avoid writing code that makes +assumptions about the structure of words or sentences. When you want +the precise text of a sentence to vary depending on the data, use two or +more alternative string constants each containing a complete sentences, +rather than inserting conditionalized words or phrases into a single +sentence framework. + + Here is an example of what not to do: + + printf ("%d file%s processed", nfiles, + nfiles != 1 ? "s" : ""); + +The problem with that example is that it assumes that plurals are made +by adding 's'. If you apply gettext to the format string, like this, + + printf (gettext ("%d file%s processed"), nfiles, + nfiles != 1 ? "s" : ""); + +the message can use different words, but it will still be forced to use +'s' for the plural. Here is a better way: + + printf ((nfiles != 1 ? "%d files processed" + : "%d file processed"), + nfiles); + +This way, you can apply gettext to each of the two strings +independently: + + printf ((nfiles != 1 ? gettext ("%d files processed") + : gettext ("%d file processed")), + nfiles); + +This can be any method of forming the plural of the word for "file", and +also handles languages that require agreement in the word for +"processed". + + A similar problem appears at the level of sentence structure with +this code: + + printf ("# Implicit rule search has%s been done.\n", + f->tried_implicit ? "" : " not"); + +Adding 'gettext' calls to this code cannot give correct results for all +languages, because negation in some languages requires adding words at +more than one place in the sentence. By contrast, adding 'gettext' +calls does the job straightfowardly if the code starts out like this: + + printf (f->tried_implicit + ? "# Implicit rule search has been done.\n", + : "# Implicit rule search has not been done.\n"); + + +File: standards.info, Node: Mmap, Prev: Internationalization, Up: Writing C + +5.9 Mmap +======== + +Don't assume that 'mmap' either works on all files or fails for all +files. It may work on some files and fail on others. + + The proper way to use 'mmap' is to try it on the specific file for +which you want to use it--and if 'mmap' doesn't work, fall back on doing +the job in another way using 'read' and 'write'. + + The reason this precaution is needed is that the GNU kernel (the +HURD) provides a user-extensible file system, in which there can be many +different kinds of "ordinary files." Many of them support 'mmap', but +some do not. It is important to make programs handle all these kinds of +files. + + +File: standards.info, Node: Documentation, Next: Managing Releases, Prev: Writing C, Up: Top + +6 Documenting Programs +********************** + +A GNU program should ideally come with full free documentation, adequate +for both reference and tutorial purposes. If the package can be +programmed or extended, the documentation should cover programming or +extending it, as well as just using it. + +* Menu: + +* GNU Manuals:: Writing proper manuals. +* Doc Strings and Manuals:: Compiling doc strings doesn't make a manual. +* Manual Structure Details:: Specific structure conventions. +* License for Manuals:: Writing the distribution terms for a manual. +* Manual Credits:: Giving credit to documentation contributors. +* Printed Manuals:: Mentioning the printed manual. +* NEWS File:: NEWS files supplement manuals. +* Change Logs:: Recording Changes +* Man Pages:: Man pages are secondary. +* Reading other Manuals:: How far you can go in learning + from other manuals. + + +File: standards.info, Node: GNU Manuals, Next: Doc Strings and Manuals, Up: Documentation + +6.1 GNU Manuals +=============== + +The preferred document format for the GNU system is the Texinfo +formatting language. Every GNU package should (ideally) have +documentation in Texinfo both for reference and for learners. Texinfo +makes it possible to produce a good quality formatted book, using TeX, +and to generate an Info file. It is also possible to generate HTML +output from Texinfo source. See the Texinfo manual, either the +hardcopy, or the on-line version available through 'info' or the Emacs +Info subsystem ('C-h i'). + + Nowadays some other formats such as Docbook and Sgmltexi can be +converted automatically into Texinfo. It is ok to produce the Texinfo +documentation by conversion this way, as long as it gives good results. + + Programmers often find it most natural to structure the documentation +following the structure of the implementation, which they know. But +this structure is not necessarily good for explaining how to use the +program; it may be irrelevant and confusing for a user. + + At every level, from the sentences in a paragraph to the grouping of +topics into separate manuals, the right way to structure documentation +is according to the concepts and questions that a user will have in mind +when reading it. Sometimes this structure of ideas matches the +structure of the implementation of the software being documented--but +often they are different. Often the most important part of learning to +write good documentation is learning to notice when you are structuring +the documentation like the implementation, and think about better +alternatives. + + For example, each program in the GNU system probably ought to be +documented in one manual; but this does not mean each program should +have its own manual. That would be following the structure of the +implementation, rather than the structure that helps the user +understand. + + Instead, each manual should cover a coherent _topic_. For example, +instead of a manual for 'diff' and a manual for 'diff3', we have one +manual for "comparison of files" which covers both of those programs, as +well as 'cmp'. By documenting these programs together, we can make the +whole subject clearer. + + The manual which discusses a program should certainly document all of +the program's command-line options and all of its commands. It should +give examples of their use. But don't organize the manual as a list of +features. Instead, organize it logically, by subtopics. Address the +questions that a user will ask when thinking about the job that the +program does. + + In general, a GNU manual should serve both as tutorial and reference. +It should be set up for convenient access to each topic through Info, +and for reading straight through (appendixes aside). A GNU manual +should give a good introduction to a beginner reading through from the +start, and should also provide all the details that hackers want. The +Bison manual is a good example of this--please take a look at it to see +what we mean. + + That is not as hard as it first sounds. Arrange each chapter as a +logical breakdown of its topic, but order the sections, and write their +text, so that reading the chapter straight through makes sense. Do +likewise when structuring the book into chapters, and when structuring a +section into paragraphs. The watchword is, _at each point, address the +most fundamental and important issue raised by the preceding text._ + + If necessary, add extra chapters at the beginning of the manual which +are purely tutorial and cover the basics of the subject. These provide +the framework for a beginner to understand the rest of the manual. The +Bison manual provides a good example of how to do this. + + To serve as a reference, a manual should have an Index that list all +the functions, variables, options, and important concepts that are part +of the program. One combined Index should do for a short manual, but +sometimes for a complex package it is better to use multiple indices. +The Texinfo manual includes advice on preparing good index entries, see +*note Making Index Entries: (texinfo)Index Entries, and see *note +Defining the Entries of an Index: (texinfo)Indexing Commands. + + Don't use Unix man pages as a model for how to write GNU +documentation; most of them are terse, badly structured, and give +inadequate explanation of the underlying concepts. (There are, of +course, some exceptions.) Also, Unix man pages use a particular format +which is different from what we use in GNU manuals. + + Please include an email address in the manual for where to report +bugs _in the manual_. + + Please do not use the term "pathname" that is used in Unix +documentation; use "file name" (two words) instead. We use the term +"path" only for search paths, which are lists of directory names. + + Please do not use the term "illegal" to refer to erroneous input to a +computer program. Please use "invalid" for this, and reserve the term +"illegal" for activities punishable by law. + + +File: standards.info, Node: Doc Strings and Manuals, Next: Manual Structure Details, Prev: GNU Manuals, Up: Documentation + +6.2 Doc Strings and Manuals +=========================== + +Some programming systems, such as Emacs, provide a documentation string +for each function, command or variable. You may be tempted to write a +reference manual by compiling the documentation strings and writing a +little additional text to go around them--but you must not do it. That +approach is a fundamental mistake. The text of well-written +documentation strings will be entirely wrong for a manual. + + A documentation string needs to stand alone--when it appears on the +screen, there will be no other text to introduce or explain it. +Meanwhile, it can be rather informal in style. + + The text describing a function or variable in a manual must not stand +alone; it appears in the context of a section or subsection. Other text +at the beginning of the section should explain some of the concepts, and +should often make some general points that apply to several functions or +variables. The previous descriptions of functions and variables in the +section will also have given information about the topic. A description +written to stand alone would repeat some of that information; this +redundance looks bad. Meanwhile, the informality that is acceptable in +a documentation string is totally unacceptable in a manual. + + The only good way to use documentation strings in writing a good +manual is to use them as a source of information for writing good text. + + +File: standards.info, Node: Manual Structure Details, Next: License for Manuals, Prev: Doc Strings and Manuals, Up: Documentation + +6.3 Manual Structure Details +============================ + +The title page of the manual should state the version of the programs or +packages documented in the manual. The Top node of the manual should +also contain this information. If the manual is changing more +frequently than or independent of the program, also state a version +number for the manual in both of these places. + + Each program documented in the manual should have a node named +'PROGRAM Invocation' or 'Invoking PROGRAM'. This node (together with +its subnodes, if any) should describe the program's command line +arguments and how to run it (the sort of information people would look +in a man page for). Start with an '@example' containing a template for +all the options and arguments that the program uses. + + Alternatively, put a menu item in some menu whose item name fits one +of the above patterns. This identifies the node which that item points +to as the node for this purpose, regardless of the node's actual name. + + The '--usage' feature of the Info reader looks for such a node or +menu item in order to find the relevant text, so it is essential for +every Texinfo file to have one. + + If one manual describes several programs, it should have such a node +for each program described in the manual. + + +File: standards.info, Node: License for Manuals, Next: Manual Credits, Prev: Manual Structure Details, Up: Documentation + +6.4 License for Manuals +======================= + +Please use the GNU Free Documentation License for all GNU manuals that +are more than a few pages long. Likewise for a collection of short +documents--you only need one copy of the GNU FDL for the whole +collection. For a single short document, you can use a very permissive +non-copyleft license, to avoid taking up space with a long license. + + See <http://www.gnu.org/copyleft/fdl-howto.html> for more explanation +of how to employ the GFDL. + + Note that it is not obligatory to include a copy of the GNU GPL or +GNU LGPL in a manual whose license is neither the GPL nor the LGPL. It +can be a good idea to include the program's license in a large manual; +in a short manual, whose size would be increased considerably by +including the program's license, it is probably better not to include +it. + + +File: standards.info, Node: Manual Credits, Next: Printed Manuals, Prev: License for Manuals, Up: Documentation + +6.5 Manual Credits +================== + +Please credit the principal human writers of the manual as the authors, +on the title page of the manual. If a company sponsored the work, thank +the company in a suitable place in the manual, but do not cite the +company as an author. + + +File: standards.info, Node: Printed Manuals, Next: NEWS File, Prev: Manual Credits, Up: Documentation + +6.6 Printed Manuals +=================== + +The FSF publishes some GNU manuals in printed form. To encourage sales +of these manuals, the on-line versions of the manual should mention at +the very start that the printed manual is available and should point at +information for getting it--for instance, with a link to the page +<http://www.gnu.org/order/order.html>. This should not be included in +the printed manual, though, because there it is redundant. + + It is also useful to explain in the on-line forms of the manual how +the user can print out the manual from the sources. + + +File: standards.info, Node: NEWS File, Next: Change Logs, Prev: Printed Manuals, Up: Documentation + +6.7 The NEWS File +================= + +In addition to its manual, the package should have a file named 'NEWS' +which contains a list of user-visible changes worth mentioning. In each +new release, add items to the front of the file and identify the version +they pertain to. Don't discard old items; leave them in the file after +the newer items. This way, a user upgrading from any previous version +can see what is new. + + If the 'NEWS' file gets very long, move some of the older items into +a file named 'ONEWS' and put a note at the end referring the user to +that file. + + +File: standards.info, Node: Change Logs, Next: Man Pages, Prev: NEWS File, Up: Documentation + +6.8 Change Logs +=============== + +Keep a change log to describe all the changes made to program source +files. The purpose of this is so that people investigating bugs in the +future will know about the changes that might have introduced the bug. +Often a new bug can be found by looking at what was recently changed. +More importantly, change logs can help you eliminate conceptual +inconsistencies between different parts of a program, by giving you a +history of how the conflicting concepts arose and who they came from. + +* Menu: + +* Change Log Concepts:: +* Style of Change Logs:: +* Simple Changes:: +* Conditional Changes:: +* Indicating the Part Changed:: + + +File: standards.info, Node: Change Log Concepts, Next: Style of Change Logs, Up: Change Logs + +6.8.1 Change Log Concepts +------------------------- + +You can think of the change log as a conceptual "undo list" which +explains how earlier versions were different from the current version. +People can see the current version; they don't need the change log to +tell them what is in it. What they want from a change log is a clear +explanation of how the earlier version differed. + + The change log file is normally called 'ChangeLog' and covers an +entire directory. Each directory can have its own change log, or a +directory can use the change log of its parent directory-it's up to you. + + Another alternative is to record change log information with a +version control system such as RCS or CVS. This can be converted +automatically to a 'ChangeLog' file using 'rcs2log'; in Emacs, the +command 'C-x v a' ('vc-update-change-log') does the job. + + There's no need to describe the full purpose of the changes or how +they work together. If you think that a change calls for explanation, +you're probably right. Please do explain it--but please put the +explanation in comments in the code, where people will see it whenever +they see the code. For example, "New function" is enough for the change +log when you add a function, because there should be a comment before +the function definition to explain what it does. + + However, sometimes it is useful to write one line to describe the +overall purpose of a batch of changes. + + The easiest way to add an entry to 'ChangeLog' is with the Emacs +command 'M-x add-change-log-entry'. An entry should have an asterisk, +the name of the changed file, and then in parentheses the name of the +changed functions, variables or whatever, followed by a colon. Then +describe the changes you made to that function or variable. + + +File: standards.info, Node: Style of Change Logs, Next: Simple Changes, Prev: Change Log Concepts, Up: Change Logs + +6.8.2 Style of Change Logs +-------------------------- + +Here are some simple examples of change log entries, starting with the +header line that says who made the change and when, followed by +descriptions of specific changes. (These examples are drawn from Emacs +and GCC.) + + 1998-08-17 Richard Stallman <rms@gnu.org> + + * register.el (insert-register): Return nil. + (jump-to-register): Likewise. + + * sort.el (sort-subr): Return nil. + + * tex-mode.el (tex-bibtex-file, tex-file, tex-region): + Restart the tex shell if process is gone or stopped. + (tex-shell-running): New function. + + * expr.c (store_one_arg): Round size up for move_block_to_reg. + (expand_call): Round up when emitting USE insns. + * stmt.c (assign_parms): Round size up for move_block_from_reg. + + It's important to name the changed function or variable in full. +Don't abbreviate function or variable names, and don't combine them. +Subsequent maintainers will often search for a function name to find all +the change log entries that pertain to it; if you abbreviate the name, +they won't find it when they search. + + For example, some people are tempted to abbreviate groups of function +names by writing '* register.el ({insert,jump-to}-register)'; this is +not a good idea, since searching for 'jump-to-register' or +'insert-register' would not find that entry. + + Separate unrelated change log entries with blank lines. When two +entries represent parts of the same change, so that they work together, +then don't put blank lines between them. Then you can omit the file +name and the asterisk when successive entries are in the same file. + + Break long lists of function names by closing continued lines with +')', rather than ',', and opening the continuation with '(' as in this +example: + + * keyboard.c (menu_bar_items, tool_bar_items) + (Fexecute_extended_command): Deal with `keymap' property. + + +File: standards.info, Node: Simple Changes, Next: Conditional Changes, Prev: Style of Change Logs, Up: Change Logs + +6.8.3 Simple Changes +-------------------- + +Certain simple kinds of changes don't need much detail in the change +log. + + When you change the calling sequence of a function in a simple +fashion, and you change all the callers of the function to use the new +calling sequence, there is no need to make individual entries for all +the callers that you changed. Just write in the entry for the function +being called, "All callers changed"--like this: + + * keyboard.c (Fcommand_execute): New arg SPECIAL. + All callers changed. + + When you change just comments or doc strings, it is enough to write +an entry for the file, without mentioning the functions. Just "Doc +fixes" is enough for the change log. + + There's no need to make change log entries for documentation files. +This is because documentation is not susceptible to bugs that are hard +to fix. Documentation does not consist of parts that must interact in a +precisely engineered fashion. To correct an error, you need not know +the history of the erroneous passage; it is enough to compare what the +documentation says with the way the program actually works. + + +File: standards.info, Node: Conditional Changes, Next: Indicating the Part Changed, Prev: Simple Changes, Up: Change Logs + +6.8.4 Conditional Changes +------------------------- + +C programs often contain compile-time '#if' conditionals. Many changes +are conditional; sometimes you add a new definition which is entirely +contained in a conditional. It is very useful to indicate in the change +log the conditions for which the change applies. + + Our convention for indicating conditional changes is to use square +brackets around the name of the condition. + + Here is a simple example, describing a change which is conditional +but does not have a function or entity name associated with it: + + * xterm.c [SOLARIS2]: Include string.h. + + Here is an entry describing a new definition which is entirely +conditional. This new definition for the macro 'FRAME_WINDOW_P' is used +only when 'HAVE_X_WINDOWS' is defined: + + * frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined. + + Here is an entry for a change within the function 'init_display', +whose definition as a whole is unconditional, but the changes themselves +are contained in a '#ifdef HAVE_LIBNCURSES' conditional: + + * dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent. + + Here is an entry for a change that takes affect only when a certain +macro is _not_ defined: + + (gethostname) [!HAVE_SOCKETS]: Replace with winsock version. + + +File: standards.info, Node: Indicating the Part Changed, Prev: Conditional Changes, Up: Change Logs + +6.8.5 Indicating the Part Changed +--------------------------------- + +Indicate the part of a function which changed by using angle brackets +enclosing an indication of what the changed part does. Here is an entry +for a change in the part of the function 'sh-while-getopts' that deals +with 'sh' commands: + + * progmodes/sh-script.el (sh-while-getopts) <sh>: Handle case that + user-specified option string is empty. + + +File: standards.info, Node: Man Pages, Next: Reading other Manuals, Prev: Change Logs, Up: Documentation + +6.9 Man Pages +============= + +In the GNU project, man pages are secondary. It is not necessary or +expected for every GNU program to have a man page, but some of them do. +It's your choice whether to include a man page in your program. + + When you make this decision, consider that supporting a man page +requires continual effort each time the program is changed. The time +you spend on the man page is time taken away from more useful work. + + For a simple program which changes little, updating the man page may +be a small job. Then there is little reason not to include a man page, +if you have one. + + For a large program that changes a great deal, updating a man page +may be a substantial burden. If a user offers to donate a man page, you +may find this gift costly to accept. It may be better to refuse the man +page unless the same person agrees to take full responsibility for +maintaining it--so that you can wash your hands of it entirely. If this +volunteer later ceases to do the job, then don't feel obliged to pick it +up yourself; it may be better to withdraw the man page from the +distribution until someone else agrees to update it. + + When a program changes only a little, you may feel that the +discrepancies are small enough that the man page remains useful without +updating. If so, put a prominent note near the beginning of the man +page explaining that you don't maintain it and that the Texinfo manual +is more authoritative. The note should say how to access the Texinfo +documentation. + + +File: standards.info, Node: Reading other Manuals, Prev: Man Pages, Up: Documentation + +6.10 Reading other Manuals +========================== + +There may be non-free books or documentation files that describe the +program you are documenting. + + It is ok to use these documents for reference, just as the author of +a new algebra textbook can read other books on algebra. A large portion +of any non-fiction book consists of facts, in this case facts about how +a certain program works, and these facts are necessarily the same for +everyone who writes about the subject. But be careful not to copy your +outline structure, wording, tables or examples from preexisting non-free +documentation. Copying from free documentation may be ok; please check +with the FSF about the individual case. + + +File: standards.info, Node: Managing Releases, Next: References, Prev: Documentation, Up: Top + +7 The Release Process +********************* + +Making a release is more than just bundling up your source files in a +tar file and putting it up for FTP. You should set up your software so +that it can be configured to run on a variety of systems. Your Makefile +should conform to the GNU standards described below, and your directory +layout should also conform to the standards discussed below. Doing so +makes it easy to include your package into the larger framework of all +GNU software. + +* Menu: + +* Configuration:: How Configuration Should Work +* Makefile Conventions:: Makefile Conventions +* Releases:: Making Releases + + +File: standards.info, Node: Configuration, Next: Makefile Conventions, Up: Managing Releases + +7.1 How Configuration Should Work +================================= + +Each GNU distribution should come with a shell script named 'configure'. +This script is given arguments which describe the kind of machine and +system you want to compile the program for. + + The 'configure' script must record the configuration options so that +they affect compilation. + + One way to do this is to make a link from a standard name such as +'config.h' to the proper configuration file for the chosen system. If +you use this technique, the distribution should _not_ contain a file +named 'config.h'. This is so that people won't be able to build the +program without configuring it first. + + Another thing that 'configure' can do is to edit the Makefile. If +you do this, the distribution should _not_ contain a file named +'Makefile'. Instead, it should include a file 'Makefile.in' which +contains the input used for editing. Once again, this is so that people +won't be able to build the program without configuring it first. + + If 'configure' does write the 'Makefile', then 'Makefile' should have +a target named 'Makefile' which causes 'configure' to be rerun, setting +up the same configuration that was set up last time. The files that +'configure' reads should be listed as dependencies of 'Makefile'. + + All the files which are output from the 'configure' script should +have comments at the beginning explaining that they were generated +automatically using 'configure'. This is so that users won't think of +trying to edit them by hand. + + The 'configure' script should write a file named 'config.status' +which describes which configuration options were specified when the +program was last configured. This file should be a shell script which, +if run, will recreate the same configuration. + + The 'configure' script should accept an option of the form +'--srcdir=DIRNAME' to specify the directory where sources are found (if +it is not the current directory). This makes it possible to build the +program in a separate directory, so that the actual source directory is +not modified. + + If the user does not specify '--srcdir', then 'configure' should +check both '.' and '..' to see if it can find the sources. If it finds +the sources in one of these places, it should use them from there. +Otherwise, it should report that it cannot find the sources, and should +exit with nonzero status. + + Usually the easy way to support '--srcdir' is by editing a definition +of 'VPATH' into the Makefile. Some rules may need to refer explicitly +to the specified source directory. To make this possible, 'configure' +can add to the Makefile a variable named 'srcdir' whose value is +precisely the specified directory. + + The 'configure' script should also take an argument which specifies +the type of system to build the program for. This argument should look +like this: + + CPU-COMPANY-SYSTEM + + For example, a Sun 3 might be 'm68k-sun-sunos4.1'. + + The 'configure' script needs to be able to decode all plausible +alternatives for how to describe a machine. Thus, 'sun3-sunos4.1' would +be a valid alias. For many programs, 'vax-dec-ultrix' would be an alias +for 'vax-dec-bsd', simply because the differences between Ultrix and BSD +are rarely noticeable, but a few programs might need to distinguish +them. + + There is a shell script called 'config.sub' that you can use as a +subroutine to validate system types and canonicalize aliases. + + Other options are permitted to specify in more detail the software or +hardware present on the machine, and include or exclude optional parts +of the package: + +'--enable-FEATURE[=PARAMETER]' + Configure the package to build and install an optional user-level + facility called FEATURE. This allows users to choose which + optional features to include. Giving an optional PARAMETER of 'no' + should omit FEATURE, if it is built by default. + + No '--enable' option should *ever* cause one feature to replace + another. No '--enable' option should ever substitute one useful + behavior for another useful behavior. The only proper use for + '--enable' is for questions of whether to build part of the program + or exclude it. + +'--with-PACKAGE' + The package PACKAGE will be installed, so configure this package to + work with PACKAGE. + + Possible values of PACKAGE include 'gnu-as' (or 'gas'), 'gnu-ld', + 'gnu-libc', 'gdb', 'x', and 'x-toolkit'. + + Do not use a '--with' option to specify the file name to use to + find certain files. That is outside the scope of what '--with' + options are for. + + All 'configure' scripts should accept all of these "detail" options, +whether or not they make any difference to the particular package at +hand. In particular, they should accept any option that starts with +'--with-' or '--enable-'. This is so users will be able to configure an +entire GNU source tree at once with a single set of options. + + You will note that the categories '--with-' and '--enable-' are +narrow: they *do not* provide a place for any sort of option you might +think of. That is deliberate. We want to limit the possible +configuration options in GNU software. We do not want GNU programs to +have idiosyncratic configuration options. + + Packages that perform part of the compilation process may support +cross-compilation. In such a case, the host and target machines for the +program may be different. + + The 'configure' script should normally treat the specified type of +system as both the host and the target, thus producing a program which +works for the same type of machine that it runs on. + + To configure a cross-compiler, cross-assembler, or what have you, you +should specify a target different from the host, using the configure +option '--target=TARGETTYPE'. The syntax for TARGETTYPE is the same as +for the host type. So the command would look like this: + + ./configure HOSTTYPE --target=TARGETTYPE + + Programs for which cross-operation is not meaningful need not accept +the '--target' option, because configuring an entire operating system +for cross-operation is not a meaningful operation. + + Bootstrapping a cross-compiler requires compiling it on a machine +other than the host it will run on. Compilation packages accept a +configuration option '--build=BUILDTYPE' for specifying the +configuration on which you will compile them, but the configure script +should normally guess the build machine type (using 'config.guess'), so +this option is probably not necessary. The host and target types +normally default from the build type, so in bootstrapping a +cross-compiler you must specify them both explicitly. + + Some programs have ways of configuring themselves automatically. If +your program is set up to do this, your 'configure' script can simply +ignore most of its arguments. + + +File: standards.info, Node: Makefile Conventions, Next: Releases, Prev: Configuration, Up: Managing Releases + +7.2 Makefile Conventions +======================== + +This node describes conventions for writing the Makefiles for GNU +programs. Using Automake will help you write a Makefile that follows +these conventions. + +* Menu: + +* Makefile Basics:: General Conventions for Makefiles +* Utilities in Makefiles:: Utilities in Makefiles +* Command Variables:: Variables for Specifying Commands +* Directory Variables:: Variables for Installation Directories +* Standard Targets:: Standard Targets for Users +* Install Command Categories:: Three categories of commands in the 'install' + rule: normal, pre-install and post-install. + + +File: standards.info, Node: Makefile Basics, Next: Utilities in Makefiles, Up: Makefile Conventions + +7.2.1 General Conventions for Makefiles +--------------------------------------- + +Every Makefile should contain this line: + + SHELL = /bin/sh + +to avoid trouble on systems where the 'SHELL' variable might be +inherited from the environment. (This is never a problem with GNU +'make'.) + + Different 'make' programs have incompatible suffix lists and implicit +rules, and this sometimes creates confusion or misbehavior. So it is a +good idea to set the suffix list explicitly using only the suffixes you +need in the particular Makefile, like this: + + .SUFFIXES: + .SUFFIXES: .c .o + +The first line clears out the suffix list, the second introduces all +suffixes which may be subject to implicit rules in this Makefile. + + Don't assume that '.' is in the path for command execution. When you +need to run programs that are a part of your package during the make, +please make sure that it uses './' if the program is built as part of +the make or '$(srcdir)/' if the file is an unchanging part of the source +code. Without one of these prefixes, the current search path is used. + + The distinction between './' (the "build directory") and '$(srcdir)/' +(the "source directory") is important because users can build in a +separate directory using the '--srcdir' option to 'configure'. A rule +of the form: + + foo.1 : foo.man sedscript + sed -e sedscript foo.man > foo.1 + +will fail when the build directory is not the source directory, because +'foo.man' and 'sedscript' are in the source directory. + + When using GNU 'make', relying on 'VPATH' to find the source file +will work in the case where there is a single dependency file, since the +'make' automatic variable '$<' will represent the source file wherever +it is. (Many versions of 'make' set '$<' only in implicit rules.) A +Makefile target like + + foo.o : bar.c + $(CC) -I. -I$(srcdir) $(CFLAGS) -c bar.c -o foo.o + +should instead be written as + + foo.o : bar.c + $(CC) -I. -I$(srcdir) $(CFLAGS) -c $< -o $@ + +in order to allow 'VPATH' to work correctly. When the target has +multiple dependencies, using an explicit '$(srcdir)' is the easiest way +to make the rule work well. For example, the target above for 'foo.1' +is best written as: + + foo.1 : foo.man sedscript + sed -e $(srcdir)/sedscript $(srcdir)/foo.man > $@ + + GNU distributions usually contain some files which are not source +files--for example, Info files, and the output from Autoconf, Automake, +Bison or Flex. Since these files normally appear in the source +directory, they should always appear in the source directory, not in the +build directory. So Makefile rules to update them should put the +updated files in the source directory. + + However, if a file does not appear in the distribution, then the +Makefile should not put it in the source directory, because building a +program in ordinary circumstances should not modify the source directory +in any way. + + Try to make the build and installation targets, at least (and all +their subtargets) work correctly with a parallel 'make'. + + +File: standards.info, Node: Utilities in Makefiles, Next: Command Variables, Prev: Makefile Basics, Up: Makefile Conventions + +7.2.2 Utilities in Makefiles +---------------------------- + +Write the Makefile commands (and any shell scripts, such as 'configure') +to run in 'sh', not in 'csh'. Don't use any special features of 'ksh' +or 'bash'. + + The 'configure' script and the Makefile rules for building and +installation should not use any utilities directly except these: + + cat cmp cp diff echo egrep expr false grep install-info + ln ls mkdir mv pwd rm rmdir sed sleep sort tar test touch true + + The compression program 'gzip' can be used in the 'dist' rule. + + Stick to the generally supported options for these programs. For +example, don't use 'mkdir -p', convenient as it may be, because most +systems don't support it. + + It is a good idea to avoid creating symbolic links in makefiles, +since a few systems don't support them. + + The Makefile rules for building and installation can also use +compilers and related programs, but should do so via 'make' variables so +that the user can substitute alternatives. Here are some of the +programs we mean: + + ar bison cc flex install ld ldconfig lex + make makeinfo ranlib texi2dvi yacc + + Use the following 'make' variables to run those programs: + + $(AR) $(BISON) $(CC) $(FLEX) $(INSTALL) $(LD) $(LDCONFIG) $(LEX) + $(MAKE) $(MAKEINFO) $(RANLIB) $(TEXI2DVI) $(YACC) + + When you use 'ranlib' or 'ldconfig', you should make sure nothing bad +happens if the system does not have the program in question. Arrange to +ignore an error from that command, and print a message before the +command to tell the user that failure of this command does not mean a +problem. (The Autoconf 'AC_PROG_RANLIB' macro can help with this.) + + If you use symbolic links, you should implement a fallback for +systems that don't have symbolic links. + + Additional utilities that can be used via Make variables are: + + chgrp chmod chown mknod + + It is ok to use other utilities in Makefile portions (or scripts) +intended only for particular systems where you know those utilities +exist. + + +File: standards.info, Node: Command Variables, Next: Directory Variables, Prev: Utilities in Makefiles, Up: Makefile Conventions + +7.2.3 Variables for Specifying Commands +--------------------------------------- + +Makefiles should provide variables for overriding certain commands, +options, and so on. + + In particular, you should run most utility programs via variables. +Thus, if you use Bison, have a variable named 'BISON' whose default +value is set with 'BISON = bison', and refer to it with '$(BISON)' +whenever you need to use Bison. + + File management utilities such as 'ln', 'rm', 'mv', and so on, need +not be referred to through variables in this way, since users don't need +to replace them with other programs. + + Each program-name variable should come with an options variable that +is used to supply options to the program. Append 'FLAGS' to the +program-name variable name to get the options variable name--for +example, 'BISONFLAGS'. (The names 'CFLAGS' for the C compiler, 'YFLAGS' +for yacc, and 'LFLAGS' for lex, are exceptions to this rule, but we keep +them because they are standard.) Use 'CPPFLAGS' in any compilation +command that runs the preprocessor, and use 'LDFLAGS' in any compilation +command that does linking as well as in any direct use of 'ld'. + + If there are C compiler options that _must_ be used for proper +compilation of certain files, do not include them in 'CFLAGS'. Users +expect to be able to specify 'CFLAGS' freely themselves. Instead, +arrange to pass the necessary options to the C compiler independently of +'CFLAGS', by writing them explicitly in the compilation commands or by +defining an implicit rule, like this: + + CFLAGS = -g + ALL_CFLAGS = -I. $(CFLAGS) + .c.o: + $(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $< + + Do include the '-g' option in 'CFLAGS', because that is not +_required_ for proper compilation. You can consider it a default that +is only recommended. If the package is set up so that it is compiled +with GCC by default, then you might as well include '-O' in the default +value of 'CFLAGS' as well. + + Put 'CFLAGS' last in the compilation command, after other variables +containing compiler options, so the user can use 'CFLAGS' to override +the others. + + 'CFLAGS' should be used in every invocation of the C compiler, both +those which do compilation and those which do linking. + + Every Makefile should define the variable 'INSTALL', which is the +basic command for installing a file into the system. + + Every Makefile should also define the variables 'INSTALL_PROGRAM' and +'INSTALL_DATA'. (The default for 'INSTALL_PROGRAM' should be +'$(INSTALL)'; the default for 'INSTALL_DATA' should be '${INSTALL} -m +644'.) Then it should use those variables as the commands for actual +installation, for executables and nonexecutables respectively. Use +these variables as follows: + + $(INSTALL_PROGRAM) foo $(bindir)/foo + $(INSTALL_DATA) libfoo.a $(libdir)/libfoo.a + + Optionally, you may prepend the value of 'DESTDIR' to the target +filename. Doing this allows the installer to create a snapshot of the +installation to be copied onto the real target filesystem later. Do not +set the value of 'DESTDIR' in your Makefile, and do not include it in +any installed files. With support for 'DESTDIR', the above examples +become: + + $(INSTALL_PROGRAM) foo $(DESTDIR)$(bindir)/foo + $(INSTALL_DATA) libfoo.a $(DESTDIR)$(libdir)/libfoo.a + +Always use a file name, not a directory name, as the second argument of +the installation commands. Use a separate command for each file to be +installed. + + +File: standards.info, Node: Directory Variables, Next: Standard Targets, Prev: Command Variables, Up: Makefile Conventions + +7.2.4 Variables for Installation Directories +-------------------------------------------- + +Installation directories should always be named by variables, so it is +easy to install in a nonstandard place. The standard names for these +variables are described below. They are based on a standard filesystem +layout; variants of it are used in SVR4, 4.4BSD, GNU/Linux, Ultrix v4, +and other modern operating systems. + + These two variables set the root for the installation. All the other +installation directories should be subdirectories of one of these two, +and nothing should be directly installed into these two directories. + +'prefix' + A prefix used in constructing the default values of the variables + listed below. The default value of 'prefix' should be + '/usr/local'. When building the complete GNU system, the prefix + will be empty and '/usr' will be a symbolic link to '/'. (If you + are using Autoconf, write it as '@prefix@'.) + + Running 'make install' with a different value of 'prefix' from the + one used to build the program should _not_ recompile the program. + +'exec_prefix' + A prefix used in constructing the default values of some of the + variables listed below. The default value of 'exec_prefix' should + be '$(prefix)'. (If you are using Autoconf, write it as + '@exec_prefix@'.) + + Generally, '$(exec_prefix)' is used for directories that contain + machine-specific files (such as executables and subroutine + libraries), while '$(prefix)' is used directly for other + directories. + + Running 'make install' with a different value of 'exec_prefix' from + the one used to build the program should _not_ recompile the + program. + + Executable programs are installed in one of the following +directories. + +'bindir' + The directory for installing executable programs that users can + run. This should normally be '/usr/local/bin', but write it as + '$(exec_prefix)/bin'. (If you are using Autoconf, write it as + '@bindir@'.) + +'sbindir' + The directory for installing executable programs that can be run + from the shell, but are only generally useful to system + administrators. This should normally be '/usr/local/sbin', but + write it as '$(exec_prefix)/sbin'. (If you are using Autoconf, + write it as '@sbindir@'.) + +'libexecdir' + The directory for installing executable programs to be run by other + programs rather than by users. This directory should normally be + '/usr/local/libexec', but write it as '$(exec_prefix)/libexec'. + (If you are using Autoconf, write it as '@libexecdir@'.) + + Data files used by the program during its execution are divided into +categories in two ways. + + * Some files are normally modified by programs; others are never + normally modified (though users may edit some of these). + + * Some files are architecture-independent and can be shared by all + machines at a site; some are architecture-dependent and can be + shared only by machines of the same kind and operating system; + others may never be shared between two machines. + + This makes for six different possibilities. However, we want to +discourage the use of architecture-dependent files, aside from object +files and libraries. It is much cleaner to make other data files +architecture-independent, and it is generally not hard. + + Therefore, here are the variables Makefiles should use to specify +directories: + +'datadir' + The directory for installing read-only architecture independent + data files. This should normally be '/usr/local/share', but write + it as '$(prefix)/share'. (If you are using Autoconf, write it as + '@datadir@'.) As a special exception, see '$(infodir)' and + '$(includedir)' below. + +'sysconfdir' + The directory for installing read-only data files that pertain to a + single machine-that is to say, files for configuring a host. + Mailer and network configuration files, '/etc/passwd', and so forth + belong here. All the files in this directory should be ordinary + ASCII text files. This directory should normally be + '/usr/local/etc', but write it as '$(prefix)/etc'. (If you are + using Autoconf, write it as '@sysconfdir@'.) + + Do not install executables here in this directory (they probably + belong in '$(libexecdir)' or '$(sbindir)'). Also do not install + files that are modified in the normal course of their use (programs + whose purpose is to change the configuration of the system + excluded). Those probably belong in '$(localstatedir)'. + +'sharedstatedir' + The directory for installing architecture-independent data files + which the programs modify while they run. This should normally be + '/usr/local/com', but write it as '$(prefix)/com'. (If you are + using Autoconf, write it as '@sharedstatedir@'.) + +'localstatedir' + The directory for installing data files which the programs modify + while they run, and that pertain to one specific machine. Users + should never need to modify files in this directory to configure + the package's operation; put such configuration information in + separate files that go in '$(datadir)' or '$(sysconfdir)'. + '$(localstatedir)' should normally be '/usr/local/var', but write + it as '$(prefix)/var'. (If you are using Autoconf, write it as + '@localstatedir@'.) + +'libdir' + The directory for object files and libraries of object code. Do + not install executables here, they probably ought to go in + '$(libexecdir)' instead. The value of 'libdir' should normally be + '/usr/local/lib', but write it as '$(exec_prefix)/lib'. (If you + are using Autoconf, write it as '@libdir@'.) + +'infodir' + The directory for installing the Info files for this package. By + default, it should be '/usr/local/info', but it should be written + as '$(prefix)/info'. (If you are using Autoconf, write it as + '@infodir@'.) + +'lispdir' + The directory for installing any Emacs Lisp files in this package. + By default, it should be '/usr/local/share/emacs/site-lisp', but it + should be written as '$(prefix)/share/emacs/site-lisp'. + + If you are using Autoconf, write the default as '@lispdir@'. In + order to make '@lispdir@' work, you need the following lines in + your 'configure.in' file: + + lispdir='${datadir}/emacs/site-lisp' + AC_SUBST(lispdir) + +'includedir' + The directory for installing header files to be included by user + programs with the C '#include' preprocessor directive. This should + normally be '/usr/local/include', but write it as + '$(prefix)/include'. (If you are using Autoconf, write it as + '@includedir@'.) + + Most compilers other than GCC do not look for header files in + directory '/usr/local/include'. So installing the header files + this way is only useful with GCC. Sometimes this is not a problem + because some libraries are only really intended to work with GCC. + But some libraries are intended to work with other compilers. They + should install their header files in two places, one specified by + 'includedir' and one specified by 'oldincludedir'. + +'oldincludedir' + The directory for installing '#include' header files for use with + compilers other than GCC. This should normally be '/usr/include'. + (If you are using Autoconf, you can write it as '@oldincludedir@'.) + + The Makefile commands should check whether the value of + 'oldincludedir' is empty. If it is, they should not try to use it; + they should cancel the second installation of the header files. + + A package should not replace an existing header in this directory + unless the header came from the same package. Thus, if your Foo + package provides a header file 'foo.h', then it should install the + header file in the 'oldincludedir' directory if either (1) there is + no 'foo.h' there or (2) the 'foo.h' that exists came from the Foo + package. + + To tell whether 'foo.h' came from the Foo package, put a magic + string in the file--part of a comment--and 'grep' for that string. + + Unix-style man pages are installed in one of the following: + +'mandir' + The top-level directory for installing the man pages (if any) for + this package. It will normally be '/usr/local/man', but you should + write it as '$(prefix)/man'. (If you are using Autoconf, write it + as '@mandir@'.) + +'man1dir' + The directory for installing section 1 man pages. Write it as + '$(mandir)/man1'. +'man2dir' + The directory for installing section 2 man pages. Write it as + '$(mandir)/man2' +'...' + + *Don't make the primary documentation for any GNU software be a man + page. Write a manual in Texinfo instead. Man pages are just for + the sake of people running GNU software on Unix, which is a + secondary application only.* + +'manext' + The file name extension for the installed man page. This should + contain a period followed by the appropriate digit; it should + normally be '.1'. + +'man1ext' + The file name extension for installed section 1 man pages. +'man2ext' + The file name extension for installed section 2 man pages. +'...' + Use these names instead of 'manext' if the package needs to install + man pages in more than one section of the manual. + + And finally, you should set the following variable: + +'srcdir' + The directory for the sources being compiled. The value of this + variable is normally inserted by the 'configure' shell script. (If + you are using Autconf, use 'srcdir = @srcdir@'.) + + For example: + + # Common prefix for installation directories. + # NOTE: This directory must exist when you start the install. + prefix = /usr/local + exec_prefix = $(prefix) + # Where to put the executable for the command `gcc'. + bindir = $(exec_prefix)/bin + # Where to put the directories used by the compiler. + libexecdir = $(exec_prefix)/libexec + # Where to put the Info files. + infodir = $(prefix)/info + + If your program installs a large number of files into one of the +standard user-specified directories, it might be useful to group them +into a subdirectory particular to that program. If you do this, you +should write the 'install' rule to create these subdirectories. + + Do not expect the user to include the subdirectory name in the value +of any of the variables listed above. The idea of having a uniform set +of variable names for installation directories is to enable the user to +specify the exact same values for several different GNU packages. In +order for this to be useful, all the packages must be designed so that +they will work sensibly when the user does so. + + +File: standards.info, Node: Standard Targets, Next: Install Command Categories, Prev: Directory Variables, Up: Makefile Conventions + +7.2.5 Standard Targets for Users +-------------------------------- + +All GNU programs should have the following targets in their Makefiles: + +'all' + Compile the entire program. This should be the default target. + This target need not rebuild any documentation files; Info files + should normally be included in the distribution, and DVI files + should be made only when explicitly asked for. + + By default, the Make rules should compile and link with '-g', so + that executable programs have debugging symbols. Users who don't + mind being helpless can strip the executables later if they wish. + +'install' + Compile the program and copy the executables, libraries, and so on + to the file names where they should reside for actual use. If + there is a simple test to verify that a program is properly + installed, this target should run that test. + + Do not strip executables when installing them. Devil-may-care + users can use the 'install-strip' target to do that. + + If possible, write the 'install' target rule so that it does not + modify anything in the directory where the program was built, + provided 'make all' has just been done. This is convenient for + building the program under one user name and installing it under + another. + + The commands should create all the directories in which files are + to be installed, if they don't already exist. This includes the + directories specified as the values of the variables 'prefix' and + 'exec_prefix', as well as all subdirectories that are needed. One + way to do this is by means of an 'installdirs' target as described + below. + + Use '-' before any command for installing a man page, so that + 'make' will ignore any errors. This is in case there are systems + that don't have the Unix man page documentation system installed. + + The way to install Info files is to copy them into '$(infodir)' + with '$(INSTALL_DATA)' (*note Command Variables::), and then run + the 'install-info' program if it is present. 'install-info' is a + program that edits the Info 'dir' file to add or update the menu + entry for the given Info file; it is part of the Texinfo package. + Here is a sample rule to install an Info file: + + $(DESTDIR)$(infodir)/foo.info: foo.info + $(POST_INSTALL) + # There may be a newer info file in . than in srcdir. + -if test -f foo.info; then d=.; \ + else d=$(srcdir); fi; \ + $(INSTALL_DATA) $$d/foo.info $(DESTDIR)$@; \ + # Run install-info only if it exists. + # Use `if' instead of just prepending `-' to the + # line so we notice real errors from install-info. + # We use `$(SHELL) -c' because some shells do not + # fail gracefully when there is an unknown command. + if $(SHELL) -c 'install-info --version' \ + >/dev/null 2>&1; then \ + install-info --dir-file=$(DESTDIR)$(infodir)/dir \ + $(DESTDIR)$(infodir)/foo.info; \ + else true; fi + + When writing the 'install' target, you must classify all the + commands into three categories: normal ones, "pre-installation" + commands and "post-installation" commands. *Note Install Command + Categories::. + +'uninstall' + Delete all the installed files--the copies that the 'install' + target creates. + + This rule should not modify the directories where compilation is + done, only the directories where files are installed. + + The uninstallation commands are divided into three categories, just + like the installation commands. *Note Install Command + Categories::. + +'install-strip' + Like 'install', but strip the executable files while installing + them. In simple cases, this target can use the 'install' target in + a simple way: + + install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ + install + + But if the package installs scripts as well as real executables, + the 'install-strip' target can't just refer to the 'install' + target; it has to strip the executables but not the scripts. + + 'install-strip' should not strip the executables in the build + directory which are being copied for installation. It should only + strip the copies that are installed. + + Normally we do not recommend stripping an executable unless you are + sure the program has no bugs. However, it can be reasonable to + install a stripped executable for actual execution while saving the + unstripped executable elsewhere in case there is a bug. + +'clean' + + Delete all files from the current directory that are normally + created by building the program. Don't delete the files that + record the configuration. Also preserve files that could be made + by building, but normally aren't because the distribution comes + with them. + + Delete '.dvi' files here if they are not part of the distribution. + +'distclean' + Delete all files from the current directory that are created by + configuring or building the program. If you have unpacked the + source and built the program without creating any other files, + 'make distclean' should leave only the files that were in the + distribution. + +'mostlyclean' + Like 'clean', but may refrain from deleting a few files that people + normally don't want to recompile. For example, the 'mostlyclean' + target for GCC does not delete 'libgcc.a', because recompiling it + is rarely necessary and takes a lot of time. + +'maintainer-clean' + Delete almost everything from the current directory that can be + reconstructed with this Makefile. This typically includes + everything deleted by 'distclean', plus more: C source files + produced by Bison, tags tables, Info files, and so on. + + The reason we say "almost everything" is that running the command + 'make maintainer-clean' should not delete 'configure' even if + 'configure' can be remade using a rule in the Makefile. More + generally, 'make maintainer-clean' should not delete anything that + needs to exist in order to run 'configure' and then begin to build + the program. This is the only exception; 'maintainer-clean' should + delete everything else that can be rebuilt. + + The 'maintainer-clean' target is intended to be used by a + maintainer of the package, not by ordinary users. You may need + special tools to reconstruct some of the files that 'make + maintainer-clean' deletes. Since these files are normally included + in the distribution, we don't take care to make them easy to + reconstruct. If you find you need to unpack the full distribution + again, don't blame us. + + To help make users aware of this, the commands for the special + 'maintainer-clean' target should start with these two: + + @echo 'This command is intended for maintainers to use; it' + @echo 'deletes files that may need special tools to rebuild.' + +'TAGS' + Update a tags table for this program. + +'info' + Generate any Info files needed. The best way to write the rules is + as follows: + + info: foo.info + + foo.info: foo.texi chap1.texi chap2.texi + $(MAKEINFO) $(srcdir)/foo.texi + + You must define the variable 'MAKEINFO' in the Makefile. It should + run the 'makeinfo' program, which is part of the Texinfo + distribution. + + Normally a GNU distribution comes with Info files, and that means + the Info files are present in the source directory. Therefore, the + Make rule for an info file should update it in the source + directory. When users build the package, ordinarily Make will not + update the Info files because they will already be up to date. + +'dvi' + Generate DVI files for all Texinfo documentation. For example: + + dvi: foo.dvi + + foo.dvi: foo.texi chap1.texi chap2.texi + $(TEXI2DVI) $(srcdir)/foo.texi + + You must define the variable 'TEXI2DVI' in the Makefile. It should + run the program 'texi2dvi', which is part of the Texinfo + distribution.(1) Alternatively, write just the dependencies, and + allow GNU 'make' to provide the command. + +'dist' + Create a distribution tar file for this program. The tar file + should be set up so that the file names in the tar file start with + a subdirectory name which is the name of the package it is a + distribution for. This name can include the version number. + + For example, the distribution tar file of GCC version 1.40 unpacks + into a subdirectory named 'gcc-1.40'. + + The easiest way to do this is to create a subdirectory + appropriately named, use 'ln' or 'cp' to install the proper files + in it, and then 'tar' that subdirectory. + + Compress the tar file with 'gzip'. For example, the actual + distribution file for GCC version 1.40 is called 'gcc-1.40.tar.gz'. + + The 'dist' target should explicitly depend on all non-source files + that are in the distribution, to make sure they are up to date in + the distribution. *Note Making Releases: Releases. + +'check' + Perform self-tests (if any). The user must build the program + before running the tests, but need not install the program; you + should write the self-tests so that they work when the program is + built but not installed. + + The following targets are suggested as conventional names, for +programs in which they are useful. + +'installcheck' + Perform installation tests (if any). The user must build and + install the program before running the tests. You should not + assume that '$(bindir)' is in the search path. + +'installdirs' + It's useful to add a target named 'installdirs' to create the + directories where files are installed, and their parent + directories. There is a script called 'mkinstalldirs' which is + convenient for this; you can find it in the Texinfo package. You + can use a rule like this: + + # Make sure all installation directories (e.g. $(bindir)) + # actually exist by making them if necessary. + installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs $(bindir) $(datadir) \ + $(libdir) $(infodir) \ + $(mandir) + + or, if you wish to support 'DESTDIR', + + # Make sure all installation directories (e.g. $(bindir)) + # actually exist by making them if necessary. + installdirs: mkinstalldirs + $(srcdir)/mkinstalldirs \ + $(DESTDIR)$(bindir) $(DESTDIR)$(datadir) \ + $(DESTDIR)$(libdir) $(DESTDIR)$(infodir) \ + $(DESTDIR)$(mandir) + + This rule should not modify the directories where compilation is + done. It should do nothing but create installation directories. + + ---------- Footnotes ---------- + + (1) 'texi2dvi' uses TeX to do the real work of formatting. TeX is +not distributed with Texinfo. + + +File: standards.info, Node: Install Command Categories, Prev: Standard Targets, Up: Makefile Conventions + +7.2.6 Install Command Categories +-------------------------------- + +When writing the 'install' target, you must classify all the commands +into three categories: normal ones, "pre-installation" commands and +"post-installation" commands. + + Normal commands move files into their proper places, and set their +modes. They may not alter any files except the ones that come entirely +from the package they belong to. + + Pre-installation and post-installation commands may alter other +files; in particular, they can edit global configuration files or data +bases. + + Pre-installation commands are typically executed before the normal +commands, and post-installation commands are typically run after the +normal commands. + + The most common use for a post-installation command is to run +'install-info'. This cannot be done with a normal command, since it +alters a file (the Info directory) which does not come entirely and +solely from the package being installed. It is a post-installation +command because it needs to be done after the normal command which +installs the package's Info files. + + Most programs don't need any pre-installation commands, but we have +the feature just in case it is needed. + + To classify the commands in the 'install' rule into these three +categories, insert "category lines" among them. A category line +specifies the category for the commands that follow. + + A category line consists of a tab and a reference to a special Make +variable, plus an optional comment at the end. There are three +variables you can use, one for each category; the variable name +specifies the category. Category lines are no-ops in ordinary execution +because these three Make variables are normally undefined (and you +_should not_ define them in the makefile). + + Here are the three possible category lines, each with a comment that +explains what it means: + + $(PRE_INSTALL) # Pre-install commands follow. + $(POST_INSTALL) # Post-install commands follow. + $(NORMAL_INSTALL) # Normal commands follow. + + If you don't use a category line at the beginning of the 'install' +rule, all the commands are classified as normal until the first category +line. If you don't use any category lines, all the commands are +classified as normal. + + These are the category lines for 'uninstall': + + $(PRE_UNINSTALL) # Pre-uninstall commands follow. + $(POST_UNINSTALL) # Post-uninstall commands follow. + $(NORMAL_UNINSTALL) # Normal commands follow. + + Typically, a pre-uninstall command would be used for deleting entries +from the Info directory. + + If the 'install' or 'uninstall' target has any dependencies which act +as subroutines of installation, then you should start _each_ +dependency's commands with a category line, and start the main target's +commands with a category line also. This way, you can ensure that each +command is placed in the right category regardless of which of the +dependencies actually run. + + Pre-installation and post-installation commands should not run any +programs except for these: + + [ basename bash cat chgrp chmod chown cmp cp dd diff echo + egrep expand expr false fgrep find getopt grep gunzip gzip + hostname install install-info kill ldconfig ln ls md5sum + mkdir mkfifo mknod mv printenv pwd rm rmdir sed sort tee + test touch true uname xargs yes + + The reason for distinguishing the commands in this way is for the +sake of making binary packages. Typically a binary package contains all +the executables and other files that need to be installed, and has its +own method of installing them--so it does not need to run the normal +installation commands. But installing the binary package does need to +execute the pre-installation and post-installation commands. + + Programs to build binary packages work by extracting the +pre-installation and post-installation commands. Here is one way of +extracting the pre-installation commands: + + make -n install -o all \ + PRE_INSTALL=pre-install \ + POST_INSTALL=post-install \ + NORMAL_INSTALL=normal-install \ + | gawk -f pre-install.awk + +where the file 'pre-install.awk' could contain this: + + $0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ {on = 0} + on {print $0} + $0 ~ /^\t[ \t]*pre_install[ \t]*$/ {on = 1} + + The resulting file of pre-installation commands is executed as a +shell script as part of installing the binary package. + + +File: standards.info, Node: Releases, Prev: Makefile Conventions, Up: Managing Releases + +7.3 Making Releases +=================== + +Package the distribution of 'Foo version 69.96' up in a gzipped tar file +with the name 'foo-69.96.tar.gz'. It should unpack into a subdirectory +named 'foo-69.96'. + + Building and installing the program should never modify any of the +files contained in the distribution. This means that all the files that +form part of the program in any way must be classified into "source +files" and "non-source files". Source files are written by humans and +never changed automatically; non-source files are produced from source +files by programs under the control of the Makefile. + + The distribution should contain a file named 'README' which gives the +name of the package, and a general description of what it does. It is +also good to explain the purpose of each of the first-level +subdirectories in the package, if there are any. The 'README' file +should either state the version number of the package, or refer to where +in the package it can be found. + + The 'README' file should refer to the file 'INSTALL', which should +contain an explanation of the installation procedure. + + The 'README' file should also refer to the file which contains the +copying conditions. The GNU GPL, if used, should be in a file called +'COPYING'. If the GNU LGPL is used, it should be in a file called +'COPYING.LIB'. + + Naturally, all the source files must be in the distribution. It is +okay to include non-source files in the distribution, provided they are +up-to-date and machine-independent, so that building the distribution +normally will never modify them. We commonly include non-source files +produced by Bison, 'lex', TeX, and 'makeinfo'; this helps avoid +unnecessary dependencies between our distributions, so that users can +install whichever packages they want to install. + + Non-source files that might actually be modified by building and +installing the program should *never* be included in the distribution. +So if you do distribute non-source files, always make sure they are up +to date when you make a new distribution. + + Make sure that the directory into which the distribution unpacks (as +well as any subdirectories) are all world-writable (octal mode 777). +This is so that old versions of 'tar' which preserve the ownership and +permissions of the files from the tar archive will be able to extract +all the files even if the user is unprivileged. + + Make sure that all the files in the distribution are world-readable. + + Make sure that no file name in the distribution is more than 14 +characters long. Likewise, no file created by building the program +should have a name longer than 14 characters. The reason for this is +that some systems adhere to a foolish interpretation of the POSIX +standard, and refuse to open a longer name, rather than truncating as +they did in the past. + + Don't include any symbolic links in the distribution itself. If the +tar file contains symbolic links, then people cannot even unpack it on +systems that don't support symbolic links. Also, don't use multiple +names for one file in different directories, because certain file +systems cannot handle this and that prevents unpacking the distribution. + + Try to make sure that all the file names will be unique on MS-DOS. A +name on MS-DOS consists of up to 8 characters, optionally followed by a +period and up to three characters. MS-DOS will truncate extra +characters both before and after the period. Thus, 'foobarhacker.c' and +'foobarhacker.o' are not ambiguous; they are truncated to 'foobarha.c' +and 'foobarha.o', which are distinct. + + Include in your distribution a copy of the 'texinfo.tex' you used to +test print any '*.texinfo' or '*.texi' files. + + Likewise, if your program uses small GNU software packages like +regex, getopt, obstack, or termcap, include them in the distribution +file. Leaving them out would make the distribution file a little +smaller at the expense of possible inconvenience to a user who doesn't +know what other files to get. + + +File: standards.info, Node: References, Next: Index, Prev: Managing Releases, Up: Top + +8 References to Non-Free Software and Documentation +*************************************************** + +A GNU program should not recommend use of any non-free program. We +can't stop some people from writing proprietary programs, or stop other +people from using them. But we can and should avoid helping to +advertise them to new customers. + + Sometimes it is important to mention how to build your package on top +of some non-free operating system or other non-free base package. In +such cases, please mention the name of the non-free package or system in +the briefest possible way. Don't include any references for where to +find more information about the proprietary program. The goal should be +that people already using the proprietary program will get the advice +they need about how to use your free program, while people who don't +already use the proprietary program will not see anything to encourage +them to take an interest in it. + + Likewise, a GNU package should not refer the user to any non-free +documentation for free software. The need for free documentation to go +with free software is now a major focus of the GNU project; to show that +we are serious about the need for free documentation, we must not +undermine our position by recommending use of documentation that isn't +free. + + +File: standards.info, Node: Index, Prev: References, Up: Top + +Index +***** + + +* Menu: + +* #endif, commenting: Comments. (line 54) +* --help option: Command-Line Interfaces. + (line 107) +* --version option: Command-Line Interfaces. + (line 34) +* -Wall compiler option: Syntactic Conventions. + (line 10) +* accepting contributions: Contributions. (line 6) +* address for bug reports: Command-Line Interfaces. + (line 113) +* ANSI C standard: Standard C. (line 6) +* arbitrary limits on data: Semantics. (line 6) +* autoconf: System Portability. (line 23) +* avoiding proprietary code: Reading Non-Free Code. + (line 6) +* behavior, dependent on program's name: User Interfaces. (line 6) +* binary packages: Install Command Categories. + (line 80) +* bindir: Directory Variables. (line 45) +* braces, in C source: Formatting. (line 6) +* bug reports: Command-Line Interfaces. + (line 113) +* canonical name of a program: Command-Line Interfaces. + (line 41) +* casting pointers to integers: CPU Portability. (line 66) +* change logs: Change Logs. (line 6) +* change logs, conditional changes: Conditional Changes. (line 6) +* change logs, style: Style of Change Logs. + (line 6) +* command-line arguments, decoding: Semantics. (line 46) +* command-line interface: Command-Line Interfaces. + (line 6) +* commenting: Comments. (line 6) +* compatibility with C and POSIX standards: Compatibility. (line 6) +* compiler warnings: Syntactic Conventions. + (line 10) +* conditional changes, and change logs: Conditional Changes. (line 6) +* conditionals, comments for: Comments. (line 54) +* configure: Configuration. (line 6) +* control-L: Formatting. (line 114) +* conventions for makefiles: Makefile Conventions. + (line 6) +* corba: Graphical Interfaces. + (line 16) +* credits for manuals: Manual Credits. (line 6) +* data types, and portability: CPU Portability. (line 6) +* declaration for system functions: System Functions. (line 21) +* documentation: Documentation. (line 6) +* doschk: Names. (line 38) +* downloading this manual: Preface. (line 17) +* error messages: Semantics. (line 19) +* error messages, formatting: Errors. (line 6) +* exec_prefix: Directory Variables. (line 27) +* expressions, splitting: Formatting. (line 77) +* file usage: File Usage. (line 6) +* file-name limitations: Names. (line 38) +* formatting error messages: Errors. (line 6) +* formatting source code: Formatting. (line 6) +* formfeed: Formatting. (line 114) +* function argument, declaring: Syntactic Conventions. + (line 6) +* function prototypes: Standard C. (line 17) +* getopt: Command-Line Interfaces. + (line 6) +* gettext: Internationalization. + (line 6) +* gnome: Graphical Interfaces. + (line 16) +* graphical user interface: Graphical Interfaces. + (line 6) +* gtk: Graphical Interfaces. + (line 6) +* GUILE: Source Language. (line 37) +* implicit int: Syntactic Conventions. + (line 6) +* impossible conditions: Semantics. (line 70) +* internationalization: Internationalization. + (line 6) +* legal aspects: Legal Issues. (line 6) +* legal papers: Contributions. (line 6) +* libexecdir: Directory Variables. (line 58) +* libraries: Libraries. (line 6) +* library functions, and portability: System Functions. (line 6) +* license for manuals: License for Manuals. (line 6) +* lint: Syntactic Conventions. + (line 109) +* long option names: Option Table. (line 6) +* long-named options: Command-Line Interfaces. + (line 12) +* makefile, conventions for: Makefile Conventions. + (line 6) +* malloc return value: Semantics. (line 25) +* man pages: Man Pages. (line 6) +* manual structure: Manual Structure Details. + (line 6) +* memory allocation failure: Semantics. (line 25) +* memory usage: Memory Usage. (line 6) +* message text, and internationalization: Internationalization. + (line 29) +* mmap: Mmap. (line 6) +* multiple variables in a line: Syntactic Conventions. + (line 35) +* names of variables and functions: Names. (line 6) +* NEWS file: NEWS File. (line 6) +* non-POSIX systems, and portability: System Portability. (line 32) +* non-standard extensions: Using Extensions. (line 6) +* NUL characters: Semantics. (line 11) +* open brace: Formatting. (line 6) +* optional features, configure-time: Configuration. (line 76) +* options for compatibility: Compatibility. (line 14) +* output device and program's behavior: User Interfaces. (line 13) +* packaging: Releases. (line 6) +* portability, and data types: CPU Portability. (line 6) +* portability, and library functions: System Functions. (line 6) +* portability, between system types: System Portability. (line 6) +* POSIX compatibility: Compatibility. (line 6) +* POSIXLY_CORRECT, environment variable: Compatibility. (line 21) +* post-installation commands: Install Command Categories. + (line 6) +* pre-installation commands: Install Command Categories. + (line 6) +* prefix: Directory Variables. (line 17) +* program configuration: Configuration. (line 6) +* program design: Design Advice. (line 6) +* program name and its behavior: User Interfaces. (line 6) +* program's canonical name: Command-Line Interfaces. + (line 41) +* programming languages: Source Language. (line 6) +* proprietary programs: Reading Non-Free Code. + (line 6) +* README file: Releases. (line 17) +* references to non-free material: References. (line 6) +* releasing: Managing Releases. (line 6) +* sbindir: Directory Variables. (line 51) +* signal handling: Semantics. (line 59) +* spaces before open-paren: Formatting. (line 71) +* standard command-line options: Command-Line Interfaces. + (line 31) +* standards for makefiles: Makefile Conventions. + (line 6) +* string library functions: System Functions. (line 54) +* syntactic conventions: Syntactic Conventions. + (line 6) +* table of long options: Option Table. (line 6) +* temporary files: Semantics. (line 84) +* temporary variables: Syntactic Conventions. + (line 23) +* texinfo.tex, in a distribution: Releases. (line 73) +* TMPDIR environment variable: Semantics. (line 84) +* trademarks: Trademarks. (line 6) +* where to obtain standards.texi: Preface. (line 17) + + + +Tag Table: +Node: Top978 +Node: Preface1577 +Node: Legal Issues3167 +Node: Reading Non-Free Code3631 +Node: Contributions5358 +Node: Trademarks7512 +Node: Design Advice8575 +Node: Source Language9082 +Node: Compatibility11087 +Node: Using Extensions12715 +Node: Standard C14292 +Node: Program Behavior16663 +Node: Semantics17582 +Node: Libraries22275 +Node: Errors23520 +Node: User Interfaces25301 +Node: Graphical Interfaces26906 +Node: Command-Line Interfaces27941 +Node: Option Table33430 +Node: Memory Usage48439 +Node: File Usage49464 +Node: Writing C50212 +Node: Formatting51052 +Node: Comments55116 +Node: Syntactic Conventions58417 +Node: Names61829 +Node: System Portability64022 +Node: CPU Portability66407 +Node: System Functions69665 +Node: Internationalization74857 +Node: Mmap78010 +Node: Documentation78720 +Node: GNU Manuals79825 +Node: Doc Strings and Manuals84882 +Node: Manual Structure Details86435 +Node: License for Manuals87853 +Node: Manual Credits88826 +Node: Printed Manuals89219 +Node: NEWS File89905 +Node: Change Logs90583 +Node: Change Log Concepts91377 +Node: Style of Change Logs93240 +Node: Simple Changes95275 +Node: Conditional Changes96519 +Node: Indicating the Part Changed97941 +Node: Man Pages98468 +Node: Reading other Manuals100092 +Node: Managing Releases100883 +Node: Configuration101638 +Node: Makefile Conventions108542 +Node: Makefile Basics109306 +Node: Utilities in Makefiles112480 +Node: Command Variables114626 +Node: Directory Variables118203 +Node: Standard Targets129094 +Ref: Standard Targets-Footnote-1140335 +Node: Install Command Categories140436 +Node: Releases145018 +Node: References149105 +Node: Index150501 + +End Tag Table diff --git a/doc/standards.texi b/doc/standards.texi new file mode 100644 index 0000000..be5bfb5 --- /dev/null +++ b/doc/standards.texi @@ -0,0 +1,3656 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename standards.info +@settitle GNU Coding Standards +@c This date is automagically updated when you save this file: +@set lastupdate March 23, 2001 +@c %**end of header + +@ifinfo +@format +START-INFO-DIR-ENTRY +* Standards: (standards). GNU coding standards. +END-INFO-DIR-ENTRY +@end format +@end ifinfo + +@c @setchapternewpage odd +@setchapternewpage off + +@c Put everything in one index (arbitrarily chosen to be the concept index). +@syncodeindex fn cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex vr cp + +@c This is used by a cross ref in make-stds.texi +@set CODESTD 1 +@iftex +@set CHAPTER chapter +@end iftex +@ifinfo +@set CHAPTER node +@end ifinfo + +@ifinfo +GNU Coding Standards +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). +@end ignore + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Free Software Foundation. +@end ifinfo + +@titlepage +@title GNU Coding Standards +@author Richard Stallman +@author last updated @value{lastupdate} +@page + +@vskip 0pt plus 1filll +Copyright @copyright{} 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Free Software Foundation. +@end titlepage + +@ifinfo +@node Top, Preface, (dir), (dir) +@top Version + +Last updated @value{lastupdate}. +@end ifinfo + +@menu +* Preface:: About the GNU Coding Standards +* Legal Issues:: Keeping Free Software Free +* Design Advice:: General Program Design +* Program Behavior:: Program Behavior for All Programs +* Writing C:: Making The Best Use of C +* Documentation:: Documenting Programs +* Managing Releases:: The Release Process +* References:: References to Non-Free Software or Documentation +* Index:: +@end menu + +@node Preface +@chapter About the GNU Coding Standards + +The GNU Coding Standards were written by Richard Stallman and other GNU +Project volunteers. Their purpose is to make the GNU system clean, +consistent, and easy to install. This document can also be read as a +guide to writing portable, robust and reliable programs. It focuses on +programs written in C, but many of the rules and principles are useful +even if you write in another programming language. The rules often +state reasons for writing in a certain way. + +This release of the GNU Coding Standards was last updated +@value{lastupdate}. + +@cindex where to obtain @code{standards.texi} +@cindex downloading this manual +If you did not obtain this file directly from the GNU project and +recently, please check for a newer version. You can ftp the GNU +Coding Standards from any GNU FTP host in the directory +@file{/pub/gnu/standards/}. The GNU Coding Standards are available +there in several different formats: @file{standards.text}, +@file{standards.info}, and @file{standards.dvi}, as well as the +Texinfo ``source'' which is divided in two files: +@file{standards.texi} and @file{make-stds.texi}. The GNU Coding +Standards are also available on the GNU World Wide Web server: +@uref{http://www.gnu.org/prep/standards_toc.html}. + +Corrections or suggestions for this document should be sent to +@email{bug-standards@@gnu.org}. If you make a suggestion, please include a +suggested new wording for it; our time is limited. We prefer a context +diff to the @file{standards.texi} or @file{make-stds.texi} files, but if +you don't have those files, please mail your suggestion anyway. + +@node Legal Issues +@chapter Keeping Free Software Free +@cindex legal aspects + +This @value{CHAPTER} discusses how you can make sure that GNU software +avoids legal difficulties, and other related issues. + +@menu +* Reading Non-Free Code:: Referring to Proprietary Programs +* Contributions:: Accepting Contributions +* Trademarks:: How We Deal with Trademark Issues +@end menu + +@node Reading Non-Free Code +@section Referring to Proprietary Programs +@cindex proprietary programs +@cindex avoiding proprietary code + +Don't in any circumstances refer to Unix source code for or during +your work on GNU! (Or to any other proprietary programs.) + +If you have a vague recollection of the internals of a Unix program, +this does not absolutely mean you can't write an imitation of it, but +do try to organize the imitation internally along different lines, +because this is likely to make the details of the Unix version +irrelevant and dissimilar to your results. + +For example, Unix utilities were generally optimized to minimize +memory use; if you go for speed instead, your program will be very +different. You could keep the entire input file in core and scan it +there instead of using stdio. Use a smarter algorithm discovered more +recently than the Unix program. Eliminate use of temporary files. Do +it in one pass instead of two (we did this in the assembler). + +Or, on the contrary, emphasize simplicity instead of speed. For some +applications, the speed of today's computers makes simpler algorithms +adequate. + +Or go for generality. For example, Unix programs often have static +tables or fixed-size strings, which make for arbitrary limits; use +dynamic allocation instead. Make sure your program handles NULs and +other funny characters in the input files. Add a programming language +for extensibility and write part of the program in that language. + +Or turn some parts of the program into independently usable libraries. +Or use a simple garbage collector instead of tracking precisely when +to free memory, or use a new GNU facility such as obstacks. + +@node Contributions +@section Accepting Contributions +@cindex legal papers +@cindex accepting contributions + +If the program you are working on is copyrighted by the Free Software +Foundation, then when someone else sends you a piece of code to add to +the program, we need legal papers to use it---just as we asked you to +sign papers initially. @emph{Each} person who makes a nontrivial +contribution to a program must sign some sort of legal papers in order +for us to have clear title to the program; the main author alone is not +enough. + +So, before adding in any contributions from other people, please tell +us, so we can arrange to get the papers. Then wait until we tell you +that we have received the signed papers, before you actually use the +contribution. + +This applies both before you release the program and afterward. If +you receive diffs to fix a bug, and they make significant changes, we +need legal papers for that change. + +This also applies to comments and documentation files. For copyright +law, comments and code are just text. Copyright applies to all kinds of +text, so we need legal papers for all kinds. + +We know it is frustrating to ask for legal papers; it's frustrating for +us as well. But if you don't wait, you are going out on a limb---for +example, what if the contributor's employer won't sign a disclaimer? +You might have to take that code out again! + +You don't need papers for changes of a few lines here or there, since +they are not significant for copyright purposes. Also, you don't need +papers if all you get from the suggestion is some ideas, not actual code +which you use. For example, if someone send you one implementation, but +you write a different implementation of the same idea, you don't need to +get papers. + +The very worst thing is if you forget to tell us about the other +contributor. We could be very embarrassed in court some day as a +result. + +We have more detailed advice for maintainers of programs; if you have +reached the stage of actually maintaining a program for GNU (whether +released or not), please ask us for a copy. + +@node Trademarks +@section Trademarks +@cindex trademarks + +Please do not include any trademark acknowledgements in GNU software +packages or documentation. + +Trademark acknowledgements are the statements that such-and-such is a +trademark of so-and-so. The GNU Project has no objection to the basic +idea of trademarks, but these acknowledgements feel like kowtowing, so +we don't use them. There is no legal requirement for them. + +What is legally required, as regards other people's trademarks, is to +avoid using them in ways which a reader might read as naming or labeling +our own programs or activities. For example, since ``Objective C'' is +(or at least was) a trademark, we made sure to say that we provide a +``compiler for the Objective C language'' rather than an ``Objective C +compiler''. The latter is meant to be short for the former, but it does +not explicitly state the relationship, so it could be misinterpreted as +using ``Objective C'' as a label for the compiler rather than for the +language. + +@node Design Advice +@chapter General Program Design +@cindex program design + +This @value{CHAPTER} discusses some of the issues you should take into +account when designing your program. + +@c Standard or ANSI C +@c +@c In 1989 the American National Standards Institute (ANSI) standardized +@c C as standard X3.159-1989. In December of that year the +@c International Standards Organization ISO adopted the ANSI C standard +@c making minor changes. In 1990 ANSI then re-adopted ISO standard +@c C. This version of C is known as either ANSI C or Standard C. + +@c A major revision of the C Standard appeared in 1999. + +@menu +* Source Language:: Which languages to use. +* Compatibility:: Compatibility with other implementations +* Using Extensions:: Using non-standard features +* Standard C:: Using Standard C features +@end menu + +@node Source Language +@section Which Languages to Use +@cindex programming languages + +When you want to use a language that gets compiled and runs at high +speed, the best language to use is C. Using another language is like +using a non-standard feature: it will cause trouble for users. Even if +GCC supports the other language, users may find it inconvenient to have +to install the compiler for that other language in order to build your +program. For example, if you write your program in C++, people will +have to install the GNU C++ compiler in order to compile your program. + +C has one other advantage over C++ and other compiled languages: more +people know C, so more people will find it easy to read and modify the +program if it is written in C. + +So in general it is much better to use C, rather than the +comparable alternatives. + +But there are two exceptions to that conclusion: + +@itemize @bullet +@item +It is no problem to use another language to write a tool specifically +intended for use with that language. That is because the only people +who want to build the tool will be those who have installed the other +language anyway. + +@item +If an application is of interest only to a narrow part of the community, +then the question of which language it is written in has less effect on +other people, so you may as well please yourself. +@end itemize + +Many programs are designed to be extensible: they include an interpreter +for a language that is higher level than C. Often much of the program +is written in that language, too. The Emacs editor pioneered this +technique. + +@cindex GUILE +The standard extensibility interpreter for GNU software is GUILE, which +implements the language Scheme (an especially clean and simple dialect +of Lisp). @uref{http://www.gnu.org/software/guile/}. We don't reject +programs written in other ``scripting languages'' such as Perl and +Python, but using GUILE is very important for the overall consistency of +the GNU system. + +@node Compatibility +@section Compatibility with Other Implementations +@cindex compatibility with C and @sc{posix} standards +@cindex @sc{posix} compatibility + +With occasional exceptions, utility programs and libraries for GNU +should be upward compatible with those in Berkeley Unix, and upward +compatible with Standard C if Standard C specifies their +behavior, and upward compatible with @sc{posix} if @sc{posix} specifies +their behavior. + +When these standards conflict, it is useful to offer compatibility +modes for each of them. + +@cindex options for compatibility +Standard C and @sc{posix} prohibit many kinds of extensions. Feel +free to make the extensions anyway, and include a @samp{--ansi}, +@samp{--posix}, or @samp{--compatible} option to turn them off. +However, if the extension has a significant chance of breaking any real +programs or scripts, then it is not really upward compatible. So you +should try to redesign its interface to make it upward compatible. + +@cindex @code{POSIXLY_CORRECT}, environment variable +Many GNU programs suppress extensions that conflict with @sc{posix} if the +environment variable @code{POSIXLY_CORRECT} is defined (even if it is +defined with a null value). Please make your program recognize this +variable if appropriate. + +When a feature is used only by users (not by programs or command +files), and it is done poorly in Unix, feel free to replace it +completely with something totally different and better. (For example, +@code{vi} is replaced with Emacs.) But it is nice to offer a compatible +feature as well. (There is a free @code{vi} clone, so we offer it.) + +Additional useful features are welcome regardless of whether +there is any precedent for them. + +@node Using Extensions +@section Using Non-standard Features +@cindex non-standard extensions + +Many GNU facilities that already exist support a number of convenient +extensions over the comparable Unix facilities. Whether to use these +extensions in implementing your program is a difficult question. + +On the one hand, using the extensions can make a cleaner program. +On the other hand, people will not be able to build the program +unless the other GNU tools are available. This might cause the +program to work on fewer kinds of machines. + +With some extensions, it might be easy to provide both alternatives. +For example, you can define functions with a ``keyword'' @code{INLINE} +and define that as a macro to expand into either @code{inline} or +nothing, depending on the compiler. + +In general, perhaps it is best not to use the extensions if you can +straightforwardly do without them, but to use the extensions if they +are a big improvement. + +An exception to this rule are the large, established programs (such as +Emacs) which run on a great variety of systems. Using GNU extensions in +such programs would make many users unhappy, so we don't do that. + +Another exception is for programs that are used as part of compilation: +anything that must be compiled with other compilers in order to +bootstrap the GNU compilation facilities. If these require the GNU +compiler, then no one can compile them without having them installed +already. That would be extremely troublesome in certain cases. + +@node Standard C +@section Standard C and Pre-Standard C +@cindex @sc{ansi} C standard + +1989 Standard C is widespread enough now that it is ok to use its +features in new programs. There is one exception: do not ever use the +``trigraph'' feature of Standard C. + +1999 Standard C is not widespread yet, so please do not require its +features in programs. It is ok to use its features if they are present. + +However, it is easy to support pre-standard compilers in most programs, +so if you know how to do that, feel free. If a program you are +maintaining has such support, you should try to keep it working. + +@cindex function prototypes +To support pre-standard C, instead of writing function definitions in +standard prototype form, + +@example +int +foo (int x, int y) +@dots{} +@end example + +@noindent +write the definition in pre-standard style like this, + +@example +int +foo (x, y) + int x, y; +@dots{} +@end example + +@noindent +and use a separate declaration to specify the argument prototype: + +@example +int foo (int, int); +@end example + +You need such a declaration anyway, in a header file, to get the benefit +of prototypes in all the files where the function is called. And once +you have the declaration, you normally lose nothing by writing the +function definition in the pre-standard style. + +This technique does not work for integer types narrower than @code{int}. +If you think of an argument as being of a type narrower than @code{int}, +declare it as @code{int} instead. + +There are a few special cases where this technique is hard to use. For +example, if a function argument needs to hold the system type +@code{dev_t}, you run into trouble, because @code{dev_t} is shorter than +@code{int} on some machines; but you cannot use @code{int} instead, +because @code{dev_t} is wider than @code{int} on some machines. There +is no type you can safely use on all machines in a non-standard +definition. The only way to support non-standard C and pass such an +argument is to check the width of @code{dev_t} using Autoconf and choose +the argument type accordingly. This may not be worth the trouble. + +In order to support pre-standard compilers that do not recognize +prototypes, you may want to use a preprocessor macro like this: + +@example +/* Declare the prototype for a general external function. */ +#if defined (__STDC__) || defined (WINDOWSNT) +#define P_(proto) proto +#else +#define P_(proto) () +#endif +@end example + +@node Program Behavior +@chapter Program Behavior for All Programs + +This @value{CHAPTER} describes conventions for writing robust +software. It also describes general standards for error messages, the +command line interface, and how libraries should behave. + +@menu +* Semantics:: Writing robust programs +* Libraries:: Library behavior +* Errors:: Formatting error messages +* User Interfaces:: Standards about interfaces generally +* Graphical Interfaces:: Standards for graphical interfaces +* Command-Line Interfaces:: Standards for command line interfaces +* Option Table:: Table of long options +* Memory Usage:: When and how to care about memory needs +* File Usage:: Which files to use, and where +@end menu + +@node Semantics +@section Writing Robust Programs + +@cindex arbitrary limits on data +Avoid arbitrary limits on the length or number of @emph{any} data +structure, including file names, lines, files, and symbols, by allocating +all data structures dynamically. In most Unix utilities, ``long lines +are silently truncated''. This is not acceptable in a GNU utility. + +@cindex @code{NUL} characters +Utilities reading files should not drop NUL characters, or any other +nonprinting characters @emph{including those with codes above 0177}. +The only sensible exceptions would be utilities specifically intended +for interface to certain types of terminals or printers +that can't handle those characters. +Whenever possible, try to make programs work properly with +sequences of bytes that represent multibyte characters, using encodings +such as UTF-8 and others. + +@cindex error messages +Check every system call for an error return, unless you know you wish to +ignore errors. Include the system error text (from @code{perror} or +equivalent) in @emph{every} error message resulting from a failing +system call, as well as the name of the file if any and the name of the +utility. Just ``cannot open foo.c'' or ``stat failed'' is not +sufficient. + +@cindex @code{malloc} return value +@cindex memory allocation failure +Check every call to @code{malloc} or @code{realloc} to see if it +returned zero. Check @code{realloc} even if you are making the block +smaller; in a system that rounds block sizes to a power of 2, +@code{realloc} may get a different block if you ask for less space. + +In Unix, @code{realloc} can destroy the storage block if it returns +zero. GNU @code{realloc} does not have this bug: if it fails, the +original block is unchanged. Feel free to assume the bug is fixed. If +you wish to run your program on Unix, and wish to avoid lossage in this +case, you can use the GNU @code{malloc}. + +You must expect @code{free} to alter the contents of the block that was +freed. Anything you want to fetch from the block, you must fetch before +calling @code{free}. + +If @code{malloc} fails in a noninteractive program, make that a fatal +error. In an interactive program (one that reads commands from the +user), it is better to abort the command and return to the command +reader loop. This allows the user to kill other processes to free up +virtual memory, and then try the command again. + +@cindex command-line arguments, decoding +Use @code{getopt_long} to decode arguments, unless the argument syntax +makes this unreasonable. + +When static storage is to be written in during program execution, use +explicit C code to initialize it. Reserve C initialized declarations +for data that will not be changed. +@c ADR: why? + +Try to avoid low-level interfaces to obscure Unix data structures (such +as file directories, utmp, or the layout of kernel memory), since these +are less likely to work compatibly. If you need to find all the files +in a directory, use @code{readdir} or some other high-level interface. +These are supported compatibly by GNU. + +@cindex signal handling +The preferred signal handling facilities are the BSD variant of +@code{signal}, and the @sc{posix} @code{sigaction} function; the +alternative USG @code{signal} interface is an inferior design. + +Nowadays, using the @sc{posix} signal functions may be the easiest way +to make a program portable. If you use @code{signal}, then on GNU/Linux +systems running GNU libc version 1, you should include +@file{bsd/signal.h} instead of @file{signal.h}, so as to get BSD +behavior. It is up to you whether to support systems where +@code{signal} has only the USG behavior, or give up on them. + +@cindex impossible conditions +In error checks that detect ``impossible'' conditions, just abort. +There is usually no point in printing any message. These checks +indicate the existence of bugs. Whoever wants to fix the bugs will have +to read the source code and run a debugger. So explain the problem with +comments in the source. The relevant data will be in variables, which +are easy to examine with the debugger, so there is no point moving them +elsewhere. + +Do not use a count of errors as the exit status for a program. +@emph{That does not work}, because exit status values are limited to 8 +bits (0 through 255). A single run of the program might have 256 +errors; if you try to return 256 as the exit status, the parent process +will see 0 as the status, and it will appear that the program succeeded. + +@cindex temporary files +@cindex @code{TMPDIR} environment variable +If you make temporary files, check the @code{TMPDIR} environment +variable; if that variable is defined, use the specified directory +instead of @file{/tmp}. + +In addition, be aware that there is a possible security problem when +creating temporary files in world-writable directories. In C, you can +avoid this problem by creating temporary files in this manner: + +@example +fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0600); +@end example + +@noindent +or by using the @code{mkstemps} function from libiberty. + +In bash, use @code{set -C} to avoid this problem. + +@node Libraries +@section Library Behavior +@cindex libraries + +Try to make library functions reentrant. If they need to do dynamic +storage allocation, at least try to avoid any nonreentrancy aside from +that of @code{malloc} itself. + +Here are certain name conventions for libraries, to avoid name +conflicts. + +Choose a name prefix for the library, more than two characters long. +All external function and variable names should start with this +prefix. In addition, there should only be one of these in any given +library member. This usually means putting each one in a separate +source file. + +An exception can be made when two external symbols are always used +together, so that no reasonable program could use one without the +other; then they can both go in the same file. + +External symbols that are not documented entry points for the user +should have names beginning with @samp{_}. The @samp{_} should be +followed by the chosen name prefix for the library, to prevent +collisions with other libraries. These can go in the same files with +user entry points if you like. + +Static functions and variables can be used as you like and need not +fit any naming convention. + +@node Errors +@section Formatting Error Messages +@cindex formatting error messages +@cindex error messages, formatting + +Error messages from compilers should look like this: + +@example +@var{source-file-name}:@var{lineno}: @var{message} +@end example + +@noindent +If you want to mention the column number, use this format: + +@example +@var{source-file-name}:@var{lineno}:@var{column}: @var{message} +@end example + +@noindent +Line numbers should start from 1 at the beginning of the file, and +column numbers should start from 1 at the beginning of the line. (Both +of these conventions are chosen for compatibility.) Calculate column +numbers assuming that space and all ASCII printing characters have +equal width, and assuming tab stops every 8 columns. + +Error messages from other noninteractive programs should look like this: + +@example +@var{program}:@var{source-file-name}:@var{lineno}: @var{message} +@end example + +@noindent +when there is an appropriate source file, or like this: + +@example +@var{program}: @var{message} +@end example + +@noindent +when there is no relevant source file. + +If you want to mention the column number, use this format: + +@example +@var{program}:@var{source-file-name}:@var{lineno}:@var{column}: @var{message} +@end example + +In an interactive program (one that is reading commands from a +terminal), it is better not to include the program name in an error +message. The place to indicate which program is running is in the +prompt or with the screen layout. (When the same program runs with +input from a source other than a terminal, it is not interactive and +would do best to print error messages using the noninteractive style.) + +The string @var{message} should not begin with a capital letter when +it follows a program name and/or file name. Also, it should not end +with a period. + +Error messages from interactive programs, and other messages such as +usage messages, should start with a capital letter. But they should not +end with a period. + +@node User Interfaces +@section Standards for Interfaces Generally + +@cindex program name and its behavior +@cindex behavior, dependent on program's name +Please don't make the behavior of a utility depend on the name used +to invoke it. It is useful sometimes to make a link to a utility +with a different name, and that should not change what it does. + +Instead, use a run time option or a compilation switch or both +to select among the alternate behaviors. + +@cindex output device and program's behavior +Likewise, please don't make the behavior of the program depend on the +type of output device it is used with. Device independence is an +important principle of the system's design; do not compromise it merely +to save someone from typing an option now and then. (Variation in error +message syntax when using a terminal is ok, because that is a side issue +that people do not depend on.) + +If you think one behavior is most useful when the output is to a +terminal, and another is most useful when the output is a file or a +pipe, then it is usually best to make the default behavior the one that +is useful with output to a terminal, and have an option for the other +behavior. + +Compatibility requires certain programs to depend on the type of output +device. It would be disastrous if @code{ls} or @code{sh} did not do so +in the way all users expect. In some of these cases, we supplement the +program with a preferred alternate version that does not depend on the +output device type. For example, we provide a @code{dir} program much +like @code{ls} except that its default output format is always +multi-column format. + +@node Graphical Interfaces +@section Standards for Graphical Interfaces +@cindex graphical user interface + +@cindex gtk +When you write a program that provides a graphical user interface, +please make it work with X Windows and the GTK toolkit unless the +functionality specifically requires some alternative (for example, +``displaying jpeg images while in console mode''). + +In addition, please provide a command-line interface to control the +functionality. (In many cases, the graphical user interface can be a +separate program which invokes the command-line program.) This is +so that the same jobs can be done from scripts. + +@cindex corba +@cindex gnome +Please also consider providing a CORBA interface (for use from GNOME), a +library interface (for use from C), and perhaps a keyboard-driven +console interface (for use by users from console mode). Once you are +doing the work to provide the functionality and the graphical interface, +these won't be much extra work. + +@node Command-Line Interfaces +@section Standards for Command Line Interfaces +@cindex command-line interface + +@findex getopt +It is a good idea to follow the @sc{posix} guidelines for the +command-line options of a program. The easiest way to do this is to use +@code{getopt} to parse them. Note that the GNU version of @code{getopt} +will normally permit options anywhere among the arguments unless the +special argument @samp{--} is used. This is not what @sc{posix} +specifies; it is a GNU extension. + +@cindex long-named options +Please define long-named options that are equivalent to the +single-letter Unix-style options. We hope to make GNU more user +friendly this way. This is easy to do with the GNU function +@code{getopt_long}. + +One of the advantages of long-named options is that they can be +consistent from program to program. For example, users should be able +to expect the ``verbose'' option of any GNU program which has one, to be +spelled precisely @samp{--verbose}. To achieve this uniformity, look at +the table of common long-option names when you choose the option names +for your program (@pxref{Option Table}). + +It is usually a good idea for file names given as ordinary arguments to +be input files only; any output files would be specified using options +(preferably @samp{-o} or @samp{--output}). Even if you allow an output +file name as an ordinary argument for compatibility, try to provide an +option as another way to specify it. This will lead to more consistency +among GNU utilities, and fewer idiosyncrasies for users to remember. + +@cindex standard command-line options +All programs should support two standard options: @samp{--version} +and @samp{--help}. + +@table @code +@cindex @samp{--version} option +@item --version +This option should direct the program to print information about its name, +version, origin and legal status, all on standard output, and then exit +successfully. Other options and arguments should be ignored once this +is seen, and the program should not perform its normal function. + +@cindex canonical name of a program +@cindex program's canonical name +The first line is meant to be easy for a program to parse; the version +number proper starts after the last space. In addition, it contains +the canonical name for this program, in this format: + +@example +GNU Emacs 19.30 +@end example + +@noindent +The program's name should be a constant string; @emph{don't} compute it +from @code{argv[0]}. The idea is to state the standard or canonical +name for the program, not its file name. There are other ways to find +out the precise file name where a command is found in @code{PATH}. + +If the program is a subsidiary part of a larger package, mention the +package name in parentheses, like this: + +@example +emacsserver (GNU Emacs) 19.30 +@end example + +@noindent +If the package has a version number which is different from this +program's version number, you can mention the package version number +just before the close-parenthesis. + +If you @strong{need} to mention the version numbers of libraries which +are distributed separately from the package which contains this program, +you can do so by printing an additional line of version info for each +library you want to mention. Use the same format for these lines as for +the first line. + +Please do not mention all of the libraries that the program uses ``just +for completeness''---that would produce a lot of unhelpful clutter. +Please mention library version numbers only if you find in practice that +they are very important to you in debugging. + +The following line, after the version number line or lines, should be a +copyright notice. If more than one copyright notice is called for, put +each on a separate line. + +Next should follow a brief statement that the program is free software, +and that users are free to copy and change it on certain conditions. If +the program is covered by the GNU GPL, say so here. Also mention that +there is no warranty, to the extent permitted by law. + +It is ok to finish the output with a list of the major authors of the +program, as a way of giving credit. + +Here's an example of output that follows these rules: + +@smallexample +GNU Emacs 19.34.5 +Copyright (C) 1996 Free Software Foundation, Inc. +GNU Emacs comes with NO WARRANTY, +to the extent permitted by law. +You may redistribute copies of GNU Emacs +under the terms of the GNU General Public License. +For more information about these matters, +see the files named COPYING. +@end smallexample + +You should adapt this to your program, of course, filling in the proper +year, copyright holder, name of program, and the references to +distribution terms, and changing the rest of the wording as necessary. + +This copyright notice only needs to mention the most recent year in +which changes were made---there's no need to list the years for previous +versions' changes. You don't have to mention the name of the program in +these notices, if that is inconvenient, since it appeared in the first +line. + +@cindex @samp{--help} option +@item --help +This option should output brief documentation for how to invoke the +program, on standard output, then exit successfully. Other options and +arguments should be ignored once this is seen, and the program should +not perform its normal function. + +@cindex address for bug reports +@cindex bug reports +Near the end of the @samp{--help} option's output there should be a line +that says where to mail bug reports. It should have this format: + +@example +Report bugs to @var{mailing-address}. +@end example +@end table + +@node Option Table +@section Table of Long Options +@cindex long option names +@cindex table of long options + +Here is a table of long options used by GNU programs. It is surely +incomplete, but we aim to list all the options that a new program might +want to be compatible with. If you use names not already in the table, +please send @email{bug-standards@@gnu.org} a list of them, with their +meanings, so we can update the table. + +@c Please leave newlines between items in this table; it's much easier +@c to update when it isn't completely squashed together and unreadable. +@c When there is more than one short option for a long option name, put +@c a semicolon between the lists of the programs that use them, not a +@c period. --friedman + +@table @samp +@item after-date +@samp{-N} in @code{tar}. + +@item all +@samp{-a} in @code{du}, @code{ls}, @code{nm}, @code{stty}, @code{uname}, +and @code{unexpand}. + +@item all-text +@samp{-a} in @code{diff}. + +@item almost-all +@samp{-A} in @code{ls}. + +@item append +@samp{-a} in @code{etags}, @code{tee}, @code{time}; +@samp{-r} in @code{tar}. + +@item archive +@samp{-a} in @code{cp}. + +@item archive-name +@samp{-n} in @code{shar}. + +@item arglength +@samp{-l} in @code{m4}. + +@item ascii +@samp{-a} in @code{diff}. + +@item assign +@samp{-v} in @code{gawk}. + +@item assume-new +@samp{-W} in Make. + +@item assume-old +@samp{-o} in Make. + +@item auto-check +@samp{-a} in @code{recode}. + +@item auto-pager +@samp{-a} in @code{wdiff}. + +@item auto-reference +@samp{-A} in @code{ptx}. + +@item avoid-wraps +@samp{-n} in @code{wdiff}. + +@item background +For server programs, run in the background. + +@item backward-search +@samp{-B} in @code{ctags}. + +@item basename +@samp{-f} in @code{shar}. + +@item batch +Used in GDB. + +@item baud +Used in GDB. + +@item before +@samp{-b} in @code{tac}. + +@item binary +@samp{-b} in @code{cpio} and @code{diff}. + +@item bits-per-code +@samp{-b} in @code{shar}. + +@item block-size +Used in @code{cpio} and @code{tar}. + +@item blocks +@samp{-b} in @code{head} and @code{tail}. + +@item break-file +@samp{-b} in @code{ptx}. + +@item brief +Used in various programs to make output shorter. + +@item bytes +@samp{-c} in @code{head}, @code{split}, and @code{tail}. + +@item c@t{++} +@samp{-C} in @code{etags}. + +@item catenate +@samp{-A} in @code{tar}. + +@item cd +Used in various programs to specify the directory to use. + +@item changes +@samp{-c} in @code{chgrp} and @code{chown}. + +@item classify +@samp{-F} in @code{ls}. + +@item colons +@samp{-c} in @code{recode}. + +@item command +@samp{-c} in @code{su}; +@samp{-x} in GDB. + +@item compare +@samp{-d} in @code{tar}. + +@item compat +Used in @code{gawk}. + +@item compress +@samp{-Z} in @code{tar} and @code{shar}. + +@item concatenate +@samp{-A} in @code{tar}. + +@item confirmation +@samp{-w} in @code{tar}. + +@item context +Used in @code{diff}. + +@item copyleft +@samp{-W copyleft} in @code{gawk}. + +@item copyright +@samp{-C} in @code{ptx}, @code{recode}, and @code{wdiff}; +@samp{-W copyright} in @code{gawk}. + +@item core +Used in GDB. + +@item count +@samp{-q} in @code{who}. + +@item count-links +@samp{-l} in @code{du}. + +@item create +Used in @code{tar} and @code{cpio}. + +@item cut-mark +@samp{-c} in @code{shar}. + +@item cxref +@samp{-x} in @code{ctags}. + +@item date +@samp{-d} in @code{touch}. + +@item debug +@samp{-d} in Make and @code{m4}; +@samp{-t} in Bison. + +@item define +@samp{-D} in @code{m4}. + +@item defines +@samp{-d} in Bison and @code{ctags}. + +@item delete +@samp{-D} in @code{tar}. + +@item dereference +@samp{-L} in @code{chgrp}, @code{chown}, @code{cpio}, @code{du}, +@code{ls}, and @code{tar}. + +@item dereference-args +@samp{-D} in @code{du}. + +@item device +Specify an I/O device (special file name). + +@item diacritics +@samp{-d} in @code{recode}. + +@item dictionary-order +@samp{-d} in @code{look}. + +@item diff +@samp{-d} in @code{tar}. + +@item digits +@samp{-n} in @code{csplit}. + +@item directory +Specify the directory to use, in various programs. In @code{ls}, it +means to show directories themselves rather than their contents. In +@code{rm} and @code{ln}, it means to not treat links to directories +specially. + +@item discard-all +@samp{-x} in @code{strip}. + +@item discard-locals +@samp{-X} in @code{strip}. + +@item dry-run +@samp{-n} in Make. + +@item ed +@samp{-e} in @code{diff}. + +@item elide-empty-files +@samp{-z} in @code{csplit}. + +@item end-delete +@samp{-x} in @code{wdiff}. + +@item end-insert +@samp{-z} in @code{wdiff}. + +@item entire-new-file +@samp{-N} in @code{diff}. + +@item environment-overrides +@samp{-e} in Make. + +@item eof +@samp{-e} in @code{xargs}. + +@item epoch +Used in GDB. + +@item error-limit +Used in @code{makeinfo}. + +@item error-output +@samp{-o} in @code{m4}. + +@item escape +@samp{-b} in @code{ls}. + +@item exclude-from +@samp{-X} in @code{tar}. + +@item exec +Used in GDB. + +@item exit +@samp{-x} in @code{xargs}. + +@item exit-0 +@samp{-e} in @code{unshar}. + +@item expand-tabs +@samp{-t} in @code{diff}. + +@item expression +@samp{-e} in @code{sed}. + +@item extern-only +@samp{-g} in @code{nm}. + +@item extract +@samp{-i} in @code{cpio}; +@samp{-x} in @code{tar}. + +@item faces +@samp{-f} in @code{finger}. + +@item fast +@samp{-f} in @code{su}. + +@item fatal-warnings +@samp{-E} in @code{m4}. + +@item file +@samp{-f} in @code{info}, @code{gawk}, Make, @code{mt}, and @code{tar}; +@samp{-n} in @code{sed}; +@samp{-r} in @code{touch}. + +@item field-separator +@samp{-F} in @code{gawk}. + +@item file-prefix +@samp{-b} in Bison. + +@item file-type +@samp{-F} in @code{ls}. + +@item files-from +@samp{-T} in @code{tar}. + +@item fill-column +Used in @code{makeinfo}. + +@item flag-truncation +@samp{-F} in @code{ptx}. + +@item fixed-output-files +@samp{-y} in Bison. + +@item follow +@samp{-f} in @code{tail}. + +@item footnote-style +Used in @code{makeinfo}. + +@item force +@samp{-f} in @code{cp}, @code{ln}, @code{mv}, and @code{rm}. + +@item force-prefix +@samp{-F} in @code{shar}. + +@item foreground +For server programs, run in the foreground; +in other words, don't do anything special to run the server +in the background. + +@item format +Used in @code{ls}, @code{time}, and @code{ptx}. + +@item freeze-state +@samp{-F} in @code{m4}. + +@item fullname +Used in GDB. + +@item gap-size +@samp{-g} in @code{ptx}. + +@item get +@samp{-x} in @code{tar}. + +@item graphic +@samp{-i} in @code{ul}. + +@item graphics +@samp{-g} in @code{recode}. + +@item group +@samp{-g} in @code{install}. + +@item gzip +@samp{-z} in @code{tar} and @code{shar}. + +@item hashsize +@samp{-H} in @code{m4}. + +@item header +@samp{-h} in @code{objdump} and @code{recode} + +@item heading +@samp{-H} in @code{who}. + +@item help +Used to ask for brief usage information. + +@item here-delimiter +@samp{-d} in @code{shar}. + +@item hide-control-chars +@samp{-q} in @code{ls}. + +@item html +In @code{makeinfo}, output HTML. + +@item idle +@samp{-u} in @code{who}. + +@item ifdef +@samp{-D} in @code{diff}. + +@item ignore +@samp{-I} in @code{ls}; +@samp{-x} in @code{recode}. + +@item ignore-all-space +@samp{-w} in @code{diff}. + +@item ignore-backups +@samp{-B} in @code{ls}. + +@item ignore-blank-lines +@samp{-B} in @code{diff}. + +@item ignore-case +@samp{-f} in @code{look} and @code{ptx}; +@samp{-i} in @code{diff} and @code{wdiff}. + +@item ignore-errors +@samp{-i} in Make. + +@item ignore-file +@samp{-i} in @code{ptx}. + +@item ignore-indentation +@samp{-I} in @code{etags}. + +@item ignore-init-file +@samp{-f} in Oleo. + +@item ignore-interrupts +@samp{-i} in @code{tee}. + +@item ignore-matching-lines +@samp{-I} in @code{diff}. + +@item ignore-space-change +@samp{-b} in @code{diff}. + +@item ignore-zeros +@samp{-i} in @code{tar}. + +@item include +@samp{-i} in @code{etags}; +@samp{-I} in @code{m4}. + +@item include-dir +@samp{-I} in Make. + +@item incremental +@samp{-G} in @code{tar}. + +@item info +@samp{-i}, @samp{-l}, and @samp{-m} in Finger. + +@item init-file +In some programs, specify the name of the file to read as the user's +init file. + +@item initial +@samp{-i} in @code{expand}. + +@item initial-tab +@samp{-T} in @code{diff}. + +@item inode +@samp{-i} in @code{ls}. + +@item interactive +@samp{-i} in @code{cp}, @code{ln}, @code{mv}, @code{rm}; +@samp{-e} in @code{m4}; +@samp{-p} in @code{xargs}; +@samp{-w} in @code{tar}. + +@item intermix-type +@samp{-p} in @code{shar}. + +@item iso-8601 +Used in @code{date} + +@item jobs +@samp{-j} in Make. + +@item just-print +@samp{-n} in Make. + +@item keep-going +@samp{-k} in Make. + +@item keep-files +@samp{-k} in @code{csplit}. + +@item kilobytes +@samp{-k} in @code{du} and @code{ls}. + +@item language +@samp{-l} in @code{etags}. + +@item less-mode +@samp{-l} in @code{wdiff}. + +@item level-for-gzip +@samp{-g} in @code{shar}. + +@item line-bytes +@samp{-C} in @code{split}. + +@item lines +Used in @code{split}, @code{head}, and @code{tail}. + +@item link +@samp{-l} in @code{cpio}. + +@item lint +@itemx lint-old +Used in @code{gawk}. + +@item list +@samp{-t} in @code{cpio}; +@samp{-l} in @code{recode}. + +@item list +@samp{-t} in @code{tar}. + +@item literal +@samp{-N} in @code{ls}. + +@item load-average +@samp{-l} in Make. + +@item login +Used in @code{su}. + +@item machine +No listing of which programs already use this; +someone should check to +see if any actually do, and tell @email{gnu@@gnu.org}. + +@item macro-name +@samp{-M} in @code{ptx}. + +@item mail +@samp{-m} in @code{hello} and @code{uname}. + +@item make-directories +@samp{-d} in @code{cpio}. + +@item makefile +@samp{-f} in Make. + +@item mapped +Used in GDB. + +@item max-args +@samp{-n} in @code{xargs}. + +@item max-chars +@samp{-n} in @code{xargs}. + +@item max-lines +@samp{-l} in @code{xargs}. + +@item max-load +@samp{-l} in Make. + +@item max-procs +@samp{-P} in @code{xargs}. + +@item mesg +@samp{-T} in @code{who}. + +@item message +@samp{-T} in @code{who}. + +@item minimal +@samp{-d} in @code{diff}. + +@item mixed-uuencode +@samp{-M} in @code{shar}. + +@item mode +@samp{-m} in @code{install}, @code{mkdir}, and @code{mkfifo}. + +@item modification-time +@samp{-m} in @code{tar}. + +@item multi-volume +@samp{-M} in @code{tar}. + +@item name-prefix +@samp{-a} in Bison. + +@item nesting-limit +@samp{-L} in @code{m4}. + +@item net-headers +@samp{-a} in @code{shar}. + +@item new-file +@samp{-W} in Make. + +@item no-builtin-rules +@samp{-r} in Make. + +@item no-character-count +@samp{-w} in @code{shar}. + +@item no-check-existing +@samp{-x} in @code{shar}. + +@item no-common +@samp{-3} in @code{wdiff}. + +@item no-create +@samp{-c} in @code{touch}. + +@item no-defines +@samp{-D} in @code{etags}. + +@item no-deleted +@samp{-1} in @code{wdiff}. + +@item no-dereference +@samp{-d} in @code{cp}. + +@item no-inserted +@samp{-2} in @code{wdiff}. + +@item no-keep-going +@samp{-S} in Make. + +@item no-lines +@samp{-l} in Bison. + +@item no-piping +@samp{-P} in @code{shar}. + +@item no-prof +@samp{-e} in @code{gprof}. + +@item no-regex +@samp{-R} in @code{etags}. + +@item no-sort +@samp{-p} in @code{nm}. + +@item no-split +Used in @code{makeinfo}. + +@item no-static +@samp{-a} in @code{gprof}. + +@item no-time +@samp{-E} in @code{gprof}. + +@item no-timestamp +@samp{-m} in @code{shar}. + +@item no-validate +Used in @code{makeinfo}. + +@item no-wait +Used in @code{emacsclient}. + +@item no-warn +Used in various programs to inhibit warnings. + +@item node +@samp{-n} in @code{info}. + +@item nodename +@samp{-n} in @code{uname}. + +@item nonmatching +@samp{-f} in @code{cpio}. + +@item nstuff +@samp{-n} in @code{objdump}. + +@item null +@samp{-0} in @code{xargs}. + +@item number +@samp{-n} in @code{cat}. + +@item number-nonblank +@samp{-b} in @code{cat}. + +@item numeric-sort +@samp{-n} in @code{nm}. + +@item numeric-uid-gid +@samp{-n} in @code{cpio} and @code{ls}. + +@item nx +Used in GDB. + +@item old-archive +@samp{-o} in @code{tar}. + +@item old-file +@samp{-o} in Make. + +@item one-file-system +@samp{-l} in @code{tar}, @code{cp}, and @code{du}. + +@item only-file +@samp{-o} in @code{ptx}. + +@item only-prof +@samp{-f} in @code{gprof}. + +@item only-time +@samp{-F} in @code{gprof}. + +@item options +@samp{-o} in @code{getopt}, @code{fdlist}, @code{fdmount}, +@code{fdmountd}, and @code{fdumount}. + +@item output +In various programs, specify the output file name. + +@item output-prefix +@samp{-o} in @code{shar}. + +@item override +@samp{-o} in @code{rm}. + +@item overwrite +@samp{-c} in @code{unshar}. + +@item owner +@samp{-o} in @code{install}. + +@item paginate +@samp{-l} in @code{diff}. + +@item paragraph-indent +Used in @code{makeinfo}. + +@item parents +@samp{-p} in @code{mkdir} and @code{rmdir}. + +@item pass-all +@samp{-p} in @code{ul}. + +@item pass-through +@samp{-p} in @code{cpio}. + +@item port +@samp{-P} in @code{finger}. + +@item portability +@samp{-c} in @code{cpio} and @code{tar}. + +@item posix +Used in @code{gawk}. + +@item prefix-builtins +@samp{-P} in @code{m4}. + +@item prefix +@samp{-f} in @code{csplit}. + +@item preserve +Used in @code{tar} and @code{cp}. + +@item preserve-environment +@samp{-p} in @code{su}. + +@item preserve-modification-time +@samp{-m} in @code{cpio}. + +@item preserve-order +@samp{-s} in @code{tar}. + +@item preserve-permissions +@samp{-p} in @code{tar}. + +@item print +@samp{-l} in @code{diff}. + +@item print-chars +@samp{-L} in @code{cmp}. + +@item print-data-base +@samp{-p} in Make. + +@item print-directory +@samp{-w} in Make. + +@item print-file-name +@samp{-o} in @code{nm}. + +@item print-symdefs +@samp{-s} in @code{nm}. + +@item printer +@samp{-p} in @code{wdiff}. + +@item prompt +@samp{-p} in @code{ed}. + +@item proxy +Specify an HTTP proxy. + +@item query-user +@samp{-X} in @code{shar}. + +@item question +@samp{-q} in Make. + +@item quiet +Used in many programs to inhibit the usual output. @strong{Note:} every +program accepting @samp{--quiet} should accept @samp{--silent} as a +synonym. + +@item quiet-unshar +@samp{-Q} in @code{shar} + +@item quote-name +@samp{-Q} in @code{ls}. + +@item rcs +@samp{-n} in @code{diff}. + +@item re-interval +Used in @code{gawk}. + +@item read-full-blocks +@samp{-B} in @code{tar}. + +@item readnow +Used in GDB. + +@item recon +@samp{-n} in Make. + +@item record-number +@samp{-R} in @code{tar}. + +@item recursive +Used in @code{chgrp}, @code{chown}, @code{cp}, @code{ls}, @code{diff}, +and @code{rm}. + +@item reference-limit +Used in @code{makeinfo}. + +@item references +@samp{-r} in @code{ptx}. + +@item regex +@samp{-r} in @code{tac} and @code{etags}. + +@item release +@samp{-r} in @code{uname}. + +@item reload-state +@samp{-R} in @code{m4}. + +@item relocation +@samp{-r} in @code{objdump}. + +@item rename +@samp{-r} in @code{cpio}. + +@item replace +@samp{-i} in @code{xargs}. + +@item report-identical-files +@samp{-s} in @code{diff}. + +@item reset-access-time +@samp{-a} in @code{cpio}. + +@item reverse +@samp{-r} in @code{ls} and @code{nm}. + +@item reversed-ed +@samp{-f} in @code{diff}. + +@item right-side-defs +@samp{-R} in @code{ptx}. + +@item same-order +@samp{-s} in @code{tar}. + +@item same-permissions +@samp{-p} in @code{tar}. + +@item save +@samp{-g} in @code{stty}. + +@item se +Used in GDB. + +@item sentence-regexp +@samp{-S} in @code{ptx}. + +@item separate-dirs +@samp{-S} in @code{du}. + +@item separator +@samp{-s} in @code{tac}. + +@item sequence +Used by @code{recode} to chose files or pipes for sequencing passes. + +@item shell +@samp{-s} in @code{su}. + +@item show-all +@samp{-A} in @code{cat}. + +@item show-c-function +@samp{-p} in @code{diff}. + +@item show-ends +@samp{-E} in @code{cat}. + +@item show-function-line +@samp{-F} in @code{diff}. + +@item show-tabs +@samp{-T} in @code{cat}. + +@item silent +Used in many programs to inhibit the usual output. +@strong{Note:} every program accepting +@samp{--silent} should accept @samp{--quiet} as a synonym. + +@item size +@samp{-s} in @code{ls}. + +@item socket +Specify a file descriptor for a network server to use for its socket, +instead of opening and binding a new socket. This provides a way to +run, in a nonpriveledged process, a server that normally needs a +reserved port number. + +@item sort +Used in @code{ls}. + +@item source +@samp{-W source} in @code{gawk}. + +@item sparse +@samp{-S} in @code{tar}. + +@item speed-large-files +@samp{-H} in @code{diff}. + +@item split-at +@samp{-E} in @code{unshar}. + +@item split-size-limit +@samp{-L} in @code{shar}. + +@item squeeze-blank +@samp{-s} in @code{cat}. + +@item start-delete +@samp{-w} in @code{wdiff}. + +@item start-insert +@samp{-y} in @code{wdiff}. + +@item starting-file +Used in @code{tar} and @code{diff} to specify which file within +a directory to start processing with. + +@item statistics +@samp{-s} in @code{wdiff}. + +@item stdin-file-list +@samp{-S} in @code{shar}. + +@item stop +@samp{-S} in Make. + +@item strict +@samp{-s} in @code{recode}. + +@item strip +@samp{-s} in @code{install}. + +@item strip-all +@samp{-s} in @code{strip}. + +@item strip-debug +@samp{-S} in @code{strip}. + +@item submitter +@samp{-s} in @code{shar}. + +@item suffix +@samp{-S} in @code{cp}, @code{ln}, @code{mv}. + +@item suffix-format +@samp{-b} in @code{csplit}. + +@item sum +@samp{-s} in @code{gprof}. + +@item summarize +@samp{-s} in @code{du}. + +@item symbolic +@samp{-s} in @code{ln}. + +@item symbols +Used in GDB and @code{objdump}. + +@item synclines +@samp{-s} in @code{m4}. + +@item sysname +@samp{-s} in @code{uname}. + +@item tabs +@samp{-t} in @code{expand} and @code{unexpand}. + +@item tabsize +@samp{-T} in @code{ls}. + +@item terminal +@samp{-T} in @code{tput} and @code{ul}. +@samp{-t} in @code{wdiff}. + +@item text +@samp{-a} in @code{diff}. + +@item text-files +@samp{-T} in @code{shar}. + +@item time +Used in @code{ls} and @code{touch}. + +@item timeout +Specify how long to wait before giving up on some operation. + +@item to-stdout +@samp{-O} in @code{tar}. + +@item total +@samp{-c} in @code{du}. + +@item touch +@samp{-t} in Make, @code{ranlib}, and @code{recode}. + +@item trace +@samp{-t} in @code{m4}. + +@item traditional +@samp{-t} in @code{hello}; +@samp{-W traditional} in @code{gawk}; +@samp{-G} in @code{ed}, @code{m4}, and @code{ptx}. + +@item tty +Used in GDB. + +@item typedefs +@samp{-t} in @code{ctags}. + +@item typedefs-and-c++ +@samp{-T} in @code{ctags}. + +@item typeset-mode +@samp{-t} in @code{ptx}. + +@item uncompress +@samp{-z} in @code{tar}. + +@item unconditional +@samp{-u} in @code{cpio}. + +@item undefine +@samp{-U} in @code{m4}. + +@item undefined-only +@samp{-u} in @code{nm}. + +@item update +@samp{-u} in @code{cp}, @code{ctags}, @code{mv}, @code{tar}. + +@item usage +Used in @code{gawk}; same as @samp{--help}. + +@item uuencode +@samp{-B} in @code{shar}. + +@item vanilla-operation +@samp{-V} in @code{shar}. + +@item verbose +Print more information about progress. Many programs support this. + +@item verify +@samp{-W} in @code{tar}. + +@item version +Print the version number. + +@item version-control +@samp{-V} in @code{cp}, @code{ln}, @code{mv}. + +@item vgrind +@samp{-v} in @code{ctags}. + +@item volume +@samp{-V} in @code{tar}. + +@item what-if +@samp{-W} in Make. + +@item whole-size-limit +@samp{-l} in @code{shar}. + +@item width +@samp{-w} in @code{ls} and @code{ptx}. + +@item word-regexp +@samp{-W} in @code{ptx}. + +@item writable +@samp{-T} in @code{who}. + +@item zeros +@samp{-z} in @code{gprof}. +@end table + +@node Memory Usage +@section Memory Usage +@cindex memory usage + +If a program typically uses just a few meg of memory, don't bother making any +effort to reduce memory usage. For example, if it is impractical for +other reasons to operate on files more than a few meg long, it is +reasonable to read entire input files into core to operate on them. + +However, for programs such as @code{cat} or @code{tail}, that can +usefully operate on very large files, it is important to avoid using a +technique that would artificially limit the size of files it can handle. +If a program works by lines and could be applied to arbitrary +user-supplied input files, it should keep only a line in memory, because +this is not very hard and users will want to be able to operate on input +files that are bigger than will fit in core all at once. + +If your program creates complicated data structures, just make them in +core and give a fatal error if @code{malloc} returns zero. + +@node File Usage +@section File Usage +@cindex file usage + +Programs should be prepared to operate when @file{/usr} and @file{/etc} +are read-only file systems. Thus, if the program manages log files, +lock files, backup files, score files, or any other files which are +modified for internal purposes, these files should not be stored in +@file{/usr} or @file{/etc}. + +There are two exceptions. @file{/etc} is used to store system +configuration information; it is reasonable for a program to modify +files in @file{/etc} when its job is to update the system configuration. +Also, if the user explicitly asks to modify one file in a directory, it +is reasonable for the program to store other files in the same +directory. + +@node Writing C +@chapter Making The Best Use of C + +This @value{CHAPTER} provides advice on how best to use the C language +when writing GNU software. + +@menu +* Formatting:: Formatting Your Source Code +* Comments:: Commenting Your Work +* Syntactic Conventions:: Clean Use of C Constructs +* Names:: Naming Variables and Functions +* System Portability:: Portability between different operating systems +* CPU Portability:: Supporting the range of CPU types +* System Functions:: Portability and ``standard'' library functions +* Internationalization:: Techniques for internationalization +* Mmap:: How you can safely use @code{mmap}. +@end menu + +@node Formatting +@section Formatting Your Source Code +@cindex formatting source code + +@cindex open brace +@cindex braces, in C source +It is important to put the open-brace that starts the body of a C +function in column zero, and avoid putting any other open-brace or +open-parenthesis or open-bracket in column zero. Several tools look +for open-braces in column zero to find the beginnings of C functions. +These tools will not work on code not formatted that way. + +It is also important for function definitions to start the name of the +function in column zero. This helps people to search for function +definitions, and may also help certain tools recognize them. Thus, +the proper format is this: + +@example +static char * +concat (s1, s2) /* Name starts in column zero here */ + char *s1, *s2; +@{ /* Open brace in column zero here */ + @dots{} +@} +@end example + +@noindent +or, if you want to use Standard C syntax, format the definition like +this: + +@example +static char * +concat (char *s1, char *s2) +@{ + @dots{} +@} +@end example + +In Standard C, if the arguments don't fit nicely on one line, +split it like this: + +@example +int +lots_of_args (int an_integer, long a_long, short a_short, + double a_double, float a_float) +@dots{} +@end example + +The rest of this section gives our recommendations for other aspects of +C formatting style, which is also the default style of the @code{indent} +program in version 1.2 and newer. It corresponds to the options + +@smallexample +-nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 +-ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob +@end smallexample + +We don't think of these recommendations as requirements, because it +causes no problems for users if two different programs have different +formatting styles. + +But whatever style you use, please use it consistently, since a mixture +of styles within one program tends to look ugly. If you are +contributing changes to an existing program, please follow the style of +that program. + +For the body of the function, our recommended style looks like this: + +@example +if (x < foo (y, z)) + haha = bar[4] + 5; +else + @{ + while (z) + @{ + haha += foo (z, z); + z--; + @} + return ++x + bar (); + @} +@end example + +@cindex spaces before open-paren +We find it easier to read a program when it has spaces before the +open-parentheses and after the commas. Especially after the commas. + +When you split an expression into multiple lines, split it +before an operator, not after one. Here is the right way: + +@cindex expressions, splitting +@example +if (foo_this_is_long && bar > win (x, y, z) + && remaining_condition) +@end example + +Try to avoid having two operators of different precedence at the same +level of indentation. For example, don't write this: + +@example +mode = (inmode[j] == VOIDmode + || GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]) + ? outmode[j] : inmode[j]); +@end example + +Instead, use extra parentheses so that the indentation shows the nesting: + +@example +mode = ((inmode[j] == VOIDmode + || (GET_MODE_SIZE (outmode[j]) > GET_MODE_SIZE (inmode[j]))) + ? outmode[j] : inmode[j]); +@end example + +Insert extra parentheses so that Emacs will indent the code properly. +For example, the following indentation looks nice if you do it by hand, + +@example +v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000; +@end example + +@noindent +but Emacs would alter it. Adding a set of parentheses produces +something that looks equally nice, and which Emacs will preserve: + +@example +v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000); +@end example + +Format do-while statements like this: + +@example +do + @{ + a = foo (a); + @} +while (a > 0); +@end example + +@cindex formfeed +@cindex control-L +Please use formfeed characters (control-L) to divide the program into +pages at logical places (but not within a function). It does not matter +just how long the pages are, since they do not have to fit on a printed +page. The formfeeds should appear alone on lines by themselves. + +@node Comments +@section Commenting Your Work +@cindex commenting + +Every program should start with a comment saying briefly what it is for. +Example: @samp{fmt - filter for simple filling of text}. + +Please write the comments in a GNU program in English, because English +is the one language that nearly all programmers in all countries can +read. If you do not write English well, please write comments in +English as well as you can, then ask other people to help rewrite them. +If you can't write comments in English, please find someone to work with +you and translate your comments into English. + +Please put a comment on each function saying what the function does, +what sorts of arguments it gets, and what the possible values of +arguments mean and are used for. It is not necessary to duplicate in +words the meaning of the C argument declarations, if a C type is being +used in its customary fashion. If there is anything nonstandard about +its use (such as an argument of type @code{char *} which is really the +address of the second character of a string, not the first), or any +possible values that would not work the way one would expect (such as, +that strings containing newlines are not guaranteed to work), be sure +to say so. + +Also explain the significance of the return value, if there is one. + +Please put two spaces after the end of a sentence in your comments, so +that the Emacs sentence commands will work. Also, please write +complete sentences and capitalize the first word. If a lower-case +identifier comes at the beginning of a sentence, don't capitalize it! +Changing the spelling makes it a different identifier. If you don't +like starting a sentence with a lower case letter, write the sentence +differently (e.g., ``The identifier lower-case is @dots{}''). + +The comment on a function is much clearer if you use the argument +names to speak about the argument values. The variable name itself +should be lower case, but write it in upper case when you are speaking +about the value rather than the variable itself. Thus, ``the inode +number NODE_NUM'' rather than ``an inode''. + +There is usually no purpose in restating the name of the function in +the comment before it, because the reader can see that for himself. +There might be an exception when the comment is so long that the function +itself would be off the bottom of the screen. + +There should be a comment on each static variable as well, like this: + +@example +/* Nonzero means truncate lines in the display; + zero means continue them. */ +int truncate_lines; +@end example + +@cindex conditionals, comments for +@cindex @code{#endif}, commenting +Every @samp{#endif} should have a comment, except in the case of short +conditionals (just a few lines) that are not nested. The comment should +state the condition of the conditional that is ending, @emph{including +its sense}. @samp{#else} should have a comment describing the condition +@emph{and sense} of the code that follows. For example: + +@example +@group +#ifdef foo + @dots{} +#else /* not foo */ + @dots{} +#endif /* not foo */ +@end group +@group +#ifdef foo + @dots{} +#endif /* foo */ +@end group +@end example + +@noindent +but, by contrast, write the comments this way for a @samp{#ifndef}: + +@example +@group +#ifndef foo + @dots{} +#else /* foo */ + @dots{} +#endif /* foo */ +@end group +@group +#ifndef foo + @dots{} +#endif /* not foo */ +@end group +@end example + +@node Syntactic Conventions +@section Clean Use of C Constructs +@cindex syntactic conventions + +@cindex implicit @code{int} +@cindex function argument, declaring +Please explicitly declare the types of all objects. For example, you +should explicitly declare all arguments to functions, and you should +declare functions to return @code{int} rather than omitting the +@code{int}. + +@cindex compiler warnings +@cindex @samp{-Wall} compiler option +Some programmers like to use the GCC @samp{-Wall} option, and change the +code whenever it issues a warning. If you want to do this, then do. +Other programmers prefer not to use @samp{-Wall}, because it gives +warnings for valid and legitimate code which they do not want to change. +If you want to do this, then do. The compiler should be your servant, +not your master. + +Declarations of external functions and functions to appear later in the +source file should all go in one place near the beginning of the file +(somewhere before the first function definition in the file), or else +should go in a header file. Don't put @code{extern} declarations inside +functions. + +@cindex temporary variables +It used to be common practice to use the same local variables (with +names like @code{tem}) over and over for different values within one +function. Instead of doing this, it is better declare a separate local +variable for each distinct purpose, and give it a name which is +meaningful. This not only makes programs easier to understand, it also +facilitates optimization by good compilers. You can also move the +declaration of each local variable into the smallest scope that includes +all its uses. This makes the program even cleaner. + +Don't use local variables or parameters that shadow global identifiers. + +@cindex multiple variables in a line +Don't declare multiple variables in one declaration that spans lines. +Start a new declaration on each line, instead. For example, instead +of this: + +@example +@group +int foo, + bar; +@end group +@end example + +@noindent +write either this: + +@example +int foo, bar; +@end example + +@noindent +or this: + +@example +int foo; +int bar; +@end example + +@noindent +(If they are global variables, each should have a comment preceding it +anyway.) + +When you have an @code{if}-@code{else} statement nested in another +@code{if} statement, always put braces around the @code{if}-@code{else}. +Thus, never write like this: + +@example +if (foo) + if (bar) + win (); + else + lose (); +@end example + +@noindent +always like this: + +@example +if (foo) + @{ + if (bar) + win (); + else + lose (); + @} +@end example + +If you have an @code{if} statement nested inside of an @code{else} +statement, either write @code{else if} on one line, like this, + +@example +if (foo) + @dots{} +else if (bar) + @dots{} +@end example + +@noindent +with its @code{then}-part indented like the preceding @code{then}-part, +or write the nested @code{if} within braces like this: + +@example +if (foo) + @dots{} +else + @{ + if (bar) + @dots{} + @} +@end example + +Don't declare both a structure tag and variables or typedefs in the +same declaration. Instead, declare the structure tag separately +and then use it to declare the variables or typedefs. + +Try to avoid assignments inside @code{if}-conditions. For example, +don't write this: + +@example +if ((foo = (char *) malloc (sizeof *foo)) == 0) + fatal ("virtual memory exhausted"); +@end example + +@noindent +instead, write this: + +@example +foo = (char *) malloc (sizeof *foo); +if (foo == 0) + fatal ("virtual memory exhausted"); +@end example + +@pindex lint +Don't make the program ugly to placate @code{lint}. Please don't insert any +casts to @code{void}. Zero without a cast is perfectly fine as a null +pointer constant, except when calling a varargs function. + +@node Names +@section Naming Variables and Functions + +@cindex names of variables and functions +The names of global variables and functions in a program serve as +comments of a sort. So don't choose terse names---instead, look for +names that give useful information about the meaning of the variable or +function. In a GNU program, names should be English, like other +comments. + +Local variable names can be shorter, because they are used only within +one context, where (presumably) comments explain their purpose. + +Try to limit your use of abbreviations in symbol names. It is ok to +make a few abbreviations, explain what they mean, and then use them +frequently, but don't use lots of obscure abbreviations. + +Please use underscores to separate words in a name, so that the Emacs +word commands can be useful within them. Stick to lower case; reserve +upper case for macros and @code{enum} constants, and for name-prefixes +that follow a uniform convention. + +For example, you should use names like @code{ignore_space_change_flag}; +don't use names like @code{iCantReadThis}. + +Variables that indicate whether command-line options have been +specified should be named after the meaning of the option, not after +the option-letter. A comment should state both the exact meaning of +the option and its letter. For example, + +@example +@group +/* Ignore changes in horizontal whitespace (-b). */ +int ignore_space_change_flag; +@end group +@end example + +When you want to define names with constant integer values, use +@code{enum} rather than @samp{#define}. GDB knows about enumeration +constants. + +@cindex file-name limitations +@pindex doschk +You might want to make sure that none of the file names would conflict +the files were loaded onto an MS-DOS file system which shortens the +names. You can use the program @code{doschk} to test for this. + +Some GNU programs were designed to limit themselves to file names of 14 +characters or less, to avoid file name conflicts if they are read into +older System V systems. Please preserve this feature in the existing +GNU programs that have it, but there is no need to do this in new GNU +programs. @code{doschk} also reports file names longer than 14 +characters. + +@node System Portability +@section Portability between System Types +@cindex portability, between system types + +In the Unix world, ``portability'' refers to porting to different Unix +versions. For a GNU program, this kind of portability is desirable, but +not paramount. + +The primary purpose of GNU software is to run on top of the GNU kernel, +compiled with the GNU C compiler, on various types of @sc{cpu}. So the +kinds of portability that are absolutely necessary are quite limited. +But it is important to support Linux-based GNU systems, since they +are the form of GNU that is popular. + +Beyond that, it is good to support the other free operating systems +(*BSD), and it is nice to support other Unix-like systems if you want +to. Supporting a variety of Unix-like systems is desirable, although +not paramount. It is usually not too hard, so you may as well do it. +But you don't have to consider it an obligation, if it does turn out to +be hard. + +@pindex autoconf +The easiest way to achieve portability to most Unix-like systems is to +use Autoconf. It's unlikely that your program needs to know more +information about the host platform than Autoconf can provide, simply +because most of the programs that need such knowledge have already been +written. + +Avoid using the format of semi-internal data bases (e.g., directories) +when there is a higher-level alternative (@code{readdir}). + +@cindex non-@sc{posix} systems, and portability +As for systems that are not like Unix, such as MSDOS, Windows, the +Macintosh, VMS, and MVS, supporting them is often a lot of work. When +that is the case, it is better to spend your time adding features that +will be useful on GNU and GNU/Linux, rather than on supporting other +incompatible systems. + +It is a good idea to define the ``feature test macro'' +@code{_GNU_SOURCE} when compiling your C files. When you compile on GNU +or GNU/Linux, this will enable the declarations of GNU library extension +functions, and that will usually give you a compiler error message if +you define the same function names in some other way in your program. +(You don't have to actually @emph{use} these functions, if you prefer +to make the program more portable to other systems.) + +But whether or not you use these GNU extensions, you should avoid +using their names for any other meanings. Doing so would make it hard +to move your code into other GNU programs. + +@node CPU Portability +@section Portability between @sc{cpu}s + +@cindex data types, and portability +@cindex portability, and data types +Even GNU systems will differ because of differences among @sc{cpu} +types---for example, difference in byte ordering and alignment +requirements. It is absolutely essential to handle these differences. +However, don't make any effort to cater to the possibility that an +@code{int} will be less than 32 bits. We don't support 16-bit machines +in GNU. + +Similarly, don't make any effort to cater to the possibility that +@code{long} will be smaller than predefined types like @code{size_t}. +For example, the following code is ok: + +@example +printf ("size = %lu\n", (unsigned long) sizeof array); +printf ("diff = %ld\n", (long) (pointer2 - pointer1)); +@end example + +1989 Standard C requires this to work, and we know of only one +counterexample: 64-bit programs on Microsoft Windows IA-64. We will +leave it to those who want to port GNU programs to that environment +to figure out how to do it. + +Predefined file-size types like @code{off_t} are an exception: they are +longer than @code{long} on many platforms, so code like the above won't +work with them. One way to print an @code{off_t} value portably is to +print its digits yourself, one by one. + +Don't assume that the address of an @code{int} object is also the +address of its least-significant byte. This is false on big-endian +machines. Thus, don't make the following mistake: + +@example +int c; +@dots{} +while ((c = getchar()) != EOF) + write(file_descriptor, &c, 1); +@end example + +When calling functions, you need not worry about the difference between +pointers of various types, or between pointers and integers. On most +machines, there's no difference anyway. As for the few machines where +there is a difference, all of them support Standard C prototypes, so you can +use prototypes (perhaps conditionalized to be active only in Standard C) +to make the code work on those systems. + +In certain cases, it is ok to pass integer and pointer arguments +indiscriminately to the same function, and use no prototype on any +system. For example, many GNU programs have error-reporting functions +that pass their arguments along to @code{printf} and friends: + +@example +error (s, a1, a2, a3) + char *s; + char *a1, *a2, *a3; +@{ + fprintf (stderr, "error: "); + fprintf (stderr, s, a1, a2, a3); +@} +@end example + +@noindent +In practice, this works on all machines, since a pointer is generally +the widest possible kind of argument; it is much simpler than any +``correct'' alternative. Be sure @emph{not} to use a prototype for such +functions. + +If you have decided to use Standard C, then you can instead define +@code{error} using @file{stdarg.h}, and pass the arguments along to +@code{vfprintf}. + +@cindex casting pointers to integers +Avoid casting pointers to integers if you can. Such casts greatly +reduce portability, and in most programs they are easy to avoid. In the +cases where casting pointers to integers is essential---such as, a Lisp +interpreter which stores type information as well as an address in one +word---you'll have to make explicit provisions to handle different word +sizes. You will also need to make provision for systems in which the +normal range of addresses you can get from @code{malloc} starts far away +from zero. + +@node System Functions +@section Calling System Functions +@cindex library functions, and portability +@cindex portability, and library functions + +C implementations differ substantially. Standard C reduces but does +not eliminate the incompatibilities; meanwhile, many GNU packages still +support pre-standard compilers because this is not hard to do. This +chapter gives recommendations for how to use the more-or-less standard C +library functions to avoid unnecessary loss of portability. + +@itemize @bullet +@item +Don't use the return value of @code{sprintf}. It returns the number of +characters written on some systems, but not on all systems. + +@item +Be aware that @code{vfprintf} is not always available. + +@item +@code{main} should be declared to return type @code{int}. It should +terminate either by calling @code{exit} or by returning the integer +status code; make sure it cannot ever return an undefined value. + +@cindex declaration for system functions +@item +Don't declare system functions explicitly. + +Almost any declaration for a system function is wrong on some system. +To minimize conflicts, leave it to the system header files to declare +system functions. If the headers don't declare a function, let it +remain undeclared. + +While it may seem unclean to use a function without declaring it, in +practice this works fine for most system library functions on the +systems where this really happens; thus, the disadvantage is only +theoretical. By contrast, actual declarations have frequently caused +actual conflicts. + +@item +If you must declare a system function, don't specify the argument types. +Use an old-style declaration, not a Standard C prototype. The more you +specify about the function, the more likely a conflict. + +@item +In particular, don't unconditionally declare @code{malloc} or +@code{realloc}. + +Most GNU programs use those functions just once, in functions +conventionally named @code{xmalloc} and @code{xrealloc}. These +functions call @code{malloc} and @code{realloc}, respectively, and +check the results. + +Because @code{xmalloc} and @code{xrealloc} are defined in your program, +you can declare them in other files without any risk of type conflict. + +On most systems, @code{int} is the same length as a pointer; thus, the +calls to @code{malloc} and @code{realloc} work fine. For the few +exceptional systems (mostly 64-bit machines), you can use +@strong{conditionalized} declarations of @code{malloc} and +@code{realloc}---or put these declarations in configuration files +specific to those systems. + +@cindex string library functions +@item +The string functions require special treatment. Some Unix systems have +a header file @file{string.h}; others have @file{strings.h}. Neither +file name is portable. There are two things you can do: use Autoconf to +figure out which file to include, or don't include either file. + +@item +If you don't include either strings file, you can't get declarations for +the string functions from the header file in the usual way. + +That causes less of a problem than you might think. The newer standard +string functions should be avoided anyway because many systems still +don't support them. The string functions you can use are these: + +@example +strcpy strncpy strcat strncat +strlen strcmp strncmp +strchr strrchr +@end example + +The copy and concatenate functions work fine without a declaration as +long as you don't use their values. Using their values without a +declaration fails on systems where the width of a pointer differs from +the width of @code{int}, and perhaps in other cases. It is trivial to +avoid using their values, so do that. + +The compare functions and @code{strlen} work fine without a declaration +on most systems, possibly all the ones that GNU software runs on. +You may find it necessary to declare them @strong{conditionally} on a +few systems. + +The search functions must be declared to return @code{char *}. Luckily, +there is no variation in the data type they return. But there is +variation in their names. Some systems give these functions the names +@code{index} and @code{rindex}; other systems use the names +@code{strchr} and @code{strrchr}. Some systems support both pairs of +names, but neither pair works on all systems. + +You should pick a single pair of names and use it throughout your +program. (Nowadays, it is better to choose @code{strchr} and +@code{strrchr} for new programs, since those are the standard +names.) Declare both of those names as functions returning @code{char +*}. On systems which don't support those names, define them as macros +in terms of the other pair. For example, here is what to put at the +beginning of your file (or in a header) if you want to use the names +@code{strchr} and @code{strrchr} throughout: + +@example +#ifndef HAVE_STRCHR +#define strchr index +#endif +#ifndef HAVE_STRRCHR +#define strrchr rindex +#endif + +char *strchr (); +char *strrchr (); +@end example +@end itemize + +Here we assume that @code{HAVE_STRCHR} and @code{HAVE_STRRCHR} are +macros defined in systems where the corresponding functions exist. +One way to get them properly defined is to use Autoconf. + +@node Internationalization +@section Internationalization +@cindex internationalization + +@pindex gettext +GNU has a library called GNU gettext that makes it easy to translate the +messages in a program into various languages. You should use this +library in every program. Use English for the messages as they appear +in the program, and let gettext provide the way to translate them into +other languages. + +Using GNU gettext involves putting a call to the @code{gettext} macro +around each string that might need translation---like this: + +@example +printf (gettext ("Processing file `%s'...")); +@end example + +@noindent +This permits GNU gettext to replace the string @code{"Processing file +`%s'..."} with a translated version. + +Once a program uses gettext, please make a point of writing calls to +@code{gettext} when you add new strings that call for translation. + +Using GNU gettext in a package involves specifying a @dfn{text domain +name} for the package. The text domain name is used to separate the +translations for this package from the translations for other packages. +Normally, the text domain name should be the same as the name of the +package---for example, @samp{fileutils} for the GNU file utilities. + +@cindex message text, and internationalization +To enable gettext to work well, avoid writing code that makes +assumptions about the structure of words or sentences. When you want +the precise text of a sentence to vary depending on the data, use two or +more alternative string constants each containing a complete sentences, +rather than inserting conditionalized words or phrases into a single +sentence framework. + +Here is an example of what not to do: + +@example +printf ("%d file%s processed", nfiles, + nfiles != 1 ? "s" : ""); +@end example + +@noindent +The problem with that example is that it assumes that plurals are made +by adding `s'. If you apply gettext to the format string, like this, + +@example +printf (gettext ("%d file%s processed"), nfiles, + nfiles != 1 ? "s" : ""); +@end example + +@noindent +the message can use different words, but it will still be forced to use +`s' for the plural. Here is a better way: + +@example +printf ((nfiles != 1 ? "%d files processed" + : "%d file processed"), + nfiles); +@end example + +@noindent +This way, you can apply gettext to each of the two strings +independently: + +@example +printf ((nfiles != 1 ? gettext ("%d files processed") + : gettext ("%d file processed")), + nfiles); +@end example + +@noindent +This can be any method of forming the plural of the word for ``file'', and +also handles languages that require agreement in the word for +``processed''. + +A similar problem appears at the level of sentence structure with this +code: + +@example +printf ("# Implicit rule search has%s been done.\n", + f->tried_implicit ? "" : " not"); +@end example + +@noindent +Adding @code{gettext} calls to this code cannot give correct results for +all languages, because negation in some languages requires adding words +at more than one place in the sentence. By contrast, adding +@code{gettext} calls does the job straightfowardly if the code starts +out like this: + +@example +printf (f->tried_implicit + ? "# Implicit rule search has been done.\n", + : "# Implicit rule search has not been done.\n"); +@end example + +@node Mmap +@section Mmap +@findex mmap + +Don't assume that @code{mmap} either works on all files or fails +for all files. It may work on some files and fail on others. + +The proper way to use @code{mmap} is to try it on the specific file for +which you want to use it---and if @code{mmap} doesn't work, fall back on +doing the job in another way using @code{read} and @code{write}. + +The reason this precaution is needed is that the GNU kernel (the HURD) +provides a user-extensible file system, in which there can be many +different kinds of ``ordinary files.'' Many of them support +@code{mmap}, but some do not. It is important to make programs handle +all these kinds of files. + +@node Documentation +@chapter Documenting Programs +@cindex documentation + +A GNU program should ideally come with full free documentation, adequate +for both reference and tutorial purposes. If the package can be +programmed or extended, the documentation should cover programming or +extending it, as well as just using it. + +@menu +* GNU Manuals:: Writing proper manuals. +* Doc Strings and Manuals:: Compiling doc strings doesn't make a manual. +* Manual Structure Details:: Specific structure conventions. +* License for Manuals:: Writing the distribution terms for a manual. +* Manual Credits:: Giving credit to documentation contributors. +* Printed Manuals:: Mentioning the printed manual. +* NEWS File:: NEWS files supplement manuals. +* Change Logs:: Recording Changes +* Man Pages:: Man pages are secondary. +* Reading other Manuals:: How far you can go in learning + from other manuals. +@end menu + +@node GNU Manuals +@section GNU Manuals + +The preferred document format for the GNU system is the Texinfo +formatting language. Every GNU package should (ideally) have +documentation in Texinfo both for reference and for learners. Texinfo +makes it possible to produce a good quality formatted book, using +@TeX{}, and to generate an Info file. It is also possible to generate +HTML output from Texinfo source. See the Texinfo manual, either the +hardcopy, or the on-line version available through @code{info} or the +Emacs Info subsystem (@kbd{C-h i}). + +Nowadays some other formats such as Docbook and Sgmltexi can be +converted automatically into Texinfo. It is ok to produce the Texinfo +documentation by conversion this way, as long as it gives good results. + +Programmers often find it most natural to structure the documentation +following the structure of the implementation, which they know. But +this structure is not necessarily good for explaining how to use the +program; it may be irrelevant and confusing for a user. + +At every level, from the sentences in a paragraph to the grouping of +topics into separate manuals, the right way to structure documentation +is according to the concepts and questions that a user will have in mind +when reading it. Sometimes this structure of ideas matches the +structure of the implementation of the software being documented---but +often they are different. Often the most important part of learning to +write good documentation is learning to notice when you are structuring +the documentation like the implementation, and think about better +alternatives. + +For example, each program in the GNU system probably ought to be +documented in one manual; but this does not mean each program should +have its own manual. That would be following the structure of the +implementation, rather than the structure that helps the user +understand. + +Instead, each manual should cover a coherent @emph{topic}. For example, +instead of a manual for @code{diff} and a manual for @code{diff3}, we +have one manual for ``comparison of files'' which covers both of those +programs, as well as @code{cmp}. By documenting these programs +together, we can make the whole subject clearer. + +The manual which discusses a program should certainly document all of +the program's command-line options and all of its commands. It should +give examples of their use. But don't organize the manual as a list of +features. Instead, organize it logically, by subtopics. Address the +questions that a user will ask when thinking about the job that the +program does. + +In general, a GNU manual should serve both as tutorial and reference. +It should be set up for convenient access to each topic through Info, +and for reading straight through (appendixes aside). A GNU manual +should give a good introduction to a beginner reading through from the +start, and should also provide all the details that hackers want. +The Bison manual is a good example of this---please take a look at it +to see what we mean. + +That is not as hard as it first sounds. Arrange each chapter as a +logical breakdown of its topic, but order the sections, and write their +text, so that reading the chapter straight through makes sense. Do +likewise when structuring the book into chapters, and when structuring a +section into paragraphs. The watchword is, @emph{at each point, address +the most fundamental and important issue raised by the preceding text.} + +If necessary, add extra chapters at the beginning of the manual which +are purely tutorial and cover the basics of the subject. These provide +the framework for a beginner to understand the rest of the manual. The +Bison manual provides a good example of how to do this. + +To serve as a reference, a manual should have an Index that list all the +functions, variables, options, and important concepts that are part of +the program. One combined Index should do for a short manual, but +sometimes for a complex package it is better to use multiple indices. +The Texinfo manual includes advice on preparing good index entries, see +@ref{Index Entries, , Making Index Entries, texinfo, The GNU Texinfo +Manual}, and see @ref{Indexing Commands, , Defining the Entries of an +Index, texinfo, The GNU Texinfo manual}. + +Don't use Unix man pages as a model for how to write GNU documentation; +most of them are terse, badly structured, and give inadequate +explanation of the underlying concepts. (There are, of course, some +exceptions.) Also, Unix man pages use a particular format which is +different from what we use in GNU manuals. + +Please include an email address in the manual for where to report +bugs @emph{in the manual}. + +Please do not use the term ``pathname'' that is used in Unix +documentation; use ``file name'' (two words) instead. We use the term +``path'' only for search paths, which are lists of directory names. + +Please do not use the term ``illegal'' to refer to erroneous input to a +computer program. Please use ``invalid'' for this, and reserve the term +``illegal'' for activities punishable by law. + +@node Doc Strings and Manuals +@section Doc Strings and Manuals + +Some programming systems, such as Emacs, provide a documentation string +for each function, command or variable. You may be tempted to write a +reference manual by compiling the documentation strings and writing a +little additional text to go around them---but you must not do it. That +approach is a fundamental mistake. The text of well-written +documentation strings will be entirely wrong for a manual. + +A documentation string needs to stand alone---when it appears on the +screen, there will be no other text to introduce or explain it. +Meanwhile, it can be rather informal in style. + +The text describing a function or variable in a manual must not stand +alone; it appears in the context of a section or subsection. Other text +at the beginning of the section should explain some of the concepts, and +should often make some general points that apply to several functions or +variables. The previous descriptions of functions and variables in the +section will also have given information about the topic. A description +written to stand alone would repeat some of that information; this +redundance looks bad. Meanwhile, the informality that is acceptable in +a documentation string is totally unacceptable in a manual. + +The only good way to use documentation strings in writing a good manual +is to use them as a source of information for writing good text. + +@node Manual Structure Details +@section Manual Structure Details +@cindex manual structure + +The title page of the manual should state the version of the programs or +packages documented in the manual. The Top node of the manual should +also contain this information. If the manual is changing more +frequently than or independent of the program, also state a version +number for the manual in both of these places. + +Each program documented in the manual should have a node named +@samp{@var{program} Invocation} or @samp{Invoking @var{program}}. This +node (together with its subnodes, if any) should describe the program's +command line arguments and how to run it (the sort of information people +would look in a man page for). Start with an @samp{@@example} +containing a template for all the options and arguments that the program +uses. + +Alternatively, put a menu item in some menu whose item name fits one of +the above patterns. This identifies the node which that item points to +as the node for this purpose, regardless of the node's actual name. + +The @samp{--usage} feature of the Info reader looks for such a node +or menu item in order to find the relevant text, so it is essential +for every Texinfo file to have one. + +If one manual describes several programs, it should have such a node for +each program described in the manual. + +@node License for Manuals +@section License for Manuals +@cindex license for manuals + +Please use the GNU Free Documentation License for all GNU manuals that +are more than a few pages long. Likewise for a collection of short +documents---you only need one copy of the GNU FDL for the whole +collection. For a single short document, you can use a very permissive +non-copyleft license, to avoid taking up space with a long license. + +See @uref{http://www.gnu.org/copyleft/fdl-howto.html} for more explanation +of how to employ the GFDL. + +Note that it is not obligatory to include a copy of the GNU GPL or GNU +LGPL in a manual whose license is neither the GPL nor the LGPL. It can +be a good idea to include the program's license in a large manual; in a +short manual, whose size would be increased considerably by including +the program's license, it is probably better not to include it. + +@node Manual Credits +@section Manual Credits +@cindex credits for manuals + +Please credit the principal human writers of the manual as the authors, +on the title page of the manual. If a company sponsored the work, thank +the company in a suitable place in the manual, but do not cite the +company as an author. + +@node Printed Manuals +@section Printed Manuals + +The FSF publishes some GNU manuals in printed form. To encourage sales +of these manuals, the on-line versions of the manual should mention at +the very start that the printed manual is available and should point at +information for getting it---for instance, with a link to the page +@url{http://www.gnu.org/order/order.html}. This should not be included +in the printed manual, though, because there it is redundant. + +It is also useful to explain in the on-line forms of the manual how the +user can print out the manual from the sources. + +@node NEWS File +@section The NEWS File +@cindex @file{NEWS} file + +In addition to its manual, the package should have a file named +@file{NEWS} which contains a list of user-visible changes worth +mentioning. In each new release, add items to the front of the file and +identify the version they pertain to. Don't discard old items; leave +them in the file after the newer items. This way, a user upgrading from +any previous version can see what is new. + +If the @file{NEWS} file gets very long, move some of the older items +into a file named @file{ONEWS} and put a note at the end referring the +user to that file. + +@node Change Logs +@section Change Logs +@cindex change logs + +Keep a change log to describe all the changes made to program source +files. The purpose of this is so that people investigating bugs in the +future will know about the changes that might have introduced the bug. +Often a new bug can be found by looking at what was recently changed. +More importantly, change logs can help you eliminate conceptual +inconsistencies between different parts of a program, by giving you a +history of how the conflicting concepts arose and who they came from. + +@menu +* Change Log Concepts:: +* Style of Change Logs:: +* Simple Changes:: +* Conditional Changes:: +* Indicating the Part Changed:: +@end menu + +@node Change Log Concepts +@subsection Change Log Concepts + +You can think of the change log as a conceptual ``undo list'' which +explains how earlier versions were different from the current version. +People can see the current version; they don't need the change log +to tell them what is in it. What they want from a change log is a +clear explanation of how the earlier version differed. + +The change log file is normally called @file{ChangeLog} and covers an +entire directory. Each directory can have its own change log, or a +directory can use the change log of its parent directory--it's up to +you. + +Another alternative is to record change log information with a version +control system such as RCS or CVS. This can be converted automatically +to a @file{ChangeLog} file using @code{rcs2log}; in Emacs, the command +@kbd{C-x v a} (@code{vc-update-change-log}) does the job. + +There's no need to describe the full purpose of the changes or how they +work together. If you think that a change calls for explanation, you're +probably right. Please do explain it---but please put the explanation +in comments in the code, where people will see it whenever they see the +code. For example, ``New function'' is enough for the change log when +you add a function, because there should be a comment before the +function definition to explain what it does. + +However, sometimes it is useful to write one line to describe the +overall purpose of a batch of changes. + +The easiest way to add an entry to @file{ChangeLog} is with the Emacs +command @kbd{M-x add-change-log-entry}. An entry should have an +asterisk, the name of the changed file, and then in parentheses the name +of the changed functions, variables or whatever, followed by a colon. +Then describe the changes you made to that function or variable. + +@node Style of Change Logs +@subsection Style of Change Logs +@cindex change logs, style + +Here are some simple examples of change log entries, starting with the +header line that says who made the change and when, followed by +descriptions of specific changes. (These examples are drawn from Emacs +and GCC.) + +@example +1998-08-17 Richard Stallman <rms@@gnu.org> + +* register.el (insert-register): Return nil. +(jump-to-register): Likewise. + +* sort.el (sort-subr): Return nil. + +* tex-mode.el (tex-bibtex-file, tex-file, tex-region): +Restart the tex shell if process is gone or stopped. +(tex-shell-running): New function. + +* expr.c (store_one_arg): Round size up for move_block_to_reg. +(expand_call): Round up when emitting USE insns. +* stmt.c (assign_parms): Round size up for move_block_from_reg. +@end example + +It's important to name the changed function or variable in full. Don't +abbreviate function or variable names, and don't combine them. +Subsequent maintainers will often search for a function name to find all +the change log entries that pertain to it; if you abbreviate the name, +they won't find it when they search. + +For example, some people are tempted to abbreviate groups of function +names by writing @samp{* register.el (@{insert,jump-to@}-register)}; +this is not a good idea, since searching for @code{jump-to-register} or +@code{insert-register} would not find that entry. + +Separate unrelated change log entries with blank lines. When two +entries represent parts of the same change, so that they work together, +then don't put blank lines between them. Then you can omit the file +name and the asterisk when successive entries are in the same file. + +Break long lists of function names by closing continued lines with +@samp{)}, rather than @samp{,}, and opening the continuation with +@samp{(} as in this example: + +@example +* keyboard.c (menu_bar_items, tool_bar_items) +(Fexecute_extended_command): Deal with `keymap' property. +@end example + +@node Simple Changes +@subsection Simple Changes + +Certain simple kinds of changes don't need much detail in the change +log. + +When you change the calling sequence of a function in a simple fashion, +and you change all the callers of the function to use the new calling +sequence, there is no need to make individual entries for all the +callers that you changed. Just write in the entry for the function +being called, ``All callers changed''---like this: + +@example +* keyboard.c (Fcommand_execute): New arg SPECIAL. +All callers changed. +@end example + +When you change just comments or doc strings, it is enough to write an +entry for the file, without mentioning the functions. Just ``Doc +fixes'' is enough for the change log. + +There's no need to make change log entries for documentation files. +This is because documentation is not susceptible to bugs that are hard +to fix. Documentation does not consist of parts that must interact in a +precisely engineered fashion. To correct an error, you need not know +the history of the erroneous passage; it is enough to compare what the +documentation says with the way the program actually works. + +@node Conditional Changes +@subsection Conditional Changes +@cindex conditional changes, and change logs +@cindex change logs, conditional changes + +C programs often contain compile-time @code{#if} conditionals. Many +changes are conditional; sometimes you add a new definition which is +entirely contained in a conditional. It is very useful to indicate in +the change log the conditions for which the change applies. + +Our convention for indicating conditional changes is to use square +brackets around the name of the condition. + +Here is a simple example, describing a change which is conditional but +does not have a function or entity name associated with it: + +@example +* xterm.c [SOLARIS2]: Include string.h. +@end example + +Here is an entry describing a new definition which is entirely +conditional. This new definition for the macro @code{FRAME_WINDOW_P} is +used only when @code{HAVE_X_WINDOWS} is defined: + +@example +* frame.h [HAVE_X_WINDOWS] (FRAME_WINDOW_P): Macro defined. +@end example + +Here is an entry for a change within the function @code{init_display}, +whose definition as a whole is unconditional, but the changes themselves +are contained in a @samp{#ifdef HAVE_LIBNCURSES} conditional: + +@example +* dispnew.c (init_display) [HAVE_LIBNCURSES]: If X, call tgetent. +@end example + +Here is an entry for a change that takes affect only when +a certain macro is @emph{not} defined: + +@example +(gethostname) [!HAVE_SOCKETS]: Replace with winsock version. +@end example + +@node Indicating the Part Changed +@subsection Indicating the Part Changed + +Indicate the part of a function which changed by using angle brackets +enclosing an indication of what the changed part does. Here is an entry +for a change in the part of the function @code{sh-while-getopts} that +deals with @code{sh} commands: + +@example +* progmodes/sh-script.el (sh-while-getopts) <sh>: Handle case that +user-specified option string is empty. +@end example + + +@node Man Pages +@section Man Pages +@cindex man pages + +In the GNU project, man pages are secondary. It is not necessary or +expected for every GNU program to have a man page, but some of them do. +It's your choice whether to include a man page in your program. + +When you make this decision, consider that supporting a man page +requires continual effort each time the program is changed. The time +you spend on the man page is time taken away from more useful work. + +For a simple program which changes little, updating the man page may be +a small job. Then there is little reason not to include a man page, if +you have one. + +For a large program that changes a great deal, updating a man page may +be a substantial burden. If a user offers to donate a man page, you may +find this gift costly to accept. It may be better to refuse the man +page unless the same person agrees to take full responsibility for +maintaining it---so that you can wash your hands of it entirely. If +this volunteer later ceases to do the job, then don't feel obliged to +pick it up yourself; it may be better to withdraw the man page from the +distribution until someone else agrees to update it. + +When a program changes only a little, you may feel that the +discrepancies are small enough that the man page remains useful without +updating. If so, put a prominent note near the beginning of the man +page explaining that you don't maintain it and that the Texinfo manual +is more authoritative. The note should say how to access the Texinfo +documentation. + +@node Reading other Manuals +@section Reading other Manuals + +There may be non-free books or documentation files that describe the +program you are documenting. + +It is ok to use these documents for reference, just as the author of a +new algebra textbook can read other books on algebra. A large portion +of any non-fiction book consists of facts, in this case facts about how +a certain program works, and these facts are necessarily the same for +everyone who writes about the subject. But be careful not to copy your +outline structure, wording, tables or examples from preexisting non-free +documentation. Copying from free documentation may be ok; please check +with the FSF about the individual case. + +@node Managing Releases +@chapter The Release Process +@cindex releasing + +Making a release is more than just bundling up your source files in a +tar file and putting it up for FTP. You should set up your software so +that it can be configured to run on a variety of systems. Your Makefile +should conform to the GNU standards described below, and your directory +layout should also conform to the standards discussed below. Doing so +makes it easy to include your package into the larger framework of +all GNU software. + +@menu +* Configuration:: How Configuration Should Work +* Makefile Conventions:: Makefile Conventions +* Releases:: Making Releases +@end menu + +@node Configuration +@section How Configuration Should Work +@cindex program configuration + +@pindex configure +Each GNU distribution should come with a shell script named +@code{configure}. This script is given arguments which describe the +kind of machine and system you want to compile the program for. + +The @code{configure} script must record the configuration options so +that they affect compilation. + +One way to do this is to make a link from a standard name such as +@file{config.h} to the proper configuration file for the chosen system. +If you use this technique, the distribution should @emph{not} contain a +file named @file{config.h}. This is so that people won't be able to +build the program without configuring it first. + +Another thing that @code{configure} can do is to edit the Makefile. If +you do this, the distribution should @emph{not} contain a file named +@file{Makefile}. Instead, it should include a file @file{Makefile.in} which +contains the input used for editing. Once again, this is so that people +won't be able to build the program without configuring it first. + +If @code{configure} does write the @file{Makefile}, then @file{Makefile} +should have a target named @file{Makefile} which causes @code{configure} +to be rerun, setting up the same configuration that was set up last +time. The files that @code{configure} reads should be listed as +dependencies of @file{Makefile}. + +All the files which are output from the @code{configure} script should +have comments at the beginning explaining that they were generated +automatically using @code{configure}. This is so that users won't think +of trying to edit them by hand. + +The @code{configure} script should write a file named @file{config.status} +which describes which configuration options were specified when the +program was last configured. This file should be a shell script which, +if run, will recreate the same configuration. + +The @code{configure} script should accept an option of the form +@samp{--srcdir=@var{dirname}} to specify the directory where sources are found +(if it is not the current directory). This makes it possible to build +the program in a separate directory, so that the actual source directory +is not modified. + +If the user does not specify @samp{--srcdir}, then @code{configure} should +check both @file{.} and @file{..} to see if it can find the sources. If +it finds the sources in one of these places, it should use them from +there. Otherwise, it should report that it cannot find the sources, and +should exit with nonzero status. + +Usually the easy way to support @samp{--srcdir} is by editing a +definition of @code{VPATH} into the Makefile. Some rules may need to +refer explicitly to the specified source directory. To make this +possible, @code{configure} can add to the Makefile a variable named +@code{srcdir} whose value is precisely the specified directory. + +The @code{configure} script should also take an argument which specifies the +type of system to build the program for. This argument should look like +this: + +@example +@var{cpu}-@var{company}-@var{system} +@end example + +For example, a Sun 3 might be @samp{m68k-sun-sunos4.1}. + +The @code{configure} script needs to be able to decode all plausible +alternatives for how to describe a machine. Thus, @samp{sun3-sunos4.1} +would be a valid alias. For many programs, @samp{vax-dec-ultrix} would +be an alias for @samp{vax-dec-bsd}, simply because the differences +between Ultrix and @sc{bsd} are rarely noticeable, but a few programs +might need to distinguish them. +@c Real 4.4BSD now runs on some Suns. + +There is a shell script called @file{config.sub} that you can use +as a subroutine to validate system types and canonicalize aliases. + +@cindex optional features, configure-time +Other options are permitted to specify in more detail the software +or hardware present on the machine, and include or exclude optional +parts of the package: + +@table @samp +@item --enable-@var{feature}@r{[}=@var{parameter}@r{]} +Configure the package to build and install an optional user-level +facility called @var{feature}. This allows users to choose which +optional features to include. Giving an optional @var{parameter} of +@samp{no} should omit @var{feature}, if it is built by default. + +No @samp{--enable} option should @strong{ever} cause one feature to +replace another. No @samp{--enable} option should ever substitute one +useful behavior for another useful behavior. The only proper use for +@samp{--enable} is for questions of whether to build part of the program +or exclude it. + +@item --with-@var{package} +@c @r{[}=@var{parameter}@r{]} +The package @var{package} will be installed, so configure this package +to work with @var{package}. + +@c Giving an optional @var{parameter} of +@c @samp{no} should omit @var{package}, if it is used by default. + +Possible values of @var{package} include +@samp{gnu-as} (or @samp{gas}), @samp{gnu-ld}, @samp{gnu-libc}, +@samp{gdb}, +@samp{x}, +and +@samp{x-toolkit}. + +Do not use a @samp{--with} option to specify the file name to use to +find certain files. That is outside the scope of what @samp{--with} +options are for. +@end table + +All @code{configure} scripts should accept all of these ``detail'' +options, whether or not they make any difference to the particular +package at hand. In particular, they should accept any option that +starts with @samp{--with-} or @samp{--enable-}. This is so users will +be able to configure an entire GNU source tree at once with a single set +of options. + +You will note that the categories @samp{--with-} and @samp{--enable-} +are narrow: they @strong{do not} provide a place for any sort of option +you might think of. That is deliberate. We want to limit the possible +configuration options in GNU software. We do not want GNU programs to +have idiosyncratic configuration options. + +Packages that perform part of the compilation process may support +cross-compilation. In such a case, the host and target machines for the +program may be different. + +The @code{configure} script should normally treat the specified type of +system as both the host and the target, thus producing a program which +works for the same type of machine that it runs on. + +To configure a cross-compiler, cross-assembler, or what have you, you +should specify a target different from the host, using the configure +option @samp{--target=@var{targettype}}. The syntax for +@var{targettype} is the same as for the host type. So the command would +look like this: + +@example +./configure @var{hosttype} --target=@var{targettype} +@end example + +Programs for which cross-operation is not meaningful need not accept the +@samp{--target} option, because configuring an entire operating system for +cross-operation is not a meaningful operation. + +Bootstrapping a cross-compiler requires compiling it on a machine other +than the host it will run on. Compilation packages accept a +configuration option @samp{--build=@var{buildtype}} for specifying the +configuration on which you will compile them, but the configure script +should normally guess the build machine type (using +@file{config.guess}), so this option is probably not necessary. The +host and target types normally default from the build type, so in +bootstrapping a cross-compiler you must specify them both explicitly. + +Some programs have ways of configuring themselves automatically. If +your program is set up to do this, your @code{configure} script can simply +ignore most of its arguments. + +@comment The makefile standards are in a separate file that is also +@comment included by make.texinfo. Done by roland@gnu.ai.mit.edu on 1/6/93. +@comment For this document, turn chapters into sections, etc. +@lowersections +@include make-stds.texi +@raisesections + +@node Releases +@section Making Releases +@cindex packaging + +Package the distribution of @code{Foo version 69.96} up in a gzipped tar +file with the name @file{foo-69.96.tar.gz}. It should unpack into a +subdirectory named @file{foo-69.96}. + +Building and installing the program should never modify any of the files +contained in the distribution. This means that all the files that form +part of the program in any way must be classified into @dfn{source +files} and @dfn{non-source files}. Source files are written by humans +and never changed automatically; non-source files are produced from +source files by programs under the control of the Makefile. + +@cindex @file{README} file +The distribution should contain a file named @file{README} which gives +the name of the package, and a general description of what it does. It +is also good to explain the purpose of each of the first-level +subdirectories in the package, if there are any. The @file{README} file +should either state the version number of the package, or refer to where +in the package it can be found. + +The @file{README} file should refer to the file @file{INSTALL}, which +should contain an explanation of the installation procedure. + +The @file{README} file should also refer to the file which contains the +copying conditions. The GNU GPL, if used, should be in a file called +@file{COPYING}. If the GNU LGPL is used, it should be in a file called +@file{COPYING.LIB}. + +Naturally, all the source files must be in the distribution. It is okay +to include non-source files in the distribution, provided they are +up-to-date and machine-independent, so that building the distribution +normally will never modify them. We commonly include non-source files +produced by Bison, @code{lex}, @TeX{}, and @code{makeinfo}; this helps avoid +unnecessary dependencies between our distributions, so that users can +install whichever packages they want to install. + +Non-source files that might actually be modified by building and +installing the program should @strong{never} be included in the +distribution. So if you do distribute non-source files, always make +sure they are up to date when you make a new distribution. + +Make sure that the directory into which the distribution unpacks (as +well as any subdirectories) are all world-writable (octal mode 777). +This is so that old versions of @code{tar} which preserve the +ownership and permissions of the files from the tar archive will be +able to extract all the files even if the user is unprivileged. + +Make sure that all the files in the distribution are world-readable. + +Make sure that no file name in the distribution is more than 14 +characters long. Likewise, no file created by building the program +should have a name longer than 14 characters. The reason for this is +that some systems adhere to a foolish interpretation of the @sc{posix} +standard, and refuse to open a longer name, rather than truncating as +they did in the past. + +Don't include any symbolic links in the distribution itself. If the tar +file contains symbolic links, then people cannot even unpack it on +systems that don't support symbolic links. Also, don't use multiple +names for one file in different directories, because certain file +systems cannot handle this and that prevents unpacking the +distribution. + +Try to make sure that all the file names will be unique on MS-DOS. A +name on MS-DOS consists of up to 8 characters, optionally followed by a +period and up to three characters. MS-DOS will truncate extra +characters both before and after the period. Thus, +@file{foobarhacker.c} and @file{foobarhacker.o} are not ambiguous; they +are truncated to @file{foobarha.c} and @file{foobarha.o}, which are +distinct. + +@cindex @file{texinfo.tex}, in a distribution +Include in your distribution a copy of the @file{texinfo.tex} you used +to test print any @file{*.texinfo} or @file{*.texi} files. + +Likewise, if your program uses small GNU software packages like regex, +getopt, obstack, or termcap, include them in the distribution file. +Leaving them out would make the distribution file a little smaller at +the expense of possible inconvenience to a user who doesn't know what +other files to get. + +@node References +@chapter References to Non-Free Software and Documentation +@cindex references to non-free material + +A GNU program should not recommend use of any non-free program. We +can't stop some people from writing proprietary programs, or stop other +people from using them. But we can and should avoid helping to +advertise them to new customers. + +Sometimes it is important to mention how to build your package on top of +some non-free operating system or other non-free base package. In such +cases, please mention the name of the non-free package or system in the +briefest possible way. Don't include any references for where to find +more information about the proprietary program. The goal should be that +people already using the proprietary program will get the advice they +need about how to use your free program, while people who don't already +use the proprietary program will not see anything to encourage them to +take an interest in it. + +Likewise, a GNU package should not refer the user to any non-free +documentation for free software. The need for free documentation to go +with free software is now a major focus of the GNU project; to show that +we are serious about the need for free documentation, we must not +undermine our position by recommending use of documentation that isn't +free. + +@node Index +@unnumbered Index +@printindex cp + +@contents + +@bye +Local variables: +update-date-leading-regexp: "@c This date is automagically updated when you save this file:\n@set lastupdate " +update-date-trailing-regexp: "" +eval: (load "/gd/gnuorg/update-date.el") +eval: (add-hook 'write-file-hooks 'update-date) +compile-command: "make just-standards" +End: diff --git a/doc/version.texi b/doc/version.texi new file mode 100644 index 0000000..d854139 --- /dev/null +++ b/doc/version.texi @@ -0,0 +1,4 @@ +@set UPDATED 2 December 2023 +@set UPDATED-MONTH December 2023 +@set EDITION 2.52.20231210 +@set VERSION 2.52.20231210 diff --git a/ifnames.in b/ifnames.in new file mode 100644 index 0000000..6267a65 --- /dev/null +++ b/ifnames.in @@ -0,0 +1,135 @@ +#! @SHELL@ +# -*- shell-script -*- +# ifnames - print the identifiers used in C preprocessor conditionals +# Copyright 2010 Thomas E. Dickey +# Copyright 1994, 1995, 1999, 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 +# the Free Software Foundation; either version 2, 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. + +# Reads from stdin if no files are given. +# Writes to stdout. + +# Written by David MacKenzie <djm@gnu.ai.mit.edu> +# and Paul Eggert <eggert@twinsun.com>. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] ... [FILE] ... + +Scan all of the C source FILES (or the standard input, if none are +given) and write to the standard output a sorted list of all the +identifiers that appear in those files in \`#if', \`#elif', \`#ifdef', or +\`#ifndef' directives. Print each identifier on a line, followed by a +space-separated list of the files in which that identifier occurs. + + -h, --help print this help, then exit + -V, --version print version number, then exit + +Report bugs to <@PACKAGE_BUGREPORT@>." + +version="\ +ifnames (@PACKAGE_NAME@) @VERSION@ +Written by David J. MacKenzie and Paul Eggert. + +Copyright 1994, 1995, 1999, 2000 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." + +while test $# -gt 0; do + case "$1" in + --help | -h ) + echo "$usage"; exit 0 ;; + --version | -V ) + echo "$version"; exit 0 ;; + --) # Stop option processing. + shift; break ;; + -*) + exec >&2 + echo "$me: invalid option $1" + echo "$help" + exit 1 ;; + *) break ;; + esac +done + +# Variables. +: ${AWK=@AWK@} + +$AWK ' + # Record that sym was found in FILENAME. + function file_sym(sym, i, fs) + { + if (sym ~ /^[A-Za-z_]/) + { + if (!found[sym,FILENAME]) + { + found[sym,FILENAME] = 1 + + # Insert FILENAME into files[sym], keeping the list sorted. + i = 1 + fs = files[sym] + while (match(substr(fs, i), /^ [^ ]*/) \ + && substr(fs, i + 1, RLENGTH - 1) < FILENAME) + { + i += RLENGTH + } + files[sym] = substr(fs, 1, i - 1) " " FILENAME substr(fs, i) + } + } + } + + { + while (sub(/\\$/, "", $0) > 0) + { + if ((getline tmp) > 0) + $0 = $0 tmp + else + break + } + } + + /^[\t ]*#/ { + if (sub(/^[\t ]*#[\t ]*ifn?def[\t ]+/, "", $0)) + { + sub(/[^A-Za-z_0-9].*/, "", $0) + file_sym($0) + } + if (sub(/^[\t ]*#[\t ]*(el)?if[\t ]+/, "", $0)) + { + # Remove comments. Not perfect, but close enough. + gsub(/\/\*[^\/]*(\*\/)?/, "", $0) + + for (i = split($0, field, /[^A-Za-z_0-9]+/); 1 <= i; i--) + { + if (field[i] != "defined") + { + file_sym(field[i]) + } + } + } + } + + END { + for (sym in files) + { + print sym files[sym] + } + } +' ${1+"$@"} | sort diff --git a/m4/Makefile.in b/m4/Makefile.in new file mode 100644 index 0000000..c699503 --- /dev/null +++ b/m4/Makefile.in @@ -0,0 +1,186 @@ +# Copyright 2010-2012,2023 Thomas E. Dickey +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datarootdir = @datarootdir@ +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 = .. + +AUTOCONF = @AUTOCONF@ +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 = : +AWK = @AWK@ +EXPR = @EXPR@ +HELP2MAN = @HELP2MAN@ +M4 = @M4@ +PACKAGE = @PACKAGE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PERL = @PERL@ +PERLSCRIPTS = @PERLSCRIPTS@ +VERSION = @VERSION@ + +EXTRA_DIST = \ +atconfig.m4 \ +init.m4 \ +m4.m4 \ +missing.m4 \ +sanity.m4 + +subdir = m4 +CONFIG_CLEAN_FILES = +DIST_SOURCES = +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +uninstall-info-am: +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 \ + mkdir -p "$(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 + +installdirs: + +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: + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +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-generic + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic 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-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic uninstall uninstall-am uninstall-info-am + +# 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 --git a/m4/atconfig.m4 b/m4/atconfig.m4 new file mode 100644 index 0000000..79c7c72 --- /dev/null +++ b/m4/atconfig.m4 @@ -0,0 +1,16 @@ +## ----------------------## -*- Autoconf -*- +## Prepare for testing. ## +## ----------------------## + +#serial 3 + +# AT_CONFIG([AUTOTEST-PATH = .]) +# ------------------------------ +# Configure the test suite. +# +# AUTOTEST-PATH must help the test suite to find the executables, i.e., +# if the test suite is in `tests/' and the executables are in `src/', +# pass `../src'. If there are also executables in the source tree, use +# `../src:$top_srcdir/src'. +AC_DEFUN([AT_CONFIG], +[AC_SUBST([AUTOTEST_PATH], [m4_default([$1], [.])])]) diff --git a/m4/init.m4 b/m4/init.m4 new file mode 100644 index 0000000..22d9592 --- /dev/null +++ b/m4/init.m4 @@ -0,0 +1,37 @@ +# 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 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])]) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +# +ac_prog_editor=`echo $program_transform_name| sed -e 's/\\$\\$/$/g'` +# +ac_prog_actual=`echo autoconf|sed -e $ac_prog_editor` +AM_MISSING_PROG(AUTOCONF, $ac_prog_actual, $missing_dir) +# +ac_prog_actual=`echo autoheader|sed -e $ac_prog_editor` +AM_MISSING_PROG(AUTOHEADER, $ac_prog_actual, $missing_dir) +# +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) diff --git a/m4/m4.m4 b/m4/m4.m4 new file mode 100644 index 0000000..e48d690 --- /dev/null +++ b/m4/m4.m4 @@ -0,0 +1,17 @@ +# AC_PROG_GNU_M4 +# -------------- +# Check for GNU m4, at least 1.3 (supports frozen files). +AC_DEFUN([AC_PROG_GNU_M4], +[AC_PATH_PROGS(M4, gm4 gnum4 m4, m4) +AC_CACHE_CHECK(version of $M4, ac_cv_m4_version, +[ + ac_cv_m4_version=`$M4 --version | head -n 1 | sed -E -e 's/^.*[[ ]]([[1-9]][[0-9]]*\.)/\1/g' -e 's/[[^0-9.]]*$//' 2>/dev/null` + test -z "$ac_cv_m4_version" && ac_cv_m4_version=unknown +]) +AC_CACHE_CHECK(whether $M4 supports frozen files, ac_cv_prog_gnu_m4, +[ac_cv_prog_gnu_m4=no +if test x"$M4" != x; then + case `$M4 --help < /dev/null 2>&1` in + *reload-state*) ac_cv_prog_gnu_m4=yes ;; + esac +fi])]) diff --git a/m4/missing.m4 b/m4/missing.m4 new file mode 100644 index 0000000..091570d --- /dev/null +++ b/m4/missing.m4 @@ -0,0 +1,70 @@ +## --------------------------------------------------------- ## +## Fake the existence of programs that GNU maintainers use. ## +## --------------------------------------------------------- ## + +# 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_INSTALL_SH +# --------------------- +# Like AM_MISSING_PROG, but only looks for install-sh. +AC_DEFUN([AM_MISSING_INSTALL_SH], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +if test -z "$install_sh"; then + for install_sh in "$ac_aux_dir/install-sh" \ + "$ac_aux_dir/install.sh" \ + "${am_missing_run}${ac_auxdir}/install-sh"; + do + test -f "$install_sh" && break + done +fi +AC_SUBST(install_sh)]) + + +# 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], +[test x"${MISSING+set}" = xset || + MISSING="\${SHELL} `CDPATH=:; cd $ac_aux_dir && pwd`/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 `.'. +# Of course, Automake must honor this variable whenever it call a tool +# from the auxiliary directory. The problem is that $srcdir (hence +# $ac_aux_dir) can be either an absolute path or a path relative to +# $top_srcdir or absolute, this depends on how configure is run. This +# is pretty annoying since it makes $ac_aux_dir quite unusable in +# subdirectories: on the top source directory, any form will work +# fine, but in subdirectories relative pat needs to be adapted. +# - calling $top_srcidr/$ac_aux_dir/missing would success if $srcdir is +# relative, but fail if $srcdir is absolute +# - conversely, calling $ax_aux_dir/missing would fail if $srcdir is +# absolute, and success on relative paths. +# +# Consequently, we define and use $am_aux_dir, the "always absolute" +# version of $ac_aux_dir. + +AC_DEFUN([AM_AUX_DIR_EXPAND], [ +# expand $ac_aux_dir to an absolute path +am_aux_dir=`CDPATH=:; cd $ac_aux_dir && pwd` +]) diff --git a/m4/sanity.m4 b/m4/sanity.m4 new file mode 100644 index 0000000..5cb5f27 --- /dev/null +++ b/m4/sanity.m4 @@ -0,0 +1,42 @@ +# +# Check to make sure that the build environment is sane. +# + +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 + 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 +rm -f conftest* +AC_MSG_RESULT([yes])]) @@ -0,0 +1,731 @@ +include(m4sugar.m4)# -*- Autoconf -*- +# This file is part of Autoconf. +# M4 sugar for common shell constructs. +# Requires GNU M4 and M4sugar. +#------------------------------------------------------------------------------ +# Copyright 2020-2021,2022 Thomas E. Dickey +# Copyright 2000, 2001 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 +# the Free Software Foundation; either version 2, 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, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by Akim Demaille, Pavel Roskin, Alexandre Oliva, Lars J. Aas +# and many other people. + + +## ------------------------- ## +## 1. Sanitizing the shell. ## +## ------------------------- ## + +# AS_SHELL_SANITIZE +# ----------------- +# Try to be as Bourne and/or POSIX as possible. +m4_defun([AS_SHELL_SANITIZE], +[# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +dnl Moved here because the tests below can use AC_MSG_ERROR, which uses $as_me +as_me=`AS_BASENAME($[0])` + +_AS_EXPR_PREPARE +_AS_LN_S_PREPARE +_AS_TEST_PREPARE +_AS_UNSET_PREPARE +_AS_TR_PREPARE + +# NLS nuisances. +AS_UNSET([LANG], [C]) +AS_UNSET([LC_ALL], [C]) +AS_UNSET([LC_TIME], [C]) +AS_UNSET([LC_CTYPE], [C]) +AS_UNSET([LANGUAGE], [C]) +AS_UNSET([LC_COLLATE], [C]) +AS_UNSET([LC_NUMERIC], [C]) +AS_UNSET([LC_MESSAGES], [C]) + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +AS_UNSET([CDPATH], [:]) +]) + + +## ----------------------------- ## +## 2. Wrappers around builtins. ## +## ----------------------------- ## + +# This section is lexicographically sorted. + + +# AS_EXIT([EXIT-CODE = 1]) +# ------------------------ +# Exit and set exit code to EXIT-CODE in the way that it's seen +# within "trap 0". +# +# We cannot simply use "exit N" because some shells (zsh and Solaris sh) +# will not set $? to N while running the code set by "trap 0" +# So we set $? by executing "exit N" in the subshell and then exit. +# Other shells don't use `$?' as default for `exit', hence just repeating +# the exit value can only help improving portability. +m4_define([AS_EXIT], +[{ (exit m4_default([$1], 1)); exit m4_default([$1], 1); }]) + + +# AS_IF(TEST, [IF-TRUE], [IF-FALSE]) +# ---------------------------------- +# Expand into +# | if TEST; then +# | IF-TRUE +# | else +# | IF-FALSE +# | fi +# with simplifications is IF-TRUE and/or IF-FALSE is empty. +m4_define([AS_IF], +[m4_ifval([$2$3], +[if $1; then + m4_ifval([$2], [$2], :) +m4_ifvaln([$3], +[else + $3])dnl +fi +])dnl +])# AS_IF + + +# _AS_UNSET_PREPARE +# ----------------- +# AS_UNSET depends upon $as_unset: compute it. +m4_defun([_AS_UNSET_PREPARE], +[# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset="unset" +else + as_unset="false" +fi +]) + + +# AS_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `']) +# -------------------------------------------------- +# Try to unset the env VAR, otherwise set it to +# VALUE-IF-UNSET-NOT-SUPPORTED. `as_unset' must have been computed. +m4_defun([AS_UNSET], +[m4_require([_AS_UNSET_PREPARE])dnl +$as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }]) + + + + + + +## ------------------------------------------ ## +## 3. Error and warnings at the shell level. ## +## ------------------------------------------ ## + +# If AS_MESSAGE_LOG_FD is defined, shell messages are duplicated there +# too. + + +# AS_ESCAPE(STRING, [CHARS = $"'\]) +# --------------------------------- +# Escape the CHARS in STRING. +m4_define([AS_ESCAPE], +[m4_patsubst([$1], + m4_ifval([$2], [[\([$2]\)]], [[\([\"$`]\)]]), + [\\\1])]) + + +# _AS_QUOTE_IFELSE(STRING, IF-MODERN-QUOTATION, IF-OLD-QUOTATION) +# --------------------------------------------------------------- +# Compatibility glue between the old AS_MSG suite which did not +# quote anything, and the modern suite which quotes the quotes. +# If STRING contains `\\' or `\$', it's modern. +# If STRING contains `\"' or `\`', it's old. +# Otherwise it's modern. +# We use two quotes in the pattern to keep highlighting tools at peace. +m4_define([_AS_QUOTE_IFELSE], +[m4_if(m4_regexp([$1], [\\[\\$]]), + [-1], [m4_if(m4_regexp([$1], [\\[`""]]), + [-1], [$2], + [$3])], + [$2])]) + + +# _AS_ECHO_UNQUOTED(STRING, [FD = AS_MESSAGE_FD]) +# ----------------------------------------------- +# Perform shell expansions on STRING and echo the string to FD. +m4_define([_AS_ECHO_UNQUOTED], +[echo "$1" >&m4_default([$2], [AS_MESSAGE_FD])]) + + +# _AS_QUOTE(STRING) +# ----------------- +# If there are quoted (via backslash) backquotes do nothing, else +# backslash all the quotes. +# FIXME: In a distant future (2.51 or +), this warning should be +# classified as `syntax'. It is classified as `obsolete' to ease +# the transition (for Libtool for instance). +m4_define([_AS_QUOTE], +[_AS_QUOTE_IFELSE([$1], + [AS_ESCAPE([$1], [`""])], + [m4_warn([obsolete], + [back quotes and double quotes should not be escaped in: $1])dnl +$1])]) + + +# _AS_ECHO(STRING, [FD = AS_MESSAGE_FD]) +# -------------------------------------- +# Protect STRING from backquote expansion, echo the result to FD. +m4_define([_AS_ECHO], +[_AS_ECHO_UNQUOTED([_AS_QUOTE([$1])], [$2])]) + + +# AS_MESSAGE(STRING, [FD = AS_MESSAGE_FD]) +# ---------------------------------------- +m4_define([AS_MESSAGE], +[m4_ifset([AS_MESSAGE_LOG_FD], + [{ _AS_ECHO([$as_me:__oline__: $1], [AS_MESSAGE_LOG_FD]) +_AS_ECHO([$as_me: $1], [$2]);}], + [_AS_ECHO([$as_me: $1], [$2])])[]dnl +]) + + +# AS_WARN(PROBLEM) +# ---------------- +m4_define([AS_WARN], +[AS_MESSAGE([WARNING: $1], [2])])# AS_WARN + + +# AS_ERROR(ERROR, [EXIT-STATUS = 1]) +# ---------------------------------- +m4_define([AS_ERROR], +[{ AS_MESSAGE([error: $1], [2]) + AS_EXIT([$2]); }[]dnl +])# AS_ERROR + + + +## -------------------------------------- ## +## 4. Portable versions of common tools. ## +## -------------------------------------- ## + +# This section is lexicographically sorted. + + +# AS_DIRNAME(PATHNAME) +# -------------------- +# Simulate running `dirname(1)' on PATHNAME, not all systems have it. +# This macro must be usable from inside ` `. +# +# Prefer expr to echo|sed, since expr is usually faster and it handles +# backslashes and newlines correctly. However, older expr +# implementations (e.g. SunOS 4 expr and Solaris 8 /usr/ucb/expr) have +# a silly length limit that causes expr to fail if the matched +# substring is longer than 120 bytes. So fall back on echo|sed if +# expr fails. +# +# FIXME: Please note the following m4_require is quite wrong: if the first +# occurrence of AS_DIRNAME_EXPR is in a backquoted expression, the +# shell will be lost. We might have to introduce diversions for +# setting up an M4sh script: required macros will then be expanded there. +m4_defun([AS_DIRNAME_EXPR], +[m4_require([_AS_EXPR_PREPARE])dnl +$as_expr X[]$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \ + X[]$1 : 'X\(//\)[[^/]]' \| \ + X[]$1 : 'X\(//\)$' \| \ + X[]$1 : 'X\(/\)' \| \ + . : '\(.\)']) + +m4_defun([AS_DIRNAME_SED], +[echo X[]$1 | + sed ['/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q']]) + +m4_defun([AS_DIRNAME], +[AS_DIRNAME_EXPR([$1]) 2>/dev/null || +AS_DIRNAME_SED([$1])]) + + +# AS_BASENAME(PATHNAME) +# -------------------- +# Simulate running `basename(1)' on PATHNAME, not all systems have it. +# This macro must be usable from inside ` `. +m4_defun([AS_BASENAME], +[echo "$1" |sed 's,.*[[\\/]],,']) + +# AS_EXECUTABLE_P +# --------------- +# Check whether a file is executable. +m4_defun([AS_EXECUTABLE_P], +[m4_require([_AS_TEST_PREPARE])dnl +$as_executable_p $1[]dnl +])# AS_EXECUTABLE_P + + +# _AS_EXPR_PREPARE +# ---------------- +# Some expr work properly (i.e. compute and issue the right result), +# but exit with failure. When a fall back to expr (as in AS_DIRNAME) +# is provided, you get twice the result. Prevent this. +m4_defun([_AS_EXPR_PREPARE], +[if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr="expr" +else + as_expr="false" +fi +])# _AS_EXPR_PREPARE + + +# _AS_LN_S_PREPARE +# ---------------- +# Don't use conftest.sym to avoid filename issues on DJGPP, where this +# would yield conftest.sym.exe for DJGPP < 2.04. And don't use `conftest' +# as base name to avoid prohibiting concurrency (e.g., concurrent +# config.statuses). +m4_defun([_AS_LN_S_PREPARE], +[rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln' +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file +])# _AS_LN_S_PREPARE + + +# AS_LN_S(FILE, LINK) +# ------------------- +# FIXME: Should we add the glue code to handle properly relative symlinks +# simulated with `ln' or `cp'? +m4_defun([AS_LN_S], +[m4_require([_AS_LN_S_PREPARE])dnl +$as_ln_s $1 $2 +]) + + +# AS_MKDIR_P(PATH) +# ---------------- +# Emulate `mkdir -p' with plain `mkdir'. +# +# Don't set IFS to '\\/' (see the doc): you would end up with +# directories called foo\bar and foo?az and others depending upon the +# shell. +m4_define([AS_MKDIR_P], +[{ case $1 in + [[\\/]]* | ?:[[\\/]]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy=$1 +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$[@]"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } +])# AS_MKDIR_P + + +# _AS_BROKEN_TEST_PREPARE +# ----------------------- +# FIXME: This does not work and breaks way too many things. +# +# Find out ahead of time whether we want test -x (preferred) or test -f +# to check whether a file is executable. +m4_defun([_AS_BROKEN_TEST_PREPARE], +[# Find out how to test for executable files. Don't use a zero-byte file, +# as systems may use methods other than mode bits to determine executability. +cat >conf$$.file <<_ASEOF +@%:@! /bin/sh +exit 0 +_ASEOF +chmod +x conf$$.file +if test -x conf$$.file >/dev/null 2>&1; then + as_executable_p="test -x" +elif test -f conf$$.file >/dev/null 2>&1; then + as_executable_p="test -f" +else + AS_ERROR([cannot check whether a file is executable on this system]) +fi +rm -f conf$$.file +])# _AS_BROKEN_TEST_PREPARE + + +# _AS_TEST_PREPARE +# ---------------- +m4_defun([_AS_TEST_PREPARE], +[as_executable_p="test -f" +])# _AS_BROKEN_TEST_PREPARE + + + + + + +## ------------------ ## +## 5. Common idioms. ## +## ------------------ ## + +# This section is lexicographically sorted. + + +# AS_BOX(MESSAGE, [FRAME-CHARACTER = `=']) +# ---------------------------------------- +# Output MESSAGE, a single line text, framed with FRAME-CHARACTER (which +# must not be `/'). +m4_define([AS_BOX], +[AS_LITERAL_IF([$1], + [_AS_BOX_LITERAL($@)], + [_AS_BOX_INDIR($@)])]) + +# _AS_BOX_LITERAL(MESSAGE, [FRAME-CHARACTER = `=']) +# ------------------------------------------------- +m4_define([_AS_BOX_LITERAL], +[cat <<\_ASBOX +m4_patsubst([$1], [.], m4_if([$2], [], [[=]], [[$2]])) +$1 +m4_patsubst([$1], [.], m4_if([$2], [], [[=]], [[$2]])) +_ASBOX]) + +# _AS_BOX_INDIR(MESSAGE, [FRAME-CHARACTER = `=']) +# ----------------------------------------------- +m4_define([_AS_BOX_INDIR], +[sed 'h;s/./m4_default([$2], [=])/g;p;x;p;x' <<_ASBOX +$1 +_ASBOX]) + + +# AS_LITERAL_IF(EXPRESSION, IF-LITERAL, IF-NOT-LITERAL) +# ----------------------------------------------------- +# If EXPRESSION has shell indirections ($var or `expr`), expand +# IF-INDIR, else IF-NOT-INDIR. +# This is an *approximation*: for instance EXPRESSION = `\$' is +# definitely a literal, but will not be recognized as such. +m4_define([AS_LITERAL_IF], +[m4_if(m4_regexp([$1], [[`$]]), + -1, [$2], + [$3])]) + + +# AS_TMPDIR(PREFIX) +# ----------------- +# Create as safely as possible a temporary directory which name is +# inspired by PREFIX (should be 2-4 chars max), and set trap +# mechanisms to remove it. +m4_define([AS_TMPDIR], +[# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap 'AS_EXIT([1])' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: "${TMPDIR=/tmp}" +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/$1XXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/$1$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + AS_EXIT +}dnl +])# AS_TMPDIR + + +# AS_UNAME +# -------- +# Try to describe this machine. Meant for logs. +m4_define([AS_UNAME], +[{ +cat <<_ASUNAME +## ---------- ## +## Platform. ## +## ---------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +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 || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +}]) + + + +## ------------------------------------ ## +## Common m4/sh character translation. ## +## ------------------------------------ ## + +# The point of this section is to provide high level macros comparable +# to m4's `translit' primitive, but m4/sh polymorphic. +# Transliteration of literal strings should be handled by m4, while +# shell variables' content will be translated at runtime (tr or sed). + + +# _AS_CR_PREPARE +# -------------- +# Output variables defining common character ranges. +# See m4_cr_letters etc. +m4_defun([_AS_CR_PREPARE], +[# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits +]) + + +# _AS_TR_SH_PREPARE +# ----------------- +m4_defun([_AS_TR_SH_PREPARE], +[m4_require([_AS_CR_PREPARE])dnl +# Sed expression to map a string onto a valid variable name. +as_tr_sh="sed y%*+%pp%;s%[[^_$as_cr_alnum]]%_%g" +]) + + +# AS_TR_SH(EXPRESSION) +# -------------------- +# Transform EXPRESSION into a valid shell variable name. +# sh/m4 polymorphic. +# Be sure to update the definition of `$as_tr_sh' if you change this. +m4_defun([AS_TR_SH], +[m4_require([_$0_PREPARE])dnl +AS_LITERAL_IF([$1], + [m4_patsubst(m4_translit([[$1]], [*+], [pp]), + [[^a-zA-Z0-9_]], [_])], + [`echo "$1" | $as_tr_sh`])]) + + +# _AS_TR_CPP_PREPARE +# ------------------ +m4_defun([_AS_TR_CPP_PREPARE], +[m4_require([_AS_CR_PREPARE])dnl +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[[^_$as_cr_alnum]]%_%g" +]) + + +# AS_TR_CPP(EXPRESSION) +# --------------------- +# Map EXPRESSION to an upper case string which is valid as rhs for a +# `#define'. sh/m4 polymorphic. Be sure to update the definition +# of `$as_tr_cpp' if you change this. +m4_defun([AS_TR_CPP], +[m4_require([_$0_PREPARE])dnl +AS_LITERAL_IF([$1], + [m4_patsubst(m4_translit([[$1]], + [*abcdefghijklmnopqrstuvwxyz], + [PABCDEFGHIJKLMNOPQRSTUVWXYZ]), + [[^A-Z0-9_]], [_])], + [`echo "$1" | $as_tr_cpp`])]) + + +# _AS_TR_PREPARE +# -------------- +m4_defun([_AS_TR_PREPARE], +[m4_require([_AS_TR_SH_PREPARE])dnl +m4_require([_AS_TR_CPP_PREPARE])dnl +]) + + + + +## --------------------------------------------------- ## +## Common m4/sh handling of variables (indirections). ## +## --------------------------------------------------- ## + + +# The purpose of this section is to provide a uniform API for +# reading/setting sh variables with or without indirection. +# Typically, one can write +# AS_VAR_SET(var, val) +# or +# AS_VAR_SET(as_$var, val) +# and expect the right thing to happen. + + +# AS_VAR_SET(VARIABLE, VALUE) +# --------------------------- +# Set the VALUE of the shell VARIABLE. +# If the variable contains indirections (e.g. `ac_cv_func_$ac_func') +# perform whenever possible at m4 level, otherwise sh level. +m4_define([AS_VAR_SET], +[AS_LITERAL_IF([$1], + [$1=$2], + [eval "$1=$2"])]) + + +# AS_VAR_GET(VARIABLE) +# -------------------- +# Get the value of the shell VARIABLE. +# Evaluates to $VARIABLE if there are no indirection in VARIABLE, +# else into the appropriate `eval' sequence. +m4_define([AS_VAR_GET], +[AS_LITERAL_IF([$1], + [$[]$1], + [`eval echo '${'"m4_patsubst($1, [[\\`]], [\\\&])"'}'`])]) + + +# AS_VAR_TEST_SET(VARIABLE) +# ------------------------- +# Expands into the `test' expression which is true if VARIABLE +# is set. Polymorphic. Should be dnl'ed. +m4_define([AS_VAR_TEST_SET], +[AS_LITERAL_IF([$1], + [test "${$1+set}" = set], + [eval "test \"\${$1+set}\" = set"])]) + + +# AS_VAR_SET_IF(VARIABLE, IF-TRUE, IF-FALSE) +# ------------------------------------------ +# Implement a shell `if-then-else' depending whether VARIABLE is set +# or not. Polymorphic. +m4_define([AS_VAR_SET_IF], +[AS_IF([AS_VAR_TEST_SET([$1])], [$2], [$3])]) + + +# AS_VAR_PUSHDEF and AS_VAR_POPDEF +# -------------------------------- +# + +# Sometimes we may have to handle literals (e.g. `stdlib.h'), while at +# other moments, the same code may have to get the value from a +# variable (e.g., `ac_header'). To have a uniform handling of both +# cases, when a new value is about to be processed, declare a local +# variable, e.g.: +# +# AS_VAR_PUSHDEF([header], [ac_cv_header_$1]) +# +# and then in the body of the macro, use `header' as is. It is of +# first importance to use `AS_VAR_*' to access this variable. Don't +# quote its name: it must be used right away by m4. +# +# If the value `$1' was a literal (e.g. `stdlib.h'), then `header' is +# in fact the value `ac_cv_header_stdlib_h'. If `$1' was indirect, +# then `header's value in m4 is in fact `$ac_header', the shell +# variable that holds all of the magic to get the expansion right. +# +# At the end of the block, free the variable with +# +# AS_VAR_POPDEF([header]) + + +# AS_VAR_PUSHDEF(VARNAME, VALUE) +# ------------------------------ +# Define the m4 macro VARNAME to an accessor to the shell variable +# named VALUE. VALUE does not need to be a valid shell variable name: +# the transliteration is handled here. To be dnl'ed. +m4_define([AS_VAR_PUSHDEF], +[AS_LITERAL_IF([$2], + [m4_pushdef([$1], [AS_TR_SH($2)])], + [as_$1=AS_TR_SH($2) +m4_pushdef([$1], [$as_[$1]])])]) + + +# AS_VAR_POPDEF(VARNAME) +# ---------------------- +# Free the shell variable accessor VARNAME. To be dnl'ed. +m4_define([AS_VAR_POPDEF], +[m4_popdef([$1])]) + + + +## ----------------- ## +## Setting M4sh up. ## +## ----------------- ## + + +# AS_INIT +# ------- +m4_define([AS_INIT], +[m4_init + +# Forbidden tokens and exceptions. +m4_pattern_forbid([^_?AS_]) +]) diff --git a/m4sugar.m4 b/m4sugar.m4 new file mode 100644 index 0000000..cebeb43 --- /dev/null +++ b/m4sugar.m4 @@ -0,0 +1,1741 @@ +divert(-1)# -*- Autoconf -*- +# vile:fk=utf-8 +# This file is part of Autoconf. +# Base M4 layer. +# Requires GNU M4. +# Copyright 2010,2023 Thomas E. Dickey +# Copyright 1999, 2000, 2001 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 +# the Free Software Foundation; either version 2, 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, the Free Software Foundation gives unlimited +# permission to copy, distribute and modify the configure scripts that +# are the output of Autoconf. You need not follow the terms of the GNU +# General Public License when using or distributing such scripts, even +# though portions of the text of Autoconf appear in them. The GNU +# General Public License (GPL) does govern all other use of the material +# that constitutes the Autoconf program. +# +# Certain portions of the Autoconf source text are designed to be copied +# (in certain cases, depending on the input) into the output of +# Autoconf. We call these the "data" portions. The rest of the Autoconf +# source text consists of comments plus executable code that decides which +# of the data portions to output in any given case. We call these +# comments and executable code the "non-data" portions. Autoconf never +# copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autoconf +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autoconf, you may extend this special +# exception to the GPL to apply to your modified version as well, *unless* +# your modified version has the potential to copy into its output some +# of the text that was the non-data portion of the version that you started +# with. (In other words, unless your change moves or copies text from +# the non-data portions to the data portions.) If your modification has +# such potential, you must delete any notice of this special exception +# to the GPL from your modified version. +# +# Written by Akim Demaille. +# + +# Set the quotes, whatever the current quoting system. +changequote() +changequote([, ]) + +# Some old m4's don't support m4exit. But they provide +# equivalent functionality by core dumping because of the +# long macros we define. +ifdef([__gnu__], , +[errprint(M4sugar requires GNU M4. Install it before installing M4sugar or +set the M4 environment variable to its path name.) +m4exit(2)]) + + +## ------------------------------- ## +## 1. Simulate --prefix-builtins. ## +## ------------------------------- ## + +# m4_define +# m4_defn +# m4_undefine +define([m4_define], defn([define])) +define([m4_defn], defn([defn])) +define([m4_undefine], defn([undefine])) + +m4_undefine([define]) +m4_undefine([defn]) +m4_undefine([undefine]) + + +# m4_copy(SRC, DST) +# ----------------- +# Define DST as the definition of SRC. +# What's the difference between: +# 1. m4_copy([from], [to]) +# 2. m4_define([from], [to($@)]) +# Well, obviously 1 is more expansive in space. Maybe 2 is more expansive +# in time, but because of the space cost of 1, it's not that obvious. +# Nevertheless, one huge difference is the handling of `$0'. If `from' +# uses `$0', then with 1, `to''s `$0' is `to', while it is `from' in 2. +# The user will certainly prefer see `from'. +m4_define([m4_copy], +[m4_define([$2], m4_defn([$1]))]) + + +# m4_rename(SRC, DST) +# ------------------- +# Rename the macro SRC as DST. +m4_define([m4_rename], +[m4_copy([$1], [$2])m4_undefine([$1])]) + + +# m4_rename_m4(MACRO-NAME) +# ------------------------ +# Rename MACRO-NAME as m4_MACRO-NAME. +m4_define([m4_rename_m4], +[m4_rename([$1], [m4_$1])]) + + +# m4_copy_unm4(m4_MACRO-NAME) +# --------------------------- +# Copy m4_MACRO-NAME as MACRO-NAME. +m4_define([m4_copy_unm4], +[m4_copy([$1], m4_patsubst([$1], [^m4_\(.*\)], [[\1]]))]) + + +# Some m4 internals have names colliding with tokens we might use. +# Rename them a` la `m4 --prefix-builtins'. +m4_rename_m4([builtin]) +m4_rename_m4([changecom]) +m4_rename_m4([changequote]) +m4_rename_m4([debugfile]) +m4_rename_m4([debugmode]) +m4_rename_m4([decr]) +m4_undefine([divert]) +m4_rename_m4([divnum]) +m4_rename_m4([dumpdef]) +m4_rename_m4([errprint]) +m4_rename_m4([esyscmd]) +m4_rename_m4([eval]) +m4_rename_m4([format]) +m4_rename_m4([ifdef]) +m4_rename([ifelse], [m4_if]) +m4_rename_m4([include]) +m4_rename_m4([incr]) +m4_rename_m4([index]) +m4_rename_m4([indir]) +m4_rename_m4([len]) +m4_rename([m4exit], [m4_exit]) +m4_rename([m4wrap], [m4_wrap]) +m4_rename_m4([maketemp]) +m4_rename_m4([patsubst]) +m4_undefine([popdef]) +m4_rename_m4([pushdef]) +m4_rename_m4([regexp]) +m4_rename_m4([shift]) +m4_rename_m4([sinclude]) +m4_rename_m4([substr]) +m4_rename_m4([symbols]) +m4_rename_m4([syscmd]) +m4_rename_m4([sysval]) +m4_rename_m4([traceoff]) +m4_rename_m4([traceon]) +m4_rename_m4([translit]) +m4_undefine([undivert]) + + +## ------------------- ## +## 2. Error messages. ## +## ------------------- ## + + +# m4_location +# ----------- +m4_define([m4_location], +[__file__:__line__]) + + +# m4_errprintn(MSG) +# ----------------- +# Same as `errprint', but with the missing end of line. +m4_define([m4_errprintn], +[m4_errprint([$1 +])]) + + +# m4_warning(MSG) +# --------------- +# Warn the user. +m4_define([m4_warning], +[m4_errprintn(m4_location[: warning: $1])]) + + +# m4_fatal(MSG, [EXIT-STATUS]) +# ---------------------------- +# Fatal the user. :) +m4_define([m4_fatal], +[m4_errprintn(m4_location[: error: $1])dnl +m4_expansion_stack_dump()dnl +m4_exit(m4_if([$2],, 1, [$2]))]) + + +# m4_assert(EXPRESSION, [EXIT-STATUS = 1]) +# ---------------------------------------- +# This macro ensures that EXPRESSION evaluates to true, and exits if +# EXPRESSION evaluates to false. +m4_define([m4_assert], +[m4_if(m4_eval([$1]), 0, + [m4_fatal([assert failed: $1], [$2])])]) + + +## ------------- ## +## 3. Warnings. ## +## ------------- ## + + +# m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE) +# ---------------------------------------------- +# If the CATEGORY of warnings is enabled, expand IF_TRUE otherwise +# IF-FALSE. +# +# The variable `m4_warnings' contains a comma separated list of +# warnings which order is the converse from the one specified by +# the user, i.e., if she specified `-W error,none,obsolete', +# `m4_warnings' is `obsolete,none,error'. We read it from left to +# right, and: +# - if none or noCATEGORY is met, run IF-FALSE +# - if all or CATEGORY is met, run IF-TRUE +# - if there is nothing left, run IF-FALSE. +m4_define([m4_warning_ifelse], +[_m4_warning_ifelse([$1], [$2], [$3], m4_warnings)]) + + +# _m4_warning_ifelse(CATEGORY, IF-TRUE, IF-FALSE, WARNING1, ...) +# -------------------------------------------------------------- +# Implementation of the loop described above. +m4_define([_m4_warning_ifelse], +[m4_case([$4], + [$1], [$2], + [all], [$2], + [], [$3], + [none], [$3], + [no-$1], [$3], + [$0([$1], [$2], [$3], m4_shiftn(4, $@))])]) + + +# _m4_warning_error_ifelse(IF-TRUE, IF-FALSE) +# ------------------------------------------- +# The same as m4_warning_ifelse, but scan for `error' only. +m4_define([_m4_warning_error_ifelse], +[__m4_warning_error_ifelse([$1], [$2], m4_warnings)]) + + +# __m4_warning_error_ifelse(IF-TRUE, IF-FALSE) +# -------------------------------------------- +# The same as _m4_warning_ifelse, but scan for `error' only. +m4_define([__m4_warning_error_ifelse], +[m4_case([$3], + [error], [$1], + [], [$2], + [no-error], [$2], + [$0([$1], [$2], m4_shiftn(3, $@))])]) + + + +# _m4_warn(MESSAGE) +# ----------------- +# Report MESSAGE as a warning, unless the user requested -W error, +# in which case report a fatal error. +m4_define([_m4_warn], +[_m4_warning_error_ifelse([m4_fatal([$1])], + [m4_warning([$1])])]) + + +# m4_warn(CATEGORY, MESSAGE) +# -------------------------- +# Report a MESSAGE to the autoconf user if the CATEGORY of warnings +# is requested (in fact, not disabled). +m4_define([m4_warn], +[m4_warning_ifelse([$1], [_m4_warn([$2])])]) + + + + +## ------------------- ## +## 4. File inclusion. ## +## ------------------- ## + + +# We also want to neutralize include (and sinclude for symmetry), +# but we want to extend them slightly: warn when a file is included +# several times. This is in general a dangerous operation because +# quite nobody quotes the first argument of m4_define. +# +# For instance in the following case: +# m4_define(foo, [bar]) +# then a second reading will turn into +# m4_define(bar, [bar]) +# which is certainly not what was meant. + +# m4_include_unique(FILE) +# ----------------------- +# Declare that the FILE was loading; and warn if it has already +# been included. +m4_define([m4_include_unique], +[m4_ifdef([m4_include($1)], + [m4_warn([syntax], [file `$1' included several times])])dnl +m4_define([m4_include($1)])]) + + +# m4_include(FILE) +# ---------------- +# As the builtin include, but warns against multiple inclusions. +m4_define([m4_include], +[m4_include_unique([$1])dnl +m4_builtin([include], [$1])]) + + +# m4_sinclude(FILE) +# ----------------- +# As the builtin sinclude, but warns against multiple inclusions. +m4_define([m4_sinclude], +[m4_include_unique([$1])dnl +m4_builtin([sinclude], [$1])]) + + + +## ------------------------------------ ## +## 5. Additional branching constructs. ## +## ------------------------------------ ## + +# Both `m4_ifval' and `m4_ifset' tests against the empty string. The +# difference is that `m4_ifset' is specialized on macros. +# +# In case of arguments of macros, eg $[1], it makes little difference. +# In the case of a macro `FOO', you don't want to check `m4_ifval(FOO, +# TRUE)', because if `FOO' expands with commas, there is a shifting of +# the arguments. So you want to run `m4_ifval([FOO])', but then you just +# compare the *string* `FOO' against `', which, of course fails. +# +# So you want a variation of `m4_ifset' that expects a macro name as $[1]. +# If this macro is both defined and defined to a non empty value, then +# it runs TRUE etc. + + +# m4_ifval(COND, [IF-TRUE], [IF-FALSE]) +# ------------------------------------- +# If COND is not the empty string, expand IF-TRUE, otherwise IF-FALSE. +# Comparable to m4_ifdef. +m4_define([m4_ifval], +[m4_if([$1], [], [$3], [$2])]) + + +# m4_n(TEXT) +# ---------- +# If TEXT is not empty, return TEXT and a new line, otherwise nothing. +m4_define([m4_n], +[m4_if([$1], + [], [], + [$1 +])]) + + +# m4_ifvaln(COND, [IF-TRUE], [IF-FALSE]) +# -------------------------------------- +# Same as `m4_ifval', but add an extra newline to IF-TRUE or IF-FALSE +# unless that argument is empty. +m4_define([m4_ifvaln], +[m4_if([$1], + [], [m4_n([$3])], + [m4_n([$2])])]) + + +# m4_ifset(MACRO, [IF-TRUE], [IF-FALSE]) +# -------------------------------------- +# If MACRO has no definition, or of its definition is the empty string, +# expand IF-FALSE, otherwise IF-TRUE. +m4_define([m4_ifset], +[m4_ifdef([$1], + [m4_if(m4_defn([$1]), [], [$3], [$2])], + [$3])]) + + +# m4_ifndef(NAME, [IF-NOT-DEFINED], [IF-DEFINED]) +# ----------------------------------------------- +m4_define([m4_ifndef], +[m4_ifdef([$1], [$3], [$2])]) + + +# m4_case(SWITCH, VAL1, IF-VAL1, VAL2, IF-VAL2, ..., DEFAULT) +# ----------------------------------------------------------- +# m4 equivalent of +# switch (SWITCH) +# { +# case VAL1: +# IF-VAL1; +# break; +# case VAL2: +# IF-VAL2; +# break; +# ... +# default: +# DEFAULT; +# break; +# }. +# All the values are optional, and the macro is robust to active +# symbols properly quoted. +m4_define([m4_case], +[m4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + [$1], [$2], [$3], + [m4_case([$1], m4_shiftn(3, $@))])]) + + +# m4_match(SWITCH, RE1, VAL1, RE2, VAL2, ..., DEFAULT) +# ---------------------------------------------------- +# m4 equivalent of +# +# if (SWITCH =~ RE1) +# VAL1; +# elif (SWITCH =~ RE2) +# VAL2; +# elif ... +# ... +# else +# DEFAULT +# +# All the values are optional, and the macro is robust to active symbols +# properly quoted. +m4_define([m4_match], +[m4_if([$#], 0, [], + [$#], 1, [], + [$#], 2, [$2], + m4_regexp([$1], [$2]), -1, [m4_match([$1], m4_shiftn(3, $@))], + [$3])]) + + + +## ---------------------------------------- ## +## 6. Enhanced version of some primitives. ## +## ---------------------------------------- ## + +# m4_do(STRING, ...) +# ------------------ +# This macro invokes all its arguments (in sequence, of course). It is +# useful for making your macros more structured and readable by dropping +# unnecessary dnl's and have the macros indented properly. +m4_define([m4_do], +[m4_if($#, 0, [], + $#, 1, [$1], + [$1[]m4_do(m4_shift($@))])]) + + +# m4_default(EXP1, EXP2) +# ---------------------- +# Returns EXP1 if non empty, otherwise EXP2. +m4_define([m4_default], +[m4_ifval([$1], [$1], [$2])]) + + +# m4_defn(NAME) +# ------------- +# Unlike to the original, don't tolerate popping something which is +# undefined. +m4_define([m4_defn], +[m4_ifndef([$1], + [m4_fatal([$0: undefined macro: $1])])dnl +m4_builtin([defn], $@)]) + + +# _m4_dumpdefs_up(NAME) +# --------------------- +m4_define([_m4_dumpdefs_up], +[m4_ifdef([$1], + [m4_pushdef([_m4_dumpdefs], m4_defn([$1]))dnl +m4_dumpdef([$1])dnl +m4_popdef([$1])dnl +_m4_dumpdefs_up([$1])])]) + + +# _m4_dumpdefs_down(NAME) +# ----------------------- +m4_define([_m4_dumpdefs_down], +[m4_ifdef([_m4_dumpdefs], + [m4_pushdef([$1], m4_defn([_m4_dumpdefs]))dnl +m4_popdef([_m4_dumpdefs])dnl +_m4_dumpdefs_down([$1])])]) + + +# m4_dumpdefs(NAME) +# ----------------- +# Similar to `m4_dumpdef(NAME)', but if NAME was m4_pushdef'ed, display its +# value stack (most recent displayed first). +m4_define([m4_dumpdefs], +[_m4_dumpdefs_up([$1])dnl +_m4_dumpdefs_down([$1])]) + + +# m4_popdef(NAME) +# --------------- +# Unlike to the original, don't tolerate popping something which is +# undefined. +m4_define([m4_popdef], +[m4_ifndef([$1], + [m4_fatal([$0: undefined macro: $1])])dnl +m4_builtin([popdef], $@)]) + + +# m4_quote(STRING) +# ---------------- +# Return STRING quoted. +# +# It is important to realize the difference between `m4_quote(exp)' and +# `[exp]': in the first case you obtain the quoted *result* of the +# expansion of EXP, while in the latter you just obtain the string +# `exp'. +m4_define([m4_quote], [[$*]]) +m4_define([m4_dquote], [[[$*]]]) + + +# m4_noquote(STRING) +# ------------------ +# Return the result of ignoring all quotes in STRING and invoking the +# macros it contains. Amongst other things useful for enabling macro +# invocations inside strings with [] blocks (for instance regexps and +# help-strings). +m4_define([m4_noquote], +[m4_changequote(-=<{,}>=-)$1-=<{}>=-m4_changequote([,])]) + + +# m4_shiftn(N, ...) +# ----------------- +# Returns ... shifted N times. Useful for recursive "varargs" constructs. +m4_define([m4_shiftn], +[m4_assert(($1 >= 0) && ($# > $1))dnl +_m4_shiftn($@)]) + +m4_define([_m4_shiftn], +[m4_if([$1], 0, + [m4_shift($@)], + [_m4_shiftn(m4_eval([$1]-1), m4_shift(m4_shift($@)))])]) + + +# m4_undefine(NAME) +# ----------------- +# Unlike to the original, don't tolerate undefining something which is +# undefined. +m4_define([m4_undefine], +[m4_ifndef([$1], + [m4_fatal([$0: undefined macro: $1])])dnl +m4_builtin([undefine], $@)]) + + +## -------------------------- ## +## 7. Implementing m4 loops. ## +## -------------------------- ## + + +# m4_for(VARIABLE, FIRST, LAST, [STEP = +/-1], EXPRESSION) +# -------------------------------------------------------- +# Expand EXPRESSION defining VARIABLE to FROM, FROM + 1, ..., TO. +# Both limits are included, and bounds are checked for consistency. +m4_define([m4_for], +[m4_case(m4_sign(m4_eval($3 - $2)), + 1, [m4_assert(m4_sign(m4_default($4, 1)) == 1)], + -1, [m4_assert(m4_sign(m4_default($4, -1)) == -1)])dnl +m4_pushdef([$1], [$2])dnl +m4_if(m4_eval([$3 > $2]), 1, + [_m4_for([$1], [$3], m4_default([$4], 1), [$5])], + [_m4_for([$1], [$3], m4_default([$4], -1), [$5])])dnl +m4_popdef([$1])]) + + +# _m4_for(VARIABLE, FIRST, LAST, STEP, EXPRESSION) +# ------------------------------------------------ +# Core of the loop, no consistency checks. +m4_define([_m4_for], +[$4[]dnl +m4_if($1, [$2], [], + [m4_define([$1], m4_eval($1+[$3]))_m4_for([$1], [$2], [$3], [$4])])]) + + +# Implementing `foreach' loops in m4 is much more tricky than it may +# seem. Actually, the example of a `foreach' loop in the m4 +# documentation is wrong: it does not quote the arguments properly, +# which leads to undesired expansions. +# +# The example in the documentation is: +# +# | # foreach(VAR, (LIST), STMT) +# | m4_define([foreach], +# | [m4_pushdef([$1])_foreach([$1], [$2], [$3])m4_popdef([$1])]) +# | m4_define([_arg1], [$1]) +# | m4_define([_foreach], +# | [m4_if([$2], [()], , +# | [m4_define([$1], _arg1$2)$3[]_foreach([$1], +# | (shift$2), +# | [$3])])]) +# +# But then if you run +# +# | m4_define(a, 1) +# | m4_define(b, 2) +# | m4_define(c, 3) +# | foreach([f], [([a], [(b], [c)])], [echo f +# | ]) +# +# it gives +# +# => echo 1 +# => echo (2,3) +# +# which is not what is expected. +# +# Of course the problem is that many quotes are missing. So you add +# plenty of quotes at random places, until you reach the expected +# result. Alternatively, if you are a quoting wizard, you directly +# reach the following implementation (but if you really did, then +# apply to the maintenance of m4sugar!). +# +# | # foreach(VAR, (LIST), STMT) +# | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])]) +# | m4_define([_arg1], [[$1]]) +# | m4_define([_foreach], +# | [m4_if($2, [()], , +# | [m4_define([$1], [_arg1$2])$3[]_foreach([$1], +# | [(shift$2)], +# | [$3])])]) +# +# which this time answers +# +# => echo a +# => echo (b +# => echo c) +# +# Bingo! +# +# Well, not quite. +# +# With a better look, you realize that the parens are more a pain than +# a help: since anyway you need to quote properly the list, you end up +# with always using an outermost pair of parens and an outermost pair +# of quotes. Rejecting the parens both eases the implementation, and +# simplifies the use: +# +# | # foreach(VAR, (LIST), STMT) +# | m4_define([foreach], [m4_pushdef([$1])_foreach($@)m4_popdef([$1])]) +# | m4_define([_arg1], [$1]) +# | m4_define([_foreach], +# | [m4_if($2, [], , +# | [m4_define([$1], [_arg1($2)])$3[]_foreach([$1], +# | [shift($2)], +# | [$3])])]) +# +# +# Now, just replace the `$2' with `m4_quote($2)' in the outer `m4_if' +# to improve robustness, and you come up with a quite satisfactory +# implementation. + + +# m4_foreach(VARIABLE, LIST, EXPRESSION) +# -------------------------------------- +# +# Expand EXPRESSION assigning each value of the LIST to VARIABLE. +# LIST should have the form `item_1, item_2, ..., item_n', i.e. the +# whole list must *quoted*. Quote members too if you don't want them +# to be expanded. +# +# This macro is robust to active symbols: +# | m4_define(active, [ACT, IVE]) +# | m4_foreach(Var, [active, active], [-Var-]) +# => -ACT--IVE--ACT--IVE- +# +# | m4_foreach(Var, [[active], [active]], [-Var-]) +# => -ACT, IVE--ACT, IVE- +# +# | m4_foreach(Var, [[[active]], [[active]]], [-Var-]) +# => -active--active- +m4_define([m4_foreach], +[m4_pushdef([$1])_m4_foreach($@)m4_popdef([$1])]) + +# Low level macros used to define m4_foreach. +m4_define([m4_car], [$1]) +m4_define([_m4_foreach], +[m4_if(m4_quote($2), [], [], + [m4_define([$1], [m4_car($2)])$3[]_m4_foreach([$1], + [m4_shift($2)], + [$3])])]) + + + +## --------------------------- ## +## 8. More diversion support. ## +## --------------------------- ## + + +# _m4_divert(DIVERSION-NAME or NUMBER) +# ------------------------------------ +# If DIVERSION-NAME is the name of a diversion, return its number, +# otherwise if is a NUMBER return it. +m4_define([_m4_divert], +[m4_ifdef([_m4_divert($1)], + [m4_indir([_m4_divert($1)])], + [$1])]) + +# KILL is only used to suppress output. +m4_define([_m4_divert(KILL)], -1) + + +# m4_divert(DIVERSION-NAME) +# ------------------------- +# Change the diversion stream to DIVERSION-NAME. +m4_define([m4_divert], +[m4_define([m4_divert_stack], + m4_location[: $0: $1]m4_ifdef([m4_divert_stack], [ +m4_defn([m4_divert_stack])]))dnl +m4_builtin([divert], _m4_divert([$1]))dnl +]) + + +# m4_divert_push(DIVERSION-NAME) +# ------------------------------ +# Change the diversion stream to DIVERSION-NAME, while stacking old values. +m4_define([m4_divert_push], +[m4_pushdef([m4_divert_stack], + m4_location[: $0: $1]m4_ifdef([m4_divert_stack], [ +m4_defn([m4_divert_stack])]))dnl +m4_pushdef([_m4_divert_diversion], [$1])dnl +m4_builtin([divert], _m4_divert(_m4_divert_diversion))dnl +]) + + +# m4_divert_pop([DIVERSION-NAME]) +# ------------------------------- +# Change the diversion stream to its previous value, unstacking it. +# If specified, verify we left DIVERSION-NAME. +m4_define([m4_divert_pop], +[m4_ifval([$1], + [m4_if(_m4_divert([$1]), m4_divnum, [], + [m4_fatal([$0($1): unexpected current diversion: ]m4_divnum)])])dnl +m4_popdef([_m4_divert_diversion])dnl +dnl m4_ifndef([_m4_divert_diversion], +dnl [m4_fatal([too many m4_divert_pop])])dnl +m4_builtin([divert], + m4_ifdef([_m4_divert_diversion], + [_m4_divert(_m4_divert_diversion)], -1))dnl +m4_popdef([m4_divert_stack])dnl +]) + + +# m4_divert_text(DIVERSION-NAME, CONTENT) +# --------------------------------------- +# Output CONTENT into DIVERSION-NAME (which may be a number actually). +# An end of line is appended for free to CONTENT. +m4_define([m4_divert_text], +[m4_divert_push([$1])dnl +$2 +m4_divert_pop([$1])dnl +]) + + +# m4_divert_once(DIVERSION-NAME, CONTENT) +# --------------------------------------- +# Output once CONTENT into DIVERSION-NAME (which may be a number +# actually). An end of line is appended for free to CONTENT. +m4_define([m4_divert_once], +[m4_expand_once([m4_divert_text([$1], [$2])])]) + + +# m4_undivert(DIVERSION-NAME) +# --------------------------- +# Undivert DIVERSION-NAME. +m4_define([m4_undivert], +[m4_builtin([undivert], _m4_divert([$1]))]) + + + + +## -------------------------------------------- ## +## 8. Defining macros with bells and whistles. ## +## -------------------------------------------- ## + +# `m4_defun' is basically `m4_define' but it equips the macro with the +# needed machinery for `m4_require'. A macro must be m4_defun'd if +# either it is m4_require'd, or it m4_require's. +# +# Two things deserve attention and are detailed below: +# 1. Implementation of m4_require +# 2. Keeping track of the expansion stack +# +# 1. Implementation of m4_require +# =============================== +# +# Of course m4_defun AC_PROVIDE's the macro, so that a macro which has +# been expanded is not expanded again when m4_require'd, but the +# difficult part is the proper expansion of macros when they are +# m4_require'd. +# +# The implementation is based on two ideas, (i) using diversions to +# prepare the expansion of the macro and its dependencies (by François +# Pinard), and (ii) expand the most recently m4_require'd macros _after_ +# the previous macros (by Axel Thimm). +# +# +# The first idea: why using diversions? +# ------------------------------------- +# +# When a macro requires another, the other macro is expanded in new +# diversion, GROW. When the outer macro is fully expanded, we first +# undivert the most nested diversions (GROW - 1...), and finally +# undivert GROW. To understand why we need several diversions, +# consider the following example: +# +# | m4_defun([TEST1], [Test...REQUIRE([TEST2])1]) +# | m4_defun([TEST2], [Test...REQUIRE([TEST3])2]) +# | m4_defun([TEST3], [Test...3]) +# +# Because m4_require is not required to be first in the outer macros, we +# must keep the expansions of the various level of m4_require separated. +# Right before executing the epilogue of TEST1, we have: +# +# GROW - 2: Test...3 +# GROW - 1: Test...2 +# GROW: Test...1 +# BODY: +# +# Finally the epilogue of TEST1 undiverts GROW - 2, GROW - 1, and +# GROW into the regular flow, BODY. +# +# GROW - 2: +# GROW - 1: +# GROW: +# BODY: Test...3; Test...2; Test...1 +# +# (The semicolons are here for clarification, but of course are not +# emitted.) This is what Autoconf 2.0 (I think) to 2.13 (I'm sure) +# implement. +# +# +# The second idea: first required first out +# ----------------------------------------- +# +# The natural implementation of the idea above is buggy and produces +# very surprising results in some situations. Let's consider the +# following example to explain the bug: +# +# | m4_defun([TEST1], [REQUIRE([TEST2a])REQUIRE([TEST2b])]) +# | m4_defun([TEST2a], []) +# | m4_defun([TEST2b], [REQUIRE([TEST3])]) +# | m4_defun([TEST3], [REQUIRE([TEST2a])]) +# | +# | AC_INIT +# | TEST1 +# +# The dependencies between the macros are: +# +# 3 --- 2b +# / \ is m4_require'd by +# / \ left -------------------- right +# 2a ------------ 1 +# +# If you strictly apply the rules given in the previous section you get: +# +# GROW - 2: TEST3 +# GROW - 1: TEST2a; TEST2b +# GROW: TEST1 +# BODY: +# +# (TEST2a, although required by TEST3 is not expanded in GROW - 3 +# because is has already been expanded before in GROW - 1, so it has +# been AC_PROVIDE'd, so it is not expanded again) so when you undivert +# the stack of diversions, you get: +# +# GROW - 2: +# GROW - 1: +# GROW: +# BODY: TEST3; TEST2a; TEST2b; TEST1 +# +# i.e., TEST2a is expanded after TEST3 although the latter required the +# former. +# +# Starting from 2.50, uses an implementation provided by Axel Thimm. +# The idea is simple: the order in which macros are emitted must be the +# same as the one in which macro are expanded. (The bug above can +# indeed be described as: a macro has been AC_PROVIDE'd, but it is +# emitted after: the lack of correlation between emission and expansion +# order is guilty). +# +# How to do that? You keeping the stack of diversions to elaborate the +# macros, but each time a macro is fully expanded, emit it immediately. +# +# In the example above, when TEST2a is expanded, but it's epilogue is +# not run yet, you have: +# +# GROW - 2: +# GROW - 1: TEST2a +# GROW: Elaboration of TEST1 +# BODY: +# +# The epilogue of TEST2a emits it immediately: +# +# GROW - 2: +# GROW - 1: +# GROW: Elaboration of TEST1 +# BODY: TEST2a +# +# TEST2b then requires TEST3, so right before the epilogue of TEST3, you +# have: +# +# GROW - 2: TEST3 +# GROW - 1: Elaboration of TEST2b +# GROW: Elaboration of TEST1 +# BODY: TEST2a +# +# The epilogue of TEST3 emits it: +# +# GROW - 2: +# GROW - 1: Elaboration of TEST2b +# GROW: Elaboration of TEST1 +# BODY: TEST2a; TEST3 +# +# TEST2b is now completely expanded, and emitted: +# +# GROW - 2: +# GROW - 1: +# GROW: Elaboration of TEST1 +# BODY: TEST2a; TEST3; TEST2b +# +# and finally, TEST1 is finished and emitted: +# +# GROW - 2: +# GROW - 1: +# GROW: +# BODY: TEST2a; TEST3; TEST2b: TEST1 +# +# The idea, is simple, but the implementation is a bit evolved. If you +# are like me, you will want to see the actual functioning of this +# implementation to be convinced. The next section gives the full +# details. +# +# +# The Axel Thimm implementation at work +# ------------------------------------- +# +# We consider the macros above, and this configure.ac: +# +# AC_INIT +# TEST1 +# +# You should keep the definitions of _m4_defun_pro, _m4_defun_epi, and +# m4_require at hand to follow the steps. +# +# This implements tries not to assume that of the current diversion is +# BODY, so as soon as a macro (m4_defun'd) is expanded, we first +# record the current diversion under the name _m4_divert_dump (denoted +# DUMP below for short). This introduces an important difference with +# the previous versions of Autoconf: you cannot use m4_require if you +# were not inside an m4_defun'd macro, and especially, you cannot +# m4_require directly from the top level. +# +# We have not tried to simulate the old behavior (better yet, we +# diagnose it), because it is too dangerous: a macro m4_require'd from +# the top level is expanded before the body of `configure', i.e., before +# any other test was run. I let you imagine the result of requiring +# AC_STDC_HEADERS for instance, before AC_PROG_CC was actually run.... +# +# After AC_INIT was run, the current diversion is BODY. +# * AC_INIT was run +# DUMP: undefined +# diversion stack: BODY |- +# +# * TEST1 is expanded +# The prologue of TEST1 sets AC_DIVERSION_DUMP, which is the diversion +# where the current elaboration will be dumped, to the current +# diversion. It also m4_divert_push to GROW, where the full +# expansion of TEST1 and its dependencies will be elaborated. +# DUMP: BODY +# BODY: empty +# diversions: GROW, BODY |- +# +# * TEST1 requires TEST2a: prologue +# m4_require m4_divert_pushes another temporary diversion GROW - 1 (in +# fact, the diversion whose number is one less than the current +# diversion), and expands TEST2a in there. +# DUMP: BODY +# BODY: empty +# diversions: GROW-1, GROW, BODY |- +# +# * TEST2a is expanded. +# Its prologue pushes the current diversion again. +# DUMP: BODY +# BODY: empty +# diversions: GROW - 1, GROW - 1, GROW, BODY |- +# It is expanded in GROW - 1, and GROW - 1 is popped by the epilogue +# of TEST2a. +# DUMP: BODY +# BODY: nothing +# GROW - 1: TEST2a +# diversions: GROW - 1, GROW, BODY |- +# +# * TEST1 requires TEST2a: epilogue +# The content of the current diversion is appended to DUMP (and removed +# from the current diversion). A diversion is popped. +# DUMP: BODY +# BODY: TEST2a +# diversions: GROW, BODY |- +# +# * TEST1 requires TEST2b: prologue +# m4_require pushes GROW - 1 and expands TEST2b. +# DUMP: BODY +# BODY: TEST2a +# diversions: GROW - 1, GROW, BODY |- +# +# * TEST2b is expanded. +# Its prologue pushes the current diversion again. +# DUMP: BODY +# BODY: TEST2a +# diversions: GROW - 1, GROW - 1, GROW, BODY |- +# The body is expanded here. +# +# * TEST2b requires TEST3: prologue +# m4_require pushes GROW - 2 and expands TEST3. +# DUMP: BODY +# BODY: TEST2a +# diversions: GROW - 2, GROW - 1, GROW - 1, GROW, BODY |- +# +# * TEST3 is expanded. +# Its prologue pushes the current diversion again. +# DUMP: BODY +# BODY: TEST2a +# diversions: GROW-2, GROW-2, GROW-1, GROW-1, GROW, BODY |- +# TEST3 requires TEST2a, but TEST2a has already been AC_PROVIDE'd, so +# nothing happens. It's body is expanded here, and its epilogue pops a +# diversion. +# DUMP: BODY +# BODY: TEST2a +# GROW - 2: TEST3 +# diversions: GROW - 2, GROW - 1, GROW - 1, GROW, BODY |- +# +# * TEST2b requires TEST3: epilogue +# The current diversion is appended to DUMP, and a diversion is popped. +# DUMP: BODY +# BODY: TEST2a; TEST3 +# diversions: GROW - 1, GROW - 1, GROW, BODY |- +# The content of TEST2b is expanded here. +# DUMP: BODY +# BODY: TEST2a; TEST3 +# GROW - 1: TEST2b, +# diversions: GROW - 1, GROW - 1, GROW, BODY |- +# The epilogue of TEST2b pops a diversion. +# DUMP: BODY +# BODY: TEST2a; TEST3 +# GROW - 1: TEST2b, +# diversions: GROW - 1, GROW, BODY |- +# +# * TEST1 requires TEST2b: epilogue +# The current diversion is appended to DUMP, and a diversion is popped. +# DUMP: BODY +# BODY: TEST2a; TEST3; TEST2b +# diversions: GROW, BODY |- +# +# * TEST1 is expanded: epilogue +# TEST1's own content is in GROW, and it's epilogue pops a diversion. +# DUMP: BODY +# BODY: TEST2a; TEST3; TEST2b +# GROW: TEST1 +# diversions: BODY |- +# Here, the epilogue of TEST1 notices the elaboration is done because +# DUMP and the current diversion are the same, it then undiverts +# GROW by hand, and undefines DUMP. +# DUMP: undefined +# BODY: TEST2a; TEST3; TEST2b; TEST1 +# diversions: BODY |- +# +# +# 2. Keeping track of the expansion stack +# ======================================= +# +# When M4 expansion goes wrong it is often extremely hard to find the +# path amongst macros that drove to the failure. What is needed is +# the stack of macro `calls'. One could imagine that GNU M4 would +# maintain a stack of macro expansions, unfortunately it doesn't, so +# we do it by hand. This is of course extremely costly, but the help +# this stack provides is worth it. Nevertheless to limit the +# performance penalty this is implemented only for m4_defun'd macros, +# not for define'd macros. +# +# The scheme is simplistic: each time we enter an m4_defun'd macros, +# we prepend its name in m4_expansion_stack, and when we exit the +# macro, we remove it (thanks to pushdef/popdef). +# +# In addition, we want to use the expansion stack to detect circular +# m4_require dependencies. This means we need to browse the stack to +# check whether a macro being expanded is m4_require'd. For ease of +# implementation, and certainly for the benefit of performances, we +# don't browse the m4_expansion_stack, rather each time we expand a +# macro FOO we define _m4_expanding(FOO). Then m4_require(BAR) simply +# needs to check whether _m4_expanding(BAR) is defined to diagnose a +# circular dependency. +# +# To improve the diagnostic, in addition to keeping track of the stack +# of macro calls, m4_expansion_stack also records the m4_require +# stack. Note that therefore an m4_defun'd macro being required will +# appear twice in the stack: the first time because it is required, +# the second because it is expanded. We can avoid this, but it has +# two small drawbacks: (i) the implementation is slightly more +# complex, and (ii) it hides the difference between define'd macros +# (which don't appear in m4_expansion_stack) and m4_defun'd macros +# (which do). The more debugging information, the better. + + +# m4_expansion_stack_push(TEXT) +# ----------------------------- +m4_define([m4_expansion_stack_push], +[m4_pushdef([m4_expansion_stack], + [$1]m4_ifdef([m4_expansion_stack], [ +m4_defn([m4_expansion_stack])]))]) + + +# m4_expansion_stack_pop +# ---------------------- +# Dump the expansion stack. +m4_define([m4_expansion_stack_pop], +[m4_popdef([m4_expansion_stack])]) + + +# m4_expansion_stack_dump +# ----------------------- +# Dump the expansion stack. +m4_define([m4_expansion_stack_dump], +[m4_ifdef([m4_expansion_stack], + [m4_errprintn(m4_defn([m4_expansion_stack]))])dnl +m4_errprintn(m4_location[: the top level])]) + + +# _m4_divert(GROW) +# ---------------- +# This diversion is used by the m4_defun/m4_require machinery. It is +# important to keep room before GROW because for each nested +# AC_REQUIRE we use an additional diversion (i.e., two m4_require's +# will use GROW - 2. More than 3 levels has never seemed to be +# needed.) +# +# ... +# - GROW - 2 +# m4_require'd code, 2 level deep +# - GROW - 1 +# m4_require'd code, 1 level deep +# - GROW +# m4_defun'd macros are elaborated here. + +m4_define([_m4_divert(GROW)], 10000) + + +# _m4_defun_pro(MACRO-NAME) +# ------------------------- +# The prologue for Autoconf macros. +m4_define([_m4_defun_pro], +[m4_expansion_stack_push(m4_defn([m4_location($1)])[: $1 is expanded from...])dnl +m4_pushdef([_m4_expanding($1)])dnl +m4_ifdef([_m4_divert_dump], + [m4_divert_push(m4_defn([_m4_divert_diversion]))], + [m4_copy([_m4_divert_diversion], [_m4_divert_dump])dnl +m4_divert_push([GROW])])dnl +]) + + +# _m4_defun_epi(MACRO-NAME) +# ------------------------- +# The Epilogue for Autoconf macros. MACRO-NAME only helps tracing +# the PRO/EPI pairs. +m4_define([_m4_defun_epi], +[m4_divert_pop()dnl +m4_if(_m4_divert_dump, _m4_divert_diversion, + [m4_undivert([GROW])dnl +m4_undefine([_m4_divert_dump])])dnl +m4_expansion_stack_pop()dnl +m4_popdef([_m4_expanding($1)])dnl +m4_provide([$1])dnl +]) + + +# m4_defun(NAME, EXPANSION) +# ------------------------- +# Define a macro which automatically provides itself. Add machinery +# so the macro automatically switches expansion to the diversion +# stack if it is not already using it. In this case, once finished, +# it will bring back all the code accumulated in the diversion stack. +# This, combined with m4_require, achieves the topological ordering of +# macros. We don't use this macro to define some frequently called +# macros that are not involved in ordering constraints, to save m4 +# processing. +m4_define([m4_defun], +[m4_define([m4_location($1)], m4_location)dnl +m4_define([$1], + [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])]) + + +# m4_defun_once(NAME, EXPANSION) +# ------------------------------ +# As m4_defun, but issues the EXPANSION only once, and warns if used +# several times. +m4_define([m4_defun_once], +[m4_define([m4_location($1)], m4_location)dnl +m4_define([$1], + [m4_provide_ifelse([$1], + [m4_warn([syntax], [$1 invoked multiple times])], + [_m4_defun_pro([$1])$2[]_m4_defun_epi([$1])])])]) + + +# m4_pattern_forbid(ERE) +# ---------------------- +# Declare that no token matching the extended regular expression ERE +# should be seen in the output but if... +m4_define([m4_pattern_forbid], +[m4_file_append(m4_defn([m4_tmpdir])/forbidden.rx, [$1])]) + + +# m4_pattern_allow(ERE) +# --------------------- +# ... but if that token matches the extended regular expression ERE. +m4_define([m4_pattern_allow], +[m4_file_append(m4_defn([m4_tmpdir])/allowed.rx, [$1])]) + + +## ----------------------------- ## +## Dependencies between macros. ## +## ----------------------------- ## + + +# m4_before(THIS-MACRO-NAME, CALLED-MACRO-NAME) +# --------------------------------------------- +m4_define([m4_before], +[m4_provide_ifelse([$2], + [m4_warn([syntax], [$2 was called before $1])])]) + + +# m4_require(NAME-TO-CHECK, [BODY-TO-EXPAND = NAME-TO-CHECK]) +# ----------------------------------------------------------- +# If NAME-TO-CHECK has never been expanded (actually, if it is not +# m4_provide'd), expand BODY-TO-EXPAND *before* the current macro +# expansion. Once expanded, emit it in _m4_divert_dump. Keep track +# of the m4_require chain in m4_expansion_stack. +# +# The normal cases are: +# +# - NAME-TO-CHECK == BODY-TO-EXPAND +# Which you can use for regular macros with or without arguments, e.g., +# m4_require([AC_PROG_CC], [AC_PROG_CC]) +# m4_require([AC_CHECK_HEADERS(limits.h)], [AC_CHECK_HEADERS(limits.h)]) +# which is just the same as +# m4_require([AC_PROG_CC]) +# m4_require([AC_CHECK_HEADERS(limits.h)]) +# +# - BODY-TO-EXPAND == m4_indir([NAME-TO-CHECK]) +# In the case of macros with irregular names. For instance: +# m4_require([AC_LANG_COMPILER(C)], [indir([AC_LANG_COMPILER(C)])]) +# which means `if the macro named `AC_LANG_COMPILER(C)' (the parens are +# part of the name, it is not an argument) has not been run, then +# call it.' +# Had you used +# m4_require([AC_LANG_COMPILER(C)], [AC_LANG_COMPILER(C)]) +# then m4_require would have tried to expand `AC_LANG_COMPILER(C)', i.e., +# call the macro `AC_LANG_COMPILER' with `C' as argument. +# +# You could argue that `AC_LANG_COMPILER', when it receives an argument +# such as `C' should dispatch the call to `AC_LANG_COMPILER(C)'. But this +# `extension' prevents `AC_LANG_COMPILER' from having actual arguments that +# it passes to `AC_LANG_COMPILER(C)'. +m4_define([m4_require], +[m4_expansion_stack_push(m4_location[: $1 is required by...])dnl +m4_ifdef([_m4_expanding($1)], + [m4_fatal([$0: circular dependency of $1])])dnl +m4_ifndef([_m4_divert_dump], + [m4_fatal([$0: cannot be used outside of an m4_defun'd macro])])dnl +m4_provide_ifelse([$1], + [], + [m4_divert_push(m4_eval(m4_divnum - 1))dnl +m4_default([$2], [$1]) +m4_divert(m4_defn([_m4_divert_dump]))dnl +m4_undivert(m4_defn([_m4_divert_diversion]))dnl +m4_divert_pop(m4_defn([_m4_divert_dump]))])dnl +m4_provide_ifelse([$1], + [], + [m4_warn([syntax], + [$1 is m4_require'd but is not m4_defun'd])])dnl +m4_expansion_stack_pop()dnl +]) + + +# m4_expand_once(TEXT, [WITNESS = TEXT]) +# -------------------------------------- +# If TEXT has never been expanded, expand it *here*. Use WITNESS as +# as a memory that TEXT has already been expanded. +m4_define([m4_expand_once], +[m4_provide_ifelse(m4_ifval([$2], [[$2]], [[$1]]), + [], + [m4_provide(m4_ifval([$2], [[$2]], [[$1]]))[]$1])]) + + +# m4_provide(MACRO-NAME) +# ---------------------- +m4_define([m4_provide], +[m4_define([m4_provide($1)])]) + + +# m4_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. +m4_define([m4_provide_ifelse], +[m4_ifdef([m4_provide($1)], + [$2], [$3])]) + + +## -------------------- ## +## 9. Text processing. ## +## -------------------- ## + +# m4_cr_letters +# m4_cr_LETTERS +# m4_cr_Letters +# ------------- +m4_define([m4_cr_letters], [abcdefghijklmnopqrstuvwxyz]) +m4_define([m4_cr_LETTERS], [ABCDEFGHIJKLMNOPQRSTUVWXYZ]) +m4_define([m4_cr_Letters], +m4_defn([m4_cr_letters])dnl +m4_defn([m4_cr_LETTERS])dnl +) + +# m4_cr_digits +# ------------ +m4_define([m4_cr_digits], [0123456789]) + + +# m4_cr_symbols1 & m4_cr_symbols2 +# ------------------------------- +m4_define([m4_cr_symbols1], +m4_defn([m4_cr_Letters])dnl +_) + +m4_define([m4_cr_symbols2], +m4_defn([m4_cr_symbols1])dnl +m4_defn([m4_cr_digits])dnl +) + + +# m4_re_string +# ------------ +# Regexp for `[a-zA-Z_0-9]*' +m4_define([m4_re_string], +m4_dquote(m4_defn([m4_cr_symbols2]))dnl +[*]dnl +) + + +# m4_re_word +# ---------- +# Regexp for `[a-zA-Z_][a-zA-Z_0-9]*' +m4_define([m4_re_word], +m4_dquote(m4_defn([m4_cr_symbols1]))dnl +m4_defn([m4_re_string])dnl +) + +# m4_tolower(STRING) +# m4_toupper(STRING) +# ------------------ +# These macros lowercase and uppercase strings. +m4_define([m4_tolower], +[m4_translit([$1], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ], + [abcdefghijklmnopqrstuvwxyz])]) + +m4_define([m4_toupper], +[m4_translit([$1], + [abcdefghijklmnopqrstuvwxyz], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ])]) + + +# m4_split(STRING, [REGEXP]) +# -------------------------- +# +# Split STRING into an m4 list of quoted elements. The elements are +# quoted with [ and ]. Beginning spaces and end spaces *are kept*. +# Use m4_strip to remove them. +# +# REGEXP specifies where to split. Default is [\t ]+. +# +# Pay attention to the m4_changequotes. Inner m4_changequotes exist for +# obvious reasons (we want to insert square brackets). Outer +# m4_changequotes are needed because otherwise the m4 parser, when it +# sees the closing bracket we add to the result, believes it is the +# end of the body of the macro we define. +# +# Also, notice that $1 is quoted twice, since we want the result to +# be quoted. Then you should understand that the argument of +# patsubst is ``STRING'' (i.e., with additional `` and ''). +# +# This macro is safe on active symbols, i.e.: +# m4_define(active, ACTIVE) +# m4_split([active active ])end +# => [active], [active], []end + +m4_changequote(<<, >>) +m4_define(<<m4_split>>, +<<m4_changequote(``, '')dnl +[dnl Can't use m4_default here instead of m4_if, because m4_default uses +dnl [ and ] as quotes. +m4_patsubst(````$1'''', + m4_if(``$2'',, ``[ ]+'', ``$2''), + ``], ['')]dnl +m4_changequote([, ])>>) +m4_changequote([, ]) + + + +# m4_flatten(STRING) +# ------------------ +# If STRING contains end of lines, replace them with spaces. If there +# are backslashed end of lines, remove them. This macro is safe with +# active symbols. +# m4_define(active, ACTIVE) +# m4_flatten([active +# act\ +# ive])end +# => active activeend +m4_define([m4_flatten], +[m4_translit(m4_patsubst([[[$1]]], [\\ +]), [ +], [ ])]) + + +# m4_strip(STRING) +# ---------------- +# Expands into STRING with tabs and spaces singled out into a single +# space, and removing leading and trailing spaces. +# +# This macro is robust to active symbols. +# m4_define(active, ACTIVE) +# m4_strip([ active active ])end +# => active activeend +# +# This macro is fun! Because we want to preserve active symbols, STRING +# must be quoted for each evaluation, which explains there are 4 levels +# of brackets around $1 (don't forget that the result must be quoted +# too, hence one more quoting than applications). +# +# Then notice the patsubst of the middle: it is in charge of removing +# the leading space. Why not just `patsubst(..., [^ ])'? Because this +# macro will receive the output of the preceding patsubst, i.e. more or +# less [[STRING]]. So if there is a leading space in STRING, then it is +# the *third* character, since there are two leading `['; Equally for +# the outer patsubst. +m4_define([m4_strip], +[m4_patsubst(m4_patsubst(m4_patsubst([[[[$1]]]], + [[ ]+], [ ]), + [^\(..\) ], [\1]), + [ \(.\)$], [\1])]) + + +# m4_normalize(STRING) +# -------------------- +# Apply m4_flatten and m4_strip to STRING. +# +# The argument is quoted, so that the macro is robust to active symbols: +# +# m4_define(active, ACTIVE) +# m4_normalize([ act\ +# ive +# active ])end +# => active activeend + +m4_define([m4_normalize], +[m4_strip(m4_flatten([$1]))]) + + + +# m4_join(SEP, ARG1, ARG2...) +# --------------------------- +# Produce ARG1SEPARG2...SEPARGn. +m4_defun([m4_join], +[m4_case([$#], + [1], [], + [2], [[$2]], + [[$2][$1]m4_join([$1], m4_shift(m4_shift($@)))])]) + + + +# m4_append(MACRO-NAME, STRING) +# ----------------------------- +# Redefine MACRO-NAME to hold its former content plus STRING at the +# end. It is valid to use this macro with MACRO-NAME undefined. +# +# This macro is robust to active symbols. It can be used to grow +# strings. +# +# | m4_define(active, ACTIVE) +# | m4_append([sentence], [This is an]) +# | m4_append([sentence], [ active ]) +# | m4_append([sentence], [symbol.]) +# | sentence +# | m4_undefine([active])dnl +# | sentence +# => This is an ACTIVE symbol. +# => This is an active symbol. +# +# It can be used to define hooks. +# +# | m4_define(active, ACTIVE) +# | m4_append([hooks], [m4_define([act1], [act2])]) +# | m4_append([hooks], [m4_define([act2], [active])]) +# | m4_undefine([active]) +# | act1 +# | hooks +# | act1 +# => act1 +# => +# => active +m4_define([m4_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])])[$2])]) + + +# m4_list_append(MACRO-NAME, STRING) +# ---------------------------------- +# Same as `m4_append', but each element is separated by `, '. +m4_define([m4_list_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1]), ])[$2])]) + + +# m4_foreach_quoted(VARIABLE, LIST, EXPRESSION) +# --------------------------------------------- +# FIXME: This macro should not exists. Currently it's used only in +# m4_wrap, which needs to be rewritten. But it's godam hard. +m4_define([m4_foreach_quoted], +[m4_pushdef([$1], [])_m4_foreach_quoted($@)m4_popdef([$1])]) + +# Low level macros used to define m4_foreach. +m4_define([m4_car_quoted], [[$1]]) +m4_define([_m4_foreach_quoted], +[m4_if($2, [()], , + [m4_define([$1], [m4_car_quoted$2])$3[]_m4_foreach_quoted([$1], + [(m4_shift$2)], + [$3])])]) + + +# m4_text_wrap(STRING, [PREFIX], [FIRST-PREFIX], [WIDTH]) +# ------------------------------------------------------- +# Expands into STRING wrapped to hold in WIDTH columns (default = 79). +# If prefix is set, each line is prefixed with it. If FIRST-PREFIX is +# specified, then the first line is prefixed with it. As a special +# case, if the length of the first prefix is greater than that of +# PREFIX, then FIRST-PREFIX will be left alone on the first line. +# +# Typical outputs are: +# +# m4_text_wrap([Short string */], [ ], [/* ], 20) +# => /* Short string */ +# +# m4_text_wrap([Much longer string */], [ ], [/* ], 20) +# => /* Much longer +# => string */ +# +# m4_text_wrap([Short doc.], [ ], [ --short ], 30) +# => --short Short doc. +# +# m4_text_wrap([Short doc.], [ ], [ --too-wide ], 30) +# => --too-wide +# => Short doc. +# +# m4_text_wrap([Super long documentation.], [ ], [ --too-wide ], 30) +# => --too-wide +# => Super long +# => documentation. +# +# FIXME: there is no checking of a longer PREFIX than WIDTH, but do +# we really want to bother with people trying each single corner +# of a software? +# +# This macro does not leave a trailing space behind the last word, +# what complicates it a bit. The algorithm is stupid simple: all the +# words are preceded by m4_Separator which is defined to empty for the +# first word, and then ` ' (single space) for all the others. +m4_define([m4_text_wrap], +[m4_pushdef([m4_Prefix], m4_default([$2], []))dnl +m4_pushdef([m4_Prefix1], m4_default([$3], [m4_Prefix]))dnl +m4_pushdef([m4_Width], m4_default([$4], 79))dnl +m4_pushdef([m4_Cursor], m4_len(m4_Prefix1))dnl +m4_pushdef([m4_Separator], [])dnl +m4_Prefix1[]dnl +m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)), + 1, [m4_define([m4_Cursor], m4_len(m4_Prefix)) +m4_Prefix])[]dnl +m4_foreach_quoted([m4_Word], (m4_split(m4_normalize([$1]))), +[m4_define([m4_Cursor], m4_eval(m4_Cursor + len(m4_Word) + 1))dnl +dnl New line if too long, else insert a space unless it is the first +dnl of the words. +m4_if(m4_eval(m4_Cursor > m4_Width), + 1, [m4_define([m4_Cursor], + m4_eval(m4_len(m4_Prefix) + m4_len(m4_Word) + 1))] +m4_Prefix, + [m4_Separator])[]dnl +m4_Word[]dnl +m4_define([m4_Separator], [ ])])dnl +m4_popdef([m4_Separator])dnl +m4_popdef([m4_Cursor])dnl +m4_popdef([m4_Width])dnl +m4_popdef([m4_Prefix1])dnl +m4_popdef([m4_Prefix])dnl +]) + + + +## ----------------------- ## +## 10. Number processing. ## +## ----------------------- ## + +# m4_sign(A) +# ---------- +# +# The sign of the integer A. +m4_define([m4_sign], +[m4_match([$1], + [^-], -1, + [^0+], 0, + 1)]) + +# m4_cmp(A, B) +# ------------ +# +# Compare two integers. +# A < B -> -1 +# A = B -> 0 +# A > B -> 1 +m4_define([m4_cmp], +[m4_sign(m4_eval([$1 - $2]))]) + + +# m4_list_cmp(A, B) +# ----------------- +# +# Compare the two lists of integers A and B. For instance: +# m4_list_cmp((1, 0), (1)) -> 0 +# m4_list_cmp((1, 0), (1, 0)) -> 0 +# m4_list_cmp((1, 2), (1, 0)) -> 1 +# m4_list_cmp((1, 2, 3), (1, 2)) -> 1 +# m4_list_cmp((1, 2, -3), (1, 2)) -> -1 +# m4_list_cmp((1, 0), (1, 2)) -> -1 +# m4_list_cmp((1), (1, 2)) -> -1 +m4_define([m4_list_cmp], +[m4_if([$1$2], [()()], 0, + [$1], [()], [m4_list_cmp((0), [$2])], + [$2], [()], [m4_list_cmp([$1], (0))], + [m4_case(m4_cmp(m4_car$1, m4_car$2), + -1, -1, + 1, 1, + 0, [m4_list_cmp((m4_shift$1), (m4_shift$2))])])]) + + + +## ------------------------ ## +## 11. Version processing. ## +## ------------------------ ## + + +# m4_version_unletter(VERSION) +# ---------------------------- +# Normalize beta version numbers with letters to numbers only for comparison. +# +# Nl -> (N+1).-1.(l#) +# +#i.e., 2.14a -> 2.15.-1.1, 2.14b -> 2.15.-1.2, etc. +# This macro is absolutely not robust to active macro, it expects +# reasonable version numbers and is valid up to `z', no double letters. +m4_define([m4_version_unletter], +[m4_translit(m4_patsubst(m4_patsubst(m4_patsubst([$1], + [\([0-9]+\)\([abcdefghi]\)], + [m4_eval(\1 + 1).-1.\2]), + [\([0-9]+\)\([jklmnopqrs]\)], + [m4_eval(\1 + 1).-1.1\2]), + [\([0-9]+\)\([tuvwxyz]\)], + [m4_eval(\1 + 1).-1.2\2]), + [abcdefghijklmnopqrstuvwxyz], + [12345678901234567890123456])]) + + +# m4_version_compare(VERSION-1, VERSION-2) +# ---------------------------------------- +# Compare the two version numbers and expand into +# -1 if VERSION-1 < VERSION-2 +# 0 if = +# 1 if > +m4_define([m4_version_compare], +[m4_list_cmp((m4_split(m4_version_unletter([$1]), [\.])), + (m4_split(m4_version_unletter([$2]), [\.])))]) + + + +## ------------------- ## +## 12. File handling. ## +## ------------------- ## + + +# It is a real pity that M4 comes with no macros to bind a diversion +# to a file. So we have to deal without, which makes us a lot more +# fragile that we should. + + +# m4_file_append(FILE-NAME, CONTENT) +# ---------------------------------- +m4_define([m4_file_append], +[m4_syscmd([cat >>$1 <<_m4eof +$2 +_m4eof +]) +m4_if(m4_sysval, [0], [], + [m4_fatal([$0: cannot write: $1])])]) + + + +## ------------------------ ## +## 13. Setting M4sugar up. ## +## ------------------------ ## + + +# m4_init +# ------- +m4_define([m4_init], +[# We need a tmp directory. +m4_ifndef([m4_tmpdir], + [m4_define([m4_tmpdir], [/tmp])]) + +# M4sugar reserves `m4_[A-Za-z0-9_]*'. We'd need \b and +, +# but they are not portable. +m4_pattern_forbid([^m4_]) +m4_pattern_forbid([^dnl$]) + +# Check the divert push/pop perfect balance. +m4_wrap([m4_ifdef([_m4_divert_diversion], + [m4_fatal([$0: unbalanced m4_divert_push:] +m4_defn([m4_divert_stack]))])[]]) + +m4_divert_push([KILL]) +m4_wrap([m4_divert_pop([KILL])[]]) +]) diff --git a/man/Makefile.in b/man/Makefile.in new file mode 100644 index 0000000..d4f66e3 --- /dev/null +++ b/man/Makefile.in @@ -0,0 +1,263 @@ +# Copyright 2010-2012,2023 Thomas E. Dickey +# 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@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datarootdir = @datarootdir@ +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 = .. + +AUTOCONF = @AUTOCONF@ +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 = : +AWK = @AWK@ +EXPR = @EXPR@ +HELP2MAN = @HELP2MAN@ +M4 = @M4@ +PACKAGE = @PACKAGE@ +PACKAGE_NAME = @PACKAGE_NAME@ +PERL = @PERL@ +PERLSCRIPTS = @PERLSCRIPTS@ +VERSION = @VERSION@ + +man_MANS = autoconf.1 autoreconf.1 autoheader.1 autoupdate.1 ifnames.1 \ +autoscan.1 + + +man_aux = autoconf.x autoreconf.x autoheader.x autoupdate.x ifnames.x \ +autoscan.x + + +EXTRA_DIST = $(man_MANS) $(man_aux) common.x +MAINTAINERCLEANFILES = $(man_MANS) + +# Depend on configure.ac to get version number changes. +common_dep = $(top_srcdir)/configure.ac $(srcdir)/common.x + +SUFFIXES = .x .1 +subdir = man +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +NROFF = nroff +MANS = $(man_MANS) +DIST_COMMON = Makefile.am Makefile.in +all: all-am + +.SUFFIXES: +.SUFFIXES: .x .1 + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && \ + CONFIG_HEADERS= CONFIG_LINKS= \ + CONFIG_FILES=$(subdir)/$@ $(SHELL) ./config.status +uninstall-info-am: + +man1dir = $(mandir)/man1 +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + mkdir -p $(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 \ + mkdir -p "$(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 $(MANS) + +installdirs: + mkdir -p $(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." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-exec-am: + +install-info: install-info-am + +install-man: install-man1 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +uninstall-am: uninstall-info-am uninstall-man + +uninstall-man: uninstall-man1 + +.PHONY: all all-am check check-am clean clean-generic 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-generic \ + mostlyclean mostlyclean-generic uninstall uninstall-am \ + uninstall-info-am uninstall-man uninstall-man1 + +autoconf.1: $(common_dep) $(srcdir)/autoconf.x $(top_srcdir)/autoconf.in +autoreconf.1: $(common_dep) $(srcdir)/autoreconf.x $(top_srcdir)/autoreconf.in +autoheader.1: $(common_dep) $(srcdir)/autoheader.x $(top_srcdir)/autoheader.in +autoupdate.1: $(common_dep) $(srcdir)/autoupdate.x $(top_srcdir)/autoupdate.in +ifnames.1: $(common_dep) $(srcdir)/ifnames.x $(top_srcdir)/ifnames.in +autoscan.1: $(common_dep) $(srcdir)/autoscan.x $(top_srcdir)/autoscan.in + +.x.1: + test -f $(top_builddir)/$* && prog=$(top_builddir)/$*; \ + test -f $(top_srcdir)/$* && prog=$(top_srcdir)/$*; \ + test -f $(top_srcdir)/config/$* && prog=$(top_srcdir)/config/$*; \ + if test -n "$$prog"; then \ + echo "Updating man page $@"; \ + $(HELP2MAN) \ + --include=$(srcdir)/$*.x \ + --include=$(srcdir)/common.x \ + --output=$@ $$prog; \ + else \ + echo "WARNING: The man page $@ cannot be updated yet."; \ + echo " Retry once the corresponding executable is built."; \ + fi +# 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 --git a/man/autoconf.1 b/man/autoconf.1 new file mode 100644 index 0000000..b66ea62 --- /dev/null +++ b/man/autoconf.1 @@ -0,0 +1,109 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. +.TH AUTOCONF "1" "December 2023" "GNU Autoconf 2.52.20231210" "User Commands" +.SH NAME +autoconf \- Generate configuration scripts +.SH SYNOPSIS +.B autoconf +[\fI\,OPTION\/\fR] ... [\fI\,TEMPLATE-FILE\/\fR] +.SH DESCRIPTION +Generate a configuration script from a TEMPLATE\-FILE if given, or +`configure.ac' if present, or else `configure.in'. Output is sent +to the standard output if TEMPLATE\-FILE is given, else into +`configure'. +.SS "Operation modes:" +.TP +\fB\-h\fR, \fB\-\-help\fR +print this help, then exit +.TP +\fB\-V\fR, \fB\-\-version\fR +print version number, then exit +.TP +\fB\-v\fR, \fB\-\-verbose\fR +verbosely report processing +.TP +\fB\-d\fR, \fB\-\-debug\fR +don't remove temporary files +.TP +\fB\-o\fR, \fB\-\-output\fR=\fI\,FILE\/\fR +save output in FILE (stdout is the default) +.TP +\fB\-W\fR, \fB\-\-warnings\fR=\fI\,CATEGORY\/\fR +report the warnings falling in CATEGORY [syntax] +.SH OPTIONS +.TP +\fB\-opt\-functions\fR +use shell\-functions to reduce repetition +.SS "Warning categories include:" +.TP +`cross' +cross compilation issues +.TP +`obsolete' +obsolete constructs +.TP +`syntax' +dubious syntactic constructs +.TP +`all' +all the warnings +.TP +`no\-CATEGORY' +turn off the warnings on CATEGORY +.TP +`none' +turn off all the warnings +.TP +`error' +warnings are error +.PP +The environment variable `WARNINGS' is honored. +.SS "Library directories:" +.TP +\fB\-A\fR, \fB\-\-autoconf\-dir\fR=\fI\,ACDIR\/\fR +Autoconf's macro files location (rarely needed) +.TP +\fB\-l\fR, \fB\-\-localdir\fR=\fI\,DIR\/\fR +location of the `aclocal.m4' file +.SS "Tracing:" +.TP +\fB\-t\fR, \fB\-\-trace\fR=\fI\,MACRO\/\fR +report the list of calls to MACRO +.TP +\fB\-i\fR, \fB\-\-initialization\fR +also trace Autoconf's initialization process +.PP +In tracing mode, no configuration script is created. +.SH AUTHOR +Written by David J. MacKenzie. +.SH "REPORTING BUGS" +Report bugs to <dickey@invisible\-island.net>. +.SH COPYRIGHT +Copyright 2003\-2022,2023 Thomas E. Dickey +.br +Copyright 1992, 1993, 1994, 1996, 1999, 2000, 2001 +Free Software Foundation, Inc. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +.BR autoconf (1), +.BR autoreconf (1), +.BR autoupdate (1), +.BR autoheader (1), +.BR autoscan (1), +.BR config.guess (1), +.BR config.sub (1), +.BR ifnames (1), +.BR libtool (1). +.PP +The full documentation for +.B autoconf +is maintained as a Texinfo manual. If the +.B info +and +.B autoconf +programs are properly installed at your site, the command +.IP +.B info autoconf +.PP +should give you access to the complete manual. diff --git a/man/autoconf.x b/man/autoconf.x new file mode 100644 index 0000000..615d2e5 --- /dev/null +++ b/man/autoconf.x @@ -0,0 +1,3 @@ +[name] +autoconf \- Generate configuration scripts + diff --git a/man/autoheader.1 b/man/autoheader.1 new file mode 100644 index 0000000..07ddb0c --- /dev/null +++ b/man/autoheader.1 @@ -0,0 +1,83 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. +.TH AUTOHEADER "1" "December 2023" "GNU Autoconf 2.52.20231210" "User Commands" +.SH NAME +autoheader \- Create a template header for configure +.SH SYNOPSIS +.B autoheader +[\fI\,OPTION\/\fR] ... [\fI\,TEMPLATE-FILE\/\fR] +.SH DESCRIPTION +Create a template file of C `#define' statements for `configure' to +use. To this end, scan TEMPLATE\-FILE, or `configure.ac' if present, +or else `configure.in'. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this help, then exit +.TP +\fB\-V\fR, \fB\-\-version\fR +print version number, then exit +.TP +\fB\-v\fR, \fB\-\-verbose\fR +verbosely report processing +.TP +\fB\-d\fR, \fB\-\-debug\fR +don't remove temporary files +.TP +\fB\-W\fR, \fB\-\-warnings\fR=\fI\,CATEGORY\/\fR +report the warnings falling in CATEGORY +.SS "Warning categories include:" +.TP +`obsolete' +obsolete constructs +.TP +`all' +all the warnings +.TP +`no\-CATEGORY' +turn off the warnings on CATEGORY +.TP +`none' +turn off all the warnings +.TP +`error' +warnings are error +.SS "Library directories:" +.TP +\fB\-A\fR, \fB\-\-autoconf\-dir\fR=\fI\,ACDIR\/\fR +Autoconf's macro files location (rarely needed) +.TP +\fB\-l\fR, \fB\-\-localdir\fR=\fI\,DIR\/\fR +location of `aclocal.m4' and `acconfig.h' +.SH AUTHOR +Written by Roland McGrath. +.SH "REPORTING BUGS" +Report bugs to <dickey@invisible\-island.net>. +.SH COPYRIGHT +Copyright 2010\-2012,2021 Thomas E. Dickey +.br +Copyright 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +.BR autoconf (1), +.BR autoreconf (1), +.BR autoupdate (1), +.BR autoheader (1), +.BR autoscan (1), +.BR config.guess (1), +.BR config.sub (1), +.BR ifnames (1), +.BR libtool (1). +.PP +The full documentation for +.B autoheader +is maintained as a Texinfo manual. If the +.B info +and +.B autoheader +programs are properly installed at your site, the command +.IP +.B info autoheader +.PP +should give you access to the complete manual. diff --git a/man/autoheader.x b/man/autoheader.x new file mode 100644 index 0000000..a3e0eba --- /dev/null +++ b/man/autoheader.x @@ -0,0 +1,3 @@ +[name] +autoheader \- Create a template header for configure + diff --git a/man/autoreconf.1 b/man/autoreconf.1 new file mode 100644 index 0000000..a98c46f --- /dev/null +++ b/man/autoreconf.1 @@ -0,0 +1,87 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. +.TH AUTORECONF "1" "December 2023" "GNU Autoconf 2.52.20231210" "User Commands" +.SH NAME +autoreconf \- Update generated configuration files +.SH SYNOPSIS +.B autoreconf +[\fI\,OPTION\/\fR] ... [\fI\,TEMPLATE-FILE\/\fR] +.SH DESCRIPTION +Run `autoconf' and `autoheader' where appropriate) repeatedly to +remake the Autoconf `configure' scripts and configuration header +templates in the directory tree rooted at the current directory. +.PP +By default, it only remakes those files that are older than their +predecessors. If you install a new version of Autoconf, running +`autoreconf' remakes all of the files by giving it the `\-\-force' +option. +.SS "Operation modes:" +.TP +\fB\-h\fR, \fB\-\-help\fR +print this help, then exit +.TP +\fB\-V\fR, \fB\-\-version\fR +print version number, then exit +.TP +\fB\-v\fR, \fB\-\-verbose\fR +verbosely report processing +.TP +\fB\-d\fR, \fB\-\-debug\fR +don't remove temporary files +.TP +\fB\-f\fR, \fB\-\-force\fR +consider every files are obsolete +.TP +\fB\-i\fR, \fB\-\-install\fR +copy missing auxiliary files +.TP +\fB\-s\fR, \fB\-\-symlink\fR +instead of copying, install symbolic links +.PP +The option `\-\-install' is similar to the option `\-\-add\-missing' in +other tools. +.SS "Library directories:" +.TP +\fB\-A\fR, \fB\-\-autoconf\-dir\fR=\fI\,ACDIR\/\fR +Autoconf's macro files location (rarely needed) +.TP +\fB\-l\fR, \fB\-\-localdir\fR=\fI\,DIR\/\fR +location of `aclocal.m4' and `acconfig.h' +.TP +\fB\-M\fR, \fB\-\-m4dir\fR=\fI\,M4DIR\/\fR +this package's Autoconf extensions +.PP +Unless specified, heuristics try to compute `M4DIR' from the `Makefile.am', +or defaults to `m4' if it exists. +.PP +The environment variables AUTOCONF and AUTOHEADER are honored. +.SH AUTHOR +Written by David J. MacKenzie. +.SH "REPORTING BUGS" +Report bugs to <dickey@invisible\-island.net>. +.SH COPYRIGHT +Copyright 1994, 1999, 2000 Free Software Foundation, Inc. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +.BR autoconf (1), +.BR autoreconf (1), +.BR autoupdate (1), +.BR autoheader (1), +.BR autoscan (1), +.BR config.guess (1), +.BR config.sub (1), +.BR ifnames (1), +.BR libtool (1). +.PP +The full documentation for +.B autoreconf +is maintained as a Texinfo manual. If the +.B info +and +.B autoreconf +programs are properly installed at your site, the command +.IP +.B info autoreconf +.PP +should give you access to the complete manual. diff --git a/man/autoreconf.x b/man/autoreconf.x new file mode 100644 index 0000000..89d4261 --- /dev/null +++ b/man/autoreconf.x @@ -0,0 +1,2 @@ +[name] +autoreconf \- Update generated configuration files diff --git a/man/autoscan.1 b/man/autoscan.1 new file mode 100644 index 0000000..8252ae6 --- /dev/null +++ b/man/autoscan.1 @@ -0,0 +1,60 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. +.TH AUTOSCAN "1" "December 2023" "GNU Autoconf 2.52.20231210" "User Commands" +.SH NAME +autoscan \- Generate a preliminary configure.in +.SH SYNOPSIS +.B autoscan +[\fI\,OPTION\/\fR] ... [\fI\,SRCDIR\/\fR] +.SH DESCRIPTION +Examine source files in the directory tree rooted at SRCDIR, or the +current directory if none is given. Search the source files for +common portability problems, check for incompleteness of +`configure.ac', and create a file `configure.scan' which is a +preliminary `configure.ac' for that package. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this help, then exit +.TP +\fB\-V\fR, \fB\-\-version\fR +print version number, then exit +.TP +\fB\-v\fR, \fB\-\-verbose\fR +verbosely report processing +.SS "Library directories:" +.TP +\fB\-A\fR, \fB\-\-autoconf\-dir\fR=\fI\,ACDIR\/\fR +Autoconf's files location (rarely needed) +.TP +\fB\-l\fR, \fB\-\-localdir\fR=\fI\,DIR\/\fR +location of `aclocal.m4' and `acconfig.h' +.SH AUTHOR +Written by David J. MacKenzie. +.SH "REPORTING BUGS" +Report bugs to <dickey@invisible\-island.net>. +.SH COPYRIGHT +Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +.BR autoconf (1), +.BR autoreconf (1), +.BR autoupdate (1), +.BR autoheader (1), +.BR autoscan (1), +.BR config.guess (1), +.BR config.sub (1), +.BR ifnames (1), +.BR libtool (1). +.PP +The full documentation for +.B autoscan +is maintained as a Texinfo manual. If the +.B info +and +.B autoscan +programs are properly installed at your site, the command +.IP +.B info autoscan +.PP +should give you access to the complete manual. diff --git a/man/autoscan.x b/man/autoscan.x new file mode 100644 index 0000000..ce120eb --- /dev/null +++ b/man/autoscan.x @@ -0,0 +1,3 @@ +[name] +autoscan \- Generate a preliminary configure.in + diff --git a/man/autoupdate.1 b/man/autoupdate.1 new file mode 100644 index 0000000..0d1f5dd --- /dev/null +++ b/man/autoupdate.1 @@ -0,0 +1,69 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. +.TH AUTOUPDATE "1" "December 2023" "GNU Autoconf 2.52.20231210" "User Commands" +.SH NAME +autoupdate \- Update a configure.in to a newer Autoconf +.SH SYNOPSIS +.B autoupdate +[\fI\,OPTION\/\fR] ... [\fI\,TEMPLATE-FILE\/\fR...] +.SH DESCRIPTION +Update the TEMPLATE\-FILE... if given, or `configure.ac' if present, +or else `configure.in', to the syntax of the current version of +Autoconf. The original files are backed up. +.SS "Operation modes:" +.TP +\fB\-h\fR, \fB\-\-help\fR +print this help, then exit +.TP +\fB\-V\fR, \fB\-\-version\fR +print version number, then exit +.TP +\fB\-v\fR, \fB\-\-verbose\fR +verbosely report processing +.TP +\fB\-d\fR, \fB\-\-debug\fR +don't remove temporary files +.SS "Library directories:" +.TP +\fB\-A\fR, \fB\-\-autoconf\-dir\fR=\fI\,ACDIR\/\fR +Autoconf's macro files location (rarely needed) +.TP +\fB\-l\fR, \fB\-\-localdir\fR=\fI\,DIR\/\fR +location of `aclocal.m4' +.SS "Environment variables:" +.TP +M4 +GNU M4 1.4 or above +.TP +AUTOCONF +autoconf 2.52.20231210 +.SH AUTHOR +Written by David J. MacKenzie and Akim Demaille. +.SH "REPORTING BUGS" +Report bugs to <dickey@invisible\-island.net>. +.SH COPYRIGHT +Copyright 1994, 1999, 2000, 2001 Free Software Foundation, Inc. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +.BR autoconf (1), +.BR autoreconf (1), +.BR autoupdate (1), +.BR autoheader (1), +.BR autoscan (1), +.BR config.guess (1), +.BR config.sub (1), +.BR ifnames (1), +.BR libtool (1). +.PP +The full documentation for +.B autoupdate +is maintained as a Texinfo manual. If the +.B info +and +.B autoupdate +programs are properly installed at your site, the command +.IP +.B info autoupdate +.PP +should give you access to the complete manual. diff --git a/man/autoupdate.x b/man/autoupdate.x new file mode 100644 index 0000000..23aa18c --- /dev/null +++ b/man/autoupdate.x @@ -0,0 +1,3 @@ +[name] +autoupdate \- Update a configure.in to a newer Autoconf + diff --git a/man/common.x b/man/common.x new file mode 100644 index 0000000..2275c16 --- /dev/null +++ b/man/common.x @@ -0,0 +1,10 @@ +[see also] +.BR autoconf (1), +.BR autoreconf (1), +.BR autoupdate (1), +.BR autoheader (1), +.BR autoscan (1), +.BR config.guess (1), +.BR config.sub (1), +.BR ifnames (1), +.BR libtool (1). diff --git a/man/ifnames.1 b/man/ifnames.1 new file mode 100644 index 0000000..1fd3961 --- /dev/null +++ b/man/ifnames.1 @@ -0,0 +1,50 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.48.1. +.TH IFNAMES "1" "December 2023" "GNU Autoconf 2.52.20231210" "User Commands" +.SH NAME +ifnames \- Extract CPP conditionals from a set of files +.SH SYNOPSIS +.B ifnames +[\fI\,OPTION\/\fR] ... [\fI\,FILE\/\fR] ... +.SH DESCRIPTION +Scan all of the C source FILES (or the standard input, if none are +given) and write to the standard output a sorted list of all the +identifiers that appear in those files in `#if', `#elif', `#ifdef', or +`#ifndef' directives. Print each identifier on a line, followed by a +space\-separated list of the files in which that identifier occurs. +.TP +\fB\-h\fR, \fB\-\-help\fR +print this help, then exit +.TP +\fB\-V\fR, \fB\-\-version\fR +print version number, then exit +.SH AUTHOR +Written by David J. MacKenzie and Paul Eggert. +.SH "REPORTING BUGS" +Report bugs to <dickey@invisible\-island.net>. +.SH COPYRIGHT +Copyright 1994, 1995, 1999, 2000 Free Software Foundation, Inc. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.SH "SEE ALSO" +.BR autoconf (1), +.BR autoreconf (1), +.BR autoupdate (1), +.BR autoheader (1), +.BR autoscan (1), +.BR config.guess (1), +.BR config.sub (1), +.BR ifnames (1), +.BR libtool (1). +.PP +The full documentation for +.B ifnames +is maintained as a Texinfo manual. If the +.B info +and +.B ifnames +programs are properly installed at your site, the command +.IP +.B info ifnames +.PP +should give you access to the complete manual. diff --git a/man/ifnames.x b/man/ifnames.x new file mode 100644 index 0000000..214ccce --- /dev/null +++ b/man/ifnames.x @@ -0,0 +1,3 @@ +[name] +ifnames \- Extract CPP conditionals from a set of files + diff --git a/package/ac252.spec b/package/ac252.spec new file mode 100644 index 0000000..37e5acf --- /dev/null +++ b/package/ac252.spec @@ -0,0 +1,89 @@ +Summary: autoconf-252 - Generate configuration scripts +%define AppProgram autoconf +%define AppVersion 2.52 +%define AppRelease 20231210 +%define AppSuffix -252 +# $Id: ac252.spec,v 1.48 2023/12/09 11:52:45 tom Exp $ +Name: ac252 +Version: %{AppVersion} +Release: %{AppRelease} +License: GPLv2 +Group: Applications/Development +URL: http://invisible-island.net/%{AppProgram} +Source0: http://invisible-island.net/archives/%{AppProgram}/%{AppProgram}-%{AppVersion}-%{AppRelease}.tgz + +BuildArch: noarch +#BuildRequires: m4 +Requires: m4 + +%description +This is a stable version of autoconf, used by all of my applications. +See http://invisible-island.net/autoconf/ + +%define MyName %{AppProgram}%{AppSuffix} + +%define find_tool tool=install-info; for dir in /sbin /usr/sbin; do if test -f $dir/$tool; then tool=$dir/$tool;break;fi;done + +%prep + +%setup -q -n %{AppProgram}-%{AppVersion}-%{AppRelease} + +%build + +INSTALL_PROGRAM='${INSTALL}' \ + ./configure \ + --program-suffix=%{AppSuffix} \ + --target %{_target_platform} \ + --prefix=%{_prefix} \ + --bindir=%{_bindir} \ + --libdir=%{_libdir} \ + --mandir=%{_mandir} \ + --datadir=%{_datadir}/%{MyName} \ + --infodir=%{_infodir} + +make + +%install +[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT + +make install DESTDIR=$RPM_BUILD_ROOT +rm -f $RPM_BUILD_ROOT%{_infodir}/dir +rm -f $RPM_BUILD_ROOT%{_infodir}/standards* + +%post +%{find_tool} +$tool \ + %{_infodir}/%{MyName}.info \ + %{_infodir}/dir || : + +%preun +if [ $1 = 0 ] ; then + %{find_tool} + $tool \ + --delete \ + %{_infodir}/%{MyName}.info \ + %{_infodir}/dir || : +fi + +%files +%defattr(-,root,root) +%{_bindir}/*%{AppSuffix} +%{_mandir}/man1/*%{AppSuffix}* +%{_datadir}/%{MyName}* +%{_infodir}/*%{AppSuffix}* + +%changelog +# each patch should add its ChangeLog entries here + +* Sun Sep 03 2023 Thomas E. Dickey +- update http-url, rpmlint'd + +* Sun Aug 19 2018 Thomas E. Dickey +- update ftp-url + +* Fri Oct 01 2010 Thomas E. Dickey +- adapt rules for installing info file from + http://fedoraproject.org/wiki/Packaging/ScriptletSnippets + +* Tue Sep 28 2010 Thomas E. Dickey +- initial version diff --git a/package/debian/changelog b/package/debian/changelog new file mode 100644 index 0000000..e045ac8 --- /dev/null +++ b/package/debian/changelog @@ -0,0 +1,162 @@ +ac252 (20231210) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 09 Dec 2023 06:52:45 -0500 + +ac252 (20231203) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Fri, 01 Dec 2023 19:55:55 -0500 + +ac252 (20230903) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 19 Aug 2023 12:08:43 -0400 + +ac252 (20230114) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 14 Jan 2023 14:57:24 -0500 + +ac252 (20221202) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Fri, 02 Dec 2022 19:00:33 -0500 + +ac252 (20221009) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 09 Oct 2022 15:15:35 -0400 + +ac252 (20221001) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 01 Oct 2022 10:35:08 -0400 + +ac252 (20210509) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 09 May 2021 13:53:30 -0400 + +ac252 (20210105) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Tue, 05 Jan 2021 18:42:28 -0500 + +ac252 (20210101) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Tue, 29 Dec 2020 13:11:02 -0500 + +ac252 (20201228) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 27 Dec 2020 09:26:56 -0500 + +ac252 (20200802) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 02 Aug 2020 13:29:38 -0400 + +ac252 (20200111) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 11 Jan 2020 10:08:04 -0500 + +ac252 (20190901) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 01 Sep 2019 13:24:56 -0400 + +ac252 (20190828) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 28 Aug 2019 17:02:12 -0400 + +ac252 (20181006) unstable; urgency=low + + * maintenance updates + + -- Thomas E. Dickey <dickey@invisible-island.net> Fri, 05 Oct 2018 04:27:30 -0400 + +ac252 (20180819) unstable; urgency=low + + * recognize "--runstatedir" + + -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 19 Aug 2018 11:43:59 -0400 + +ac252 (20170501) unstable; urgency=low + + * fix "make check" for OSX, also use 'int main(void)', per c89. + + -- Thomas E. Dickey <dickey@invisible-island.net> Sun, 30 Apr 2017 10:48:44 -0400 + +ac252 (20150926) unstable; urgency=low + + * workaround multiline substitutions vs splitting of script in config.status + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 26 Sep 2015 17:17:41 -0400 + +ac252 (20141204) unstable; urgency=low + + * workaround for a broken port of "dash" + + -- Thomas E. Dickey <dickey@invisible-island.net> Wed, 03 Dec 2014 20:40:36 -0500 + +ac252 (20121002) unstable; urgency=low + + * workaround for GCC_PRINTFLIKE in autoheader + + -- Thomas E. Dickey <dickey@invisible-island.net> Tue, 02 Oct 2012 05:45:57 -0400 + +ac252 (20120929) unstable; urgency=low + + * fix regression + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 29 Sep 2012 14:41:32 -0400 + +ac252 (20120923) unstable; urgency=low + + * improve --datarootdir support + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 22 Sep 2012 11:01:26 -0400 + +ac252 (20120811) unstable; urgency=low + + * add --datarootdir support + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 11 Aug 2012 16:48:21 -0400 + +ac252 (20120310) unstable; urgency=low + + * repackaging for consistent versions + + -- Thomas E. Dickey <dickey@invisible-island.net> Sat, 10 Mar 2012 20:27:13 -0500 + +ac252 (20120303) unstable; urgency=low + + * Modify AC_LANG_FUNC_LINK_TRY to work around breakage in Intel compiler's + use of linker. + + -- Thomas E. Dickey <dickey@invisible-island.net> Tue, 28 Sep 2010 20:11:31 -0400 + +ac252 (20101002) unstable; urgency=low + + * Add package scripts to upstream source, for test-builds. + + -- Thomas E. Dickey <dickey@invisible-island.net> Tue, 28 Sep 2010 20:11:31 -0400 diff --git a/package/debian/compat b/package/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/package/debian/compat @@ -0,0 +1 @@ +10 diff --git a/package/debian/control b/package/debian/control new file mode 100644 index 0000000..3c5c2be --- /dev/null +++ b/package/debian/control @@ -0,0 +1,17 @@ +Source: ac252 +Maintainer: Thomas E. Dickey <dickey@invisible-island.net> +Section: devel +Priority: optional +Standards-Version: 3.8.4 +Build-Depends-Indep: texinfo (>= 4.6), m4 (>= 1.4), help2man +Build-Depends: debhelper (>= 5) +Homepage: http://invisible-island.net/autoconf/ + +Package: ac252 +Architecture: any +Depends: m4 (>= 1.4.6), ${misc:Depends} +Description: autoconf 2.52 (stable) + This is the supported version of autoconf used for programs developed and + maintained by Thomas E. Dickey + . + See http://invisible-island.net/autoconf/ diff --git a/package/debian/copyright b/package/debian/copyright new file mode 100644 index 0000000..1fc6bc2 --- /dev/null +++ b/package/debian/copyright @@ -0,0 +1,69 @@ +Upstream source http://invisible-island.net/autoconf/autoconf.html + +------------------------------------------------------------------------------- +Copyright 2003-2022,2023 Thomas E. Dickey +Copyright 2001 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 +the Free Software Foundation; either version 2, or (at your option) +any later version. +------------------------------------------------------------------------------- + +Files: install-sh +Copyright: 1994 X Consortium +Licence: other-BSD + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to + deal in the Software without restriction, including without limitation the + rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- + TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of the X Consortium shall not + be used in advertising or otherwise to promote the sale, use or other deal- + ings in this Software without prior written authorization from the X Consor- + tium. + + FSF changes to this file are in the public domain. + + Calling this script install-sh is preferred over install.sh, to prevent + `make' implicit rules from creating a file called install from it + when there is no Makefile. + + This script is compatible with the BSD install script, but was written + from scratch. It can only install one file at a time, a restriction + shared with many OS's install programs. + +Files: debian/* +Copyright: 2010-2022,2023 Thomas E. Dickey +Licence: other-BSD + Permission to use, copy, modify, and distribute this software and its + documentation for any purpose and without fee is hereby granted, + provided that the above copyright notice appear in all copies and that + both that copyright notice and this permission notice appear in + supporting documentation, and that the name of the above listed + copyright holder(s) not be used in advertising or publicity pertaining + to distribution of the software without specific, written prior + permission. + + THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD + TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE + LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +On Debian systems, the complete text of the GNU General +Public License can be found in '/usr/share/common-licenses/GPL-2' diff --git a/package/debian/docs b/package/debian/docs new file mode 100644 index 0000000..e4cf55f --- /dev/null +++ b/package/debian/docs @@ -0,0 +1,2 @@ +README +THANKS diff --git a/package/debian/rules b/package/debian/rules new file mode 100755 index 0000000..59298b2 --- /dev/null +++ b/package/debian/rules @@ -0,0 +1,100 @@ +#!/usr/bin/make -f +# MAde with the aid of dh_make, by Craig Small +# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess. +# Some lines taken from debmake, by Cristoph Lameter. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) + +PACKAGE = ac252 +DSTDIR := $(CURDIR)/debian/$(PACKAGE) + +CFLAGS = + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif +ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL_PROGRAM += -s +endif + +CPPFLAGS := $(shell dpkg-buildflags --get CPPFLAGS) +CFLAGS := $(shell dpkg-buildflags --get CFLAGS) +LDFLAGS := $(shell dpkg-buildflags --get LDFLAGS) + +configure: configure-stamp +configure-stamp: + dh_testdir + + CPPFLAGS="$(CPPFLAGS)" \ + CFLAGS="$(CFLAGS)" \ + LDFLAGS="$(LDFLAGS)" \ + ./configure \ + --program-suffix=-252 \ + --host=$(DEB_HOST_GNU_TYPE) \ + --build=$(DEB_BUILD_GNU_TYPE) \ + --prefix=/usr \ + --mandir=\$${prefix}/share/man \ + --infodir=\$${prefix}/share/info \ + --datadir=\$${prefix}/share/$(PACKAGE) + + touch configure-stamp + +build: build-stamp +build-stamp: configure-stamp + dh_testdir + + $(MAKE) + + touch build-stamp + +clean: + dh_testdir + dh_testroot + + [ ! -f Makefile ] || $(MAKE) distclean + rm -f build-stamp install-stamp + + dh_clean + +install: install-stamp +install-stamp: build-stamp + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) install DESTDIR=$(DSTDIR) + rm -f $(DSTDIR)/usr/share/info/dir* + rm -f $(DSTDIR)/usr/share/info/standard* + + touch install-stamp + +# Build architecture-independent files here. +binary-indep: build install +# No binary-indep target. + +# Build architecture-dependent files here. +binary-arch: build install + dh_testdir + dh_testroot + dh_installdocs + dh_installchangelogs ChangeLog + dh_strip + dh_compress + dh_fixperms + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install install-stamp diff --git a/package/debian/source/format b/package/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/package/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/package/debian/watch b/package/debian/watch new file mode 100644 index 0000000..958d8e1 --- /dev/null +++ b/package/debian/watch @@ -0,0 +1,4 @@ +version=3 + +opts=passive http://invisible-island.net/archives/autoconf/autoconf-2.52-(\d+)\.tgz \ + debian uupdate diff --git a/tests/Makefile.in b/tests/Makefile.in new file mode 100644 index 0000000..c417f20 --- /dev/null +++ b/tests/Makefile.in @@ -0,0 +1,257 @@ +# Copyright 2010-2021,2023 Thomas E. Dickey +# Copyright (C) 1994, 1995-8, 1999 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. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +datarootdir = @datarootdir@ +datadir = @datadir@ + +DESTDIR = + +top_builddir = .. + +transform = @program_transform_name@ + +EXPR = @EXPR@ +M4 = @M4@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SUITE = suite.at \ + m4sugar.at \ + m4sh.at \ + base.at \ + tools.at \ + torture.at \ + compile.at \ + semantics.at \ + acgeneral.at \ + acspecific.at \ + acfunctions.at \ + aclang.at \ + acheaders.at \ + actypes.at + +EGREP = @EGREP@ +FGREP = @FGREP@ + +# We don't actually distribute the testsuite, since one only +# needs m4 to build it, m4 being required anyway to install Autoconf. +EXTRA_DIST = README atgeneral.m4 atspecific.m4 aclocal.m4 $(SUITE) mktests.sh + +# The files which contains macro we check for syntax. Don't use $(top_srcdir) +# here since below we explicitly `cd' to $srcdir. As for the dependencies, +# thanks God for VPATH. Hm... +MACRO_FILES = \ + ../acgeneral.m4 \ + ../acspecific.m4 \ + ../acfunctions.m4 \ + ../aclang.m4 \ + ../acheaders.m4 \ + ../actypes.m4 + +CLEANFILES = \ + debug-*.sh \ + macro \ + configure \ + configure.in \ + configure.ac \ + config.status \ + config.cache \ + config.log \ + config.h.in \ + config.h \ + config.hin \ + state-* \ + at-* \ + stderr \ + stdout \ + empty \ + config.guess \ + config.sub \ + expr \ + libtool \ + ltconfig \ + ltmain.sh \ + install-sh + +DISTCLEANFILES = atconfig testsuite +CONFIG_CLEAN_FILES = \ + atconfig \ + mktests.sh \ + acgeneral.at \ + acspecific.at \ + acfunctions.at \ + aclang.at \ + acheaders.at \ + actypes.at + +DIST_COMMON = README Makefile.am Makefile.in atconfig.in + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +all: all-redirect +.SUFFIXES: + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +atconfig: $(top_builddir)/config.status atconfig.in + cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = tests + +distdir: $(DISTFILES) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-local +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: +uninstall: uninstall-am +all-am: Makefile +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + + +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-generic clean-am + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: tags distdir info-am info dvi-am dvi check-local check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +check-local: atconfig testsuite + @echo "making $@" + @FGREP="$(FGREP)" EGREP="$(EGREP)" $(SHELL) testsuite + +testsuite: $(top_srcdir)/m4sugar.m4 $(top_srcdir)/m4sh.m4 \ + atgeneral.m4 atspecific.m4 \ + $(SUITE) + $(M4) -I $(srcdir) -I $(top_srcdir) atspecific.m4 suite.at | \ + sed -e 's/[ ]*$$//' | \ + sed -e '/^$$/N;/\n$$/D' >$@.tmp + chmod +x $@.tmp + mv $@.tmp $@ + +acgeneral.at: mktests.sh $(MACRO_FILES) + cd $(srcdir) && $(SHELL) ./mktests.sh $(MACRO_FILES) + +acspecific.at: mktests.sh $(MACRO_FILES) + cd $(srcdir) && $(SHELL) ./mktests.sh $(MACRO_FILES) + +acfunctions.at: mktests.sh $(MACRO_FILES) + cd $(srcdir) && $(SHELL) ./mktests.sh $(MACRO_FILES) + +aclang.at: mktests.sh $(MACRO_FILES) + cd $(srcdir) && $(SHELL) ./mktests.sh $(MACRO_FILES) + +acheaders.at: mktests.sh $(MACRO_FILES) + cd $(srcdir) && $(SHELL) ./mktests.sh $(MACRO_FILES) + +actypes.at: mktests.sh $(MACRO_FILES) + cd $(srcdir) && $(SHELL) ./mktests.sh $(MACRO_FILES) + +maintainer-check: maintainer-check-posix maintainer-check-c++ + +# The hairy heredoc is more robust than using echo. +expr: + echo '#! $(SHELL)' >expr + echo 'result=`@EXPR@ "$$@"`' >>expr + echo 'estatus=$$?' >>expr + echo 'cat <<EOF' >>expr + echo '$${result:-0}' >>expr + echo 'EOF' >>expr + echo 'exit $$estatus' >>expr + chmod +x expr + +# Try the test suite with more severe environments. +maintainer-check-posix: expr + POSIXLY_CORRECTLY=yes make check + rm expr + +# Try using G++ as a C compiler. +maintainer-check-c++: + CC=g++ make check + +# 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 --git a/tests/README b/tests/README new file mode 100644 index 0000000..f0661c2 --- /dev/null +++ b/tests/README @@ -0,0 +1,57 @@ + -*- outline -*- + +This directory holds the M4sugar, M4sh and Autoconf test suites. + + +Here are a few rules on how to write tests. + +* Order of the tests + +It is extremely important to pay attention to the order of the tests. +There are basically two philosophies: (i) test earlier the most +critical features (hence hurried users will at least check those), or +(ii) test earlier the primitives. + +For having tried both, I definitely recommend (ii). In practice users +will run the whole test suite even if it's long. And if they don't, +there will be enough other users who will do the job. + +But also in practice some problems in the core of project can be +responsible for an incredible number of failures. Then the problems +at the origin will be hidden by the consequences. If dependencies are +properly ordered in the test suite (test features which depend upon +other features *after* having checked the latter), basically you'll +just have to pay attention to the first failures. BTW, it also makes +`./testsuite -e' much more useful. + + +* Write tests! + +Don't let you be bitten three times by the same dog! When you spent a +significant amount of time tracking the failure of feature in some +more primitive problem, immediately write a test for the latter. + +If you track down several bugs down to the same origin, write a test +especially for it. + +Of course in both cases, more primitive tests will be run beforehand. +Write your test and have it failed before your fixing, and succeeding +after. This usually means having at hand two copies of the source +tree, one running the test suite to have it fail, and the other to +have the same testsuite succeed. + + +* Autoconf + +** Use of `exit' +Don't directly `exit 1' or `exit 77', rather use `AC_MSG_ERROR'. +First of all because when we have to read the test suite logs we are +happy to know why `configure' exited thanks to the error +message. Secondly, because `configure' traps the `exit' and pretty +many shells fail to set $? to 77 when trapping `exit 77'. This +results in the test suite not being able to check the exit status. + +** AC_MSG_ERROR +Of course, since macro names are forbidden in `configure', if you +really want to mention the macro name, you'll have to do without +including `A?_' in the output. diff --git a/tests/aclocal.m4 b/tests/aclocal.m4 new file mode 100644 index 0000000..db41e8f --- /dev/null +++ b/tests/aclocal.m4 @@ -0,0 +1,61 @@ +# actest.m4 -*- autoconf -*- +# Additional Autoconf macros to ease testing. + +# AC_STATE_SAVE(FILE) +# ------------------ +# Save the environment, except for those variables we are allowed to touch. +# This is to check no test touches the user name space. +# FIXME: There are surely better ways. Explore for instance if +# we can ask help from AC_SUBST. We have the right to touch what +# is AC_SUBST'ed. +# - ^ac_ +# Autoconf's shell name space. +# - prefix and exec_prefix +# are kept undefined (NONE) until AC_OUTPUT which then sets them to +# `/usr/local' and `${prefix}' for make. +# - CONFIG_STATUS and DEFS +# Set by AC_OUTPUT. +# - F77_DUMMY_MAIN +# Set by AC_F77_DUMMY_MAIN. +# - ALLOCA|NEED_SETGID|KMEM_GROUP +# AC_FUNCs from acspecific. +# - AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|RANLIB|SET_MAKE|YACC +# AC_PROGs from acspecific +# - _|@|.[*#?].|LINENO|OLDPWD|PIPESTATUS|RANDOM|SECONDS +# Some variables some shells use and change. +# `.[*#?].' catches `$#' etc. which are displayed like this: +# | '!'=18186 +# | '#'=0 +# | '$'=6908 +# - POW_LIB +# From acfunctions.m4. +# +# Some `egrep' choke on such a big regex (e.g., SunOS 4.1.3). In this +# case just don't pay attention to the env. It would be great +# to keep the error message but we can't: that would break AT_CHECK. +m4_defun([AC_STATE_SAVE], +[(set) 2>&1 | + $EGREP -v -e 'm4_join([|], + [^a[cs]_], + [^((exec_)?prefix|DEFS|CONFIG_STATUS)=], + [^(CC|CFLAGS|CPP|GCC|CXX|CXXFLAGS|CXXCPP|GXX|F77|FFLAGS|FLIBS|G77)=], + [^(LIBS|LIBOBJS|LDFLAGS)=], + [^INSTALL(_(DATA|PROGRAM|SCRIPT))?=], + [^(CYGWIN|ISC|MINGW32|MINIX|EMXOS2|XENIX|EXEEXT|OBJEXT)=], + [^(X_(CFLAGS|(EXTRA_|PRE_)?LIBS)|x_(includes|libraries)|(have|no)_x)=], + [^(host|build|target)(_(alias|cpu|vendor|os))?=], + [^(cross_compiling)=], + [^(interpval|PATH_SEPARATOR)=], + [^(F77_DUMMY_MAIN|f77_(case|underscore))=], + [^(COLLECT_(GCC|GCC_OPTIONS|LTO_WRAPPER)|(COMPILER|LIBRARY)_PATH)=], + [^(ALLOCA|GETLOADAVG_LIBS|KMEM_GROUP|NEED_SETGID|POW_LIB)=], + [^(AWK|LEX|LEXLIB|LEX_OUTPUT_ROOT|LN_S|M4|RANLIB|SET_MAKE|YACC)=], + [^(GREP|EGREP|FGREP|ToD)=], + [^(_|@|.[*#?].|LINENO|OLDPWD|PIPESTATUS|RANDOM|SECONDS)=])' 2>/dev/null | + # There may be variables spread on several lines, eg IFS, remove the dead + # lines. + grep '^m4_defn([m4_re_word])=' >state-env.$1 +test $? = 0 || rm -f state-env.$1 + +ls -1 | $EGREP -v '^(at-|state-|config\.|conftest\.dSYM)' | sort >state-ls.$1 +])# AC_STATE_SAVE diff --git a/tests/atconfig.in b/tests/atconfig.in new file mode 100644 index 0000000..9c5b7c8 --- /dev/null +++ b/tests/atconfig.in @@ -0,0 +1,67 @@ +# -*- shell-script -*- +# @configure_input@ +# Configurable variable values for building test suites. +# Copyright 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 +# the Free Software Foundation; either version 2, 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. + +# This script is part of Autotest. Unlimited permission to copy, +# distribute and modify the testing scripts that are the output of +# that Autotest script is given. You need not follow the terms of the +# GNU General Public License when using or distributing such scripts, +# even though portions of the text of Autotest appear in them. The +# GNU General Public License (GPL) does govern all other use of the +# material that constitutes the Autotest. +# +# Certain portions of the Autotest source text are designed to be +# copied (in certain cases, depending on the input) into the output of +# Autotest. We call these the "data" portions. The rest of the +# Autotest source text consists of comments plus executable code that +# decides which of the data portions to output in any given case. We +# call these comments and executable code the "non-data" portions. +# Autotest never copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autotest +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autotest, you may extend this +# special exception to the GPL to apply to your modified version as +# well, *unless* your modified version has the potential to copy into +# its output some of the text that was the non-data portion of the +# version that you started with. (In other words, unless your change +# moves or copies text from the non-data portions to the data +# portions.) If your modification has such potential, you must delete +# any notice of this special exception to the GPL from your modified +# version. + +# This debugging script has been automatically generated from `make check'. +# Call it with `--help' to get a quick usage summary. + +at_package='@PACKAGE_NAME@' +at_version='@PACKAGE_VERSION@' +at_bugreport='@PACKAGE_BUGREPORT@' + +at_n='@ECHO_N@' +at_c='@ECHO_C@' + +srcdir='@srcdir@' +top_srcdir='@top_srcdir@' +AUTOTEST_PATH='@AUTOTEST_PATH@' + +SHELL=${CONFIG_SHELL-'@SHELL@'} +PATH_SEPARATOR='@PATH_SEPARATOR@' + +# We need GNU m4. +M4='@M4@' diff --git a/tests/atgeneral.m4 b/tests/atgeneral.m4 new file mode 100644 index 0000000..2097005 --- /dev/null +++ b/tests/atgeneral.m4 @@ -0,0 +1,567 @@ +include(m4sh.m4) -*- Autoconf -*- +# M4 macros used in building test suites. +# Copyright 2022,2023 Thomas E. Dickey +# Copyright 2000, 2001 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 +# the Free Software Foundation; either version 2, 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. + +# This script is part of Autotest. Unlimited permission to copy, +# distribute and modify the testing scripts that are the output of +# that Autotest script is given. You need not follow the terms of the +# GNU General Public License when using or distributing such scripts, +# even though portions of the text of Autotest appear in them. The +# GNU General Public License (GPL) does govern all other use of the +# material that constitutes the Autotest. +# +# Certain portions of the Autotest source text are designed to be +# copied (in certain cases, depending on the input) into the output of +# Autotest. We call these the "data" portions. The rest of the +# Autotest source text consists of comments plus executable code that +# decides which of the data portions to output in any given case. We +# call these comments and executable code the "non-data" portions. +# Autotest never copies any of the non-data portions into its output. +# +# This special exception to the GPL applies to versions of Autotest +# released by the Free Software Foundation. When you make and +# distribute a modified version of Autotest, you may extend this +# special exception to the GPL to apply to your modified version as +# well, *unless* your modified version has the potential to copy into +# its output some of the text that was the non-data portion of the +# version that you started with. (In other words, unless your change +# moves or copies text from the non-data portions to the data +# portions.) If your modification has such potential, you must delete +# any notice of this special exception to the GPL from your modified +# version. + + +# Use of diversions: +# +# - DEFAULT +# Overall initialization, value of $at_tests_all. +# - OPTIONS +# Option processing +# - HELP +# Help message. Of course it is useless, you could just push into +# OPTIONS, but that's much clearer this way. +# - SETUP +# Be ready to run the tests. +# - TESTS +# The core of the test suite, the ``normal'' diversion. +# - TAIL +# tail of the core for;case, overall wrap up, generation of debugging +# scripts and statistics. + +m4_define([_m4_divert(DEFAULT)], 0) +m4_define([_m4_divert(OPTIONS)], 10) +m4_define([_m4_divert(HELP)], 20) +m4_define([_m4_divert(SETUP)], 30) +m4_define([_m4_divert(TESTS)], 50) +m4_define([_m4_divert(TAIL)], 60) + +m4_divert_push([TESTS]) +m4_divert_push([KILL]) + + +# AT_LINE +# ------- +# Return the current file sans directory, a colon, and the current line. +m4_define([AT_LINE], +[m4_patsubst(__file__, ^.*/\(.*\), \1):__line__]) + + +# AT_INIT(PROGRAM) +# ---------------- +# Begin test suite, using PROGRAM to check version. The search path +# should be already preset so the proper executable will be selected. +m4_define([AT_INIT], +[m4_define([AT_ordinal], 0) +m4_define([AT_banner_ordinal], 0) +m4_define([AT_data_files], + [stdout expout at-setup-line at-check-line at-stdout stderr experr + at-stder1 at-stderr ]) +m4_divert_push([DEFAULT])dnl +#! /bin/sh + +AS_SHELL_SANITIZE +SHELL=${CONFIG_SHELL-/bin/sh} + +. ./atconfig +# Use absolute file notations, as the test might change directories. +at_srcdir=`cd "$srcdir" && pwd` +at_top_srcdir=`cd "$top_srcdir" && pwd` + +# Don't take risks: use absolute path names. +at_path=`pwd` +at_IFS_save=$IFS +IFS=$PATH_SEPARATOR +for at_dir in $AUTOTEST_PATH $PATH; do + # There might be directories that don't exist, but don't redirect + # builtins' (eg., cd) stderr directly: Ultrix's sh hates that. + at_dir=`(cd "$at_dir" && pwd) 2>/dev/null` + test -n "$at_dir" && at_path="$at_path$PATH_SEPARATOR$at_dir" +done +IFS=$at_IFS_save +PATH=$at_path +export PATH + +test -f atlocal && . ./atlocal + +# -e sets to true +at_stop_on_error=false +# Shall we be verbose? +at_verbose=: +at_quiet=echo +# Shall we keep the debug scripts? Must be `:' when testsuite is +# run by a debug script, so that the script doesn't remove itself. +at_debug=false +# Display help message? +at_help=false +# Tests to run +at_tests= +dnl Other vars inserted here (DEFAULT). +m4_divert([OPTIONS]) + +while test $[#] -gt 0; do + case $[1] in + --help | -h) at_help=: ;; + --version) echo "$[0] ($at_package) $at_version"; exit 0 ;; + + -d) at_debug=:;; + -e) at_stop_on_error=:;; + -v) at_verbose=echo; at_quiet=:;; + -x) at_traceon='set -vx'; at_traceoff='set +vx';; + + [[0-9] | [0-9][0-9] | [0-9][0-9][0-9] | [0-9][0-9][0-9][0-9]]) + at_tests="$at_tests$[1] ";; + + *) echo "$as_me: invalid option: $[1]" >&2 + echo "Try \`$[0] --help' for more information." >&2 + exit 1 ;; + esac + shift +done + +# Help message. +if $at_help; then + # If tests were specified, display only their title. + if test -z "$at_tests"; then + cat <<EOF +Usage: $[0] [[OPTION]]... [[TESTS]] + +Run all the tests, or the selected TESTS. + +Options: + -h Display this help message and the description of TESTS + -e Abort the full suite and inhibit normal clean up if a test fails + -v Force more detailed output, default for debugging scripts + -d Inhibit clean up and debug script creation, default for debugging scripts + -x Have the shell to trace command execution + +Tests: +EOF + else + # " 1 42 45 " => " (1|42|45): " + at_tests_pattern=`echo "$at_tests" | sed 's/^ *//;s/ *$//;s/ */|/g'` + at_tests_pattern=" (${at_tests_pattern}): " + fi + $EGREP -e "$at_tests_pattern" <<EOF +m4_divert([HELP])dnl Help message inserted here. +m4_divert([SETUP])dnl +EOF + exit 0 +fi + +# Tests to run. +test -z "$at_tests" && at_tests=$at_tests_all + +# Can we diff with `/dev/null'? DU 5.0 refuses. +if diff /dev/null /dev/null >/dev/null 2>&1; then + at_devnull=/dev/null +else + at_devnull=at-devnull + cp /dev/null $at_devnull +fi + +# Use `diff -u' when possible. +if diff -u $at_devnull $at_devnull >/dev/null 2>&1; then + at_diff='diff -u' +else + at_diff=diff +fi + +# Tester and tested. +if $1 --version | grep "$at_package.*$at_version" >/dev/null; then + AS_BOX([Test suite for $at_package $at_version]) +else + AS_BOX([ERROR: Not using the proper version, no tests performed]) + exit 1 +fi + +# Setting up the FDs. +# 5 is stdout conditioned by verbosity. +if test $at_verbose = echo; then + exec 5>&1 +else + exec 5>/dev/null +fi + +at_fail_list= +at_skip_list= +at_test_count=0 +m4_divert([TESTS])dnl + +for at_test in $at_tests +do + at_status=0 + rm -rf $at_data_files + # Clearly separate the tests when verbose. + test $at_test_count != 0 && $at_verbose + case $at_test in +dnl Tests inserted here (TESTS). +m4_divert([TAIL])[]dnl + + * ) + echo $as_me: no such test: $at_test + continue + ;; + esac + case $at_test in + banner-*) ;; + *) + if test ! -f at-check-line; then + echo "$as_me: warning: no at-check-line which means a failure happened" + echo "$as_me: warning: in a [AT_SETUP/AT_CLEANUP] pair before any" + echo "$as_me: warning: [AT_CHECK] could be run. This test suite is" + echo "$as_me: warning: improperly designed, please report to" + echo "$as_me: warning: <$at_bugreport>." + cp at-setup-line at-check-line + fi + at_test_count=`expr 1 + $at_test_count` + $at_verbose $at_n "$at_test. $srcdir/`cat at-setup-line`: $at_c" + case $at_status in + 0) echo ok + ;; + 77) echo "ok (skipped near \``cat at-check-line`')" + at_skip_list="$at_skip_list $at_test" + ;; + *) echo "FAILED near \``cat at-check-line`'" + at_fail_list="$at_fail_list $at_test" + $at_stop_on_error && break + ;; + esac + $at_debug || rm -rf $at_data_files + ;; + esac +done + +# Wrap up the test suite with summary statistics. + +rm -f at-check-line at-setup-line +at_skip_count=`set dummy $at_skip_list; shift; echo $[#]` +at_fail_count=`set dummy $at_fail_list; shift; echo $[#]` +if test $at_fail_count = 0; then + if test $at_skip_count = 0; then + AS_BOX([All $at_test_count tests were successful]) + else + AS_BOX([All $at_test_count tests were successful ($at_skip_count skipped)]) + fi +elif test $at_debug = false; then + if $at_stop_on_error; then + AS_BOX([ERROR: One of the tests failed, inhibiting subsequent tests]) + else + AS_BOX([ERROR: Suite unsuccessful, $at_fail_count of $at_test_count tests failed]) + fi + + # Remove any debugging script resulting from a previous run. + rm -f debug-*.sh $[0].log + echo + echo $at_n "Writing \`debug-NN.sh' scripts, NN =$at_c" + for at_group in $at_fail_list; do + echo $at_n " $at_group$at_c" + ( echo "#! /bin/sh" + echo 'exec ${CONFIG_SHELL-'"$SHELL"'} '"$[0]"' -v -d '"$at_group"' ${1+"$[@]"}' + echo 'exit 1' + ) >debug-$at_group.sh + chmod +x debug-$at_group.sh + done + echo ', done' + echo + echo 'You may investigate any problem if you feel able to do so, in which' + echo 'case the testsuite provide a good starting point.' + echo + echo 'Now, failed tests will be executed again, verbosely, and logged' + echo 'in the file '$[0]'.log.' + + { + AS_BOX([Test suite log for $at_package $at_version]) + echo + + # Try to find a few ChangeLogs in case it might help determining the + # exact version. + find "$at_top_srcdir" -name ChangeLog \ + -exec echo {} : ';' \ + -exec sed 's/^/| /;10q' {} ';' \ + -exec echo ';' + + # Summary of failed and skipped tests. + if test $at_fail_count != 0; then + echo "Failed tests:" + $SHELL $[0] $at_fail_list --help + echo + fi + if test $at_skip_count != 0; then + echo "Skipped tests:" + $SHELL $[0] $at_skip_list --help + echo + fi + + AS_UNAME + } >>$[0].log + + $SHELL $[0] -v -d $at_fail_list 2>&1 | tee -a $[0].log + AS_BOX([$[0].log is created]) + + echo + echo "Please send \`$[0].log' to <$at_bugreport> together with all" + echo "the information you think might help." + exit 1 +fi + +exit 0 +m4_divert_pop()dnl +m4_wrap([m4_divert_text([DEFAULT], + [# List of the tests. +at_tests_all="AT_TESTS_ALL "])])dnl +m4_wrap([m4_divert_text([SETUP], + [# List of the output files. +at_data_files="AT_data_files "])])dnl +])# AT_INIT + + + +# AT_SETUP(DESCRIPTION) +# --------------------- +# Start a group of related tests, all to be executed in the same subshell. +# The group is testing what DESCRIPTION says. +m4_define([AT_SETUP], +[m4_define([AT_ordinal], m4_incr(AT_ordinal)) +m4_append([AT_TESTS_ALL], [ ]m4_defn([AT_ordinal])) +m4_divert_text([HELP], + [m4_format([ %3d: %-15s %s], AT_ordinal, AT_LINE, [$1])]) +m4_divert_push([TESTS])dnl + AT_ordinal ) [#] AT_ordinal. AT_LINE: $1 + echo AT_LINE >at-setup-line + $at_verbose "AT_ordinal. $srcdir/AT_LINE: testing $1..." + $at_quiet $at_n "m4_format([%3d: %-18s], AT_ordinal, AT_LINE)[]$at_c" + ( + $at_traceon +]) + + +# AT_CLEANUP_FILE_IFELSE(FILE, IF-REGISTERED, IF-NOT-REGISTERED) +# -------------------------------------------------------------- +# We try to build a regular expression matching `[', `]', `*', and +# `.', i.e., the regexp active characters. +# +# Novices would write, `[[]*.]', which sure fails since the character +# class ends with the first closing braquet. +# M4 gurus will sure write `[\[\]*.]', but it will fail too because +# regexp does not support this and understands `\' per se. +# Regexp gurus will write `[][*.]' which is indeed what Regexp expects, +# but it will fail for M4 reasons: it's the same as `[*.]'. +# +# So the question is: +# +# Can you write a regexp that matches those four characters, +# and respects the M4 quotation constraints? +# +# The answer is: (rot13) tvira va gur ertrkc orybj, lbh vqvbg! +m4_define([AT_CLEANUP_FILE_IFELSE], +[m4_if(m4_regexp(AT_data_files, m4_patsubst([ $1 ], [[[]\|[]]\|[*.]], [\\\&])), + -1, + [$3], [$2])]) + + +# AT_CLEANUP_FILE(FILE) +# --------------------- +# Register FILE for AT_CLEANUP. +m4_define([AT_CLEANUP_FILE], +[AT_CLEANUP_FILE_IFELSE([$1], [], + [m4_append([AT_data_files], [$1 ])])]) + + +# AT_CLEANUP_FILES(FILES) +# ----------------------- +# Declare a list of FILES to clean. +m4_define([AT_CLEANUP_FILES], +[m4_foreach([AT_File], m4_quote(m4_patsubst([$1], [ *], [,])), + [AT_CLEANUP_FILE(AT_File)])]) + + +# AT_CLEANUP(FILES) +# ----------------- +# Complete a group of related tests, recursively remove those FILES +# created within the test. There is no need to list files created with +# AT_DATA. +m4_define([AT_CLEANUP], +[AT_CLEANUP_FILES([$1])dnl + ) + at_status=$? + ;; + +m4_divert([TESTS])[]dnl +m4_divert_pop()dnl +])# AT_CLEANUP + + +# AT_BANNER(TEXT) +# --------------- +# Output TEXT without any shell expansion. +m4_define([AT_BANNER], +[m4_define([AT_banner_ordinal], m4_incr(AT_banner_ordinal)) +m4_append([AT_TESTS_ALL], [ banner-]m4_defn([AT_banner_ordinal])) +m4_divert_push([TESTS])dnl + banner-AT_banner_ordinal ) [#] Banner AT_banner_ordinal. AT_LINE + cat <<\_ATEOF + +$1 + +_ATEOF + ;; + +m4_divert_pop()dnl +])# AT_BANNER + + +# AT_DATA(FILE, CONTENTS) +# ----------------------- +# Initialize an input data FILE with given CONTENTS, which should end with +# an end of line. +# This macro is not robust to active symbols in CONTENTS *on purpose*. +# If you don't want CONTENT to be evaluated, quote it twice. +m4_define([AT_DATA], +[AT_CLEANUP_FILES([$1])dnl +cat >$1 <<'_ATEOF' +$2[]_ATEOF +]) + + +# AT_CHECK(COMMANDS, [STATUS = 0], STDOUT, STDERR) +# ------------------------------------------------ +# Execute a test by performing given shell COMMANDS. These commands +# should normally exit with STATUS, while producing expected STDOUT and +# STDERR contents. +# +# STATUS, STDOUT, and STDERR are not checked if equal to `ignore'. +# +# If STDOUT is `expout', then stdout is compared to the content of the file +# `expout'. Likewise for STDERR and `experr'. +# +# If STDOUT is `stdout', then the stdout is left in the file `stdout', +# likewise for STDERR and `stderr'. Don't do this: +# +# AT_CHECK([command >out]) +# # Some checks on `out' +# +# do this instead: +# +# AT_CHECK([command], [], [stdout]) +# # Some checks on `stdout' +# +# This is an unfortunate limitation inherited from Ultrix which will not +# let you redirect several times the same FD (see the Autoconf documentation). +# If you use the `AT_CHECK([command >out])' be sure to have the test +# suite introduces spurious failures. +# +# You might wander why not just use `ignore' and directly use stdout and +# stderr left by the test suite. Firstly because the names of these files +# is an internal detail, and secondly, because +# +# AT_CHECK([command], [], [ignore]) +# AT_CHECK([check stdout]) +# +# will use `stdout' both in input and output: undefined behavior would +# certainly result. That's why the test suite will save them in `at-stdout' +# and `at-stderr', and will provide you with `stdout' and `stderr'. +# +# Any line of stderr starting with leading blanks and a `+' are filtered +# out, since most shells when tracing include subshell traces in stderr. +# This may cause spurious failures when the test suite is run with `-x'. +# +# +# Implementation Details +# ---------------------- +# Ideally, we would like to run +# +# ( $at_traceon; COMMANDS >at-stdout 2> at-stderr ) +# +# but we must group COMMANDS as it is not limited to a single command, and +# then the shells will save the traces in at-stderr. So we have to filter +# them out when checking stderr, and we must send them into the test suite's +# stderr to honor -x properly. +# +# Limiting COMMANDS to a single command is not good either, since them +# the user herself would use {} or (), and then we face the same problem. +# +# But then, there is no point in running +# +# ( $at_traceon { $1 ; } >at-stdout 2>at-stder1 ) +# +# instead of the simpler +# +# ( $at_traceon; $1 ) >at-stdout 2>at-stder1 +# +m4_define([AT_CHECK], +[$at_traceoff +$at_verbose "$srcdir/AT_LINE: AS_ESCAPE([$1])" +echo AT_LINE >at-check-line +( $at_traceon; $1 ) >at-stdout 2>at-stder1 +at_status=$? +$EGREP '^ *\+' at-stder1 >&2 +$EGREP -v '^ *\+' at-stder1 >at-stderr +at_failed=false +dnl Check stderr. +m4_case([$4], + stderr, [(echo stderr:; tee stderr <at-stderr) >&5], + ignore, [(echo stderr:; cat at-stderr) >&5], + experr, [$at_diff experr at-stderr >&5 || at_failed=:], + [], [$at_diff $at_devnull at-stderr >&5 || at_failed=:], + [echo >>at-stderr; echo "AS_ESCAPE([$4])" | $at_diff - at-stderr >&5 || at_failed=:]) +dnl Check stdout. +m4_case([$3], + stdout, [(echo stdout:; tee stdout <at-stdout) >&5], + ignore, [(echo stdout:; cat at-stdout) >&5], + expout, [$at_diff expout at-stdout >&5 || at_failed=:], + [], [$at_diff $at_devnull at-stdout >&5 || at_failed=:], + [echo >>at-stdout; echo "AS_ESCAPE([$3])" | $at_diff - at-stdout >&5 || at_failed=:]) +dnl Check exit val. Don't `skip' if we are precisely checking $? = 77. +case $at_status in +m4_case([$2], + [77], + [], + [ 77) exit 77;; +])dnl +m4_case([$2], + [ignore], + [ *);;], + [ m4_default([$2], [0])) ;; + *) $at_verbose "$srcdir/AT_LINE: exit code was $at_status, expected m4_default([$2], [0])" >&2 + at_failed=:;;]) +esac +AS_IF($at_failed, [$5], [$6]) +$at_failed && exit 1 +$at_traceon +])# AT_CHECK diff --git a/tests/atspecific.m4 b/tests/atspecific.m4 new file mode 100644 index 0000000..0b0bb8e --- /dev/null +++ b/tests/atspecific.m4 @@ -0,0 +1,185 @@ +include(atgeneral.m4) -*- Autoconf -*- +# M4 macros used in building Autoconf test suites. + +# 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, 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. + + +## ---------------------------------------- ## +## Macros specialized in testing Autoconf. ## +## ---------------------------------------- ## + + +# AT_CONFIGURE_AC(BODY) +# --------------------- +# Create a full configure.ac running BODY, with a config header set up, +# AC_OUTPUT, and environment checking hooks. +m4_define([AT_CONFIGURE_AC], +[AT_CLEANUP_FILES(env-after state*)dnl +AT_DATA([configure.ac], +[[AC_INIT +AC_CONFIG_AUX_DIR($top_srcdir/config) +AC_CONFIG_HEADER(config.h:config.hin) +AC_STATE_SAVE(before)] +$1 +[AC_OUTPUT +AC_STATE_SAVE(after) +]])]) + + +# AT_CHECK_AUTOCONF(FLAGS, [EXIT-STATUS = 0], STDOUT, STDERR) +# ----------------------------------------------------------- +# Also remove `configure.in', just in case one remained from a previous +# run. +m4_define([AT_CHECK_AUTOCONF], +[AT_CLEANUP_FILES(configure.in configure)dnl +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir $1], + m4_default([$2], [0]), [$3], [$4])]) + + +# AT_CHECK_AUTOHEADER +# ------------------- +m4_define([AT_CHECK_AUTOHEADER], +[AT_CLEANUP_FILES(config.hin)dnl +AT_CHECK([autoheader --autoconf-dir .. -l $at_srcdir], 0, [], [])]) + + +# AT_CHECK_CONFIGURE(END-COMMAND, +# [EXIT-STATUS = 0], +# [SDOUT = IGNORE], STDERR) +# -------------------------------------------- +# `top_srcdir' is needed so that `./configure' finds install-sh. +# Using --srcdir is more expensive. +m4_define([AT_CHECK_CONFIGURE], +[AT_CLEANUP_FILE_IFELSE([config.hin], [AT_CLEANUP_FILE(config.h)])dnl +AT_CLEANUP_FILE_IFELSE([defs.in], [AT_CLEANUP_FILE(defs)])dnl +AT_CLEANUP_FILES(config.log config.status config.cache)dnl +AT_CHECK([top_srcdir=$top_srcdir ./configure $1], + [$2], + m4_default([$3], [ignore]), [$4], + [test $at_verbose = echo && echo "$srcdir/AT_LINE: config.log" && cat config.log])]) + + +# AT_CHECK_ENV +# ------------ +# Check that the full configure run remained in its variable name space, +# and cleaned up tmp files. +# The tests might exit prematurely when they find a problem, in +# which case `env-after' is probably missing. Don't check it then. +m4_define([AT_CHECK_ENV], +[if test -f expout; then chmod +w expout; fi +if test -f state-env.before -a -f state-env.after; then + mv state-env.before expout + AT_CHECK([cat state-env.after], 0, expout) +fi +if test -f state-ls.before -a -f state-ls.after; then + mv state-ls.before expout + AT_CHECK([cat state-ls.after], 0, expout) +fi +]) + + +# AT_CHECK_DEFINES(CONTENT) +# ------------------------- +# Verify that config.h, once stripped is CONTENT. +# Stripping consists of keeping CPP lines (i.e. containing a hash), +# but those of automatically checked features (STDC_HEADERS etc.). +# AT_CHECK_HEADER is a better name, but too close from AC_CHECK_HEADER. +m4_define([AT_CHECK_DEFINES], +[AT_CHECK([[$FGREP '#' config.h | + $EGREP -v 'STDC_HEADERS|STD(INT|LIB)|INTTYPES|MEMORY|STRING|UNISTD|SYS_(TYPES|STAT)']],, + [$1])]) + + +# AT_CHECK_AUTOUPDATE +# ------------------- +m4_define([AT_CHECK_AUTOUPDATE], +[AT_CHECK([autoupdate --version || exit 77], ignore, ignore, ignore) + AT_CHECK([autoupdate --autoconf-dir $at_top_srcdir], 0, + [], [autoupdate: `configure.ac' is updated +])]) + + +# _AT_CHECK_AC_MACRO(AC-BODY, PRE-TESTS) +# -------------------------------------- +# Create a minimalist configure.ac running the macro named +# NAME-OF-THE-MACRO, check that autoconf runs on that script, +# and that the shell runs correctly the configure. +# TOP_SRCDIR is needed to set the auxdir (some macros need `install-sh', +# `config.guess' etc.). +m4_define([_AT_CHECK_AC_MACRO], +[AT_CONFIGURE_AC([$1]) +$2 +AT_CHECK_AUTOCONF +AT_CHECK_AUTOHEADER +AT_CHECK_CONFIGURE +AT_CHECK_ENV +])# _AT_CHECK_AC_MACRO + + +# AT_CHECK_MACRO(MACRO, [MACRO-USE], [ADDITIONAL-CMDS], [AUTOCONF-FLAGS]) +# ----------------------------------------------------------------------- +# Create a minimalist configure.ac running the macro named +# NAME-OF-THE-MACRO, check that autoconf runs on that script, +# and that the shell runs correctly the configure. +# TOP_SRCDIR is needed to set the auxdir (some macros need `install-sh', +# `config.guess' etc.). +# +# New macros are not expected to depend upon obsolete macros. +m4_define([AT_CHECK_MACRO], +[AT_SETUP([$1]) +AT_CONFIGURE_AC([m4_default([$2], [$1])]) + +AT_CHECK_AUTOCONF([m4_default([$4], [-W obsolete])]) +AT_CHECK_AUTOHEADER +AT_CHECK_CONFIGURE +AT_CHECK_ENV +$3 +AT_CLEANUP()dnl +])# AT_CHECK_MACRO + + +# AT_CHECK_AU_MACRO(MACRO) +# ------------------------ +# Create a minimalist configure.ac running the macro named +# NAME-OF-THE-MACRO, autoupdate this script, check that autoconf runs +# on that script, and that the shell runs correctly the configure. +# TOP_SRCDIR is needed to set the auxdir (some macros need +# `install-sh', `config.guess' etc.). +# +# Updated configure.ac shall not depend upon obsolete macros, which votes +# in favor of `-W obsolete', but since many of these macros leave a message +# to be removed by the user once her code is adjusted, let's not check. +# +# Remove config.hin to avoid `autoheader: config.hin is unchanged'. +m4_define([AT_CHECK_AU_MACRO], +[AT_SETUP([$1]) +AT_CONFIGURE_AC([$1]) + +AT_CHECK_AUTOCONF +AT_CHECK_AUTOHEADER +AT_CHECK_CONFIGURE +AT_CHECK_ENV + +rm config.hin +AT_CHECK_AUTOUPDATE + +AT_CHECK_AUTOCONF +AT_CHECK_AUTOHEADER +AT_CHECK_CONFIGURE +AT_CHECK_ENV + +AT_CLEANUP()dnl +])# AT_CHECK_UPDATE diff --git a/tests/base.at b/tests/base.at new file mode 100644 index 0000000..726dba9 --- /dev/null +++ b/tests/base.at @@ -0,0 +1,255 @@ +# -*- autoconf -*- + +AT_BANNER([Autoconf base layer.]) + + +## ------------------------------- ## +## AC_REQUIRE: topological sort.. ## +## ------------------------------- ## + +# Check that dependencies are always properly honored. + +AT_SETUP([AC_REQUIRE: topological sort]) + +AT_DATA(configure.ac, +[[define([REQUIRE_AND_CHECK], +[AC_REQUIRE([$1])dnl +test -z "$m4_translit([$1], [A-Z], [a-z])" && AS_EXIT(1)]) + +AC_DEFUN([TEST1], +[REQUIRE_AND_CHECK([TEST2a]) +REQUIRE_AND_CHECK([TEST2b]) +test1=set]) + +AC_DEFUN([TEST2a], +[test2a=set]) + +AC_DEFUN([TEST2b], +[REQUIRE_AND_CHECK([TEST3]) +test2b=set]) + +AC_DEFUN([TEST3], +[REQUIRE_AND_CHECK([TEST2a]) +test3=set]) + +AC_PLAIN_SCRIPT()dnl +#! /bin/sh + +TEST1 +test -z "$test1" && + AC_MSG_ERROR([\$test1 is empty]) +AS_EXIT(0) +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE + +AT_CLEANUP + + + +## ----------------------------------------------- ## +## AC_REQUIRE and AC_DEFUN_ONCE: Require, expand. ## +## ----------------------------------------------- ## + +AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: Require, expand]) + +AT_DATA([configure.ac], +[[AC_DEFUN([TEST], +[AC_REQUIRE([MULTI_TEST]) +AC_REQUIRE([SINGLE_TEST])]) + +AC_DEFUN([MULTI_TEST], +[multi_test=".$multi_test"]) + +AC_DEFUN_ONCE([SINGLE_TEST], +[single_test=".$single_test"]) + +AC_PLAIN_SCRIPT()dnl +#! /bin/sh + +TEST +TEST +MULTI_TEST +MULTI_TEST +SINGLE_TEST +SINGLE_TEST + +case $multi_test:$single_test in + ...:. ) AS_EXIT(0);; + ...:* ) AC_MSG_ERROR([DEFUN_ONCE is broken]);; + *:. ) AC_MSG_ERROR([DEFUN is broken (Wow, congrats!)]);; +esac +]]) + +AT_CHECK_AUTOCONF([], 0, [], +[configure.ac:18: warning: SINGLE_TEST invoked multiple times +configure.ac:19: warning: SINGLE_TEST invoked multiple times +]) + +AT_CHECK_CONFIGURE + +AT_CLEANUP + + + +## ----------------------------------------------- ## +## AC_REQUIRE and AC_DEFUN_ONCE: Expand, require. ## +## ----------------------------------------------- ## + +AT_SETUP([AC_REQUIRE & AC_DEFUN_ONCE: Expand, require]) + +AT_DATA([configure.ac], +[[AC_DEFUN([TEST], +[AC_REQUIRE([MULTI_TEST]) +AC_REQUIRE([SINGLE_TEST])]) + +AC_DEFUN([MULTI_TEST], +[multi_test=".$multi_test"]) + +AC_DEFUN_ONCE([SINGLE_TEST], +[single_test=".$single_test"]) + +AC_PLAIN_SCRIPT()dnl +#! /bin/sh + +MULTI_TEST +MULTI_TEST +SINGLE_TEST +SINGLE_TEST +TEST +TEST + +case $multi_test:$single_test in + ..:. ) AS_EXIT(0);; + ..:* ) AC_MSG_ERROR([DEFUN_ONCE is broken]);; + *:. ) AC_MSG_ERROR([DEFUN is broken (Wow, congrats!)]);; + * ) AC_MSG_ERROR([received `$multi_test:$single_test']);; +esac +]]) + +AT_CHECK_AUTOCONF([], 0, [], +[configure.ac:17: warning: SINGLE_TEST invoked multiple times +]) +AT_CHECK_CONFIGURE + +AT_CLEANUP + + + +## ------------------------- ## +## AC_REQUIRE & AC_PROVIDE. ## +## ------------------------- ## + +AT_SETUP([AC_REQUIRE & AC_PROVIDE]) + +AT_DATA([configure.ac], +[[AC_DEFUN([TEST], +[AC_REQUIRE([INNER_TEST])]) + +AC_DEFUN([INNER_TEST], +[inner_test=".$inner_test"]) + +AC_PLAIN_SCRIPT()dnl +#! /bin/sh + +AC_PROVIDE([INNER_TEST]) +TEST + +case $inner_test in + "" ) AS_EXIT(0);; + * ) AC_MSG_ERROR([received `$inner_test']);; +esac +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE + +AT_CLEANUP + + +## ---------------------- ## +## AC_REQUIRE & AC_LANG. ## +## ---------------------- ## + +AT_SETUP([AC_REQUIRE & AC_LANG]) + +AT_DATA([configure.ac], +[[AC_DEFUN([AC_F77_1], +[AC_LANG_PUSH([Fortran 77]) +if test $ac_ext != f; then + AC_MSG_ERROR([F77_1: current shell language is $ac_ext, expected Fortran]) +fi +AC_LANG_POP +]) + + +AC_DEFUN([AC_F77_2], +[AC_LANG_PUSH([Fortran 77]) +AC_REQUIRE([AC_F77_1]) +if test $ac_ext != f; then + AC_MSG_ERROR([F77_2: current shell language is $ac_ext, expected Fortran]) +fi +AC_LANG_POP +]) + +AC_INIT +AC_F77_2 +AS_EXIT(0) +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE + +AT_CLEANUP + + +## ---------------- ## +## AC_CACHE_CHECK. ## +## ---------------- ## + +# Make sure AC_CACHE_CHECK is silent with -q. + +AT_SETUP([AC_CACHE_CHECK]) + +AT_DATA([configure.ac], +[[AC_INIT +AC_CACHE_CHECK([for nothing], + [ac_nothing], + [ac_nothing=found]) +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([-q]) + +AT_CLEANUP + + +## ---------- ## +## AC_TRY_*. ## +## ---------- ## + +AT_SETUP([AC_TRY_*]) + +AT_DATA([configure.ac], +[[AC_INIT + +if AC_TRY_COMMAND([(echo "The Cat in the Hat"; + echo "The Hat in the Cat" >&2) + | grep \^The\ Cat\ in\ the\ Hat\$ >/dev/null]); then + : +else + AC_MSG_ERROR([Didn't see the Cat in the Hat!]) +fi + +if AC_TRY_COMMAND([(echo "The Cat in the Hat"; + echo "The Hat in the Cat" >&2) + | grep \^The\ Hat\ in\ the\ Cat\$ >/dev/null]); then + AC_MSG_ERROR([Saw the Hat in the Cat!]) +fi +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([-q]) + +AT_CLEANUP diff --git a/tests/compile.at b/tests/compile.at new file mode 100644 index 0000000..7ea207f --- /dev/null +++ b/tests/compile.at @@ -0,0 +1,277 @@ +# -*- autoconf -*- + +AT_BANNER([Low level compiling/preprocessing macros.]) + +# Since the macros which compile are required by most tests, check +# them first. But remember that looking for a compiler is even more +# primitive, so check those first. + + +## ------------------------------------- ## +## AC_LANG, AC_LANG_PUSH & AC_LANG_POP. ## +## ------------------------------------- ## + +AT_SETUP([AC_LANG, AC_LANG_PUSH & AC_LANG_POP]) + +AT_DATA([configure.ac], +[[AC_INIT +# C +AC_LANG(C) +# C +AC_LANG_PUSH(C) +# C C +AC_LANG_PUSH(C++) +# C++ C C +AC_LANG(C++) +# C++ C C +AC_LANG_PUSH(Fortran 77) +# F77 C++ C C +AC_LANG_POP(Fortran 77) +# C++ C C +AC_LANG(C++) +# C++ C C +AC_LANG_POP(C++) +# C C +AC_LANG_POP(C) +# C +]]) + +AT_CHECK_AUTOCONF +AT_CHECK([sed -n 's/^ac_ext=//p' configure], 0, +[c +c +c +cc +cc +f +cc +cc +c +c +]) + +AT_CLEANUP + + +## ------------ ## +## Extensions. ## +## ------------ ## + +# As far as we know only `foo', `foo.exe' are possible executable, +# and `foo.o', `foo.obj' are possible object files. Autoconf must not +# know that, but it is OK for the test suite to take this into account. +AT_CHECK_MACRO([Extensions], +[[AC_PROG_CC +case $ac_exeext in + '' | '.exe' ) ;; + * ) AC_MSG_ERROR([suspicious executable suffix: $ac_exeext]);; +esac + +case $ac_objext in + 'o' | 'obj' ) ;; + * ) AC_MSG_ERROR([suspicious object suffix: $ac_objext]);; +esac +AS_EXIT([0]) +]]) + + + +## -------------------------- ## +## Broken/missing compilers. ## +## -------------------------- ## + + +# Check that Autoconf correctly diagnoses broken compilers, and in +# particular, if it does not exit 77, the test suite is in trouble... +# FIXME: Once a precise message decided, check stderr of configure. +AT_SETUP([Broken/missing compilers]) + +AT_DATA([configure.ac], +[[AC_INIT +CC=no-such-compiler +AC_PROG_CC +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([], 77, ignore, ignore) + +AT_CLEANUP + + +## ------------ ## +## C keywords. ## +## ------------ ## + +# GCC supports `const', `volatile', and `inline'. +AT_CHECK_MACRO([C keywords], +[[AC_PROG_CC +AC_C_CONST +AC_C_INLINE +AC_C_VOLATILE +case $GCC,$ac_cv_c_const,$ac_cv_c_inline,$ac_cv_c_volatile in + yes,*no*) + AC_MSG_ERROR([failed to detect `const', `inline' or `volatile' support]);; +esac +]]) + + + +## --------------------------------- ## +## AC_PROG_CPP requires AC_PROG_CC. ## +## --------------------------------- ## + +# Must invoke AC_PROG_CC. +AT_CHECK_MACRO([AC_PROG_CPP requires AC_PROG_CC], +[[AC_PROG_CPP +test -z "$CC" && + AC_MSG_ERROR([looked for a C preprocessor without looking for a compiler]) +]]) + + + +## --------------------------- ## +## AC_PROG_CPP with warnings. ## +## --------------------------- ## + + +# It's Ok for strict preprocessors to produce warnings. + +AT_SETUP([AC_PROG_CPP with warnings]) + +AT_DATA([mycpp], +[[#! /bin/sh +echo noise >&2 +exec ${1+"$@"} +]]) + +chmod +x mycpp + +_AT_CHECK_AC_MACRO( +[[AC_PROG_CPP +# If the preprocessor is not strict, just ignore +test "x$ac_c_preproc_warn_flag" = xyes && + AC_MSG_ERROR([preprocessor has no warning option], 77) +CPP="./mycpp $CPP" +AC_CHECK_HEADERS(stdio.h autoconf_io.h)]]) + +AT_CHECK_DEFINES( +[/* #undef HAVE_AUTOCONF_IO_H */ +#define HAVE_STDIO_H 1 +]) + +AT_CLEANUP + + +## ------------------------------ ## +## AC_PROG_CPP without warnings. ## +## ------------------------------ ## + +AT_SETUP([AC_PROG_CPP without warnings]) + +# Ignore if /lib/cpp doesn't work +AT_CHECK([/lib/cpp </dev/null || exit 77], [], [ignore], [ignore]) + +# A cpp which exit status is meaningless. +AT_DATA([mycpp], +[[#! /bin/sh +/lib/cpp ${1+"$@"} +exit 0 +]]) + +chmod +x mycpp + +_AT_CHECK_AC_MACRO( +[[CPP=./mycpp +AC_PROG_CPP +test "x$ac_c_preproc_warn_flag" != xyes && + AC_MSG_ERROR([failed to detect preprocessor warning option]) +AC_CHECK_HEADERS(stdio.h autoconf_io.h)]]) + +AT_CHECK_DEFINES( +[/* #undef HAVE_AUTOCONF_IO_H */ +#define HAVE_STDIO_H 1 +]) + +AT_CLEANUP + + + +## -------------------- ## +## AC_PROG_CPP via CC. ## +## -------------------- ## + + +# It's Ok for strict preprocessors to produce warnings. + +AT_SETUP([AC_PROG_CPP via CC]) + +# Ignore if /lib/cpp doesn't work +AT_CHECK([/lib/cpp </dev/null || exit 77], [], [ignore], [ignore]) + +AT_DATA([mycc], +[[#! /bin/sh +echo "Annoying copyright message" >&2 +exec "$@" +]]) + +chmod +x mycc + +# We go through the following contortions, in order to have the +# configure script go down the same codepaths as it would during a +# normal CPP selection check. If we explicitly set CPP, it goes down +# a different codepath. +_AT_CHECK_AC_MACRO( +[[AC_PROG_CC +CC="./mycc $CC" +AC_PROG_CPP +# The test $CC compiler should have been selected. +test "$CPP" != "$CC -E" && + AC_MSG_ERROR([error messages on stderr cause the preprocessor selection to fail]) + +# Exercise CPP. +AC_CHECK_HEADERS(stdio.h autoconf_io.h)]]) + +AT_CHECK_DEFINES( +[/* #undef HAVE_AUTOCONF_IO_H */ +#define HAVE_STDIO_H 1 +]) + +AT_CLEANUP + + +## ------------------ ## +## AC_TRY_LINK_FUNC. ## +## ------------------ ## + +AT_CHECK_MACRO([AC_TRY_LINK_FUNC], +[AC_TRY_LINK_FUNC(printf,, + [AC_MSG_ERROR([cannot find `printf'])]) +AC_TRY_LINK_FUNC(Be_doomed_if_your_libc_has_a_function_named_like_this, + [AC_MSG_ERROR([found a nonexistent function])])]) + + + +## --------------------- ## +## Fortran 77 Compiler. ## +## --------------------- ## + + +AT_CHECK_MACRO([GNU Fortran 77], +[[AC_LANG(Fortran 77) +AC_LANG_COMPILER + +if AC_TRY_COMMAND([$F77 --version | grep GNU >&2]); then + # Be sure to remove files which might be created by compilers that + # don't support --version. + rm -f a.exe a.out + # Has GNU in --version. + test "$G77" != yes && + AC_MSG_ERROR([failed to recognize GNU Fortran 77 compiler]) +else + # Be sure to remove files which might be created by compilers that + # don't support --version. + rm -f a.exe a.out + # Has not. + test "$G77" = yes && + AC_MSG_ERROR([incorrectly recognized a GNU Fortran 77 compiler]) +fi]]) diff --git a/tests/m4sh.at b/tests/m4sh.at new file mode 100644 index 0000000..255c185 --- /dev/null +++ b/tests/m4sh.at @@ -0,0 +1,118 @@ +# -*- Autoconf -*- + +AT_BANNER([M4sh.]) + + +## ----------------------------- ## +## AS_DIRNAME & AS_DIRNAME_SED. ## +## ----------------------------- ## + +# Build nested dirs. + +AT_SETUP([[AS_DIRNAME & AS_DIRNAME_SED]]) + +AT_DATA(configure.ac, +[[AC_PLAIN_SCRIPT()dnl +#! /bin/sh + +_AS_EXPR_PREPARE + +define([AS_DIRNAME_TEST], +[dir=`AS_DIRNAME([$1])` +test "$dir" = "$2" || + echo "dirname($1) = $dir instead of $2" >&2 + +dir=`AS_DIRNAME_SED([$1])` +test "$dir" = "$2" || + echo "dirname_sed($1) = $dir instead of $2" >&2]) + +AS_DIRNAME_TEST([//1], [//]) +AS_DIRNAME_TEST([/1], [/]) +AS_DIRNAME_TEST([./1], [.]) +AS_DIRNAME_TEST([../../2], [../..]) +AS_DIRNAME_TEST([//1/], [//]) +AS_DIRNAME_TEST([/1/], [/]) +AS_DIRNAME_TEST([./1/], [.]) +AS_DIRNAME_TEST([../../2], [../..]) +AS_DIRNAME_TEST([//1/3], [//1]) +AS_DIRNAME_TEST([/1/3], [/1]) +AS_DIRNAME_TEST([./1/3], [./1]) +AS_DIRNAME_TEST([../../2/3], [../../2]) +AS_DIRNAME_TEST([//1/3///], [//1]) +AS_DIRNAME_TEST([/1/3///], [/1]) +AS_DIRNAME_TEST([./1/3///], [./1]) +AS_DIRNAME_TEST([../../2/3///], [../../2]) +AS_DIRNAME_TEST([//1//3/], [//1]) +AS_DIRNAME_TEST([/1//3/], [/1]) +AS_DIRNAME_TEST([./1//3/], [./1]) +AS_DIRNAME_TEST([../../2//3/], [../../2]) +AS_EXIT(0) +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE + +AT_CLEANUP(configure) + + + +## ------------ ## +## AS_MKDIR_P. ## +## ------------ ## + +# Build nested dirs. + +AT_SETUP([[AS_MKDIR_P]]) + +AT_DATA([configure.ac], +[[AC_PLAIN_SCRIPT()dnl +#! /bin/sh + +pwd=`pwd` +set -e +# Absolute +AS_MKDIR_P(["$pwd/1/2/3/4/5/6"]) +test -d "$pwd/1/2/3/4/5/6" || + AC_MSG_ERROR([$pwd/1/2/3/4/5/6 has not been properly created]) +# Relative +AS_MKDIR_P(["a/b/c/d/e/f"]) +test -d a/b/c/d/e/f || + AC_MSG_ERROR([a/b/c/d/e/f has not been properly created]) +AS_EXIT(0) +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE + +AT_CLEANUP(configure 1 a) + + + + +## ----------------------------- ## +## Negated classes in globbing. ## +## ----------------------------- ## + +# It is known that `[^...]' is not universally supported, but it is +# unknown for `[!...]'. + +AT_SETUP([Negated classes in globbing]) + +AT_DATA([configure.ac], +[[AC_PLAIN_SCRIPT()dnl +#! /bin/sh + +case 'with!two!bangs' in + *[[!a-z]]*) ;; + *) AC_MSG_ERROR([[`*[!a-z]*' didn't match `with!two!bangs']]);; +esac + +case without in + *[[!a-z]]*) AC_MSG_ERROR([[`*[!a-z]*' matched `without']]);; +esac +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE + +AT_CLEANUP(configure) diff --git a/tests/m4sugar.at b/tests/m4sugar.at new file mode 100644 index 0000000..9f4dab7 --- /dev/null +++ b/tests/m4sugar.at @@ -0,0 +1,139 @@ +# -*- Autoconf -*- + +AT_BANNER([M4sugar.]) + + +# Order of the tests: +# - m4_warn +# +# - m4_require +# uses warn/error code. +# +# - m4_text_wrap + +## --------- ## +## m4_warn. ## +## --------- ## + +AT_SETUP([[m4_warn]]) + +# m4_text_wrap is used to display the help strings. Also, check that +# commas are not swallowed. This can easily happen because of +# m4-listification. + +AT_DATA(configure.ac, +[[m4_warn([foo], [foo]) +m4_warn([bar], [bar]) +m4_warn([syntax], [syntax]) +]]) + +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o-], + 0, [], +[configure.ac:3: warning: syntax +]) + +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o- -Wall], + 0, [], +[configure.ac:1: warning: foo +configure.ac:2: warning: bar +configure.ac:3: warning: syntax +]) + +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o- -Wnone,bar], + 0, [], +[configure.ac:2: warning: bar +]) + +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -o- -Wnone,bar,error], + 1, [], +[configure.ac:2: error: bar +configure.ac:2: the top level +]) + +AT_CLEANUP + + +## ----------------------------------- ## +## m4_require: circular dependencies. ## +## ----------------------------------- ## + +AT_SETUP([[m4_require: circular dependencies]]) + +# m4_text_wrap is used to display the help strings. Also, check that +# commas are not swallowed. This can easily happen because of +# m4-listification. + +AT_DATA([configure.ac], +[[m4_defun([foo], +[m4_require([bar])]) + +m4_defun([bar], +[m4_require([foo])]) + +m4_defun([baz], +[m4_require([foo])]) + +m4_init +baz +]]) + +AT_CHECK_AUTOCONF([], 1, [], +[[configure.ac:11: error: m4_require: circular dependency of foo +configure.ac:11: foo is required by... +configure.ac:4: bar is expanded from... +configure.ac:11: bar is required by... +configure.ac:1: foo is expanded from... +configure.ac:11: foo is required by... +configure.ac:7: baz is expanded from... +configure.ac:11: the top level +]]) + +AT_CLEANUP + + +## -------------- ## +## m4_text_wrap. ## +## -------------- ## + +AT_SETUP([[m4_text_wrap]]) + +# m4_text_wrap is used to display the help strings. Also, check that +# commas are not swallowed. This can easily happen because of +# m4-listification. + +AT_DATA([configure.ac], +[[AC_PLAIN_SCRIPT()dnl +m4_text_wrap([Short string */], [ ], [/* ], 20) + +m4_text_wrap([Much longer string */], [ ], [/* ], 20) + +m4_text_wrap([Short doc.], [ ], [ --short ], 30) + +m4_text_wrap([Short doc.], [ ], [ --too-wide], 30) + +m4_text_wrap([Super long documentation.], [ ], [ --too-wide], 30) + +m4_text_wrap([First, second , third, [,quoted]]) +]]) + +AT_DATA(expout, +[[/* Short string */ + +/* Much longer + string */ + + --short Short doc. + + --too-wide + Short doc. + + --too-wide + Super long + documentation. + +First, second , third, [,quoted] +]]) + +AT_CHECK_AUTOCONF([-o-], 0, [expout]) + +AT_CLEANUP diff --git a/tests/mktests.in b/tests/mktests.in new file mode 100755 index 0000000..6868f5b --- /dev/null +++ b/tests/mktests.in @@ -0,0 +1,230 @@ +#! /bin/sh + +# Build some of the Autoconf test files. +# Copyright 2021,2023 Thomas E. Dickey +# Copyright 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 +# the Free Software Foundation; either version 2, 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. + +# If we fail, clean up, but touch the output files. We probably failed +# because we used some non portable tool, but we just don't care: this +# shell script is a maintainer tool, and we do expect good tools. + +as_me=`echo "$0" | sed 's,.*[\\/],,'` + +trap 'echo "'"$as_me"': failed. To proceed run make check." >&2 + rm -f acdefuns audefuns requires *.tat + for file in "$@" + do + touch `echo "$file" | sed "s,.*[\\/],,;s/\..*/.at/"` + done + trap 0 + exit 1' \ + 0 1 2 15 + +# If ever something goes wrong, fail, so that the trap be launched. +set -e + +# We need arguments. +test $# != 0 + +# We need these arguments. +src="$@" + +# Set locale to C so that `sort' behaves in a uniform way. +export LANGUAGE; LANGUAGE=C +export LANG; LANG=C +export LC_ALL; LC_ALL=C + + +# requires +# -------- +# Get the list of macros that are required: there is little interest +# in testing them since they will be run but the guy who requires +# them. +cat $src | + sed -n 's/dnl.*//;s/.*AC_REQUIRE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' | + sort | + uniq >requires + + +# exclude_list +# ------------ +# Macros which must not be checked at all (not by ac-macros.at, nor +# au-macros.at). +# The trailing new line is meant. +# +# - ac_cv_prog_gcc, gxx, g77 +# Not macros, just mapping from old variable name to a new one. +exclude_list='^ac_cv_prog_(gcc|gxx|g77)$ +' + + +# ac_exclude_list +# --------------- +# The test `ac-macros.at' tries to run all the macros of Autoconf to check +# for syntax problems, etc. Not all the macros can be run without argument, +# and some are already tested elsewhere. EGREP_EXCLUDE must filter out +# the macros we don't want to test in ac-macros.at. +# +# - AC_CANONICALIZE, AC_PREFIX_PROGRAM, AC_PREREQ +# Need an argument. +# - AC_CHECK decl, file, func, header, lib, member, prog, sizeof, type +# Performed in the semantics tests. +# - AC_CONFIG +# They fail when the source does not exist. +# - AC_INIT +# AC_INIT includes all the AC_INIT macros. Note that there is an +# infinite m4 recursion if AC_INIT it used twice. +# - AC_LANG* +# Heavily used by other macros. +# - AC_PATH_PROGS?, AC_F77_FUNC +# They produce `= val' because $1, the variable used to store the result, +# is empty. +# - AC_TRY, AC_.*_IFELSE, AC_RUN_LOG. +# Used in many places. +# - _AC_ +# Internal macros are used elsewhere. +# - AC_OUTPUT +# Already tested by `AT_CHECK_MACRO'. +# - AC_FD_CC +# Is a number. +# - AC_PROG_CC, AC_C_(CONST|INLINE|VOLATILE), AC_PATH_XTRA +# Checked in semantics. +# - AC_CYGWIN, AC_CYGWIN32, AC_EMXOS2, AC_MING32, AC_EXEEXT, AC_OBJEXT +# AU defined to nothing. +# - AC_PATH_XTRA +# Checked in semantics. +# - AC_SYS_RESTARTABLE_SYSCALLS, AC_FUNC_WAIT3 +# Obsolete, checked in semantics. +# +ac_exclude_list='^AC_ARG_VAR$ +^AC_CANONICALIZE|AC_PREFIX_PROGRAM|AC_PREREQ$ +^AC_CHECK_(DECL|FILE|FUNC|HEADER|LIB|MEMBER|PROG|SIZEOF|TOOL|TYPE)S?$ +^AC_CONFIG +^AC_F77_FUNC$ +^AC_INIT +^AC_LANG +^AC_LINKER_OPTION$ +^AC_LINK_FILES$ +^AC_LIST_MEMBER_OF$ +^AC_OUTPUT$ +^AC_PATH_(TOOL|PROG)S?$ +^AC_REPLACE_FUNCS$ +^AC_SEARCH_LIBS$ +^(AC_TRY.*|AC_RUN_LOG)$ +^AC_.*_IFELSE$ +^AC_FD_CC$ +^(AC_(PROG_CC|C_CONST|C_INLINE|C_VOLATILE))$ +^AC_(CYGWIN|CYGWIN32|EMXOS2|MING32|EXEEXT|OBJEXT)$ +^AC_PATH_XTRA$ +^AC_SYS_RESTARTABLE_SYSCALLS$ +^AC_FUNC_WAIT3$ +_AC_' + + +# ac_exclude_egrep +# ---------------- +# Build a single egrep pattern out of filter_macros_list. +# Sed is used to get rid of the trailing `|' coming from the trailing +# `\n' from `echo'. +ac_exclude_egrep=`echo "$exclude_list$ac_exclude_list" | tr ' +' '|' | sed 's/.$//'` + + +# au_exclude_list +# --------------- +# AC_LANG_RESTORE +# cannot be used alone. +# AC_LINK_FILES, AC_PREREQ +# need arguments and are tested elsewhere. +# AC_INIT and AC_OUTPUT +# are already in `configure.ac'. +# AC_CYGWIN, AC_MINGW32, AC_EMXOS2 +# are using AC_REQUIRE. +au_exclude_list='^AC_LANG_RESTORE$ +^AC_LINK_FILES|AC_PREREQ$ +^AC_(INIT|OUTPUT)$ +^AC_(CYGWIN|MINGW32|EMXOS2)$' + + +# au_exclude_egrep +# ---------------- +# Build a single egrep pattern out of filter_macros_list. +# Sed is used to get rid of the trailing `|' coming from the trailing +# `\n' from `echo'. +au_exclude_egrep=`echo "$exclude_list$au_exclude_list" | tr ' +' '|' | sed 's/.$//'` + + + +## ------------------------- ## +## Creating the test files. ## +## ------------------------- ## + +for file in $src +do + base=`echo "$file" | sed 's,.*[\\/],,;s/\..*//'` + # Get the list of macros which are defined in Autoconf level. + # Get rid of the macros we are not interested in. + cat $file | + sed -n -e 's/^AC_DEFUN(\[*\([a-zA-Z0-9_]*\).*$/\1/p' \ + -e 's/^AC_DEFUN_ONCE(\[*\([a-zA-Z0-9_]*\).*$/\1/p' | + sort | + uniq | + # Watch out we are `set -e': don't fail. + ( @EGREP@ -v "$ac_exclude_egrep" || true) >acdefuns + + # Get the list of macros which are defined in Autoupdate level. + cat $file | + sed -n 's/^AU_DEFUN(\[*\([a-zA-Z][a-zA-Z0-9_]*\).*$/\1/p' | + sort | + uniq | + ( @EGREP@ -v "$au_exclude_egrep" || true) > audefuns + + # Filter out required macros. + { + sed 's/^ *//' <<MK_EOF + # Generated by $as_me, do not edit by hand. -*- autoconf -*- + + AT_BANNER([Testing $base macros.]) + +MK_EOF + + echo "# Modern macros." + for macro in `cat acdefuns`; do + if @FGREP@ "$macro" requires >/dev/null 2>&1; then :; else + echo "AT_CHECK_MACRO([$macro])" + fi + done + echo + echo "# Obsolete macros." + for macro in `cat audefuns`; do + if @FGREP@ "$macro" requires >/dev/null 2>&1; then :; else + echo "AT_CHECK_AU_MACRO([$macro])" + fi + done + } >$base.tat + + # In one atomic step so that if something above fails, the trap + # preserves the old version of the file. + mv -f $base.tat $base.at +done + +rm -f acdefuns audefuns requires + +trap 0 +exit 0 diff --git a/tests/semantics.at b/tests/semantics.at new file mode 100644 index 0000000..0ca46b4 --- /dev/null +++ b/tests/semantics.at @@ -0,0 +1,378 @@ +# -*- autoconf -*- + +AT_BANNER([Semantics.]) + + + + +## -------------------------------- ## +## Members of the AC_CHECK family. ## +## -------------------------------- ## + + +# AC_CHECK_LIB +# ------------ +# Well, I can't imagine a system where `cos' is neither in libc, nor +# in libm. Nor can I imagine a lib more likely to exists than libm. +# But there are systems without libm, on which we don't want to have +# this test fail, so exit successfully if `cos' is in libc. +AT_CHECK_MACRO([AC_CHECK_LIB], +[AC_TRY_LINK_FUNC(cos, + [AC_MSG_ERROR([`cos' is in `libc'], 77)]) + +AC_CHECK_LIB(m, cos,, + [AC_MSG_ERROR([cannot find `cos' in `libm'])]) + +# No kidding, using variables was broken in 2.50 :( +ac_sin=sin +AC_CHECK_LIB(m, $ac_sin,, + [AC_MSG_ERROR([cannot find `\$ac_sin' (= `$ac_sin') in `libm'])]) + +ac_m=m +AC_CHECK_LIB($ac_m, acos,, + [AC_MSG_ERROR([cannot find `acos' in `\$ac_m' (= `$ac_m')])]) + +ac_asin=asin +AC_CHECK_LIB($ac_m, $ac_asin,, + [AC_MSG_ERROR([cannot find `\$ac_asin' (= `$ac_asin') in `\$ac_m' (= `$at_m')])]) + +# But if the bug is in the caching mechanism, then be sure we +# correctly detect failures. + +AC_CHECK_LIB(m, cossack, + [AC_MSG_ERROR([found `cossack' in `libm'])]) + +# No kidding, using variables was broken in 2.50 :( +ac_sinner=sinner +AC_CHECK_LIB(m, $ac_sinner, + [AC_MSG_ERROR([found `\$ac_sinner' (= `$ac_sinner') in `libm'])]) + +ac_m=m +AC_CHECK_LIB($ac_m, acossack, + [AC_MSG_ERROR([found `acossack' in `\$ac_m' (= `$ac_m')])]) + +ac_asinner=asinner +AC_CHECK_LIB($ac_m, $ac_asinner, + [AC_MSG_ERROR([found `\$ac_asinner' (= `$ac_asinner') in `\$ac_m' (= `$at_m')])]) + +]) + + +# AC_CHECK_DECLS +# -------------- +# Check that it performs the correct actions: +# Must define NEED_NO_DECL, but not NEED_YES_DECL. +AT_CHECK_MACRO([AC_CHECK_DECLS], +[[AC_CHECK_DECLS([yes, no],,, + [int yes = 1;])]], +[AT_CHECK_DEFINES( +[#define HAVE_DECL_NO 0 +#define HAVE_DECL_YES 1 +])]) + + +# AC_CHECK_FUNCS +# -------------- +# Check that it performs the correct actions: +# Must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP +AT_CHECK_MACRO([AC_CHECK_FUNCS], +[AC_CHECK_FUNCS(printf autoconf_ftnirp)], +[AT_CHECK_DEFINES( +[/* #undef HAVE_AUTOCONF_FTNIRP */ +#define HAVE_PRINTF 1 +])]) + + +# AC_REPLACE_FUNCS +# ---------------- +# Check that it performs the correct actions: autoconf_ftnirp.c must +# be compiled, and must define HAVE_PRINTF, but not HAVE_AUTOCONF_FTNIRP +# FIXME: Maybe check the traces? +AT_SETUP([AC_REPLACE_FUNCS]) + +AT_DATA([config.in], +[@LIBOBJS@ +]) + +AT_CONFIGURE_AC( +[AC_CONFIG_FILES(config.libobjs:config.in) +AC_REPLACE_FUNCS(printf autoconf_ftnirp)]) + +AT_CHECK_AUTOCONF([-W obsolete]) +AT_CHECK_AUTOHEADER +AT_CHECK_CONFIGURE +AT_CHECK_ENV +AT_CHECK_DEFINES( +[/* #undef HAVE_AUTOCONF_FTNIRP */ +#define HAVE_PRINTF 1 +]) + +AT_CHECK([sed 's/ */ /g;s/^ //;s/ $//' config.libobjs], [], + [autoconf_ftnirp.o +]) + +AT_CLEANUP([config.libobjs]) + + +# AC_CHECK_HEADERS +# ---------------- +# Check that it performs the correct actions: +# Must define HAVE_STDIO_H, but not HAVE_AUTOCONF_IO_H. +AT_CHECK_MACRO([AC_CHECK_HEADERS], +[AC_CHECK_HEADERS(stdio.h autoconf_io.h)], +[AT_CHECK_DEFINES( +[/* #undef HAVE_AUTOCONF_IO_H */ +#define HAVE_STDIO_H 1 +])]) + + +# AC_CHECK_MEMBERS +# ---------------- +# Check that it performs the correct actions. +# Must define HAVE_STRUCT_YES_S_YES, but not HAVE_STRUCT_YES_S_NO. +AT_CHECK_MACRO([AC_CHECK_MEMBERS], +[[AC_CHECK_MEMBERS([struct yes_s.yes, struct yes_s.no],,, + [struct yes_s { int yes ;} ;])]], +[AT_CHECK_DEFINES( +[/* #undef HAVE_STRUCT_YES_S_NO */ +#define HAVE_STRUCT_YES_S_YES 1 +])]) + + +# AC_CHECK_SIZEOF +# --------------- +AT_CHECK_MACRO([AC_CHECK_SIZEOF], +[[AC_CHECK_SIZEOF(char) +AC_CHECK_SIZEOF(charchar,, +[[#include <stdio.h> +typedef char charchar[2];]]) +AC_CHECK_SIZEOF(charcharchar) + +# Exercise the code used when cross-compiling +cross_compiling=yes +AC_CHECK_SIZEOF(unsigned char) +AC_CHECK_SIZEOF(ucharchar,, +[[#include <stdio.h> +typedef unsigned char ucharchar[2];]]) +AC_CHECK_SIZEOF(ucharcharchar)]], +[AT_CHECK_DEFINES( +[#define SIZEOF_CHAR 1 +#define SIZEOF_CHARCHAR 2 +#define SIZEOF_CHARCHARCHAR 0 +#define SIZEOF_UCHARCHAR 2 +#define SIZEOF_UCHARCHARCHAR 0 +#define SIZEOF_UNSIGNED_CHAR 1 +])]) + + +# AC_CHECK_TYPES +# -------------- +# Check that it performs the correct actions. +# Must define HAVE_STRUCT_YES_S, HAVE_INT, but not HAVE_STRUCT_NO_S. +# `int' and `struct yes_s' are both checked to test both the compiler +# builtin types, and defined types. +AT_CHECK_MACRO([AC_CHECK_TYPES], +[[AC_CHECK_TYPES([int, struct yes_s, struct no_s],,, + [struct yes_s { int yes ;} ;])]], +[AT_CHECK_DEFINES( +[#define HAVE_INT 1 +/* #undef HAVE_STRUCT_NO_S */ +#define HAVE_STRUCT_YES_S 1 +])]) + + +# AC_CHECK_TYPES +# -------------- +# Check that we properly dispatch properly to the old implementation +# or to the new one. +AT_SETUP([AC_CHECK_TYPES: backward compatibility]) + +AT_DATA(configure.ac, +[[AC_INIT +define([_AC_CHECK_TYPE_NEW], [NEW]) +define([_AC_CHECK_TYPE_OLD], [OLD]) +#(cut-from-here +AC_CHECK_TYPE(ptrdiff_t) +AC_CHECK_TYPE(ptrdiff_t, int) +AC_CHECK_TYPE(quad, long long) +AC_CHECK_TYPE(table_42, [int[42]]) +# Nice machine! +AC_CHECK_TYPE(uint8_t, uint65536_t) +AC_CHECK_TYPE(a,b,c,d) +#to-here) +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF +AT_CHECK([[sed -e '/^#(cut-from-here/,/^#to-here)/!d' -e '/^#/d' configure]], + 0, + [NEW +OLD +OLD +OLD +OLD +NEW +]) + +AT_CLEANUP + + +# AC_CHECK_FILES +# -------------- +# FIXME: To really test HAVE_AC_EXISTS2 and HAVE_AC_MISSING2 we need to +# open AH_TEMPLATE to `configure.ac', which is not yet the case. +AT_CHECK_MACRO([AC_CHECK_FILES], +[touch at-exists1 at-exists2 +ac_exists2=at-exists2 +ac_missing2=at-missing2 +AC_CHECK_FILES(at-exists1 at-missing1 $ac_exists2 $ac_missing2) +rm at-exists1 at-exists2], +[AT_CHECK_DEFINES( +[#define HAVE_AT_EXISTS1 1 +/* #undef HAVE_AT_MISSING1 */ +])]) + + + +## ------------------------------ ## +## AC_CHECK_PROG & AC_PATH_PROG. ## +## ------------------------------ ## + + +# AT_CHECK_PROGS_PREPARE +# ---------------------- +# Create a sub directory `path' with 6 subdirs which all 7 contain +# an executable `tool'. `6' contains a `better' tool. +m4_define([AT_CHECK_PROGS_PREPARE], +[mkdir path + +cat >path/tool <<\EOF +#! /bin/sh +exit 0 +EOF +chmod +x path/tool + +for i in 1 2 3 4 5 6 +do + mkdir path/$i + cp path/tool path/$i +done +cp path/tool path/6/better]) + + +# -------------------------------- # +# AC_CHECK_PROG & AC_CHECK_PROGS. # +# -------------------------------- # + +AT_SETUP([AC_CHECK_PROG & AC_CHECK_PROGS]) + +AT_CHECK_PROGS_PREPARE + +AT_DATA(configure.ac, +[[AC_INIT +pwd=`pwd` +p="1${ac_path_separator}2${ac_path_separator}3${ac_path_separator}4${ac_path_separator}5${ac_path_separator}6" +path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'` +fail=false + +AC_CHECK_PROG(TOOL1, tool, found, not-found, $path) +test "$TOOL1" = found || fail=: + +# Yes, the semantics of this macro is weird. +AC_CHECK_PROG(TOOL2, tool,, not-found, $path) +test "$TOOL2" = not-found || fail=: + +AC_CHECK_PROG(TOOL3, tool, tool, not-found, $path, $pwd/path/1/tool) +test "$TOOL3" = $pwd/path/2/tool || fail=: + +AC_CHECK_PROG(TOOL4, better, better, not-found, $path, $pwd/path/1/tool) +test "$TOOL4" = better || fail=: + +# When a tool is not found, and no value is given for not-found, +# the variable is left empty. +AC_CHECK_PROGS(TOOL5, missing,, $path) +test -z "$TOOL5" || fail=: + +AC_CHECK_PROGS(TOOL6, missing tool better,, $path) +test "$TOOL6" = tool || fail=: + +# No AC-OUTPUT, we don't need config.status. +$fail && + AC_MSG_ERROR([[CHECK_PROG failed]]) +AS_EXIT(0) +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE + +AT_CLEANUP(path) + + +# ------------------------------ # +# AC_PATH_PROG & AC_PATH_PROGS. # +# ------------------------------ # + +AT_SETUP(AC_PATH_PROG & AC_PATH_PROGS) + +AT_CHECK_PROGS_PREPARE + +AT_DATA(configure.ac, +[[AC_INIT +pwd=`pwd` +p="1${ac_path_separator}2${ac_path_separator}3${ac_path_separator}4${ac_path_separator}5${ac_path_separator}6" +path=`echo $p | sed -e 's,\([[0-9]]\),'"$pwd"'/path/\1,g'` +fail=false + +AC_PATH_PROG(TOOL1, tool, not-found, $path) +test "$TOOL1" = $pwd/path/1/tool || fail=: + +AC_PATH_PROG(TOOL2, better, not-found, $path) +test "$TOOL2" = $pwd/path/6/better || fail=: + +# When a tool is not found, and no value is given for not-found, +# the variable is left empty. +AC_PATH_PROGS(TOOL3, missing,, $path) +test -z "$TOOL3" || fail=: + +AC_PATH_PROGS(TOOL4, missing tool better,, $path) +test "$TOOL4" = $pwd/path/1/tool || fail=: + +# No AC-OUTPUT, we don't need config.status. +$fail && + AC_MSG_ERROR([[PATH_PROG failed]]) +AS_EXIT(0) +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE + +AT_CLEANUP(path) + + + + +## -------------- ## +## AC_PATH_XTRA. ## +## -------------- ## + + +AT_SETUP([AC_PATH_XTRA]) + +_AT_CHECK_AC_MACRO([AC_PATH_XTRA]) + +# Check X_DISPLAY_MISSING. +AT_CHECK_CONFIGURE([--without-x]) +AT_CHECK_DEFINES( +[#define X_DISPLAY_MISSING 1 +]) + +AT_CLEANUP + + +## ------------------------------- ## +## Obsolete non-updatable macros. ## +## ------------------------------- ## + + +AT_CHECK_MACRO([AC_SYS_RESTARTABLE_SYSCALLS], , ,[-W no-obsolete]) +AT_CHECK_MACRO([AC_FUNC_WAIT3], , ,[-W no-obsolete]) diff --git a/tests/suite.at b/tests/suite.at new file mode 100644 index 0000000..88f64fa --- /dev/null +++ b/tests/suite.at @@ -0,0 +1,53 @@ +# Validation suite for Autoconf -*- Autoconf -*- +# Copyright 2010 Thomas E. Dickey +# Copyright 2000 Free Software Foundation, Inc. + +# Still many parts of `autoconf' are not exercised by the test suite. A few +# FIXME's, below, are used to list tests that we would need. Do you feel +# like contributing new tests? If you do, you may tell your intent to +# `autoconf@gnu.org', so no two people work at the same thing. + +AT_INIT([autoconf]) + +AT_BANNER( +[Some tests might be skipped if you don't have the software which the +macros check (e.g., a Fortran compiler).]) + +# Run the tests from the lowest level to the highest level, and from +# the most selective to the easiest. + +# The executables. +# Even the tests on M4sugar and M4sh use `autoconf', so check it first. +m4_include([tools.at]) + +# M4sugar. +m4_include([m4sugar.at]) + +# M4sh.m4. +m4_include([m4sh.at]) + +# Autoconf base macros. +m4_include([base.at]) + +# Testing config.status +# --------------------- +# Actually should be named config.status.at but I fear problems with +# the name. Does no `checking...' at all, but exercises only code +# which following section use too. Hence, run it first. +m4_include([torture.at]) + +# Checking AC_PROG_CC, AC_COMPILE_IFELSE etc. +m4_include([compile.at]) + +# Checking that AC_CHECK_FOO macros work properly. +m4_include([semantics.at]) + +# Blind testing the macros. +# Include them as is suggested for a `configure.ac', as looking for +# for types requires looking for headers etc. +m4_include([acgeneral.at]) +m4_include([acspecific.at]) +m4_include([aclang.at]) +m4_include([acheaders.at]) +m4_include([actypes.at]) +m4_include([acfunctions.at]) diff --git a/tests/tools.at b/tests/tools.at new file mode 100644 index 0000000..7c953b2 --- /dev/null +++ b/tests/tools.at @@ -0,0 +1,490 @@ +# -*- autoconf -*- + +AT_BANNER([Executables (autoheader, autoupdate...).]) + +## -------------------------------------------------------- ## +## Check that the shell scripts are syntactically correct. ## +## -------------------------------------------------------- ## + +# We use `/bin/sh -n script' to check that there are no syntax errors +# in the scripts. Although incredible, there are /bin/sh that go into +# endless loops with `-n', e.g., SunOS's: +# +# $ uname -a +# SunOS ondine 4.1.3 2 sun4m unknown +# $ cat endless.sh +# while false +# do +# : +# done +# exit 0 +# $ time sh endless.sh +# sh endless.sh 0,02s user 0,03s system 78% cpu 0,064 total +# $ time sh -nx endless.sh +# ^Csh -nx endless.sh 3,67s user 0,03s system 63% cpu 5,868 total +# +# So before using `/bin/sh -n' to check our scripts, we first check +# that `/bin/sh -n' is not broken to death. + +AT_SETUP([Syntax of the scripts]) + +# A script that never returns. We don't care that it never returns, +# broken /bin/sh loop equally with `false', but it makes it easier to +# test the robusteness in a good environment: just remove the `-n'. +AT_DATA(endless.sh, +[[while : +do + : +done +]]) + +# A script in charge of testing `/bin/sh -n'. +AT_DATA(syntax.sh, +[[(/bin/sh -n endless.sh) & +sleep 2 +if kill $! >/dev/null 2>&1; then + # We managed to kill the child, which means that we probably + # can't trust `/bin/sh -n', hence the test failed. + exit 77 +fi +]]) + +# If we can't trust sh, just skip. +AT_CHECK([/bin/sh ./syntax.sh]) + +# Specify the path to the tool, some shells don't honor PATH when +# running `sh PROG'. + +AT_CHECK([/bin/sh -n ../autoconf], 0) +AT_CHECK([/bin/sh -n ../autoreconf], 0) +AT_CHECK([/bin/sh -n ../ifnames], 0) + +# These are not built, they are in the src tree. +AT_CHECK([/bin/sh -n $top_srcdir/config/install-sh], 0) +AT_CHECK([/bin/sh -n $top_srcdir/config/missing], 0) + +AT_CLEANUP + + + + +## ----------------- ## +## AWK portability. ## +## ----------------- ## + +AT_SETUP([AWK portability]) + +AT_DATA([configure.ac], +[]) + +# Skip if we don't have GNU Awk. +AT_CHECK([gawk --version || exit 77], 0, ignore, ignore) + +# Generation of the script. +AT_CHECK([AWK='gawk --posix' autoconf --autoconf-dir .. -l $at_srcdir], 0, + [], []) +# Tracing. +AT_CHECK([AWK='gawk --posix' autoconf --autoconf-dir .. -l $at_srcdir -t AC_INIT], 0, + ignore, []) +# Syntax correctness of ifnames. +AT_CHECK([AWK='gawk --posix' ifnames /dev/null], 0, + [], []) + +AT_CLEANUP(configure) + + + + + + +## ------------------ ## +## autoconf --trace. ## +## ------------------ ## + + +# autoconf --trace: user macros +# ----------------------------- +AT_SETUP([autoconf --trace: user macros]) + +AT_DATA(configure.ac, +[[m4_define([active], [ACTIVE]) +m4_define([TRACE1], [TRACE2(m4_shift($@))]) +m4_define([TRACE2], [[$2], $1]) +TRACE1(foo, bar, baz) +TRACE1(foo, TRACE1(bar, baz)) +TRACE1(foo, active, baz) +TRACE1(foo, [active], TRACE1(active, [active])) +]]) + +# Several --traces. +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -t TRACE1 -t TRACE2], 0, +[[configure.ac:4:TRACE1:foo:bar:baz +configure.ac:4:TRACE2:bar:baz +configure.ac:5:TRACE1:bar:baz +configure.ac:5:TRACE2:baz +configure.ac:5:TRACE1:foo::baz +configure.ac:5:TRACE2::baz +configure.ac:6:TRACE1:foo:ACTIVE:baz +configure.ac:6:TRACE2:ACTIVE:baz +configure.ac:7:TRACE1:ACTIVE:active +configure.ac:7:TRACE2:active +configure.ac:7:TRACE1:foo:active::ACTIVE +configure.ac:7:TRACE2:active::ACTIVE +]]) + +# Several line requests. +AT_CHECK([[autoconf --autoconf-dir .. -l $at_srcdir -t TRACE1:' +[$1], [$2], [$3].']], 0, +[[ +[foo], [bar], [baz]. + +[bar], [baz], []. + +[foo], [], [baz]. + +[foo], [ACTIVE], [baz]. + +[ACTIVE], [active], []. + +[foo], [active], []. +]]) + +# ${sep}@. +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir -t TRACE2:'${)===(}@'], 0, +[[[bar])===([baz] +[baz] +[])===([baz] +[ACTIVE])===([baz] +[active] +[active])===([])===([ACTIVE] +]]) + +AT_CLEANUP + + +# autoconf --trace: builtins +# -------------------------- +AT_SETUP([autoconf --trace: builtins]) + +AT_DATA(configure.ac, +[[define([active], [ACTIVE]) +]]) + +AT_CHECK([[autoconf --autoconf-dir .. -l $at_srcdir -t define | + sed -n '$p']], + 0, +[[configure.ac:1:define:active:ACTIVE +]]) + +# FIXME: Without `$1' the following test dies. Groumphf, once again to +# dive into obscure feature interaction... +# Note that using `-i' means we need the *.m4 files, not the *.m4f files, +# hence we need srcdir, not builddir. +AT_CHECK([[autoconf --autoconf-dir $top_srcdir -l $at_srcdir -t define:'$1' -i| + sed -n '$p']], + 0, +[[active +]]) + +AT_CLEANUP + + + + +## ---------------------------- ## +## autoconf: forbidden tokens. ## +## ---------------------------- ## + +# autoconf: forbidden tokens, basic +# --------------------------------- +AT_SETUP([autoconf: forbidden tokens, basic]) + +AT_DATA([configure.ac], +[[AC_PLAIN_SCRIPT()dnl +AC_FOO +_AC_BAR +m4_foo +_m4_bar +BAC_FOO +B_AC_FOO +AS_FOO +_AS_BAR +]]) + +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 1, [], [stderr]) +# The output of autoconf is not deterministic here because it +# uses `for (ind in array)'. So be sure to have a unique representation. +AT_CHECK([sort stderr], 0, +[[configure.ac:2: error: possibly undefined macro: AC_FOO +configure.ac:3: error: possibly undefined macro: _AC_BAR +configure.ac:4: error: possibly undefined macro: m4_foo +configure.ac:7: error: possibly undefined macro: B_AC_FOO +configure.ac:8: error: possibly undefined macro: AS_FOO +configure.ac:9: error: possibly undefined macro: _AS_BAR +]]) + +AT_CLEANUP(configure) + + +# autoconf: forbidden tokens, exceptions +# -------------------------------------- +AT_SETUP([autoconf: forbidden tokens, exceptions]) + +AT_DATA([configure.ac], +[[AC_PLAIN_SCRIPT()dnl + +# This is allowed in spite of the name. +# It is on purpose that we check the case where there are several +# tokens on the same line. +m4_pattern_allow([^AC_ALLOWED$]) +NOT_AC_ALLOWED AC_ALLOWED AC_ALLOWED_NOT + +# Test forbidding. +m4_pattern_forbid([^FORBIDDEN$]) +NOT_FORBIDDEN FORBIDDEN FORBIDDEN_NOT + +# Test Autoconf's patterns. +AC_THIS_IS_INVALID and _AC_THIS_IS_INVALID_TOO +BUT_AZ_THIS_IS_NOT ALTHOUGH_AC_THIS_IS +# This is legal, although there is `AC_DEFINE' in there. +BAC_DEFINE +# AC_THIS_IS_A_COMMENT so just shut up. +It would be very bad if Autoconf forgot to expand [AC_]OUTPUT! +]]) + +AT_CHECK([autoconf --autoconf-dir .. -l $at_srcdir], 1, [], [stderr]) +# The output of autoconf is not deterministic here because it +# uses `for (ind in array)'. So be sure to have a unique representation. +AT_CHECK([sort stderr], 0, +[[configure.ac:10: error: possibly undefined macro: FORBIDDEN +configure.ac:14: error: possibly undefined macro: AC_THIS_IS_INVALID +configure.ac:14: error: possibly undefined macro: _AC_THIS_IS_INVALID_TOO +configure.ac:15: error: possibly undefined macro: ALTHOUGH_AC_THIS_IS +configure.ac:7: error: possibly undefined macro: AC_ALLOWED_NOT +configure.ac:7: error: possibly undefined macro: NOT_AC_ALLOWED +configure:18: error: possibly undefined macro: AC_OUTPUT +]]) + +AT_CLEANUP(configure err) + + + + + +## --------- ## +## ifnames. ## +## --------- ## + +AT_SETUP([ifnames]) + +AT_DATA([iftest1.c], +[[#ifdef DEF1 +#ifndef DEF2 +#if !defined(DEF3) && defined(DEF4) /* but not defined(DEF5) */ + # if SPACES + # if TABS +/* #if C_COMMENTS */ +// #if CXX_COMMENTS +#if LINE1 = \ +LINE2 +#if (VAL1*VAL2)==VAL3+VAL4 /* Not VAL5 !!! */ +]]) + +AT_DATA([iftest2.c], +[[#ifdef IFTEST2 +#if VAL1 +]]) + +AT_CHECK([ifnames iftest1.c iftest2.c], 0, +[DEF1 iftest1.c +DEF2 iftest1.c +DEF3 iftest1.c +DEF4 iftest1.c +IFTEST2 iftest2.c +LINE1 iftest1.c +LINE2 iftest1.c +SPACES iftest1.c +TABS iftest1.c +VAL1 iftest1.c iftest2.c +VAL2 iftest1.c +VAL3 iftest1.c +VAL4 iftest1.c +], []) + +AT_CLEANUP + + + +## ------------ ## +## autoheader. ## +## ------------ ## + +# autoheader is intensively used in its modern form through this +# test suite. But we also have to check that acconfig.h still works. +# autoheader uses autoconf --trace, so traces first. + +AT_SETUP([autoheader]) + +AT_DATA(acconfig.h, +[[/* Define this to whatever you want. */ +#undef this +]]) + + +# 1. Check that `acconfig.h' is still honored. +AT_DATA(configure.ac, +[[AC_INIT +AC_CONFIG_HEADERS(config.h) +AC_DEFINE(this, "whatever you want.") +]]) + +AT_CHECK([autoheader --autoconf-dir .. -<configure.ac], 0, +[[/* config.h.in. Generated automatically from - by autoheader. */ +/* Define this to whatever you want. */ +#undef this +]], ignore) + + +# 2. Check that missing templates are a fatal error. +AT_DATA(configure.ac, +[[AC_INIT +AC_CONFIG_HEADERS(config.h) +AC_DEFINE(that, "whatever you want.") +]]) + +AT_CHECK([autoheader --autoconf-dir .. -<configure.ac], 1, [], +[autoheader: No template for symbol `that' +]) + + +# 3. Check TOP and BOTTOM. +AT_DATA(acconfig.h, +[[/* Top from acconfig.h. */ +@TOP@ +/* Middle from acconfig.h. */ +@BOTTOM@ +/* Bottom from acconfig.h. */ +]]) + +AT_DATA(configure.ac, +[[AC_INIT +AC_CONFIG_HEADERS(config.h) +AH_TOP([Top1 from configure.ac.]) +AH_TOP([Top2 from configure.ac.]) +AH_VERBATIM([Middle], [Middle from configure.ac.]) +AH_BOTTOM([Bottom1 from configure.ac.]) +AH_BOTTOM([Bottom2 from configure.ac.]) +]]) + + +# Yes, that's right: the `middle' part of `acconfig.h' is still before +# the AH_TOP part. But so what, you're not supposed to use the two +# together. +AT_CHECK([autoheader --autoconf-dir .. -<configure.ac], 0, +[[/* config.h.in. Generated automatically from - by autoheader. */ +/* Top from acconfig.h. */ + +/* Middle from acconfig.h. */ + +Top1 from configure.ac. + +Top2 from configure.ac. + +Middle from configure.ac. + +Bottom1 from configure.ac. + +Bottom2 from configure.ac. +/* Bottom from acconfig.h. */ +]], []) + + +AT_CLEANUP + + + + +## ------------ ## +## autoupdate. ## +## ------------ ## + +# Check that AC_CANONICAL_SYSTEM and AC_OUTPUT are properly updated. +AT_SETUP([autoupdate]) + +AT_DATA(configure.ac, +[[AC_INIT(Test, 1.0) +AC_CANONICAL_SYSTEM +dnl The doc says 27 is a valid fubar. +fubar=27 +AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar) +]]) + +AT_DATA([expout], +[[AC_INIT([Test],[1.0]) +AC_CANONICAL_TARGET([]) +dnl The doc says 27 is a valid fubar. +fubar=27 +AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar) +]]) + +# Checking `autoupdate'. +AT_CHECK_AUTOUPDATE +AT_CHECK([cat configure.ac], 0, [expout]) +# Checking that `autoupdate' is idempotent +AT_CHECK([autoupdate --autoconf-dir $top_srcdir], 0, [], + [autoupdate: `configure.ac' is unchanged +]) +AT_CHECK([cat configure.ac], 0, [expout]) + +AT_CLEANUP(configure.ac~) + + +# autoupdating AC_LINK_FILES +# -------------------------- +AT_SETUP([autoupdating AC_LINK_FILES]) + +AT_DATA(configure.ac, +[[AC_INIT +AC_LINK_FILES(dst1 dst2, src1 src2) +AC_OUTPUT +]]) + +AT_DATA(dst1, dst1 +) +AT_DATA(dst2, dst2 +) + +# Checking `autoupdate'. +AT_CHECK_AUTOUPDATE +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE +AT_CHECK([cat src1], 0, [dst1 +]) +AT_CHECK([cat src2], 0, [dst2 +]) + +AT_CLEANUP(src1 src2 configure.ac~) + + +# autoupdating AC_PREREQ +# ---------------------- +AT_SETUP([autoupdating AC_PREREQ]) + +cat >expout <<EOF +AC_PREREQ($at_version) +EOF + +AT_CHECK([autoupdate --version || exit 77], ignore, ignore, ignore) +AT_CHECK([echo "AC_PREREQ(1.0)" | + autoupdate --autoconf-dir $top_srcdir -], + 0, [expout], []) + +AT_CHECK([echo "AC_PREREQ($at_version)" | + autoupdate --autoconf-dir $top_srcdir -], + 0, [expout], []) + +AT_CHECK([echo "AC_PREREQ(999.99)" | + autoupdate --autoconf-dir $top_srcdir -], + 1, [], [ignore]) + +AT_CLEANUP diff --git a/tests/torture.at b/tests/torture.at new file mode 100644 index 0000000..786efd0 --- /dev/null +++ b/tests/torture.at @@ -0,0 +1,478 @@ +# -*- autoconf -*- + +AT_BANNER([[Testing config.status. + +## ---------------------------------------------------------------- ## +## This section of torture tests is trying to make Autoconf produce ## +## failing `configure' scripts, which must never happen. If one of ## +## these tests ever fails, it is extremely important that you ## +## report the failure to dickey@invisible-island.net. ## +## ---------------------------------------------------------------- ##]]) + + +## ------------ ## +## AC_ARG_VAR. ## +## ------------ ## + +# AT_CHECK_AC_ARG_VAR(FIRST-VALUE, SECOND-VALUE) +# ---------------------------------------------- +# Check that AC_ARG_VAR caches the latest values, diagnoses +# inconsistances, and arms config.status. +m4_define([AT_CHECK_AC_ARG_VAR], +[rm -f config.cache + +# Initial value. +m4_ifval([$1], + [precious='$1'; export precious], + [unset precious]) +AT_CHECK_CONFIGURE([--config-cache]) +AT_CHECK([cat file], [], [`$1' +]) + +# Testing --recheck. +unset precious +AT_CHECK([./config.status --recheck], [], [ignore]) +AT_CHECK([./config.status], [], [ignore]) +AT_CHECK([cat file], [], [`$1' +]) + +# Second value. +m4_ifval([$2], + [precious='$2'; export precious], + [unset precious]) +AT_CHECK_CONFIGURE([--config-cache], [1], [], [ignore]) + +])# AT_CHECK_AC_ARG_VAR + + +AT_SETUP([AC_ARG_VAR]) + +# We don't want to run this test if this shell doesn't support +# `unset'. +AT_CHECK([ +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + exit 0 +else + exit 77 +fi +]) + +AT_DATA([configure.ac], +[[AC_INIT +AC_ARG_VAR([precious], [this variable costs a lot]) +AC_OUTPUT(file) +]]) + +AT_DATA([file.in], +[[`@precious@' +]]) + +AT_CHECK_AUTOCONF + +# Set a precious variable +AT_CHECK_AC_ARG_VAR([], [apple of my eye]) + +# Unset a precious variable +AT_CHECK_AC_ARG_VAR([apple of my eye], []) + +# Change a precious variable +AT_CHECK_AC_ARG_VAR([apple of my eye], [orange of my eye]) + +AT_CLEANUP + + + + +## ---------------------------------------------- ## +## AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS. ## +## ---------------------------------------------- ## + +AT_SETUP([AC_CONFIG_FILES, HEADERS, LINKS and COMMANDS]) + +AT_DATA(configure.ac, +[[AC_INIT +rm -rf header var-header file var-file link var-link command var-command +echo 'OK' >input + +# Be sure to also stress the associated INIT-CMDS. +case $what_to_test in + header) + AC_CONFIG_HEADERS(header:input);; + var-header) + AC_CONFIG_HEADERS(var-header:$header_in, [], [header_in=input]);; + + file) + AC_CONFIG_FILES(file:input);; + var-file) + AC_CONFIG_FILES(var-file:$file_in, [], [file_in=input]);; + + command) + AC_CONFIG_COMMANDS(command:input, + [cp input command]);; + var-command) + AC_CONFIG_COMMANDS(var-command:$command_in, + [cp $command_in var-command], [command_in=input]);; + + link) + AC_CONFIG_LINKS(link:input);; + var-link) + AC_CONFIG_LINKS(var-link:$link_in, [], [link_in=input]);; +esac +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF + + +# AT_CHECK_CONFIG_CREATION(THING = (header | link | file | command)) +# ------------------------------------------------------------------ +# Check that THING and var-THING (which uses variables in AC_CONFIG_THING) +# are properly created, with the right content. +# Use `grep OK' instead of a simple `cat' to avoid banners such as in +# AC_CONFIG_HEADERS. +m4_define([AT_CHECK_CONFIG_CREATION], +[AT_CHECK_CONFIGURE([what_to_test=$1]) +AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null], + [ignore], [$1 +]) +AT_CHECK([grep OK $1], [], [OK +]) + +AT_CHECK_CONFIGURE([what_to_test=var-$1 --no-create]) +# config.status might be stupidly expecting data on stdin, if it's +# really broken... +AT_CHECK([./config.status var-$1 </dev/null], [], [ignore]) +AT_CHECK([ls header var-header file var-file command var-command link var-link 2>/dev/null], + [ignore], [var-$1 +]) +AT_CHECK([grep OK var-$1], [], [OK +]) +])# AT_CHECK_CONFIG_CREATION + + +# Create a file +AT_CHECK_CONFIG_CREATION(file) + +# Create a header +AT_CHECK_CONFIG_CREATION(header) + +# Execute a command +AT_CHECK_CONFIG_CREATION(command) + +# Create a link +AT_CHECK_CONFIG_CREATION(link) + +AT_CLEANUP(header file link commandvar-header var-file var-link var-command + input) + + + +## ------------------- ## +## Missing templates. ## +## ------------------- ## + +# Check that config.status detects missing input files +AT_SETUP([Missing templates]) + +AT_DATA(configure.ac, +[[AC_INIT +AC_CONFIG_FILES([nonexistent]) +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([], [1], [], +[[config.status: error: cannot find input file: nonexistent.in +]]) +# Make sure that the output file doesn't exist +AT_CHECK([test -f nonexistent], 1) + +AT_CLEANUP + + + + +## ---------------------- ## +## configure invocation. ## +## ---------------------- ## + +# Check that `configure' and `config.status' honor their interface. +# +# We run `./configure one=val1 --enable-two=val2 --with-three=val3' +# and verify that (i) `configure' correctly receives the arguments and +# (ii) correctly passes them to `config.status', which we check by +# running `config.status --recheck'. + +AT_SETUP([configure invocation]) + +AT_DATA(configure.ac, +[[AC_INIT +echo "result=$one$enable_two$with_three" +AC_OUTPUT +]]) + +AT_CHECK_AUTOCONF + +AT_CHECK_CONFIGURE([one=one --enable-two=two --with-three=three | + sed -n -e 's/^result=//p'], 0, + [onetwothree +]) +AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0, + [onetwothree +]) + +AT_CHECK_CONFIGURE([one="\"'$ " --enable-two="\" ' $" --with-three=" \"'$"| + sed -n -e 's/^result=//p'], 0, + ["'$ " ' $ "'$ +]) +AT_CHECK([./config.status --recheck | sed -n 's/^result=//p'], 0, + ["'$ " ' $ "'$ +]) + +AT_CLEANUP(configure config.status config.log config.cache) + + + +## -------------------------------------------- ## +## Check that `#define' templates are honored. ## +## -------------------------------------------- ## + +# Use various forms of `#define' templates, and make sure there are no +# problems when a symbol is prefix of another. + +AT_SETUP([#define header templates]) + +AT_DATA([configure.ac], +[[AC_INIT +AC_CONFIG_HEADERS(config.h:config.hin) + +# I18n of dummy variables: their French translations. +AC_DEFINE(foo, toto) +AC_DEFINE(bar, tata) +AC_DEFINE(baz, titi) +AC_DEFINE(fubar, tutu) + +# Symbols which are prefixes of another. +AC_DEFINE(a, A) +AC_DEFINE(aaa, AAA) +AC_DEFINE(aa, AA) +AC_CONFIG_FILES(defs) + +# Things included in confdefs.h, but which make no sense in +# config.h, nor in $DEFS. +cat <<\EOF >>confdefs.h +/* Hi Mum! Look, I'm doing C++! */ +#ifdef __cplusplus +void exit (int status); +#endif +EOF + +# In addition of config.h output a full DEFS +AC_OUTPUT_MAKE_DEFS +DEFS_SAVED=$DEFS +AC_SUBST(DEFS_SAVED) +AC_OUTPUT +]]) + +AT_DATA([defs.in], +[[@DEFS_SAVED@ +]]) + +AT_DATA([config.hin], +[[#define foo 0 +# define bar bar +# define baz "Archimedes was sinking in his baz" +# define fubar tutu +#define a B +#define aa BB +#define aaa BBB +#undef a +#undef aa +#undef aaa +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE + +AT_DATA([expout], +[[/* config.h. Generated automatically by configure. */ +#define foo toto +# define bar tata +# define baz titi +# define fubar tutu +#define a A +#define aa AA +#define aaa AAA +#define a A +#define aa AA +#define aaa AAA +]]) +AT_CHECK([cat config.h], 0, expout) + +# Check the value of DEFS. Note the leading space. +AT_DATA([expout], +[[-Dfoo=toto -Dbar=tata -Dbaz=titi -Dfubar=tutu -Da=A -Daaa=AAA -Daa=AA] +]) + +# Because we strip trailing spaces in `testsuite' we can't leave one in +# expout, hence nuke the one left by AC_OUTPUT_MAKE_DEFS. +AT_CHECK([sed -e 's/ $//' defs], 0, expout) + +AT_CLEANUP + + + +## ------------------------- ## +## Torturing config.status. ## +## ------------------------- ## + +## Require 100 AC_DEFINE and AC_SUBST with a significantly big value. +## This is mostly to check that Autoconf produces portable sed scripts +## in config.status. sed is used to skip the first two lines +## `Generated by...'. + +AT_SETUP([Torturing config.status]) + +dnl The value used as a big value for AC_DEFINE. +dnl Don't use sh active chars here, below it is also used in a sh +dnl assignment. +m4_define([AT_BIG_VALUE], +[This value should be long enough to torture the various limits of sed and other tools used by Autoconf.]) + +m4_define([AT_DESCRIPTION], +[Define to a long string if your `Autoconf' works properly.]) + + +# AT_DUMMY_VAR(NUMBER) +# -------------------- +# Build a name used for AC_SUBST and AC_DEFINE. Put ac_ in it +# so that the check for user name space invasion does not complain +# of the new variables defined. +# +# Note that you should not use the name ac_dummy, because it will be +# turned into ac_uummy during the construction of config.status. Yes, +# this is admittedly a bug, but it would be too hard to fix this. +# There is really no point in AC_DEFINE a var named ac_d.*. +m4_define([AT_DUMMY_VAR], +[ac_Dummy_[]m4_patsubst([000$1], [.*\(...\)$], [\1])]) + + + +AT_DATA([dummy.in], +[m4_for([AT_Count], 1, 100, 1, +[@AT_DUMMY_VAR(AT_Count)@ +])]) + + +# ------------ # +# configure.ac # +# ------------ # + +AT_DATA(configure.ac, +dnl The following lines transfer AT_DUMMY_VAR, AT_DESCRIPTION, and +dnl AT_BIG_VALUE into the configure.ac as AC_DUMMY_VAR etc. +[[m4_define([AC_DUMMY_VAR],] +m4_dquote(m4_defn([AT_DUMMY_VAR]))[)]] + +[[m4_define([AC_DESCRIPTION],] +m4_dquote(m4_defn([AT_DESCRIPTION]))[)]] + +[[m4_define([AC_BIG_VALUE],] +m4_dquote(m4_defn([AT_BIG_VALUE]))[)]] + +[[# AC_DEFUBST(NAME) +# ---------------- +# Related VALUE to NAME both with AC_SUBST and AC_DEFINE. This is +# used in the torture tests. +m4_defun([AC_DEFUBST], +[AC_DUMMY_VAR($1)="AC_BIG_VALUE" +AC_DEFINE_UNQUOTED(AC_DUMMY_VAR($1), "$AC_DUMMY_VAR($1)", + AC_DESCRIPTION) +AC_SUBST(AC_DUMMY_VAR($1))]) + +AC_INIT +AC_CONFIG_HEADERS(config.h:config.hin) +AC_CONFIG_FILES(dummy) +m4_for(AC_Count, 1, 100, 1, + [AC_DEFUBST(AC_Count)]) +AC_OUTPUT +]])# configure.ac + +AT_CHECK_AUTOCONF +AT_CHECK_AUTOHEADER +AT_CHECK_CONFIGURE + +# Checking that AC_DEFINE worked properly. +AT_DATA(expout, +[m4_for(AT_Count, 1, 100, 1, +[ +/* AT_DESCRIPTION */ +[#define] AT_DUMMY_VAR(AT_Count) "AT_BIG_VALUE" +])]) +AT_CHECK([sed -n '3,$ p' config.h], 0, expout) + +# Checking that AC_SUBST worked properly. +AT_DATA(expout, +[m4_for(AT_Count, 1, 100, 1, +[AT_BIG_VALUE +])]) + +AT_CLEANUP(dummy) + + +## -------- ## +## srcdir. ## +## -------- ## + +AT_SETUP([srcdir]) + +rm -rf at-dir +mkdir at-dir +: >at-dir/bar.in +: >foo.in + +AT_DATA([configure.ac], +[[AC_INIT + +AC_CONFIG_FILES([foo at-dir/bar]) + +AC_CONFIG_COMMANDS([report], +[test -f $srcdir/configure.ac || + AC_MSG_ERROR([cannot find $srcdir/configure.ac])], + [srcdir=$srcdir]) + +AC_OUTPUT +rm -rf foo at-dir/bar +]]) + +AT_CHECK_AUTOCONF + +# In place. +AT_CHECK([./configure], [], [ignore]) + +# Relative path. +AT_CHECK([cd at-dir && ../configure], [], [ignore]) + +# Absolute path. +at_here=`pwd` +AT_CHECK([cd at-dir && $at_here/configure], [], [ignore]) + +AT_CLEANUP(at-dir foo.in foo) + + +## ----------------- ## +## Signal handling. ## +## ----------------- ## + +AT_SETUP([Signal handling]) + +AT_DATA([configure.ac], +[[AC_INIT +kill -2 $$ +exit 77 +]]) + +AT_CHECK_AUTOCONF +AT_CHECK_CONFIGURE([], 1, ignore, ignore) + +AT_CLEANUP |