From 1ca270f548455bc00869759f592ab4cb9c3c01f3 Mon Sep 17 00:00:00 2001 From: Packit Date: Sep 17 2020 15:26:05 +0000 Subject: autoconf213-2.13 base --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..33e02f5 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,3 @@ +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. diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..a3f6b12 --- /dev/null +++ b/COPYING @@ -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. + + + Copyright (C) 19yy + + 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. + + , 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..1ef762c --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2377 @@ +1999-01-05 Ben Elliston + + * Version 2.13. + +1999-01-04 Ben Elliston + + * 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 + + * 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 + + * 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 + + * 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. + + * NEWS: Update. + + * configure: Rebuild. + +1998-12-26 Ben Elliston + + * 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 + + * 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 + + * acgeneral.m4 (AC_ACVERSION): Bump to 2.13. + + * autoconf.texi (EDITION): Likewise. + (VERSION): Likewise. + +1998-10-30 Jeff Garzik + + * 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 + + * 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 + + * acgeneral.m4 (AC_LANG_FORTRAN77): Remove [] (i.e. the m4 quotes) + since it was confusing the testsuite. Also make `f77' the default + for FC, otherwise the testsuite 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 + + * 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 + + * acgeneral.m4 (AC_LANG_RESTORE): Fix a typo spotted by Noah + Elliott . + +1998-10-09 Tom Tromey + + * Makefile.in (autoconf.m4f): New target. + (autoheader.m4f): Likewise. + +1998-10-08 Ben Elliston + + * acgeneral.m4 (AC_TRY_LINK_FUNC): Fix macro ordering. + +Sun Oct 4 21:57:20 1998 Tom Tromey + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * config.guess: Handle strange processor ID assignments on AIX + machines. Contributed by Didier Desseaux . + +Sat Sep 12 16:25:00 1998 Aaron Crane + + * 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 + + * 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 + + * 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 + + * acspecific.m4 (AC_EXEEXT): Correct setting of ac_exeext when + there is no extension. + +Mon Jun 1 12:30:39 1998 Ian Lance Taylor + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * Version 2.12. + +Wed Nov 20 13:00:21 1996 David J MacKenzie + + * 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 tom@vlsivie.tuwien.ac.AT (Thomas Winder). + * autoconf.sh, autoheader.sh: Likewise set LC_MESSAGES and LC_CTYPE. + +Tue Nov 19 10:29:06 1996 David J MacKenzie + + * 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 + + * Version 2.11. + +Sun Nov 17 20:12:05 1996 David J MacKenzie + + * acspecific.m4 (AC_FUNC_STRCOLL): Make the checking message more + accurate. + +Thu Nov 14 11:15:27 1996 David J MacKenzie + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * acgeneral.m4 (AC_CHECK_TYPE): Remove extra ')'. + + * Many files: Update the FSF street address. + +Sun Jun 9 17:54:23 1996 Roland McGrath + + * acgeneral.m4 (AC_CHECK_LIB): Add missing \ in last change. + +Fri Jun 7 11:54:58 1996 Roland McGrath + + * acgeneral.m4 (AC_CHECK_LIB): Identifierize lib name in $ac_tr_lib. + +Mon May 27 13:49:02 1996 Roland McGrath + + * 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 + + * 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 + + * acgeneral.m4: Version 2.10 released. + +Tue Mar 26 13:03:12 1996 Roland McGrath + + * acgeneral.m4 (AC_OUTPUT_HEADER): Make subdir if necessary. + +Thu Mar 21 10:52:03 1996 Roland McGrath + + * 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 + + * 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 + + * 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 + + * Version 2.9 released. + * acgeneral.m4 (AC_ACVERSION): Updated to 2.9. + +Wed Mar 13 12:49:51 1996 Roland McGrath + + * 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 + + * 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 + + * acgeneral.m4 (AC_INIT_NOTICE): Add 95 and 96 to copyright years. + +Sat Mar 9 18:28:42 1996 Roland McGrath + + * acgeneral.m4 (AC_CHECK_LIB): Add missing [. + +Fri Mar 8 15:06:48 1996 Roland McGrath + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * autoconf.sh: Ignore undefined macros in shell comments. + +Mon Dec 11 22:12:54 1995 Roland McGrath + + * 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 + + * autoconf.sh: Define $AWK from the subst @AWK@, and use it. + +Wed Nov 22 11:01:16 1995 David J. MacKenzie + + * 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 + + * 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 + + * 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 + + * 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 + + * 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 + + * autoconf.sh: Allow lowercase letters in the undefined-macro name. + +Fri Nov 17 15:05:44 1995 Roland McGrath + + * Version 2.5 released. + +Fri Nov 17 15:23:04 1995 David J. MacKenzie + + * 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 + + * acgeneral.m4 (AC_CHECK_PROG): Use arg 5 as search list, not arg 4. + +Wed Aug 30 17:34:48 1995 Roland McGrath + + * 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 + + * 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 + + * 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 + + * acgeneral.m4 (AC_CHECK_LIB): Translate + to p in lib name. + +Wed Jun 28 13:45:16 1995 David J. MacKenzie + + * 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 + + * acgeneral.m4 (AC_INIT_PARSE_ARGS, AC_INIT_PREPARE): Add options + --bindir, --libdir, etc. + +Mon Jun 26 20:54:36 1995 David J. MacKenzie + + * 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 + + * 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 + + * Version 2.4. + +Sun May 7 08:09:12 1995 David J. MacKenzie + + * 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 + + * 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 + + * 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 + + * 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 + + * Version 2.2. + +Wed Mar 8 12:44:34 1995 David J. MacKenzie + + * Makefile.in: Follow cd commands with &&, not ;. + From Franc,ois Pinard. + +Tue Mar 7 11:48:19 1995 David J. MacKenzie + + * acspecific.m4 (AC_FUNC_ALLOCA): Keep sh variable namespace clean. + Put newline after AC_DEFINE_UNQUOTED call to avoid Irix syntax error. + +Mon Mar 6 15:07:00 1995 David J. MacKenzie + + * 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 + + * 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 + + * 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 + + * 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 + + * Test release 2.1.2. + +Tue Feb 21 13:00:07 1995 David J. MacKenzie + + * 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 + + * 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 + + * 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 + + * 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 + + * acgeneral.m4 (AC_OUTPUT): Fix sed command to produce $ac_dots + for subdir configures. + +Thu Feb 9 14:42:20 1995 David J. MacKenzie + + * 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 + + * 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 + + * 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 + + * 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 + + * acspecific.m4 (AC_FUNC_GETLOADAVG): Use elf_begin in -lelf + check, not elf_read. + +Mon Nov 7 18:18:11 1994 Roland McGrath + + * acspecific.m4 (AC_PROG_MAKE_SET): Fix msg; $MAKE is not useful + Make syntax. + +Fri Nov 4 09:08:33 1994 David J. MacKenzie + + * Version 2.1. + + * autoreconf.sh: Add -f --force option. + From "Theodore Ts'o" . + +Thu Nov 3 10:24:08 1994 David J. MacKenzie + + * 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 + + * acspecific.m4 (AC_CHECK_HEADERS_DIRENT): Use define, not + AC_DEFUN, so the testsuite 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 + + * Version 2.0. + +Tue Oct 25 11:04:16 1994 David J. MacKenzie + + * 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 + + * Makefile.in (uninstall): Remove the transformed names. + (SCRIPTS): Rename from PROGS. + * configure.in: Likewise. + +Fri Oct 21 07:14:23 1994 David J. MacKenzie + + * 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 + + * 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 + + * ifnames.sh: Take comments out of sed script. + +Tue Oct 18 00:20:04 1994 David J. MacKenzie + + * 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 + + * 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 + + * Makefile.in: Set datadir to $(prefix)/share. + +Tue Sep 27 08:00:38 1994 David MacKenzie + + * 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 + + * 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 + + * autoconf.sh (tmpin): Always set. + +Wed Sep 21 13:12:10 1994 David MacKenzie + + * acgeneral.m4 (AC_INIT_PREPARE): Remove trailing slashes from + srcdir. + +Mon Sep 19 17:11:39 1994 David MacKenzie + + * 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 + + * 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 + + * 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__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): Namespace 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/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..5e2f017 --- /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 . + +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 . + +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" . + + * 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 + . + * 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 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 = ' + with `ccp = '; 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 + 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 . + +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 . + +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 . + +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 + 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 . + +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 . + +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/INSTALL b/INSTALL new file mode 100644 index 0000000..50dbe43 --- /dev/null +++ b/INSTALL @@ -0,0 +1,183 @@ +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, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + 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 at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' 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. + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + +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 supports 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. + +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'. + +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. + +Specifying the System Type +========================== + + There may be some features `configure' can not 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 can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +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 can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + +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. + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--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. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..a6c94d4 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,228 @@ +# Makefile for Autoconf. +# Copyright (C) 1992, 1993, 1994, 1998 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +#### Start of system configuration section. #### + +srcdir = @srcdir@ +VPATH = @srcdir@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +MAKEINFO = makeinfo +TEXI2DVI = texi2dvi +M4 = @M4@ +AWK = @AWK@ +PERL = @PERL@ + +# Programs that are ALWAYS installed (and are created in the build dir). +ASCRIPTS = autoconf autoheader autoreconf autoupdate ifnames + +# M4 input that is frozen. +M4FROZEN = autoconf.m4f autoheader.m4f + +# All programs, including those only installed if you have perl. +SCRIPTS = $(ASCRIPTS) @SCRIPTS@ + +transform=@program_transform_name@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +# Directory in which to install scripts. +bindir = @bindir@ + +# Directory in which to install library files. +datadir = @datadir@ +acdatadir = $(datadir)/autoconf + +# Directory in which to install documentation info files. +infodir = @infodir@ + +#### End of system configuration section. #### + +SHELL = @SHELL@ + +SUBDIRS = testsuite + +M4FILES = autoconf.m4 acgeneral.m4 acoldnames.m4 acspecific.m4 autoheader.m4 + +# Files that can be generated, but should be up to date for a distribution. +DISTDEP = info Makefile +# Files to distribute. +DISTFILES = AUTHORS COPYING ChangeLog ChangeLog.1 INSTALL \ + Makefile.in NEWS README TODO $(M4FILES) \ + acconfig.h acfunctions acheaders acidentifiers \ + acmakevars acprograms autoconf.info* \ + autoconf.sh autoconf.texi install.texi \ + autoheader.sh autoscan.pl autoreconf.sh autoupdate.sh ifnames.sh \ + config.guess config.sub configure configure.in \ + install-sh mkinstalldirs texinfo.tex \ + testsuite/Makefile.in testsuite/config/*.exp \ + testsuite/lib/*.exp testsuite/autoconf.[gs]/*.exp \ + standards.texi make-stds.texi standards.info* + +editsh = sed -e 's,@''datadir''@,$(acdatadir),g' -e \ + 's,@''M4''@,$(M4),g' -e 's,@''AWK''@,$(AWK),g' \ + -e 's,@''SHELL''@,$(SHELL),g' +editpl = sed -e 's,@''datadir''@,$(acdatadir),g' -e 's,@''PERL''@,$(PERL),g' + +all: ${SCRIPTS} ${M4FROZEN} info + +.SUFFIXES: +.SUFFIXES: .sh .pl .m4 .m4f + +.sh: + rm -f $@ $@.tmp + $(editsh) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@ + +.pl: + rm -f $@ $@.tmp + $(editpl) $< > $@.tmp && chmod +x $@.tmp && mv $@.tmp $@ + +.m4.m4f: + @case `$(M4) --help &1` in \ + *reload-state*) echo freezing $*.m4; \ + $(M4) -F $*.m4f -I${srcdir} ${srcdir}/$*.m4 ;; \ + *traditional*) ;; \ + *) echo Error: Autoconf requires GNU m4 1.1 or later; exit 1 ;; \ + esac + +autoconf.m4f: autoconf.m4 acgeneral.m4 acspecific.m4 acoldnames.m4 +autoheader.m4f: autoheader.m4 acgeneral.m4 acspecific.m4 acoldnames.m4 + +info: autoconf.info @standards_info@ INSTALL + +# Use --no-split to avoid creating filenames > 14 chars. +autoconf.info: autoconf.texi install.texi + $(MAKEINFO) -I$(srcdir) $(srcdir)/autoconf.texi --no-split --output=$@ + +INSTALL: install.texi + $(MAKEINFO) -I$(srcdir) $(srcdir)/install.texi --output=$@ \ + --no-headers --no-validate + +standards.info: standards.texi make-stds.texi + $(MAKEINFO) -I$(srcdir) $(srcdir)/standards.texi --no-split --output=$@ + +dvi: autoconf.dvi @standards_dvi@ + +autoconf.dvi: autoconf.texi + $(TEXI2DVI) $(srcdir)/autoconf.texi + +standards.dvi: standards.texi make-stds.texi + $(TEXI2DVI) $(srcdir)/standards.texi + +check: all + rootme=`pwd`; srcrootme=`cd $(srcdir); pwd`; \ + test -r install-sh || cp $(srcdir)/install-sh .; \ + cd testsuite && ${MAKE} $@ AUTOCONF=$$rootme/autoconf \ + AUTOCONFFLAGS="-m $$srcrootme" + +installcheck: all install + cd testsuite && ${MAKE} AUTOCONF=${bindir}/autoconf $@ + +installdirs: + $(SHELL) ${srcdir}/mkinstalldirs $(bindir) $(infodir) $(acdatadir) + +install: all $(M4FILES) acconfig.h installdirs install-info + for p in $(ASCRIPTS); do \ + $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \ + done + for i in $(M4FROZEN); do \ + $(INSTALL_DATA) $$i $(acdatadir)/$$i; \ + done + for i in $(M4FILES) acconfig.h; do \ + $(INSTALL_DATA) $(srcdir)/$$i $(acdatadir)/$$i; \ + done + -if test -f autoscan; then \ + $(INSTALL_PROGRAM) autoscan $(bindir)/`echo autoscan|sed '$(transform)'`; \ + for i in acfunctions acheaders acidentifiers acprograms \ + acmakevars; do \ + $(INSTALL_DATA) $(srcdir)/$$i $(acdatadir)/$$i; \ + done; \ + else :; fi + +# Don't cd, to avoid breaking install-sh references. +install-info: info installdirs + if test -f autoconf.info; then \ + for i in *.info*; do \ + $(INSTALL_DATA) $$i $(infodir)/$$i; \ + done; \ + else \ + for i in $(srcdir)/*.info*; do \ + $(INSTALL_DATA) $$i $(infodir)/`echo $$i | sed 's|^$(srcdir)/||'`; \ + done; \ + fi + +uninstall: + for p in $(SCRIPTS); do \ + rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \ + done + rm -fr $(acdatadir) + cd $(infodir) && rm -f autoconf.info* + if test -f standards.info || test -f $(srcdir)/standards.info; \ + then cd $(infodir) && rm -f standards.info*; fi + +${srcdir}/configure: configure.in $(M4FILES) + cd $(srcdir) && \ + rm -f configure configure.tmp && \ + $(M4) autoconf.m4 configure.in > configure.tmp && \ + chmod +x configure.tmp && mv configure.tmp configure +Makefile: Makefile.in config.status + $(SHELL) ./config.status +config.status: configure + $(SHELL) ./config.status --recheck + +maintainer-clean:: + @echo "This command is intended for maintainers to use;" + @echo "rebuilding the deleted files requires makeinfo." + rm -f TAGS *.info* INSTALL + +clean mostlyclean distclean maintainer-clean:: + for dir in $(SUBDIRS); do \ + echo making $@ in $$dir ; \ + (cd $$dir && $(MAKE) $@) ; \ + done + +clean mostlyclean distclean maintainer-clean:: + rm -f $(SCRIPTS) *.tmp + rm -f *.aux *.cp *.cps *.dvi *.fn *.fns *.ky *.kys *.log + rm -f *.pg *.pgs *.toc *.tp *.tps *.vr *.vrs + rm -f *.ev *.evs *.ov *.ovs *.cv *.cvs *.ma *.mas + +distclean maintainer-clean:: + rm -f Makefile config.status config.cache config.log + +TAGS: + etags ${srcdir}/*.m4 ${srcdir}/*.sh ${srcdir}/[a-z]*.in ${srcdir}/*.texi + +# Don't depend on DISTFILES because there's no rule for "standards.info*". +dist: $(DISTDEP) + distname=`sed -e '/define(AC_ACVERSION,/!d' \ + -e 's/[^0-9.]*\([0-9.]*\).*/autoconf-\1/' -e q acgeneral.m4`; \ + rm -fr $$distname; \ + mkdir $$distname $$distname/testsuite $$distname/testsuite/config \ + $$distname/testsuite/lib $$distname/testsuite/autoconf.g \ + $$distname/testsuite/autoconf.s; \ + for file in $(DISTFILES); do \ + ln $$file $$distname/$$file \ + || { echo copying $$file instead; cp -p $$file $$distname/$$file;}; \ + done; \ + chmod -R a+rX $$distname; \ + tar -chz -f $$distname.tar.gz $$distname; \ + rm -fr $$distname diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..be22433 --- /dev/null +++ b/NEWS @@ -0,0 +1,368 @@ +Major changes in release 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 release 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 release 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 release 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 releases 2.6 through 2.9: + +* Bug fixes. + +Major changes in release 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 release 2.4: + +* Fix a few bugs found by Emacs testers. + +Major changes in release 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 release 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 release 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 release 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 release 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 release 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 release 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 release 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 release 1.7: + +* New macro AC_OBSOLETE. +* Bugs in Makefile.in fixed. +* AC_LONG_FILE_NAMES improved. + +Major changes in release 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 release 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 release 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 release 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 release 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 release 1.1: + +Added AC_STRCOLL macro. +Made AC_GETLOADAVG check for more things. +AC_OUTPUT argument is now optional. +Various bug fixes. diff --git a/README b/README new file mode 100644 index 0000000..674adcb --- /dev/null +++ b/README @@ -0,0 +1,39 @@ +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.1 or later, preferably 1.3 or later +for better performance) 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). + +Also, some optional utilities that come with Autoconf use Perl, TCL, +and the TCL packages Expect and DejaGNU. However, none of those +are required in order to use the main Autoconf program. If they are +not present, the affected Autoconf utilities will not be installed. + +The file INSTALL can 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. + +The file `acconfig.h' contains short descriptions of the C preprocessor +variables that Autoconf can define, suitable for copying into other +packages' configuration headers or Makefile.in files. You can use the +program `autoheader' to automatically create a configuration header +from a `configure.in', based on the information in `acconfig.h'. + +Mail suggestions and bug reports for Autoconf to autoconf@gnu.org. +Please include the Autoconf version number, which you can get by running +"autoconf --version". The current autoconf maintainer is Ben Elliston +. diff --git a/TODO b/TODO new file mode 100644 index 0000000..c6b7ac8 --- /dev/null +++ b/TODO @@ -0,0 +1,580 @@ +-*- outline -*- + +Things it might be nice to do someday. I haven't evaluated all of +these suggestions... their presence here doesn't imply my endorsement. +-djm + +------------------------------------------------------------------------------ + +* Make AC_CHECK_LIB check whether the function is already available + before checking for the library. This might involve adding another + kind of cache variable to indicate whether a given function needs a + given library. The current ac_cv_func_ variables are intended to + indicate whether the function is in the default libraries, but + actually also take into account whatever value LIBS had when they + were checked for. + +------------------------------------------------------------------------------ + +* Add AC_PROG_CC_POSIX to replace the current ad-hoc macros for AIX, + Minix, ISC, etc. + +------------------------------------------------------------------------------ + +* Use AC_EGREP_CPP instead of AC_TRY_LINK to detect structures and members. + +------------------------------------------------------------------------------ + +* Make AC_CHECK_FUNC[S] automatically use any particular macros for the + listed functions. + +------------------------------------------------------------------------------ + +* Support creating both config.h and DEFS in the same configure. + +------------------------------------------------------------------------------ + +* Select the right CONFIG_SHELL automatically (for Ultrix, Lynx especially.) + +------------------------------------------------------------------------------ + +* Doc: Add a concept index. + +------------------------------------------------------------------------------ + +* Doc: Centralize information on POSIX, MS-DOS, cross-compiling, and + other important topics. + +------------------------------------------------------------------------------ + +* Split up AC_SUBST substitutions using a loop to accomodate shells + with severely limited here document sizes, if it turns out to be a problem. + I'm not sure whether the limit is on lines or bytes; if bytes, it + will be less of a problem than it was with the long lines used for + creating a header file. + +------------------------------------------------------------------------------ + +* Allow [ and ] in AC_DEFINE args. + +------------------------------------------------------------------------------ + +* Mike Haertel's suggestions: + +** Provide header files containing decls for alloca, strings, etc. + +** Cross compiling: + +*** Error messages include instructions for overriding defaults using +config.site. + +*** Distribute a config.site corresponding to a hypothetical bare POSIX system with c89. + +** Site defaults: + +*** Convention for consistency checking of env vars and options in config.site so config.site can print obnoxious messages if it doesn't like options or env vars that users use. + +------------------------------------------------------------------------------ + +* autoscan: Tell the files that caused inclusion of each macro, +in a dnl comment. (Seems to be hard.) + +------------------------------------------------------------------------------ + +* Look at user contributed macros: + prototypes + IEEE double precision math + more + +------------------------------------------------------------------------------ + +For AC_TYPE_SIGNAL signal handlers, provide a way for code to know +whether to do "return 0" or "return" (int vs void) to avoid compiler +warnings. (Roland McGrath) + +------------------------------------------------------------------------------ + +In config.status comment, put the host/target/build types, if used. + +------------------------------------------------------------------------------ + +Have AC_CANONICAL_* cache the host/build/target types. +They have to be overridden by the command line arguments, +just as for X includes and libraries. Should they be cached +all in one variable, or three? In that case, what if only one +or two of the cache variables are set? + +------------------------------------------------------------------------------ + + The argument HELP-STRING is a description of the option which + ... + Avoid tabs in the help string. You'll need to enclose it in `[' + and `]' in order to produce the leading spaces. + +Except that [...] is the convention for telling the user the default, +So I guess a changequote(`,') or something would be in order in some cases. +From: "K. Berry" + +------------------------------------------------------------------------------ + +The default of unlimited permission is fine, but there should be some easy +way for configure to have copyright terms passed through from configure.in. +Maybe AC_LICENSE([...]). +From: roland@gnu.ai.mit.edu (Roland McGrath) + +------------------------------------------------------------------------------ + +AC_MSG_CHECKING([checking for ANSI #stringize]) +AC_REVISION([ #(@) revision 2.1 ]) + +causes bogus code to be generated for whatever immediately follows. The +problem goes away if the '#' is removed. Probably the macros are not +disabling the m4 "comment" feature when processing user-supplied strings. +-Jim Avera jima@netcom.com + +------------------------------------------------------------------------------ + +on hal.gnu.ai.mit.edu, configure is getting the wrong answer for +AC_CHECK_FUNCS(select). + +The problem here is that there's severe namespace pollution: when +conftest.c includes to pick up any __stub macro definitions, +it's getting a prototype declaration for select(), which collides +with the dummy declaration in conftest.c. (The chain of includes +is conftest.c -> -> -> +-> -> .) + + #define $ac_func __dummy_$ac_func + #include + #undef $ac_func +From: kwzh@gnu.ai.mit.edu (Karl Heuer) + +The test for the isascii function was failing because that function is +also a macro. He proposed that the test file look like this: + +/* Remove any macro definition. */ +#undef isascii +/* Override any gcc2 internal prototype to avoid an error. */ +char isascii(); isascii(); + +Andreas Schwab + +------------------------------------------------------------------------------ + +put all the config.* stuff somewhere like config/? +All these extraneous files sure clutter up a toplevel directory. +From: "Randall S. Winchester" + +------------------------------------------------------------------------------ + +It would be nice if I could (in the Makefile.in files) set +the path to config.h. You have config.h ../config.h ../../config.h's all +over the place, in the findutils-4.1 directory. +From: "Randall S. Winchester" + +------------------------------------------------------------------------------ + +In libc and make in aclocal.m4 I have AC_CHECK_SYMBOL, which checks for +sys_siglist et al. Using AC_CHECK_FUNC doesn't work on some system that +winds up caring that you reference it as a function and it is really a +variable. My version always declares the symbol as a char *[]; if that +ends up a bad idea, we can have it take an arg with the C decl, but that is +a bit verbose to write if it's actually superfluous. +From Roland McGrath. +[I'd call it AC_CHECK_VAR, I think. -djm] + +------------------------------------------------------------------------------ + +In a future version (after 2.2), make AC_PROG_{CC,RANLIB,anything else} +use AC_CHECK_TOOL. +From Roland McGrath. + +------------------------------------------------------------------------------ + + ls -lt configure configure.in | sort +doesn't work right if configure.in is from a symlink farm, where the +symlink has either a timestamp of its own, or under BSD 4.4, it has +the timestamp of the current directory, neither of which +helps. Changing it to + ls -Llt configure configure.in | sort +works for me, though I don't know how portable that is +_Mark_ + +------------------------------------------------------------------------------ + +Here is the thing I would like the most; +AC_PKG_WITH(PACKAGE, HELP_STRING, PACKAGE-ROOT, PACKAGE-LIBS, PACKAGE-DEFS, + PACKAGE-CCPFLAGS) +like + +AC_PKG_WITH(kerberos,,/usr/local/athena,-lkrb -ldes,[KERBEROS KRB4 +CRYPT],include) +AC_PKG_WITH(hesiod, +[if hesiod is not in kerberos-root add --with-hesiod-root=somewhere] +,,-lhesiod,HESIOD,,) +AC_PKG_WITH(glue,,,-lglue,GLUE,,) +AC_PKG_WITH(bind,,/usr/local/bind, [lib/resolv.a lib/lib44bsd.a], ,include) +After the apropriate checks, the existance of the paths, and libs and such +LIBS=$LIBS $PKG-LIBS +DEFS=$DEFS $PKG-DEFS +CPPFLAGS=$PKG-CPPFLAGS $CPPFLAGS +$PKG-ROOT=$PKG-ROOT +The cppflags should reverse the order so that you can have; +-I/usr/local/bind/include -I/usr/local/athena/include +and +-L/usr/local/athena/lib -lkrb -ldes /usr/local/bind/lib/libresolv.a +as order matters. + +also an AC_PKG_CHK_HEADER +and an AC_PKG_CHK_FUNCTION +so one can give alternate paths to check for stuff ($PKG-ROOT/lib for +example) +From: Randall Winchester + +------------------------------------------------------------------------------ + +AC_C_CROSS assumes that configure was +called like 'CC=target-gcc; ./configure'. I want to write a package +that has target dependent libraries and host dependent tools. So I +don't like to lose the distinction between CC and [G]CC_FOR_TARGET. +AC_C_CROSS should check for equality of target and host. + +It would be great if + +GCC_FOR_TARGET +AR_FOR_TARGET +RANLIB_FOR_TARGET + +would be set automatically if host != target. +AC_LANG_CROSS_C would be nice too, to check header files +etc. with GCC_FOR_TARGET instead of CC + +Here is one simple test + +if test "x$host" != "x$target"; then +AC_PROGRAMS_CHECK(AR_FOR_TARGET, $target-ar, $target-ar, ar) +AC_PROGRAMS_CHECK(RANLIB_FOR_TARGET, $target-ranlib, $target-ranlib, ranlib) +AC_PROGRAMS_CHECK(GCC_FOR_TARGET, $target-gcc, $target-gcc, gcc) +fi + +This could be improved to also look for gcc in PATH, but require the +prefix to contain the target e.g.: + +target=m68k-coff -->GCC_FOR_TARGET = /usr/gnu/m68k-coff/bin/gcc + +From: nennker@cs.tu-berlin.DE (Axel Nennker) + +------------------------------------------------------------------------------ + +The problem occurs with the following libc functions in SunOS 5.4: + + fnmatch glob globfree regcomp regexec regerror regfree wordexp wordfree + +It also occurs with a bunch more libposix4 functions that most people +probably aren't worried about yet, e.g. shm_open. + +All these functions fail with errno set to ENOSYS (89) +``Operation not applicable''. + +Perhaps autoconf should have a +specific macro for fnmatch, another for glob+globfree, another for +regcomp+regexec+regerror+regfree, and another for wordexp+wordfree. +This wouldn't solve the problem in general, but it should work for +Solaris 2.4. Or autoconf could limit itself to fnmatch and regcomp, +the only two functions that I know have been a problem so far. + +From Paul Eggert. + +------------------------------------------------------------------------------ + +Make easy macros for checking for X functions and libraries, such as Motif. + +------------------------------------------------------------------------------ + +* Test suite: more things to test: +** That the shell scripts produce correct output on some simple data. +** Configuration header files. That autoheader does the right thing, + and so does AC_CONFIG_HEADER when autoconf is run. + +------------------------------------------------------------------------------ + +Autoheader in autoconf-2.4 doesn't produce entries for: + + AC_CHECK_TYPE(ssize_t, int) + +and it seems like it could easily do so. + +In general, it seems to me like autoconf isn't set up to +let me periodically run autoheader, and then include my +"local" tests -- autoheader gets most stuff right, I'd like +to rerun it periodically without losing my local changes +to config.h.in. + +One of the things that I need is to know is the type to use +for a fixed size on disk, e.g., what is the system's name +for an unsigned-32-bit integer? + +I can use: + + AC_CHECK_SIZEOF(unsigned int) + +and, in fact, that's what I do. But I still have to build +sets of #if tests to get from there to the name of the type. + +From: bostic@bsdi.com (Keith Bostic) + +------------------------------------------------------------------------------ + +There are basically three ways to lock files + lockf, fnctl, flock +I'd be interested in adding a macro to pick the "right one" if you're +interested. + +From: Rich Salz + +------------------------------------------------------------------------------ + +It is IMHO a bug that `config.status' cannot handle multiple +simultaneous invocations. It should include the process id (`$$' in sh) +as part of the name of any temporary files it creates. + +From: fjh@kryten.cs.mu.oz.au (Fergus Henderson) + +------------------------------------------------------------------------------ + +Timezone calculations checks. + +------------------------------------------------------------------------------ + +Support different default filesystem layouts, e.g. SVR4, Linux. +Of course, this can be done locally with config.site. + +------------------------------------------------------------------------------ + +Mention automake, libtool, etc. in the autoconf manual. + +------------------------------------------------------------------------------ + +I wonder if it is possible to get the path for X11's app-defaults +directory by autoconf. Moreover, I'd like to have a general way of +accessing imake variables by autoconf, something like + +AC_DEFINE(WINE_APP_DEFAULTS, AC_IMAKE_VAR(XAPPLOADDIR)) + +Slaven Rezic + +------------------------------------------------------------------------------ + +Question: at least one common UNIX variant has a "cc" that is old K&R +and "c89" for ANSI C. Is there any reason why AC_PROG_CC couldn't +check for c89 before cc if it can't find gcc? + +hpa@yggdrasil.com (H. Peter Anvin) + +------------------------------------------------------------------------------ + +Cache consistency checking: ignore cache if environment +(CC or PATH) differs. +From Mike Haertel + +So we need a general mechanism for storing variables' values in the cache, +and checking if they are the same after reading the cache. Then we can add +to the list of variables as we come across the need. So far we want +LD_LIBRARY_PATH and the internal variables for some of (all?) the args. +From: roland@gnu.ai.mit.edu (Roland McGrath) + +Hmm. That list might include LD_LIBRARY_PATH, LD_RUN_PATH (for solaris), +and PATH. I can't think of any others so far. +From: friedman@splode.com (Noah Friedman) + +------------------------------------------------------------------------------ + +So how about an option to configure --reset-cache, that says to ignore all +existing cached values for tests that configure runs, and then update the +cache normally. This should be utterly trivial to do in AC_CACHE_VAL; +check the flag variable and always compute the value if it's set. + +------------------------------------------------------------------------------ + +A number of people have tried to fix configuration problems by editing +acconfig.h. (Despite comments at the top of the file.) I think they're +confused because anything.h looks like a regular source file name. +Maybe acconfig.h could be called acconfig.extra or something? + +From: kb@cs.umb.edu (K. Berry) + +------------------------------------------------------------------------------ + +Every user running +X11 usually has a directory like *X11* in his PATH variable. By replacing +bin by include, you can find good places to look for the include files +or libraries. + +From: rcb5@win.tue.nl (Richard Verhoeven) + +------------------------------------------------------------------------------ + +When using CONFIG_FILES= and CONFIG_HEADERS= for controlling +partial configuration, any AC_LINK_FILES is repeated in each case +(that is, usually, once for config.h and once per subdirectory). +This is not elegant. + +Maybe Autoconf could use some kind of CONFIG_LINKS=, +having all such AC_LINK(ed)_FILES by default, but usable by each +Makefile.in in rules for updating the particular links they need. + +From: pinard@iro.umontreal.ca + +------------------------------------------------------------------------------ + +Perhaps autoconf could have a single @magic@ frob that gets replaced with +assignments for all the *dir variables? There is quite a plethora for each +Makefile.in to have foodir = @foodir@. + +From: Roland McGrath + +------------------------------------------------------------------------------ + +In most cases, when autoscan suggests something, using the search +or index command into the Info reader for autoconf manual quickly +explains me what the test is about. However, for header files +and functions, the search might fail, because the test is not of +the specific kind. The Autoconf manual should reflect somewhere +all header files or functions (non-specific features, generally) +triggering autoscan to generate tests, and tell in a few words +what is the problem, and the suggested approach for a solution; +that is, how one should use the result of testing the feature. + +From: pinard@iro.umontreal.ca + +------------------------------------------------------------------------------ + +It would be nice if the configure script would handle an option such as +--x-libraries="/usr/openwin/lib /usr/dt/lib". + +Rick Boykin + +Under Solaris 2.4, the regular X includes and libs and the Motif +includes and libs are in different places. The Emacs configure script +actually allows dir1:dir2:dir3 -- + + if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then + LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"` + LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"` + fi + if test "${x_includes}" != NONE && test -n "${x_includes}"; then + C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` + fi + +------------------------------------------------------------------------------ + + What messages should be produced by default, if any? + +Probably only the few most important ones, like which configuration +name was used, whether X or Xt are in use, etc. The specific +decisions, and progress messages, should be recorded on the terminal +only if --verbose is used. + + --silent just supresses the "checking for...result" + messages, not the "creating FOO" messages. + +I think the default should be to suppress both. +From: Richard Stallman + +There is no distinction now between +important decisions (we have X) vs minor decisions (we have lstat). +However, there are probably only a few things you deem important enough to +announce and only those few things will need to be changed. +Perhaps config.status could be written with comments saying what was +decided. +From: Roland McGrath + +------------------------------------------------------------------------------ + +Use automake to generate autoconf's Makefile.in's? + +------------------------------------------------------------------------------ + +about the idea of using small configure.in/aclocal.m4 snippets: +this is the one idea in metaconfig (the autoconf-like program used by +Perl) that I like. metaconfig looks for a "U" directory, and includes +each ".U" file into the generated Configure script (according to +various complicated rules). +From: Tom Tromey + +------------------------------------------------------------------------------ + +I'd much prefer to see the absolute paths substituted for all the +standard "dir" variables. It would be nice to have variables in +configure that held the absolute paths. And it is nice to be able to +substitute them into other files without relying on the destination +file supporting ${...} syntax. (It works in Perl, sh, and make -- +but not guile) + +From: Tom Tromey + +------------------------------------------------------------------------------ + +Another thing I wish for is a macro which figures out which libraries are +needed for BSD-sytle sockets. AC_PATH_X already detects this +correctly...so it's just a matter of seperating out the socket-related code. +From: "Joel N. Weber II" + +------------------------------------------------------------------------------ + +Merge the two lex macros, AC_PROG_LEX and AC_DECL_YYTEXT? + +------------------------------------------------------------------------------ + +in order to use the AC_CANONICAL_SYSTEM macro, I have to +have install-sh somewhere nearby --- why is this? I have no real +reason to distribute install-sh, other than that its absence breaks +this code. + +Shouldn't the above loop be looking for config.sub and config.guess? +From: jimb@totoro.bio.indiana.edu (Jim Blandy) + +adding AC_CANONICAL_HOST to my configure.in script caused +all sorts of odd/unexplained errors. Obviously, I had to go +get copies of config.guess, config.sub and install-sh from the +autoconf distribution, but the error messages and autoconf docs +didn't explain that very well. +From: bostic@bsdi.com (Keith Bostic) + +------------------------------------------------------------------------------ + +Perhaps also have AC_TRY_COMPILER try to link an invalid program, and +die if the compiler seemed to succeed--in which case it's not usable +with autoconf scripts. + +------------------------------------------------------------------------------ + +there is absolutely no guarantee that 'a' to 'z' are +contiguous, and the ISLOWER macro is not guaranteed to correctly +reproduce the result of islower. In all variants of ASCII however, it +will work correctly in the C locale. + +There is also no guarantee that toupper(i) - i is the same constant if +non-zero. TOUPPER, hence, is not correct either. But, in all variants +of ASCII in the C locale, it works. + +Tanmoy Bhattacharya (tanmoy@qcd.lanl.gov> + +------------------------------------------------------------------------------ + +autoreconf doesn't support having (in the same 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 ac*). +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. + +autoreconf should automatically figure out which ac* files to use--the +closest ones up the tree from each directory, probably, unless +overridden by --localdir. + +Also, autoreconf recurses on all subdirectories containing a +configure.in, not just those given by an AC_CONFIG_SUBDIRS directive. +This may not be a problem in practice. + +------------------------------------------------------------------------------ + diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 0000000..ea6988f --- /dev/null +++ b/acconfig.h @@ -0,0 +1,277 @@ +/* acconfig.h + This file is in the public domain. + + Descriptive text for the C preprocessor macros that + the distributed Autoconf macros can define. + No software package will use all of them; autoheader copies the ones + your configure.in uses into your configuration header file templates. + + The entries are in sort -df order: alphabetical, case insensitive, + ignoring punctuation (such as underscores). Although this order + can split up related entries, it makes it easier to check whether + a given entry is in the file. + + Leave the following blank line there!! Autoheader needs it. */ + + +/* 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 + +/* Define if using alloca.c. */ +#undef C_ALLOCA + +/* Define if type char is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +#undef __CHAR_UNSIGNED__ +#endif + +/* Define if the closedir function returns void instead of int. */ +#undef CLOSEDIR_VOID + +/* Define to empty if the keyword does not work. */ +#undef const + +/* 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 + +/* Define for DGUX with . */ +#undef DGUX + +/* Define if you have . */ +#undef DIRENT + +/* Define to the type of elements in the array set by `getgroups'. + Usually this is either `int' or `gid_t'. */ +#undef GETGROUPS_T + +/* Define if the `getloadavg' function needs to be run setuid or setgid. */ +#undef GETLOADAVG_PRIVILEGED + +/* Define if the `getpgrp' function takes no argument. */ +#undef GETPGRP_VOID + +/* Define to `int' if doesn't define. */ +#undef gid_t + +/* Define if you have alloca, as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define if you have and it should be used (not on Ultrix). */ +#undef HAVE_ALLOCA_H + +/* Define if you don't have vprintf but do have _doprnt. */ +#undef HAVE_DOPRNT + +/* Define if your system has a working fnmatch function. */ +#undef HAVE_FNMATCH + +/* Define if your system has its own `getloadavg' function. */ +#undef HAVE_GETLOADAVG + +/* Define if you have the getmntent function. */ +#undef HAVE_GETMNTENT + +/* Define if the `long double' type works. */ +#undef HAVE_LONG_DOUBLE + +/* Define if you support file names longer than 14 characters. */ +#undef HAVE_LONG_FILE_NAMES + +/* Define if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define if system calls automatically restart after interruption + by a signal. */ +#undef HAVE_RESTARTABLE_SYSCALLS + +/* Define if your struct stat has st_blksize. */ +#undef HAVE_ST_BLKSIZE + +/* Define if your struct stat has st_blocks. */ +#undef HAVE_ST_BLOCKS + +/* Define if you have the strcoll function and it is properly defined. */ +#undef HAVE_STRCOLL + +/* Define if your struct stat has st_rdev. */ +#undef HAVE_ST_RDEV + +/* Define if you have the strftime function. */ +#undef HAVE_STRFTIME + +/* Define if you have the ANSI # stringizing operator in cpp. */ +#undef HAVE_STRINGIZE + +/* Define if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define if your struct tm has tm_zone. */ +#undef HAVE_TM_ZONE + +/* Define if you don't have tm_zone but do have the external array + tzname. */ +#undef HAVE_TZNAME + +/* Define if you have . */ +#undef HAVE_UNISTD_H + +/* Define if utime(file, NULL) sets file's timestamp to the present. */ +#undef HAVE_UTIME_NULL + +/* Define if you have . */ +#undef HAVE_VFORK_H + +/* Define if you have the vprintf function. */ +#undef HAVE_VPRINTF + +/* Define if you have the wait3 system call. */ +#undef HAVE_WAIT3 + +/* Define as __inline if that's what the C compiler calls it. */ +#undef inline + +/* Define if int is 16 bits instead of 32. */ +#undef INT_16_BITS + +/* Define if long int is 64 bits. */ +#undef LONG_64_BITS + +/* Define if major, minor, and makedev are declared in . */ +#undef MAJOR_IN_MKDEV + +/* Define if major, minor, and makedev are declared in . */ +#undef MAJOR_IN_SYSMACROS + +/* Define if on MINIX. */ +#undef _MINIX + +/* Define to `int' if doesn't define. */ +#undef mode_t + +/* Define if you don't have , but have . */ +#undef NDIR + +/* Define if you have , and doesn't declare the + mem* functions. */ +#undef NEED_MEMORY_H + +/* Define if your struct nlist has an n_un member. */ +#undef NLIST_NAME_UNION + +/* Define if you have . */ +#undef NLIST_STRUCT + +/* Define if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Define if your Fortran 77 compiler doesn't accept -c and -o together. */ +#undef F77_NO_MINUS_C_MINUS_O + +/* Define to `long' if doesn't define. */ +#undef off_t + +/* Define to `int' if doesn't define. */ +#undef pid_t + +/* Define if the system does not provide POSIX.1 features except + with this defined. */ +#undef _POSIX_1_SOURCE + +/* Define if you need to in order for stat and other things to work. */ +#undef _POSIX_SOURCE + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define to the type of arg1 for select(). */ +#undef SELECT_TYPE_ARG1 + +/* Define to the type of args 2, 3 and 4 for select(). */ +#undef SELECT_TYPE_ARG234 + +/* Define to the type of arg5 for select(). */ +#undef SELECT_TYPE_ARG5 + +/* Define if the `setpgrp' function takes no argument. */ +#undef SETPGRP_VOID + +/* 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. */ +#undef SETVBUF_REVERSED + +/* Define to `unsigned' if doesn't define. */ +#undef size_t + +/* 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 + +/* Define if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define on System V Release 4. */ +#undef SVR4 + +/* Define if you don't have , but have . */ +#undef SYSDIR + +/* Define if you don't have , but have . */ +#undef SYSNDIR + +/* Define if `sys_siglist' is declared by . */ +#undef SYS_SIGLIST_DECLARED + +/* Define if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define if your declares struct tm. */ +#undef TM_IN_SYS_TIME + +/* Define to `int' if doesn't define. */ +#undef uid_t + +/* Define for Encore UMAX. */ +#undef UMAX + +/* Define for Encore UMAX 4.3 that has + instead of . */ +#undef UMAX4_3 + +/* Define if you do not have , index, bzero, etc.. */ +#undef USG + +/* Define vfork as fork if vfork does not work. */ +#undef vfork + +/* Define if the closedir function returns void instead of int. */ +#undef VOID_CLOSEDIR + +/* Define if your processor stores words with the most significant + byte first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* Define if the X Window System is missing or not being used. */ +#undef X_DISPLAY_MISSING + +/* Define if lex declares yytext as a char * by default, not a char[]. */ +#undef YYTEXT_POINTER + + +/* Leave that blank line there!! Autoheader needs it. + If you're adding to this file, keep in mind: + The entries are in sort -df order: alphabetical, case insensitive, + ignoring punctuation (such as underscores). */ diff --git a/acfunctions b/acfunctions new file mode 100644 index 0000000..3c04834 --- /dev/null +++ b/acfunctions @@ -0,0 +1,60 @@ +# Ones that have their own macros. +major AC_HEADER_MAJOR +minor AC_HEADER_MAJOR +makedev AC_HEADER_MAJOR +bcopy AC_HEADER_STDC +bcmp AC_HEADER_STDC +bzero AC_HEADER_STDC +ioctl AC_PROG_GCC_TRADITIONAL +memchr AC_HEADER_STDC +memcpy AC_HEADER_STDC +memcmp AC_FUNC_MEMCMP +memmove AC_HEADER_STDC +memset AC_HEADER_STDC +index AC_HEADER_STDC +rindex AC_HEADER_STDC +getgroups AC_TYPE_GETGROUPS +getpgrp AC_FUNC_GETPGRP +setpgrp AC_FUNC_SETPGRP +signal AC_TYPE_SIGNAL +alloca AC_FUNC_ALLOCA +fnmatch AC_FUNC_FNMATCH +getloadavg AC_FUNC_GETLOADAVG +mmap AC_FUNC_MMAP +setvbuf AC_FUNC_SETVBUF_REVERSED +strcoll AC_FUNC_STRCOLL +strftime AC_FUNC_STRFTIME +utime AC_FUNC_UTIME_NULL +vfork AC_FUNC_VFORK +vprintf AC_FUNC_VPRINTF +vfprintf AC_FUNC_VPRINTF +vsprintf AC_FUNC_VPRINTF +wait3 AC_FUNC_WAIT3 + +# Others. +ftime AC_CHECK_FUNCS +gethostname AC_CHECK_FUNCS +gettimeofday AC_CHECK_FUNCS +getusershell AC_CHECK_FUNCS +getcwd AC_CHECK_FUNCS +getwd AC_CHECK_FUNCS +mkdir AC_CHECK_FUNCS +mkfifo AC_CHECK_FUNCS +mktime AC_CHECK_FUNCS +putenv AC_CHECK_FUNCS +re_comp AC_CHECK_FUNCS +regcmp AC_CHECK_FUNCS +regcomp AC_CHECK_FUNCS +rmdir AC_CHECK_FUNCS +select AC_CHECK_FUNCS +socket AC_CHECK_FUNCS +stime AC_CHECK_FUNCS +strcspn AC_CHECK_FUNCS +strdup AC_CHECK_FUNCS +strerror AC_CHECK_FUNCS +strspn AC_CHECK_FUNCS +strstr AC_CHECK_FUNCS +strtod AC_CHECK_FUNCS +strtol AC_CHECK_FUNCS +strtoul AC_CHECK_FUNCS +uname AC_CHECK_FUNCS diff --git a/acgeneral.m4 b/acgeneral.m4 new file mode 100644 index 0000000..ae971de --- /dev/null +++ b/acgeneral.m4 @@ -0,0 +1,2607 @@ +dnl Parameterized macros. +dnl Requires GNU m4. +dnl This file is part of Autoconf. +dnl Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception, the Free Software Foundation gives unlimited +dnl permission to copy, distribute and modify the configure scripts that +dnl are the output of Autoconf. You need not follow the terms of the GNU +dnl General Public License when using or distributing such scripts, even +dnl though portions of the text of Autoconf appear in them. The GNU +dnl General Public License (GPL) does govern all other use of the material +dnl that constitutes the Autoconf program. +dnl +dnl Certain portions of the Autoconf source text are designed to be copied +dnl (in certain cases, depending on the input) into the output of +dnl Autoconf. We call these the "data" portions. The rest of the Autoconf +dnl source text consists of comments plus executable code that decides which +dnl of the data portions to output in any given case. We call these +dnl comments and executable code the "non-data" portions. Autoconf never +dnl copies any of the non-data portions into its output. +dnl +dnl This special exception to the GPL applies to versions of Autoconf +dnl released by the Free Software Foundation. When you make and +dnl distribute a modified version of Autoconf, you may extend this special +dnl exception to the GPL to apply to your modified version as well, *unless* +dnl your modified version has the potential to copy into its output some +dnl of the text that was the non-data portion of the version that you started +dnl with. (In other words, unless your change moves or copies text from +dnl the non-data portions to the data portions.) If your modification has +dnl such potential, you must delete any notice of this special exception +dnl to the GPL from your modified version. +dnl +dnl Written by David MacKenzie, with help from +dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. +dnl +divert(-1)dnl Throw away output until AC_INIT is called. +changequote([, ]) + +define(AC_ACVERSION, 2.13) + +dnl Some old m4's don't support m4exit. But they provide +dnl equivalent functionality by core dumping because of the +dnl long macros we define. +ifdef([__gnu__], , [errprint(Autoconf requires GNU m4. +Install it before installing Autoconf or set the +M4 environment variable to its path name. +)m4exit(2)]) + +undefine([eval]) +undefine([include]) +undefine([shift]) +undefine([format]) + + +dnl ### Defining macros + + +dnl m4 output diversions. We let m4 output them all in order at the end, +dnl except that we explicitly undivert AC_DIVERSION_SED, AC_DIVERSION_CMDS, +dnl and AC_DIVERSION_ICMDS. + +dnl AC_DIVERSION_NOTICE - 1 (= 0) AC_REQUIRE'd #! /bin/sh line +define(AC_DIVERSION_NOTICE, 1)dnl copyright notice & option help strings +define(AC_DIVERSION_INIT, 2)dnl initialization code +define(AC_DIVERSION_NORMAL_4, 3)dnl AC_REQUIRE'd code, 4 level deep +define(AC_DIVERSION_NORMAL_3, 4)dnl AC_REQUIRE'd code, 3 level deep +define(AC_DIVERSION_NORMAL_2, 5)dnl AC_REQUIRE'd code, 2 level deep +define(AC_DIVERSION_NORMAL_1, 6)dnl AC_REQUIRE'd code, 1 level deep +define(AC_DIVERSION_NORMAL, 7)dnl the tests and output code +define(AC_DIVERSION_SED, 8)dnl variable substitutions in config.status +define(AC_DIVERSION_CMDS, 9)dnl extra shell commands in config.status +define(AC_DIVERSION_ICMDS, 10)dnl extra initialization in config.status + +dnl Change the diversion stream to STREAM, while stacking old values. +dnl AC_DIVERT_PUSH(STREAM) +define(AC_DIVERT_PUSH, +[pushdef([AC_DIVERSION_CURRENT], $1)dnl +divert(AC_DIVERSION_CURRENT)dnl +]) + +dnl Change the diversion stream to its previous value, unstacking it. +dnl AC_DIVERT_POP() +define(AC_DIVERT_POP, +[popdef([AC_DIVERSION_CURRENT])dnl +divert(AC_DIVERSION_CURRENT)dnl +]) + +dnl Initialize the diversion setup. +define([AC_DIVERSION_CURRENT], AC_DIVERSION_NORMAL) +dnl This will be popped by AC_REQUIRE in AC_INIT. +pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_NOTICE) + +dnl The prologue for Autoconf macros. +dnl AC_PRO(MACRO-NAME) +define(AC_PRO, +[define([AC_PROVIDE_$1], )dnl +ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL, +[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))], +[pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_CURRENT)])dnl +]) + +dnl The Epilogue for Autoconf macros. +dnl AC_EPI() +define(AC_EPI, +[AC_DIVERT_POP()dnl +ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL, +[undivert(AC_DIVERSION_NORMAL_4)dnl +undivert(AC_DIVERSION_NORMAL_3)dnl +undivert(AC_DIVERSION_NORMAL_2)dnl +undivert(AC_DIVERSION_NORMAL_1)dnl +])dnl +]) + +dnl Define a macro which automatically provides itself. Add machinery +dnl so the macro automatically switches expansion to the diversion +dnl stack if it is not already using it. In this case, once finished, +dnl it will bring back all the code accumulated in the diversion stack. +dnl This, combined with AC_REQUIRE, achieves the topological ordering of +dnl macros. We don't use this macro to define some frequently called +dnl macros that are not involved in ordering constraints, to save m4 +dnl processing. +dnl AC_DEFUN(NAME, EXPANSION) +define([AC_DEFUN], +[define($1, [AC_PRO([$1])$2[]AC_EPI()])]) + + +dnl ### Initialization + + +dnl AC_INIT_NOTICE() +AC_DEFUN(AC_INIT_NOTICE, +[# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version] AC_ACVERSION [ +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +[#] Any additions from configure.in:]) + +dnl AC_PREFIX_DEFAULT(PREFIX) +AC_DEFUN(AC_PREFIX_DEFAULT, +[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +ac_default_prefix=$1 +AC_DIVERT_POP()]) + +dnl AC_INIT_PARSE_ARGS() +AC_DEFUN(AC_INIT_PARSE_ARGS, +[ +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +dnl Installation directory options. +dnl These are left unexpanded so users can "make install exec_prefix=/foo" +dnl and all the variables that are supposed to be based on exec_prefix +dnl by default will actually change. +dnl Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in +changequote(, )dnl + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; +changequote([, ])dnl + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_feature: invalid feature name) + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_feature: invalid feature name) + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +changequote(, )dnl +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +changequote([, ])dnl +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version AC_ACVERSION" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_package: invalid package name) + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_package: invalid package name) + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) AC_MSG_ERROR([$ac_option: invalid option; use --help to show usage]) + ;; + + *) +changequote(, )dnl + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then +changequote([, ])dnl + AC_MSG_WARN($ac_option: invalid host type) + fi + if test "x$nonopt" != xNONE; then + AC_MSG_ERROR(can only configure for one host and one target at a time) + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + AC_MSG_ERROR(missing argument to --`echo $ac_prev | sed 's/_/-/g'`) +fi +]) + +dnl Try to have only one #! line, so the script doesn't look funny +dnl for users of AC_REVISION. +dnl AC_INIT_BINSH() +AC_DEFUN(AC_INIT_BINSH, +[#! /bin/sh +]) + +dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR) +AC_DEFUN(AC_INIT, +[sinclude(acsite.m4)dnl +sinclude(./aclocal.m4)dnl +AC_REQUIRE([AC_INIT_BINSH])dnl +AC_INIT_NOTICE +AC_DIVERT_POP()dnl to NORMAL +AC_DIVERT_PUSH(AC_DIVERSION_INIT)dnl +AC_INIT_PARSE_ARGS +AC_INIT_PREPARE($1)dnl +AC_DIVERT_POP()dnl to NORMAL +]) + +dnl AC_INIT_PREPARE(UNIQUE-FILE-IN-SOURCE-DIR) +AC_DEFUN(AC_INIT_PREPARE, +[trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +define(AC_FD_MSG, 6)dnl +[#] AC_FD_MSG checking for... messages and results +define(AC_FD_CC, 5)dnl +[#] AC_FD_CC compiler messages saved in config.log +if test "$silent" = yes; then + exec AC_FD_MSG>/dev/null +else + exec AC_FD_MSG>&1 +fi +exec AC_FD_CC>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&AC_FD_CC + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; +changequote(<<, >>)dnl +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_configure_args="$ac_configure_args '$ac_arg'" ;; +changequote([, ])dnl + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=$1 + +# 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 +changequote(, )dnl + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` +changequote([, ])dnl + 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(can not find sources in $ac_confdir or ..) + else + AC_MSG_ERROR(can not find sources in $srcdir) + fi +fi +dnl Double slashes in pathnames in object file debugging info +dnl mess up M-x gdb in Emacs. +changequote(, )dnl +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +changequote([, ])dnl + +dnl Let the site file select an alternate cache file if it wants to. +AC_SITE_LOAD +AC_CACHE_LOAD +AC_LANG_C +dnl By default always use an empty string as the executable +dnl extension. Only change it if the script calls AC_EXEEXT. +ac_exeext= +dnl By default assume that objects files use an extension of .o. Only +dnl change it if the script calls AC_OBJEXT. +ac_objext=o +AC_PROG_ECHO_N +dnl Substitute for predefined variables. +AC_SUBST(SHELL)dnl +AC_SUBST(CFLAGS)dnl +AC_SUBST(CPPFLAGS)dnl +AC_SUBST(CXXFLAGS)dnl +AC_SUBST(FFLAGS)dnl +AC_SUBST(DEFS)dnl +AC_SUBST(LDFLAGS)dnl +AC_SUBST(LIBS)dnl +AC_SUBST(exec_prefix)dnl +AC_SUBST(prefix)dnl +AC_SUBST(program_transform_name)dnl +dnl Installation directory options. +AC_SUBST(bindir)dnl +AC_SUBST(sbindir)dnl +AC_SUBST(libexecdir)dnl +AC_SUBST(datadir)dnl +AC_SUBST(sysconfdir)dnl +AC_SUBST(sharedstatedir)dnl +AC_SUBST(localstatedir)dnl +AC_SUBST(libdir)dnl +AC_SUBST(includedir)dnl +AC_SUBST(oldincludedir)dnl +AC_SUBST(infodir)dnl +AC_SUBST(mandir)dnl +]) + + +dnl ### Selecting optional features + + +dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE]) +AC_DEFUN(AC_ARG_ENABLE, +[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +ac_help="$ac_help +[$2]" +AC_DIVERT_POP()dnl +[#] Check whether --enable-[$1] or --disable-[$1] was given. +if test "[${enable_]patsubst([$1], -, _)+set}" = set; then + enableval="[$enable_]patsubst([$1], -, _)" + ifelse([$3], , :, [$3]) +ifelse([$4], , , [else + $4 +])dnl +fi +]) + +AC_DEFUN(AC_ENABLE, +[AC_OBSOLETE([$0], [; instead use AC_ARG_ENABLE])dnl +AC_ARG_ENABLE([$1], [ --enable-$1], [$2], [$3])dnl +]) + + +dnl ### Working with optional software + + +dnl AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE]) +AC_DEFUN(AC_ARG_WITH, +[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +ac_help="$ac_help +[$2]" +AC_DIVERT_POP()dnl +[#] Check whether --with-[$1] or --without-[$1] was given. +if test "[${with_]patsubst([$1], -, _)+set}" = set; then + withval="[$with_]patsubst([$1], -, _)" + ifelse([$3], , :, [$3]) +ifelse([$4], , , [else + $4 +])dnl +fi +]) + +AC_DEFUN(AC_WITH, +[AC_OBSOLETE([$0], [; instead use AC_ARG_WITH])dnl +AC_ARG_WITH([$1], [ --with-$1], [$2], [$3])dnl +]) + + +dnl ### Transforming program names. + + +dnl AC_ARG_PROGRAM() +AC_DEFUN(AC_ARG_PROGRAM, +[if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," +]) + + +dnl ### Version numbers + + +dnl AC_REVISION(REVISION-INFO) +AC_DEFUN(AC_REVISION, +[AC_REQUIRE([AC_INIT_BINSH])dnl +[# From configure.in] translit([$1], $")]) + +dnl Subroutines of AC_PREREQ. + +dnl Change the dots in NUMBER into commas. +dnl AC_PREREQ_SPLIT(NUMBER) +define(AC_PREREQ_SPLIT, +[translit($1, ., [, ])]) + +dnl Default the ternary version number to 0 (e.g., 1, 7 -> 1, 7, 0). +dnl AC_PREREQ_CANON(MAJOR, MINOR [,TERNARY]) +define(AC_PREREQ_CANON, +[$1, $2, ifelse([$3], , 0, [$3])]) + +dnl Complain and exit if version number 1 is less than version number 2. +dnl PRINTABLE2 is the printable version of version number 2. +dnl AC_PREREQ_COMPARE(MAJOR1, MINOR1, TERNARY1, MAJOR2, MINOR2, TERNARY2, +dnl PRINTABLE2) +define(AC_PREREQ_COMPARE, +[ifelse(builtin([eval], +[$3 + $2 * 1000 + $1 * 1000000 < $6 + $5 * 1000 + $4 * 1000000]), 1, +[errprint(dnl +FATAL ERROR: Autoconf version $7 or higher is required for this script +)m4exit(3)])]) + +dnl Complain and exit if the Autoconf version is less than VERSION. +dnl AC_PREREQ(VERSION) +define(AC_PREREQ, +[AC_PREREQ_COMPARE(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), +AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1])]) + + +dnl ### Getting the canonical system type + + +dnl Find install-sh, config.sub, config.guess, and Cygnus configure +dnl in directory DIR. These are auxiliary files used in configuration. +dnl DIR can be either absolute or relative to $srcdir. +dnl AC_CONFIG_AUX_DIR(DIR) +AC_DEFUN(AC_CONFIG_AUX_DIR, +[AC_CONFIG_AUX_DIRS($1 $srcdir/$1)]) + +dnl The default is `$srcdir' or `$srcdir/..' or `$srcdir/../..'. +dnl 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/../..)]) + +dnl Internal subroutine. +dnl Search for the configuration auxiliary files in directory list $1. +dnl We look only for install-sh, so users of AC_PROG_INSTALL +dnl do not automatically need to distribute the other auxiliary files. +dnl AC_CONFIG_AUX_DIRS(DIR ...) +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 + fi +done +if test -z "$ac_aux_dir"; then + AC_MSG_ERROR([can not find install-sh or install.sh in $1]) +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +]) + +dnl Canonicalize the host, target, and build system types. +AC_DEFUN(AC_CANONICAL_SYSTEM, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [AC_ARG_PROGRAM]) +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) AC_MSG_ERROR(can only configure for one host and one target at a time) ;; +esac + +AC_CANONICAL_HOST +AC_CANONICAL_TARGET +AC_CANONICAL_BUILD +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +]) + +dnl Subroutines of AC_CANONICAL_SYSTEM. + +AC_DEFUN(AC_CANONICAL_HOST, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else AC_MSG_ERROR(can not run $ac_config_sub) +fi + +AC_MSG_CHECKING(host system type) + +dnl Set host_alias. +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else AC_MSG_ERROR(can not guess host type; you must specify one) + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +dnl Set the other host vars. +changequote(<<, >>)dnl +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +changequote([, ])dnl +AC_MSG_RESULT($host) +AC_SUBST(host)dnl +AC_SUBST(host_alias)dnl +AC_SUBST(host_cpu)dnl +AC_SUBST(host_vendor)dnl +AC_SUBST(host_os)dnl +]) + +dnl Internal use only. +AC_DEFUN(AC_CANONICAL_TARGET, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_MSG_CHECKING(target system type) + +dnl Set target_alias. +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +dnl Set the other target vars. +changequote(<<, >>)dnl +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +changequote([, ])dnl +AC_MSG_RESULT($target) +AC_SUBST(target)dnl +AC_SUBST(target_alias)dnl +AC_SUBST(target_cpu)dnl +AC_SUBST(target_vendor)dnl +AC_SUBST(target_os)dnl +]) + +dnl Internal use only. +AC_DEFUN(AC_CANONICAL_BUILD, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_MSG_CHECKING(build system type) + +dnl Set build_alias. +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +dnl Set the other build vars. +changequote(<<, >>)dnl +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +changequote([, ])dnl +AC_MSG_RESULT($build) +AC_SUBST(build)dnl +AC_SUBST(build_alias)dnl +AC_SUBST(build_cpu)dnl +AC_SUBST(build_vendor)dnl +AC_SUBST(build_os)dnl +]) + + +dnl AC_VALIDATE_CACHED_SYSTEM_TUPLE[(cmd)] +dnl if the cache file is inconsistent with the current host, +dnl target and build system types, execute CMD or print a default +dnl error message. +AC_DEFUN(AC_VALIDATE_CACHED_SYSTEM_TUPLE, [ + AC_REQUIRE([AC_CANONICAL_SYSTEM]) + AC_MSG_CHECKING([cached system tuple]) + if { test x"${ac_cv_host_system_type+set}" = x"set" && + test x"$ac_cv_host_system_type" != x"$host"; } || + { test x"${ac_cv_build_system_type+set}" = x"set" && + test x"$ac_cv_build_system_type" != x"$build"; } || + { test x"${ac_cv_target_system_type+set}" = x"set" && + test x"$ac_cv_target_system_type" != x"$target"; }; then + AC_MSG_RESULT([different]) + ifelse($#, 1, [$1], + [AC_MSG_ERROR([remove config.cache and re-run configure])]) + else + AC_MSG_RESULT(ok) + fi + ac_cv_host_system_type="$host" + ac_cv_build_system_type="$build" + ac_cv_target_system_type="$target" +]) + + +dnl ### Caching test results + + +dnl Look for site or system specific initialization scripts. +dnl AC_SITE_LOAD() +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 + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done +]) + +dnl AC_CACHE_LOAD() +define(AC_CACHE_LOAD, +[if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi +]) + +dnl AC_CACHE_SAVE() +define(AC_CACHE_SAVE, +[cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +dnl Allow a site initialization script to override cache values. +# 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. +changequote(, )dnl +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +changequote([, ])dnl +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache +]) + +dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved. +dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT) +define(AC_CACHE_VAL, +[dnl We used to use the below line, but it fails if the 1st arg is a +dnl shell variable, so we need the eval. +dnl if test "${$1+set}" = set; then +dnl the '' avoids an AIX 4.1 sh bug ("invalid expansion"). +if eval "test \"`echo '$''{'$1'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&AC_FD_MSG +else + $2 +fi +]) + +dnl AC_CACHE_CHECK(MESSAGE, CACHE-ID, COMMANDS) +define(AC_CACHE_CHECK, +[AC_MSG_CHECKING([$1]) +AC_CACHE_VAL([$2], [$3]) +AC_MSG_RESULT([$]$2)]) + + +dnl ### Defining symbols + + +dnl Set VARIABLE to VALUE, verbatim, or 1. +dnl AC_DEFINE(VARIABLE [, VALUE]) +define(AC_DEFINE, +[cat >> confdefs.h <<\EOF +[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) +EOF +]) + +dnl Similar, but perform shell substitutions $ ` \ once on VALUE. +define(AC_DEFINE_UNQUOTED, +[cat >> confdefs.h <&AC_FD_MSG +echo "configure:__oline__: checking $1" >&AC_FD_CC]) + +dnl AC_CHECKING(FEATURE-DESCRIPTION) +define(AC_CHECKING, +[echo "checking $1" 1>&AC_FD_MSG +echo "configure:__oline__: checking $1" >&AC_FD_CC]) + +dnl AC_MSG_RESULT(RESULT-DESCRIPTION) +define(AC_MSG_RESULT, +[echo "$ac_t""$1" 1>&AC_FD_MSG]) + +dnl AC_VERBOSE(RESULT-DESCRIPTION) +define(AC_VERBOSE, +[AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl +echo " $1" 1>&AC_FD_MSG]) + +dnl AC_MSG_WARN(PROBLEM-DESCRIPTION) +define(AC_MSG_WARN, +[echo "configure: warning: $1" 1>&2]) + +dnl AC_MSG_ERROR(ERROR-DESCRIPTION) +define(AC_MSG_ERROR, +[{ echo "configure: error: $1" 1>&2; exit 1; }]) + + +dnl ### Selecting which language to use for testing + + +dnl AC_LANG_C() +AC_DEFUN(AC_LANG_C, +[define([AC_LANG], [C])dnl +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +cross_compiling=$ac_cv_prog_cc_cross +]) + +dnl AC_LANG_CPLUSPLUS() +AC_DEFUN(AC_LANG_CPLUSPLUS, +[define([AC_LANG], [CPLUSPLUS])dnl +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +cross_compiling=$ac_cv_prog_cxx_cross +]) + +dnl AC_LANG_FORTRAN77() +AC_DEFUN(AC_LANG_FORTRAN77, +[define([AC_LANG], [FORTRAN77])dnl +ac_ext=f +ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&AC_FD_CC' +ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +cross_compiling=$ac_cv_prog_f77_cross +]) + +dnl Push the current language on a stack. +dnl AC_LANG_SAVE() +define(AC_LANG_SAVE, +[pushdef([AC_LANG_STACK], AC_LANG)]) + +dnl Restore the current language from the stack. +dnl AC_LANG_RESTORE() +pushdef([AC_LANG_RESTORE], +[ifelse(AC_LANG_STACK, [C], [AC_LANG_C],dnl +AC_LANG_STACK, [CPLUSPLUS], [AC_LANG_CPLUSPLUS],dnl +AC_LANG_STACK, [FORTRAN77], [AC_LANG_FORTRAN77])[]popdef([AC_LANG_STACK])]) + + +dnl ### Compiler-running mechanics + + +dnl The purpose of this macro is to "configure:123: command line" +dnl written into config.log for every test run. +dnl AC_TRY_EVAL(VARIABLE) +AC_DEFUN(AC_TRY_EVAL, +[{ (eval echo configure:__oline__: \"[$]$1\") 1>&AC_FD_CC; dnl +(eval [$]$1) 2>&AC_FD_CC; }]) + +dnl AC_TRY_COMMAND(COMMAND) +AC_DEFUN(AC_TRY_COMMAND, +[{ ac_try='$1'; AC_TRY_EVAL(ac_try); }]) + + +dnl ### Dependencies between macros + + +dnl AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME) +define(AC_BEFORE, +[ifdef([AC_PROVIDE_$2], [errprint(__file__:__line__: [$2 was called before $1 +])])]) + +dnl AC_REQUIRE(MACRO-NAME) +define(AC_REQUIRE, +[ifdef([AC_PROVIDE_$1], , +[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl +indir([$1]) +AC_DIVERT_POP()dnl +])]) + +dnl AC_PROVIDE(MACRO-NAME) +define(AC_PROVIDE, +[define([AC_PROVIDE_$1], )]) + +dnl AC_OBSOLETE(THIS-MACRO-NAME [, SUGGESTION]) +define(AC_OBSOLETE, +[errprint(__file__:__line__: warning: [$1] is obsolete[$2] +)]) + + +dnl ### Checking for programs + + +dnl AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND +dnl [, [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 + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +ifelse([$6], , , [ ac_prog_rejected=no +])dnl +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$5], , $PATH, [$5])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then +ifelse([$6], , , dnl +[ if test "[$ac_dir/$ac_word]" = "$6"; then + ac_prog_rejected=yes + continue + fi +])dnl + ac_cv_prog_$1="$3" + break + fi + done + IFS="$ac_save_ifs" +ifelse([$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 [$]# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set $1 to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "[$]@" + shift + ac_cv_prog_$1="[$]@" +ifelse([$2], [$4], dnl +[ else + # Default is a loser. + AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl +ifelse([$5], , [\$]PATH, [$5])]) +])dnl + fi +fi +])dnl +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_CHECK_PROGS will keep looking. +ifelse([$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 +]) + +dnl 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_cv_path_$1="[$]$1" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$4], , $PATH, [$4])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" +dnl If no 3rd arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$3], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$3" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +dnl AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND +dnl [, 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 +ifelse([$3], , , [test -n "[$]$1" || $1="$3" +])]) + +dnl AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND +dnl [, PATH]]) +AC_DEFUN(AC_PATH_PROGS, +[for ac_prog in $2 +do +AC_PATH_PROG($1, [$]ac_prog, , $4) +test -n "[$]$1" && break +done +ifelse([$3], , , [test -n "[$]$1" || $1="$3" +])]) + +dnl Internal subroutine. +AC_DEFUN(AC_CHECK_TOOL_PREFIX, +[AC_REQUIRE([AC_CANONICAL_HOST])AC_REQUIRE([AC_CANONICAL_BUILD])dnl +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi +]) + +dnl AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR[, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AC_CHECK_TOOL, +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_CHECK_PROG($1, ${ac_tool_prefix}$2, ${ac_tool_prefix}$2, + ifelse([$3], , [$2], ), $4) +ifelse([$3], , , [ +if test -z "$ac_cv_prog_$1"; then +if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG($1, $2, $2, $3) +else + $1="$3" +fi +fi]) +]) + +dnl Guess the value for the `prefix' variable by looking for +dnl the argument program along PATH and taking its parent. +dnl Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc, +dnl set `prefix' to /usr/local/gnu. +dnl This comes too late to find a site file based on the prefix, +dnl and it might use a cached value for the path. +dnl No big loss, I think, since most configures don't use this macro anyway. +dnl AC_PREFIX_PROGRAM(PROGRAM) +AC_DEFUN(AC_PREFIX_PROGRAM, +[if test "x$prefix" = xNONE; then +changequote(<<, >>)dnl +define(<>, translit($1, [a-z], [A-Z]))dnl +changequote([, ])dnl +dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle. +echo $ac_n "checking for prefix by $ac_c" 1>&AC_FD_MSG +AC_PATH_PROG(AC_VAR_NAME, $1) +changequote(<<, >>)dnl + if test -n "$ac_cv_path_<<>>AC_VAR_NAME"; then + prefix=`echo $ac_cv_path_<<>>AC_VAR_NAME|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` +changequote([, ])dnl + fi +fi +undefine([AC_VAR_NAME])dnl +]) + +dnl Try to compile, link and execute TEST-PROGRAM. Set WORKING-VAR to +dnl `yes' if the current compiler works, otherwise set it ti `no'. Set +dnl CROSS-VAR to `yes' if the compiler and linker produce non-native +dnl executables, otherwise set it to `no'. Before calling +dnl `AC_TRY_COMPILER()', call `AC_LANG_*' to set-up for the right +dnl language. +dnl +dnl AC_TRY_COMPILER(TEST-PROGRAM, WORKING-VAR, CROSS-VAR) +AC_DEFUN(AC_TRY_COMPILER, +[cat > conftest.$ac_ext << EOF +ifelse(AC_LANG, [FORTRAN77], , +[ +[#]line __oline__ "configure" +#include "confdefs.h" +]) +[$1] +EOF +if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + [$2]=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + [$3]=no + else + [$3]=yes + fi +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + [$2]=no +fi +rm -fr conftest*]) + + +dnl ### Checking for libraries + + +dnl AC_TRY_LINK_FUNC(func, action-if-found, action-if-not-found) +dnl Try to link a program that calls FUNC, handling GCC builtins. If +dnl the link succeeds, execute ACTION-IF-FOUND; otherwise, execute +dnl ACTION-IF-NOT-FOUND. + +AC_DEFUN(AC_TRY_LINK_FUNC, +AC_TRY_LINK(dnl +ifelse([$1], [main], , dnl Avoid conflicting decl of main. +[/* Override any gcc2 internal prototype to avoid an error. */ +]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern "C" +#endif +])dnl +[/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $1(); +]), +[$1()], +[$2], +[$3])) + + +dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND +dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) +dnl Search for a library defining FUNC, if it's not already available. + +AC_DEFUN(AC_SEARCH_LIBS, +[AC_PREREQ([2.13]) +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"]) +test "$ac_cv_search_$1" = "no" && for i in $2; do +LIBS="-l$i $5 $ac_func_search_save_LIBS" +AC_TRY_LINK_FUNC([$1], +[ac_cv_search_$1="-l$i" +break]) +done +LIBS="$ac_func_search_save_LIBS"]) +if test "$ac_cv_search_$1" != "no"; then + test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS" + $3 +else : + $4 +fi]) + + + +dnl AC_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, OTHER-LIBRARIES]]]) +AC_DEFUN(AC_CHECK_LIB, +[AC_MSG_CHECKING([for $2 in -l$1]) +dnl Use a cache variable name containing both the library and function name, +dnl because the test really is for library $1 defining function $2, not +dnl just for library $1. Separate tests with the same $1 and different $2s +dnl may have different results. +ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` +AC_CACHE_VAL(ac_cv_lib_$ac_lib_var, +[ac_save_LIBS="$LIBS" +LIBS="-l$1 $5 $LIBS" +AC_TRY_LINK(dnl +ifelse(AC_LANG, [FORTRAN77], , +ifelse([$2], [main], , dnl Avoid conflicting decl of main. +[/* Override any gcc2 internal prototype to avoid an error. */ +]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern "C" +#endif +])dnl +[/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $2(); +])), + [$2()], + eval "ac_cv_lib_$ac_lib_var=yes", + eval "ac_cv_lib_$ac_lib_var=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$3], , +[changequote(, )dnl + ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_lib) + LIBS="-l$1 $LIBS" +], [$3]) +else + AC_MSG_RESULT(no) +ifelse([$4], , , [$4 +])dnl +fi +]) + +dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, OTHER-LIBRARIES]]]) +AC_DEFUN(AC_HAVE_LIBRARY, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_LIB])dnl +changequote(<<, >>)dnl +define(<>, dnl +patsubst(patsubst($1, <>, <<\1>>), <<-l>>, <<>>))dnl +define(<>, ac_cv_lib_<<>>AC_LIB_NAME)dnl +changequote([, ])dnl +AC_MSG_CHECKING([for -l[]AC_LIB_NAME]) +AC_CACHE_VAL(AC_CV_NAME, +[ac_save_LIBS="$LIBS" +LIBS="-l[]AC_LIB_NAME[] $4 $LIBS" +AC_TRY_LINK( , [main()], AC_CV_NAME=yes, AC_CV_NAME=no) +LIBS="$ac_save_LIBS" +])dnl +AC_MSG_RESULT($AC_CV_NAME) +if test "$AC_CV_NAME" = yes; then + ifelse([$2], , +[AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z])) + LIBS="-l[]AC_LIB_NAME[] $LIBS" +], [$2]) +ifelse([$3], , , [else + $3 +])dnl +fi +undefine([AC_LIB_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + + +dnl ### Examining declarations + + +dnl AC_TRY_CPP(INCLUDES, [ACTION-IF-TRUE [, ACTION-IF-FALSE]]) +AC_DEFUN(AC_TRY_CPP, +[AC_REQUIRE_CPP()dnl +cat > conftest.$ac_ext <&AC_FD_CC + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$3], , , [ rm -rf conftest* + $3 +])dnl +fi +rm -f conftest*]) + +dnl AC_EGREP_HEADER(PATTERN, HEADER-FILE, ACTION-IF-FOUND [, +dnl ACTION-IF-NOT-FOUND]) +AC_DEFUN(AC_EGREP_HEADER, +[AC_EGREP_CPP([$1], [#include <$2>], [$3], [$4])]) + +dnl Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must +dnl come early, it is not included in AC_BEFORE checks. +dnl AC_EGREP_CPP(PATTERN, PROGRAM, [ACTION-IF-FOUND [, +dnl ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_EGREP_CPP, +[AC_REQUIRE_CPP()dnl +cat > conftest.$ac_ext <&AC_FD_CC | +dnl Prevent m4 from eating character classes: +changequote(, )dnl + egrep "$1" >/dev/null 2>&1; then +changequote([, ])dnl + ifelse([$3], , :, [rm -rf conftest* + $3]) +ifelse([$4], , , [else + rm -rf conftest* + $4 +])dnl +fi +rm -f conftest* +]) + + +dnl ### Examining syntax + + +dnl AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_TRY_COMPILE, +[cat > conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$4], , , [ rm -rf conftest* + $4 +])dnl +fi +rm -f conftest*]) + + +dnl ### Examining libraries + + +dnl AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY, +dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) +AC_DEFUN(AC_COMPILE_CHECK, +[AC_OBSOLETE([$0], [; instead use AC_TRY_COMPILE or AC_TRY_LINK, and AC_MSG_CHECKING and AC_MSG_RESULT])dnl +ifelse([$1], , , [AC_CHECKING([for $1]) +])dnl +AC_TRY_LINK([$2], [$3], [$4], [$5]) +]) + +dnl AC_TRY_LINK(INCLUDES, FUNCTION-BODY, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_TRY_LINK, +[cat > conftest.$ac_ext <&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$4], , , [ rm -rf conftest* + $4 +])dnl +fi +rm -f conftest*]) + + +dnl ### Checking for run-time features + + +dnl AC_TRY_RUN(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE +dnl [, ACTION-IF-CROSS-COMPILING]]]) +AC_DEFUN(AC_TRY_RUN, +[if test "$cross_compiling" = yes; then + ifelse([$4], , + [errprint(__file__:__line__: warning: [AC_TRY_RUN] called without default to allow cross compiling +)dnl + AC_MSG_ERROR(can not run test program while cross compiling)], + [$4]) +else + AC_TRY_RUN_NATIVE([$1], [$2], [$3]) +fi +]) + +dnl Like AC_TRY_RUN but assumes a native-environment (non-cross) compiler. +dnl AC_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]]) +AC_DEFUN(AC_TRY_RUN_NATIVE, +[cat > conftest.$ac_ext </dev/null +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$2], , :, [$2]) +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$3], , , [ rm -fr conftest* + $3 +])dnl +fi +rm -fr conftest*]) + + +dnl ### Checking for header files + + +dnl AC_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_HEADER, +[dnl Do the transliteration at runtime so arg 1 can be a shell variable. +ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(ac_cv_header_$ac_safe, +[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes", + eval "ac_cv_header_$ac_safe=no")])dnl +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) +ifelse([$3], , , [$3 +])dnl +fi +]) + +dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_HEADERS, +[for ac_hdr in $1 +do +AC_CHECK_HEADER($ac_hdr, +[changequote(, )dnl + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_hdr) $2], $3)dnl +done +]) + + +dnl ### Checking for the existence of files + +dnl AC_CHECK_FILE(FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FILE, +[AC_REQUIRE([AC_PROG_CC]) +dnl Do the transliteration at runtime so arg 1 can be a shell variable. +ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(ac_cv_file_$ac_safe, +[if test "$cross_compiling" = yes; then + errprint(__file__:__line__: warning: Cannot check for file existence when cross compiling +)dnl + AC_MSG_ERROR(Cannot check for file existence when cross compiling) +else + if test -r $1; then + eval "ac_cv_file_$ac_safe=yes" + else + eval "ac_cv_file_$ac_safe=no" + fi +fi])dnl +if eval "test \"`echo '$ac_cv_file_'$ac_safe`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) +ifelse([$3], , , [$3]) +fi +]) + +dnl AC_CHECK_FILES(FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FILES, +[for ac_file in $1 +do +AC_CHECK_FILE($ac_file, +[changequote(, )dnl + ac_tr_file=HAVE_`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_file) $2], $3)dnl +done +]) + + +dnl ### Checking for library functions + + +dnl AC_CHECK_FUNC(FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FUNC, +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(ac_cv_func_$1, +[AC_TRY_LINK( +dnl Don't include because on OSF/1 3.0 it includes +dnl which includes which contains a prototype for +dnl select. Similarly for bzero. +[/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $1(); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern "C" +#endif +])dnl +[/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $1(); +], [ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$1) || defined (__stub___$1) +choke me +#else +$1(); +#endif +], eval "ac_cv_func_$1=yes", eval "ac_cv_func_$1=no")]) +if eval "test \"`echo '$ac_cv_func_'$1`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) +ifelse([$3], , , [$3 +])dnl +fi +]) + +dnl AC_CHECK_FUNCS(FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FUNCS, +[for ac_func in $1 +do +AC_CHECK_FUNC($ac_func, +[changequote(, )dnl + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_func) $2], $3)dnl +done +]) + +dnl AC_REPLACE_FUNCS(FUNCTION...) +AC_DEFUN(AC_REPLACE_FUNCS, +[AC_CHECK_FUNCS([$1], , [LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"]) +AC_SUBST(LIBOBJS)dnl +]) + + +dnl ### Checking compiler characteristics + + +dnl AC_CHECK_SIZEOF(TYPE [, CROSS-SIZE]) +AC_DEFUN(AC_CHECK_SIZEOF, +[changequote(<<, >>)dnl +dnl The name to #define. +define(<>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $1) +AC_CACHE_VAL(AC_CV_NAME, +[AC_TRY_RUN([#include +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof($1)); + exit(0); +}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + + +dnl ### Checking for typedefs + + +dnl AC_CHECK_TYPE(TYPE, DEFAULT) +AC_DEFUN(AC_CHECK_TYPE, +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(ac_cv_type_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [#include +#if STDC_HEADERS +#include +#include +#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl +AC_MSG_RESULT($ac_cv_type_$1) +if test $ac_cv_type_$1 = no; then + AC_DEFINE($1, $2) +fi +]) + + +dnl ### Creating output files + + +dnl AC_CONFIG_HEADER(HEADER-TO-CREATE ...) +AC_DEFUN(AC_CONFIG_HEADER, +[define(AC_LIST_HEADER, $1)]) + +dnl Link each of the existing files SOURCE... to the corresponding +dnl link name in DEST... +dnl AC_LINK_FILES(SOURCE..., DEST...) +AC_DEFUN(AC_LINK_FILES, +[dnl +define([AC_LIST_FILES], ifdef([AC_LIST_FILES], [AC_LIST_FILES ],)[$1])dnl +define([AC_LIST_LINKS], ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$2])]) + +dnl Add additional commands for AC_OUTPUT to put into config.status. +dnl Use diversions instead of macros so we can be robust in the +dnl presence of commas in $1 and/or $2. +dnl AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) +AC_DEFUN(AC_OUTPUT_COMMANDS, +[AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl +[$1] +AC_DIVERT_POP()dnl +AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl +[$2] +AC_DIVERT_POP()]) + +dnl AC_CONFIG_SUBDIRS(DIR ...) +AC_DEFUN(AC_CONFIG_SUBDIRS, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +define([AC_LIST_SUBDIRS], ifdef([AC_LIST_SUBDIRS], [AC_LIST_SUBDIRS ],)[$1])dnl +subdirs="AC_LIST_SUBDIRS" +AC_SUBST(subdirs)dnl +]) + +dnl The big finish. +dnl Produce config.status, config.h, and links; and configure subdirs. +dnl AC_OUTPUT([FILE...] [, EXTRA-CMDS] [, INIT-CMDS]) +define(AC_OUTPUT, +[trap '' 1 2 15 +AC_CACHE_SAVE +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then +changequote(, )dnl + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +changequote([, ])dnl +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +ifdef([AC_LIST_HEADER], [DEFS=-DHAVE_CONFIG_H], [AC_OUTPUT_MAKE_DEFS()]) + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +[#] [$]0 [$]ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +changequote(, )dnl +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +changequote([, ])dnl +for ac_option +do + case "[\$]ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion" + exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version AC_ACVERSION" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "[\$]ac_cs_usage"; exit 0 ;; + *) echo "[\$]ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ifdef([AC_PROVIDE_AC_PROG_INSTALL], [ac_given_INSTALL="$INSTALL" +])dnl + +changequote(<<, >>)dnl +ifdef(<>, +<>, +<>) +changequote([, ])dnl +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +undivert(AC_DIVERSION_CMDS)dnl +$2 +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +dnl config.status should not do recursion. +ifdef([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl +])dnl + +dnl Set the DEFS variable to the -D options determined earlier. +dnl This is a subroutine of AC_OUTPUT. +dnl It is called inside configure, outside of config.status. +dnl AC_OUTPUT_MAKE_DEFS() +define(AC_OUTPUT_MAKE_DEFS, +[# Transform confdefs.h into DEFS. +dnl Using a here document instead of a string reduces the quoting nightmare. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +changequote(<<, >>)dnl +s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~<<#>>$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +changequote([, ])dnl +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs +]) + +dnl Do the variable substitutions to create the Makefiles or whatever. +dnl This is a subroutine of AC_OUTPUT. It is called inside an unquoted +dnl here document whose contents are going into config.status, but +dnl upon returning, the here document is being quoted. +dnl AC_OUTPUT_FILES(FILE...) +define(AC_OUTPUT_FILES, +[# Protect against being on the right side of a sed subst in config.status. +changequote(, )dnl +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +changequote([, ])dnl +dnl These here document variables are unquoted when configure runs +dnl but quoted when config.status runs, so variables are expanded once. +$ac_vpsub +dnl Shell code in configure.in might set extrasub. +$extrasub +dnl Insert the sed substitutions of variables. +undivert(AC_DIVERSION_SED) +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then +changequote(, )dnl + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` +changequote([, ])dnl + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. +changequote(, )dnl + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` +changequote([, ])dnl + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + +ifdef([AC_PROVIDE_AC_PROG_INSTALL], +[ case "$ac_given_INSTALL" in +changequote(, )dnl + [/$]*) INSTALL="$ac_given_INSTALL" ;; +changequote([, ])dnl + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac +])dnl + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +ifdef([AC_PROVIDE_AC_PROG_INSTALL], [s%@INSTALL@%$INSTALL%g +])dnl +dnl The parens around the eval prevent an "illegal io" in Ultrix sh. +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +dnl This would break Makefile dependencies. +dnl if cmp -s $ac_file conftest.out 2>/dev/null; then +dnl echo "$ac_file is unchanged" +dnl rm -f conftest.out +dnl else +dnl rm -f $ac_file +dnl mv conftest.out $ac_file +dnl fi +fi; done +rm -f conftest.s* +]) + +dnl Create the config.h files from the config.h.in files. +dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted +dnl here document whose contents are going into config.status. +dnl AC_OUTPUT_HEADER(HEADER-FILE...) +define(AC_OUTPUT_HEADER, +[changequote(<<, >>)dnl +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='<<$>>%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' +changequote([, ])dnl + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +dnl Support passing AC_CONFIG_HEADER a value containing shell variables. +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +changequote(, )dnl + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac +changequote([, ])dnl + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +dnl Using a here document instead of a string reduces the quoting nightmare. +dnl Putting comments in sed scripts is not portable. +cat > conftest.hdr <<\EOF +changequote(<<, >>)dnl +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +changequote([, ])dnl +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +changequote(, )dnl +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +changequote([, ])dnl +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +dnl Now back to your regularly scheduled config.status. +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + changequote(, )dnl + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + changequote([, ])dnl + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +]) + +dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted +dnl here document whose contents are going into config.status. +dnl AC_OUTPUT_LINKS(SOURCE..., DEST...) +define(AC_OUTPUT_LINKS, +[EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=[$]1; shift; ac_dests=[$]* + set $ac_sources; ac_source=[$]1; shift; ac_sources=[$]* + + echo "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. + # Remove last slash and all that follows it. Not all systems have dirname. +changequote(, )dnl + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` +changequote([, ])dnl + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. +changequote(, )dnl + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` +changequote([, ])dnl + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in +changequote(, )dnl + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; +changequote([, ])dnl + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + AC_MSG_ERROR(can not link $ac_dest to $srcdir/$ac_source) + fi +done +]) + +dnl This is a subroutine of AC_OUTPUT. +dnl It is called after running config.status. +dnl AC_OUTPUT_SUBDIRS(DIRECTORY...) +define(AC_OUTPUT_SUBDIRS, +[ +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=*) + ;; + -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_config_dir in $1; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + AC_MSG_ERROR(can not create `pwd`/$ac_config_dir) + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + +changequote(, )dnl + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` +changequote([, ])dnl + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$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_config_dir) + 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 +ifdef([AC_PROVIDE_AC_PROG_INSTALL], + [ case "$ac_given_INSTALL" in +changequote(, )dnl + [/$]*) INSTALL="$ac_given_INSTALL" ;; +changequote([, ])dnl + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac +])dnl + + echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + AC_MSG_ERROR($ac_sub_configure failed for $ac_config_dir) + fi + fi + + cd $ac_popdir + done +fi +]) diff --git a/acheaders b/acheaders new file mode 100644 index 0000000..fce653d --- /dev/null +++ b/acheaders @@ -0,0 +1,28 @@ +# Ones that have their own macros. +dirent.h AC_HEADER_DIRENT +sys/ndir.h AC_HEADER_DIRENT +sys/dir.h AC_HEADER_DIRENT +ndir.h AC_HEADER_DIRENT +sys/mkdev.h AC_HEADER_MAJOR +string.h AC_HEADER_STDC +stdlib.h AC_HEADER_STDC +stddef.h AC_HEADER_STDC +stdarg.h AC_HEADER_STDC +float.h AC_HEADER_STDC +sys/wait.h AC_HEADER_SYS_WAIT +X11/Xlib.h AC_PATH_X + +# Others. +fcntl.h AC_CHECK_HEADERS +limits.h AC_CHECK_HEADERS +malloc.h AC_CHECK_HEADERS +paths.h AC_CHECK_HEADERS +sgtty.h AC_CHECK_HEADERS +strings.h AC_CHECK_HEADERS +sys/file.h AC_CHECK_HEADERS +sys/ioctl.h AC_CHECK_HEADERS +sys/time.h AC_CHECK_HEADERS +sys/window.h AC_CHECK_HEADERS +syslog.h AC_CHECK_HEADERS +termio.h AC_CHECK_HEADERS +unistd.h AC_CHECK_HEADERS diff --git a/acidentifiers b/acidentifiers new file mode 100644 index 0000000..a7979c0 --- /dev/null +++ b/acidentifiers @@ -0,0 +1,22 @@ +sys_siglist AC_DECL_SYS_SIGLIST +mode_t AC_TYPE_MODE_T +off_t AC_TYPE_OFF_T +pid_t AC_TYPE_PID_T +size_t AC_TYPE_SIZE_T +uid_t AC_TYPE_UID_T +gid_t AC_TYPE_UID_T +S_ISDIR AC_HEADER_STAT +S_ISREG AC_HEADER_STAT +S_ISCHR AC_HEADER_STAT +S_ISBLK AC_HEADER_STAT +S_ISFIFO AC_HEADER_STAT +S_ISLNK AC_HEADER_STAT +S_ISSOCK AC_HEADER_STAT +st_blksize AC_STRUCT_ST_BLKSIZE +st_blocks AC_STRUCT_ST_BLOCKS +st_rdev AC_STRUCT_ST_RDEV +timeval AC_HEADER_TIME +tm AC_STRUCT_TM +tm_zone AC_STRUCT_TIMEZONE +const AC_C_CONST +inline AC_C_INLINE diff --git a/acmakevars b/acmakevars new file mode 100644 index 0000000..721b79b --- /dev/null +++ b/acmakevars @@ -0,0 +1,11 @@ +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 diff --git a/acoldnames.m4 b/acoldnames.m4 new file mode 100644 index 0000000..d31cdd7 --- /dev/null +++ b/acoldnames.m4 @@ -0,0 +1,80 @@ +dnl Map old names of Autoconf macros to new regularized names. +dnl This file is part of Autoconf. +dnl Copyright (C) 1994 Free Software Foundation, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl General macros. +dnl +define(AC_WARN, [indir([AC_MSG_WARN], $@)])dnl +define(AC_ERROR, [indir([AC_MSG_ERROR], $@)])dnl +AC_DEFUN(AC_PROGRAM_CHECK, [indir([AC_CHECK_PROG], $@)])dnl +AC_DEFUN(AC_PROGRAM_PATH, [indir([AC_PATH_PROG], $@)])dnl +AC_DEFUN(AC_PROGRAMS_CHECK, [indir([AC_CHECK_PROGS], $@)])dnl +AC_DEFUN(AC_PROGRAMS_PATH, [indir([AC_PATH_PROGS], $@)])dnl +AC_DEFUN(AC_PREFIX, [indir([AC_PREFIX_PROGRAM], $@)])dnl +AC_DEFUN(AC_HEADER_EGREP, [indir([AC_EGREP_HEADER], $@)])dnl +AC_DEFUN(AC_PROGRAM_EGREP, [indir([AC_EGREP_CPP], $@)])dnl +AC_DEFUN(AC_TEST_PROGRAM, [indir([AC_TRY_RUN], $@)])dnl +AC_DEFUN(AC_TEST_CPP, [indir([AC_TRY_CPP], $@)])dnl +AC_DEFUN(AC_HEADER_CHECK, [indir([AC_CHECK_HEADER], $@)])dnl +AC_DEFUN(AC_FUNC_CHECK, [indir([AC_CHECK_FUNC], $@)])dnl +AC_DEFUN(AC_HAVE_FUNCS, [indir([AC_CHECK_FUNCS], $@)])dnl +AC_DEFUN(AC_HAVE_HEADERS, [indir([AC_CHECK_HEADERS], $@)])dnl +AC_DEFUN(AC_SIZEOF_TYPE, [indir([AC_CHECK_SIZEOF], $@)])dnl +dnl +dnl Specific macros. +dnl +AC_DEFUN(AC_GCC_TRADITIONAL, [indir([AC_PROG_GCC_TRADITIONAL])])dnl +AC_DEFUN(AC_MINUS_C_MINUS_O, [indir([AC_PROG_CC_C_O])])dnl +AC_DEFUN(AC_SET_MAKE, [indir([AC_PROG_MAKE_SET])])dnl +AC_DEFUN(AC_YYTEXT_POINTER, [indir([AC_DECL_YYTEXT])])dnl +AC_DEFUN(AC_LN_S, [indir([AC_PROG_LN_S])])dnl +AC_DEFUN(AC_STDC_HEADERS, [indir([AC_HEADER_STDC])])dnl +AC_DEFUN(AC_MAJOR_HEADER, [indir([AC_HEADER_MAJOR])])dnl +AC_DEFUN(AC_STAT_MACROS_BROKEN, [indir([AC_HEADER_STAT])])dnl +AC_DEFUN(AC_SYS_SIGLIST_DECLARED, [indir([AC_DECL_SYS_SIGLIST])])dnl +AC_DEFUN(AC_GETGROUPS_T, [indir([AC_TYPE_GETGROUPS])])dnl +AC_DEFUN(AC_UID_T, [indir([AC_TYPE_UID_T])])dnl +AC_DEFUN(AC_SIZE_T, [indir([AC_TYPE_SIZE_T])])dnl +AC_DEFUN(AC_PID_T, [indir([AC_TYPE_PID_T])])dnl +AC_DEFUN(AC_OFF_T, [indir([AC_TYPE_OFF_T])])dnl +AC_DEFUN(AC_MODE_T, [indir([AC_TYPE_MODE_T])])dnl +AC_DEFUN(AC_RETSIGTYPE, [indir([AC_TYPE_SIGNAL])])dnl +AC_DEFUN(AC_MMAP, [indir([AC_FUNC_MMAP])])dnl +AC_DEFUN(AC_VPRINTF, [indir([AC_FUNC_VPRINTF])])dnl +AC_DEFUN(AC_VFORK, [indir([AC_FUNC_VFORK])])dnl +AC_DEFUN(AC_WAIT3, [indir([AC_FUNC_WAIT3])])dnl +AC_DEFUN(AC_ALLOCA, [indir([AC_FUNC_ALLOCA])])dnl +AC_DEFUN(AC_GETLOADAVG, [indir([AC_FUNC_GETLOADAVG])])dnl +AC_DEFUN(AC_UTIME_NULL, [indir([AC_FUNC_UTIME_NULL])])dnl +AC_DEFUN(AC_STRCOLL, [indir([AC_FUNC_STRCOLL])])dnl +AC_DEFUN(AC_SETVBUF_REVERSED, [indir([AC_FUNC_SETVBUF_REVERSED])])dnl +AC_DEFUN(AC_TIME_WITH_SYS_TIME, [indir([AC_HEADER_TIME])])dnl +AC_DEFUN(AC_TIMEZONE, [indir([AC_STRUCT_TIMEZONE])])dnl +AC_DEFUN(AC_ST_BLOCKS, [indir([AC_STRUCT_ST_BLOCKS])])dnl +AC_DEFUN(AC_ST_BLKSIZE, [indir([AC_STRUCT_ST_BLKSIZE])])dnl +AC_DEFUN(AC_ST_RDEV, [indir([AC_STRUCT_ST_RDEV])])dnl +AC_DEFUN(AC_CROSS_CHECK, [indir([AC_C_CROSS])])dnl +AC_DEFUN(AC_CHAR_UNSIGNED, [indir([AC_C_CHAR_UNSIGNED])])dnl +AC_DEFUN(AC_LONG_DOUBLE, [indir([AC_C_LONG_DOUBLE])])dnl +AC_DEFUN(AC_WORDS_BIGENDIAN, [indir([AC_C_BIGENDIAN])])dnl +AC_DEFUN(AC_INLINE, [indir([AC_C_INLINE])])dnl +AC_DEFUN(AC_CONST, [indir([AC_C_CONST])])dnl +AC_DEFUN(AC_LONG_FILE_NAMES, [indir([AC_SYS_LONG_FILE_NAMES])])dnl +AC_DEFUN(AC_RESTARTABLE_SYSCALLS, [indir([AC_SYS_RESTARTABLE_SYSCALLS])])dnl +AC_DEFUN(AC_FIND_X, [indir([AC_PATH_X])])dnl +AC_DEFUN(AC_FIND_XTRA, [indir([AC_PATH_XTRA])])dnl diff --git a/acprograms b/acprograms new file mode 100644 index 0000000..be237e3 --- /dev/null +++ b/acprograms @@ -0,0 +1,18 @@ +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 +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 diff --git a/acspecific.m4 b/acspecific.m4 new file mode 100644 index 0000000..5c6f1c9 --- /dev/null +++ b/acspecific.m4 @@ -0,0 +1,2758 @@ +dnl Macros that test for specific features. +dnl This file is part of Autoconf. +dnl Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception, the Free Software Foundation gives unlimited +dnl permission to copy, distribute and modify the configure scripts that +dnl are the output of Autoconf. You need not follow the terms of the GNU +dnl General Public License when using or distributing such scripts, even +dnl though portions of the text of Autoconf appear in them. The GNU +dnl General Public License (GPL) does govern all other use of the material +dnl that constitutes the Autoconf program. +dnl +dnl Certain portions of the Autoconf source text are designed to be copied +dnl (in certain cases, depending on the input) into the output of +dnl Autoconf. We call these the "data" portions. The rest of the Autoconf +dnl source text consists of comments plus executable code that decides which +dnl of the data portions to output in any given case. We call these +dnl comments and executable code the "non-data" portions. Autoconf never +dnl copies any of the non-data portions into its output. +dnl +dnl This special exception to the GPL applies to versions of Autoconf +dnl released by the Free Software Foundation. When you make and +dnl distribute a modified version of Autoconf, you may extend this special +dnl exception to the GPL to apply to your modified version as well, *unless* +dnl your modified version has the potential to copy into its output some +dnl of the text that was the non-data portion of the version that you started +dnl with. (In other words, unless your change moves or copies text from +dnl the non-data portions to the data portions.) If your modification has +dnl such potential, you must delete any notice of this special exception +dnl to the GPL from your modified version. +dnl +dnl Written by David MacKenzie, with help from +dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +dnl ### Checks for programs + + +dnl Check whether to use -n, \c, or newline-tab to separate +dnl checking messages from result messages. +dnl Idea borrowed from dist 3.0. +dnl Internal use only. +AC_DEFUN(AC_PROG_ECHO_N, +[if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi +]) + +AC_DEFUN(AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + AC_CHECK_PROG(CC, cl, cl) ;; + esac + fi + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_WORKS +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +AC_PROG_CC_G +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 +]) + +AC_DEFUN(AC_PROG_CXX, +[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl +AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc) + +AC_PROG_CXX_WORKS +AC_PROG_CXX_GNU + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +dnl Check whether -g works, even if CXXFLAGS is set, in case the package +dnl plays around with CXXFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. +ac_test_CXXFLAGS="${CXXFLAGS+set}" +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= +AC_PROG_CXX_G +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 Determine a Fortran 77 compiler to use. If `F77' is not already set +dnl in the environment, check for `g77', `f77' and `f2c', in that order. +dnl Set the output variable `F77' to the name of the compiler found. +dnl +dnl If using `g77' (the GNU Fortran 77 compiler), then `AC_PROG_F77' +dnl will set the shell variable `G77' to `yes', and empty otherwise. If +dnl the output variable `FFLAGS' was not already set in the environment, +dnl then set it to `-g -02' for `g77' (or `-O2' where `g77' does not +dnl accept `-g'). Otherwise, set `FFLAGS' to `-g' for all other Fortran +dnl 77 compilers. +dnl +dnl AC_PROG_F77() +AC_DEFUN(AC_PROG_F77, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +if test -z "$F77"; then + AC_CHECK_PROGS(F77, g77 f77 f2c) + test -z "$F77" && AC_MSG_ERROR([no acceptable Fortran 77 compiler found in \$PATH]) +fi + +AC_PROG_F77_WORKS +AC_PROG_F77_GNU + +if test $ac_cv_prog_g77 = yes; then + G77=yes +dnl Check whether -g works, even if FFLAGS is set, in case the package +dnl plays around with FFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_FFLAGS="${FFLAGS+set}" + ac_save_FFLAGS="$FFLAGS" + FFLAGS= + AC_PROG_F77_G + if test "$ac_test_FFLAGS" = set; then + FFLAGS="$ac_save_FFLAGS" + elif test $ac_cv_prog_f77_g = yes; then + FFLAGS="-g -O2" + else + FFLAGS="-O2" + fi +else + G77= + test "${FFLAGS+set}" = set || FFLAGS="-g" +fi +]) + +AC_DEFUN(AC_PROG_CC_WORKS, +[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works]) +AC_LANG_SAVE +AC_LANG_C +AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross) +AC_LANG_RESTORE +AC_MSG_RESULT($ac_cv_prog_cc_works) +if test $ac_cv_prog_cc_works = no; then + AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.]) +fi +AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler]) +AC_MSG_RESULT($ac_cv_prog_cc_cross) +cross_compiling=$ac_cv_prog_cc_cross +]) + +AC_DEFUN(AC_PROG_CXX_WORKS, +[AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works]) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILER([int main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross) +AC_LANG_RESTORE +AC_MSG_RESULT($ac_cv_prog_cxx_works) +if test $ac_cv_prog_cxx_works = no; then + AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.]) +fi +AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler]) +AC_MSG_RESULT($ac_cv_prog_cxx_cross) +cross_compiling=$ac_cv_prog_cxx_cross +]) + +dnl Test whether the Fortran 77 compiler can compile and link a trivial +dnl Fortran program. Also, test whether the Fortran 77 compiler is a +dnl cross-compiler (which may realistically be the case if the Fortran +dnl compiler is `g77'). +dnl +dnl AC_PROG_F77_WORKS() +AC_DEFUN(AC_PROG_F77_WORKS, +[AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) works]) +AC_LANG_SAVE +AC_LANG_FORTRAN77 +AC_TRY_COMPILER(dnl +[ program conftest + end +], ac_cv_prog_f77_works, ac_cv_prog_f77_cross) +AC_LANG_RESTORE +AC_MSG_RESULT($ac_cv_prog_f77_works) +if test $ac_cv_prog_f77_works = no; then + AC_MSG_ERROR([installation or configuration problem: Fortran 77 compiler cannot create executables.]) +fi +AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler]) +AC_MSG_RESULT($ac_cv_prog_f77_cross) +cross_compiling=$ac_cv_prog_f77_cross +]) + +AC_DEFUN(AC_PROG_CC_GNU, +[AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc, +[dnl The semicolon is to pacify NeXT's syntax-checking cpp. +cat > conftest.c </dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi])]) + +AC_DEFUN(AC_PROG_CXX_GNU, +[AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx, +[dnl The semicolon is to pacify NeXT's syntax-checking cpp. +cat > conftest.C </dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi])]) + +dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77 +dnl Compiler). This test depends on whether the Fortran 77 compiler can +dnl do CPP pre-processing. +dnl +dnl AC_PROG_F77_GNU() +AC_DEFUN(AC_PROG_F77_GNU, +[AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77, +[cat > conftest.fpp </dev/null 2>&1; then + ac_cv_prog_g77=yes +else + ac_cv_prog_g77=no +fi])]) + +AC_DEFUN(AC_PROG_CC_G, +[AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g, +[echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* +])]) + +AC_DEFUN(AC_PROG_CXX_G, +[AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g, +[echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* +])]) + +dnl Test whether the Fortran 77 compiler can accept the `-g' option to +dnl enable debugging. +dnl +dnl AC_PROG_F77_G() +AC_DEFUN(AC_PROG_F77_G, +[AC_CACHE_CHECK(whether $F77 accepts -g, ac_cv_prog_f77_g, +[cat > conftest.f << EOF + program conftest + end +EOF +if test -z "`$F77 -g -c conftest.f 2>&1`"; then + ac_cv_prog_f77_g=yes +else + ac_cv_prog_f77_g=no +fi +rm -f conftest* +])]) + +AC_DEFUN(AC_PROG_GCC_TRADITIONAL, +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +if test $ac_cv_prog_gcc = yes; then + AC_CACHE_CHECK(whether ${CC-cc} needs -traditional, + ac_cv_prog_gcc_traditional, +[ ac_pattern="Autoconf.*'x'" + AC_EGREP_CPP($ac_pattern, [#include +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 +Autoconf TCGETA], + ac_cv_prog_gcc_traditional=yes) + fi]) + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi +]) + +AC_DEFUN(AC_PROG_CC_C_O, +[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 | +changequote(, )dnl + sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" +changequote([, ])dnl +AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o, +[echo 'foo(){}' > conftest.c +# 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-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC' +if AC_TRY_EVAL(ac_try) && + test -f conftest.o && 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.c 1>&AC_FD_CC); then + ac_try='cc -c conftest.c -o conftest.o 1>&AC_FD_CC' + if AC_TRY_EVAL(ac_try) && + test -f conftest.o && 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 -f 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) +fi +]) + +dnl Test if the Fortran 77 compiler accepts the options `-c' and `-o' +dnl simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not. +dnl +dnl The usefulness of this macro is questionable, as I can't really see +dnl why anyone would use it. The only reason I include it is for +dnl completeness, since a similar test exists for the C compiler. +dnl +dnl AC_PROG_F77_C_O +AC_DEFUN(AC_PROG_F77_C_O, +[AC_BEFORE([$0], [AC_PROG_F77])dnl +AC_MSG_CHECKING(whether $F77 understand -c and -o together) +set dummy $F77; ac_f77="`echo [$]2 | +changequote(, )dnl +sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" +changequote([, ])dnl +AC_CACHE_VAL(ac_cv_prog_f77_${ac_f77}_c_o, +[cat > conftest.f << EOF + program conftest + end +EOF +# We do the `AC_TRY_EVAL' 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.f -o conftest.o 1>&AC_FD_CC' +if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then + eval ac_cv_prog_f77_${ac_f77}_c_o=yes +else + eval ac_cv_prog_f77_${ac_f77}_c_o=no +fi +rm -f conftest* +])dnl +if eval "test \"`echo '$ac_cv_prog_f77_'${ac_f77}_c_o`\" = yes"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) + AC_DEFINE(F77_NO_MINUS_C_MINUS_O) +fi +]) + +dnl 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 > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +changequote(, )dnl +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +changequote([, ])dnl +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake])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_DEFUN(AC_PROG_RANLIB, +[AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)]) + +dnl Check for mawk first since it's generally faster. +AC_DEFUN(AC_PROG_AWK, +[AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )]) + +AC_DEFUN(AC_PROG_YACC, +[AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)]) + +AC_DEFUN(AC_PROG_CPP, +[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, +[ # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. +dnl Use a header file that comes with gcc, so configuring glibc +dnl with a fresh cross-compiler works. + AC_TRY_CPP([#include +Syntax Error], , + CPP="${CC-cc} -E -traditional-cpp" + AC_TRY_CPP([#include +Syntax Error], , + CPP="${CC-cc} -nologo -E" + AC_TRY_CPP([#include +Syntax Error], , CPP=/lib/cpp))) + ac_cv_prog_CPP="$CPP"])dnl + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +AC_MSG_RESULT($CPP) +AC_SUBST(CPP)dnl +]) + +AC_DEFUN(AC_PROG_CXXCPP, +[AC_MSG_CHECKING(how to run the C++ preprocessor) +if test -z "$CXXCPP"; then +AC_CACHE_VAL(ac_cv_prog_CXXCPP, +[AC_LANG_SAVE[]dnl +AC_LANG_CPLUSPLUS[]dnl + CXXCPP="${CXX-g++} -E" + AC_TRY_CPP([#include ], , CXXCPP=/lib/cpp) + ac_cv_prog_CXXCPP="$CXXCPP" +AC_LANG_RESTORE[]dnl +fi])dnl +CXXCPP="$ac_cv_prog_CXXCPP" +AC_MSG_RESULT($CXXCPP) +AC_SUBST(CXXCPP)dnl +]) + +dnl Require finding the C or C++ preprocessor, whichever is the +dnl current language. +AC_DEFUN(AC_REQUIRE_CPP, +[ifelse(AC_LANG, C, [AC_REQUIRE([AC_PROG_CPP])], [AC_REQUIRE([AC_PROG_CXXCPP])])]) + +AC_DEFUN(AC_PROG_LEX, +[AC_CHECK_PROG(LEX, flex, flex, lex) +if test -z "$LEXLIB" +then + case "$LEX" in + flex*) ac_lib=fl ;; + *) ac_lib=l ;; + esac + AC_CHECK_LIB($ac_lib, yywrap, LEXLIB="-l$ac_lib") +fi +AC_SUBST(LEXLIB)]) + +dnl Check if lex declares yytext as a char * by default, not a char[]. +undefine([AC_DECL_YYTEXT]) +AC_DEFUN(AC_DECL_YYTEXT, +[AC_REQUIRE_CPP()dnl +AC_REQUIRE([AC_PROG_LEX])dnl +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_TRY_LINK(`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) +fi +]) + +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 +# 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, +[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" +])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_PROGRAM}' +AC_SUBST(INSTALL_SCRIPT)dnl + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +AC_SUBST(INSTALL_DATA)dnl +]) + +AC_DEFUN(AC_PROG_LN_S, +[AC_MSG_CHECKING(whether ln -s works) +AC_CACHE_VAL(ac_cv_prog_LN_S, +[rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi])dnl +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_SUBST(LN_S)dnl +]) + +define(AC_RSH, +[errprint(__file__:__line__: [$0] has been removed; replace it with equivalent code +)m4exit(4)]) + + +dnl ### Checks for header files + + +AC_DEFUN(AC_HEADER_STDC, +[AC_REQUIRE_CPP()dnl +AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc, +[AC_TRY_CPP([#include +#include +#include +#include ], 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 +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } +], , ac_cv_header_stdc=no, :) +fi]) +if test $ac_cv_header_stdc = yes; then + AC_DEFINE(STDC_HEADERS) +fi +]) + +AC_DEFUN(AC_UNISTD_H, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(unistd.h)])dnl +AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))]) + +AC_DEFUN(AC_USG, +[AC_OBSOLETE([$0], + [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H])dnl +AC_MSG_CHECKING([for BSD string and memory functions]) +AC_TRY_LINK([#include ], [rindex(0, 0); bzero(0, 0);], + [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); AC_DEFINE(USG)])]) + + +dnl If memchr and the like aren't declared in , include . +dnl To avoid problems, don't check for gcc2 built-ins. +AC_DEFUN(AC_MEMORY_H, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H])dnl +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 +]) + +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 ], [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)]) + + if test $ac_cv_header_sys_mkdev_h = no; then +AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)]) + fi +fi +]) + +AC_DEFUN(AC_HEADER_DIRENT, +[ac_header_dirent=no +AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h, + [ac_header_dirent=$ac_hdr; break]) +# 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 +]) + +dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE +dnl defines the type `DIR'. dirent.h on NextStep 3.2 doesn't. +dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND) +AC_DEFUN(AC_CHECK_HEADER_DIRENT, +[ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` +AC_MSG_CHECKING([for $1 that defines DIR]) +AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe, +[AC_TRY_COMPILE([#include +#include <$1>], [DIR *dirp = 0;], + eval "ac_cv_header_dirent_$ac_safe=yes", + eval "ac_cv_header_dirent_$ac_safe=no")])dnl +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + AC_MSG_RESULT(yes) + $2 +else + AC_MSG_RESULT(no) +fi +]) + +dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that +dnl defines `DIR'. +dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION]) +define(AC_CHECK_HEADERS_DIRENT, +[for ac_hdr in $1 +do +AC_CHECK_HEADER_DIRENT($ac_hdr, +[changequote(, )dnl + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl +done]) + +AC_DEFUN(AC_DIR_HEADER, +[AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl +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_header_dirent=$ac_hdr; break]) +done + +case "$ac_header_dirent" in +dirent.h) AC_DEFINE(DIRENT) ;; +sys/ndir.h) AC_DEFINE(SYSNDIR) ;; +sys/dir.h) AC_DEFINE(SYSDIR) ;; +ndir.h) AC_DEFINE(NDIR) ;; +esac + +AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void, +[AC_TRY_RUN([#include +#include <$ac_header_dirent> +int closedir(); main() { exit(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(VOID_CLOSEDIR) +fi +]) + +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 +#include + +#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) +fi +]) + +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_TRY_COMPILE([#include +#include +/* NetBSD declares sys_siglist in unistd.h. */ +#ifdef HAVE_UNISTD_H +#include +#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) +fi +]) + +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_TRY_COMPILE([#include +#include +#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) +fi +]) + + +dnl ### Checks for typedefs + + +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_TRY_RUN( +changequote(<<, >>)dnl +<< +/* Thanks to Mike Rendell for this test. */ +#include +#define NGID 256 +#undef MAX +#define MAX(x, y) ((x) > (y) ? (x) : (y)) +main() +{ + gid_t gidset[NGID]; + int i, n; + union { gid_t gval; long lval; } val; + + val.lval = -1; + for (i = 0; i < NGID; i++) + gidset[i] = val.gval; + n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, + gidset); + /* Exit non-zero if getgroups seems to require an array of ints. This + happens when gid_t is short but getgroups modifies an array of ints. */ + exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); +} +>>, +changequote([, ])dnl + 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 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) +]) + +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) + AC_DEFINE(gid_t, int) +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)]) + +dnl 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_TRY_COMPILE([#include +#include +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif +], +[int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)]) +AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal) +]) + + +dnl ### Checks for functions + + +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_TRY_RUN([#include +#include <$ac_header_dirent> +int closedir(); main() { exit(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) +fi +]) + +AC_DEFUN(AC_FUNC_FNMATCH, +[AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works, +# Some versions of Solaris or SCO have a broken fnmatch function. +# So we run a test program. If we are cross-compiling, take no chance. +# Thanks to John Oleynick and Franc,ois Pinard for this test. +[AC_TRY_RUN([main() { exit (fnmatch ("a*", "abc", 0) != 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) +fi +]) + +AC_DEFUN(AC_FUNC_MMAP, +[AC_CHECK_HEADERS(unistd.h) +AC_CHECK_FUNCS(getpagesize) +AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, +[AC_TRY_RUN([ +/* 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 filesystem buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated 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 +#include +#include + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); +} +], 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) +fi +]) + +AC_DEFUN(AC_FUNC_GETPGRP, +[AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void, +[AC_TRY_RUN([ +/* + * 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 + */ +#include +#include + +int pid; +int pg1, pg2, pg3, pg4; +int ng, np, s, child; + +main() +{ + pid = getpid(); + pg1 = getpgrp(0); + pg2 = getpgrp(); + pg3 = getpgrp(pid); + pg4 = getpgrp(1); + + /* + * If all of these values are the same, it's pretty sure that + * we're on a system that ignores getpgrp's first argument. + */ + if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) + exit(0); + + child = fork(); + if (child < 0) + exit(1); + else if (child == 0) { + np = getpid(); + /* + * If this is Sys V, this will not work; pgrp will be + * set to np because setpgrp just changes a pgrp to be + * the same as the pid. + */ + setpgrp(np, pg1); + ng = getpgrp(0); /* Same result for Sys V and BSD */ + if (ng == pg1) { + exit(1); + } else { + exit(0); + } + } else { + wait(&s); + exit(s>>8); + } +} +], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no, + AC_MSG_ERROR(cannot check getpgrp if cross compiling)) +]) +if test $ac_cv_func_getpgrp_void = yes; then + AC_DEFINE(GETPGRP_VOID) +fi +]) + +AC_DEFUN(AC_FUNC_SETPGRP, +[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, +AC_TRY_RUN([ +#ifdef HAVE_UNISTD_H +#include +#endif + +/* + * If this system has a BSD-style setpgrp, which takes arguments, exit + * successfully. + */ +main() +{ + if (setpgrp(1,1) == -1) + exit(0); + else + exit(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) +fi +]) + +AC_DEFUN(AC_FUNC_VPRINTF, +[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 +]) + +AC_DEFUN(AC_FUNC_VFORK, +[AC_REQUIRE([AC_TYPE_PID_T])dnl +AC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H)) +AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, +[AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */ +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_VFORK_H +#include +#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 , + but some compilers (e.g. gcc -O) don't grok . + Test for this by using a static variable whose address + is put into a register that is clobbered by the vfork. */ +static +#ifdef __cplusplus +sparc_address_test (int arg) +#else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} +main() { + 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) + ; + exit( + /* 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_CHECK_FUNC(vfork) +ac_cv_func_vfork_works=$ac_cv_func_vfork)]) +if test $ac_cv_func_vfork_works = no; then + AC_DEFINE(vfork, fork) +fi +]) + +AC_DEFUN(AC_FUNC_WAIT3, +[AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage, +[AC_TRY_RUN([#include +#include +#include +#include +/* HP-UX has wait3 but does not fill in rusage at all. */ +main() { + 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); + case -1: _exit(0); /* What can we do? */ + default: /* Parent. */ + wait3(&i, 0, &r); + sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines. */ + exit(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) +fi +]) + +AC_DEFUN(AC_FUNC_ALLOCA, +[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. +# 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_header_alloca_h, +[AC_TRY_LINK([#include ], [char *p = alloca(2 * sizeof(int));], + ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)]) +if test $ac_cv_header_alloca_h = yes; then + AC_DEFINE(HAVE_ALLOCA_H) +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 +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif +], [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) +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.${ac_objext} + AC_DEFINE(C_ALLOCA) + +AC_CACHE_CHECK(whether alloca 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) + break]) +done +fi + +AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, +[AC_TRY_RUN([find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, + ac_cv_c_stack_direction=0)]) +AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) +fi +AC_SUBST(ALLOCA)dnl +]) + +AC_DEFUN(AC_FUNC_GETLOADAVG, +[ac_have_func=no # yes means we've found a way to get the load average. + +# 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. +AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS") +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]) + +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. +AC_REPLACE_FUNCS(getloadavg) + +if test $ac_cv_func_getloadavg = yes; then + AC_DEFINE(HAVE_GETLOADAVG) + ac_have_func=yes +else + # 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) + AC_CHECK_LIB(dgc, dg_sys_info)]) + + # We cannot check for , because Solaris 2 does not use dwarf (it + # uses stabs), but it is still SVR4. We cannot check for 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) + fi + + if test $ac_have_func = no; then + AC_CHECK_HEADER(inq_stats/cpustats.h, + [ac_have_func=yes; AC_DEFINE(UMAX) + AC_DEFINE(UMAX4_3)]) + 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_HEADER(nlist.h, + [AC_DEFINE(NLIST_STRUCT) + AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un, + [AC_TRY_COMPILE([#include ], + [struct nlist n; n.n_un.n_name = 0;], + ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)]) + if test $ac_cv_struct_nlist_n_un = yes; then + AC_DEFINE(NLIST_NAME_UNION) + fi + ])dnl +fi # Do not have getloadavg in system libraries. + +# 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) +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, +[changequote(, )dnl + # 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;'` +changequote([, ])dnl +]) + KMEM_GROUP=$ac_cv_group_kmem +fi +AC_SUBST(KMEM_GROUP)dnl +]) + +AC_DEFUN(AC_FUNC_UTIME_NULL, +[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null, +[rm -f conftestdata; > conftestdata +# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. +AC_TRY_RUN([#include +#include +main() { +struct stat s, t; +exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0 +&& stat("conftestdata", &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) +fi +]) + +AC_DEFUN(AC_FUNC_STRCOLL, +[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works, +[AC_TRY_RUN([#include +main () +{ + exit (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) +fi +]) + +AC_DEFUN(AC_FUNC_SETVBUF_REVERSED, +[AC_CACHE_CHECK(whether setvbuf arguments are reversed, + ac_cv_func_setvbuf_reversed, +[AC_TRY_RUN([#include +/* If setvbuf has the reversed format, exit 0. */ +main () { + /* 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) + exit(1); + putc('\r', stdout); + exit(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) +fi +]) + +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)])]) + +AC_DEFUN(AC_FUNC_STRFTIME, +[AC_CHECK_FUNC(strftime, [AC_DEFINE(HAVE_STRFTIME)], +[# strftime is in -lintl on SCO UNIX. +AC_CHECK_LIB(intl, strftime, +[AC_DEFINE(HAVE_STRFTIME) +LIBS="-lintl $LIBS"])])]) + +AC_DEFUN(AC_FUNC_MEMCMP, +[AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean, +[AC_TRY_RUN([ +main() +{ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1); +} +], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no, +ac_cv_func_memcmp_clean=no)]) +test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" +AC_SUBST(LIBOBJS)dnl +]) + +AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, +[AC_MSG_CHECKING([types of arguments for select()]) + AC_CACHE_VAL(ac_cv_func_select_arg234,dnl + [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl + [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl + [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do + for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do + AC_TRY_COMPILE(dnl +[#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl + [ac_not_found=no ; break 3],ac_not_found=yes) + done + done + done + ])dnl AC_CACHE_VAL + ])dnl AC_CACHE_VAL + ])dnl AC_CACHE_VAL + if test "$ac_not_found" = yes; then + ac_cv_func_select_arg1=int + ac_cv_func_select_arg234='int *' + ac_cv_func_select_arg5='struct timeval *' + fi + AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5]) + AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1) + AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234)) + AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5)) +]) + + +dnl ### Checks for structure members + + +AC_DEFUN(AC_HEADER_TIME, +[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included], + ac_cv_header_time, +[AC_TRY_COMPILE([#include +#include +#include ], +[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)]) +if test $ac_cv_header_time = yes; then + AC_DEFINE(TIME_WITH_SYS_TIME) +fi +]) + +AC_DEFUN(AC_STRUCT_TM, +[AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h], + ac_cv_struct_tm, +[AC_TRY_COMPILE([#include +#include ], +[struct tm *tp; tp->tm_sec;], + 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) +fi +]) + +AC_DEFUN(AC_STRUCT_TIMEZONE, +[AC_REQUIRE([AC_STRUCT_TM])dnl +AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone, +[AC_TRY_COMPILE([#include +#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;], + ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)]) +if test "$ac_cv_struct_tm_zone" = yes; then + AC_DEFINE(HAVE_TM_ZONE) +else + AC_CACHE_CHECK(for tzname, ac_cv_var_tzname, +[AC_TRY_LINK( +changequote(<<, >>)dnl +<<#include +#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)]) + if test $ac_cv_var_tzname = yes; then + AC_DEFINE(HAVE_TZNAME) + fi +fi +]) + +AC_DEFUN(AC_STRUCT_ST_BLOCKS, +[AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks, +[AC_TRY_COMPILE([#include +#include ], [struct stat s; s.st_blocks;], +ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)]) +if test $ac_cv_struct_st_blocks = yes; then + AC_DEFINE(HAVE_ST_BLOCKS) +else + LIBOBJS="$LIBOBJS fileblocks.${ac_objext}" +fi +AC_SUBST(LIBOBJS)dnl +]) + +AC_DEFUN(AC_STRUCT_ST_BLKSIZE, +[AC_CACHE_CHECK([for st_blksize in struct stat], ac_cv_struct_st_blksize, +[AC_TRY_COMPILE([#include +#include ], [struct stat s; s.st_blksize;], +ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)]) +if test $ac_cv_struct_st_blksize = yes; then + AC_DEFINE(HAVE_ST_BLKSIZE) +fi +]) + +AC_DEFUN(AC_STRUCT_ST_RDEV, +[AC_CACHE_CHECK([for st_rdev in struct stat], ac_cv_struct_st_rdev, +[AC_TRY_COMPILE([#include +#include ], [struct stat s; s.st_rdev;], +ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)]) +if test $ac_cv_struct_st_rdev = yes; then + AC_DEFINE(HAVE_ST_RDEV) +fi +]) + + +dnl ### Checks for compiler characteristics + + +AC_DEFUN(AC_C_CROSS, +[AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])]) + +AC_DEFUN(AC_C_CHAR_UNSIGNED, +[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, +[if test "$GCC" = yes; then + # GCC predefines this symbol on systems where it applies. +AC_EGREP_CPP(yes, +[#ifdef __CHAR_UNSIGNED__ + yes +#endif +], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no) +else +AC_TRY_RUN( +[/* volatile prevents gcc2 from optimizing the test away on sparcs. */ +#if !defined(__STDC__) || __STDC__ != 1 +#define volatile +#endif +main() { + volatile char c = 255; exit(c < 0); +}], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no) +fi]) +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + AC_DEFINE(__CHAR_UNSIGNED__) +fi +]) + +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() { +/* 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. */ +exit(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) +fi +]) + +AC_DEFUN(AC_INT_16_BITS, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnl +AC_MSG_CHECKING(whether int is 16 bits) +AC_TRY_RUN([main() { exit(sizeof(int) != 2); }], + [AC_MSG_RESULT(yes) + AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no)) +]) + +AC_DEFUN(AC_LONG_64_BITS, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnl +AC_MSG_CHECKING(whether long int is 64 bits) +AC_TRY_RUN([main() { exit(sizeof(long int) != 8); }], + [AC_MSG_RESULT(yes) + AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no)) +]) + +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_TRY_COMPILE([#include +#include ], [ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. +AC_TRY_COMPILE([#include +#include ], [ +#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([main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (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) +fi +]) + +dnl Do nothing if the compiler accepts the inline keyword. +dnl Otherwise define inline to __inline__ or __inline if one of those work, +dnl otherwise define inline to be empty. +AC_DEFUN(AC_C_INLINE, +[AC_CACHE_CHECK([for inline], ac_cv_c_inline, +[ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break]) +done +]) +case "$ac_cv_c_inline" in + inline | yes) ;; + no) AC_DEFINE(inline, ) ;; + *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;; +esac +]) + +AC_DEFUN(AC_C_CONST, +[dnl This message is consistent in form with the other checking messages, +dnl and with the result message. +AC_CACHE_CHECK([for working const], ac_cv_c_const, +[AC_TRY_COMPILE(, +changequote(<<, >>)dnl +<< +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset 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}; +/* 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; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++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; +} +>>, +changequote([, ])dnl +ac_cv_c_const=yes, ac_cv_c_const=no)]) +if test $ac_cv_c_const = no; then + AC_DEFINE(const, ) +fi +]) + +AC_DEFUN(AC_C_STRINGIZE, [ +AC_REQUIRE([AC_PROG_CPP]) +AC_MSG_CHECKING([for preprocessor stringizing operator]) +AC_CACHE_VAL(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) +fi +AC_MSG_RESULT([${ac_cv_c_stringize}]) +])dnl + +define(AC_ARG_ARRAY, +[errprint(__file__:__line__: [$0] has been removed; don't do unportable things with arguments +)m4exit(4)]) + +dnl Check the object extension used by the compiler: typically .o or +dnl .obj. If this is called, some other behaviour will change, +dnl determined by ac_objext. +AC_DEFUN(AC_OBJEXT, +[AC_MSG_CHECKING([for object suffix]) +AC_CACHE_VAL(ac_cv_objext, +[rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if AC_TRY_EVAL(ac_compile); then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + AC_MSG_ERROR([installation or configuration problem; compiler does not work]) +fi +rm -f conftest*]) +AC_MSG_RESULT($ac_cv_objext) +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext +AC_SUBST(OBJEXT)]) + +dnl Determine the linker flags (e.g. `-L' and `-l') for the Fortran 77 +dnl intrinsic and run-time libraries that are required to successfully +dnl link a Fortran 77 program or shared library. The output variable +dnl FLIBS is set to these flags. +dnl +dnl This macro is intended to be used in those situations when it is +dnl necessary to mix, e.g. C++ and Fortran 77, source code into a single +dnl program or shared library. +dnl +dnl For example, if object files from a C++ and Fortran 77 compiler must +dnl be linked together, then the C++ compiler/linker must be used for +dnl linking (since special C++-ish things need to happen at link time +dnl like calling global constructors, instantiating templates, enabling +dnl exception support, etc.). +dnl +dnl However, the Fortran 77 intrinsic and run-time libraries must be +dnl linked in as well, but the C++ compiler/linker doesn't know how to +dnl add these Fortran 77 libraries. Hence, the macro +dnl `AC_F77_LIBRARY_LDFLAGS' was created to determine these Fortran 77 +dnl libraries. +dnl +dnl This macro was packaged in its current form by Matthew D. Langston +dnl . However, nearly all of this macro +dnl came from the `OCTAVE_FLIBS' macro in `octave-2.0.13/aclocal.m4', +dnl and full credit should go to John W. Eaton for writing this +dnl extremely useful macro. Thank you John. +dnl +dnl AC_F77_LIBRARY_LDFLAGS() +AC_DEFUN(AC_F77_LIBRARY_LDFLAGS, +[AC_MSG_CHECKING([for Fortran 77 libraries]) +AC_REQUIRE([AC_PROG_F77]) +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_CACHE_VAL(ac_cv_flibs, +[changequote(, )dnl +dnl Write a minimal program and compile it with -v. I don't know what +dnl to do if your compiler doesn't have -v... +echo " END" > conftest.f +foutput=`${F77} -v -o conftest conftest.f 2>&1` +dnl +dnl The easiest thing to do for xlf output is to replace all the commas +dnl with spaces. Try to only do that if the output is really from xlf, +dnl since doing that causes problems on other systems. +dnl +xlf_p=`echo $foutput | grep xlfentry` +if test -n "$xlf_p"; then + foutput=`echo $foutput | sed 's/,/ /g'` +fi +dnl +ld_run_path=`echo $foutput | \ + sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'` +dnl +dnl We are only supposed to find this on Solaris systems... +dnl Uh, the run path should be absolute, shouldn't it? +dnl +case "$ld_run_path" in + /*) + if test "$ac_cv_prog_gcc" = yes; then + ld_run_path="-Xlinker -R -Xlinker $ld_run_path" + else + ld_run_path="-R $ld_run_path" + fi + ;; + *) + ld_run_path= + ;; +esac +dnl +flibs= +lflags= +dnl +dnl If want_arg is set, we know we want the arg to be added to the list, +dnl so we don't have to examine it. +dnl +want_arg= +dnl +for arg in $foutput; do + old_want_arg=$want_arg + want_arg= +dnl +dnl None of the options that take arguments expect the argument to +dnl start with a -, so pretend we didn't see anything special. +dnl + if test -n "$old_want_arg"; then + case "$arg" in + -*) + old_want_arg= + ;; + esac + fi + case "$old_want_arg" in + '') + case $arg in + /*.a) + exists=false + for f in $lflags; do + if test x$arg = x$f; then + exists=true + fi + done + if $exists; then + arg= + else + lflags="$lflags $arg" + fi + ;; + -bI:*) + exists=false + for f in $lflags; do + if test x$arg = x$f; then + exists=true + fi + done + if $exists; then + arg= + else + if test "$ac_cv_prog_gcc" = yes; then + lflags="$lflags -Xlinker $arg" + else + lflags="$lflags $arg" + fi + fi + ;; + -lang* | -lcrt0.o | -lc | -lgcc) + arg= + ;; + -[lLR]) + want_arg=$arg + arg= + ;; + -[lLR]*) + exists=false + for f in $lflags; do + if test x$arg = x$f; then + exists=true + fi + done + if $exists; then + arg= + else + case "$arg" in + -lkernel32) + case "$canonical_host_type" in + *-*-cygwin*) + arg= + ;; + *) + lflags="$lflags $arg" + ;; + esac + ;; + -lm) + ;; + *) + lflags="$lflags $arg" + ;; + esac + fi + ;; + -u) + want_arg=$arg + arg= + ;; + -Y) + want_arg=$arg + arg= + ;; + *) + arg= + ;; + esac + ;; + -[lLR]) + arg="$old_want_arg $arg" + ;; + -u) + arg="-u $arg" + ;; + -Y) +dnl +dnl Should probably try to ensure unique directory options here too. +dnl This probably only applies to Solaris systems, and then will only +dnl work with gcc... +dnl + arg=`echo $arg | sed -e 's%^P,%%'` + SAVE_IFS=$IFS + IFS=: + list= + for elt in $arg; do + list="$list -L$elt" + done + IFS=$SAVE_IFS + arg="$list" + ;; + esac +dnl + if test -n "$arg"; then + flibs="$flibs $arg" + fi +done +if test -n "$ld_run_path"; then + flibs_result="$ld_run_path $flibs" +else + flibs_result="$flibs" +fi +changequote([, ])dnl +ac_cv_flibs="$flibs_result"]) +FLIBS="$ac_cv_flibs" +AC_SUBST(FLIBS)dnl +AC_MSG_RESULT($FLIBS) +]) + + +dnl ### Checks for operating system services + + +AC_DEFUN(AC_SYS_INTERPRETER, +[# Pull the hash mark out of the macro call to avoid m4 problems. +ac_msg="whether #! works in shell scripts" +AC_CACHE_CHECK($ac_msg, 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" +]) + +define(AC_HAVE_POUNDBANG, +[errprint(__file__:__line__: [$0 has been replaced by AC_SYS_INTERPRETER, taking no arguments +])m4exit(4)]) + +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. + (echo 1 > $ac_dir/conftest9012345) 2>/dev/null + (echo 2 > $ac_dir/conftest9012346) 2>/dev/null + val=`cat $ac_dir/conftest9012345 2>/dev/null` + if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then + ac_cv_sys_long_file_names=no + rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null + break + fi + rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null +done]) +if test $ac_cv_sys_long_file_names = yes; then + AC_DEFINE(HAVE_LONG_FILE_NAMES) +fi +]) + +AC_DEFUN(AC_SYS_RESTARTABLE_SYSCALLS, +[AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls, +[AC_TRY_RUN( +[/* 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 +#include +ucatch (isig) { } +main () { + int i = fork (), status; + if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); } + signal (SIGINT, ucatch); + status = wait(&i); + if (status == -1) wait(&i); + exit (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) +fi +]) + +AC_DEFUN(AC_PATH_X, +[AC_REQUIRE_CPP()dnl Set CPP; we run AC_PATH_X_DIRECT conditionally. +# 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_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_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 + 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 +]) + +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN(AC_PATH_X_XMKMF, +[rm -fr conftestdir +if mkdir conftestdir; then + cd conftestdir + # 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; 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 conftestdir +fi +]) + +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN(AC_PATH_X_DIRECT, +[if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +AC_TRY_CPP([#include <$x_direct_test_include>], +[# We can compile using X headers with no special include directory. +ac_x_includes=], +[# Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /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 \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; 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. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +AC_TRY_LINK(, [${x_direct_test_function}()], +[LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries=], +[LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ + /usr/X11/lib \ + /usr/X11R6/lib \ + /usr/X11R5/lib \ + /usr/X11R4/lib \ + \ + /usr/lib/X11 \ + /usr/lib/X11R6 \ + /usr/lib/X11R5 \ + /usr/lib/X11R4 \ + \ + /usr/local/X11/lib \ + /usr/local/X11R6/lib \ + /usr/local/X11R5/lib \ + /usr/local/X11R4/lib \ + \ + /usr/local/lib/X11 \ + /usr/local/lib/X11R6 \ + /usr/local/lib/X11R5 \ + /usr/local/lib/X11R4 \ + \ + /usr/X386/lib \ + /usr/x386/lib \ + /usr/XFree86/lib/X11 \ + \ + /usr/lib \ + /usr/local/lib \ + /usr/unsupported/lib \ + /usr/athena/lib \ + /usr/local/x11r5/lib \ + /usr/lpp/Xamples/lib \ + /lib/usr/lib/X11 \ + \ + /usr/openwin/lib \ + /usr/openwin/share/lib \ + ; \ +do +dnl Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done]) +fi # $ac_x_libraries = NO +]) + +dnl 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) + 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_TRY_LINK(, , 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_TRY_LINK(, , 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@cl.cam.ac.uk says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And karl@cs.umb.edu says + # the Alpha needs dnet_stub (dnet does not exist). + 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 + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # chad@anasazi.com says the 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 dickey@clark.net. + AC_CHECK_FUNC(gethostbyname) + if test $ac_cv_func_gethostbyname = no; then + AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says simon@lia.di.epfl.ch: it contains + # gethostby* variants that don't use the nameserver (or something). + # -lsocket must be given before -lnsl if both are needed. + # We assume that if connect needs -lnsl, so does gethostbyname. + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + # gomez@mi.uni-erlangen.de 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. + # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. + 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 +]) + +dnl The old Cygwin32 macro is deprecated. +AC_DEFUN(AC_CYGWIN32, +[AC_OBSOLETE([$0], [; instead use AC_CYGWIN])dnl +AC_CYGWIN]) + +dnl Check for Cygwin. This is a way to set the right value for +dnl EXEEXT. +AC_DEFUN(AC_CYGWIN, +[AC_CACHE_CHECK(for Cygwin environment, ac_cv_cygwin, +[AC_TRY_COMPILE(,[ +#ifndef __CYGWIN__ +#define __CYGWIN__ __CYGWIN32__ +#endif +return __CYGWIN__;], +ac_cv_cygwin=yes, ac_cv_cygwin=no) +rm -f conftest*]) +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes]) + +dnl Check for mingw32. This is another way to set the right value for +dnl EXEEXT. +AC_DEFUN(AC_MINGW32, +[AC_CACHE_CHECK(for mingw32 environment, ac_cv_mingw32, +[AC_TRY_COMPILE(,[return __MINGW32__;], +ac_cv_mingw32=yes, ac_cv_mingw32=no) +rm -f conftest*]) +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes]) + +dnl Check for the extension used for executables. This knows that we +dnl add .exe for Cygwin or mingw32. Otherwise, it compiles a test +dnl executable. If this is called, the executable extensions will be +dnl automatically used by link commands run by the configure script. +AC_DEFUN(AC_EXEEXT, +[AC_REQUIRE([AC_CYGWIN]) +AC_REQUIRE([AC_MINGW32]) +AC_MSG_CHECKING([for executable suffix]) +AC_CACHE_VAL(ac_cv_exeext, +[if test "$CYGWIN" = yes || test "$MINGW32" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if AC_TRY_EVAL(ac_link); then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.]) + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi]) +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +AC_MSG_RESULT(${ac_cv_exeext}) +dnl Setting ac_exeext will implicitly change the ac_link command. +ac_exeext=$EXEEXT +AC_SUBST(EXEEXT)]) + + +dnl ### Checks for UNIX variants +dnl These are kludges which should be replaced by a single POSIX check. +dnl They aren't cached, to discourage their use. + + +AC_DEFUN(AC_AIX, +[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl +AC_BEFORE([$0], [AC_TRY_RUN])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_DEFUN(AC_MINIX, +[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl +AC_BEFORE([$0], [AC_TRY_RUN])dnl +AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=) +if test "$MINIX" = yes; then + AC_DEFINE(_POSIX_SOURCE) + AC_DEFINE(_POSIX_1_SOURCE, 2) + AC_DEFINE(_MINIX) +fi +]) + +AC_DEFUN(AC_ISC_POSIX, +[AC_REQUIRE([AC_PROG_CC])dnl +AC_BEFORE([$0], [AC_TRY_COMPILE])dnl +AC_BEFORE([$0], [AC_TRY_RUN])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) + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + AC_MSG_RESULT(no) + ISC= +fi +]) + +AC_DEFUN(AC_XENIX_DIR, +[AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl +AC_REQUIRE([AC_DIR_HEADER])dnl +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=]) +if test "$XENIX" = yes; then + # Make sure -ldir precedes -lx. + test $ac_header_dirent = dirent.h && LIBS="-ldir $LIBS" + LIBS="$LIBS -lx" +fi +]) + +AC_DEFUN(AC_DYNIX_SEQ, +[AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT])dnl +AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS") +]) + +AC_DEFUN(AC_IRIX_SUN, +[AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT or AC_CHECK_LIB(sun, getpwnam)])dnl +AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS") +]) + +AC_DEFUN(AC_SCO_INTL, +[AC_OBSOLETE([$0], [; instead use AC_FUNC_STRFTIME])dnl +AC_CHECK_LIB(intl, strftime, LIBS="-lintl $LIBS") +]) diff --git a/autoconf.info b/autoconf.info new file mode 100644 index 0000000..7df4819 --- /dev/null +++ b/autoconf.info @@ -0,0 +1,5803 @@ +This is Info file autoconf.info, produced by Makeinfo version 1.67 from +the input file /home/bje/autoconf-2.13/autoconf.texi. + +START-INFO-DIR-ENTRY +* Autoconf: (autoconf). Create source code configuration scripts. +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 (C) 1992, 1993, 1994, 1995, 1996, 1998 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 an `m4' macro +package. This is edition 2.13, for Autoconf version 2.13. + +* Menu: + +* Introduction:: Autoconf's purpose, strengths, and weaknesses. +* 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. +* Writing Macros:: Adding new macros to Autoconf. +* Manual Configuration:: Selecting features that can't be guessed. +* Site Configuration:: Local defaults for `configure'. +* Invoking configure:: How to use the Autoconf output. +* Invoking config.status:: Recreating a configuration. +* Questions:: Questions about Autoconf, with answers. +* Upgrading:: Tips for upgrading from version 1. +* History:: History of Autoconf. +* Old Macro Names:: Backward compatibility macros. +* 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. +* Macro Index:: Index of Autoconf macros. + + -- The Detailed Node Listing -- + +Making `configure' Scripts + +* Writing configure.in:: What to put in an Autoconf input file. +* Invoking autoscan:: Semi-automatic `configure.in' writing. +* Invoking ifnames:: Listing the conditionals in source code. +* Invoking autoconf:: How to create configuration scripts. +* Invoking autoreconf:: Remaking multiple `configure' scripts. + +Initialization and Output Files + +* Input:: Where Autoconf should find files. +* Output:: Creating output files. +* Makefile Substitutions:: Using output variables in `Makefile's. +* Configuration Headers:: Creating a configuration header file. +* Subdirectories:: Configuring independent packages together. +* Default Prefix:: Changing the default installation prefix. +* Versions:: Version numbers in `configure'. + +Substitutions in Makefiles + +* Preset Output Variables:: Output variables that are always set. +* Build Directories:: Supporting multiple concurrent compiles. +* Automatic Remaking:: Makefile rules for configuring. + +Configuration Header Files + +* Header Templates:: Input for the configuration headers. +* Invoking autoheader:: How to create configuration templates. + +Existing Tests + +* Alternative Programs:: Selecting between alternative programs. +* Libraries:: Library archives that might be missing. +* Library Functions:: C library functions that might be missing. +* Header Files:: Header files that might be missing. +* Structures:: Structures or members that might be missing. +* Typedefs:: `typedef's that might be missing. +* C Compiler Characteristics:: +* Fortran 77 Compiler Characteristics:: +* System Services:: Operating system services. +* UNIX Variants:: Special kludges for specific UNIX variants. + +Alternative Programs + +* Particular Programs:: Special handling to find certain programs. +* Generic Programs:: How to find other programs. + +Library 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. + +Typedefs + +* Particular Typedefs:: Special handling to find certain types. +* Generic Typedefs:: How to find other types. + +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. +* Portable Shell:: Shell script portability pitfalls. +* Testing Values and Files:: Checking strings and files. +* 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 users of progress or problems. + +Caching Results + +* Cache Variable Names:: Shell variables used in caches. +* Cache Files:: Files `configure' uses for caching. + +Writing Macros + +* Macro Definitions:: Basic format of an Autoconf macro. +* Macro Names:: What to call your new macros. +* Quoting:: Protecting macros from unwanted expansion. +* Dependencies Between Macros:: What to do when macros depend on other macros. + +Dependencies Between Macros + +* Prerequisite Macros:: Ensuring required information. +* Suggested Ordering:: Warning about possible ordering problems. +* Obsolete Macros:: Warning about old ways of doing things. + +Manual Configuration + +* Specifying Names:: Specifying the system type. +* Canonicalizing:: Getting the canonical system type. +* System Type Variables:: Variables containing the 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. +* 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'. +* Operation Controls:: Changing how `configure' runs. + +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. + +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. +* Invoking autoupdate:: Replacing old macro names in `configure.in'. +* Changed Results:: Changes in how to check test results. +* Changed Macro Writing:: Better ways to write your own macros. + +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: Making configure Scripts, Prev: Top, Up: Top + +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 electro-magnetic + waves, the relativist 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 test for the presence of each +feature that the software package they are for might need individually. +(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. + + There are several jobs related to making portable software packages +that Autoconf currently does not do. Among these are automatically +creating `Makefile' files with all of the standard targets, and +supplying replacements for standard library functions and header files +on systems that lack them. Work is in progress to add those features in +the future. + + Autoconf imposes some restrictions on the names of macros used with +`#ifdef' 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' do not have. It also +overflows internal limits of some versions of `m4', including GNU `m4' +1.0. You must use version 1.1 or later of GNU `m4'. Using version 1.3 +or later will be much faster than 1.1 or 1.2. + + *Note Upgrading::, 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. + + Mail suggestions and bug reports for Autoconf to +`bug-gnu-utils@prep.ai.mit.edu'. Please include the Autoconf version +number, which you can get by running `autoconf --version'. + + +File: autoconf.info, Node: Making configure Scripts, Next: Setup, Prev: Introduction, Up: Top + +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 Invoking config.status::.); + + * a shell script called `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.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 write `acconfig.h', and you will distribute +the Autoconf-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.in + + configure.in --. .------> autoconf* -----> configure + +---+ + [aclocal.m4] --+ `---. + [acsite.m4] ---' | + +--> [autoheader*] -> [config.h.in] + [acconfig.h] ----. | + +-----' + [config.h.top] --+ + [config.h.bot] --' + + 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.in:: What to put in an Autoconf input file. +* Invoking autoscan:: Semi-automatic `configure.in' writing. +* Invoking ifnames:: Listing the conditionals in source code. +* Invoking autoconf:: How to create configuration scripts. +* Invoking autoreconf:: Remaking multiple `configure' scripts. + + +File: autoconf.info, Node: Writing configure.in, Next: Invoking autoscan, Prev: Making configure Scripts, Up: Making configure Scripts + +Writing `configure.in' +====================== + + To produce a `configure' script for a software package, create a +file called `configure.in' 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.in' might need to contain some +hand-crafted shell commands. The `autoscan' program can give you a +good start in writing `configure.in' (*note Invoking autoscan::., for +more information). + + The order in which `configure.in' calls the Autoconf macros is not +important, with a few exceptions. Every `configure.in' 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 creating `configure' 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 could depend on things earlier in it. For example, library +functions could be affected by typedefs and libraries. + + `AC_INIT(FILE)' + checks for programs + checks for libraries + checks for header files + checks for typedefs + checks for structures + checks for compiler characteristics + checks for library functions + checks for system services + `AC_OUTPUT([FILE...])' + + It is best to put each macro call on its own line in `configure.in'. +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. + + When calling macros that take arguments, there must not be any blank +space between the macro name and the open parenthesis. Arguments can be +more than one line long if they are enclosed within the `m4' quote +characters `[' and `]'. If you have a long line such as a list of file +names, you can generally use a backslash at the end of a line to +continue it logically on the next line (this is implemented by the +shell, not by anything special that Autoconf does). + + Some macros handle two cases: what to do if the given condition is +met, and what to do if the condition is not met. In some places you +might want to do something if a condition is true but do nothing if it's +false, or vice versa. To omit the true case, pass an empty value for +the ACTION-IF-FOUND argument to the macro. To omit the false case, +omit the ACTION-IF-NOT-FOUND argument to the macro, including the comma +before it. + + You can include comments in `configure.in' files by starting them +with the `m4' builtin macro `dnl', which discards text up through the +next newline. These comments do not appear in the generated +`configure' scripts. For example, it is helpful to begin +`configure.in' files with a line like this: + + dnl Process this file with autoconf to produce a configure script. + + +File: autoconf.info, Node: Invoking autoscan, Next: Invoking ifnames, Prev: Writing configure.in, Up: Making configure Scripts + +Using `autoscan' to Create `configure.in' +========================================= + + The `autoscan' program can help you create a `configure.in' 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.in' for that package. + + You should manually examine `configure.scan' before renaming it to +`configure.in'; 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_HEADER' (*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 Invoking ifnames::., for information about a program that can +help with that job). + + `autoscan' uses several data files, which are installed along with +the distributed Autoconf macro files, to determine which macros to +output when it finds particular symbols in a package's source files. +These 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' + Print a summary of the command line options and exit. + +`--macrodir=DIR' + Look for the data files in directory DIR instead of the default + installation directory. You can also set the `AC_MACRODIR' + environment variable to a directory; this option overrides the + environment variable. + +`--verbose' + Print the names of the files it examines and the potentially + interesting symbols it finds in them. This output can be + voluminous. + +`--version' + Print the version number of Autoconf and exit. + + +File: autoconf.info, Node: Invoking ifnames, Next: Invoking autoconf, Prev: Invoking autoscan, Up: Making configure Scripts + +Using `ifnames' to List Conditionals +==================================== + + `ifnames' can help when writing a `configure.in' 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, this program can help you figure out what its +`configure' needs to check for. It may help fill in some gaps in a +`configure.in' generated by `autoscan' (*note Invoking autoscan::.). + + `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. + +`--macrodir=DIR' +`-m DIR' + Look for the Autoconf macro files in directory DIR instead of the + default installation directory. Only used to get the version + number. You can also set the `AC_MACRODIR' environment variable + to a directory; this option overrides the environment variable. + +`--version' + Print the version number of Autoconf and exit. + + +File: autoconf.info, Node: Invoking autoconf, Next: Invoking autoreconf, Prev: Invoking ifnames, Up: Making configure Scripts + +Using `autoconf' to Create `configure' +====================================== + + To create `configure' from `configure.in', run the `autoconf' +program with no arguments. `autoconf' processes `configure.in' with +the `m4' macro processor, using the Autoconf macros. If you give +`autoconf' an argument, it reads that file instead of `configure.in' +and writes the configuration script to the standard output instead of +to `configure'. If you give `autoconf' the argument `-', it reads the +standard input instead of `configure.in' and writes the configuration +script on 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 +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. + +`--localdir=DIR' +`-l DIR' + Look for the package file `aclocal.m4' in directory DIR instead of + in the current directory. + +`--macrodir=DIR' +`-m DIR' + Look for the installed macro files in directory DIR. You can also + set the `AC_MACRODIR' environment variable to a directory; this + option overrides the environment variable. + +`--version' + Print the version number of Autoconf and exit. + + +File: autoconf.info, Node: Invoking autoreconf, Prev: Invoking autoconf, Up: Making configure Scripts + +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.in' 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 `--macrodir=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 `--macrodir=DIR' or `--localdir=DIR'. + +`autoreconf' accepts the following options: + +`--help' +`-h' + Print a summary of the command line options and exit. + +`--force' +`-f' + Remake even `configure' scripts and configuration headers that are + newer than their input files (`configure.in' and, if present, + `aclocal.m4'). + +`--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.in'. + +`--macrodir=DIR' +`-m DIR' + Look for the Autoconf macro files in directory DIR instead of the + default installation directory. You can also set the `AC_MACRODIR' + environment variable to a directory; this option overrides the + environment variable. + +`--verbose' + Print the name of each directory where `autoreconf' runs + `autoconf' (and `autoheader', if appropriate). + +`--version' + Print the version number of Autoconf and exit. + + +File: autoconf.info, Node: Setup, Next: Existing Tests, Prev: Making configure Scripts, Up: Top + +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 creating output files. + +* Menu: + +* Input:: Where Autoconf should find files. +* Output:: Creating output files. +* Makefile Substitutions:: Using output variables in `Makefile's. +* Configuration Headers:: Creating a configuration header file. +* Subdirectories:: Configuring independent packages together. +* Default Prefix:: Changing the default installation prefix. +* Versions:: Version numbers in `configure'. + + +File: autoconf.info, Node: Input, Next: Output, Prev: Setup, Up: Setup + +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 (UNIQUE-FILE-IN-SOURCE-DIR) + Process any command-line arguments and find the source code + directory. 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 Invoking configure::, 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 `install-sh', `config.sub', `config.guess', and Cygnus + `configure' scripts 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' programs have a rule that + creates `install' from it if there is no `Makefile'. + + +File: autoconf.info, Node: Output, Next: Makefile Substitutions, Prev: Input, Up: Setup + +Creating Output Files +===================== + + Every Autoconf-generated `configure' script must finish by calling +`AC_OUTPUT'. It is the macro that creates the `Makefile's and optional +other files resulting from configuration. The only other required +macro is `AC_INIT' (*note Input::.). + + - Macro: AC_OUTPUT ([FILE... [, EXTRA-CMDS [, INIT-CMDS]]]) + Create output files. Call this macro once, at the end of + `configure.in'. The FILE... argument is a whitespace-separated + list of output files; it may be empty. This macro creates each + file `FILE' by copying an input file (by default named `FILE.in'), + substituting the output variable values. *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 (but not the parents of that directory). Usually, + `Makefile's are created this way, but other files, such as + `.gdbinit', can be specified as well. + + If `AC_CONFIG_HEADER', `AC_LINK_FILES', or `AC_CONFIG_SUBDIRS' has + been called, this macro also creates the files named as their + arguments. + + A typical call to `AC_OUTPUT' looks like this: + AC_OUTPUT(Makefile src/Makefile man/Makefile X/Imakefile) + + You can override an input file name by appending to FILE a + colon-separated list of input files. Examples: + AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk) + AC_OUTPUT(Makefile:templates/vars.mk:Makefile.in:templates/rules.mk) + Doing this allows you to keep your file names acceptable to + MS-DOS, or to prepend and/or append boilerplate to the file. + + If you pass EXTRA-CMDS, those commands will be inserted into + `config.status' to be run after all its other processing. If + INIT-CMDS are given, they are inserted just before EXTRA-CMDS, + with shell variable, command, and backslash substitutions + performed on them in `configure'. You can use INIT-CMDS to pass + variables from `configure' to the EXTRA-CMDS. If + `AC_OUTPUT_COMMANDS' has been called, the commands given to it are + run just before the commands passed to this macro. + + - 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. 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]) + + 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: Makefile Substitutions, Next: Configuration Headers, Prev: Output, Up: Setup + +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. +* Build Directories:: Supporting multiple concurrent compiles. +* Automatic Remaking:: Makefile rules for configuring. + + +File: autoconf.info, Node: Preset Output Variables, Next: Build Directories, Prev: Makefile Substitutions, Up: Makefile Substitutions + +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. Here is what each of the preset ones +contains. *Note Variables for Installation Directories: +(standards)Directory Variables, for more information about the +variables with names that end in `dir'. + + - Variable: bindir + The directory for installing executables that users run. + + - 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: datadir + The directory for installing read-only architecture-independent + data. + + - Variable: exec_prefix + The installation prefix for architecture-dependent files. + + - 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 installation prefix 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: srcdir + The directory that contains the source code for that `Makefile'. + + - Variable: sysconfdir + The directory for installing read-only single-machine data. + + - Variable: top_srcdir + The top-level source code directory for the package. In the + top-level directory, this is the same as `srcdir'. + + - 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: CPPFLAGS + Header file search directory (`-IDIR') and any other miscellaneous + options for the C preprocessor and compiler. 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 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: 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: DEFS + `-D' options to pass to the C compiler. If `AC_CONFIG_HEADER' 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: LDFLAGS + Stripping (`-s') and any other miscellaneous options for the + linker. 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 features. + + - Variable: LIBS + `-l' and `-L' options to pass to the linker. + + +File: autoconf.info, Node: Build Directories, Next: Automatic Remaking, Prev: Preset Output Variables, Up: Makefile Substitutions + +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 pathname +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 + +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 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. 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. + + ${srcdir}/configure: configure.in 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.in aclocal.m4 acconfig.h \ + config.h.top config.h.bot + 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 + + In addition, you should pass `echo timestamp > stamp-h' in the +EXTRA-CMDS argument to `AC_OUTPUT', so `config.status' will ensure that +`config.h' is considered up to date. *Note Output::, for more +information about `AC_OUTPUT'. + + *Note Invoking config.status::, for more examples of handling +configuration-related dependencies. + + +File: autoconf.info, Node: Configuration Headers, Next: Subdirectories, Prev: Makefile Substitutions, Up: Setup + +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_HEADER' +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 ' 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_HEADER (HEADER-TO-CREATE ...) + Make `AC_OUTPUT' create the file(s) in the whitespace-separated + list HEADER-TO-CREATE 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-TO-CREATE is `config.h'. + + If HEADER-TO-CREATE 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-TO-CREATE.in'; however, + you can override the input file name by appending to + HEADER-TO-CREATE, a colon-separated list of input files. Examples: + AC_CONFIG_HEADER(defines.h:defines.hin) + AC_CONFIG_HEADER(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. + +* Menu: + +* Header Templates:: Input for the configuration headers. +* Invoking autoheader:: How to create configuration templates. + + +File: autoconf.info, Node: Header Templates, Next: Invoking autoheader, Prev: Configuration Headers, Up: Configuration Headers + +Configuration Header Templates +------------------------------ + + Your distribution should contain a template file that looks as you +want the final header file to look, including comments, with default +values in the `#define' statements. For example, suppose your +`configure.in' makes these calls: + + AC_CONFIG_HEADER(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 change the 0 to a 1. On other +systems, it will leave the line unchanged. + + /* Define as 1 if you have unistd.h. */ + #define HAVE_UNISTD_H 0 + + Alternately, if your code tests for configuration options using +`#ifdef' instead of `#if', a default value can be to `#undef' the +variable instead of to define it to a value. On systems that have +`unistd.h', `configure' will change the second line to read `#define +HAVE_UNISTD_H 1'. On other systems, it will comment that line out (in +case the system predefines that symbol). + + /* Define if you have unistd.h. */ + #undef HAVE_UNISTD_H + + +File: autoconf.info, Node: Invoking autoheader, Prev: Header Templates, Up: Configuration Headers + +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.in' invokes +`AC_CONFIG_HEADER(FILE)', `autoheader' creates `FILE.in'; if multiple +file arguments are given, the first one is used. Otherwise, +`autoheader' creates `config.h.in'. + + If you give `autoheader' an argument, it uses that file instead of +`configure.in' 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.in' and writes +the header file to the standard output. + + `autoheader' scans `configure.in' and figures out which C +preprocessor symbols it might define. It copies comments and `#define' +and `#undef' statements from a file called `acconfig.h', which comes +with and is installed with Autoconf. It also uses a file called +`acconfig.h' in the current directory, if present. If you `AC_DEFINE' +any additional symbols, you must create that file with entries for +them. For symbols defined by `AC_CHECK_HEADERS', `AC_CHECK_FUNCS', +`AC_CHECK_SIZEOF', or `AC_CHECK_LIB', `autoheader' generates comments +and `#undef' statements itself rather than copying them from a file, +since the possible symbols are effectively limitless. + + The file that `autoheader' creates contains mainly `#define' and +`#undef' statements and their accompanying comments. 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 alternate way to produce the same effect 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. Their use is discouraged because +they have file names that contain two periods, and so can not be stored +on MS-DOS; also, they are two more files to clutter up the directory. +But if you use the `--localdir=DIR' option to use an `acconfig.h' in +another directory, they give you a way to put custom boilerplate in each +individual `config.h.in'. + + `autoheader' accepts the following options: + +`--help' +`-h' + Print a summary of the command line options and exit. + +`--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. + +`--macrodir=DIR' +`-m DIR' + Look for the installed macro files and `acconfig.h' in directory + DIR. You can also set the `AC_MACRODIR' environment variable to a + directory; this option overrides the environment variable. + +`--version' + Print the version number of Autoconf and exit. + + +File: autoconf.info, Node: Subdirectories, Next: Default Prefix, Prev: Configuration Headers, Up: Setup + +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. 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.in' but no `configure', the Cygnus `configure' script + found by `AC_CONFIG_AUXDIR' 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, Next: Versions, Prev: Subdirectories, Up: Setup + +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: Versions, Prev: Default Prefix, Up: Setup + +Version Numbers 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 on the standard error output + and do not create `configure'. For example: + + AC_PREREQ(1.8) + + This macro is useful if your `configure.in' relies on non-obvious + behavior that changed between Autoconf releases. If it merely + needs recently added macros, then `AC_PREREQ' is less useful, + because the `autoconf' program already tells the user which macros + are not found. The same thing happens if `configure.in' is + processed by a version of Autoconf older than when `AC_PREREQ' was + added. + + - 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.in' into `configure' + without RCS or CVS changing it when you check in `configure'. That + way, you can determine easily which revision of `configure.in' a + particular `configure' corresponds to. + + It is a good idea to call this macro before `AC_INIT' so that the + revision number is near the top of both `configure.in' and + `configure'. To support doing that, the `AC_REVISION' output + begins with `#! /bin/sh', like the normal start of a `configure' + script does. + + For example, this line in `configure.in': + + AC_REVISION($Revision: 1.30 $)dnl + + produces this in `configure': + + #! /bin/sh + # From configure.in Revision: 1.30 + + +File: autoconf.info, Node: Existing Tests, Next: Writing Tests, Prev: Setup, Up: Top + +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: + +* Alternative Programs:: Selecting between alternative programs. +* Libraries:: Library archives that might be missing. +* Library Functions:: C library functions that might be missing. +* Header Files:: Header files that might be missing. +* Structures:: Structures or members that might be missing. +* Typedefs:: `typedef's that might be missing. +* C Compiler Characteristics:: +* Fortran 77 Compiler Characteristics:: +* System Services:: Operating system services. +* UNIX Variants:: Special kludges for specific UNIX variants. + + +File: autoconf.info, Node: Alternative Programs, Next: Libraries, Prev: Existing Tests, Up: Existing Tests + +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 + +Particular Program Checks +------------------------- + + These macros check for particular programs--whether they exist, and +in some cases whether they support certain features. + + - Macro: AC_DECL_YYTEXT + 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. + + - Macro: AC_PROG_AWK + Check for `mawk', `gawk', `nawk', and `awk', in that order, and + set output variable `AWK' to the first one that it finds. It + tries `mawk' first because that is reported to be the fastest + implementation. + + - Macro: AC_PROG_CC + Determine a C compiler to use. If `CC' is not already set in the + environment, check for `gcc', and use `cc' if that's not found. + Set output variable `CC' to the name of the compiler found. + + If using the GNU C compiler, set shell variable `GCC' to `yes', + empty otherwise. 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. + + If the C compiler being used does not produce executables that can + run on the system where `configure' is being run, set the shell + variable `cross_compiling' to `yes', otherwise `no'. In other + words, this tests whether the build system type is different from + the host system type (the target system type is irrelevant to this + test). *Note Manual Configuration::, for more on support for + cross compiling. + + - 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'. + + - Macro: AC_PROG_CPP + Set output variable `CPP' to a command that runs the C + preprocessor. If `$CC -E' doesn't work, it uses `/lib/cpp'. 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'. + + - Macro: AC_PROG_CXX + Determine a C++ compiler to use. Check if the environment variable + `CXX' or `CCC' (in that order) is set; if so, set output variable + `CXX' to its value. Otherwise search for a C++ compiler under + likely names (`c++', `g++', `gcc', `CC', `cxx', and `cc++'). If + none of those checks succeed, as a last resort set `CXX' to `gcc'. + + If using the GNU C++ compiler, set shell variable `GXX' to `yes', + empty otherwise. 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. + + If the C++ compiler being used does not produce executables that + can run on the system where `configure' is being run, set the shell + variable `cross_compiling' to `yes', otherwise `no'. In other + words, this tests whether the build system type is different from + the host system type (the target system type is irrelevant to this + test). *Note Manual Configuration::, for more on support for + cross compiling. + + - Macro: AC_PROG_CXXCPP + Set output variable `CXXCPP' to a command that runs the C++ + preprocessor. If `$CXX -E' doesn't work, it uses `/lib/cpp'. 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'. + + - Macro: AC_PROG_F77 + Determine a Fortran 77 compiler to use. If `F77' is not already + set in the environment, check for `g77', `f77' and `f2c', in that + order. Set the output variable `F77' to the name of the compiler + found. + + If using `g77' (the GNU Fortran 77 compiler), then `AC_PROG_F77' + will set the shell variable `G77' to `yes', and empty otherwise. + 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. + + - 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. + + - 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 to not + 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'. + + A copy of `install-sh' which you may use comes with Autoconf. 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 pathname 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'. + + - Macro: AC_PROG_LN_S + If `ln -s' works on the current filesystem (the operating system + and filesystem support symbolic links), set output variable `LN_S' + to `ln -s', otherwise set it to `ln'. + + If the link is put in 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, + otherwise to `:' (do nothing). + + - Macro: AC_PROG_YACC + If `bison' is found, set output variable `YACC' to `bison -y'. + Otherwise, if `byacc' is found, set `YACC' to `byacc'. Otherwise + set `YACC' to `yacc'. + + +File: autoconf.info, Node: Generic Programs, Prev: Particular Programs, Up: Alternative Programs + +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) + + - 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 `HAVEFILE' for each file found, set to 1. + + - 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 in `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 to `ranlib' if that program exists in `PATH', or to `:' + if neither program exists. + + - 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. + + +File: autoconf.info, Node: Libraries, Next: Library Functions, Prev: Alternative Programs, Up: Existing Tests + +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 add `-lLIBRARY' to `LIBS' and + define `HAVE_LIBLIBRARY' (in all capitals). + + If linking with LIBRARY results in unresolved symbols, which would + be resolved by linking with additional libraries, give those + libraries as the OTHER-LIBRARIES argument, separated by spaces: + `-lXt -lX11'. Otherwise this macro will fail to detect that + LIBRARY is present, because linking the test program will always + fail with unresolved symbols. + + - 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 can not be a shell + variable; it must be a literal name. This macro is considered + obsolete. + + - 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. + + If the function is found, run ACTION-IF-FOUND, otherwise run + ACTION-IF-NOT-FOUND. + + If linking with LIBRARY results in unresolved symbols, which would + be resolved by linking with additional libraries, give those + libraries as the OTHER-LIBRARIES argument, separated by spaces: + `-lXt -lX11'. Otherwise this macro will fail to detect that + FUNCTION is present, because linking the test program will always + fail with unresolved symbols. + + - Macro: AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS[, ACTION-IF-FOUND [, + ACTION-IF-NOT-FOUND]]) + This macro is equivalent to calling `AC_TRY_LINK_FUNC' once for + each library listed in SEARCH-LIBS. Add `-lLIBRARY' to `LIBS' for + the first library found to contain FUNCTION, and execute + ACTION-IF-FOUND. Otherwise execute ACTION-IF-NOT-FOUND. + + +File: autoconf.info, Node: Library Functions, Next: Header Files, Prev: Libraries, Up: Existing Tests + +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: + +* Particular Functions:: Special handling to find certain functions. +* Generic Functions:: How to find other functions. + + +File: autoconf.info, Node: Particular Functions, Next: Generic Functions, Prev: Library Functions, Up: Library Functions + +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 + # else + # ifdef _AIX + #pragma alloca + # else + # ifndef alloca /* predefined by HP cc +Olibcalls */ + char *alloca (); + # endif + # endif + # endif + #endif + + - 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_FNMATCH + If the `fnmatch' function is available and works (unlike the one on + SunOS 5.4), define `HAVE_FNMATCH'. + + - Macro: AC_FUNC_GETLOADAVG + Check how to get the system load averages. If the system has the + `getloadavg' function, this macro defines `HAVE_GETLOADAVG', and + adds to `LIBS' any libraries needed to get that function. + + Otherwise, it adds `getloadavg.o' to the output variable + `LIBOBJS', and possibly defines several other C preprocessor + macros and output variables: + + 1. It defines `SVR4', `DGUX', `UMAX', or `UMAX4_3' if on those + systems. + + 2. If it finds `nlist.h', it defines `NLIST_STRUCT'. + + 3. If `struct nlist' has an `n_un' member, it defines + `NLIST_NAME_UNION'. + + 4. If compiling `getloadavg.c' defines `LDAV_PRIVILEGED', + programs need to be installed specially on this system for + `getloadavg' to work, and this macro defines + `GETLOADAVG_PRIVILEGED'. + + 5. This macro sets the output variable `NEED_SETGID'. The value + is `true' if special installation is required, `false' if not. + If `NEED_SETGID' is `true', this macro sets `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_MEMCMP + If the `memcmp' function is not available, or does not work on + 8-bit data (like the one on SunOS 4.1.3), add `memcmp.o' to output + variable `LIBOBJS'. + + - 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_SELECT_ARGTYPES + Determines the correct type to be passed to 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 ID 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_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'. This is the case on System V before + release 3. + + - 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', which should not be used. + + - 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_VFORK + If `vfork.h' is found, define `HAVE_VFORK_H'. If a working + `vfork' is not found, define `vfork' to be `fork'. 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. + + - 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.) + + - 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'. + + +File: autoconf.info, Node: Generic Functions, Prev: Particular Functions, Up: Library Functions + +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_CPLUSPLUS' has been called, since C++ is + more standardized than C is. (*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 given FUNCTION in the whitespace-separated argument list + that is available, define `HAVE_FUNCTION' (in all capitals). 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. + + - Macro: AC_REPLACE_FUNCS (FUNCTION...) + Like calling `AC_CHECK_FUNCS' using an ACTION-IF-NOT-FOUND that + adds `FUNCTION.o' to the value of the output variable `LIBOBJS'. + You can declare a function for which your replacement version is + used by enclosing the prototype in `#ifndef 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: Structures, Prev: Library Functions, Up: Existing Tests + +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 + +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_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'. + + - Macro: 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. This macro and the names it defines are + considered obsolete. The names it defines are: + + `dirent.h' + `DIRENT' + + `sys/ndir.h' + `SYSNDIR' + + `sys/dir.h' + `SYSDIR' + + `ndir.h' + `NDIR' + + In addition, if the `closedir' function does not return a + meaningful value, define `VOID_CLOSEDIR'. + + - Macro: AC_HEADER_DIRENT + Check for the following header files, and 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 the source code should look + something like the following: + + #if HAVE_DIRENT_H + # include + # define NAMLEN(dirent) strlen((dirent)->d_name) + #else + # define dirent direct + # define NAMLEN(dirent) (dirent)->d_namlen + # if HAVE_SYS_NDIR_H + # include + # endif + # if HAVE_SYS_DIR_H + # include + # endif + # if HAVE_NDIR_H + # include + # endif + #endif + + Using the above declarations, the program would declare variables + to be 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_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.in': + + AC_HEADER_STDC + AC_CHECK_FUNCS(strchr memcpy) + + then, in your code, you can put declarations like this: + + #if STDC_HEADERS + # include + #else + # ifndef HAVE_STRCHR + # define strchr index + # define strrchr rindex + # endif + char *strchr (), *strrchr (); + # ifndef 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 + #if HAVE_SYS_WAIT_H + # include + #endif + #ifndef WEXITSTATUS + # define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) + #endif + #ifndef WIFEXITED + # define WIFEXITED(stat_val) (((stat_val) & 255) == 0) + #endif + + - Macro: AC_MEMORY_H + Define `NEED_MEMORY_H' if `memcpy', `memcmp', etc. are not + declared in `string.h' and `memory.h' exists. This macro is + obsolete; instead, use `AC_CHECK_HEADERS(memory.h)'. See the + example for `AC_HEADER_STDC'. + + - Macro: AC_UNISTD_H + Define `HAVE_UNISTD_H' if the system has `unistd.h'. This macro + is obsolete; instead, use `AC_CHECK_HEADERS(unistd.h)'. + + The way to check if the system supports POSIX.1 is: + + #if HAVE_UNISTD_H + # include + # include + #endif + + #ifdef _POSIX_VERSION + /* Code for POSIX.1 systems. */ + #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'. + + - Macro: AC_USG + Define `USG' if the system does not have `strings.h', `rindex', + `bzero', etc. This implies that it has `string.h', `strrchr', + `memset', etc. + + The symbol `USG' is obsolete. Instead of this macro, see the + example for `AC_HEADER_STDC'. + + +File: autoconf.info, Node: Generic Headers, Prev: Particular Headers, Up: Header Files + +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]]) + If the system header file HEADER-FILE exists, 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. + + - Macro: AC_CHECK_HEADERS (HEADER-FILE... [, ACTION-IF-FOUND [, + ACTION-IF-NOT-FOUND]]) + 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. + + +File: autoconf.info, Node: Structures, Next: Typedefs, Prev: Header Files, Up: Existing Tests + +Structures +========== + + The following macros check for certain structures or structure +members. To check structures not listed here, use `AC_EGREP_CPP' +(*note Examining Declarations::.) or `AC_TRY_COMPILE' (*note Examining +Syntax::.). + + - 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_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 + # include + #else + # if HAVE_SYS_TIME_H + # include + # else + # include + # endif + #endif + + - Macro: AC_STRUCT_ST_BLKSIZE + If `struct stat' contains an `st_blksize' member, define + `HAVE_ST_BLKSIZE'. + + - Macro: AC_STRUCT_ST_BLOCKS + If `struct stat' contains an `st_blocks' member, define + `HAVE_ST_BLOCKS'. Otherwise, add `fileblocks.o' to the output + variable `LIBOBJS'. + + - Macro: AC_STRUCT_ST_RDEV + If `struct stat' contains an `st_rdev' member, define + `HAVE_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_TM_ZONE'. Otherwise, if the + external array `tzname' is found, define `HAVE_TZNAME'. + + +File: autoconf.info, Node: Typedefs, Next: C Compiler Characteristics, Prev: Structures, Up: Existing Tests + +Typedefs +======== + + The following macros check for C typedefs. If there is no macro +specifically defined to check for a typedef you need, and you don't need +to check for any special properties of it, then you can use a general +typedef check macro. + +* Menu: + +* Particular Typedefs:: Special handling to find certain types. +* Generic Typedefs:: How to find other types. + + +File: autoconf.info, Node: Particular Typedefs, Next: Generic Typedefs, Prev: Typedefs, Up: Typedefs + +Particular Typedef Checks +------------------------- + + These macros check for particular C typedefs in `sys/types.h' and +`stdlib.h' (if it exists). + + - 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 + If `mode_t' is not defined, define `mode_t' to be `int'. + + - Macro: AC_TYPE_OFF_T + If `off_t' is not defined, define `off_t' to be `long'. + + - Macro: AC_TYPE_PID_T + If `pid_t' is not defined, define `pid_t' to be `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 + If `size_t' is not defined, define `size_t' to be `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 Typedefs, Prev: Particular Typedefs, Up: Typedefs + +Generic Typedef Checks +---------------------- + + This macro is used to check for typedefs not covered by the +particular test macros. + + - Macro: AC_CHECK_TYPE (TYPE, DEFAULT) + If the type TYPE is not defined in `sys/types.h', or `stdlib.h' or + `stddef.h' if they exist, define it to be the C (or C++) builtin + type DEFAULT; e.g., `short' or `unsigned'. + + +File: autoconf.info, Node: C Compiler Characteristics, Next: Fortran 77 Compiler Characteristics, Prev: Typedefs, Up: Existing Tests + +C Compiler Characteristics +========================== + + 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 keyword `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. + + - 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_CHECK_SIZEOF (TYPE [, CROSS-SIZE]) + Define `SIZEOF_UCTYPE' to be the size in bytes of the C (or C++) + builtin type TYPE, e.g. `int' or `char *'. If `type' is unknown + to the compiler, it gets a size of 0. UCTYPE is TYPE, with + lowercase converted to uppercase, spaces changed to underscores, + and asterisks changed to `P'. If cross-compiling, the value + CROSS-SIZE is used if given, otherwise `configure' exits with an + error message. + + For example, the call + AC_CHECK_SIZEOF(int *) + + defines `SIZEOF_INT_P' to be 8 on DEC Alpha AXP systems. + + - Macro: AC_INT_16_BITS + If the C type `int' is 16 bits wide, define `INT_16_BITS'. This + macro is obsolete; it is more general to use + `AC_CHECK_SIZEOF(int)' instead. + + - Macro: AC_LONG_64_BITS + If the C type `long int' is 64 bits wide, define `LONG_64_BITS'. + This macro is obsolete; it is more general to use + `AC_CHECK_SIZEOF(long)' instead. + + +File: autoconf.info, Node: Fortran 77 Compiler Characteristics, Next: System Services, Prev: C Compiler Characteristics, Up: Existing Tests + +Fortran 77 Compiler Characteristics +=================================== + + 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 lanuage to Fortran 77 `AC_LANG_FORTRAN77' +(*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 Mixing Fortran 77 With C and C++: + (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. + + +File: autoconf.info, Node: System Services, Next: UNIX Variants, Prev: Fortran 77 Compiler Characteristics, Up: Existing Tests + +System Services +=============== + + The following macros check for operating system services or +capabilities. + + - Macro: AC_CYGWIN + Checks for the Cygwin environment. If present, sets shell variable + `CYGWIN' to `yes'. If not present, sets `CYGWIN' to the empty + string. + + - Macro: AC_EXEEXT + Defines substitute variable `EXEEXT' based on the output of the + compiler, after .c, .o, and .obj files have been excluded. + Typically set to empty string if Unix, `.exe' or `.EXE' if Win32. + + - Macro: AC_OBJEXT + Defines substitute variable `OBJEXT' based on the output of the + compiler, after .c files have been excluded. Typically set to + `.o' if Unix, `.obj' if Win32. + + - Macro: AC_MINGW32 + Checks for the MingW32 compiler environment. If present, sets + shell variable `MINGW32' to `yes'. If not present, sets `MINGW32' + to the empty string. + + - 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'. If X is not available, adds `-DX_DISPLAY_MISSING' to + `X_CFLAGS'. + + 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.in' + can check the shell variable `interpval'; it will be set to `yes' + if the system supports `#!', `no' if not. + + - Macro: AC_SYS_LONG_FILE_NAMES + If the system supports file names longer than 14 characters, define + `HAVE_LONG_FILE_NAMES'. + + - Macro: AC_SYS_RESTARTABLE_SYSCALLS + If the system automatically restarts a system call that is + interrupted by a signal, define `HAVE_RESTARTABLE_SYSCALLS'. + + +File: autoconf.info, Node: UNIX Variants, Prev: System Services, Up: Existing Tests + +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_DYNIX_SEQ + If on Dynix/PTX (Sequent UNIX), add `-lseq' to output variable + `LIBS'. This macro is obsolete; instead, use `AC_FUNC_GETMNTENT'. + + - Macro: AC_IRIX_SUN + If on IRIX (Silicon Graphics UNIX), add `-lsun' to output variable + `LIBS'. This macro is obsolete. 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)'. + + - 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. + + - Macro: AC_SCO_INTL + If on SCO UNIX, add `-lintl' to output variable `LIBS'. This + macro is obsolete; instead, use `AC_FUNC_STRFTIME'. + + - Macro: AC_XENIX_DIR + If on Xenix, add `-lx' to output variable `LIBS'. Also, if + `dirent.h' is being used, add `-ldir' to `LIBS'. This macro is + obsolete; use `AC_HEADER_DIRENT' instead. + + +File: autoconf.info, Node: Writing Tests, Next: Results, Prev: Existing Tests, Up: Top + +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 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. +* Portable Shell:: Shell script portability pitfalls. +* Testing Values and Files:: Checking strings and files. +* 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 + +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, backquote, 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, backquote, 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 + +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 + +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. + + - Macro: AC_TRY_LINK_FUNC (FUNCTION, [ACTION-IF-FOUND [, + ACTION-IF-NOT-FOUND]]) + Attempt to compile and link a small program that links with + FUNCTION. If the file compiles and links successfully, run shell + commands ACTION-IF-FOUND, otherwise run ACTION-IF-NOT-FOUND. + + - 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', 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::.). + + +File: autoconf.info, Node: Run Time, Next: Portable Shell, Prev: Examining Libraries, Up: Writing Tests + +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 using them 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 + +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 + backquote 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 target 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. + + - Macro: AC_C_CROSS + This macro is obsolete; it does nothing. + + +File: autoconf.info, Node: Guidelines, Next: Test Functions, Prev: Test Programs, Up: Run Time + +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.in' +you can have a test program that includes an ANSI C header file +conditionally: + + #if STDC_HEADERS + # include + #endif + + If a test program needs to use or create a data file, give it a name +that starts with `conftest', such as `conftestdata'. 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 + +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: Portable Shell, Next: Testing Values and Files, Prev: Run Time, Up: Writing Tests + +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 Bash and the Korn shell +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, +as well; for example, don't rely on `ln' having a `-f' option or `cat' +having any options. `sed' scripts should not contain comments or use +branch labels longer than 8 characters. 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. + + +File: autoconf.info, Node: Testing Values and Files, Next: Multiple Cases, Prev: Portable Shell, Up: Writing Tests + +Testing Values and Files +======================== + + `configure' scripts need to test properties of many files and +strings. Here are some portability problems to watch out for when doing +those tests. + + 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. + + To enable `configure' scripts to support cross-compilation, they +shouldn't do anything that tests features of the host system instead of +the target 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. + + Another nonportable shell programming construction is + VAR=${VAR:-VALUE} + +The intent is to set VAR to VALUE only if it is not already set, but if +VAR has any value, even the empty string, to leave it alone. Old BSD +shells, including the Ultrix `sh', don't accept the colon, and complain +and die. A portable equivalent is + : ${VAR=VALUE} + + +File: autoconf.info, Node: Multiple Cases, Next: Language Choice, Prev: Testing Values and Files, Up: Writing Tests + +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 filesystem type) + fstype=no + # The order of these tests is important. + AC_TRY_CPP([#include + #include ], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4) + if test $fstype = no; then + AC_TRY_CPP([#include + #include ], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3) + fi + if test $fstype = no; then + AC_TRY_CPP([#include + #include ], 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 + +Language Choice +=============== + + Packages that use both C and C++ need to test features of both +compilers. Autoconf-generated `configure' scripts check for C features +by default. The following macros determine which language's compiler +is used in tests that follow in `configure.in'. + + - Macro: AC_LANG_C + Do compilation tests using `CC' and `CPP' and use extension `.c' + for test programs. Set the shell variable `cross_compiling' to + the value computed by `AC_PROG_CC' if it has been run, empty + otherwise. + + - Macro: AC_LANG_CPLUSPLUS + Do compilation tests using `CXX' and `CXXCPP' and use extension + `.C' for test programs. Set the shell variable `cross_compiling' + to the value computed by `AC_PROG_CXX' if it has been run, empty + otherwise. + + - Macro: AC_LANG_FORTRAN77 + Do compilation tests using `F77' and use extension `.f' for test + programs. Set the shell variable `cross_compiling' to the value + computed by `AC_PROG_F77' if it has been run, empty otherwise. + + - Macro: AC_LANG_SAVE + Remember the current language (as set by `AC_LANG_C', + `AC_LANG_CPLUSPLUS' or `AC_LANG_FORTRAN77') on a stack. Does not + change which language is current. Use this macro and + `AC_LANG_RESTORE' in macros that need to temporarily switch to a + particular language. + + - Macro: AC_LANG_RESTORE + Select the language that is saved on the top of the stack, as set + by `AC_LANG_SAVE', and remove it from the stack. This macro is + equivalent to either `AC_LANG_C', `AC_LANG_CPLUSPLUS' or + `AC_LANG_FORTRAN77', whichever had been run most recently when + `AC_LANG_SAVE' was last called. + + Do not call this macro more times than `AC_LANG_SAVE'. + + - 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: Writing Macros, Prev: Writing Tests, Up: Top + +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 users of progress or problems. + + +File: autoconf.info, Node: Defining Symbols, Next: Setting Output Variables, Prev: Results, Up: Results + +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_HEADER' 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_HEADER' 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_HEADER'. + In this case, DESCRIPTION is put into the generated `config.h.in' + as the comment before the macro define; the macro need not be + mentioned in `acconfig.h'. 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 + +Setting Output Variables +======================== + + One 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) + 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. The value + of VARIABLE should not contain literal newlines. + + - 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.in' + could contain: + + AC_SUBST_FILE(host_frag)dnl + host_frag=$srcdir/conf/sun4.mh + + and then a `Makefile.in' could contain: + + @host_frag@ + + +File: autoconf.info, Node: Caching Results, Next: Printing Messages, Prev: Setting Output Variables, Up: Results + +Caching Results +=============== + + To avoid checking for the same features repeatedly in various +`configure' scripts (or repeated runs of one script), `configure' saves +the results of many of its checks in a "cache file". If, when a +`configure' script runs, it finds a cache file, it reads from it the +results from previous runs and avoids rerunning those checks. As a +result, `configure' can 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. + Those commands should have no side effects except for setting the + variable CACHE-ID. In particular, they should not call + `AC_DEFINE'; the code that follows the call to `AC_CACHE_VAL' + should do that, based on the cached value. Also, they 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. 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. + + - Macro: AC_CACHE_CHECK (MESSAGE, CACHE-ID, COMMANDS) + 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. + + - 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.in. Doing so + checkpoints the cache in case of an early configure script abort. + +* Menu: + +* Cache Variable Names:: Shell variables used in caches. +* Cache Files:: Files `configure' uses for caching. + + +File: autoconf.info, Node: Cache Variable Names, Next: Cache Files, Prev: Caching Results, Up: Caching Results + +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. + +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, Prev: Cache Variable Names, Up: Caching Results + +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 `./config.cache' as the cache file, +creating it if it does not exist already. `configure' accepts the +`--cache-file=FILE' option to use a different cache file; that is what +`configure' does when it calls `configure' scripts in subdirectories, +so they share the cache. *Note Subdirectories::, for information on +configuring subdirectories with the `AC_CONFIG_SUBDIRS' macro. + + Giving `--cache-file=/dev/null' disables caching, for debugging +`configure'. `config.status' only pays attention to the cache file if +it is given the `--recheck' option, which makes it rerun `configure'. +If you are anticipating a long debugging period, you can also disable +cache loading and saving for a `configure' script by redefining the +cache macros at the start of `configure.in': + + define([AC_CACHE_LOAD], )dnl + define([AC_CACHE_SAVE], )dnl + AC_INIT(whatever) + ... rest of configure.in ... + + 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 cache file on a particular system will gradually accumulate +whenever someone runs a `configure' script; it will be initially +nonexistent. Running `configure' merges the new cache results with the +existing cache file. The site initialization script can specify a +site-wide cache file to use instead of the default, to make it work +transparently, as long as the same C compiler is used every time (*note +Site Defaults::.). + + If your configure script, or a macro called from configure.in, +happens to abort the configure process, it may be useful to checkpoint +the cache a few times at key points. 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. + + ... AC_INIT, etc. ... + dnl checks for programs + AC_PROG_CC + AC_PROG_GCC_TRADITIONAL + ... more program checks ... + AC_CACHE_SAVE + + dnl checks for libraries + AC_CHECK_LIB(nsl, gethostbyname) + AC_CHECK_LIB(socket, connect) + ... more lib checks ... + AC_CACHE_SAVE + + dnl Might abort... + AM_PATH_GTK(1.0.2, , exit 1) + AM_PATH_GTKMM(0.9.5, , exit 1) + + +File: autoconf.info, Node: Printing Messages, Prev: Caching Results, Up: Results + +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 backquote substitution +on them. You can print a message containing a comma by quoting the +message with the `m4' quote characters: + + AC_MSG_RESULT([never mind, I found the BASIC compiler]) + + 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 change +automatically. + + - 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_ERROR (ERROR-DESCRIPTION) + Notify the user of an error that prevents `configure' from + completing. This macro prints an error message on the standard + error output and exits `configure' with a nonzero status. + ERROR-DESCRIPTION should be something like `invalid value $HOME + for \$HOME'. + + - Macro: AC_MSG_WARN (PROBLEM-DESCRIPTION) + Notify the `configure' user of a possible problem. This macro + prints the message on 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'. + + The following two macros are an obsolete alternative to +`AC_MSG_CHECKING' and `AC_MSG_RESULT'. + + - Macro: AC_CHECKING (FEATURE-DESCRIPTION) + This macro is similar to `AC_MSG_CHECKING', except that it prints a + newline after the FEATURE-DESCRIPTION. It is useful mainly to + print a general description of the overall purpose of a group of + feature checks, e.g., + + AC_CHECKING(if stack overflow is detectable) + + - Macro: AC_VERBOSE (RESULT-DESCRIPTION) + This macro is similar to `AC_MSG_RESULT', except that it is meant + to follow a call to `AC_CHECKING' instead of `AC_MSG_CHECKING'; it + starts the message it prints with a tab. It is considered + obsolete. + + +File: autoconf.info, Node: Writing Macros, Next: Manual Configuration, Prev: Results, Up: Top + +Writing 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. +* Quoting:: Protecting macros from unwanted expansion. +* Dependencies Between Macros:: What to do when macros depend on other macros. + + +File: autoconf.info, Node: Macro Definitions, Next: Macro Names, Prev: Writing Macros, Up: Writing Macros + +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 which 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]) + +The square brackets here do not indicate optional text: they should +literally be present in the macro definition to avoid macro expansion +problems (*note Quoting::.). You can refer to any arguments passed to +the macro as `$1', `$2', etc. + + To introduce comments in `m4', use the `m4' builtin `dnl'; it causes +`m4' to discard the text through the next newline. It is not needed +between macro definitions in `acsite.m4' and `aclocal.m4', because all +output is discarded until `AC_INIT' is called. + + *Note How to define new macros: (m4.info)Definitions, for more +complete information on writing `m4' macros. + + +File: autoconf.info, Node: Macro Names, Next: Quoting, Prev: Macro Definitions, Up: Writing Macros + +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. + +`STRUCT' + Definitions of C structures in header files. + +`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. + + A macro that is an internal subroutine of another macro should have a +name that starts with 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: Quoting, Next: Dependencies Between Macros, Prev: Macro Names, Up: Writing Macros + +Quoting +======= + + Macros that are called by other macros are evaluated by `m4' several +times; each evaluation might require another layer of quotes to prevent +unwanted expansions of macros or `m4' builtins, such as `define' and +`$1'. Quotes are also required around macro arguments that contain +commas, since commas separate the arguments from each other. It's a +good idea to quote any macro arguments that contain newlines or calls +to other macros, as well. + + Autoconf changes the `m4' quote characters from the default ``' and +`'' to `[' and `]', because many of the macros use ``' and `'', +mismatched. However, in a few places the macros need to use brackets +(usually in C program text or regular expressions). In those places, +they use the `m4' builtin command `changequote' to temporarily change +the quote characters to `<<' and `>>'. (Sometimes, if they don't need +to quote anything, they disable quoting entirely instead by setting the +quote characters to empty strings.) Here is an example: + + AC_TRY_LINK( + changequote(<<, >>)dnl + <<#include + #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) + + 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: Dependencies Between Macros, Prev: Quoting, Up: Writing Macros + +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. +* Obsolete Macros:: Warning about old ways of doing things. + + +File: autoconf.info, Node: Prerequisite Macros, Next: Suggested Ordering, Prev: Dependencies Between Macros, Up: Dependencies Between Macros + +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. + + An alternative to using `AC_DEFUN' is to use `define' and call +`AC_PROVIDE'. Because this technique does not prevent nested messages, +it is considered obsolete. + + - Macro: AC_PROVIDE (THIS-MACRO-NAME) + Record the fact that THIS-MACRO-NAME has been called. + THIS-MACRO-NAME should be the name of the macro that is calling + `AC_PROVIDE'. An easy way to get it is from the `m4' builtin + variable `$0', like this: + + AC_PROVIDE([$0]) + + +File: autoconf.info, Node: Suggested Ordering, Next: Obsolete Macros, Prev: Prerequisite Macros, Up: Dependencies Between Macros + +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.in' +file. The warning occurs when creating `configure' from +`configure.in', 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 on 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: Obsolete Macros, Prev: Suggested Ordering, Up: Dependencies Between Macros + +Obsolete 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. Autoconf provides the `AC_OBSOLETE' macro to +warn users producing `configure' scripts when they use obsolete macros, +to encourage them to modernize. A sample call is: + + AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl + + - Macro: AC_OBSOLETE (THIS-MACRO-NAME [, SUGGESTION]) + Make `m4' print a message on 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. + + +File: autoconf.info, Node: Manual Configuration, Next: Site Configuration, Prev: Writing Macros, Up: Top + +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. +* System Type Variables:: Variables containing the 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 + +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-COMPANY-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 derives 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: + +`--build=BUILD-TYPE' + the type of system on which the package is being configured and + compiled (rarely needed); + +`--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. + +If the user gives `configure' a non-option argument, it is used as the +default for the host, target, and build system types if the user does +not specify them explicitly with options. The target and build types +default to the host type if it is given and they are not. If you are +cross-compiling, you still have to specify the names of the cross-tools +you use, in particular the C compiler, on the `configure' command line, +e.g., + + CC=m68k-coff-gcc configure --target=m68k-coff + + `configure' recognizes short aliases for many system types; for +example, `decstation' can be given on the command line instead of +`mips-dec-ultrix4.2'. `configure' runs a script called `config.sub' to +canonicalize system type aliases. + + +File: autoconf.info, Node: Canonicalizing, Next: System Type Variables, Prev: Specifying Names, Up: Manual Configuration + +Getting the Canonical System Type +================================= + + The following macros make the system type available to `configure' +scripts. They run the shell script `config.guess' to determine any +values for the host, target, and build types that they need and the user +did not specify on the command line. They run `config.sub' to +canonicalize any aliases the user gave. If you use these macros, you +must distribute those two shell scripts along with your source code. +*Note Output::, for information about the `AC_CONFIG_AUX_DIR' macro +which you can use to control which directory `configure' looks for +those scripts in. If you do not use either of these macros, +`configure' ignores any `--host', `--target', and `--build' options +given to it. + + - Macro: AC_CANONICAL_SYSTEM + Determine the system type and set output variables to the names of + the canonical system types. *Note System Type Variables::, for + details about the variables this macro sets. + + - Macro: AC_CANONICAL_HOST + Perform only the subset of `AC_CANONICAL_SYSTEM' relevant to the + host type. This is all that is needed for programs that are not + part of a compiler toolchain. + + - Macro: 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. + + +File: autoconf.info, Node: System Type Variables, Next: Using System Type, Prev: Canonicalizing, Up: Manual Configuration + +System Type Variables +===================== + + After calling `AC_CANONICAL_SYSTEM', the following output variables +contain the system type information. After `AC_CANONICAL_HOST', only +the `host' variables below are set. + +``build', `host', `target'' + the canonical system names; + +``build_alias', `host_alias', `target_alias'' + the names the user specified, or the canonical names if + `config.guess' was used; + +``build_cpu', `build_vendor', `build_os'' +``host_cpu', `host_vendor', `host_os'' +``target_cpu', `target_vendor', `target_os'' + the individual parts of the canonical names (for convenience). + + +File: autoconf.info, Node: Using System Type, Prev: System Type Variables, Up: Manual Configuration + +Using the System Type +===================== + + How do you use a canonical system type? Usually, you use it in one +or more `case' statements in `configure.in' to select system-specific C +files. Then link those files, which have names based on the system +name, to generic names, such as `host.h' or `target.c'. The `case' +statement patterns can use shell wildcards 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 + + - Macro: AC_LINK_FILES (SOURCE..., DEST...) + 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 + may be called multiple times. + + For example, this call: + + AC_LINK_FILES(config/${machine}.h config/${obj_format}.h, host.h object.h) + + creates in the current directory `host.h', which is a link to + `SRCDIR/config/${machine}.h', and `object.h', which is a link to + `SRCDIR/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: Invoking configure, Prev: Manual Configuration, Up: Top + +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. +* 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 + +Working With External Software +============================== + + Some packages require, or can optionally use, other software packages +which 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.in' +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 which + 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. + + - 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: Site Details, Prev: External Software, Up: Site Configuration + +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.in' 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::.). + + - 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: Site Details, Next: Transforming Names, Prev: Package Options, Up: Site Configuration + +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 + +Transforming Program Names When Installing +========================================== + + Autoconf supports changing the names of programs when installing +them. In order to use these transformations, `configure.in' 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_SYSTEM' has been called and a `--target' value is + given that differs from the host type (specified with `--host' or + defaulted by `config.sub'), 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 + +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 + +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. + + +File: autoconf.info, Node: Transformation Rules, Prev: Transformation Examples, Up: Transforming Names + +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 + + 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 + +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. 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" = ./config.cache; then + cache_file="$prefix/var/config.cache" + # A cache file is only valid for one C compiler. + CC=gcc + fi + + +File: autoconf.info, Node: Invoking configure, Next: Invoking config.status, Prev: Site Configuration, Up: Top + +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'. +* Operation Controls:: Changing how `configure' runs. + + +File: autoconf.info, Node: Basic Installation, Next: Compilers and Options, Up: Invoking configure + +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, a file +`config.cache' that saves the results of its tests to speed up +reconfiguring, and a file `config.log' containing compiler output +(useful mainly for debugging `configure'). + + 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 at some point `config.cache' +contains results you don't want to keep, you may remove or edit it. + + The file `configure.in' is used to create `configure' by a program +called `autoconf'. You only need `configure.in' 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: Invoking configure + +Compilers and Options +===================== + + Some systems require unusual options for compilation or linking that +the `configure' script does not know about. You can give `configure' +initial values for variables by setting them in the environment. Using +a Bourne-compatible shell, you can do that on the command line like +this: + CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure + +Or on systems that have the `env' program, you can do it like this: + env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure + + +File: autoconf.info, Node: Multiple Architectures, Next: Installation Names, Prev: Compilers and Options, Up: Invoking configure + +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 supports 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: Invoking configure + +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: Invoking configure + +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: Invoking configure + +Specifying the System Type +========================== + + There may be some features `configure' can not 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 can not guess the host type, give it the +`--host=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name with three fields: + CPU-COMPANY-SYSTEM + +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 can also +use the `--target=TYPE' option to select the type of system they will +produce code for and the `--build=TYPE' option to select the type of +system on which you are compiling the package. + + +File: autoconf.info, Node: Sharing Defaults, Next: Operation Controls, Prev: System Type, Up: Invoking configure + +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: Operation Controls, Prev: Sharing Defaults, Up: Invoking configure + +Operation Controls +================== + + `configure' recognizes the following options to control how it +operates. + +`--cache-file=FILE' + Use and save the results of the tests in FILE instead of + `./config.cache'. Set FILE to `/dev/null' to disable caching, for + debugging `configure'. + +`--help' + Print a summary of the options to `configure', and exit. + +`--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. + +`--version' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`configure' also accepts some other, not widely useful, options. + + +File: autoconf.info, Node: Invoking config.status, Next: Questions, Prev: Invoking configure, Up: Top + +Recreating a Configuration +************************** + + The `configure' script creates a file named `config.status' which +describes which configuration options were specified when the package +was last configured. This file is a shell script which, if run, will +recreate the same configuration. + + You can give `config.status' the `--recheck' option to update +itself. 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 prevent `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' also accepts the options `--help', which prints a +summary of the options to `config.status', and `--version', which +prints the version of Autoconf used to create the `configure' script +that generated `config.status'. + + `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. + + The following variables 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 variables allow a +`config.status' file to create files other than the ones that its +`configure.in' specifies, so it can be used for a different package. + + - Variable: CONFIG_FILES + The files in which to perform `@VARIABLE@' substitutions. The + default is the arguments given to `AC_OUTPUT' in `configure.in'. + + - Variable: CONFIG_HEADERS + The files in which to substitute C `#define' statements. The + default is the arguments given to `AC_CONFIG_HEADER'; if that + macro was not called, `config.status' ignores this variable. + + These variables also allow you to write `Makefile' rules that +regenerate only some of the files. For example, in the dependencies +given above (*note Automatic Remaking::.), `config.status' is run twice +when `configure.in' 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_FILES= CONFIG_HEADERS=config.h ./config.status + echo > stamp-h + + Makefile: Makefile.in config.status + CONFIG_FILES=Makefile CONFIG_HEADERS= ./config.status + +(If `configure.in' does not call `AC_CONFIG_HEADER', there is no need +to set `CONFIG_HEADERS' in the `make' rules.) + + +File: autoconf.info, Node: Questions, Next: Upgrading, Prev: Invoking config.status, Up: Top + +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 + +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.in', since it is derived from that file and from the public +domain file `acconfig.h'. `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 + +Why Require GNU `m4'? +===================== + + Why does Autoconf require GNU `m4'? + + Many `m4' implementations have hard-coded limitations on the size +and number of macros, which 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__ + + 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 + +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 + +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 which 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: Upgrading, Next: History, Prev: Questions, Up: Top + +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.in' 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. + + First, make sure you have GNU `m4' version 1.1 or higher installed, +preferably 1.3 or higher. Versions before 1.1 have bugs that prevent +them from working with Autoconf version 2. Versions 1.3 and later are +much faster than earlier versions, because as of version 1.3, GNU `m4' +has a more efficient implementation of diversions and can freeze its +internal state in a file that it can read back quickly. + +* Menu: + +* Changed File Names:: Files you might rename. +* Changed Makefiles:: New things to put in `Makefile.in'. +* Changed Macros:: Macro calls you might replace. +* Invoking autoupdate:: Replacing old macro names in `configure.in'. +* 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: Upgrading, Up: Upgrading + +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 Invoking autoconf::. + + 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' or `config.h.bot', you still can, +but you will have less clutter if you merge them into `acconfig.h'. +*Note Invoking autoheader::. + + +File: autoconf.info, Node: Changed Makefiles, Next: Changed Macros, Prev: Changed File Names, Up: Upgrading + +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 non-`Makefile' +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: Invoking autoupdate, Prev: Changed Makefiles, Up: Upgrading + +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 Old Macro Names::, for a table +showing the new names for the old macros. Use the `autoupdate' program +to convert your `configure.in' to using the new macro names. *Note +Invoking autoupdate::. + + 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: Invoking autoupdate, Next: Changed Results, Prev: Changed Macros, Up: Upgrading + +Using `autoupdate' to Modernize `configure' +=========================================== + + The `autoupdate' program updates a `configure.in' 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 Old Macro Names::., for a list of the old macro names and the +corresponding new names), you can make your `configure.in' 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.in', 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.in' 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. + +`--macrodir=DIR' +`-m DIR' + Look for the Autoconf macro files in directory DIR instead of the + default installation directory. You can also set the `AC_MACRODIR' + environment variable to a directory; this option overrides the + environment variable. + +`--version' + Print the version number of `autoupdate' and exit. + + +File: autoconf.info, Node: Changed Results, Next: Changed Macro Writing, Prev: Invoking autoupdate, Up: Upgrading + +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.in' 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 $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 backquotes) 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: Upgrading + +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: History, Next: Old Macro Names, Prev: Upgrading, Up: Top + +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 + +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 + +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 + +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 Franc,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 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 + +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. Franc,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 +`--macrodir' 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 + +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 Franc,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 testsuite, because experience had +shown that Autoconf has a pronounced tendency to regress when we change +it. + + Again, several alpha testers gave invaluable feedback, especially +Franc,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: Old Macro Names, Next: Environment Variable Index, Prev: History, Up: Top + +Old Macro Names +*************** + + In version 2 of Autoconf, most of the macros were renamed to use a +more uniform and descriptive naming scheme. Here are the old names of +the macros that were renamed, followed by the current names of those +macros. Although the old names are still accepted by the `autoconf' +program for backward compatibility, the old names are considered +obsolete. *Note Macro Names::, for a description of the new naming +scheme. + +`AC_ALLOCA' + `AC_FUNC_ALLOCA' + +`AC_ARG_ARRAY' + removed because of limited usefulness + +`AC_CHAR_UNSIGNED' + `AC_C_CHAR_UNSIGNED' + +`AC_CONST' + `AC_C_CONST' + +`AC_CROSS_CHECK' + `AC_C_CROSS' + +`AC_ERROR' + `AC_MSG_ERROR' + +`AC_FIND_X' + `AC_PATH_X' + +`AC_FIND_XTRA' + `AC_PATH_XTRA' + +`AC_FUNC_CHECK' + `AC_CHECK_FUNC' + +`AC_GCC_TRADITIONAL' + `AC_PROG_GCC_TRADITIONAL' + +`AC_GETGROUPS_T' + `AC_TYPE_GETGROUPS' + +`AC_GETLOADAVG' + `AC_FUNC_GETLOADAVG' + +`AC_HAVE_FUNCS' + `AC_CHECK_FUNCS' + +`AC_HAVE_HEADERS' + `AC_CHECK_HEADERS' + +`AC_HAVE_POUNDBANG' + `AC_SYS_INTERPRETER' (different calling convention) + +`AC_HEADER_CHECK' + `AC_CHECK_HEADER' + +`AC_HEADER_EGREP' + `AC_EGREP_HEADER' + +`AC_INLINE' + `AC_C_INLINE' + +`AC_LN_S' + `AC_PROG_LN_S' + +`AC_LONG_DOUBLE' + `AC_C_LONG_DOUBLE' + +`AC_LONG_FILE_NAMES' + `AC_SYS_LONG_FILE_NAMES' + +`AC_MAJOR_HEADER' + `AC_HEADER_MAJOR' + +`AC_MINUS_C_MINUS_O' + `AC_PROG_CC_C_O' + +`AC_MMAP' + `AC_FUNC_MMAP' + +`AC_MODE_T' + `AC_TYPE_MODE_T' + +`AC_OFF_T' + `AC_TYPE_OFF_T' + +`AC_PID_T' + `AC_TYPE_PID_T' + +`AC_PREFIX' + `AC_PREFIX_PROGRAM' + +`AC_PROGRAMS_CHECK' + `AC_CHECK_PROGS' + +`AC_PROGRAMS_PATH' + `AC_PATH_PROGS' + +`AC_PROGRAM_CHECK' + `AC_CHECK_PROG' + +`AC_PROGRAM_EGREP' + `AC_EGREP_CPP' + +`AC_PROGRAM_PATH' + `AC_PATH_PROG' + +`AC_REMOTE_TAPE' + removed because of limited usefulness + +`AC_RESTARTABLE_SYSCALLS' + `AC_SYS_RESTARTABLE_SYSCALLS' + +`AC_RETSIGTYPE' + `AC_TYPE_SIGNAL' + +`AC_RSH' + removed because of limited usefulness + +`AC_SETVBUF_REVERSED' + `AC_FUNC_SETVBUF_REVERSED' + +`AC_SET_MAKE' + `AC_PROG_MAKE_SET' + +`AC_SIZEOF_TYPE' + `AC_CHECK_SIZEOF' + +`AC_SIZE_T' + `AC_TYPE_SIZE_T' + +`AC_STAT_MACROS_BROKEN' + `AC_HEADER_STAT' + +`AC_STDC_HEADERS' + `AC_HEADER_STDC' + +`AC_STRCOLL' + `AC_FUNC_STRCOLL' + +`AC_ST_BLKSIZE' + `AC_STRUCT_ST_BLKSIZE' + +`AC_ST_BLOCKS' + `AC_STRUCT_ST_BLOCKS' + +`AC_ST_RDEV' + `AC_STRUCT_ST_RDEV' + +`AC_SYS_SIGLIST_DECLARED' + `AC_DECL_SYS_SIGLIST' + +`AC_TEST_CPP' + `AC_TRY_CPP' + +`AC_TEST_PROGRAM' + `AC_TRY_RUN' + +`AC_TIMEZONE' + `AC_STRUCT_TIMEZONE' + +`AC_TIME_WITH_SYS_TIME' + `AC_HEADER_TIME' + +`AC_UID_T' + `AC_TYPE_UID_T' + +`AC_UTIME_NULL' + `AC_FUNC_UTIME_NULL' + +`AC_VFORK' + `AC_FUNC_VFORK' + +`AC_VPRINTF' + `AC_FUNC_VPRINTF' + +`AC_WAIT3' + `AC_FUNC_WAIT3' + +`AC_WARN' + `AC_MSG_WARN' + +`AC_WORDS_BIGENDIAN' + `AC_C_BIGENDIAN' + +`AC_YYTEXT_POINTER' + `AC_DECL_YYTEXT' + + +File: autoconf.info, Node: Environment Variable Index, Next: Output Variable Index, Prev: Old Macro Names, Up: Top + +Environment Variable Index +************************** + + This is an alphabetical list of the environment variables that +Autoconf checks. + +* Menu: + +* AC_MACRODIR <1>: Invoking autoupdate. +* AC_MACRODIR <2>: Invoking autoheader. +* AC_MACRODIR <3>: Invoking autoreconf. +* AC_MACRODIR <4>: Invoking autoconf. +* AC_MACRODIR <5>: Invoking ifnames. +* AC_MACRODIR: Invoking autoscan. +* CONFIG_FILES: Invoking config.status. +* CONFIG_HEADERS: Invoking config.status. +* CONFIG_SHELL: Invoking config.status. +* CONFIG_SITE: Site Defaults. +* CONFIG_STATUS: Invoking config.status. +* SIMPLE_BACKUP_SUFFIX: Invoking autoupdate. + + +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. +* AWK: Particular Programs. +* bindir: Preset Output Variables. +* build: System Type Variables. +* build_alias: System Type Variables. +* build_cpu: System Type Variables. +* build_os: System Type Variables. +* build_vendor: System Type Variables. +* CC <1>: UNIX Variants. +* CC: Particular Programs. +* CFLAGS <1>: Particular Programs. +* CFLAGS: Preset Output Variables. +* configure_input: Preset Output Variables. +* CPP: Particular Programs. +* CPPFLAGS: Preset Output Variables. +* CXX: Particular Programs. +* CXXCPP: Particular Programs. +* CXXFLAGS <1>: Particular Programs. +* CXXFLAGS: Preset Output Variables. +* datadir: Preset Output Variables. +* DEFS: Preset Output Variables. +* exec_prefix: Preset Output Variables. +* EXEEXT: System Services. +* F77: Particular Programs. +* FFLAGS <1>: Particular Programs. +* FFLAGS: Preset Output Variables. +* FLIBS: Fortran 77 Compiler Characteristics. +* host: System Type Variables. +* host_alias: System Type Variables. +* host_cpu: System Type Variables. +* host_os: System Type Variables. +* host_vendor: System Type Variables. +* includedir: Preset Output Variables. +* infodir: Preset Output Variables. +* INSTALL: Particular Programs. +* INSTALL_DATA: Particular Programs. +* INSTALL_PROGRAM: Particular Programs. +* INSTALL_SCRIPT: Particular Programs. +* KMEM_GROUP: Particular Functions. +* LDFLAGS: Preset Output Variables. +* LEX: Particular Programs. +* LEX_OUTPUT_ROOT: Particular Programs. +* LEXLIB: Particular Programs. +* libdir: Preset Output Variables. +* libexecdir: Preset Output Variables. +* LIBOBJS <1>: Structures. +* LIBOBJS <2>: Generic Functions. +* LIBOBJS: Particular Functions. +* LIBS <1>: UNIX Variants. +* LIBS: Preset Output Variables. +* LN_S: Particular Programs. +* localstatedir: Preset Output Variables. +* mandir: Preset Output Variables. +* NEED_SETGID: Particular Functions. +* OBJEXT: System Services. +* oldincludedir: Preset Output Variables. +* prefix: Preset Output Variables. +* program_transform_name: Transforming Names. +* RANLIB: Particular Programs. +* sbindir: Preset Output Variables. +* SET_MAKE: Output. +* sharedstatedir: Preset Output Variables. +* srcdir: Preset Output Variables. +* subdirs: Subdirectories. +* sysconfdir: Preset Output Variables. +* target: System Type Variables. +* target_alias: System Type Variables. +* target_cpu: System Type Variables. +* target_os: System Type Variables. +* target_vendor: System Type Variables. +* top_srcdir: Preset Output Variables. +* X_CFLAGS: System Services. +* X_EXTRA_LIBS: System Services. +* X_LIBS: System Services. +* X_PRE_LIBS: System Services. +* YACC: Particular Programs. + + +File: autoconf.info, Node: Preprocessor Symbol Index, Next: 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: + +* __CHAR_UNSIGNED__: C Compiler Characteristics. +* _ALL_SOURCE: UNIX Variants. +* _MINIX: UNIX Variants. +* _POSIX_1_SOURCE: UNIX Variants. +* _POSIX_SOURCE: UNIX Variants. +* _POSIX_VERSION: Particular Headers. +* C_ALLOCA: Particular Functions. +* CLOSEDIR_VOID: Particular Functions. +* const: C Compiler Characteristics. +* DGUX: Particular Functions. +* DIRENT: Particular Headers. +* F77_NO_MINUS_C_MINUS_O: Particular Programs. +* GETGROUPS_T: Particular Typedefs. +* GETLODAVG_PRIVILEGED: Particular Functions. +* GETPGRP_VOID: Particular Functions. +* gid_t: Particular Typedefs. +* HAVE_ALLOCA_H: Particular Functions. +* HAVE_CONFIG_H: Configuration Headers. +* HAVE_DIRENT_H: Particular Headers. +* HAVE_DOPRNT: Particular Functions. +* HAVE_FUNCTION: Generic Functions. +* HAVE_GETMNTENT: Particular Functions. +* HAVE_HEADER: Generic Headers. +* HAVE_LONG_DOUBLE: C Compiler Characteristics. +* HAVE_LONG_FILE_NAMES: System Services. +* HAVE_MMAP: Particular Functions. +* HAVE_NDIR_H: Particular Headers. +* HAVE_RESTARTABLE_SYSCALLS: System Services. +* HAVE_ST_BLKSIZE: Structures. +* HAVE_ST_BLOCKS: Structures. +* HAVE_ST_RDEV: Structures. +* HAVE_STRCOLL: Particular Functions. +* HAVE_STRFTIME: Particular Functions. +* HAVE_STRINGIZE: C Compiler Characteristics. +* HAVE_SYS_DIR_H: Particular Headers. +* HAVE_SYS_NDIR_H: Particular Headers. +* HAVE_SYS_WAIT_H: Particular Headers. +* HAVE_TM_ZONE: Structures. +* HAVE_TZNAME: Structures. +* HAVE_UNISTD_H: Particular Headers. +* HAVE_UTIME_NULL: Particular Functions. +* HAVE_VFORK_H: Particular Functions. +* HAVE_VPRINTF: Particular Functions. +* HAVE_WAIT3: Particular Functions. +* inline: C Compiler Characteristics. +* INT_16_BITS: C Compiler Characteristics. +* LONG_64_BITS: C Compiler Characteristics. +* MAJOR_IN_MKDEV: Particular Headers. +* MAJOR_IN_SYSMACROS: Particular Headers. +* mode_t: Particular Typedefs. +* NDIR: Particular Headers. +* NEED_MEMORY_H: Particular Headers. +* NEED_SETGID: Particular Functions. +* NLIST_NAME_UNION: Particular Functions. +* NLIST_STRUCT: Particular Functions. +* NO_MINUS_C_MINUS_O: Particular Programs. +* off_t: Particular Typedefs. +* pid_t: Particular Typedefs. +* RETSIGTYPE: Particular Typedefs. +* SELECT_TYPE_ARG1: Particular Functions. +* SELECT_TYPE_ARG234: Particular Functions. +* SELECT_TYPE_ARG5: Particular Functions. +* SETPGRP_VOID: Particular Functions. +* SETVBUF_REVERSED: Particular Functions. +* size_t: Particular Typedefs. +* STDC_HEADERS: Particular Headers. +* SVR4: Particular Functions. +* SYS_SIGLIST_DECLARED: Particular Headers. +* SYSDIR: Particular Headers. +* SYSNDIR: Particular Headers. +* TIME_WITH_SYS_TIME: Structures. +* TM_IN_SYS_TIME: Structures. +* uid_t: Particular Typedefs. +* UMAX: Particular Functions. +* UMAX4_3: Particular Functions. +* USG: Particular Headers. +* vfork: Particular Functions. +* VOID_CLOSEDIR: Particular Headers. +* WORDS_BIGENDIAN: C Compiler Characteristics. +* YYTEXT_POINTER: Particular Programs. + + +File: autoconf.info, Node: Macro Index, Prev: Preprocessor Symbol Index, Up: Top + +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: + +* AIX: UNIX Variants. +* ALLOCA: Old Macro Names. +* ARG_ARRAY: Old Macro Names. +* ARG_ENABLE: Package Options. +* ARG_PROGRAM: Transforming Names. +* ARG_WITH: External Software. +* BEFORE: Suggested Ordering. +* C_BIGENDIAN: C Compiler Characteristics. +* C_CHAR_UNSIGNED: C Compiler Characteristics. +* C_CONST: C Compiler Characteristics. +* C_CROSS: Test Programs. +* C_INLINE: C Compiler Characteristics. +* C_LONG_DOUBLE: C Compiler Characteristics. +* C_STRINGIZE: C Compiler Characteristics. +* CACHE_CHECK: Caching Results. +* CACHE_LOAD: Caching Results. +* CACHE_SAVE: Caching Results. +* CACHE_VAL: Caching Results. +* CANONICAL_HOST: Canonicalizing. +* CANONICAL_SYSTEM: Canonicalizing. +* CHAR_UNSIGNED: Old Macro Names. +* CHECK_FILE: Generic Programs. +* CHECK_FILES: Generic Programs. +* CHECK_FUNC: Generic Functions. +* CHECK_FUNCS: Generic Functions. +* CHECK_HEADER: Generic Headers. +* CHECK_HEADERS: Generic Headers. +* CHECK_LIB: Libraries. +* CHECK_PROG: Generic Programs. +* CHECK_PROGS: Generic Programs. +* CHECK_SIZEOF: C Compiler Characteristics. +* CHECK_TOOL: Generic Programs. +* CHECK_TYPE: Generic Typedefs. +* CHECKING: Printing Messages. +* COMPILE_CHECK: Examining Libraries. +* CONFIG_AUX_DIR: Input. +* CONFIG_HEADER: Configuration Headers. +* CONFIG_SUBDIRS: Subdirectories. +* CONST: Old Macro Names. +* CROSS_CHECK: Old Macro Names. +* CYGWIN: System Services. +* DECL_SYS_SIGLIST: Particular Headers. +* DECL_YYTEXT: Particular Programs. +* DEFINE: Defining Symbols. +* DEFINE_UNQUOTED: Defining Symbols. +* DEFUN: Macro Definitions. +* DIR_HEADER: Particular Headers. +* DYNIX_SEQ: UNIX Variants. +* EGREP_CPP: Examining Declarations. +* EGREP_HEADER: Examining Declarations. +* ENABLE: Package Options. +* ERROR: Old Macro Names. +* EXEEXT: System Services. +* F77_LIBRARY_LDFLAGS: Fortran 77 Compiler Characteristics. +* FIND_X: Old Macro Names. +* FIND_XTRA: Old Macro Names. +* FUNC_ALLOCA: Particular Functions. +* FUNC_CHECK: Old Macro Names. +* FUNC_CLOSEDIR_VOID: Particular Functions. +* FUNC_FNMATCH: Particular Functions. +* FUNC_GETLOADAVG: Particular Functions. +* FUNC_GETMNTENT: Particular Functions. +* FUNC_GETPGRP: Particular Functions. +* FUNC_MEMCMP: Particular Functions. +* FUNC_MMAP: Particular Functions. +* FUNC_SELECT_ARGTYPES: Particular Functions. +* FUNC_SETPGRP: Particular Functions. +* FUNC_SETVBUF_REVERSED: Particular Functions. +* FUNC_STRCOLL: Particular Functions. +* FUNC_STRFTIME: Particular Functions. +* FUNC_UTIME_NULL: Particular Functions. +* FUNC_VFORK: Particular Functions. +* FUNC_VPRINTF: Particular Functions. +* FUNC_WAIT3: Particular Functions. +* GCC_TRADITIONAL: Old Macro Names. +* GETGROUPS_T: Old Macro Names. +* GETLOADAVG: Old Macro Names. +* HAVE_FUNCS: Old Macro Names. +* HAVE_HEADERS: Old Macro Names. +* HAVE_LIBRARY: Libraries. +* HAVE_POUNDBANG: Old Macro Names. +* HEADER_CHECK: Old Macro Names. +* HEADER_DIRENT: Particular Headers. +* HEADER_EGREP: Old Macro Names. +* HEADER_MAJOR: Particular Headers. +* HEADER_STAT: Structures. +* HEADER_STDC: Particular Headers. +* HEADER_SYS_WAIT: Particular Headers. +* HEADER_TIME: Structures. +* INIT: Input. +* INLINE: Old Macro Names. +* INT_16_BITS: C Compiler Characteristics. +* IRIX_SUN: UNIX Variants. +* ISC_POSIX: UNIX Variants. +* LANG_C: Language Choice. +* LANG_CPLUSPLUS: Language Choice. +* LANG_FORTRAN77: Language Choice. +* LANG_RESTORE: Language Choice. +* LANG_SAVE: Language Choice. +* LINK_FILES: Using System Type. +* LN_S: Old Macro Names. +* LONG_64_BITS: C Compiler Characteristics. +* LONG_DOUBLE: Old Macro Names. +* LONG_FILE_NAMES: Old Macro Names. +* MAJOR_HEADER: Old Macro Names. +* MEMORY_H: Particular Headers. +* MINGW32: System Services. +* MINIX: UNIX Variants. +* MINUS_C_MINUS_O: Old Macro Names. +* MMAP: Old Macro Names. +* MODE_T: Old Macro Names. +* MSG_CHECKING: Printing Messages. +* MSG_ERROR: Printing Messages. +* MSG_RESULT: Printing Messages. +* MSG_WARN: Printing Messages. +* OBJEXT: System Services. +* OBSOLETE: Obsolete Macros. +* OFF_T: Old Macro Names. +* OUTPUT: Output. +* PATH_PROG: Generic Programs. +* PATH_PROGS: Generic Programs. +* PATH_X: System Services. +* PATH_XTRA: System Services. +* PID_T: Old Macro Names. +* PREFIX: Old Macro Names. +* PREFIX_PROGRAM: Default Prefix. +* PREREQ: Versions. +* PROG_AWK: Particular Programs. +* PROG_CC: Particular Programs. +* PROG_CC_C_O: Particular Programs. +* PROG_CPP: Particular Programs. +* PROG_CXX: Particular Programs. +* PROG_CXXCPP: Particular Programs. +* PROG_F77_C_O: Particular Programs. +* PROG_FORTRAN: Particular Programs. +* PROG_GCC_TRADITIONAL: Particular Programs. +* PROG_INSTALL: Particular Programs. +* PROG_LEX: Particular Programs. +* PROG_LN_S: Particular Programs. +* PROG_MAKE_SET: Output. +* PROG_RANLIB: Particular Programs. +* PROG_YACC: Particular Programs. +* PROGRAM_CHECK: Old Macro Names. +* PROGRAM_EGREP: Old Macro Names. +* PROGRAM_PATH: Old Macro Names. +* PROGRAMS_CHECK: Old Macro Names. +* PROGRAMS_PATH: Old Macro Names. +* PROVIDE: Prerequisite Macros. +* REMOTE_TAPE: Old Macro Names. +* REPLACE_FUNCS: Generic Functions. +* REQUIRE: Prerequisite Macros. +* REQUIRE_CPP: Language Choice. +* RESTARTABLE_SYSCALLS: Old Macro Names. +* RETSIGTYPE: Old Macro Names. +* REVISION: Versions. +* RSH: Old Macro Names. +* SCO_INTL: UNIX Variants. +* SEARCH_LIBS: Libraries. +* SET_MAKE: Old Macro Names. +* SETVBUF_REVERSED: Old Macro Names. +* SIZE_T: Old Macro Names. +* SIZEOF_TYPE: Old Macro Names. +* ST_BLKSIZE: Old Macro Names. +* ST_BLOCKS: Old Macro Names. +* ST_RDEV: Old Macro Names. +* STAT_MACROS_BROKEN <1>: Old Macro Names. +* STAT_MACROS_BROKEN: Structures. +* STDC_HEADERS: Old Macro Names. +* STRCOLL: Old Macro Names. +* STRUCT_ST_BLKSIZE: Structures. +* STRUCT_ST_BLOCKS: Structures. +* STRUCT_ST_RDEV: Structures. +* STRUCT_TIMEZONE: Structures. +* STRUCT_TM: Structures. +* SUBST: Setting Output Variables. +* SUBST_FILE: Setting Output Variables. +* SYS_INTERPRETER: System Services. +* SYS_LONG_FILE_NAMES: System Services. +* SYS_RESTARTABLE_SYSCALLS: System Services. +* SYS_SIGLIST_DECLARED: Old Macro Names. +* TEST_CPP: Old Macro Names. +* TEST_PROGRAM: Old Macro Names. +* TIME_WITH_SYS_TIME: Old Macro Names. +* TIMEZONE: Old Macro Names. +* TRY_COMPILE: Examining Syntax. +* TRY_CPP: Examining Declarations. +* TRY_LINK: Examining Libraries. +* TRY_LINK_FUNC: Examining Libraries. +* TRY_RUN: Test Programs. +* TYPE_GETGROUPS: Particular Typedefs. +* TYPE_MODE_T: Particular Typedefs. +* TYPE_OFF_T: Particular Typedefs. +* TYPE_PID_T: Particular Typedefs. +* TYPE_SIGNAL: Particular Typedefs. +* TYPE_SIZE_T: Particular Typedefs. +* TYPE_UID_T: Particular Typedefs. +* UID_T: Old Macro Names. +* UNISTD_H: Particular Headers. +* USG: Particular Headers. +* UTIME_NULL: Old Macro Names. +* VALIDATE_CACHED_SYSTEM_TUPLE: Canonicalizing. +* VERBOSE: Printing Messages. +* VFORK: Old Macro Names. +* VPRINTF: Old Macro Names. +* WAIT3: Old Macro Names. +* WARN: Old Macro Names. +* WITH: External Software. +* WORDS_BIGENDIAN: Old Macro Names. +* XENIX_DIR: UNIX Variants. +* YYTEXT_POINTER: Old Macro Names. + + + +Tag Table: +Node: Top1209 +Node: Introduction9711 +Node: Making configure Scripts13551 +Node: Writing configure.in16632 +Node: Invoking autoscan20365 +Node: Invoking ifnames22670 +Node: Invoking autoconf24160 +Node: Invoking autoreconf25998 +Node: Setup28834 +Node: Input29739 +Node: Output31476 +Node: Makefile Substitutions35113 +Node: Preset Output Variables36716 +Node: Build Directories41585 +Node: Automatic Remaking43218 +Node: Configuration Headers45304 +Node: Header Templates47818 +Node: Invoking autoheader49027 +Node: Subdirectories52175 +Node: Default Prefix53570 +Node: Versions54974 +Node: Existing Tests56878 +Node: Alternative Programs58426 +Node: Particular Programs59113 +Node: Generic Programs67165 +Node: Libraries70471 +Node: Library Functions73545 +Node: Particular Functions74103 +Node: Generic Functions81297 +Node: Header Files83401 +Node: Particular Headers83960 +Node: Generic Headers90952 +Node: Structures92254 +Node: Typedefs94491 +Node: Particular Typedefs94997 +Node: Generic Typedefs96214 +Node: C Compiler Characteristics96671 +Node: Fortran 77 Compiler Characteristics99542 +Node: System Services101245 +Node: UNIX Variants104381 +Node: Writing Tests106400 +Node: Examining Declarations108393 +Node: Examining Syntax110885 +Node: Examining Libraries112330 +Node: Run Time116040 +Node: Test Programs117028 +Node: Guidelines119356 +Node: Test Functions120545 +Node: Portable Shell122088 +Node: Testing Values and Files124020 +Node: Multiple Cases125675 +Node: Language Choice126873 +Node: Results128975 +Node: Defining Symbols129737 +Node: Setting Output Variables133033 +Node: Caching Results134879 +Node: Cache Variable Names137625 +Node: Cache Files139109 +Node: Printing Messages141946 +Node: Writing Macros145394 +Node: Macro Definitions146041 +Node: Macro Names147169 +Node: Quoting149620 +Node: Dependencies Between Macros151522 +Node: Prerequisite Macros152169 +Node: Suggested Ordering153660 +Node: Obsolete Macros155190 +Node: Manual Configuration156414 +Node: Specifying Names157313 +Node: Canonicalizing159214 +Node: System Type Variables160726 +Node: Using System Type161473 +Node: Site Configuration162967 +Node: External Software163740 +Node: Package Options166943 +Node: Site Details169690 +Node: Transforming Names170913 +Node: Transformation Options172091 +Node: Transformation Examples172584 +Node: Transformation Rules174152 +Node: Site Defaults175561 +Node: Invoking configure179467 +Node: Basic Installation180416 +Node: Compilers and Options182996 +Node: Multiple Architectures183645 +Node: Installation Names184631 +Node: Optional Features185815 +Node: System Type186585 +Node: Sharing Defaults187607 +Node: Operation Controls188231 +Node: Invoking config.status189217 +Node: Questions192605 +Node: Distributing193137 +Node: Why GNU m4194281 +Node: Bootstrapping195094 +Node: Why Not Imake195710 +Node: Upgrading200119 +Node: Changed File Names201640 +Node: Changed Makefiles202394 +Node: Changed Macros203490 +Node: Invoking autoupdate204737 +Node: Changed Results206328 +Node: Changed Macro Writing208430 +Node: History209693 +Node: Genesis210485 +Node: Exodus211674 +Node: Leviticus214723 +Node: Numbers216246 +Node: Deuteronomy218162 +Node: Old Macro Names220826 +Node: Environment Variable Index223875 +Node: Output Variable Index224889 +Node: Preprocessor Symbol Index230087 +Node: Macro Index235373 + +End Tag Table diff --git a/autoconf.m4 b/autoconf.m4 new file mode 100644 index 0000000..dde59ab --- /dev/null +++ b/autoconf.m4 @@ -0,0 +1,28 @@ +dnl Driver that loads the Autoconf macro files. +dnl Requires GNU m4. +dnl This file is part of Autoconf. +dnl Copyright (C) 1994 Free Software Foundation, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl Written by David MacKenzie. +dnl +include(acgeneral.m4)dnl +builtin(include, acspecific.m4)dnl +builtin(include, acoldnames.m4)dnl +dnl Do not sinclude acsite.m4 here, because it may not be installed +dnl yet when Autoconf is frozen. +dnl Do not sinclude ./aclocal.m4 here, to prevent it from being frozen. diff --git a/autoconf.sh b/autoconf.sh new file mode 100644 index 0000000..e6b0819 --- /dev/null +++ b/autoconf.sh @@ -0,0 +1,159 @@ +#! @SHELL@ +# autoconf -- create `configure' using m4 macros +# Copyright (C) 1992, 1993, 1994, 1996 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 given no args, create `configure' from template file `configure.in'. +# With one arg, create a configure script on standard output from +# the given template file. + +usage="\ +Usage: autoconf [-h] [--help] [-m dir] [--macrodir=dir] + [-l dir] [--localdir=dir] [--version] [template-file]" + +# 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 + +: ${AC_MACRODIR=@datadir@} +: ${M4=@M4@} +: ${AWK=@AWK@} +case "${M4}" in +/*) # Handle the case that m4 has moved since we were configured. + # It may have been found originally in a build directory. + test -f "${M4}" || M4=m4 ;; +esac + +: ${TMPDIR=/tmp} +tmpout=${TMPDIR}/acout.$$ +localdir= +show_version=no + +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) + echo "${usage}" 1>&2; exit 0 ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; + --macrodir=* | --m*=* ) + AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -m | --macrodir | --m* ) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + AC_MACRODIR="${1}" + shift ;; + --version | --v* ) + show_version=yes; shift ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "${usage}" 1>&2; exit 1 ;; + * ) + break ;; + esac +done + +if test $show_version = yes; then + version=`sed -n 's/define.AC_ACVERSION.[ ]*\([0-9.]*\).*/\1/p' \ + $AC_MACRODIR/acgeneral.m4` + echo "Autoconf version $version" + exit 0 +fi + +case $# in + 0) infile=configure.in ;; + 1) infile="$1" ;; + *) echo "$usage" >&2; exit 1 ;; +esac + +trap 'rm -f $tmpin $tmpout; exit 1' 1 2 15 + +tmpin=${TMPDIR}/acin.$$ # Always set this, to avoid bogus errors from some rm's. +if test z$infile = z-; then + infile=$tmpin + cat > $infile +elif test ! -r "$infile"; then + echo "autoconf: ${infile}: No such file or directory" >&2 + exit 1 +fi + +if test -n "$localdir"; then + use_localdir="-I$localdir -DAC_LOCALDIR=$localdir" +else + use_localdir= +fi + +# Use the frozen version of Autoconf if available. +r= f= +# 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*) test -r $AC_MACRODIR/autoconf.m4f && { r=--reload f=f; } ;; +*traditional*) ;; +*) echo Autoconf requires GNU m4 1.1 or later >&2; rm -f $tmpin; exit 1 ;; +esac + +$M4 -I$AC_MACRODIR $use_localdir $r autoconf.m4$f $infile > $tmpout || + { rm -f $tmpin $tmpout; exit 2; } + +# You could add your own prefixes to pattern if you wanted to check for +# them too, e.g. pattern='\(AC_\|ILT_\)', except that UNIX sed doesn't do +# alternation. +pattern="AC_" + +status=0 +if grep "^[^#]*${pattern}" $tmpout > /dev/null 2>&1; then + echo "autoconf: Undefined macros:" >&2 + sed -n "s/^[^#]*\\(${pattern}[_A-Za-z0-9]*\\).*/\\1/p" $tmpout | + while read macro; do + grep -n "^[^#]*$macro" $infile /dev/null + test $? -eq 1 && echo >&2 "***BUG in Autoconf--please report*** $macro" + done | sort -u >&2 + status=1 +fi + +if test $# -eq 0; then + exec 4> configure; chmod +x configure +else + exec 4>&1 +fi + +# Put the real line numbers into configure to make config.log more helpful. +$AWK ' +/__oline__/ { printf "%d:", NR + 1 } + { print } +' $tmpout | sed ' +/__oline__/s/^\([0-9][0-9]*\):\(.*\)__oline__/\2\1/ +' >&4 + +rm -f $tmpout + +exit $status diff --git a/autoconf.texi b/autoconf.texi new file mode 100644 index 0000000..22a2ccd --- /dev/null +++ b/autoconf.texi @@ -0,0 +1,5671 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename autoconf.info +@settitle Autoconf +@c For double-sided printing, uncomment: +@c @setchapternewpage odd +@c %**end of header + +@set EDITION 2.13 +@set VERSION 2.13 +@set UPDATED December 1998 + +@iftex +@finalout +@end iftex + +@ifinfo +@format +START-INFO-DIR-ENTRY +* Autoconf: (autoconf). Create source code configuration scripts. +END-INFO-DIR-ENTRY +@end format + +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 (C) 1992, 1993, 1994, 1995, 1996, 1998 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 by 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, 93, 94, 95, 96, 98 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 a macro index that @@defmac doesn't write to. +@defcodeindex ma + +@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 an @code{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. +* 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. +* Writing Macros:: Adding new macros to Autoconf. +* Manual Configuration:: Selecting features that can't be guessed. +* Site Configuration:: Local defaults for @code{configure}. +* Invoking configure:: How to use the Autoconf output. +* Invoking config.status:: Recreating a configuration. +* Questions:: Questions about Autoconf, with answers. +* Upgrading:: Tips for upgrading from version 1. +* History:: History of Autoconf. +* Old Macro Names:: Backward compatibility macros. +* 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. +* Macro Index:: Index of Autoconf macros. + +@detailmenu + --- The Detailed Node Listing --- + +Making @code{configure} Scripts + +* Writing configure.in:: What to put in an Autoconf input file. +* Invoking autoscan:: Semi-automatic @file{configure.in} writing. +* Invoking ifnames:: Listing the conditionals in source code. +* Invoking autoconf:: How to create configuration scripts. +* Invoking autoreconf:: Remaking multiple @code{configure} scripts. + +Initialization and Output Files + +* Input:: Where Autoconf should find files. +* Output:: Creating output files. +* Makefile Substitutions:: Using output variables in @file{Makefile}s. +* Configuration Headers:: Creating a configuration header file. +* Subdirectories:: Configuring independent packages together. +* Default Prefix:: Changing the default installation prefix. +* Versions:: Version numbers in @code{configure}. + +Substitutions in Makefiles + +* Preset Output Variables:: Output variables that are always set. +* Build Directories:: Supporting multiple concurrent compiles. +* Automatic Remaking:: Makefile rules for configuring. + +Configuration Header Files + +* Header Templates:: Input for the configuration headers. +* Invoking autoheader:: How to create configuration templates. + +Existing Tests + +* Alternative Programs:: Selecting between alternative programs. +* Libraries:: Library archives that might be missing. +* Library Functions:: C library functions that might be missing. +* Header Files:: Header files that might be missing. +* Structures:: Structures or members that might be missing. +* Typedefs:: @code{typedef}s that might be missing. +* C Compiler Characteristics:: +* Fortran 77 Compiler Characteristics:: +* System Services:: Operating system services. +* UNIX Variants:: Special kludges for specific UNIX variants. + +Alternative Programs + +* Particular Programs:: Special handling to find certain programs. +* Generic Programs:: How to find other programs. + +Library 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. + +Typedefs + +* Particular Typedefs:: Special handling to find certain types. +* Generic Typedefs:: How to find other types. + +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. +* Portable Shell:: Shell script portability pitfalls. +* Testing Values and Files:: Checking strings and files. +* 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 users of progress or problems. + +Caching Results + +* Cache Variable Names:: Shell variables used in caches. +* Cache Files:: Files @code{configure} uses for caching. + +Writing Macros + +* Macro Definitions:: Basic format of an Autoconf macro. +* Macro Names:: What to call your new macros. +* Quoting:: Protecting macros from unwanted expansion. +* Dependencies Between Macros:: What to do when macros depend on other macros. + +Dependencies Between Macros + +* Prerequisite Macros:: Ensuring required information. +* Suggested Ordering:: Warning about possible ordering problems. +* Obsolete Macros:: Warning about old ways of doing things. + +Manual Configuration + +* Specifying Names:: Specifying the system type. +* Canonicalizing:: Getting the canonical system type. +* System Type Variables:: Variables containing the 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. +* 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}. +* Operation Controls:: Changing how @code{configure} runs. + +Questions About Autoconf + +* Distributing:: Distributing @code{configure} scripts. +* Why GNU m4:: Why not use the standard @code{m4}? +* Bootstrapping:: Autoconf and GNU @code{m4} require each other? +* Why Not Imake:: Why GNU uses @code{configure} instead of Imake. + +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. +* Invoking autoupdate:: Replacing old macro names in @code{configure.in}. +* Changed Results:: Changes in how to check test results. +* Changed Macro Writing:: Better ways to write your own macros. + +History of Autoconf + +* Genesis:: Prehistory and naming of @code{configure}. +* Exodus:: The plagues of @code{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 + +@node Introduction, Making configure Scripts, Top, Top +@chapter Introduction + +@display +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 electro-magnetic +waves, the relativist 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 display +@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 +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 test for the presence of each +feature that the software package they are for might need individually. +(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. + +There are several jobs related to making portable software packages +that Autoconf currently does not do. Among these are automatically +creating @file{Makefile} files with all of the standard targets, and +supplying replacements for standard library functions and header files on +systems that lack them. Work is in progress to add those features in +the future. + +Autoconf imposes some restrictions on the names of macros used with +@code{#ifdef} in C programs (@pxref{Preprocessor Symbol Index}). + +Autoconf requires GNU @code{m4} in order to generate the scripts. It +uses features that some UNIX versions of @code{m4} do not have. It also +overflows internal limits of some versions of @code{m4}, including GNU +@code{m4} 1.0. You must use version 1.1 or later of GNU @code{m4}. +Using version 1.3 or later will be much faster than 1.1 or 1.2. + +@xref{Upgrading}, 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. + +Mail suggestions and bug reports for Autoconf to +@code{bug-gnu-utils@@prep.ai.mit.edu}. Please include the Autoconf version +number, which you can get by running @samp{autoconf --version}. + +@node Making configure Scripts, Setup, Introduction, Top +@chapter Making @code{configure} Scripts + +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 @bullet +@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{Invoking config.status}); + +@item +a shell script called @file{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 + +To create a @code{configure} script with Autoconf, you need to write an +Autoconf input file @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 write @file{acconfig.h}, and you will +distribute the Autoconf-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 +@group +your source files --> [autoscan*] --> [configure.scan] --> configure.in + +configure.in --. .------> autoconf* -----> configure + +---+ +[aclocal.m4] --+ `---. +[acsite.m4] ---' | + +--> [autoheader*] -> [config.h.in] +[acconfig.h] ----. | + +-----' +[config.h.top] --+ +[config.h.bot] --' + +Makefile.in -------------------------------> Makefile.in +@end group +@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.in:: What to put in an Autoconf input file. +* Invoking autoscan:: Semi-automatic @file{configure.in} writing. +* Invoking ifnames:: Listing the conditionals in source code. +* Invoking autoconf:: How to create configuration scripts. +* Invoking autoreconf:: Remaking multiple @code{configure} scripts. +@end menu + +@node Writing configure.in, Invoking autoscan, Making configure Scripts, Making configure Scripts +@section Writing @file{configure.in} + +To produce a @code{configure} script for a software package, create a +file called @file{configure.in} 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.in} might need to +contain some hand-crafted shell commands. The @code{autoscan} +program can give you a good start in writing @file{configure.in} +(@pxref{Invoking autoscan}, for more information). + +The order in which @file{configure.in} calls the Autoconf macros +is not important, with a few exceptions. Every +@file{configure.in} 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 creating @code{configure} 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 could depend on things earlier in it. For example, library +functions could be affected by typedefs and libraries. + +@display +@group +@code{AC_INIT(@var{file})} +checks for programs +checks for libraries +checks for header files +checks for typedefs +checks for structures +checks for compiler characteristics +checks for library functions +checks for system services +@code{AC_OUTPUT(@r{[}@var{file@dots{}}@r{]})} +@end group +@end display + +It is best to put each macro call on its own line in +@file{configure.in}. 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. + +When calling macros that take arguments, there must not be any blank +space between the macro name and the open parenthesis. Arguments can be +more than one line long if they are enclosed within the @code{m4} quote +characters @samp{[} and @samp{]}. If you have a long line such as a +list of file names, you can generally use a backslash at the end of a +line to continue it logically on the next line (this is implemented by +the shell, not by anything special that Autoconf does). + +Some macros handle two cases: what to do if the given condition is met, +and what to do if the condition is not met. In some places you might +want to do something if a condition is true but do nothing if it's +false, or vice versa. To omit the true case, pass an empty value for +the @var{action-if-found} argument to the macro. To omit the false +case, omit the @var{action-if-not-found} argument to the macro, +including the comma before it. + +You can include comments in @file{configure.in} files by starting them +with the @code{m4} builtin macro @code{dnl}, which discards text up +through the next newline. These comments do not appear in the generated +@code{configure} scripts. For example, it is helpful to begin +@file{configure.in} files with a line like this: + +@example +dnl Process this file with autoconf to produce a configure script. +@end example + +@node Invoking autoscan, Invoking ifnames, Writing configure.in, Making configure Scripts +@section Using @code{autoscan} to Create @file{configure.in} + +The @code{autoscan} program can help you create a @file{configure.in} +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.in} for +that package. + +You should manually examine @file{configure.scan} before renaming it to +@file{configure.in}; 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_HEADER} (@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{Invoking ifnames}, for +information about a program that can help with that job). + +@code{autoscan} uses several data files, which are installed along with the +distributed Autoconf macro files, to determine which macros to output +when it finds particular symbols in a package's source files. These +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 @code +@item --help +Print a summary of the command line options and exit. + +@item --macrodir=@var{dir} +@evindex AC_MACRODIR +Look for the data files in directory @var{dir} instead of the default +installation directory. You can also set the @code{AC_MACRODIR} +environment variable to a directory; this option overrides the +environment variable. + +@item --verbose +Print the names of the files it examines and the potentially interesting +symbols it finds in them. This output can be voluminous. + +@item --version +Print the version number of Autoconf and exit. +@end table + +@node Invoking ifnames, Invoking autoconf, Invoking autoscan, Making configure Scripts +@section Using @code{ifnames} to List Conditionals + +@code{ifnames} can help when writing a @file{configure.in} 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, this program can help you figure out what +its @code{configure} needs to check for. It may help fill in some gaps +in a @file{configure.in} generated by @code{autoscan} (@pxref{Invoking +autoscan}). + +@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 @code +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@item --macrodir=@var{dir} +@itemx -m @var{dir} +@evindex AC_MACRODIR +Look for the Autoconf macro files in directory @var{dir} instead of the +default installation directory. Only used to get the version number. +You can also set the @code{AC_MACRODIR} +environment variable to a directory; this option overrides the +environment variable. + +@item --version +Print the version number of Autoconf and exit. +@end table + +@node Invoking autoconf, Invoking autoreconf, Invoking ifnames, Making configure Scripts +@section Using @code{autoconf} to Create @code{configure} + +To create @code{configure} from @file{configure.in}, run the +@code{autoconf} program with no arguments. @code{autoconf} processes +@file{configure.in} 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.in} and writes the configuration script +to the standard output instead of to @code{configure}. If you give +@code{autoconf} the argument @samp{-}, it reads the standard input +instead of @file{configure.in} and writes the configuration script on +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 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 @code +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@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 --macrodir=@var{dir} +@itemx -m @var{dir} +@evindex AC_MACRODIR +Look for the installed macro files in directory @var{dir}. You can also +set the @code{AC_MACRODIR} environment variable to a directory; this +option overrides the environment variable. + +@item --version +Print the version number of Autoconf and exit. +@end table + +@node Invoking autoreconf, , Invoking autoconf, Making configure Scripts +@section Using @code{autoreconf} to Update @code{configure} Scripts + +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.in} 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 +@samp{--force} option. + +If you give @code{autoreconf} the @samp{--macrodir=@var{dir}} or +@samp{--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 @samp{--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 @samp{--macrodir=@var{dir}} or +@samp{--localdir=@var{dir}}. + +@noindent +@code{autoreconf} accepts the following options: + +@table @code +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@item --force +@itemx -f +Remake even @file{configure} scripts and configuration headers that are +newer than their input files (@file{configure.in} and, if present, +@file{aclocal.m4}). + +@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.in}. + +@item --macrodir=@var{dir} +@itemx -m @var{dir} +@evindex AC_MACRODIR +Look for the Autoconf macro files in directory @var{dir} instead of the +default installation directory. +You can also set the @code{AC_MACRODIR} +environment variable to a directory; this option overrides the +environment variable. + +@item --verbose +Print the name of each directory where @code{autoreconf} runs +@code{autoconf} (and @code{autoheader}, if appropriate). + +@item --version +Print the version number of Autoconf and exit. +@end table + +@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 creating output files. + +@menu +* Input:: Where Autoconf should find files. +* Output:: Creating output files. +* Makefile Substitutions:: Using output variables in @file{Makefile}s. +* Configuration Headers:: Creating a configuration header file. +* Subdirectories:: Configuring independent packages together. +* Default Prefix:: Changing the default installation prefix. +* Versions:: Version numbers in @code{configure}. +@end menu + +@node Input, Output, Setup, 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{unique-file-in-source-dir}) +@maindex INIT +Process any command-line arguments and find the source code directory. +@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 @samp{--srcdir}; this is a safety check. @xref{Invoking configure}, +for more information. +@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 @file{install-sh}, @file{config.sub}, @file{config.guess}, and +Cygnus @code{configure} scripts 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 @code{make} programs have a rule that +creates @file{install} from it if there is no @file{Makefile}. +@end defmac + +@node Output, Makefile Substitutions, Input, Setup +@section Creating Output Files + +Every Autoconf-generated @code{configure} script must finish by calling +@code{AC_OUTPUT}. It is the macro that creates the @file{Makefile}s and +optional other files resulting from configuration. The only other +required macro is @code{AC_INIT} (@pxref{Input}). + +@defmac AC_OUTPUT (@r{[}@var{file}@dots{} @r{[}, @var{extra-cmds} @r{[}, @var{init-cmds}@r{]]]}) +@maindex OUTPUT +Create output files. Call this macro once, at the end of @file{configure.in}. +The @var{file}@dots{} argument is a +whitespace-separated list of output files; it may be empty. This macro +creates each file @file{@var{file}} by copying an input file (by default +named @file{@var{file}.in}), substituting the output variable values. +@c If the file would be unchanged, it is left untouched, to preserve its timestamp. +@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 (but +not the parents of that directory). Usually, @file{Makefile}s are +created this way, but other files, such as @file{.gdbinit}, can be +specified as well. + +If @code{AC_CONFIG_HEADER}, @code{AC_LINK_FILES}, or +@code{AC_CONFIG_SUBDIRS} has been called, this macro also creates the +files named as their arguments. + +A typical call to @code{AC_OUTPUT} looks like this: +@example +AC_OUTPUT(Makefile src/Makefile man/Makefile X/Imakefile) +@end example + +You can override an input file name by appending to @var{file} a +colon-separated list of input files. Examples: +@example +AC_OUTPUT(Makefile:templates/top.mk lib/Makefile:templates/lib.mk) +AC_OUTPUT(Makefile:templates/vars.mk:Makefile.in:templates/rules.mk) +@end example +Doing this allows you to keep your file names acceptable to MS-DOS, or +to prepend and/or append boilerplate to the file. + +If you pass @var{extra-cmds}, those commands will be inserted into +@file{config.status} to be run after all its other processing. If +@var{init-cmds} are given, they are inserted just before +@var{extra-cmds}, with shell variable, command, and backslash +substitutions performed on them in @code{configure}. You can use +@var{init-cmds} to pass variables from @code{configure} to the +@var{extra-cmds}. If @code{AC_OUTPUT_COMMANDS} has been called, the +commands given to it are run just before the commands passed to this macro. +@end defmac + +@defmac AC_OUTPUT_COMMANDS (@var{extra-cmds} @r{[}, @var{init-cmds}@r{]}) +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. +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 +@end defmac + +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 Makefile Substitutions, Configuration Headers, Output, 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. +* Build Directories:: Supporting multiple concurrent compiles. +* Automatic Remaking:: Makefile rules for configuring. +@end menu + +@node Preset Output Variables, Build Directories, 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. Here is what each of the preset ones +contains. @xref{Directory Variables, , Variables for Installation Directories, +standards, The GNU Coding Standards}, for more information about +the variables with names that end in @samp{dir}. + +@defvar bindir +@ovindex bindir +The directory for installing executables that users run. +@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 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. +@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 installation prefix 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 srcdir +@ovindex srcdir +The directory that contains the source code for that @file{Makefile}. +@end defvar + +@defvar sysconfdir +@ovindex sysconfdir +The directory for installing read-only single-machine data. +@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 + +@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 CPPFLAGS +@ovindex CPPFLAGS +Header file search directory (@samp{-I@var{dir}}) and any other +miscellaneous options for the C preprocessor and compiler. 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 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 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 DEFS +@ovindex DEFS +@samp{-D} options to pass to the C compiler. If @code{AC_CONFIG_HEADER} +is called, @code{configure} replaces @samp{@@DEFS@@} with +@samp{-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 LDFLAGS +@ovindex LDFLAGS +Stripping (@samp{-s}) and any other miscellaneous options for the +linker. 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 features. +@end defvar + +@defvar LIBS +@ovindex LIBS +@samp{-l} and @samp{-L} options to pass to the linker. +@end defvar + +@node Build Directories, Automatic Remaking, Preset Output 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. 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 +pathname 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 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 @code{make} will consider @file{config.h.in} +up to date. On some old BSD systems, @code{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. +@c Using @code{date} would cause needless CVS conflicts. + +@example +@group +$@{srcdir@}/configure: configure.in 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.in aclocal.m4 acconfig.h \ + config.h.top config.h.bot + 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 + +In addition, you should pass @samp{echo timestamp > stamp-h} in the +@var{extra-cmds} argument to @code{AC_OUTPUT}, 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{Invoking config.status}, for more examples of handling +configuration-related dependencies. + +@node Configuration Headers, Subdirectories, Makefile Substitutions, Setup +@section Configuration Header Files + +When a package tests more than a few C preprocessor symbols, the command +lines to pass @samp{-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 @samp{-D} options to the compiler, @code{configure} scripts can +create a C header file containing @samp{#define} directives. The +@code{AC_CONFIG_HEADER} 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 } +instead of @samp{#include "config.h"}, and pass the C compiler a +@samp{-I.} option (or @samp{-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_HEADER (@var{header-to-create} @dots{}) +@maindex CONFIG_HEADER +@cvindex HAVE_CONFIG_H +Make @code{AC_OUTPUT} create the file(s) in the whitespace-separated +list @var{header-to-create} containing C preprocessor @code{#define} +statements, and replace @samp{@@DEFS@@} in generated files with +@samp{-DHAVE_CONFIG_H} instead of the value of @code{DEFS}. The usual +name for @var{header-to-create} is @file{config.h}. + +If @var{header-to-create} 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-to-create}.in}; +however, you can override the input file name by appending to +@var{header-to-create}, a colon-separated list of input files. +Examples: +@example +AC_CONFIG_HEADER(defines.h:defines.hin) +AC_CONFIG_HEADER(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 + +@menu +* Header Templates:: Input for the configuration headers. +* Invoking autoheader:: How to create configuration templates. +@end menu + +@node Header Templates, Invoking autoheader, Configuration Headers, Configuration Headers +@subsection Configuration Header Templates + +Your distribution should contain a template file that looks as you want +the final header file to look, including comments, with default values +in the @code{#define} statements. For example, suppose your +@file{configure.in} makes these calls: + +@example +AC_CONFIG_HEADER(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 change the 0 +to a 1. On other systems, it will leave the line unchanged. + +@example +@group +/* Define as 1 if you have unistd.h. */ +#define HAVE_UNISTD_H 0 +@end group +@end example + +Alternately, if your code tests for configuration options using +@code{#ifdef} instead of @code{#if}, a default value can be to +@code{#undef} the variable instead of to define it to a value. On +systems that have @file{unistd.h}, @code{configure} will change the +second line to read @samp{#define HAVE_UNISTD_H 1}. On other systems, +it will comment that line out (in case the system predefines that +symbol). + +@example +@group +/* Define if you have unistd.h. */ +#undef HAVE_UNISTD_H +@end group +@end example + +@node Invoking autoheader, , Header Templates, Configuration Headers +@subsection Using @code{autoheader} to Create @file{config.h.in} + +The @code{autoheader} program can create a template file of C +@samp{#define} statements for @code{configure} to use. If +@file{configure.in} invokes @code{AC_CONFIG_HEADER(@var{file})}, +@code{autoheader} creates @file{@var{file}.in}; if multiple file +arguments are given, the first one is used. Otherwise, +@code{autoheader} creates @file{config.h.in}. + +If you give @code{autoheader} an argument, it uses that file instead of +@file{configure.in} and writes the header file to the standard output +instead of to @file{config.h.in}. If you give @code{autoheader} an +argument of @samp{-}, it reads the standard input instead of +@file{configure.in} and writes the header file to the standard output. + +@code{autoheader} scans @file{configure.in} and figures out which C +preprocessor symbols it might define. It copies comments and +@code{#define} and @code{#undef} statements from a file called +@file{acconfig.h}, which comes with and is installed with Autoconf. It +also uses a file called @file{acconfig.h} in the current directory, if +present. If you @code{AC_DEFINE} any additional symbols, you must +create that file with entries for them. For symbols defined by +@code{AC_CHECK_HEADERS}, @code{AC_CHECK_FUNCS}, @code{AC_CHECK_SIZEOF}, +or @code{AC_CHECK_LIB}, @code{autoheader} generates comments and +@code{#undef} statements itself rather than copying them from a file, +since the possible symbols are effectively limitless. + +The file that @code{autoheader} creates contains mainly @code{#define} +and @code{#undef} statements and their accompanying comments. 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 alternate way to produce the same effect 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. Their use is discouraged because they have file names that +contain two periods, and so can not be stored on MS-DOS; also, they are +two more files to clutter up the directory. But if you use the +@samp{--localdir=@var{dir}} option to use an @file{acconfig.h} in another +directory, they give you a way to put custom boilerplate in each +individual @file{config.h.in}. + +@code{autoheader} accepts the following options: + +@table @code +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@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 --macrodir=@var{dir} +@itemx -m @var{dir} +@evindex AC_MACRODIR +Look for the installed macro files and @file{acconfig.h} in directory +@var{dir}. You can also set the @code{AC_MACRODIR} environment variable +to a directory; this option overrides the environment variable. + +@item --version +Print the version number of Autoconf and exit. +@end table + +@node Subdirectories, Default Prefix, Configuration Headers, 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. 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 @file{configure.in} but no @code{configure}, +the Cygnus @code{configure} script found by @code{AC_CONFIG_AUXDIR} 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, Versions, 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 @samp{--prefix} and @samp{--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}) +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 +@samp{--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 + +@node Versions, , Default Prefix, Setup +@section Version Numbers in @code{configure} + +The following macros manage version numbers for @code{configure} +scripts. Using them is optional. + +@defmac AC_PREREQ (@var{version}) +@maindex PREREQ +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 on the standard error output +and do not create @code{configure}. For example: + +@example +AC_PREREQ(1.8) +@end example + +This macro is useful if your @file{configure.in} relies on non-obvious +behavior that changed between Autoconf releases. If it merely needs +recently added macros, then @code{AC_PREREQ} is less useful, because the +@code{autoconf} program already tells the user which macros are not +found. The same thing happens if @file{configure.in} is processed by a +version of Autoconf older than when @code{AC_PREREQ} was added. +@end defmac + +@defmac AC_REVISION (@var{revision-info}) +@maindex 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.in} into @code{configure} +without RCS or CVS changing it when you check in @code{configure}. That +way, you can determine easily which revision of @file{configure.in} a +particular @code{configure} corresponds to. + +It is a good idea to call this macro before @code{AC_INIT} so that the +revision number is near the top of both @file{configure.in} and +@code{configure}. To support doing that, the @code{AC_REVISION} output +begins with @samp{#! /bin/sh}, like the normal start of a +@code{configure} script does. + +For example, this line in @file{configure.in}: + +@c The asis prevents RCS from changing the example in the manual. +@example +AC_REVISION($@asis{Revision: 1.30 }$)dnl +@end example + +@noindent +produces this in @code{configure}: + +@example +#! /bin/sh +# From configure.in Revision: 1.30 +@end example +@end defmac + +@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 +* Alternative Programs:: Selecting between alternative programs. +* Libraries:: Library archives that might be missing. +* Library Functions:: C library functions that might be missing. +* Header Files:: Header files that might be missing. +* Structures:: Structures or members that might be missing. +* Typedefs:: @code{typedef}s that might be missing. +* C Compiler Characteristics:: +* Fortran 77 Compiler Characteristics:: +* System Services:: Operating system services. +* UNIX Variants:: Special kludges for specific UNIX variants. +@end menu + +@node Alternative Programs, Libraries, Existing Tests, Existing Tests +@section 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. +@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_DECL_YYTEXT +@maindex DECL_YYTEXT +@cvindex YYTEXT_POINTER +@ovindex LEX_OUTPUT_ROOT +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. +@end defmac + +@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 it +finds. It tries @code{mawk} first because that is reported to be the +fastest implementation. +@end defmac + +@defmac AC_PROG_CC +@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 use @code{cc} if that's not found. +Set output variable @code{CC} to the name of the compiler found. + +If using the GNU C compiler, set shell variable @code{GCC} to +@samp{yes}, empty otherwise. If output variable @code{CFLAGS} was +not already set, set it to @samp{-g -O2} for the GNU C compiler +(@samp{-O2} on systems where GCC does not accept @samp{-g}), or @samp{-g} +for other compilers. + +If the C compiler being used does not produce executables that can run +on the system where @code{configure} is being run, set the shell +variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}. +In other words, this tests whether the build system type is different +from the host system type (the target system type is irrelevant to this +test). @xref{Manual Configuration}, for more on support for cross compiling. +@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 @samp{-c} and @samp{-o} options +simultaneously, define @code{NO_MINUS_C_MINUS_O}. +@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, it uses @file{/lib/cpp}. +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}. +@end defmac + +@defmac AC_PROG_CXX +@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, set output +variable @code{CXX} to its value. Otherwise search for a C++ compiler +under likely names (@code{c++}, @code{g++}, @code{gcc}, @code{CC}, +@code{cxx}, and @code{cc++}). If none of those checks succeed, as a +last resort set @code{CXX} to @code{gcc}. + +If using the GNU C++ compiler, set shell variable @code{GXX} to +@samp{yes}, empty otherwise. If output variable @code{CXXFLAGS} was +not already set, set it to @samp{-g -O2} for the GNU C++ compiler +(@samp{-O2} on systems where G++ does not accept @samp{-g}), or @samp{-g} +for other compilers. + +If the C++ compiler being used does not produce executables that can run +on the system where @code{configure} is being run, set the shell +variable @code{cross_compiling} to @samp{yes}, otherwise @samp{no}. +In other words, this tests whether the build system type is different +from the host system type (the target system type is irrelevant to this +test). @xref{Manual Configuration}, for more on support for cross compiling. +@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, it uses @file{/lib/cpp}. +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}. +@end defmac + +@defmac AC_PROG_F77 +@maindex PROG_FORTRAN +@ovindex F77 +@ovindex FFLAGS +Determine a Fortran 77 compiler to use. If @code{F77} is not already +set in the environment, check for @code{g77}, @code{f77} and @code{f2c}, +in that order. Set the output variable @code{F77} to the name of the +compiler found. + +If using @code{g77} (the GNU Fortran 77 compiler), then +@code{AC_PROG_F77} will set the shell variable @code{G77} to @samp{yes}, +and empty otherwise. If the output variable @code{FFLAGS} was not +already set in the environment, then set it to @samp{-g -02} for +@code{g77} (or @samp{-O2} where @code{g77} does not accept @samp{-g}). +Otherwise, set @code{FFLAGS} to @samp{-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 @samp{-c} and +@samp{-o} simultaneously, and define @code{F77_NO_MINUS_C_MINUS_O} if it +does not. +@end defmac + +@defmac AC_PROG_GCC_TRADITIONAL +@maindex PROG_GCC_TRADITIONAL +@ovindex CC +Add @samp{-traditional} to output variable @code{CC} if using the +GNU C compiler and @code{ioctl} does not work properly without +@samp{-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. +@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 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 to not +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}. + +A copy of @file{install-sh} which you may use comes with Autoconf. 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 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 pathname of your +program into your @file{Makefile.in} files. +@end defmac + +@defmac AC_PROG_LEX +@maindex PROG_LEX +@ovindex LEX +@ovindex LEXLIB +If @code{flex} is found, set output variable @code{LEX} to +@samp{flex} and @code{LEXLIB} to @samp{-lfl}, if that library is in a +standard place. Otherwise set @code{LEX} to @samp{lex} and +@code{LEXLIB} to @samp{-ll}. +@end defmac + +@defmac AC_PROG_LN_S +@maindex PROG_LN_S +@ovindex LN_S +If @samp{ln -s} works on the current filesystem (the operating system +and filesystem support symbolic links), set output +variable @code{LN_S} to @samp{ln -s}, otherwise set it to @samp{ln}. + +If the link is put in 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, otherwise to @samp{:} (do nothing). +@end defmac + +@defmac AC_PROG_YACC +@maindex PROG_YACC +@ovindex YACC +If @code{bison} is found, set output variable @code{YACC} to +@samp{bison -y}. Otherwise, if @code{byacc} is found, set @code{YACC} +to @samp{byacc}. Otherwise 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 + +@defmac AC_CHECK_FILE (@var{file} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@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}@r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@maindex CHECK_FILES +Executes @code{AC_CHECK_FILE} once for each file listed in @var{files}. +Additionally, defines @samp{HAVE@var{file}} for each file found, set to 1. +@end defmac + +@defmac AC_CHECK_PROG (@var{variable}, @var{prog-to-check-for}, @var{value-if-found} @r{[}, @var{value-if-not-found} @r{[}, @var{path}, @r{[} @var{reject} @r{]]]}) +@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} @r{[}, @var{value-if-not-found} @r{[}, @var{path}@r{]]}) +@maindex CHECK_PROGS +Check for each program in the whitespace-separated list +@var{progs-to-check-for} exists in @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} @r{[}, @var{value-if-not-found} @r{[}, @var{path}@r{]]}) +@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 to @samp{ranlib} if that program exists in @code{PATH}, +or to @samp{:} if neither program exists. +@end defmac + +@defmac AC_PATH_PROG (@var{variable}, @var{prog-to-check-for} @r{[}, @var{value-if-not-found} @r{[}, @var{path}@r{]]}) +@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} @r{[}, @var{value-if-not-found} @r{[}, @var{path}@r{]]}) +@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 + +@node Libraries, Library Functions, Alternative Programs, Existing Tests +@section Library Files + +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} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]}) +@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 @samp{-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 add @samp{-l@var{library}} to +@code{LIBS} and define @samp{HAVE_LIB@var{library}} (in all capitals). + +If linking with @var{library} results in unresolved symbols, which would +be resolved by linking with additional libraries, give those libraries +as the @var{other-libraries} argument, separated by spaces: @samp{-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. +@end defmac + +@defmac AC_HAVE_LIBRARY (@var{library}, @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]}) +@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}, @samp{-lfoo}, or @samp{libfoo.a}. In +all of those cases, the compiler is passed @samp{-lfoo}. However, +@var{library} can not be a shell variable; it must be a literal name. +This macro is considered obsolete. +@end defmac + +@defmac AC_SEARCH_LIBS (@var{function}, @var{search-libs} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found} @r{[}, @var{other-libraries}@r{]]]}) +@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}. + +If the function is found, run @var{action-if-found}, otherwise run +@var{action-if-not-found}. + +If linking with @var{library} results in unresolved symbols, which would +be resolved by linking with additional libraries, give those libraries +as the @var{other-libraries} argument, separated by spaces: @samp{-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 + +@defmac AC_SEARCH_LIBS (@var{function}, @var{search-libs}@r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@maindex SEARCH_LIBS +This macro is equivalent to calling @code{AC_TRY_LINK_FUNC} once for each +library listed in @var{search-libs}. Add @samp{-l@var{library}} to +@code{LIBS} for the first library found to contain @var{function}, and +execute @var{action-if-found}. Otherwise execute +@var{action-if-not-found}. +@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 +* Particular Functions:: Special handling to find certain functions. +* Generic Functions:: How to find other functions. +@end menu + +@node Particular Functions, Generic Functions, Library Functions, Library Functions +@subsection Particular Function Checks + +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-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 +# 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_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_FNMATCH +@maindex FUNC_FNMATCH +@ovindex LIBOBJS +If the @code{fnmatch} function is available and works (unlike the one on +SunOS 5.4), define @code{HAVE_FNMATCH}. +@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 +@ovindex LIBOBJS +@ovindex NEED_SETGID +@ovindex KMEM_GROUP +Check how to get the system load averages. If the system has the +@code{getloadavg} function, this macro defines @code{HAVE_GETLOADAVG}, +and adds to @code{LIBS} any libraries needed to get that function. + +Otherwise, it adds @samp{getloadavg.o} to the output variable +@code{LIBOBJS}, and possibly defines several other C preprocessor +macros and output variables: + +@enumerate +@item +It defines @code{SVR4}, @code{DGUX}, @code{UMAX}, or @code{UMAX4_3} if +on those systems. + +@item +If it finds @file{nlist.h}, it defines @code{NLIST_STRUCT}. + +@item +If @samp{struct nlist} has an @samp{n_un} member, it defines +@code{NLIST_NAME_UNION}. + +@item +If compiling @file{getloadavg.c} defines @code{LDAV_PRIVILEGED}, +programs need to be installed specially on this system for +@code{getloadavg} to work, and this macro defines +@code{GETLOADAVG_PRIVILEGED}. + +@item +This macro sets the output variable @code{NEED_SETGID}. The value is +@samp{true} if special installation is required, @samp{false} if not. +If @code{NEED_SETGID} is @samp{true}, this macro sets @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 POSIX.1 version), define +@code{GETPGRP_VOID}. Otherwise, it is the 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_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), add @samp{memcmp.o} to output +variable @code{LIBOBJS}. +@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_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 to 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 POSIX.1 version), define +@code{SETPGRP_VOID}. Otherwise, it is the BSD version, which takes two +process ID 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_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}. This is the case on System V before release 3. +@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}, which should not be used. +@end defmac + +@defmac AC_FUNC_STRFTIME +@maindex FUNC_STRFTIME +@cvindex HAVE_STRFTIME +Check for @code{strftime} in the @file{intl} library, for SCO 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_VFORK +@maindex FUNC_VFORK +@cvindex HAVE_VFORK_H +@cvindex vfork +If @file{vfork.h} is found, define @code{HAVE_VFORK_H}. If a working +@code{vfork} is not found, define @code{vfork} to be @code{fork}. 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. +@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 + +@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}. +@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}, @r{[}@var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@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_CPLUSPLUS} has been called, since C++ is +more standardized than C is. (@pxref{Language Choice}, for more +information about selecting the language for checks.) +@end defmac + +@defmac AC_CHECK_FUNCS (@var{function}@dots{} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@maindex CHECK_FUNCS +@cvindex HAVE_@var{function} +For each given @var{function} in the whitespace-separated argument list +that is available, define @code{HAVE_@var{function}} (in all capitals). 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 + +@defmac AC_REPLACE_FUNCS (@var{function}@dots{}) +@maindex REPLACE_FUNCS +@ovindex LIBOBJS +Like calling @code{AC_CHECK_FUNCS} using an @var{action-if-not-found} +that adds @samp{@var{function}.o} to the value of the output variable +@code{LIBOBJS}. You can declare a function for which your replacement +version is used by enclosing the prototype in @samp{#ifndef +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, Structures, Library Functions, Existing Tests +@section 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. +@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_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 + +@defmac AC_DIR_HEADER +@maindex DIR_HEADER +@cvindex DIRENT +@cvindex SYSDIR +@cvindex SYSNDIR +@cvindex NDIR +@cvindex VOID_CLOSEDIR +Like calling @code{AC_HEADER_DIRENT} and @code{AC_FUNC_CLOSEDIR_VOID}, +but defines a different set of C preprocessor macros to indicate which +header file is found. This macro and the names it defines are +considered obsolete. The names it defines are: + +@c The printed table looks too spaced out with blank lines between the entries. +@table @file +@item dirent.h +@code{DIRENT} +@item sys/ndir.h +@code{SYSNDIR} +@item sys/dir.h +@code{SYSDIR} +@item ndir.h +@code{NDIR} +@end table + +In addition, if the @code{closedir} function does not return a +meaningful value, define @code{VOID_CLOSEDIR}. +@end defmac + +@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, and for the first one that is +found and defines @samp{DIR}, define the listed C preprocessor macro: + +@c The printed table looks too spaced out with blank lines between the entries. +@table @file +@item dirent.h +@code{HAVE_DIRENT_H} +@item sys/ndir.h +@code{HAVE_SYS_NDIR_H} +@item sys/dir.h +@code{HAVE_SYS_DIR_H} +@item ndir.h +@code{HAVE_NDIR_H} +@end table + +The directory library declarations in the source code should look +something like the following: + +@example +@group +#if HAVE_DIRENT_H +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +#else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include +# endif +# if HAVE_SYS_DIR_H +# include +# endif +# if HAVE_NDIR_H +# include +# endif +#endif +@end group +@end example + +Using the above declarations, the program would declare variables to be +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_STDC +@maindex HEADER_STDC +@cvindex STDC_HEADERS +Define @code{STDC_HEADERS} if the system has 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 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 ANSI C requires. + +Use @code{STDC_HEADERS} instead of @code{__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 +@samp{memmove}; some define the BSD functions as macros in +@file{string.h} or @file{strings.h}; some have only the 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 ANSI versions of those then it probably has most of +the others. If you put the following in @file{configure.in}: + +@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 +#else +# ifndef HAVE_STRCHR +# define strchr index +# define strrchr rindex +# endif +char *strchr (), *strrchr (); +# ifndef 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 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 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 BSD @code{union wait} instead of +@code{int} to store a status value. If @file{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: + +@example +@group +#include +#if HAVE_SYS_WAIT_H +# include +#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 + +@defmac AC_MEMORY_H +@maindex MEMORY_H +@cvindex NEED_MEMORY_H +Define @code{NEED_MEMORY_H} if @code{memcpy}, @code{memcmp}, etc. are +not declared in @file{string.h} and @file{memory.h} exists. This macro +is obsolete; instead, use @code{AC_CHECK_HEADERS(memory.h)}. See the +example for @code{AC_HEADER_STDC}. +@end defmac + +@defmac AC_UNISTD_H +@maindex UNISTD_H +@cvindex HAVE_UNISTD_H +Define @code{HAVE_UNISTD_H} if the system has @file{unistd.h}. This +macro is obsolete; instead, use @samp{AC_CHECK_HEADERS(unistd.h)}. + +The way to check if the system supports POSIX.1 is: + +@example +@group +#if HAVE_UNISTD_H +# include +# include +#endif + +#ifdef _POSIX_VERSION +/* Code for POSIX.1 systems. */ +#endif +@end group +@end example + +@cvindex _POSIX_VERSION +@code{_POSIX_VERSION} is defined when @file{unistd.h} is included on +POSIX.1 systems. If there is no @file{unistd.h}, it is definitely not a +POSIX.1 system. However, some non-POSIX.1 systems do have @file{unistd.h}. +@end defmac + +@defmac AC_USG +@maindex USG +@cvindex USG +Define @code{USG} if the system does not have @file{strings.h}, +@code{rindex}, @code{bzero}, etc. This implies that it has +@file{string.h}, @code{strrchr}, @code{memset}, etc. + +The symbol @code{USG} is obsolete. Instead of this macro, see the +example for @code{AC_HEADER_STDC}. +@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}, @r{[}@var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@maindex CHECK_HEADER +If the system header file @var{header-file} exists, 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. +@end defmac + +@defmac AC_CHECK_HEADERS (@var{header-file}@dots{} @r{[}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@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. +@end defmac + +@node Structures, Typedefs, Header Files, Existing Tests +@section Structures + +The following macros check for certain structures or structure members. +To check structures not listed here, use @code{AC_EGREP_CPP} +(@pxref{Examining Declarations}) or @code{AC_TRY_COMPILE} +(@pxref{Examining Syntax}). + +@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_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 +# include +#else +# if HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif +@end group +@end example +@end defmac + +@defmac AC_STRUCT_ST_BLKSIZE +@maindex STRUCT_ST_BLKSIZE +@cvindex HAVE_ST_BLKSIZE +If @code{struct stat} contains an @code{st_blksize} member, define +@code{HAVE_ST_BLKSIZE}. +@end defmac + +@defmac AC_STRUCT_ST_BLOCKS +@maindex STRUCT_ST_BLOCKS +@cvindex HAVE_ST_BLOCKS +@ovindex LIBOBJS +If @code{struct stat} contains an @code{st_blocks} member, define +@code{HAVE_ST_BLOCKS}. Otherwise, add @samp{fileblocks.o} to the +output variable @code{LIBOBJS}. +@end defmac + +@defmac AC_STRUCT_ST_RDEV +@maindex STRUCT_ST_RDEV +@cvindex HAVE_ST_RDEV +If @code{struct stat} contains an @code{st_rdev} member, define +@code{HAVE_ST_RDEV}. +@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_TM_ZONE}. Otherwise, if the +external array @code{tzname} is found, define @code{HAVE_TZNAME}. +@end defmac + +@node Typedefs, C Compiler Characteristics, Structures, Existing Tests +@section Typedefs + +The following macros check for C typedefs. If there is no macro +specifically defined to check for a typedef you need, and you don't need +to check for any special properties of it, then you can use a general +typedef check macro. + +@menu +* Particular Typedefs:: Special handling to find certain types. +* Generic Typedefs:: How to find other types. +@end menu + +@node Particular Typedefs, Generic Typedefs, Typedefs, Typedefs +@subsection Particular Typedef Checks + +These macros check for particular C typedefs in @file{sys/types.h} and +@file{stdlib.h} (if it exists). + +@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 +If @code{mode_t} is not defined, define @code{mode_t} to be @code{int}. +@end defmac + +@defmac AC_TYPE_OFF_T +@maindex TYPE_OFF_T +@cvindex off_t +If @code{off_t} is not defined, define @code{off_t} to be @code{long}. +@end defmac + +@defmac AC_TYPE_PID_T +@maindex TYPE_PID_T +@cvindex pid_t +If @code{pid_t} is not defined, define @code{pid_t} to be @code{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 +If @code{size_t} is not defined, define @code{size_t} to be +@code{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 Typedefs, , Particular Typedefs, Typedefs +@subsection Generic Typedef Checks + +This macro is used to check for typedefs not covered by the particular +test macros. + +@defmac AC_CHECK_TYPE (@var{type}, @var{default}) +@maindex CHECK_TYPE +If the type @var{type} is not defined in @file{sys/types.h}, or +@file{stdlib.h} or @file{stddef.h} if they exist, define it to be the +C (or C++) builtin type @var{default}; e.g., @samp{short} or +@samp{unsigned}. +@end defmac + +@node C Compiler Characteristics, Fortran 77 Compiler Characteristics, Typedefs, Existing Tests +@section C Compiler Characteristics + +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 +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 keyword @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. +@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_CHECK_SIZEOF (@var{type} @r{[}, @var{cross-size}@r{]}) +@maindex CHECK_SIZEOF +Define @code{SIZEOF_@var{uctype}} to be the size in bytes of the C (or +C++) builtin type @var{type}, e.g. @samp{int} or @samp{char *}. If +@samp{type} is unknown to the compiler, it gets a size of 0. @var{uctype} +is @var{type}, with lowercase converted to uppercase, spaces changed to +underscores, and asterisks changed to @samp{P}. If cross-compiling, the +value @var{cross-size} is used if given, otherwise @code{configure} +exits with an error message. + +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 + +@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}. +This macro is obsolete; it is more general to use +@samp{AC_CHECK_SIZEOF(int)} instead. +@end defmac + +@defmac AC_LONG_64_BITS +@maindex LONG_64_BITS +@cvindex LONG_64_BITS +If the C type @code{long int} is 64 bits wide, define +@code{LONG_64_BITS}. This macro is obsolete; it is more general to use +@samp{AC_CHECK_SIZEOF(long)} instead. +@end defmac + + +@node Fortran 77 Compiler Characteristics, System Services, C Compiler Characteristics, Existing Tests +@section Fortran 77 Compiler Characteristics + +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 lanuage to Fortran 77 +@code{AC_LANG_FORTRAN77} (@pxref{Language Choice}). + +@defmac AC_F77_LIBRARY_LDFLAGS +@maindex F77_LIBRARY_LDFLAGS +@ovindex FLIBS +Determine the linker flags (e.g. @samp{-L} and @samp{-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. +@end defmac + + +@node System Services, UNIX Variants, Fortran 77 Compiler Characteristics, Existing Tests +@section System Services + +The following macros check for operating system services or capabilities. + +@defmac AC_CYGWIN +@maindex CYGWIN +Checks for the Cygwin environment. If present, sets shell variable +@code{CYGWIN} to @samp{yes}. If not present, sets @code{CYGWIN} +to the empty string. +@end defmac + +@defmac AC_EXEEXT +@maindex EXEEXT +@ovindex EXEEXT +Defines substitute variable @code{EXEEXT} based on the output of the +compiler, after .c, .o, and .obj files have been excluded. Typically +set to empty string if Unix, @samp{.exe} or @samp{.EXE} if Win32. +@end defmac + +@defmac AC_OBJEXT +@maindex OBJEXT +@ovindex OBJEXT +Defines substitute 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. +@end defmac + +@defmac AC_MINGW32 +@maindex MINGW32 +Checks for the MingW32 compiler environment. If present, sets shell +variable @code{MINGW32} to @samp{yes}. If not present, sets +@code{MINGW32} to the empty string. +@end defmac + +@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 @samp{--x-includes=@var{dir}} and +@samp{--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 +@samp{--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 +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}. If X is not available, adds @samp{-DX_DISPLAY_MISSING} to +@code{X_CFLAGS}. + +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 @samp{-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.in} 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_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_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}. +@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 BSD +functions. Should be called before any macros that run the C compiler. +@end defmac + +@defmac AC_DYNIX_SEQ +@maindex DYNIX_SEQ +If on Dynix/PTX (Sequent UNIX), add @samp{-lseq} to output +variable @code{LIBS}. This macro is obsolete; instead, use +@code{AC_FUNC_GETMNTENT}. +@end defmac + +@defmac AC_IRIX_SUN +@maindex IRIX_SUN +If on IRIX (Silicon Graphics UNIX), add @samp{-lsun} to output variable +@code{LIBS}. This macro is obsolete. 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)}. +@end defmac + +@defmac AC_ISC_POSIX +@maindex ISC_POSIX +@cvindex _POSIX_SOURCE +@ovindex CC +If on a POSIXized ISC UNIX, define @code{_POSIX_SOURCE} and add +@samp{-posix} (for the GNU C compiler) or @samp{-Xp} (for other C +compilers) to output variable @code{CC}. This allows the use of +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 POSIX +facilities. Should be called before any macros that run the C compiler. +@end defmac + +@defmac AC_SCO_INTL +@maindex SCO_INTL +@ovindex LIBS +If on SCO UNIX, add @samp{-lintl} to output variable @code{LIBS}. +This macro is obsolete; instead, use @code{AC_FUNC_STRFTIME}. +@end defmac + +@defmac AC_XENIX_DIR +@maindex XENIX_DIR +@ovindex LIBS +If on Xenix, add @samp{-lx} to output variable @code{LIBS}. Also, if +@file{dirent.h} is being used, add @samp{-ldir} to @code{LIBS}. This +macro is obsolete; use @code{AC_HEADER_DIRENT} instead. +@end defmac + +@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 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. +* Portable Shell:: Shell script portability pitfalls. +* Testing Values and Files:: Checking strings and files. +* 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}, @r{[}@var{action-if-true} @r{[}, @var{action-if-false}@r{]]}) +@maindex TRY_CPP +@var{includes} is C or C++ @code{#include} statements and declarations, +on which shell variable, backquote, 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 +@samp{-g}, @samp{-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} @r{[}, @var{action-if-not-found}@r{]}) +@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}, @r{[}@var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@maindex EGREP_CPP +@var{program} is the text of a C or C++ program, on which shell +variable, backquote, 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}, @r{[}@var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@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, @samp{-Wl,-dn} on 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}, @r{[}@var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@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}, @r{[}@var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@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 + +@defmac AC_TRY_LINK_FUNC (@var{function}, @r{[}@var{action-if-found} @r{[}, @var{action-if-not-found}@r{]]}) +@maindex TRY_LINK_FUNC +Attempt to compile and link a small program that links with +@var{function}. 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_COMPILE_CHECK (@var{echo-text}, @var{includes}, @var{function-body}, @var{action-if-found} @r{[}, @var{action-if-not-found}@r{]}) +@maindex COMPILE_CHECK +This is an obsolete version of @code{AC_TRY_LINK}, 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 + +@node Run Time, Portable Shell, 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 using them 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}, @r{[}@var{action-if-true} @r{[}, @var{action-if-false} @r{[}, @var{action-if-cross-compiling}@r{]]]}) +@maindex TRY_RUN +@var{program} is the text of a C program, on which shell variable and +backquote 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 target 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. + +@defmac AC_C_CROSS +@maindex C_CROSS +This macro is obsolete; it does nothing. +@end defmac + +@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.in} you can have a test program that includes an ANSI C +header file conditionally: + +@example +@group +#if STDC_HEADERS +# include +#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{conftestdata}. 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 Portable Shell, Testing Values and Files, Run Time, Writing Tests +@section 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 Bash and the Korn shell +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 @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 +If you omit the space before the path, then 4.2BSD 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, as +well; for example, don't rely on @code{ln} having a @samp{-f} option or +@code{cat} having any options. @code{sed} scripts should not contain +comments or use branch labels longer than 8 characters. 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. + +@node Testing Values and Files, Multiple Cases, Portable Shell, Writing Tests +@section Testing Values and Files + +@code{configure} scripts need to test properties of many files and +strings. Here are some portability problems to watch out for when doing +those tests. + +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 +@code{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 @samp{-a} and @samp{-o}. On System V, the +precedence of @samp{-a} and @samp{-o} is wrong relative to the unary +operators; consequently, 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. + +To enable @code{configure} scripts to support cross-compilation, they +shouldn't do anything that tests features of the host system instead of +the target 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 4.3BSD does not have +it. + +Another nonportable shell programming construction is +@example +@var{var}=$@{@var{var}:-@var{value}@} +@end example +@noindent +The intent is to set @var{var} to @var{value} only if it is not already +set, but if @var{var} has any value, even the empty string, to leave it +alone. Old BSD shells, including the Ultrix @code{sh}, don't accept +the colon, and complain and die. A portable equivalent is +@example +: $@{@var{var}=@var{value}@} +@end example + +@node Multiple Cases, Language Choice, Testing Values and Files, Writing Tests +@section 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 @code{fstype} to keep +track of whether the remaining cases need to be checked. + +@example +@group +AC_MSG_CHECKING(how to get filesystem type) +fstype=no +# The order of these tests is important. +AC_TRY_CPP([#include +#include ], AC_DEFINE(FSTYPE_STATVFS) fstype=SVR4) +if test $fstype = no; then +AC_TRY_CPP([#include +#include ], AC_DEFINE(FSTYPE_USG_STATFS) fstype=SVR3) +fi +if test $fstype = no; then +AC_TRY_CPP([#include +#include ], 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 + +Packages that use both C and C++ need to test features of both +compilers. Autoconf-generated @code{configure} scripts check for C +features by default. The following macros determine which language's +compiler is used in tests that follow in @file{configure.in}. + +@defmac AC_LANG_C +@maindex LANG_C +Do compilation tests using @code{CC} and @code{CPP} and use extension +@file{.c} for test programs. Set the shell variable +@code{cross_compiling} to the value computed by @code{AC_PROG_CC} if it +has been run, empty otherwise. +@end defmac + +@defmac AC_LANG_CPLUSPLUS +@maindex LANG_CPLUSPLUS +Do compilation tests using @code{CXX} and @code{CXXCPP} and use +extension @file{.C} for test programs. Set the shell variable +@code{cross_compiling} to the value computed by @code{AC_PROG_CXX} if +it has been run, empty otherwise. +@end defmac + +@defmac AC_LANG_FORTRAN77 +@maindex LANG_FORTRAN77 +Do compilation tests using @code{F77} and use extension @file{.f} for +test programs. Set the shell variable @code{cross_compiling} to the +value computed by @code{AC_PROG_F77} if it has been run, empty +otherwise. +@end defmac + +@defmac AC_LANG_SAVE +@maindex LANG_SAVE +Remember the current language (as set by @code{AC_LANG_C}, +@code{AC_LANG_CPLUSPLUS} or @code{AC_LANG_FORTRAN77}) on a stack. Does +not change which language is current. Use this macro and +@code{AC_LANG_RESTORE} in macros that need to temporarily switch to a +particular language. +@end defmac + +@defmac AC_LANG_RESTORE +@maindex LANG_RESTORE +Select the language that is saved on the top of the stack, as set by +@code{AC_LANG_SAVE}, and remove it from the stack. This macro is +equivalent to either @code{AC_LANG_C}, @code{AC_LANG_CPLUSPLUS} or +@code{AC_LANG_FORTRAN77}, whichever had been run most recently when +@code{AC_LANG_SAVE} was last called. + +Do not call this macro more times than @code{AC_LANG_SAVE}. +@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 + +@node Results, Writing Macros, 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 users of progress or problems. +@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 +@samp{-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_HEADER} 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} @r{[}, @var{value} @r{[}, @var{description}@r{]}@r{]}) +@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_HEADER} 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 +@code{m4} quote characters @samp{[} or @samp{]}), use +@code{AC_DEFINE_UNQUOTED} instead. @var{description} is only useful if +you are using @code{AC_CONFIG_HEADER}. In this case, @var{description} +is put into the generated @file{config.h.in} as the comment before the +macro define; the macro need not be mentioned in @file{acconfig.h}. 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} @r{[}, @var{value} @r{[}, @var{description}@r{]}@r{]}) +@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 + +One 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}) +@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. The value of @var{variable} should not contain literal +newlines. +@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.in} +could contain: + +@example +AC_SUBST_FILE(host_frag)dnl +host_frag=$srcdir/conf/sun4.mh +@end example + +@noindent +and then a @file{Makefile.in} could contain: + +@example +@@host_frag@@ +@end example +@end defmac + +@node Caching Results, Printing Messages, Setting Output Variables, Results +@section Caching Results + +To avoid checking for the same features repeatedly in various +@code{configure} scripts (or repeated runs of one script), +@code{configure} saves the results of many of its checks in a @dfn{cache +file}. If, when a @code{configure} script runs, it finds a cache file, +it reads from it the results from previous runs and avoids rerunning +those checks. As a result, @code{configure} can 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 @samp{--quiet} or +@samp{--silent} option, print a message saying that the result was +cached; otherwise, run the shell commands @var{commands-to-set-it}. +Those commands should have no side effects except for setting the +variable @var{cache-id}. In particular, they should not call +@code{AC_DEFINE}; the code that follows the call to @code{AC_CACHE_VAL} +should do that, based on the cached value. Also, they 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. 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. +@end defmac + +@defmac AC_CACHE_CHECK (@var{message}, @var{cache-id}, @var{commands}) +@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}. +@end defmac + +@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.in. Doing so +checkpoints the cache in case of an early configure script abort. +@end defmac + +@menu +* Cache Variable Names:: Shell variables used in caches. +* Cache Files:: Files @code{configure} uses for caching. +@end menu + +@node Cache Variable Names, Cache Files, Caching Results, Caching Results +@subsection Cache Variable Names + +The names of cache variables should have the following format: + +@example +@var{package-prefix}_cv_@var{value-type}_@var{specific-value}@r{[}_@var{additional-options}@r{]} +@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. + +@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 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, configure uses @file{./config.cache} as the cache file, +creating it if it does not exist already. @code{configure} accepts the +@samp{--cache-file=@var{file}} option to use a different cache file; +that is what @code{configure} does when it calls @code{configure} +scripts in subdirectories, so they share the cache. +@xref{Subdirectories}, for information on configuring subdirectories +with the @code{AC_CONFIG_SUBDIRS} macro. + +Giving @samp{--cache-file=/dev/null} disables caching, for debugging +@code{configure}. @file{config.status} only pays attention to the cache +file if it is given the @samp{--recheck} option, which makes it rerun +@code{configure}. If you are anticipating a long debugging period, you +can also disable cache loading and saving for a @code{configure} script +by redefining the cache macros at the start of @file{configure.in}: + +@example +define([AC_CACHE_LOAD], )dnl +define([AC_CACHE_SAVE], )dnl +AC_INIT(@r{whatever}) +@r{ ... rest of configure.in ...} +@end example + +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 cache file on a particular system will gradually accumulate whenever +someone runs a @code{configure} script; it will be initially +nonexistent. Running @code{configure} merges the new cache results with +the existing cache file. The site initialization script can specify a +site-wide cache file to use instead of the default, to make it work +transparently, as long as the same C compiler is used every time +(@pxref{Site Defaults}). + +If your configure script, or a macro called from configure.in, happens to +abort the configure process, it may be useful to checkpoint the cache a +few times at key points. 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. + +@example +@r{ ... AC_INIT, etc. ...} +dnl checks for programs +AC_PROG_CC +AC_PROG_GCC_TRADITIONAL +@r{ ... more program checks ...} +AC_CACHE_SAVE + +dnl checks for libraries +AC_CHECK_LIB(nsl, gethostbyname) +AC_CHECK_LIB(socket, connect) +@r{ ... more lib checks ...} +AC_CACHE_SAVE + +dnl Might abort... +AM_PATH_GTK(1.0.2, , exit 1) +AM_PATH_GTKMM(0.9.5, , exit 1) +@end example + +@node Printing Messages, , Caching Results, Results +@section Printing Messages + +@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 backquote substitution +on them. You can print a message containing a comma by quoting the +message with the @code{m4} quote characters: + +@example +AC_MSG_RESULT([never mind, I found the BASIC compiler]) +@end example + +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 change +automatically. + +@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 +@samp{--quiet} or @samp{--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 +@samp{--quiet} or @samp{--silent} option. +@end defmac + +@defmac AC_MSG_ERROR (@var{error-description}) +@maindex MSG_ERROR +Notify the user of an error that prevents @code{configure} from +completing. This macro prints an error message on the standard error +output and exits @code{configure} with a nonzero status. +@var{error-description} should be something like @samp{invalid value +$HOME for \$HOME}. +@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 on 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 + +The following two macros are an obsolete alternative to +@code{AC_MSG_CHECKING} and @code{AC_MSG_RESULT}. + +@defmac AC_CHECKING (@var{feature-description}) +@maindex CHECKING +This macro is similar to @code{AC_MSG_CHECKING}, except that it prints a +newline after the @var{feature-description}. It is useful mainly to +print a general description of the overall purpose of a group of feature +checks, e.g., + +@example +AC_CHECKING(if stack overflow is detectable) +@end example +@end defmac + +@defmac AC_VERBOSE (@var{result-description}) +@maindex VERBOSE +This macro is similar to @code{AC_MSG_RESULT}, except that it is meant +to follow a call to @code{AC_CHECKING} instead of +@code{AC_MSG_CHECKING}; it starts the message it prints with a tab. It +is considered obsolete. +@end defmac + +@node Writing Macros, Manual Configuration, Results, Top +@chapter Writing 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. +* Quoting:: Protecting macros from unwanted expansion. +* Dependencies Between Macros:: What to do when macros depend on other macros. +@end menu + +@node Macro Definitions, Macro Names, Writing Macros, Writing Macros +@section Macro Definitions + +@maindex DEFUN +Autoconf macros are defined using the @code{AC_DEFUN} macro, which is +similar to the @code{m4} builtin @code{define} macro. In addition to +defining a macro, @code{AC_DEFUN} adds to it some code which 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 + +@noindent +The square brackets here do not indicate optional text: they should +literally be present in the macro definition to avoid macro expansion +problems (@pxref{Quoting}). You can refer to any arguments passed to +the macro as @samp{$1}, @samp{$2}, etc. + +To introduce comments in @code{m4}, use the @code{m4} builtin +@code{dnl}; it causes @code{m4} to discard the text through the next +newline. It is not needed between macro definitions in @file{acsite.m4} +and @file{aclocal.m4}, because all output is discarded until +@code{AC_INIT} is called. + +@xref{Definitions, , How to define new macros, m4.info, GNU m4}, for +more complete information on writing @code{m4} macros. + +@node Macro Names, Quoting, Macro Definitions, Writing 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 +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 STRUCT +Definitions of C structures in header files. +@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. + +A macro that is an internal subroutine of another macro should have a +name that starts with 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 Quoting, Dependencies Between Macros, Macro Names, Writing Macros +@section Quoting + +Macros that are called by other macros are evaluated by @code{m4} +several times; each evaluation might require another layer of quotes to +prevent unwanted expansions of macros or @code{m4} builtins, such as +@samp{define} and @samp{$1}. Quotes are also required around macro +arguments that contain commas, since commas separate the arguments from +each other. It's a good idea to quote any macro arguments that contain +newlines or calls to other macros, as well. + +Autoconf changes the @code{m4} quote characters +from the default @samp{`} and @samp{'} to @samp{[} and @samp{]}, because +many of the macros use @samp{`} and @samp{'}, mismatched. However, in a +few places the macros need to use brackets (usually in C program text or +regular expressions). In those places, they use the @code{m4} builtin +command @code{changequote} to temporarily change the quote characters to +@samp{<<} and @samp{>>}. (Sometimes, if they don't need to quote +anything, they disable quoting entirely instead by setting the quote +characters to empty strings.) Here is an example: + +@example +AC_TRY_LINK( +changequote(<<, >>)dnl +<<#include +#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 + +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 Dependencies Between Macros, , Quoting, Writing 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. +* Obsolete Macros:: Warning about old ways of doing things. +@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 @code{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. +@end defmac + +An alternative to using @code{AC_DEFUN} is to use @code{define} and call +@code{AC_PROVIDE}. Because this technique does not prevent nested +messages, it is considered obsolete. + +@defmac AC_PROVIDE (@var{this-macro-name}) +@maindex PROVIDE +Record the fact that @var{this-macro-name} has been called. +@var{this-macro-name} should be the name of the macro that is calling +@code{AC_PROVIDE}. An easy way to get it is from the @code{m4} builtin +variable @code{$0}, like this: + +@example +AC_PROVIDE([$0]) +@end example +@end defmac + +@node Suggested Ordering, Obsolete Macros, 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.in} file. The warning occurs when creating +@code{configure} from @file{configure.in}, not when running +@code{configure}. +For example, @code{AC_PROG_CPP} checks whether the C compiler +can run the C preprocessor when given the @samp{-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 on 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 Obsolete Macros, , Suggested Ordering, Dependencies Between Macros +@subsection Obsolete 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. Autoconf provides the @code{AC_OBSOLETE} macro to +warn users producing @code{configure} scripts when they use obsolete +macros, to encourage them to modernize. A sample call is: + +@example +AC_OBSOLETE([$0], [; use AC_CHECK_HEADERS(unistd.h) instead])dnl +@end example + +@defmac AC_OBSOLETE (@var{this-macro-name} @r{[}, @var{suggestion}@r{]}) +@maindex OBSOLETE +Make @code{m4} print a message on 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}. +@end defmac + +@node Manual Configuration, Site Configuration, Writing Macros, 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. +* System Type Variables:: Variables containing the 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 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: + +@example +@var{cpu}-@var{company}-@var{system} +@end example + +@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 derives 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: + +@table @code +@item --build=@var{build-type} +the type of system on which the package is being configured and +compiled (rarely needed); + +@item --host=@var{host-type} +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. +@end table + +@noindent +If the user gives @code{configure} a non-option argument, it is used as +the default for the host, target, and build system types if the user +does not specify them explicitly with options. The target and build +types default to the host type if it is given and they are not. If you +are cross-compiling, you still have to specify the names of the +cross-tools you use, in particular the C compiler, on the +@code{configure} command line, e.g., + +@example +CC=m68k-coff-gcc configure --target=m68k-coff +@end example + +@code{configure} recognizes short aliases for many system types; for +example, @samp{decstation} can be given on the command line instead of +@samp{mips-dec-ultrix4.2}. @code{configure} runs a script called +@code{config.sub} to canonicalize system type aliases. + +@node Canonicalizing, System Type Variables, Specifying Names, Manual Configuration +@section Getting the Canonical System Type + +The following macros make the system type available to @code{configure} +scripts. They run the shell script @code{config.guess} to determine any +values for the host, target, and build types that they need and the user +did not specify on the command line. They run @code{config.sub} to +canonicalize any aliases the user gave. If you use these macros, you +must distribute those two shell scripts along with your source code. +@xref{Output}, for information about the @code{AC_CONFIG_AUX_DIR} macro +which you can use to control which directory @code{configure} looks for +those scripts in. If you do not use either of these macros, +@code{configure} ignores any @samp{--host}, @samp{--target}, and +@samp{--build} options given to it. + +@defmac AC_CANONICAL_SYSTEM +@maindex CANONICAL_SYSTEM +Determine the system type and set output variables to the names of the +canonical system types. @xref{System Type Variables}, for details about +the variables this macro sets. +@end defmac + +@defmac AC_CANONICAL_HOST +@maindex CANONICAL_HOST +Perform only the subset of @code{AC_CANONICAL_SYSTEM} relevant to the +host type. This is all that is needed for programs that are not part of +a compiler toolchain. +@end defmac + +@defmac AC_VALIDATE_CACHED_SYSTEM_TUPLE (@var{cmd}) +@maindex VALIDATE_CACHED_SYSTEM_TUPLE +If the cache file is inconsistent with the current host, +target and build system types, execute @var{cmd} or print a default +error message. +@end defmac + +@node System Type Variables, Using System Type, Canonicalizing, Manual Configuration +@section System Type Variables + +After calling @code{AC_CANONICAL_SYSTEM}, the following output variables +contain the system type information. After @code{AC_CANONICAL_HOST}, +only the @code{host} variables below are set. + +@table @code +@ovindex build +@ovindex host +@ovindex target +@item @code{build}, @code{host}, @code{target} +the canonical system names; + +@item @code{build_alias}, @code{host_alias}, @code{target_alias} +@ovindex build_alias +@ovindex host_alias +@ovindex target_alias +the names the user specified, or the canonical names if +@code{config.guess} was used; + +@item @code{build_cpu}, @code{build_vendor}, @code{build_os} +@itemx @code{host_cpu}, @code{host_vendor}, @code{host_os} +@itemx @code{target_cpu}, @code{target_vendor}, @code{target_os} +@ovindex build_cpu +@ovindex host_cpu +@ovindex target_cpu +@ovindex build_vendor +@ovindex host_vendor +@ovindex target_vendor +@ovindex build_os +@ovindex host_os +@ovindex target_os +the individual parts of the canonical names (for convenience). +@end table + +@node Using System Type, , System Type Variables, 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.in} to select +system-specific C files. Then link those files, which have names based +on the system name, to generic names, such as @file{host.h} or +@file{target.c}. The @code{case} statement patterns can use shell +wildcards 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 + +@defmac AC_LINK_FILES (@var{source}@dots{}, @var{dest}@dots{}) +@maindex LINK_FILES +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 may be called multiple times. + +For example, this call: + +@example +AC_LINK_FILES(config/$@{machine@}.h config/$@{obj_format@}.h, host.h object.h) +@end example + +@noindent +creates in the current directory @file{host.h}, which is a link to +@file{@var{srcdir}/config/$@{machine@}.h}, and @file{object.h}, which is a link +to @file{@var{srcdir}/config/$@{obj_format@}.h}. +@end defmac + +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. + +@node Site Configuration, Invoking configure, 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. +* 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 +which 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}@r{[}=@var{arg}@r{]} +--without-@var{package} +@end example + +For example, @samp{--with-gnu-ld} means work with the GNU linker instead +of some other linker. @samp{--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}. +@samp{--without-@var{package}} is equivalent to +@samp{--with-@var{package}=no}. + +@code{configure} scripts do not complain about +@samp{--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.in} +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} @r{[}, @var{action-if-given} @r{[}, @var{action-if-not-given}@r{]]}) +@maindex ARG_WITH +If the user gave @code{configure} the option @samp{--with-@var{package}} +or @samp{--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 @samp{-} characters changed into @samp{_}. +You may use that variable instead, if you wish. + +The argument @var{help-string} is a description of the option which +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. +@end defmac + +@defmac AC_WITH (@var{package}, @var{action-if-given} @r{[}, @var{action-if-not-given}@r{]}) +@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, Site Details, 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}@r{[}=@var{arg}@r{]} +--disable-@var{feature} +@end example + +These options allow users to choose which optional features to build and +install. @samp{--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 @samp{--enable-debug=stabs}. If no argument is +given, it defaults to @samp{yes}. @samp{--disable-@var{feature}} is +equivalent to @samp{--enable-@var{feature}=no}. + +@code{configure} scripts do not complain about +@samp{--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.in} 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} @r{[}, @var{action-if-given} @r{[}, @var{action-if-not-given}@r{]]}) +@maindex ARG_ENABLE +If the user gave @code{configure} the option +@samp{--enable-@var{feature}} or @samp{--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 @samp{-} 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}). +@end defmac + +@defmac AC_ENABLE (@var{feature}, @var{action-if-given} @r{[}, @var{action-if-not-given}@r{]}) +@maindex ENABLE +This is an obsolete version of @code{AC_ARG_ENABLE} that does not +support providing a help string. +@end defmac + +@node Site Details, Transforming Names, Package Options, 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.in} 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_SYSTEM} has been called and a @samp{--target} value +is given that differs from the host type (specified with @samp{--host} +or defaulted by @code{config.sub}), 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 @code +@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 +@samp{--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 +GNU programs installed on your system to shadow other programs with the +same name. For example, if you configure GNU @code{diff} with +@samp{--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 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 @samp{--program-suffix=2} to install the +programs as @file{/usr/local/bin/autoconf2}, +@file{/usr/local/bin/autoheader2}, etc. + +@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 + +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. 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 @samp{--without-} and @samp{--disable-} options +are like giving the corresponding @samp{--with-} or @samp{--enable-} +option and the value @samp{no}. Thus, @samp{--cache-file=localcache} +sets the variable @code{cache_file} to the value @samp{localcache}; +@samp{--enable-warnings=no} or @samp{--disable-warnings} sets the variable +@code{enable_warnings} to the value @samp{no}; @samp{--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 +@code{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" = ./config.cache; then + cache_file="$prefix/var/config.cache" + # A cache file is only valid for one C compiler. + CC=gcc +fi +@end example + +@node Invoking configure, Invoking config.status, Site Configuration, Top +@chapter Running @code{configure} Scripts + +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}. +* Operation Controls:: Changing how @code{configure} runs. +@end menu + +@include install.texi + +@node Invoking config.status, Questions, Invoking configure, Top +@chapter Recreating a Configuration + +The @code{configure} script creates a file named @file{config.status} +which describes which configuration options were specified when the +package was last configured. This file is a shell script which, +if run, will recreate the same configuration. + +You can give @file{config.status} the @samp{--recheck} option to update +itself. This option is useful if you change @code{configure}, so that +the results of some tests might be different from the previous run. The +@samp{--recheck} option re-runs @code{configure} with the same arguments +you used before, plus the @samp{--no-create} option, which prevent +@code{configure} from running @file{config.status} and creating +@file{Makefile} and other files, and the @samp{--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). + +@file{config.status} also accepts the options @samp{--help}, which +prints a summary of the options to @file{config.status}, and +@samp{--version}, which prints the version of Autoconf used to create +the @code{configure} script that generated @file{config.status}. + +@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 @samp{--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 + +The following variables 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 variables allow a +@file{config.status} file to create files other than the ones that its +@file{configure.in} specifies, so it can be used for a different package. + +@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} in @file{configure.in}. +@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_HEADER}; if that +macro was not called, @file{config.status} ignores this variable. +@end defvar + +These variables also allow you to write @file{Makefile} rules that +regenerate only some of the files. For example, in the dependencies +given above (@pxref{Automatic Remaking}), @file{config.status} is run +twice when @file{configure.in} 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_FILES= CONFIG_HEADERS=config.h ./config.status + echo > stamp-h + +Makefile: Makefile.in config.status + CONFIG_FILES=Makefile CONFIG_HEADERS= ./config.status +@end group +@end example + +@noindent +(If @file{configure.in} does not call @code{AC_CONFIG_HEADER}, there is +no need to set @code{CONFIG_HEADERS} in the @code{make} rules.) + +@node Questions, Upgrading, Invoking config.status, 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 @code{m4}? +* Bootstrapping:: Autoconf and GNU @code{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 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.in}, since it is derived from that file and from the +public domain file @file{acconfig.h}. @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 @code{m4}? + +@display +Why does Autoconf require GNU @code{m4}? +@end display + +Many @code{m4} implementations have hard-coded limitations on the size +and number of macros, which 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 + +Since only software maintainers need to use Autoconf, and since GNU +@code{m4} is simple to configure and install, it seems reasonable to +require GNU @code{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. + +@node Bootstrapping, Why Not Imake, Why GNU m4, Questions +@section How Can I Bootstrap? + +@display +If Autoconf requires GNU @code{m4} and GNU @code{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 GNU @code{m4} does come with a +@code{configure} script produced by Autoconf, Autoconf is not required +in order to run the script and install GNU @code{m4}. Autoconf is only +required if you want to change the @code{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: + +Autoconf generated scripts frequently work on machines which 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 @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. + +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 +@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. + +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 @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. + +@node Upgrading, History, Questions, Top +@chapter 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.in} 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. + +First, make sure you have GNU @code{m4} version 1.1 or higher installed, +preferably 1.3 or higher. Versions before 1.1 have bugs that prevent +them from working with Autoconf version 2. Versions 1.3 and later are +much faster than earlier versions, because as of version 1.3, GNU +@code{m4} has a more efficient implementation of diversions and can +freeze its internal state in a file that it can read back quickly. + +@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. +* Invoking autoupdate:: Replacing old macro names in @code{configure.in}. +* 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, Upgrading, Upgrading +@section 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{Invoking autoconf}. + +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} or @file{config.h.bot}, you still +can, but you will have less clutter if you merge them into +@file{acconfig.h}. @xref{Invoking autoheader}. + +@node Changed Makefiles, Changed Macros, Changed File Names, Upgrading +@section 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 non-@file{Makefile} +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, Invoking autoupdate, Changed Makefiles, Upgrading +@section 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{Old Macro Names}, for a table showing +the new names for the old macros. Use the @code{autoupdate} program to +convert your @file{configure.in} to using the new macro names. +@xref{Invoking autoupdate}. + +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 Invoking autoupdate, Changed Results, Changed Macros, Upgrading +@section Using @code{autoupdate} to Modernize @code{configure} + +The @code{autoupdate} program updates a @file{configure.in} 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{Old Macro Names}, for a list of the old macro names and the +corresponding new names), you can make your @file{configure.in} 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.in}, +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.in} and writes the updated file to the +standard output. + +@noindent +@code{autoupdate} accepts the following options: + +@table @code +@item --help +@itemx -h +Print a summary of the command line options and exit. + +@item --macrodir=@var{dir} +@itemx -m @var{dir} +@evindex AC_MACRODIR +Look for the Autoconf macro files in directory @var{dir} instead of the +default installation directory. +You can also set the @code{AC_MACRODIR} +environment variable to a directory; this option overrides the +environment variable. + +@item --version +Print the version number of @code{autoupdate} and exit. +@end table + +@node Changed Results, Changed Macro Writing, Invoking autoupdate, Upgrading +@section 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.in} 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 $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 backquotes) 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, Upgrading +@section 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 History, Old Macro Names, Upgrading, 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 @code{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 GNU utilities for the Free +Software Foundation. As they were ported to more platforms and more +programs were added, the number of @samp{-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 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 @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 GNU utilities packages to use +@code{configure} scripts, updating them all by hand became impractical. +Rich Murphey, the maintainer of the 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 @code{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 @code{m4}.) Also, some of my friends at the +University of Maryland had recently been putting @code{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 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 @code{m4} +macros and continued to add features and improve the techniques used in +the checks. Prominent among the testers were +@ifinfo +Franc,ois +@end ifinfo +@tex +Fran\c cois +@end tex +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 Taylor, who added support for +creating a C header file as an alternative to putting @samp{-D} options +in a @file{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. + +@node Numbers, Deuteronomy, Leviticus, History +@section 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 +@code{configure} scripts reported problems they encountered. + +Autoconf turned out to be a good torture test for @code{m4} +implementations. UNIX @code{m4} started to dump core because of the +length of the macros that Autoconf defined, and several bugs showed up +in GNU @code{m4} as well. Eventually, we realized that we needed to use +some features that only GNU @code{m4} has. 4.3BSD @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. +@ifinfo +Franc,ois +@end ifinfo +@tex +Fran\c cois +@end tex +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 @code{autoheader} script to automate the creation of C header +file templates, and added a @samp{--verbose} option to @code{configure}. +Noah Friedman added the @samp{--macrodir} 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}, @samp{--host}, and +@samp{--target}; making links to files; and running @code{configure} +scripts in subdirectories. Adding these features enabled Ken to convert +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 +@ifinfo +Franc,ois +@end ifinfo +@tex +Fran\c cois +@end tex +Pinard, I made the macros not interrupt each others' messages. +(That feature revealed some performance bottlenecks in GNU @code{m4}, +which he hastily corrected!) +I reorganized the documentation around problems people want to solve. +And I began a testsuite, because experience +had shown that Autoconf has a pronounced tendency to regress when we +change it. + +Again, several alpha testers gave invaluable feedback, especially +@ifinfo +Franc,ois +@end ifinfo +@tex +Fran\c cois +@end tex +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.) + +@node Old Macro Names, Environment Variable Index, History, Top +@chapter Old Macro Names + +In version 2 of Autoconf, most of the macros were renamed to use a more +uniform and descriptive naming scheme. Here are the old names of the +macros that were renamed, followed by the current names of those macros. +Although the old names are still accepted by the @code{autoconf} program +for backward compatibility, the old names are considered obsolete. +@xref{Macro Names}, for a description of the new naming scheme. + +@table @code +@item AC_ALLOCA +@maindex ALLOCA +@code{AC_FUNC_ALLOCA} +@item AC_ARG_ARRAY +@maindex ARG_ARRAY +removed because of limited usefulness +@item AC_CHAR_UNSIGNED +@maindex CHAR_UNSIGNED +@code{AC_C_CHAR_UNSIGNED} +@item AC_CONST +@maindex CONST +@code{AC_C_CONST} +@item AC_CROSS_CHECK +@maindex CROSS_CHECK +@code{AC_C_CROSS} +@item AC_ERROR +@maindex ERROR +@code{AC_MSG_ERROR} +@item AC_FIND_X +@maindex FIND_X +@code{AC_PATH_X} +@item AC_FIND_XTRA +@maindex FIND_XTRA +@code{AC_PATH_XTRA} +@item AC_FUNC_CHECK +@maindex FUNC_CHECK +@code{AC_CHECK_FUNC} +@item AC_GCC_TRADITIONAL +@maindex GCC_TRADITIONAL +@code{AC_PROG_GCC_TRADITIONAL} +@item AC_GETGROUPS_T +@maindex GETGROUPS_T +@code{AC_TYPE_GETGROUPS} +@item AC_GETLOADAVG +@maindex GETLOADAVG +@code{AC_FUNC_GETLOADAVG} +@item AC_HAVE_FUNCS +@maindex HAVE_FUNCS +@code{AC_CHECK_FUNCS} +@item AC_HAVE_HEADERS +@maindex HAVE_HEADERS +@code{AC_CHECK_HEADERS} +@item AC_HAVE_POUNDBANG +@maindex HAVE_POUNDBANG +@code{AC_SYS_INTERPRETER} (different calling convention) +@item AC_HEADER_CHECK +@maindex HEADER_CHECK +@code{AC_CHECK_HEADER} +@item AC_HEADER_EGREP +@maindex HEADER_EGREP +@code{AC_EGREP_HEADER} +@item AC_INLINE +@maindex INLINE +@code{AC_C_INLINE} +@item AC_LN_S +@maindex LN_S +@code{AC_PROG_LN_S} +@item AC_LONG_DOUBLE +@maindex LONG_DOUBLE +@code{AC_C_LONG_DOUBLE} +@item AC_LONG_FILE_NAMES +@maindex LONG_FILE_NAMES +@code{AC_SYS_LONG_FILE_NAMES} +@item AC_MAJOR_HEADER +@maindex MAJOR_HEADER +@code{AC_HEADER_MAJOR} +@item AC_MINUS_C_MINUS_O +@maindex MINUS_C_MINUS_O +@code{AC_PROG_CC_C_O} +@item AC_MMAP +@maindex MMAP +@code{AC_FUNC_MMAP} +@item AC_MODE_T +@maindex MODE_T +@code{AC_TYPE_MODE_T} +@item AC_OFF_T +@maindex OFF_T +@code{AC_TYPE_OFF_T} +@item AC_PID_T +@maindex PID_T +@code{AC_TYPE_PID_T} +@item AC_PREFIX +@maindex PREFIX +@code{AC_PREFIX_PROGRAM} +@item AC_PROGRAMS_CHECK +@maindex PROGRAMS_CHECK +@code{AC_CHECK_PROGS} +@item AC_PROGRAMS_PATH +@maindex PROGRAMS_PATH +@code{AC_PATH_PROGS} +@item AC_PROGRAM_CHECK +@maindex PROGRAM_CHECK +@code{AC_CHECK_PROG} +@item AC_PROGRAM_EGREP +@maindex PROGRAM_EGREP +@code{AC_EGREP_CPP} +@item AC_PROGRAM_PATH +@maindex PROGRAM_PATH +@code{AC_PATH_PROG} +@item AC_REMOTE_TAPE +@maindex REMOTE_TAPE +removed because of limited usefulness +@item AC_RESTARTABLE_SYSCALLS +@maindex RESTARTABLE_SYSCALLS +@code{AC_SYS_RESTARTABLE_SYSCALLS} +@item AC_RETSIGTYPE +@maindex RETSIGTYPE +@code{AC_TYPE_SIGNAL} +@item AC_RSH +@maindex RSH +removed because of limited usefulness +@item AC_SETVBUF_REVERSED +@maindex SETVBUF_REVERSED +@code{AC_FUNC_SETVBUF_REVERSED} +@item AC_SET_MAKE +@maindex SET_MAKE +@code{AC_PROG_MAKE_SET} +@item AC_SIZEOF_TYPE +@maindex SIZEOF_TYPE +@code{AC_CHECK_SIZEOF} +@item AC_SIZE_T +@maindex SIZE_T +@code{AC_TYPE_SIZE_T} +@item AC_STAT_MACROS_BROKEN +@maindex STAT_MACROS_BROKEN +@code{AC_HEADER_STAT} +@item AC_STDC_HEADERS +@maindex STDC_HEADERS +@code{AC_HEADER_STDC} +@item AC_STRCOLL +@maindex STRCOLL +@code{AC_FUNC_STRCOLL} +@item AC_ST_BLKSIZE +@maindex ST_BLKSIZE +@code{AC_STRUCT_ST_BLKSIZE} +@item AC_ST_BLOCKS +@maindex ST_BLOCKS +@code{AC_STRUCT_ST_BLOCKS} +@item AC_ST_RDEV +@maindex ST_RDEV +@code{AC_STRUCT_ST_RDEV} +@item AC_SYS_SIGLIST_DECLARED +@maindex SYS_SIGLIST_DECLARED +@code{AC_DECL_SYS_SIGLIST} +@item AC_TEST_CPP +@maindex TEST_CPP +@code{AC_TRY_CPP} +@item AC_TEST_PROGRAM +@maindex TEST_PROGRAM +@code{AC_TRY_RUN} +@item AC_TIMEZONE +@maindex TIMEZONE +@code{AC_STRUCT_TIMEZONE} +@item AC_TIME_WITH_SYS_TIME +@maindex TIME_WITH_SYS_TIME +@code{AC_HEADER_TIME} +@item AC_UID_T +@maindex UID_T +@code{AC_TYPE_UID_T} +@item AC_UTIME_NULL +@maindex UTIME_NULL +@code{AC_FUNC_UTIME_NULL} +@item AC_VFORK +@maindex VFORK +@code{AC_FUNC_VFORK} +@item AC_VPRINTF +@maindex VPRINTF +@code{AC_FUNC_VPRINTF} +@item AC_WAIT3 +@maindex WAIT3 +@code{AC_FUNC_WAIT3} +@item AC_WARN +@maindex WARN +@code{AC_MSG_WARN} +@item AC_WORDS_BIGENDIAN +@maindex WORDS_BIGENDIAN +@code{AC_C_BIGENDIAN} +@item AC_YYTEXT_POINTER +@maindex YYTEXT_POINTER +@code{AC_DECL_YYTEXT} +@end table + +@node Environment Variable Index, Output Variable Index, Old Macro Names, 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, 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 Macro Index, , Preprocessor Symbol Index, Top +@unnumbered 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 + +@contents +@bye diff --git a/autoheader.m4 b/autoheader.m4 new file mode 100644 index 0000000..cb411b0 --- /dev/null +++ b/autoheader.m4 @@ -0,0 +1,110 @@ +dnl Driver and redefinitions of some Autoconf macros for autoheader. +dnl This file is part of Autoconf. +dnl Copyright (C) 1994, 1995 Free Software Foundation, Inc. +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl Written by Roland McGrath. +dnl +include(acgeneral.m4)dnl +builtin(include, acspecific.m4)dnl +builtin(include, acoldnames.m4)dnl + +dnl These are alternate definitions of some macros, which produce +dnl strings in the output marked with "@@@" so we can easily extract +dnl the information we want. The `#' at the end of the first line of +dnl each definition seems to be necessary to prevent m4 from eating +dnl the newline, which makes the @@@ not always be at the beginning of +dnl a line. + +define([AC_CHECK_FUNCS], [# +@@@funcs="$funcs $1"@@@ +ifelse([$2], , , [ +# If it was found, we do: +$2 +# If it was not found, we do: +$3 +]) +]) + +define([AC_CHECK_HEADERS], [# +@@@headers="$headers $1"@@@ +ifelse([$2], , , [ +# If it was found, we do: +$2 +# If it was not found, we do: +$3 +]) +]) + +define([AC_CHECK_HEADERS_DIRENT], [# +@@@headers="$headers $1"@@@ +]) + +define([AC_CHECK_LIB], [# + ifelse([$3], , [ +@@@libs="$libs $1"@@@ +], [ +# If it was found, we do: +$3 +# If it was not found, we do: +$4 +]) +]) + +define([AC_HAVE_LIBRARY], [# +changequote(<<, >>)dnl +define(<>, dnl +patsubst(patsubst($1, <>, <<\1>>), <<-l>>, <<>>))dnl +changequote([, ])dnl + ifelse([$2], , [ +@@@libs="$libs AC_LIB_NAME"@@@ +], [ +# If it was found, we do: +$2 +# If it was not found, we do: +$3 +]) +]) + +define([AC_CHECK_SIZEOF], [# +@@@types="$types,$1"@@@ +]) + +define([AC_CONFIG_HEADER], [# +define([AC_CONFIG_H], patsubst($1, [ .*$], []))dnl +@@@config_h=AC_CONFIG_H@@@ +]) + +define([AC_DEFINE], [# +ifelse([$3],,[# +@@@syms="$syms $1"@@@ +], [# +@@@verbatim="$verbatim +/* $3 */ +#undef $1 +"@@@ +])]) + +define([AC_DEFINE_UNQUOTED], [# +ifelse([$3],,[# +@@@syms="$syms $1"@@@ +], [# +@@@verbatim="$verbatim +/* $3 */ +#undef $1 +"@@@ +])]) diff --git a/autoheader.sh b/autoheader.sh new file mode 100644 index 0000000..196c16d --- /dev/null +++ b/autoheader.sh @@ -0,0 +1,279 @@ +#! @SHELL@ +# autoheader -- create `config.h.in' from `configure.in' +# Copyright (C) 1992, 1993, 1994, 1996, 1998 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# If given no args, create `config.h.in' from template file `configure.in'. +# With one arg, create a header file on standard output from +# the given template file. + +usage="\ +Usage: autoheader [-h] [--help] [-m dir] [--macrodir=dir] + [-l dir] [--localdir=dir] [--version] [template-file]" + +# 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 + +test -z "${AC_MACRODIR}" && AC_MACRODIR=@datadir@ +test -z "${M4}" && M4=@M4@ +case "${M4}" in +/*) # Handle the case that m4 has moved since we were configured. + # It may have been found originally in a build directory. + test -f "${M4}" || M4=m4 ;; +esac + +localdir=. +show_version=no + +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) + echo "${usage}"; exit 0 ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; + --macrodir=* | --m*=* ) + AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -m | --macrodir | --m* ) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + AC_MACRODIR="${1}" + shift ;; + --version | --v* ) + show_version=yes; shift ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "${usage}" 1>&2; exit 1 ;; + * ) + break ;; + esac +done + +if test $show_version = yes; then + version=`sed -n 's/define.AC_ACVERSION.[ ]*\([0-9.]*\).*/\1/p' \ + $AC_MACRODIR/acgeneral.m4` + echo "Autoconf version $version" + exit 0 +fi + +TEMPLATES="${AC_MACRODIR}/acconfig.h" +test -r $localdir/acconfig.h && TEMPLATES="${TEMPLATES} $localdir/acconfig.h" + +case $# in + 0) infile=configure.in ;; + 1) infile=$1 ;; + *) echo "$usage" >&2; exit 1 ;; +esac + +config_h=config.h +syms= +types= +funcs= +headers= +libs= + +if test "$localdir" != .; then + use_localdir="-I$localdir -DAC_LOCALDIR=$localdir" +else + use_localdir= +fi + +# Use the frozen version of Autoconf if available. +r= f= +# 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*) test -r $AC_MACRODIR/autoheader.m4f && { r=--reload f=f; } ;; +*traditional*) ;; +*) echo Autoconf requires GNU m4 1.1 or later >&2; exit 1 ;; +esac + +# Extract assignments of SYMS, TYPES, FUNCS, HEADERS, and LIBS from the +# modified autoconf processing of the input file. The sed hair is +# necessary to win for multi-line macro invocations. +eval "`$M4 -I$AC_MACRODIR $use_localdir $r autoheader.m4$f $infile | + sed -n -e ' + : again + /^@@@.*@@@$/s/^@@@\(.*\)@@@$/\1/p + /^@@@/{ + s/^@@@//p + n + s/^/@@@/ + b again + }'`" + +# 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. +syms="`for sym in $syms; do echo $sym; done | sort | uniq | sed 's@^@ @'`" + +if test $# -eq 0; then + tmpout=autoh$$ + trap "rm -f $tmpout; exit 1" 1 2 15 + exec > $tmpout +fi + +# Support "outfile[:infile]", defaulting infile="outfile.in". +case "$config_h" in +*:*) 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 </dev/null && + sed '/@TOP@/,$d' $localdir/acconfig.h + +# This puts each template paragraph on its own line, separated by @s. +if test -n "$syms"; then + # Make sure the boundary of template files is also the boundary + # of the paragraph. Extra newlines don't hurt since they will + # be removed. + # Undocumented useless feature: stuff outside of @TOP@ and @BOTTOM@ + # is ignored in the systemwide acconfig.h too. + for t in $TEMPLATES; do + sedscript="" + grep @TOP@ $t >/dev/null && sedscript="1,/@TOP@/d;" + grep @BOTTOM@ $t >/dev/null && sedscript="$sedscript /@BOTTOM@/,\$d;" + # This substitution makes "#undefFOO" in acconfig.h work. + sed -n -e "$sedscript s/ / /g; p" $t + echo; echo + done | + # The sed script is suboptimal because it has to take care of + # some broken seds (e.g. AIX) that remove '\n' from the + # pattern/hold space if the line is empty. (junio@twinsun.com). + sed -n -e ' + /^[ ]*$/{ + x + s/\n/@/g + p + s/.*/@/ + x + } + H' | sed -e 's/@@*/@/g' | + # Select each paragraph that refers to a symbol we picked out above. + # Some fgrep's have limits on the number of lines that can be in the + # pattern on the command line, so use a temporary file containing the + # pattern. + (fgrep_tmp=${TMPDIR-/tmp}/autoh$$ + trap "rm -f $fgrep_tmp; exit 1" 1 2 15 + cat > $fgrep_tmp < header file. */ +#undef HAVE_${sym}" + done +fi + +if test -n "$libs"; then + for lib in `for x in $libs; do echo $x; done | sort | uniq`; do + sym="`echo ${lib} | sed 's/[^a-zA-Z0-9_]/_/g' | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`" + echo " +/* Define if you have the ${lib} library (-l${lib}). */ +#undef HAVE_LIB${sym}" + done +fi + +if test -n "$verbatim"; then + echo "$verbatim" +fi + +# 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 +test -f ${config_h}.bot && cat ${config_h}.bot + +status=0 + +if test -n "$syms"; then + for sym in $syms; do + if fgrep $sym $TEMPLATES >/dev/null; then + : # All is well. + else + echo "$0: Symbol \`${sym}' is not covered by $TEMPLATES" >&2 + status=1 + fi + done +fi + +if test $# -eq 0; then + if test $status -eq 0; then + if test -f ${config_h_in} && cmp -s $tmpout ${config_h_in}; then + rm -f $tmpout # File didn't change, so don't update its mod time. + else + mv -f $tmpout ${config_h_in} + fi + else + rm -f $tmpout + fi +fi + +exit $status diff --git a/autoreconf.sh b/autoreconf.sh new file mode 100644 index 0000000..99770bb --- /dev/null +++ b/autoreconf.sh @@ -0,0 +1,204 @@ +#! @SHELL@ +# autoreconf - remake all Autoconf configure scripts in a directory tree +# Copyright (C) 1994 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. + +usage="\ +Usage: autoreconf [-f] [-h] [--help] [-m dir] [--macrodir=dir] + [-l dir] [--localdir=dir] [--force] [--verbose] [--version] + [--cygnus] [--foreign] [--gnits] [--gnu] [-i] [--include-deps]" + +localdir= +verbose=no +show_version=no +force=no +automake_mode=--gnu +automake_deps= + +test -z "$AC_MACRODIR" && AC_MACRODIR=@datadir@ + +while test $# -gt 0; do + case "$1" in + -h | --help | --h*) + echo "$usage"; exit 0 ;; + --localdir=* | --l*=* ) + localdir="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -l | --localdir | --l*) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + localdir="${1}" + shift ;; + --macrodir=* | --m*=* ) + AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" + shift ;; + -m | --macrodir | --m*) + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + AC_MACRODIR="$1" + shift ;; + --verbose | --verb*) + verbose=yes; shift ;; + -f | --force) + force=yes; shift ;; + --version | --vers*) + show_version=yes; shift ;; + --cygnus | --foreign | --gnits | --gnu) + automake_mode=$1; shift ;; + --include-deps | -i) + automake_deps=$1; shift ;; + --) # Stop option processing. + shift; break ;; + -*) echo "$usage" 1>&2; exit 1 ;; + *) break ;; + esac +done + +if test $show_version = yes; then + version=`sed -n 's/define.AC_ACVERSION.[ ]*\([0-9.]*\).*/\1/p' \ + $AC_MACRODIR/acgeneral.m4` + echo "Autoconf version $version" + exit 0 +fi + +if test $# -ne 0; then + echo "$usage" 1>&2; exit 1 +fi + +# The paths to the autoconf and autoheader scripts, at the top of the tree. +top_autoconf=`echo $0|sed s%autoreconf%autoconf%` +top_autoheader=`echo $0|sed s%autoreconf%autoheader%` + +# Make a list of directories to process. +# The xargs grep filters out Cygnus configure.in files. +find . -name configure.in -print | +xargs grep -l AC_OUTPUT | +sed 's%/configure\.in$%%; s%^./%%' | +while read dir; do + ( + cd $dir || continue + + case "$dir" in + .) dots= ;; + *) # A "../" for each directory in /$dir. + dots=`echo /$dir|sed 's%/[^/]*%../%g'` ;; + esac + + case "$0" in + /*) autoconf=$top_autoconf; autoheader=$top_autoheader ;; + */*) autoconf=$dots$top_autoconf; autoheader=$dots$top_autoheader ;; + *) autoconf=$top_autoconf; autoheader=$top_autoheader ;; + esac + + case "$AC_MACRODIR" in + /*) macrodir_opt="--macrodir=$AC_MACRODIR" ;; + *) macrodir_opt="--macrodir=$dots$AC_MACRODIR" ;; + esac + + case "$localdir" in + "") localdir_opt= + aclocal=aclocal.m4 ;; + /*) localdir_opt="--localdir=$localdir" + aclocal=$localdir/aclocal.m4 ;; + *) localdir_opt="--localdir=$dots$localdir" + aclocal=$dots$localdir/aclocal.m4 ;; + esac + + # Regenerate aclocal.m4 if necessary. FIXME: if aclocal searches + # nonstandard directories, we need to deal with that here. The + # easiest way is to move this info into configure.in. + run_aclocal=no + if test -f "$aclocal" && + grep 'generated automatically by aclocal' $aclocal > /dev/null + then + run_aclocal=yes + else + if test -f `echo $aclocal | sed 's,/*[^/]*$,,;s,^$,.,'`/acinclude.m4 + then + run_aclocal=yes + fi + fi + if test $run_aclocal = yes + then + if test $force = no && + ls -lt configure.in $aclocal \ + `echo $aclocal | sed 's,/*[^/]*$,,;s,^$,.,'`/acinclude.m4 | + sed 1q | + grep 'aclocal\.m4$' > /dev/null + then + : + else + test $verbose = yes && echo running aclocal in $dir, creating $aclocal + aclocal --output=$aclocal -I `echo $aclocal | sed 's,/*[^/]*$,,;s,^$,.,'` + fi + fi + + # Re-run automake if required. Assumes that there is a Makefile.am + # in the topmost directory. + if test -f Makefile.am + then + amforce= + test $force = no && amforce=--no-force + test $verbose = yes && echo running automake`test x"$amforce" = x || echo " ($amforce)"` in $dir + automake $amforce $automake_mode $automake_deps + fi + + test ! -f $aclocal && aclocal= + + if test $force = no && test -f configure && + ls -lt configure configure.in $aclocal | sed 1q | + grep 'configure$' > /dev/null + then + : + else + test $verbose = yes && echo running autoconf in $dir + $autoconf $macrodir_opt $localdir_opt + fi + + if grep 'A[CM]_CONFIG_HEADER' configure.in >/dev/null; then + templates=`sed -n '/A[CM]_CONFIG_HEADER/ { + s%[^#]*A[CM]_CONFIG_HEADER[ ]*(\([^)]*\).*%\1% + p + q + }' configure.in` + tcount=`set -- $templates; echo $#` + template=`set -- $templates; echo $1 | sed ' + s/.*:// + t colon + s/$/.in/ + : colon + s/:.*// + '` + stamp=`echo $template | sed 's,/*[^/]*$,,;s,^$,.,'`/stamp-h`test "$tcount" -gt 1 && echo "$tcount"`.in + if test ! -f "$template" || grep autoheader "$template" >/dev/null; then + if test $force = no && test -f $template && + ls -lt $template configure.in $aclocal $stamp 2>/dev/null \ + `echo $localdir_opt | sed -e 's/--localdir=//' \ + -e '/./ s%$%/%'`acconfig.h | + sed 1q | egrep "$template$|$stamp$" > /dev/null + then + : + else + test $verbose = yes && echo running autoheader in $dir + $autoheader $macrodir_opt $localdir_opt && + { test $verbose != yes || echo touching $stamp; } && + touch $stamp + fi + fi + fi + ) +done diff --git a/autoscan.pl b/autoscan.pl new file mode 100644 index 0000000..3285236 --- /dev/null +++ b/autoscan.pl @@ -0,0 +1,395 @@ +#! @PERL@ +# autoscan - Create configure.scan (a preliminary configure.in) for a package. +# Copyright (C) 1994 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 . + +require "find.pl"; + +$datadir = $ENV{"AC_MACRODIR"} || "@datadir@"; +$verbose = 0; +# Reference these variables to pacify perl -w. +undef %identifiers_macros; +undef %makevars_macros; +undef %programs_macros; + +&parse_args; +&init_tables; +&find('.'); +&scan_files; +&output; + +exit 0; + +# Process any command line arguments. +sub parse_args +{ + local ($usage) = + "Usage: autoscan [--macrodir=dir] [--help] [--verbose] [--version] [srcdir]\n"; + + foreach $_ (@ARGV) { + if (/^--m[a-z]*=(.*)/) { + $datadir = $1; + } elsif (/^--h/) { + print "$usage"; + exit 0; + } elsif (/^--verb/) { + $verbose = 1; + } elsif (/^--vers/) { + &version; + } elsif (/^[^-]/) { + die "$usage" if defined($srcdir); + # Top level directory of the package being autoscanned. + $srcdir = $_; + } else { + die "$usage"; + } + } + + $srcdir="." if !defined($srcdir); + + print "srcdir=$srcdir\n" if $verbose; + chdir $srcdir || die "$0: cannot cd to $srcdir: $!\n"; + + open(CONF, ">configure.scan") || + die "$0: cannot create configure.scan: $!\n"; +} + +# Print the version number and exit. +sub version +{ + open(ACG, "<$datadir/acgeneral.m4") || + die "$0: cannot open $datadir/acgeneral.m4: $!\n"; + while () { + if (/define.AC_ACVERSION.\s*([0-9.]+)/) { + print "Autoconf version $1\n"; + exit 0; + } + } + die "Autoconf version unknown\n"; +} + +# Put values in the tables of what to do with each token. +sub init_tables +{ + local($kind, $word, $macro); + + # 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 $word ('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{$word} = 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.in files. + + foreach $kind ('functions', 'headers', 'identifiers', 'programs', + 'makevars') { + open(TABLE, "<$datadir/ac$kind") || + die "$0: cannot open $datadir/ac$kind: $!\n"; + while () { + next if /^\s*$/ || /^\s*#/; # Ignore blank lines and comments. + ($word, $macro) = split; + eval "\$$kind" . "_macros{\$word} = \$macro"; + } + close(TABLE); + } +} + +# Collect names of various kinds of files in the package. +# Called by &find on each file. +sub wanted +{ + if (/^.*\.[chlymC]$/ || /^.*\.cc$/) { + $name =~ s?^\./??; push(@cfiles, $name); + } + elsif (/^[Mm]akefile$/ || /^[Mm]akefile\.in$/ || /^GNUmakefile$/) { + $name =~ s?^\./??; push(@makefiles, $name); + } + elsif (/^.*\.sh$/) { + $name =~ s?^\./??; push(@shfiles, $name); + } +} + +# Read through the files and collect lists of tokens in them +# that might create nonportabilities. +sub scan_files +{ + $initfile = $cfiles[0]; # Pick one at random. + + if ($verbose) { + print "cfiles:", join(" ", @cfiles), "\n"; + print "makefiles:", join(" ", @makefiles), "\n"; + print "shfiles:", join(" ", @shfiles), "\n"; + } + + foreach $file (@cfiles) { + &scan_c_file($file); + } + + foreach $file (@makefiles) { + &scan_makefile($file); + } + + foreach $file (@shfiles) { + &scan_sh_file($file); + } +} + +sub scan_c_file +{ + local($file) = @_; + local($in_comment) = 0; # Nonzero if in a multiline comment. + + open(CFILE, "<$file") || die "$0: cannot open $file: $!\n"; + while () { + # 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*<([^>]*)>/) { + $headers{$1}++; + } + # 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/\W([a-zA-Z_]\w*)\s*\(/ /) { + $functions{$1}++ if !defined($c_keywords{$1}); + } + while (s/\W([a-zA-Z_]\w*)\W/ /) { + $identifiers{$1}++ if !defined($c_keywords{$1}); + } + } + close(CFILE); + + if ($verbose) { + local($word); + + print "\n$file functions:\n"; + foreach $word (sort keys %functions) { + print "$word $functions{$word}\n"; + } + + print "\n$file identifiers:\n"; + foreach $word (sort keys %identifiers) { + print "$word $identifiers{$word}\n"; + } + + print "\n$file headers:\n"; + foreach $word (sort keys %headers) { + print "$word $headers{$word}\n"; + } + } +} + +sub scan_makefile +{ + local($file) = @_; + + open(MFILE, "<$file") || die "$0: cannot open $file: $!\n"; + while () { + # Strip out comments and variable references. + s/#.*//; + s/\$\([^\)]*\)//g; + s/\${[^\}]*}//g; + s/@[^@]*@//g; + + # Variable assignments. + while (s/\W([a-zA-Z_]\w*)\s*=/ /) { + $makevars{$1}++; + } + # Libraries. + while (s/\W-l([a-zA-Z_]\w*)\W/ /) { + $libraries{$1}++; + } + # Tokens in the code. + while (s/\W([a-zA-Z_]\w*)\W/ /) { + $programs{$1}++; + } + } + close(MFILE); + + if ($verbose) { + local($word); + + print "\n$file makevars:\n"; + foreach $word (sort keys %makevars) { + print "$word $makevars{$word}\n"; + } + + print "\n$file libraries:\n"; + foreach $word (sort keys %libraries) { + print "$word $libraries{$word}\n"; + } + + print "\n$file programs:\n"; + foreach $word (sort keys %programs) { + print "$word $programs{$word}\n"; + } + } +} + +sub scan_sh_file +{ + local($file) = @_; + + open(MFILE, "<$file") || die "$0: cannot open $file: $!\n"; + while () { + # Strip out comments and variable references. + s/#.*//; + s/\${[^\}]*}//g; + s/@[^@]*@//g; + + # Tokens in the code. + while (s/\W([a-zA-Z_]\w*)\W/ /) { + $programs{$1}++; + } + } + close(MFILE); + + if ($verbose) { + local($word); + + print "\n$file programs:\n"; + foreach $word (sort keys %programs) { + print "$word $programs{$word}\n"; + } + } +} + +# Print a configure.in. +sub output +{ + local (%unique_makefiles); + + print CONF "dnl Process this file with autoconf to produce a configure script.\n"; + print CONF "AC_INIT($initfile)\n"; + + &output_programs; + &output_headers; + &output_identifiers; + &output_functions; + + # Change DIR/Makefile.in to DIR/Makefile. + foreach $_ (@makefiles) { + s/\.in$//; + $unique_makefiles{$_}++; + } + print CONF "\nAC_OUTPUT(", join(" ", keys(%unique_makefiles)), ")\n"; + + close CONF; +} + +# Print Autoconf macro $1 if it's not undef and hasn't been printed already. +sub print_unique +{ + local($macro) = @_; + + if (defined($macro) && !defined($printed{$macro})) { + print CONF "$macro\n"; + $printed{$macro} = 1; + } +} + +sub output_programs +{ + local ($word); + + print CONF "\ndnl Checks for programs.\n"; + foreach $word (sort keys %programs) { + &print_unique($programs_macros{$word}); + } + foreach $word (sort keys %makevars) { + &print_unique($makevars_macros{$word}); + } + print CONF "\ndnl Checks for libraries.\n"; + foreach $word (sort keys %libraries) { + print CONF "dnl Replace `\main\' with a function in -l$word:\n"; + print CONF "AC_CHECK_LIB($word, main)\n"; + } +} + +sub output_headers +{ + local ($word); + + print CONF "\ndnl Checks for header files.\n"; + foreach $word (sort keys %headers) { + if (defined($headers_macros{$word}) && + $headers_macros{$word} eq 'AC_CHECK_HEADERS') { + push(@have_headers, $word); + } else { + &print_unique($headers_macros{$word}); + } + } + print CONF "AC_CHECK_HEADERS(" . join(' ', sort(@have_headers)) . ")\n" + if defined(@have_headers); +} + +sub output_identifiers +{ + local ($word); + + print CONF "\ndnl Checks for typedefs, structures, and compiler characteristics.\n"; + foreach $word (sort keys %identifiers) { + &print_unique($identifiers_macros{$word}); + } +} + +sub output_functions +{ + local ($word); + + print CONF "\ndnl Checks for library functions.\n"; + foreach $word (sort keys %functions) { + if (defined($functions_macros{$word}) && + $functions_macros{$word} eq 'AC_CHECK_FUNCS') { + push(@have_funcs, $word); + } else { + &print_unique($functions_macros{$word}); + } + } + print CONF "AC_CHECK_FUNCS(" . join(' ', sort(@have_funcs)) . ")\n" + if defined(@have_funcs); +} diff --git a/autoupdate.sh b/autoupdate.sh new file mode 100644 index 0000000..c92e023 --- /dev/null +++ b/autoupdate.sh @@ -0,0 +1,113 @@ +#! @SHELL@ +# autoupdate - modernize a configure.in +# Copyright (C) 1994 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 given no args, update `configure.in'; +# With one arg, write on the standard output from the given template file. +# +# Written by David MacKenzie + +usage="\ +Usage: autoupdate [-h] [--help] [-m dir] [--macrodir=dir] + [--version] [template-file]" + +sedtmp=/tmp/acups.$$ +# For debugging. +#sedtmp=/tmp/acups +show_version=no +test -z "${AC_MACRODIR}" && AC_MACRODIR=@datadir@ + +while test $# -gt 0 ; do + case "${1}" in + -h | --help | --h* ) + echo "${usage}" 1>&2; exit 0 ;; + --macrodir=* | --m*=* ) + AC_MACRODIR="`echo \"${1}\" | sed -e 's/^[^=]*=//'`" + shift ;; + -m | --macrodir | --m* ) + shift + test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; } + AC_MACRODIR="${1}" + shift ;; + --version | --versio | --versi | --vers) + show_version=yes; shift ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "${usage}" 1>&2; exit 1 ;; + * ) + break ;; + esac +done + +if test $show_version = yes; then + version=`sed -n 's/define.AC_ACVERSION.[ ]*\([0-9.]*\).*/\1/p' \ + $AC_MACRODIR/acgeneral.m4` + echo "Autoconf version $version" + exit 0 +fi + +: ${SIMPLE_BACKUP_SUFFIX='~'} + +tmpout=acupo.$$ +trap 'rm -f $sedtmp $tmpout; exit 1' 1 2 15 +case $# in + 0) infile=configure.in; out="> $tmpout" + # Make sure $infile can be read, and $tmpout has the same permissions. + cp $infile $tmpout || exit + + # Make sure $infile can be written. + if test ! -w $infile; then + rm -f $tmpout + echo "$0: $infile: cannot write" >&2 + exit 1 + fi + ;; + 1) infile="$1"; out= ;; + *) echo "$usage" >&2; exit 1 ;; +esac + +# Turn the m4 macro file into a sed script. +# For each old macro name, make one substitution command to replace it +# at the end of a line, and one when followed by ( or whitespace. +# That is easier than splitting the macros up into those that take +# arguments and those that don't. +sed -n -e ' +/^AC_DEFUN(/ { + s//s%/ + s/, *\[indir(\[/$%/ + s/\].*/%/ + p + s/\$// + s/%/^/ + s/%/\\([( ]\\)^/ + s/%/\\1^/ + s/\^/%/g + p +}' ${AC_MACRODIR}/acoldnames.m4 > $sedtmp +eval sed -f $sedtmp $infile $out + +case $# in + 0) mv configure.in configure.in${SIMPLE_BACKUP_SUFFIX} && + mv $tmpout configure.in ;; +esac + +rm -f $sedtmp $tmpout +exit 0 diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..2960d6e --- /dev/null +++ b/config.guess @@ -0,0 +1,951 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. +# +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner . +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <dummy.s + .globl main + .ent main +main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + ${CC-cc} dummy.s -o dummy 2>/dev/null + if test "$?" = 0 ; then + ./dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + fi + rm -f dummy.s dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + arm32:NetBSD:*:*) + echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + macppc:NetBSD:*:*) + echo powerpc-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >dummy.c + int main (argc, argv) int argc; char **argv; { + #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-cc} dummy.c -o dummy \ + && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 ) + sed 's/^ //' << EOF >dummy.c + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy` + rm -f dummy.c dummy + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + # uname on the ARM produces all sorts of strangeness, and we need to + # filter it out. + case "$UNAME_MACHINE" in + arm* | sa110*) UNAME_MACHINE="arm" ;; + esac + + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. + ld_help_string=`ld --help 2>&1` + ld_supported_emulations=`echo $ld_help_string \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; + i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; + sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + sed 's/^ //' <dummy.s + .globl main + .ent main + main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + LIBC="" + ${CC-cc} dummy.s -o dummy 2>/dev/null + if test "$?" = 0 ; then + ./dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + + objdump --private-headers dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f dummy.s dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >dummy.c </dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + else + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" + test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >dummy.c < +main(argc, argv) + int argc; + char *argv[]; +{ +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + fi ;; +# 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. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i?86:UnixWare:*:*) + if /bin/uname -X 2>/dev/null >/dev/null ; then + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + fi + echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION} + exit 0 ;; + pc:*:*:*) + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + printf ("%s-next-nextstep%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) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..00bea6e --- /dev/null +++ b/config.sub @@ -0,0 +1,955 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ + | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ + | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ + | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ + | mipstx39 | mipstx39el \ + | sparc | sparclet | sparclite | sparc64 | v850) + basic_machine=$basic_machine-unknown + ;; + # 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[34567]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ + | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ + | alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ + | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mipstx39-* | mipstx39el-* \ + | f301-*) + ;; + # 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) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + np1) + basic_machine=np1-gould + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | nexen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | k6 | 6x86) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | nexen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | k6-* | 6x86-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -hpux*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/configure b/configure new file mode 100755 index 0000000..7c2ad02 --- /dev/null +++ b/configure @@ -0,0 +1,1017 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=acgeneral.m4 + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + + +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:551: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_M4'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$M4" in + /*) + ac_cv_path_M4="$M4" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_M4="$M4" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_M4="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + ;; +esac +fi +M4="$ac_cv_path_M4" +if test -n "$M4"; then + echo "$ac_t""$M4" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$M4" && break +done +test -n "$M4" || M4="m4" + +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 $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:592: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_AWK="$ac_prog" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +AWK="$ac_cv_prog_AWK" +if test -n "$AWK"; then + echo "$ac_t""$AWK" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +test -n "$AWK" && break +done + + +# Extract the first word of "perl", so it can be a program name with args. +set dummy perl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:625: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$PERL" in + /*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_PERL="$PERL" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_PERL="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="no" + ;; +esac +fi +PERL="$ac_cv_path_PERL" +if test -n "$PERL"; then + echo "$ac_t""$PERL" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test "$PERL" != no; then + SCRIPTS=autoscan +else + echo "configure: warning: autoscan will not be built since perl is not found" 1>&2 +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:695: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# Work with the GNU or Cygnus source tree layout. +if test -f $srcdir/standards.texi; then + standards_info=standards.info standards_dvi=standards.dvi +fi + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +# Transform confdefs.h into DEFS. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs + + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile testsuite/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@M4@%$M4%g +s%@AWK@%$AWK%g +s%@PERL@%$PERL%g +s%@SCRIPTS@%$SCRIPTS%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@standards_info@%$standards_info%g +s%@standards_dvi@%$standards_dvi%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..f1a8986 --- /dev/null +++ b/configure.in @@ -0,0 +1,32 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(acgeneral.m4) + +AC_ARG_PROGRAM + +dnl We use a path for GNU m4 so even if users have another m4 first in +dnl their path, the installer can configure with a path that has GNU m4 +dnl first and get that path embedded in the installed autoconf and +dnl autoheader scripts. +AC_PATH_PROGS(M4, gm4 gnum4 m4, m4) +AC_PROG_AWK + +dnl 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(SCRIPTS)dnl +if test "$PERL" != no; then + SCRIPTS=autoscan +else + AC_MSG_WARN(autoscan will not be built since perl is not found) +fi + +AC_PROG_INSTALL + +# Work with the GNU or Cygnus source tree layout. +if test -f $srcdir/standards.texi; then + standards_info=standards.info standards_dvi=standards.dvi +fi +AC_SUBST(standards_info)dnl +AC_SUBST(standards_dvi)dnl + +AC_OUTPUT(Makefile testsuite/Makefile) diff --git a/ifnames.sh b/ifnames.sh new file mode 100644 index 0000000..cb0158b --- /dev/null +++ b/ifnames.sh @@ -0,0 +1,101 @@ +#! @SHELL@ +# ifnames - print the identifiers used in C preprocessor conditionals +# Copyright (C) 1994, 1995 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 +# and Paul Eggert . + +usage="\ +Usage: ifnames [-h] [--help] [-m dir] [--macrodir=dir] [--version] [file...]" +show_version=no + +: ${AC_MACRODIR=@datadir@} + +while test $# -gt 0; do + case "$1" in + -h | --help | --h* ) + echo "$usage"; exit 0 ;; + --macrodir=* | --m*=* ) + AC_MACRODIR="`echo \"$1\" | sed -e 's/^[^=]*=//'`" + shift ;; + -m | --macrodir | --m* ) + shift + test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } + AC_MACRODIR="$1" + shift ;; + --version | --versio | --versi | --vers) + show_version=yes; shift ;; + --) # Stop option processing. + shift; break ;; + -*) echo "$usage" 1>&2; exit 1 ;; + *) break ;; + esac +done + +if test $show_version = yes; then + version=`sed -n 's/define.AC_ACVERSION.[ ]*\([0-9.]*\).*/\1/p' \ + $AC_MACRODIR/acgeneral.m4` + echo "Autoconf version $version" + exit 0 +fi + +@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) + } + } + } + + /^[\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/install-sh b/install-sh new file mode 100755 index 0000000..e9de238 --- /dev/null +++ b/install-sh @@ -0,0 +1,251 @@ +#!/bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, 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 M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# 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. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + chmodcmd="" + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# 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 $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/install.texi b/install.texi new file mode 100644 index 0000000..f26dfcd --- /dev/null +++ b/install.texi @@ -0,0 +1,209 @@ +@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, a file @file{config.cache} that saves the results +of its tests to speed up reconfiguring, and a file @file{config.log} +containing compiler output (useful mainly for debugging +@code{configure}). + +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 at some point +@file{config.cache} contains results you don't want to keep, you may +remove or edit it. + +The file @file{configure.in} is used to create @file{configure} by a +program called @code{autoconf}. You only need @file{configure.in} 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. You can give +@code{configure} initial values for variables by setting them in the +environment. Using a Bourne-compatible shell, you can do that on the +command line like this: +@example +CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure +@end example + +@noindent +Or on systems that have the @code{env} program, you can do it like this: +@example +env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure +@end example + +@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 supports 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 @samp{--prefix=@var{path}}. + +You can specify separate installation prefixes for architecture-specific +files and architecture-independent files. If you give @code{configure} +the option @samp{--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 @samp{--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 @samp{--program-prefix=@var{PREFIX}} or +@samp{--program-suffix=@var{SUFFIX}}. + +@node Optional Features +@section Optional Features + +Some packages pay attention to @samp{--enable-@var{feature}} options to +@code{configure}, where @var{feature} indicates an optional part of the +package. They may also pay attention to @samp{--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 +@samp{--enable-} and @samp{--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 @samp{--x-includes=@var{dir}} +and @samp{--x-libraries=@var{dir}} to specify their locations. + +@node System Type +@section Specifying the System Type + +There may be some features @code{configure} can not 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 can not guess the host type, give it the +@samp{--host=@var{type}} option. @var{type} can either be a short name +for the system type, such as @samp{sun4}, or a canonical name with three +fields: +@example +@var{cpu}-@var{company}-@var{system} +@end example +@noindent +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 building compiler tools for cross-compiling, you can also use +the @samp{--target=@var{type}} option to select the type of system +they will produce code for and the @samp{--build=@var{type}} option +to select the type of system on which you are compiling the package. + +@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 Operation Controls +@section Operation Controls + +@code{configure} recognizes the following options to control how it +operates. + +@table @code +@item --cache-file=@var{file} +Use and save the results of the tests in @var{file} instead of +@file{./config.cache}. Set @var{file} to @file{/dev/null} to disable +caching, for debugging @code{configure}. + +@item --help +Print a summary of the options to @code{configure}, and exit. + +@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. + +@item --version +Print the version of Autoconf used to generate the @code{configure} +script, and exit. +@end table + +@noindent +@code{configure} also accepts some other, not widely useful, options. diff --git a/make-stds.texi b/make-stds.texi new file mode 100644 index 0000000..41fb212 --- /dev/null +++ b/make-stds.texi @@ -0,0 +1,894 @@ +@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. + +@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 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 each of these should be +@code{$(INSTALL)}.) 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 + +@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, 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 @samp +@item 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@@}.) + +@item 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. +@end table + +Executable programs are installed in one of the following directories. + +@table @samp +@item 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 +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 +@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 +$(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 $@@; \ +# 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=$(infodir)/dir \ + $(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 many cases, the definition of this target can be very simple: + +@smallexample +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ + install +@end smallexample + +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 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 + +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/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..70f983f --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.12.2.1 1998/12/26 17:32:14 bje Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/standards.info b/standards.info new file mode 100644 index 0000000..1b111f9 --- /dev/null +++ b/standards.info @@ -0,0 +1,3837 @@ +This is Info file standards.info, produced by Makeinfo version 1.67 +from the input file /home/bje/autoconf-2.13/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 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 August 26, 1998. + +* Menu: + +* Preface:: About the GNU Coding Standards +* Intellectual Property:: 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 + + +File: standards.info, Node: Preface, Next: Intellectual Property, Prev: Top, Up: Top + +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. + + Corrections or suggestions for this document should be sent to +. 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. + + This release of the GNU Coding Standards was last updated August 26, +1998. + + +File: standards.info, Node: Intellectual Property, Next: Design Advice, Prev: Preface, Up: Top + +Keeping Free Software Free +************************** + + This node discusses how you can make sure that GNU software remains +unencumbered. + +* Menu: + +* Reading Non-Free Code:: Referring to Proprietary Programs +* Contributions:: Accepting Contributions + + +File: standards.info, Node: Reading Non-Free Code, Next: Contributions, Up: Intellectual Property + +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, Prev: Reading Non-Free Code, Up: Intellectual Property + +Accepting Contributions +======================= + + If someone else sends you a piece of code to add to the program you +are working on, we need legal papers to use it--the same sort of legal +papers we will need to get from you. *Each* significant contributor 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. + + 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 you write a different solution to the +problem, you don't need to get papers. + + We know this is frustrating; 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! + + 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: Design Advice, Next: Program Behavior, Prev: Intellectual Property, Up: Top + +General Program Design +********************** + + This node discusses some of the issues you should take into account +when designing your program. + +* Menu: + +* Compatibility:: Compatibility with other implementations +* Using Extensions:: Using non-standard features +* ANSI C:: Using ANSI C features +* Source Language:: Using languages other than C + + +File: standards.info, Node: Compatibility, Next: Using Extensions, Up: Design Advice + +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 ANSI C if ANSI 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. + + ANSI 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. Try to redesign its interface. + + 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 not in Berkeley Unix are welcome. + + +File: standards.info, Node: Using Extensions, Next: ANSI C, Prev: Compatibility, Up: Design Advice + +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. Such programs would +be broken by use of GNU extensions. + + 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 no good. + + +File: standards.info, Node: ANSI C, Next: Source Language, Prev: Using Extensions, Up: Design Advice + +ANSI C and pre-ANSI C +===================== + + Do not ever use the "trigraph" feature of ANSI C. + + ANSI C is widespread enough now that it is ok to write new programs +that use ANSI C features (and therefore will not work in non-ANSI +compilers). And if a program is already written in ANSI C, there's no +need to convert it to support non-ANSI compilers. + + However, it is easy to support non-ANSI compilers in most programs, +so you might still consider doing so when you write a program. Instead +of writing function definitions in ANSI prototype form, + + int + foo (int x, int y) + ... + +write the definition in pre-ANSI 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 ANSI C prototypes in all the files where the function is +called. And once you have it, you lose nothing by writing the function +definition in the pre-ANSI style. + + If you don't know non-ANSI C, there's no need to learn it; just +write in ANSI C. + + +File: standards.info, Node: Source Language, Prev: ANSI C, Up: Design Advice + +Using Languages Other Than C +============================ + + Using a language other than C 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 C++ compiler in order to compile your program. Thus, it is better +if you write in C. + + But there are three situations when there is no disadvantage in using +some other language: + + * It is okay to use another language if your program contains an + interpreter for that language. + + For example, if your program links with GUILE, it is ok to write + part of the program in Scheme or another language supported by + GUILE. + + * It is okay to use another language in a tool specifically intended + for use with that language. + + This is okay 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 to a narrow community, then + perhaps it's not important if the application is inconvenient to + install. + + 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. + + +File: standards.info, Node: Program Behavior, Next: Writing C, Prev: Design Advice, Up: Top + +Program Behavior for All Programs +********************************* + + This node describes how to write 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 for command line interfaces +* Option Table:: Table of long options. +* Memory Usage:: When and how to care about memory needs + + +File: standards.info, Node: Semantics, Next: Libraries, Up: Program Behavior + +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 printers that can't handle those +characters. + + 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 will be 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'. + + +File: standards.info, Node: Libraries, Next: Errors, Prev: Semantics, Up: Program Behavior + +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 `_'. They should also contain 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 + +Formatting Error Messages +========================= + + Error messages from compilers should look like this: + + SOURCE-FILE-NAME:LINENO: MESSAGE + + 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. + + 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: Option Table, Prev: Errors, Up: Program Behavior + +Standards for Command Line Interfaces +===================================== + + 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. + + 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 idiosyncracies for users to remember. + + All programs should support two standard options: `--version' and +`--help'. + +`--version' + This option should direct the program to 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: User Interfaces, Up: Program Behavior + +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 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'. + +`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'. + +`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. + +`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'. + +`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 . + +`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'. + +`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'. + +`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'. + +`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, Prev: Option Table, Up: Program Behavior + +Memory Usage +============ + + If it 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: Writing C, Next: Documentation, Prev: Program Behavior, Up: Top + +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 + +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 ANSI C, format the definition like this: + + static char * + concat (char *s1, char *s2) + { + ... + } + + In ANSI 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) + ... + + For the body of the function, we prefer code formatted 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, +but Emacs would mess it up: + + 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 adding a set of parentheses solves the problem: + + 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 + +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 + +Clean Use of C Constructs +========================= + + Please explicitly declare all arguments to functions. Don't omit +them just because they are `int's. + + 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 + +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. + + 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. + + Use file names of 14 characters or less, to avoid creating gratuitous +problems on older System V systems. You can use the program `doschk' +to test for this. `doschk' also tests for potential name conflicts if +the files were loaded onto an MS-DOS file system--something you may or +may not care about. + + +File: standards.info, Node: System Portability, Next: CPU Portability, Prev: Names, Up: Writing C + +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. The +amount and kinds of variation among GNU systems on different CPUs will +be comparable to the variation among Linux-based GNU systems or among +BSD systems today. So the kinds of portability that are absolutely +necessary are quite limited. + + But many users do run GNU software on non-GNU Unix or Unix-like +systems. So supporting a variety of Unix-like systems is desirable, +although not paramount. + + 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 usually so much work that it +is better if you don't. + + The planned GNU kernel is not finished yet, but you can tell which +facilities it will provide by looking at the GNU C Library Manual. The +GNU kernel is based on Mach, so the features of Mach will also be +available. However, if you use Mach features, you'll probably have +trouble debugging your program today. + + +File: standards.info, Node: CPU Portability, Next: System Functions, Prev: System Portability, Up: Writing C + +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. + + 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 ANSI C, so +you can use prototypes (conditionalized to be active only in ANSI 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; + int a1, a2, a3; + { + fprintf (stderr, "error: "); + fprintf (stderr, s, a1, a2, a3); + } + +In practice, this works on all machines, and it is much simpler than any +"correct" alternative. Be sure *not* to use a prototype for such +functions. + + However, avoid casting pointers to integers unless you really need +to. These assumptions really 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--it is ok to do so, but +you'll have to make explicit provisions to handle different word sizes. + + +File: standards.info, Node: System Functions, Next: Internationalization, Prev: CPU Portability, Up: Writing C + +Calling System Functions +======================== + + C implementations differ substantially. ANSI C reduces but does not +eliminate the incompatibilities; meanwhile, many users wish to compile +GNU software with pre-ANSI compilers. 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 value of `sprintf'. It returns the number of + characters written on some systems, but not on all systems. + + * `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 an ANSI 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 ANSI + 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 ANSI 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 + +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 + +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 + +Documenting Programs +******************** + +* Menu: + +* GNU Manuals:: Writing proper manuals. +* Manual Structure Details:: Specific structure conventions. +* 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: Manual Structure Details, Up: Documentation + +GNU Manuals +=========== + + The preferred way to document part of the GNU system is to write a +manual in the Texinfo formatting language. See the Texinfo manual, +either the hardcopy, or the on-line version available through `info' or +the Emacs Info subsystem (`C-h i'). + + 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 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. + + 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. + + 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 exceptions.) Also Unix man pages use a particular format which +is different from what we use in GNU manuals. + + 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 file 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 violations of law. + + +File: standards.info, Node: Manual Structure Details, Next: NEWS File, Prev: GNU Manuals, Up: Documentation + +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 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. + + There will be automatic features for specifying a program name and +quickly reading just this part of its manual. + + If one manual describes several programs, it should have such a node +for each program described. + + +File: standards.info, Node: NEWS File, Next: Change Logs, Prev: Manual Structure Details, Up: Documentation + +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 + +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:: + + +File: standards.info, Node: Change Log Concepts, Next: Style of Change Logs, Up: Change Logs + +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. + + 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 + +Style of Change Logs +-------------------- + + Here are some examples of change log entries: + + * 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. + + +File: standards.info, Node: Simple Changes, Next: Conditional Changes, Prev: Style of Change Logs, Up: Change Logs + +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, 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." + + * 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, Prev: Simple Changes, Up: Change Logs + +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: Man Pages, Next: Reading other Manuals, Prev: Change Logs, Up: Documentation + +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 + +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, Prev: Documentation, Up: Top + +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 + +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. + +`--nfp' + The target machine has no floating point processor. + +`--gas' + The target machine assembler is GAS, the GNU assembler. This is + obsolete; users should use `--with-gnu-as' instead. + +`--x' + The target machine has the X Window System installed. This is + obsolete; users should use `--with-x' instead. + + 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. + + The way to build a cross-compiler, cross-assembler, or what have +you, is to specify the option `--host=HOSTTYPE' when running +`configure'. This specifies the host system without changing the type +of target system. The syntax for HOSTTYPE is the same as described +above. + + 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=HOSTTYPE' for specifying the +configuration on which you will compile them, in case that is different +from the host. + + Programs for which cross-operation is not meaningful need not accept +the `--host' option, because configuring an entire operating system for +cross-operation is not a meaningful thing. + + 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 + +Makefile Conventions +==================== + + This node describes conventions for writing the Makefiles for GNU +programs. + +* 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 + +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 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 + +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 + +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 each of these should be +`$(INSTALL)'.) 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 + +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 + +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, 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@'.) + +`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. + + 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 + +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: + + $(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 $@; \ + # 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=$(infodir)/dir \ + $(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 many cases, the definition of this target can be very + simple: + + install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' \ + install + + 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 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) + + 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 + +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 + +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. + + 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. + + + +Tag Table: +Node: Top1010 +Node: Preface1554 +Node: Intellectual Property2582 +Node: Reading Non-Free Code2957 +Node: Contributions4689 +Node: Design Advice6683 +Node: Compatibility7200 +Node: Using Extensions8711 +Node: ANSI C10213 +Node: Source Language11449 +Node: Program Behavior12942 +Node: Semantics13651 +Node: Libraries17801 +Node: Errors19036 +Node: User Interfaces20259 +Node: Option Table27131 +Node: Memory Usage41686 +Node: Writing C42680 +Node: Formatting43519 +Node: Comments46791 +Node: Syntactic Conventions50089 +Node: Names53027 +Node: System Portability54763 +Node: CPU Portability56539 +Node: System Functions58700 +Node: Internationalization63804 +Node: Mmap66952 +Node: Documentation67657 +Node: GNU Manuals68215 +Node: Manual Structure Details72102 +Node: NEWS File73432 +Node: Change Logs74113 +Node: Change Log Concepts74830 +Node: Style of Change Logs76598 +Node: Simple Changes78152 +Node: Conditional Changes79343 +Node: Man Pages80720 +Node: Reading other Manuals82339 +Node: Managing Releases83123 +Node: Configuration83859 +Node: Makefile Conventions90799 +Node: Makefile Basics91479 +Node: Utilities in Makefiles94648 +Node: Command Variables96784 +Node: Directory Variables99812 +Node: Standard Targets110394 +Node: Install Command Categories120895 +Node: Releases125468 + +End Tag Table diff --git a/standards.texi b/standards.texi new file mode 100644 index 0000000..6cb685d --- /dev/null +++ b/standards.texi @@ -0,0 +1,3116 @@ +\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 August 26, 1998 +@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 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 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 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 +* Intellectual Property:: 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 +@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. + +Corrections or suggestions for this document should be sent to +@email{gnu@@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. + +This release of the GNU Coding Standards was last updated +@value{lastupdate}. + +@node Intellectual Property +@chapter Keeping Free Software Free + +This @value{CHAPTER} discusses how you can make sure that GNU software +remains unencumbered. + +@menu +* Reading Non-Free Code:: Referring to Proprietary Programs +* Contributions:: Accepting Contributions +@end menu + +@node Reading Non-Free Code +@section 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. + + +@node Contributions +@section Accepting Contributions + +If someone else sends you a piece of code to add to the program you are +working on, we need legal papers to use it---the same sort of legal +papers we will need to get from you. @emph{Each} significant +contributor 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. + +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 you write a different solution to the +problem, you don't need to get papers. + +We know this is frustrating; 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! + +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 Design Advice +@chapter General Program Design + +This @value{CHAPTER} discusses some of the issues you should take into +account when designing your program. + +@menu +* Compatibility:: Compatibility with other implementations +* Using Extensions:: Using non-standard features +* ANSI C:: Using ANSI C features +* Source Language:: Using languages other than C +@end menu + +@node Compatibility +@section 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 @sc{ansi} C if @sc{ansi} 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. + +@sc{ansi} 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. Try to +redesign its interface. + +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 not in Berkeley Unix are welcome. + +@node Using Extensions +@section 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'' @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. Such programs would +be broken by use of GNU extensions. + +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 no good. + +@node ANSI C +@section @sc{ansi} C and pre-@sc{ansi} C + +Do not ever use the ``trigraph'' feature of @sc{ansi} C. + +@sc{ansi} C is widespread enough now that it is ok to write new programs +that use @sc{ansi} C features (and therefore will not work in +non-@sc{ansi} compilers). And if a program is already written in +@sc{ansi} C, there's no need to convert it to support non-@sc{ansi} +compilers. + +However, it is easy to support non-@sc{ansi} compilers in most programs, +so you might still consider doing so when you write a program. Instead +of writing function definitions in @sc{ansi} prototype form, + +@example +int +foo (int x, int y) +@dots{} +@end example + +@noindent +write the definition in pre-@sc{ansi} 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 @sc{ansi} C prototypes in all the files where the function is called. +And once you have it, you lose nothing by writing the function +definition in the pre-@sc{ansi} style. + +If you don't know non-@sc{ansi} C, there's no need to learn it; just +write in @sc{ansi} C. + +@node Source Language +@section Using Languages Other Than C + +Using a language other than C 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 C++ compiler +in order to compile your program. Thus, it is better if you write in C. + +But there are three situations when there is no disadvantage in using +some other language: + +@itemize @bullet +@item +It is okay to use another language if your program contains an +interpreter for that language. + +For example, if your program links with GUILE, it is ok to write part of +the program in Scheme or another language supported by GUILE. + +@item +It is okay to use another language in a tool specifically intended for +use with that language. + +This is okay 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 to a narrow community, then perhaps +it's not important if the application is inconvenient to install. +@end itemize + +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. + +@node Program Behavior +@chapter Program Behavior for All Programs + +This @value{CHAPTER} describes how to write 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 for command line interfaces +* Option Table:: Table of long options. +* Memory Usage:: When and how to care about memory needs +@end menu + +@node Semantics +@section Writing Robust Programs + +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. + +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 printers that can't handle those characters. + +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. + +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. + +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 will be supported compatibly by GNU. + +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. + +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. + +If you make temporary files, check the @code{TMPDIR} environment +variable; if that variable is defined, use the specified directory +instead of @file{/tmp}. + +@node Libraries +@section 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 @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{_}. They should also contain +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 + +Error messages from compilers should look like this: + +@example +@var{source-file-name}:@var{lineno}: @var{message} +@end example + +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. + +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 Command Line Interfaces + +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 @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. + +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. + +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 idiosyncracies for users to remember. + +All programs should support two standard options: @samp{--version} +and @samp{--help}. + +@table @code +@item --version +This option should direct the program to 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: + +@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. + +@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. + +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 + +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{gnu@@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 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 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 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 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 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 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 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 + +If it 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 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 + +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 @sc{ansi} C, format the definition like this: + +@example +static char * +concat (char *s1, char *s2) +@{ + @dots{} +@} +@end example + +In @sc{ansi} 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 + +For the body of the function, we prefer code formatted 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 + +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: + +@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, +but Emacs would mess it up: + +@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 + +But adding a set of parentheses solves the problem: + +@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 + +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 + +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 + +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 + +Please explicitly declare all arguments to functions. +Don't omit them just because they are @code{int}s. + +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. + +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. + +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 + +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 + +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. + +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. + +Use file names of 14 characters or less, to avoid creating gratuitous +problems on older System V systems. You can use the program +@code{doschk} to test for this. @code{doschk} also tests for potential +name conflicts if the files were loaded onto an MS-DOS file +system---something you may or may not care about. + +@node System Portability +@section 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}. The +amount and kinds of variation among GNU systems on different @sc{cpu}s +will be comparable to the variation among Linux-based GNU systems or +among BSD systems today. So the kinds of portability that are absolutely +necessary are quite limited. + +But many users do run GNU software on non-GNU Unix or Unix-like systems. +So supporting a variety of Unix-like systems is desirable, although not +paramount. + +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}). + +As for systems that are not like Unix, such as MSDOS, Windows, the +Macintosh, VMS, and MVS, supporting them is usually so much work that it +is better if you don't. + +The planned GNU kernel is not finished yet, but you can tell which +facilities it will provide by looking at the GNU C Library Manual. The +GNU kernel is based on Mach, so the features of Mach will also be +available. However, if you use Mach features, you'll probably have +trouble debugging your program today. + +@node CPU Portability +@section Portability between @sc{cpu}s + +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. + +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 @sc{ansi} C, so you can use +prototypes (conditionalized to be active only in @sc{ansi} 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; + int a1, a2, a3; +@{ + fprintf (stderr, "error: "); + fprintf (stderr, s, a1, a2, a3); +@} +@end example + +@noindent +In practice, this works on all machines, and it is much simpler than any +``correct'' alternative. Be sure @emph{not} to use a prototype +for such functions. + +However, avoid casting pointers to integers unless you really need to. +These assumptions really 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---it is ok to do so, but you'll have to +make explicit provisions to handle different word sizes. + +@node System Functions +@section Calling System Functions + +C implementations differ substantially. @sc{ansi} C reduces but does not +eliminate the incompatibilities; meanwhile, many users wish to compile +GNU software with pre-@sc{ansi} compilers. 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 value of @code{sprintf}. It returns the number of +characters written on some systems, but not on all systems. + +@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. + +@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 an @sc{ansi} 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. + +@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 @sc{ansi} +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 @sc{ansi} +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 + +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. + +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 + +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 + +@menu +* GNU Manuals:: Writing proper manuals. +* Manual Structure Details:: Specific structure conventions. +* 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 way to document part of the GNU system is to write a +manual in the Texinfo formatting language. 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}). + +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 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. + +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. + +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 +exceptions.) Also Unix man pages use a particular format which is +different from what we use in GNU manuals. + +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 file 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 violations of law. + +@node Manual Structure Details +@section 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 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. + +There will be automatic features for specifying a program name and +quickly reading just this part of its manual. + +If one manual describes several programs, it should have such a node for +each program described. + +@node NEWS File +@section The 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 + +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:: +@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. + +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 + +Here are some examples of change log entries: + +@example +* 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. + +@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, 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.'' + +@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 + +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 Man Pages +@section 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 + +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 + +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. + +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. + +@item --nfp +The target machine has no floating point processor. + +@item --gas +The target machine assembler is GAS, the GNU assembler. +This is obsolete; users should use @samp{--with-gnu-as} instead. + +@item --x +The target machine has the X Window System installed. +This is obsolete; users should use @samp{--with-x} instead. +@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. + +The way to build a cross-compiler, cross-assembler, or what have you, is +to specify the option @samp{--host=@var{hosttype}} when running +@code{configure}. This specifies the host system without changing the +type of target system. The syntax for @var{hosttype} is the same as +described above. + +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{hosttype}} for specifying the +configuration on which you will compile them, in case that is different +from the host. + +Programs for which cross-operation is not meaningful need not accept the +@samp{--host} option, because configuring an entire operating system for +cross-operation is not a meaningful thing. + +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 + +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. + +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. + +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. + +@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) +End: diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in new file mode 100644 index 0000000..c3c4cd4 --- /dev/null +++ b/testsuite/Makefile.in @@ -0,0 +1,80 @@ +# Makefile for Autoconf test suite. +# Copyright (C) 1994 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +#### Start of system configuration section. #### + +top_srcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +M4 = @M4@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +AUTOCONF = ../autoconf +AUTOCONFFLAGS = -m $(top_srcdir) + +RUNTEST= runtest +RUNTESTFLAGS= + +#### End of system configuration section. #### + +SHELL = /bin/sh + +all: +info: +dvi: + +check: site.exp all + @if ($(RUNTEST) --version) >/dev/null 2>&1; then \ + echo $(RUNTEST); \ + $(RUNTEST) $(RUNTESTFLAGS) --tool autoconf AUTOCONF=${AUTOCONF} \ + AUTOCONFFLAGS="${AUTOCONFFLAGS}" --srcdir $(srcdir); \ + else echo $(RUNTEST) not found, check skipped; fi + +installcheck: + +site.exp: Makefile + @echo "Making a new site.exp file..." + @test ! -f site.bak || rm -f site.bak + @test ! -f site.exp || mv site.exp site.bak + @echo "## these variables are automatically generated by make ##" > site.exp + @echo "# Do not edit here. If you wish to override these values" >> site.exp + @echo "# add them to the last section" >> site.exp + @echo "set tool autoconf" >> site.exp + @echo "set srcdir ${srcdir}" >> site.exp + @echo "set objdir `pwd`" >> site.exp + @echo "## All variables above are generated by configure. Do Not Edit ##" >> site.exp + @test ! -f site.bak || sed '1,/^## All variables above are.*##/ d' site.bak >> site.exp + +install: + +install-info: + +uninstall: + +Makefile: Makefile.in ../config.status + cd ..; ./config.status + +clean mostlyclean distclean maintainer-clean:: + rm -f autoconf.log autoconf.sum site.exp site.bak AC* confdummy* + +distclean maintainer-clean:: + rm -f Makefile config.status config.cache config.log + +TAGS: diff --git a/testsuite/autoconf.g/init.exp b/testsuite/autoconf.g/init.exp new file mode 100644 index 0000000..5efb2d4 --- /dev/null +++ b/testsuite/autoconf.g/init.exp @@ -0,0 +1,2 @@ +# Test whether AC_INIT and AC_OUTPUT compile. +autoconf_test AC_INIT "" diff --git a/testsuite/autoconf.g/sizeof.exp b/testsuite/autoconf.g/sizeof.exp new file mode 100644 index 0000000..933deac --- /dev/null +++ b/testsuite/autoconf.g/sizeof.exp @@ -0,0 +1 @@ +autoconf_test AC_CHECK_SIZEOF "AC_CHECK_SIZEOF(long *)" diff --git a/testsuite/autoconf.s/defines.exp b/testsuite/autoconf.s/defines.exp new file mode 100644 index 0000000..44be7d8 --- /dev/null +++ b/testsuite/autoconf.s/defines.exp @@ -0,0 +1,49 @@ +# -*- TCL -*- +# Check for a 1-1 correspondence between acconfig.h and acspecific.m4. +# Copyright (C) 1994 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 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Adapted by David MacKenzie from a shell script by Paul Eggert. + +set top_srcdir "$srcdir/.." + +set uscript {s/^#undef[ ]*\([^ ]*\).*/\1/p} +set undefs [exec sed -n $uscript $top_srcdir/acconfig.h] + +set dscript {s/.*AC_DEFINE[A-Z_]*(\([^$,)]*\).*/\1/p; s/.*AC_CHECK_TYPE(\([^$,)]*\).*/\1/p} +set defines [exec sed -n $dscript $top_srcdir/acspecific.m4] + +send_user "Checking acspecific.m4 for definitions of symbols in acconfig.h...\n" + +foreach u $undefs { + send_user "$u\n" + if {[lsearch -exact $defines $u] != -1} { + pass "$u" + } else { + fail "$u, not defined" + } +} + +send_user "Checking acconfig.h for symbols defined in acspecific.m4...\n" + +foreach d $defines { + send_user "$d\n" + if {[lsearch -exact $undefs $d] != -1} { + pass "$d" + } else { + fail "$d, no entry" + } +} diff --git a/testsuite/autoconf.s/syntax.exp b/testsuite/autoconf.s/syntax.exp new file mode 100644 index 0000000..95a4611 --- /dev/null +++ b/testsuite/autoconf.s/syntax.exp @@ -0,0 +1,10 @@ +# Test all of the acspecific.m4 macros. -*- TCL -*- + +send_user "Checking for syntax errors in the specific tests...\n" +set script {s/^AC_DEFUN(\([^,]*\).*/\1/p} +set macros [exec sed -n $script $srcdir/../acspecific.m4] + +foreach mac $macros { + send_user "$mac\n" + autoconf_test $mac $mac +} diff --git a/testsuite/config/unix.exp b/testsuite/config/unix.exp new file mode 100644 index 0000000..8d19d74 --- /dev/null +++ b/testsuite/config/unix.exp @@ -0,0 +1,124 @@ +# -*- TCL -*- +# Test-specific TCL procedures required by DejaGNU. +# Copyright (C) 1994 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 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Modified by David MacKenzie from the gcc files +# written by Rob Savoye . + +# +# Called by runtest. +# Extract and print the version number of autoconf. +# +proc autoconf_version {} { + global AUTOCONF + global AUTOCONFFLAGS + + if {[which $AUTOCONF] != 0} then { + set tmp [ eval exec $AUTOCONF $AUTOCONFFLAGS --version /dev/null ] + regexp "version.*$" $tmp version + if [info exists version] then { + clone_output "[which $AUTOCONF] $version\n" + } else { + warning "cannot get version from $tmp." + } + } else { + warning "$AUTOCONF, program does not exist" + } +} + +# +# Compile a configure.in using autoconf. +# Runs autoconf and leaves the output in $comp_output. +# Called by individual test scripts. +# Return 1 if ok, 0 if not. +proc autoconf_start { configout } { + global verbose + global AUTOCONF + global AUTOCONFFLAGS + global comp_output + + if {[which $AUTOCONF] == 0} then { + error "$AUTOCONF, program does not exist" + exit 1 + } + + set configin "$configout.in" + + send_log "$AUTOCONF $AUTOCONFFLAGS $configin > $configout\n" + if $verbose>1 then { + send_user "Spawning \"$AUTOCONF $AUTOCONFFLAGS $configin > $configout\"\n" + } + + catch "exec $AUTOCONF $AUTOCONFFLAGS $configin > $configout" comp_output + if ![string match "" $comp_output] then { + send_log "$comp_output\n" + if $verbose>1 then { + send_user "$comp_output\n" + } + } + catch "exec chmod +x $configout" + return 1 +} + +# +# Execute the configure script. +# Leaves the output in $exec_output. +# Called by individual test scripts. +# Return 1 if successful so far, 0 if failure already. +proc autoconf_load { args } { + global verbose + global exec_output + + if ![file exists $args] then { + error "$args, configure script does not exist" + return 0 + } + + # Check whether m4 processing left any icky residue. + # The autoconf script does this already, pretty much. + # catch "exec sed -n -e /dnl/p -e /AC_/p $args" exec_output + # if $verbose>1 then { + # send_user "Checked $args for unexpanded m4 macros\n" + # } + # if ![string match "" $exec_output] then { + # fail "$args, unexpanded m4 macros" + # send_log "$exec_output\n" + # return 0 + # } + + # Capture only stderr in exec_output, not "creating Makefile" etc. + catch "exec ./$args --cache=/dev/null >/dev/null" exec_output + if $verbose>1 then { + send_user "Executed $args --cache=/dev/null\n" + } + if ![string match "" $exec_output] then { + fail "$args, problem with executing" + send_log "$exec_output\n" + return 0 + } else { + return 1 + } +} + +# +# Called by runtest. +# Clean up (remove temporary files) before runtest exits. +# +proc autoconf_exit {} { +} + +load_lib common.exp diff --git a/testsuite/lib/common.exp b/testsuite/lib/common.exp new file mode 100644 index 0000000..2ebb2d6 --- /dev/null +++ b/testsuite/lib/common.exp @@ -0,0 +1,123 @@ +# -*- TCL -*- +# Auxiliary procedures for autoconf tests. +# Copyright (C) 1994 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 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +# Written by David MacKenzie . + +# +# Create a configure.in from a string. +# CONFIG.in is the file to create containing CONTENTS plus boilerplate. +# Return 1 if successful, 0 if an error occurs. +proc autoconf_create {config contents} { + if [catch {open "$config.in" "w"} hand] { + error "$config, cannot create $config.in" + return 0 + } + puts $hand "AC_INIT(confdummy.in) +$contents +AC_OUTPUT(confdummy)" + close $hand + + if [catch {open "confdummy.in" "w"} hand] { + error "$config, cannot create confdummy.in" + return 0 + } + puts $hand "# This is a dummy file for testing. +srcdir = @srcdir@ +# Please ignore this file." + close $hand + + return 1 +} + +# Compile a configure.in into a configure +# and call error if there's any output (undefined macros, can't +# find library files, etc.). +proc autoconf_start_plus {configout} { + global comp_output + + set status [autoconf_start $configout] + if {$status==0} { + return 0 + } + # Examine $comp_output. + if [string match "*is obsolete*" "$comp_output"] then { + return 1 + } + if [string match "*allow cross*" "$comp_output"] then { + return 1 + } + if ![string match "" "$comp_output"] then { + fail "$configout, problem with running autoconf" + return 0 + } + return 1 +} + +# Execute a configure script and check the output +# against what it's supposed to be. +# Return 1 if successful so far, 0 if failure already. +proc autoconf_load_plus {args} { + global exec_output + + set status [autoconf_load $args] + if {$status==0} { + return 0 + } + if [string match "*:*" "$exec_output"] then { + fail "$args, problem with executing" + return 0 + } + return 1 +} + +# Remove generated configuration files for test CONFIG. +# Return 1 if successful, 0 if not. +proc autoconf_remove {config} { + if [catch "exec rm -f $config $config.in [glob -nocomplain conftest* confdummy*] config.status config.cache config.log"] { + warning "$config output files, cannot remove" + return 0 + } + return 1 +} + +# The standard autoconf test: create, compile, run, and remove +# a simple configure script to test a single macro. +# TESTNAME is the name of the macro being tested. +# CONTENTS is the body of the configure script to create and test. +proc autoconf_test {testname contents} { + if ![autoconf_remove $testname] { + return 0 + } + if ![autoconf_create $testname "$contents"] { + return 0 + } + if ![autoconf_start_plus $testname] { + autoconf_remove $testname + return 0 + } + if ![autoconf_load_plus $testname] { + autoconf_remove $testname + return 0 + } + if ![autoconf_remove $testname] { + return 0 + } + + pass "$testname" + return 1 +} diff --git a/texinfo.tex b/texinfo.tex new file mode 100644 index 0000000..310a65c --- /dev/null +++ b/texinfo.tex @@ -0,0 +1,5452 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% $Id: texinfo.tex,v 1.1 1998/09/26 06:51:15 bje Exp $ +% +% Copyright (C) 1985, 86, 88, 90, 91, 92, 93, 94, 95, 96, 97, 98 +% 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/pub/gnu/texinfo.tex +% /home/gd/gnu/doc/texinfo.tex on the GNU machines. +% (and all GNU mirrors, see http://www.gnu.org/order/ftp.html) +% ftp://tug.org/tex/texinfo.tex +% ftp://ctan.org/macros/texinfo/texinfo.tex +% (and all CTAN mirrors, finger ctan@ctan.org for a list). +% The texinfo.tex in the texinfo distribution itself could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. +% Please include a precise test case in each bug report, +% including a complete document with which we can reproduce the problem. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For simple +% manuals, however, you can get away with: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever, to process the dvi file. +% 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. + + +% Make it possible to create a .fmt file just by loading this file: +% if the underlying format is not loaded, start by loading it now. +% Added by gildea November 1993. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi + +% This automatically updates the version number based on RCS. +\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}} +\deftexinfoversion$Revision: 1.1 $ +\message{Loading texinfo package [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]}\message{} + \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\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\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\putwordShortContents\undefined \gdef\putwordShortContents{Short Contents}\fi +\ifx\putwordTableofContents\undefined\gdef\putwordTableofContents{Table of Contents}\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 + +% 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{% + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \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 + \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{% + % Go into vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % Don't add any leading before our big empty box, but allow a page + % break, since the best break might be right here. + \allowbreak + \nointerlineskip + \vtop to #1\mil{\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 +} + +% @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{TEXT} puts TEXT in the margin next to the current paragraph. + +\def\inmargin#1{% +\strut\vadjust{\nobreak\kern-\strutdepth + \vtop to \strutdepth{\baselineskip\strutdepth\vss + \llap{\rightskip=\inmarginspacing \vbox{\noindent #1}}\null}}} +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} + +%\hbox{{\rm#1}}\hfil\break}} + +% @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 is defined for the Info formatting commands only. +\let\paragraphindent=\comment + +% 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\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.ai.mit.edu/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 (mostly for their use in + % smallexample) + \let\indrm = \nullfont \let\indit = \nullfont \let\indsl = \nullfont + \let\indbf = \nullfont \let\indtt = \nullfont \let\indsc = \nullfont + \let\indsf = \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'']v}% + \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} + +% @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{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} + +% 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 and small examples (9pt). +% We actually use the slanted font rather than the italic, +% because texinfo normally uses the slanted fonts for that. +% Do not make many font distinctions in general in the index, since they +% aren't very useful. +\setfont\ninett\ttshape{9}{1000} +\setfont\ninettsl\ttslshape{10}{900} +\setfont\indrm\rmshape{9}{1000} +\setfont\indit\itshape{9}{1000} +\setfont\indsl\slshape{9}{1000} +\let\indtt=\ninett +\let\indttsl=\ninettsl +\let\indsf=\indrm +\let\indbf=\indrm +\setfont\indsc\scshape{10}{900} +\font\indi=cmmi9 +\font\indsy=cmsy9 + +% 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} +\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\indexfonts{% + \let\tenrm=\indrm \let\tenit=\indit \let\tensl=\indsl + \let\tenbf=\indbf \let\tentt=\indtt \let\smallcaps=\indsc + \let\tensf=\indsf \let\teni=\indi \let\tensy=\indsy \let\tenttsl=\indttsl + \resetmathfonts \setleading{12pt}} + +% 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\smallrm\rmshape{8}{1000} +\font\smallsy=cmsy9 +\def\key#1{{\smallrm\textfont2=\smallsy \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 second argument +% specifying the text to display. First (mandatory) arg is the url. +% Perhaps eventually put in a hypertex \special here. +% +\def\uref#1{\urefxxx #1,,\finish} +\def\urefxxx#1,#2,#3\finish{% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \unhbox0\ (\code{#1})% + \else + \code{#1}% + \fi +} + +% rms does not like the angle brackets --karl, 17may97. +% So now @email is just like @uref. +%\def\email#1{\angleleft{\tt #1}\angleright} +\let\email=\uref + +% 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 @contentsaftertitlepage or @shortcontentsaftertitlepage. +% +\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 + % + \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 +% Produces Day Month Year style of output. +\def\today{\number\day\space +\ifcase\month\or +January\or February\or March\or April\or May\or June\or +July\or August\or September\or October\or November\or December\fi +\space\number\year} + +% Use this if you want the Month Day, Year style of output. +%\def\today{\ifcase\month\or +%January\or February\or March\or April\or May\or June\or +%July\or August\or September\or October\or November\or December\fi +%\space\number\day, \number\year} + +% @settitle line... specifies the title of the document, for headings +% It generates no output of its own + +\def\thistitle{No Title} +\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 . + % + \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 + +% 2/1/96, to allow fractions to be given with more than one digit. +\def\pickupwholefraction#1 {\global\advance\colcount by1 % +\expandafter\xdef\csname col\the\colcount\endcsname{.#1\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 % In this case arg of setuptable + % is the decimal point before the + % number given in percent of hsize. + % We don't need this so we don't use it. + \else + \global\advance\colcount by1 + \setbox0=\hbox{#1 }% 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\else\let\go\setuptable\fi% +\fi\go} + +% multitable syntax +\def\tab{&\hskip1sp\relax} % 2/2/96 + % tiny skip here makes sure this column space is + % maintained, even if it is never used. + +% @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 +%% strut to put in table in case some entry doesn't have descenders, +%% to keep lines equally spaced +\let\multistrut = \strut +%% 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. +\else +\gdef\multistrut{\vrule height\multitablelinespace depth\dp0 +width0pt\relax} \fi +\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{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\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}} +} + +\def\defcodeindex{\parsearg\newcodeindex} + +% @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. +% The \closeout helps reduce unnecessary open files; the limit on the +% Acorn RISC OS is a mere 16 files. +\def\synindex#1 #2 {% + \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname + \expandafter\closeout\csname#1indfile\endcsname + \expandafter\let\csname#1indfile\endcsname=\synindexfoo + \expandafter\xdef\csname#1index\endcsname{% define \xxxindex + \noexpand\doindex{#2}}% +} + +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +\def\syncodeindex#1 #2 {% + \expandafter\let\expandafter\synindexfoo\expandafter=\csname#2indfile\endcsname + \expandafter\closeout\csname#1indfile\endcsname + \expandafter\let\csname#1indfile\endcsname=\synindexfoo + \expandafter\xdef\csname#1index\endcsname{% define \xxxindex + \noexpand\docodeindex{#2}}% +} + +% 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. +%\let\{ = \lbracecmd +%\let\} = \rbracecmd +\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\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}}% +% +% 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 +} + +% 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\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-string with all font commands turned off + % to get the string to sort by. + {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% + % + % Now produce the complete index entry, with both the sort key and the + % original text, including any font commands. + \toks0 = {#2}% + \edef\temp{% + \write\csname#1indfile\endcsname{% + \realbackslash entry{\indexsorttmp}{\folio}{\the\toks0}}% + }% + % + % If third (subentry) arg is present, add it to the index string. + \ifx\thirdarg\emptymacro \else + \toks0 = {#3}% + \edef\temp{\temp{\the\toks0}}% + \fi + % + % 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}% + % + \indexfonts \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. + (Index is nonexistent) + \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 + (Index is empty) + \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. + \ #2% The page number ends the paragraph. + \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 #2\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 = {\global\setbox\partialpage = \vbox{% + % + % 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 must prevent the second \partialpage from + % simply overwriting the first, causing us to lose the page. + % This will preserve it until a real output routine can ship it + % out. Generally, \partialpage will be empty when this runs and + % this will be a no-op. + \unvbox\partialpage + % + % Unvbox the main output page. + \unvbox255 + \kern-\topskip \kern\baselineskip + }}% + \eject + % + % 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.) + \advance\vsize by -\ht\partialpage + \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 + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +\def\pagesofar{% + % Re-output the contents of the output page -- any previous material, + % followed by the two boxes we just split, in box0 and box2. + \advance\vsize by \ht\partialpage + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +\def\enddoublecolumns{% + \output = {% + % Split the last of the double-column material. Leave 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}}% + % + % \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. + \pagegoal = \vsize + }% + \eject + \endgroup % started in \begindoublecolumns +} +\def\balancecolumns{% + % Called at the end of the double column material. + \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,} +% Define 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} + +% 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 to achieve this: TeX expands \the only once, +% simply yielding the contents of . (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,} +\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 + \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{\putwordTableofContents}% + \openin 1 \jobname.toc + \ifeof 1 \else + \closein 1 + \input \jobname.toc + \fi + \vfill \eject + \endgroup + \lastnegativepageno = \pageno + \pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortContents}% + % + \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 + \endgroup + \lastnegativepageno = \pageno + \pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% 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{#3}}% +} + +% 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. +\setbox0 = \hbox{\shortcontrm \putwordAppendix } +\newdimen\shortappendixwidth \shortappendixwidth = \wd0 + +\def\shortchaplabel#1{% + % 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{#2}}} + +% 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{#2}}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno{#2}}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno{#2}}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno{#2}}% +\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,} + +% 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{{\advance\envskipamount by \parskip +\endgraf \ifdim\lastskip<\envskipamount +\removelastskip \penalty-50 \vskip\envskipamount \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}% + \indexfonts + \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}% + \indexfonts \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}% + \indexfonts \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 +} + + +\message{defuns,} +% Define formatter for defuns +% First, 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 } +\def\ampnr{\&} +\def\lbrb{{\bf\char`\[}} +\def\rbrb{{\bf\char`\]}} + +% 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}}} + +% @deftypemethod has an extra argument that nothing else does. Sigh. +% #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. +% #5 is the method's return type. +% +\def\deftypemethparsebody#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 {\begingroup\obeylines\activeparens\spacesplit{#3{##1}{##2}}}% +\parindent=0in +\advance\leftskip by \defbodyindent +\exdentamount=\defbodyindent +\begingroup\obeylines\activeparens\spacesplit{#3{#4}{#5}}} + +\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. +\hyphenchar\tensl=0 +#1% +\hyphenchar\tensl=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}{Function}% +\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}{Function}% +\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}{Macro}% +\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}{Special Form}% +\defunargs {#2}\endgroup % +\catcode 61=\other % Turn off change made in \defparsebody +} + +% This definition is run if you use @defunx +% anywhere other than immediately after a @defun or @defunx. + +\def\deffnx #1 {\errmessage{@deffnx in invalid context}} +\def\defunx #1 {\errmessage{@defunx in invalid context}} +\def\defmacx #1 {\errmessage{@defmacx in invalid context}} +\def\defspecx #1 {\errmessage{@defspecx in invalid context}} +\def\deftypefnx #1 {\errmessage{@deftypefnx in invalid context}} +\def\deftypemethodx #1 {\errmessage{@deftypemethodx in invalid context}} +\def\deftypefunx #1 {\errmessage{@deftypefunx in invalid context}} + +% @defmethod, and so on + +% @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{} on #1}% +\defunargs {#3}\endgroup % +} + +% @deftypemethod CLASS RETURN-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 +} + +% @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}}{of #1}% Make entry in var index +\begingroup\defname {#2}{\defcvtype{} of #1}% +\defvarargs {#3}\endgroup % +} + +% @defivar == @defcv {Instance Variable} + +\def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} + +\def\defivarheader #1#2#3{% +\dosubind {vr}{\code{#2}}{of #1}% Make entry in var index +\begingroup\defname {#2}{Instance Variable of #1}% +\defvarargs {#3}\endgroup % +} + +% These definitions are run if you use @defmethodx, etc., +% anywhere other than immediately after a @defmethod, etc. + +\def\defopx #1 {\errmessage{@defopx in invalid context}} +\def\defmethodx #1 {\errmessage{@defmethodx in invalid context}} +\def\defcvx #1 {\errmessage{@defcvx in invalid context}} +\def\defivarx #1 {\errmessage{@defivarx in invalid context}} + +% Now @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}{Variable}% +\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}{User Option}% +\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}{Variable}% +\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} + +% This definition is run if you use @defvarx +% anywhere other than immediately after a @defvar or @defvarx. + +\def\defvrx #1 {\errmessage{@defvrx in invalid context}} +\def\defvarx #1 {\errmessage{@defvarx in invalid context}} +\def\defoptx #1 {\errmessage{@defoptx in invalid context}} +\def\deftypevarx #1 {\errmessage{@deftypevarx in invalid context}} +\def\deftypevrx #1 {\errmessage{@deftypevrx in invalid context}} + +% 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} + +% This definition is run if you use @deftpx, etc +% anywhere other than immediately after a @deftp, etc. + +\def\deftpx #1 {\errmessage{@deftpx 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 + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{#1}% + \immediate\closeout\macscribble + \let\xeatspaces\eatspaces + \input \jobname.tmp + \endgroup +} +\else +\def\scanmacro#1{% +\begingroup \newlinechar`\^^M +\let\xeatspaces\eatspaces\scantokens{#1}\endgroup} +\fi + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? + +% 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 + \expandafter\ifx \csname macsave.\the\macname\endcsname \relax + \cslet{macsave.\the\macname}{\the\macname}% + \else + \message{Warning: redefining \the\macname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\def\unmacro{\parsearg\unmacroxxx} +\def\unmacroxxx#1{% + \expandafter\ifx \csname macsave.\the\macname\endcsname \relax + \errmessage{Macro \the\macname\ not defined.}% + \else + \cslet{#1}{macsave.#1}% + \expandafter\let \csname macsave.\the\macname\endcsname \undefined + \fi +} + +% This makes use of the obscure feature that if the last token of a +% 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\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{% + \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\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 + \noexpand\csname\the\macname xx\endcsname} + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \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} + + +\message{cross references,} +\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. +% +\def\anchor#1{\setref{#1}{Ynothing}} + + +% \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 + \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 + \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. + \ifdim \wd1 > 0pt + \putwordsection{} ``\printednodename'' in \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 +\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 + % + % 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\egroup} + +}%end \catcode `\@=11 + +% 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 + }% +} + +% @| 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 +% +\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://ftp.tug.org/tex/epsf.tex.} +% +% Only complain once about lack of 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 just the usual extra ignored arg for parsing this stuff. +\def\imagexxx#1,#2,#3,#4\finish{% + % \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 + % If the image is by itself, center it. + \ifvmode + \nobreak\medskip + \nobreak + \centerline{\epsfbox{#1.eps}}% + \bigbreak + \else + \epsfbox{#1.eps}% + \fi +} + + +\message{paper sizes,} +% And other related 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. This makes it come to about 9pt for the 8.5x11 format. 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 = \hsize + \divide\emergencystretch by 45 + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; 3) voffset; +% 4) hoffset; 5) binding offset; 6) topskip. Then whoever calls us can +% set \parskip and call \setleading for \baselineskip. +% +\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 0.6in + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \setleading{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 + \setleading{12pt}% + % + \internalpagesizes{7.5in}{5.in}{\voffset}{.25in}{\bindingoffset}{16pt}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \deftypemargin = 0pt + \defbodyindent = .5cm + % + \let\smalldisplay = \smalldisplayx + \let\smallexample = \smalllispx + \let\smallformat = \smallformatx + \let\smalllisp = \smalllispx +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \setleading{12pt}% + \parskip = 3pt plus 2pt minus 1pt + % + \internalpagesizes{53\baselineskip}{160mm}{\voffset}{4mm}{\bindingoffset}{44pt}% + % + \tolerance = 700 + \hfuzz = 1pt +}} + +% 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 + \setleading{13.6pt}% + % + \afourpaper + \internalpagesizes{237mm}{150mm}{3.6mm}{3.6mm}{3mm}{7mm}% + % + \globaldefs = 0 +}} + +% Use @afourwide to print on European A4 paper in wide format. +\def\afourwide{% + \afourpaper + \internalpagesizes{9.5in}{6.5in}{\hoffset}{\normaloffset}{\bindingoffset}{7mm}% + % + \globaldefs = 0 +} + +% @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{13.2pt}% + % + \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 +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} + +% 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\the\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 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}} + +% Say @foo, not \foo, in error messages. +\escapechar=`\@ + +% \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} + +@def@normalturnoffactive{@let"=@normaldoublequote +@let\=@normalbackslash +@let~=@normaltilde +@let^=@normalcaret +@let_=@normalunderscore +@let|=@normalverticalbar +@let<=@normalless +@let>=@normalgreater +@let+=@normalplus} + +% 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} + +% These look ok in all fonts, so just make them not special. The @rm below +% makes sure that the current font starts out as the newly loaded cmr10 +@catcode`@$=@other @catcode`@%=@other @catcode`@&=@other @catcode`@#=@other + +@textfonts +@rm + +@c Local variables: +@c page-delimiter: "^\\\\message" +@c End: