From 1d81d8820f3d1807192c03dc83e2ec20763b3811 Mon Sep 17 00:00:00 2001 From: eirikald Date: Tue, 13 Feb 2007 21:11:55 +0000 Subject: [PATCH] Initial mysql-admtools import --- AUTHORS | 0 COPYING | 340 +++ ChangeLog | 13 + INSTALL | 183 ++ Makefile.am | 7 + Makefile.in | 548 ++++ NEWS | 0 README | 0 acconfig.h | 29 + aclocal.m4 | 862 ++++++ bin/aclocal | 716 +++++ bin/autoconf | 271 ++ bin/autoheader | 296 ++ bin/automake | 7523 ++++++++++++++++++++++++++++++++++++++++++++++ common.c | 106 + config.h | 97 + config.h.in | 96 + config.log | 520 ++++ configure | 6183 +++++++++++++++++++++++++++++++++++++ configure.in | 83 + depcomp | 529 ++++ install-sh | 250 ++ missing | 134 + mkinstalldirs | 40 + mysql-admutils.h | 28 + mysql-dbadm.c | 427 +++ mysql-useradm.c | 304 ++ stamp-h.in | 1 + 28 files changed, 19586 insertions(+) create mode 100644 AUTHORS create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 Makefile.in create mode 100644 NEWS create mode 100644 README create mode 100644 acconfig.h create mode 100644 aclocal.m4 create mode 100755 bin/aclocal create mode 100755 bin/autoconf create mode 100755 bin/autoheader create mode 100755 bin/automake create mode 100644 common.c create mode 100644 config.h create mode 100644 config.h.in create mode 100644 config.log create mode 100755 configure create mode 100644 configure.in create mode 100755 depcomp create mode 100755 install-sh create mode 100755 missing create mode 100755 mkinstalldirs create mode 100644 mysql-admutils.h create mode 100644 mysql-dbadm.c create mode 100644 mysql-useradm.c create mode 100644 stamp-h.in diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..eeb586b --- /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 + + 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..9764562 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,13 @@ +Wed Jul 6 00:24:26 2005 Knut Auvor Grythe + + * Added support for changing Alter_priv + +Thu Jun 30 15:13:15 2005 Knut Auvor Grythe + + * A few patches to be able to use the mysql bundled with FreeBSD 5.4 + +Mon Jul 6 11:58:10 1998 Vebjorn Ljosa + + * Initial version. + + 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.am b/Makefile.am new file mode 100644 index 0000000..6bb13aa --- /dev/null +++ b/Makefile.am @@ -0,0 +1,7 @@ +bin_PROGRAMS = mysql-dbadm mysql-useradm +mysql_dbadm_SOURCES = mysql-dbadm.c common.c mysql-admutils.h +mysql_useradm_SOURCES = mysql-useradm.c common.c mysql-admutils.h +INCLUDES = @MYSQL_INCLUDE@ +LDADD = @MYSQL_LIBS@ +LDFLAGS = @MYSQL_LFLAGS@ + diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..035070e --- /dev/null +++ b/Makefile.in @@ -0,0 +1,548 @@ +# Makefile.in generated by automake 1.9.5 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +SOURCES = $(mysql_dbadm_SOURCES) $(mysql_useradm_SOURCES) + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +bin_PROGRAMS = mysql-dbadm$(EXEEXT) mysql-useradm$(EXEEXT) +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ + acconfig.h depcomp install-sh missing mkinstalldirs +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_mysql_dbadm_OBJECTS = mysql-dbadm.$(OBJEXT) common.$(OBJEXT) +mysql_dbadm_OBJECTS = $(am_mysql_dbadm_OBJECTS) +mysql_dbadm_LDADD = $(LDADD) +mysql_dbadm_DEPENDENCIES = +am_mysql_useradm_OBJECTS = mysql-useradm.$(OBJEXT) common.$(OBJEXT) +mysql_useradm_OBJECTS = $(am_mysql_useradm_OBJECTS) +mysql_useradm_LDADD = $(LDADD) +mysql_useradm_DEPENDENCIES = +DEFAULT_INCLUDES = -I. -I$(srcdir) -I. +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(mysql_dbadm_SOURCES) $(mysql_useradm_SOURCES) +DIST_SOURCES = $(mysql_dbadm_SOURCES) $(mysql_useradm_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @MYSQL_LFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MYSQL_INCLUDE = @MYSQL_INCLUDE@ +MYSQL_LFLAGS = @MYSQL_LFLAGS@ +MYSQL_LIBS = @MYSQL_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build_alias = @build_alias@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host_alias = @host_alias@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +mysql_dbadm_SOURCES = mysql-dbadm.c common.c mysql-admutils.h +mysql_useradm_SOURCES = mysql-useradm.c common.c mysql-admutils.h +INCLUDES = @MYSQL_INCLUDE@ +LDADD = @MYSQL_LIBS@ +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: $(am__configure_deps) $(top_srcdir)/acconfig.h + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +mysql-dbadm$(EXEEXT): $(mysql_dbadm_OBJECTS) $(mysql_dbadm_DEPENDENCIES) + @rm -f mysql-dbadm$(EXEEXT) + $(LINK) $(mysql_dbadm_LDFLAGS) $(mysql_dbadm_OBJECTS) $(mysql_dbadm_LDADD) $(LIBS) +mysql-useradm$(EXEEXT): $(mysql_useradm_OBJECTS) $(mysql_useradm_DEPENDENCIES) + @rm -f mysql-useradm$(EXEEXT) + $(LINK) $(mysql_useradm_LDFLAGS) $(mysql_useradm_OBJECTS) $(mysql_useradm_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mysql-dbadm.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mysql-useradm.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) config.h +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ + clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ + dist-gzip dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..e69de29 diff --git a/acconfig.h b/acconfig.h new file mode 100644 index 0000000..00c9039 --- /dev/null +++ b/acconfig.h @@ -0,0 +1,29 @@ +/* + * acconfig.h + * + * @(#) $Header: /home/nalle/cvsroot/mysql-admutils/acconfig.h,v 1.1 1998/07/06 12:33:07 ljosa Exp $ + * + */ + + +/* Define the name of the package */ +#undef PACKAGE + +/* Define the version of the package */ +#undef VERSION + +/* Define if MySQL is installed */ +#undef HAVE_MYSQL + +/* Define if you have the header file. */ +#undef HAVE_MATH_H + +/* Define if libmath is available */ +#undef HAVE_LIBM + +/* Define if libnsl is available */ +#undef HAVE_LIBNSL + +/* Define if libsocket is available */ +#undef HAVE_LIBSOCKET + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..74de4a1 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,862 @@ +# generated automatically by aclocal 1.9.5 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.5])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + diff --git a/bin/aclocal b/bin/aclocal new file mode 100755 index 0000000..1557640 --- /dev/null +++ b/bin/aclocal @@ -0,0 +1,716 @@ +#!/usr/bin/perl +# -*- perl -*- +# Generated from aclocal.in; do not edit by hand. + +eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' + if 0; + +# aclocal - create aclocal.m4 by scanning configure.ac + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# 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 Tom Tromey . + +BEGIN +{ + my $perllibdir = $ENV{'perllibdir'} || '/usr/local/share/automake19'; + unshift @INC, (split ':', $perllibdir); +} + +use Automake::Config; +use Automake::General; +use Automake::Configure_ac; +use Automake::Channels; +use Automake::XFile; +use Automake::FileUtils; +use File::Basename; +use File::stat; +use Cwd; + +# Note that this isn't pkgdatadir, but a separate directory. +# Note also that the versioned directory is handled later. +$acdir = '/usr/local/share/aclocal19'; +$default_acdir = $acdir; +$acdir_x11 = '/usr/X11R6/share/aclocal'; +# contains a list of directories, one per line, to be added +# to the dirlist in addition to $acdir, as if -I had been +# added to the command line. If acdir has been redirected, +# we will also check the specified acdir (this is done later). +$default_dirlist = "$default_acdir/dirlist"; + +# Some globals. + +# configure.ac or configure.in. +my $configure_ac; + +# Output file name. +$output_file = 'aclocal.m4'; + +# Modification time of the youngest dependency. +$greatest_mtime = 0; + +# Option --force. +$force_output = 0; + +# Which macros have been seen. +%macro_seen = (); + +# Which files have been seen. +%file_seen = (); + +# Remember the order into which we scanned the files. +# It's important to output the contents of aclocal.m4 in the opposite order. +# (Definitions in first files we have scanned should override those from +# later files. So they must appear last in the output.) +@file_order = (); + +# Map macro names to file names. +%map = (); + +# Ditto, but records the last definition of each macro as returned by --trace. +%map_traced_defs = (); + +# Map file names to file contents. +%file_contents = (); + +# Map file names to included files (transitively closed). +%file_includes = (); + +# How much to say. +$verbose = 0; + +# Matches a macro definition. +# AC_DEFUN([macroname], ...) +# or +# AC_DEFUN(macroname, ...) +# When macroname is `['-quoted , we accept any character in the name, +# except `]'. Otherwise macroname stops on the first `]', `,', `)', +# or `\n' encountered. +$ac_defun_rx = + "(?:AU_ALIAS|A[CU]_DEFUN|AC_DEFUN_ONCE)\\((?:\\[([^]]+)\\]|([^],)\n]+))"; + +# Matches an AC_REQUIRE line. +$ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)"; + +# Matches an m4_include line +$m4_include_rx = "(?:m4_)?s?include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)"; + + +################################################################ + +# Check macros in acinclude.m4. If one is not used, warn. +sub check_acinclude () +{ + foreach my $key (keys %map) + { + # FIXME: should print line number of acinclude.m4. + warn ("aclocal: warning: macro `$key' defined in " + . "acinclude.m4 but never used\n") + if $map{$key} eq 'acinclude.m4' && ! $macro_seen{$key}; + } +} + +################################################################ + +# Scan all the installed m4 files and construct a map. +sub scan_m4_files (@) +{ + local (@dirlist) = @_; + + # First, scan configure.ac. It may contain macro definitions, + # or may include other files that define macros. + &scan_file ($configure_ac, 'aclocal'); + + # Then, scan acinclude.m4 if it exists. + if (-f 'acinclude.m4') + { + &scan_file ('acinclude.m4', 'aclocal'); + } + + # Finally, scan all files in our search path. + local ($m4dir); + foreach $m4dir (@dirlist) + { + if (! opendir (DIR, $m4dir)) + { + print STDERR "aclocal: couldn't open directory `$m4dir': $!\n"; + exit 1; + } + + local ($file, $fullfile); + # We reverse the directory contents so that foo2.m4 gets + # used in preference to foo1.m4. + foreach $file (reverse sort grep (! /^\./, readdir (DIR))) + { + # Only examine .m4 files. + next unless $file =~ /\.m4$/; + + # Skip some files when running out of srcdir. + next if $file eq 'aclocal.m4'; + + $fullfile = File::Spec->canonpath ("$m4dir/$file"); + &scan_file ($fullfile, 'aclocal'); + } + closedir (DIR); + } + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that + # "die" is correctly and easily propagated if run. + my $search = "sub search {\nmy \$found = 0;\n"; + foreach my $key (reverse sort keys %map) + { + $search .= ('if (/\b\Q' . $key . '\E(?!\w)/) { & add_macro ("' . $key + . '"); $found = 1; }' . "\n"); + } + $search .= "return \$found;\n};\n"; + eval $search; + die "internal error: $@\n search is $search" if $@; +} + +################################################################ + +# Add a macro to the output. +sub add_macro ($) +{ + local ($macro) = @_; + + # Ignore unknown required macros. Either they are not really + # needed (e.g., a conditional AC_REQUIRE), in which case aclocal + # should be quiet, or they are needed and Autoconf itself will + # complain when we trace for macro usage later. + return unless defined $map{$macro}; + + print STDERR "aclocal: saw macro $macro\n" if $verbose; + $macro_seen{$macro} = 1; + &add_file ($map{$macro}); +} + +# rel2abs ($file, $directory) +# --------------------------- +# Similar to File::Spec->rel2abs ($file, $directory), but +# work with Perl 5.005. (File::Spec->rel2abs is available +# only in Perl 5.6.) +# Remove this once we require 5.6. +sub rel2abs ($$) +{ + my ($file, $dir) = @_; + if (! File::Spec->file_name_is_absolute ($file)) + { + $dir = cwd () . "/$dir" + unless File::Spec->file_name_is_absolute ($dir); + $file = "$dir/$file"; + } + $file = File::Spec->canonpath ($file); + return $file; +} + +# scan_configure_dep ($file) +# -------------------------- +# Scan a configure dependency (configure.ac, or separate m4 files) +# for uses of know macros and AC_REQUIREs of possibly unknown macros. +# Recursively scan m4_included files. +my %scanned_configure_dep = (); +sub scan_configure_dep ($) +{ + my ($file) = @_; + # Do not scan a file twice. + return () + if exists $scanned_configure_dep{$file}; + $scanned_configure_dep{$file} = 1; + + my $mtime = mtime $file; + $greatest_mtime = $mtime if $greatest_mtime < $mtime; + + my $contents = exists $file_contents{$file} ? + $file_contents{$file} : contents $file; + + my $line = 0; + my @rlist = (); + my @ilist = (); + foreach (split ("\n", $contents)) + { + ++$line; + # Remove comments from current line. + s/\bdnl\b.*$//; + s/\#.*$//; + + while (/$m4_include_rx/go) + { + push (@ilist, $1 || $2); + } + + while (/$ac_require_rx/go) + { + push (@rlist, $1 || $2); + } + + # The search function is constructed dynamically by + # scan_m4_files. The last parenthetical match makes sure we + # don't match things that look like macro assignments or + # AC_SUBSTs. + if (! &search && /(^|\s+)(AM_[A-Z0-9_]+)($|[^\]\)=A-Z0-9_])/) + { + # Macro not found, but AM_ prefix found. + # Make this just a warning, because we do not know whether + # the macro is actually used (it could be called conditionally). + warn ("aclocal:$file:$line: warning: " + . "macro `$2' not found in library\n"); + } + } + + add_macro ($_) foreach (@rlist); + my $dirname = dirname $file; + &scan_configure_dep (rel2abs ($_, $dirname)) foreach (@ilist); +} + +# Add a file to output. +sub add_file ($) +{ + local ($file) = @_; + + # Only add a file once. + return if ($file_seen{$file}); + $file_seen{$file} = 1; + + scan_configure_dep $file; +} + +# Point to the documentation for underquoted AC_DEFUN only once. +my $underquoted_manual_once = 0; + +# scan_file ($FILE, $WHERE) +# ------------------------- +# Scan a single M4 file ($FILE), and all files it includes. +# Return the list of included files. +# $WHERE is the location to use in the diagnostic if the file +# does not exist. +sub scan_file ($$) +{ + my ($file, $where) = @_; + my $base = dirname $file; + + # Do not scan the same file twice. + return @$file_includes{$file} if exists $file_includes{$file}; + # Prevent potential infinite recursion (if two files include each other). + return () if exists $file_contents{$file}; + + unshift @file_order, $file; + + if (! -e $file) + { + print STDERR "$where: file `$file' does not exist\n"; + exit 1; + } + + my $fh = new Automake::XFile $file; + my $contents = ''; + my @inc_files = (); + my %inc_lines = (); + while ($_ = $fh->getline) + { + # Ignore `##' lines. + next if /^##/; + + $contents .= $_; + + while (/$ac_defun_rx/go) + { + if (! defined $1) + { + print STDERR "$file:$.: warning: underquoted definition of $2\n"; + print STDERR " run info '(automake)Extending aclocal'\n" + . " or see http://sources.redhat.com/automake/" + . "automake.html#Extending-aclocal\n" + unless $underquoted_manual_once; + $underquoted_manual_once = 1; + } + my $macro = $1 || $2; + if (! defined $map{$macro}) + { + print STDERR "aclocal: found macro $macro in $file: $.\n" + if $verbose; + $map{$macro} = $file; + } + else + { + # Note: we used to give an error here if we saw a + # duplicated macro. However, this turns out to be + # extremely unpopular. It causes actual problems which + # are hard to work around, especially when you must + # mix-and-match tool versions. + print STDERR "aclocal: ignoring macro $macro in $file: $.\n" + if $verbose; + } + } + + while (/$m4_include_rx/go) + { + my $ifile = $1 || $2; + # m4_include is relative to the directory of the file which + # perform the include, but we want paths relative to the + # directory where aclocal is run. Do not use + # File::Spec->rel2abs, because we want to store relative + # paths (they might be used later of aclocal outputs an + # m4_include for this file, or if the user itself includes + # this file). + $ifile = "$base/$ifile" + unless $base eq '.' || File::Spec->file_name_is_absolute ($ifile); + push (@inc_files, $ifile); + $inc_lines{$ifile} = $.; + } + } + $file_contents{$file} = $contents; + + # For some reason I don't understand, it does not work + # to do `map { scan_file ($_, ...) } @inc_files' below. + # With Perl 5.8.2 it undefines @inc_files. + my @copy = @inc_files; + my @all_inc_files = (@inc_files, + map { scan_file ($_, "$file:$inc_lines{$_}") } @copy); + $file_includes{$file} = \@all_inc_files; + return @all_inc_files; +} + +# strip_redundant_includes (%FILES) +# --------------------------------- +# Each key in %FILES is a file that must be present in the output. +# However some of these files might already include other files in %FILES, +# so there is no point in including them another time. +# This removes items of %FILES which are already included by another file. +sub strip_redundant_includes (%) +{ + my %files = @_; + # Files at the end of @file_order should override those at the beginning, + # so it is important to preserve these trailing files. We can remove + # a file A if it is going to be output before a file B that includes + # file A, not the converse. + foreach my $file (reverse @file_order) + { + next unless exists $files{$file}; + foreach my $ifile (@{$file_includes{$file}}) + { + next unless exists $files{$ifile}; + delete $files{$ifile}; + print STDERR "$ifile is already included by $file\n" + if $verbose; + } + } + return %files; +} + +sub trace_used_macros () +{ + my %files = map { $map{$_} => 1 } keys %macro_seen; + $files{'acinclude.m4'} = 1 if -f 'acinclude.m4'; + %files = strip_redundant_includes %files; + # configure.ac is implicitly included. + delete $files{$configure_ac}; + + my $traces = ($ENV{AUTOM4TE} || 'autom4te259'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + # All candidate files. + $traces .= join (' ', grep { exists $files{$_} } @file_order) . " "; + # All candidate macros. + $traces .= join (' ', map { "--trace='$_:\$f:\$n:\$1'" } ('AC_DEFUN', + 'AC_DEFUN_ONCE', + 'AU_DEFUN', + keys %macro_seen)); + + print STDERR "aclocal: running $traces $configure_ac\n" if $verbose; + + my $tracefh = new Automake::XFile ("$traces $configure_ac |"); + + my %traced = (); + + while ($_ = $tracefh->getline) + { + chomp; + my ($file, $macro, $arg1) = split (/:/); + + $traced{$macro} = 1 if $macro_seen{$macro}; + + $map_traced_defs{$arg1} = $file + if ($macro eq 'AC_DEFUN' + || $macro eq 'AC_DEFUN_ONCE' + || $macro eq 'AU_DEFUN'); + } + + $tracefh->close; + + return %traced; +} + +sub scan_configure () +{ + # Make sure we include acinclude.m4 if it exists. + if (-f 'acinclude.m4') + { + add_file ('acinclude.m4'); + } + scan_configure_dep ($configure_ac); +} + +################################################################ + +# Write output. +sub write_aclocal ($@) +{ + my ($output_file, @macros) = @_; + my $output = ''; + + my %files = (); + # Get the list of files containing definitions for the macros used. + # (Filter out unused macro definitions with $map_traced_defs. This + # can happen when an Autoconf macro is conditionally defined: + # aclocal sees the potential definition, but this definition is + # actually never processed and the Autoconf implementation is used + # instead.) + for my $m (@macros) + { + $files{$map{$m}} = 1 if $map{$m} eq $map_traced_defs{$m}; + } + $files{'acinclude.m4'} = 1 if -f 'acinclude.m4'; + %files = strip_redundant_includes %files; + delete $files{$configure_ac}; + + for $file (grep { exists $files{$_} } @file_order) + { + # Check the time stamp of this file, and all files it includes. + for my $ifile ($file, @{$file_includes{$file}}) + { + my $mtime = mtime $ifile; + $greatest_mtime = $mtime if $greatest_mtime < $mtime; + } + + # If the file to add looks like outside the project, copy it + # to the output. The regex catches filenames starting with + # things like `/', `\', or `c:\'. + if ($file =~ m,^(?:\w:)?[\\/],) + { + $output .= $file_contents{$file} . "\n"; + } + else + { + # Otherwise, simply include the file. + $output .= "m4_include([$file])\n"; + } + } + + # Nothing to output?! + # FIXME: Shouldn't we diagnose this? + return if ! length ($output); + + # We used to print `# $output_file generated automatically etc.' But + # this creates spurious differences when using autoreconf. Autoreconf + # creates aclocal.m4t and then rename it to aclocal.m4, but the + # rebuild rules generated by Automake create aclocal.m4 directly -- + # this would gives two ways to get the same file, with a different + # name in the header. + $output = "# generated automatically by aclocal $VERSION -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +$output"; + + # We try not to update $output_file unless necessary, because + # doing so invalidate Autom4te's cache and therefore slows down + # tools called after aclocal. + # + # We need to overwrite $output_file in the following situations. + # * The --force option is in use. + # * One of the dependencies is younger. + # (Not updating $output_file in this situation would cause + # make to call aclocal in loop.) + # * The contents of the current file are different from what + # we have computed. + if (!$force_output + && $greatest_mtime < mtime ($output_file) + && $output eq contents ($output_file)) + { + print STDERR "aclocal: $output_file unchanged\n" if $verbose; + return; + } + + print STDERR "aclocal: writing $output_file\n" if $verbose; + + my $out = new Automake::XFile "> $output_file"; + print $out $output; + return; +} + +################################################################ + +# Print usage and exit. +sub usage ($) +{ + local ($status) = @_; + + print "Usage: aclocal [OPTIONS] ...\n\n"; + print "\ +Generate `aclocal.m4' by scanning `configure.ac' or `configure.in' + + --acdir=DIR directory holding config files + --help print this help, then exit + -I DIR add directory to search list for .m4 files + --force always update output file + --output=FILE put output in FILE (default aclocal.m4) + --print-ac-dir print name of directory holding m4 files + --verbose don't be silent + --version print version number, then exit + +Report bugs to .\n"; + + exit $status; +} + +# Parse command line. +sub parse_arguments (@) +{ + local (@arglist) = @_; + local (@dirlist); + local ($print_and_exit) = 0; + + while (@arglist) + { + if ($arglist[0] =~ /^--acdir=(.+)$/) + { + $acdir = $1; + } + elsif ($arglist[0] =~/^--output=(.+)$/) + { + $output_file = $1; + } + elsif ($arglist[0] eq '-I') + { + shift (@arglist); + push (@dirlist, $arglist[0]); + } + elsif ($arglist[0] eq '--print-ac-dir') + { + $print_and_exit = 1; + } + elsif ($arglist[0] eq '--force') + { + $force_output = 1; + } + elsif ($arglist[0] eq '--verbose') + { + ++$verbose; + } + elsif ($arglist[0] eq '--version') + { + print "aclocal (GNU $PACKAGE) $VERSION\n"; + print "Written by Tom Tromey \n\n"; + print "Copyright (C) 2005 Free Software Foundation, Inc.\n"; + print "This is free software; see the source for copying conditions. There is NO\n"; + print "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; + exit 0; + } + elsif ($arglist[0] eq '--help') + { + &usage (0); + } + else + { + print STDERR "aclocal: unrecognized option -- `$arglist[0]'\nTry `aclocal --help' for more information.\n"; + exit 1; + } + + shift (@arglist); + } + + if ($print_and_exit) + { + print $acdir, "\n"; + exit 0; + } + + $default_dirlist="$acdir/dirlist" + if $acdir ne $default_acdir; + + unshift @dirlist, $acdir_x11 if -d "$acdir_x11/."; + + # By default $(datadir)/aclocal doesn't exist. We don't want to + # get an error in the case where we are searching the default + # directory and it hasn't been created. + push (@dirlist, $acdir) + unless $acdir eq $default_acdir && ! -d $acdir; + + # Finally, adds any directory listed in the `dirlist' file. + if (open (DEFAULT_DIRLIST, $default_dirlist)) + { + while () + { + # Ignore '#' lines. + next if /^#/; + # strip off newlines and end-of-line comments + s/\s*\#.*$//; + chomp ($contents=$_); + if (-d $contents ) + { + push (@dirlist, $contents); + } + } + close (DEFAULT_DIRLIST); + } + + return @dirlist; +} + +################################################################ + +local (@dirlist) = parse_arguments (@ARGV); +$configure_ac = require_configure_ac; +scan_m4_files (@dirlist); +scan_configure; +if (! $exit_code) + { + my %macro_traced = trace_used_macros; + write_aclocal ($output_file, keys %macro_traced); + } +check_acinclude; + +exit $exit_code; + +### Setup "GNU" style for perl-mode and cperl-mode. +## Local Variables: +## perl-indent-level: 2 +## perl-continued-statement-offset: 2 +## perl-continued-brace-offset: 0 +## perl-brace-offset: 0 +## perl-brace-imaginary-offset: 0 +## perl-label-offset: -2 +## cperl-indent-level: 2 +## cperl-brace-offset: 0 +## cperl-continued-brace-offset: 0 +## cperl-label-offset: -2 +## cperl-extra-newline-before-brace: t +## cperl-merge-trailing-else: nil +## cperl-continued-statement-offset: 2 +## End: diff --git a/bin/autoconf b/bin/autoconf new file mode 100755 index 0000000..c3475a1 --- /dev/null +++ b/bin/autoconf @@ -0,0 +1,271 @@ +#! /bin/sh +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Support unset when possible. +if (as_foo=foo; unset as_foo) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# autoconf -- create `configure' using m4 macros +# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003 +# 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: $0 [OPTION] ... [TEMPLATE-FILE] + +Generate a configuration script from a TEMPLATE-FILE if given, or +\`configure.ac' if present, or else \`configure.in'. Output is sent +to the standard output if TEMPLATE-FILE is given, else into +\`configure'. + +Operation modes: + -h, --help print this help, then exit + -V, --version print version number, then exit + -v, --verbose verbosely report processing + -d, --debug don't remove temporary files + -f, --force consider all files obsolete + -o, --output=FILE save output in FILE (stdout is the default) + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax] + +Warning categories include: + \`cross' cross compilation issues + \`obsolete' obsolete constructs + \`syntax' dubious syntactic constructs + \`all' all the warnings + \`no-CATEGORY' turn off the warnings on CATEGORY + \`none' turn off all the warnings + \`error' warnings are error + +The environment variable \`WARNINGS' is honored. + +Library directories: + -B, --prepend-include=DIR prepend directory DIR to search path + -I, --include=DIR append directory DIR to search path + +Tracing: + -t, --trace=MACRO report the list of calls to MACRO + -i, --initialization also trace Autoconf's initialization process + +In tracing mode, no configuration script is created. + +Report bugs to ." + +version="\ +autoconf (GNU Autoconf) 2.59 +Written by David J. MacKenzie and Akim Demaille. + +Copyright (C) 2003 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +me=`$as_basename $0 || +$as_expr X/$0 : '.*/\([^/][^/]*\)/*$' \| \ + X$0 : 'X\(//\)$' \| \ + X$0 : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/$0 | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + +help="\ +Try \`$me --help' for more information." + +exit_missing_arg="\ +echo \"$me: option \\\`\$1' requires an argument\" >&2 +echo \"\$help\" >&2 +exit 1" + +# Variables. +: ${AUTOM4TE='/usr/local/bin/autom4te259'} +dir=`(dirname $0) 2>/dev/null || +$as_expr X$0 : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$0 : 'X\(//\)[^/]' \| \ + X$0 : 'X\(//\)$' \| \ + X$0 : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$0 | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` +outfile= +verbose=: + +# Parse command line. +while test $# -gt 0 ; do + option=`expr "x$1" : 'x\(--[^=]*\)' \| \ + "x$1" : 'x\(-.\)'` + optarg=`expr "x$1" : 'x--[^=]*=\(.*\)' \| \ + "x$1" : 'x-.\(.*\)'` + case $1 in + --version | -V ) + echo "$version" ; exit 0 ;; + --help | -h ) + echo "$usage"; exit 0 ;; + + --verbose | -v ) + verbose=echo + AUTOM4TE="$AUTOM4TE $1"; shift ;; + + # Arguments passed as is to autom4te. + --debug | -d | \ + --force | -f | \ + --include=* | -I?* | \ + --prepend-include=* | -B?* | \ + --warnings=* | -W?* ) + AUTOM4TE="$AUTOM4TE $1"; shift ;; + + # Options with separated arg passed as is to autom4te. + --include | -I | \ + --prepend-include | -B | \ + --warnings | -W ) + test $# = 1 && eval "$exit_missing_arg" + AUTOM4TE="$AUTOM4TE $option $2" + shift 2 ;; + + --trace=* | -t?* ) + traces="$traces --trace='"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'" + shift ;; + --trace | -t ) + test $# = 1 && eval "$exit_missing_arg" + shift + traces="$traces --trace='"`echo "$1" | sed "s/'/'\\\\\\\\''/g"`"'" + shift ;; + --initialization | -i ) + AUTOM4TE="$AUTOM4TE --melt" + shift;; + + --output=* | -o?* ) + outfile=$optarg + shift ;; + --output | -o ) + test $# = 1 && eval "$exit_missing_arg" + shift + outfile=$1 + shift ;; + + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + exec >&2 + echo "$me: invalid option $1" + echo "$help" + exit 1 ;; + * ) + break ;; + esac +done + +# Find the input file. +case $# in + 0) + if test -f configure.ac; then + if test -f configure.in; then + echo "$me: warning: both \`configure.ac' and \`configure.in' are present." >&2 + echo "$me: warning: proceeding with \`configure.ac'." >&2 + fi + infile=configure.ac + elif test -f configure.in; then + infile=configure.in + else + echo "$me: no input file" >&2 + exit 1 + fi + test -z "$traces" && test -z "$outfile" && outfile=configure;; + 1) # autom4te doesn't like `-'. + test "x$1" != "x-" && infile=$1 ;; + *) exec >&2 + echo "$me: invalid number of arguments." + echo "$help" + (exit 1); exit 1 ;; +esac + +# Unless specified, the output is stdout. +test -z "$outfile" && outfile=- + +# Run autom4te with expansion. +eval set \$AUTOM4TE --language=autoconf --output=\$outfile "$traces" \$infile +$verbose "$me: running $*" >&2 +exec "$@" diff --git a/bin/autoheader b/bin/autoheader new file mode 100755 index 0000000..4ba3e77 --- /dev/null +++ b/bin/autoheader @@ -0,0 +1,296 @@ +#! /usr/bin/perl +# -*- Perl -*- +# Generated from autoheader.in; do not edit by hand. + +eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' + if 0; + +# autoheader -- create `config.h.in' from `configure.ac' +# Copyright (C) 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2002, 2003 +# 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. +# Rewritten in Perl by Akim Demaille. + +BEGIN +{ + my $datadir = $ENV{'autom4te_perllibdir'} || '/usr/local/share/autoconf259'; + unshift @INC, "$datadir"; + + # Override SHELL. On DJGPP SHELL may not be set to a shell + # that can handle redirection and quote arguments correctly, + # e.g.: COMMAND.COM. For DJGPP always use the shell that configure + # has detected. + $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); +} + +use Autom4te::ChannelDefs; +use Autom4te::Channels; +use Autom4te::Configure_ac; +use Autom4te::FileUtils; +use Autom4te::General; +use Autom4te::XFile; +use strict; + +# Using `do FILE', we need `local' vars. +use vars qw ($config_h %verbatim %symbol); + +# Lib files. +my $autom4te = $ENV{'AUTOM4TE'} || '/usr/local/bin/autom4te259'; +local $config_h; +my $config_h_in; +my @prepend_include; +my @include; + + +# $HELP +# ----- +$help = "Usage: $0 [OPTION] ... [TEMPLATE-FILE] + +Create a template file of C \`\#define\' statements for \`configure\' to +use. To this end, scan TEMPLATE-FILE, or \`configure.ac\' if present, +or else \`configure.in\'. + + -h, --help print this help, then exit + -V, --version print version number, then exit + -v, --verbose verbosely report processing + -d, --debug don\'t remove temporary files + -f, --force consider all files obsolete + -W, --warnings=CATEGORY report the warnings falling in CATEGORY + +" . Autom4te::ChannelDefs::usage () . " + +Library directories: + -B, --prepend-include=DIR prepend directory DIR to search path + -I, --include=DIR append directory DIR to search path + +Report bugs to . +"; + + +# $VERSION +# -------- +$version = "autoheader (GNU Autoconf) 2.59 +Written by Roland McGrath and Akim Demaille. + +Copyright (C) 2003 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +"; + + +## ---------- ## +## Routines. ## +## ---------- ## + + +# parse_args () +# ------------- +# Process any command line arguments. +sub parse_args () +{ + my $srcdir; + + parse_WARNINGS; + getopt ('I|include=s' => \@include, + 'B|prepend-include=s' => \@prepend_include, + 'W|warnings=s' => \&parse_warnings); + + if (! @ARGV) + { + my $configure_ac = require_configure_ac; + push @ARGV, $configure_ac; + } +} + + +## -------------- ## +## Main program. ## +## -------------- ## + +mktmpdir ('ah'); +switch_warning 'obsolete'; +parse_args; + +# Preach. +my $config_h_top = find_file ("config.h.top?", + reverse (@prepend_include), @include); +my $config_h_bot = find_file ("config.h.bot?", + reverse (@prepend_include), @include); +my $acconfig_h = find_file ("acconfig.h?", + reverse (@prepend_include), @include); +if ($config_h_top || $config_h_bot || $acconfig_h) + { + my $msg = << "END"; + Using auxiliary files such as \`acconfig.h\', \`config.h.bot\' + and \`config.h.top\', to define templates for \`config.h.in\' + is deprecated and discouraged. + + Using the third argument of \`AC_DEFINE\' and + \`AC_DEFINE_UNQUOTED\' allows to define a template without + \`acconfig.h\': + + AC_DEFINE([NEED_FUNC_MAIN], 1, + [Define if a function \`main\' is needed.]) + + More sophisticated templates can also be produced, see the + documentation. +END + $msg =~ s/^ /WARNING: /gm; + msg 'obsolete', $msg; + } + +# Set up autoconf. +my $autoconf = "$autom4te --language=autoconf "; +$autoconf .= join (' ', map { "--include=$_" } @include); +$autoconf .= join (' ', map { "--prepend-include=$_" } @prepend_include); +$autoconf .= ' --debug' if $debug; +$autoconf .= ' --force' if $force; +$autoconf .= ' --verbose' if $verbose; + +# ----------------------- # +# Real work starts here. # +# ----------------------- # + +# Source what the traces are trying to tell us. +verb "$me: running $autoconf to trace from $ARGV[0]"; +xsystem ("$autoconf" + # If you change this list, update the + # `Autoheader-preselections' section of autom4te.in. + . ' --trace AC_CONFIG_HEADERS:\'$$config_h ||= \'"\'"\'$1\'"\'"\';\'' + . ' --trace AH_OUTPUT:\'$$verbatim{\'"\'"\'$1\'"\'"\'} = \'"\'"\'$2\'"\'"\';\'' + . ' --trace AC_DEFINE_TRACE_LITERAL:\'$$symbol{\'"\'"\'$1\'"\'"\'} = 1;\'' + . " $ARGV[0] >$tmp/traces.pl"); + +local (%verbatim, %symbol); +debug "$me: \`do'ing $tmp/traces.pl:\n" . `sed 's/^/| /' $tmp/traces.pl`; +do "$tmp/traces.pl"; +warn "couldn't parse $tmp/traces.pl: $@" if $@; +error "error: AC_CONFIG_HEADERS not found in $ARGV[0]" + unless $config_h; + +# We template only the first CONFIG_HEADER. +$config_h =~ s/ .*//; +# Support "outfile[:infile]", defaulting infile="outfile.in". +($config_h, $config_h_in) = split (':', $config_h, 2); +$config_h_in ||= "$config_h.in"; + +# %SYMBOL might contain things like `F77_FUNC(name,NAME)', but we keep +# only the name of the macro. +%symbol = map { s/\(.*//; $_ => 1 } keys %symbol; + +my $out = new Autom4te::XFile (">$tmp/config.hin"); + +# Don't write "do not edit" -- it will get copied into the +# config.h, which it's ok to edit. +print $out "/* $config_h_in. Generated from $ARGV[0] by autoheader. */\n"; + +# Dump the top. +if ($config_h_top) + { + my $in = new Autom4te::XFile ($config_h_top); + while ($_ = $in->getline) + { + print $out $_; + } + } + +# Dump `acconfig.h', except for its bottom portion. +if ($acconfig_h) + { + my $in = new Autom4te::XFile ($acconfig_h); + while ($_ = $in->getline) + { + last if /\@BOTTOM\@/; + next if /\@TOP\@/; + print $out $_; + } + } + +# Dump the templates from `configure.ac'. +foreach (sort keys %verbatim) + { + print $out "\n$verbatim{$_}\n"; + } + +# Dump bottom portion of `acconfig.h'. +if ($acconfig_h) + { + my $in = new Autom4te::XFile ($acconfig_h); + my $dump = 0; + while ($_ = $in->getline) + { + print $out $_ if $dump; + $dump = 1 if /\@BOTTOM\@/; + } + } + +# Dump the bottom. +if ($config_h_bot) + { + my $in = new Autom4te::XFile ($config_h_bot); + while ($_ = $in->getline) + { + print $out $_; + } + } + +$out->close; + +# Check that all the symbols have a template. +{ + my $in = new Autom4te::XFile ("$tmp/config.hin"); + my $suggest_ac_define = 1; + while ($_ = $in->getline) + { + my ($symbol) = /^\#\s*\w+\s+(\w+)/ + or next; + delete $symbol{$symbol}; + } + foreach (sort keys %symbol) + { + msg 'syntax', "warning: missing template: $_"; + if ($suggest_ac_define) + { + msg 'syntax', "Use AC_DEFINE([$_], [], [Description])"; + $suggest_ac_define = 0; + } + + } + exit 1 + if keys %symbol; +} + +update_file ("$tmp/config.hin", "$config_h_in"); + +### Setup "GNU" style for perl-mode and cperl-mode. +## Local Variables: +## perl-indent-level: 2 +## perl-continued-statement-offset: 2 +## perl-continued-brace-offset: 0 +## perl-brace-offset: 0 +## perl-brace-imaginary-offset: 0 +## perl-label-offset: -2 +## cperl-indent-level: 2 +## cperl-brace-offset: 0 +## cperl-continued-brace-offset: 0 +## cperl-label-offset: -2 +## cperl-extra-newline-before-brace: t +## cperl-merge-trailing-else: nil +## cperl-continued-statement-offset: 2 +## End: diff --git a/bin/automake b/bin/automake new file mode 100755 index 0000000..7c472f7 --- /dev/null +++ b/bin/automake @@ -0,0 +1,7523 @@ +#!/usr/bin/perl -w +# -*- perl -*- +# Generated from automake.in; do not edit by hand. + +eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' + if 0; + +# automake - create Makefile.in from Makefile.am +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# Originally written by David Mackenzie . +# Perl reimplementation by Tom Tromey . + +package Language; + +BEGIN +{ + my $perllibdir = $ENV{'perllibdir'} || '/usr/local/share/automake19'; + unshift @INC, (split ':', $perllibdir); + + # Override SHELL. This is required on DJGPP so that system() uses + # bash, not COMMAND.COM which doesn't quote arguments properly. + # Other systems aren't expected to use $SHELL when Automake + # runs, but it should be safe to drop the `if DJGPP' guard if + # it turns up other systems need the same thing. After all, + # if SHELL is used, ./configure's SHELL is always better than + # the user's SHELL (which may be something like tcsh). + $ENV{'SHELL'} = '/bin/sh' if exists $ENV{'DJGPP'}; +} + +use Automake::Struct; +struct (# Short name of the language (c, f77...). + 'name' => "\$", + # Nice name of the language (C, Fortran 77...). + 'Name' => "\$", + + # List of configure variables which must be defined. + 'config_vars' => '@', + + 'ansi' => "\$", + # `pure' is `1' or `'. A `pure' language is one where, if + # all the files in a directory are of that language, then we + # do not require the C compiler or any code to call it. + 'pure' => "\$", + + 'autodep' => "\$", + + # Name of the compiling variable (COMPILE). + 'compiler' => "\$", + # Content of the compiling variable. + 'compile' => "\$", + # Flag to require compilation without linking (-c). + 'compile_flag' => "\$", + 'extensions' => '@', + # A subroutine to compute a list of possible extensions of + # the product given the input extensions. + # (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo')) + 'output_extensions' => "\$", + # A list of flag variables used in 'compile'. + # (defaults to []) + 'flags' => "@", + + # Any tag to pass to libtool while compiling. + 'libtool_tag' => "\$", + + # The file to use when generating rules for this language. + # The default is 'depend2'. + 'rule_file' => "\$", + + # Name of the linking variable (LINK). + 'linker' => "\$", + # Content of the linking variable. + 'link' => "\$", + + # Name of the linker variable (LD). + 'lder' => "\$", + # Content of the linker variable ($(CC)). + 'ld' => "\$", + + # Flag to specify the output file (-o). + 'output_flag' => "\$", + '_finish' => "\$", + + # This is a subroutine which is called whenever we finally + # determine the context in which a source file will be + # compiled. + '_target_hook' => "\$"); + + +sub finish ($) +{ + my ($self) = @_; + if (defined $self->_finish) + { + &{$self->_finish} (); + } +} + +sub target_hook ($$$$%) +{ + my ($self) = @_; + if (defined $self->_target_hook) + { + &{$self->_target_hook} (@_); + } +} + +package Automake; + +use strict; +use Automake::Config; +use Automake::General; +use Automake::XFile; +use Automake::Channels; +use Automake::ChannelDefs; +use Automake::Configure_ac; +use Automake::FileUtils; +use Automake::Location; +use Automake::Condition qw/TRUE FALSE/; +use Automake::DisjConditions; +use Automake::Options; +use Automake::Version; +use Automake::Variable; +use Automake::VarDef; +use Automake::Rule; +use Automake::RuleDef; +use Automake::Wrap 'makefile_wrap'; +use File::Basename; +use Carp; + +## ----------- ## +## Constants. ## +## ----------- ## + +# Some regular expressions. One reason to put them here is that it +# makes indentation work better in Emacs. + +# Writing singled-quoted-$-terminated regexes is a pain because +# perl-mode thinks of $' as the ${'} variable (instead of a $ followed +# by a closing quote. Letting perl-mode think the quote is not closed +# leads to all sort of misindentations. On the other hand, defining +# regexes as double-quoted strings is far less readable. So usually +# we will write: +# +# $REGEX = '^regex_value' . "\$"; + +my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n'; +my $WHITE_PATTERN = '^\s*' . "\$"; +my $COMMENT_PATTERN = '^#'; +my $TARGET_PATTERN='[$a-zA-Z_.@%][-.a-zA-Z0-9_(){}/$+@%]*'; +# A rule has three parts: a list of targets, a list of dependencies, +# and optionally actions. +my $RULE_PATTERN = + "^($TARGET_PATTERN(?:(?:\\\\\n|\\s)+$TARGET_PATTERN)*) *:([^=].*|)\$"; + +# Only recognize leading spaces, not leading tabs. If we recognize +# leading tabs here then we need to make the reader smarter, because +# otherwise it will think rules like `foo=bar; \' are errors. +my $ASSIGNMENT_PATTERN = '^ *([^ \t=:+]*)\s*([:+]?)=\s*(.*)' . "\$"; +# This pattern recognizes a Gnits version id and sets $1 if the +# release is an alpha release. We also allow a suffix which can be +# used to extend the version number with a "fork" identifier. +my $GNITS_VERSION_PATTERN = '\d+\.\d+([a-z]|\.\d+)?(-[A-Za-z0-9]+)?'; + +my $IF_PATTERN = '^if\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*)\s*(?:#.*)?' . "\$"; +my $ELSE_PATTERN = + '^else(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; +my $ENDIF_PATTERN = + '^endif(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; +my $PATH_PATTERN = '(\w|[+/.-])+'; +# This will pass through anything not of the prescribed form. +my $INCLUDE_PATTERN = ('^include\s+' + . '((\$\(top_srcdir\)/' . $PATH_PATTERN . ')' + . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')' + . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$"); + +# Match `-d' as a command-line argument in a string. +my $DASH_D_PATTERN = "(^|\\s)-d(\\s|\$)"; +# Directories installed during 'install-exec' phase. +my $EXEC_DIR_PATTERN = + '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$"; + +# Values for AC_CANONICAL_* +use constant AC_CANONICAL_BUILD => 1; +use constant AC_CANONICAL_HOST => 2; +use constant AC_CANONICAL_TARGET => 3; + +# Values indicating when something should be cleaned. +use constant MOSTLY_CLEAN => 0; +use constant CLEAN => 1; +use constant DIST_CLEAN => 2; +use constant MAINTAINER_CLEAN => 3; + +# Libtool files. +my @libtool_files = qw(ltmain.sh config.guess config.sub); +# ltconfig appears here for compatibility with old versions of libtool. +my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh); + +# Commonly found files we look for and automatically include in +# DISTFILES. +my @common_files = + (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB + COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO + ansi2knr.1 ansi2knr.c compile config.guess config.rpath config.sub + depcomp elisp-comp install-sh libversion.in mdate-sh missing + mkinstalldirs py-compile texinfo.tex ylwrap), + @libtool_files, @libtool_sometimes); + +# Commonly used files we auto-include, but only sometimes. This list +# is used for the --help output only. +my @common_sometimes = + qw(aclocal.m4 acconfig.h config.h.top config.h.bot configure + configure.ac configure.in stamp-vti); + +# Standard directories from the GNU Coding Standards, and additional +# pkg* directories from Automake. Stored in a hash for fast member check. +my %standard_prefix = + map { $_ => 1 } (qw(bin data exec include info lib libexec lisp + localstate man man1 man2 man3 man4 man5 man6 + man7 man8 man9 oldinclude pkgdatadir + pkgincludedir pkglibdir sbin sharedstate + sysconf)); + +# Copyright on generated Makefile.ins. +my $gen_copyright = "\ +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. +"; + +# These constants are returned by lang_*_rewrite functions. +# LANG_SUBDIR means that the resulting object file should be in a +# subdir if the source file is. In this case the file name cannot +# have `..' components. +use constant LANG_IGNORE => 0; +use constant LANG_PROCESS => 1; +use constant LANG_SUBDIR => 2; + +# These are used when keeping track of whether an object can be built +# by two different paths. +use constant COMPILE_LIBTOOL => 1; +use constant COMPILE_ORDINARY => 2; + +# We can't always associate a location to a variable or a rule, +# when its defined by Automake. We use INTERNAL in this case. +use constant INTERNAL => new Automake::Location; + + +## ---------------------------------- ## +## Variables related to the options. ## +## ---------------------------------- ## + +# TRUE if we should always generate Makefile.in. +my $force_generation = 1; + +# From the Perl manual. +my $symlink_exists = (eval 'symlink ("", "");', $@ eq ''); + +# TRUE if missing standard files should be installed. +my $add_missing = 0; + +# TRUE if we should copy missing files; otherwise symlink if possible. +my $copy_missing = 0; + +# TRUE if we should always update files that we know about. +my $force_missing = 0; + + +## ---------------------------------------- ## +## Variables filled during files scanning. ## +## ---------------------------------------- ## + +# Name of the configure.ac file. +my $configure_ac; + +# Files found by scanning configure.ac for LIBOBJS. +my %libsources = (); + +# Names used in AC_CONFIG_HEADER call. +my @config_headers = (); + +# Names used in AC_CONFIG_LINKS call. +my @config_links = (); + +# Directory where output files go. Actually, output files are +# relative to this directory. +my $output_directory; + +# List of Makefile.am's to process, and their corresponding outputs. +my @input_files = (); +my %output_files = (); + +# Complete list of Makefile.am's that exist. +my @configure_input_files = (); + +# List of files in AC_CONFIG_FILES/AC_OUTPUT without Makefile.am's, +# and their outputs. +my @other_input_files = (); +# Where each AC_CONFIG_FILES/AC_OUTPUT/AC_CONFIG_LINK/AC_CONFIG_HEADER appears. +# The keys are the files created by these macros. +my %ac_config_files_location = (); + +# Directory to search for configure-required files. This +# will be computed by &locate_aux_dir and can be set using +# AC_CONFIG_AUX_DIR in configure.ac. +# $CONFIG_AUX_DIR is the `raw' directory, valid only in the source-tree. +my $config_aux_dir = ''; +my $config_aux_dir_set_in_configure_ac = 0; +# $AM_CONFIG_AUX_DIR is prefixed with $(top_srcdir), so it can be used +# in Makefiles. +my $am_config_aux_dir = ''; + +# Whether AM_GNU_GETTEXT has been seen in configure.ac. +my $seen_gettext = 0; +# Whether AM_GNU_GETTEXT([external]) is used. +my $seen_gettext_external = 0; +# Where AM_GNU_GETTEXT appears. +my $ac_gettext_location; + +# Lists of tags supported by Libtool. +my %libtool_tags = (); + +# Most important AC_CANONICAL_* macro seen so far. +my $seen_canonical = 0; +# Location of that macro. +my $canonical_location; + +# Where AM_MAINTAINER_MODE appears. +my $seen_maint_mode; + +# Actual version we've seen. +my $package_version = ''; + +# Where version is defined. +my $package_version_location; + +# TRUE if we've seen AC_ENABLE_MULTILIB. +my $seen_multilib = 0; + +# TRUE if we've seen AM_PROG_CC_C_O +my $seen_cc_c_o = 0; + +# Where AM_INIT_AUTOMAKE is called; +my $seen_init_automake = 0; + +# TRUE if we've seen AM_AUTOMAKE_VERSION. +my $seen_automake_version = 0; + +# Hash table of discovered configure substitutions. Keys are names, +# values are `FILE:LINE' strings which are used by error message +# generation. +my %configure_vars = (); + +# Files included by $configure_ac. +my @configure_deps = (); + +# Greatest timestamp of configure's dependencies. +my $configure_deps_greatest_timestamp = 0; + +# Hash table of AM_CONDITIONAL variables seen in configure. +my %configure_cond = (); + +# This maps extensions onto language names. +my %extension_map = (); + +# List of the DIST_COMMON files we discovered while reading +# configure.in +my $configure_dist_common = ''; + +# This maps languages names onto objects. +my %languages = (); + +# List of targets we must always output. +# FIXME: Complete, and remove falsely required targets. +my %required_targets = + ( + 'all' => 1, + 'dvi' => 1, + 'pdf' => 1, + 'ps' => 1, + 'info' => 1, + 'install-info' => 1, + 'install' => 1, + 'install-data' => 1, + 'install-exec' => 1, + 'uninstall' => 1, + + # FIXME: Not required, temporary hacks. + # Well, actually they are sort of required: the -recursive + # targets will run them anyway... + 'dvi-am' => 1, + 'pdf-am' => 1, + 'ps-am' => 1, + 'info-am' => 1, + 'install-data-am' => 1, + 'install-exec-am' => 1, + 'installcheck-am' => 1, + 'uninstall-am' => 1, + + 'install-man' => 1, + ); + +# Set to 1 if this run will create the Makefile.in that distribute +# the files in config_aux_dir. +my $automake_will_process_aux_dir = 0; + +# The name of the Makefile currently being processed. +my $am_file = 'BUG'; + + +################################################################ + +## ------------------------------------------ ## +## Variables reset by &initialize_per_input. ## +## ------------------------------------------ ## + +# Basename and relative dir of the input file. +my $am_file_name; +my $am_relative_dir; + +# Same but wrt Makefile.in. +my $in_file_name; +my $relative_dir; + +# Greatest timestamp of the output's dependencies (excluding +# configure's dependencies). +my $output_deps_greatest_timestamp; + +# These two variables are used when generating each Makefile.in. +# They hold the Makefile.in until it is ready to be printed. +my $output_rules; +my $output_vars; +my $output_trailer; +my $output_all; +my $output_header; + +# This is the conditional stack, updated on if/else/endif, and +# used to build Condition objects. +my @cond_stack; + +# This holds the set of included files. +my @include_stack; + +# This holds a list of directories which we must create at `dist' +# time. This is used in some strange scenarios involving weird +# AC_OUTPUT commands. +my %dist_dirs; + +# List of dependencies for the obvious targets. +my @all; +my @check; +my @check_tests; + +# Keys in this hash table are files to delete. The associated +# value tells when this should happen (MOSTLY_CLEAN, DIST_CLEAN, etc.) +my %clean_files; + +# Keys in this hash table are object files or other files in +# subdirectories which need to be removed. This only holds files +# which are created by compilations. The value in the hash indicates +# when the file should be removed. +my %compile_clean_files; + +# Keys in this hash table are directories where we expect to build a +# libtool object. We use this information to decide what directories +# to delete. +my %libtool_clean_directories; + +# Value of `$(SOURCES)', used by tags.am. +my @sources; +# Sources which go in the distribution. +my @dist_sources; + +# This hash maps object file names onto their corresponding source +# file names. This is used to ensure that each object is created +# by a single source file. +my %object_map; + +# This hash maps object file names onto an integer value representing +# whether this object has been built via ordinary compilation or +# libtool compilation (the COMPILE_* constants). +my %object_compilation_map; + + +# This keeps track of the directories for which we've already +# created dirstamp code. +my %directory_map; + +# All .P files. +my %dep_files; + +# This is a list of all targets to run during "make dist". +my @dist_targets; + +# Keys in this hash are the basenames of files which must depend on +# ansi2knr. Values are either the empty string, or the directory in +# which the ANSI source file appears; the directory must have a +# trailing `/'. +my %de_ansi_files; + +# This is the name of the redirect `all' target to use. +my $all_target; + +# This keeps track of which extensions we've seen (that we care +# about). +my %extension_seen; + +# This is random scratch space for the language finish functions. +# Don't randomly overwrite it; examine other uses of keys first. +my %language_scratch; + +# We keep track of which objects need special (per-executable) +# handling on a per-language basis. +my %lang_specific_files; + +# This is set when `handle_dist' has finished. Once this happens, +# we should no longer push on dist_common. +my $handle_dist_run; + +# Used to store a set of linkers needed to generate the sources currently +# under consideration. +my %linkers_used; + +# True if we need `LINK' defined. This is a hack. +my $need_link; + +# Was get_object_extension run? +# FIXME: This is a hack. a better switch should be found. +my $get_object_extension_was_run; + +# Record each file processed by make_paragraphs. +my %transformed_files; + +################################################################ + +# var_SUFFIXES_trigger ($TYPE, $VALUE) +# ------------------------------------ +# This is called by Automake::Variable::define() when SUFFIXES +# is defined ($TYPE eq '') or appended ($TYPE eq '+'). +# The work here needs to be performed as a side-effect of the +# macro_define() call because SUFFIXES definitions impact +# on $KNOWN_EXTENSIONS_PATTERN which is used used when parsing +# the input am file. +sub var_SUFFIXES_trigger ($$) +{ + my ($type, $value) = @_; + accept_extensions (split (' ', $value)); +} +Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger); + +################################################################ + +## --------------------------------- ## +## Forward subroutine declarations. ## +## --------------------------------- ## +sub register_language (%); +sub file_contents_internal ($$$%); +sub define_files_variable ($\@$$); + + +# &initialize_per_input () +# ------------------------ +# (Re)-Initialize per-Makefile.am variables. +sub initialize_per_input () +{ + reset_local_duplicates (); + + $am_file_name = ''; + $am_relative_dir = ''; + + $in_file_name = ''; + $relative_dir = ''; + + $output_deps_greatest_timestamp = 0; + + $output_rules = ''; + $output_vars = ''; + $output_trailer = ''; + $output_all = ''; + $output_header = ''; + + Automake::Options::reset; + Automake::Variable::reset; + Automake::Rule::reset; + + @cond_stack = (); + + @include_stack = (); + + %dist_dirs = (); + + @all = (); + @check = (); + @check_tests = (); + + %clean_files = (); + + @sources = (); + @dist_sources = (); + + %object_map = (); + %object_compilation_map = (); + + %directory_map = (); + + %dep_files = (); + + @dist_targets = (); + + %de_ansi_files = (); + + $all_target = ''; + + %extension_seen = (); + + %language_scratch = (); + + %lang_specific_files = (); + + $handle_dist_run = 0; + + $need_link = 0; + + $get_object_extension_was_run = 0; + + %compile_clean_files = (); + + # We always include `.'. This isn't strictly correct. + %libtool_clean_directories = ('.' => 1); + + %transformed_files = (); +} + + +################################################################ + +# Initialize our list of languages that are internally supported. + +# C. +register_language ('name' => 'c', + 'Name' => 'C', + 'config_vars' => ['CC'], + 'ansi' => 1, + 'autodep' => '', + 'flags' => ['CFLAGS', 'CPPFLAGS'], + 'compiler' => 'COMPILE', + 'compile' => '$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)', + 'lder' => 'CCLD', + 'ld' => '$(CC)', + 'linker' => 'LINK', + 'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'compile_flag' => '-c', + 'libtool_tag' => 'CC', + 'extensions' => ['.c'], + '_finish' => \&lang_c_finish); + +# C++. +register_language ('name' => 'cxx', + 'Name' => 'C++', + 'config_vars' => ['CXX'], + 'linker' => 'CXXLINK', + 'link' => '$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'autodep' => 'CXX', + 'flags' => ['CXXFLAGS', 'CPPFLAGS'], + 'compile' => '$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)', + 'compiler' => 'CXXCOMPILE', + 'compile_flag' => '-c', + 'output_flag' => '-o', + 'libtool_tag' => 'CXX', + 'lder' => 'CXXLD', + 'ld' => '$(CXX)', + 'pure' => 1, + 'extensions' => ['.c++', '.cc', '.cpp', '.cxx', '.C']); + +# Objective C. +register_language ('name' => 'objc', + 'Name' => 'Objective C', + 'config_vars' => ['OBJC'], + 'linker' => 'OBJCLINK',, + 'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'autodep' => 'OBJC', + 'flags' => ['OBJCFLAGS', 'CPPFLAGS'], + 'compile' => '$(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS)', + 'compiler' => 'OBJCCOMPILE', + 'compile_flag' => '-c', + 'output_flag' => '-o', + 'lder' => 'OBJCLD', + 'ld' => '$(OBJC)', + 'pure' => 1, + 'extensions' => ['.m']); + +# Headers. +register_language ('name' => 'header', + 'Name' => 'Header', + 'extensions' => ['.h', '.H', '.hxx', '.h++', '.hh', + '.hpp', '.inc'], + # No output. + 'output_extensions' => sub { return () }, + # Nothing to do. + '_finish' => sub { }); + +# Yacc (C & C++). +register_language ('name' => 'yacc', + 'Name' => 'Yacc', + 'config_vars' => ['YACC'], + 'flags' => ['YFLAGS'], + 'compile' => '$(YACC) $(YFLAGS) $(AM_YFLAGS)', + 'compiler' => 'YACCCOMPILE', + 'extensions' => ['.y'], + 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/; + return ($ext,) }, + 'rule_file' => 'yacc', + '_finish' => \&lang_yacc_finish, + '_target_hook' => \&lang_yacc_target_hook); +register_language ('name' => 'yaccxx', + 'Name' => 'Yacc (C++)', + 'config_vars' => ['YACC'], + 'rule_file' => 'yacc', + 'flags' => ['YFLAGS'], + 'compiler' => 'YACCCOMPILE', + 'compile' => '$(YACC) $(YFLAGS) $(AM_YFLAGS)', + 'extensions' => ['.y++', '.yy', '.yxx', '.ypp'], + 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/; + return ($ext,) }, + '_finish' => \&lang_yacc_finish, + '_target_hook' => \&lang_yacc_target_hook); + +# Lex (C & C++). +register_language ('name' => 'lex', + 'Name' => 'Lex', + 'config_vars' => ['LEX'], + 'rule_file' => 'lex', + 'flags' => ['LFLAGS'], + 'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)', + 'compiler' => 'LEXCOMPILE', + 'extensions' => ['.l'], + 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/; + return ($ext,) }, + '_finish' => \&lang_lex_finish, + '_target_hook' => \&lang_lex_target_hook); +register_language ('name' => 'lexxx', + 'Name' => 'Lex (C++)', + 'config_vars' => ['LEX'], + 'rule_file' => 'lex', + 'flags' => ['LFLAGS'], + 'compile' => '$(LEX) $(LFLAGS) $(AM_LFLAGS)', + 'compiler' => 'LEXCOMPILE', + 'extensions' => ['.l++', '.ll', '.lxx', '.lpp'], + 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/; + return ($ext,) }, + '_finish' => \&lang_lex_finish, + '_target_hook' => \&lang_lex_target_hook); + +# Assembler. +register_language ('name' => 'asm', + 'Name' => 'Assembler', + 'config_vars' => ['CCAS', 'CCASFLAGS'], + + 'flags' => ['CCASFLAGS'], + # Users can set AM_ASFLAGS to includes DEFS, INCLUDES, + # or anything else required. They can also set AS. + 'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)', + 'compiler' => 'CCASCOMPILE', + 'compile_flag' => '-c', + 'extensions' => ['.s', '.S'], + + # With assembly we still use the C linker. + '_finish' => \&lang_c_finish); + +# Fortran 77 +register_language ('name' => 'f77', + 'Name' => 'Fortran 77', + 'linker' => 'F77LINK', + 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'flags' => ['FFLAGS'], + 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)', + 'compiler' => 'F77COMPILE', + 'compile_flag' => '-c', + 'output_flag' => '-o', + 'libtool_tag' => 'F77', + 'lder' => 'F77LD', + 'ld' => '$(F77)', + 'pure' => 1, + 'extensions' => ['.f', '.for']); + +# Fortran +register_language ('name' => 'fc', + 'Name' => 'Fortran', + 'linker' => 'FCLINK', + 'link' => '$(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'flags' => ['FCFLAGS'], + 'compile' => '$(FC) $(AM_FCFLAGS) $(FCFLAGS)', + 'compiler' => 'FCCOMPILE', + 'compile_flag' => '-c', + 'output_flag' => '-o', + 'lder' => 'FCLD', + 'ld' => '$(FC)', + 'pure' => 1, + 'extensions' => ['.f90', '.f95']); + +# Preprocessed Fortran +register_language ('name' => 'ppfc', + 'Name' => 'Preprocessed Fortran', + 'config_vars' => ['FC'], + 'linker' => 'FCLINK', + 'link' => '$(FCLD) $(AM_FCFLAGS) $(FCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'lder' => 'FCLD', + 'ld' => '$(FC)', + 'flags' => ['FCFLAGS', 'CPPFLAGS'], + 'compiler' => 'PPFCCOMPILE', + 'compile' => '$(FC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FCFLAGS) $(FCFLAGS)', + 'compile_flag' => '-c', + 'output_flag' => '-o', + 'libtool_tag' => 'FC', + 'pure' => 1, + 'extensions' => ['.F90','.F95']); + +# Preprocessed Fortran 77 +# +# The current support for preprocessing Fortran 77 just involves +# passing `$(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) +# $(CPPFLAGS)' as additional flags to the Fortran 77 compiler, since +# this is how GNU Make does it; see the `GNU Make Manual, Edition 0.51 +# for `make' Version 3.76 Beta' (specifically, from info file +# `(make)Catalogue of Rules'). +# +# A better approach would be to write an Autoconf test +# (i.e. AC_PROG_FPP) for a Fortran 77 preprocessor, because not all +# Fortran 77 compilers know how to do preprocessing. The Autoconf +# macro AC_PROG_FPP should test the Fortran 77 compiler first for +# preprocessing capabilities, and then fall back on cpp (if cpp were +# available). +register_language ('name' => 'ppf77', + 'Name' => 'Preprocessed Fortran 77', + 'config_vars' => ['F77'], + 'linker' => 'F77LINK', + 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'lder' => 'F77LD', + 'ld' => '$(F77)', + 'flags' => ['FFLAGS', 'CPPFLAGS'], + 'compiler' => 'PPF77COMPILE', + 'compile' => '$(F77) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_FFLAGS) $(FFLAGS)', + 'compile_flag' => '-c', + 'output_flag' => '-o', + 'libtool_tag' => 'F77', + 'pure' => 1, + 'extensions' => ['.F']); + +# Ratfor. +register_language ('name' => 'ratfor', + 'Name' => 'Ratfor', + 'config_vars' => ['F77'], + 'linker' => 'F77LINK', + 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'lder' => 'F77LD', + 'ld' => '$(F77)', + 'flags' => ['RFLAGS', 'FFLAGS'], + # FIXME also FFLAGS. + 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)', + 'compiler' => 'RCOMPILE', + 'compile_flag' => '-c', + 'output_flag' => '-o', + 'libtool_tag' => 'F77', + 'pure' => 1, + 'extensions' => ['.r']); + +# Java via gcj. +register_language ('name' => 'java', + 'Name' => 'Java', + 'config_vars' => ['GCJ'], + 'linker' => 'GCJLINK', + 'link' => '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', + 'autodep' => 'GCJ', + 'flags' => ['GCJFLAGS'], + 'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)', + 'compiler' => 'GCJCOMPILE', + 'compile_flag' => '-c', + 'output_flag' => '-o', + 'libtool_tag' => 'GCJ', + 'lder' => 'GCJLD', + 'ld' => '$(GCJ)', + 'pure' => 1, + 'extensions' => ['.java', '.class', '.zip', '.jar']); + +################################################################ + +# Error reporting functions. + +# err_am ($MESSAGE, [%OPTIONS]) +# ----------------------------- +# Uncategorized errors about the current Makefile.am. +sub err_am ($;%) +{ + msg_am ('error', @_); +} + +# err_ac ($MESSAGE, [%OPTIONS]) +# ----------------------------- +# Uncategorized errors about configure.ac. +sub err_ac ($;%) +{ + msg_ac ('error', @_); +} + +# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS]) +# --------------------------------------- +# Messages about about the current Makefile.am. +sub msg_am ($$;%) +{ + my ($channel, $msg, %opts) = @_; + msg $channel, "${am_file}.am", $msg, %opts; +} + +# msg_ac ($CHANNEL, $MESSAGE, [%OPTIONS]) +# --------------------------------------- +# Messages about about configure.ac. +sub msg_ac ($$;%) +{ + my ($channel, $msg, %opts) = @_; + msg $channel, $configure_ac, $msg, %opts; +} + +################################################################ + +# subst ($TEXT) +# ------------- +# Return a configure-style substitution using the indicated text. +# We do this to avoid having the substitutions directly in automake.in; +# when we do that they are sometimes removed and this causes confusion +# and bugs. +sub subst ($) +{ + my ($text) = @_; + return '@' . $text . '@'; +} + +################################################################ + + +# $BACKPATH +# &backname ($REL-DIR) +# -------------------- +# If I `cd $REL-DIR', then to come back, I should `cd $BACKPATH'. +# For instance `src/foo' => `../..'. +# Works with non strictly increasing paths, i.e., `src/../lib' => `..'. +sub backname ($) +{ + my ($file) = @_; + my @res; + foreach (split (/\//, $file)) + { + next if $_ eq '.' || $_ eq ''; + if ($_ eq '..') + { + pop @res; + } + else + { + push (@res, '..'); + } + } + return join ('/', @res) || '.'; +} + +################################################################ + + +# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise. +sub handle_options +{ + my $var = var ('AUTOMAKE_OPTIONS'); + if ($var) + { + # FIXME: We should disallow conditional definitions of AUTOMAKE_OPTIONS. + if (process_option_list ($var->rdef (TRUE)->location, + $var->value_as_list_recursive (cond_filter => + TRUE))) + { + return 1; + } + } + + if ($strictness == GNITS) + { + set_option ('readme-alpha', INTERNAL); + set_option ('std-options', INTERNAL); + set_option ('check-news', INTERNAL); + } + + return 0; +} + +# shadow_unconditionally ($varname, $where) +# ----------------------------------------- +# Return a $(variable) that contains all possible values +# $varname can take. +# If the VAR wasn't defined conditionally, return $(VAR). +# Otherwise we create a am__VAR_DIST variable which contains +# all possible values, and return $(am__VAR_DIST). +sub shadow_unconditionally ($$) +{ + my ($varname, $where) = @_; + my $var = var $varname; + if ($var->has_conditional_contents) + { + $varname = "am__${varname}_DIST"; + my @files = uniq ($var->value_as_list_recursive); + define_pretty_variable ($varname, TRUE, $where, @files); + } + return "\$($varname)" +} + +# get_object_extension ($EXTENSION) +# --------------------------------- +# Prefix $EXTENSION with $U if ansi2knr is in use. +sub get_object_extension ($) +{ + my ($extension) = @_; + + # Check for automatic de-ANSI-fication. + $extension = '$U' . $extension + if option 'ansi2knr'; + + $get_object_extension_was_run = 1; + + return $extension; +} + + +# Call finish function for each language that was used. +sub handle_languages +{ + if (! option 'no-dependencies') + { + # Include auto-dep code. Don't include it if DEP_FILES would + # be empty. + if (&saw_sources_p (0) && keys %dep_files) + { + # Set location of depcomp. + &define_variable ('depcomp', + "\$(SHELL) $am_config_aux_dir/depcomp", + INTERNAL); + &define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL); + + require_conf_file ("$am_file.am", FOREIGN, 'depcomp'); + + my @deplist = sort keys %dep_files; + # Generate each `include' individually. Irix 6 make will + # not properly include several files resulting from a + # variable expansion; generating many separate includes + # seems safest. + $output_rules .= "\n"; + foreach my $iter (@deplist) + { + $output_rules .= (subst ('AMDEP_TRUE') + . subst ('am__include') + . ' ' + . subst ('am__quote') + . $iter + . subst ('am__quote') + . "\n"); + } + + # Compute the set of directories to remove in distclean-depend. + my @depdirs = uniq (map { dirname ($_) } @deplist); + $output_rules .= &file_contents ('depend', + new Automake::Location, + DEPDIRS => "@depdirs"); + } + } + else + { + &define_variable ('depcomp', '', INTERNAL); + &define_variable ('am__depfiles_maybe', '', INTERNAL); + } + + my %done; + + # Is the c linker needed? + my $needs_c = 0; + foreach my $ext (sort keys %extension_seen) + { + next unless $extension_map{$ext}; + + my $lang = $languages{$extension_map{$ext}}; + + my $rule_file = $lang->rule_file || 'depend2'; + + # Get information on $LANG. + my $pfx = $lang->autodep; + my $fpfx = ($pfx eq '') ? 'CC' : $pfx; + + my ($AMDEP, $FASTDEP) = + (option 'no-dependencies' || $lang->autodep eq 'no') + ? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx"); + + my %transform = ('EXT' => $ext, + 'PFX' => $pfx, + 'FPFX' => $fpfx, + 'AMDEP' => $AMDEP, + 'FASTDEP' => $FASTDEP, + '-c' => $lang->compile_flag || '', + 'MORE-THAN-ONE' + => (count_files_for_language ($lang->name) > 1)); + + # Generate the appropriate rules for this extension. + if (((! option 'no-dependencies') && $lang->autodep ne 'no') + || defined $lang->compile) + { + # Some C compilers don't support -c -o. Use it only if really + # needed. + my $output_flag = $lang->output_flag || ''; + $output_flag = '-o' + if (! $output_flag + && $lang->name eq 'c' + && option 'subdir-objects'); + + # Compute a possible derived extension. + # This is not used by depend2.am. + my $der_ext = (&{$lang->output_extensions} ($ext))[0]; + + # When we output an inference rule like `.c.o:' we + # have two cases to consider: either subdir-objects + # is used, or it is not. + # + # In the latter case the rule is used to build objects + # in the current directory, and dependencies always + # go into `./$(DEPDIR)/'. We can hard-code this value. + # + # In the former case the rule can be used to build + # objects in sub-directories too. Dependencies should + # go into the appropriate sub-directories, e.g., + # `sub/$(DEPDIR)/'. The value of this directory + # need the be computed on-the-fly. + # + # DEPBASE holds the name of this directory, plus the + # basename part of the object file (extensions Po, TPo, + # Plo, TPlo will be added later as appropriate). It is + # either hardcoded, or a shell variable (`$depbase') that + # will be computed by the rule. + my $depbase = + option ('subdir-objects') ? '$$depbase' : '$(DEPDIR)/$*'; + $output_rules .= + file_contents ($rule_file, + new Automake::Location, + %transform, + GENERIC => 1, + + 'DERIVED-EXT' => $der_ext, + + DEPBASE => $depbase, + BASE => '$*', + SOURCE => '$<', + OBJ => '$@', + OBJOBJ => '$@', + LTOBJ => '$@', + + COMPILE => '$(' . $lang->compiler . ')', + LTCOMPILE => '$(LT' . $lang->compiler . ')', + -o => $output_flag, + SUBDIROBJ => !! option 'subdir-objects'); + } + + # Now include code for each specially handled object with this + # language. + my %seen_files = (); + foreach my $file (@{$lang_specific_files{$lang->name}}) + { + my ($derived, $source, $obj, $myext, %file_transform) = @$file; + + # We might see a given object twice, for instance if it is + # used under different conditions. + next if defined $seen_files{$obj}; + $seen_files{$obj} = 1; + + prog_error ("found " . $lang->name . + " in handle_languages, but compiler not defined") + unless defined $lang->compile; + + my $obj_compile = $lang->compile; + + # Rewrite each occurrence of `AM_$flag' in the compile + # rule into `${derived}_$flag' if it exists. + for my $flag (@{$lang->flags}) + { + my $val = "${derived}_$flag"; + $obj_compile =~ s/\(AM_$flag\)/\($val\)/ + if set_seen ($val); + } + + my $libtool_tag = ''; + if ($lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}) + { + $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' + } + + my $obj_ltcompile = + "\$(LIBTOOL) $libtool_tag--mode=compile $obj_compile"; + + # We _need_ `-o' for per object rules. + my $output_flag = $lang->output_flag || '-o'; + + my $depbase = dirname ($obj); + $depbase = '' + if $depbase eq '.'; + $depbase .= '/' + unless $depbase eq ''; + $depbase .= '$(DEPDIR)/' . basename ($obj); + + # Support for deansified files in subdirectories is ugly + # enough to deserve an explanation. + # + # A Note about normal ansi2knr processing first. On + # + # AUTOMAKE_OPTIONS = ansi2knr + # bin_PROGRAMS = foo + # foo_SOURCES = foo.c + # + # we generate rules similar to: + # + # foo: foo$U.o; link ... + # foo$U.o: foo$U.c; compile ... + # foo_.c: foo.c; ansi2knr ... + # + # this is fairly compact, and will call ansi2knr depending + # on the value of $U (`' or `_'). + # + # It's harder with subdir sources. On + # + # AUTOMAKE_OPTIONS = ansi2knr + # bin_PROGRAMS = foo + # foo_SOURCES = sub/foo.c + # + # we have to create foo_.c in the current directory. + # (Unless the user asks 'subdir-objects'.) This is important + # in case the same file (`foo.c') is compiled from other + # directories with different cpp options: foo_.c would + # be preprocessed for only one set of options if it were + # put in the subdirectory. + # + # Because foo$U.o must be built from either foo_.c or + # sub/foo.c we can't be as concise as in the first example. + # Instead we output + # + # foo: foo$U.o; link ... + # foo_.o: foo_.c; compile ... + # foo.o: sub/foo.c; compile ... + # foo_.c: foo.c; ansi2knr ... + # + # This is why we'll now transform $rule_file twice + # if we detect this case. + # A first time we output the compile rule with `$U' + # replaced by `_' and the source directory removed, + # and another time we simply remove `$U'. + # + # Note that at this point $source (as computed by + # &handle_single_transform) is `sub/foo$U.c'. + # This can be confusing: it can be used as-is when + # subdir-objects is set, otherwise you have to know + # it really means `foo_.c' or `sub/foo.c'. + my $objdir = dirname ($obj); + my $srcdir = dirname ($source); + if ($lang->ansi && $obj =~ /\$U/) + { + prog_error "`$obj' contains \$U, but `$source' doesn't." + if $source !~ /\$U/; + + (my $source_ = $source) =~ s/\$U/_/g; + # Output an additional rule if _.c and .c are not in + # the same directory. (_.c is always in $objdir.) + if ($objdir ne $srcdir) + { + (my $obj_ = $obj) =~ s/\$U/_/g; + (my $depbase_ = $depbase) =~ s/\$U/_/g; + $source_ = basename ($source_); + + $output_rules .= + file_contents ($rule_file, + new Automake::Location, + %transform, + GENERIC => 0, + + DEPBASE => $depbase_, + BASE => $obj_, + SOURCE => $source_, + OBJ => "$obj_$myext", + OBJOBJ => "$obj_.obj", + LTOBJ => "$obj_.lo", + + COMPILE => $obj_compile, + LTCOMPILE => $obj_ltcompile, + -o => $output_flag, + %file_transform); + $obj =~ s/\$U//g; + $depbase =~ s/\$U//g; + $source =~ s/\$U//g; + } + } + + $output_rules .= + file_contents ($rule_file, + new Automake::Location, + %transform, + GENERIC => 0, + + DEPBASE => $depbase, + BASE => $obj, + SOURCE => $source, + # Use $myext and not `.o' here, in case + # we are actually building a new source + # file -- e.g. via yacc. + OBJ => "$obj$myext", + OBJOBJ => "$obj.obj", + LTOBJ => "$obj.lo", + + COMPILE => $obj_compile, + LTCOMPILE => $obj_ltcompile, + -o => $output_flag, + %file_transform); + } + + # The rest of the loop is done once per language. + next if defined $done{$lang}; + $done{$lang} = 1; + + # Load the language dependent Makefile chunks. + my %lang = map { uc ($_) => 0 } keys %languages; + $lang{uc ($lang->name)} = 1; + $output_rules .= file_contents ('lang-compile', + new Automake::Location, + %transform, %lang); + + # If the source to a program consists entirely of code from a + # `pure' language, for instance C++ for Fortran 77, then we + # don't need the C compiler code. However if we run into + # something unusual then we do generate the C code. There are + # probably corner cases here that do not work properly. + # People linking Java code to Fortran code deserve pain. + $needs_c ||= ! $lang->pure; + + define_compiler_variable ($lang) + if ($lang->compile); + + define_linker_variable ($lang) + if ($lang->link); + + require_variables ("$am_file.am", $lang->Name . " source seen", + TRUE, @{$lang->config_vars}); + + # Call the finisher. + $lang->finish; + + # Flags listed in `->flags' are user variables (per GNU Standards), + # they should not be overridden in the Makefile... + my @dont_override = @{$lang->flags}; + # ... and so is LDFLAGS. + push @dont_override, 'LDFLAGS' if $lang->link; + + foreach my $flag (@dont_override) + { + my $var = var $flag; + if ($var) + { + for my $cond ($var->conditions->conds) + { + if ($var->rdef ($cond)->owner == VAR_MAKEFILE) + { + msg_cond_var ('gnu', $cond, $flag, + "`$flag' is a user variable, " + . "you should not override it;\n" + . "use `AM_$flag' instead."); + } + } + } + } + } + + # If the project is entirely C++ or entirely Fortran 77 (i.e., 1 + # suffix rule was learned), don't bother with the C stuff. But if + # anything else creeps in, then use it. + $needs_c = 1 + if $need_link || suffix_rules_count > 1; + + if ($needs_c) + { + &define_compiler_variable ($languages{'c'}) + unless defined $done{$languages{'c'}}; + define_linker_variable ($languages{'c'}); + } +} + +# Check to make sure a source defined in LIBOBJS is not explicitly +# mentioned. This is a separate function (as opposed to being inlined +# in handle_source_transform) because it isn't always appropriate to +# do this check. +sub check_libobjs_sources +{ + my ($one_file, $unxformed) = @_; + + foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', + 'dist_EXTRA_', 'nodist_EXTRA_') + { + my @files; + my $varname = $prefix . $one_file . '_SOURCES'; + my $var = var ($varname); + if ($var) + { + @files = $var->value_as_list_recursive; + } + elsif ($prefix eq '') + { + @files = ($unxformed . '.c'); + } + else + { + next; + } + + foreach my $file (@files) + { + err_var ($prefix . $one_file . '_SOURCES', + "automatically discovered file `$file' should not" . + " be explicitly mentioned") + if defined $libsources{$file}; + } + } +} + + +# @OBJECTS +# handle_single_transform ($VAR, $TOPPARENT, $DERIVED, $OBJ, $FILE, %TRANSFORM) +# ----------------------------------------------------------------------------- +# Does much of the actual work for handle_source_transform. +# Arguments are: +# $VAR is the name of the variable that the source filenames come from +# $TOPPARENT is the name of the _SOURCES variable which is being processed +# $DERIVED is the name of resulting executable or library +# $OBJ is the object extension (e.g., `$U.lo') +# $FILE the source file to transform +# %TRANSFORM contains extras arguments to pass to file_contents +# when producing explicit rules +# Result is a list of the names of objects +# %linkers_used will be updated with any linkers needed +sub handle_single_transform ($$$$$%) +{ + my ($var, $topparent, $derived, $obj, $_file, %transform) = @_; + my @files = ($_file); + my @result = (); + my $nonansi_obj = $obj; + $nonansi_obj =~ s/\$U//g; + + # Turn sources into objects. We use a while loop like this + # because we might add to @files in the loop. + while (scalar @files > 0) + { + $_ = shift @files; + + # Configure substitutions in _SOURCES variables are errors. + if (/^\@.*\@$/) + { + my $parent_msg = ''; + $parent_msg = "\nand is referred to from `$topparent'" + if $topparent ne $var->name; + err_var ($var, + "`" . $var->name . "' includes configure substitution `$_'" + . $parent_msg . ";\nconfigure " . + "substitutions are not allowed in _SOURCES variables"); + next; + } + + # If the source file is in a subdirectory then the `.o' is put + # into the current directory, unless the subdir-objects option + # is in effect. + + # Split file name into base and extension. + next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/; + my $full = $_; + my $directory = $1 || ''; + my $base = $2; + my $extension = $3; + + # We must generate a rule for the object if it requires its own flags. + my $renamed = 0; + my ($linker, $object); + + # This records whether we've seen a derived source file (e.g. + # yacc output). + my $derived_source = 0; + + # This holds the `aggregate context' of the file we are + # currently examining. If the file is compiled with + # per-object flags, then it will be the name of the object. + # Otherwise it will be `AM'. This is used by the target hook + # language function. + my $aggregate = 'AM'; + + $extension = &derive_suffix ($extension, $nonansi_obj); + my $lang; + if ($extension_map{$extension} && + ($lang = $languages{$extension_map{$extension}})) + { + # Found the language, so see what it says. + &saw_extension ($extension); + + # Note: computed subr call. The language rewrite function + # should return one of the LANG_* constants. It could + # also return a list whose first value is such a constant + # and whose second value is a new source extension which + # should be applied. This means this particular language + # generates another source file which we must then process + # further. + my $subr = \&{'lang_' . $lang->name . '_rewrite'}; + my ($r, $source_extension) + = &$subr ($directory, $base, $extension); + # Skip this entry if we were asked not to process it. + next if $r == LANG_IGNORE; + + # Now extract linker and other info. + $linker = $lang->linker; + + my $this_obj_ext; + if (defined $source_extension) + { + $this_obj_ext = $source_extension; + $derived_source = 1; + } + elsif ($lang->ansi) + { + $this_obj_ext = $obj; + } + else + { + $this_obj_ext = $nonansi_obj; + } + $object = $base . $this_obj_ext; + + # Do we have per-executable flags for this executable? + my $have_per_exec_flags = 0; + foreach my $flag (@{$lang->flags}) + { + if (set_seen ("${derived}_$flag")) + { + $have_per_exec_flags = 1; + last; + } + } + + if ($have_per_exec_flags) + { + # We have a per-executable flag in effect for this + # object. In this case we rewrite the object's + # name to ensure it is unique. We also require + # the `compile' program to deal with compilers + # where `-c -o' does not work. + + # We choose the name `DERIVED_OBJECT' to ensure + # (1) uniqueness, and (2) continuity between + # invocations. However, this will result in a + # name that is too long for losing systems, in + # some situations. So we provide _SHORTNAME to + # override. + + my $dname = $derived; + my $var = var ($derived . '_SHORTNAME'); + if ($var) + { + # FIXME: should use the same Condition as + # the _SOURCES variable. But this is really + # silly overkill -- nobody should have + # conditional shortnames. + $dname = $var->variable_value; + } + $object = $dname . '-' . $object; + + require_conf_file ("$am_file.am", FOREIGN, 'compile') + if $lang->name eq 'c'; + + prog_error ($lang->name . " flags defined without compiler") + if ! defined $lang->compile; + + $renamed = 1; + } + + # If rewrite said it was ok, put the object into a + # subdir. + if ($r == LANG_SUBDIR && $directory ne '') + { + $object = $directory . '/' . $object; + } + + # If the object file has been renamed (because per-target + # flags are used) we cannot compile the file with an + # inference rule: we need an explicit rule. + # + # If the source is in a subdirectory and the object is in + # the current directory, we also need an explicit rule. + # + # If both source and object files are in a subdirectory + # (this happens when the subdir-objects option is used), + # then the inference will work. + # + # The latter case deserves a historical note. When the + # subdir-objects option was added on 1999-04-11 it was + # thought that inferences rules would work for + # subdirectory objects too. Later, on 1999-11-22, + # automake was changed to output explicit rules even for + # subdir-objects. Nobody remembers why, but this occured + # soon after the merge of the user-dep-gen-branch so it + # might be related. In late 2003 people complained about + # the size of the generated Makefile.ins (libgcj, with + # 2200+ subdir objects was reported to have a 9MB + # Makefile), so we now rely on inference rules again. + # Maybe we'll run across the same issue as in the past, + # but at least this time we can document it. However since + # dependency tracking has evolved it is possible that + # our old problem no longer exists. + # Using inference rules for subdir-objects has been tested + # with GNU make, Solaris make, Ultrix make, BSD make, + # HP-UX make, and OSF1 make successfully. + if ($renamed || + ($directory ne '' && ! option 'subdir-objects')) + { + my $obj_sans_ext = substr ($object, 0, + - length ($this_obj_ext)); + my $full_ansi = $full; + if ($lang->ansi && option 'ansi2knr') + { + $full_ansi =~ s/$KNOWN_EXTENSIONS_PATTERN$/\$U$&/; + $obj_sans_ext .= '$U'; + } + + my @specifics = ($full_ansi, $obj_sans_ext, + # Only use $this_obj_ext in the derived + # source case because in the other case we + # *don't* want $(OBJEXT) to appear here. + ($derived_source ? $this_obj_ext : '.o')); + + # If we renamed the object then we want to use the + # per-executable flag name. But if this is simply a + # subdir build then we still want to use the AM_ flag + # name. + if ($renamed) + { + unshift @specifics, $derived; + $aggregate = $derived; + } + else + { + unshift @specifics, 'AM'; + } + + # Each item on this list is a reference to a list consisting + # of four values followed by additional transform flags for + # file_contents. The four values are the derived flag prefix + # (e.g. for `foo_CFLAGS', it is `foo'), the name of the + # source file, the base name of the output file, and + # the extension for the object file. + push (@{$lang_specific_files{$lang->name}}, + [@specifics, %transform]); + } + } + elsif ($extension eq $nonansi_obj) + { + # This is probably the result of a direct suffix rule. + # In this case we just accept the rewrite. + $object = "$base$extension"; + $linker = ''; + } + else + { + # No error message here. Used to have one, but it was + # very unpopular. + # FIXME: we could potentially do more processing here, + # perhaps treating the new extension as though it were a + # new source extension (as above). This would require + # more restructuring than is appropriate right now. + next; + } + + err_am "object `$object' created by `$full' and `$object_map{$object}'" + if (defined $object_map{$object} + && $object_map{$object} ne $full); + + my $comp_val = (($object =~ /\.lo$/) + ? COMPILE_LIBTOOL : COMPILE_ORDINARY); + (my $comp_obj = $object) =~ s/\.lo$/.\$(OBJEXT)/; + if (defined $object_compilation_map{$comp_obj} + && $object_compilation_map{$comp_obj} != 0 + # Only see the error once. + && ($object_compilation_map{$comp_obj} + != (COMPILE_LIBTOOL | COMPILE_ORDINARY)) + && $object_compilation_map{$comp_obj} != $comp_val) + { + err_am "object `$comp_obj' created both with libtool and without"; + } + $object_compilation_map{$comp_obj} |= $comp_val; + + if (defined $lang) + { + # Let the language do some special magic if required. + $lang->target_hook ($aggregate, $object, $full, %transform); + } + + if ($derived_source) + { + prog_error ($lang->name . " has automatic dependency tracking") + if $lang->autodep ne 'no'; + # Make sure this new source file is handled next. That will + # make it appear to be at the right place in the list. + unshift (@files, $object); + # Distribute derived sources unless the source they are + # derived from is not. + &push_dist_common ($object) + unless ($topparent =~ /^(?:nobase_)?nodist_/); + next; + } + + $linkers_used{$linker} = 1; + + push (@result, $object); + + if (! defined $object_map{$object}) + { + my @dep_list = (); + $object_map{$object} = $full; + + # If resulting object is in subdir, we need to make + # sure the subdir exists at build time. + if ($object =~ /\//) + { + # FIXME: check that $DIRECTORY is somewhere in the + # project + + # For Java, the way we're handling it right now, a + # `..' component doesn't make sense. + if ($lang->name eq 'java' && $object =~ /(\/|^)\.\.\//) + { + err_am "`$full' should not contain a `..' component"; + } + + # Make sure object is removed by `make mostlyclean'. + $compile_clean_files{$object} = MOSTLY_CLEAN; + # If we have a libtool object then we also must remove + # the ordinary .o. + if ($object =~ /\.lo$/) + { + (my $xobj = $object) =~ s,lo$,\$(OBJEXT),; + $compile_clean_files{$xobj} = MOSTLY_CLEAN; + + # Remove any libtool object in this directory. + $libtool_clean_directories{$directory} = 1; + } + + push (@dep_list, require_build_directory ($directory)); + + # If we're generating dependencies, we also want + # to make sure that the appropriate subdir of the + # .deps directory is created. + push (@dep_list, + require_build_directory ($directory . '/$(DEPDIR)')) + unless option 'no-dependencies'; + } + + &pretty_print_rule ($object . ':', "\t", @dep_list) + if scalar @dep_list > 0; + } + + # Transform .o or $o file into .P file (for automatic + # dependency code). + if ($lang && $lang->autodep ne 'no') + { + my $depfile = $object; + $depfile =~ s/\.([^.]*)$/.P$1/; + $depfile =~ s/\$\(OBJEXT\)$/o/; + $dep_files{dirname ($depfile) . '/$(DEPDIR)/' + . basename ($depfile)} = 1; + } + } + + return @result; +} + + +# $LINKER +# define_objects_from_sources ($VAR, $OBJVAR, $NODEFINE, $ONE_FILE, +# $OBJ, $PARENT, $TOPPARENT, $WHERE, %TRANSFORM) +# --------------------------------------------------------------------------- +# Define an _OBJECTS variable for a _SOURCES variable (or subvariable) +# +# Arguments are: +# $VAR is the name of the _SOURCES variable +# $OBJVAR is the name of the _OBJECTS variable if known (otherwise +# it will be generated and returned). +# $NODEFINE is a boolean: if true, $OBJVAR will not be defined (but +# work done to determine the linker will be). +# $ONE_FILE is the canonical (transformed) name of object to build +# $OBJ is the object extension (i.e. either `.o' or `.lo'). +# $TOPPARENT is the _SOURCES variable being processed. +# $WHERE context into which this definition is done +# %TRANSFORM extra arguments to pass to file_contents when producing +# rules +# +# Result is a pair ($LINKER, $OBJVAR): +# $LINKER is a boolean, true if a linker is needed to deal with the objects +sub define_objects_from_sources ($$$$$$$%) +{ + my ($var, $objvar, $nodefine, $one_file, + $obj, $topparent, $where, %transform) = @_; + + my $needlinker = ""; + + transform_variable_recursively + ($var, $objvar, 'am__objects', $nodefine, $where, + # The transform code to run on each filename. + sub { + my ($subvar, $val, $cond, $full_cond) = @_; + my @trans = handle_single_transform ($subvar, $topparent, + $one_file, $obj, $val, + %transform); + $needlinker = "true" if @trans; + return @trans; + }); + + return $needlinker; +} + + +# handle_source_transform ($CANON_TARGET, $TARGET, $OBJEXT, $WHERE, %TRANSFORM) +# ----------------------------------------------------------------------------- +# Handle SOURCE->OBJECT transform for one program or library. +# Arguments are: +# canonical (transformed) name of target to build +# actual target of object to build +# object extension (i.e. either `.o' or `$o'. +# location of the source variable +# extra arguments to pass to file_contents when producing rules +# Return result is name of linker variable that must be used. +# Empty return means just use `LINK'. +sub handle_source_transform ($$$$%) +{ + # one_file is canonical name. unxformed is given name. obj is + # object extension. + my ($one_file, $unxformed, $obj, $where, %transform) = @_; + + my ($linker) = ''; + + # No point in continuing if _OBJECTS is defined. + return if reject_var ($one_file . '_OBJECTS', + $one_file . '_OBJECTS should not be defined'); + + my %used_pfx = (); + my $needlinker; + %linkers_used = (); + foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', + 'dist_EXTRA_', 'nodist_EXTRA_') + { + my $varname = $prefix . $one_file . "_SOURCES"; + my $var = var $varname; + next unless $var; + + # We are going to define _OBJECTS variables using the prefix. + # Then we glom them all together. So we can't use the null + # prefix here as we need it later. + my $xpfx = ($prefix eq '') ? 'am_' : $prefix; + + # Keep track of which prefixes we saw. + $used_pfx{$xpfx} = 1 + unless $prefix =~ /EXTRA_/; + + push @sources, "\$($varname)"; + push @dist_sources, shadow_unconditionally ($varname, $where) + unless (option ('no-dist') || $prefix =~ /^nodist_/); + + $needlinker |= + define_objects_from_sources ($varname, + $xpfx . $one_file . '_OBJECTS', + $prefix =~ /EXTRA_/, + $one_file, $obj, $varname, $where, + DIST_SOURCE => ($prefix !~ /^nodist_/), + %transform); + } + if ($needlinker) + { + $linker ||= &resolve_linker (%linkers_used); + } + + my @keys = sort keys %used_pfx; + if (scalar @keys == 0) + { + # The default source for libfoo.la is libfoo.c, but for + # backward compatibility we first look at libfoo_la.c + my $old_default_source = "$one_file.c"; + (my $default_source = $unxformed) =~ s,(\.[^./\\]*)?$,.c,; + if ($old_default_source ne $default_source + && (rule $old_default_source + || rule '$(srcdir)/' . $old_default_source + || rule '${srcdir}/' . $old_default_source + || -f $old_default_source)) + { + my $loc = $where->clone; + $loc->pop_context; + msg ('obsolete', $loc, + "the default source for `$unxformed' has been changed " + . "to `$default_source'.\n(Using `$old_default_source' for " + . "backward compatibility.)"); + $default_source = $old_default_source; + } + # If a rule exists to build this source with a $(srcdir) + # prefix, use that prefix in our variables too. This is for + # the sake of BSD Make. + if (rule '$(srcdir)/' . $default_source + || rule '${srcdir}/' . $default_source) + { + $default_source = '$(srcdir)/' . $default_source; + } + + &define_variable ($one_file . "_SOURCES", $default_source, $where); + push (@sources, $default_source); + push (@dist_sources, $default_source); + + %linkers_used = (); + my (@result) = + handle_single_transform ($one_file . '_SOURCES', + $one_file . '_SOURCES', + $one_file, $obj, + $default_source, %transform); + $linker ||= &resolve_linker (%linkers_used); + define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result); + } + else + { + @keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys; + define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys); + } + + # If we want to use `LINK' we must make sure it is defined. + if ($linker eq '') + { + $need_link = 1; + } + + return $linker; +} + + +# handle_lib_objects ($XNAME, $VAR) +# --------------------------------- +# Special-case ALLOCA and LIBOBJS substitutions in _LDADD or _LIBADD variables. +# Also, generate _DEPENDENCIES variable if appropriate. +# Arguments are: +# transformed name of object being built, or empty string if no object +# name of _LDADD/_LIBADD-type variable to examine +# Returns 1 if LIBOBJS seen, 0 otherwise. +sub handle_lib_objects +{ + my ($xname, $varname) = @_; + + my $var = var ($varname); + prog_error "handle_lib_objects: `$varname' undefined" + unless $var; + prog_error "handle_lib_objects: unexpected variable name `$varname'" + unless $varname =~ /^(.*)(?:LIB|LD)ADD$/; + my $prefix = $1 || 'AM_'; + + my $seen_libobjs = 0; + my $flagvar = 0; + + transform_variable_recursively + ($varname, $xname . '_DEPENDENCIES', 'am__DEPENDENCIES', + ! $xname, INTERNAL, + # Transformation function, run on each filename. + sub { + my ($subvar, $val, $cond, $full_cond) = @_; + + if ($val =~ /^-/) + { + # Skip -lfoo and -Ldir silently; these are explicitly allowed. + if ($val !~ /^-[lL]/ && + # Skip -dlopen and -dlpreopen; these are explicitly allowed + # for Libtool libraries or programs. (Actually we are a bit + # laxest here since this code also applies to non-libtool + # libraries or programs, for which -dlopen and -dlopreopen + # are pure non-sence. Diagnosting this doesn't seems very + # important: the developer will quickly get complaints from + # the linker.) + $val !~ /^-dl(?:pre)?open$/ && + # Only get this error once. + ! $flagvar) + { + $flagvar = 1; + # FIXME: should display a stack of nested variables + # as context when $var != $subvar. + err_var ($var, "linker flags such as `$val' belong in " + . "`${prefix}LDFLAGS"); + } + return (); + } + elsif ($val !~ /^\@.*\@$/) + { + # Assume we have a file of some sort, and output it into the + # dependency variable. Autoconf substitutions are not output; + # rarely is a new dependency substituted into e.g. foo_LDADD + # -- but bad things (e.g. -lX11) are routinely substituted. + # Note that LIBOBJS and ALLOCA are exceptions to this rule, + # and handled specially below. + return $val; + } + elsif ($val =~ /^\@(LT)?LIBOBJS\@$/) + { + handle_LIBOBJS ($subvar, $cond, $1); + $seen_libobjs = 1; + return $val; + } + elsif ($val =~ /^\@(LT)?ALLOCA\@$/) + { + handle_ALLOCA ($subvar, $cond, $1); + return $val; + } + else + { + return (); + } + }); + + return $seen_libobjs; +} + +sub handle_LIBOBJS ($$$) +{ + my ($var, $cond, $lt) = @_; + $lt ||= ''; + my $myobjext = ($1 ? 'l' : '') . 'o'; + + $var->requires_variables ("\@${lt}LIBOBJS\@ used", $lt . 'LIBOBJS') + if ! keys %libsources; + + foreach my $iter (keys %libsources) + { + if ($iter =~ /\.[cly]$/) + { + &saw_extension ($&); + &saw_extension ('.c'); + } + + if ($iter =~ /\.h$/) + { + require_file_with_macro ($cond, $var, FOREIGN, $iter); + } + elsif ($iter ne 'alloca.c') + { + my $rewrite = $iter; + $rewrite =~ s/\.c$/.P$myobjext/; + $dep_files{'$(DEPDIR)/' . $rewrite} = 1; + $rewrite = "^" . quotemeta ($iter) . "\$"; + # Only require the file if it is not a built source. + my $bs = var ('BUILT_SOURCES'); + if (! $bs || ! grep (/$rewrite/, $bs->value_as_list_recursive)) + { + require_file_with_macro ($cond, $var, FOREIGN, $iter); + } + } + } +} + +sub handle_ALLOCA ($$$) +{ + my ($var, $cond, $lt) = @_; + my $myobjext = ($lt ? 'l' : '') . 'o'; + $lt ||= ''; + $var->requires_variables ("\@${lt}ALLOCA\@ used", $lt . 'ALLOCA'); + $dep_files{'$(DEPDIR)/alloca.P' . $myobjext} = 1; + require_file_with_macro ($cond, $var, FOREIGN, 'alloca.c'); + &saw_extension ('c'); +} + +# Canonicalize the input parameter +sub canonicalize +{ + my ($string) = @_; + $string =~ tr/A-Za-z0-9_\@/_/c; + return $string; +} + +# Canonicalize a name, and check to make sure the non-canonical name +# is never used. Returns canonical name. Arguments are name and a +# list of suffixes to check for. +sub check_canonical_spelling +{ + my ($name, @suffixes) = @_; + + my $xname = &canonicalize ($name); + if ($xname ne $name) + { + foreach my $xt (@suffixes) + { + reject_var ("$name$xt", "use `$xname$xt', not `$name$xt'"); + } + } + + return $xname; +} + + +# handle_compile () +# ----------------- +# Set up the compile suite. +sub handle_compile () +{ + return + unless $get_object_extension_was_run; + + # Boilerplate. + my $default_includes = ''; + if (! option 'nostdinc') + { + $default_includes = ' -I. -I$(srcdir)'; + + my $var = var 'CONFIG_HEADER'; + if ($var) + { + foreach my $hdr (split (' ', $var->variable_value)) + { + $default_includes .= ' -I' . dirname ($hdr); + } + } + } + + my (@mostly_rms, @dist_rms); + foreach my $item (sort keys %compile_clean_files) + { + if ($compile_clean_files{$item} == MOSTLY_CLEAN) + { + push (@mostly_rms, "\t-rm -f $item"); + } + elsif ($compile_clean_files{$item} == DIST_CLEAN) + { + push (@dist_rms, "\t-rm -f $item"); + } + else + { + prog_error 'invalid entry in %compile_clean_files'; + } + } + + my ($coms, $vars, $rules) = + &file_contents_internal (1, "$libdir/am/compile.am", + new Automake::Location, + ('DEFAULT_INCLUDES' => $default_includes, + 'MOSTLYRMS' => join ("\n", @mostly_rms), + 'DISTRMS' => join ("\n", @dist_rms))); + $output_vars .= $vars; + $output_rules .= "$coms$rules"; + + # Check for automatic de-ANSI-fication. + if (option 'ansi2knr') + { + my ($ansi2knr_filename, $ansi2knr_where) = @{option 'ansi2knr'}; + my $ansi2knr_dir = ''; + + require_variables ($ansi2knr_where, "option `ansi2knr' is used", + TRUE, "ANSI2KNR", "U"); + + # topdir is where ansi2knr should be. + if ($ansi2knr_filename eq 'ansi2knr') + { + # Only require ansi2knr files if they should appear in + # this directory. + require_file ($ansi2knr_where, FOREIGN, + 'ansi2knr.c', 'ansi2knr.1'); + + # ansi2knr needs to be built before subdirs, so unshift it. + unshift (@all, '$(ANSI2KNR)'); + } + else + { + $ansi2knr_dir = dirname ($ansi2knr_filename); + } + + $output_rules .= &file_contents ('ansi2knr', + new Automake::Location, + 'ANSI2KNR-DIR' => $ansi2knr_dir); + + } +} + +# handle_libtool () +# ----------------- +# Handle libtool rules. +sub handle_libtool +{ + return unless var ('LIBTOOL'); + + # Libtool requires some files, but only at top level. + require_conf_file_with_macro (TRUE, 'LIBTOOL', FOREIGN, @libtool_files) + if $relative_dir eq '.'; + + my @libtool_rms; + foreach my $item (sort keys %libtool_clean_directories) + { + my $dir = ($item eq '.') ? '' : "$item/"; + # .libs is for Unix, _libs for DOS. + push (@libtool_rms, "\t-rm -rf ${dir}.libs ${dir}_libs"); + } + + # Output the libtool compilation rules. + $output_rules .= &file_contents ('libtool', + new Automake::Location, + LTRMS => join ("\n", @libtool_rms)); +} + +# handle_programs () +# ------------------ +# Handle C programs. +sub handle_programs +{ + my @proglist = &am_install_var ('progs', 'PROGRAMS', + 'bin', 'sbin', 'libexec', 'pkglib', + 'noinst', 'check'); + return if ! @proglist; + + my $seen_global_libobjs = + var ('LDADD') && &handle_lib_objects ('', 'LDADD'); + + foreach my $pair (@proglist) + { + my ($where, $one_file) = @$pair; + + my $seen_libobjs = 0; + my $obj = get_object_extension '.$(OBJEXT)'; + + # Strip any $(EXEEXT) suffix the user might have added, or this + # will confuse &handle_source_transform and &check_canonical_spelling. + # We'll add $(EXEEXT) back later anyway. + $one_file =~ s/\$\(EXEEXT\)$//; + + # Canonicalize names and check for misspellings. + my $xname = &check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS', + '_SOURCES', '_OBJECTS', + '_DEPENDENCIES'); + + $where->push_context ("while processing program `$one_file'"); + $where->set (INTERNAL->get); + + my $linker = &handle_source_transform ($xname, $one_file, $obj, $where, + NONLIBTOOL => 1, LIBTOOL => 0); + + if (var ($xname . "_LDADD")) + { + $seen_libobjs = &handle_lib_objects ($xname, $xname . '_LDADD'); + } + else + { + # User didn't define prog_LDADD override. So do it. + &define_variable ($xname . '_LDADD', '$(LDADD)', $where); + + # This does a bit too much work. But we need it to + # generate _DEPENDENCIES when appropriate. + if (var ('LDADD')) + { + $seen_libobjs = &handle_lib_objects ($xname, 'LDADD'); + } + } + + reject_var ($xname . '_LIBADD', + "use `${xname}_LDADD', not `${xname}_LIBADD'"); + + set_seen ($xname . '_DEPENDENCIES'); + set_seen ($xname . '_LDFLAGS'); + + # Determine program to use for link. + my $xlink; + if (var ($xname . '_LINK')) + { + $xlink = $xname . '_LINK'; + } + else + { + $xlink = $linker ? $linker : 'LINK'; + } + + # If the resulting program lies into a subdirectory, + # make sure this directory will exist. + my $dirstamp = require_build_directory_maybe ($one_file); + + $output_rules .= &file_contents ('program', + $where, + PROGRAM => $one_file, + XPROGRAM => $xname, + XLINK => $xlink, + DIRSTAMP => $dirstamp, + EXEEXT => '$(EXEEXT)'); + + if ($seen_libobjs || $seen_global_libobjs) + { + if (var ($xname . '_LDADD')) + { + &check_libobjs_sources ($xname, $xname . '_LDADD'); + } + elsif (var ('LDADD')) + { + &check_libobjs_sources ($xname, 'LDADD'); + } + } + } +} + + +# handle_libraries () +# ------------------- +# Handle libraries. +sub handle_libraries +{ + my @liblist = &am_install_var ('libs', 'LIBRARIES', + 'lib', 'pkglib', 'noinst', 'check'); + return if ! @liblist; + + my @prefix = am_primary_prefixes ('LIBRARIES', 0, 'lib', 'pkglib', + 'noinst', 'check'); + + if (@prefix) + { + my $var = rvar ($prefix[0] . '_LIBRARIES'); + $var->requires_variables ('library used', 'RANLIB'); + } + + &define_variable ('AR', 'ar', INTERNAL); + &define_variable ('ARFLAGS', 'cru', INTERNAL); + + foreach my $pair (@liblist) + { + my ($where, $onelib) = @$pair; + + my $seen_libobjs = 0; + # Check that the library fits the standard naming convention. + my $bn = basename ($onelib); + if ($bn !~ /^lib.*\.a$/) + { + $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.a/; + my $suggestion = dirname ($onelib) . "/$bn"; + $suggestion =~ s|^\./||g; + msg ('error-gnu/warn', $where, + "`$onelib' is not a standard library name\n" + . "did you mean `$suggestion'?") + } + + $where->push_context ("while processing library `$onelib'"); + $where->set (INTERNAL->get); + + my $obj = get_object_extension '.$(OBJEXT)'; + + # Canonicalize names and check for misspellings. + my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES', + '_OBJECTS', '_DEPENDENCIES', + '_AR'); + + if (! var ($xlib . '_AR')) + { + &define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where); + } + + # Generate support for conditional object inclusion in + # libraries. + if (var ($xlib . '_LIBADD')) + { + if (&handle_lib_objects ($xlib, $xlib . '_LIBADD')) + { + $seen_libobjs = 1; + } + } + else + { + &define_variable ($xlib . "_LIBADD", '', $where); + } + + reject_var ($xlib . '_LDADD', + "use `${xlib}_LIBADD', not `${xlib}_LDADD'"); + + # Make sure we at look at this. + set_seen ($xlib . '_DEPENDENCIES'); + + &handle_source_transform ($xlib, $onelib, $obj, $where, + NONLIBTOOL => 1, LIBTOOL => 0); + + # If the resulting library lies into a subdirectory, + # make sure this directory will exist. + my $dirstamp = require_build_directory_maybe ($onelib); + + $output_rules .= &file_contents ('library', + $where, + LIBRARY => $onelib, + XLIBRARY => $xlib, + DIRSTAMP => $dirstamp); + + if ($seen_libobjs) + { + if (var ($xlib . '_LIBADD')) + { + &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); + } + } + } +} + + +# handle_ltlibraries () +# --------------------- +# Handle shared libraries. +sub handle_ltlibraries +{ + my @liblist = &am_install_var ('ltlib', 'LTLIBRARIES', + 'noinst', 'lib', 'pkglib', 'check'); + return if ! @liblist; + + my @prefix = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib', + 'noinst', 'check'); + + if (@prefix) + { + my $var = rvar ($prefix[0] . '_LTLIBRARIES'); + $var->requires_variables ('Libtool library used', 'LIBTOOL'); + } + + my %instdirs = (); + my %instconds = (); + my %liblocations = (); # Location (in Makefile.am) of each library. + + foreach my $key (@prefix) + { + # Get the installation directory of each library. + (my $dir = $key) =~ s/^nobase_//; + my $var = rvar ($key . '_LTLIBRARIES'); + + # We reject libraries which are installed in several places + # in the same condition, because we can only specify one + # `-rpath' option. + $var->traverse_recursively + (sub + { + my ($var, $val, $cond, $full_cond) = @_; + my $hcond = $full_cond->human; + my $where = $var->rdef ($cond)->location; + # A library cannot be installed in different directory + # in overlapping conditions. + if (exists $instconds{$val}) + { + my ($msg, $acond) = + $instconds{$val}->ambiguous_p ($val, $full_cond); + + if ($msg) + { + error ($where, $msg, partial => 1); + + my $dirtxt = "installed in `$dir'"; + $dirtxt = "built for `$dir'" + if $dir eq 'EXTRA' || $dir eq 'noinst' || $dir eq 'check'; + my $dircond = + $full_cond->true ? "" : " in condition $hcond"; + + error ($where, "`$val' should be $dirtxt$dircond ...", + partial => 1); + + my $hacond = $acond->human; + my $adir = $instdirs{$val}{$acond}; + my $adirtxt = "installed in `$adir'"; + $adirtxt = "built for `$adir'" + if ($adir eq 'EXTRA' || $adir eq 'noinst' + || $adir eq 'check'); + my $adircond = $acond->true ? "" : " in condition $hacond"; + + my $onlyone = ($dir ne $adir) ? + ("\nLibtool libraries can be built for only one " + . "destination.") : ""; + + error ($liblocations{$val}{$acond}, + "... and should also be $adirtxt$adircond.$onlyone"); + return; + } + } + else + { + $instconds{$val} = new Automake::DisjConditions; + } + $instdirs{$val}{$full_cond} = $dir; + $liblocations{$val}{$full_cond} = $where; + $instconds{$val} = $instconds{$val}->merge ($full_cond); + }, + sub + { + return (); + }, + skip_ac_subst => 1); + } + + foreach my $pair (@liblist) + { + my ($where, $onelib) = @$pair; + + my $seen_libobjs = 0; + my $obj = get_object_extension '.lo'; + + # Canonicalize names and check for misspellings. + my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS', + '_SOURCES', '_OBJECTS', + '_DEPENDENCIES'); + + # Check that the library fits the standard naming convention. + my $libname_rx = '^lib.*\.la'; + my $ldvar = var ("${xlib}_LDFLAGS") || var ('AM_LDFLAGS'); + my $ldvar2 = var ('LDFLAGS'); + if (($ldvar && grep (/-module/, $ldvar->value_as_list_recursive)) + || ($ldvar2 && grep (/-module/, $ldvar2->value_as_list_recursive))) + { + # Relax name checking for libtool modules. + $libname_rx = '\.la'; + } + + my $bn = basename ($onelib); + if ($bn !~ /$libname_rx$/) + { + my $type = 'library'; + if ($libname_rx eq '\.la') + { + $bn =~ s/^(lib|)(.*?)(?:\.[^.]*)?$/$1$2.la/; + $type = 'module'; + } + else + { + $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.la/; + } + my $suggestion = dirname ($onelib) . "/$bn"; + $suggestion =~ s|^\./||g; + msg ('error-gnu/warn', $where, + "`$onelib' is not a standard libtool $type name\n" + . "did you mean `$suggestion'?") + } + + $where->push_context ("while processing Libtool library `$onelib'"); + $where->set (INTERNAL->get); + + # Make sure we look at these. + set_seen ($xlib . '_LDFLAGS'); + set_seen ($xlib . '_DEPENDENCIES'); + + # Generate support for conditional object inclusion in + # libraries. + if (var ($xlib . '_LIBADD')) + { + if (&handle_lib_objects ($xlib, $xlib . '_LIBADD')) + { + $seen_libobjs = 1; + } + } + else + { + &define_variable ($xlib . "_LIBADD", '', $where); + } + + reject_var ("${xlib}_LDADD", + "use `${xlib}_LIBADD', not `${xlib}_LDADD'"); + + + my $linker = &handle_source_transform ($xlib, $onelib, $obj, $where, + NONLIBTOOL => 0, LIBTOOL => 1); + + # Determine program to use for link. + my $xlink; + if (var ($xlib . '_LINK')) + { + $xlink = $xlib . '_LINK'; + } + else + { + $xlink = $linker ? $linker : 'LINK'; + } + + my $rpathvar = "am_${xlib}_rpath"; + my $rpath = "\$($rpathvar)"; + foreach my $rcond ($instconds{$onelib}->conds) + { + my $val; + if ($instdirs{$onelib}{$rcond} eq 'EXTRA' + || $instdirs{$onelib}{$rcond} eq 'noinst' + || $instdirs{$onelib}{$rcond} eq 'check') + { + # It's an EXTRA_ library, so we can't specify -rpath, + # because we don't know where the library will end up. + # The user probably knows, but generally speaking automake + # doesn't -- and in fact configure could decide + # dynamically between two different locations. + $val = ''; + } + else + { + $val = ('-rpath $(' . $instdirs{$onelib}{$rcond} . 'dir)'); + } + if ($rcond->true) + { + # If $rcond is true there is only one condition and + # there is no point defining an helper variable. + $rpath = $val; + } + else + { + define_pretty_variable ($rpathvar, $rcond, INTERNAL, $val); + } + } + + # If the resulting library lies into a subdirectory, + # make sure this directory will exist. + my $dirstamp = require_build_directory_maybe ($onelib); + + # Remember to cleanup .libs/ in this directory. + my $dirname = dirname $onelib; + $libtool_clean_directories{$dirname} = 1; + + $output_rules .= &file_contents ('ltlibrary', + $where, + LTLIBRARY => $onelib, + XLTLIBRARY => $xlib, + RPATH => $rpath, + XLINK => $xlink, + DIRSTAMP => $dirstamp); + if ($seen_libobjs) + { + if (var ($xlib . '_LIBADD')) + { + &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); + } + } + } +} + +# See if any _SOURCES variable were misspelled. +sub check_typos () +{ + # It is ok if the user sets this particular variable. + set_seen 'AM_LDFLAGS'; + + foreach my $var (variables) + { + my $varname = $var->name; + # A configure variable is always legitimate. + next if exists $configure_vars{$varname}; + + my $check = 0; + foreach my $primary ('_SOURCES', '_LIBADD', '_LDADD', '_LDFLAGS', + '_DEPENDENCIES') + { + if ($varname =~ /^(.*)$primary$/) + { + $check = $1; + last; + } + } + next unless $check; + + for my $cond ($var->conditions->conds) + { + msg_var ('syntax', $var, "variable `$varname' is defined but no" + . " program or\nlibrary has `$check' as canonic name" + . " (possible typo)") + unless $var->rdef ($cond)->seen; + } + } +} + + +# Handle scripts. +sub handle_scripts +{ + # NOTE we no longer automatically clean SCRIPTS, because it is + # useful to sometimes distribute scripts verbatim. This happens + # e.g. in Automake itself. + &am_install_var ('-candist', 'scripts', 'SCRIPTS', + 'bin', 'sbin', 'libexec', 'pkgdata', + 'noinst', 'check'); +} + + + + +## ------------------------ ## +## Handling Texinfo files. ## +## ------------------------ ## + +# ($OUTFILE, $VFILE, @CLEAN_FILES) +# &scan_texinfo_file ($FILENAME) +# ------------------------------ +# $OUTFILE - name of the info file produced by $FILENAME. +# $VFILE - name of the version.texi file used (undef if none). +# @CLEAN_FILES - list of byproducts (indexes etc.) +sub scan_texinfo_file ($) +{ + my ($filename) = @_; + + # Some of the following extensions are always created, no matter + # whether indexes are used or not. Other (like cps, fns, ... pgs) + # are only created when they are used. We used to scan $FILENAME + # for their use, but that is not enough: they could be used in + # included files. We can't scan included files because we don't + # know the include path. Therefore we always erase these files, no + # matter whether they are used or not. + # + # (tmp is only created if an @macro is used and a certain e-TeX + # feature is not available.) + my %clean_suffixes = + map { $_ => 1 } (qw(aux log toc tmp + cp cps + fn fns + ky kys + vr vrs + tp tps + pg pgs)); # grep 'new.*index' texinfo.tex + + my $texi = new Automake::XFile "< $filename"; + verb "reading $filename"; + + my ($outfile, $vfile); + while ($_ = $texi->getline) + { + if (/^\@setfilename +(\S+)/) + { + # Honor only the first @setfilename. (It's possible to have + # more occurrences later if the manual shows examples of how + # to use @setfilename...) + next if $outfile; + + $outfile = $1; + if ($outfile =~ /\.(.+)$/ && $1 ne 'info') + { + error ("$filename:$.", + "output `$outfile' has unrecognized extension"); + return; + } + } + # A "version.texi" file is actually any file whose name matches + # "vers*.texi". + elsif (/^\@include\s+(vers[^.]*\.texi)\s*$/) + { + $vfile = $1; + } + + # Try to find new or unused indexes. + + # Creating a new category of index. + elsif (/^\@def(code)?index (\w+)/) + { + $clean_suffixes{$2} = 1; + $clean_suffixes{"$2s"} = 1; + } + + # Merging an index into an another. + elsif (/^\@syn(code)?index (\w+) (\w+)/) + { + delete $clean_suffixes{"$2s"}; + $clean_suffixes{"$3s"} = 1; + } + + } + + if (! $outfile) + { + err_am "`$filename' missing \@setfilename"; + return; + } + + my $infobase = basename ($filename); + $infobase =~ s/\.te?xi(nfo)?$//; + return ($outfile, $vfile, + map { "$infobase.$_" } (sort keys %clean_suffixes)); +} + + +# ($DIRSTAMP, @CLEAN_FILES) +# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES) +# ------------------------------------------------------------------ +# SOURCE - the source Texinfo file +# DEST - the destination Info file +# INSRC - wether DEST should be built in the source tree +# DEPENDENCIES - known dependencies +sub output_texinfo_build_rules ($$$@) +{ + my ($source, $dest, $insrc, @deps) = @_; + + # Split `a.texi' into `a' and `.texi'. + my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/); + my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/); + + $ssfx ||= ""; + $dsfx ||= ""; + + # We can output two kinds of rules: the "generic" rules use Make + # suffix rules and are appropriate when $source and $dest do not lie + # in a sub-directory; the "specific" rules are needed in the other + # case. + # + # The former are output only once (this is not really apparent here, + # but just remember that some logic deeper in Automake will not + # output the same rule twice); while the later need to be output for + # each Texinfo source. + my $generic; + my $makeinfoflags; + my $sdir = dirname $source; + if ($sdir eq '.' && dirname ($dest) eq '.') + { + $generic = 1; + $makeinfoflags = '-I $(srcdir)'; + } + else + { + $generic = 0; + $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir"; + } + + # A directory can contain two kinds of info files: some built in the + # source tree, and some built in the build tree. The rules are + # different in each case. However we cannot output two different + # set of generic rules. Because in-source builds are more usual, we + # use generic rules in this case and fall back to "specific" rules + # for build-dir builds. (It should not be a problem to invert this + # if needed.) + $generic = 0 unless $insrc; + + # We cannot use a suffix rule to build info files with an empty + # extension. Otherwise we would output a single suffix inference + # rule, with separate dependencies, as in + # + # .texi: + # $(MAKEINFO) ... + # foo.info: foo.texi + # + # which confuse Solaris make. (See the Autoconf manual for + # details.) Therefore we use a specific rule in this case. This + # applies to info files only (dvi and pdf files always have an + # extension). + my $generic_info = ($generic && $dsfx) ? 1 : 0; + + # If the resulting file lie into a subdirectory, + # make sure this directory will exist. + my $dirstamp = require_build_directory_maybe ($dest); + + my $dipfx = ($insrc ? '$(srcdir)/' : '') . $dpfx; + + $output_rules .= file_contents ('texibuild', + new Automake::Location, + DEPS => "@deps", + DEST_PREFIX => $dpfx, + DEST_INFO_PREFIX => $dipfx, + DEST_SUFFIX => $dsfx, + DIRSTAMP => $dirstamp, + GENERIC => $generic, + GENERIC_INFO => $generic_info, + INSRC => $insrc, + MAKEINFOFLAGS => $makeinfoflags, + SOURCE => ($generic + ? '$<' : $source), + SOURCE_INFO => ($generic_info + ? '$<' : $source), + SOURCE_REAL => $source, + SOURCE_SUFFIX => $ssfx, + ); + return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html"); +} + + +# $TEXICLEANS +# handle_texinfo_helper ($info_texinfos) +# -------------------------------------- +# Handle all Texinfo source; helper for handle_texinfo. +sub handle_texinfo_helper ($) +{ + my ($info_texinfos) = @_; + my (@infobase, @info_deps_list, @texi_deps); + my %versions; + my $done = 0; + my @texi_cleans; + + # Build a regex matching user-cleaned files. + my $d = var 'DISTCLEANFILES'; + my $c = var 'CLEANFILES'; + my @f = (); + push @f, $d->value_as_list_recursive (inner_expand => 1) if $d; + push @f, $c->value_as_list_recursive (inner_expand => 1) if $c; + @f = map { s|[^A-Za-z_0-9*\[\]\-]|\\$&|g; s|\*|[^/]*|g; $_; } @f; + my $user_cleaned_files = '^(?:' . join ('|', @f) . ')$'; + + foreach my $texi + ($info_texinfos->value_as_list_recursive (inner_expand => 1)) + { + my $infobase = $texi; + $infobase =~ s/\.(txi|texinfo|texi)$//; + + if ($infobase eq $texi) + { + # FIXME: report line number. + err_am "texinfo file `$texi' has unrecognized extension"; + next; + } + + push @infobase, $infobase; + + # If 'version.texi' is referenced by input file, then include + # automatic versioning capability. + my ($out_file, $vtexi, @clean_files) = + scan_texinfo_file ("$relative_dir/$texi") + or next; + push (@texi_cleans, @clean_files); + + # If the Texinfo source is in a subdirectory, create the + # resulting info in this subdirectory. If it is in the current + # directory, try hard to not prefix "./" because it breaks the + # generic rules. + my $outdir = dirname ($texi) . '/'; + $outdir = "" if $outdir eq './'; + $out_file = $outdir . $out_file; + + # Until Automake 1.6.3, .info files were built in the + # source tree. This was an obstacle to the support of + # non-distributed .info files, and non-distributed .texi + # files. + # + # * Non-distributed .texi files is important in some packages + # where .texi files are built at make time, probably using + # other binaries built in the package itself, maybe using + # tools or information found on the build host. Because + # these files are not distributed they are always rebuilt + # at make time; they should therefore not lie in the source + # directory. One plan was to support this using + # nodist_info_TEXINFOS or something similar. (Doing this + # requires some sanity checks. For instance Automake should + # not allow: + # dist_info_TEXINFO = foo.texi + # nodist_foo_TEXINFO = included.texi + # because a distributed file should never depend on a + # non-distributed file.) + # + # * If .texi files are not distributed, then .info files should + # not be distributed either. There are also cases where one + # want to distribute .texi files, but do not want to + # distribute the .info files. For instance the Texinfo package + # distributes the tool used to build these files; it would + # be a waste of space to distribute them. It's not clear + # which syntax we should use to indicate that .info files should + # not be distributed. Akim Demaille suggested that eventually + # we switch to a new syntax: + # | Maybe we should take some inspiration from what's already + # | done in the rest of Automake. Maybe there is too much + # | syntactic sugar here, and you want + # | nodist_INFO = bar.info + # | dist_bar_info_SOURCES = bar.texi + # | bar_texi_DEPENDENCIES = foo.texi + # | with a bit of magic to have bar.info represent the whole + # | bar*info set. That's a lot more verbose that the current + # | situation, but it is # not new, hence the user has less + # | to learn. + # | + # | But there is still too much room for meaningless specs: + # | nodist_INFO = bar.info + # | dist_bar_info_SOURCES = bar.texi + # | dist_PS = bar.ps something-written-by-hand.ps + # | nodist_bar_ps_SOURCES = bar.texi + # | bar_texi_DEPENDENCIES = foo.texi + # | here bar.texi is dist_ in line 2, and nodist_ in 4. + # + # Back to the point, it should be clear that in order to support + # non-distributed .info files, we need to build them in the + # build tree, not in the source tree (non-distributed .texi + # files are less of a problem, because we do not output build + # rules for them). In Automake 1.7 .info build rules have been + # largely cleaned up so that .info files get always build in the + # build tree, even when distributed. The idea was that + # (1) if during a VPATH build the .info file was found to be + # absent or out-of-date (in the source tree or in the + # build tree), Make would rebuild it in the build tree. + # If an up-to-date source-tree of the .info file existed, + # make would not rebuild it in the build tree. + # (2) having two copies of .info files, one in the source tree + # and one (newer) in the build tree is not a problem + # because `make dist' always pick files in the build tree + # first. + # However it turned out the be a bad idea for several reasons: + # * Tru64, OpenBSD, and FreeBSD (not NetBSD) Make do not behave + # like GNU Make on point (1) above. These implementations + # of Make would always rebuild .info files in the build + # tree, even if such files were up to date in the source + # tree. Consequently, it was impossible to perform a VPATH + # build of a package containing Texinfo files using these + # Make implementations. + # (Refer to the Autoconf Manual, section "Limitation of + # Make", paragraph "VPATH", item "target lookup", for + # an account of the differences between these + # implementations.) + # * The GNU Coding Standards require these files to be built + # in the source-tree (when they are distributed, that is). + # * Keeping a fresher copy of distributed files in the + # build tree can be annoying during development because + # - if the files is kept under CVS, you really want it + # to be updated in the source tree + # - it is confusing that `make distclean' does not erase + # all files in the build tree. + # + # Consequently, starting with Automake 1.8, .info files are + # built in the source tree again. Because we still plan to + # support non-distributed .info files at some point, we + # have a single variable ($INSRC) that controls whether + # the current .info file must be built in the source tree + # or in the build tree. Actually this variable is switched + # off for .info files that appear to be cleaned; this is + # for backward compatibility with package such as Texinfo, + # which do things like + # info_TEXINFOS = texinfo.txi info-stnd.texi info.texi + # DISTCLEANFILES = texinfo texinfo-* info*.info* + # # Do not create info files for distribution. + # dist-info: + # in order not to distribute .info files. + my $insrc = ($out_file =~ $user_cleaned_files) ? 0 : 1; + + my $soutdir = '$(srcdir)/' . $outdir; + $outdir = $soutdir if $insrc; + + # If user specified file_TEXINFOS, then use that as explicit + # dependency list. + @texi_deps = (); + push (@texi_deps, "$soutdir$vtexi") if $vtexi; + + my $canonical = canonicalize ($infobase); + if (var ($canonical . "_TEXINFOS")) + { + push (@texi_deps, '$(' . $canonical . '_TEXINFOS)'); + push_dist_common ('$(' . $canonical . '_TEXINFOS)'); + } + + my ($dirstamp, @cfiles) = + output_texinfo_build_rules ($texi, $out_file, $insrc, @texi_deps); + push (@texi_cleans, @cfiles); + + push (@info_deps_list, $out_file); + + # If a vers*.texi file is needed, emit the rule. + if ($vtexi) + { + err_am ("`$vtexi', included in `$texi', " + . "also included in `$versions{$vtexi}'") + if defined $versions{$vtexi}; + $versions{$vtexi} = $texi; + + # We number the stamp-vti files. This is doable since the + # actual names don't matter much. We only number starting + # with the second one, so that the common case looks nice. + my $vti = ($done ? $done : 'vti'); + ++$done; + + # This is ugly, but it is our historical practice. + if ($config_aux_dir_set_in_configure_ac) + { + require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, + 'mdate-sh'); + } + else + { + require_file_with_macro (TRUE, 'info_TEXINFOS', + FOREIGN, 'mdate-sh'); + } + + my $conf_dir; + if ($config_aux_dir_set_in_configure_ac) + { + $conf_dir = "$am_config_aux_dir/"; + } + else + { + $conf_dir = '$(srcdir)/'; + } + $output_rules .= file_contents ('texi-vers', + new Automake::Location, + TEXI => $texi, + VTI => $vti, + STAMPVTI => "${soutdir}stamp-$vti", + VTEXI => "$soutdir$vtexi", + MDDIR => $conf_dir, + DIRSTAMP => $dirstamp); + } + } + + # Handle location of texinfo.tex. + my $need_texi_file = 0; + my $texinfodir; + if (var ('TEXINFO_TEX')) + { + # The user defined TEXINFO_TEX so assume he knows what he is + # doing. + $texinfodir = ('$(srcdir)/' + . dirname (variable_value ('TEXINFO_TEX'))); + } + elsif (option 'cygnus') + { + $texinfodir = '$(top_srcdir)/../texinfo'; + define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL); + } + elsif ($config_aux_dir_set_in_configure_ac) + { + $texinfodir = $am_config_aux_dir; + define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL); + $need_texi_file = 2; # so that we require_conf_file later + } + else + { + $texinfodir = '$(srcdir)'; + $need_texi_file = 1; + } + define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL); + + push (@dist_targets, 'dist-info'); + + if (! option 'no-installinfo') + { + # Make sure documentation is made and installed first. Use + # $(INFO_DEPS), not 'info', because otherwise recursive makes + # get run twice during "make all". + unshift (@all, '$(INFO_DEPS)'); + } + + define_files_variable ("DVIS", @infobase, 'dvi', INTERNAL); + define_files_variable ("PDFS", @infobase, 'pdf', INTERNAL); + define_files_variable ("PSS", @infobase, 'ps', INTERNAL); + define_files_variable ("HTMLS", @infobase, 'html', INTERNAL); + + # This next isn't strictly needed now -- the places that look here + # could easily be changed to look in info_TEXINFOS. But this is + # probably better, in case noinst_TEXINFOS is ever supported. + define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL); + + # Do some error checking. Note that this file is not required + # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly + # up above. + if ($need_texi_file && ! option 'no-texinfo.tex') + { + if ($need_texi_file > 1) + { + require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, + 'texinfo.tex'); + } + else + { + require_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, + 'texinfo.tex'); + } + } + + return makefile_wrap ("", "\t ", @texi_cleans); +} + + +# handle_texinfo () +# ----------------- +# Handle all Texinfo source. +sub handle_texinfo () +{ + reject_var 'TEXINFOS', "`TEXINFOS' is an anachronism; use `info_TEXINFOS'"; + # FIXME: I think this is an obsolete future feature name. + reject_var 'html_TEXINFOS', "HTML generation not yet supported"; + + my $info_texinfos = var ('info_TEXINFOS'); + my $texiclean = ""; + if ($info_texinfos) + { + $texiclean = handle_texinfo_helper ($info_texinfos); + } + $output_rules .= file_contents ('texinfos', + new Automake::Location, + TEXICLEAN => $texiclean, + 'LOCAL-TEXIS' => !!$info_texinfos); +} + + +# Handle any man pages. +sub handle_man_pages +{ + reject_var 'MANS', "`MANS' is an anachronism; use `man_MANS'"; + + # Find all the sections in use. We do this by first looking for + # "standard" sections, and then looking for any additional + # sections used in man_MANS. + my (%sections, %vlist); + # We handle nodist_ for uniformity. man pages aren't distributed + # by default so it isn't actually very important. + foreach my $pfx ('', 'dist_', 'nodist_') + { + # Add more sections as needed. + foreach my $section ('0'..'9', 'n', 'l') + { + my $varname = $pfx . 'man' . $section . '_MANS'; + if (var ($varname)) + { + $sections{$section} = 1; + $varname = '$(' . $varname . ')'; + $vlist{$varname} = 1; + + &push_dist_common ($varname) + if $pfx eq 'dist_'; + } + } + + my $varname = $pfx . 'man_MANS'; + my $var = var ($varname); + if ($var) + { + foreach ($var->value_as_list_recursive) + { + # A page like `foo.1c' goes into man1dir. + if (/\.([0-9a-z])([a-z]*)$/) + { + $sections{$1} = 1; + } + } + + $varname = '$(' . $varname . ')'; + $vlist{$varname} = 1; + &push_dist_common ($varname) + if $pfx eq 'dist_'; + } + } + + return unless %sections; + + # Now for each section, generate an install and uninstall rule. + # Sort sections so output is deterministic. + foreach my $section (sort keys %sections) + { + $output_rules .= &file_contents ('mans', + new Automake::Location, + SECTION => $section); + } + + my @mans = sort keys %vlist; + $output_vars .= file_contents ('mans-vars', + new Automake::Location, + MANS => "@mans"); + + push (@all, '$(MANS)') + unless option 'no-installman'; +} + +# Handle DATA variables. +sub handle_data +{ + &am_install_var ('-noextra', '-candist', 'data', 'DATA', + 'data', 'sysconf', 'sharedstate', 'localstate', + 'pkgdata', 'lisp', 'noinst', 'check'); +} + +# Handle TAGS. +sub handle_tags +{ + my @tag_deps = (); + my @ctag_deps = (); + if (var ('SUBDIRS')) + { + $output_rules .= ("tags-recursive:\n" + . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n" + # Never fail here if a subdir fails; it + # isn't important. + . "\t test \"\$\$subdir\" = . || (cd \$\$subdir" + . " && \$(MAKE) \$(AM_MAKEFLAGS) tags); \\\n" + . "\tdone\n"); + push (@tag_deps, 'tags-recursive'); + &depend ('.PHONY', 'tags-recursive'); + + $output_rules .= ("ctags-recursive:\n" + . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n" + # Never fail here if a subdir fails; it + # isn't important. + . "\t test \"\$\$subdir\" = . || (cd \$\$subdir" + . " && \$(MAKE) \$(AM_MAKEFLAGS) ctags); \\\n" + . "\tdone\n"); + push (@ctag_deps, 'ctags-recursive'); + &depend ('.PHONY', 'ctags-recursive'); + } + + if (&saw_sources_p (1) + || var ('ETAGS_ARGS') + || @tag_deps) + { + my @config; + foreach my $spec (@config_headers) + { + my ($out, @ins) = split_config_file_spec ($spec); + foreach my $in (@ins) + { + # If the config header source is in this directory, + # require it. + push @config, basename ($in) + if $relative_dir eq dirname ($in); + } + } + $output_rules .= &file_contents ('tags', + new Automake::Location, + CONFIG => "@config", + TAGSDIRS => "@tag_deps", + CTAGSDIRS => "@ctag_deps"); + + set_seen 'TAGS_DEPENDENCIES'; + } + elsif (reject_var ('TAGS_DEPENDENCIES', + "doesn't make sense to define `TAGS_DEPENDENCIES'" + . "without\nsources or `ETAGS_ARGS'")) + { + } + else + { + # Every Makefile must define some sort of TAGS rule. + # Otherwise, it would be possible for a top-level "make TAGS" + # to fail because some subdirectory failed. + $output_rules .= "tags: TAGS\nTAGS:\n\n"; + # Ditto ctags. + $output_rules .= "ctags: CTAGS\nCTAGS:\n\n"; + } +} + +# Handle multilib support. +sub handle_multilib +{ + if ($seen_multilib && $relative_dir eq '.') + { + $output_rules .= &file_contents ('multilib', new Automake::Location); + push (@all, 'all-multi'); + } +} + + +# user_phony_rule ($NAME) +# ----------------------- +# Return false if rule $NAME does not exist. Otherwise, +# declare it as phony, complete its definition (in case it is +# conditional), and return its Automake::Rule instance. +sub user_phony_rule ($) +{ + my ($name) = @_; + my $rule = rule $name; + if ($rule) + { + depend ('.PHONY', $name); + # Define $NAME in all condition where it is not already defined, + # so that it is always OK to depend on $NAME. + for my $c ($rule->not_always_defined_in_cond (TRUE)->conds) + { + Automake::Rule::define ($name, 'internal', RULE_AUTOMAKE, + $c, INTERNAL); + $output_rules .= $c->subst_string . "$name:\n"; + } + } + return $rule; +} + + +# $BOOLEAN +# &for_dist_common ($A, $B) +# ------------------------- +# Subroutine for &handle_dist: sort files to dist. +# +# We put README first because it then becomes easier to make a +# Usenet-compliant shar file (in these, README must be first). +# +# FIXME: do more ordering of files here. +sub for_dist_common +{ + return 0 + if $a eq $b; + return -1 + if $a eq 'README'; + return 1 + if $b eq 'README'; + return $a cmp $b; +} + + +# handle_dist +# ----------- +# Handle 'dist' target. +sub handle_dist () +{ + # Substutions for distdit.am + my %transform; + + # Define DIST_SUBDIRS. This must always be done, regardless of the + # no-dist setting: target like `distclean' or `maintainer-clean' use it. + my $subdirs = var ('SUBDIRS'); + if ($subdirs) + { + # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS + # to all possible directories, and use it. If DIST_SUBDIRS is + # defined, just use it. + + # Note that we check DIST_SUBDIRS first on purpose, so that + # we don't call has_conditional_contents for now reason. + # (In the past one project used so many conditional subdirectories + # that calling has_conditional_contents on SUBDIRS caused + # automake to grow to 150Mb -- this should not happen with + # the current implementation of has_conditional_contents, + # but it's more efficient to avoid the call anyway.) + if (var ('DIST_SUBDIRS')) + { + } + elsif ($subdirs->has_conditional_contents) + { + define_pretty_variable + ('DIST_SUBDIRS', TRUE, INTERNAL, + uniq ($subdirs->value_as_list_recursive)); + } + else + { + # We always define this because that is what `distclean' + # wants. + define_pretty_variable ('DIST_SUBDIRS', TRUE, INTERNAL, + '$(SUBDIRS)'); + } + } + + # The remaining definitions are only required when a dist target is used. + return if option 'no-dist'; + + # At least one of the archive formats must be enabled. + if ($relative_dir eq '.') + { + my $archive_defined = option 'no-dist-gzip' ? 0 : 1; + $archive_defined ||= + grep { option "dist-$_" } ('shar', 'zip', 'tarZ', 'bzip2'); + error (option 'no-dist-gzip', + "no-dist-gzip specified but no dist-* specified, " + . "at least one archive format must be enabled") + unless $archive_defined; + } + + # Look for common files that should be included in distribution. + # If the aux dir is set, and it does not have a Makefile.am, then + # we check for these files there as well. + my $check_aux = 0; + if ($relative_dir eq '.' + && $config_aux_dir_set_in_configure_ac) + { + if (! &is_make_dir ($config_aux_dir)) + { + $check_aux = 1; + } + } + foreach my $cfile (@common_files) + { + if (dir_has_case_matching_file ($relative_dir, $cfile) + # The file might be absent, but if it can be built it's ok. + || rule $cfile) + { + &push_dist_common ($cfile); + } + + # Don't use `elsif' here because a file might meaningfully + # appear in both directories. + if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile)) + { + &push_dist_common ("$config_aux_dir/$cfile") + } + } + + # We might copy elements from $configure_dist_common to + # %dist_common if we think we need to. If the file appears in our + # directory, we would have discovered it already, so we don't + # check that. But if the file is in a subdir without a Makefile, + # we want to distribute it here if we are doing `.'. Ugly! + if ($relative_dir eq '.') + { + foreach my $file (split (' ' , $configure_dist_common)) + { + push_dist_common ($file) + unless is_make_dir (dirname ($file)); + } + } + + # Files to distributed. Don't use ->value_as_list_recursive + # as it recursively expands `$(dist_pkgdata_DATA)' etc. + my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value); + @dist_common = uniq (sort for_dist_common (@dist_common)); + variable_delete 'DIST_COMMON'; + define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common); + + # Now that we've processed DIST_COMMON, disallow further attempts + # to set it. + $handle_dist_run = 1; + + # Scan EXTRA_DIST to see if we need to distribute anything from a + # subdir. If so, add it to the list. I didn't want to do this + # originally, but there were so many requests that I finally + # relented. + my $extra_dist = var ('EXTRA_DIST'); + if ($extra_dist) + { + # FIXME: This should be fixed to work with conditions. That + # will require only making the entries in %dist_dirs under the + # appropriate condition. This is meaningful if the nature of + # the distribution should depend upon the configure options + # used. + foreach ($extra_dist->value_as_list_recursive (skip_ac_subst => 1)) + { + next unless s,/+[^/]+$,,; + $dist_dirs{$_} = 1 + unless $_ eq '.'; + } + } + + # We have to check DIST_COMMON for extra directories in case the + # user put a source used in AC_OUTPUT into a subdir. + my $topsrcdir = backname ($relative_dir); + foreach (rvar ('DIST_COMMON')->value_as_list_recursive (skip_ac_subst => 1)) + { + s/\$\(top_srcdir\)/$topsrcdir/; + s/\$\(srcdir\)/./; + # Strip any leading `./'. + s,^(:?\./+)*,,; + next unless s,/+[^/]+$,,; + $dist_dirs{$_} = 1 + unless $_ eq '.'; + } + + $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook'; + $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external; + + # Prepend $(distdir) to each directory given. + my %rewritten = map { '$(distdir)/' . "$_" => 1 } keys %dist_dirs; + $transform{'DISTDIRS'} = join (' ', sort keys %rewritten); + + # If the target `dist-hook' exists, make sure it is run. This + # allows users to do random weird things to the distribution + # before it is packaged up. + push (@dist_targets, 'dist-hook') + if user_phony_rule 'dist-hook'; + $transform{'DIST-TARGETS'} = join (' ', @dist_targets); + + my $flm = option ('filename-length-max'); + my $filename_filter = $flm ? '.' x $flm->[1] : ''; + + $output_rules .= &file_contents ('distdir', + new Automake::Location, + %transform, + FILENAME_FILTER => $filename_filter); +} + + +# check_directory ($NAME, $WHERE) +# ------------------------------- +# Ensure $NAME is a directory, and that it uses sane name. +# Use $WHERE as a location in the diagnostic, if any. +sub check_directory ($$) +{ + my ($dir, $where) = @_; + + error $where, "required directory $relative_dir/$dir does not exist" + unless -d "$relative_dir/$dir"; + + # If an `obj/' directory exists, BSD make will enter it before + # reading `Makefile'. Hence the `Makefile' in the current directory + # will not be read. + # + # % cat Makefile + # all: + # echo Hello + # % cat obj/Makefile + # all: + # echo World + # % make # GNU make + # echo Hello + # Hello + # % pmake # BSD make + # echo World + # World + msg ('portability', $where, + "naming a subdirectory `obj' causes troubles with BSD make") + if $dir eq 'obj'; + + # `aux' is probably the most important of the following forbidden name, + # since it's tempting to use it as an AC_CONFIG_AUX_DIR. + msg ('portability', $where, + "name `$dir' is reserved on W32 and DOS platforms") + if grep (/^\Q$dir\E$/i, qw/aux lpt1 lpt2 lpt3 com1 com2 com3 com4 con prn/); +} + +# check_directories_in_var ($VARIABLE) +# ------------------------------------ +# Recursively check all items in variables $VARIABLE as directories +sub check_directories_in_var ($) +{ + my ($var) = @_; + $var->traverse_recursively + (sub + { + my ($var, $val, $cond, $full_cond) = @_; + check_directory ($val, $var->rdef ($cond)->location); + return (); + }, + undef, + skip_ac_subst => 1); +} + +# &handle_subdirs () +# ------------------ +# Handle subdirectories. +sub handle_subdirs () +{ + my $subdirs = var ('SUBDIRS'); + return + unless $subdirs; + + check_directories_in_var $subdirs; + + my $dsubdirs = var ('DIST_SUBDIRS'); + check_directories_in_var $dsubdirs + if $dsubdirs; + + $output_rules .= &file_contents ('subdirs', new Automake::Location); + rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross! +} + + +# ($REGEN, @DEPENDENCIES) +# &scan_aclocal_m4 +# ---------------- +# If aclocal.m4 creation is automated, return the list of its dependencies. +sub scan_aclocal_m4 () +{ + my $regen_aclocal = 0; + + set_seen 'CONFIG_STATUS_DEPENDENCIES'; + set_seen 'CONFIGURE_DEPENDENCIES'; + + if (-f 'aclocal.m4') + { + &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL); + + my $aclocal = new Automake::XFile "< aclocal.m4"; + my $line = $aclocal->getline; + $regen_aclocal = $line =~ 'generated automatically by aclocal'; + } + + my @ac_deps = (); + + if (set_seen ('ACLOCAL_M4_SOURCES')) + { + push (@ac_deps, '$(ACLOCAL_M4_SOURCES)'); + msg_var ('obsolete', 'ACLOCAL_M4_SOURCES', + "`ACLOCAL_M4_SOURCES' is obsolete.\n" + . "It should be safe to simply remove it."); + } + + # Note that it might be possible that aclocal.m4 doesn't exist but + # should be auto-generated. This case probably isn't very + # important. + + return ($regen_aclocal, @ac_deps); +} + + +# @DEPENDENCIES +# &prepend_srcdir (@INPUTS) +# ------------------------- +# Prepend $(srcdir) or $(top_srcdir) to all @INPUTS. The idea is that +# if an input file has a directory part the same as the current +# directory, then the directory part is simply replaced by $(srcdir). +# But if the directory part is different, then $(top_srcdir) is +# prepended. +sub prepend_srcdir (@) +{ + my (@inputs) = @_; + my @newinputs; + + foreach my $single (@inputs) + { + if (dirname ($single) eq $relative_dir) + { + push (@newinputs, '$(srcdir)/' . basename ($single)); + } + else + { + push (@newinputs, '$(top_srcdir)/' . $single); + } + } + return @newinputs; +} + +# @DEPENDENCIES +# rewrite_inputs_into_dependencies ($OUTPUT, @INPUTS) +# --------------------------------------------------- +# Compute a list of dependencies appropriate for the rebuild +# rule of +# AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...) +# Also distribute $INPUTs which are not build by another AC_CONFIG_FILES. +sub rewrite_inputs_into_dependencies ($@) +{ + my ($file, @inputs) = @_; + my @res = (); + + for my $i (@inputs) + { + if (exists $ac_config_files_location{$i}) + { + my $di = dirname $i; + if ($di eq $relative_dir) + { + $i = basename $i; + } + # In the top-level Makefile we do not use $(top_builddir), because + # we are already there, and since the targets are built without + # a $(top_builddir), it helps BSD Make to match them with + # dependencies. + elsif ($relative_dir ne '.') + { + $i = '$(top_builddir)/' . $i; + } + } + else + { + msg ('error', $ac_config_files_location{$file}, + "required file `$i' not found") + unless exists $output_files{$i} || -f $i; + ($i) = prepend_srcdir ($i); + push_dist_common ($i); + } + push @res, $i; + } + return @res; +} + + + +# &handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS) +# ------------------------------------------------------------------ +# Handle remaking and configure stuff. +# We need the name of the input file, to do proper remaking rules. +sub handle_configure ($$$@) +{ + my ($makefile_am, $makefile_in, $makefile, @inputs) = @_; + + prog_error 'empty @inputs' + unless @inputs; + + my ($rel_makefile_am, $rel_makefile_in) = prepend_srcdir ($makefile_am, + $makefile_in); + my $rel_makefile = basename $makefile; + + my $colon_infile = ':' . join (':', @inputs); + $colon_infile = '' if $colon_infile eq ":$makefile.in"; + my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs); + my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4; + define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL, + @configure_deps, @aclocal_m4_deps, + '$(top_srcdir)/' . $configure_ac); + my @configuredeps = ('$(am__aclocal_m4_deps)', '$(CONFIGURE_DEPENDENCIES)'); + push @configuredeps, '$(ACLOCAL_M4)' if -f 'aclocal.m4'; + define_pretty_variable ('am__configure_deps', TRUE, INTERNAL, + @configuredeps); + + $output_rules .= file_contents + ('configure', + new Automake::Location, + MAKEFILE => $rel_makefile, + 'MAKEFILE-DEPS' => "@rewritten", + 'CONFIG-MAKEFILE' => ($relative_dir eq '.') ? '$@' : '$(subdir)/$@', + 'MAKEFILE-IN' => $rel_makefile_in, + 'MAKEFILE-IN-DEPS' => "@include_stack", + 'MAKEFILE-AM' => $rel_makefile_am, + STRICTNESS => global_option 'cygnus' + ? 'cygnus' : $strictness_name, + 'USE-DEPS' => global_option 'no-dependencies' + ? ' --ignore-deps' : '', + 'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile", + 'REGEN-ACLOCAL-M4' => $regen_aclocal_m4); + + if ($relative_dir eq '.') + { + &push_dist_common ('acconfig.h') + if -f 'acconfig.h'; + } + + # If we have a configure header, require it. + my $hdr_index = 0; + my @distclean_config; + foreach my $spec (@config_headers) + { + $hdr_index += 1; + # $CONFIG_H_PATH: config.h from top level. + my ($config_h_path, @ins) = split_config_file_spec ($spec); + my $config_h_dir = dirname ($config_h_path); + + # If the header is in the current directory we want to build + # the header here. Otherwise, if we're at the topmost + # directory and the header's directory doesn't have a + # Makefile, then we also want to build the header. + if ($relative_dir eq $config_h_dir + || ($relative_dir eq '.' && ! &is_make_dir ($config_h_dir))) + { + my ($cn_sans_dir, $stamp_dir); + if ($relative_dir eq $config_h_dir) + { + $cn_sans_dir = basename ($config_h_path); + $stamp_dir = ''; + } + else + { + $cn_sans_dir = $config_h_path; + if ($config_h_dir eq '.') + { + $stamp_dir = ''; + } + else + { + $stamp_dir = $config_h_dir . '/'; + } + } + + # This will also distribute all inputs. + @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins); + + # Header defined and in this directory. + my @files; + if (-f $config_h_path . '.top') + { + push (@files, "$cn_sans_dir.top"); + } + if (-f $config_h_path . '.bot') + { + push (@files, "$cn_sans_dir.bot"); + } + + push_dist_common (@files); + + # For now, acconfig.h can only appear in the top srcdir. + if (-f 'acconfig.h') + { + push (@files, '$(top_srcdir)/acconfig.h'); + } + + my $stamp = "${stamp_dir}stamp-h${hdr_index}"; + $output_rules .= + file_contents ('remake-hdr', + new Automake::Location, + FILES => "@files", + CONFIG_H => $cn_sans_dir, + CONFIG_HIN => $ins[0], + CONFIG_H_DEPS => "@ins", + CONFIG_H_PATH => $config_h_path, + STAMP => "$stamp"); + + push @distclean_config, $cn_sans_dir, $stamp; + } + } + + $output_rules .= file_contents ('clean-hdr', + new Automake::Location, + FILES => "@distclean_config") + if @distclean_config; + + # Distribute and define mkinstalldirs only if it is already present + # in the package, for backward compatibility (some people may still + # use $(mkinstalldirs)). + my $mkidpath = "$config_aux_dir/mkinstalldirs"; + if (-f $mkidpath) + { + # Use require_file so that any existingscript gets updated + # by --force-missing. + require_conf_file ($mkidpath, FOREIGN, 'mkinstalldirs'); + define_variable ('mkinstalldirs', + "\$(SHELL) $am_config_aux_dir/mkinstalldirs", INTERNAL); + } + else + { + # Use $(install_sh), not $(mkdir_p) because the latter requires + # at least one argument, and $(mkinstalldirs) used to work + # even without arguments (e.g. $(mkinstalldirs) $(conditional_dir)). + define_variable ('mkinstalldirs', '$(install_sh) -d', INTERNAL); + } + + reject_var ('CONFIG_HEADER', + "`CONFIG_HEADER' is an anachronism; now determined " + . "automatically\nfrom `$configure_ac'"); + + my @config_h; + foreach my $spec (@config_headers) + { + my ($out, @ins) = split_config_file_spec ($spec); + # Generate CONFIG_HEADER define. + if ($relative_dir eq dirname ($out)) + { + push @config_h, basename ($out); + } + else + { + push @config_h, "\$(top_builddir)/$out"; + } + } + define_variable ("CONFIG_HEADER", "@config_h", INTERNAL) + if @config_h; + + # Now look for other files in this directory which must be remade + # by config.status, and generate rules for them. + my @actual_other_files = (); + foreach my $lfile (@other_input_files) + { + my $file; + my @inputs; + if ($lfile =~ /^([^:]*):(.*)$/) + { + # This is the ":" syntax of AC_OUTPUT. + $file = $1; + @inputs = split (':', $2); + } + else + { + # Normal usage. + $file = $lfile; + @inputs = $file . '.in'; + } + + # Automake files should not be stored in here, but in %MAKE_LIST. + prog_error ("$lfile in \@other_input_files\n" + . "\@other_input_files = (@other_input_files)") + if -f $file . '.am'; + + my $local = basename ($file); + + # Make sure the dist directory for each input file is created. + # We only have to do this at the topmost level though. This + # is a bit ugly but it easier than spreading out the logic, + # especially in cases like AC_OUTPUT(foo/out:bar/in), where + # there is no Makefile in bar/. + if ($relative_dir eq '.') + { + foreach (@inputs) + { + $dist_dirs{dirname ($_)} = 1; + } + } + + # We skip files that aren't in this directory. However, if + # the file's directory does not have a Makefile, and we are + # currently doing `.', then we create a rule to rebuild the + # file in the subdir. + my $fd = dirname ($file); + if ($fd ne $relative_dir) + { + if ($relative_dir eq '.' && ! &is_make_dir ($fd)) + { + $local = $file; + } + else + { + next; + } + } + + my @rewritten_inputs = rewrite_inputs_into_dependencies ($file, @inputs); + + $output_rules .= ($local . ': ' + . '$(top_builddir)/config.status ' + . "@rewritten_inputs\n" + . "\t" + . 'cd $(top_builddir) && ' + . '$(SHELL) ./config.status ' + . ($relative_dir eq '.' ? '' : '$(subdir)/') + . '$@' + . "\n"); + push (@actual_other_files, $local); + } + + # For links we should clean destinations and distribute sources. + foreach my $spec (@config_links) + { + my ($link, $file) = split /:/, $spec; + # Some people do AC_CONFIG_LINKS($computed). We only handle + # the DEST:SRC form. + next unless $file; + my $where = $ac_config_files_location{$link}; + + # Skip destinations that contain shell variables. + if ($link !~ /\$/) + { + # We skip links that aren't in this directory. However, if + # the link's directory does not have a Makefile, and we are + # currently doing `.', then we add the link to CONFIG_CLEAN_FILES + # in `.'s Makefile.in. + my $local = basename ($link); + my $fd = dirname ($link); + if ($fd ne $relative_dir) + { + if ($relative_dir eq '.' && ! &is_make_dir ($fd)) + { + $local = $link; + } + else + { + $local = undef; + } + } + push @actual_other_files, $local if $local; + } + + # Do not process sources that contain shell variables. + if ($file !~ /\$/) + { + my $fd = dirname ($file); + + # Make sure the dist directory for each input file is created. + # We only have to do this at the topmost level though. + if ($relative_dir eq '.') + { + $dist_dirs{$fd} = 1; + } + + # We distribute files that are in this directory. + # At the top-level (`.') we also distribute files whose + # directory does not have a Makefile. + if (($fd eq $relative_dir) + || ($relative_dir eq '.' && ! &is_make_dir ($fd))) + { + # The following will distribute $file as a side-effect when + # it is appropriate (i.e., when $file is not already an output). + # We do not need the result, just the side-effect. + rewrite_inputs_into_dependencies ($link, $file); + } + } + } + + # These files get removed by "make distclean". + define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL, + @actual_other_files); +} + +# Handle C headers. +sub handle_headers +{ + my @r = &am_install_var ('-defaultdist', 'header', 'HEADERS', 'include', + 'oldinclude', 'pkginclude', + 'noinst', 'check'); + foreach (@r) + { + next unless $_->[1] =~ /\..*$/; + &saw_extension ($&); + } +} + +sub handle_gettext +{ + return if ! $seen_gettext || $relative_dir ne '.'; + + my $subdirs = var 'SUBDIRS'; + + if (! $subdirs) + { + err_ac "AM_GNU_GETTEXT used but SUBDIRS not defined"; + return; + } + + # Perform some sanity checks to help users get the right setup. + # We disable these tests when po/ doesn't exist in order not to disallow + # unusual gettext setups. + # + # Bruno Haible: + # | The idea is: + # | + # | 1) If a package doesn't have a directory po/ at top level, it + # | will likely have multiple po/ directories in subpackages. + # | + # | 2) It is useful to warn for the absence of intl/ if AM_GNU_GETTEXT + # | is used without 'external'. It is also useful to warn for the + # | presence of intl/ if AM_GNU_GETTEXT([external]) is used. Both + # | warnings apply only to the usual layout of packages, therefore + # | they should both be disabled if no po/ directory is found at + # | top level. + + if (-d 'po') + { + my @subdirs = $subdirs->value_as_list_recursive; + + msg_var ('syntax', $subdirs, + "AM_GNU_GETTEXT used but `po' not in SUBDIRS") + if ! grep ($_ eq 'po', @subdirs); + + # intl/ is not required when AM_GNU_GETTEXT is called with + # the `external' option. + msg_var ('syntax', $subdirs, + "AM_GNU_GETTEXT used but `intl' not in SUBDIRS") + if (! $seen_gettext_external + && ! grep ($_ eq 'intl', @subdirs)); + + # intl/ should not be used with AM_GNU_GETTEXT([external]) + msg_var ('syntax', $subdirs, + "`intl' should not be in SUBDIRS when " + . "AM_GNU_GETTEXT([external]) is used") + if ($seen_gettext_external && grep ($_ eq 'intl', @subdirs)); + } + + require_file ($ac_gettext_location, GNU, 'ABOUT-NLS'); +} + +# Handle footer elements. +sub handle_footer +{ + # NOTE don't use define_pretty_variable here, because + # $contents{...} is already defined. + $output_vars .= 'SOURCES = ' . variable_value ('SOURCES') . "\n\n" + if variable_value ('SOURCES'); + + reject_rule ('.SUFFIXES', + "use variable `SUFFIXES', not target `.SUFFIXES'"); + + # Note: AIX 4.1 /bin/make will fail if any suffix rule appears + # before .SUFFIXES. So we make sure that .SUFFIXES appears before + # anything else, by sticking it right after the default: target. + $output_header .= ".SUFFIXES:\n"; + my $suffixes = var 'SUFFIXES'; + my @suffixes = Automake::Rule::suffixes; + if (@suffixes || $suffixes) + { + # Make sure SUFFIXES has unique elements. Sort them to ensure + # the output remains consistent. However, $(SUFFIXES) is + # always at the start of the list, unsorted. This is done + # because make will choose rules depending on the ordering of + # suffixes, and this lets the user have some control. Push + # actual suffixes, and not $(SUFFIXES). Some versions of make + # do not like variable substitutions on the .SUFFIXES line. + my @user_suffixes = ($suffixes + ? $suffixes->value_as_list_recursive : ()); + + my %suffixes = map { $_ => 1 } @suffixes; + delete @suffixes{@user_suffixes}; + + $output_header .= (".SUFFIXES: " + . join (' ', @user_suffixes, sort keys %suffixes) + . "\n"); + } + + $output_trailer .= file_contents ('footer', new Automake::Location); +} + + +# Generate `make install' rules. +sub handle_install () +{ + $output_rules .= &file_contents + ('install', + new Automake::Location, + maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES') + ? (" \$(BUILT_SOURCES)\n" + . "\t\$(MAKE) \$(AM_MAKEFLAGS)") + : ''), + 'installdirs-local' => (user_phony_rule 'installdirs-local' + ? ' installdirs-local' : ''), + am__installdirs => variable_value ('am__installdirs') || ''); +} + + +# Deal with all and all-am. +sub handle_all ($) +{ + my ($makefile) = @_; + + # Output `all-am'. + + # Put this at the beginning for the sake of non-GNU makes. This + # is still wrong if these makes can run parallel jobs. But it is + # right enough. + unshift (@all, basename ($makefile)); + + foreach my $spec (@config_headers) + { + my ($out, @ins) = split_config_file_spec ($spec); + push (@all, basename ($out)) + if dirname ($out) eq $relative_dir; + } + + # Install `all' hooks. + push (@all, "all-local") + if user_phony_rule "all-local"; + + &pretty_print_rule ("all-am:", "\t\t", @all); + &depend ('.PHONY', 'all-am', 'all'); + + + # Output `all'. + + my @local_headers = (); + push @local_headers, '$(BUILT_SOURCES)' + if var ('BUILT_SOURCES'); + foreach my $spec (@config_headers) + { + my ($out, @ins) = split_config_file_spec ($spec); + push @local_headers, basename ($out) + if dirname ($out) eq $relative_dir; + } + + if (@local_headers) + { + # We need to make sure config.h is built before we recurse. + # We also want to make sure that built sources are built + # before any ordinary `all' targets are run. We can't do this + # by changing the order of dependencies to the "all" because + # that breaks when using parallel makes. Instead we handle + # things explicitly. + $output_all .= ("all: @local_headers" + . "\n\t" + . '$(MAKE) $(AM_MAKEFLAGS) ' + . (var ('SUBDIRS') ? 'all-recursive' : 'all-am') + . "\n\n"); + } + else + { + $output_all .= "all: " . (var ('SUBDIRS') + ? 'all-recursive' : 'all-am') . "\n\n"; + } +} + + +# &do_check_merge_target () +# ------------------------- +# Handle check merge target specially. +sub do_check_merge_target () +{ + # Include user-defined local form of target. + push @check_tests, 'check-local' + if user_phony_rule 'check-local'; + + # In --cygnus mode, check doesn't depend on all. + if (option 'cygnus') + { + # Just run the local check rules. + pretty_print_rule ('check-am:', "\t\t", @check); + } + else + { + # The check target must depend on the local equivalent of + # `all', to ensure all the primary targets are built. Then it + # must build the local check rules. + $output_rules .= "check-am: all-am\n"; + pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", + @check) + if @check; + } + pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", + @check_tests) + if @check_tests; + + depend '.PHONY', 'check', 'check-am'; + # Handle recursion. We have to honor BUILT_SOURCES like for `all:'. + $output_rules .= ("check: " + . (var ('BUILT_SOURCES') + ? "\$(BUILT_SOURCES)\n\t\$(MAKE) \$(AM_MAKEFLAGS) " + : '') + . (var ('SUBDIRS') ? 'check-recursive' : 'check-am') + . "\n"); +} + +# handle_clean ($MAKEFILE) +# ------------------------ +# Handle all 'clean' targets. +sub handle_clean ($) +{ + my ($makefile) = @_; + + # Clean the files listed in user variables if they exist. + $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN + if var ('MOSTLYCLEANFILES'); + $clean_files{'$(CLEANFILES)'} = CLEAN + if var ('CLEANFILES'); + $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN + if var ('DISTCLEANFILES'); + $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN + if var ('MAINTAINERCLEANFILES'); + + # Built sources are automatically removed by maintainer-clean. + $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN + if var ('BUILT_SOURCES'); + + # Compute a list of "rm"s to run for each target. + my %rms = (MOSTLY_CLEAN, [], + CLEAN, [], + DIST_CLEAN, [], + MAINTAINER_CLEAN, []); + + foreach my $file (keys %clean_files) + { + my $when = $clean_files{$file}; + prog_error 'invalid entry in %clean_files' + unless exists $rms{$when}; + + my $rm = "rm -f $file"; + # If file is a variable, make sure when don't call `rm -f' without args. + $rm ="test -z \"$file\" || $rm" + if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/); + + push @{$rms{$when}}, "\t-$rm\n"; + } + + $output_rules .= &file_contents + ('clean', + new Automake::Location, + MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}), + CLEAN_RMS => join ('', sort @{$rms{&CLEAN}}), + DISTCLEAN_RMS => join ('', sort @{$rms{&DIST_CLEAN}}), + MAINTAINER_CLEAN_RMS => join ('', sort @{$rms{&MAINTAINER_CLEAN}}), + MAKEFILE => basename $makefile, + ); +} + + +# &target_cmp ($A, $B) +# -------------------- +# Subroutine for &handle_factored_dependencies to let `.PHONY' be last. +sub target_cmp +{ + return 0 + if $a eq $b; + return -1 + if $b eq '.PHONY'; + return 1 + if $a eq '.PHONY'; + return $a cmp $b; +} + + +# &handle_factored_dependencies () +# -------------------------------- +# Handle everything related to gathered targets. +sub handle_factored_dependencies +{ + # Reject bad hooks. + foreach my $utarg ('uninstall-data-local', 'uninstall-data-hook', + 'uninstall-exec-local', 'uninstall-exec-hook') + { + my $x = $utarg; + $x =~ s/(data|exec)-//; + reject_rule ($utarg, "use `$x', not `$utarg'"); + } + + reject_rule ('install-local', + "use `install-data-local' or `install-exec-local', " + . "not `install-local'"); + + reject_rule ('install-info-local', + "`install-info-local' target defined but " + . "`no-installinfo' option not in use") + unless option 'no-installinfo'; + + # Install the -local hooks. + foreach (keys %dependencies) + { + # Hooks are installed on the -am targets. + s/-am$// or next; + depend ("$_-am", "$_-local") + if user_phony_rule "$_-local"; + } + + # Install the -hook hooks. + # FIXME: Why not be as liberal as we are with -local hooks? + foreach ('install-exec', 'install-data', 'uninstall') + { + if (user_phony_rule "$_-hook") + { + $actions{"$_-am"} .= + ("\t\@\$(NORMAL_INSTALL)\n" + . "\t" . '$(MAKE) $(AM_MAKEFLAGS) ' . "$_-hook\n"); + } + } + + # All the required targets are phony. + depend ('.PHONY', keys %required_targets); + + # Actually output gathered targets. + foreach (sort target_cmp keys %dependencies) + { + # If there is nothing about this guy, skip it. + next + unless (@{$dependencies{$_}} + || $actions{$_} + || $required_targets{$_}); + + # Define gathered targets in undefined conditions. + # FIXME: Right now we must handle .PHONY as an exception, + # because people write things like + # .PHONY: myphonytarget + # to append dependencies. This would not work if Automake + # refrained from defining its own .PHONY target as it does + # with other overridden targets. + my @undefined_conds = (TRUE,); + if ($_ ne '.PHONY') + { + @undefined_conds = + Automake::Rule::define ($_, 'internal', + RULE_AUTOMAKE, TRUE, INTERNAL); + } + my @uniq_deps = uniq (sort @{$dependencies{$_}}); + foreach my $cond (@undefined_conds) + { + my $condstr = $cond->subst_string; + &pretty_print_rule ("$condstr$_:", "$condstr\t", @uniq_deps); + $output_rules .= $actions{$_} if defined $actions{$_}; + $output_rules .= "\n"; + } + } +} + + +# &handle_tests_dejagnu () +# ------------------------ +sub handle_tests_dejagnu +{ + push (@check_tests, 'check-DEJAGNU'); + $output_rules .= file_contents ('dejagnu', new Automake::Location); +} + + +# Handle TESTS variable and other checks. +sub handle_tests +{ + if (option 'dejagnu') + { + &handle_tests_dejagnu; + } + else + { + foreach my $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS') + { + reject_var ($c, "`$c' defined but `dejagnu' not in " + . "`AUTOMAKE_OPTIONS'"); + } + } + + if (var ('TESTS')) + { + push (@check_tests, 'check-TESTS'); + $output_rules .= &file_contents ('check', new Automake::Location); + } +} + +# Handle Emacs Lisp. +sub handle_emacs_lisp +{ + my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP', + 'lisp', 'noinst'); + + return if ! @elfiles; + + define_pretty_variable ('am__ELFILES', TRUE, INTERNAL, + map { $_->[1] } @elfiles); + define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL, + '$(am__ELFILES:.el=.elc)'); + # This one can be overridden by users. + define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(LISP:.el=.elc)'); + + push @all, '$(ELCFILES)'; + + require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE, + 'EMACS', 'lispdir'); + require_conf_file ($elfiles[0][0], FOREIGN, 'elisp-comp'); + &define_variable ('elisp_comp', "$am_config_aux_dir/elisp-comp", INTERNAL); +} + +# Handle Python +sub handle_python +{ + my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON', + 'noinst'); + return if ! @pyfiles; + + require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON'); + require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile'); + &define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL); +} + +# Handle Java. +sub handle_java +{ + my @sourcelist = &am_install_var ('-candist', + 'java', 'JAVA', + 'java', 'noinst', 'check'); + return if ! @sourcelist; + + my @prefix = am_primary_prefixes ('JAVA', 1, + 'java', 'noinst', 'check'); + + my $dir; + foreach my $curs (@prefix) + { + next + if $curs eq 'EXTRA'; + + err_var "${curs}_JAVA", "multiple _JAVA primaries in use" + if defined $dir; + $dir = $curs; + } + + + push (@all, 'class' . $dir . '.stamp'); +} + + +# Handle some of the minor options. +sub handle_minor_options +{ + if (option 'readme-alpha') + { + if ($relative_dir eq '.') + { + if ($package_version !~ /^$GNITS_VERSION_PATTERN$/) + { + msg ('error-gnits', $package_version_location, + "version `$package_version' doesn't follow " . + "Gnits standards"); + } + if (defined $1 && -f 'README-alpha') + { + # This means we have an alpha release. See + # GNITS_VERSION_PATTERN for details. + push_dist_common ('README-alpha'); + } + } + } +} + +################################################################ + +# ($OUTPUT, @INPUTS) +# &split_config_file_spec ($SPEC) +# ------------------------------- +# Decode the Autoconf syntax for config files (files, headers, links +# etc.). +sub split_config_file_spec ($) +{ + my ($spec) = @_; + my ($output, @inputs) = split (/:/, $spec); + + push @inputs, "$output.in" + unless @inputs; + + return ($output, @inputs); +} + +# $input +# locate_am (@POSSIBLE_SOURCES) +# ----------------------------- +# AC_CONFIG_FILES allow specifications such as Makefile:top.in:mid.in:bot.in +# This functions returns the first *.in file for which a *.am exists. +# It returns undef otherwise. +sub locate_am (@) +{ + my (@rest) = @_; + my $input; + foreach my $file (@rest) + { + if (($file =~ /^(.*)\.in$/) && -f "$1.am") + { + $input = $file; + last; + } + } + return $input; +} + +my %make_list; + +# &scan_autoconf_config_files ($WHERE, $CONFIG-FILES) +# --------------------------------------------------- +# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES +# (or AC_OUTPUT). +sub scan_autoconf_config_files ($$) +{ + my ($where, $config_files) = @_; + + # Look at potential Makefile.am's. + foreach (split ' ', $config_files) + { + # Must skip empty string for Perl 4. + next if $_ eq "\\" || $_ eq ''; + + # Handle $local:$input syntax. + my ($local, @rest) = split (/:/); + @rest = ("$local.in",) unless @rest; + my $input = locate_am @rest; + if ($input) + { + # We have a file that automake should generate. + $make_list{$input} = join (':', ($local, @rest)); + } + else + { + # We have a file that automake should cause to be + # rebuilt, but shouldn't generate itself. + push (@other_input_files, $_); + } + $ac_config_files_location{$local} = $where; + } +} + + +# &scan_autoconf_traces ($FILENAME) +# --------------------------------- +sub scan_autoconf_traces ($) +{ + my ($filename) = @_; + + # Macros to trace, with their minimal number of arguments. + # + # IMPORTANT: If you add a macro here, you should also add this macro + # ========= to Automake-preselection in autoconf/lib/autom4te.in. + my %traced = ( + AC_CANONICAL_BUILD => 0, + AC_CANONICAL_HOST => 0, + AC_CANONICAL_TARGET => 0, + AC_CONFIG_AUX_DIR => 1, + AC_CONFIG_FILES => 1, + AC_CONFIG_HEADERS => 1, + AC_CONFIG_LINKS => 1, + AC_INIT => 0, + AC_LIBSOURCE => 1, + AC_SUBST => 1, + AM_AUTOMAKE_VERSION => 1, + AM_CONDITIONAL => 2, + AM_ENABLE_MULTILIB => 0, + AM_GNU_GETTEXT => 0, + AM_INIT_AUTOMAKE => 0, + AM_MAINTAINER_MODE => 0, + AM_PROG_CC_C_O => 0, + LT_SUPPORTED_TAG => 1, + _LT_AC_TAGCONFIG => 0, + m4_include => 1, + m4_sinclude => 1, + sinclude => 1, + ); + + my $traces = ($ENV{AUTOCONF} || 'autoconf259') . " "; + + # Use a separator unlikely to be used, not `:', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. + $traces .= join (' ', + map { "--trace=$_" . ':\$f:\$l::\$n::\${::}%' } + (keys %traced)); + + my $tracefh = new Automake::XFile ("$traces $filename |"); + verb "reading $traces"; + + while ($_ = $tracefh->getline) + { + chomp; + my ($here, @args) = split (/::/); + my $where = new Automake::Location $here; + my $macro = $args[0]; + + prog_error ("unrequested trace `$macro'") + unless exists $traced{$macro}; + + # Skip and diagnose malformed calls. + if ($#args < $traced{$macro}) + { + msg ('syntax', $where, "not enough arguments for $macro"); + next; + } + + # Alphabetical ordering please. + if ($macro eq 'AC_CANONICAL_BUILD') + { + if ($seen_canonical <= AC_CANONICAL_BUILD) + { + $seen_canonical = AC_CANONICAL_BUILD; + $canonical_location = $where; + } + } + elsif ($macro eq 'AC_CANONICAL_HOST') + { + if ($seen_canonical <= AC_CANONICAL_HOST) + { + $seen_canonical = AC_CANONICAL_HOST; + $canonical_location = $where; + } + } + elsif ($macro eq 'AC_CANONICAL_TARGET') + { + $seen_canonical = AC_CANONICAL_TARGET; + $canonical_location = $where; + } + elsif ($macro eq 'AC_CONFIG_AUX_DIR') + { + if ($seen_init_automake) + { + error ($where, "AC_CONFIG_AUX_DIR must be called before " + . "AM_INIT_AUTOMAKE...", partial => 1); + error ($seen_init_automake, "... AM_INIT_AUTOMAKE called here"); + } + $config_aux_dir = $args[1]; + $config_aux_dir_set_in_configure_ac = 1; + $relative_dir = '.'; + check_directory ($config_aux_dir, $where); + } + elsif ($macro eq 'AC_CONFIG_FILES') + { + # Look at potential Makefile.am's. + scan_autoconf_config_files ($where, $args[1]); + } + elsif ($macro eq 'AC_CONFIG_HEADERS') + { + foreach my $spec (split (' ', $args[1])) + { + my ($dest, @src) = split (':', $spec); + $ac_config_files_location{$dest} = $where; + push @config_headers, $spec; + } + } + elsif ($macro eq 'AC_CONFIG_LINKS') + { + foreach my $spec (split (' ', $args[1])) + { + my ($dest, $src) = split (':', $spec); + $ac_config_files_location{$dest} = $where; + push @config_links, $spec; + } + } + elsif ($macro eq 'AC_INIT') + { + if (defined $args[2]) + { + $package_version = $args[2]; + $package_version_location = $where; + } + } + elsif ($macro eq 'AC_LIBSOURCE') + { + $libsources{$args[1]} = $here; + } + elsif ($macro eq 'AC_SUBST') + { + # Just check for alphanumeric in AC_SUBST. If you do + # AC_SUBST(5), then too bad. + $configure_vars{$args[1]} = $where + if $args[1] =~ /^\w+$/; + } + elsif ($macro eq 'AM_AUTOMAKE_VERSION') + { + error ($where, + "version mismatch. This is Automake $VERSION,\n" . + "but the definition used by this AM_INIT_AUTOMAKE\n" . + "comes from Automake $args[1]. You should recreate\n" . + "aclocal.m4 with aclocal and run automake again.\n", + # $? = 63 is used to indicate version mismatch to missing. + exit_code => 63) + if $VERSION ne $args[1]; + + $seen_automake_version = 1; + } + elsif ($macro eq 'AM_CONDITIONAL') + { + $configure_cond{$args[1]} = $where; + } + elsif ($macro eq 'AM_ENABLE_MULTILIB') + { + $seen_multilib = $where; + } + elsif ($macro eq 'AM_GNU_GETTEXT') + { + $seen_gettext = $where; + $ac_gettext_location = $where; + $seen_gettext_external = grep ($_ eq 'external', @args); + } + elsif ($macro eq 'AM_INIT_AUTOMAKE') + { + $seen_init_automake = $where; + if (defined $args[2]) + { + $package_version = $args[2]; + $package_version_location = $where; + } + elsif (defined $args[1]) + { + exit $exit_code + if (process_global_option_list ($where, + split (' ', $args[1]))); + } + } + elsif ($macro eq 'AM_MAINTAINER_MODE') + { + $seen_maint_mode = $where; + } + elsif ($macro eq 'AM_PROG_CC_C_O') + { + $seen_cc_c_o = $where; + } + elsif ($macro eq 'm4_include' + || $macro eq 'm4_sinclude' + || $macro eq 'sinclude') + { + # Some modified versions of Autoconf don't use + # forzen files. Consequently it's possible that we see all + # m4_include's performed during Autoconf's startup. + # Obviously we don't want to distribute Autoconf's files + # so we skip absolute filenames here. + push @configure_deps, '$(top_srcdir)/' . $args[1] + unless $here =~ m,^(?:\w:)?[\\/],; + # Keep track of the greatest timestamp. + if (-e $args[1]) + { + my $mtime = mtime $args[1]; + $configure_deps_greatest_timestamp = $mtime + if $mtime > $configure_deps_greatest_timestamp; + } + } + elsif ($macro eq 'LT_SUPPORTED_TAG') + { + $libtool_tags{$args[1]} = 1; + } + elsif ($macro eq '_LT_AC_TAGCONFIG') + { + # _LT_AC_TAGCONFIG is an old macro present in Libtool 1.5. + # We use it to detect whether tags are supported. Our + # prefered interface is LT_SUPPORTED_TAG, but it was + # introduced in Libtool 1.6. + if (0 == keys %libtool_tags) + { + # Hardcode the tags supported by Libtool 1.5. + %libtool_tags = (CC => 1, CXX => 1, GCJ => 1, F77 => 1); + } + } + } + + $tracefh->close; +} + + +# &scan_autoconf_files () +# ----------------------- +# Check whether we use `configure.ac' or `configure.in'. +# Scan it (and possibly `aclocal.m4') for interesting things. +# We must scan aclocal.m4 because there might be AC_SUBSTs and such there. +sub scan_autoconf_files () +{ + # Reinitialize libsources here. This isn't really necessary, + # since we currently assume there is only one configure.ac. But + # that won't always be the case. + %libsources = (); + + # Keep track of the youngest configure dependency. + $configure_deps_greatest_timestamp = mtime $configure_ac; + if (-e 'aclocal.m4') + { + my $mtime = mtime 'aclocal.m4'; + $configure_deps_greatest_timestamp = $mtime + if $mtime > $configure_deps_greatest_timestamp; + } + + scan_autoconf_traces ($configure_ac); + + @configure_input_files = sort keys %make_list; + # Set input and output files if not specified by user. + if (! @input_files) + { + @input_files = @configure_input_files; + %output_files = %make_list; + } + + + if (! $seen_init_automake) + { + err_ac ("no proper invocation of AM_INIT_AUTOMAKE was found.\nYou " + . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE," + . "\nthat aclocal.m4 is present in the top-level directory,\n" + . "and that aclocal.m4 was recently regenerated " + . "(using aclocal)."); + } + else + { + if (! $seen_automake_version) + { + if (-f 'aclocal.m4') + { + error ($seen_init_automake, + "your implementation of AM_INIT_AUTOMAKE comes from " . + "an\nold Automake version. You should recreate " . + "aclocal.m4\nwith aclocal and run automake again.\n", + # $? = 63 is used to indicate version mismatch to missing. + exit_code => 63); + } + else + { + error ($seen_init_automake, + "no proper implementation of AM_INIT_AUTOMAKE was " . + "found,\nprobably because aclocal.m4 is missing...\n" . + "You should run aclocal to create this file, then\n" . + "run automake again.\n"); + } + } + } + + locate_aux_dir (); + + # Reorder @input_files so that the Makefile that distributes aux + # files is processed last. This is important because each directory + # can require auxiliary scripts and we should wait until they have + # been installed before distributing them. + + # The Makefile.in that distribute the aux files is the one in + # $config_aux_dir or the top-level Makefile. + my $auxdirdist = is_make_dir ($config_aux_dir) ? $config_aux_dir : '.'; + my @new_input_files = (); + while (@input_files) + { + my $in = pop @input_files; + my @ins = split (/:/, $output_files{$in}); + if (dirname ($ins[0]) eq $auxdirdist) + { + push @new_input_files, $in; + $automake_will_process_aux_dir = 1; + } + else + { + unshift @new_input_files, $in; + } + } + @input_files = @new_input_files; + + # If neither the auxdir/Makefile nor the ./Makefile are generated + # by Automake, we won't distribute the aux files anyway. Assume + # the user know what (s)he does, and pretend we will distribute + # them to disable the error in require_file_internal. + $automake_will_process_aux_dir = 1 if ! is_make_dir ($auxdirdist); + + # Look for some files we need. Always check for these. This + # check must be done for every run, even those where we are only + # looking at a subdir Makefile. We must set relative_dir for + # maybe_push_required_file to work. + $relative_dir = '.'; + require_conf_file ($configure_ac, FOREIGN, 'install-sh', 'missing'); + err_am "`install.sh' is an anachronism; use `install-sh' instead" + if -f $config_aux_dir . '/install.sh'; + + # Preserve dist_common for later. + $configure_dist_common = variable_value ('DIST_COMMON') || ''; + +} + +################################################################ + +# Set up for Cygnus mode. +sub check_cygnus +{ + my $cygnus = option 'cygnus'; + return unless $cygnus; + + set_strictness ('foreign'); + set_option ('no-installinfo', $cygnus); + set_option ('no-dependencies', $cygnus); + set_option ('no-dist', $cygnus); + + err_ac "`AM_MAINTAINER_MODE' required when --cygnus specified" + if !$seen_maint_mode; +} + +# Do any extra checking for GNU standards. +sub check_gnu_standards +{ + if ($relative_dir eq '.') + { + # In top level (or only) directory. + require_file ("$am_file.am", GNU, + qw/INSTALL NEWS README AUTHORS ChangeLog/); + + # Accept one of these three licenses; default to COPYING. + # Make sure we do not overwrite an existing license. + my $license; + foreach (qw /COPYING COPYING.LIB COPYING.LESSER/) + { + if (-f $_) + { + $license = $_; + last; + } + } + require_file ("$am_file.am", GNU, 'COPYING') + unless $license; + } + + for my $opt ('no-installman', 'no-installinfo') + { + msg ('error-gnu', option $opt, + "option `$opt' disallowed by GNU standards") + if option $opt; + } +} + +# Do any extra checking for GNITS standards. +sub check_gnits_standards +{ + if ($relative_dir eq '.') + { + # In top level (or only) directory. + require_file ("$am_file.am", GNITS, 'THANKS'); + } +} + +################################################################ +# +# Functions to handle files of each language. + +# Each `lang_X_rewrite($DIRECTORY, $BASE, $EXT)' function follows a +# simple formula: Return value is LANG_SUBDIR if the resulting object +# file should be in a subdir if the source file is, LANG_PROCESS if +# file is to be dealt with, LANG_IGNORE otherwise. + +# Much of the actual processing is handled in +# handle_single_transform. These functions exist so that +# auxiliary information can be recorded for a later cleanup pass. +# Note that the calls to these functions are computed, so don't bother +# searching for their precise names in the source. + +# This is just a convenience function that can be used to determine +# when a subdir object should be used. +sub lang_sub_obj +{ + return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS; +} + +# Rewrite a single C source file. +sub lang_c_rewrite +{ + my ($directory, $base, $ext) = @_; + + if (option 'ansi2knr' && $base =~ /_$/) + { + # FIXME: include line number in error. + err_am "C source file `$base.c' would be deleted by ansi2knr rules"; + } + + my $r = LANG_PROCESS; + if (option 'subdir-objects') + { + $r = LANG_SUBDIR; + $base = $directory . '/' . $base + unless $directory eq '.' || $directory eq ''; + + err_am ("C objects in subdir but `AM_PROG_CC_C_O' " + . "not in `$configure_ac'", + uniq_scope => US_GLOBAL) + unless $seen_cc_c_o; + + require_conf_file ("$am_file.am", FOREIGN, 'compile'); + + # In this case we already have the directory information, so + # don't add it again. + $de_ansi_files{$base} = ''; + } + else + { + $de_ansi_files{$base} = (($directory eq '.' || $directory eq '') + ? '' + : "$directory/"); + } + + return $r; +} + +# Rewrite a single C++ source file. +sub lang_cxx_rewrite +{ + return &lang_sub_obj; +} + +# Rewrite a single header file. +sub lang_header_rewrite +{ + # Header files are simply ignored. + return LANG_IGNORE; +} + +# Rewrite a single yacc file. +sub lang_yacc_rewrite +{ + my ($directory, $base, $ext) = @_; + + my $r = &lang_sub_obj; + (my $newext = $ext) =~ tr/y/c/; + return ($r, $newext); +} + +# Rewrite a single yacc++ file. +sub lang_yaccxx_rewrite +{ + my ($directory, $base, $ext) = @_; + + my $r = &lang_sub_obj; + (my $newext = $ext) =~ tr/y/c/; + return ($r, $newext); +} + +# Rewrite a single lex file. +sub lang_lex_rewrite +{ + my ($directory, $base, $ext) = @_; + + my $r = &lang_sub_obj; + (my $newext = $ext) =~ tr/l/c/; + return ($r, $newext); +} + +# Rewrite a single lex++ file. +sub lang_lexxx_rewrite +{ + my ($directory, $base, $ext) = @_; + + my $r = &lang_sub_obj; + (my $newext = $ext) =~ tr/l/c/; + return ($r, $newext); +} + +# Rewrite a single assembly file. +sub lang_asm_rewrite +{ + return &lang_sub_obj; +} + +# Rewrite a single Fortran 77 file. +sub lang_f77_rewrite +{ + return LANG_PROCESS; +} + +# Rewrite a single Fortran file. +sub lang_fc_rewrite +{ + return LANG_PROCESS; +} + +# Rewrite a single preprocessed Fortran file. +sub lang_ppfc_rewrite +{ + return LANG_PROCESS; +} + +# Rewrite a single preprocessed Fortran 77 file. +sub lang_ppf77_rewrite +{ + return LANG_PROCESS; +} + +# Rewrite a single ratfor file. +sub lang_ratfor_rewrite +{ + return LANG_PROCESS; +} + +# Rewrite a single Objective C file. +sub lang_objc_rewrite +{ + return &lang_sub_obj; +} + +# Rewrite a single Java file. +sub lang_java_rewrite +{ + return LANG_SUBDIR; +} + +# The lang_X_finish functions are called after all source file +# processing is done. Each should handle defining rules for the +# language, etc. A finish function is only called if a source file of +# the appropriate type has been seen. + +sub lang_c_finish +{ + # Push all libobjs files onto de_ansi_files. We actually only + # push files which exist in the current directory, and which are + # genuine source files. + foreach my $file (keys %libsources) + { + if ($file =~ /^(.*)\.[cly]$/ && -f "$relative_dir/$file") + { + $de_ansi_files{$1} = '' + } + } + + if (option 'ansi2knr' && keys %de_ansi_files) + { + # Make all _.c files depend on their corresponding .c files. + my @objects; + foreach my $base (sort keys %de_ansi_files) + { + # Each _.c file must depend on ansi2knr; otherwise it + # might be used in a parallel build before it is built. + # We need to support files in the srcdir and in the build + # dir (because these files might be auto-generated. But + # we can't use $< -- some makes only define $< during a + # suffix rule. + my $ansfile = $de_ansi_files{$base} . $base . '.c'; + $output_rules .= ($base . "_.c: $ansfile \$(ANSI2KNR)\n\t" + . '$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) ' + . '`if test -f $(srcdir)/' . $ansfile + . '; then echo $(srcdir)/' . $ansfile + . '; else echo ' . $ansfile . '; fi` ' + . "| sed 's/^# \\([0-9]\\)/#line \\1/' " + . '| $(ANSI2KNR) > $@' + # If ansi2knr fails then we shouldn't + # create the _.c file + . " || rm -f \$\@\n"); + push (@objects, $base . '_.$(OBJEXT)'); + push (@objects, $base . '_.lo') + if var ('LIBTOOL'); + + # Explicitly clean the _.c files if they are in a + # subdirectory. (In the current directory they get erased + # by a `rm -f *_.c' rule.) + $clean_files{$base . '_.c'} = MOSTLY_CLEAN + if dirname ($base) ne '.'; + } + + # Make all _.o (and _.lo) files depend on ansi2knr. + # Use a sneaky little hack to make it print nicely. + &pretty_print_rule ('', '', @objects, ':', '$(ANSI2KNR)'); + } +} + +# This is a yacc helper which is called whenever we have decided to +# compile a yacc file. +sub lang_yacc_target_hook +{ + my ($self, $aggregate, $output, $input, %transform) = @_; + + my $flag = $aggregate . "_YFLAGS"; + my $flagvar = var $flag; + my $YFLAGSvar = var 'YFLAGS'; + if (($flagvar && $flagvar->variable_value =~ /$DASH_D_PATTERN/o) + || ($YFLAGSvar && $YFLAGSvar->variable_value =~ /$DASH_D_PATTERN/o)) + { + (my $output_base = $output) =~ s/$KNOWN_EXTENSIONS_PATTERN$//; + my $header = $output_base . '.h'; + + # Found a `-d' that applies to the compilation of this file. + # Add a dependency for the generated header file, and arrange + # for that file to be included in the distribution. + foreach my $cond (Automake::Rule::define (${header}, 'internal', + RULE_AUTOMAKE, TRUE, + INTERNAL)) + { + my $condstr = $cond->subst_string; + $output_rules .= ("$condstr${header}: $output\n" + # Recover from removal of $header + . "$condstr\t\@if test ! -f \$@; then \\\n" + . "$condstr\t rm -f $output; \\\n" + . "$condstr\t \$(MAKE) $output; \\\n" + . "$condstr\telse :; fi\n"); + } + # Distribute the generated file, unless its .y source was + # listed in a nodist_ variable. (&handle_source_transform + # will set DIST_SOURCE.) + &push_dist_common ($header) + if $transform{'DIST_SOURCE'}; + + # If the files are built in the build directory, then we want + # to remove them with `make clean'. If they are in srcdir + # they shouldn't be touched. However, we can't determine this + # statically, and the GNU rules say that yacc/lex output files + # should be removed by maintainer-clean. So that's what we + # do. + $clean_files{$header} = MAINTAINER_CLEAN; + } + # Erase $OUTPUT on `make maintainer-clean' (by GNU standards). + # See the comment above for $HEADER. + $clean_files{$output} = MAINTAINER_CLEAN; +} + +# This is a lex helper which is called whenever we have decided to +# compile a lex file. +sub lang_lex_target_hook +{ + my ($self, $aggregate, $output, $input) = @_; + # If the files are built in the build directory, then we want to + # remove them with `make clean'. If they are in srcdir they + # shouldn't be touched. However, we can't determine this + # statically, and the GNU rules say that yacc/lex output files + # should be removed by maintainer-clean. So that's what we do. + $clean_files{$output} = MAINTAINER_CLEAN; +} + +# This is a helper for both lex and yacc. +sub yacc_lex_finish_helper +{ + return if defined $language_scratch{'lex-yacc-done'}; + $language_scratch{'lex-yacc-done'} = 1; + + # If there is more than one distinct yacc (resp lex) source file + # in a given directory, then the `ylwrap' program is required to + # allow parallel builds to work correctly. FIXME: for now, no + # line number. + require_conf_file ($configure_ac, FOREIGN, 'ylwrap'); + &define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL); +} + +sub lang_yacc_finish +{ + return if defined $language_scratch{'yacc-done'}; + $language_scratch{'yacc-done'} = 1; + + reject_var 'YACCFLAGS', "`YACCFLAGS' obsolete; use `YFLAGS' instead"; + + &yacc_lex_finish_helper + if count_files_for_language ('yacc') > 1; +} + + +sub lang_lex_finish +{ + return if defined $language_scratch{'lex-done'}; + $language_scratch{'lex-done'} = 1; + + &yacc_lex_finish_helper + if count_files_for_language ('lex') > 1; +} + + +# Given a hash table of linker names, pick the name that has the most +# precedence. This is lame, but something has to have global +# knowledge in order to eliminate the conflict. Add more linkers as +# required. +sub resolve_linker +{ + my (%linkers) = @_; + + foreach my $l (qw(GCJLINK CXXLINK F77LINK FCLINK OBJCLINK)) + { + return $l if defined $linkers{$l}; + } + return 'LINK'; +} + +# Called to indicate that an extension was used. +sub saw_extension +{ + my ($ext) = @_; + if (! defined $extension_seen{$ext}) + { + $extension_seen{$ext} = 1; + } + else + { + ++$extension_seen{$ext}; + } +} + +# Return the number of files seen for a given language. Knows about +# special cases we care about. FIXME: this is hideous. We need +# something that involves real language objects. For instance yacc +# and yaccxx could both derive from a common yacc class which would +# know about the strange ylwrap requirement. (Or better yet we could +# just not support legacy yacc!) +sub count_files_for_language +{ + my ($name) = @_; + + my @names; + if ($name eq 'yacc' || $name eq 'yaccxx') + { + @names = ('yacc', 'yaccxx'); + } + elsif ($name eq 'lex' || $name eq 'lexxx') + { + @names = ('lex', 'lexxx'); + } + else + { + @names = ($name); + } + + my $r = 0; + foreach $name (@names) + { + my $lang = $languages{$name}; + foreach my $ext (@{$lang->extensions}) + { + $r += $extension_seen{$ext} + if defined $extension_seen{$ext}; + } + } + + return $r +} + +# Called to ask whether source files have been seen . If HEADERS is 1, +# headers can be included. +sub saw_sources_p +{ + my ($headers) = @_; + + # count all the sources + my $count = 0; + foreach my $val (values %extension_seen) + { + $count += $val; + } + + if (!$headers) + { + $count -= count_files_for_language ('header'); + } + + return $count > 0; +} + + +# register_language (%ATTRIBUTE) +# ------------------------------ +# Register a single language. +# Each %ATTRIBUTE is of the form ATTRIBUTE => VALUE. +sub register_language (%) +{ + my (%option) = @_; + + # Set the defaults. + $option{'ansi'} = 0 + unless defined $option{'ansi'}; + $option{'autodep'} = 'no' + unless defined $option{'autodep'}; + $option{'linker'} = '' + unless defined $option{'linker'}; + $option{'flags'} = [] + unless defined $option{'flags'}; + $option{'output_extensions'} = sub { return ( '.$(OBJEXT)', '.lo' ) } + unless defined $option{'output_extensions'}; + + my $lang = new Language (%option); + + # Fill indexes. + $extension_map{$_} = $lang->name foreach @{$lang->extensions}; + $languages{$lang->name} = $lang; + + # Update the pattern of known extensions. + accept_extensions (@{$lang->extensions}); + + # Upate the $suffix_rule map. + foreach my $suffix (@{$lang->extensions}) + { + foreach my $dest (&{$lang->output_extensions} ($suffix)) + { + register_suffix_rule (INTERNAL, $suffix, $dest); + } + } +} + +# derive_suffix ($EXT, $OBJ) +# -------------------------- +# This function is used to find a path from a user-specified suffix $EXT +# to $OBJ or to some other suffix we recognize internally, e.g. `cc'. +sub derive_suffix ($$) +{ + my ($source_ext, $obj) = @_; + + while (! $extension_map{$source_ext} + && $source_ext ne $obj + && exists $suffix_rules->{$source_ext} + && exists $suffix_rules->{$source_ext}{$obj}) + { + $source_ext = $suffix_rules->{$source_ext}{$obj}[0]; + } + + return $source_ext; +} + + +################################################################ + +# Pretty-print something and append to output_rules. +sub pretty_print_rule +{ + $output_rules .= &makefile_wrap (@_); +} + + +################################################################ + + +## -------------------------------- ## +## Handling the conditional stack. ## +## -------------------------------- ## + + +# $STRING +# make_conditional_string ($NEGATE, $COND) +# ---------------------------------------- +sub make_conditional_string ($$) +{ + my ($negate, $cond) = @_; + $cond = "${cond}_TRUE" + unless $cond =~ /^TRUE|FALSE$/; + $cond = Automake::Condition::conditional_negate ($cond) + if $negate; + return $cond; +} + + +# $COND +# cond_stack_if ($NEGATE, $COND, $WHERE) +# -------------------------------------- +sub cond_stack_if ($$$) +{ + my ($negate, $cond, $where) = @_; + + error $where, "$cond does not appear in AM_CONDITIONAL" + if ! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/; + + push (@cond_stack, make_conditional_string ($negate, $cond)); + + return new Automake::Condition (@cond_stack); +} + + +# $COND +# cond_stack_else ($NEGATE, $COND, $WHERE) +# ---------------------------------------- +sub cond_stack_else ($$$) +{ + my ($negate, $cond, $where) = @_; + + if (! @cond_stack) + { + error $where, "else without if"; + return FALSE; + } + + $cond_stack[$#cond_stack] = + Automake::Condition::conditional_negate ($cond_stack[$#cond_stack]); + + # If $COND is given, check against it. + if (defined $cond) + { + $cond = make_conditional_string ($negate, $cond); + + error ($where, "else reminder ($negate$cond) incompatible with " + . "current conditional: $cond_stack[$#cond_stack]") + if $cond_stack[$#cond_stack] ne $cond; + } + + return new Automake::Condition (@cond_stack); +} + + +# $COND +# cond_stack_endif ($NEGATE, $COND, $WHERE) +# ----------------------------------------- +sub cond_stack_endif ($$$) +{ + my ($negate, $cond, $where) = @_; + my $old_cond; + + if (! @cond_stack) + { + error $where, "endif without if"; + return TRUE; + } + + # If $COND is given, check against it. + if (defined $cond) + { + $cond = make_conditional_string ($negate, $cond); + + error ($where, "endif reminder ($negate$cond) incompatible with " + . "current conditional: $cond_stack[$#cond_stack]") + if $cond_stack[$#cond_stack] ne $cond; + } + + pop @cond_stack; + + return new Automake::Condition (@cond_stack); +} + + + + + +## ------------------------ ## +## Handling the variables. ## +## ------------------------ ## + + +# &define_pretty_variable ($VAR, $COND, $WHERE, @VALUE) +# ----------------------------------------------------- +# Like define_variable, but the value is a list, and the variable may +# be defined conditionally. The second argument is the Condition +# under which the value should be defined; this should be the empty +# string to define the variable unconditionally. The third argument +# is a list holding the values to use for the variable. The value is +# pretty printed in the output file. +sub define_pretty_variable ($$$@) +{ + my ($var, $cond, $where, @value) = @_; + + if (! vardef ($var, $cond)) + { + Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value", + '', $where, VAR_PRETTY); + rvar ($var)->rdef ($cond)->set_seen; + } +} + + +# define_variable ($VAR, $VALUE, $WHERE) +# -------------------------------------- +# Define a new user variable VAR to VALUE, but only if not already defined. +sub define_variable ($$$) +{ + my ($var, $value, $where) = @_; + define_pretty_variable ($var, TRUE, $where, $value); +} + + +# define_files_variable ($VAR, \@BASENAME, $EXTENSION, $WHERE) +# ----------------------------------------------------------- +# Define the $VAR which content is the list of file names composed of +# a @BASENAME and the $EXTENSION. +sub define_files_variable ($\@$$) +{ + my ($var, $basename, $extension, $where) = @_; + define_variable ($var, + join (' ', map { "$_.$extension" } @$basename), + $where); +} + + +# Like define_variable, but define a variable to be the configure +# substitution by the same name. +sub define_configure_variable ($) +{ + my ($var) = @_; + + my $pretty = VAR_ASIS; + my $owner = VAR_CONFIGURE; + + # Do not output the ANSI2KNR configure variable -- we AC_SUBST + # it in protos.m4, but later redefine it elsewhere. This is + # pretty hacky. We also don't output AMDEPBACKSLASH: it might + # be subst'd by `\', which certainly would not be appreciated by + # Make. + if ($var eq 'ANSI2KNR' || $var eq 'AMDEPBACKSLASH') + { + $pretty = VAR_SILENT; + $owner = VAR_AUTOMAKE; + } + + Automake::Variable::define ($var, $owner, '', TRUE, subst $var, + '', $configure_vars{$var}, $pretty); +} + + +# define_compiler_variable ($LANG) +# -------------------------------- +# Define a compiler variable. We also handle defining the `LT' +# version of the command when using libtool. +sub define_compiler_variable ($) +{ + my ($lang) = @_; + + my ($var, $value) = ($lang->compiler, $lang->compile); + my $libtool_tag = ''; + $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' + if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; + &define_variable ($var, $value, INTERNAL); + &define_variable ("LT$var", + "\$(LIBTOOL) $libtool_tag--mode=compile $value", + INTERNAL) + if var ('LIBTOOL'); +} + + +# define_linker_variable ($LANG) +# ------------------------------ +# Define linker variables. +sub define_linker_variable ($) +{ + my ($lang) = @_; + + my ($var, $value) = ($lang->lder, $lang->ld); + my $libtool_tag = ''; + $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' + if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; + # CCLD = $(CC). + &define_variable ($lang->lder, $lang->ld, INTERNAL); + # CCLINK = $(CCLD) blah blah... + &define_variable ($lang->linker, + ((var ('LIBTOOL') ? + "\$(LIBTOOL) $libtool_tag--mode=link " : '') + . $lang->link), + INTERNAL); +} + +################################################################ + +# &check_trailing_slash ($WHERE, $LINE) +# -------------------------------------- +# Return 1 iff $LINE ends with a slash. +# Might modify $LINE. +sub check_trailing_slash ($\$) +{ + my ($where, $line) = @_; + + # Ignore `##' lines. + return 0 if $$line =~ /$IGNORE_PATTERN/o; + + # Catch and fix a common error. + msg "syntax", $where, "whitespace following trailing backslash" + if $$line =~ s/\\\s+\n$/\\\n/; + + return $$line =~ /\\$/; +} + + +# &read_am_file ($AMFILE, $WHERE) +# ------------------------------- +# Read Makefile.am and set up %contents. Simultaneously copy lines +# from Makefile.am into $output_trailer, or define variables as +# appropriate. NOTE we put rules in the trailer section. We want +# user rules to come after our generated stuff. +sub read_am_file ($$) +{ + my ($amfile, $where) = @_; + + my $am_file = new Automake::XFile ("< $amfile"); + verb "reading $amfile"; + + # Keep track of the youngest output dependency. + my $mtime = mtime $amfile; + $output_deps_greatest_timestamp = $mtime + if $mtime > $output_deps_greatest_timestamp; + + my $spacing = ''; + my $comment = ''; + my $blank = 0; + my $saw_bk = 0; + my $var_look = VAR_ASIS; + + use constant IN_VAR_DEF => 0; + use constant IN_RULE_DEF => 1; + use constant IN_COMMENT => 2; + my $prev_state = IN_RULE_DEF; + + while ($_ = $am_file->getline) + { + $where->set ("$amfile:$."); + if (/$IGNORE_PATTERN/o) + { + # Merely delete comments beginning with two hashes. + } + elsif (/$WHITE_PATTERN/o) + { + error $where, "blank line following trailing backslash" + if $saw_bk; + # Stick a single white line before the incoming macro or rule. + $spacing = "\n"; + $blank = 1; + # Flush all comments seen so far. + if ($comment ne '') + { + $output_vars .= $comment; + $comment = ''; + } + } + elsif (/$COMMENT_PATTERN/o) + { + # Stick comments before the incoming macro or rule. Make + # sure a blank line precedes the first block of comments. + $spacing = "\n" unless $blank; + $blank = 1; + $comment .= $spacing . $_; + $spacing = ''; + $prev_state = IN_COMMENT; + } + else + { + last; + } + $saw_bk = check_trailing_slash ($where, $_); + } + + # We save the conditional stack on entry, and then check to make + # sure it is the same on exit. This lets us conditionally include + # other files. + my @saved_cond_stack = @cond_stack; + my $cond = new Automake::Condition (@cond_stack); + + my $last_var_name = ''; + my $last_var_type = ''; + my $last_var_value = ''; + my $last_where; + # FIXME: shouldn't use $_ in this loop; it is too big. + while ($_) + { + $where->set ("$amfile:$."); + + # Make sure the line is \n-terminated. + chomp; + $_ .= "\n"; + + # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be + # used by users. @MAINT@ is an anachronism now. + $_ =~ s/\@MAINT\@//g + unless $seen_maint_mode; + + my $new_saw_bk = check_trailing_slash ($where, $_); + + if (/$IGNORE_PATTERN/o) + { + # Merely delete comments beginning with two hashes. + } + elsif (/$WHITE_PATTERN/o) + { + # Stick a single white line before the incoming macro or rule. + $spacing = "\n"; + error $where, "blank line following trailing backslash" + if $saw_bk; + } + elsif (/$COMMENT_PATTERN/o) + { + # Stick comments before the incoming macro or rule. + $comment .= $spacing . $_; + $spacing = ''; + error $where, "comment following trailing backslash" + if $saw_bk && $comment eq ''; + $prev_state = IN_COMMENT; + } + elsif ($saw_bk) + { + if ($prev_state == IN_RULE_DEF) + { + my $cond = new Automake::Condition @cond_stack; + $output_trailer .= $cond->subst_string; + $output_trailer .= $_; + } + elsif ($prev_state == IN_COMMENT) + { + # If the line doesn't start with a `#', add it. + # We do this because a continued comment like + # # A = foo \ + # bar \ + # baz + # is not portable. BSD make doesn't honor + # escaped newlines in comments. + s/^#?/#/; + $comment .= $spacing . $_; + } + else # $prev_state == IN_VAR_DEF + { + $last_var_value .= ' ' + unless $last_var_value =~ /\s$/; + $last_var_value .= $_; + + if (!/\\$/) + { + Automake::Variable::define ($last_var_name, VAR_MAKEFILE, + $last_var_type, $cond, + $last_var_value, $comment, + $last_where, VAR_ASIS) + if $cond != FALSE; + $comment = $spacing = ''; + } + } + } + + elsif (/$IF_PATTERN/o) + { + $cond = cond_stack_if ($1, $2, $where); + } + elsif (/$ELSE_PATTERN/o) + { + $cond = cond_stack_else ($1, $2, $where); + } + elsif (/$ENDIF_PATTERN/o) + { + $cond = cond_stack_endif ($1, $2, $where); + } + + elsif (/$RULE_PATTERN/o) + { + # Found a rule. + $prev_state = IN_RULE_DEF; + + # For now we have to output all definitions of user rules + # and can't diagnose duplicates (see the comment in + # rule_define). So we go on and ignore the return value. + Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where); + + check_variable_expansions ($_, $where); + + $output_trailer .= $comment . $spacing; + my $cond = new Automake::Condition @cond_stack; + $output_trailer .= $cond->subst_string; + $output_trailer .= $_; + $comment = $spacing = ''; + } + elsif (/$ASSIGNMENT_PATTERN/o) + { + # Found a macro definition. + $prev_state = IN_VAR_DEF; + $last_var_name = $1; + $last_var_type = $2; + $last_var_value = $3; + $last_where = $where->clone; + if ($3 ne '' && substr ($3, -1) eq "\\") + { + # We preserve the `\' because otherwise the long lines + # that are generated will be truncated by broken + # `sed's. + $last_var_value = $3 . "\n"; + } + # Normally we try to output variable definitions in the + # same format they were input. However, POSIX compliant + # systems are not required to support lines longer than + # 2048 bytes (most notably, some sed implementation are + # limited to 4000 bytes, and sed is used by config.status + # to rewrite Makefile.in into Makefile). Moreover nobody + # would really write such long lines by hand since it is + # hardly maintainable. So if a line is longer that 1000 + # bytes (an arbitrary limit), assume it has been + # automatically generated by some tools, and flatten the + # variable definition. Otherwise, keep the variable as it + # as been input. + $var_look = VAR_PRETTY if length ($last_var_value) >= 1000; + + if (!/\\$/) + { + Automake::Variable::define ($last_var_name, VAR_MAKEFILE, + $last_var_type, $cond, + $last_var_value, $comment, + $last_where, $var_look) + if $cond != FALSE; + $comment = $spacing = ''; + $var_look = VAR_ASIS; + } + } + elsif (/$INCLUDE_PATTERN/o) + { + my $path = $1; + + if ($path =~ s/^\$\(top_srcdir\)\///) + { + push (@include_stack, "\$\(top_srcdir\)/$path"); + # Distribute any included file. + + # Always use the $(top_srcdir) prefix in DIST_COMMON, + # otherwise OSF make will implicitly copy the included + # file in the build tree during `make distdir' to satisfy + # the dependency. + # (subdircond2.test and subdircond3.test will fail.) + push_dist_common ("\$\(top_srcdir\)/$path"); + } + else + { + $path =~ s/\$\(srcdir\)\///; + push (@include_stack, "\$\(srcdir\)/$path"); + # Always use the $(srcdir) prefix in DIST_COMMON, + # otherwise OSF make will implicitly copy the included + # file in the build tree during `make distdir' to satisfy + # the dependency. + # (subdircond2.test and subdircond3.test will fail.) + push_dist_common ("\$\(srcdir\)/$path"); + $path = $relative_dir . "/" . $path if $relative_dir ne '.'; + } + $where->push_context ("`$path' included from here"); + &read_am_file ($path, $where); + $where->pop_context; + } + else + { + # This isn't an error; it is probably a continued rule. + # In fact, this is what we assume. + $prev_state = IN_RULE_DEF; + check_variable_expansions ($_, $where); + $output_trailer .= $comment . $spacing; + my $cond = new Automake::Condition @cond_stack; + $output_trailer .= $cond->subst_string; + $output_trailer .= $_; + $comment = $spacing = ''; + error $where, "`#' comment at start of rule is unportable" + if $_ =~ /^\t\s*\#/; + } + + $saw_bk = $new_saw_bk; + $_ = $am_file->getline; + } + + $output_trailer .= $comment; + + error ($where, "trailing backslash on last line") + if $saw_bk; + + error ($where, (@cond_stack ? "unterminated conditionals: @cond_stack" + : "too many conditionals closed in include file")) + if "@saved_cond_stack" ne "@cond_stack"; +} + + +# define_standard_variables () +# ---------------------------- +# A helper for read_main_am_file which initializes configure variables +# and variables from header-vars.am. +sub define_standard_variables +{ + my $saved_output_vars = $output_vars; + my ($comments, undef, $rules) = + file_contents_internal (1, "$libdir/am/header-vars.am", + new Automake::Location); + + foreach my $var (sort keys %configure_vars) + { + &define_configure_variable ($var); + } + + $output_vars .= $comments . $rules; +} + +# Read main am file. +sub read_main_am_file +{ + my ($amfile) = @_; + + # This supports the strange variable tricks we are about to play. + prog_error (macros_dump () . "variable defined before read_main_am_file") + if (scalar (variables) > 0); + + # Generate copyright header for generated Makefile.in. + # We do discard the output of predefined variables, handled below. + $output_vars = ("# $in_file_name generated by automake " + . $VERSION . " from $am_file_name.\n"); + $output_vars .= '# ' . subst ('configure_input') . "\n"; + $output_vars .= $gen_copyright; + + # We want to predefine as many variables as possible. This lets + # the user set them with `+=' in Makefile.am. + &define_standard_variables; + + # Read user file, which might override some of our values. + &read_am_file ($amfile, new Automake::Location); +} + + + +################################################################ + +# $FLATTENED +# &flatten ($STRING) +# ------------------ +# Flatten the $STRING and return the result. +sub flatten +{ + $_ = shift; + + s/\\\n//somg; + s/\s+/ /g; + s/^ //; + s/ $//; + + return $_; +} + + +# @PARAGRAPHS +# &make_paragraphs ($MAKEFILE, [%TRANSFORM]) +# ------------------------------------------ +# Load a $MAKEFILE, apply the %TRANSFORM, and return it as a list of +# paragraphs. +sub make_paragraphs ($%) +{ + my ($file, %transform) = @_; + + # Complete %transform with global options and make it a Perl $command. + # Note that %transform goes last, so it overrides global options. + my $command = + "s/$IGNORE_PATTERN//gm;" + . transform ('CYGNUS' => !! option 'cygnus', + 'MAINTAINER-MODE' + => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '', + + 'BZIP2' => !! option 'dist-bzip2', + 'COMPRESS' => !! option 'dist-tarZ', + 'GZIP' => ! option 'no-dist-gzip', + 'SHAR' => !! option 'dist-shar', + 'ZIP' => !! option 'dist-zip', + + 'INSTALL-INFO' => ! option 'no-installinfo', + 'INSTALL-MAN' => ! option 'no-installman', + 'CK-NEWS' => !! option 'check-news', + + 'SUBDIRS' => !! var ('SUBDIRS'), + 'TOPDIR' => backname ($relative_dir), + 'TOPDIR_P' => $relative_dir eq '.', + + 'BUILD' => ($seen_canonical >= AC_CANONICAL_BUILD), + 'HOST' => ($seen_canonical >= AC_CANONICAL_HOST), + 'TARGET' => ($seen_canonical >= AC_CANONICAL_TARGET), + + 'LIBTOOL' => !! var ('LIBTOOL'), + 'NONLIBTOOL' => 1, + 'FIRST' => ! $transformed_files{$file}, + %transform) + # We don't need more than two consecutive new-lines. + . 's/\n{3,}/\n\n/g'; + + $transformed_files{$file} = 1; + + # Swallow the file and apply the COMMAND. + my $fc_file = new Automake::XFile "< $file"; + # Looks stupid? + verb "reading $file"; + my $saved_dollar_slash = $/; + undef $/; + $_ = $fc_file->getline; + $/ = $saved_dollar_slash; + eval $command; + $fc_file->close; + my $content = $_; + + # Split at unescaped new lines. + my @lines = split (/(?set ($file); + + my $result_vars = ''; + my $result_rules = ''; + my $comment = ''; + my $spacing = ''; + + # The following flags are used to track rules spanning across + # multiple paragraphs. + my $is_rule = 0; # 1 if we are processing a rule. + my $discard_rule = 0; # 1 if the current rule should not be output. + + # We save the conditional stack on entry, and then check to make + # sure it is the same on exit. This lets us conditionally include + # other files. + my @saved_cond_stack = @cond_stack; + my $cond = new Automake::Condition (@cond_stack); + + foreach (make_paragraphs ($file, %transform)) + { + # FIXME: no line number available. + $where->set ($file); + + # Sanity checks. + error $where, "blank line following trailing backslash:\n$_" + if /\\$/; + error $where, "comment following trailing backslash:\n$_" + if /\\#/; + + if (/^$/) + { + $is_rule = 0; + # Stick empty line before the incoming macro or rule. + $spacing = "\n"; + } + elsif (/$COMMENT_PATTERN/mso) + { + $is_rule = 0; + # Stick comments before the incoming macro or rule. + $comment = "$_\n"; + } + + # Handle inclusion of other files. + elsif (/$INCLUDE_PATTERN/o) + { + if ($cond != FALSE) + { + my $file = ($is_am ? "$libdir/am/" : '') . $1; + $where->push_context ("`$file' included from here"); + # N-ary `.=' fails. + my ($com, $vars, $rules) + = file_contents_internal ($is_am, $file, $where, %transform); + $where->pop_context; + $comment .= $com; + $result_vars .= $vars; + $result_rules .= $rules; + } + } + + # Handling the conditionals. + elsif (/$IF_PATTERN/o) + { + $cond = cond_stack_if ($1, $2, $file); + } + elsif (/$ELSE_PATTERN/o) + { + $cond = cond_stack_else ($1, $2, $file); + } + elsif (/$ENDIF_PATTERN/o) + { + $cond = cond_stack_endif ($1, $2, $file); + } + + # Handling rules. + elsif (/$RULE_PATTERN/mso) + { + $is_rule = 1; + $discard_rule = 0; + # Separate relationship from optional actions: the first + # `new-line tab" not preceded by backslash (continuation + # line). + my $paragraph = $_; + /^(.*?)(?:(?subst_string/gme; + $result_rules .= "$spacing$comment$condparagraph\n"; + } + if (scalar @undefined_conds == 0) + { + # Remember to discard next paragraphs + # if they belong to this rule. + # (but see also FIXME: #2 above.) + $discard_rule = 1; + } + $comment = $spacing = ''; + last; + } + } + } + + elsif (/$ASSIGNMENT_PATTERN/mso) + { + my ($var, $type, $val) = ($1, $2, $3); + error $where, "variable `$var' with trailing backslash" + if /\\$/; + + $is_rule = 0; + + Automake::Variable::define ($var, + $is_am ? VAR_AUTOMAKE : VAR_MAKEFILE, + $type, $cond, $val, $comment, $where, + VAR_ASIS) + if $cond != FALSE; + + $comment = $spacing = ''; + } + else + { + # This isn't an error; it is probably some tokens which + # configure is supposed to replace, such as `@SET-MAKE@', + # or some part of a rule cut by an if/endif. + if (! $cond->false && ! ($is_rule && $discard_rule)) + { + s/^/$cond->subst_string/gme; + $result_rules .= "$spacing$comment$_\n"; + } + $comment = $spacing = ''; + } + } + + error ($where, @cond_stack ? + "unterminated conditionals: @cond_stack" : + "too many conditionals closed in include file") + if "@saved_cond_stack" ne "@cond_stack"; + + return ($comment, $result_vars, $result_rules); +} + + +# $CONTENTS +# &file_contents ($BASENAME, $WHERE, [%TRANSFORM]) +# ------------------------------------------------ +# Return contents of a file from $libdir/am, automatically skipping +# macros or rules which are already known. +sub file_contents ($$%) +{ + my ($basename, $where, %transform) = @_; + my ($comments, $variables, $rules) = + file_contents_internal (1, "$libdir/am/$basename.am", $where, + %transform); + return "$comments$variables$rules"; +} + + +# $REGEXP +# &transform (%PAIRS) +# ------------------- +# For each ($TOKEN, $VAL) in %PAIRS produce a replacement expression +# suitable for file_contents which: +# - replaces %$TOKEN% with $VAL, +# - enables/disables ?$TOKEN? and ?!$TOKEN?, +# - replaces %?$TOKEN% with TRUE or FALSE. +sub transform (%) +{ + my (%pairs) = @_; + my $result = ''; + + while (my ($token, $val) = each %pairs) + { + $result .= "s/\Q%$token%\E/\Q$val\E/gm;"; + if ($val) + { + $result .= "s/\Q?$token?\E//gm;s/^.*\Q?!$token?\E.*\\n//gm;"; + $result .= "s/\Q%?$token%\E/TRUE/gm;"; + } + else + { + $result .= "s/\Q?!$token?\E//gm;s/^.*\Q?$token?\E.*\\n//gm;"; + $result .= "s/\Q%?$token%\E/FALSE/gm;"; + } + } + + return $result; +} + + +# &append_exeext ($MACRO) +# ----------------------- +# Macro is an Automake magic macro which primary is PROGRAMS, e.g. +# bin_PROGRAMS. Make sure these programs have $(EXEEXT) appended. +sub append_exeext ($) +{ + my ($macro) = @_; + + prog_error "append_exeext ($macro)" + unless $macro =~ /_PROGRAMS$/; + + transform_variable_recursively + ($macro, $macro, 'am__EXEEXT', 0, INTERNAL, + sub { + my ($subvar, $val, $cond, $full_cond) = @_; + # Append $(EXEEXT) unless the user did it already, or it's a + # @substitution@. + $val .= '$(EXEEXT)' unless $val =~ /(?:\$\(EXEEXT\)$|^[@]\w+[@]$)/; + return $val; + }); +} + + +# @PREFIX +# &am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES) +# ----------------------------------------------------- +# Find all variable prefixes that are used for install directories. A +# prefix `zar' qualifies iff: +# +# * `zardir' is a variable. +# * `zar_PRIMARY' is a variable. +# +# As a side effect, it looks for misspellings. It is an error to have +# a variable ending in a "reserved" suffix whose prefix is unknown, e.g. +# "bin_PROGRAMS". However, unusual prefixes are allowed if a variable +# of the same name (with "dir" appended) exists. For instance, if the +# variable "zardir" is defined, then "zar_PROGRAMS" becomes valid. +# This is to provide a little extra flexibility in those cases which +# need it. +sub am_primary_prefixes ($$@) +{ + my ($primary, $can_dist, @prefixes) = @_; + + local $_; + my %valid = map { $_ => 0 } @prefixes; + $valid{'EXTRA'} = 0; + foreach my $var (variables) + { + # Automake is allowed to define variables that look like primaries + # but which aren't. E.g. INSTALL_sh_DATA. + # Autoconf can also define variables like INSTALL_DATA, so + # ignore all configure variables (at least those which are not + # redefined in Makefile.am). + # FIXME: We should make sure that these variables are not + # conditionally defined (or else adjust the condition below). + my $def = $var->def (TRUE); + next if $def && $def->owner != VAR_MAKEFILE; + + my $varname = $var->name; + + if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_$primary$/) + { + my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || ''); + if ($dist ne '' && ! $can_dist) + { + err_var ($var, + "invalid variable `$varname': `dist' is forbidden"); + } + # Standard directories must be explicitly allowed. + elsif (! defined $valid{$X} && exists $standard_prefix{$X}) + { + err_var ($var, + "`${X}dir' is not a legitimate directory " . + "for `$primary'"); + } + # A not explicitly valid directory is allowed if Xdir is defined. + elsif (! defined $valid{$X} && + $var->requires_variables ("`$varname' is used", "${X}dir")) + { + # Nothing to do. Any error message has been output + # by $var->requires_variables. + } + else + { + # Ensure all extended prefixes are actually used. + $valid{"$base$dist$X"} = 1; + } + } + } + + # Return only those which are actually defined. + return sort grep { var ($_ . '_' . $primary) } keys %valid; +} + + +# Handle `where_HOW' variable magic. Does all lookups, generates +# install code, and possibly generates code to define the primary +# variable. The first argument is the name of the .am file to munge, +# the second argument is the primary variable (e.g. HEADERS), and all +# subsequent arguments are possible installation locations. +# +# Returns list of [$location, $value] pairs, where +# $value's are the values in all where_HOW variable, and $location +# there associated location (the place here their parent variables were +# defined). +# +# FIXME: this should be rewritten to be cleaner. It should be broken +# up into multiple functions. +# +# Usage is: am_install_var (OPTION..., file, HOW, where...) +sub am_install_var +{ + my (@args) = @_; + + my $do_require = 1; + my $can_dist = 0; + my $default_dist = 0; + while (@args) + { + if ($args[0] eq '-noextra') + { + $do_require = 0; + } + elsif ($args[0] eq '-candist') + { + $can_dist = 1; + } + elsif ($args[0] eq '-defaultdist') + { + $default_dist = 1; + $can_dist = 1; + } + elsif ($args[0] !~ /^-/) + { + last; + } + shift (@args); + } + + my ($file, $primary, @prefix) = @args; + + # Now that configure substitutions are allowed in where_HOW + # variables, it is an error to actually define the primary. We + # allow `JAVA', as it is customarily used to mean the Java + # interpreter. This is but one of several Java hacks. Similarly, + # `PYTHON' is customarily used to mean the Python interpreter. + reject_var $primary, "`$primary' is an anachronism" + unless $primary eq 'JAVA' || $primary eq 'PYTHON'; + + # Get the prefixes which are valid and actually used. + @prefix = am_primary_prefixes ($primary, $can_dist, @prefix); + + # If a primary includes a configure substitution, then the EXTRA_ + # form is required. Otherwise we can't properly do our job. + my $require_extra; + + my @used = (); + my @result = (); + + foreach my $X (@prefix) + { + my $nodir_name = $X; + my $one_name = $X . '_' . $primary; + my $one_var = var $one_name; + + my $strip_subdir = 1; + # If subdir prefix should be preserved, do so. + if ($nodir_name =~ /^nobase_/) + { + $strip_subdir = 0; + $nodir_name =~ s/^nobase_//; + } + + # If files should be distributed, do so. + my $dist_p = 0; + if ($can_dist) + { + $dist_p = (($default_dist && $nodir_name !~ /^nodist_/) + || (! $default_dist && $nodir_name =~ /^dist_/)); + $nodir_name =~ s/^(dist|nodist)_//; + } + + + # Use the location of the currently processed variable. + # We are not processing a particular condition, so pick the first + # available. + my $tmpcond = $one_var->conditions->one_cond; + my $where = $one_var->rdef ($tmpcond)->location->clone; + + # Append actual contents of where_PRIMARY variable to + # @result, skipping @substitutions@. + foreach my $locvals ($one_var->value_as_list_recursive (location => 1)) + { + my ($loc, $value) = @$locvals; + # Skip configure substitutions. + if ($value =~ /^\@.*\@$/) + { + if ($nodir_name eq 'EXTRA') + { + error ($where, + "`$one_name' contains configure substitution, " + . "but shouldn't"); + } + # Check here to make sure variables defined in + # configure.ac do not imply that EXTRA_PRIMARY + # must be defined. + elsif (! defined $configure_vars{$one_name}) + { + $require_extra = $one_name + if $do_require; + } + } + else + { + push (@result, $locvals); + } + } + # A blatant hack: we rewrite each _PROGRAMS primary to include + # EXEEXT. + append_exeext ($one_name) + if $primary eq 'PROGRAMS'; + # "EXTRA" shouldn't be used when generating clean targets, + # all, or install targets. We used to warn if EXTRA_FOO was + # defined uselessly, but this was annoying. + next + if $nodir_name eq 'EXTRA'; + + if ($nodir_name eq 'check') + { + push (@check, '$(' . $one_name . ')'); + } + else + { + push (@used, '$(' . $one_name . ')'); + } + + # Is this to be installed? + my $install_p = $nodir_name ne 'noinst' && $nodir_name ne 'check'; + + # If so, with install-exec? (or install-data?). + my $exec_p = ($nodir_name =~ /$EXEC_DIR_PATTERN/o); + + my $check_options_p = $install_p && !! option 'std-options'; + + # Use the location of the currently processed variable as context. + $where->push_context ("while processing `$one_name'"); + + # The variable containing all file to distribute. + my $distvar = "\$($one_name)"; + $distvar = shadow_unconditionally ($one_name, $where) + if ($dist_p && $one_var->has_conditional_contents); + + # Singular form of $PRIMARY. + (my $one_primary = $primary) =~ s/S$//; + $output_rules .= &file_contents ($file, $where, + PRIMARY => $primary, + ONE_PRIMARY => $one_primary, + DIR => $X, + NDIR => $nodir_name, + BASE => $strip_subdir, + + EXEC => $exec_p, + INSTALL => $install_p, + DIST => $dist_p, + DISTVAR => $distvar, + 'CK-OPTS' => $check_options_p); + } + + # The JAVA variable is used as the name of the Java interpreter. + # The PYTHON variable is used as the name of the Python interpreter. + if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON') + { + # Define it. + define_pretty_variable ($primary, TRUE, INTERNAL, @used); + $output_vars .= "\n"; + } + + err_var ($require_extra, + "`$require_extra' contains configure substitution,\n" + . "but `EXTRA_$primary' not defined") + if ($require_extra && ! var ('EXTRA_' . $primary)); + + # Push here because PRIMARY might be configure time determined. + push (@all, '$(' . $primary . ')') + if @used && $primary ne 'JAVA' && $primary ne 'PYTHON'; + + # Make the result unique. This lets the user use conditionals in + # a natural way, but still lets us program lazily -- we don't have + # to worry about handling a particular object more than once. + # We will keep only one location per object. + my %result = (); + for my $pair (@result) + { + my ($loc, $val) = @$pair; + $result{$val} = $loc; + } + my @l = sort keys %result; + return map { [$result{$_}->clone, $_] } @l; +} + + +################################################################ + +# Each key in this hash is the name of a directory holding a +# Makefile.in. These variables are local to `is_make_dir'. +my %make_dirs = (); +my $make_dirs_set = 0; + +sub is_make_dir +{ + my ($dir) = @_; + if (! $make_dirs_set) + { + foreach my $iter (@configure_input_files) + { + $make_dirs{dirname ($iter)} = 1; + } + # We also want to notice Makefile.in's. + foreach my $iter (@other_input_files) + { + if ($iter =~ /Makefile\.in$/) + { + $make_dirs{dirname ($iter)} = 1; + } + } + $make_dirs_set = 1; + } + return defined $make_dirs{$dir}; +} + +################################################################ + +# Find the aux dir. This should match the algorithm used by +# ./configure. (See the Autoconf documentation for for +# AC_CONFIG_AUX_DIR.) +sub locate_aux_dir () +{ + if (! $config_aux_dir_set_in_configure_ac) + { + # The default auxiliary directory is the first + # of ., .., or ../.. that contains install-sh. + # Assume . if install-sh doesn't exist yet. + for my $dir (qw (. .. ../..)) + { + if (-f "$dir/install-sh") + { + $config_aux_dir = $dir; + last; + } + } + $config_aux_dir = '.' unless $config_aux_dir; + } + # Avoid unsightly '/.'s. + $am_config_aux_dir = + '$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir"); + $am_config_aux_dir =~ s,/*$,,; +} + + +# &maybe_push_required_file ($DIR, $FILE, $FULLFILE) +# -------------------------------------------------- +# See if we want to push this file onto dist_common. This function +# encodes the rules for deciding when to do so. +sub maybe_push_required_file +{ + my ($dir, $file, $fullfile) = @_; + + if ($dir eq $relative_dir) + { + push_dist_common ($file); + return 1; + } + elsif ($relative_dir eq '.' && ! &is_make_dir ($dir)) + { + # If we are doing the topmost directory, and the file is in a + # subdir which does not have a Makefile, then we distribute it + # here. + + # If a required file is above the source tree, it is important + # to prefix it with `$(srcdir)' so that no VPATH search is + # performed. Otherwise problems occur with Make implementations + # that rewrite and simplify rules whose dependencies are found in a + # VPATH location. Here is an example with OSF1/Tru64 Make. + # + # % cat Makefile + # VPATH = sub + # distdir: ../a + # echo ../a + # % ls + # Makefile a + # % make + # echo a + # a + # + # Dependency `../a' was found in `sub/../a', but this make + # implementation simplified it as `a'. (Note that the sub/ + # directory does not even exist.) + # + # This kind of VPATH rewriting seems hard to cancel. The + # distdir.am hack against VPATH rewriting works only when no + # simplification is done, i.e., for dependencies which are in + # subdirectories, not in enclosing directories. Hence, in + # the latter case we use a full path to make sure no VPATH + # search occurs. + $fullfile = '$(srcdir)/' . $fullfile + if $dir =~ m,^\.\.(?:$|/),; + + push_dist_common ($fullfile); + return 1; + } + return 0; +} + + +# If a file name appears as a key in this hash, then it has already +# been checked for. This allows us not to report the same error more +# than once. +my %required_file_not_found = (); + +# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, @FILES) +# -------------------------------------------------------------- +# Verify that the file must exist in $DIRECTORY, or install it. +# $MYSTRICT is the strictness level at which this file becomes required. +sub require_file_internal ($$$@) +{ + my ($where, $mystrict, $dir, @files) = @_; + + foreach my $file (@files) + { + my $fullfile = "$dir/$file"; + my $found_it = 0; + my $dangling_sym = 0; + + if (-l $fullfile && ! -f $fullfile) + { + $dangling_sym = 1; + } + elsif (dir_has_case_matching_file ($dir, $file)) + { + $found_it = 1; + maybe_push_required_file ($dir, $file, $fullfile); + } + + # `--force-missing' only has an effect if `--add-missing' is + # specified. + if ($found_it && (! $add_missing || ! $force_missing)) + { + next; + } + else + { + # If we've already looked for it, we're done. You might + # wonder why we don't do this before searching for the + # file. If we do that, then something like + # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into + # DIST_COMMON. + if (! $found_it) + { + next if defined $required_file_not_found{$fullfile}; + $required_file_not_found{$fullfile} = 1; + } + + if ($strictness >= $mystrict) + { + if ($dangling_sym && $add_missing) + { + unlink ($fullfile); + } + + my $trailer = ''; + my $suppress = 0; + + # Only install missing files according to our desired + # strictness level. + my $message = "required file `$fullfile' not found"; + if ($add_missing) + { + if (-f ("$libdir/$file")) + { + $suppress = 1; + + # Install the missing file. Symlink if we + # can, copy if we must. Note: delete the file + # first, in case it is a dangling symlink. + $message = "installing `$fullfile'"; + # Windows Perl will hang if we try to delete a + # file that doesn't exist. + unlink ($fullfile) if -f $fullfile; + if ($symlink_exists && ! $copy_missing) + { + if (! symlink ("$libdir/$file", $fullfile)) + { + $suppress = 0; + $trailer = "; error while making link: $!"; + } + } + elsif (system ('cp', "$libdir/$file", $fullfile)) + { + $suppress = 0; + $trailer = "\n error while copying"; + } + reset_dir_cache ($dir); + } + + if (! maybe_push_required_file (dirname ($fullfile), + $file, $fullfile)) + { + if (! $found_it && ! $automake_will_process_aux_dir) + { + # We have added the file but could not push it + # into DIST_COMMON, probably because this is + # an auxiliary file and we are not processing + # the top level Makefile. Furthermore Automake + # hasn't been asked to create the Makefile.in + # that distribute the aux dir files. + error ($where, 'Please make a full run of automake' + . " so $fullfile gets distributed."); + } + } + } + + # If --force-missing was specified, and we have + # actually found the file, then do nothing. + next + if $found_it && $force_missing; + + # If we couldn' install the file, but it is a target in + # the Makefile, don't print anything. This allows files + # like README, AUTHORS, or THANKS to be generated. + next + if !$suppress && rule $file; + + msg ($suppress ? 'note' : 'error', $where, "$message$trailer"); + } + } + } +} + +# &require_file ($WHERE, $MYSTRICT, @FILES) +# ----------------------------------------- +sub require_file ($$@) +{ + my ($where, $mystrict, @files) = @_; + require_file_internal ($where, $mystrict, $relative_dir, @files); +} + +# &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) +# ----------------------------------------------------------- +sub require_file_with_macro ($$$@) +{ + my ($cond, $macro, $mystrict, @files) = @_; + $macro = rvar ($macro) unless ref $macro; + require_file ($macro->rdef ($cond)->location, $mystrict, @files); +} + + +# &require_conf_file ($WHERE, $MYSTRICT, @FILES) +# ---------------------------------------------- +# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR. +sub require_conf_file ($$@) +{ + my ($where, $mystrict, @files) = @_; + require_file_internal ($where, $mystrict, $config_aux_dir, @files); +} + + +# &require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) +# ---------------------------------------------------------------- +sub require_conf_file_with_macro ($$$@) +{ + my ($cond, $macro, $mystrict, @files) = @_; + require_conf_file (rvar ($macro)->rdef ($cond)->location, + $mystrict, @files); +} + +################################################################ + +# &require_build_directory ($DIRECTORY) +# ------------------------------------ +# Emit rules to create $DIRECTORY if needed, and return +# the file that any target requiring this directory should be made +# dependent upon. +sub require_build_directory ($) +{ + my $directory = shift; + my $dirstamp = "$directory/\$(am__dirstamp)"; + + # Don't emit the rule twice. + if (! defined $directory_map{$directory}) + { + $directory_map{$directory} = 1; + + # Set a variable for the dirstamp basename. + define_pretty_variable ('am__dirstamp', TRUE, INTERNAL, + '$(am__leading_dot)dirstamp'); + + # Directory must be removed by `make distclean'. + $clean_files{$dirstamp} = DIST_CLEAN; + + $output_rules .= ("$dirstamp:\n" + . "\t\@\$(mkdir_p) $directory\n" + . "\t\@: > $dirstamp\n"); + } + + return $dirstamp; +} + +# &require_build_directory_maybe ($FILE) +# -------------------------------------- +# If $FILE lies in a subdirectory, emit a rule to create this +# directory and return the file that $FILE should be made +# dependent upon. Otherwise, just return the empty string. +sub require_build_directory_maybe ($) +{ + my $file = shift; + my $directory = dirname ($file); + + if ($directory ne '.') + { + return require_build_directory ($directory); + } + else + { + return ''; + } +} + +################################################################ + +# Push a list of files onto dist_common. +sub push_dist_common +{ + prog_error "push_dist_common run after handle_dist" + if $handle_dist_run; + Automake::Variable::define ('DIST_COMMON', VAR_AUTOMAKE, '+', TRUE, "@_", + '', INTERNAL, VAR_PRETTY); +} + + +################################################################ + +# generate_makefile ($MAKEFILE_AM, $MAKEFILE_IN) +# ---------------------------------------------- +# Generate a Makefile.in given the name of the corresponding Makefile and +# the name of the file output by config.status. +sub generate_makefile ($$) +{ + my ($makefile_am, $makefile_in) = @_; + + # Reset all the Makefile.am related variables. + initialize_per_input; + + # AUTOMAKE_OPTIONS can contains -W flags to disable or enable + # warnings for this file. So hold any warning issued before + # we have processed AUTOMAKE_OPTIONS. + buffer_messages ('warning'); + + # Name of input file ("Makefile.am") and output file + # ("Makefile.in"). These have no directory components. + $am_file_name = basename ($makefile_am); + $in_file_name = basename ($makefile_in); + + # $OUTPUT is encoded. If it contains a ":" then the first element + # is the real output file, and all remaining elements are input + # files. We don't scan or otherwise deal with these input files, + # other than to mark them as dependencies. See + # &scan_autoconf_files for details. + my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in}); + + $relative_dir = dirname ($makefile); + $am_relative_dir = dirname ($makefile_am); + + read_main_am_file ($makefile_am); + if (handle_options) + { + # Process buffered warnings. + flush_messages; + # Fatal error. Just return, so we can continue with next file. + return; + } + # Process buffered warnings. + flush_messages; + + # There are a few install-related variables that you should not define. + foreach my $var ('PRE_INSTALL', 'POST_INSTALL', 'NORMAL_INSTALL') + { + my $v = var $var; + if ($v) + { + my $def = $v->def (TRUE); + prog_error "$var not defined in condition TRUE" + unless $def; + reject_var $var, "`$var' should not be defined" + if $def->owner != VAR_AUTOMAKE; + } + } + + # Catch some obsolete variables. + msg_var ('obsolete', 'INCLUDES', + "`INCLUDES' is the old name for `AM_CPPFLAGS' (or `*_CPPFLAGS')") + if var ('INCLUDES'); + + # At the toplevel directory, we might need config.guess, config.sub. + # (Libtool scripts such ltconfig as ltmain.sh are checked for in + # handle_libtool.) + if ($relative_dir eq '.') + { + # AC_CANONICAL_HOST, AC_CANONICAL_SYSTEM, and AC_CANONICAL_TARGET + # need config.guess and config.sub. + require_conf_file ($canonical_location, FOREIGN, + 'config.guess', 'config.sub') + if $seen_canonical; + } + + # Must do this after reading .am file. + define_variable ('subdir', $relative_dir, INTERNAL); + + # If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that + # recursive rules are enabled. + define_pretty_variable ('SUBDIRS', TRUE, INTERNAL, '') + if var 'DIST_SUBDIRS' && ! var 'SUBDIRS'; + + # Check first, because we might modify some state. + check_cygnus; + check_gnu_standards; + check_gnits_standards; + + handle_configure ($makefile_am, $makefile_in, $makefile, @inputs); + handle_gettext; + handle_libraries; + handle_ltlibraries; + handle_programs; + handle_scripts; + + # These must be run after all the sources are scanned. They + # use variables defined by &handle_libraries, &handle_ltlibraries, + # or &handle_programs. + handle_compile; + handle_languages; + handle_libtool; + + # Variables used by distdir.am and tags.am. + define_pretty_variable ('SOURCES', TRUE, INTERNAL, @sources); + if (! option 'no-dist') + { + define_pretty_variable ('DIST_SOURCES', TRUE, INTERNAL, @dist_sources); + } + + handle_multilib; + handle_texinfo; + handle_emacs_lisp; + handle_python; + handle_java; + handle_man_pages; + handle_data; + handle_headers; + handle_subdirs; + handle_tags; + handle_minor_options; + handle_tests; + + # This must come after most other rules. + handle_dist; + + handle_footer; + do_check_merge_target; + handle_all ($makefile); + + # FIXME: Gross! + if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS')) + { + $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n"; + } + + handle_install; + handle_clean ($makefile); + handle_factored_dependencies; + + # Comes last, because all the above procedures may have + # defined or overridden variables. + $output_vars .= output_variables; + + check_typos; + + my ($out_file) = $output_directory . '/' . $makefile_in; + + if ($exit_code != 0) + { + verb "not writing $out_file because of earlier errors"; + return; + } + + if (! -d ($output_directory . '/' . $am_relative_dir)) + { + mkdir ($output_directory . '/' . $am_relative_dir, 0755); + } + + # We make sure that `all:' is the first target. + my $output = + "$output_vars$output_all$output_header$output_rules$output_trailer"; + + # Decide whether we must update the output file or not. + # We have to update in the following situations. + # * $force_generation is set. + # * any of the output dependencies is younger than the output + # * the contents of the output is different (this can happen + # if the project has been populated with a file listed in + # @common_files since the last run). + # Output's dependencies are split in two sets: + # * dependencies which are also configure dependencies + # These do not change between each Makefile.am + # * other dependencies, specific to the Makefile.am being processed + # (such as the Makefile.am itself, or any Makefile fragment + # it includes). + my $timestamp = mtime $out_file; + if (! $force_generation + && $configure_deps_greatest_timestamp < $timestamp + && $output_deps_greatest_timestamp < $timestamp + && $output eq contents ($out_file)) + { + verb "$out_file unchanged"; + # No need to update. + return; + } + + if (-e $out_file) + { + unlink ($out_file) + or fatal "cannot remove $out_file: $!\n"; + } + + my $gm_file = new Automake::XFile "> $out_file"; + verb "creating $out_file"; + print $gm_file $output; +} + +################################################################ + + + + +################################################################ + +# Print usage information. +sub usage () +{ + print "Usage: $0 [OPTION] ... [Makefile]... + +Generate Makefile.in for configure from Makefile.am. + +Operation modes: + --help print this help, then exit + --version print version number, then exit + -v, --verbose verbosely list files processed + --no-force only update Makefile.in's that are out of date + -W, --warnings=CATEGORY report the warnings falling in CATEGORY + +Dependency tracking: + -i, --ignore-deps disable dependency tracking code + --include-deps enable dependency tracking code + +Flavors: + --cygnus assume program is part of Cygnus-style tree + --foreign set strictness to foreign + --gnits set strictness to gnits + --gnu set strictness to gnu + +Library files: + -a, --add-missing add missing standard files to package + --libdir=DIR directory storing library files + -c, --copy with -a, copy missing files (default is symlink) + -f, --force-missing force update of standard files + +"; + Automake::ChannelDefs::usage; + + my ($last, @lcomm); + $last = ''; + foreach my $iter (sort ((@common_files, @common_sometimes))) + { + push (@lcomm, $iter) unless $iter eq $last; + $last = $iter; + } + + my @four; + print "\nFiles which are automatically distributed, if found:\n"; + format USAGE_FORMAT = + @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< + $four[0], $four[1], $four[2], $four[3] +. + $~ = "USAGE_FORMAT"; + + my $cols = 4; + my $rows = int(@lcomm / $cols); + my $rest = @lcomm % $cols; + + if ($rest) + { + $rows++; + } + else + { + $rest = $cols; + } + + for (my $y = 0; $y < $rows; $y++) + { + @four = ("", "", "", ""); + for (my $x = 0; $x < $cols; $x++) + { + last if $y + 1 == $rows && $x == $rest; + + my $idx = (($x > $rest) + ? ($rows * $rest + ($rows - 1) * ($x - $rest)) + : ($rows * $x)); + + $idx += $y; + $four[$x] = $lcomm[$idx]; + } + write; + } + + print "\nReport bugs to .\n"; + + # --help always returns 0 per GNU standards. + exit 0; +} + + +# &version () +# ----------- +# Print version information +sub version () +{ + print <. + +Copyright 2005 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +EOF + # --version always returns 0 per GNU standards. + exit 0; +} + +################################################################ + +# Parse command line. +sub parse_arguments () +{ + # Start off as gnu. + set_strictness ('gnu'); + + my $cli_where = new Automake::Location; + my %cli_options = + ( + 'libdir:s' => \$libdir, + 'gnu' => sub { set_strictness ('gnu'); }, + 'gnits' => sub { set_strictness ('gnits'); }, + 'cygnus' => sub { set_global_option ('cygnus', $cli_where); }, + 'foreign' => sub { set_strictness ('foreign'); }, + 'include-deps' => sub { unset_global_option ('no-dependencies'); }, + 'i|ignore-deps' => sub { set_global_option ('no-dependencies', + $cli_where); }, + 'no-force' => sub { $force_generation = 0; }, + 'f|force-missing' => \$force_missing, + 'o|output-dir:s' => \$output_directory, + 'a|add-missing' => \$add_missing, + 'c|copy' => \$copy_missing, + 'v|verbose' => sub { setup_channel 'verb', silent => 0; }, + 'W|warnings:s' => \&parse_warnings, + # These long options (--Werror and --Wno-error) for backward + # compatibility. Use -Werror and -Wno-error today. + 'Werror' => sub { parse_warnings 'W', 'error'; }, + 'Wno-error' => sub { parse_warnings 'W', 'no-error'; }, + ); + use Getopt::Long; + Getopt::Long::config ("bundling", "pass_through"); + + # See if --version or --help is used. We want to process these before + # anything else because the GNU Coding Standards require us to + # `exit 0' after processing these options, and we can't guarantee this + # if we treat other options first. (Handling other options first + # could produce error diagnostics, and in this condition it is + # confusing if Automake does `exit 0'.) + my %cli_options_1st_pass = + ( + 'version' => \&version, + 'help' => \&usage, + # Recognize all other options (and their arguments) but do nothing. + map { $_ => sub {} } (keys %cli_options) + ); + my @ARGV_backup = @ARGV; + Getopt::Long::GetOptions %cli_options_1st_pass + or exit 1; + @ARGV = @ARGV_backup; + + # Now *really* process the options. This time we know + # that --help and --version are not present. + Getopt::Long::GetOptions %cli_options + or exit 1; + + if (defined $output_directory) + { + msg 'obsolete', "`--output-dir' is deprecated\n"; + } + else + { + # In the next release we'll remove this entirely. + $output_directory = '.'; + } + + my $errspec = 0; + foreach my $arg (@ARGV) + { + if ($arg =~ /^-./) + { + fatal ("unrecognized option `$arg'\n" + . "Try `$0 --help' for more information."); + } + + # Handle $local:$input syntax. + my ($local, @rest) = split (/:/, $arg); + @rest = ("$local.in",) unless @rest; + my $input = locate_am @rest; + if ($input) + { + push @input_files, $input; + $output_files{$input} = join (':', ($local, @rest)); + } + else + { + error "no Automake input file found for `$arg'"; + $errspec = 1; + } + } + fatal "no input file found among supplied arguments" + if $errspec && ! @input_files; +} + +################################################################ + +# Parse the WARNINGS environment variable. +parse_WARNINGS; + +# Parse command line. +parse_arguments; + +$configure_ac = require_configure_ac; + +# Do configure.ac scan only once. +scan_autoconf_files; + +if (! @input_files) + { + my $msg = ''; + $msg = "\nDid you forget AC_CONFIG_FILES([Makefile]) in $configure_ac?" + if -f 'Makefile.am'; + fatal ("no `Makefile.am' found for any configure output$msg"); + } + +# Now do all the work on each file. +foreach my $file (@input_files) + { + ($am_file = $file) =~ s/\.in$//; + if (! -f ($am_file . '.am')) + { + error "`$am_file.am' does not exist"; + } + else + { + # Any warning setting now local to this Makefile.am. + dup_channel_setup; + + generate_makefile ($am_file . '.am', $file); + + # Back out any warning setting. + drop_channel_setup; + } + } + +exit $exit_code; + + +### Setup "GNU" style for perl-mode and cperl-mode. +## Local Variables: +## perl-indent-level: 2 +## perl-continued-statement-offset: 2 +## perl-continued-brace-offset: 0 +## perl-brace-offset: 0 +## perl-brace-imaginary-offset: 0 +## perl-label-offset: -2 +## cperl-indent-level: 2 +## cperl-brace-offset: 0 +## cperl-continued-brace-offset: 0 +## cperl-label-offset: -2 +## cperl-extra-newline-before-brace: t +## cperl-merge-trailing-else: nil +## cperl-continued-statement-offset: 2 +## End: diff --git a/common.c b/common.c new file mode 100644 index 0000000..8143377 --- /dev/null +++ b/common.c @@ -0,0 +1,106 @@ +/* + * @(#) $Header: /home/nalle/cvsroot/mysql-admutils/common.c,v 1.3 1998/07/06 12:33:07 ljosa Exp $ + * + * functions used by mysql-dbadm.c and mysql-useradm.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" + +char *program_name; + +static char *rcsheader = "@(#) " PACKAGE " " VERSION " ljosa@initio.no $Header: /home/nalle/cvsroot/mysql-admutils/common.c,v 1.3 1998/07/06 12:33:07 ljosa Exp $"; + + +int +version() +{ + printf("%s %s\n", program_name, rcsheader); + exit(0); +} + + +int +wrong_use(char *format, ...) +{ + va_list ap; + + if (format) + { + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + putchar('\n'); + } + + fprintf(stderr, "Try `%s --help' for more information.\n", program_name); + + return 1; +} + + +int +dberror(MYSQL *pmysql, char *format, ...) +{ + char *errmsg; + va_list ap; + char *p; + char token[1024] = "%"; + + fprintf(stderr, "%s: ", program_name); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fprintf(stderr, "\n"); + + if (pmysql) + { + errmsg = mysql_error(pmysql); + if ((errmsg) && (strcmp(errmsg, "") != 0)) + fprintf(stderr, "mysql: %s\n", errmsg); + + mysql_close(pmysql); + } + + return 1; +} + + +/* decides if the UNIX user is entitled to the MySQL database or MySQL user. */ +int +owner(char *name) +{ + struct passwd *p; + + p = getpwuid(getuid()); + if (!p) + { + dberror(NULL, "Failed to look up your UNIX username."); + exit(1); + } + + if (strcmp(name, p->pw_name) == 0) + return 1; /* OK */ + + if ((strncmp(name, p->pw_name, strlen(p->pw_name)) == 0) && + (*(name + strlen(p->pw_name)) == '_')) + return 1; /* OK */ + + return 0; /* not owner if we get as far as this */ +} + + +int +reload(MYSQL *pmysql) +{ + return mysql_reload(pmysql); +} + diff --git a/config.h b/config.h new file mode 100644 index 0000000..7c1b127 --- /dev/null +++ b/config.h @@ -0,0 +1,97 @@ +/* config.h. Generated by configure. */ +/* config.h.in. Generated from configure.in by autoheader. */ +/* + * acconfig.h + * + * @(#) $Header: /home/nalle/cvsroot/mysql-admutils/acconfig.h,v 1.1 1998/07/06 12:33:07 ljosa Exp $ + * + */ + + +/* Define the name of the package */ +#define PACKAGE "mysql-admutils" + +/* Define the version of the package */ +#define VERSION "0.1" + +/* Define if MySQL is installed */ +#define HAVE_MYSQL 1 + +/* Define if you have the header file. */ +/* #undef HAVE_MATH_H */ + +/* Define if libmath is available */ +#define HAVE_LIBM 1 + +/* Define if libnsl is available */ +/* #undef HAVE_LIBNSL */ + +/* Define if libsocket is available */ +/* #undef HAVE_LIBSOCKET */ + + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRMSG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Name of package */ +#define PACKAGE "mysql-admutils" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Version number of package */ +#define VERSION "0.1" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..0f3baab --- /dev/null +++ b/config.h.in @@ -0,0 +1,96 @@ +/* config.h.in. Generated from configure.in by autoheader. */ +/* + * acconfig.h + * + * @(#) $Header: /home/nalle/cvsroot/mysql-admutils/acconfig.h,v 1.1 1998/07/06 12:33:07 ljosa Exp $ + * + */ + + +/* Define the name of the package */ +#undef PACKAGE + +/* Define the version of the package */ +#undef VERSION + +/* Define if MySQL is installed */ +#undef HAVE_MYSQL + +/* Define if you have the header file. */ +#undef HAVE_MATH_H + +/* Define if libmath is available */ +#undef HAVE_LIBM + +/* Define if libnsl is available */ +#undef HAVE_LIBNSL + +/* Define if libsocket is available */ +#undef HAVE_LIBSOCKET + + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#undef HAVE_DOPRNT + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRMSG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `unsigned' if does not define. */ +#undef size_t diff --git a/config.log b/config.log new file mode 100644 index 0000000..1dfc429 --- /dev/null +++ b/config.log @@ -0,0 +1,520 @@ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by configure, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ ./configure + +## --------- ## +## Platform. ## +## --------- ## + +hostname = eirik-laptop +uname -m = i686 +uname -r = 2.6.17-10-generic +uname -s = Linux +uname -v = #2 SMP Tue Dec 5 22:28:26 UTC 2006 + +/usr/bin/uname -p = unknown +/bin/uname -X = unknown + +/bin/arch = i686 +/usr/bin/arch -k = unknown +/usr/convex/getsysinfo = unknown +hostinfo = unknown +/bin/machine = unknown +/usr/bin/oslevel = unknown +/bin/universe = unknown + +PATH: /sbin +PATH: /bin +PATH: /usr/sbin +PATH: /usr/bin +PATH: /usr/games +PATH: /usr/local/sbin +PATH: /usr/local/bin +PATH: /usr/X11R6/bin +PATH: /home/eirik/bin + + +## ----------- ## +## Core tests. ## +## ----------- ## + +configure:1345: checking for a BSD-compatible install +configure:1400: result: /usr/bin/install -c +configure:1411: checking whether build environment is sane +configure:1454: result: yes +configure:1478: WARNING: `missing' script is too old or missing +configure:1519: checking for gawk +configure:1548: result: no +configure:1519: checking for mawk +configure:1535: found /usr/bin/mawk +configure:1545: result: mawk +configure:1555: checking whether make sets $(MAKE) +configure:1575: result: yes +configure:1743: checking whether build environment is sane +configure:1786: result: yes +configure:1835: checking for gcc +configure:1851: found /usr/bin/gcc +configure:1861: result: gcc +configure:2105: checking for C compiler version +configure:2108: gcc --version &5 +gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) +Copyright (C) 2006 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +configure:2111: $? = 0 +configure:2113: gcc -v &5 +Using built-in specs. +Target: i486-linux-gnu +Configured with: ../src/configure -v --enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-mpfr --enable-checking=release i486-linux-gnu +Thread model: posix +gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) +configure:2116: $? = 0 +configure:2118: gcc -V &5 +gcc: '-V' option must have argument +configure:2121: $? = 1 +configure:2144: checking for C compiler default output file name +configure:2147: gcc conftest.c >&5 +configure:2150: $? = 0 +configure:2196: result: a.out +configure:2201: checking whether the C compiler works +configure:2207: ./a.out +configure:2210: $? = 0 +configure:2227: result: yes +configure:2234: checking whether we are cross compiling +configure:2236: result: no +configure:2239: checking for suffix of executables +configure:2241: gcc -o conftest conftest.c >&5 +configure:2244: $? = 0 +configure:2269: result: +configure:2275: checking for suffix of object files +configure:2296: gcc -c conftest.c >&5 +configure:2299: $? = 0 +configure:2321: result: o +configure:2325: checking whether we are using the GNU C compiler +configure:2349: gcc -c conftest.c >&5 +configure:2355: $? = 0 +configure:2359: test -z + || test ! -s conftest.err +configure:2362: $? = 0 +configure:2365: test -s conftest.o +configure:2368: $? = 0 +configure:2381: result: yes +configure:2387: checking whether gcc accepts -g +configure:2408: gcc -c -g conftest.c >&5 +configure:2414: $? = 0 +configure:2418: test -z + || test ! -s conftest.err +configure:2421: $? = 0 +configure:2424: test -s conftest.o +configure:2427: $? = 0 +configure:2438: result: yes +configure:2455: checking for gcc option to accept ANSI C +configure:2525: gcc -c -g -O2 conftest.c >&5 +configure:2531: $? = 0 +configure:2535: test -z + || test ! -s conftest.err +configure:2538: $? = 0 +configure:2541: test -s conftest.o +configure:2544: $? = 0 +configure:2562: result: none needed +configure:2580: gcc -c -g -O2 conftest.c >&5 +conftest.c:2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'me' +configure:2586: $? = 1 +configure: failed program was: +| #ifndef __cplusplus +| choke me +| #endif +configure:2730: checking for style of include used by make +configure:2758: result: GNU +configure:2786: checking dependency style of gcc +configure:2876: result: gcc3 +configure:2898: checking how to run the C preprocessor +configure:2933: gcc -E conftest.c +configure:2939: $? = 0 +configure:2971: gcc -E conftest.c +conftest.c:11:28: error: ac_nonexistent.h: No such file or directory +configure:2977: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define PACKAGE "mysql-admutils" +| #define VERSION "0.1" +| /* end confdefs.h. */ +| #include +configure:3016: result: gcc -E +configure:3040: gcc -E conftest.c +configure:3046: $? = 0 +configure:3078: gcc -E conftest.c +conftest.c:11:28: error: ac_nonexistent.h: No such file or directory +configure:3084: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define PACKAGE "mysql-admutils" +| #define VERSION "0.1" +| /* end confdefs.h. */ +| #include +configure:3129: checking for floor in -lc +configure:3159: gcc -o conftest -g -O2 conftest.c -lc >&5 +conftest.c:18: warning: conflicting types for built-in function 'floor' +/tmp/cc03JAry.o: In function `main': +/home/eirik/Projects/PVV/tmp/mysql-admtools/trunk/conftest.c:22: undefined reference to `floor' +collect2: ld returned 1 exit status +configure:3165: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define PACKAGE "mysql-admutils" +| #define VERSION "0.1" +| /* end confdefs.h. */ +| +| /* Override any gcc2 internal prototype to avoid an error. */ +| #ifdef __cplusplus +| extern "C" +| #endif +| /* We use char because int might match the return type of a gcc2 +| builtin and then its argument prototype would still apply. */ +| char floor (); +| int +| main () +| { +| floor (); +| ; +| return 0; +| } +configure:3191: result: no +configure:3197: checking for floor in -lm +configure:3227: gcc -o conftest -g -O2 conftest.c -lm >&5 +conftest.c:18: warning: conflicting types for built-in function 'floor' +configure:3233: $? = 0 +configure:3237: test -z + || test ! -s conftest.err +configure:3240: $? = 0 +configure:3243: test -s conftest +configure:3246: $? = 0 +configure:3259: result: yes +configure:3272: checking for mysql_connect in -lmysqlclient +configure:3302: gcc -o conftest -g -O2 conftest.c -lmysqlclient -lm >&5 +/usr/bin/ld: cannot find -lmysqlclient +collect2: ld returned 1 exit status +configure:3308: $? = 1 +configure: failed program was: +| /* confdefs.h. */ +| +| #define PACKAGE_NAME "" +| #define PACKAGE_TARNAME "" +| #define PACKAGE_VERSION "" +| #define PACKAGE_STRING "" +| #define PACKAGE_BUGREPORT "" +| #define PACKAGE "mysql-admutils" +| #define VERSION "0.1" +| #define HAVE_LIBM 1 +| /* end confdefs.h. */ +| +| /* Override any gcc2 internal prototype to avoid an error. */ +| #ifdef __cplusplus +| extern "C" +| #endif +| /* We use char because int might match the return type of a gcc2 +| builtin and then its argument prototype would still apply. */ +| char mysql_connect (); +| int +| main () +| { +| mysql_connect (); +| ; +| return 0; +| } +configure:3334: result: no +configure:3341: checking for gethostbyaddr in -lc +configure:3371: gcc -o conftest -g -O2 conftest.c -lc -lm >&5 +configure:3377: $? = 0 +configure:3381: test -z + || test ! -s conftest.err +configure:3384: $? = 0 +configure:3387: test -s conftest +configure:3390: $? = 0 +configure:3403: result: yes +configure:3484: checking for socket in -lc +configure:3514: gcc -o conftest -g -O2 conftest.c -lc -lm >&5 +configure:3520: $? = 0 +configure:3524: test -z + || test ! -s conftest.err +configure:3527: $? = 0 +configure:3530: test -s conftest +configure:3533: $? = 0 +configure:3546: result: yes +configure:3628: checking for MySQL support +configure:3631: checking for egrep +configure:3641: result: grep -E +configure:3646: checking for ANSI C header files +configure:3671: gcc -c -g -O2 conftest.c >&5 +configure:3677: $? = 0 +configure:3681: test -z + || test ! -s conftest.err +configure:3684: $? = 0 +configure:3687: test -s conftest.o +configure:3690: $? = 0 +configure:3779: gcc -o conftest -g -O2 conftest.c -lm >&5 +conftest.c: In function 'main': +conftest.c:29: warning: incompatible implicit declaration of built-in function 'exit' +configure:3782: $? = 0 +configure:3784: ./conftest +configure:3787: $? = 0 +configure:3802: result: yes +configure:3826: checking for sys/types.h +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3848: $? = 0 +configure:3852: test -z + || test ! -s conftest.err +configure:3855: $? = 0 +configure:3858: test -s conftest.o +configure:3861: $? = 0 +configure:3872: result: yes +configure:3826: checking for sys/stat.h +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3848: $? = 0 +configure:3852: test -z + || test ! -s conftest.err +configure:3855: $? = 0 +configure:3858: test -s conftest.o +configure:3861: $? = 0 +configure:3872: result: yes +configure:3826: checking for stdlib.h +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3848: $? = 0 +configure:3852: test -z + || test ! -s conftest.err +configure:3855: $? = 0 +configure:3858: test -s conftest.o +configure:3861: $? = 0 +configure:3872: result: yes +configure:3826: checking for string.h +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3848: $? = 0 +configure:3852: test -z + || test ! -s conftest.err +configure:3855: $? = 0 +configure:3858: test -s conftest.o +configure:3861: $? = 0 +configure:3872: result: yes +configure:3826: checking for memory.h +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3848: $? = 0 +configure:3852: test -z + || test ! -s conftest.err +configure:3855: $? = 0 +configure:3858: test -s conftest.o +configure:3861: $? = 0 +configure:3872: result: yes +configure:3826: checking for strings.h +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3848: $? = 0 +configure:3852: test -z + || test ! -s conftest.err +configure:3855: $? = 0 +configure:3858: test -s conftest.o +configure:3861: $? = 0 +configure:3872: result: yes +configure:3826: checking for inttypes.h +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3848: $? = 0 +configure:3852: test -z + || test ! -s conftest.err +configure:3855: $? = 0 +configure:3858: test -s conftest.o +configure:3861: $? = 0 +configure:3872: result: yes +configure:3826: checking for stdint.h +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3848: $? = 0 +configure:3852: test -z + || test ! -s conftest.err +configure:3855: $? = 0 +configure:3858: test -s conftest.o +configure:3861: $? = 0 +configure:3872: result: yes +configure:3826: checking for unistd.h +configure:3842: gcc -c -g -O2 conftest.c >&5 +configure:3848: $? = 0 +configure:3852: test -z + || test ! -s conftest.err +configure:3855: $? = 0 +configure:3858: test -s conftest.o +configure:3861: $? = 0 +configure:3872: result: yes +configure:4079: result: no +configure:4081: result: "Giving up - You need to install MySQL somewhere" + +## ---------------- ## +## Cache variables. ## +## ---------------- ## + +ac_cv_c_compiler_gnu=yes +ac_cv_env_CC_set= +ac_cv_env_CC_value= +ac_cv_env_CFLAGS_set= +ac_cv_env_CFLAGS_value= +ac_cv_env_CPPFLAGS_set= +ac_cv_env_CPPFLAGS_value= +ac_cv_env_CPP_set= +ac_cv_env_CPP_value= +ac_cv_env_LDFLAGS_set= +ac_cv_env_LDFLAGS_value= +ac_cv_env_build_alias_set= +ac_cv_env_build_alias_value= +ac_cv_env_host_alias_set= +ac_cv_env_host_alias_value= +ac_cv_env_target_alias_set= +ac_cv_env_target_alias_value= +ac_cv_exeext= +ac_cv_header_inttypes_h=yes +ac_cv_header_memory_h=yes +ac_cv_header_stdc=yes +ac_cv_header_stdint_h=yes +ac_cv_header_stdlib_h=yes +ac_cv_header_string_h=yes +ac_cv_header_strings_h=yes +ac_cv_header_sys_stat_h=yes +ac_cv_header_sys_types_h=yes +ac_cv_header_unistd_h=yes +ac_cv_lib_c_floor=no +ac_cv_lib_c_gethostbyaddr=yes +ac_cv_lib_c_socket=yes +ac_cv_lib_m_floor=yes +ac_cv_lib_mysqlclient_mysql_connect=no +ac_cv_objext=o +ac_cv_path_install='/usr/bin/install -c' +ac_cv_prog_AWK=mawk +ac_cv_prog_CPP='gcc -E' +ac_cv_prog_ac_ct_CC=gcc +ac_cv_prog_cc_g=yes +ac_cv_prog_cc_stdc= +ac_cv_prog_egrep='grep -E' +ac_cv_prog_make_make_set=yes +am_cv_CC_dependencies_compiler_type=gcc3 + +## ----------------- ## +## Output variables. ## +## ----------------- ## + +ACLOCAL='aclocal-1.9' +AMDEPBACKSLASH='\' +AMDEP_FALSE='#' +AMDEP_TRUE='' +AMTAR='tar' +AUTOCONF='autoconf' +AUTOHEADER='autoheader' +AUTOMAKE='automake-1.9' +AWK='mawk' +CC='gcc' +CCDEPMODE='depmode=gcc3' +CFLAGS='-g -O2' +CPP='gcc -E' +CPPFLAGS='' +CYGPATH_W='echo' +DEFS='' +DEPDIR='.deps' +ECHO_C='' +ECHO_N='-n' +ECHO_T='' +EGREP='grep -E' +EXEEXT='' +INSTALL_DATA='${INSTALL} -m 644' +INSTALL_PROGRAM='${INSTALL}' +INSTALL_SCRIPT='${INSTALL}' +INSTALL_STRIP_PROGRAM='${SHELL} $(install_sh) -c -s' +LDFLAGS='' +LIBOBJS='' +LIBS=' -lm' +LTLIBOBJS='' +MAKEINFO='makeinfo' +MYSQL_INCLUDE='' +MYSQL_LFLAGS='' +MYSQL_LIBS='' +OBJEXT='o' +PACKAGE='mysql-admutils' +PACKAGE_BUGREPORT='' +PACKAGE_NAME='' +PACKAGE_STRING='' +PACKAGE_TARNAME='' +PACKAGE_VERSION='' +PATH_SEPARATOR=':' +SET_MAKE='' +SHELL='/bin/bash' +STRIP='' +VERSION='0.1' +ac_ct_CC='gcc' +ac_ct_STRIP='' +am__fastdepCC_FALSE='#' +am__fastdepCC_TRUE='' +am__include='include' +am__leading_dot='.' +am__quote='' +am__tar='${AMTAR} chof - "$$tardir"' +am__untar='${AMTAR} xf -' +bindir='${exec_prefix}/bin' +build_alias='' +datadir='${prefix}/share' +exec_prefix='NONE' +host_alias='' +includedir='${prefix}/include' +infodir='${prefix}/info' +install_sh='/home/eirik/Projects/PVV/tmp/mysql-admtools/trunk/install-sh' +libdir='${exec_prefix}/lib' +libexecdir='${exec_prefix}/libexec' +localstatedir='${prefix}/var' +mandir='${prefix}/man' +mkdir_p='mkdir -p --' +oldincludedir='/usr/include' +prefix='NONE' +program_transform_name='s,x,x,' +sbindir='${exec_prefix}/sbin' +sharedstatedir='${prefix}/com' +sysconfdir='${prefix}/etc' +target_alias='' + +## ----------- ## +## confdefs.h. ## +## ----------- ## + +#define HAVE_INTTYPES_H 1 +#define HAVE_LIBM 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UNISTD_H 1 +#define PACKAGE "mysql-admutils" +#define PACKAGE_BUGREPORT "" +#define PACKAGE_NAME "" +#define PACKAGE_STRING "" +#define PACKAGE_TARNAME "" +#define PACKAGE_VERSION "" +#define STDC_HEADERS 1 +#define VERSION "0.1" + +configure: exit 0 diff --git a/configure b/configure new file mode 100755 index 0000000..acdc925 --- /dev/null +++ b/configure @@ -0,0 +1,6183 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59. +# +# Copyright (C) 2003 Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_unique_file="mysql-dbadm.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CPP EGREP MYSQL_LIBS MYSQL_LFLAGS MYSQL_INCLUDE LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +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' + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -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 | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$0" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures this package to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +_ACEOF + + cat <<_ACEOF +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +_ACEOF +fi + +if test -n "$ac_init_help"; then + + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-mysql=DIR Include MySQL support. DIR is the MySQL base + install directory, defaults to /usr/local. + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_srcdir/configure.gnu; then + echo + $SHELL $ac_srcdir/configure.gnu --help=recursive + elif test -f $ac_srcdir/configure; then + echo + $SHELL $ac_srcdir/configure --help=recursive + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF + +Copyright (C) 2003 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + echo "PATH: $as_dir" +done + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_sep= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + esac + done +done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + cat <<\_ASBOX +## ---------------- ## +## Cache variables. ## +## ---------------- ## +_ASBOX + echo + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) + ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + + + + + + + + + + + + + + + + + + ac_config_headers="$ac_config_headers config.h" + +am__api_version="1.9" +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 + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /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 + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE=mysql-admutils + VERSION=0.1 + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + + +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_compiler_gnu=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=no +ac_save_CC=$CC +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std1 is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std1. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +echo "$as_me:$LINENO: checking for floor in -lc" >&5 +echo $ECHO_N "checking for floor in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_floor+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char floor (); +int +main () +{ +floor (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_floor=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_floor=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_floor" >&5 +echo "${ECHO_T}$ac_cv_lib_c_floor" >&6 +if test $ac_cv_lib_c_floor = yes; then + : +else + + echo "$as_me:$LINENO: checking for floor in -lm" >&5 +echo $ECHO_N "checking for floor in -lm... $ECHO_C" >&6 +if test "${ac_cv_lib_m_floor+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char floor (); +int +main () +{ +floor (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_m_floor=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_m_floor=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_m_floor" >&5 +echo "${ECHO_T}$ac_cv_lib_m_floor" >&6 +if test $ac_cv_lib_m_floor = yes; then + + LIBS="$LIBS -lm" + cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBM 1 +_ACEOF + +fi + +fi + +echo "$as_me:$LINENO: checking for mysql_connect in -lmysqlclient" >&5 +echo $ECHO_N "checking for mysql_connect in -lmysqlclient... $ECHO_C" >&6 +if test "${ac_cv_lib_mysqlclient_mysql_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmysqlclient $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char mysql_connect (); +int +main () +{ +mysql_connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mysqlclient_mysql_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_mysqlclient_mysql_connect=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_mysqlclient_mysql_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_mysqlclient_mysql_connect" >&6 +if test $ac_cv_lib_mysqlclient_mysql_connect = yes; then + + LIBS="$LIBS -lmysqlclient" +fi + +echo "$as_me:$LINENO: checking for gethostbyaddr in -lc" >&5 +echo $ECHO_N "checking for gethostbyaddr in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_gethostbyaddr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyaddr (); +int +main () +{ +gethostbyaddr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_gethostbyaddr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_gethostbyaddr=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_gethostbyaddr" >&5 +echo "${ECHO_T}$ac_cv_lib_c_gethostbyaddr" >&6 +if test $ac_cv_lib_c_gethostbyaddr = yes; then + : +else + + echo "$as_me:$LINENO: checking for gethostbyaddr in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyaddr in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyaddr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyaddr (); +int +main () +{ +gethostbyaddr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyaddr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_nsl_gethostbyaddr=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyaddr" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyaddr" >&6 +if test $ac_cv_lib_nsl_gethostbyaddr = yes; then + + LIBS="$LIBS -lnsl" + cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBNSL 1 +_ACEOF + +fi + +fi + +echo "$as_me:$LINENO: checking for socket in -lc" >&5 +echo $ECHO_N "checking for socket in -lc... $ECHO_C" >&6 +if test "${ac_cv_lib_c_socket+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket (); +int +main () +{ +socket (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_socket=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_socket=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_c_socket" >&6 +if test $ac_cv_lib_c_socket = yes; then + : +else + + echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 +echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_socket+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket (); +int +main () +{ +socket (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_socket=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_socket=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 +if test $ac_cv_lib_socket_socket = yes; then + + LIBS="$LIBS -lsocket" + cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBSOCKET 1 +_ACEOF + +fi + +fi + + +echo "$as_me:$LINENO: checking for MySQL support" >&5 +echo $ECHO_N "checking for MySQL support... $ECHO_C" >&6 + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +# Check whether --with-mysql or --without-mysql was given. +if test "${with_mysql+set}" = set; then + withval="$with_mysql" + + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + MYSQL_INCDIR=/usr/local/include/mysql + MYSQL_LIBDIR=/usr/local/lib/mysql + else + if test -f $withval/include/mysql/mysql.h; then + MYSQL_INCDIR=$withval/include/mysql + MYSQL_LIBDIR=$withval/lib/mysql + elif test -f $withval/include/mysql.h; then + MYSQL_INCDIR=$withval/include + MYSQL_LIBDIR=$withval/lib + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + { { echo "$as_me:$LINENO: error: Invalid MySQL directory - unable to find mysql.h under $withval" >&5 +echo "$as_me: error: Invalid MySQL directory - unable to find mysql.h under $withval" >&2;} + { (exit 1); exit 1; }; } + fi + fi + MYSQL_INCLUDE=-I$MYSQL_INCDIR + MYSQL_LFLAGS=-L$MYSQL_LIBDIR + MYSQL_LIBS=-lmysqlclient + + cat >>confdefs.h <<\_ACEOF +#define HAVE_MYSQL 1 +_ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + + old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" + +for ac_header in errmsg.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + CPPFLAGS="$old_CPPFLAGS" + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + +else + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + echo "$as_me:$LINENO: result: \"Giving up - You need to install MySQL somewhere\"" >&5 +echo "${ECHO_T}\"Giving up - You need to install MySQL somewhere\"" >&6; exit + +fi; + + + + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + + +for ac_header in unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +if test "${ac_cv_c_const+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* 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; + } +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_const=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_const=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6 +if test $ac_cv_c_const = no; then + +cat >>confdefs.h <<\_ACEOF +#define const +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +if ((size_t *) 0) + return 0; +if (sizeof (size_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_size_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6 +if test $ac_cv_type_size_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned +_ACEOF + +fi + + + +for ac_func in vprintf +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +echo "$as_me:$LINENO: checking for _doprnt" >&5 +echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6 +if test "${ac_cv_func__doprnt+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define _doprnt to an innocuous variant, in case declares _doprnt. + For example, HP-UX 11i declares gettimeofday. */ +#define _doprnt innocuous__doprnt + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char _doprnt (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef _doprnt + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _doprnt (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub__doprnt) || defined (__stub____doprnt) +choke me +#else +char (*f) () = _doprnt; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != _doprnt; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func__doprnt=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func__doprnt=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5 +echo "${ECHO_T}$ac_cv_func__doprnt" >&6 +if test $ac_cv_func__doprnt = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_DOPRNT 1 +_ACEOF + +fi + +fi +done + + + + ac_config_files="$ac_config_files Makefile" + ac_config_commands="$ac_config_commands default" +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if diff $cache_file confcache >/dev/null 2>&1; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false +SHELL=\${CONFIG_SHELL-$SHELL} +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)$' \| \ + . : '\(.\)' 2>/dev/null || +echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } + /^X\/\(\/\/\)$/{ s//\1/; q; } + /^X\/\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh +fi + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + case $0 in + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done + + ;; + esac + # We did not find ourselves, most probably we were run as `sh COMMAND' + # in which case we are not to be found in the path. + if test "x$as_myself" = x; then + as_myself=$0 + fi + if test ! -f "$as_myself"; then + { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, and appends trailing '-' during + # substitution so that $LINENO is not a special case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by $as_me, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\_ACEOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +config.status +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_shift=: + ;; + -*) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + + *) ac_config_targets="$ac_config_targets $1" ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; + esac +done + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit 1); exit 1; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# CONFIG_FILES section. +# + +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "\$CONFIG_FILES"; then + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t +s,@MYSQL_LIBS@,$MYSQL_LIBS,;t t +s,@MYSQL_LFLAGS@,$MYSQL_LFLAGS,;t t +s,@MYSQL_INCLUDE@,$MYSQL_INCLUDE,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@abs_srcdir@,$ac_abs_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t +s,@builddir@,$ac_builddir,;t t +s,@abs_builddir@,$ac_abs_builddir,;t t +s,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X$ac_file | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + default ) date > stamp-h ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (exit 0); exit 0; } +_ACEOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..224908b --- /dev/null +++ b/configure.in @@ -0,0 +1,83 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(mysql-dbadm.c) +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(mysql-admutils, 0.1) +AM_SANITY_CHECK + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CPP + +dnl Checks for libraries. +AC_CHECK_LIB(c, floor, [:], [ + AC_CHECK_LIB(m, floor, [ + LIBS="$LIBS -lm" + AC_DEFINE(HAVE_LIBM) ], []) ]) +AC_CHECK_LIB(mysqlclient, mysql_connect, [ + LIBS="$LIBS -lmysqlclient" ], []) +AC_CHECK_LIB(c, gethostbyaddr, [:], [ + AC_CHECK_LIB(nsl, gethostbyaddr, [ + LIBS="$LIBS -lnsl" + AC_DEFINE(HAVE_LIBNSL) ], []) ]) +AC_CHECK_LIB(c, socket, [:], [ + AC_CHECK_LIB(socket, socket, [ + LIBS="$LIBS -lsocket" + AC_DEFINE(HAVE_LIBSOCKET) ], []) ]) + +AC_MSG_CHECKING(for MySQL support) +AC_ARG_WITH(mysql, +[ --with-mysql[=DIR] Include MySQL support. DIR is the MySQL base + install directory, defaults to /usr/local.], +[ + if test "$withval" != "no"; then + if test "$withval" = "yes"; then + MYSQL_INCDIR=/usr/local/include/mysql + MYSQL_LIBDIR=/usr/local/lib/mysql + else + if test -f $withval/include/mysql/mysql.h; then + MYSQL_INCDIR=$withval/include/mysql + MYSQL_LIBDIR=$withval/lib/mysql + elif test -f $withval/include/mysql.h; then + MYSQL_INCDIR=$withval/include + MYSQL_LIBDIR=$withval/lib + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid MySQL directory - unable to find mysql.h under $withval) + fi + fi + MYSQL_INCLUDE=-I$MYSQL_INCDIR + MYSQL_LFLAGS=-L$MYSQL_LIBDIR + MYSQL_LIBS=-lmysqlclient + + AC_DEFINE(HAVE_MYSQL) + AC_MSG_RESULT(yes) + + dnl check for errmsg.h, which isn't installed by some versions of 3.21 + old_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $MYSQL_INCLUDE" + AC_CHECK_HEADERS(errmsg.h) + CPPFLAGS="$old_CPPFLAGS" + else + AC_MSG_RESULT(no) + fi +],[ + AC_MSG_RESULT(no) + AC_MSG_RESULT("Giving up - You need to install MySQL somewhere"); exit +]) +AC_SUBST(MYSQL_LIBS) +AC_SUBST(MYSQL_LFLAGS) +AC_SUBST(MYSQL_INCLUDE) + + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_TYPE_SIZE_T + +dnl Checks for library functions. +AC_FUNC_VPRINTF + +AC_OUTPUT(Makefile, [date > stamp-h]) diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..ffcd540 --- /dev/null +++ b/depcomp @@ -0,0 +1,529 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2005-02-09.22 + +# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + stat=$? + + if test -f "$tmpdepfile"; then : + else + stripped=`echo "$stripped" | sed 's,^.*/,,'` + tmpdepfile="$stripped.u" + fi + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + outname="$stripped.o" + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mecanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..e843669 --- /dev/null +++ b/install-sh @@ -0,0 +1,250 @@ +#!/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=: + 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/missing b/missing new file mode 100755 index 0000000..a6abd06 --- /dev/null +++ b/missing @@ -0,0 +1,134 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison touch file \`y.tab.c' + makeinfo touch the output file + yacc touch file \`y.tab.c'" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + touch config.h.in + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print \ + | sed 's/^\(.*\).am$/touch \1.in/' \ + | sh + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + touch y.tab.c + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..2de5e97 --- /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.1.1.1 1998/07/06 10:15:30 ljosa 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" 1>&2 + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/mysql-admutils.h b/mysql-admutils.h new file mode 100644 index 0000000..d52ee81 --- /dev/null +++ b/mysql-admutils.h @@ -0,0 +1,28 @@ +/* + * @(#) $Header: /home/nalle/cvsroot/mysql-admutils/mysql-admutils.h,v 1.2 1998/07/06 11:54:56 ljosa Exp $ + * + */ + +#ifndef MYSQL_ADMUTILS_H +#define MYSQL_ADMUTILS_H + +#define DB_SERVER "verden.pvv.ntnu.no" +#define DB_USER "root" +#define DB_PASSWD "somepass" +#define DB_NAME "mysql" + +extern char *program_name; + +extern int +wrong_use(char *format, ...); + +extern int +dberror(MYSQL *pmysql, char *format, ...); + +extern int +owner(char *name); + +extern int +reload(MYSQL *pmysql); + +#endif /* MYSQL_ADMUTILS_H */ diff --git a/mysql-dbadm.c b/mysql-dbadm.c new file mode 100644 index 0000000..2354d4a --- /dev/null +++ b/mysql-dbadm.c @@ -0,0 +1,427 @@ +/* + * @(#) $Header: /home/nalle/cvsroot/mysql-admutils/mysql-dbadm.c,v 1.3 1998/07/06 12:33:07 ljosa Exp $ + * + * mysql-dbadm.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" + +char * +strchr_whitespace(const char *s) +{ + char *sp, *tab; + sp = strchr(s, ' '); + tab = strchr(s, '\t'); + if (sp == NULL) + return tab; + if (tab == NULL) + return sp; + return sp < tab ? sp : tab; /* if both are found, return the first one */ +} + +char * +strtok_whitespace(char *s) +{ + static char *cp; + char *r; + + r = s ? s : cp; + if (r == NULL) + return NULL; + cp = strchr_whitespace(r); + if (cp == NULL) + return r; + while ((*cp == ' ') || (*cp == '\t')) + { + *cp++ = '\0'; + } + return r; +} + + +int +valid_priv(const char *s) +{ + #define ACCEPT(x) if (strcmp(s, x) == 0) return 1 + ACCEPT("Y"); + ACCEPT("N"); + ACCEPT("y"); + ACCEPT("n"); + #undef ACCEPT + return 0; /* not a valid priv */ +} + + +int +usage() +{ + printf("Usage: %s COMMAND [DATABASE]...\n", program_name); + printf("Create, drop og edit permission for the DATABASE(s),\n"); + printf("as determined by the COMMAND. Valid COMMANDs:\n"); + printf("\n"); + printf(" create create the DATABASE(s).\n"); + printf(" drop delete the DATABASE(s).\n"); + printf(" show give information about the DATABASE(s), or, if\n"); + printf(" none are given, all the ones you own.\n"); + printf(" editperm change permissions for the DATABASE(s). Your\n"); + printf(" favorite editor will be started, allowing you\n"); + printf(" to make changes to the permission table.\n"); + printf("\n"); + printf("Report bugs to ljosa@initio.no\n"); + return 0; +} + + +int +create(MYSQL *pmysql, char *db) +{ + char query[1024]; + sprintf(query, "create database `%s`", db); + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Cannot create database '%s'.", db); + + fprintf(stderr, "Database '%s' created.\n", db); + return 0; +} + + +int +drop(MYSQL *pmysql, char *db) +{ + char query[1024]; + + sprintf(query, "delete from db where db = '%s'", db); + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to delete permissions for database '%s'.", db); + + sprintf(query, "drop database `%s`", db); + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Cannot drop database '%s'.", db); + + fprintf(stderr, "Database '%s' dropped.\n", db); + return 0; +} + + +/* return a list of the user's databases */ +char ** +list(MYSQL *pmysql) +{ + char *wild; + MYSQL_RES *res; + int rows; + MYSQL_ROW row; + char **dblist; + int i; + char **t; + struct passwd *p; + + p = getpwuid(getuid()); + if (!p) + { + dberror(NULL, "Failed to lookup your UNIX username."); + exit(1); + } + wild = malloc(strlen(p->pw_name) + 3); + sprintf(wild, "%s_%%", p->pw_name); + + res = mysql_list_dbs(pmysql, wild); + rows = mysql_num_rows(res); + dblist = malloc((rows + 2) * sizeof(char *)); /* one for the username + (might not be used)*/ + if (!dblist) + { + dberror(NULL, "Out of memory.\n"); + free(wild); + return NULL; + } + for (i = 0; i < rows; i++) + if (row = mysql_fetch_row(res)) + { + dblist[i] = strdup(row[0]); + } + + res = mysql_list_dbs(pmysql, p->pw_name); + rows = mysql_num_rows(res); + if (rows == 1) + dblist[i++] = strdup(p->pw_name); + + dblist[i] = NULL; + + return dblist; +} + + +writeperm(FILE *f, MYSQL *pmysql, const char *db) +{ + char query[1024]; + MYSQL_RES *res; + int rows, i; + MYSQL_ROW row; + + sprintf(query, "select user,select_priv,insert_priv,update_priv," + "delete_priv,create_priv,alter_priv,drop_priv from db where db='%s'", db); + + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Query for permissions failed."); + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + fprintf(f, "# User " + "Select Insert Update Delete Create Alter Drop\n"); + fprintf(f, "# ---------------- " + "------ ------ ------ ------ ------ ------ ------\n"); + if (rows == 0) + fprintf(f, "# (no permissions currently granted to any users)\n"); + else + for (i = 0; i < rows; i++) + { + row = mysql_fetch_row(res); + fprintf(f, " %-16s %-7s %-7s %-7s %-7s %-7s %-7s %s\n", + row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7]); + } +} + + +/* show information about the database */ +int +show(MYSQL *pmysql, const char *db) +{ + printf("Database '%s':\n", db); + + writeperm(stdout, pmysql, db); + return 0; +} + + +#define MAX_GRANTS 1024 + + +int +editperm(MYSQL *pmysql, const char *db) +{ + char fn[] = "/tmp/mysql-dbadm.tmp.XXXXXX"; + FILE *f; + char *editor; + char cmd[1024]; /* shell command for editing the file */ + char line[1024]; /* buffer to hold one line */ + char *cp; /* used to interate through a line */ + char *user, *select_priv, *insert_priv, *update_priv, *delete_priv, + *create_priv, *alter_priv, *drop_priv; + char query[1024]; /* used to build a query */ + char *queries[MAX_GRANTS]; /* insert queries */ + int lines; /* number of grant lines processed */ + int i; /* iterate through lines[] */ + + mktemp(fn); + if (strcmp(fn, "") == 0) + return dberror(NULL, "Cannot create a unique temporary file name."); + + f = fopen(fn, "w"); + if (f == NULL) + return dberror(NULL, "Failed to open temporary file %s.", fn); + writeperm(f, pmysql, db); + fclose(f); + + editor = getenv("EDITOR"); + if (!editor) + editor = "pico"; /* OK since editor won't be freed */ + strcpy(cmd, editor); + strcat(cmd, " "); + strcat(cmd, fn); + if (system(cmd) == -1) + { + dberror(NULL, "Failed to execute '%s'\n", cmd); + perror("system"); + return 1; + } + + /* parse */ + f = fopen(fn, "r"); + lines = 0; + while (fgets(line, sizeof(line), f)) + { + cp = strchr(line, '\n'); + if (cp) + *cp = '\0'; + + cp = line; + while (*cp && ((*cp == ' ') || (*cp == '\t'))) cp++; + if (*cp == '\0') continue; + if (*cp == '#') continue; + if (*cp == '\n') continue; + + #define STRTOK_WHITESPACE(res, start) \ + { if (!(res = strtok_whitespace(start))) continue; } + + STRTOK_WHITESPACE(user, cp); + if (strlen(user) < 1) + return dberror(NULL, "Invalid user '%s' in grant line %d.", user, + lines + 1); + if (strcmp(user, "%") == 0) + *user = '\0'; /* ugly, but it works... */ + + #define CHECK_PRIV(PRIV) \ + if (!valid_priv(PRIV)) return dberror(NULL, "Invalid value '%s' " \ + "in grant line %d.", PRIV, lines + 1) + + STRTOK_WHITESPACE(select_priv, NULL); + CHECK_PRIV(select_priv); + STRTOK_WHITESPACE(insert_priv, NULL); + CHECK_PRIV(insert_priv); + STRTOK_WHITESPACE(update_priv, NULL); + CHECK_PRIV(update_priv); + STRTOK_WHITESPACE(delete_priv, NULL); + CHECK_PRIV(delete_priv); + STRTOK_WHITESPACE(create_priv, NULL); + CHECK_PRIV(create_priv); + STRTOK_WHITESPACE(alter_priv, NULL); + CHECK_PRIV(alter_priv); + STRTOK_WHITESPACE(drop_priv, NULL); + CHECK_PRIV(drop_priv); + + #undef STRTOK_WHITESPACE + #undef CHECK_PRIV + + sprintf(query, "insert into db(Host, Db, User, Select_priv, Insert_priv, " + "Update_priv, Delete_priv, Create_priv, Alter_priv, Drop_priv) " + "values ('%%', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", + db, user, select_priv, insert_priv, update_priv, delete_priv, + create_priv, alter_priv, drop_priv); + queries[lines] = strdup(query); + lines++; + if (lines >= MAX_GRANTS) + { + dberror(NULL, "Warning: Maximum of %d grants reached.\n", + MAX_GRANTS); + continue; + } + } /* while fgets ... */ + + unlink(fn); + fclose(f); + + /* now that we have checked the input for errors, we can safely + delete the old grants from the database and insert the new ones. */ + + sprintf(query, "delete from db where db='%s'", db); + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to delete old grants for '%s'.", db); + + for (i = 0; i < lines; i++) + { + #ifdef DEBUG + puts(queries[i]); + putchar('\n'); + #endif DEBUG + if (mysql_query(pmysql, queries[i])) + dberror(pmysql, "Failed to insert grant line %d.", i + 1); + } + + return 0; +} + + +int +main(int argc, char *argv[]) +{ + int i; + enum { c_create, c_drop, c_editperm, c_show } command; + MYSQL mysql; + mysql_init(&mysql); + char **dblist, **p; + + program_name = argv[0]; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help") == 0) + return usage(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--version") == 0) + return version(); + + if (argc < 2) + return wrong_use(NULL); + + /* check that the supplied command is valid */ + + if (strcmp(argv[1], "create") == 0) + command = c_create; + else if (strcmp(argv[1], "drop") == 0) + command = c_drop; + else if (strcmp(argv[1], "editperm") == 0) + command = c_editperm; + else if (strcmp(argv[1], "show") == 0) + command = c_show; + else + return wrong_use("unrecognized command"); /* XXX */ + + /* all other than show requires at lease one DATABASE argument. */ + if ((command != c_show) && (argc < 3)) + return wrong_use(NULL); + + /* connect to the database server and select the mysql database */ + if (!mysql_real_connect(&mysql, DB_SERVER, DB_USER, DB_PASSWD, DB_NAME, 0, NULL, 0)) + return dberror(&mysql, "Cannot connect to database server '%s'.", + DB_SERVER); + if (mysql_select_db(&mysql, DB_NAME)) + return dberror(&mysql, "Cannot select database '%s'.", DB_NAME); + + if ((command == c_show) && (argc == 2)) + { + dblist = list(&mysql); + p = dblist; + while (*p) + { + show(&mysql, *p); + free(*p); + p++; + } + free(dblist); + } + else + { + /* for each supplied database name, perform the requested action */ + for (i = 2; i < argc; i++) + { + if (! owner(argv[i])) + { + dberror(NULL, "You are not the owner of '%s'. Skipping.", + argv[i]); + continue; + } + + switch (command) + { + case c_create: + create(&mysql, argv[i]); + break; + case c_drop: + drop(&mysql, argv[i]); + break; + case c_editperm: + editperm(&mysql, argv[i]); + break; + case c_show: + show(&mysql, argv[i]); + break; + default: + return dberror(NULL, "This point should never be reached!"); + } + } + } + + mysql_reload(&mysql); + mysql_close(&mysql); + + return 0; +} diff --git a/mysql-useradm.c b/mysql-useradm.c new file mode 100644 index 0000000..8b24e8a --- /dev/null +++ b/mysql-useradm.c @@ -0,0 +1,304 @@ +/* + * @(#) $Header: /home/nalle/cvsroot/mysql-admutils/mysql-useradm.c,v 1.3 1998/07/06 12:33:08 ljosa Exp $ + * + * mysql-useradm.c + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mysql-admutils.h" + +int +usage() +{ + printf("Usage: %s COMMAND [USER]...\n", program_name); + printf("Create, delete or change password for the USER(s),\n"); + printf("as determined by the COMMAND. Valid COMMANDs:\n"); + printf("\n"); + printf(" create create the USER(s).\n"); + printf(" delete delete the USER(s).\n"); + printf(" passwd change the MySQL password for the USER(s). You\n"); + printf(" will be promptet for the old and the new password.\n"); + printf(" show give information about the USERS(s), or, if\n"); + printf(" none are given, all the users you have.\n"); + printf("\n"); + printf("Report bugs to ljosa@initio.no\n"); + return 0; +} + + +int +is_password_set(MYSQL *pmysql, const char *user) +{ + char query[1024]; + MYSQL_RES *res; + int rows; + MYSQL_ROW row; + + sprintf(query, "select password from user where user = '%s'", user); + if (mysql_query(pmysql, query)) + dberror(pmysql, "Failed to look up password for user '%s'.", user); + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + if (rows == 0) + return -1; + if (rows > 1) + return dberror(NULL, "Query for password for user '%s' gave %d results!", + rows); + row = mysql_fetch_row(res); + return (row[0] && (strlen(row[0]) > 0)); +} + + +int +create(MYSQL *pmysql, const char *user) +{ + char query[1024]; + + sprintf(query, "insert into user (host, user) values ('%%', '%s')", user); + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to create user '%s'.", user); + + return 0; +} + + +int +delete(MYSQL *pmysql, const char *user) +{ + char query[1024]; + + sprintf(query, "delete from user where user = '%s'", user); + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to delete user '%s'.", user); + + return 0; +} + + +int +passwd(MYSQL *pmysql, const char *user) +{ + char prompt[1024]; + char query[1024]; + char *password, *confirm_password; + MYSQL_RES *res; + int rows; + MYSQL_ROW row; + + if (is_password_set(pmysql, user)) + { + sprintf(prompt, "(current) MySQL password for user '%s': ", user); + password = getpass(prompt); + sprintf(query, "select password = password('%s') from user " + "where user = '%s'", password, user); + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to check old password for user '%s'.", + user); + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + if (rows == 0) + return dberror(NULL, "Check for old password for user '%s' " + "returned empty.", user); + if (rows > 1) + return dberror(NULL, "Check for old password for user '%s' " + "returned more than one row!", user); + row = mysql_fetch_row(res); + if (strcmp(row[0], "1") != 0) + { + fprintf(stderr, "%s: Wrong password entered for user '%s'.\n", + program_name, user); + return 1; + } + } + + sprintf(prompt, "New MySQL password for user '%s': ", user); + password = getpass(prompt); + confirm_password = strdup(password); + sprintf(prompt, "Retype new MySQL password for user '%s': ", user); + password = getpass(prompt); + if (strcmp(password, confirm_password) != 0) + { + free(confirm_password); + return dberror(NULL, "Sorry, passwords do not match."); + } + free(confirm_password); + + sprintf(query, "update user set password = password('%s') " + "where user = '%s'", password, user); + if (mysql_query(pmysql, query)) + return dberror(pmysql, "Failed to set new password for user '%s'.", user); + if (mysql_affected_rows(pmysql) > 1) + dberror(NULL, "%d rows affected by password update for user '%s'!", + mysql_affected_rows(pmysql), user); + + fprintf(stderr, "Password updated for user '%s'.\n", user); + return 0; +} + + +int +show(MYSQL *pmysql, const char *user) +{ + switch (is_password_set(pmysql, user)) + { + case -1: + break; + case 0: + printf("User '%s': ", user); + printf("no password set.\n"); + break; + case 1: + printf("User '%s': ", user); + printf("password set.\n"); + break; + } + return 0; +} + + +/* return a list of the user's databases */ +char ** +list(MYSQL *pmysql) +{ + char query[1024]; + MYSQL_RES *res; + int rows; + MYSQL_ROW row; + char **userlist; + int i; + struct passwd *p; + + p = getpwuid(getuid()); + sprintf(query, "select user from user where user='%s' or user like '%s_%%'", + p->pw_name, p->pw_name); + + if (mysql_query(pmysql, query)) + { + dberror(pmysql, "Failed to look up %s's users.", p->pw_name); + return NULL; + } + res = mysql_store_result(pmysql); + rows = mysql_num_rows(res); + userlist = malloc((rows + 1) * sizeof(char *)); + if (!userlist) + { + dberror(NULL, "%s: Out of memory.\n", program_name); + return NULL; + } + for (i = 0; i < rows; i++) + if (row = mysql_fetch_row(res)) + { + userlist[i] = strdup(row[0]); + } + + userlist[i] = NULL; + + return userlist; +} + + +int +main(int argc, char *argv[]) +{ + int i; + enum { c_create, c_delete, c_passwd, c_show } command; + MYSQL mysql; + mysql_init(&mysql); + char **dblist, **p; + + program_name = argv[0]; + + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--help") == 0) + return usage(); + for (i = 1; i < argc; i++) + if (strcmp(argv[i], "--version") == 0) + return version(); + + if (argc < 2) + return wrong_use(NULL); + + /* check that the supplied command is valid */ + + if (strcmp(argv[1], "create") == 0) + command = c_create; + else if (strcmp(argv[1], "delete") == 0) + command = c_delete; + else if (strcmp(argv[1], "passwd") == 0) + command = c_passwd; + else if (strcmp(argv[1], "show") == 0) + command = c_show; + else + return wrong_use("unrecognized command '%s'.", argv[1]); /* XXX */ + + /* all other than show requires at lease one USER argument. */ + if ((command != c_show) && (argc < 3)) + return wrong_use(NULL); + + /* connect to the database server and select the mysql database */ + if (!mysql_real_connect(&mysql, DB_SERVER, DB_USER, DB_PASSWD, DB_NAME, 0, NULL, 0)) + return dberror(&mysql, "Cannot connect to database server '%s'.", + DB_SERVER); + if (mysql_select_db(&mysql, DB_NAME)) + return dberror(&mysql, "Cannot select database '%s'.", DB_NAME); + + if ((command == c_show) && (argc == 2)) + { + dblist = list(&mysql); + p = dblist; + while (*p) + { + show(&mysql, *p); + free(*p); + p++; + } + free(dblist); + } + else + { + /* for each supplied database name, perform the requested action */ + for (i = 2; i < argc; i++) + { + if (! owner(argv[i])) + { + dberror(NULL, "You are not the owner of '%s'. Skipping.", + argv[i]); + continue; + } + + switch (command) + { + case c_create: + create(&mysql, argv[i]); + break; + case c_delete: + delete(&mysql, argv[i]); + break; + case c_passwd: + passwd(&mysql, argv[i]); + break; + case c_show: + show(&mysql, argv[i]); + break; + default: + fprintf(stderr, "This point should never be reached.\n"); + exit(1); + } + } + } + + reload(&mysql); + + mysql_close(&mysql); + + return 0; +} diff --git a/stamp-h.in b/stamp-h.in new file mode 100644 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp