From dc8e8ad8b0f627a6580ce87ebf6176b401af642e Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 23 Jan 2008 11:51:19 +0000 Subject: [PATCH] Install msysDTK-1.0.1 Signed-off-by: Johannes Schindelin --- bin/aclocal | 1547 +- bin/aclocal-1.7 | 475 + bin/autoconf | 853 +- bin/autoheader | 91 +- bin/autom4te | 400 +- bin/automake | 9324 +++++---- bin/automake-1.7 | 9229 +++++++++ bin/autoreconf | 318 +- bin/autoscan | 92 +- bin/autoupdate | 312 +- bin/ifnames | 47 +- bin/rcp.exe | Bin 0 -> 42735 bytes bin/rcs2log | 677 + bin/rlogin.exe | Bin 0 -> 11776 bytes bin/rsh.exe | Bin 0 -> 11264 bytes bin/telnet.exe | Bin 0 -> 109127 bytes bin/tftp.exe | Bin 0 -> 40946 bytes share/aclocal-1.7/amversion.m4 | 28 + share/aclocal-1.7/as.m4 | 31 + share/aclocal-1.7/auxdir.m4 | 64 + share/aclocal-1.7/ccstdc.m4 | 111 + share/aclocal-1.7/cond.m4 | 43 + share/aclocal-1.7/depend.m4 | 146 + share/aclocal-1.7/depout.m4 | 83 + share/aclocal-1.7/dmalloc.m4 | 41 + share/aclocal-1.7/gcj.m4 | 29 + share/aclocal-1.7/header.m4 | 25 + share/aclocal-1.7/init.m4 | 121 + share/aclocal-1.7/install-sh.m4 | 25 + share/aclocal-1.7/lex.m4 | 34 + share/aclocal-1.7/lispdir.m4 | 66 + share/aclocal-1.7/maintainer.m4 | 38 + share/aclocal-1.7/make.m4 | 61 + share/aclocal-1.7/minuso.m4 | 39 + share/aclocal-1.7/missing.m4 | 48 + share/aclocal-1.7/multi.m4 | 67 + share/aclocal-1.7/obsol-gt.m4 | 23 + share/aclocal-1.7/obsol-lt.m4 | 23 + share/aclocal-1.7/obsolete.m4 | 49 + share/aclocal-1.7/options.m4 | 43 + share/aclocal-1.7/protos.m4 | 44 + share/aclocal-1.7/python.m4 | 159 + share/aclocal-1.7/regex.m4 | 65 + share/aclocal-1.7/runlog.m4 | 27 + share/aclocal-1.7/sanity.m4 | 63 + share/aclocal-1.7/strip.m4 | 38 + share/aclocal/autoopts.m4 | 256 + share/aclocal/guile.m4 | 221 + share/aclocal/libtool.m4 | 5482 +++++ share/aclocal/ltdl.m4 | 428 + share/autoconf/Autom4te/General.pm | 483 +- share/autoconf/Autom4te/Struct.pm | 11 +- share/autoconf/Autom4te/XFile.pm | 148 +- share/autoconf/INSTALL | 103 +- share/autoconf/autoconf/autoconf.m4 | 13 +- share/autoconf/autoconf/autoconf.m4f | 10834 ++++------ share/autoconf/autoconf/autoheader.m4 | 8 +- share/autoconf/autoconf/autoscan.m4 | 4 +- share/autoconf/autoconf/autotest.m4 | 15 +- .../autoconf/{autoheader.m4 => autoupdate.m4} | 91 +- share/autoconf/autoconf/c.m4 | 1088 +- share/autoconf/autoconf/fortran.m4 | 1000 +- share/autoconf/autoconf/functions.m4 | 752 +- share/autoconf/autoconf/general.m4 | 1450 +- share/autoconf/autoconf/headers.m4 | 450 +- share/autoconf/autoconf/lang.m4 | 195 +- share/autoconf/autoconf/libs.m4 | 180 +- share/autoconf/autoconf/oldnames.m4 | 6 +- share/autoconf/autoconf/programs.m4 | 556 +- share/autoconf/autoconf/specific.m4 | 235 +- share/autoconf/autoconf/status.m4 | 1866 +- share/autoconf/autoconf/types.m4 | 678 +- share/autoconf/autom4te.cfg | 143 +- share/autoconf/autoscan/autoscan.list | 20 +- share/autoconf/autoscan/functions | 173 + share/autoconf/autoscan/headers | 101 + share/autoconf/autoscan/identifiers | 58 + share/autoconf/autoscan/libraries | 26 + share/autoconf/autoscan/makevars | 34 + share/autoconf/autoscan/programs | 42 + share/autoconf/autotest/autotest.m4 | 4 +- share/autoconf/autotest/autotest.m4f | 4341 ++-- share/autoconf/autotest/general.m4 | 2408 +-- share/autoconf/m4sugar/m4sh.m4 | 1051 +- share/autoconf/m4sugar/m4sh.m4f | 2499 +-- share/autoconf/m4sugar/m4sugar.m4 | 752 +- share/autoconf/m4sugar/m4sugar.m4f | 426 +- share/autoconf/m4sugar/version.m4 | 4 +- share/autogen/aginfo.tpl | 240 + share/autogen/aginfo3.tpl | 115 + share/autogen/agman1.tpl | 442 + share/autogen/agman3.tpl | 126 + share/autogen/confmacs.tpl | 506 + share/autogen/conftest.tpl | 80 + share/autogen/fsm-macro.tpl | 304 + share/autogen/fsm-trans.tpl | 278 + share/autogen/fsm.tpl | 183 + share/autogen/libopts-18.4.9.tar.gz | Bin 0 -> 51401 bytes share/autogen/optcode.tpl | 421 + share/autogen/opthead.tpl | 246 + share/autogen/options.tpl | 196 + share/autogen/options_h.tpl | 308 + share/autogen/optlib.tpl | 562 + share/autogen/optmain.tpl | 431 + share/autogen/schemedef.scm | 75 + share/autogen/stdoptions.def | 348 + share/automake-1.7/Automake/Channels.pm | 620 + share/automake-1.7/Automake/General.pm | 334 + .../Autom4te => automake-1.7/Automake}/Struct.pm | 39 +- share/automake-1.7/Automake/XFile.pm | 211 + share/automake-1.7/COPYING | 340 + share/{autoconf => automake-1.7}/INSTALL | 103 +- share/automake-1.7/acinstall | 52 + share/automake-1.7/am/ansi2knr.am | 77 + share/automake-1.7/am/check.am | 99 + share/automake-1.7/am/clean-hdr.am | 22 + share/automake-1.7/am/clean.am | 49 + share/automake-1.7/am/compile.am | 34 + share/automake-1.7/am/configure.am | 105 + share/automake-1.7/am/data.am | 78 + share/automake-1.7/am/dejagnu.am | 112 + share/automake-1.7/am/depend.am | 24 + share/automake-1.7/am/depend2.am | 98 + share/automake-1.7/am/distdir.am | 383 + share/automake-1.7/am/footer.am | 20 + share/automake-1.7/am/header-vars.am | 62 + share/automake-1.7/am/header.am | 21 + share/automake-1.7/am/install.am | 71 + share/automake-1.7/am/java.am | 89 + share/automake-1.7/am/lang-compile.am | 41 + share/automake-1.7/am/lex.am | 28 + share/automake-1.7/am/library.am | 21 + share/automake-1.7/am/libs.am | 95 + share/automake-1.7/am/libtool.am | 31 + share/automake-1.7/am/lisp.am | 99 + share/automake-1.7/am/ltlib.am | 88 + share/automake-1.7/am/ltlibrary.am | 19 + share/automake-1.7/am/mans-vars.am | 22 + share/automake-1.7/am/mans.am | 94 + share/automake-1.7/am/multilib.am | 68 + share/automake-1.7/am/program.am | 25 + share/automake-1.7/am/progs.am | 129 + share/automake-1.7/am/python.am | 87 + share/automake-1.7/am/remake-hdr.am | 43 + share/automake-1.7/am/scripts.am | 107 + share/automake-1.7/am/subdirs.am | 101 + share/automake-1.7/am/tags.am | 122 + share/automake-1.7/am/texi-vers.am | 61 + share/automake-1.7/am/texibuild.am | 63 + share/automake-1.7/am/texinfos.am | 243 + share/automake-1.7/am/yacc.am | 46 + share/automake-1.7/ansi2knr.1 | 36 + share/automake-1.7/ansi2knr.c | 739 + share/automake-1.7/compile | 99 + share/automake-1.7/config.guess | 1363 ++ share/automake-1.7/config.sub | 1470 ++ share/automake-1.7/depcomp | 423 + share/automake-1.7/elisp-comp | 54 + share/automake-1.7/install-sh | 251 + share/automake-1.7/mdate-sh | 97 + share/automake-1.7/missing | 336 + share/automake-1.7/mkinstalldirs | 111 + share/automake-1.7/py-compile | 92 + share/automake-1.7/texinfo.tex | 6432 ++++++ share/automake-1.7/ylwrap | 160 + share/guile/1.6.0/guile-procedures.txt | 5915 ++++++ share/guile/1.6.0/ice-9/and-let-star.scm | 71 + share/guile/1.6.0/ice-9/arrays.scm | 82 + share/guile/1.6.0/ice-9/boot-9.scm | 3098 +++ share/guile/1.6.0/ice-9/buffered-input.scm | 132 + share/guile/1.6.0/ice-9/calling.scm | 351 + share/guile/1.6.0/ice-9/channel.scm | 195 + share/guile/1.6.0/ice-9/common-list.scm | 303 + share/guile/1.6.0/ice-9/debug.scm | 164 + share/guile/1.6.0/ice-9/debugger.scm | 841 + share/guile/1.6.0/ice-9/documentation.scm | 227 + share/guile/1.6.0/ice-9/emacs.scm | 296 + share/guile/1.6.0/ice-9/expect.scm | 196 + share/guile/1.6.0/ice-9/format.scm | 1714 ++ share/guile/1.6.0/ice-9/ftw.scm | 384 + share/guile/1.6.0/ice-9/getopt-long.scm | 449 + share/guile/1.6.0/ice-9/hcons.scm | 105 + share/guile/1.6.0/ice-9/history.scm | 65 + share/guile/1.6.0/ice-9/lineio.scm | 140 + share/guile/1.6.0/ice-9/ls.scm | 121 + share/guile/1.6.0/ice-9/mapping.scm | 153 + share/guile/1.6.0/ice-9/match.scm | 223 + share/guile/1.6.0/ice-9/networking.scm | 107 + share/guile/1.6.0/ice-9/null.scm | 60 + share/guile/1.6.0/ice-9/optargs.scm | 457 + share/guile/1.6.0/ice-9/poe.scm | 143 + share/guile/1.6.0/ice-9/popen.scm | 205 + share/guile/1.6.0/ice-9/posix.scm | 94 + share/guile/1.6.0/ice-9/pretty-print.scm | 320 + share/guile/1.6.0/ice-9/psyntax.pp | 11 + share/guile/1.6.0/ice-9/psyntax.ss | 2233 ++ share/guile/1.6.0/ice-9/q.scm | 178 + share/guile/1.6.0/ice-9/r4rs.scm | 236 + share/guile/1.6.0/ice-9/r5rs.scm | 69 + share/guile/1.6.0/ice-9/rdelim.scm | 197 + share/guile/1.6.0/ice-9/readline.scm | 218 + share/guile/1.6.0/ice-9/receive.scm | 51 + share/guile/1.6.0/ice-9/regex.scm | 239 + share/guile/1.6.0/ice-9/runq.scm | 266 + share/guile/1.6.0/ice-9/rw.scm | 52 + share/guile/1.6.0/ice-9/safe-r5rs.scm | 169 + share/guile/1.6.0/ice-9/safe.scm | 59 + share/guile/1.6.0/ice-9/session.scm | 499 + share/guile/1.6.0/ice-9/slib.scm | 291 + share/guile/1.6.0/ice-9/stack-catch.scm | 70 + share/guile/1.6.0/ice-9/streams.scm | 242 + share/guile/1.6.0/ice-9/string-fun.scm | 304 + share/guile/1.6.0/ice-9/syncase.scm | 240 + share/guile/1.6.0/ice-9/threads.scm | 117 + share/guile/1.6.0/ice-9/time.scm | 81 + share/guile/1.6.0/oop/goops.scm | 1529 ++ share/guile/1.6.0/oop/goops/active-slot.scm | 91 + share/guile/1.6.0/oop/goops/compile.scm | 164 + share/guile/1.6.0/oop/goops/composite-slot.scm | 107 + share/guile/1.6.0/oop/goops/describe.scm | 225 + share/guile/1.6.0/oop/goops/dispatch.scm | 293 + share/guile/1.6.0/oop/goops/internal.scm | 50 + share/guile/1.6.0/oop/goops/old-define-method.scm | 85 + share/guile/1.6.0/oop/goops/save.scm | 899 + share/guile/1.6.0/oop/goops/stklos.scm | 122 + share/guile/1.6.0/oop/goops/util.scm | 136 + share/guile/1.6.0/scripts/PROGRAM | 45 + share/guile/1.6.0/scripts/autofrisk | 221 + share/guile/1.6.0/scripts/display-commentary | 70 + share/guile/1.6.0/scripts/doc-snarf | 442 + share/guile/1.6.0/scripts/frisk | 292 + share/guile/1.6.0/scripts/generate-autoload | 146 + share/guile/1.6.0/scripts/lint | 319 + share/guile/1.6.0/scripts/punify | 89 + share/guile/1.6.0/scripts/read-scheme-source | 284 + .../1.6.0/scripts/snarf-check-and-output-texi | 313 + share/guile/1.6.0/scripts/snarf-guile-m4-docs | 88 + share/guile/1.6.0/scripts/use2dot | 113 + share/guile/1.6.0/srfi/srfi-1.scm | 1070 + share/guile/1.6.0/srfi/srfi-10.scm | 114 + share/guile/1.6.0/srfi/srfi-11.scm | 281 + share/guile/1.6.0/srfi/srfi-13.scm | 189 + share/guile/1.6.0/srfi/srfi-14.scm | 175 + share/guile/1.6.0/srfi/srfi-16.scm | 151 + share/guile/1.6.0/srfi/srfi-17.scm | 130 + share/guile/1.6.0/srfi/srfi-19.scm | 1561 ++ share/guile/1.6.0/srfi/srfi-2.scm | 56 + share/guile/1.6.0/srfi/srfi-4.scm | 202 + share/guile/1.6.0/srfi/srfi-6.scm | 57 + share/guile/1.6.0/srfi/srfi-8.scm | 56 + share/guile/1.6.0/srfi/srfi-9.scm | 116 + share/libtool/config.guess | 1365 ++ share/libtool/config.sub | 1387 ++ share/libtool/install-sh | 251 + share/libtool/libltdl/COPYING.LIB | 515 + share/libtool/libltdl/Makefile.am | 48 + share/libtool/libltdl/Makefile.in | 491 + share/libtool/libltdl/README | 9 + share/libtool/libltdl/acinclude.m4 | 5910 ++++++ share/libtool/libltdl/aclocal.m4 | 6684 ++++++ share/libtool/libltdl/config-h.in | 187 + share/libtool/libltdl/configure | 20369 +++++++++++++++++++ share/libtool/libltdl/configure.ac | 84 + share/libtool/libltdl/ltdl.c | 4140 ++++ share/libtool/libltdl/ltdl.h | 361 + share/libtool/ltmain.sh | 5794 ++++++ share/libtool/missing | 336 + share/libtool/mkinstalldirs | 101 + uninstall/unins000.dat | Bin 0 -> 88523 bytes uninstall/unins000.exe | Bin 0 -> 72784 bytes 270 files changed, 139994 insertions(+), 25586 deletions(-) rewrite bin/aclocal (88%) create mode 100644 bin/aclocal-1.7 rewrite bin/autoconf (63%) create mode 100644 bin/automake-1.7 create mode 100644 bin/rcp.exe create mode 100644 bin/rcs2log create mode 100644 bin/rlogin.exe create mode 100644 bin/rsh.exe create mode 100644 bin/telnet.exe create mode 100644 bin/tftp.exe create mode 100644 share/aclocal-1.7/amversion.m4 create mode 100644 share/aclocal-1.7/as.m4 create mode 100644 share/aclocal-1.7/auxdir.m4 create mode 100644 share/aclocal-1.7/ccstdc.m4 create mode 100644 share/aclocal-1.7/cond.m4 create mode 100644 share/aclocal-1.7/depend.m4 create mode 100644 share/aclocal-1.7/depout.m4 create mode 100644 share/aclocal-1.7/dmalloc.m4 create mode 100644 share/aclocal-1.7/gcj.m4 create mode 100644 share/aclocal-1.7/header.m4 create mode 100644 share/aclocal-1.7/init.m4 create mode 100644 share/aclocal-1.7/install-sh.m4 create mode 100644 share/aclocal-1.7/lex.m4 create mode 100644 share/aclocal-1.7/lispdir.m4 create mode 100644 share/aclocal-1.7/maintainer.m4 create mode 100644 share/aclocal-1.7/make.m4 create mode 100644 share/aclocal-1.7/minuso.m4 create mode 100644 share/aclocal-1.7/missing.m4 create mode 100644 share/aclocal-1.7/multi.m4 create mode 100644 share/aclocal-1.7/obsol-gt.m4 create mode 100644 share/aclocal-1.7/obsol-lt.m4 create mode 100644 share/aclocal-1.7/obsolete.m4 create mode 100644 share/aclocal-1.7/options.m4 create mode 100644 share/aclocal-1.7/protos.m4 create mode 100644 share/aclocal-1.7/python.m4 create mode 100644 share/aclocal-1.7/regex.m4 create mode 100644 share/aclocal-1.7/runlog.m4 create mode 100644 share/aclocal-1.7/sanity.m4 create mode 100644 share/aclocal-1.7/strip.m4 create mode 100644 share/aclocal/autoopts.m4 create mode 100644 share/aclocal/guile.m4 create mode 100644 share/aclocal/libtool.m4 create mode 100644 share/aclocal/ltdl.m4 copy share/autoconf/autoconf/{autoheader.m4 => autoupdate.m4} (59%) create mode 100644 share/autoconf/autoscan/functions create mode 100644 share/autoconf/autoscan/headers create mode 100644 share/autoconf/autoscan/identifiers create mode 100644 share/autoconf/autoscan/libraries create mode 100644 share/autoconf/autoscan/makevars create mode 100644 share/autoconf/autoscan/programs rewrite share/autoconf/autotest/autotest.m4f (64%) rewrite share/autoconf/autotest/general.m4 (67%) rewrite share/autoconf/m4sugar/m4sh.m4f (60%) create mode 100644 share/autogen/aginfo.tpl create mode 100644 share/autogen/aginfo3.tpl create mode 100644 share/autogen/agman1.tpl create mode 100644 share/autogen/agman3.tpl create mode 100644 share/autogen/confmacs.tpl create mode 100644 share/autogen/conftest.tpl create mode 100644 share/autogen/fsm-macro.tpl create mode 100644 share/autogen/fsm-trans.tpl create mode 100644 share/autogen/fsm.tpl create mode 100644 share/autogen/libopts-18.4.9.tar.gz create mode 100644 share/autogen/optcode.tpl create mode 100644 share/autogen/opthead.tpl create mode 100644 share/autogen/options.tpl create mode 100644 share/autogen/options_h.tpl create mode 100644 share/autogen/optlib.tpl create mode 100644 share/autogen/optmain.tpl create mode 100644 share/autogen/schemedef.scm create mode 100644 share/autogen/stdoptions.def create mode 100644 share/automake-1.7/Automake/Channels.pm create mode 100644 share/automake-1.7/Automake/General.pm copy share/{autoconf/Autom4te => automake-1.7/Automake}/Struct.pm (95%) create mode 100644 share/automake-1.7/Automake/XFile.pm create mode 100644 share/automake-1.7/COPYING copy share/{autoconf => automake-1.7}/INSTALL (66%) create mode 100644 share/automake-1.7/acinstall create mode 100644 share/automake-1.7/am/ansi2knr.am create mode 100644 share/automake-1.7/am/check.am create mode 100644 share/automake-1.7/am/clean-hdr.am create mode 100644 share/automake-1.7/am/clean.am create mode 100644 share/automake-1.7/am/compile.am create mode 100644 share/automake-1.7/am/configure.am create mode 100644 share/automake-1.7/am/data.am create mode 100644 share/automake-1.7/am/dejagnu.am create mode 100644 share/automake-1.7/am/depend.am create mode 100644 share/automake-1.7/am/depend2.am create mode 100644 share/automake-1.7/am/distdir.am create mode 100644 share/automake-1.7/am/footer.am create mode 100644 share/automake-1.7/am/header-vars.am create mode 100644 share/automake-1.7/am/header.am create mode 100644 share/automake-1.7/am/install.am create mode 100644 share/automake-1.7/am/java.am create mode 100644 share/automake-1.7/am/lang-compile.am create mode 100644 share/automake-1.7/am/lex.am create mode 100644 share/automake-1.7/am/library.am create mode 100644 share/automake-1.7/am/libs.am create mode 100644 share/automake-1.7/am/libtool.am create mode 100644 share/automake-1.7/am/lisp.am create mode 100644 share/automake-1.7/am/ltlib.am create mode 100644 share/automake-1.7/am/ltlibrary.am create mode 100644 share/automake-1.7/am/mans-vars.am create mode 100644 share/automake-1.7/am/mans.am create mode 100644 share/automake-1.7/am/multilib.am create mode 100644 share/automake-1.7/am/program.am create mode 100644 share/automake-1.7/am/progs.am create mode 100644 share/automake-1.7/am/python.am create mode 100644 share/automake-1.7/am/remake-hdr.am create mode 100644 share/automake-1.7/am/scripts.am create mode 100644 share/automake-1.7/am/subdirs.am create mode 100644 share/automake-1.7/am/tags.am create mode 100644 share/automake-1.7/am/texi-vers.am create mode 100644 share/automake-1.7/am/texibuild.am create mode 100644 share/automake-1.7/am/texinfos.am create mode 100644 share/automake-1.7/am/yacc.am create mode 100644 share/automake-1.7/ansi2knr.1 create mode 100644 share/automake-1.7/ansi2knr.c create mode 100644 share/automake-1.7/compile create mode 100644 share/automake-1.7/config.guess create mode 100644 share/automake-1.7/config.sub create mode 100644 share/automake-1.7/depcomp create mode 100644 share/automake-1.7/elisp-comp create mode 100644 share/automake-1.7/install-sh create mode 100644 share/automake-1.7/mdate-sh create mode 100644 share/automake-1.7/missing create mode 100644 share/automake-1.7/mkinstalldirs create mode 100644 share/automake-1.7/py-compile create mode 100644 share/automake-1.7/texinfo.tex create mode 100644 share/automake-1.7/ylwrap create mode 100644 share/guile/1.6.0/guile-procedures.txt create mode 100644 share/guile/1.6.0/ice-9/and-let-star.scm create mode 100644 share/guile/1.6.0/ice-9/arrays.scm create mode 100644 share/guile/1.6.0/ice-9/boot-9.scm create mode 100644 share/guile/1.6.0/ice-9/buffered-input.scm create mode 100644 share/guile/1.6.0/ice-9/calling.scm create mode 100644 share/guile/1.6.0/ice-9/channel.scm create mode 100644 share/guile/1.6.0/ice-9/common-list.scm create mode 100644 share/guile/1.6.0/ice-9/debug.scm create mode 100644 share/guile/1.6.0/ice-9/debugger.scm create mode 100644 share/guile/1.6.0/ice-9/documentation.scm create mode 100644 share/guile/1.6.0/ice-9/emacs.scm create mode 100644 share/guile/1.6.0/ice-9/expect.scm create mode 100644 share/guile/1.6.0/ice-9/format.scm create mode 100644 share/guile/1.6.0/ice-9/ftw.scm create mode 100644 share/guile/1.6.0/ice-9/getopt-long.scm create mode 100644 share/guile/1.6.0/ice-9/hcons.scm create mode 100644 share/guile/1.6.0/ice-9/history.scm create mode 100644 share/guile/1.6.0/ice-9/lineio.scm create mode 100644 share/guile/1.6.0/ice-9/ls.scm create mode 100644 share/guile/1.6.0/ice-9/mapping.scm create mode 100644 share/guile/1.6.0/ice-9/match.scm create mode 100644 share/guile/1.6.0/ice-9/networking.scm create mode 100644 share/guile/1.6.0/ice-9/null.scm create mode 100644 share/guile/1.6.0/ice-9/optargs.scm create mode 100644 share/guile/1.6.0/ice-9/poe.scm create mode 100644 share/guile/1.6.0/ice-9/popen.scm create mode 100644 share/guile/1.6.0/ice-9/posix.scm create mode 100644 share/guile/1.6.0/ice-9/pretty-print.scm create mode 100644 share/guile/1.6.0/ice-9/psyntax.pp create mode 100644 share/guile/1.6.0/ice-9/psyntax.ss create mode 100644 share/guile/1.6.0/ice-9/q.scm create mode 100644 share/guile/1.6.0/ice-9/r4rs.scm create mode 100644 share/guile/1.6.0/ice-9/r5rs.scm create mode 100644 share/guile/1.6.0/ice-9/rdelim.scm create mode 100644 share/guile/1.6.0/ice-9/readline.scm create mode 100644 share/guile/1.6.0/ice-9/receive.scm create mode 100644 share/guile/1.6.0/ice-9/regex.scm create mode 100644 share/guile/1.6.0/ice-9/runq.scm create mode 100644 share/guile/1.6.0/ice-9/rw.scm create mode 100644 share/guile/1.6.0/ice-9/safe-r5rs.scm create mode 100644 share/guile/1.6.0/ice-9/safe.scm create mode 100644 share/guile/1.6.0/ice-9/session.scm create mode 100644 share/guile/1.6.0/ice-9/slib.scm create mode 100644 share/guile/1.6.0/ice-9/stack-catch.scm create mode 100644 share/guile/1.6.0/ice-9/streams.scm create mode 100644 share/guile/1.6.0/ice-9/string-fun.scm create mode 100644 share/guile/1.6.0/ice-9/syncase.scm create mode 100644 share/guile/1.6.0/ice-9/threads.scm create mode 100644 share/guile/1.6.0/ice-9/time.scm create mode 100644 share/guile/1.6.0/oop/goops.scm create mode 100644 share/guile/1.6.0/oop/goops/active-slot.scm create mode 100644 share/guile/1.6.0/oop/goops/compile.scm create mode 100644 share/guile/1.6.0/oop/goops/composite-slot.scm create mode 100644 share/guile/1.6.0/oop/goops/describe.scm create mode 100644 share/guile/1.6.0/oop/goops/dispatch.scm create mode 100644 share/guile/1.6.0/oop/goops/internal.scm create mode 100644 share/guile/1.6.0/oop/goops/old-define-method.scm create mode 100644 share/guile/1.6.0/oop/goops/save.scm create mode 100644 share/guile/1.6.0/oop/goops/stklos.scm create mode 100644 share/guile/1.6.0/oop/goops/util.scm create mode 100644 share/guile/1.6.0/scripts/PROGRAM create mode 100644 share/guile/1.6.0/scripts/autofrisk create mode 100644 share/guile/1.6.0/scripts/display-commentary create mode 100644 share/guile/1.6.0/scripts/doc-snarf create mode 100644 share/guile/1.6.0/scripts/frisk create mode 100644 share/guile/1.6.0/scripts/generate-autoload create mode 100644 share/guile/1.6.0/scripts/lint create mode 100644 share/guile/1.6.0/scripts/punify create mode 100644 share/guile/1.6.0/scripts/read-scheme-source create mode 100644 share/guile/1.6.0/scripts/snarf-check-and-output-texi create mode 100644 share/guile/1.6.0/scripts/snarf-guile-m4-docs create mode 100644 share/guile/1.6.0/scripts/use2dot create mode 100644 share/guile/1.6.0/srfi/srfi-1.scm create mode 100644 share/guile/1.6.0/srfi/srfi-10.scm create mode 100644 share/guile/1.6.0/srfi/srfi-11.scm create mode 100644 share/guile/1.6.0/srfi/srfi-13.scm create mode 100644 share/guile/1.6.0/srfi/srfi-14.scm create mode 100644 share/guile/1.6.0/srfi/srfi-16.scm create mode 100644 share/guile/1.6.0/srfi/srfi-17.scm create mode 100644 share/guile/1.6.0/srfi/srfi-19.scm create mode 100644 share/guile/1.6.0/srfi/srfi-2.scm create mode 100644 share/guile/1.6.0/srfi/srfi-4.scm create mode 100644 share/guile/1.6.0/srfi/srfi-6.scm create mode 100644 share/guile/1.6.0/srfi/srfi-8.scm create mode 100644 share/guile/1.6.0/srfi/srfi-9.scm create mode 100644 share/libtool/config.guess create mode 100644 share/libtool/config.sub create mode 100644 share/libtool/install-sh create mode 100644 share/libtool/libltdl/COPYING.LIB create mode 100644 share/libtool/libltdl/Makefile.am create mode 100644 share/libtool/libltdl/Makefile.in create mode 100644 share/libtool/libltdl/README create mode 100644 share/libtool/libltdl/acinclude.m4 create mode 100644 share/libtool/libltdl/aclocal.m4 create mode 100644 share/libtool/libltdl/config-h.in create mode 100644 share/libtool/libltdl/configure create mode 100644 share/libtool/libltdl/configure.ac create mode 100644 share/libtool/libltdl/ltdl.c create mode 100644 share/libtool/libltdl/ltdl.h create mode 100644 share/libtool/ltmain.sh create mode 100644 share/libtool/missing create mode 100644 share/libtool/mkinstalldirs create mode 100644 uninstall/unins000.dat create mode 100644 uninstall/unins000.exe diff --git a/bin/aclocal b/bin/aclocal dissimilarity index 88% index e728ee45..ea2a104f 100644 --- a/bin/aclocal +++ b/bin/aclocal @@ -1,1072 +1,475 @@ -#!/bin/perl -w -# -*- perl -*- -# Generated from aclocal.in; do not edit by hand. - -eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /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, 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. - -# Written by Tom Tromey , and -# Alexandre Duret-Lutz . - -BEGIN -{ - my $perllibdir = $ENV{'perllibdir'} || '/usr/share/automake-1.10'; - unshift @INC, (split ':', $perllibdir); -} - -use strict; - -use Automake::Config; -use Automake::General; -use Automake::Configure_ac; -use Automake::Channels; -use Automake::ChannelDefs; -use Automake::XFile; -use Automake::FileUtils; -use File::Basename; -use File::stat; -use Cwd; - -# Some globals. - -# Include paths for searching macros. We search macros in this order: -# user-supplied directories first, then the directory containing the -# automake macros, and finally the system-wide directories for -# third-party macro. @user_includes can be augmented with -I. -# @system_includes can be augmented with the `dirlist' file. Also -# --acdir will reset both @automake_includes and @system_includes. -my @user_includes = (); -my @automake_includes = ("/usr/share/aclocal-$APIVERSION"); -my @system_includes = ('/usr/share/aclocal'); - -# Whether we should copy M4 file in $user_includes[0]. -my $install = 0; - -# --diff -my @diff_command; - -# --dry-run -my $dry_run = 0; - -# configure.ac or configure.in. -my $configure_ac; - -# Output file name. -my $output_file = 'aclocal.m4'; - -# Option --force. -my $force_output = 0; - -# Modification time of the youngest dependency. -my $greatest_mtime = 0; - -# Which macros have been seen. -my %macro_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.) -my @file_order = (); - -# Map macro names to file names. -my %map = (); - -# Ditto, but records the last definition of each macro as returned by --trace. -my %map_traced_defs = (); - -# Map basenames to macro names. -my %invmap = (); - -# Map file names to file contents. -my %file_contents = (); - -# Map file names to file types. -my %file_type = (); -use constant FT_USER => 1; -use constant FT_AUTOMAKE => 2; -use constant FT_SYSTEM => 3; - -# Map file names to included files (transitively closed). -my %file_includes = (); - -# Files which have already been added. -my %file_added = (); - -# Files that have already been scanned. -my %scanned_configure_dep = (); - -# Serial numbers, for files that have one. -# The key is the basename of the file, -# the value is the serial number represented as a list. -my %serial = (); - -# 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. -my $ac_defun_rx = - "(?:AU_ALIAS|A[CU]_DEFUN|AC_DEFUN_ONCE)\\((?:\\[([^]]+)\\]|([^],)\n]+))"; - -# Matches an AC_REQUIRE line. -my $ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)"; - -# Matches an m4_include line. -my $m4_include_rx = "(m4_|m4_s|s)include\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)"; - -# Match a serial number. -my $serial_line_rx = '^#\s*serial\s+(\S*)'; -my $serial_number_rx = '^\d+(?:\.\d+)*$'; - -# Autoconf version -# Set by trace_used_macros. -my $ac_version; - -# If set, names a temporary file that must be erased on abnormal exit. -my $erase_me; - -################################################################ - -# Erase temporary file ERASE_ME. -sub unlink_tmp -{ - if (defined $erase_me && -e $erase_me && !unlink ($erase_me)) - { - fatal "could not remove `$erase_me': $!"; - } - undef $erase_me; -} - -$SIG{'INT'} = $SIG{'TERM'} = $SIG{'QUIT'} = $SIG{'HUP'} = 'unlink_tmp'; -END { unlink_tmp } - -# 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. - msg ('syntax', "warning: macro `$key' defined in " - . "acinclude.m4 but never used") - if $map{$key} eq 'acinclude.m4' && ! exists $macro_seen{$key}; - } -} - -sub reset_maps () -{ - $greatest_mtime = 0; - %macro_seen = (); - @file_order = (); - %map = (); - %map_traced_defs = (); - %file_contents = (); - %file_type = (); - %file_includes = (); - %file_added = (); - %scanned_configure_dep = (); - %invmap = (); - %serial = (); - undef &search; -} - -# install_file ($SRC, $DEST) -sub install_file ($$) -{ - my ($src, $dest) = @_; - my $diff_dest; - - if ($force_output - || !exists $file_contents{$dest} - || $file_contents{$src} ne $file_contents{$dest}) - { - if (-e $dest) - { - msg 'note', "overwriting `$dest' with `$src'"; - $diff_dest = $dest; - } - else - { - msg 'note', "installing `$dest' from `$src'"; - } - - if (@diff_command) - { - if (! defined $diff_dest) - { - # $dest does not exist. We create an empty one just to - # run diff, and we erase it afterward. Using the real - # the destination file (rather than a temporary file) is - # good when diff is run with options that display the - # file name. - # - # If creating $dest fails, fall back to /dev/null. At - # least one diff implementation (Tru64's) cannot deal - # with /dev/null. However working around this is not - # worth the trouble since nobody run aclocal on a - # read-only tree anyway. - $erase_me = $dest; - my $f = new IO::File "> $dest"; - if (! defined $f) - { - undef $erase_me; - $diff_dest = '/dev/null'; - } - else - { - $diff_dest = $dest; - $f->close; - } - } - my @cmd = (@diff_command, $diff_dest, $src); - $! = 0; - verb "running: @cmd"; - my $res = system (@cmd); - Automake::FileUtils::handle_exec_errors "@cmd", 1 - if $res; - unlink_tmp; - } - elsif (!$dry_run) - { - xsystem ('cp', $src, $dest); - } - } -} - -# Compare two lists of numbers. -sub list_compare (\@\@) -{ - my @l = @{$_[0]}; - my @r = @{$_[1]}; - while (1) - { - if (0 == @l) - { - return (0 == @r) ? 0 : -1; - } - elsif (0 == @r) - { - return 1; - } - elsif ($l[0] < $r[0]) - { - return -1; - } - elsif ($l[0] > $r[0]) - { - return 1; - } - shift @l; - shift @r; - } -} - -################################################################ - -# scan_m4_dirs($TYPE, @DIRS) -# -------------------------- -# Scan all M4 files installed in @DIRS for new macro definitions. -# Register each file as of type $TYPE (one of the FT_* constants). -sub scan_m4_dirs ($@) -{ - my ($type, @dirlist) = @_; - - foreach my $m4dir (@dirlist) - { - if (! opendir (DIR, $m4dir)) - { - fatal "couldn't open directory `$m4dir': $!"; - } - - # We reverse the directory contents so that foo2.m4 gets - # used in preference to foo1.m4. - foreach my $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'; - - my $fullfile = File::Spec->canonpath ("$m4dir/$file"); - &scan_file ($type, $fullfile, 'aclocal'); - } - closedir (DIR); - } -} - -# Scan all the installed m4 files and construct a map. -sub scan_m4_files () -{ - # First, scan configure.ac. It may contain macro definitions, - # or may include other files that define macros. - &scan_file (FT_USER, $configure_ac, 'aclocal'); - - # Then, scan acinclude.m4 if it exists. - if (-f 'acinclude.m4') - { - &scan_file (FT_USER, 'acinclude.m4', 'aclocal'); - } - - # Finally, scan all files in our search paths. - scan_m4_dirs (FT_USER, @user_includes); - scan_m4_dirs (FT_AUTOMAKE, @automake_includes); - scan_m4_dirs (FT_SYSTEM, @system_includes); - - # 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; - prog_error "$@\n search is $search" if $@; -} - -################################################################ - -# Add a macro to the output. -sub add_macro ($) -{ - my ($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}; - - verb "saw macro $macro"; - $macro_seen{$macro} = 1; - &add_file ($map{$macro}); -} - -# scan_configure_dep ($file) -# -------------------------- -# Scan a configure dependency (configure.ac, or separate m4 files) -# for uses of known macros and AC_REQUIREs of possibly unknown macros. -# Recursively scan m4_included files. -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/\#.*$//; - # Avoid running all the following regexes on white lines. - next if /^\s*$/; - - while (/$m4_include_rx/go) - { - my $ifile = $2 || $3; - # Skip missing `sinclude'd files. - next if $1 ne 'm4_' && ! -f $ifile; - push @ilist, $ifile; - } - - 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). - msg ('unsupported', "$file:$line", - "warning: macro `$2' not found in library"); - } - } - - add_macro ($_) foreach (@rlist); - &scan_configure_dep ($_) foreach @ilist; -} - -# add_file ($FILE) -# ---------------- -# Add $FILE to output. -sub add_file ($) -{ - my ($file) = @_; - - # Only add a file once. - return if ($file_added{$file}); - $file_added{$file} = 1; - - scan_configure_dep $file; -} - -# Point to the documentation for underquoted AC_DEFUN only once. -my $underquoted_manual_once = 0; - -# scan_file ($TYPE, $FILE, $WHERE) -# -------------------------------- -# Scan a single M4 file ($FILE), and all files it includes. -# Return the list of included files. -# $TYPE is one of FT_USER, FT_AUTOMAKE, or FT_SYSTEM, depending -# on where the file comes from. -# $WHERE is the location to use in the diagnostic if the file -# does not exist. -sub scan_file ($$$) -{ - my ($type, $file, $where) = @_; - my $basename = basename $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; - - $file_type{$file} = $type; - - fatal "$where: file `$file' does not exist" if ! -e $file; - - my $fh = new Automake::XFile $file; - my $contents = ''; - my @inc_files = (); - my %inc_lines = (); - - my $defun_seen = 0; - my $serial_seen = 0; - my $serial_older = 0; - - while ($_ = $fh->getline) - { - # Ignore `##' lines. - next if /^##/; - - $contents .= $_; - my $line = $_; - - if ($line =~ /$serial_line_rx/go) - { - my $number = $1; - if ($number !~ /$serial_number_rx/go) - { - msg ('syntax', "$file:$.", - "warning: ill-formed serial number `$number', " - . "expecting a version string with only digits and dots"); - } - elsif ($defun_seen) - { - # aclocal removes all definitions from M4 file with the - # same basename if a greater serial number is found. - # Encountering a serial after some macros will undefine - # these macros... - msg ('syntax', "$file:$.", - 'the serial number must appear before any macro definition'); - } - # We really care about serials only for non-automake macros - # and when --install is used. But the above diagnostics are - # made regardless of this, because not using --install is - # not a reason not the fix macro files. - elsif ($install && $type != FT_AUTOMAKE) - { - $serial_seen = 1; - my @new = split (/\./, $number); - - verb "$file:$.: serial $number"; - - if (!exists $serial{$basename} - || list_compare (@new, @{$serial{$basename}}) > 0) - { - # Delete any definition we knew from the old macro. - foreach my $def (@{$invmap{$basename}}) - { - verb "$file:$.: ignoring previous definition of $def"; - delete $map{$def}; - } - $invmap{$basename} = []; - $serial{$basename} = \@new; - } - else - { - $serial_older = 1; - } - } - } - - # Remove comments from current line. - # Do not do it earlier, because the serial line is a comment. - $line =~ s/\bdnl\b.*$//; - $line =~ s/\#.*$//; - - while ($line =~ /$ac_defun_rx/go) - { - $defun_seen = 1; - if (! defined $1) - { - msg ('syntax', "$file:$.", "warning: underquoted definition of $2" - . "\n run info '(automake)Extending aclocal'\n" - . " or see http://sources.redhat.com/automake/" - . "automake.html#Extending-aclocal") - unless $underquoted_manual_once; - $underquoted_manual_once = 1; - } - - # If this macro does not have a serial and we have already - # seen a macro with the same basename earlier, we should - # ignore the macro (don't exit immediately so we can still - # diagnose later #serial numbers and underquoted macros). - $serial_older ||= ($type != FT_AUTOMAKE - && !$serial_seen && exists $serial{$basename}); - - my $macro = $1 || $2; - if (!$serial_older && !defined $map{$macro}) - { - verb "found macro $macro in $file: $."; - $map{$macro} = $file; - push @{$invmap{$basename}}, $macro; - } - 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. - verb "ignoring macro $macro in $file: $."; - } - } - - while ($line =~ /$m4_include_rx/go) - { - my $ifile = $2 || $3; - # Skip missing `sinclude'd files. - next if $1 ne 'm4_' && ! -f $ifile; - push (@inc_files, $ifile); - $inc_lines{$ifile} = $.; - } - } - - # Ignore any file that has an old serial (or no serial if we know - # another one with a serial). - return () - if ($serial_older || - ($type != FT_AUTOMAKE && !$serial_seen && exists $serial{$basename})); - - $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 ($type, $_, - "$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 = @_; - - # Always include acinclude.m4, even if it does not appear to be used. - $files{'acinclude.m4'} = 1 if -f 'acinclude.m4'; - # File included by $configure_ac are redundant. - $files{$configure_ac} = 1; - - # 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}; - verb "$ifile is already included by $file"; - } - } - - # configure.ac is implicitly included. - delete $files{$configure_ac}; - - return %files; -} - -sub trace_used_macros () -{ - my %files = map { $map{$_} => 1 } keys %macro_seen; - %files = strip_redundant_includes %files; - - my $traces = ($ENV{AUTOM4TE} || 'autom4te'); - $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', - '_AM_AUTOCONF_VERSION')), - # Do not trace $1 for all other macros as we do - # not need it and it might contains harmful - # characters (like newlines). - (map { "--trace='$_:\$f::\$n'" } (keys %macro_seen))); - - verb "running $traces $configure_ac"; - - my $tracefh = new Automake::XFile ("$traces $configure_ac |"); - - my %traced = (); - - while ($_ = $tracefh->getline) - { - chomp; - my ($file, $macro, $arg1) = split (/::/); - - $traced{$macro} = 1 if exists $macro_seen{$macro}; - - $map_traced_defs{$arg1} = $file - if ($macro eq 'AC_DEFUN' - || $macro eq 'AC_DEFUN_ONCE' - || $macro eq 'AU_DEFUN'); - - $ac_version = $arg1 if $macro eq '_AM_AUTOCONF_VERSION'; - } - - $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. -# Return 0 iff some files were installed locally. -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 (exists $map_traced_defs{$m} - && $map{$m} eq $map_traced_defs{$m}); - } - # Do not explicitly include a file that is already indirectly included. - %files = strip_redundant_includes %files; - - my $installed = 0; - - for my $file (grep { exists $files{$_} } @file_order) - { - # Check the time stamp of this file, and of 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_type{$file} != FT_USER - || $file =~ m,^(?:\w:)?[\\/],) - { - if (!$install || $file_type{$file} != FT_SYSTEM) - { - # Copy the file into aclocal.m4. - $output .= $file_contents{$file} . "\n"; - } - else - { - # Install the file (and any file it includes). - my $dest; - for my $ifile (@{$file_includes{$file}}, $file) - { - $dest = "$user_includes[0]/" . basename $ifile; - verb "installing $ifile to $dest"; - install_file ($ifile, $dest); - } - $installed = 1; - } - } - else - { - # Otherwise, simply include the file. - $output .= "m4_include([$file])\n"; - } - } - - if ($installed) - { - verb "running aclocal anew, because some files were installed locally"; - return 0; - } - - # Nothing to output?! - # FIXME: Shouldn't we diagnose this? - return 1 if ! length ($output); - - if ($ac_version) - { - # Do not use "$output_file" here for the same reason we do not - # use it in the header below. autom4te will output the name of - # the file in the diagnostic anyway. - $output = "m4_if(m4_PACKAGE_VERSION, [$ac_version],, -[m4_fatal([this file was generated for autoconf $ac_version. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) - -$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, 2006 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)) - { - verb "$output_file unchanged"; - return 1; - } - - verb "writing $output_file"; - - if (!$dry_run) - { - if (-e $output_file && !unlink $output_file) - { - fatal "could not remove `$output_file': $!"; - } - my $out = new Automake::XFile "> $output_file"; - print $out $output; - } - return 1; -} - -################################################################ - -# Print usage and exit. -sub usage ($) -{ - my ($status) = @_; - - print "Usage: aclocal [OPTIONS] ... - -Generate `aclocal.m4' by scanning `configure.ac' or `configure.in' - -Options: - --acdir=DIR directory holding config files (for debugging) - --diff[=COMMAND] run COMMAND [diff -u] on M4 files that would be - changed (implies --install and --dry-run) - --dry-run pretend to, but do not actually update any file - --force always update output file - --help print this help, then exit - -I DIR add directory to search list for .m4 files - --install copy third-party files to the first -I directory - --output=FILE put output in FILE (default aclocal.m4) - --print-ac-dir print name of directory holding m4 files, then exit - --verbose don't be silent - --version print version number, then exit - -W, --warnings=CATEGORY report the warnings falling in CATEGORY - -Warning categories include: - `syntax' dubious syntactic constructs (default) - `unsupported' unknown macros (default) - `all' all the warnings (default) - `no-CATEGORY' turn off warnings in CATEGORY - `none' turn off all the warnings - `error' treat warnings as errors - -Report bugs to .\n"; - - exit $status; -} - -# Print version and exit. -sub version() -{ - print < - and Alexandre Duret-Lutz . - -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. -EOF - exit 0; -} - -# Parse command line. -sub parse_arguments () -{ - my $print_and_exit = 0; - my $diff_command; - - my %cli_options = - ( - 'acdir=s' => sub # Setting --acdir overrides both the - { # automake (versioned) directory and the - # public (unversioned) system directory. - @automake_includes = (); - @system_includes = ($_[1]) - }, - 'diff:s' => \$diff_command, - 'dry-run' => \$dry_run, - 'force' => \$force_output, - 'I=s' => \@user_includes, - 'install' => \$install, - 'output=s' => \$output_file, - 'print-ac-dir' => \$print_and_exit, - 'verbose' => sub { setup_channel 'verb', silent => 0; }, - 'W|warnings=s' => \&parse_warnings, - ); - 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 aclocal does `exit 0'.) - my %cli_options_1st_pass = - ( - 'version' => \&version, - 'help' => sub { usage(0); }, - # 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, but we specify them nonetheless so - # that ambiguous abbreviation are diagnosed. - Getopt::Long::GetOptions %cli_options, 'version' => sub {}, 'help' => sub {} - or exit 1; - - if (@ARGV) - { - my %argopts; - for my $k (keys %cli_options) - { - if ($k =~ /(.*)=s$/) - { - map { $argopts{(length ($_) == 1) - ? "-$_" : "--$_" } = 1; } (split (/\|/, $1)); - } - } - if (exists $argopts{$ARGV[0]}) - { - fatal ("option `$ARGV[0]' requires an argument\n" - . "Try `$0 --help' for more information."); - } - else - { - fatal ("unrecognized option `$ARGV[0]'\n" - . "Try `$0 --help' for more information."); - } - } - - if ($print_and_exit) - { - print "@system_includes\n"; - exit 0; - } - - if (defined $diff_command) - { - $diff_command = 'diff -u' if $diff_command eq ''; - @diff_command = split (' ', $diff_command); - $install = 1; - $dry_run = 1; - } - - if ($install && !@user_includes) - { - fatal ("--install should copy macros in the directory indicated by the" - . "\nfirst -I option, but no -I was supplied."); - } - - if (! -d $system_includes[0]) - { - # 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. (We know - # @system_includes has its default value if @automake_includes - # is not empty, because --acdir is the only way to change this.) - @system_includes = () if @automake_includes; - } - else - { - # Finally, adds any directory listed in the `dirlist' file. - if (open (DIRLIST, "$system_includes[0]/dirlist")) - { - while () - { - # Ignore '#' lines. - next if /^#/; - # strip off newlines and end-of-line comments - s/\s*\#.*$//; - chomp; - foreach my $dir (glob) - { - push (@system_includes, $dir) if -d $dir; - } - } - close (DIRLIST); - } - } -} - -################################################################ - -parse_WARNINGS; # Parse the WARNINGS environment variable. -parse_arguments; -$configure_ac = require_configure_ac; - -# We may have to rerun aclocal if some file have been installed, but -# it should not happen more than once. The reason we must run again -# is that once the file has been moved from /usr/share/aclocal/ to the -# local m4/ directory it appears at a new place in the search path, -# hence it should be output at a different position in aclocal.m4. If -# we did not rerun aclocal, the next run of aclocal would produce a -# different aclocal.m4. -my $loop = 0; -while (1) - { - ++$loop; - prog_error "Too many loops." if $loop > 2; - - reset_maps; - scan_m4_files; - scan_configure; - last if $exit_code; - my %macro_traced = trace_used_macros; - last if write_aclocal ($output_file, keys %macro_traced); - last if $dry_run; - } -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: +#!/bin/perl +# -*- perl -*- +# Makefile. Generated from Makefile.in by configure. + +eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; esac' + if 0; + +# aclocal - create aclocal.m4 by scanning configure.ac + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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/share/automake-1.7'; + unshift @INC, $perllibdir; +} + +use Automake::General; +use Automake::XFile; + +# Some constants. +$VERSION = '1.7.1'; +$APIVERSION = '1.7'; +$PACKAGE = 'automake'; +# Note that this isn't pkgdatadir, but a separate directory. +# Note also that the versioned directory is handled later. +$acdir = '/usr/share/aclocal'; +$default_acdir = $acdir; +# 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. + +# Exit status. +$exit_status = 0; + +# Name of the top autoconf input: `configure.ac' or `configure.in'. +$configure_ac = find_configure_ac; + +# Text to output. +$output = ''; + +# Output file name. +$output_file = 'aclocal.m4'; + +# Which macros have been seen. +%macro_seen = (); + +# Which files have been seen. +%file_seen = (); + +# Map macro names to file names. +%map = (); + +# Map file names to file contents. +%file_contents = (); + +# 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 = "A[CU]_DEFUN\\((?:\\[([^]]+)\\]|([^],)\n]+))"; + +# Matches an AC_REQUIRE line. +$ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)"; + + + +local (@dirlist) = &parse_arguments (@ARGV); +&scan_m4_files (@dirlist); +&scan_configure; +if (! $exit_status) +{ + &write_aclocal; +} +&check_acinclude; + +exit $exit_status; + +################################################################ + +# 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 + --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 '--verbose') + { + ++$verbose; + } + elsif ($arglist[0] eq '--version') + { + print "aclocal (GNU $PACKAGE) $VERSION\n\n"; + print "Copyright (C) 2002 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\n"; + print "Written by Tom Tromey \n"; + exit 0; + } + elsif ($arglist[0] eq '--help') + { + &usage (0); + } + else + { + die "aclocal: unrecognized option -- `$arglist[0]'\nTry `aclocal --help' for more information.\n"; + } + + shift (@arglist); + } + + if ($print_and_exit) + { + print $acdir, "\n"; + exit 0; + } + + $default_dirlist="$acdir/dirlist" + if $acdir ne $default_acdir; + + # Search the versioned directory near the end, and then the + # unversioned directory last. Only do this if the user didn't + # override acdir. + push (@dirlist, "$acdir-$APIVERSION") + if $acdir eq $default_acdir; + + # 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; +} + +################################################################ + +sub scan_configure () +{ + die "aclocal: `configure.ac' or `configure.in' is required\n" + if !$configure_ac; + + open (CONFIGURE, $configure_ac) + || die "aclocal: couldn't open `$configure_ac': $!\n"; + + # Make sure we include acinclude.m4 if it exists. + if (-f 'acinclude.m4') + { + &add_file ('acinclude.m4'); + } + + while () + { + # Remove comments from current line. + s/\bdnl\b.*$//; + s/\#.*$//; + + # Search for things we know about. The "search" sub is + # constructed dynamically by scan_m4_files. The last + # parenthethical 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. + warn "aclocal: $configure_ac: $.: macro `$2' not found in library\n"; + $exit_status = 1; + } + } + + close (CONFIGURE); +} + +################################################################ + +# Check macros in acinclude.m4. If one is not used, warn. +sub check_acinclude () +{ + local ($key); + + foreach $key (keys %map) + { + next unless $map{$key} eq 'acinclude.m4'; + if (! $macro_seen{$key}) + { + # FIXME: should print line number of acinclude.m4. + warn "aclocal: macro `$key' defined in acinclude.m4 but never used\n"; + } + } +} + +################################################################ + +# Scan all the installed m4 files and construct a map. +sub scan_m4_files (@) +{ + local (@dirlist) = @_; + + # First, scan acinclude.m4 if it exists. + if (-f 'acinclude.m4') + { + $file_contents{'acinclude.m4'} = &scan_file ('acinclude.m4'); + } + + local ($m4dir); + foreach $m4dir (@dirlist) + { + opendir (DIR, $m4dir) + || die "aclocal: couldn't open directory `$m4dir': $!\n"; + local ($file, $fullfile); + foreach $file (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 = $m4dir . '/' . $file; + $file_contents{$fullfile} = &scan_file ($fullfile); + } + closedir (DIR); + } + + # Construct a new function that does the searching. We use a + # function (instead of just evalling $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) = @_; + + # We want to ignore AC_ macros. However, if an AC_ macro is + # defined in (eg) acinclude.m4, then we want to make sure we mark + # it as seen. + return if $macro =~ /^AC_/ && ! defined $map{$macro}; + + if (! defined $map{$macro}) + { + warn "aclocal: macro `$macro' required but not defined\n"; + $exit_status = 1; + return; + } + + print STDERR "aclocal: saw macro $macro\n" if $verbose; + $macro_seen{$macro} = 1; + &add_file ($map{$macro}); +} + +# Add a file to output. +sub add_file ($) +{ + local ($file) = @_; + + # Only add a file once. + return if ($file_seen{$file}); + $file_seen{$file} = 1; + + $output .= $file_contents{$file} . "\n"; + my (@rlist); + foreach (split ("\n", $file_contents{$file})) + { + # Remove comments from current line. + s/\bdnl\b.*$//; + s/\#.*$//; + + if (/$ac_require_rx/g) + { + push (@rlist, $1 || $2); + } + + # The search function is constructed dynamically by + # scan_m4_files. The last parenthethical 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. + warn "aclocal: $configure_ac: $.: macro `$2' not found in library\n"; + $exit_status = 1; + } + } + + local ($macro); + foreach $macro (@rlist) + { + &add_macro ($macro); + } +} + +# Scan a single M4 file. Return contents. +sub scan_file ($) +{ + local ($file) = @_; + + my $fh = new Automake::XFile $file; + my $contents = ''; + while ($_ = $fh->getline) + { + # Ignore `##' lines. + next if /^##/; + + $contents .= $_; + + if (/$ac_defun_rx/) + { + if (! defined $map{$1 || $2}) + { + $map{$1 || $2} = $file; + } + + # 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: found macro $1 in $file: $.\n" if $verbose; + } + } + + return $contents; +} + +################################################################ + +# Write output. +sub write_aclocal () +{ + return if ! length ($output); + + print STDERR "aclocal: writing $output_file\n" if $verbose; + + my $out = new Automake::XFile "> $output_file"; + +# 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. + print $out +"# generated automatically by aclocal $VERSION -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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"; +} + +### 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/aclocal-1.7 b/bin/aclocal-1.7 new file mode 100644 index 00000000..ea2a104f --- /dev/null +++ b/bin/aclocal-1.7 @@ -0,0 +1,475 @@ +#!/bin/perl +# -*- perl -*- +# Makefile. Generated from Makefile.in by configure. + +eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; esac' + if 0; + +# aclocal - create aclocal.m4 by scanning configure.ac + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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/share/automake-1.7'; + unshift @INC, $perllibdir; +} + +use Automake::General; +use Automake::XFile; + +# Some constants. +$VERSION = '1.7.1'; +$APIVERSION = '1.7'; +$PACKAGE = 'automake'; +# Note that this isn't pkgdatadir, but a separate directory. +# Note also that the versioned directory is handled later. +$acdir = '/usr/share/aclocal'; +$default_acdir = $acdir; +# 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. + +# Exit status. +$exit_status = 0; + +# Name of the top autoconf input: `configure.ac' or `configure.in'. +$configure_ac = find_configure_ac; + +# Text to output. +$output = ''; + +# Output file name. +$output_file = 'aclocal.m4'; + +# Which macros have been seen. +%macro_seen = (); + +# Which files have been seen. +%file_seen = (); + +# Map macro names to file names. +%map = (); + +# Map file names to file contents. +%file_contents = (); + +# 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 = "A[CU]_DEFUN\\((?:\\[([^]]+)\\]|([^],)\n]+))"; + +# Matches an AC_REQUIRE line. +$ac_require_rx = "AC_REQUIRE\\((?:\\[([^]]+)\\]|([^],)\n]+))\\)"; + + + +local (@dirlist) = &parse_arguments (@ARGV); +&scan_m4_files (@dirlist); +&scan_configure; +if (! $exit_status) +{ + &write_aclocal; +} +&check_acinclude; + +exit $exit_status; + +################################################################ + +# 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 + --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 '--verbose') + { + ++$verbose; + } + elsif ($arglist[0] eq '--version') + { + print "aclocal (GNU $PACKAGE) $VERSION\n\n"; + print "Copyright (C) 2002 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\n"; + print "Written by Tom Tromey \n"; + exit 0; + } + elsif ($arglist[0] eq '--help') + { + &usage (0); + } + else + { + die "aclocal: unrecognized option -- `$arglist[0]'\nTry `aclocal --help' for more information.\n"; + } + + shift (@arglist); + } + + if ($print_and_exit) + { + print $acdir, "\n"; + exit 0; + } + + $default_dirlist="$acdir/dirlist" + if $acdir ne $default_acdir; + + # Search the versioned directory near the end, and then the + # unversioned directory last. Only do this if the user didn't + # override acdir. + push (@dirlist, "$acdir-$APIVERSION") + if $acdir eq $default_acdir; + + # 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; +} + +################################################################ + +sub scan_configure () +{ + die "aclocal: `configure.ac' or `configure.in' is required\n" + if !$configure_ac; + + open (CONFIGURE, $configure_ac) + || die "aclocal: couldn't open `$configure_ac': $!\n"; + + # Make sure we include acinclude.m4 if it exists. + if (-f 'acinclude.m4') + { + &add_file ('acinclude.m4'); + } + + while () + { + # Remove comments from current line. + s/\bdnl\b.*$//; + s/\#.*$//; + + # Search for things we know about. The "search" sub is + # constructed dynamically by scan_m4_files. The last + # parenthethical 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. + warn "aclocal: $configure_ac: $.: macro `$2' not found in library\n"; + $exit_status = 1; + } + } + + close (CONFIGURE); +} + +################################################################ + +# Check macros in acinclude.m4. If one is not used, warn. +sub check_acinclude () +{ + local ($key); + + foreach $key (keys %map) + { + next unless $map{$key} eq 'acinclude.m4'; + if (! $macro_seen{$key}) + { + # FIXME: should print line number of acinclude.m4. + warn "aclocal: macro `$key' defined in acinclude.m4 but never used\n"; + } + } +} + +################################################################ + +# Scan all the installed m4 files and construct a map. +sub scan_m4_files (@) +{ + local (@dirlist) = @_; + + # First, scan acinclude.m4 if it exists. + if (-f 'acinclude.m4') + { + $file_contents{'acinclude.m4'} = &scan_file ('acinclude.m4'); + } + + local ($m4dir); + foreach $m4dir (@dirlist) + { + opendir (DIR, $m4dir) + || die "aclocal: couldn't open directory `$m4dir': $!\n"; + local ($file, $fullfile); + foreach $file (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 = $m4dir . '/' . $file; + $file_contents{$fullfile} = &scan_file ($fullfile); + } + closedir (DIR); + } + + # Construct a new function that does the searching. We use a + # function (instead of just evalling $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) = @_; + + # We want to ignore AC_ macros. However, if an AC_ macro is + # defined in (eg) acinclude.m4, then we want to make sure we mark + # it as seen. + return if $macro =~ /^AC_/ && ! defined $map{$macro}; + + if (! defined $map{$macro}) + { + warn "aclocal: macro `$macro' required but not defined\n"; + $exit_status = 1; + return; + } + + print STDERR "aclocal: saw macro $macro\n" if $verbose; + $macro_seen{$macro} = 1; + &add_file ($map{$macro}); +} + +# Add a file to output. +sub add_file ($) +{ + local ($file) = @_; + + # Only add a file once. + return if ($file_seen{$file}); + $file_seen{$file} = 1; + + $output .= $file_contents{$file} . "\n"; + my (@rlist); + foreach (split ("\n", $file_contents{$file})) + { + # Remove comments from current line. + s/\bdnl\b.*$//; + s/\#.*$//; + + if (/$ac_require_rx/g) + { + push (@rlist, $1 || $2); + } + + # The search function is constructed dynamically by + # scan_m4_files. The last parenthethical 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. + warn "aclocal: $configure_ac: $.: macro `$2' not found in library\n"; + $exit_status = 1; + } + } + + local ($macro); + foreach $macro (@rlist) + { + &add_macro ($macro); + } +} + +# Scan a single M4 file. Return contents. +sub scan_file ($) +{ + local ($file) = @_; + + my $fh = new Automake::XFile $file; + my $contents = ''; + while ($_ = $fh->getline) + { + # Ignore `##' lines. + next if /^##/; + + $contents .= $_; + + if (/$ac_defun_rx/) + { + if (! defined $map{$1 || $2}) + { + $map{$1 || $2} = $file; + } + + # 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: found macro $1 in $file: $.\n" if $verbose; + } + } + + return $contents; +} + +################################################################ + +# Write output. +sub write_aclocal () +{ + return if ! length ($output); + + print STDERR "aclocal: writing $output_file\n" if $verbose; + + my $out = new Automake::XFile "> $output_file"; + +# 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. + print $out +"# generated automatically by aclocal $VERSION -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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"; +} + +### 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 dissimilarity index 63% index e8d91fa4..447b771b 100644 --- a/bin/autoconf +++ b/bin/autoconf @@ -1,582 +1,271 @@ -#! /bin/sh -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -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+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - - - -# PATH needs CR -# 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 - -# Support unset when possible. -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -as_nl=' -' -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -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 -IFS=$as_save_IFS - - ;; -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_myself: error: cannot find myself; rerun with an absolute file name" >&2 - { (exit 1); exit 1; } -fi - -# Work around bugs in pre-3.0 UWIN ksh. -for as_var in ENV MAIL MAILPATH -do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var -done -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) >/dev/null 2>&1 && $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; 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'` - -# CDPATH. -$as_unset CDPATH - - -if test "x$CONFIG_SHELL" = x; then - if (eval ":") 2>/dev/null; then - as_have_required=yes -else - as_have_required=no -fi - - if test $as_have_required = yes && (eval ": -(as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0) || { (exit 1); exit 1; } -") 2> /dev/null; then - : -else - as_candidate_shells= - 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=. - case $as_dir in - /*) - for as_base in sh bash ksh sh5; do - as_candidate_shells="$as_candidate_shells $as_dir/$as_base" - done;; - esac -done -IFS=$as_save_IFS - - - for as_shell in $as_candidate_shells $SHELL; do - # Try only shells that exist, to save several forks. - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { ("$as_shell") 2> /dev/null <<\_ASEOF -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+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -_ASEOF -}; then - CONFIG_SHELL=$as_shell - as_have_required=yes - if { "$as_shell" 2> /dev/null <<\_ASEOF -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+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in - *posix*) set -o posix ;; -esac - -fi - - -: -(as_func_return () { - (exit $1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = "$1" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test $exitcode = 0) || { (exit 1); exit 1; } - -_ASEOF -}; then - break -fi - -fi - - done - - if test "x$CONFIG_SHELL" != x; then - for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} -fi - - - if test $as_have_required = no; then - echo This script requires a shell more modern than all the - echo shells that I found on your system. Please install a - echo modern shell, or manually run the script under such a - echo shell if you do have one. - { (exit 1); exit 1; } -fi - - -fi - -fi - - - -(eval "as_func_return () { - (exit \$1) -} -as_func_success () { - as_func_return 0 -} -as_func_failure () { - as_func_return 1 -} -as_func_ret_success () { - return 0 -} -as_func_ret_failure () { - return 1 -} - -exitcode=0 -if as_func_success; then - : -else - exitcode=1 - echo as_func_success failed. -fi - -if as_func_failure; then - exitcode=1 - echo as_func_failure succeeded. -fi - -if as_func_ret_success; then - : -else - exitcode=1 - echo as_func_ret_success failed. -fi - -if as_func_ret_failure; then - exitcode=1 - echo as_func_ret_failure succeeded. -fi - -if ( set x; as_func_ret_success y && test x = \"\$1\" ); then - : -else - exitcode=1 - echo positional parameters were not saved. -fi - -test \$exitcode = 0") || { - echo No shell found that supports shell functions. - echo Please tell autoconf@gnu.org about your system, - echo including any error possibly output before this - echo message -} - -# autoconf -- create `configure' using m4 macros - -# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, -# 2004, 2005, 2006 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, 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 variables \`M4' and \`WARNINGS' are 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.61 -Copyright (C) 2006 Free Software Foundation, Inc. -This is free software. You may redistribute copies of it under the terms of -the GNU General Public License . -There is NO WARRANTY, to the extent permitted by law. - -Written by David J. MacKenzie and Akim Demaille." - -help="\ -Try \`$as_me --help' for more information." - -exit_missing_arg="\ -echo \"$as_me: option \\\`\$1' requires an argument\" >&2 -echo \"\$help\" >&2 -exit 1" - -# Variables. -: ${AUTOM4TE='/usr/bin/autom4te'} -autom4te_options= -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 ;; - --help | -h ) - echo "$usage"; exit ;; - - --verbose | -v ) - verbose=echo - autom4te_options="$autom4te_options $1"; shift ;; - - # Arguments passed as is to autom4te. - --debug | -d | \ - --force | -f | \ - --include=* | -I?* | \ - --prepend-include=* | -B?* | \ - --warnings=* | -W?* ) - autom4te_options="$autom4te_options '$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_options="$autom4te_options $option '$2'" - shift; shift ;; - - --trace=* | -t?* ) - traces="$traces --trace='"`echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'" - shift ;; - --trace | -t ) - test $# = 1 && eval "$exit_missing_arg" - traces="$traces --trace='"`echo "$2" | sed "s/'/'\\\\\\\\''/g"`"'" - shift; shift ;; - --initialization | -i ) - autom4te_options="$autom4te_options --melt" - shift;; - - --output=* | -o?* ) - outfile=$optarg - shift ;; - --output | -o ) - test $# = 1 && eval "$exit_missing_arg" - outfile=$2 - shift; shift ;; - - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - exec >&2 - echo "$as_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 "$as_me: warning: both \`configure.ac' and \`configure.in' are present." >&2 - echo "$as_me: warning: proceeding with \`configure.ac'." >&2 - fi - infile=configure.ac - elif test -f configure.in; then - infile=configure.in - else - echo "$as_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 "$as_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 x $autom4te_options \ - --language=autoconf --output=\$outfile "$traces" \$infile -shift -$verbose "$as_me: running $AUTOM4TE $*" >&2 -exec "$AUTOM4TE" "$@" +#! /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 (FOO=FOO; unset 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 -n "`(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 +# 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.56 +Written by David J. MacKenzie and Akim Demaille. + +Copyright 2002 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/bin/autom4te'} +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 index 733509e6..5ccf6c5a 100644 --- a/bin/autoheader +++ b/bin/autoheader @@ -1,14 +1,13 @@ #! /bin/perl # -*- Perl -*- -# Generated from autoheader.in; do not edit by hand. +# @configure_input@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /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, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,28 +21,18 @@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; es # 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# 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/share/autoconf'; - 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'); + my $perllibdir = $ENV{'autom4te_perllibdir'} || '/usr/share/autoconf'; + unshift @INC, "$perllibdir"; } -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::Configure_ac; -use Autom4te::FileUtils; use Autom4te::General; use Autom4te::XFile; use strict; @@ -57,11 +46,13 @@ local $config_h; my $config_h_in; my @prepend_include; my @include; +my @warning; # $HELP # ----- -$help = "Usage: $0 [OPTION] ... [TEMPLATE-FILE] +$help = <<"END"; +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, @@ -74,26 +65,31 @@ or else \`configure.in\'. -f, --force consider all files obsolete -W, --warnings=CATEGORY report the warnings falling in CATEGORY -" . Autom4te::ChannelDefs::usage () . " +Warning categories include: + \`obsolete\' obsolete constructs + \`all\' all the warnings + \`no-CATEGORY\' turn off the warnings on CATEGORY + \`none\' turn off all the warnings + \`error\' warnings are error Library directories: -B, --prepend-include=DIR prepend directory DIR to search path -I, --include=DIR append directory DIR to search path Report bugs to . -"; +END # $VERSION # -------- -$version = "autoheader (GNU Autoconf) 2.61 -Copyright (C) 2006 Free Software Foundation, Inc. -This is free software. You may redistribute copies of it under the terms of -the GNU General Public License . -There is NO WARRANTY, to the extent permitted by law. - +$version = <<"END"; +autoheader (GNU Autoconf) 2.56 Written by Roland McGrath and Akim Demaille. -"; + +Copyright 2002 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +END ## ---------- ## @@ -108,14 +104,15 @@ sub parse_args () { my $srcdir; - parse_WARNINGS; - getopt ('I|include=s' => \@include, + getopt ('I|include=s' => \@include, 'B|prepend-include=s' => \@prepend_include, - 'W|warnings=s' => \&parse_warnings); + 'W|warnings=s' => \@warning); if (! @ARGV) { - my $configure_ac = require_configure_ac; + my $configure_ac = find_configure_ac; + error "no input file" + unless $configure_ac; push @ARGV, $configure_ac; } } @@ -126,7 +123,6 @@ sub parse_args () ## -------------- ## mktmpdir ('ah'); -switch_warning 'obsolete'; parse_args; # Preach. @@ -144,23 +140,23 @@ if ($config_h_top || $config_h_bot || $acconfig_h) is deprecated and discouraged. Using the third argument of \`AC_DEFINE\' and - \`AC_DEFINE_UNQUOTED\' allows one to define a template without + \`AC_DEFINE_UNQUOTED\' allows to define a template without \`acconfig.h\': - AC_DEFINE([NEED_FUNC_MAIN], 1, - [Define if a function \`main\' is needed.]) + AC_DEFINE([NEED_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; + print STDERR $msg; } # Set up autoconf. -my $autoconf = "'$autom4te' --language=autoconf "; -$autoconf .= join (' ', map { "--include='$_'" } @include); -$autoconf .= join (' ', map { "--prepend-include='$_'" } @prepend_include); +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; @@ -170,7 +166,7 @@ $autoconf .= ' --verbose' if $verbose; # ----------------------- # # Source what the traces are trying to tell us. -verb "$me: running $autoconf to trace from $ARGV[0]"; +verbose "$me: running $autoconf to trace from $ARGV[0]"; xsystem ("$autoconf" # If you change this list, update the # `Autoheader-preselections' section of autom4te.in. @@ -183,11 +179,8 @@ 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 $@; -unless ($config_h) - { - error "error: AC_CONFIG_HEADERS not found in $ARGV[0]"; - exit 1; - } +error "error: AC_CONFIG_HEADERS not found in $ARGV[0]" + unless $config_h; # We template only the first CONFIG_HEADER. $config_h =~ s/ .*//; @@ -269,10 +262,10 @@ $out->close; } foreach (sort keys %symbol) { - msg 'syntax', "warning: missing template: $_"; + print STDERR "$me: missing template: $_\n"; if ($suggest_ac_define) { - msg 'syntax', "Use AC_DEFINE([$_], [], [Description])"; + print STDERR "Use AC_DEFINE([$_], [], [Description])"; $suggest_ac_define = 0; } @@ -281,7 +274,7 @@ $out->close; if keys %symbol; } -update_file ("$tmp/config.hin", "$config_h_in", $force); +update_file ("$tmp/config.hin", "$config_h_in"); ### Setup "GNU" style for perl-mode and cperl-mode. ## Local Variables: diff --git a/bin/autom4te b/bin/autom4te index 65c3b169..ad8fde33 100644 --- a/bin/autom4te +++ b/bin/autom4te @@ -1,12 +1,12 @@ #! /bin/perl -w # -*- perl -*- -# Generated from autom4te.in; do not edit by hand. +# @configure_input@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; esac' if 0; # autom4te - Wrapper around M4 libraries. -# Copyright (C) 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -20,29 +20,214 @@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; es # 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. BEGIN { - my $datadir = $ENV{'autom4te_perllibdir'} || '/usr/share/autoconf'; - 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'); + my $datadir = ($ENV{'autom4te_perllibdir'} || '/usr/share/autoconf'); + unshift @INC, "$datadir"; } -use Autom4te::C4che; -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::FileUtils; +## --------- ## +## Request. ## +## --------- ## + +package Request; + +use Data::Dumper; use Autom4te::General; +use Autom4te::Struct; use Autom4te::XFile; +use Carp; +use strict; + +# List of requests. +# We can't declare it `my' as the loading, performed via `do', +# would refer to another scope, and @request would not be updated. +# It used to work with `my' vars, and I don't know whether the current +# behavior (5.6) is wanted or not. +use vars qw(@request); + +struct + ( + # The key of the cache files. + 'id' => "\$", + # True iff %MACRO contains all the macros we want to trace. + 'valid' => "\$", + # The include path. + 'path' => '@', + # The set of input files. + 'input' => '@', + # The set of macros currently traced. + 'macro' => '%', + ); + + +# $REQUEST-OBJ +# retrieve ($SELF, %ATTR) +# ----------------------- +# Find a request with the same path and input. +# Private. +sub retrieve +{ + my ($self, %attr) = @_; + + foreach (@request) + { + # Same path. + next + if join ("\n", @{$_->path}) ne join ("\n", @{$attr{path}}); + + # Same inputs. + next + if join ("\n", @{$_->input}) ne join ("\n", @{$attr{input}}); + + # Found it. + return $_; + } + + return undef; +} + + +# $REQUEST-OBJ +# register ($SELF, %ATTR) +# ----------------------- +# NEW should not be called directly. +# Private. +sub register ($%) +{ + my ($self, %attr) = @_; + + # path and input are the only ID for a request object. + my $obj = $self->new ('path' => $attr{path}, + 'input' => $attr{input}); + push @request, $obj; + + # Assign an id for cache file. + $obj->id ("$#request"); + + return $obj; +} + + +# $REQUEST-OBJ +# request($SELF, %REQUEST) +# ------------------------ +# Return a request corresponding to $REQUEST{path} and $REQUEST{input}, +# using a cache value if it exists. +sub request ($%) +{ + my ($self, %request) = @_; + + my $req = Request->retrieve (%request) || Request->register (%request); + + # If there are new traces to produce, then we are not valid. + foreach (@{$request{'macro'}}) + { + if (! exists ${$req->macro}{$_}) + { + ${$req->macro}{$_} = 1; + $req->valid (0); + } + } + + # It would be great to have $REQ check that it up to date wrt its + # dependencies, but that requires getting traces (to fetch the + # included files), which is out of the scope of Request + # (currently?). + + return $req; +} + +# Serialize a request or all the current requests. +sub marshall +{ + my ($caller) = @_; + my $res = ''; + + if (ref ($caller)) + { + # CALLER is an object: instance method. + my $marshall = Data::Dumper->new ([$caller]); + $marshall->Indent(2)->Terse(0); + $res = $marshall->Dump . "\n"; + } + else + { + # CALLER is the package: class method. + my $marshall = Data::Dumper->new ([\@request], [qw (*request)]); + $marshall->Indent(2)->Terse(0); + $res = $marshall->Dump . "\n"; + } + + return $res; +} + + +# includes_p (@MACRO) +# ------------------- +# Does this request covers all the @MACRO. +sub includes_p +{ + my ($self, @macro) = @_; + + foreach (@macro) + { + return 0 + if ! exists ${$self->macro}{$_}; + } + return 1; +} + + +# SAVE ($FILENAME) +# ---------------- +sub save +{ + my ($self, $filename) = @_; + + croak "$me: cannot save a single request\n" + if ref ($self); + + my $requests = new Autom4te::XFile ("> $filename"); + print $requests + "# This file was created by $me.\n", + "# It contains the lists of macros which have been traced.\n", + "# It can be safely removed.\n", + "\n", + $self->marshall; +} + + +# LOAD ($FILE) +# ------------ +sub load +{ + my ($self, $file) = @_; + + croak "$me: cannot load a single request\n" + if ref ($self); + + (my $return) = do "$file"; + + croak "$me: cannot parse $file: $@\n" if $@; + croak "$me: cannot do $file: $!\n" unless defined $return; + croak "$me: cannot run $file\n" unless $return; +} + + +## ---------- ## +## Autom4te. ## +## ---------- ## + +package Autom4te; + +use Autom4te::General; use File::Basename; +use Autom4te::XFile; use strict; # Data directory. @@ -60,12 +245,11 @@ my $mode = "0666"; my $melt = 0; # Names of the cache directory, cache directory index, trace cache -# prefix, and output cache prefix. And the IO objet for the index. +# prefix, and output cache prefix. my $cache; my $icache; my $tcache; my $ocache; -my $icache_file; # The macros to trace mapped to their format, as specified by the # user. @@ -76,26 +260,30 @@ my %trace; # `m4_pattern_allow' to check the output. # # FIXME: What about `sinclude'? -my @preselect = ('include', - 'm4_pattern_allow', 'm4_pattern_forbid', - '_m4_warn'); +my @preselect = ('include', 'm4_pattern_allow', 'm4_pattern_forbid'); + +# List of warnings. +my @warning; # M4 include path. my @include; +# 0 for EXIT_SUCCESS. +my $exit_status = 0; + # Do we freeze? my $freeze = 0; # $M4. my $m4 = $ENV{"M4"} || '/bin/m4'; # Some non-GNU m4's don't reject the --help option, so give them /dev/null. -fatal "need GNU m4 1.4 or later: $m4" +error "need GNU m4 1.4 or later: $m4" if system "$m4 --help &1 | grep reload-state >/dev/null"; # Set some high recursion limit as the default limit, 250, has already # been hit with AC_OUTPUT. Don't override the user's choice. $m4 .= ' --nesting-limit=1024' - if " $m4 " !~ / (--nesting-limit(=[0-9]+)?|-L[0-9]*) /; + if " $m4 " !~ / (--nesting-limit|-L) /; # @M4_BUILTIN -- M4 builtins and a useful comment. @@ -155,7 +343,8 @@ my %m4_builtin_alternate_name; # $HELP # ----- -$help = "Usage: $0 [OPTION] ... [FILES] +$help = << "EOF"; +Usage: $0 [OPTION] ... [FILES] Run GNU M4 on the FILES, avoiding useless runs. Output the traces if tracing, the frozen file if freezing, otherwise the expansion of the FILES. @@ -189,9 +378,16 @@ Languages include: \`M4sh\' create M4sh shell scripts \`M4sugar\' create M4sugar output -" . Autom4te::ChannelDefs::usage . " +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 variables \`M4\' and \`WARNINGS\' are honored. +The environment variable \`WARNINGS\' is honored. Library directories: -B, --prepend-include=DIR prepend directory DIR to search path @@ -205,18 +401,17 @@ Freezing: -F, --freeze produce an M4 frozen state file for FILES Report bugs to . -"; +EOF # $VERSION # -------- $version = <<"EOF"; -autom4te (GNU Autoconf) 2.61 -Copyright (C) 2006 Free Software Foundation, Inc. -This is free software. You may redistribute copies of it under the terms of -the GNU General Public License . -There is NO WARRANTY, to the extent permitted by law. - +autom4te (GNU Autoconf) 2.56 Written by Akim Demaille. + +Copyright 2002 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 @@ -270,7 +465,7 @@ sub load_configuration ($) my $type = shift @words; if ($type eq 'begin-language:') { - fatal "$file:$.: end-language missing for: $lang" + error "$file:$.: end-language missing for: $lang" if defined $lang; $lang = lc $words[0]; } @@ -282,7 +477,7 @@ sub load_configuration ($) } elsif ($type eq 'args:') { - fatal "$file:$.: no current language" + error "$file:$.: no current language" unless defined $lang; push @{$language{$lang}}, @words; } @@ -332,12 +527,11 @@ sub parse_args () # Process the arguments for real this time. my @trace; my @prepend_include; - parse_WARNINGS; getopt ( # Operation modes: "o|output=s" => \$output, - "W|warnings=s" => \&parse_warnings, + "W|warnings=s" => \@warning, "m|mode=s" => \$mode, "M|melt" => \$melt, @@ -361,7 +555,7 @@ sub parse_args () "no-cache" => sub { $cache = undef; }, ); - fatal "too few arguments + error "too few arguments Try `$me --help' for more information." unless @ARGV; @@ -370,7 +564,7 @@ Try `$me --help' for more information." # And it implies melting: there is risk not to update properly using # old frozen files, and worse yet: we could load a frozen file and # refreeze it! A sort of caching :) - fatal "cannot freeze and trace" + error "cannot freeze and trace" if $freeze && @trace; $melt = 1 if $freeze; @@ -449,20 +643,31 @@ sub handle_m4 ($@) { my ($req, @macro) = @_; - # GNU m4 appends when using --debugfile/--error-output. + # The warnings are the concatenation of 1. application's defaults, + # 2. $WARNINGS, $3 command line options, in that order. + # Set them in the order expected by the M4 macros: the converse. + my $m4_warnings = + lc join (',', reverse (split (',', ($ENV{'WARNINGS'} || '')), + map { split /,/ } @warning)); + + # GNU m4 appends when using --error-output. unlink ($tcache . $req->id . "t"); # Run m4. # + # Neutralize its stdin, so that GNU M4 1.5 doesn't neutralize SIGINT. + # # We don't output directly to the cache files, to avoid problems # when we are interrupted (that leaves corrupted files). xsystem ("$m4" . join (' --include=', '', @include) + . " --define=m4_warnings=$m4_warnings" . ' --debug=aflq' . (!exists $ENV{'AUTOM4TE_NO_FATAL'} ? ' --fatal-warning' : '') . " --error-output=$tcache" . $req->id . "t" . join (' --trace=', '', sort @macro) . " " . files_to_options (@ARGV) + . ' $ocache" . $req->id . "t"); # Everything went ok: preserve the outputs. @@ -470,7 +675,7 @@ sub handle_m4 ($@) { use File::Copy; move ("${file}t", "$file") - or fatal "cannot rename ${file}t as $file: $!"; + or error "cannot not rename ${file}t as $file: $!"; } } @@ -515,7 +720,7 @@ sub handle_output ($$) { my ($req, $output) = @_; - verb "creating $output"; + verbose "creating $output"; # Load the forbidden/allowed patterns. handle_traces ($req, "$tmp/patterns", @@ -528,10 +733,10 @@ sub handle_output ($$) my $forbidden = join ('|', map { /^forbid:([^:]+)/ } @patterns) || "^\$"; my $allowed = join ('|', map { /^allow:([^:]+)/ } @patterns) || "^\$"; - verb "forbidden tokens: $forbidden"; - verb "forbidden token : $_ => $forbidden{$_}" + verbose "forbidden tokens: $forbidden"; + verbose "forbidden token : $_ => $forbidden{$_}" foreach (sort keys %forbidden); - verb "allowed tokens: $allowed"; + verbose "allowed tokens: $allowed"; # Read the (cached) raw M4 output, produce the actual result. We # have to use the 2nd arg to have Autom4te::XFile honor the third, but then @@ -546,7 +751,7 @@ sub handle_output ($$) { $out->open($output, O_CREAT | O_WRONLY | O_TRUNC, oct ($mode)); } - fatal "cannot create $output: $!" + error "cannot create $output: $!" unless $out; my $in = new Autom4te::XFile ($ocache . $req->id); @@ -570,7 +775,7 @@ sub handle_output ($$) foreach (split (/\W+/)) { $prohibited{$_} = $. - if !/^$/ && /$forbidden/o && !/$allowed/o && ! exists $prohibited{$_}; + if /$forbidden/o && !/$allowed/o && ! exists $prohibited{$_}; } # Performed *last*: the empty quadrigraph. @@ -587,7 +792,7 @@ sub handle_output ($$) # This is unsatisfying but... my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b'; my $file = new Autom4te::XFile ($ARGV[$#ARGV]); - $exit_code = 1; + $exit_status = 1; while ($_ = $file->getline) { @@ -648,7 +853,7 @@ sub trace_format_to_m4 ($) } # $x, no separator given. elsif (s/^\$([fldn\$])//) - { + { $res .= $escape{$1}; } # $.x or ${sep}x. @@ -672,14 +877,14 @@ sub trace_format_to_m4 ($) } } elsif (/^(\$.)/) - { + { error "invalid escape: $1"; - } + } else - { + { s/^([^\$]+)//; $res .= $1; - } + } } $_ = $underscore; @@ -701,7 +906,7 @@ sub handle_traces ($$%) { my ($req, $output, %trace) = @_; - verb "formatting traces for `$output': " . join (', ', sort keys %trace); + verbose "formatting traces for `$output': ", join (', ', sort keys %trace); # Processing the traces. my $trace_m4 = new Autom4te::XFile (">$tmp/traces.m4"); @@ -719,27 +924,26 @@ sub handle_traces ($$%) # and no new line remains. define([_at_at], [at_ifelse([$#], [1], [], - [$#], [2], [[[$2]]], - [[[$2]][$1]$0([$1], at_shift(at_shift($@)))])]) + [$#], [2], [[[$2]]], + [[[$2]][$1]$0([$1], at_shift(at_shift($@)))])]) define([_at_percent], [at_ifelse([$#], [1], [], - [$#], [2], [at_flatten([$2])], - [at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) + [$#], [2], [at_flatten([$2])], + [at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) define([_at_star], [at_ifelse([$#], [1], [], - [$#], [2], [[$2]], - [[$2][$1]$0([$1], at_shift(at_shift($@)))])]) + [$#], [2], [[$2]], + [[$2][$1]$0([$1], at_shift(at_shift($@)))])]) # FLATTEN quotes its result. # Note that the second pattern is `newline, tab or space'. Don't lose # the tab! define([at_flatten], - [at_patsubst(at_patsubst(at_patsubst(at_patsubst([[[[$1]]]], [\\\n]), - [[\n\t ]+], [ ]), - [ *\(.\)$], [\1]), - [^ *\(.*\)], [[\1]])]) + [at_patsubst(at_patsubst(at_patsubst([[[$1]]], [\\\n]), + [[\n\t ]+], [ ]), + [^ *\(.*\) *$], [[\1]])]) define([at_args], [at_shift(at_shift(at_shift(at_shift(at_shift($@)))))]) define([at_at], [_$0([$1], at_args($@))]) @@ -834,7 +1038,7 @@ EOF # It makes no sense to try to transform __oline__. s/\@<:\@/[/g; s/\@:>\@/]/g; - s/\@S\|\@/\$/g; + s/\@\$\|\@/\$/g; s/\@%:\@/#/g; s/\@&t\@//g; print $out $_; @@ -920,7 +1124,7 @@ sub freeze ($) $result =~ s/#.*\n//g; $result =~ s/^\n//mg; - fatal "freezing produced output:\n$result" + error "freezing produced output:\n$result" if $result; # If freezing produces output, something went wrong: a bad `divert', @@ -940,7 +1144,7 @@ sub freeze ($) mktmpdir ('am4t'); load_configuration ($ENV{'AUTOM4TE_CFG'} || "$datadir/autom4te.cfg"); load_configuration ("$ENV{'HOME'}/.autom4te.cfg") - if exists $ENV{'HOME'} && -f "$ENV{'HOME'}/.autom4te.cfg"; + if -f "$ENV{'HOME'}/.autom4te.cfg"; load_configuration (".autom4te.cfg") if -f ".autom4te.cfg"; parse_args; @@ -949,32 +1153,26 @@ parse_args; if ($freeze) { freeze ($output); - exit $exit_code; + exit 0; } # We need our cache directory. if (! -d "$cache") { mkdir "$cache", 0755 - or fatal "cannot create $cache: $!"; + or error "cannot create $cache: $!"; } -# Open the index for update, and lock it. autom4te handles several -# files, but the index is the first and last file to be update, so -# locking it is sufficient. -$icache_file = new Autom4te::XFile $icache, O_RDWR|O_CREAT; -$icache_file->lock (LOCK_EX); - # Read the cache index if available and older than autom4te itself. -# If autom4te is younger, then some structures such as C4che, might +# If autom4te is younger, then some structures such as Request, might # have changed, which would corrupt its processing. -Autom4te::C4che->load ($icache_file) +Request->load ($icache) if -f $icache && mtime ($icache) > mtime ($0); # Add the new trace requests. -my $req = Autom4te::C4che->request ('input' => \@ARGV, - 'path' => \@include, - 'macro' => [keys %trace, @preselect]); +my $req = Request->request ('input' => \@ARGV, + 'path' => \@include, + 'macro' => [keys %trace, @preselect]); # If $REQ's cache files are not up to date, or simply if the user # discarded them (-f), declare it invalid. @@ -982,35 +1180,13 @@ $req->valid (0) if $force || ! up_to_date ($req); # We now know whether we can trust the Request object. Say it. -verb "the trace request object is:\n" . $req->marshall; +verbose "$me: the trace request object is:\n" . $req->marshall; -# We need to run M4 if (i) the user wants it (--force), (ii) $REQ is +# We need to run M4 if (i) the users wants it (--force), (ii) $REQ is # invalid. handle_m4 ($req, keys %{$req->macro}) if $force || ! $req->valid; -# Issue the warnings each time autom4te was run. -my $separator = "\n" . ('-' x 25) . " END OF WARNING " . ('-' x 25) . "\n\n"; -handle_traces ($req, "$tmp/warnings", - ('_m4_warn' => "\$1::\$f:\$l::\$2::\$3$separator")); -# Swallow excessive newlines. -for (split (/\n*$separator\n*/o, contents ("$tmp/warnings"))) -{ - # The message looks like: - # | syntax::input.as:5::ouch - # | ::input.as:4: baz is expanded from... - # | input.as:2: bar is expanded from... - # | input.as:3: foo is expanded from... - # | input.as:5: the top level - my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4); - msg $cat, $loc, "warning: $msg"; - for (split /\n/, $stacktrace) - { - my ($loc, $trace) = split (': ', $_, 2); - msg $cat, $loc, $trace; - } -} - # Now output... if (%trace) { @@ -1023,17 +1199,19 @@ if (%trace) } else { - # Actual M4 expansion, if the user wants it, or if $output is old - # (STDOUT is pretty old). + # Actual M4 expansion, only if $output is too old. STDOUT is + # pretty old. handle_output ($req, $output) - if $force || mtime ($output) < mtime ($ocache . $req->id); + if mtime ($output) < mtime ($ocache . $req->id); } -# If we ran up to here, the cache is valid. -$req->valid (1); -Autom4te::C4che->save ($icache_file); +# If all went fine, the cache is valid. +$req->valid (1) + if $exit_status == 0; + +Request->save ($icache); -exit $exit_code; +exit $exit_status; ### Setup "GNU" style for perl-mode and cperl-mode. ## Local Variables: diff --git a/bin/automake b/bin/automake index 8538ba83..22d974db 100644 --- a/bin/automake +++ b/bin/automake @@ -1,13 +1,13 @@ #!/bin/perl -w # -*- perl -*- -# Generated from automake.in; do not edit by hand. +# Makefile. Generated from Makefile.in by configure. eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /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, 2006 Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,28 +21,18 @@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; es # 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # Originally written by David Mackenzie . -# Perl reimplementation by Tom Tromey , and -# Alexandre Duret-Lutz . +# Perl reimplementation by Tom Tromey . package Language; BEGIN { - my $perllibdir = $ENV{'perllibdir'} || '/usr/share/automake-1.10'; - 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'}; + my $perllibdir = $ENV{'perllibdir'} || '/usr/share/automake-1.7'; + unshift @INC, $perllibdir; } use Automake::Struct; @@ -77,9 +67,6 @@ struct (# Short name of the language (c, f77...). # (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' => "\$", @@ -101,11 +88,7 @@ struct (# Short name of the language (c, f77...). # This is a subroutine which is called whenever we finally # determine the context in which a source file will be # compiled. - '_target_hook' => "\$", - - # If TRUE, nodist_ sources will be compiled using specific rules - # (i.e. not inference rules). The default is FALSE. - 'nodist_specific' => "\$"); + '_target_hook' => "\$"); sub finish ($) @@ -117,7 +100,7 @@ sub finish ($) } } -sub target_hook ($$$$%) +sub target_hook ($$$$) { my ($self) = @_; if (defined $self->_target_hook) @@ -128,37 +111,28 @@ sub target_hook ($$$$%) package Automake; -use strict; -use Automake::Config; +use strict 'vars', 'subs'; 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 File::Spec; use Carp; ## ----------- ## ## Constants. ## ## ----------- ## +# Parameters set by configure. Not to be changed. NOTE: assign +# VERSION as string so that eg version 0.30 will print correctly. +my $VERSION = '1.7.1'; +my $PACKAGE = 'automake'; +my $libdir = '/usr/share/automake-1.7'; + # 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 +# Writting singled-quoted-$-terminated regexes is a pain because +# perl-mode thinks of $' as the ${'} variable (intead 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 @@ -175,9 +149,12 @@ my $TARGET_PATTERN='[$a-zA-Z_.@%][-.a-zA-Z0-9_(){}/$+@%]*'; my $RULE_PATTERN = "^($TARGET_PATTERN(?:(?:\\\\\n|\\s)+$TARGET_PATTERN)*) *:([^=].*|)\$"; +my $SUFFIX_RULE_PATTERN = + '^(\.[a-zA-Z0-9_(){}$+@]+)(\.[a-zA-Z0-9_(){}$+@]+)' . "\$"; # 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 $MACRO_PATTERN = '^[.A-Za-z0-9_@]+' . "\$"; 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 @@ -189,23 +166,30 @@ 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|[+/.-])+'; +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*(#.*)?' . "\$"); +# This handles substitution references like ${foo:.a=.b}. +my $SUBST_REF_PATTERN = "^([^:]*):([^=]*)=(.*)\$"; + # 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.*)' . "\$"; +# Constants to define the "strictness" level. +use constant FOREIGN => 0; +use constant GNU => 1; +use constant GNITS => 2; + # Values for AC_CANONICAL_* -use constant AC_CANONICAL_BUILD => 1; -use constant AC_CANONICAL_HOST => 2; -use constant AC_CANONICAL_TARGET => 3; +use constant AC_CANONICAL_HOST => 1; +use constant AC_CANONICAL_SYSTEM => 2; # Values indicating when something should be cleaned. use constant MOSTLY_CLEAN => 0; @@ -222,31 +206,65 @@ my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh); # DISTFILES. my @common_files = (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB - COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO + COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO acinclude.m4 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), + configure configure.ac configure.in 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. +# Commonly used files we auto-include, but only sometimes. my @common_sometimes = - qw(aclocal.m4 acconfig.h config.h.top config.h.bot configure - configure.ac configure.in stamp-vti); + qw(aclocal.m4 acconfig.h config.h.top config.h.bot 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 dataroot dvi exec html include info - lib libexec lisp localstate man man1 man2 man3 - man4 man5 man6 man7 man8 man9 oldinclude pdf - pkgdatadir pkgincludedir pkglibdir ps sbin - sharedstate sysconf)); + 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)); + +# Declare the macros that define known variables, so we can +# hint the user if she try to use one of these variables. + +# Macros accessible via aclocal. +my %am_macro_for_var = + ( + ANSI2KNR => 'AM_C_PROTOTYPES', + CCAS => 'AM_PROG_AS', + CCASFLAGS => 'AM_PROG_AS', + EMACS => 'AM_PATH_LISPDIR', + GCJ => 'AM_PROG_GCJ', + LEX => 'AM_PROG_LEX', + LIBTOOL => 'AC_PROG_LIBTOOL', + lispdir => 'AM_PATH_LISPDIR', + pkgpyexecdir => 'AM_PATH_PYTHON', + pkgpythondir => 'AM_PATH_PYTHON', + pyexecdir => 'AM_PATH_PYTHON', + PYTHON => 'AM_PATH_PYTHON', + pythondir => 'AM_PATH_PYTHON', + U => 'AM_C_PROTOTYPES', + ); + +# Macros shipped with Autoconf. +my %ac_macro_for_var = + ( + CC => 'AC_PROG_CC', + CFLAGS => 'AC_PROG_CC', + CXX => 'AC_PROG_CXX', + CXXFLAGS => 'AC_PROG_CXX', + F77 => 'AC_PROG_F77', + F77FLAGS => 'AC_PROG_F77', + RANLIB => 'AC_PROG_RANLIB', + YACC => 'AC_PROG_YACC', + ); # Copyright on generated Makefile.ins. my $gen_copyright = "\ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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. @@ -257,7 +275,7 @@ my $gen_copyright = "\ # PARTICULAR PURPOSE. "; -# These constants are returned by the lang_*_rewrite functions. +# 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. @@ -269,12 +287,9 @@ use constant LANG_SUBDIR => 2; # 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 it's defined by Automake. We use INTERNAL in this case. -use constant INTERNAL => new Automake::Location; + ## ---------------------------------- ## ## Variables related to the options. ## ## ---------------------------------- ## @@ -282,6 +297,16 @@ use constant INTERNAL => new Automake::Location; # TRUE if we should always generate Makefile.in. my $force_generation = 1; +# Strictness level as set on command line. +my $default_strictness = GNU; + +# Name of strictness level, as set on command line. +my $default_strictness_name = 'gnu'; + +# This is TRUE if automatic dependency generation code should be +# included in generated Makefile.in. +my $cmdline_use_dependencies = 1; + # From the Perl manual. my $symlink_exists = (eval 'symlink ("", "");', $@ eq ''); @@ -299,17 +324,16 @@ my $force_missing = 0; ## Variables filled during files scanning. ## ## ---------------------------------------- ## -# Name of the configure.ac file. -my $configure_ac; +# Name of the top autoconf input: `configure.ac' or `configure.in'. +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 = (); +# Where AC_CONFIG_HEADER appears. +my $config_header_location; # Directory where output files go. Actually, output files are # relative to this directory. @@ -325,23 +349,14 @@ 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 = ''; +# Where the last AC_CONFIG_FILES/AC_OUTPUT appears. +my $ac_config_files_location; -# Directory to search for AC_LIBSOURCE files, as set by AC_CONFIG_LIBOBJ_DIR -# in configure.ac. -my $config_libobj_dir = ''; +# List of directories to search for configure-required files. This +# can be set by AC_CONFIG_AUX_DIR. +my @config_aux_path = qw(. .. ../..); +my $config_aux_dir = ''; +my $config_aux_dir_set_in_configure_in = 0; # Whether AM_GNU_GETTEXT has been seen in configure.ac. my $seen_gettext = 0; @@ -349,18 +364,9 @@ my $seen_gettext = 0; my $seen_gettext_external = 0; # Where AM_GNU_GETTEXT appears. my $ac_gettext_location; -# Whether AM_GNU_GETTEXT_INTL_SUBDIR has been seen. -my $seen_gettext_intl = 0; -# Lists of tags supported by Libtool. -my %libtool_tags = (); -# 1 if Libtool uses LT_SUPPORTED_TAG. If it does, then it also -# uses AC_REQUIRE_AUX_FILE. -my $libtool_new_api = 0; - -# Most important AC_CANONICAL_* macro seen so far. +# TRUE if we've seen AC_CANONICAL_(HOST|SYSTEM). my $seen_canonical = 0; -# Location of that macro. my $canonical_location; # Where AM_MAINTAINER_MODE appears. @@ -378,9 +384,6 @@ my $seen_multilib = 0; # TRUE if we've seen AM_PROG_CC_C_O my $seen_cc_c_o = 0; -# Location of AC_REQUIRE_AUX_FILE calls, indexed by their argument. -my %required_aux_file = (); - # Where AM_INIT_AUTOMAKE is called; my $seen_init_automake = 0; @@ -392,15 +395,13 @@ my $seen_automake_version = 0; # generation. my %configure_vars = (); -# Ignored configure substitutions (i.e., variables not to be output in -# Makefile.in) -my %ignored_configure_vars = (); +# This is used to keep track of which variable definitions we are +# scanning. It is only used in certain limited ways, but it has to be +# global. It is declared just for documentation purposes. +my %vars_scanned = (); -# Files included by $configure_ac. -my @configure_deps = (); - -# Greatest timestamp of configure's dependencies. -my $configure_deps_greatest_timestamp = 0; +# TRUE if --cygnus seen. +my $cygnus_mode = 0; # Hash table of AM_CONDITIONAL variables seen in configure. my %configure_cond = (); @@ -414,8 +415,6 @@ my $configure_dist_common = ''; # This maps languages names onto objects. my %languages = (); -# Maps each linker variable onto a language object. -my %link_languages = (); # List of targets we must always output. # FIXME: Complete, and remove falsely required targets. @@ -447,12 +446,23 @@ my %required_targets = '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; +# This is set to 1 when Automake needs to be run again. +# (For instance, this happens when an auxiliary file such as +# depcomp is added after the toplevel Makefile.in -- which +# should distribute depcomp -- has been generated.) +my $automake_needs_to_reprocess_all_files = 0; + +# Options set via AM_INIT_AUTOMAKE. +my $global_options = ''; -# The name of the Makefile currently being processed. -my $am_file = 'BUG'; +# Same as $suffix_rules (declared below), but records only the +# default rules supplied by the languages Automake supports. +my $suffix_rules_default; + +# If a file name appears as a key in this hash, then it has already +# been checked for. This variable is local to the "require file" +# functions. +my %require_file_found = (); ################################################################ @@ -469,13 +479,6 @@ my $am_relative_dir; my $in_file_name; my $relative_dir; -# Relative path to the top directory. -my $topsrcdir; - -# 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; @@ -484,18 +487,81 @@ 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. +# Suffixes found during a run. +my @suffixes; + +# Handling the variables. +# +# For a $VAR: +# - $var_value{$VAR}{$COND} is its value associated to $COND, +# - $var_location{$VAR}{$COND} is where it was defined, +# - $var_comment{$VAR}{$COND} are the comments associated to it. +# - $var_type{$VAR}{$COND} is how it has been defined (`', `+', or `:'), +# - $var_owner{$VAR}{$COND} tells who owns the variable (VAR_AUTOMAKE, +# VAR_CONFIGURE, or VAR_MAKEFILE). +my %var_value; +my %var_location; +my %var_comment; +my %var_type; +my %var_owner; +# Possible values for var_owner. Defined so that the owner of +# a variable can only be increased (e.g Automake should not +# override a configure or Makefile variable). +use constant VAR_AUTOMAKE => 0; # Variable defined by Automake. +use constant VAR_CONFIGURE => 1;# Variable defined in configure.ac. +use constant VAR_MAKEFILE => 2; # Variable defined in Makefile.am. + +# This holds a 1 if a particular variable was examined. +my %content_seen; + +# This holds the names which are targets. These also appear in +# %contents. $targets{TARGET}{COND} is the location of the definition +# of TARGET for condition COND. TARGETs should not include +# a trailing $(EXEEXT), we record this in %target_name. +my %targets; + +# $target_source{TARGET}{COND} is the filename where TARGET +# were defined for condition COND. Note this must be a +# filename, *without* any line number. +my %target_source; + +# $target_name{TARGET}{COND} is the real name of TARGET (in condition COND). +# The real name is often TARGET or TARGET$(EXEEXT), and TARGET never +# contain $(EXEEXT) +my %target_name; + +# $target_owner{TARGET}{COND} the owner of TARGET in condition COND. +my %target_owner; +use constant TARGET_AUTOMAKE => 0; # Target defined by Automake. +use constant TARGET_USER => 1; # Target defined in the user's Makefile.am. + +# This is the conditional stack. 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; +# Holds the dependencies of targets which dependencies are factored. +# Typically, `.PHONY' will appear in plenty of *.am files, but must +# be output once. Arguably all pure dependencies could be subject +# to this factorization, but it is not unpleasant to have paragraphs +# in Makefile: keeping related stuff altogether. +my %dependencies; + +# Holds the factored actions. Tied to %DEPENDENCIES, i.e., filled +# only when keys exists in %DEPENDENCIES. +my %actions; + # 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; @@ -528,27 +594,53 @@ my %object_compilation_map; # This keeps track of the directories for which we've already -# created dirstamp code. Keys are directories, values are stamp files. -# Several keys can share the same stamp files if they are equivalent -# (as are `.//foo' and `foo'). +# created `.dirstamp' code. my %directory_map; # All .P files. my %dep_files; +# Strictness levels. +my $strictness; +my $strictness_name; + +# Options from AUTOMAKE_OPTIONS. +my %options; + +# Whether or not dependencies are handled. Can be further changed +# in handle_options. +my $use_dependencies; + # This is a list of all targets to run during "make dist". my @dist_targets; -# Keep track of all programs declared in this Makefile, without -# $(EXEEXT). @substitution@ are not listed. -my %known_programs; - # 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 maps the source extension for all suffix rule seen to +# a \hash whose keys are the possible output extensions. +# +# Note that this is transitively closed by construction: +# if we have +# exists $suffix_rules{$ext1}{$ext2} +# && exists $suffix_rules{$ext2}{$ext3} +# then we also have +# exists $suffix_rules{$ext1}{$ext3} +# +# So it's easy to check whether '.foo' can be transformed to '.$(OBJEXT)' +# by checking whether $suffix_rules{'.foo'}{'.$(OBJEXT)'} exist. This +# will work even if transforming '.foo' to '.$(OBJEXT)' involves a chain +# of several suffix rules. +# +# The value of `$suffix_rules{$ext1}{$ext2}' is the a pair +# `[ $next_sfx, $dist ]' where `$next_sfx' is target suffix +# for the next rule to use to reach '$ext2', and `$dist' the +# distance to `$ext2'. +my $suffix_rules; + # This is the name of the redirect `all' target to use. my $all_target; @@ -575,44 +667,40 @@ my %linkers_used; # True if we need `LINK' defined. This is a hack. my $need_link; +# This is the list of such variables to output. +# FIXME: Might be useless actually. +my @var_list; + # 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; +# Contains a stack of `from' parts of variable substitutions currently in +# force. +my @substfroms; -# Cache each file processed by make_paragraphs. -# (This is different from %transformed_files because -# %transformed_files is reset for each file while %am_file_cache -# it global to the run.) -my %am_file_cache; +# Contains a stack of `to' parts of variable substitutions currently in +# force. +my @substtos; -################################################################ +# This keeps track of all variables defined by subobjname. +# The value stored is the variable names. +# The key has the form "(COND1)VAL1(COND2)VAL2..." where VAL1 and VAL2 +# are the values of the variable for condition COND1 and COND2. +my %subobjvar = (); -# 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); +# This hash records helper variables used to implement '+=' in conditionals. +# Keys have the form "VAR:CONDITIONS". The value associated to a key is +# the named of the helper variable used to append to VAR in CONDITIONS. +my %appendvar = (); -################################################################ ## --------------------------------- ## ## Forward subroutine declarations. ## ## --------------------------------- ## sub register_language (%); -sub file_contents_internal ($$$%); -sub define_files_variable ($\@$$); +sub file_contents_internal ($$%); +sub define_objects_from_sources ($$$$$$$); # &initialize_per_input () @@ -628,26 +716,81 @@ sub initialize_per_input () $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; + @suffixes = (); + + %var_value = (); + %var_location = (); + %var_comment = (); + %var_type = (); + %var_owner = (); + + %content_seen = (); + + %targets = (); + %target_source = (); + %target_name = (); + %target_owner = (); @cond_stack = (); @include_stack = (); + %dist_dirs = (); + @all = (); @check = (); @check_tests = (); + %dependencies = + ( + # Texinfoing. + 'dvi' => [], + 'dvi-am' => [], + 'pdf' => [], + 'pdf-am' => [], + 'ps' => [], + 'ps-am' => [], + 'info' => [], + 'info-am' => [], + + # Installing/uninstalling. + 'install-data-am' => [], + 'install-exec-am' => [], + 'uninstall-am' => [], + + 'install-man' => [], + 'uninstall-man' => [], + + 'install-info' => [], + 'install-info-am' => [], + 'uninstall-info' => [], + + 'installcheck-am' => [], + + # Cleaning. + 'clean-am' => [], + 'mostlyclean-am' => [], + 'maintainer-clean-am' => [], + 'distclean-am' => [], + 'clean' => [], + 'mostlyclean' => [], + 'maintainer-clean' => [], + 'distclean' => [], + + # Tarballing. + 'dist-all' => [], + + # Phoning. + '.PHONY' => [] + ); + %actions = (); + %clean_files = (); @sources = (); @@ -660,12 +803,29 @@ sub initialize_per_input () %dep_files = (); - @dist_targets = (); + $strictness = $default_strictness; + $strictness_name = $default_strictness_name; + + %options = (); - %known_programs = (); + $use_dependencies = $cmdline_use_dependencies; + + @dist_targets = (); %de_ansi_files = (); + + # The first time we initialize the variables, + # we save the value of $suffix_rules. + if (defined $suffix_rules_default) + { + $suffix_rules = $suffix_rules_default; + } + else + { + $suffix_rules_default = $suffix_rules; + } + $all_target = ''; %extension_seen = (); @@ -678,6 +838,8 @@ sub initialize_per_input () $need_link = 0; + @var_list = (); + $get_object_extension_was_run = 0; %compile_clean_files = (); @@ -685,12 +847,52 @@ sub initialize_per_input () # We always include `.'. This isn't strictly correct. %libtool_clean_directories = ('.' => 1); - %transformed_files = (); + %subobjvar = (); + + %appendvar = (); } ################################################################ +# Initialize our list of error/warning channels. +# Do not forget to update &usage and the manual +# if you add or change a warning channel. + +# Fatal errors. +register_channel 'fatal', type => 'fatal'; +# Common errors. +register_channel 'error', type => 'error'; +# Errors related to GNU Standards. +register_channel 'error-gnu', type => 'error'; +# Errors related to GNU Standards that should be warnings in `foreign' mode. +register_channel 'error-gnu/warn', type => 'error'; +# Errors related to GNITS Standards (silent by default). +register_channel 'error-gnits', type => 'error', silent => 1; +# Internal errors. +register_channel 'automake', type => 'fatal', backtrace => 1, + header => ("####################\n" . + "## Internal Error ##\n" . + "####################\n"), + footer => "\nPlease contact ."; + +# Warnings related to GNU Coding Standards. +register_channel 'gnu', type => 'warning'; +# Warnings about obsolete features (silent by default). +register_channel 'obsolete', type => 'warning', silent => 1; +# Warnings about non-portable constructs. +register_channel 'portability', type => 'warning', silent => 1; +# Weird syntax, unused variables, typos... +register_channel 'syntax', type => 'warning'; +# Warnings about unsupported (or mis-supported) features. +register_channel 'unsupported', type => 'warning'; + +# For &verb. +register_channel 'verb', type => 'debug', silent => 1; +# Informative messages. +register_channel 'note', type => 'debug', silent => 0; + + # Initialize our list of languages that are internally supported. # C. @@ -707,7 +909,6 @@ register_language ('name' => 'c', 'linker' => 'LINK', 'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', 'compile_flag' => '-c', - 'libtool_tag' => 'CC', 'extensions' => ['.c'], '_finish' => \&lang_c_finish); @@ -723,7 +924,6 @@ register_language ('name' => 'cxx', 'compiler' => 'CXXCOMPILE', 'compile_flag' => '-c', 'output_flag' => '-o', - 'libtool_tag' => 'CXX', 'lder' => 'CXXLD', 'ld' => '$(CXX)', 'pure' => 1, @@ -733,7 +933,7 @@ register_language ('name' => 'cxx', register_language ('name' => 'objc', 'Name' => 'Objective C', 'config_vars' => ['OBJC'], - 'linker' => 'OBJCLINK', + 'linker' => 'OBJCLINK',, 'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', 'autodep' => 'OBJC', 'flags' => ['OBJCFLAGS', 'CPPFLAGS'], @@ -746,23 +946,6 @@ register_language ('name' => 'objc', 'pure' => 1, 'extensions' => ['.m']); -# Unified Parallel C. -register_language ('name' => 'upc', - 'Name' => 'Unified Parallel C', - 'config_vars' => ['UPC'], - 'linker' => 'UPCLINK', - 'link' => '$(UPCLD) $(AM_UPCFLAGS) $(UPCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'UPC', - 'flags' => ['UPCFLAGS', 'CPPFLAGS'], - 'compile' => '$(UPC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_UPCFLAGS) $(UPCFLAGS)', - 'compiler' => 'UPCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'UPCLD', - 'ld' => '$(UPC)', - 'pure' => 1, - 'extensions' => ['.upc']); - # Headers. register_language ('name' => 'header', 'Name' => 'Header', @@ -785,8 +968,7 @@ register_language ('name' => 'yacc', return ($ext,) }, 'rule_file' => 'yacc', '_finish' => \&lang_yacc_finish, - '_target_hook' => \&lang_yacc_target_hook, - 'nodist_specific' => 1); + '_target_hook' => \&lang_yacc_target_hook); register_language ('name' => 'yaccxx', 'Name' => 'Yacc (C++)', 'config_vars' => ['YACC'], @@ -798,8 +980,7 @@ register_language ('name' => 'yaccxx', 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/y/c/; return ($ext,) }, '_finish' => \&lang_yacc_finish, - '_target_hook' => \&lang_yacc_target_hook, - 'nodist_specific' => 1); + '_target_hook' => \&lang_yacc_target_hook); # Lex (C & C++). register_language ('name' => 'lex', @@ -813,8 +994,7 @@ register_language ('name' => 'lex', 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/; return ($ext,) }, '_finish' => \&lang_lex_finish, - '_target_hook' => \&lang_lex_target_hook, - 'nodist_specific' => 1); + '_target_hook' => \&lang_lex_target_hook); register_language ('name' => 'lexxx', 'Name' => 'Lex (C++)', 'config_vars' => ['LEX'], @@ -826,8 +1006,7 @@ register_language ('name' => 'lexxx', 'output_extensions' => sub { (my $ext = $_[0]) =~ tr/l/c/; return ($ext,) }, '_finish' => \&lang_lex_finish, - '_target_hook' => \&lang_lex_target_hook, - 'nodist_specific' => 1); + '_target_hook' => \&lang_lex_target_hook); # Assembler. register_language ('name' => 'asm', @@ -835,30 +1014,12 @@ register_language ('name' => 'asm', 'config_vars' => ['CCAS', 'CCASFLAGS'], 'flags' => ['CCASFLAGS'], - # Users can set AM_CCASFLAGS to include DEFS, INCLUDES, - # or anything else required. They can also set CCAS. - # Or simply use Preprocessed Assembler. + # 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', - 'output_flag' => '-o', - 'extensions' => ['.s'], - - # With assembly we still use the C linker. - '_finish' => \&lang_c_finish); - -# Preprocessed Assembler. -register_language ('name' => 'cppasm', - 'Name' => 'Preprocessed Assembler', - 'config_vars' => ['CCAS', 'CCASFLAGS'], - - 'autodep' => 'CCAS', - 'flags' => ['CCASFLAGS', 'CPPFLAGS'], - 'compile' => '$(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS)', - 'compiler' => 'CPPASCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'extensions' => ['.S'], + 'extensions' => ['.s', '.S'], # With assembly we still use the C linker. '_finish' => \&lang_c_finish); @@ -866,7 +1027,6 @@ register_language ('name' => 'cppasm', # Fortran 77 register_language ('name' => 'f77', 'Name' => 'Fortran 77', - 'config_vars' => ['F77'], 'linker' => 'F77LINK', 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', 'flags' => ['FFLAGS'], @@ -874,44 +1034,10 @@ register_language ('name' => 'f77', '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', - 'config_vars' => ['FC'], - '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']); + 'extensions' => ['.f', '.for', '.f90']); # Preprocessed Fortran 77 # @@ -940,7 +1066,6 @@ register_language ('name' => 'ppf77', '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']); @@ -958,7 +1083,6 @@ register_language ('name' => 'ratfor', 'compiler' => 'RCOMPILE', 'compile_flag' => '-c', 'output_flag' => '-o', - 'libtool_tag' => 'F77', 'pure' => 1, 'extensions' => ['.r']); @@ -974,7 +1098,6 @@ register_language ('name' => 'java', 'compiler' => 'GCJCOMPILE', 'compile_flag' => '-c', 'output_flag' => '-o', - 'libtool_tag' => 'GCJ', 'lder' => 'GCJLD', 'ld' => '$(GCJ)', 'pure' => 1, @@ -982,8 +1105,108 @@ register_language ('name' => 'java', ################################################################ +# Parse the WARNINGS environnent variable. +&parse_WARNINGS; + +# Parse command line. +&parse_arguments; + +# Do configure.ac scan only once. +&scan_autoconf_files; + +&fatal ("no `Makefile.am' found or specified\n") + if ! @input_files; + +my $automake_has_run = 0; + +do +{ + if ($automake_has_run) + { + &verb ('processing Makefiles another time to fix them up.'); + &prog_error ('running more than two times should never be needed.') + if $automake_has_run >= 2; + } + $automake_needs_to_reprocess_all_files = 0; + + # Now do all the work on each file. + # This guy must be local otherwise it's private to the loop. + use vars '$am_file'; + local $am_file; + foreach $am_file (@input_files) + { + if (! -f ($am_file . '.am')) + { + &err ("`$am_file.am' does not exist"); + } + else + { + &generate_makefile ($output_files{$am_file}, $am_file); + } + } + ++$automake_has_run; +} +while ($automake_needs_to_reprocess_all_files); + +exit $exit_code; + +################################################################ + # Error reporting functions. +# prog_error ($MESSAGE, [%OPTIONS]) +# ------------------------------- +# Signal a programming error, display $MESSAGE, and exit 1. +sub prog_error ($;%) +{ + my ($msg, %opts) = @_; + msg 'automake', '', $msg, %opts; +} + +# err ($WHERE, $MESSAGE, [%OPTIONS]) +# err ($MESSAGE) +# ---------------------------------- +# Uncategorized errors. +sub err ($;$%) +{ + my ($where, $msg, %opts) = @_; + msg ('error', $where, $msg, %opts); +} + +# fatal ($WHERE, $MESSAGE, [%OPTIONS]) +# fatal ($MESSAGE) +# ---------------------------------- +# Fatal errors. +sub fatal ($;$%) +{ + my ($where, $msg, %opts) = @_; + msg ('fatal', $where, $msg, %opts); +} + +# err_var ($VARNAME, $MESSAGE, [%OPTIONS]) +# ---------------------------------------- +# Uncategorized errors about variables. +sub err_var ($$;%) +{ + msg_var ('error', @_); +} + +# err_target ($TARGETNAME, $MESSAGE, [%OPTIONS]) +# ---------------------------------------------- +# Uncategorized errors about targets. +sub err_target ($$;%) +{ + msg_target ('error', @_); +} + +# err_cond_target ($COND, $TARGETNAME, $MESSAGE, [%OPTIONS]) +# ---------------------------------------------------------- +# Uncategorized errors about conditional targets. +sub err_cond_target ($$$;%) +{ + msg_cond_target ('error', @_); +} + # err_am ($MESSAGE, [%OPTIONS]) # ----------------------------- # Uncategorized errors about the current Makefile.am. @@ -1000,6 +1223,46 @@ sub err_ac ($;%) msg_ac ('error', @_); } +# msg_cond_var ($CHANNEL, $COND, $VARNAME, $MESSAGE, [%OPTIONS]) +# -------------------------------------------------------------- +# Messages about conditional variable. +sub msg_cond_var ($$$$;%) +{ + my ($channel, $cond, $var, $msg, %opts) = @_; + msg $channel, $var_location{$var}{$cond}, $msg, %opts; +} + +# msg_var ($CHANNEL, $VARNAME, $MESSAGE, [%OPTIONS]) +# -------------------------------------------------- +# Messages about variables. +sub msg_var ($$$;%) +{ + my ($channel, $var, $msg, %opts) = @_; + # Don't know which condition is concerned. Pick any. + my $cond = (keys %{$var_value{$var}})[0]; + msg_cond_var $channel, $cond, $var, $msg, %opts; +} + +# msg_cond_target ($CHANNEL, $COND, $TARGETNAME, $MESSAGE, [%OPTIONS]) +# -------------------------------------------------------------------- +# Messages about conditional targets. +sub msg_cond_target ($$$$;%) +{ + my ($channel, $cond, $target, $msg, %opts) = @_; + msg $channel, $targets{$target}{$cond}, $msg, %opts; +} + +# msg_target ($CHANNEL, $TARGETNAME, $MESSAGE, [%OPTIONS]) +# -------------------------------------------------------- +# Messages about targets. +sub msg_target ($$$;%) +{ + my ($channel, $target, $msg, %opts) = @_; + # Don't know which condition is concerned. Pick any. + my $cond = (keys %{$targets{$target}})[0]; + msg_cond_target ($channel, $cond, $target, $msg, %opts); +} + # msg_am ($CHANNEL, $MESSAGE, [%OPTIONS]) # --------------------------------------- # Messages about about the current Makefile.am. @@ -1018,6 +1281,42 @@ sub msg_ac ($$;%) msg $channel, $configure_ac, $msg, %opts; } +# $BOOL +# reject_var ($VAR, $ERROR_MSG) +# ----------------------------- +sub reject_var ($$) +{ + my ($var, $msg) = @_; + if (variable_defined ($var)) + { + err_var $var, $msg; + return 1; + } + return 0; +} + +# $BOOL +# reject_target ($VAR, $ERROR_MSG) +# -------------------------------- +sub reject_target ($$) +{ + my ($target, $msg) = @_; + if (target_defined ($target)) + { + err_target $target, $msg; + return 1; + } + return 0; +} + +# verb ($MESSAGE, [%OPTIONS]) +# --------------------------- +sub verb ($;%) +{ + my ($msg, %opts) = @_; + msg 'verb', '', $msg, %opts; +} + ################################################################ # subst ($TEXT) @@ -1062,119 +1361,638 @@ sub backname ($) ################################################################ +# Pattern that matches all know input extensions (i.e. extensions used +# by the languages supported by Automake). Using this pattern +# (instead of `\..*$') to match extensions allows Automake to support +# dot-less extensions. +my $KNOWN_EXTENSIONS_PATTERN = ""; +my @known_extensions_list = (); -# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise. -sub handle_options +# accept_extensions (@EXTS) +# ------------------------- +# Update $KNOWN_EXTENSIONS_PATTERN to recognize the extensions +# listed @EXTS. Extensions should contain a dot if needed. +sub accept_extensions (@) +{ + push @known_extensions_list, @_; + $KNOWN_EXTENSIONS_PATTERN = + '(?:' . join ('|', map (quotemeta, @known_extensions_list)) . ')'; +} + +# var_SUFFIXES_trigger ($TYPE, $VALUE) +# ------------------------------------ +# This is called automagically by macro_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, and $KNOWN_EXTENSIONS_PATTERN +# are used when parsing the input am file. +sub var_SUFFIXES_trigger ($$) +{ + my ($type, $value) = @_; + accept_extensions (split (' ', $value)); +} + +################################################################ + + +# switch_warning ($CATEGORY) +# -------------------------- +# If $CATEGORY is mumble, turn on the mumble channel. +# If it's no-mumble, turn mumble off. +# Alse handle `all' and `none' for completeness. +sub switch_warning ($) { - my $var = var ('AUTOMAKE_OPTIONS'); - if ($var) + my ($cat) = @_; + my $has_no = 0; + + if ($cat =~ /^no-(.*)$/) { - if ($var->has_conditional_contents) - { - msg_var ('unsupported', $var, - "`AUTOMAKE_OPTIONS' cannot have conditional contents"); - } - foreach my $locvals ($var->value_as_list_recursive (cond_filter => TRUE, - location => 1)) - { - my ($loc, $value) = @$locvals; - return 1 if (process_option_list ($loc, $value)) - } + $cat = $1; + $has_no = 1; } - if ($strictness == GNITS) + if ($cat eq 'all') { - set_option ('readme-alpha', INTERNAL); - set_option ('std-options', INTERNAL); - set_option ('check-news', INTERNAL); + setup_channel_type 'warning', silent => $has_no; + } + elsif ($cat eq 'none') + { + setup_channel_type 'warning', silent => 1 - $has_no; + } + elsif ($cat eq 'error') + { + $warnings_are_errors = 1 - $has_no; + } + elsif (channel_type ($cat) eq 'warning') + { + setup_channel $cat, silent => $has_no; + } + else + { + return 1; } - 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 ($$) +# parse_WARNINGS +# -------------- +# Honor the WARNINGS environment variable. +sub parse_WARNINGS ($$) { - my ($varname, $where) = @_; - my $var = var $varname; - if ($var->has_conditional_contents) + if (exists $ENV{'WARNINGS'}) { - $varname = "am__${varname}_DIST"; - my @files = uniq ($var->value_as_list_recursive); - define_pretty_variable ($varname, TRUE, $where, @files); + # Ignore unknown categories. This is required because WARNINGS + # should be honored by many tools. + switch_warning $_ foreach (split (',', $ENV{'WARNINGS'})); } - return "\$($varname)" } -# get_object_extension ($EXTENSION) -# --------------------------------- -# Prefix $EXTENSION with $U if ansi2knr is in use. -sub get_object_extension ($) +# parse_warning ($OPTION, $ARGUMENT) +# ---------------------------------- +# Parse the argument of --warning=CATEGORY or -WCATEGORY. +sub parse_warnings ($$) { - my ($extension) = @_; - - # Check for automatic de-ANSI-fication. - $extension = '$U' . $extension - if option 'ansi2knr'; + my ($opt, $categories) = @_; - $get_object_extension_was_run = 1; - - return $extension; -} - -# check_user_variables (@LIST) -# ---------------------------- -# Make sure each variable VAR in @LIST does not exist, suggest using AM_VAR -# otherwise. -sub check_user_variables (@) -{ - my @dont_override = @_; - foreach my $flag (@dont_override) + foreach my $cat (split (',', $categories)) { - 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."); - } - } - } + msg 'unsupported', "unknown warning category `$cat'" + if switch_warning $cat; } } -# Call finish function for each language that was used. -sub handle_languages +# Parse command line. +sub parse_arguments () { - 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); + # Start off as gnu. + &set_strictness ('gnu'); - require_conf_file ("$am_file.am", FOREIGN, 'depcomp'); + my %options = + ( + 'libdir:s' => \$libdir, + 'gnu' => sub { &set_strictness ('gnu'); }, + 'gnits' => sub { &set_strictness ('gnits'); }, + 'cygnus' => \$cygnus_mode, + 'foreign' => sub { &set_strictness ('foreign'); }, + 'include-deps' => sub { $cmdline_use_dependencies = 1; }, + 'i|ignore-deps' => sub { $cmdline_use_dependencies = 0; }, + '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'; }, + ); - 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 + 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 garanty this + # if we treat other options first. (Handling other options first + # could produce error diagnostics, and in this condition it is + # confusing if Automake `exit 0'.) + my %options_1st_pass = + ( + 'version' => \&version, + 'help' => \&usage, + # Recognize all other options (and their arguments) but do nothing. + map { $_ => sub {} } (keys %options) + ); + my @ARGV_backup = @ARGV; + Getopt::Long::GetOptions %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 %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 = '.'; + } + + foreach my $arg (@ARGV) + { + if ($arg =~ /^-./) + { + fatal ("unrecognized option `$arg'\n" + . "Try `$0 --help' for more information."); + } + + # Handle $local:$input syntax. Note that we only examine the + # first ":" file to see if it is automake input; the rest are + # just taken verbatim. We still keep all the files around for + # dependency checking, however. + my ($local, $input, @rest) = split (/:/, $arg); + if (! $input) + { + $input = $local; + } + else + { + # Strip .in; later on .am is tacked on. That is how the + # automake input file is found. Maybe not the best way, but + # it is easy to explain. + $input =~ s/\.in$// + or fatal "invalid input file name `$arg'\n."; + } + push (@input_files, $input); + $output_files{$input} = join (':', ($local, @rest)); + } + + # Take global strictness from whatever we currently have set. + $default_strictness = $strictness; + $default_strictness_name = $strictness_name; +} + +################################################################ + +# 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 ($output, $makefile) = @_; + + # Reset all the Makefile.am related variables. + &initialize_per_input; + + # Any warning setting now local to this Makefile.am. + &dup_channel_setup; + # 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 file, + # other than to mark them as dependencies. See + # &scan_autoconf_files for details. + my (@secondary_inputs); + ($output, @secondary_inputs) = split (/:/, $output); + + $relative_dir = dirname ($output); + $am_relative_dir = dirname ($makefile); + + &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') + { + if (exists $var_owner{$var}) + { + prog_error "\$var_owner{$var}{TRUE} doesn't exist" + unless exists $var_owner{$var}{'TRUE'}; + reject_var $var, "`$var' should not be defined" + if $var_owner{$var}{'TRUE'} != VAR_AUTOMAKE; + } + } + + # Catch some obsolete variables. + msg_var ('obsolete', 'INCLUDES', + "`INCLUDES' is the old name for `AM_CPPFLAGS'") + if variable_defined ('INCLUDES'); + + # At the toplevel directory, we might need config.guess, config.sub + # or libtool scripts (ltconfig and ltmain.sh). + if ($relative_dir eq '.') + { + # AC_CANONICAL_HOST and AC_CANONICAL_SYSTEM need config.guess and + # config.sub. + require_conf_file ($canonical_location, FOREIGN, + 'config.guess', 'config.sub') + if $seen_canonical; + } + + # We still need Makefile.in here, because sometimes the `dist' + # target doesn't re-run automake. + if ($am_relative_dir eq $relative_dir) + { + # Only distribute the files if they are in the same subdir as + # the generated makefile. + &push_dist_common ($in_file_name, $am_file_name); + } + + push (@sources, '$(SOURCES)') + if variable_defined ('SOURCES'); + + # Must do this after reading .am file. See read_main_am_file to + # understand weird tricks we play there with variables. + &define_variable ('subdir', $relative_dir); + + # Check first, because we might modify some state. + &check_cygnus; + &check_gnu_standards; + &check_gnits_standards; + + &handle_configure ($output, $makefile, @secondary_inputs); + &handle_gettext; + &handle_libraries; + &handle_ltlibraries; + &handle_programs; + &handle_scripts; + + # This must run first so that the ANSI2KNR definition is generated + # before it is used by the _.c rules. We have to do this because + # a variable which is used in a dependency must be defined before + # the target, or else make won't properly see it. + &handle_compile; + # This must be run after all the sources are scanned. + &handle_languages; + + # We have to run this after dealing with all the programs. + &handle_libtool; + + # Re-init SOURCES. FIXME: other code shouldn't depend on this + # (but currently does). + macro_define ('SOURCES', VAR_AUTOMAKE, '', 'TRUE', "@sources", 'internal'); + define_pretty_variable ('DIST_SOURCES', '', @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 ($makefile); + + &handle_footer; + &do_check_merge_target; + &handle_all ($output); + + # FIXME: Gross! + if (variable_defined ('lib_LTLIBRARIES') && + variable_defined ('bin_PROGRAMS')) + { + $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n"; + } + + &handle_installdirs; + &handle_clean; + &handle_factored_dependencies; + + check_typos (); + + if (! -d ($output_directory . '/' . $am_relative_dir)) + { + mkdir ($output_directory . '/' . $am_relative_dir, 0755); + } + + my ($out_file) = $output_directory . '/' . $makefile . ".in"; + if (! $force_generation && -e $out_file) + { + my ($am_time) = (stat ($makefile . '.am'))[9]; + my ($in_time) = (stat ($out_file))[9]; + # FIXME: should cache these times. + my ($conf_time) = (stat ($configure_ac))[9]; + # FIXME: how to do unsigned comparison? + if ($am_time < $in_time || $am_time < $conf_time) + { + # No need to update. + return; + } + if (-f 'aclocal.m4') + { + my ($acl_time) = (stat _)[9]; + return if ($am_time < $acl_time); + } + } + + if (-e "$out_file") + { + unlink ($out_file) + or fatal "cannot remove $out_file: $!\n"; + } + my $gm_file = new Automake::XFile "> $out_file"; + verb "creating $makefile.in"; + + print $gm_file $output_vars; + # We make sure that `all:' is the first target. + print $gm_file $output_all; + print $gm_file $output_header; + print $gm_file $output_rules; + print $gm_file $output_trailer; + + # Back out any warning setting. + &drop_channel_setup; +} + +################################################################ + +# A version is a string that looks like +# MAJOR.MINOR[.MICRO][ALPHA][-FORK] +# where +# MAJOR, MINOR, and MICRO are digits, ALPHA is a character, and +# FORK any alphanumeric word. +# Usually, ALPHA is used to label alpha releases or intermediate snapshots, +# FORK is used for CVS branches or patched releases, and MICRO is used +# for bug fixes releases on the MAJOR.MINOR branch. +# +# For the purpose of ordering, 1.4 is the same as 1.4.0, but 1.4g is +# the same as 1.4.99g. The FORK identifier is ignored in the +# ordering, except when it looks like -pMINOR[ALPHA]: some versions +# were labelled like 1.4-p3a, this is the same as an alpha release +# labelled 1.4.3a. Yes it's horrible, but Automake did not support +# two-dot versions in the past. + +# version_split (VERSION) +# ----------------------- +# Split a version string into the corresponding (MAJOR, MINOR, MICRO, +# ALPHA, FORK) tuple. For instance "1.4g" would be split into +# (1, 4, 99, 'g', ''). +# Return () on error. +sub version_split ($) +{ + my ($ver) = @_; + + # Special case for versions like 1.4-p2a. + if ($ver =~ /^(\d+)\.(\d+)(?:-p(\d+)([a-z]+)?)$/) + { + return ($1, $2, $3, $4 || '', ''); + } + # Common case. + elsif ($ver =~ /^(\d+)\.(\d+)(?:\.(\d+))?([a-z])?(?:-([A-Za-z0-9]+))?$/) + { + return ($1, $2, $3 || (defined $4 ? 99 : 0), $4 || '', $5 || ''); + } + return (); +} + +# version_compare (\@LVERSION, \@RVERSION) +# ---------------------------------------- +# Return 1 if LVERSION > RVERSION, +# -1 if LVERSION < RVERSION, +# 0 if LVERSION = RVERSION. +sub version_compare (\@\@) +{ + my @l = @{$_[0]}; + my @r = @{$_[1]}; + + for my $i (0, 1, 2) + { + return 1 if ($l[$i] > $r[$i]); + return -1 if ($l[$i] < $r[$i]); + } + for my $i (3, 4) + { + return 1 if ($l[$i] gt $r[$i]); + return -1 if ($l[$i] lt $r[$i]); + } + return 0; +} + +# Handles the logic of requiring a version number in AUTOMAKE_OPTIONS. +# Return 0 if the required version is satisfied, 1 otherwise. +sub version_check ($) +{ + my ($required) = @_; + my @version = version_split $VERSION; + my @required = version_split $required; + + prog_error "version is incorrect: $VERSION" + if $#version == -1; + + # This should not happen, because process_option_list and split_version + # use similar regexes. + prog_error "required version is incorrect: $required" + if $#required == -1; + + # If we require 3.4n-foo then we require something + # >= 3.4n, with the `foo' fork identifier. + return 1 + if ($required[4] ne '' && $required[4] ne $version[4]); + + return 0 > version_compare @version, @required; +} + +# $BOOL +# process_option_list ($CONFIG, @OPTIONS) +# ------------------------------ +# Process a list of options. Return 1 on error, 0 otherwise. +# This is a helper for handle_options. CONFIG is true if we're +# handling global options. +sub process_option_list +{ + my ($config, @list) = @_; + + # FIXME: We should disallow conditional deffinitions of AUTOMAKE_OPTIONS. + my $where = ($config ? + $seen_init_automake : + $var_location{'AUTOMAKE_OPTIONS'}{'TRUE'}); + + foreach (@list) + { + $options{$_} = 1; + if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign') + { + &set_strictness ($_); + } + elsif ($_ eq 'cygnus') + { + $cygnus_mode = 1; + } + elsif (/^(.*\/)?ansi2knr$/) + { + # An option like "../lib/ansi2knr" is allowed. With no + # path prefix, we assume the required programs are in this + # directory. We save the actual option for later. + $options{'ansi2knr'} = $_; + } + elsif ($_ eq 'no-installman' || $_ eq 'no-installinfo' + || $_ eq 'dist-shar' || $_ eq 'dist-zip' + || $_ eq 'dist-tarZ' || $_ eq 'dist-bzip2' + || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex' + || $_ eq 'readme-alpha' || $_ eq 'check-news' + || $_ eq 'subdir-objects' || $_ eq 'nostdinc' + || $_ eq 'no-exeext' || $_ eq 'no-define' + || $_ eq 'std-options') + { + # Explicitly recognize these. + } + elsif ($_ eq 'no-dependencies') + { + $use_dependencies = 0; + } + elsif (/^\d+\.\d+(?:\.\d+)?[a-z]?(?:-[A-Za-z0-9]+)?$/) + { + # Got a version number. + if (version_check $&) + { + err ($where, "require Automake $_, but have $VERSION", + uniq_scope => US_GLOBAL); + return 1; + } + } + elsif (/^(?:--warnings=|-W)(.*)$/) + { + foreach my $cat (split (',', $1)) + { + msg 'unsupported', $where, "unknown warning category `$cat'" + if switch_warning $cat; + } + } + else + { + err ($where, "option `$_' not recognized", + uniq_scope => US_GLOBAL); + return 1; + } + } +} + +# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise. +sub handle_options +{ + # Process global options first so that more specific options can + # override. + if (&process_option_list (1, split (' ', $global_options))) + { + return 1; + } + + if (variable_defined ('AUTOMAKE_OPTIONS')) + { + if (&process_option_list (0, &variable_value_as_list_recursive ('AUTOMAKE_OPTIONS', ''))) + { + return 1; + } + } + + if ($strictness == GNITS) + { + $options{'readme-alpha'} = 1; + $options{'std-options'} = 1; + $options{'check-news'} = 1; + } + + return 0; +} + + +# get_object_extension ($OUT) +# --------------------------- +# Return object extension. Just once, put some code into the output. +# OUT is the name of the output file +sub get_object_extension +{ + my ($out) = @_; + + # Maybe require libtool library object files. + my $extension = '.$(OBJEXT)'; + $extension = '.lo' if ($out =~ /\.la$/); + + # Check for automatic de-ANSI-fication. + $extension = '$U' . $extension + if defined $options{'ansi2knr'}; + + $get_object_extension_was_run = 1; + + return $extension; +} + + +# Call finish function for each language that was used. +sub handle_languages +{ + if ($use_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) $config_aux_dir/depcomp"); + &define_variable ('am__depfiles_maybe', 'depfiles'); + + require_conf_file ("$am_file.am", FOREIGN, 'depcomp'); + + my @deplist = sort keys %dep_files; + + # We define this as a conditional variable because BSD + # make can't handle backslashes for continuing comments on + # the following line. + define_pretty_variable ('DEP_FILES', 'AMDEP_TRUE', @deplist); + + # 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) @@ -1191,14 +2009,13 @@ sub handle_languages # 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); + &define_variable ('depcomp', ''); + &define_variable ('am__depfiles_maybe', ''); } my %done; @@ -1217,9 +2034,10 @@ sub handle_languages 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 $AMDEP = (($use_dependencies && $lang->autodep ne 'no') + ? 'AMDEP' : 'FALSE'); + my $FASTDEP = (($use_dependencies && $lang->autodep ne 'no') + ? ('am__fastdep' . $fpfx) : 'FALSE'); my %transform = ('EXT' => $ext, 'PFX' => $pfx, @@ -1227,15 +2045,11 @@ sub handle_languages 'AMDEP' => $AMDEP, 'FASTDEP' => $FASTDEP, '-c' => $lang->compile_flag || '', - # These are not used, but they need to be defined - # so &transform do not complain. - SUBDIROBJ => 0, - 'DERIVED-EXT' => 'BUG', - DIST_SOURCE => 1, - ); + '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') + if (($use_dependencies && $lang->autodep ne 'no') || defined $lang->compile) { # Some C compilers don't support -c -o. Use it only if really @@ -1244,52 +2058,33 @@ sub handle_languages $output_flag = '-o' if (! $output_flag && $lang->name eq 'c' - && option 'subdir-objects'); + && defined $options{'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 - # needs to 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, + 'GENERIC' => 1, 'DERIVED-EXT' => $der_ext, - DEPBASE => $depbase, - BASE => '$*', - SOURCE => '$<', - OBJ => '$@', - OBJOBJ => '$@', - LTOBJ => '$@', + # In this situation we know that the + # object is in this directory, so + # $(DEPDIR) is the correct location for + # dependencies. + 'DEPBASE' => '$(DEPDIR)/$*', + 'BASE' => '$*', + 'SOURCE' => '$<', + 'OBJ' => '$@', + 'OBJOBJ' => '$@', + 'LTOBJ' => '$@', - COMPILE => '$(' . $lang->compiler . ')', - LTCOMPILE => '$(LT' . $lang->compiler . ')', - -o => $output_flag, - SUBDIROBJ => !! option 'subdir-objects'); + 'COMPILE' => '$(' . $lang->compiler . ')', + 'LTCOMPILE' => '$(LT' . $lang->compiler . ')', + '-o' => $output_flag); } # Now include code for each specially handled object with this @@ -1297,7 +2092,15 @@ sub handle_languages my %seen_files = (); foreach my $file (@{$lang_specific_files{$lang->name}}) { - my ($derived, $source, $obj, $myext, %file_transform) = @$file; + my ($derived, $source, $obj, $myext) = split (' ', $file); + + # For any specially-generated object, we must respect the + # ansi2knr setting so that we don't inadvertently try to + # use the default rule. + if ($lang->ansi && defined $options{'ansi2knr'}) + { + $myext = '$U' . $myext; + } # We might see a given object twice, for instance if it is # used under different conditions. @@ -1310,27 +2113,16 @@ sub handle_languages my $obj_compile = $lang->compile; - # Rewrite each occurrence of `AM_$flag' in the compile + # Rewrite each occurence 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 . ' ' + if variable_defined ($val); } - my $ptltflags = "${derived}_LIBTOOLFLAGS"; - $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags; - - my $obj_ltcompile = - "\$(LIBTOOL) $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) " - . "--mode=compile $obj_compile"; + my $obj_ltcompile = '$(LIBTOOL) --mode=compile ' . $obj_compile; # We _need_ `-o' for per object rules. my $output_flag = $lang->output_flag || '-o'; @@ -1342,116 +2134,27 @@ sub handle_languages 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; - } - } - + # Generate a transform which will turn suffix targets in + # depend2.am into real targets for the particular objects we + # are building. $output_rules .= file_contents ($rule_file, - new Automake::Location, - %transform, - GENERIC => 0, + (%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", + '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); + 'COMPILE' => $obj_compile, + 'LTCOMPILE' => $obj_ltcompile, + '-o' => $output_flag)); } # The rest of the loop is done once per language. @@ -1461,12 +2164,10 @@ sub handle_languages # 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); + $output_rules .= file_contents ('lang-compile', %transform, %lang); # If the source to a program consists entirely of code from a - # `pure' language, for instance C++ or Fortran 77, then we + # `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. @@ -1480,25 +2181,41 @@ sub handle_languages if ($lang->link); require_variables ("$am_file.am", $lang->Name . " source seen", - TRUE, @{$lang->config_vars}); + '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... + # they should not be overriden in the Makefile... my @dont_override = @{$lang->flags}; # ... and so is LDFLAGS. push @dont_override, 'LDFLAGS' if $lang->link; - check_user_variables @dont_override; + foreach my $flag (@dont_override) + { + if (exists $var_owner{$flag}) + { + for my $cond (keys %{$var_owner{$flag}}) + { + if ($var_owner{$flag}{$cond} == 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 $need_link || ((scalar keys %$suffix_rules) + - (scalar keys %$suffix_rules_default)) > 1; if ($needs_c) { @@ -1508,32 +2225,6 @@ sub handle_languages } } - -# append_exeext { PREDICATE } $MACRO -# ---------------------------------- -# Append $(EXEEXT) to each filename in $F appearing in the Makefile -# variable $MACRO if &PREDICATE($F) is true. @substitutions@ are -# ignored. -# -# This is typically used on all filenames of *_PROGRAMS, and filenames -# of TESTS that are programs. -sub append_exeext (&$) -{ - my ($pred, $macro) = @_; - - 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)' - if $val !~ /(?:\$\(EXEEXT\)$|^[@]\w+[@]$)/ && &$pred ($val); - return $val; - }); -} - - # 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 @@ -1545,23 +2236,23 @@ sub check_libobjs_sources foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', 'dist_EXTRA_', 'nodist_EXTRA_') { - my @files; - my $varname = $prefix . $one_file . '_SOURCES'; - my $var = var ($varname); - if ($var) + my @files; + if (variable_defined ($prefix . $one_file . '_SOURCES')) { - @files = $var->value_as_list_recursive; + @files = &variable_value_as_list_recursive ( + ($prefix . $one_file . '_SOURCES'), + 'all'); } - elsif ($prefix eq '') + elsif ($prefix eq '') { - @files = ($unxformed . '.c'); + @files = ($unxformed . '.c'); } - else + else { - next; + next; } - foreach my $file (@files) + foreach my $file (@files) { err_var ($prefix . $one_file . '_SOURCES', "automatically discovered file `$file' should not" . @@ -1573,23 +2264,20 @@ sub check_libobjs_sources # @OBJECTS -# handle_single_transform ($VAR, $TOPPARENT, $DERIVED, $OBJ, $FILE, %TRANSFORM) -# ----------------------------------------------------------------------------- +# handle_single_transform_list ($VAR, $TOPPARENT, $DERIVED, $OBJ, @FILES) +# ----------------------------------------------------------------------- # 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 +# @FILES is the list of source files to transform # Result is a list of the names of objects # %linkers_used will be updated with any linkers needed -sub handle_single_transform ($$$$$%) +sub handle_single_transform_list ($$$$@) { - my ($var, $topparent, $derived, $obj, $_file, %transform) = @_; - my @files = ($_file); + my ($var, $topparent, $derived, $obj, @files) = @_; my @result = (); my $nonansi_obj = $obj; $nonansi_obj =~ s/\$U//g; @@ -1603,14 +2291,11 @@ sub handle_single_transform ($$$$$%) # 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; + err_var ($var, + "`$var' includes configure substitution `$_', and is " . + "referred to\nfrom `$topparent': configure " . + "substitutions are not allowed\nin _SOURCES variables"); + next; } # If the source file is in a subdirectory then the `.o' is put @@ -1623,12 +2308,13 @@ sub handle_single_transform ($$$$$%) my $directory = $1 || ''; my $base = $2; my $extension = $3; + my $full_ansi = $full; # We'll add `$U' if needed. # 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. + # This records whether we've seen a derived source file (eg, # yacc output). my $derived_source = 0; @@ -1647,19 +2333,6 @@ sub handle_single_transform ($$$$$%) # Found the language, so see what it says. &saw_extension ($extension); - # Do we have per-executable flags for this executable? - my $have_per_exec_flags = 0; - my @peflags = @{$lang->flags}; - push @peflags, 'LIBTOOLFLAGS' if $nonansi_obj eq '.lo'; - foreach my $flag (@peflags) - { - if (set_seen ("${derived}_$flag")) - { - $have_per_exec_flags = 1; - last; - } - } - # 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 @@ -1667,10 +2340,9 @@ sub handle_single_transform ($$$$$%) # 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 $subr = 'lang_' . $lang->name . '_rewrite'; my ($r, $source_extension) - = &$subr ($directory, $base, $extension, - $nonansi_obj, $have_per_exec_flags, $var); + = & $subr ($directory, $base, $extension); # Skip this entry if we were asked not to process it. next if $r == LANG_IGNORE; @@ -1693,31 +2365,46 @@ sub handle_single_transform ($$$$$%) } $object = $base . $this_obj_ext; - 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 choose the name `DERIVED_OBJECT' to ensure - # (1) uniqueness, and (2) continuity between - # invocations. However, this will result in a + # Do we have per-executable flags for this executable? + my $have_per_exec_flags = 0; + foreach my $flag (@{$lang->flags}) + { + if (variable_defined ("${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) + if (variable_defined ($derived . '_SHORTNAME')) { - # FIXME: should use the same Condition as + # FIXME: should use the same conditional as # the _SOURCES variable. But this is really # silly overkill -- nobody should have # conditional shortnames. - $dname = $var->variable_value; + $dname = &variable_value ($derived . '_SHORTNAME'); } $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; @@ -1731,78 +2418,49 @@ sub handle_single_transform ($$$$$%) $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 occurred - # 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') - # We must also use specific rules for a nodist_ source - # if its language requests it. - || ($lang->nodist_specific && ! $transform{'DIST_SOURCE'})) + # If doing dependency tracking, then we can't print + # the rule. If we have a subdir object, we need to + # generate an explicit rule. Actually, in any case + # where the object is not in `.' we need a special + # rule. The per-object rules in this case are + # generated later, by handle_languages. + if ($renamed || $directory ne '') { my $obj_sans_ext = substr ($object, 0, - length ($this_obj_ext)); - my $full_ansi = $full; - if ($lang->ansi && option 'ansi2knr') + if ($lang->ansi && defined $options{'ansi2knr'}) { $full_ansi =~ s/$KNOWN_EXTENSIONS_PATTERN$/\$U$&/; - $obj_sans_ext .= '$U'; + $full_ansi = basename $full_ansi + unless defined $options{'subdir-objects'}; } - 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')); + my $val = ("$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; + { + $val = "$derived $val"; $aggregate = $derived; - } + } else - { - unshift @specifics, 'AM'; - } + { + $val = "AM $val"; + } - # 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 + # Each item on this list is a string consisting of + # four space-separated values: the derived flag prefix + # (eg, 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]); + push (@{$lang_specific_files{$lang->name}}, $val); } } elsif ($extension eq $nonansi_obj) @@ -1810,7 +2468,6 @@ sub handle_single_transform ($$$$$%) # This is probably the result of a direct suffix rule. # In this case we just accept the rewrite. $object = "$base$extension"; - $object = "$directory/$object" if $directory ne ''; $linker = ''; } else @@ -1838,14 +2495,14 @@ sub handle_single_transform ($$$$$%) != (COMPILE_LIBTOOL | COMPILE_ORDINARY)) && $object_compilation_map{$comp_obj} != $comp_val) { - err_am "object `$comp_obj' created both with libtool and without"; + err_am "object `$object' 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); + $lang->target_hook ($aggregate, $object, $full); } if ($derived_source) @@ -1871,6 +2528,13 @@ sub handle_single_transform ($$$$$%) my @dep_list = (); $object_map{$object} = $full; + # If file is in subdirectory, we need explicit + # dependency. + if ($directory ne '' || $renamed) + { + push (@dep_list, $full_ansi); + } + # If resulting object is in subdir, we need to make # sure the subdir exists at build time. if ($object =~ /\//) @@ -1880,7 +2544,7 @@ sub handle_single_transform ($$$$$%) # For Java, the way we're handling it right now, a # `..' component doesn't make sense. - if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//) + if ($lang->name eq 'java' && $object =~ /(\/|^)\.\.\//) { err_am "`$full' should not contain a `..' component"; } @@ -1905,7 +2569,7 @@ sub handle_single_transform ($$$$$%) # .deps directory is created. push (@dep_list, require_build_directory ($directory . '/$(DEPDIR)')) - unless option 'no-dependencies'; + if $use_dependencies; } &pretty_print_rule ($object . ':', "\t", @dep_list) @@ -1920,18 +2584,17 @@ sub handle_single_transform ($$$$$%) $depfile =~ s/\.([^.]*)$/.P$1/; $depfile =~ s/\$\(OBJEXT\)$/o/; $dep_files{dirname ($depfile) . '/$(DEPDIR)/' - . basename ($depfile)} = 1; + . basename ($depfile)} = 1; } } return @result; } - -# $LINKER +# ($LINKER, $OBJVAR) # define_objects_from_sources ($VAR, $OBJVAR, $NODEFINE, $ONE_FILE, -# $OBJ, $PARENT, $TOPPARENT, $WHERE, %TRANSFORM) -# --------------------------------------------------------------------------- +# $OBJ, $PARENT, $TOPPARENT) +# --------------------------------------------------------------------- # Define an _OBJECTS variable for a _SOURCES variable (or subvariable) # # Arguments are: @@ -1941,55 +2604,173 @@ sub handle_single_transform ($$$$$%) # $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'). +# $OBJ is the object extension (ie either `.o' or `.lo'). +# $PARENT is the variable in which $VAR is used, or $VAR if not applicable. # $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 ($$$$$$$%) +# $LINKER is a boolean, true if a linker is needed to deal with the objects, +# $OBJVAR is the name of the variable defined to hold the objects. +# +# %linkers_used, %vars_scanned, @substfroms and @substtos should be cleared +# before use: +# %linkers_used variable will be set to contain the linkers desired. +# %vars_scanned will be used to check for recursive definitions. +# @substfroms and @substtos will be used to keep a stack of variable +# substitutions to be applied. +# +sub define_objects_from_sources ($$$$$$$) { - my ($var, $objvar, $nodefine, $one_file, - $obj, $topparent, $where, %transform) = @_; + my ($var, $objvar, $nodefine, $one_file, $obj, $parent, $topparent) = @_; - my $needlinker = ""; + if (defined $vars_scanned{$var}) + { + err_var $var, "variable `$var' recursively defined"; + return ""; + } + $vars_scanned{$var} = 1; + + my $needlinker = ""; + my @allresults = (); + foreach my $cond (variable_conditions ($var)) + { + my @result; + foreach my $val (&variable_value_as_list ($var, $cond, $parent)) + { + # If $val is a variable (i.e. ${foo} or $(bar), not a filename), + # handle the sub variable recursively. + if ($val =~ /^\$\{([^}]*)\}$/ || $val =~ /^\$\(([^)]*)\)$/) + { + my $subvar = $1; + + # If the user uses a losing variable name, just ignore it. + # This isn't ideal, but people have requested it. + next if ($subvar =~ /\@.*\@/); + + # See if the variable is actually a substitution reference + my ($from, $to); + my @temp_list; + if ($subvar =~ /$SUBST_REF_PATTERN/o) + { + $subvar = $1; + $to = $3; + $from = quotemeta $2; + } + push @substfroms, $from; + push @substtos, $to; + + my ($temp, $varname) + = define_objects_from_sources ($subvar, undef, + $nodefine, $one_file, + $obj, $var, $topparent); + + push (@result, '$('. $varname . ')'); + $needlinker ||= $temp; + + pop @substfroms; + pop @substtos; + } + else # $var is a filename + { + my $substnum=$#substfroms; + while ($substnum >= 0) + { + $val =~ s/$substfroms[$substnum]$/$substtos[$substnum]/ + if defined $substfroms[$substnum]; + $substnum -= 1; + } + + my (@transformed) = + &handle_single_transform_list ($var, $topparent, $one_file, $obj, $val); + push (@result, @transformed); + $needlinker = "true" if @transformed; + } + } + push (@allresults, [$cond, @result]); + } + # Find a name for the variable, unless imposed. + $objvar = subobjname (@allresults) unless defined $objvar; + # Define _OBJECTS conditionally + unless ($nodefine) + { + foreach my $pair (@allresults) + { + my ($cond, @result) = @$pair; + define_pretty_variable ($objvar, $cond, @result); + } + } + + delete $vars_scanned{$var}; + return ($needlinker, $objvar); +} + + +# $VARNAME +# subobjname (@DEFINITIONS) +# ------------------------- +# Return a name for an object variable that with definitions @DEFINITIONS. +# @DEFINITIONS is a list of pair [$COND, @OBJECTS]. +# +# If we already have an object variable containing @DEFINITIONS, reuse it. +# This way, we avoid combinatorial explosion of the generated +# variables. Especially, in a Makefile such as: +# +# | if FOO1 +# | A1=1 +# | endif +# | +# | if FOO2 +# | A2=2 +# | endif +# | +# | ... +# | +# | if FOON +# | AN=N +# | endif +# | +# | B=$(A1) $(A2) ... $(AN) +# | +# | c_SOURCES=$(B) +# | d_SOURCES=$(B) +# +# The generated c_OBJECTS and d_OBJECTS will share the same variable +# definitions. +# +# This setup can be the case of a testsuite containing lots (>100) of +# small C programs, all testing the same set of source files. +sub subobjname (@) +{ + my $key = ''; + foreach my $pair (@_) + { + my ($cond, @values) = @$pair; + $key .= "($cond)@values"; + } - 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 $subobjvar{$key} if exists $subobjvar{$key}; - return $needlinker; + my $num = 1 + keys (%subobjvar); + my $name = "am__objects_${num}"; + $subobjvar{$key} = $name; + return $name; } -# 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 the name of the linker variable that must be used. +# canonical (transformed) name of object to build +# actual name of object to build +# object extension (ie either `.o' or `$o'. +# Return result is name of linker variable that must be used. # Empty return means just use `LINK'. -sub handle_source_transform ($$$$%) +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 ($one_file, $unxformed, $obj) = @_; - my $linker = ''; + my ($linker) = ''; # No point in continuing if _OBJECTS is defined. return if reject_var ($one_file . '_OBJECTS', @@ -2001,9 +2782,9 @@ sub handle_source_transform ($$$$%) foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', 'dist_EXTRA_', 'nodist_EXTRA_') { - my $varname = $prefix . $one_file . "_SOURCES"; - my $var = var $varname; - next unless $var; + my $var = $prefix . $one_file . "_SOURCES"; + next + if !variable_defined ($var); # We are going to define _OBJECTS variables using the prefix. # Then we glom them all together. So we can't use the null @@ -2014,17 +2795,34 @@ sub handle_source_transform ($$$$%) $used_pfx{$xpfx} = 1 unless $prefix =~ /EXTRA_/; - push @sources, "\$($varname)"; - push @dist_sources, shadow_unconditionally ($varname, $where) - unless (option ('no-dist') || $prefix =~ /^nodist_/); + push @sources, "\$($var)"; + if ($prefix !~ /^nodist_/) + { + # If the VAR wasn't definined conditionally, we add + # it to DIST_SOURCES as is. Otherwise we create a + # am__VAR_DIST variable which contains all possible values, + # and add this variable to DIST_SOURCES. + my $distvar = "$var"; + my @conds = variable_conditions_recursive ($var); + if (@conds && $conds[0] ne 'TRUE') + { + $distvar = "am__${var}_DIST"; + my @files = + uniq (variable_value_as_list_recursive ($var, 'all')); + define_pretty_variable ($distvar, '', @files); + } + push @dist_sources, "\$($distvar)" + } - $needlinker |= - define_objects_from_sources ($varname, + @substfroms = (); + @substtos = (); + %vars_scanned = (); + my ($temp, $objvar) = + define_objects_from_sources ($var, $xpfx . $one_file . '_OBJECTS', $prefix =~ /EXTRA_/, - $one_file, $obj, $varname, $where, - DIST_SOURCE => ($prefix !~ /^nodist_/), - %transform); + $one_file, $obj, $var, $var); + $needlinker ||= $temp; } if ($needlinker) { @@ -2034,50 +2832,23 @@ sub handle_source_transform ($$$$%) 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); + &define_variable ($one_file . "_SOURCES", $unxformed . ".c"); + push (@sources, $unxformed . '.c'); + push (@dist_sources, $unxformed . '.c'); %linkers_used = (); my (@result) = - handle_single_transform ($one_file . '_SOURCES', - $one_file . '_SOURCES', - $one_file, $obj, - $default_source, %transform); + &handle_single_transform_list ($one_file . '_SOURCES', + $one_file . '_SOURCES', + $one_file, $obj, + "$unxformed.c"); $linker ||= &resolve_linker (%linkers_used); - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result); + define_pretty_variable ($one_file . "_OBJECTS", '', @result) } else { - @keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys; - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys); + grep ($_ = '$(' . $_ . $one_file . '_OBJECTS)', @keys); + define_pretty_variable ($one_file . '_OBJECTS', '', @keys); } # If we want to use `LINK' we must make sure it is defined. @@ -2100,170 +2871,143 @@ sub handle_source_transform ($$$$%) # 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 - # laxe here since this code also applies to non-libtool - # libraries or programs, for which -dlopen and -dlopreopen - # are pure nonsense. Diagnosing 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 (); - } - }); + my ($xname, $var) = @_; - return $seen_libobjs; + prog_error "handle_lib_objects: $var undefined" + if ! variable_defined ($var); + + my $ret = 0; + foreach my $cond (variable_conditions_recursive ($var)) + { + if (&handle_lib_objects_cond ($xname, $var, $cond)) + { + $ret = 1; + } + } + return $ret; } -# handle_LIBOBJS_or_ALLOCA ($VAR) -# ------------------------------- -# Definitions common to LIBOBJS and ALLOCA. -# VAR should be one of LIBOBJS, LTLIBOBJS, ALLOCA, or LTALLOCA. -sub handle_LIBOBJS_or_ALLOCA ($) +# Subroutine of handle_lib_objects: handle a particular condition. +sub handle_lib_objects_cond { - my ($var) = @_; + my ($xname, $var, $cond) = @_; - my $dir = ''; + # We recognize certain things that are commonly put in LIBADD or + # LDADD. + my @dep_list = (); - # If LIBOBJS files must be built in another directory we have - # to define LIBOBJDIR and ensure the files get cleaned. - # Otherwise LIBOBJDIR can be left undefined, and the cleaning - # is achieved by `rm -f *.$(OBJEXT)' in compile.am. - if ($config_libobj_dir - && $relative_dir ne $config_libobj_dir) - { - if (option 'subdir-objects') - { - # 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. - $dir = "$config_libobj_dir/" if $config_libobj_dir ne '.'; - $dir = "$topsrcdir/$dir" if $relative_dir ne '.'; - define_variable ('LIBOBJDIR', "$dir", INTERNAL); - $clean_files{"\$($var)"} = MOSTLY_CLEAN; - # If LTLIBOBJS is used, we must also clear LIBOBJS (which might - # be created by libtool as a side-effect of creating LTLIBOBJS). - $clean_files{"\$($var)"} = MOSTLY_CLEAN if $var =~ s/^LT//; + my $seen_libobjs = 0; + my $flagvar = 0; - } - else + foreach my $lsearch (&variable_value_as_list_recursive ($var, $cond)) + { + # Skip -lfoo and -Ldir; these are explicitly allowed. + next if $lsearch =~ /^-[lL]/; + if (! $flagvar && $lsearch =~ /^-/) { - error ("`\$($var)' cannot be used outside `$dir' if" - . " `subdir-objects' is not set"); + if ($var =~ /^(.*)LDADD$/) + { + # Skip -dlopen and -dlpreopen; these are explicitly allowed. + next if $lsearch =~ /^-dl(pre)?open$/; + my $prefix = $1 || 'AM_'; + err_var ($var, "linker flags such as `$lsearch' belong in " + . "`${prefix}LDFLAGS"); + } + else + { + $var =~ /^(.*)LIBADD$/; + # Only get this error once. + $flagvar = 1; + err_var ($var, "linker flags such as `$lsearch' belong in " + . "`${1}LDFLAGS"); + } } - } - return $dir; -} + # Assume we have a file of some sort, and push it onto the + # dependency list. Autoconf substitutions are not pushed; + # rarely is a new dependency substituted into (eg) foo_LDADD + # -- but "bad things (eg -lX11) are routinely substituted. + # Note that LIBOBJS and ALLOCA are exceptions to this rule, + # and handled specially below. + push (@dep_list, $lsearch) + unless $lsearch =~ /^\@.*\@$/; -sub handle_LIBOBJS ($$$) -{ - my ($var, $cond, $lt) = @_; - my $myobjext = $lt ? 'lo' : 'o'; - $lt ||= ''; + # Automatically handle LIBOBJS and ALLOCA substitutions. + # Basically this means adding entries to dep_files. + if ($lsearch =~ /^\@(LT)?LIBOBJS\@$/) + { + my $lt = $1 ? $1 : ''; + my $myobjext = ($1 ? 'l' : '') . 'o'; - $var->requires_variables ("\@${lt}LIBOBJS\@ used", $lt . 'LIBOBJS') - if ! keys %libsources; + push (@dep_list, $lsearch); + $seen_libobjs = 1; + if (! keys %libsources + && ! variable_defined ($lt . 'LIBOBJS')) + { + err_var ($var, "\@${lt}LIBOBJS\@ seen but never set in " + . "`$configure_ac'"); + } - my $dir = handle_LIBOBJS_or_ALLOCA "${lt}LIBOBJS"; + foreach my $iter (keys %libsources) + { + if ($iter =~ /\.[cly]$/) + { + &saw_extension ($&); + &saw_extension ('.c'); + } - foreach my $iter (keys %libsources) - { - if ($iter =~ /\.[cly]$/) + 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. + if (! variable_defined ('BUILT_SOURCES') + || ! grep (/$rewrite/, + &variable_value_as_list_recursive ( + 'BUILT_SOURCES', 'all'))) + { + require_file_with_macro ($cond, $var, FOREIGN, $iter); + } + } + } + } + elsif ($lsearch =~ /^\@(LT)?ALLOCA\@$/) { - &saw_extension ($&); - &saw_extension ('.c'); + my $lt = $1 ? $1 : ''; + my $myobjext = ($1 ? 'l' : '') . 'o'; + + push (@dep_list, $lsearch); + err_var ($var, "\@${lt}ALLOCA\@ seen but `AC_FUNC_ALLOCA' not in " + . "`$configure_ac'") + if ! defined $libsources{'alloca.c'}; + $dep_files{'$(DEPDIR)/alloca.P' . $myobjext} = 1; + require_file_with_macro ($cond, $var, FOREIGN, 'alloca.c'); + &saw_extension ('c'); } + } - if ($iter =~ /\.h$/) + if ($xname ne '') + { + my $depvar = $xname . '_DEPENDENCIES'; + if ((conditional_ambiguous_p ($depvar, $cond, + keys %{$var_value{$depvar}}))[0] ne '') { - require_libsource_with_macro ($cond, $var, FOREIGN, $iter); + # Note that we've examined this. + &examine_variable ($depvar); } - elsif ($iter ne 'alloca.c') + else { - my $rewrite = $iter; - $rewrite =~ s/\.c$/.P$myobjext/; - $dep_files{$dir . '$(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_libsource_with_macro ($cond, $var, FOREIGN, $iter); - } + define_pretty_variable ($depvar, $cond, @dep_list); } } -} - -sub handle_ALLOCA ($$$) -{ - my ($var, $cond, $lt) = @_; - my $myobjext = $lt ? 'lo' : 'o'; - $lt ||= ''; - my $dir = handle_LIBOBJS_or_ALLOCA "${lt}ALLOCA"; - $var->requires_variables ("\@${lt}ALLOCA\@ used", $lt . 'ALLOCA'); - $dep_files{$dir . '$(DEPDIR)/alloca.P' . $myobjext} = 1; - require_libsource_with_macro ($cond, $var, FOREIGN, 'alloca.c'); - &saw_extension ('.c'); + return $seen_libobjs; } # Canonicalize the input parameter @@ -2304,24 +3048,17 @@ sub handle_compile () # Boilerplate. my $default_includes = ''; - if (! option 'nostdinc') + if (! defined $options{'nostdinc'}) { - my @incs = ('-I.'); + $default_includes = ' -I. -I$(srcdir)'; - my $var = var 'CONFIG_HEADER'; - if ($var) + if (variable_defined ('CONFIG_HEADER')) { - foreach my $hdr (split (' ', $var->variable_value)) + foreach my $hdr (split (' ', &variable_value ('CONFIG_HEADER'))) { - push @incs, '-I' . dirname ($hdr); + $default_includes .= ' -I' . dirname ($hdr); } } - # We want `-I. -I$(srcdir)', but the latter -I is redundant - # and unaesthetic in non-VPATH builds. We use `-I.@am__isrc@` - # instead. It will be replaced by '-I.' or '-I. -I$(srcdir)'. - # Items in CONFIG_HEADER are never in $(srcdir) so it is safe - # to just append @am__isrc@. - $default_includes = ' ' . uniq (@incs) . subst ('am__isrc'); } my (@mostly_rms, @dist_rms); @@ -2343,7 +3080,6 @@ sub handle_compile () 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))); @@ -2351,33 +3087,30 @@ sub handle_compile () $output_rules .= "$coms$rules"; # Check for automatic de-ANSI-fication. - if (option 'ansi2knr') + if (defined $options{'ansi2knr'}) { - my ($ansi2knr_filename, $ansi2knr_where) = @{option 'ansi2knr'}; - my $ansi2knr_dir = ''; - - require_variables ($ansi2knr_where, "option `ansi2knr' is used", - TRUE, "ANSI2KNR", "U"); + require_variables_for_macro ('AUTOMAKE_OPTIONS', + "option `ansi2knr' is used", + "ANSI2KNR", "U"); # topdir is where ansi2knr should be. - if ($ansi2knr_filename eq 'ansi2knr') + if ($options{'ansi2knr'} eq 'ansi2knr') { # Only require ansi2knr files if they should appear in # this directory. - require_file ($ansi2knr_where, FOREIGN, - 'ansi2knr.c', 'ansi2knr.1'); + require_file_with_macro ('TRUE', 'AUTOMAKE_OPTIONS', FOREIGN, + 'ansi2knr.c', 'ansi2knr.1'); # ansi2knr needs to be built before subdirs, so unshift it. unshift (@all, '$(ANSI2KNR)'); } - else - { - $ansi2knr_dir = dirname ($ansi2knr_filename); - } + + my $ansi2knr_dir = ''; + $ansi2knr_dir = dirname ($options{'ansi2knr'}) + if $options{'ansi2knr'} ne 'ansi2knr'; $output_rules .= &file_contents ('ansi2knr', - new Automake::Location, - 'ANSI2KNR-DIR' => $ansi2knr_dir); + ('ANSI2KNR-DIR' => $ansi2knr_dir)); } } @@ -2387,13 +3120,11 @@ sub handle_compile () # Handle libtool rules. sub handle_libtool { - return unless var ('LIBTOOL'); + return unless variable_defined ('LIBTOOL'); # Libtool requires some files, but only at top level. - # (Starting with Libtool 2.0 we do not have to bother. These - # requirements are done with AC_REQUIRE_AUX_FILE.) - require_conf_file_with_macro (TRUE, 'LIBTOOL', FOREIGN, @libtool_files) - if $relative_dir eq '.' && ! $libtool_new_api; + 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) @@ -2403,12 +3134,9 @@ sub handle_libtool push (@libtool_rms, "\t-rm -rf ${dir}.libs ${dir}_libs"); } - check_user_variables 'LIBTOOLFLAGS'; - # Output the libtool compilation rules. $output_rules .= &file_contents ('libtool', - new Automake::Location, - LTRMS => join ("\n", @libtool_rms)); + ('LTRMS' => join ("\n", @libtool_rms))); } # handle_programs () @@ -2422,78 +3150,87 @@ sub handle_programs return if ! @proglist; my $seen_global_libobjs = - var ('LDADD') && &handle_lib_objects ('', 'LDADD'); + variable_defined ('LDADD') && &handle_lib_objects ('', 'LDADD'); - foreach my $pair (@proglist) + foreach my $one_file (@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\)$//; - - $known_programs{$one_file} = $where; + my $obj = &get_object_extension ($one_file); # 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); - my $linker = &handle_source_transform ($xname, $one_file, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); - - if (var ($xname . "_LDADD")) + my $xt = ''; + if (variable_defined ($xname . "_LDADD")) { $seen_libobjs = &handle_lib_objects ($xname, $xname . '_LDADD'); + $xt = '_LDADD'; } else { # User didn't define prog_LDADD override. So do it. - &define_variable ($xname . '_LDADD', '$(LDADD)', $where); + &define_variable ($xname . '_LDADD', '$(LDADD)'); # This does a bit too much work. But we need it to # generate _DEPENDENCIES when appropriate. - if (var ('LDADD')) + if (variable_defined ('LDADD')) { $seen_libobjs = &handle_lib_objects ($xname, 'LDADD'); } + elsif (! variable_defined ($xname . '_DEPENDENCIES')) + { + &define_variable ($xname . '_DEPENDENCIES', ''); + } + $xt = '_SOURCES'; } reject_var ($xname . '_LIBADD', "use `${xname}_LDADD', not `${xname}_LIBADD'"); - set_seen ($xname . '_DEPENDENCIES'); - set_seen ($xname . '_LDFLAGS'); + if (! variable_defined ($xname . '_LDFLAGS')) + { + # Define the prog_LDFLAGS variable. + &define_variable ($xname . '_LDFLAGS', ''); + } # Determine program to use for link. - my $xlink = &define_per_target_linker_variable ($linker, $xname); + my $xlink; + if (variable_defined ($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); + # Don't add $(EXEEXT) if user already did. + my $extension = ($one_file !~ /\$\(EXEEXT\)$/ + ? "\$(EXEEXT)" + : ''); + $output_rules .= &file_contents ('program', - $where, - PROGRAM => $one_file, - XPROGRAM => $xname, - XLINK => $xlink, - DIRSTAMP => $dirstamp, - EXEEXT => '$(EXEEXT)'); + ('PROGRAM' => $one_file, + 'XPROGRAM' => $xname, + 'XLINK' => $xlink, + 'DIRSTAMP' => $dirstamp, + 'EXEEXT' => $extension)); if ($seen_libobjs || $seen_global_libobjs) { - if (var ($xname . '_LDADD')) + if (variable_defined ($xname . '_LDADD')) { &check_libobjs_sources ($xname, $xname . '_LDADD'); } - elsif (var ('LDADD')) + elsif (variable_defined ('LDADD')) { &check_libobjs_sources ($xname, 'LDADD'); } @@ -2514,50 +3251,34 @@ sub handle_libraries 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); + require_variables_for_macro ($prefix[0] . '_LIBRARIES', + 'library used', 'RANLIB') + if (@prefix); - foreach my $pair (@liblist) + foreach my $onelib (@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$/) + if (basename ($onelib) !~ /^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'?") + # FIXME should put line number here. That means mapping + # from library name back to variable name. + err_am "`$onelib' is not a standard library name"; } - $where->push_context ("while processing library `$onelib'"); - $where->set (INTERNAL->get); - - my $obj = get_object_extension '.$(OBJEXT)'; + my $obj = &get_object_extension ($onelib); # Canonicalize names and check for misspellings. my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES', '_OBJECTS', '_DEPENDENCIES', '_AR'); - if (! var ($xlib . '_AR')) + if (! variable_defined ($xlib . '_AR')) { - &define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where); + &define_variable ($xlib . '_AR', '$(AR) cru'); } - # Generate support for conditional object inclusion in - # libraries. - if (var ($xlib . '_LIBADD')) + if (variable_defined ($xlib . '_LIBADD')) { if (&handle_lib_objects ($xlib, $xlib . '_LIBADD')) { @@ -2566,31 +3287,31 @@ sub handle_libraries } else { - &define_variable ($xlib . "_LIBADD", '', $where); + # Generate support for conditional object inclusion in + # libraries. + &define_variable ($xlib . "_LIBADD", ''); } reject_var ($xlib . '_LDADD', "use `${xlib}_LIBADD', not `${xlib}_LDADD'"); # Make sure we at look at this. - set_seen ($xlib . '_DEPENDENCIES'); + &examine_variable ($xlib . '_DEPENDENCIES'); - &handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); + &handle_source_transform ($xlib, $onelib, $obj); # 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); + ('LIBRARY' => $onelib, + 'XLIBRARY' => $xlib, + 'DIRSTAMP' => $dirstamp)); if ($seen_libobjs) { - if (var ($xlib . '_LIBADD')) + if (variable_defined ($xlib . '_LIBADD')) { &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); } @@ -2608,139 +3329,88 @@ sub handle_ltlibraries 'noinst', 'lib', 'pkglib', 'check'); return if ! @liblist; + my %instdirs; 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. + require_variables_for_macro ($prefix[0] . '_LTLIBRARIES', + 'Libtool library used', 'LIBTOOL') + if (@prefix); 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; + for (variable_value_as_list_recursive ($key . '_LTLIBRARIES', 'all')) + { + # We reject libraries which are installed in several places, + # because we don't handle this in the rules (think `-rpath'). + # + # However, we allow the same library to be listed many times + # for the same directory. This is for users who need setups + # like + # if COND1 + # lib_LTLIBRARIES = libfoo.la + # endif + # if COND2 + # lib_LTLIBRARIES = libfoo.la + # endif + # + # Actually this will also allow + # lib_LTLIBRARIES = libfoo.la libfoo.la + # Diagnosing this case doesn't seem worth the plain (we'd + # have to fill $instdirs on a per-condition basis, check + # implied conditions, etc.) + if (defined $instdirs{$_} && $instdirs{$_} ne $dir) + { + err_am ("`$_' is already going to be installed in " + . "`$instdirs{$_}'"); + } + else + { + $instdirs{$_} = $dir; + } + } + } + foreach my $onelib (@liblist) + { my $seen_libobjs = 0; - my $obj = get_object_extension '.lo'; + my $obj = &get_object_extension ($onelib); # Canonicalize names and check for misspellings. my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS', '_SOURCES', '_OBJECTS', '_DEPENDENCIES'); + if (! variable_defined ($xlib . '_LDFLAGS')) + { + # Define the lib_LDFLAGS variable. + &define_variable ($xlib . '_LDFLAGS', ''); + } + # 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))) + my $libname_rx = "^lib.*\.la"; + if ((variable_defined ($xlib . '_LDFLAGS') + && grep (/-module/, + &variable_value_as_list_recursive ($xlib . '_LDFLAGS', + 'all'))) + || (variable_defined ('LDFLAGS') + && grep (/-module/, + &variable_value_as_list_recursive ('LDFLAGS', 'all')))) { # Relax name checking for libtool modules. - $libname_rx = '\.la'; + $libname_rx = "\.la"; } - - my $bn = basename ($onelib); - if ($bn !~ /$libname_rx$/) + if (basename ($onelib) !~ /$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'?") + # FIXME should put line number here. That means mapping + # from library name back to variable name. + msg_am ('error-gnu/warn', + "`$onelib' is not a standard libtool library name"); } - $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 (variable_defined ($xlib . '_LIBADD')) { if (&handle_lib_objects ($xlib, $xlib . '_LIBADD')) { @@ -2749,49 +3419,45 @@ sub handle_ltlibraries } else { - &define_variable ($xlib . "_LIBADD", '', $where); + # Generate support for conditional object inclusion in + # libraries. + &define_variable ($xlib . "_LIBADD", ''); } reject_var ("${xlib}_LDADD", "use `${xlib}_LIBADD', not `${xlib}_LDADD'"); + # Make sure we at look at this. + &examine_variable ($xlib . '_DEPENDENCIES'); - my $linker = &handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 0, LIBTOOL => 1); + my $linker = &handle_source_transform ($xlib, $onelib, $obj); # Determine program to use for link. - my $xlink = &define_per_target_linker_variable ($linker, $xlib); + my $xlink; + if (variable_defined ($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); - } + my $rpath; + if ($instdirs{$onelib} eq 'EXTRA' + || $instdirs{$onelib} eq 'noinst' + || $instdirs{$onelib} 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. + $rpath = ''; + } + else + { + $rpath = ('-rpath $(' . $instdirs{$onelib} . 'dir)'); } # If the resulting library lies into a subdirectory, @@ -2803,15 +3469,14 @@ sub handle_ltlibraries $libtool_clean_directories{$dirname} = 1; $output_rules .= &file_contents ('ltlibrary', - $where, - LTLIBRARY => $onelib, - XLTLIBRARY => $xlib, - RPATH => $rpath, - XLINK => $xlink, - DIRSTAMP => $dirstamp); + ('LTLIBRARY' => $onelib, + 'XLTLIBRARY' => $xlib, + 'RPATH' => $rpath, + 'XLINK' => $xlink, + 'DIRSTAMP' => $dirstamp)); if ($seen_libobjs) { - if (var ($xlib . '_LIBADD')) + if (variable_defined ($xlib . '_LIBADD')) { &check_libobjs_sources ($xlib, $xlib . '_LIBADD'); } @@ -2823,24 +3488,17 @@ sub handle_ltlibraries sub check_typos () { # It is ok if the user sets this particular variable. - set_seen 'AM_LDFLAGS'; + &examine_variable ('AM_LDFLAGS'); - foreach my $primary ('SOURCES', 'LIBADD', 'LDADD', 'LDFLAGS', 'DEPENDENCIES') + foreach my $varname (keys %var_value) { - foreach my $var (variables $primary) + foreach my $primary ('_SOURCES', '_LIBADD', '_LDADD', '_LDFLAGS', + '_DEPENDENCIES') { - my $varname = $var->name; - # A configure variable is always legitimate. - next if exists $configure_vars{$varname}; - - for my $cond ($var->conditions->conds) - { - $varname =~ /^(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/; - msg_var ('syntax', $var, "variable `$varname' is defined but no" - . " program or\nlibrary has `$1' as canonic name" - . " (possible typo)") - unless $var->rdef ($cond)->seen; - } + msg_var 'syntax', $varname, "unused variable: `$varname'" + # Note that a configure variable is always legitimate. + if ($varname =~ /$primary$/ && ! $content_seen{$varname} + && ! exists $configure_vars{$varname}); } } } @@ -2851,117 +3509,120 @@ 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. + # eg 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) +# $OUTFILE is the name of the info file produced by $FILENAME. +# $VFILE is the name of the version.texi file used (empty if none). +# @CLEAN_FILES is the list of by products (indexes etc.) +sub scan_texinfo_file +{ + my ($filename) = @_; + + # These are always created, no matter whether indexes are used or not. + # (Actually tmp is only created if an @macro is used and a certain e-TeX + # feature is not available.) + my @clean_suffixes = qw(aux log toc tmp + cp fn ky vr tp pg); # grep new.*index texinfo.tex + + # There are predefined indexes which don't follow the regular rules. + my %predefined_index = qw(c cps + f fns + k kys + v vrs + t tps + p pgs); + + # There are commands which include a hidden index command. + my %hidden_index = (tp => 'tps'); + $hidden_index{$_} = 'fns' foreach qw(fn un typefn typefun max spec + op typeop method typemethod); + $hidden_index{$_} = 'vrs' foreach qw(vr var typevr typevar opt cv + ivar typeivar); + + # Indexes stored into another one. In this case, the *.??s file + # is not created. + my @syncodeindexes = (); + + 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". + { + $outfile = $1; + if ($outfile =~ /\.(.+)$/ && $1 ne 'info') + { + err "$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; - } + { + $vfile = $1; + } - # Try to find new or unused indexes. + # Try to find what are the indexes which are used. # Creating a new category of index. elsif (/^\@def(code)?index (\w+)/) - { - $clean_suffixes{$2} = 1; - $clean_suffixes{"$2s"} = 1; - } + { + push @clean_suffixes, $2; + } + + # Storing in a predefined index. + elsif (/^\@([cfkvtp])index /) + { + push @clean_suffixes, $predefined_index{$1}; + } + elsif (/^\@def(\w+) /) + { + push @clean_suffixes, $hidden_index{$1} + if defined $hidden_index{$1}; + } # Merging an index into an another. elsif (/^\@syn(code)?index (\w+) (\w+)/) - { - delete $clean_suffixes{"$2s"}; - $clean_suffixes{"$3s"} = 1; - } + { + push @syncodeindexes, "$2s"; + push @clean_suffixes, "$3s"; + } } - if (! $outfile) - { - err_am "`$filename' missing \@setfilename"; - return; - } + if ($outfile eq '') + { + err_am "`$filename' missing \@setfilename"; + return; + } - my $infobase = basename ($filename); - $infobase =~ s/\.te?xi(nfo)?$//; - return ($outfile, $vfile, - map { "$infobase.$_" } (sort keys %clean_suffixes)); + my $infobase = basename ($filename); + $infobase =~ s/\.te?xi(nfo)?$//; + my %clean_files = map { +"$infobase.$_" => 1 } @clean_suffixes; + grep { delete $clean_files{"$infobase.$_"} } @syncodeindexes; + return ($outfile, $vfile, (sort keys %clean_files)); } - # ($DIRSTAMP, @CLEAN_FILES) -# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES) -# ------------------------------------------------------------------ +# output_texinfo_build_rules ($SOURCE, $DEST, @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 ($$$@) +sub output_texinfo_build_rules ($$@) { - my ($source, $dest, $insrc, @deps) = @_; + my ($source, $dest, @deps) = @_; # Split `a.texi' into `a' and `.texi'. my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/); @@ -2970,15 +3631,15 @@ sub output_texinfo_build_rules ($$$@) $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. + # We can output two kinds of rules: the "generic" rules + # use Make suffix rules and are appropritate when + # $source and $dest lie in the current directory; the "specifix" + # rules is 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. + # 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; @@ -2993,442 +3654,286 @@ sub output_texinfo_build_rules ($$$@) $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'); - } + $output_rules .= &file_contents ('texibuild', + GENERIC => $generic, + SOURCE_SUFFIX => $ssfx, + SOURCE => ($generic ? '$<' : $source), + SOURCE_REAL => $source, + DEST_PREFIX => $dpfx, + DEST_SUFFIX => $dsfx, + MAKEINFOFLAGS => $makeinfoflags, + DEPS => "@deps", + DIRSTAMP => $dirstamp); + return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps"); +} - 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); + +# ($DO-SOMETHING, $TEXICLEANS) +# handle_texinfo_helper () +# ------------------------ +# Handle all Texinfo source; helper for handle_texinfo +sub handle_texinfo_helper +{ + reject_var 'TEXINFOS', "`TEXINFOS' is an anachronism; use `info_TEXINFOS'"; + reject_var 'html_TEXINFOS', "HTML generation not yet supported"; + + return (0, '') if ! variable_defined ('info_TEXINFOS'); + + my @texis = &variable_value_as_list_recursive ('info_TEXINFOS', 'all'); + + my (@info_deps_list, @dvis_list, @pdfs_list, @pss_list, @texi_deps); + my %versions; + my $done = 0; + my @texi_cleans; + my $canonical; + + foreach my $info_cursor (@texis) + { + my $infobase = $info_cursor; + $infobase =~ s/\.(txi|texinfo|texi)$//; + + if ($infobase eq $info_cursor) + { + # FIXME: report line number. + err_am "texinfo file `$info_cursor' has unrecognized extension"; + next; + } + + # If 'version.texi' is referenced by input file, then include + # automatic versioning capability. + my ($out_file, $vtexi, @clean_files) = + &scan_texinfo_file ("$relative_dir/$info_cursor") + 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 ($info_cursor) . '/'; + $outdir = "" if $outdir eq './'; + $out_file = $outdir . $out_file; + + # If user specified file_TEXINFOS, then use that as explicit + # dependency list. + @texi_deps = (); + push (@texi_deps, "$outdir$vtexi") if $vtexi; + + my $canonical = &canonicalize ($infobase); + if (variable_defined ($canonical . "_TEXINFOS")) + { + push (@texi_deps, '$(' . $canonical . '_TEXINFOS)'); + &push_dist_common ('$(' . $canonical . '_TEXINFOS)'); + } + + my ($dirstamp, @cfiles) = + output_texinfo_build_rules ($info_cursor, $out_file, @texi_deps); + push (@texi_cleans, @cfiles); + + push (@info_deps_list, $out_file); + push (@dvis_list, $infobase . '.dvi'); + push (@pdfs_list, $infobase . '.pdf'); + push (@pss_list, $infobase . '.ps'); + + # If a vers*.texi file is needed, emit the rule. + if ($vtexi) + { + err_am ("`$vtexi', included in `$info_cursor', " + . "also included in `$versions{$vtexi}'") + if defined $versions{$vtexi}; + $versions{$vtexi} = $info_cursor; + + # 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_in) + { + 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_in) + { + $conf_dir = $config_aux_dir; + $conf_dir .= '/' unless $conf_dir =~ /\/$/; + } + else + { + $conf_dir = '$(srcdir)/'; + } + $output_rules .= &file_contents ('texi-vers', + TEXI => $info_cursor, + VTI => $vti, + STAMPVTI => "${outdir}stamp-$vti", + VTEXI => "$outdir$vtexi", + MDDIR => $conf_dir, + DIRSTAMP => $dirstamp); } } - # Handle location of texinfo.tex. - my $need_texi_file = 0; - my $texinfodir; - if (var ('TEXINFO_TEX')) + # Handle location of texinfo.tex. + my $need_texi_file = 0; + my $texinfodir; + if ($cygnus_mode) { - # The user defined TEXINFO_TEX so assume he knows what he is - # doing. - $texinfodir = ('$(srcdir)/' - . dirname (variable_value ('TEXINFO_TEX'))); + $texinfodir = '$(top_srcdir)/../texinfo'; + &define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex"); } - elsif (option 'cygnus') + elsif ($config_aux_dir_set_in_configure_in) { - $texinfodir = '$(top_srcdir)/../texinfo'; - define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL); + $texinfodir = $config_aux_dir; + &define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex"); + $need_texi_file = 2; # so that we require_conf_file later } - elsif ($config_aux_dir_set_in_configure_ac) + elsif (variable_defined ('TEXINFO_TEX')) { - $texinfodir = $am_config_aux_dir; - define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL); - $need_texi_file = 2; # so that we require_conf_file later + # The user defined TEXINFO_TEX so assume he knows what he is + # doing. + $texinfodir = ('$(srcdir)/' + . dirname (&variable_value ('TEXINFO_TEX'))); } - else + else { - $texinfodir = '$(srcdir)'; - $need_texi_file = 1; + $texinfodir = '$(srcdir)'; + $need_texi_file = 1; } - define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL); + &define_variable ('am__TEXINFO_TEX_DIR', $texinfodir); - push (@dist_targets, 'dist-info'); + # The return value. + my $texiclean = &pretty_print_internal ("", "\t ", @texi_cleans); - if (! option 'no-installinfo') + push (@dist_targets, 'dist-info'); + + if (! defined $options{'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)'); + # 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); + &define_variable ("INFO_DEPS", "@info_deps_list"); + &define_variable ("DVIS", "@dvis_list"); + &define_variable ("PDFS", "@pdfs_list"); + &define_variable ("PSS", "@pss_list"); + # 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')); - # 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') + # 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 && ! defined $options{'no-texinfo.tex'}) { - if ($need_texi_file > 1) + if ($need_texi_file > 1) { - require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); + require_conf_file_with_macro ('TRUE', 'info_TEXINFOS', FOREIGN, + 'texinfo.tex'); } - else + else { - require_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); + require_file_with_macro ('TRUE', 'info_TEXINFOS', FOREIGN, + 'texinfo.tex'); } } - return makefile_wrap ("", "\t ", @texi_cleans); + return (1, $texiclean); } - # handle_texinfo () # ----------------- # Handle all Texinfo source. -sub handle_texinfo () +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); + my ($do_something, $texiclean) = handle_texinfo_helper (); + $output_rules .= &file_contents ('texinfos', + ('TEXICLEAN' => $texiclean, + 'LOCAL-TEXIS' => $do_something)); } - # Handle any man pages. sub handle_man_pages { - reject_var 'MANS', "`MANS' is an anachronism; use `man_MANS'"; + 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_') + # 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') + # Add more sections as needed. + foreach my $section ('0'..'9', 'n', 'l') { - my $varname = $pfx . 'man' . $section . '_MANS'; - if (var ($varname)) + if (variable_defined ($pfx . 'man' . $section . '_MANS')) { - $sections{$section} = 1; - $varname = '$(' . $varname . ')'; - $vlist{$varname} = 1; + $sections{$section} = 1; + $vlist{'$(' . $pfx . 'man' . $section . '_MANS)'} = 1; - &push_dist_common ($varname) - if $pfx eq 'dist_'; + &push_dist_common ('$(' . $pfx . 'man' . $section . '_MANS)') + if $pfx eq 'dist_'; } } - my $varname = $pfx . 'man_MANS'; - my $var = var ($varname); - if ($var) + if (variable_defined ($pfx . 'man_MANS')) { - foreach ($var->value_as_list_recursive) + $vlist{'$(' . $pfx . 'man_MANS)'} = 1; + foreach (&variable_value_as_list_recursive ($pfx . 'man_MANS', 'all')) { - # A page like `foo.1c' goes into man1dir. - if (/\.([0-9a-z])([a-z]*)$/) + # A page like `foo.1c' goes into man1dir. + if (/\.([0-9a-z])([a-z]*)$/) { - $sections{$1} = 1; + $sections{$1} = 1; } } - $varname = '$(' . $varname . ')'; - $vlist{$varname} = 1; - &push_dist_common ($varname) - if $pfx eq 'dist_'; + &push_dist_common ('$(' . $pfx . 'man_MANS)') + if $pfx eq 'dist_'; } } - return unless %sections; + 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) + # Now for each section, generate an install and unintall rule. + # Sort sections so output is deterministic. + foreach my $section (sort keys %sections) { - $output_rules .= &file_contents ('mans', - new Automake::Location, - SECTION => $section); + $output_rules .= &file_contents ('mans', ('SECTION' => $section)); } - my @mans = sort keys %vlist; - $output_vars .= file_contents ('mans-vars', - new Automake::Location, - MANS => "@mans"); + my @mans = sort keys %vlist; + $output_vars .= file_contents ('mans-vars', + ('MANS' => "@mans")); - push (@all, '$(MANS)') - unless option 'no-installman'; + if (! defined $options{'no-installman'}) + { + push (@all, '$(MANS)'); + } } # Handle DATA variables. sub handle_data { &am_install_var ('-noextra', '-candist', 'data', 'DATA', - 'data', 'dataroot', 'dvi', 'html', 'pdf', 'ps', - 'sysconf', 'sharedstate', 'localstate', - 'pkgdata', 'lisp', 'noinst', 'check'); + 'data', 'sysconf', 'sharedstate', 'localstate', + 'pkgdata', 'noinst', 'check'); } # Handle TAGS. @@ -3436,7 +3941,7 @@ sub handle_tags { my @tag_deps = (); my @ctag_deps = (); - if (var ('SUBDIRS')) + if (variable_defined ('SUBDIRS')) { $output_rules .= ("tags-recursive:\n" . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n" @@ -3460,7 +3965,7 @@ sub handle_tags } if (&saw_sources_p (1) - || var ('ETAGS_ARGS') + || variable_defined ('ETAGS_ARGS') || @tag_deps) { my @config; @@ -3476,12 +3981,10 @@ sub handle_tags } } $output_rules .= &file_contents ('tags', - new Automake::Location, - CONFIG => "@config", - TAGSDIRS => "@tag_deps", - CTAGSDIRS => "@ctag_deps"); - - set_seen 'TAGS_DEPENDENCIES'; + ('CONFIG' => "@config", + 'TAGSDIRS' => "@tag_deps", + 'CTAGSDIRS' => "@ctag_deps")); + &examine_variable ('TAGS_DEPENDENCIES'); } elsif (reject_var ('TAGS_DEPENDENCIES', "doesn't make sense to define `TAGS_DEPENDENCIES'" @@ -3502,36 +4005,10 @@ sub handle_tags # Handle multilib support. sub handle_multilib { - if ($seen_multilib && $relative_dir eq '.') + 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"; - } + $output_rules .= &file_contents ('multilib'); } - return $rule; } @@ -3555,215 +4032,219 @@ sub for_dist_common return $a cmp $b; } -# handle_dist -# ----------- + +# handle_dist ($MAKEFILE) +# ----------------------- # Handle 'dist' target. -sub handle_dist () +sub handle_dist { - # Substitutions for distdir.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'; + my ($makefile) = @_; - # 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; - } + # `make dist' isn't used in a Cygnus-style tree. + # Omit the rules so that people don't try to use them. + return if $cygnus_mode; - # 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) + # 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; + my $auxdir = ''; + if ($relative_dir eq '.' + && $config_aux_dir_set_in_configure_in) { - if (! &is_make_dir ($config_aux_dir)) + ($auxdir = $config_aux_dir) =~ s,^\$\(top_srcdir\)/,,; + if (! &is_make_dir ($auxdir)) { - $check_aux = 1; + $check_aux = 1; } } - foreach my $cfile (@common_files) + 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) + if (-f ($relative_dir . "/" . $cfile) + # The file might be absent, but if it can be built it's ok. + || exists $targets{$cfile}) { - &push_dist_common ($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)) + # Don't use `elsif' here because a file might meaningfully + # appear in both directories. + if ($check_aux && -f ($auxdir . '/' . $cfile)) { - &push_dist_common ("$config_aux_dir/$cfile") + &push_dist_common ($auxdir . '/' . $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 '.') + # 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)); - } + 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'); + # Files to distributed. Don't use &variable_value_as_list_recursive + # as it recursively expands `$(dist_pkgdata_DATA)' etc. + check_variable_defined_unconditionally ('DIST_COMMON'); + my @dist_common = split (' ', variable_value ('DIST_COMMON', 'TRUE')); + @dist_common = uniq (sort for_dist_common (@dist_common)); + pretty_print ('DIST_COMMON = ', "\t", @dist_common); - $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook'; - $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external; + # Now that we've processed DIST_COMMON, disallow further attempts + # to set it. + $handle_dist_run = 1; - # 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); + # 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. + if (variable_defined ('EXTRA_DIST')) + { + # FIXME: This should be fixed to work with conditionals. 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 (&variable_value_as_list_recursive ('EXTRA_DIST', '')) + { + next if /^\@.*\@$/; + next unless s,/+[^/]+$,,; + $dist_dirs{$_} = 1 + unless $_ eq '.'; + } + } - my $flm = option ('filename-length-max'); - my $filename_filter = $flm ? '.' x $flm->[1] : ''; + # 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 (&variable_value_as_list_recursive ('DIST_COMMON', 'all')) + { + next if /^\@.*\@$/; + s/\$\(top_srcdir\)/$topsrcdir/; + s/\$\(srcdir\)/./; + next unless s,/+[^/]+$,,; + $dist_dirs{$_} = 1 + unless $_ eq '.'; + } - $output_rules .= &file_contents ('distdir', - new Automake::Location, - %transform, - FILENAME_FILTER => $filename_filter); -} + # Rule to check whether a distribution is viable. + my %transform = ('DISTCHECK-HOOK' => &target_defined ('distcheck-hook'), + 'GETTEXT' => $seen_gettext); + # Prepend $(distdir) to each directory given. + my %rewritten = map { '$(distdir)/' . "$_" => 1 } keys %dist_dirs; + $transform{'DISTDIRS'} = join (' ', sort keys %rewritten); -# 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) = @_; + # If we have SUBDIRS, create all dist subdirectories and do + # recursive build. + if (variable_defined ('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. + my $dist_subdir_name; + # Note that we check DIST_SUBDIRS first on purpose. At least + # one project uses so many conditional subdirectories that + # calling variable_conditionally_defined on SUBDIRS will cause + # automake to grow to 150Mb. Sigh. + if (variable_defined ('DIST_SUBDIRS') + || variable_conditionally_defined ('SUBDIRS')) + { + $dist_subdir_name = 'DIST_SUBDIRS'; + if (! variable_defined ('DIST_SUBDIRS')) + { + define_pretty_variable + ('DIST_SUBDIRS', '', + uniq (&variable_value_as_list_recursive ('SUBDIRS', 'all'))); + } + } + else + { + $dist_subdir_name = 'SUBDIRS'; + # We always define this because that is what `distclean' + # wants. + define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)'); + } - error $where, "required directory $relative_dir/$dir does not exist" - unless -d "$relative_dir/$dir"; + $transform{'DIST_SUBDIR_NAME'} = $dist_subdir_name; + } - # 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'; + # 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 &target_defined ('dist-hook'); + $transform{'DIST-TARGETS'} = join(' ', @dist_targets); - # `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/); + # Defining $(DISTDIR). + $transform{'DISTDIR'} = !variable_defined('distdir'); + $transform{'TOP_DISTDIR'} = backname ($relative_dir); + + $output_rules .= &file_contents ('distdir', %transform); } -# 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 () +sub handle_subdirs { - my $subdirs = var ('SUBDIRS'); - return - unless $subdirs; - - check_directories_in_var $subdirs; + return + unless variable_defined ('SUBDIRS'); + + my @subdirs = &variable_value_as_list_recursive ('SUBDIRS', 'all'); + my @dsubdirs = (); + @dsubdirs = &variable_value_as_list_recursive ('DIST_SUBDIRS', 'all') + if variable_defined ('DIST_SUBDIRS'); + + # 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_var ('portability', 'SUBDIRS', + "naming a subdirectory `obj' causes troubles with BSD make") + if grep ($_ eq 'obj', @subdirs); + msg_var ('portability', 'DIST_SUBDIRS', + "naming a subdirectory `obj' causes troubles with BSD make") + if grep ($_ eq 'obj', @dsubdirs); + + # Make sure each directory mentioned in SUBDIRS actually exists. + foreach my $dir (@subdirs) + { + # Skip directories substituted by configure. + next if $dir =~ /^\@.*\@$/; + + if (! -d $am_relative_dir . '/' . $dir) + { + err_var ('SUBDIRS', "required directory $am_relative_dir/$dir " + . "does not exist"); + next; + } - my $dsubdirs = var ('DIST_SUBDIRS'); - check_directories_in_var $dsubdirs - if $dsubdirs; + err_var 'SUBDIRS', "directory should not contain `/'" + if $dir =~ /\//; + } - $output_rules .= &file_contents ('subdirs', new Automake::Location); - rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross! + $output_rules .= &file_contents ('subdirs'); + variable_pretty_output ('RECURSIVE_TARGETS', 'TRUE'); } @@ -3771,420 +4252,352 @@ sub handle_subdirs () # &scan_aclocal_m4 # ---------------- # If aclocal.m4 creation is automated, return the list of its dependencies. -sub scan_aclocal_m4 () +sub scan_aclocal_m4 { - my $regen_aclocal = 0; + my $regen_aclocal = 0; + + return (0, ()) + unless $relative_dir eq '.'; - set_seen 'CONFIG_STATUS_DEPENDENCIES'; - set_seen 'CONFIGURE_DEPENDENCIES'; + &examine_variable ('CONFIG_STATUS_DEPENDENCIES'); + &examine_variable ('CONFIGURE_DEPENDENCIES'); - if (-f 'aclocal.m4') + if (-f 'aclocal.m4') { - &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL); + &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4'); + &push_dist_common ('aclocal.m4'); - my $aclocal = new Automake::XFile "< aclocal.m4"; - my $line = $aclocal->getline; - $regen_aclocal = $line =~ 'generated automatically by aclocal'; + my $aclocal = new Automake::XFile "< aclocal.m4"; + my $line = $aclocal->getline; + $regen_aclocal = $line =~ 'generated automatically by aclocal'; } - my @ac_deps = (); + my @ac_deps = (); - if (set_seen ('ACLOCAL_M4_SOURCES')) + if (-f 'acinclude.m4') { - 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."); + $regen_aclocal = 1; + push @ac_deps, 'acinclude.m4'; } - # 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); -} - - -# Helper function for substitute_ac_subst_variables. -sub substitute_ac_subst_variables_worker($) -{ - my ($token) = @_; - return "\@$token\@" if var $token; - return "\${$token\}"; -} - -# substitute_ac_subst_variables ($TEXT) -# ------------------------------------- -# Replace any occurrence of ${FOO} in $TEXT by @FOO@ if FOO is an AC_SUBST -# variable. -sub substitute_ac_subst_variables ($) -{ - my ($text) = @_; - $text =~ s/\${([^ \t=:+{}]+)}/&substitute_ac_subst_variables_worker ($1)/ge; - return $text; -} - -# @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 (variable_defined ('ACLOCAL_M4_SOURCES')) { - if (dirname ($single) eq $relative_dir) - { - push (@newinputs, '$(srcdir)/' . basename ($single)); - } - else - { - push (@newinputs, '$(top_srcdir)/' . $single); - } + push (@ac_deps, '$(ACLOCAL_M4_SOURCES)'); } - 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) + elsif (variable_defined ('ACLOCAL_AMFLAGS')) { - # We cannot create dependencies on shell variables. - next if (substitute_ac_subst_variables $i) =~ /\$/; - - if (exists $ac_config_files_location{$i}) + # Scan all -I directories for m4 files. These are our + # dependencies. + my $examine_next = 0; + foreach my $amdir (&variable_value_as_list_recursive ('ACLOCAL_AMFLAGS', '')) { - my $di = dirname $i; - if ($di eq $relative_dir) + if ($examine_next) { - $i = basename $i; + $examine_next = 0; + if ($amdir !~ /^\// && -d $amdir) + { + foreach my $ac_dep (&my_glob ($amdir . '/*.m4')) + { + $ac_dep =~ s/^\.\/+//; + push (@ac_deps, $ac_dep) + unless $ac_dep eq "aclocal.m4" + || $ac_dep eq "acinclude.m4"; + } + } } - # 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 '.') + elsif ($amdir eq '-I') { - $i = '$(top_builddir)/' . $i; + $examine_next = 1; } } - else - { - msg ('error', $ac_config_files_location{$file}, - "required file `$i' not found") - unless $i =~ /\$/ || exists $output_files{$i} || -f $i; - ($i) = prepend_srcdir ($i); - push_dist_common ($i); - } - push @res, $i; } - return @res; -} - + # Note that it might be possible that aclocal.m4 doesn't exist but + # should be auto-generated. This case probably isn't very + # important. -# &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) = @_; + return ($regen_aclocal, @ac_deps); +} - 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); +# @DEPENDENCY +# &rewrite_inputs_into_dependencies ($ADD_SRCDIR, @INPUTS) +# -------------------------------------------------------- +# Rewrite a list of input files into a form suitable to put on a +# dependency list. The idea is that if an input file has a directory +# part the same as the current directory, then the directory part is +# simply removed. But if the directory part is different, then +# $(top_srcdir) is prepended. Among other things, this is used to +# generate the dependency list for the output files generated by +# AC_OUTPUT. Consider what the dependencies should look like in this +# case: +# AC_OUTPUT(src/out:src/in1:lib/in2) +# The first argument, ADD_SRCDIR, is 1 if $(top_srcdir) should be added. +# If 0 then files that require this addition will simply be ignored. +sub rewrite_inputs_into_dependencies ($@) +{ + my ($add_srcdir, @inputs) = @_; + my @newinputs; - if ($relative_dir eq '.') + foreach my $single (@inputs) { - &push_dist_common ('acconfig.h') - if -f 'acconfig.h'; + if (dirname ($single) eq $relative_dir) + { + push (@newinputs, basename ($single)); + } + elsif ($add_srcdir) + { + push (@newinputs, '$(top_srcdir)/' . $single); + } } - # 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); + return @newinputs; +} - # 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) +# Handle remaking and configure stuff. +# We need the name of the input file, to do proper remaking rules. +sub handle_configure +{ + my ($local, $input, @secondary_inputs) = @_; + + my $input_base = basename ($input); + my $local_base = basename ($local); + + my $amfile = $input_base . '.am'; + # We know we can always add '.in' because it really should be an + # error if the .in was missing originally. + my $infile = '$(srcdir)/' . $input_base . '.in'; + my $colon_infile = ''; + if ($local ne $input || @secondary_inputs) + { + $colon_infile = ':' . $input . '.in'; + } + $colon_infile .= ':' . join (':', @secondary_inputs) + if @secondary_inputs; + + my @rewritten = rewrite_inputs_into_dependencies (1, @secondary_inputs); + + my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4 (); + + $output_rules .= + &file_contents ('configure', + ('MAKEFILE' + => $local_base, + 'MAKEFILE-DEPS' + => "@rewritten", + 'CONFIG-MAKEFILE' + => ((($relative_dir eq '.') ? '$@' : '$(subdir)/$@') + . $colon_infile), + 'MAKEFILE-IN' + => $infile, + 'MAKEFILE-IN-DEPS' + => "@include_stack", + 'MAKEFILE-AM' + => $amfile, + 'STRICTNESS' + => $cygnus_mode ? 'cygnus' : $strictness_name, + 'USE-DEPS' + => $cmdline_use_dependencies ? '' : ' --ignore-deps', + 'MAKEFILE-AM-SOURCES' + => "$input$colon_infile", + 'REGEN-ACLOCAL-M4' + => $regen_aclocal_m4, + 'ACLOCAL_M4_DEPS' + => "@aclocal_m4_deps")); + + 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 = ''; + $cn_sans_dir = basename ($config_h_path); + $stamp_dir = ''; } - else + else { - $cn_sans_dir = $config_h_path; - if ($config_h_dir eq '.') + $cn_sans_dir = $config_h_path; + if ($config_h_dir eq '.') { - $stamp_dir = ''; + $stamp_dir = ''; } - else + else { - $stamp_dir = $config_h_dir . '/'; + $stamp_dir = $config_h_dir . '/'; } } - # This will also distribute all inputs. - @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins); + # Compute relative path from directory holding output + # header to directory holding input header. FIXME: + # doesn't handle case where we have multiple inputs. + my $in0_sans_dir; + if (dirname ($ins[0]) eq $relative_dir) + { + $in0_sans_dir = basename ($ins[0]); + } + else + { + $in0_sans_dir = backname ($relative_dir) . '/' . $ins[0]; + } - # Cannot define rebuild rules for filenames with shell variables. - next if (substitute_ac_subst_variables $config_h_path) =~ /\$/; + require_file ($config_header_location, FOREIGN, $in0_sans_dir); - # Header defined in this directory. - my @files; - if (-f $config_h_path . '.top') + # Header defined and in this directory. + my @files; + if (-f $config_h_path . '.top') { - push (@files, "$cn_sans_dir.top"); + push (@files, "$cn_sans_dir.top"); } - if (-f $config_h_path . '.bot') + if (-f $config_h_path . '.bot') { - push (@files, "$cn_sans_dir.bot"); + push (@files, "$cn_sans_dir.bot"); } - push_dist_common (@files); + push_dist_common (@files); - # For now, acconfig.h can only appear in the top srcdir. - if (-f 'acconfig.h') + # For now, acconfig.h can only appear in the top srcdir. + if (-f 'acconfig.h') { - push (@files, '$(top_srcdir)/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"); + my $stamp = "${stamp_dir}stamp-h${hdr_index}"; + $output_rules .= + file_contents ('remake-hdr', + ('FILES' => "@files", + 'CONFIG_H' => $cn_sans_dir, + 'CONFIG_HIN' => $in0_sans_dir, + 'CONFIG_H_PATH' => $config_h_path, + 'STAMP' => "$stamp")); - push @distclean_config, $cn_sans_dir, $stamp; + push @distclean_config, $cn_sans_dir, $stamp; } } - $output_rules .= file_contents ('clean-hdr', - new Automake::Location, - FILES => "@distclean_config") - if @distclean_config; + $output_rules .= file_contents ('clean-hdr', + ('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 existing script 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); - } + # Set location of mkinstalldirs. + define_variable ('mkinstalldirs', + ('$(SHELL) ' . $config_aux_dir . '/mkinstalldirs')); - reject_var ('CONFIG_HEADER', - "`CONFIG_HEADER' is an anachronism; now determined " - . "automatically\nfrom `$configure_ac'"); + 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)) + 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); + push @config_h, basename ($out); } - else + else { - push @config_h, "\$(top_builddir)/$out"; + push @config_h, "\$(top_builddir)/$out"; } } - define_variable ("CONFIG_HEADER", "@config_h", INTERNAL) - if @config_h; + define_variable ("CONFIG_HEADER", "@config_h") + 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) + # 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 =~ /^([^:]*):(.*)$/) + my $file; + my @inputs; + if ($lfile =~ /^([^:]*):(.*)$/) { - # This is the ":" syntax of AC_OUTPUT. - $file = $1; - @inputs = split (':', $2); + # This is the ":" syntax of AC_OUTPUT. + $file = $1; + @inputs = split (':', $2); } - else + else { - # Normal usage. - $file = $lfile; - @inputs = $file . '.in'; + # 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'; + # Automake files should not be stored in here, but in %MAKE_LIST. + prog_error "$lfile in \@other_input_files" + if -f $file . '.am'; - my $local = basename ($file); + my $local = basename ($file); - # 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) + # 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 '.') { - if ($relative_dir eq '.' && ! &is_make_dir ($fd)) - { - $local = $file; - } - else + foreach (@inputs) { - next; + $dist_dirs{dirname ($_)} = 1; } } - my @rewritten_inputs = rewrite_inputs_into_dependencies ($file, @inputs); - - # Cannot output rules for shell variables. - next if (substitute_ac_subst_variables $local) =~ /\$/; - - $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 ((substitute_ac_subst_variables $link) !~ /\$/) + # 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) { - # 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)) { - if ($relative_dir eq '.' && ! &is_make_dir ($fd)) - { - $local = $link; - } - else - { - $local = undef; - } + $local = $file; } - push @actual_other_files, $local if $local; - } - - # Do not process sources that contain shell variables. - if ((substitute_ac_subst_variables $file) !~ /\$/) - { - my $fd = dirname ($file); - - # 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))) + else { - # 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); + next; } } + + my @rewritten_inputs = rewrite_inputs_into_dependencies (1, @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); + + # Require all input files. + require_file ($ac_config_files_location, FOREIGN, + rewrite_inputs_into_dependencies (0, @inputs)); } - # These files get removed by "make distclean". - define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL, - @actual_other_files); + # These files get removed by "make clean". + define_pretty_variable ('CONFIG_CLEAN_FILES', '', @actual_other_files); } # Handle C headers. @@ -4195,8 +4608,8 @@ sub handle_headers 'noinst', 'check'); foreach (@r) { - next unless $_->[1] =~ /\..*$/; - &saw_extension ($&); + next unless /\..*$/; + &saw_extension ($&); } } @@ -4204,54 +4617,20 @@ sub handle_gettext { return if ! $seen_gettext || $relative_dir ne '.'; - my $subdirs = var 'SUBDIRS'; - - if (! $subdirs) + if (! variable_defined ('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 and AM_GNU_GETTEXT_INTL_SUBDIR is not called. - msg_var ('syntax', $subdirs, - "AM_GNU_GETTEXT used but `intl' not in SUBDIRS") - if (! ($seen_gettext_external && ! $seen_gettext_intl) - && ! grep ($_ eq 'intl', @subdirs)); - - # intl/ should not be used with AM_GNU_GETTEXT([external]), except - # if AM_GNU_GETTEXT_INTL_SUBDIR is called. - msg_var ('syntax', $subdirs, - "`intl' should not be in SUBDIRS when " - . "AM_GNU_GETTEXT([external]) is used") - if ($seen_gettext_external && ! $seen_gettext_intl - && grep ($_ eq 'intl', @subdirs)); - } + my @subdirs = &variable_value_as_list_recursive ('SUBDIRS', 'all'); + err_var '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. + err_var 'SUBDIRS', "AM_GNU_GETTEXT used but `intl' not in SUBDIRS" + if (! $seen_gettext_external + && ! grep ($_ eq 'intl', @subdirs)); require_file ($ac_gettext_location, GNU, 'ABOUT-NLS'); } @@ -4259,26 +4638,30 @@ sub handle_gettext # Handle footer elements. sub handle_footer { - reject_rule ('.SUFFIXES', - "use variable `SUFFIXES', not target `.SUFFIXES'"); + # 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_target ('.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) + if (@suffixes || variable_defined ('SUFFIXES')) { - # Make sure SUFFIXES has unique elements. Sort them to ensure + # 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 @user_suffixes = (variable_defined ('SUFFIXES') + ? &variable_value_as_list_recursive ('SUFFIXES', '') + : ()); my %suffixes = map { $_ => 1 } @suffixes; delete @suffixes{@user_suffixes}; @@ -4288,23 +4671,19 @@ sub handle_footer . "\n"); } - $output_trailer .= file_contents ('footer', new Automake::Location); + $output_trailer .= file_contents ('footer'); } - -# Generate `make install' rules. -sub handle_install () +# Deal with installdirs target. +sub handle_installdirs () { - $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') || ''); + $output_rules .= + &file_contents ('install', + ('am__installdirs' + => variable_value ('am__installdirs') || '', + 'installdirs-local' + => (target_defined ('installdirs-local') + ? ' installdirs-local' : ''))); } @@ -4328,8 +4707,11 @@ sub handle_all ($) } # Install `all' hooks. - push (@all, "all-local") - if user_phony_rule "all-local"; + if (&target_defined ("all-local")) + { + push (@all, "all-local"); + &depend ('.PHONY', "all-local"); + } &pretty_print_rule ("all-am:", "\t\t", @all); &depend ('.PHONY', 'all-am', 'all'); @@ -4339,7 +4721,7 @@ sub handle_all ($) my @local_headers = (); push @local_headers, '$(BUILT_SOURCES)' - if var ('BUILT_SOURCES'); + if variable_defined ('BUILT_SOURCES'); foreach my $spec (@config_headers) { my ($out, @ins) = split_config_file_spec ($spec); @@ -4358,76 +4740,71 @@ sub handle_all ($) $output_all .= ("all: @local_headers" . "\n\t" . '$(MAKE) $(AM_MAKEFLAGS) ' - . (var ('SUBDIRS') ? 'all-recursive' : 'all-am') + . (variable_defined ('SUBDIRS') + ? 'all-recursive' : 'all-am') . "\n\n"); } else { - $output_all .= "all: " . (var ('SUBDIRS') + $output_all .= "all: " . (variable_defined ('SUBDIRS') ? 'all-recursive' : 'all-am') . "\n\n"; } } -# &do_check_merge_target () -# ------------------------- # Handle check merge target specially. -sub do_check_merge_target () +sub do_check_merge_target { - # Include user-defined local form of target. - push @check_tests, 'check-local' - if user_phony_rule 'check-local'; + if (&target_defined ('check-local')) + { + # User defined local form of target. So include it. + push (@check_tests, 'check-local'); + &depend ('.PHONY', 'check-local'); + } - # In --cygnus mode, check doesn't depend on all. - if (option 'cygnus') + # In --cygnus mode, check doesn't depend on all. + if ($cygnus_mode) { - # Just run the local check rules. - pretty_print_rule ('check-am:', "\t\t", @check); + # Just run the local check rules. + &pretty_print_rule ('check-am:', "\t\t", @check); } - else + 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) -# ------------------------ + # 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'); + $output_rules .= ("check: " + . (variable_defined ('SUBDIRS') + ? 'check-recursive' : 'check-am') + . "\n"); +} + # Handle all 'clean' targets. -sub handle_clean ($) +sub handle_clean { - my ($makefile) = @_; - # Clean the files listed in user variables if they exist. $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN - if var ('MOSTLYCLEANFILES'); + if variable_defined ('MOSTLYCLEANFILES'); $clean_files{'$(CLEANFILES)'} = CLEAN - if var ('CLEANFILES'); + if variable_defined ('CLEANFILES'); $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN - if var ('DISTCLEANFILES'); + if variable_defined ('DISTCLEANFILES'); $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN - if var ('MAINTAINERCLEANFILES'); + if variable_defined ('MAINTAINERCLEANFILES'); # Built sources are automatically removed by maintainer-clean. $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN - if var ('BUILT_SOURCES'); + if variable_defined ('BUILT_SOURCES'); # Compute a list of "rm"s to run for each target. my %rms = (MOSTLY_CLEAN, [], @@ -4451,32 +4828,37 @@ sub handle_clean ($) $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, - ); + MOSTLYCLEAN_RMS => join ('', @{$rms{&MOSTLY_CLEAN}}), + CLEAN_RMS => join ('', @{$rms{&CLEAN}}), + DISTCLEAN_RMS => join ('', @{$rms{&DIST_CLEAN}}), + MAINTAINER_CLEAN_RMS => join ('', @{$rms{&MAINTAINER_CLEAN}})); +} + + +# &depend ($CATEGORY, @DEPENDENDEES) +# ---------------------------------- +# The target $CATEGORY depends on @DEPENDENDEES. +sub depend +{ + my ($category, @dependendees) = @_; + { + push (@{$dependencies{$category}}, @dependendees); + } } # &target_cmp ($A, $B) # -------------------- -# Subroutine for &handle_factored_dependencies to let `.PHONY' and -# other `.TARGETS' be last. +# Subroutine for &handle_factored_dependencies to let `.PHONY' be last. sub target_cmp { - return 0 if $a eq $b; - - my $a1 = substr ($a, 0, 1); - my $b1 = substr ($b, 0, 1); - if ($a1 ne $b1) - { - return -1 if $b1 eq '.'; - return 1 if $a1 eq '.'; - } - return $a cmp $b; + return 0 + if $a eq $b; + return -1 + if $b eq '.PHONY'; + return 1 + if $a eq '.PHONY'; + return $a cmp $b; } @@ -4487,45 +4869,43 @@ sub handle_factored_dependencies { # Reject bad hooks. foreach my $utarg ('uninstall-data-local', 'uninstall-data-hook', - 'uninstall-exec-local', 'uninstall-exec-hook', - 'uninstall-dvi-local', - 'uninstall-html-local', - 'uninstall-info-local', - 'uninstall-pdf-local', - 'uninstall-ps-local') + 'uninstall-exec-local', 'uninstall-exec-hook') { my $x = $utarg; - $x =~ s/-.*-/-/; - reject_rule ($utarg, "use `$x', not `$utarg'"); + $x =~ s/(data|exec)-//; + reject_target ($utarg, "use `$x', not `$utarg'"); } - reject_rule ('install-local', - "use `install-data-local' or `install-exec-local', " - . "not `install-local'"); + reject_target ('install-local', + "use `install-data-local' or `install-exec-local', " + . "not `install-local'"); - reject_rule ('install-hook', - "use `install-data-hook' or `install-exec-hook', " - . "not `install-hook'"); + reject_target ('install-info-local', + "`install-info-local' target defined but " + . "`no-installinfo' option not in use") + unless defined $options{'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"; + if (&target_defined ("$_-local")) + { + depend ("$_-am", "$_-local"); + &depend ('.PHONY', "$_-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") + if (&target_defined ("$_-hook")) { $actions{"$_-am"} .= ("\t\@\$(NORMAL_INSTALL)\n" . "\t" . '$(MAKE) $(AM_MAKEFLAGS) ' . "$_-hook\n"); - depend ('.MAKE', "$_-am"); } } @@ -4540,30 +4920,11 @@ sub handle_factored_dependencies 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. - # Likewise for `.MAKE'. - my @undefined_conds = (TRUE,); - if ($_ ne '.PHONY' && $_ ne '.MAKE') - { - @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"; - } + &pretty_print_rule ("$_:", "\t", + uniq (sort @{$dependencies{$_}})); + $output_rules .= $actions{$_} + if defined $actions{$_}; + $output_rules .= "\n"; } } @@ -4573,14 +4934,14 @@ sub handle_factored_dependencies sub handle_tests_dejagnu { push (@check_tests, 'check-DEJAGNU'); - $output_rules .= file_contents ('dejagnu', new Automake::Location); + $output_rules .= file_contents ('dejagnu'); } # Handle TESTS variable and other checks. sub handle_tests { - if (option 'dejagnu') + if (defined $options{'dejagnu'}) { &handle_tests_dejagnu; } @@ -4593,13 +4954,10 @@ sub handle_tests } } - if (var ('TESTS')) + if (variable_defined ('TESTS')) { push (@check_tests, 'check-TESTS'); - $output_rules .= &file_contents ('check', new Automake::Location); - - # Tests that are known programs should have $(EXEEXT) appended. - append_exeext { exists $known_programs{$_[0]} } 'TESTS'; + $output_rules .= &file_contents ('check'); } } @@ -4611,19 +4969,16 @@ sub handle_emacs_lisp 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)'); + # Generate .elc files. + my @elcfiles = map { $_ . 'c' } @elfiles; + define_pretty_variable ('ELCFILES', '', @elcfiles); - push @all, '$(ELCFILES)'; + push (@all, '$(ELCFILES)'); - require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE, + require_variables ("$am_file.am", "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); + require_conf_file ("$am_file.am", FOREIGN, 'elisp-comp'); + &define_variable ('elisp_comp', $config_aux_dir . '/elisp-comp'); } # Handle Python @@ -4633,9 +4988,10 @@ sub handle_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); + require_variables ("$am_file.am", "Python sources seen", 'TRUE', + 'PYTHON'); + require_conf_file ("$am_file.am", FOREIGN, 'py-compile'); + &define_variable ('py_compile', $config_aux_dir . '/py-compile'); } # Handle Java. @@ -4668,7 +5024,7 @@ sub handle_java # Handle some of the minor options. sub handle_minor_options { - if (option 'readme-alpha') + if (defined $options{'readme-alpha'}) { if ($relative_dir eq '.') { @@ -4682,7 +5038,8 @@ sub handle_minor_options { # This means we have an alpha release. See # GNITS_VERSION_PATTERN for details. - push_dist_common ('README-alpha'); + require_file_with_macro ('TRUE', 'AUTOMAKE_OPTIONS', + FOREIGN, 'README-alpha'); } } } @@ -4706,59 +5063,47 @@ sub split_config_file_spec ($) 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) -# --------------------------------------------------- +# &scan_autoconf_config_files ($CONFIG-FILES) +# ------------------------------------------- # Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES # (or AC_OUTPUT). -sub scan_autoconf_config_files ($$) +sub scan_autoconf_config_files { - my ($where, $config_files) = @_; - - # Look at potential Makefile.am's. - foreach (split ' ', $config_files) + my ($config_files) = @_; + # Look at potential Makefile.am's. + foreach (split ' ', $config_files) { - # Must skip empty string for Perl 4. - next if $_ eq "\\" || $_ eq ''; + # 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) + # Handle $local:$input syntax. Note that we ignore + # every input file past the first, though we keep + # those around for later. + my ($local, $input, @rest) = split (/:/); + if (! $input) { - # We have a file that automake should generate. - $make_list{$input} = join (':', ($local, @rest)); + $input = $local; } - else + else { - # We have a file that automake should cause to be - # rebuilt, but shouldn't generate itself. - push (@other_input_files, $_); + # FIXME: should be error if .in is missing. + $input =~ s/\.in$//; + } + + if (-f $input . '.am') + { + # 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; } } @@ -4769,46 +5114,27 @@ 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_LIBOBJ_DIR => 1, - AC_CONFIG_LINKS => 1, - AC_INIT => 0, - AC_LIBSOURCE => 1, - AC_REQUIRE_AUX_FILE => 1, - AC_SUBST_TRACE => 1, - AM_AUTOMAKE_VERSION => 1, - AM_CONDITIONAL => 2, - AM_ENABLE_MULTILIB => 0, - AM_GNU_GETTEXT => 0, - AM_GNU_GETTEXT_INTL_SUBDIR => 0, - AM_INIT_AUTOMAKE => 0, - AM_MAINTAINER_MODE => 0, - AM_PROG_CC_C_O => 0, - _AM_SUBST_NOTMAKE => 1, - LT_SUPPORTED_TAG => 1, - _LT_AC_TAGCONFIG => 0, - m4_include => 1, - m4_sinclude => 1, - sinclude => 1, - ); + my @traced = qw(AC_CANONICAL_HOST + AC_CANONICAL_SYSTEM + AC_CONFIG_AUX_DIR + AC_CONFIG_FILES + AC_CONFIG_HEADERS + AC_INIT + AC_LIBSOURCE + AC_SUBST + AM_AUTOMAKE_VERSION + AM_CONDITIONAL + AM_GNU_GETTEXT + AM_INIT_AUTOMAKE + AM_MAINTAINER_MODE + AM_PROG_CC_C_O); my $traces = ($ENV{AUTOCONF} || 'autoconf') . " "; # 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)); + map { "--trace=$_" . ':\$f:\$l::\$n::\${::}%' } @traced); my $tracefh = new Automake::XFile ("$traces $filename |"); verb "reading $traces"; @@ -4816,209 +5142,101 @@ sub scan_autoconf_traces ($) while ($_ = $tracefh->getline) { chomp; - my ($here, @args) = split (/::/); - my $where = new Automake::Location $here; + my ($here, @args) = split /::/; 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 ($macro eq 'AC_CANONICAL_HOST') { - if ($seen_canonical <= AC_CANONICAL_HOST) + if (! $seen_canonical) { $seen_canonical = AC_CANONICAL_HOST; - $canonical_location = $where; - } + $canonical_location = $here; + }; } - elsif ($macro eq 'AC_CANONICAL_TARGET') + elsif ($macro eq 'AC_CANONICAL_SYSTEM') { - $seen_canonical = AC_CANONICAL_TARGET; - $canonical_location = $where; + $seen_canonical = AC_CANONICAL_SYSTEM; + $canonical_location = $here; } 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); + @config_aux_path = $args[1]; + $config_aux_dir_set_in_configure_in = 1; } elsif ($macro eq 'AC_CONFIG_FILES') { # Look at potential Makefile.am's. - scan_autoconf_config_files ($where, $args[1]); + $ac_config_files_location = $here; + &scan_autoconf_config_files ($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_LIBOBJ_DIR') - { - $config_libobj_dir = $args[1]; - $relative_dir = '.'; - check_directory ($config_libobj_dir, $where); - } - 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; - } + $config_header_location = $here; + push @config_headers, split (' ', $args[1]); } elsif ($macro eq 'AC_INIT') { if (defined $args[2]) { $package_version = $args[2]; - $package_version_location = $where; + $package_version_location = $here; } } elsif ($macro eq 'AC_LIBSOURCE') { $libsources{$args[1]} = $here; } - elsif ($macro eq 'AC_REQUIRE_AUX_FILE') - { - # Only remember the first time a file is required. - $required_aux_file{$args[1]} = $where - unless exists $required_aux_file{$args[1]}; - } - elsif ($macro eq 'AC_SUBST_TRACE') + elsif ($macro eq 'AC_SUBST') { - # Just check for alphanumeric in AC_SUBST_TRACE. If you do + # Just check for alphanumeric in AC_SUBST. If you do # AC_SUBST(5), then too bad. - $configure_vars{$args[1]} = $where + $configure_vars{$args[1]} = $here 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]; + err ($here, + "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") + 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; + $configure_cond{$args[1]} = $here; } elsif ($macro eq 'AM_GNU_GETTEXT') { - $seen_gettext = $where; - $ac_gettext_location = $where; + $seen_gettext = $here; + $ac_gettext_location = $here; $seen_gettext_external = grep ($_ eq 'external', @args); } - elsif ($macro eq 'AM_GNU_GETTEXT_INTL_SUBDIR') - { - $seen_gettext_intl = $where; - } elsif ($macro eq 'AM_INIT_AUTOMAKE') { - $seen_init_automake = $where; + $seen_init_automake = $here; if (defined $args[2]) { $package_version = $args[2]; - $package_version_location = $where; + $package_version_location = $here; } elsif (defined $args[1]) { - exit $exit_code - if (process_global_option_list ($where, - split (' ', $args[1]))); + $global_options = $args[1]; } } elsif ($macro eq 'AM_MAINTAINER_MODE') { - $seen_maint_mode = $where; + $seen_maint_mode = $here; } elsif ($macro eq 'AM_PROG_CC_C_O') { - $seen_cc_c_o = $where; + $seen_cc_c_o = $here; } - elsif ($macro eq '_AM_SUBST_NOTMAKE') - { - $ignored_configure_vars{$args[1]} = $where; - } - elsif ($macro eq 'm4_include' - || $macro eq 'm4_sinclude' - || $macro eq 'sinclude') - { - # Skip missing `sinclude'd files. - next if $macro ne 'm4_include' && ! -f $args[1]; - - # Some modified versions of Autoconf don't use - # frozen 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; - $libtool_new_api = 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 - # preferred 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; + } } @@ -5027,113 +5245,64 @@ sub scan_autoconf_traces ($) # 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 () +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; - } + # 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 = (); - 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; - } + $configure_ac = find_configure_ac; + fatal "`configure.ac' or `configure.in' is required\n" + if !$configure_ac; + scan_autoconf_traces ($configure_ac); - 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 + # Set input and output files if not specified by user. + if (! @input_files) { - 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"); - } - } + @input_files = sort keys %make_list; + %output_files = %make_list; } - 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. + @configure_input_files = sort keys %make_list; - # 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); + err_ac "`AM_INIT_AUTOMAKE' must be used" + if ! $seen_init_automake; - # 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 = '.'; - foreach my $file (keys %required_aux_file) - { - require_conf_file ($required_aux_file{$file}->get, FOREIGN, $file) - } - err_am "`install.sh' is an anachronism; use `install-sh' instead" - if -f $config_aux_dir . '/install.sh'; + if (! $seen_automake_version) + { + if (-f 'aclocal.m4') + { + err ($seen_init_automake || $me, + "your implementation of AM_INIT_AUTOMAKE comes from " . + "an\nold Automake version. You should recreate " . + "aclocal.m4\nwith aclocal and run automake again.\n"); + } + else + { + err ($seen_init_automake || $me, + "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"); + } + } - # Preserve dist_common for later. - $configure_dist_common = variable_value ('DIST_COMMON') || ''; + # 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 so that + # the file-finding machinery works. + # FIXME: Is this broken because it needs dynamic scopes. + # My tests seems to show it's not the case. + $relative_dir = '.'; + require_conf_file ($configure_ac, FOREIGN, + 'install-sh', 'mkinstalldirs', 'missing'); + err_am "`install.sh' is an anachronism; use `install-sh' instead" + if -f $config_aux_path[0] . '/install.sh'; + # Preserve dist_common for later. + $configure_dist_common = variable_value ('DIST_COMMON', 'TRUE') || ''; } ################################################################ @@ -5141,13 +5310,12 @@ sub scan_autoconf_files () # Set up for Cygnus mode. sub check_cygnus { - my $cygnus = option 'cygnus'; - return unless $cygnus; + return unless $cygnus_mode; - set_strictness ('foreign'); - set_option ('no-installinfo', $cygnus); - set_option ('no-dependencies', $cygnus); - set_option ('no-dist', $cygnus); + &set_strictness ('foreign'); + $options{'no-installinfo'} = 1; + $options{'no-dependencies'} = 1; + $use_dependencies = 0; err_ac "`AM_MAINTAINER_MODE' required when --cygnus specified" if !$seen_maint_mode; @@ -5159,29 +5327,22 @@ 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/) + my $license = 'COPYING'; + foreach (qw /COPYING.LIB COPYING.LESSER/) { - if (-f $_) - { - $license = $_; - last; - } + $license = $_ if -f $_; } - require_file ("$am_file.am", GNU, 'COPYING') - unless $license; + require_file ("$am_file.am", GNU, $license, + qw/INSTALL NEWS README AUTHORS ChangeLog/); } for my $opt ('no-installman', 'no-installinfo') { - msg ('error-gnu', option $opt, - "option `$opt' disallowed by GNU standards") - if option $opt; + msg_var ('error-gnu', 'AUTOMAKE_OPTIONS', + "option `$opt' disallowed by GNU standards") + if (defined $options{$opt}); } } @@ -5205,7 +5366,7 @@ sub check_gnits_standards # 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 +# handle_single_transform_list. 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. @@ -5214,37 +5375,33 @@ sub check_gnits_standards # when a subdir object should be used. sub lang_sub_obj { - return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS; + return defined $options{'subdir-objects'} ? LANG_SUBDIR : LANG_PROCESS; } # Rewrite a single C source file. sub lang_c_rewrite { - my ($directory, $base, $ext, $nonansi_obj, $have_per_exec_flags, $var) = @_; + my ($directory, $base, $ext) = @_; - if (option 'ansi2knr' && $base =~ /_$/) + if (defined $options{'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') + if (defined $options{'subdir-objects'}) { $r = LANG_SUBDIR; - if ($directory && $directory ne '.') - { - $base = $directory . '/' . $base; + $base = $directory . '/' . $base + unless $directory eq '.' || $directory eq ''; - # libtool is always able to put the object at the proper place, - # so we do not have to require AM_PROG_CC_C_O when building .lo files. - msg_var ('portability', $var, - "compiling `$base.c' in subdir requires " - . "`AM_PROG_CC_C_O' in `$configure_ac'", - uniq_scope => US_GLOBAL, - uniq_part => 'AM_PROG_CC_C_O subdir') - unless $seen_cc_c_o || $nonansi_obj eq '.lo'; - } + 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. @@ -5257,18 +5414,6 @@ sub lang_c_rewrite : "$directory/"); } - if (! $seen_cc_c_o - && $have_per_exec_flags - && ! option 'subdir-objects' - && $nonansi_obj ne '.lo') - { - msg_var ('portability', - $var, "compiling `$base.c' with per-target flags requires " - . "`AM_PROG_CC_C_O' in `$configure_ac'", - uniq_scope => US_GLOBAL, - uniq_part => 'AM_PROG_CC_C_O per-target') - } - return $r; } @@ -5331,30 +5476,12 @@ sub lang_asm_rewrite return &lang_sub_obj; } -# Rewrite a single preprocessed assembly file. -sub lang_cppasm_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 { @@ -5373,12 +5500,6 @@ sub lang_objc_rewrite return &lang_sub_obj; } -# Rewrite a single Unified Parallel C file. -sub lang_upc_rewrite -{ - return &lang_sub_obj; -} - # Rewrite a single Java file. sub lang_java_rewrite { @@ -5399,11 +5520,13 @@ sub lang_c_finish { if ($file =~ /^(.*)\.[cly]$/ && -f "$relative_dir/$file") { - $de_ansi_files{$1} = '' + $de_ansi_files{$1} = (($relative_dir eq '.' || $relative_dir eq '') + ? '' + : "$relative_dir/"); } } - if (option 'ansi2knr' && keys %de_ansi_files) + if (defined $options{'ansi2knr'} && keys %de_ansi_files) { # Make all _.c files depend on their corresponding .c files. my @objects; @@ -5422,19 +5545,13 @@ sub lang_c_finish . '; then echo $(srcdir)/' . $ansfile . '; else echo ' . $ansfile . '; fi` ' . "| sed 's/^# \\([0-9]\\)/#line \\1/' " - . '| $(ANSI2KNR) > $@' + . '| $(ANSI2KNR) > ' . $base . "_.c" # If ansi2knr fails then we shouldn't # create the _.c file - . " || rm -f \$\@\n"); + . " || rm -f ${base}_.c\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 '.'; + if variable_defined ('LIBTOOL'); } # Make all _.o (and _.lo) files depend on ansi2knr. @@ -5447,13 +5564,13 @@ sub lang_c_finish # compile a yacc file. sub lang_yacc_target_hook { - my ($self, $aggregate, $output, $input, %transform) = @_; + my ($self, $aggregate, $output, $input) = @_; 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)) + if ((variable_defined ($flag) + && &variable_value ($flag) =~ /$DASH_D_PATTERN/o) + || (variable_defined ('YFLAGS') + && &variable_value ('YFLAGS') =~ /$DASH_D_PATTERN/o)) { (my $output_base = $output) =~ s/$KNOWN_EXTENSIONS_PATTERN$//; my $header = $output_base . '.h'; @@ -5461,25 +5578,14 @@ sub lang_yacc_target_hook # 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) \$(AM_MAKEFLAGS) $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'}; - + # FIXME: this fails for `nodist_*_SOURCES'. + $output_rules .= ("${header}: $output\n" + # Recover from removal of $header + . "\t\@if test ! -f \$@; then \\\n" + . "\t rm -f $output; \\\n" + . "\t \$(MAKE) $output; \\\n" + . "\telse :; fi\n"); + &push_dist_common ($header); # 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 @@ -5509,12 +5615,22 @@ sub lang_lex_target_hook # 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; + return if defined $language_scratch{'lex-yacc-done'}; + $language_scratch{'lex-yacc-done'} = 1; - # FIXME: for now, no line number. - require_conf_file ($configure_ac, FOREIGN, 'ylwrap'); - &define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL); + # 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'); + if ($config_aux_dir_set_in_configure_in) + { + &define_variable ('YLWRAP', $config_aux_dir . "/ylwrap"); + } + else + { + &define_variable ('YLWRAP', '$(top_srcdir)/ylwrap'); + } } sub lang_yacc_finish @@ -5524,7 +5640,8 @@ sub lang_yacc_finish reject_var 'YACCFLAGS', "`YACCFLAGS' obsolete; use `YFLAGS' instead"; - yacc_lex_finish_helper; + &yacc_lex_finish_helper + if count_files_for_language ('yacc') > 1; } @@ -5533,7 +5650,8 @@ sub lang_lex_finish return if defined $language_scratch{'lex-done'}; $language_scratch{'lex-done'} = 1; - yacc_lex_finish_helper; + &yacc_lex_finish_helper + if count_files_for_language ('lex') > 1; } @@ -5545,7 +5663,7 @@ sub resolve_linker { my (%linkers) = @_; - foreach my $l (qw(GCJLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK)) + foreach my $l (qw(GCJLINK CXXLINK F77LINK OBJCLINK)) { return $l if defined $linkers{$l}; } @@ -5645,28 +5763,12 @@ sub register_language (%) unless defined $option{'flags'}; $option{'output_extensions'} = sub { return ( '.$(OBJEXT)', '.lo' ) } unless defined $option{'output_extensions'}; - $option{'nodist_specific'} = 0 - unless defined $option{'nodist_specific'}; my $lang = new Language (%option); # Fill indexes. - $extension_map{$_} = $lang->name foreach @{$lang->extensions}; + grep ($extension_map{$_} = $lang->name, @{$lang->extensions}); $languages{$lang->name} = $lang; - my $link = $lang->linker; - if ($link) - { - if (exists $link_languages{$link}) - { - prog_error ("`$link' has different definitions in " - . $lang->name . " and " . $link_languages{$link}->name) - if $lang->link ne $link_languages{$link}->link; - } - else - { - $link_languages{$link} = $lang; - } - } # Update the pattern of known extensions. accept_extensions (@{$lang->extensions}); @@ -5676,7 +5778,7 @@ sub register_language (%) { foreach my $dest (&{$lang->output_extensions} ($suffix)) { - register_suffix_rule (INTERNAL, $suffix, $dest); + ®ister_suffix_rule ('internal', $suffix, $dest); } } } @@ -5684,7 +5786,7 @@ sub register_language (%) # 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'. +# to $OBJ or to some other suffix we recognize internally, eg `cc'. sub derive_suffix ($$) { my ($source_ext, $obj) = @_; @@ -5703,188 +5805,1508 @@ sub derive_suffix ($$) ################################################################ +# Pretty-print something. HEAD is what should be printed at the +# beginning of the first line, FILL is what should be printed at the +# beginning of every subsequent line. +sub pretty_print_internal +{ + my ($head, $fill, @values) = @_; + + my $column = length ($head); + my $result = $head; + + # Fill length is number of characters. However, each Tab + # character counts for eight. So we count the number of Tabs and + # multiply by 7. + my $fill_length = length ($fill); + $fill_length += 7 * ($fill =~ tr/\t/\t/d); + + foreach (@values) + { + # "71" because we also print a space. + if ($column + length ($_) > 71) + { + $result .= " \\\n" . $fill; + $column = $fill_length; + } + $result .= ' ' if $result =~ /\S\z/; + $result .= $_; + $column += length ($_) + 1; + } + + $result .= "\n"; + return $result; +} + +# Pretty-print something and append to output_vars. +sub pretty_print +{ + $output_vars .= &pretty_print_internal (@_); +} + # Pretty-print something and append to output_rules. sub pretty_print_rule { - $output_rules .= &makefile_wrap (@_); + $output_rules .= &pretty_print_internal (@_); } ################################################################ -## -------------------------------- ## -## Handling the conditional stack. ## -## -------------------------------- ## +# $STRING +# &conditional_string(@COND-STACK) +# -------------------------------- +# Build a string which denotes the conditional in @COND-STACK. Some +# simplifications are done: `TRUE' entries are elided, and any `FALSE' +# entry results in a return of `FALSE'. +sub conditional_string +{ + my (@stack) = @_; + + if (grep (/^FALSE$/, @stack)) + { + return 'FALSE'; + } + else + { + return join (' ', uniq sort grep (!/^TRUE$/, @stack)); + } +} + + +# $BOOLEAN +# &conditional_true_when ($COND, $WHEN) +# ------------------------------------- +# See if a conditional is true. Both arguments are conditional +# strings. This returns true if the first conditional is true when +# the second conditional is true. +# For instance with $COND = `BAR FOO', and $WHEN = `BAR BAZ FOO', +# obviously return 1, and 0 when, for instance, $WHEN = `FOO'. +sub conditional_true_when ($$) +{ + my ($cond, $when) = @_; + + # Make a hash holding all the values from $WHEN. + my %cond_vals = map { $_ => 1 } split (' ', $when); + # Nothing is true when FALSE (not even FALSE itself, but it + # shouldn't hurt if you decide to change that). + return 0 if exists $cond_vals{'FALSE'}; -# $STRING -# make_conditional_string ($NEGATE, $COND) + # Check each component of $cond, which looks `COND1 COND2'. + foreach my $comp (split (' ', $cond)) + { + # TRUE is always true. + next if $comp eq 'TRUE'; + return 0 if ! defined $cond_vals{$comp}; + } + + return 1; +} + + +# $BOOLEAN +# &conditional_is_redundant ($COND, @WHENS) # ---------------------------------------- -sub make_conditional_string ($$) +# Determine whether $COND is redundant with respect to @WHENS. +# +# Returns true if $COND is true for any of the conditions in @WHENS. +# +# If there are no @WHENS, then behave as if @WHENS contained a single empty +# condition. +sub conditional_is_redundant ($@) { - my ($negate, $cond) = @_; - $cond = "${cond}_TRUE" - unless $cond =~ /^TRUE|FALSE$/; - $cond = Automake::Condition::conditional_negate ($cond) - if $negate; - return $cond; + my ($cond, @whens) = @_; + + @whens = ("") if @whens == 0; + + foreach my $when (@whens) + { + return 1 if conditional_true_when ($cond, $when); + } + return 0; } -my %_am_macro_for_cond = - ( - AMDEP => "one of the compiler tests\n" - . " AC_PROG_CC, AC_PROG_CXX, AC_PROG_CXX, AC_PROG_OBJC,\n" - . " AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC", - am__fastdepCC => 'AC_PROG_CC', - am__fastdepCCAS => 'AM_PROG_AS', - am__fastdepCXX => 'AC_PROG_CXX', - am__fastdepGCJ => 'AM_PROG_GCJ', - am__fastdepOBJC => 'AC_PROG_OBJC', - am__fastdepUPC => 'AM_PROG_UPC' - ); +# $BOOLEAN +# &conditional_implies_any ($COND, @CONDS) +# ---------------------------------------- +# Returns true iff $COND implies any of the conditions in @CONDS. +sub conditional_implies_any ($@) +{ + my ($cond, @conds) = @_; + + @conds = ("") if @conds == 0; + + foreach my $c (@conds) + { + return 1 if conditional_true_when ($c, $cond); + } + return 0; +} + + +# $NEGATION +# condition_negate ($COND) +# ------------------------ +sub condition_negate ($) +{ + my ($cond) = @_; + + $cond =~ s/TRUE$/TRUEO/; + $cond =~ s/FALSE$/TRUE/; + $cond =~ s/TRUEO$/FALSE/; + + return $cond; +} + + +# Compare condition names. +# Issue them in alphabetical order, foo_TRUE before foo_FALSE. +sub by_condition +{ + # Be careful we might be comparing `' or `#'. + $a =~ /^(.*)_(TRUE|FALSE)$/; + my ($aname, $abool) = ($1 || '', $2 || ''); + $b =~ /^(.*)_(TRUE|FALSE)$/; + my ($bname, $bbool) = ($1 || '', $2 || ''); + return ($aname cmp $bname + # Don't bother with IFs, given that TRUE is after FALSE + # just cmp in the reverse order. + || $bbool cmp $abool + # Just in case... + || $a cmp $b); +} + + +# &make_condition (@CONDITIONS) +# ----------------------------- +# Transform a list of conditions (themselves can be an internal list +# of conditions, e.g., @CONDITIONS = ('cond1 cond2', 'cond3')) into a +# Make conditional (a pattern for AC_SUBST). +# Correctly returns the empty string when there are no conditions. +sub make_condition +{ + my $res = conditional_string (@_); + + # There are no conditions. + if ($res eq '') + { + # Nothing to do. + } + # It's impossible. + elsif ($res eq 'FALSE') + { + $res = '#'; + } + # Build it. + else + { + $res = '@' . $res . '@'; + $res =~ s/ /@@/g; + } + + return $res; +} + -# $COND + +## ------------------------------ ## +## Handling the condition stack. ## +## ------------------------------ ## + + +# $COND_STRING # cond_stack_if ($NEGATE, $COND, $WHERE) # -------------------------------------- sub cond_stack_if ($$$) { my ($negate, $cond, $where) = @_; - if (! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/) + err $where, "$cond does not appear in AM_CONDITIONAL" + if ! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/; + + $cond = "${cond}_TRUE" + unless $cond =~ /^TRUE|FALSE$/; + $cond = condition_negate ($cond) + if $negate; + + push (@cond_stack, $cond); + + return conditional_string (@cond_stack); +} + + +# $COND_STRING +# cond_stack_else ($NEGATE, $COND, $WHERE) +# ---------------------------------------- +sub cond_stack_else ($$$) +{ + my ($negate, $cond, $where) = @_; + + if (! @cond_stack) + { + err $where, "else without if"; + return; + } + + $cond_stack[$#cond_stack] = condition_negate ($cond_stack[$#cond_stack]); + + # If $COND is given, check against it. + if (defined $cond) + { + $cond = "${cond}_TRUE" + unless $cond =~ /^TRUE|FALSE$/; + $cond = condition_negate ($cond) + if $negate; + + err ($where, "else reminder ($negate$cond) incompatible with " + . "current conditional: $cond_stack[$#cond_stack]") + if $cond_stack[$#cond_stack] ne $cond; + } + + return conditional_string (@cond_stack); +} + + +# $COND_STRING +# cond_stack_endif ($NEGATE, $COND, $WHERE) +# ----------------------------------------- +sub cond_stack_endif ($$$) +{ + my ($negate, $cond, $where) = @_; + my $old_cond; + + if (! @cond_stack) + { + err $where, "endif without if: $negate$cond"; + return; + } + + + # If $COND is given, check against it. + if (defined $cond) + { + $cond = "${cond}_TRUE" + unless $cond =~ /^TRUE|FALSE$/; + $cond = condition_negate ($cond) + if $negate; + + err ($where, "endif reminder ($negate$cond) incompatible with " + . "current conditional: $cond_stack[$#cond_stack]") + if $cond_stack[$#cond_stack] ne $cond; + } + + pop @cond_stack; + + return conditional_string (@cond_stack); +} + + + + + +## ------------------------ ## +## Handling the variables. ## +## ------------------------ ## + + +# check_ambiguous_conditional ($VAR, $COND, $WHERE) +# ------------------------------------------------- +# Check for an ambiguous conditional. This is called when a variable +# is being defined conditionally. If we already know about a +# definition that is true under the same conditions, then we have an +# ambiguity. +sub check_ambiguous_conditional ($$$) +{ + my ($var, $cond, $where) = @_; + my ($message, $ambig_cond) = + conditional_ambiguous_p ($var, $cond, keys %{$var_value{$var}}); + if ($message) + { + msg 'syntax', $where, "$message ..."; + msg_var ('syntax', $var, "... `$var' previously defined here."); + verb (macro_dump ($var)); + } +} + +# $STRING, $AMBIG_COND +# conditional_ambiguous_p ($WHAT, $COND, @CONDS) +# ---------------------------------------------- +# Check for an ambiguous conditional. Return an error message and +# the other condition involved if we have one, two empty strings otherwise. +# WHAT: the thing being defined +# COND: the condition under which is is being defined +# CONDS: the conditons under which is had already been defined +sub conditional_ambiguous_p ($$@) +{ + my ($var, $cond, @conds) = @_; + foreach my $vcond (@conds) + { + # Note that these rules doesn't consider the following + # example as ambiguous. + # + # if COND1 + # FOO = foo + # endif + # if COND2 + # FOO = bar + # endif + # + # It's up to the user to not define COND1 and COND2 + # simultaneously. + my $message; + if ($vcond eq $cond) + { + return ("$var multiply defined in condition $cond", $vcond); + } + elsif (&conditional_true_when ($vcond, $cond)) + { + return ("$var was already defined in condition $vcond, " + . "which implies condition $cond", $vcond); + } + elsif (&conditional_true_when ($cond, $vcond)) + { + return ("$var was already defined in condition $vcond, " + . "which is implied by condition $cond", $vcond); + } + } + return ('', ''); +} + +# @MISSING_CONDS +# variable_not_always_defined_in_cond ($VAR, $COND) +# --------------------------------------------- +# Check whether $VAR is always defined for condition $COND. +# Return a list of conditions where the definition is missing. +# +# For instance, given +# +# if COND1 +# if COND2 +# A = foo +# D = d1 +# else +# A = bar +# D = d2 +# endif +# else +# D = d3 +# endif +# if COND3 +# A = baz +# B = mumble +# endif +# C = mumble +# +# we should have: +# variable_not_always_defined_in_cond ('A', 'COND1_TRUE COND2_TRUE') +# => () +# variable_not_always_defined_in_cond ('A', 'COND1_TRUE') +# => () +# variable_not_always_defined_in_cond ('A', 'TRUE') +# => ("COND1_FALSE COND2_FALSE COND3_FALSE", +# "COND1_FALSE COND2_TRUE COND3_FALSE", +# "COND1_TRUE COND2_FALSE COND3_FALSE", +# "COND1_TRUE COND2_TRUE COND3_FALSE") +# variable_not_always_defined_in_cond ('B', 'COND1_TRUE') +# => ("COND3_FALSE") +# variable_not_always_defined_in_cond ('C', 'COND1_TRUE') +# => () +# variable_not_always_defined_in_cond ('D', 'TRUE') +# => () +# variable_not_always_defined_in_cond ('Z', 'TRUE') +# => ("TRUE") +# +sub variable_not_always_defined_in_cond ($$) +{ + my ($var, $cond) = @_; + + # It's easy to answer if the variable is not defined. + return ("TRUE",) unless exists $var_value{$var}; + + # How does it work? Let's take the second example: + # + # variable_not_always_defined_in_cond ('A', 'COND1_TRUE') + # + # (1) First, we get the list of conditions where A is defined: + # + # ("COND1_TRUE COND2_TRUE", "COND1_TRUE COND2_FALSE", "COND3_TRUE") + # + # (2) Then we generate the set of inverted conditions: + # + # ("COND1_FALSE COND2_TRUE COND3_FALSE", + # "COND1_FALSE COND2_FALSE COND3_FALSE") + # + # (3) Finally we remove these conditions which are not implied by + # COND1_TRUE. This yields an empty list and we are done. + + my @res = (); + my @cond_defs = keys %{$var_value{$var}}; # (1) + foreach my $icond (invert_conditions (@cond_defs)) # (2) + { + prog_error "invert_conditions returned an input condition" + if exists $var_value{$var}{$icond}; + + push @res, $icond + if (conditional_true_when ($cond, $icond)); # (3) + } + return @res; +} + +# ¯o_define($VAR, $OWNER, $TYPE, $COND, $VALUE, $WHERE) +# ------------------------------------------------------------- +# The $VAR can go from Automake to user, but not the converse. +sub macro_define ($$$$$$) +{ + my ($var, $owner, $type, $cond, $value, $where) = @_; + + # We will adjust the owener of this variable unless told otherwise. + my $adjust_owner = 1; + + err $where, "bad characters in variable name `$var'" + if $var !~ /$MACRO_PATTERN/o; + + # NEWS-OS 4.2R complains if a Makefile variable begins with `_'. + msg ('portability', $where, + "$var: variable names starting with `_' are not portable") + if $var =~ /^_/; + + # `:='-style assignments are not acknowledged by POSIX. Moreover it + # has multiple meanings. In GNU make or BSD make it means "assign + # with immediate expansion", while in OSF make it is used for + # conditional assignments. + msg ('portability', $where, "`:='-style assignments are not portable") + if $type eq ':'; + + check_variable_expansions ($value, $where); + + $cond ||= 'TRUE'; + + # An Automake variable must be consistently defined with the same + # sign by Automake. A user variable must be set by either `=' or + # `:=', and later promoted to `+='. + if ($owner == VAR_AUTOMAKE) + { + if (exists $var_type{$var} + && exists $var_type{$var}{$cond} + && $var_type{$var}{$cond} ne $type) + { + err ($where, "$var was set with `$var_type{$var}=' " + . "and is now set with `$type='"); + } + } + else + { + if (!exists $var_type{$var} && $type eq '+') + { + err $where, "$var must be set with `=' before using `+='"; + } + } + $var_type{$var}{$cond} = $type; + + # When adding, since we rewrite, don't try to preserve the + # Automake continuation backslashes. + $value =~ s/\\$//mg + if $type eq '+' && $owner == VAR_AUTOMAKE; + + # Differentiate assignment types. + + # 1. append (+=) to a variable defined for current condition + if ($type eq '+' && exists $var_value{$var}{$cond}) + { + if (chomp $var_value{$var}{$cond}) + { + # Insert a backslash before a trailing newline. + $var_value{$var}{$cond} .= "\\\n"; + } + elsif ($var_value{$var}{$cond}) + { + # Insert a separator. + $var_value{$var}{$cond} .= ' '; + } + $var_value{$var}{$cond} .= $value; + } + # 2. append (+=) to a variable defined for *another* condition + elsif ($type eq '+' && keys %{$var_value{$var}}) + { + # * Generally, $cond is not TRUE. For instance: + # FOO = foo + # if COND + # FOO += bar + # endif + # In this case, we declare an helper variable conditionally, + # and append it to FOO: + # FOO = foo $(am__append_1) + # @COND_TRUE@am__append_1 = bar + # Of course if FOO is defined under several conditions, we add + # $(am__append_1) to each definitions. + # + # * If $cond is TRUE, we don't need the helper variable. E.g., in + # if COND1 + # FOO = foo1 + # else + # FOO = foo2 + # endif + # FOO += bar + # we can add bar directly to all definition of FOO, and output + # @COND_TRUE@FOO = foo1 bar + # @COND_FALSE@FOO = foo2 bar + + # Do we need an helper variable? + if ($cond ne 'TRUE') + { + # Does the helper variable already exists? + my $key = "$var:$cond"; + if (exists $appendvar{$key}) + { + # Yes, let's simply append to it. + $var = $appendvar{$key}; + $owner = VAR_AUTOMAKE; + } + else + { + # No, create it. + my $num = 1 + keys (%appendvar); + my $hvar = "am__append_$num"; + $appendvar{$key} = $hvar; + ¯o_define ($hvar, VAR_AUTOMAKE, '+', + $cond, $value, $where); + push @var_list, $hvar; + # Now HVAR is to be added to VAR. + $value = "\$($hvar)"; + } + } + + # Add VALUE to all definitions of VAR. + foreach my $vcond (keys %{$var_value{$var}}) + { + # We have a bit of error detection to do here. + # This: + # if COND1 + # X = Y + # endif + # X += Z + # should be rejected because X is not defined for all conditions + # where `+=' applies. + my @undef_cond = variable_not_always_defined_in_cond $var, $cond; + if (@undef_cond != 0) + { + err ($where, + "Cannot apply `+=' because `$var' is not defined " + . "in\nthe following conditions:\n " + . join ("\n ", @undef_cond) + . "\nEither define `$var' in these conditions," + . " or use\n`+=' in the same conditions as" + . " the definitions."); + } + else + { + ¯o_define ($var, $owner, '+', $vcond, $value, $where); + } + } + # Don't adjust the owner. The above ¯o_define did it in the + # right conditions. + $adjust_owner = 0; + } + # 3. first assignment (=, :=, or +=) + else + { + # If Automake tries to override a value specified by the user, + # just don't let it do. + if (exists $var_value{$var}{$cond} + && $var_owner{$var} != VAR_AUTOMAKE + && $owner == VAR_AUTOMAKE) + { + verb ("refusing to override the user definition of:\n" + . macro_dump ($var) + ."with `$cond' => `$value'"); + } + else + { + # There must be no previous value unless the user is redefining + # an Automake variable or an AC_SUBST variable for an existing + # condition. + check_ambiguous_conditional ($var, $cond, $where) + unless (exists $var_owner{$var}{$cond} + && (($var_owner{$var}{$cond} == VAR_AUTOMAKE + && $owner != VAR_AUTOMAKE) + || $var_owner{$var}{$cond} == VAR_CONFIGURE)); + + $var_value{$var}{$cond} = $value; + # Assignments to a macro set its location. We don't adjust + # locations for `+='. Ideally I suppose we would associate + # line numbers with random bits of text. + $var_location{$var}{$cond} = $where; + } + } + + # The owner of a variable can only increase, because an Automake + # variable can be given to the user, but not the converse. + if ($adjust_owner && + (! exists $var_owner{$var}{$cond} + || $owner > $var_owner{$var}{$cond})) + { + $var_owner{$var}{$cond} = $owner; + # Always adjust the location when the owner changes (even for + # `+=' statements). The risk otherwise is to warn about + # a VAR_MAKEFILE variable and locate it in configure.ac... + $var_location{$var}{$cond} = $where; + } + + # Call var_VAR_trigger if it's defined. + # This hook helps to update some internal state *while* + # parsing the file. For instance the handling of SUFFIXES + # requires this (see var_SUFFIXES_trigger). + my $var_trigger = "var_${var}_trigger"; + &$var_trigger($type, $value) if defined &$var_trigger; +} + + +# ¯o_delete ($VAR, [@CONDS]) +# ------------------------------ +# Forget about $VAR under the conditions @CONDS, or completely if +# @CONDS is empty. +sub macro_delete ($@) +{ + my ($var, @conds) = @_; + + if (!@conds) + { + delete $var_value{$var}; + delete $var_location{$var}; + delete $var_owner{$var}; + delete $var_comment{$var}; + delete $var_type{$var}; + } + else + { + foreach my $cond (@conds) + { + delete $var_value{$var}{$cond}; + delete $var_location{$var}{$cond}; + delete $var_owner{$var}{$cond}; + delete $var_comment{$var}{$cond}; + delete $var_type{$var}{$cond}; + } + } +} + + +# ¯o_dump ($VAR) +# ------------------ +sub macro_dump ($) +{ + my ($var) = @_; + my $text = ''; + + if (!exists $var_value{$var}) + { + $text = " $var does not exist\n"; + } + else + { + $text .= " $var $var_type{$var}=\n {\n"; + foreach my $vcond (sort by_condition keys %{$var_value{$var}}) + { + prog_error ("`$var' is a key in \$var_value, " + . "but not in \$var_owner\n") + unless exists $var_owner{$var}{$vcond}; + + my $var_owner; + if ($var_owner{$var}{$vcond} == VAR_AUTOMAKE) + { + $var_owner = 'Automake'; + } + elsif ($var_owner{$var}{$vcond} == VAR_CONFIGURE) + { + $var_owner = 'Configure'; + } + elsif ($var_owner{$var}{$vcond} == VAR_MAKEFILE) + { + $var_owner = 'Makefile'; + } + else + { + prog_error ("unexpected value for `\$var_owner{$var}{$vcond}': " + . $var_owner{$var}{$vcond}) + unless defined $var_owner; + } + + my $where = (defined $var_location{$var}{$vcond} + ? $var_location{$var}{$vcond} : "undefined"); + $text .= "$var_comment{$var}{$vcond}" + if exists $var_comment{$var}{$vcond}; + $text .= " $vcond => $var_value{$var}{$vcond}\n"; + } + $text .= " }\n"; + } + return $text; +} + + +# ¯os_dump () +# --------------- +sub macros_dump () +{ + my ($var) = @_; + + my $text = "%var_value =\n{\n"; + foreach my $var (sort (keys %var_value)) + { + $text .= macro_dump ($var); + } + $text .= "}\n"; + return $text; +} + + +# $BOOLEAN +# variable_defined ($VAR, [$COND]) +# --------------------------------- +# See if a variable exists. $VAR is the variable name, and $COND is +# the condition which we should check. If no condition is given, we +# currently return true if the variable is defined under any +# condition. +sub variable_defined ($;$) +{ + my ($var, $cond) = @_; + + if (! exists $var_value{$var} + || (defined $cond && ! exists $var_value{$var}{$cond})) + { + # VAR is not defined. + + # Check there is no target defined with the name of the + # variable we check. + + # adl> I'm wondering if this error still makes any sense today. I + # adl> guess it was because targets and variables used to share + # adl> the same namespace in older versions of Automake? + # tom> While what you say is definitely part of it, I think it + # tom> might also have been due to someone making a "spelling error" + # tom> -- writing "foo:..." instead of "foo = ...". + # tom> I'm not sure whether it is really worth diagnosing + # tom> this sort of problem. In the old days I used to add warnings + # tom> and errors like this pretty randomly, based on bug reports I + # tom> got. But there's a plausible argument that I was trying + # tom> too hard to prevent people from making mistakes. + if (exists $targets{$var} + && (! defined $cond || exists $targets{$var}{$cond})) + { + for my $tcond ($cond || keys %{$targets{$var}}) + { + prog_error ("\$targets{$var}{$tcond} exists but " + . "\$target_owner doesn't") + unless exists $target_owner{$var}{$tcond}; + # Diagnose the first user target encountered, if any. + # Restricting this test to user targets allows Automake + # to create rules for things like `bin_PROGRAMS = LDADD'. + if ($target_owner{$var}{$tcond} == TARGET_USER) + { + msg_cond_target ('syntax', $tcond, $var, + "`$var' is a target; " + . "expected a variable"); + return 0; + } + } + } + return 0; + } + + # Even a var_value examination is good enough for us. FIXME: + # really should maintain examined status on a per-condition basis. + $content_seen{$var} = 1; + return 1; +} + + +# $BOOLEAN +# variable_assert ($VAR, $WHERE) +# ------------------------------ +# Make sure a variable exists. $VAR is the variable name, and $WHERE +# is the name of a macro which refers to $VAR. +sub variable_assert ($$) +{ + my ($var, $where) = @_; + + return 1 + if variable_defined $var; + + require_variables ($where, "variable `$var' is used", 'TRUE', $var); + + return 0; +} + +# Mark a variable as examined. +sub examine_variable +{ + my ($var) = @_; + variable_defined ($var); +} + + +# &variable_conditions_recursive ($VAR) +# ------------------------------------- +# Return the set of conditions for which a variable is defined. + +# If the variable is not defined conditionally, and is not defined in +# terms of any variables which are defined conditionally, then this +# returns the empty list. + +# If the variable is defined conditionally, but is not defined in +# terms of any variables which are defined conditionally, then this +# returns the list of conditions for which the variable is defined. + +# If the variable is defined in terms of any variables which are +# defined conditionally, then this returns a full set of permutations +# of the subvariable conditions. For example, if the variable is +# defined in terms of a variable which is defined for COND_TRUE, +# then this returns both COND_TRUE and COND_FALSE. This is +# because we will need to define the variable under both conditions. +sub variable_conditions_recursive ($) +{ + my ($var) = @_; + + %vars_scanned = (); + + my @new_conds = variable_conditions_recursive_sub ($var, ''); + + # Now we want to return all permutations of the subvariable + # conditions. + my %allconds = (); + foreach my $item (@new_conds) + { + foreach (split (' ', $item)) + { + s/^(.*)_(TRUE|FALSE)$/$1_TRUE/; + $allconds{$_} = 1; + } + } + @new_conds = variable_conditions_permutations (sort keys %allconds); + + my %uniqify; + foreach my $cond (@new_conds) + { + my $reduce = variable_conditions_reduce (split (' ', $cond)); + next + if $reduce eq 'FALSE'; + $uniqify{$cond} = 1; + } + + # Note we cannot just do `return sort keys %uniqify', because this + # function is sometimes used in a scalar context. + my @uniq_list = sort by_condition keys %uniqify; + return @uniq_list; +} + + +# @CONDS +# variable_conditions ($VAR) +# -------------------------- +# Get the list of conditions that a variable is defined with, without +# recursing through the conditions of any subvariables. +# Argument is $VAR: the variable to get the conditions of. +# Returns the list of conditions. +sub variable_conditions ($) +{ + my ($var) = @_; + my @conds = keys %{$var_value{$var}}; + return sort by_condition @conds; +} + + +# $BOOLEAN +# &variable_conditionally_defined ($VAR) +# -------------------------------------- +sub variable_conditionally_defined ($) +{ + my ($var) = @_; + foreach my $cond (variable_conditions_recursive ($var)) + { + return 1 + unless $cond =~ /^TRUE|FALSE$/; + } + return 0; +} + +# @LIST +# &scan_variable_expansions ($TEXT) +# --------------------------------- +# Return the list of variable names expanded in $TEXT. +# Note that unlike some other functions, $TEXT is not split +# on spaces before we check for subvariables. +sub scan_variable_expansions ($) +{ + my ($text) = @_; + my @result = (); + + # Strip comments. + $text =~ s/#.*$//; + + # Record each use of ${stuff} or $(stuff) that do not follow a $. + while ($text =~ /(? 0) + { + $cond = shift(@conds); + + # FALSE is absorbent. + return 'FALSE' + if $cond eq 'FALSE'; + + if (!conditional_is_redundant ($cond, @ret, @conds)) + { + push (@ret, $cond); + } + } + + return "TRUE" if @ret == 0; + return @ret; +} + +# @CONDS +# invert_conditions (@CONDS) +# -------------------------- +# Invert a list of conditionals. Returns a set of conditionals which +# are never true for any of the input conditionals, and when taken +# together with the input conditionals cover all possible cases. +# +# For example: +# invert_conditions("A_TRUE B_TRUE", "A_FALSE B_FALSE") +# => ("A_FALSE B_TRUE", "A_TRUE B_FALSE") +# +# invert_conditions("A_TRUE B_TRUE", "A_TRUE B_FALSE", "A_FALSE") +# => () +sub invert_conditions +{ + my (@conds) = @_; + + my @notconds = (); + + # Generate all permutation for all inputs. + my @perm = + map { variable_conditions_permutations (split(' ', $_)); } @conds; + # Remove redundant conditions. + @perm = variable_conditions_reduce @perm; + + # Now remove all conditions which imply one of the input conditions. + foreach my $perm (@perm) + { + push @notconds, $perm + if ! conditional_implies_any ($perm, @conds); + } + return @notconds; +} + +# Return a list of permutations of a conditional string. +# (But never output FALSE conditions, they are useless.) +# +# Examples: +# variable_conditions_permutations ("FOO_FALSE", "BAR_TRUE") +# => ("FOO_FALSE BAR_FALSE", +# "FOO_FALSE BAR_TRUE", +# "FOO_TRUE BAR_FALSE", +# "FOO_TRUE BAR_TRUE") +# variable_conditions_permutations ("FOO_FALSE", "TRUE") +# => ("FOO_FALSE TRUE", +# "FOO_TRUE TRUE") +# variable_conditions_permutations ("TRUE") +# => ("TRUE") +# variable_conditions_permutations ("FALSE") +# => ("TRUE") +sub variable_conditions_permutations +{ + my (@comps) = @_; + return () + if ! @comps; + my $comp = shift (@comps); + return variable_conditions_permutations (@comps) + if $comp eq ''; + my $neg = condition_negate ($comp); + + my @ret; + foreach my $sub (variable_conditions_permutations (@comps)) + { + push (@ret, "$comp $sub") if $comp ne 'FALSE'; + push (@ret, "$neg $sub") if $neg ne 'FALSE'; + } + if (! @ret) + { + push (@ret, $comp) if $comp ne 'FALSE'; + push (@ret, $neg) if $neg ne 'FALSE'; + } + return @ret; +} + + +# $BOOL +# &check_variable_defined_unconditionally($VAR, $PARENT) +# ------------------------------------------------------ +# Warn if a variable is conditionally defined. This is called if we +# are using the value of a variable. +sub check_variable_defined_unconditionally ($$) +{ + my ($var, $parent) = @_; + foreach my $cond (keys %{$var_value{$var}}) + { + next + if $cond =~ /^TRUE|FALSE$/; + + if ($parent) + { + msg_var ('unsupported', $parent, + "automake does not support conditional definition of " + . "$var in $parent"); + } + else + { + msg_var ('unsupported', $var, + "automake does not support $var being defined " + . "conditionally"); + } + } +} + + +# Get the TRUE value of a variable, warn if the variable is +# conditionally defined. +sub variable_value +{ + my ($var) = @_; + &check_variable_defined_unconditionally ($var); + return $var_value{$var}{'TRUE'}; +} + + +# @VALUES +# &value_to_list ($VAR, $VAL, $COND) +# ---------------------------------- +# Convert a variable value to a list, split as whitespace. This will +# recursively follow $(...) and ${...} inclusions. It preserves @...@ +# substitutions. +# +# If COND is 'all', then all values under all conditions should be +# returned; if COND is a particular condition (all conditions are +# surrounded by @...@) then only the value for that condition should +# be returned; otherwise, warn if VAR is conditionally defined. +# SCANNED is a global hash listing whose keys are all the variables +# already scanned; it is an error to rescan a variable. +sub value_to_list ($$$) +{ + my ($var, $val, $cond) = @_; + my @result; + + # Strip backslashes + $val =~ s/\\(\n|$)/ /g; + + foreach (split (' ', $val)) + { + # If a comment seen, just leave. + last if /^#/; + + # Handle variable substitutions. + if (/^\$\{([^}]*)\}$/ || /^\$\(([^)]*)\)$/) + { + my $varname = $1; + + # If the user uses a losing variable name, just ignore it. + # This isn't ideal, but people have requested it. + next if ($varname =~ /\@.*\@/); + + my ($from, $to); + my @temp_list; + if ($varname =~ /$SUBST_REF_PATTERN/o) + { + $varname = $1; + $to = $3; + $from = quotemeta $2; + } + + # Find the value. + @temp_list = + variable_value_as_list_recursive_worker ($1, $cond, $var); + + # Now rewrite the value if appropriate. + if (defined $from) + { + grep (s/$from$/$to/, @temp_list); + } + + push (@result, @temp_list); + } + else + { + push (@result, $_); + } + } + + return @result; +} + + +# @VALUES +# variable_value_as_list ($VAR, $COND, $PARENT) +# --------------------------------------------- +# Get the value of a variable given a specified condition. without +# recursing through any subvariables. +# Arguments are: +# $VAR is the variable +# $COND is the condition. If this is not given, the value for the +# "TRUE" condition will be returned. +# $PARENT is the variable in which the variable is used: this is used +# only for error messages. +# Returns the list of conditions. +# For example, if A is defined as "foo $(B) bar", and B is defined as +# "baz", this will return ("foo", "$(B)", "bar") +sub variable_value_as_list +{ + my ($var, $cond, $parent) = @_; + my @result; + + # Check defined + return + unless variable_assert $var, $parent; + + # Get value for given condition + $cond ||= 'TRUE'; + my $onceflag; + foreach my $vcond (keys %{$var_value{$var}}) + { + my $val = $var_value{$var}{$vcond}; + + if (&conditional_true_when ($vcond, $cond)) + { + # Unless variable is not defined conditionally, there should only + # be one value of $vcond true when $cond. + &check_variable_defined_unconditionally ($var, $parent) + if $onceflag; + $onceflag = 1; + + # Strip backslashes + $val =~ s/\\(\n|$)/ /g; + + foreach (split (' ', $val)) + { + # If a comment seen, just leave. + last if /^#/; + + push (@result, $_); + } + } + } + + return @result; +} + + +# @VALUE +# &variable_value_as_list_recursive_worker ($VAR, $COND, $PARENT) +# --------------------------------------------------------------- +# Return contents of VAR as a list, split on whitespace. This will +# recursively follow $(...) and ${...} inclusions. It preserves @...@ +# substitutions. If COND is 'all', then all values under all +# conditions should be returned; if COND is a particular condition +# (all conditions are surrounded by @...@) then only the value for +# that condition should be returned; otherwise, warn if VAR is +# conditionally defined. If PARENT is specified, it is the name of +# the including variable; this is only used for error reports. +sub variable_value_as_list_recursive_worker ($$$) +{ + my ($var, $cond, $parent) = @_; + my @result = (); + + return + unless variable_assert $var, $parent; + + if (defined $vars_scanned{$var}) + { + # `vars_scanned' is a global we use to keep track of which + # variables we've already examined. + err_var $parent, "variable `$var' recursively defined"; + } + elsif ($cond eq 'all') + { + $vars_scanned{$var} = 1; + foreach my $vcond (keys %{$var_value{$var}}) + { + my $val = $var_value{$var}{$vcond}; + push (@result, &value_to_list ($var, $val, $cond)); + } + } + else { - my $text = "$cond does not appear in AM_CONDITIONAL"; - my $scope = US_LOCAL; - if (exists $_am_macro_for_cond{$cond}) - { - my $mac = $_am_macro_for_cond{$cond}; - $text .= "\n The usual way to define `$cond' is to add "; - $text .= ($mac =~ / /) ? $mac : "`$mac'"; - $text .= "\n to `$configure_ac' and run `aclocal' and `autoconf' again."; - # These warnings appear in Automake files (depend2.am), - # so there is no need to display them more than once: - $scope = US_GLOBAL; + $cond ||= 'TRUE'; + $vars_scanned{$var} = 1; + my $onceflag; + foreach my $vcond (keys %{$var_value{$var}}) + { + my $val = $var_value{$var}{$vcond}; + if (&conditional_true_when ($vcond, $cond)) + { + # Warn if we have an ambiguity. It's hard to know how + # to handle this case correctly. + &check_variable_defined_unconditionally ($var, $parent) + if $onceflag; + $onceflag = 1; + push (@result, &value_to_list ($var, $val, $cond)); + } } - error $where, $text, uniq_scope => $scope; } - push (@cond_stack, make_conditional_string ($negate, $cond)); + # Unset our entry in vars_scanned. We only care about recursive + # definitions. + delete $vars_scanned{$var}; - return new Automake::Condition (@cond_stack); + return @result; } -# $COND -# cond_stack_else ($NEGATE, $COND, $WHERE) -# ---------------------------------------- -sub cond_stack_else ($$$) +# &variable_output ($VAR, [@CONDS]) +# --------------------------------- +# Output all the values of $VAR is @COND is not specified, else only +# that corresponding to @COND. +sub variable_output ($@) { - my ($negate, $cond, $where) = @_; - - if (! @cond_stack) - { - error $where, "else without if"; - return FALSE; - } + my ($var, @conds) = @_; - $cond_stack[$#cond_stack] = - Automake::Condition::conditional_negate ($cond_stack[$#cond_stack]); + @conds = keys %{$var_value{$var}} + unless @conds; - # If $COND is given, check against it. - if (defined $cond) + foreach my $cond (sort by_condition @conds) { - $cond = make_conditional_string ($negate, $cond); + prog_error ("unknown condition `$cond' for `$var'") + unless exists $var_value{$var}{$cond}; - error ($where, "else reminder ($negate$cond) incompatible with " - . "current conditional: $cond_stack[$#cond_stack]") - if $cond_stack[$#cond_stack] ne $cond; - } + if (exists $var_comment{$var} && exists $var_comment{$var}{$cond}) + { + $output_vars .= $var_comment{$var}{$cond}; + } - return new Automake::Condition (@cond_stack); + my $val = $var_value{$var}{$cond}; + my $equals = $var_type{$var}{$cond} eq ':' ? ':=' : '='; + my $output_var = "$var $equals $val"; + $output_var =~ s/^/make_condition ($cond)/meg; + $output_vars .= $output_var . "\n"; + } } -# $COND -# cond_stack_endif ($NEGATE, $COND, $WHERE) -# ----------------------------------------- -sub cond_stack_endif ($$$) +# &variable_pretty_output ($VAR, [@CONDS]) +# ---------------------------------------- +# Likewise, but pretty, i.e., we *split* the values at spaces. Use only +# with variables holding filenames. +sub variable_pretty_output ($@) { - my ($negate, $cond, $where) = @_; - my $old_cond; + my ($var, @conds) = @_; - if (! @cond_stack) - { - error $where, "endif without if"; - return TRUE; - } + @conds = keys %{$var_value{$var}} + unless @conds; - # If $COND is given, check against it. - if (defined $cond) + foreach my $cond (sort by_condition @conds) { - $cond = make_conditional_string ($negate, $cond); + prog_error ("unknown condition `$cond' for `$var'") + unless exists $var_value{$var}{$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; + if (exists $var_comment{$var} && exists $var_comment{$var}{$cond}) + { + $output_vars .= $var_comment{$var}{$cond}; + } - return new Automake::Condition (@cond_stack); + my $val = $var_value{$var}{$cond}; + my $equals = $var_type{$var}{$cond} eq ':' ? ':=' : '='; + my $make_condition = make_condition ($cond); + $output_vars .= pretty_print_internal ("$make_condition$var $equals", + "$make_condition\t", + split (' ' , $val)); + } } +# &variable_value_as_list_recursive ($VAR, $COND, $PARENT) +# -------------------------------------------------------- +# This is just a wrapper for variable_value_as_list_recursive_worker that +# initializes the global hash `vars_scanned'. This hash is used to +# avoid infinite recursion. +sub variable_value_as_list_recursive ($$@) +{ + my ($var, $cond, $parent) = @_; + %vars_scanned = (); + return &variable_value_as_list_recursive_worker ($var, $cond, $parent); +} - -## ------------------------ ## -## Handling the variables. ## -## ------------------------ ## - - -# &define_pretty_variable ($VAR, $COND, $WHERE, @VALUE) -# ----------------------------------------------------- +# &define_pretty_variable ($VAR, $COND, @VALUE) +# --------------------------------------------- # Like define_variable, but the value is a list, and the variable may -# be defined conditionally. The second argument is the Condition +# be defined conditionally. The second argument is the conditional # 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 ($$$@) +sub define_pretty_variable ($$@) { - my ($var, $cond, $where, @value) = @_; + my ($var, $cond, @value) = @_; - if (! vardef ($var, $cond)) + # Beware that an empty $cond has a different semantics for + # macro_define and variable_pretty_output. + $cond ||= 'TRUE'; + + if (! variable_defined ($var, $cond)) { - Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value", - '', $where, VAR_PRETTY); - rvar ($var)->rdef ($cond)->set_seen; + macro_define ($var, VAR_AUTOMAKE, '', $cond, "@value", undef); + variable_pretty_output ($var, $cond || 'TRUE'); + $content_seen{$var} = 1; } } -# define_variable ($VAR, $VALUE, $WHERE) -# -------------------------------------- -# Define a new Automake Makefile 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 ($\@$$) +# define_variable ($VAR, $VALUE) +# ------------------------------ +# Define a new user variable VAR to VALUE, but only if not already defined. +sub define_variable ($$) { - my ($var, $basename, $extension, $where) = @_; - define_variable ($var, - join (' ', map { "$_.$extension" } @$basename), - $where); + my ($var, $value) = @_; + define_pretty_variable ($var, 'TRUE', $value); } @@ -5893,23 +7315,18 @@ sub define_files_variable ($\@$$) sub define_configure_variable ($) { my ($var) = @_; - - my $pretty = VAR_ASIS; - my $owner = VAR_CONFIGURE; - - # Some variables we do not want to output. For instance it - # would be a bad idea to output `U = @U@` when `@U@` can be - # substituted as `\`. - $pretty = VAR_SILENT if exists $ignored_configure_vars{$var}; - - # ANSI2KNR is a variable that Automake wants to redefine, so - # it must be owned by Automake. (It is also used as a proof - # that AM_C_PROTOTYPES has been run, that's why we do not simply - # omit the AC_SUBST.) - $owner = VAR_AUTOMAKE if $var eq 'ANSI2KNR'; - - Automake::Variable::define ($var, $owner, '', TRUE, subst $var, - '', $configure_vars{$var}, $pretty); + if (! variable_defined ($var, 'TRUE') + # Explicitly avoid ANSI2KNR -- we AC_SUBST that in + # protos.m4, but later define it elsewhere. This is + # pretty hacky. We also explicitly avoid AMDEPBACKSLASH: + # it might be subst'd by `\', which certainly would not be + # appreciated by Make. + && ! grep { $_ eq $var } (qw(ANSI2KNR AMDEPBACKSLASH))) + { + macro_define ($var, VAR_CONFIGURE, '', 'TRUE', + subst $var, $configure_vars{$var}); + variable_pretty_output ($var, 'TRUE'); + } } @@ -5922,15 +7339,9 @@ 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\$(AM_LIBTOOLFLAGS) " - . "\$(LIBTOOLFLAGS) --mode=compile $value", - INTERNAL) - if var ('LIBTOOL'); + &define_variable ($var, $value); + &define_variable ("LT$var", "\$(LIBTOOL) --mode=compile $value") + if variable_defined ('LIBTOOL'); } @@ -5941,111 +7352,349 @@ sub define_linker_variable ($) { my ($lang) = @_; - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; + my ($var, $value) = ($lang->lder, $lang->ld); # CCLD = $(CC). - &define_variable ($lang->lder, $lang->ld, INTERNAL); + &define_variable ($lang->lder, $lang->ld); # CCLINK = $(CCLD) blah blah... &define_variable ($lang->linker, - ((var ('LIBTOOL') ? - "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) " - . "\$(LIBTOOLFLAGS) --mode=link " : '') - . $lang->link), - INTERNAL); + ((variable_defined ('LIBTOOL') + ? '$(LIBTOOL) --mode=link ' : '') + . $lang->link)); +} + +################################################################ + +## ---------------- ## +## Handling rules. ## +## ---------------- ## + +sub register_suffix_rule ($$$) +{ + my ($where, $src, $dest) = @_; + + verb "Sources ending in $src become $dest"; + push @suffixes, $src, $dest; + + # When tranforming sources to objects, Automake uses the + # %suffix_rules to move from each source extension to + # `.$(OBJEXT)', not to `.o' or `.obj'. However some people + # define suffix rules for `.o' or `.obj', so internally we will + # consider these extensions equivalent to `.$(OBJEXT)'. We + # CANNOT rewrite the target (i.e., automagically replace `.o' + # and `.obj' by `.$(OBJEXT)' in the output), or warn the user + # that (s)he'd better use `.$(OBJEXT)', because Automake itself + # output suffix rules for `.o' or `.obj'... + $dest = '.$(OBJEXT)' if ($dest eq '.o' || $dest eq '.obj'); + + # Reading the comments near the declaration of $suffix_rules might + # help to understand the update of $suffix_rules that follows... + + # Register $dest as a possible destination from $src. + # We might have the create the \hash. + if (exists $suffix_rules->{$src}) + { + $suffix_rules->{$src}{$dest} = [ $dest, 1 ]; + } + else + { + $suffix_rules->{$src} = { $dest => [ $dest, 1 ] }; + } + + # If we know how to transform $dest in something else, then + # we know how to transform $src in that "something else". + if (exists $suffix_rules->{$dest}) + { + for my $dest2 (keys %{$suffix_rules->{$dest}}) + { + my $dist = $suffix_rules->{$dest}{$dest2}[1] + 1; + # Overwrite an existing $src->$dest2 path only if + # the path via $dest which is shorter. + if (! exists $suffix_rules->{$src}{$dest2} + || $suffix_rules->{$src}{$dest2}[1] > $dist) + { + $suffix_rules->{$src}{$dest2} = [ $dest, $dist ]; + } + } + } + + # Similarly, any extension that can be derived into $src + # can be derived into the same extenstions as $src can. + my @dest2 = keys %{$suffix_rules->{$src}}; + for my $src2 (keys %$suffix_rules) + { + if (exists $suffix_rules->{$src2}{$src}) + { + for my $dest2 (@dest2) + { + my $dist = $suffix_rules->{$src}{$dest2} + 1; + # Overwrite an existing $src2->$dest2 path only if + # the path via $src is shorter. + if (! exists $suffix_rules->{$src2}{$dest2} + || $suffix_rules->{$src2}{$dest2}[1] > $dist) + { + $suffix_rules->{$src2}{$dest2} = [ $src, $dist ]; + } + } + } + } } -sub define_per_target_linker_variable ($$) +# @CONDS +# rule_define ($TARGET, $SOURCE, $OWNER, $COND, $WHERE) +# ----------------------------------------------------- +# Define a new rule. $TARGET is the rule name. $SOURCE +# is the filename the rule comes from. $OWNER is the +# owener of the rule (TARGET_AUTOMAKE or TARGET_USER). +# $COND is the condition string under which the rule is defined. +# $WHERE is where the rule is defined (file name and/or line number). +# Returns a (possibly empty) list of conditions where the rule +# should be defined. +sub rule_define ($$$$$) { - my ($linker, $target) = @_; + my ($target, $source, $owner, $cond, $where) = @_; - # If the user wrote a custom link command, we don't define ours. - return "${target}_LINK" - if set_seen "${target}_LINK"; + # Don't even think about defining a rule in condition FALSE. + return () if $cond eq 'FALSE'; + + # For now `foo:' will override `foo$(EXEEXT):'. This is temporary, + # though, so we emit a warning. + (my $noexe = $target) =~ s,\$\(EXEEXT\)$,,; + if ($noexe ne $target + && exists $targets{$noexe} + && exists $targets{$noexe}{$cond} + && $target_name{$noexe}{$cond} ne $target) + { + # The no-exeext option enables this feature. + if (! defined $options{'no-exeext'}) + { + msg ('obsolete', $noexe, + "deprecated feature: `$noexe' overrides `$noexe\$(EXEEXT)'\n" + . "change your target to read `$noexe\$(EXEEXT)'"); + } + # Don't define. + return (); + } - my $xlink = $linker ? $linker : 'LINK'; + # For now on, strip off $(EXEEXT) from $target, so we can diagnose + # a clash if `ctags$(EXEEXT):' is redefined after `ctags:'. + my $realtarget = $target; + $target = $noexe; - my $lang = $link_languages{$xlink}; - prog_error "Unknown language for linker variable `$xlink'" - unless $lang; + # A GNU make-style pattern rule has a single "%" in the target name. + msg ('portability', $where, + "`%'-style pattern rules are a GNU make extension") + if $target =~ /^[^%]*%[^%]*$/; - my $link_command = $lang->link; - if (var 'LIBTOOL') + # Diagnose target redefinitions. + if (exists $target_source{$target}{$cond}) { - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; + # Sanity checks. + prog_error ("\$target_source{$target}{$cond} exists, but \$target_owner" + . " doesn't.") + unless exists $target_owner{$target}{$cond}; + prog_error ("\$target_source{$target}{$cond} exists, but \$targets" + . " doesn't.") + unless exists $targets{$target}{$cond}; + prog_error ("\$target_source{$target}{$cond} exists, but \$target_name" + . " doesn't.") + unless exists $target_name{$target}{$cond}; + + my $oldowner = $target_owner{$target}{$cond}; + + # Don't mention true conditions in diagnostics. + my $condmsg = $cond ne 'TRUE' ? " in condition `$cond'" : ''; + + if ($owner == TARGET_USER) + { + if ($oldowner eq TARGET_USER) + { + # Ignore `%'-style pattern rules. We'd need the + # dependencies to detect duplicates, and they are + # already diagnosed as unportable by -Wportability. + if ($target !~ /^[^%]*%[^%]*$/) + { + ## FIXME: Presently we can't diagnose duplcate user rules + ## because we doesn't distinguish rules with commands + ## from rules that only add dependencies. E.g., + ## .PHONY: foo + ## .PHONY: bar + ## is legitimate. (This is phony.test.) + + # msg ('syntax', $where, + # "redefinition of `$target'$condmsg..."); + # msg_cond_target ('syntax', $cond, $target, + # "... `$target' previously defined here."); + } + # Return so we don't redefine the rule in our tables, + # don't check for ambiguous conditional, etc. The rule + # will be output anyway beauce &read_am_file ignore the + # return code. + return (); + } + else + { + # Since we parse the user Makefile.am before reading + # the Automake fragments, this condition should never happen. + prog_error ("user target `$target' seen after Automake's " + . "definition\nfrom `$targets{$target}$condmsg'"); + } + } + else # $owner == TARGET_AUTOMAKE + { + if ($oldowner == TARGET_USER) + { + # Don't overwrite the user definition of TARGET. + return (); + } + else # $oldowner == TARGET_AUTOMAKE + { + # Automake should ignore redefinitions of its own + # rules if they came from the same file. This makes + # it easier to process a Makefile fragment several times. + # Hower it's an error if the target is defined in many + # files. E.g., the user might be using bin_PROGRAMS = ctags + # which clashes with our `ctags' rule. + # (It would be more accurate if we had a way to compare + # the *content* of both rules. Then $targets_source would + # be useless.) + my $oldsource = $target_source{$target}{$cond}; + return () if $source eq $oldsource; + + msg ('syntax', $where, "redefinition of `$target'$condmsg..."); + msg_cond_target ('syntax', $cond, $target, + "... `$target' previously defined here."); + return (); + } + } + # Never reached. + prog_error ("Unreachable place reached."); + } + + # Conditions for which the rule should be defined. + my @conds = $cond; - $link_command = - "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) " - . "--mode=link " . $link_command; + # Check ambiguous conditional definitions. + my ($message, $ambig_cond) = + conditional_ambiguous_p ($target, $cond, keys %{$targets{$target}}); + if ($message) # We have an ambiguty. + { + if ($owner == TARGET_USER) + { + # For user rules, just diagnose the ambiguity. + msg 'syntax', $where, "$message ..."; + msg_cond_target ('syntax', $ambig_cond, $target, + "... `$target' previously defined here."); + return (); + } + else + { + # FIXME: for Automake rules, we can't diagnose ambiguities yet. + # The point is that Automake doesn't propagate conditionals + # everywhere. For instance &handle_PROGRAMS doesn't care if + # bin_PROGRAMS was defined conditionally or not. + # On the following input + # if COND1 + # foo: + # ... + # else + # bin_PROGRAMS = foo + # endif + # &handle_PROGRAMS will attempt to define a `foo:' rule + # in condition TRUE (which conflicts with COND1). Fixing + # this in &handle_PROGRAMS and siblings seems hard: you'd + # have to explain &file_contents what to do with a + # conditional. So for now we do our best *here*. If `foo:' + # was already defined in condition COND1 and we want to define + # it in condition TRUE, then define it only in condition !COND1. + # (See cond14.test and cond15.test for some test cases.) + my @defined_conds = keys %{$targets{$target}}; + @conds = (); + for my $undefined_cond (invert_conditions(@defined_conds)) + { + push @conds, make_condition ($cond, $undefined_cond); + } + # No conditions left to define the rule. + # Warn, because our workaround is meaningless in this case. + if (scalar @conds == 0) + { + msg 'syntax', $where, "$message ..."; + msg_cond_target ('syntax', $ambig_cond, $target, + "... `$target' previously defined here."); + return (); + } + } } - # Rewrite each occurrence of `AM_$flag' in the link - # command into `${derived}_$flag' if it exists. - my $orig_command = $link_command; - my @flags = (@{$lang->flags}, 'LDFLAGS'); - push @flags, 'LIBTOOLFLAGS' if var 'LIBTOOL'; - for my $flag (@flags) + # Finally define this rule. + for my $c (@conds) { - my $val = "${target}_$flag"; - $link_command =~ s/\(AM_$flag\)/\($val\)/ - if set_seen ($val); + $targets{$target}{$c} = $where; + $target_source{$target}{$c} = $source; + $target_owner{$target}{$c} = $owner; + $target_name{$target}{$c} = $realtarget; } - # If the computed command is the same as the generic command, use - # the command linker variable. - return $lang->linker - if $link_command eq $orig_command; + # Check the rule for being a suffix rule. If so, store in a hash. + # Either it's a rule for two known extensions... + if ($target =~ /^($KNOWN_EXTENSIONS_PATTERN)($KNOWN_EXTENSIONS_PATTERN)$/ + # ...or it's a rule with unknown extensions (.i.e, the rule looks like + # `.foo.bar:' but `.foo' or `.bar' are not declared in SUFFIXES + # and are not known language extensions). + # Automake will complete SUFFIXES from @suffixes automatically + # (see handle_footer). + || ($target =~ /$SUFFIX_RULE_PATTERN/o && accept_extensions($1))) + { + register_suffix_rule ($where, $1, $2); + } - &define_variable ("${target}_LINK", $link_command, INTERNAL); - return "${target}_LINK"; + # Return "" instead of TRUE so it can be used with make_paragraphs + # directly. + return "" if 1 == @conds && $conds[0] eq 'TRUE'; + return @conds; } -################################################################ -# &check_trailing_slash ($WHERE, $LINE) -# -------------------------------------- -# Return 1 iff $LINE ends with a slash. -# Might modify $LINE. -sub check_trailing_slash ($\$) +# See if a target exists. +sub target_defined { - my ($where, $line) = @_; + my ($target) = @_; + return exists $targets{$target}; +} - # 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 =~ /\\$/; +# &append_comments ($VARIABLE, $SPACING, $COMMENT) +# ------------------------------------------------ +# Apped $COMMENT to the other comments for $VARIABLE, using +# $SPACING as separator. +sub append_comments ($$$$) +{ + my ($cond, $var, $spacing, $comment) = @_; + $var_comment{$var}{$cond} .= $spacing + if (!defined $var_comment{$var}{$cond} + || $var_comment{$var}{$cond} !~ /\n$/o); + $var_comment{$var}{$cond} .= $comment; } -# &read_am_file ($AMFILE, $WHERE) -# ------------------------------- +# &read_am_file ($AMFILE) +# ----------------------- # Read Makefile.am and set up %contents. Simultaneously copy lines -# from Makefile.am into $output_trailer, or define variables as +# from Makefile.am into $output_trailer or $output_vars as # appropriate. NOTE we put rules in the trailer section. We want # user rules to come after our generated stuff. -sub read_am_file ($$) +sub read_am_file ($) { - my ($amfile, $where) = @_; + my ($amfile) = @_; 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; @@ -6054,14 +7703,13 @@ sub read_am_file ($$) 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" + err "$amfile:$.", "blank line following trailing backslash" if $saw_bk; # Stick a single white line before the incoming macro or rule. $spacing = "\n"; @@ -6076,7 +7724,7 @@ sub read_am_file ($$) elsif (/$COMMENT_PATTERN/o) { # Stick comments before the incoming macro or rule. Make - # sure a blank line precedes the first block of comments. + # sure a blank line preceeds first block of comments. $spacing = "\n" unless $blank; $blank = 1; $comment .= $spacing . $_; @@ -6087,23 +7735,22 @@ sub read_am_file ($$) { last; } - $saw_bk = check_trailing_slash ($where, $_); + $saw_bk = /\\$/ && ! /$IGNORE_PATTERN/o; } # We save the conditional stack on entry, and then check to make - # sure it is the same on exit. This lets us conditionally include + # sure it is the same on exit. This lets us conditonally include # other files. my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); + my $cond = conditional_string (@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:$."); + my $here = "$amfile:$."; # Make sure the line is \n-terminated. chomp; @@ -6114,44 +7761,39 @@ sub read_am_file ($$) $_ =~ s/\@MAINT\@//g unless $seen_maint_mode; - my $new_saw_bk = check_trailing_slash ($where, $_); + my $new_saw_bk = /\\$/ && ! /$IGNORE_PATTERN/o; if (/$IGNORE_PATTERN/o) { # Merely delete comments beginning with two hashes. - - # Keep any backslash from the previous line. - $new_saw_bk = $saw_bk; } elsif (/$WHITE_PATTERN/o) { # Stick a single white line before the incoming macro or rule. $spacing = "\n"; - error $where, "blank line following trailing backslash" + err $here, "blank line following trailing backslash" if $saw_bk; } elsif (/$COMMENT_PATTERN/o) { - error $where, "comment following trailing backslash" - if $saw_bk && $comment eq ''; - # Stick comments before the incoming macro or rule. $comment .= $spacing . $_; $spacing = ''; + err $here, "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 .= $_; + $output_trailer .= &make_condition (@cond_stack); + $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 + # We do this because a continuated comment like # # A = foo \ # bar \ # baz @@ -6168,27 +7810,29 @@ sub read_am_file ($$) if (!/\\$/) { - Automake::Variable::define ($last_var_name, VAR_MAKEFILE, - $last_var_type, $cond, - $last_var_value, $comment, - $last_where, VAR_ASIS) - if $cond != FALSE; + append_comments ($cond || 'TRUE', + $last_var_name, $spacing, $comment); $comment = $spacing = ''; + macro_define ($last_var_name, VAR_MAKEFILE, + $last_var_type, $cond, + $last_var_value, $here) + if $cond ne 'FALSE'; + push (@var_list, $last_var_name); } } } elsif (/$IF_PATTERN/o) { - $cond = cond_stack_if ($1, $2, $where); + $cond = cond_stack_if ($1, $2, $here); } elsif (/$ELSE_PATTERN/o) { - $cond = cond_stack_else ($1, $2, $where); + $cond = cond_stack_else ($1, $2, $here); } elsif (/$ENDIF_PATTERN/o) { - $cond = cond_stack_endif ($1, $2, $where); + $cond = cond_stack_endif ($1, $2, $here); } elsif (/$RULE_PATTERN/o) @@ -6198,14 +7842,13 @@ sub read_am_file ($$) # For now we have to output all definitions of user rules # and can't diagnose duplicates (see the comment in - # Automake::Rule::define). So we go on and ignore the return value. - Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where); + # rule_define). So we go on and ignore the return value. + rule_define ($1, $amfile, TARGET_USER, $cond || 'TRUE', $here); - check_variable_expansions ($_, $where); + check_variable_expansions ($_, $here); $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; + $output_trailer .= &make_condition (@cond_stack); $output_trailer .= $_; $comment = $spacing = ''; } @@ -6216,37 +7859,26 @@ sub read_am_file ($$) $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; + # Accumulating variables must not be output. + append_comments ($cond || 'TRUE', + $last_var_name, $spacing, $comment); $comment = $spacing = ''; - $var_look = VAR_ASIS; + + macro_define ($last_var_name, VAR_MAKEFILE, + $last_var_type, $cond, + $last_var_value, $here) + if $cond ne 'FALSE'; + push (@var_list, $last_var_name); } } elsif (/$INCLUDE_PATTERN/o) @@ -6259,7 +7891,7 @@ sub read_am_file ($$) # Distribute any included file. # Always use the $(top_srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included + # otherwise OSF make will implicitely copy the included # file in the build tree during `make distdir' to satisfy # the dependency. # (subdircond2.test and subdircond3.test will fail.) @@ -6270,29 +7902,26 @@ sub read_am_file ($$) $path =~ s/\$\(srcdir\)\///; push (@include_stack, "\$\(srcdir\)/$path"); # Always use the $(srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included + # otherwise OSF make will implicitely 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 '.'; + $path = $relative_dir . "/" . $path; } - $where->push_context ("`$path' included from here"); - &read_am_file ($path, $where); - $where->pop_context; + &read_am_file ($path); } 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); + check_variable_expansions ($_, $here); $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; + $output_trailer .= &make_condition (@cond_stack); $output_trailer .= $_; $comment = $spacing = ''; - error $where, "`#' comment at start of rule is unportable" + err $here, "`#' comment at start of rule is unportable" if $_ =~ /^\t\s*\#/; } @@ -6302,11 +7931,8 @@ sub read_am_file ($$) $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")) + err_am (@cond_stack ? "unterminated conditionals: @cond_stack" + : "too many conditionals closed in include file") if "@saved_cond_stack" ne "@cond_stack"; } @@ -6317,17 +7943,20 @@ sub read_am_file ($$) # 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); + my $saved_output_vars = $output_vars; + my ($comments, undef, $rules) = + file_contents_internal (1, "$libdir/am/header-vars.am"); - foreach my $var (sort keys %configure_vars) + # This will output the definitions in $output_vars, which we don't + # want... + foreach my $var (sort keys %configure_vars) { - &define_configure_variable ($var); + &define_configure_variable ($var); + push (@var_list, $var); } - $output_vars .= $comments . $rules; + # ... hence, we restore $output_vars. + $output_vars = $saved_output_vars . $comments . $rules; } # Read main am file. @@ -6337,7 +7966,7 @@ sub read_main_am_file # 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); + if (scalar keys %var_value > 0); # Generate copyright header for generated Makefile.in. # We do discard the output of predefined variables, handled below. @@ -6347,14 +7976,39 @@ sub read_main_am_file $output_vars .= $gen_copyright; # We want to predefine as many variables as possible. This lets - # the user set them with `+=' in Makefile.am. + # the user set them with `+=' in Makefile.am. However, we don't + # want these initial definitions to end up in the output quite + # yet. So we just load them, but output them later. &define_standard_variables; # Read user file, which might override some of our values. - &read_am_file ($amfile, new Automake::Location); -} + &read_am_file ($amfile); + # Output all the Automake variables. If the user changed one, + # then it is now marked as VAR_CONFIGURE or VAR_MAKEFILE. + foreach my $var (uniq @var_list) + { + # Some variables, like AMDEPBACKSLASH are in @var_list + # but don't have a owner. This is good, because we don't want + # to output them. + foreach my $cond (keys %{$var_owner{$var}}) + { + variable_output ($var, $cond) + if $var_owner{$var}{$cond} == VAR_AUTOMAKE; + } + } + # Now dump the user variables that were defined. We do it in the same + # order in which they were defined (skipping duplicates). + foreach my $var (uniq @var_list) + { + foreach my $cond (keys %{$var_owner{$var}}) + { + variable_output ($var, $cond) + if $var_owner{$var}{$cond} != VAR_AUTOMAKE; + } + } +} ################################################################ @@ -6374,38 +8028,6 @@ sub flatten return $_; } -# transform($TOKEN, \%PAIRS) -# ========================== -# If ($TOKEN, $VAL) is in %PAIRS: -# - replaces %$TOKEN% with $VAL, -# - enables/disables ?$TOKEN? and ?!$TOKEN?, -# - replaces %?$TOKEN% with TRUE or FALSE. -sub transform($$) -{ - my ($token, $transform) = @_; - - if (substr ($token, 0, 1) eq '%') - { - my $cond = (substr ($token, 1, 1) eq '?') ? 1 : 0; - $token = substr ($token, 1 + $cond, -1); - my $val = $transform->{$token}; - prog_error "Unknown %token% `$token'" unless defined $val; - if ($cond) - { - return $val ? 'TRUE' : 'FALSE'; - } - else - { - return $val; - } - } - # Now $token is '?xxx?' or '?!xxx?'. - my $neg = (substr ($token, 1, 1) eq '!') ? 1 : 0; - $token = substr ($token, 1 + $neg, -1); - my $val = $transform->{$token}; - prog_error "Unknown ?token? `$token' (neg = $neg)" unless defined $val; - return (!!$val == $neg) ? '##%' : ''; -} # @PARAGRAPHS # &make_paragraphs ($MAKEFILE, [%TRANSFORM]) @@ -6414,111 +8036,98 @@ sub transform($$) # paragraphs. sub make_paragraphs ($%) { - my ($file, %transform) = @_; - - # Complete %transform with global options. - # Note that %transform goes last, so it overrides global options. - %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_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); - - $transformed_files{$file} = 1; - $_ = $am_file_cache{$file}; - - if (! defined $_) - { - verb "reading $file"; - # Swallow the whole file. - my $fc_file = new Automake::XFile "< $file"; - my $saved_dollar_slash = $/; - undef $/; - $_ = $fc_file->getline; - $/ = $saved_dollar_slash; - $fc_file->close; - - # Remove ##-comments. - # Besides we don't need more than two consecutive new-lines. - s/(?:$IGNORE_PATTERN|(?<=\n\n)\n+)//gom; - - $am_file_cache{$file} = $_; - } - - # Substitute Automake template tokens. - s/(?:%\??[\w\-]+%|\?!?[\w\-]+\?)/transform($&, \%transform)/ge; - # transform() may have added some ##%-comments to strip. - # (we use `##%' instead of `##' so we can distinguish ##%##%##% from - # ####### and do not remove the latter.) - s/^[ \t]*(?:##%)+.*\n//gm; - - # Split at unescaped new lines. - my @lines = split (/(? $cygnus_mode, + 'MAINTAINER-MODE' + => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '', + + 'SHAR' => $options{'dist-shar'} || 0, + 'BZIP2' => $options{'dist-bzip2'} || 0, + 'ZIP' => $options{'dist-zip'} || 0, + 'COMPRESS' => $options{'dist-tarZ'} || 0, + + 'INSTALL-INFO' => !$options{'no-installinfo'}, + 'INSTALL-MAN' => !$options{'no-installman'}, + 'CK-NEWS' => $options{'check-news'} || 0, + + 'SUBDIRS' => variable_defined ('SUBDIRS'), + 'TOPDIR' => backname ($relative_dir), + 'TOPDIR_P' => $relative_dir eq '.', + 'CONFIGURE-AC' => $configure_ac, + + 'BUILD' => $seen_canonical == AC_CANONICAL_SYSTEM, + 'HOST' => $seen_canonical, + 'TARGET' => $seen_canonical == AC_CANONICAL_SYSTEM, + + 'LIBTOOL' => variable_defined ('LIBTOOL')) + # We don't need more than two consecutive new-lines. + . 's/\n{3,}/\n\n/g'; + + # 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 ($is_am, $file, %transform) = @_; my $result_vars = ''; my $result_rules = ''; @@ -6531,20 +8140,17 @@ sub file_contents_internal ($$$%) 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 + # sure it is the same on exit. This lets us conditonally include # other files. my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); + my $cond = conditional_string (@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$_" + err $file, "blank line following trailing backslash:\n$_" if /\\$/; - error $where, "comment following trailing backslash:\n$_" + err $file, "comment following trailing backslash:\n$_" if /\\#/; if (/^$/) @@ -6563,14 +8169,12 @@ sub file_contents_internal ($$$%) # Handle inclusion of other files. elsif (/$INCLUDE_PATTERN/o) { - if ($cond != FALSE) + if ($cond ne '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; + = file_contents_internal ($is_am, $file, %transform); $comment .= $com; $result_vars .= $vars; $result_rules .= $rules; @@ -6622,7 +8226,7 @@ sub file_contents_internal ($$$%) # in %dependencies and $targets will have two rules). # FIXME: 2. The logic here is not able to output a - # multi-paragraph rule several time (e.g. for each condition + # multi-paragraph rule several time (e.g. for each conditional # it is defined for) because it only knows the first paragraph. # FIXME: 3. We are not robust to people defining a subset @@ -6630,30 +8234,23 @@ sub file_contents_internal ($$$%) # `foo:' after `foo bar:'. # Output only if not in FALSE. - if (defined $dependencies{$_} && $cond != FALSE) + if (defined $dependencies{$_} && $cond ne 'FALSE') { &depend ($_, @deps); - if ($actions{$_}) - { - $actions{$_} .= "\n$actions" if $actions; - } - else - { - $actions{$_} = $actions; - } + $actions{$_} .= $actions; } else { # Free-lance dependency. Output the rule for all the # targets instead of one by one. my @undefined_conds = - Automake::Rule::define ($targets, $file, - $is_am ? RULE_AUTOMAKE : RULE_USER, - $cond, $where); + rule_define ($targets, $file, + $is_am ? TARGET_AUTOMAKE : TARGET_USER, + $cond || 'TRUE', $file); for my $undefined_cond (@undefined_conds) { my $condparagraph = $paragraph; - $condparagraph =~ s/^/$undefined_cond->subst_string/gme; + $condparagraph =~ s/^/$undefined_cond/gm; $result_rules .= "$spacing$comment$condparagraph\n"; } if (scalar @undefined_conds == 0) @@ -6672,16 +8269,25 @@ sub file_contents_internal ($$$%) elsif (/$ASSIGNMENT_PATTERN/mso) { my ($var, $type, $val) = ($1, $2, $3); - error $where, "variable `$var' with trailing backslash" + err $file, "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; + # Accumulating variables must not be output. + append_comments ($cond || 'TRUE', $var, $spacing, $comment); + macro_define ($var, $is_am ? VAR_AUTOMAKE : VAR_MAKEFILE, + $type, $cond, $val, $file) + if $cond ne 'FALSE'; + push (@var_list, $var); + + # If the user has set some variables we were in charge + # of (which is detected by the first reading of + # `header-vars.am'), we must not output them. + $result_vars .= "$spacing$comment$_\n" + if ($cond ne 'FALSE' && $type ne '+' + && exists $var_owner{$var}{$cond || 'TRUE'} + && $var_owner{$var}{$cond || 'TRUE'} == VAR_AUTOMAKE); $comment = $spacing = ''; } @@ -6690,18 +8296,18 @@ sub file_contents_internal ($$$%) # 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)) + if ($cond ne 'FALSE' && ! ($is_rule && $discard_rule)) { - s/^/$cond->subst_string/gme; + s/^/make_condition (@cond_stack)/gme; $result_rules .= "$spacing$comment$_\n"; } $comment = $spacing = ''; } } - error ($where, @cond_stack ? - "unterminated conditionals: @cond_stack" : - "too many conditionals closed in include file") + err_am (@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); @@ -6709,20 +8315,97 @@ sub file_contents_internal ($$$%) # $CONTENTS -# &file_contents ($BASENAME, $WHERE, [%TRANSFORM]) -# ------------------------------------------------ +# &file_contents ($BASENAME, [%TRANSFORM]) +# ---------------------------------------- # Return contents of a file from $libdir/am, automatically skipping # macros or rules which are already known. -sub file_contents ($$%) +sub file_contents ($%) { - my ($basename, $where, %transform) = @_; + my ($basename, %transform) = @_; my ($comments, $variables, $rules) = - file_contents_internal (1, "$libdir/am/$basename.am", $where, - %transform); + file_contents_internal (1, "$libdir/am/$basename.am", %transform); return "$comments$variables$rules"; } +# $REGEXP +# &transform (%PAIRS) +# ------------------- +# Foreach ($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$/; + + my @conds = variable_conditions_recursive ($macro); + + my @condvals; + foreach my $cond (@conds) + { + my @one_binlist = (); + my @condval = variable_value_as_list_recursive ($macro, $cond); + foreach my $rcurs (@condval) + { + # Skip autoconf substs. Also skip if the user + # already applied $(EXEEXT). + if ($rcurs =~ /^\@.*\@$/ || $rcurs =~ /\$\(EXEEXT\)$/) + { + push (@one_binlist, $rcurs); + } + else + { + push (@one_binlist, $rcurs . '$(EXEEXT)'); + } + } + + push (@condvals, $cond); + push (@condvals, "@one_binlist"); + } + + macro_delete ($macro); + while (@condvals) + { + my $cond = shift (@condvals); + my @val = split (' ', shift (@condvals)); + define_pretty_variable ($macro, $cond, @val); + } + } + + # @PREFIX # &am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES) # ----------------------------------------------------- @@ -6733,8 +8416,8 @@ sub file_contents ($$%) # * `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 +# a variable ending in a "reserved" suffix whose prefix is unknown, eg +# "bni_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 @@ -6746,7 +8429,7 @@ sub am_primary_prefixes ($$@) local $_; my %valid = map { $_ => 0 } @prefixes; $valid{'EXTRA'} = 0; - foreach my $var (variables $primary) + foreach my $varname (keys %var_value) { # Automake is allowed to define variables that look like primaries # but which aren't. E.g. INSTALL_sh_DATA. @@ -6755,32 +8438,33 @@ sub am_primary_prefixes ($$@) # 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; + next + if (exists $var_owner{$varname} + && exists $var_owner{$varname}{'TRUE'} + && $var_owner{$varname}{'TRUE'} != VAR_MAKEFILE); - if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_[[:alnum:]]+$/) + if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_$primary$/) { my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || ''); if ($dist ne '' && ! $can_dist) { - err_var ($var, + err_var ($varname, "invalid variable `$varname': `dist' is forbidden"); } - # Standard directories must be explicitly allowed. + # Standard directories must be explicitely allowed. elsif (! defined $valid{$X} && exists $standard_prefix{$X}) { - err_var ($var, + err_var ($varname, "`${X}dir' is not a legitimate directory " . "for `$primary'"); } - # A not explicitly valid directory is allowed if Xdir is defined. + # A not explicitely valid directory is allowed if Xdir is defined. elsif (! defined $valid{$X} && - $var->requires_variables ("`$varname' is used", "${X}dir")) + require_variables_for_macro ($varname, "`$varname' is used", + "${X}dir")) { # Nothing to do. Any error message has been output - # by $var->requires_variables. + # by require_variables_for_macro. } else { @@ -6788,27 +8472,19 @@ sub am_primary_prefixes ($$@) $valid{"$base$dist$X"} = 1; } } - else - { - prog_error "unexpected variable name: $varname"; - } } # Return only those which are actually defined. - return sort grep { var ($_ . '_' . $primary) } keys %valid; + return sort grep { variable_defined ($_ . '_' . $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). +# the second argument is the primary variable (eg HEADERS), and all +# subsequent arguments are possible installation locations. Returns +# list of all values of all _HOW targets. # # FIXME: this should be rewritten to be cleaner. It should be broken # up into multiple functions. @@ -6816,192 +8492,174 @@ sub am_primary_prefixes ($$@) # Usage is: am_install_var (OPTION..., file, HOW, where...) sub am_install_var { - my (@args) = @_; + my (@args) = @_; - my $do_require = 1; - my $can_dist = 0; - my $default_dist = 0; - while (@args) + my $do_require = 1; + my $can_dist = 0; + my $default_dist = 0; + while (@args) { - if ($args[0] eq '-noextra') + if ($args[0] eq '-noextra') { - $do_require = 0; + $do_require = 0; } - elsif ($args[0] eq '-candist') + elsif ($args[0] eq '-candist') { - $can_dist = 1; + $can_dist = 1; } - elsif ($args[0] eq '-defaultdist') + elsif ($args[0] eq '-defaultdist') { - $default_dist = 1; - $can_dist = 1; + $default_dist = 1; + $can_dist = 1; } - elsif ($args[0] !~ /^-/) + elsif ($args[0] !~ /^-/) { - last; + last; } - shift (@args); + shift (@args); } - my ($file, $primary, @prefix) = @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'; + # 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); + # 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; + # 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 = (); + my @used = (); + my @result = (); - foreach my $X (@prefix) + # True if the iteration is the first one. Used for instance to + # output parts of the associated file only once. + my $first = 1; + foreach my $X (@prefix) { - my $nodir_name = $X; - my $one_name = $X . '_' . $primary; - my $one_var = var $one_name; + my $nodir_name = $X; + my $one_name = $X . '_' . $primary; - my $strip_subdir = 1; - # If subdir prefix should be preserved, do so. - if ($nodir_name =~ /^nobase_/) - { - $strip_subdir = 0; - $nodir_name =~ s/^nobase_//; - } + 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)_//; - } + # 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)_//; + } + # Append actual contents of where_PRIMARY variable to + # result. + foreach my $rcurs (&variable_value_as_list_recursive ($one_name, 'all')) + { + # Skip configure substitutions. Possibly bogus. + if ($rcurs =~ /^\@.*\@$/) + { + if ($nodir_name eq 'EXTRA') + { + err_var ($one_name, + "`$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; + } - # 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; + next; + } - # 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 { 1 } $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'; + push (@result, $rcurs); + } + # 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 . ')'); - } + 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'; + # 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); + # 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'; + my $check_options_p = $install_p + && defined $options{'std-options'}; - # Use the location of the currently processed variable as context. - $where->push_context ("while processing `$one_name'"); + # Singular form of $PRIMARY. + (my $one_primary = $primary) =~ s/S$//; + $output_rules .= &file_contents ($file, + ('FIRST' => $first, - # 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); + 'PRIMARY' => $primary, + 'ONE_PRIMARY' => $one_primary, + 'DIR' => $X, + 'NDIR' => $nodir_name, + 'BASE' => $strip_subdir, - # 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, + 'CK-OPTS' => $check_options_p)); - EXEC => $exec_p, - INSTALL => $install_p, - DIST => $dist_p, - DISTVAR => $distvar, - 'CK-OPTS' => $check_options_p); + $first = 0; } - # 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') + # 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"; + # Define it. + define_pretty_variable ($primary, '', @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)); + err_var ($require_extra, + "`$require_extra' contains configure substitution,\n" + . "but `EXTRA_$primary' not defined") + if ($require_extra && ! variable_defined ('EXTRA_' . $primary)); - # Push here because PRIMARY might be configure time determined. - push (@all, '$(' . $primary . ')') - if @used && $primary ne 'JAVA' && $primary ne 'PYTHON'; + # 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; + # 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. + return uniq (sort @result); } @@ -7036,31 +8694,8 @@ sub is_make_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,/*$,,; -} +# This variable is local to the "require file" set of functions. +my @require_file_paths = (); # &maybe_push_required_file ($DIR, $FILE, $FULLFILE) @@ -7069,179 +8704,161 @@ sub locate_aux_dir () # encodes the rules for deciding when to do so. sub maybe_push_required_file { - my ($dir, $file, $fullfile) = @_; + my ($dir, $file, $fullfile) = @_; - if ($dir eq $relative_dir) + if ($dir eq $relative_dir) { - push_dist_common ($file); - return 1; + push_dist_common ($file); + return 1; } - elsif ($relative_dir eq '.' && ! &is_make_dir ($dir)) + 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; + # 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. + push_dist_common ($fullfile); + return 1; } - return 0; + 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. +# &require_file_internal ($WHERE, $MYSTRICT, @FILES) +# -------------------------------------------------- +# Verify that the file must exist in the current directory. # $MYSTRICT is the strictness level at which this file becomes required. -sub require_file_internal ($$$@) +# +# Must set require_file_paths before calling this function. +# require_file_paths is set to hold a single directory (the one in +# which the first file was found) before return. +sub require_file_internal ($$@) { - my ($where, $mystrict, $dir, @files) = @_; + my ($where, $mystrict, @files) = @_; - foreach my $file (@files) + foreach my $file (@files) { - my $fullfile = "$dir/$file"; - my $found_it = 0; - my $dangling_sym = 0; + my $fullfile; + my $errdir; + my $errfile; + my $save_dir; - if (-l $fullfile && ! -f $fullfile) - { - $dangling_sym = 1; - } - elsif (dir_has_case_matching_file ($dir, $file)) + my $found_it = 0; + my $dangling_sym = 0; + foreach my $dir (@require_file_paths) { - $found_it = 1; - maybe_push_required_file ($dir, $file, $fullfile); + $fullfile = $dir . "/" . $file; + $errdir = $dir unless $errdir; + + # Use different name for "error filename". Otherwise on + # an error the bad file will be reported as eg + # `../../install-sh' when using the default + # config_aux_path. + $errfile = $errdir . '/' . $file; + + if (-l $fullfile && ! -f $fullfile) + { + $dangling_sym = 1; + last; + } + elsif (-f $fullfile) + { + $found_it = 1; + maybe_push_required_file ($dir, $file, $fullfile); + $save_dir = $dir; + last; + } } - # `--force-missing' only has an effect if `--add-missing' is - # specified. - if ($found_it && (! $add_missing || ! $force_missing)) + # `--force-missing' only has an effect if `--add-missing' is + # specified. + if ($found_it && (! $add_missing || ! $force_missing)) { - next; + # Prune the path list. + @require_file_paths = $save_dir; } - else + 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) + # 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; + next if defined $require_file_found{$fullfile}; + $require_file_found{$fullfile} = 1; } - if ($strictness >= $mystrict) + if ($strictness >= $mystrict) { - if ($dangling_sym && $add_missing) + if ($dangling_sym && $add_missing) { - unlink ($fullfile); + unlink ($fullfile); } - my $trailer = ''; - my $suppress = 0; + 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) + # Only install missing files according to our desired + # strictness level. + my $message = "required file `$errfile' not found"; + if ($add_missing) { - if (-f "$libdir/$file") + $suppress = 1; + + 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) + # 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 `$errfile'"; + # Windows Perl will hang if we try to delete a + # file that doesn't exist. + unlink ($errfile) if -f $errfile; + if ($symlink_exists && ! $copy_missing) { - if (! symlink ("$libdir/$file", $fullfile)) + if (! symlink ("$libdir/$file", $errfile)) { - $suppress = 0; - $trailer = "; error while making link: $!"; + $suppress = 0; + $trailer = "; error while making link: $!"; } } - elsif (system ('cp', "$libdir/$file", $fullfile)) + elsif (system ('cp', "$libdir/$file", $errfile)) { - $suppress = 0; - $trailer = "\n error while copying"; + $suppress = 0; + $trailer = "\n error while copying"; } - reset_dir_cache ($dir); } - if (! maybe_push_required_file (dirname ($fullfile), - $file, $fullfile)) + if (! maybe_push_required_file (dirname ($errfile), + $file, $errfile)) { - if (! $found_it && ! $automake_will_process_aux_dir) + if (! $found_it) { - # 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."); + # 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). This is unfortunate, + # since it means we are using a file which is not + # distributed! + + # Get Automake to be run again: on the second + # run the file will be found, and pushed into + # the toplevel DIST_COMMON automatically. + $automake_needs_to_reprocess_all_files = 1; } } - } - else - { - $trailer = "\n `automake --add-missing' can install `$file'" - if -f "$libdir/$file"; - } - # If --force-missing was specified, and we have - # actually found the file, then do nothing. - next - if $found_it && $force_missing; + # Prune the path list. + @require_file_paths = &dirname ($errfile); + } - # If we couldn't 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; + # If --force-missing was specified, and we have + # actually found the file, then do nothing. + next + if $found_it && $force_missing; - msg ($suppress ? 'note' : 'error', $where, "$message$trailer"); + msg ($suppress ? 'note' : 'error', $where, "$message$trailer"); } } } @@ -7252,7 +8869,8 @@ sub require_file_internal ($$$@) sub require_file ($$@) { my ($where, $mystrict, @files) = @_; - require_file_internal ($where, $mystrict, $relative_dir, @files); + @require_file_paths = $relative_dir; + require_file_internal ($where, $mystrict, @files); } # &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) @@ -7260,28 +8878,9 @@ sub require_file ($$@) 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_file ($var_location{$macro}{$cond}, $mystrict, @files); } -# &require_libsource_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) -# ---------------------------------------------------------------- -# Require an AC_LIBSOURCEd file. If AC_CONFIG_LIBOBJ_DIR was called, it -# must be in that directory. Otherwise expect it in the current directory. -sub require_libsource_with_macro ($$$@) -{ - my ($cond, $macro, $mystrict, @files) = @_; - $macro = rvar ($macro) unless ref $macro; - if ($config_libobj_dir) - { - require_file_internal ($macro->rdef ($cond)->location, $mystrict, - $config_libobj_dir, @files); - } - else - { - require_file ($macro->rdef ($cond)->location, $mystrict, @files); - } -} # &require_conf_file ($WHERE, $MYSTRICT, @FILES) # ---------------------------------------------- @@ -7289,7 +8888,12 @@ sub require_libsource_with_macro ($$$@) sub require_conf_file ($$@) { my ($where, $mystrict, @files) = @_; - require_file_internal ($where, $mystrict, $config_aux_dir, @files); + @require_file_paths = @config_aux_path; + require_file_internal ($where, $mystrict, @files); + my $dir = $require_file_paths[0]; + @config_aux_path = @require_file_paths; + # Avoid unsightly '/.'s. + $config_aux_dir = '$(top_srcdir)' . ($dir eq '.' ? "" : "/$dir"); } @@ -7298,8 +8902,7 @@ sub require_conf_file ($$@) sub require_conf_file_with_macro ($$$@) { my ($cond, $macro, $mystrict, @files) = @_; - require_conf_file (rvar ($macro)->rdef ($cond)->location, - $mystrict, @files); + require_conf_file ($var_location{$macro}{$cond}, $mystrict, @files); } ################################################################ @@ -7309,40 +8912,25 @@ sub require_conf_file_with_macro ($$$@) # Emit rules to create $DIRECTORY if needed, and return # the file that any target requiring this directory should be made # dependent upon. -# We don't want to emit the rule twice, and want to reuse it -# for directories with equivalent names (e.g., `foo/bar' and `./foo//bar'). sub require_build_directory ($) { - my $directory = shift; - - return $directory_map{$directory} if exists $directory_map{$directory}; - - my $cdir = File::Spec->canonpath ($directory); + my $directory = shift; + my $dirstamp = "$directory/.dirstamp"; - if (exists $directory_map{$cdir}) + # Don't emit the rule twice. + if (! defined $directory_map{$directory}) { - my $stamp = $directory_map{$cdir}; - $directory_map{$directory} = $stamp; - return $stamp; - } - - my $dirstamp = "$cdir/\$(am__dirstamp)"; - - $directory_map{$directory} = $dirstamp; - $directory_map{$cdir} = $dirstamp; - - # Set a variable for the dirstamp basename. - define_pretty_variable ('am__dirstamp', TRUE, INTERNAL, - '$(am__leading_dot)dirstamp'); + $directory_map{$directory} = 1; - # Directory must be removed by `make distclean'. - $clean_files{$dirstamp} = DIST_CLEAN; + # Directory must be removed by `make distclean'. + $clean_files{$dirstamp} = DIST_CLEAN; - $output_rules .= ("$dirstamp:\n" - . "\t\@\$(MKDIR_P) $directory\n" - . "\t\@: > $dirstamp\n"); + $output_rules .= ("$dirstamp:\n" + . "\t\@\$(mkinstalldirs) $directory\n" + . "\t\@: > $dirstamp\n"); + } - return $dirstamp; + return $dirstamp; } # &require_build_directory_maybe ($FILE) @@ -7372,205 +8960,145 @@ 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); + macro_define ('DIST_COMMON', VAR_AUTOMAKE, '+', '', "@_", ''); } -################################################################ - -# 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 ($$) +# Set strictness. +sub set_strictness { - 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'); + $strictness_name = $_[0]; - # 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); - $topsrcdir = backname ($relative_dir); - - 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; + # FIXME: 'portability' warnings are currently disabled by default. + # Eventually we want to turn them on in GNU and GNITS modes, but + # we don't do this yet in Automake 1.7 to help the 1.6/1.7 transition. + # + # Indeed there would be only two ways to get rid of these new warnings: + # 1. adjusting Makefile.am + # This is not always easy (or wanted). Consider %-rules or + # $(function args) variables. + # 2. using -Wno-portability + # This means there is no way to have the same Makefile.am + # working both with Automake 1.6 and 1.7 (since 1.6 does not + # understand -Wno-portability). + # + # In Automake 1.8 (or whatever it is called) we can turn these + # warnings on, since -Wno-portability will not be an issue for + # the 1.7/1.8 transition. + if ($strictness_name eq 'gnu') + { + $strictness = GNU; + setup_channel 'error-gnu', silent => 0; + setup_channel 'error-gnu/warn', silent => 0, type => 'error'; + setup_channel 'error-gnits', silent => 1; + # setup_channel 'portability', silent => 0; + setup_channel 'gnu', silent => 0; + } + elsif ($strictness_name eq 'gnits') + { + $strictness = GNITS; + setup_channel 'error-gnu', silent => 0; + setup_channel 'error-gnu/warn', silent => 0, type => 'error'; + setup_channel 'error-gnits', silent => 0; + # setup_channel 'portability', silent => 0; + setup_channel 'gnu', silent => 0; + } + elsif ($strictness_name eq 'foreign') + { + $strictness = FOREIGN; + setup_channel 'error-gnu', silent => 1; + setup_channel 'error-gnu/warn', silent => 0, type => 'warning'; + setup_channel 'error-gnits', silent => 1; + # setup_channel 'portability', silent => 1; + setup_channel 'gnu', silent => 1; } - # 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') + else { - 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; - } + prog_error "level `$strictness_name' not recognized\n"; } +} - # Catch some obsolete variables. - msg_var ('obsolete', 'INCLUDES', - "`INCLUDES' is the old name for `AM_CPPFLAGS' (or `*_CPPFLAGS')") - if var ('INCLUDES'); - - # 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; - # Must come after handle_programs so that %known_programs is up-to-date. - handle_tests; +# Glob something. Do this to avoid indentation screwups everywhere we +# want to glob. Gross! +sub my_glob +{ + my ($pat) = @_; + return <${pat}>; +} - # This must come after most other rules. - handle_dist; +################################################################ - handle_footer; - do_check_merge_target; - handle_all ($makefile); +# INTEGER +# require_variables ($WHERE, $REASON, $COND, @VARIABLES) +# ------------------------------------------------------ +# Make sure that each supplied variable is defined in $COND. +# Otherwise, issue a warning. If we know which macro can +# define this variable, hint the user. +# Return the number of undefined variables. +sub require_variables ($$$@) +{ + my ($where, $reason, $cond, @vars) = @_; + my $res = 0; + $reason .= ' but ' unless $reason eq ''; - # FIXME: Gross! - if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS')) + VARIABLE: + foreach my $var (@vars) { - $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n"; - } - - handle_install; - handle_clean ($makefile); - handle_factored_dependencies; + # Nothing to do if the variable exists. The $configure_vars test + # needed for strange variables like AMDEPBACKSLASH or ANSI2KNR + # that are AC_SUBST'ed but never macro_define'd. + next VARIABLE + if ((exists $var_value{$var} && exists $var_value{$var}{$cond}) + || exists $configure_vars{$var}); - # Comes last, because all the above procedures may have - # defined or overridden variables. - $output_vars .= output_variables; + my @undef_cond = variable_not_always_defined_in_cond $var, $cond; + next VARIABLE + unless @undef_cond; - check_typos; + my $text = "$reason`$var' is undefined\n"; + if (@undef_cond && $undef_cond[0] ne 'TRUE') + { + $text .= ("in the following conditions:\n " + . join ("\n ", @undef_cond)); + } - my ($out_file) = $output_directory . '/' . $makefile_in; + ++$res; - if ($exit_code != 0) - { - verb "not writing $out_file because of earlier errors"; - return; - } + if (exists $am_macro_for_var{$var}) + { + $text .= "\nThe usual way to define `$var' is to add " + . "`$am_macro_for_var{$var}'\nto `$configure_ac' and run " + . "`aclocal' and `autoconf' again."; + } + elsif (exists $ac_macro_for_var{$var}) + { + $text .= "\nThe usual way to define `$var' is to add " + . "`$ac_macro_for_var{$var}'\nto `$configure_ac' and run " + . "`autoconf' again."; + } - 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; + err $where, $text, uniq_scope => US_GLOBAL; } + return $res; +} - if (-e $out_file) +# INTEGER +# require_variables_for_macro ($MACRO, $REASON, @VARIABLES) +# --------------------------------------------------------- +# Same as require_variables, but take a macro mame as first argument. +sub require_variables_for_macro ($$@) +{ + my ($macro, $reason, @args) = @_; + for my $cond (keys %{$var_value{$macro}}) { - unlink ($out_file) - or fatal "cannot remove $out_file: $!\n"; + return require_variables ($var_location{$macro}{$cond}, $reason, + $cond, @args); } - - my $gm_file = new Automake::XFile "> $out_file"; - verb "creating $out_file"; - print $gm_file $output; } -################################################################ - - - - -################################################################ - # Print usage information. sub usage () { @@ -7601,8 +9129,17 @@ Library files: -c, --copy with -a, copy missing files (default is symlink) -f, --force-missing force update of standard files +Warning categories include: + `gnu' GNU coding standards (default in gnu and gnits modes) + `obsolete' obsolete features or constructions + `portability' portability issues + `syntax' dubious syntactic constructs (default) + `unsupported' unsupported or incomplete features (default) + `all' all the warnings + `no-CATEGORY' turn off warnings in CATEGORY + `none' turn off all the warnings + `error' treat warnings as errors "; - Automake::ChannelDefs::usage; my ($last, @lcomm); $last = ''; @@ -7664,10 +9201,9 @@ sub version () { print < - and Alexandre Duret-Lutz . +Written by Tom Tromey . -Copyright 2006 Free Software Foundation, Inc. +Copyright 2002 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 @@ -7675,172 +9211,6 @@ EOF 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, but we specify them nonetheless so - # that ambiguous abbreviation are diagnosed. - Getopt::Long::GetOptions %cli_options, 'version' => sub {}, 'help' => sub {} - 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 = '.'; - } - - return unless @ARGV; - - if ($ARGV[0] =~ /^-./) - { - my %argopts; - for my $k (keys %cli_options) - { - if ($k =~ /(.*)=s$/) - { - map { $argopts{(length ($_) == 1) - ? "-$_" : "--$_" } = 1; } (split (/\|/, $1)); - } - } - if ($ARGV[0] eq '--') - { - shift @ARGV; - } - elsif (exists $argopts{$ARGV[0]}) - { - fatal ("option `$ARGV[0]' requires an argument\n" - . "Try `$0 --help' for more information."); - } - else - { - fatal ("unrecognized option `$ARGV[0]'.\n" - . "Try `$0 --help' for more information."); - } - } - - my $errspec = 0; - foreach my $arg (@ARGV) - { - fatal ("empty argument\nTry `$0 --help' for more information.") - if ($arg eq ''); - - # 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 diff --git a/bin/automake-1.7 b/bin/automake-1.7 new file mode 100644 index 00000000..22d974db --- /dev/null +++ b/bin/automake-1.7 @@ -0,0 +1,9229 @@ +#!/bin/perl -w +# -*- perl -*- +# Makefile. Generated from Makefile.in by configure. + +eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /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 +# 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/share/automake-1.7'; + unshift @INC, $perllibdir; +} + +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' => "@", + + # 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 'vars', 'subs'; +use Automake::General; +use Automake::XFile; +use Automake::Channels; +use File::Basename; +use Carp; + +## ----------- ## +## Constants. ## +## ----------- ## + +# Parameters set by configure. Not to be changed. NOTE: assign +# VERSION as string so that eg version 0.30 will print correctly. +my $VERSION = '1.7.1'; +my $PACKAGE = 'automake'; +my $libdir = '/usr/share/automake-1.7'; + +# Some regular expressions. One reason to put them here is that it +# makes indentation work better in Emacs. + +# Writting singled-quoted-$-terminated regexes is a pain because +# perl-mode thinks of $' as the ${'} variable (intead 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)*) *:([^=].*|)\$"; + +my $SUFFIX_RULE_PATTERN = + '^(\.[a-zA-Z0-9_(){}$+@]+)(\.[a-zA-Z0-9_(){}$+@]+)' . "\$"; +# 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 $MACRO_PATTERN = '^[.A-Za-z0-9_@]+' . "\$"; +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*(#.*)?' . "\$"); + +# This handles substitution references like ${foo:.a=.b}. +my $SUBST_REF_PATTERN = "^([^:]*):([^=]*)=(.*)\$"; + +# 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.*)' . "\$"; + +# Constants to define the "strictness" level. +use constant FOREIGN => 0; +use constant GNU => 1; +use constant GNITS => 2; + +# Values for AC_CANONICAL_* +use constant AC_CANONICAL_HOST => 1; +use constant AC_CANONICAL_SYSTEM => 2; + +# 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 acinclude.m4 + ansi2knr.1 ansi2knr.c compile config.guess config.rpath config.sub + configure configure.ac configure.in 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. +my @common_sometimes = + qw(aclocal.m4 acconfig.h config.h.top config.h.bot 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)); + +# Declare the macros that define known variables, so we can +# hint the user if she try to use one of these variables. + +# Macros accessible via aclocal. +my %am_macro_for_var = + ( + ANSI2KNR => 'AM_C_PROTOTYPES', + CCAS => 'AM_PROG_AS', + CCASFLAGS => 'AM_PROG_AS', + EMACS => 'AM_PATH_LISPDIR', + GCJ => 'AM_PROG_GCJ', + LEX => 'AM_PROG_LEX', + LIBTOOL => 'AC_PROG_LIBTOOL', + lispdir => 'AM_PATH_LISPDIR', + pkgpyexecdir => 'AM_PATH_PYTHON', + pkgpythondir => 'AM_PATH_PYTHON', + pyexecdir => 'AM_PATH_PYTHON', + PYTHON => 'AM_PATH_PYTHON', + pythondir => 'AM_PATH_PYTHON', + U => 'AM_C_PROTOTYPES', + ); + +# Macros shipped with Autoconf. +my %ac_macro_for_var = + ( + CC => 'AC_PROG_CC', + CFLAGS => 'AC_PROG_CC', + CXX => 'AC_PROG_CXX', + CXXFLAGS => 'AC_PROG_CXX', + F77 => 'AC_PROG_F77', + F77FLAGS => 'AC_PROG_F77', + RANLIB => 'AC_PROG_RANLIB', + YACC => 'AC_PROG_YACC', + ); + +# Copyright on generated Makefile.ins. +my $gen_copyright = "\ +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# 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; + + + +## ---------------------------------- ## +## Variables related to the options. ## +## ---------------------------------- ## + +# TRUE if we should always generate Makefile.in. +my $force_generation = 1; + +# Strictness level as set on command line. +my $default_strictness = GNU; + +# Name of strictness level, as set on command line. +my $default_strictness_name = 'gnu'; + +# This is TRUE if automatic dependency generation code should be +# included in generated Makefile.in. +my $cmdline_use_dependencies = 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 top autoconf input: `configure.ac' or `configure.in'. +my $configure_ac = ''; + +# Files found by scanning configure.ac for LIBOBJS. +my %libsources = (); + +# Names used in AC_CONFIG_HEADER call. +my @config_headers = (); +# Where AC_CONFIG_HEADER appears. +my $config_header_location; + +# 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 the last AC_CONFIG_FILES/AC_OUTPUT appears. +my $ac_config_files_location; + +# List of directories to search for configure-required files. This +# can be set by AC_CONFIG_AUX_DIR. +my @config_aux_path = qw(. .. ../..); +my $config_aux_dir = ''; +my $config_aux_dir_set_in_configure_in = 0; + +# 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; + +# TRUE if we've seen AC_CANONICAL_(HOST|SYSTEM). +my $seen_canonical = 0; +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 = (); + +# This is used to keep track of which variable definitions we are +# scanning. It is only used in certain limited ways, but it has to be +# global. It is declared just for documentation purposes. +my %vars_scanned = (); + +# TRUE if --cygnus seen. +my $cygnus_mode = 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, + ); + +# This is set to 1 when Automake needs to be run again. +# (For instance, this happens when an auxiliary file such as +# depcomp is added after the toplevel Makefile.in -- which +# should distribute depcomp -- has been generated.) +my $automake_needs_to_reprocess_all_files = 0; + +# Options set via AM_INIT_AUTOMAKE. +my $global_options = ''; + +# Same as $suffix_rules (declared below), but records only the +# default rules supplied by the languages Automake supports. +my $suffix_rules_default; + +# If a file name appears as a key in this hash, then it has already +# been checked for. This variable is local to the "require file" +# functions. +my %require_file_found = (); + + +################################################################ + +## ------------------------------------------ ## +## 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; + +# 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; + +# Suffixes found during a run. +my @suffixes; + +# Handling the variables. +# +# For a $VAR: +# - $var_value{$VAR}{$COND} is its value associated to $COND, +# - $var_location{$VAR}{$COND} is where it was defined, +# - $var_comment{$VAR}{$COND} are the comments associated to it. +# - $var_type{$VAR}{$COND} is how it has been defined (`', `+', or `:'), +# - $var_owner{$VAR}{$COND} tells who owns the variable (VAR_AUTOMAKE, +# VAR_CONFIGURE, or VAR_MAKEFILE). +my %var_value; +my %var_location; +my %var_comment; +my %var_type; +my %var_owner; +# Possible values for var_owner. Defined so that the owner of +# a variable can only be increased (e.g Automake should not +# override a configure or Makefile variable). +use constant VAR_AUTOMAKE => 0; # Variable defined by Automake. +use constant VAR_CONFIGURE => 1;# Variable defined in configure.ac. +use constant VAR_MAKEFILE => 2; # Variable defined in Makefile.am. + +# This holds a 1 if a particular variable was examined. +my %content_seen; + +# This holds the names which are targets. These also appear in +# %contents. $targets{TARGET}{COND} is the location of the definition +# of TARGET for condition COND. TARGETs should not include +# a trailing $(EXEEXT), we record this in %target_name. +my %targets; + +# $target_source{TARGET}{COND} is the filename where TARGET +# were defined for condition COND. Note this must be a +# filename, *without* any line number. +my %target_source; + +# $target_name{TARGET}{COND} is the real name of TARGET (in condition COND). +# The real name is often TARGET or TARGET$(EXEEXT), and TARGET never +# contain $(EXEEXT) +my %target_name; + +# $target_owner{TARGET}{COND} the owner of TARGET in condition COND. +my %target_owner; +use constant TARGET_AUTOMAKE => 0; # Target defined by Automake. +use constant TARGET_USER => 1; # Target defined in the user's Makefile.am. + +# This is the conditional stack. +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; + +# Holds the dependencies of targets which dependencies are factored. +# Typically, `.PHONY' will appear in plenty of *.am files, but must +# be output once. Arguably all pure dependencies could be subject +# to this factorization, but it is not unpleasant to have paragraphs +# in Makefile: keeping related stuff altogether. +my %dependencies; + +# Holds the factored actions. Tied to %DEPENDENCIES, i.e., filled +# only when keys exists in %DEPENDENCIES. +my %actions; + +# 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; + +# Strictness levels. +my $strictness; +my $strictness_name; + +# Options from AUTOMAKE_OPTIONS. +my %options; + +# Whether or not dependencies are handled. Can be further changed +# in handle_options. +my $use_dependencies; + +# 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 maps the source extension for all suffix rule seen to +# a \hash whose keys are the possible output extensions. +# +# Note that this is transitively closed by construction: +# if we have +# exists $suffix_rules{$ext1}{$ext2} +# && exists $suffix_rules{$ext2}{$ext3} +# then we also have +# exists $suffix_rules{$ext1}{$ext3} +# +# So it's easy to check whether '.foo' can be transformed to '.$(OBJEXT)' +# by checking whether $suffix_rules{'.foo'}{'.$(OBJEXT)'} exist. This +# will work even if transforming '.foo' to '.$(OBJEXT)' involves a chain +# of several suffix rules. +# +# The value of `$suffix_rules{$ext1}{$ext2}' is the a pair +# `[ $next_sfx, $dist ]' where `$next_sfx' is target suffix +# for the next rule to use to reach '$ext2', and `$dist' the +# distance to `$ext2'. +my $suffix_rules; + +# 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; + +# This is the list of such variables to output. +# FIXME: Might be useless actually. +my @var_list; + +# Was get_object_extension run? +# FIXME: This is a hack. a better switch should be found. +my $get_object_extension_was_run; + +# Contains a stack of `from' parts of variable substitutions currently in +# force. +my @substfroms; + +# Contains a stack of `to' parts of variable substitutions currently in +# force. +my @substtos; + +# This keeps track of all variables defined by subobjname. +# The value stored is the variable names. +# The key has the form "(COND1)VAL1(COND2)VAL2..." where VAL1 and VAL2 +# are the values of the variable for condition COND1 and COND2. +my %subobjvar = (); + +# This hash records helper variables used to implement '+=' in conditionals. +# Keys have the form "VAR:CONDITIONS". The value associated to a key is +# the named of the helper variable used to append to VAR in CONDITIONS. +my %appendvar = (); + + +## --------------------------------- ## +## Forward subroutine declarations. ## +## --------------------------------- ## +sub register_language (%); +sub file_contents_internal ($$%); +sub define_objects_from_sources ($$$$$$$); + + +# &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_rules = ''; + $output_vars = ''; + $output_trailer = ''; + $output_all = ''; + $output_header = ''; + + @suffixes = (); + + %var_value = (); + %var_location = (); + %var_comment = (); + %var_type = (); + %var_owner = (); + + %content_seen = (); + + %targets = (); + %target_source = (); + %target_name = (); + %target_owner = (); + + @cond_stack = (); + + @include_stack = (); + + %dist_dirs = (); + + @all = (); + @check = (); + @check_tests = (); + + %dependencies = + ( + # Texinfoing. + 'dvi' => [], + 'dvi-am' => [], + 'pdf' => [], + 'pdf-am' => [], + 'ps' => [], + 'ps-am' => [], + 'info' => [], + 'info-am' => [], + + # Installing/uninstalling. + 'install-data-am' => [], + 'install-exec-am' => [], + 'uninstall-am' => [], + + 'install-man' => [], + 'uninstall-man' => [], + + 'install-info' => [], + 'install-info-am' => [], + 'uninstall-info' => [], + + 'installcheck-am' => [], + + # Cleaning. + 'clean-am' => [], + 'mostlyclean-am' => [], + 'maintainer-clean-am' => [], + 'distclean-am' => [], + 'clean' => [], + 'mostlyclean' => [], + 'maintainer-clean' => [], + 'distclean' => [], + + # Tarballing. + 'dist-all' => [], + + # Phoning. + '.PHONY' => [] + ); + %actions = (); + + %clean_files = (); + + @sources = (); + @dist_sources = (); + + %object_map = (); + %object_compilation_map = (); + + %directory_map = (); + + %dep_files = (); + + $strictness = $default_strictness; + $strictness_name = $default_strictness_name; + + %options = (); + + $use_dependencies = $cmdline_use_dependencies; + + @dist_targets = (); + + %de_ansi_files = (); + + + # The first time we initialize the variables, + # we save the value of $suffix_rules. + if (defined $suffix_rules_default) + { + $suffix_rules = $suffix_rules_default; + } + else + { + $suffix_rules_default = $suffix_rules; + } + + $all_target = ''; + + %extension_seen = (); + + %language_scratch = (); + + %lang_specific_files = (); + + $handle_dist_run = 0; + + $need_link = 0; + + @var_list = (); + + $get_object_extension_was_run = 0; + + %compile_clean_files = (); + + # We always include `.'. This isn't strictly correct. + %libtool_clean_directories = ('.' => 1); + + %subobjvar = (); + + %appendvar = (); +} + + +################################################################ + +# Initialize our list of error/warning channels. +# Do not forget to update &usage and the manual +# if you add or change a warning channel. + +# Fatal errors. +register_channel 'fatal', type => 'fatal'; +# Common errors. +register_channel 'error', type => 'error'; +# Errors related to GNU Standards. +register_channel 'error-gnu', type => 'error'; +# Errors related to GNU Standards that should be warnings in `foreign' mode. +register_channel 'error-gnu/warn', type => 'error'; +# Errors related to GNITS Standards (silent by default). +register_channel 'error-gnits', type => 'error', silent => 1; +# Internal errors. +register_channel 'automake', type => 'fatal', backtrace => 1, + header => ("####################\n" . + "## Internal Error ##\n" . + "####################\n"), + footer => "\nPlease contact ."; + +# Warnings related to GNU Coding Standards. +register_channel 'gnu', type => 'warning'; +# Warnings about obsolete features (silent by default). +register_channel 'obsolete', type => 'warning', silent => 1; +# Warnings about non-portable constructs. +register_channel 'portability', type => 'warning', silent => 1; +# Weird syntax, unused variables, typos... +register_channel 'syntax', type => 'warning'; +# Warnings about unsupported (or mis-supported) features. +register_channel 'unsupported', type => 'warning'; + +# For &verb. +register_channel 'verb', type => 'debug', silent => 1; +# Informative messages. +register_channel 'note', type => 'debug', silent => 0; + + +# 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', + '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', + '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', + 'lder' => 'F77LD', + 'ld' => '$(F77)', + 'pure' => 1, + 'extensions' => ['.f', '.for', '.f90']); + +# 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', + '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', + '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', + 'lder' => 'GCJLD', + 'ld' => '$(GCJ)', + 'pure' => 1, + 'extensions' => ['.java', '.class', '.zip', '.jar']); + +################################################################ + +# Parse the WARNINGS environnent variable. +&parse_WARNINGS; + +# Parse command line. +&parse_arguments; + +# Do configure.ac scan only once. +&scan_autoconf_files; + +&fatal ("no `Makefile.am' found or specified\n") + if ! @input_files; + +my $automake_has_run = 0; + +do +{ + if ($automake_has_run) + { + &verb ('processing Makefiles another time to fix them up.'); + &prog_error ('running more than two times should never be needed.') + if $automake_has_run >= 2; + } + $automake_needs_to_reprocess_all_files = 0; + + # Now do all the work on each file. + # This guy must be local otherwise it's private to the loop. + use vars '$am_file'; + local $am_file; + foreach $am_file (@input_files) + { + if (! -f ($am_file . '.am')) + { + &err ("`$am_file.am' does not exist"); + } + else + { + &generate_makefile ($output_files{$am_file}, $am_file); + } + } + ++$automake_has_run; +} +while ($automake_needs_to_reprocess_all_files); + +exit $exit_code; + +################################################################ + +# Error reporting functions. + +# prog_error ($MESSAGE, [%OPTIONS]) +# ------------------------------- +# Signal a programming error, display $MESSAGE, and exit 1. +sub prog_error ($;%) +{ + my ($msg, %opts) = @_; + msg 'automake', '', $msg, %opts; +} + +# err ($WHERE, $MESSAGE, [%OPTIONS]) +# err ($MESSAGE) +# ---------------------------------- +# Uncategorized errors. +sub err ($;$%) +{ + my ($where, $msg, %opts) = @_; + msg ('error', $where, $msg, %opts); +} + +# fatal ($WHERE, $MESSAGE, [%OPTIONS]) +# fatal ($MESSAGE) +# ---------------------------------- +# Fatal errors. +sub fatal ($;$%) +{ + my ($where, $msg, %opts) = @_; + msg ('fatal', $where, $msg, %opts); +} + +# err_var ($VARNAME, $MESSAGE, [%OPTIONS]) +# ---------------------------------------- +# Uncategorized errors about variables. +sub err_var ($$;%) +{ + msg_var ('error', @_); +} + +# err_target ($TARGETNAME, $MESSAGE, [%OPTIONS]) +# ---------------------------------------------- +# Uncategorized errors about targets. +sub err_target ($$;%) +{ + msg_target ('error', @_); +} + +# err_cond_target ($COND, $TARGETNAME, $MESSAGE, [%OPTIONS]) +# ---------------------------------------------------------- +# Uncategorized errors about conditional targets. +sub err_cond_target ($$$;%) +{ + msg_cond_target ('error', @_); +} + +# 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_cond_var ($CHANNEL, $COND, $VARNAME, $MESSAGE, [%OPTIONS]) +# -------------------------------------------------------------- +# Messages about conditional variable. +sub msg_cond_var ($$$$;%) +{ + my ($channel, $cond, $var, $msg, %opts) = @_; + msg $channel, $var_location{$var}{$cond}, $msg, %opts; +} + +# msg_var ($CHANNEL, $VARNAME, $MESSAGE, [%OPTIONS]) +# -------------------------------------------------- +# Messages about variables. +sub msg_var ($$$;%) +{ + my ($channel, $var, $msg, %opts) = @_; + # Don't know which condition is concerned. Pick any. + my $cond = (keys %{$var_value{$var}})[0]; + msg_cond_var $channel, $cond, $var, $msg, %opts; +} + +# msg_cond_target ($CHANNEL, $COND, $TARGETNAME, $MESSAGE, [%OPTIONS]) +# -------------------------------------------------------------------- +# Messages about conditional targets. +sub msg_cond_target ($$$$;%) +{ + my ($channel, $cond, $target, $msg, %opts) = @_; + msg $channel, $targets{$target}{$cond}, $msg, %opts; +} + +# msg_target ($CHANNEL, $TARGETNAME, $MESSAGE, [%OPTIONS]) +# -------------------------------------------------------- +# Messages about targets. +sub msg_target ($$$;%) +{ + my ($channel, $target, $msg, %opts) = @_; + # Don't know which condition is concerned. Pick any. + my $cond = (keys %{$targets{$target}})[0]; + msg_cond_target ($channel, $cond, $target, $msg, %opts); +} + +# 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; +} + +# $BOOL +# reject_var ($VAR, $ERROR_MSG) +# ----------------------------- +sub reject_var ($$) +{ + my ($var, $msg) = @_; + if (variable_defined ($var)) + { + err_var $var, $msg; + return 1; + } + return 0; +} + +# $BOOL +# reject_target ($VAR, $ERROR_MSG) +# -------------------------------- +sub reject_target ($$) +{ + my ($target, $msg) = @_; + if (target_defined ($target)) + { + err_target $target, $msg; + return 1; + } + return 0; +} + +# verb ($MESSAGE, [%OPTIONS]) +# --------------------------- +sub verb ($;%) +{ + my ($msg, %opts) = @_; + msg 'verb', '', $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) || '.'; +} + +################################################################ + +# Pattern that matches all know input extensions (i.e. extensions used +# by the languages supported by Automake). Using this pattern +# (instead of `\..*$') to match extensions allows Automake to support +# dot-less extensions. +my $KNOWN_EXTENSIONS_PATTERN = ""; +my @known_extensions_list = (); + +# accept_extensions (@EXTS) +# ------------------------- +# Update $KNOWN_EXTENSIONS_PATTERN to recognize the extensions +# listed @EXTS. Extensions should contain a dot if needed. +sub accept_extensions (@) +{ + push @known_extensions_list, @_; + $KNOWN_EXTENSIONS_PATTERN = + '(?:' . join ('|', map (quotemeta, @known_extensions_list)) . ')'; +} + +# var_SUFFIXES_trigger ($TYPE, $VALUE) +# ------------------------------------ +# This is called automagically by macro_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, and $KNOWN_EXTENSIONS_PATTERN +# are used when parsing the input am file. +sub var_SUFFIXES_trigger ($$) +{ + my ($type, $value) = @_; + accept_extensions (split (' ', $value)); +} + +################################################################ + + +# switch_warning ($CATEGORY) +# -------------------------- +# If $CATEGORY is mumble, turn on the mumble channel. +# If it's no-mumble, turn mumble off. +# Alse handle `all' and `none' for completeness. +sub switch_warning ($) +{ + my ($cat) = @_; + my $has_no = 0; + + if ($cat =~ /^no-(.*)$/) + { + $cat = $1; + $has_no = 1; + } + + if ($cat eq 'all') + { + setup_channel_type 'warning', silent => $has_no; + } + elsif ($cat eq 'none') + { + setup_channel_type 'warning', silent => 1 - $has_no; + } + elsif ($cat eq 'error') + { + $warnings_are_errors = 1 - $has_no; + } + elsif (channel_type ($cat) eq 'warning') + { + setup_channel $cat, silent => $has_no; + } + else + { + return 1; + } + return 0; +} + +# parse_WARNINGS +# -------------- +# Honor the WARNINGS environment variable. +sub parse_WARNINGS ($$) +{ + if (exists $ENV{'WARNINGS'}) + { + # Ignore unknown categories. This is required because WARNINGS + # should be honored by many tools. + switch_warning $_ foreach (split (',', $ENV{'WARNINGS'})); + } +} + +# parse_warning ($OPTION, $ARGUMENT) +# ---------------------------------- +# Parse the argument of --warning=CATEGORY or -WCATEGORY. +sub parse_warnings ($$) +{ + my ($opt, $categories) = @_; + + foreach my $cat (split (',', $categories)) + { + msg 'unsupported', "unknown warning category `$cat'" + if switch_warning $cat; + } +} + +# Parse command line. +sub parse_arguments () +{ + # Start off as gnu. + &set_strictness ('gnu'); + + my %options = + ( + 'libdir:s' => \$libdir, + 'gnu' => sub { &set_strictness ('gnu'); }, + 'gnits' => sub { &set_strictness ('gnits'); }, + 'cygnus' => \$cygnus_mode, + 'foreign' => sub { &set_strictness ('foreign'); }, + 'include-deps' => sub { $cmdline_use_dependencies = 1; }, + 'i|ignore-deps' => sub { $cmdline_use_dependencies = 0; }, + '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 garanty this + # if we treat other options first. (Handling other options first + # could produce error diagnostics, and in this condition it is + # confusing if Automake `exit 0'.) + my %options_1st_pass = + ( + 'version' => \&version, + 'help' => \&usage, + # Recognize all other options (and their arguments) but do nothing. + map { $_ => sub {} } (keys %options) + ); + my @ARGV_backup = @ARGV; + Getopt::Long::GetOptions %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 %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 = '.'; + } + + foreach my $arg (@ARGV) + { + if ($arg =~ /^-./) + { + fatal ("unrecognized option `$arg'\n" + . "Try `$0 --help' for more information."); + } + + # Handle $local:$input syntax. Note that we only examine the + # first ":" file to see if it is automake input; the rest are + # just taken verbatim. We still keep all the files around for + # dependency checking, however. + my ($local, $input, @rest) = split (/:/, $arg); + if (! $input) + { + $input = $local; + } + else + { + # Strip .in; later on .am is tacked on. That is how the + # automake input file is found. Maybe not the best way, but + # it is easy to explain. + $input =~ s/\.in$// + or fatal "invalid input file name `$arg'\n."; + } + push (@input_files, $input); + $output_files{$input} = join (':', ($local, @rest)); + } + + # Take global strictness from whatever we currently have set. + $default_strictness = $strictness; + $default_strictness_name = $strictness_name; +} + +################################################################ + +# 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 ($output, $makefile) = @_; + + # Reset all the Makefile.am related variables. + &initialize_per_input; + + # Any warning setting now local to this Makefile.am. + &dup_channel_setup; + # 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 file, + # other than to mark them as dependencies. See + # &scan_autoconf_files for details. + my (@secondary_inputs); + ($output, @secondary_inputs) = split (/:/, $output); + + $relative_dir = dirname ($output); + $am_relative_dir = dirname ($makefile); + + &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') + { + if (exists $var_owner{$var}) + { + prog_error "\$var_owner{$var}{TRUE} doesn't exist" + unless exists $var_owner{$var}{'TRUE'}; + reject_var $var, "`$var' should not be defined" + if $var_owner{$var}{'TRUE'} != VAR_AUTOMAKE; + } + } + + # Catch some obsolete variables. + msg_var ('obsolete', 'INCLUDES', + "`INCLUDES' is the old name for `AM_CPPFLAGS'") + if variable_defined ('INCLUDES'); + + # At the toplevel directory, we might need config.guess, config.sub + # or libtool scripts (ltconfig and ltmain.sh). + if ($relative_dir eq '.') + { + # AC_CANONICAL_HOST and AC_CANONICAL_SYSTEM need config.guess and + # config.sub. + require_conf_file ($canonical_location, FOREIGN, + 'config.guess', 'config.sub') + if $seen_canonical; + } + + # We still need Makefile.in here, because sometimes the `dist' + # target doesn't re-run automake. + if ($am_relative_dir eq $relative_dir) + { + # Only distribute the files if they are in the same subdir as + # the generated makefile. + &push_dist_common ($in_file_name, $am_file_name); + } + + push (@sources, '$(SOURCES)') + if variable_defined ('SOURCES'); + + # Must do this after reading .am file. See read_main_am_file to + # understand weird tricks we play there with variables. + &define_variable ('subdir', $relative_dir); + + # Check first, because we might modify some state. + &check_cygnus; + &check_gnu_standards; + &check_gnits_standards; + + &handle_configure ($output, $makefile, @secondary_inputs); + &handle_gettext; + &handle_libraries; + &handle_ltlibraries; + &handle_programs; + &handle_scripts; + + # This must run first so that the ANSI2KNR definition is generated + # before it is used by the _.c rules. We have to do this because + # a variable which is used in a dependency must be defined before + # the target, or else make won't properly see it. + &handle_compile; + # This must be run after all the sources are scanned. + &handle_languages; + + # We have to run this after dealing with all the programs. + &handle_libtool; + + # Re-init SOURCES. FIXME: other code shouldn't depend on this + # (but currently does). + macro_define ('SOURCES', VAR_AUTOMAKE, '', 'TRUE', "@sources", 'internal'); + define_pretty_variable ('DIST_SOURCES', '', @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 ($makefile); + + &handle_footer; + &do_check_merge_target; + &handle_all ($output); + + # FIXME: Gross! + if (variable_defined ('lib_LTLIBRARIES') && + variable_defined ('bin_PROGRAMS')) + { + $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n"; + } + + &handle_installdirs; + &handle_clean; + &handle_factored_dependencies; + + check_typos (); + + if (! -d ($output_directory . '/' . $am_relative_dir)) + { + mkdir ($output_directory . '/' . $am_relative_dir, 0755); + } + + my ($out_file) = $output_directory . '/' . $makefile . ".in"; + if (! $force_generation && -e $out_file) + { + my ($am_time) = (stat ($makefile . '.am'))[9]; + my ($in_time) = (stat ($out_file))[9]; + # FIXME: should cache these times. + my ($conf_time) = (stat ($configure_ac))[9]; + # FIXME: how to do unsigned comparison? + if ($am_time < $in_time || $am_time < $conf_time) + { + # No need to update. + return; + } + if (-f 'aclocal.m4') + { + my ($acl_time) = (stat _)[9]; + return if ($am_time < $acl_time); + } + } + + if (-e "$out_file") + { + unlink ($out_file) + or fatal "cannot remove $out_file: $!\n"; + } + my $gm_file = new Automake::XFile "> $out_file"; + verb "creating $makefile.in"; + + print $gm_file $output_vars; + # We make sure that `all:' is the first target. + print $gm_file $output_all; + print $gm_file $output_header; + print $gm_file $output_rules; + print $gm_file $output_trailer; + + # Back out any warning setting. + &drop_channel_setup; +} + +################################################################ + +# A version is a string that looks like +# MAJOR.MINOR[.MICRO][ALPHA][-FORK] +# where +# MAJOR, MINOR, and MICRO are digits, ALPHA is a character, and +# FORK any alphanumeric word. +# Usually, ALPHA is used to label alpha releases or intermediate snapshots, +# FORK is used for CVS branches or patched releases, and MICRO is used +# for bug fixes releases on the MAJOR.MINOR branch. +# +# For the purpose of ordering, 1.4 is the same as 1.4.0, but 1.4g is +# the same as 1.4.99g. The FORK identifier is ignored in the +# ordering, except when it looks like -pMINOR[ALPHA]: some versions +# were labelled like 1.4-p3a, this is the same as an alpha release +# labelled 1.4.3a. Yes it's horrible, but Automake did not support +# two-dot versions in the past. + +# version_split (VERSION) +# ----------------------- +# Split a version string into the corresponding (MAJOR, MINOR, MICRO, +# ALPHA, FORK) tuple. For instance "1.4g" would be split into +# (1, 4, 99, 'g', ''). +# Return () on error. +sub version_split ($) +{ + my ($ver) = @_; + + # Special case for versions like 1.4-p2a. + if ($ver =~ /^(\d+)\.(\d+)(?:-p(\d+)([a-z]+)?)$/) + { + return ($1, $2, $3, $4 || '', ''); + } + # Common case. + elsif ($ver =~ /^(\d+)\.(\d+)(?:\.(\d+))?([a-z])?(?:-([A-Za-z0-9]+))?$/) + { + return ($1, $2, $3 || (defined $4 ? 99 : 0), $4 || '', $5 || ''); + } + return (); +} + +# version_compare (\@LVERSION, \@RVERSION) +# ---------------------------------------- +# Return 1 if LVERSION > RVERSION, +# -1 if LVERSION < RVERSION, +# 0 if LVERSION = RVERSION. +sub version_compare (\@\@) +{ + my @l = @{$_[0]}; + my @r = @{$_[1]}; + + for my $i (0, 1, 2) + { + return 1 if ($l[$i] > $r[$i]); + return -1 if ($l[$i] < $r[$i]); + } + for my $i (3, 4) + { + return 1 if ($l[$i] gt $r[$i]); + return -1 if ($l[$i] lt $r[$i]); + } + return 0; +} + +# Handles the logic of requiring a version number in AUTOMAKE_OPTIONS. +# Return 0 if the required version is satisfied, 1 otherwise. +sub version_check ($) +{ + my ($required) = @_; + my @version = version_split $VERSION; + my @required = version_split $required; + + prog_error "version is incorrect: $VERSION" + if $#version == -1; + + # This should not happen, because process_option_list and split_version + # use similar regexes. + prog_error "required version is incorrect: $required" + if $#required == -1; + + # If we require 3.4n-foo then we require something + # >= 3.4n, with the `foo' fork identifier. + return 1 + if ($required[4] ne '' && $required[4] ne $version[4]); + + return 0 > version_compare @version, @required; +} + +# $BOOL +# process_option_list ($CONFIG, @OPTIONS) +# ------------------------------ +# Process a list of options. Return 1 on error, 0 otherwise. +# This is a helper for handle_options. CONFIG is true if we're +# handling global options. +sub process_option_list +{ + my ($config, @list) = @_; + + # FIXME: We should disallow conditional deffinitions of AUTOMAKE_OPTIONS. + my $where = ($config ? + $seen_init_automake : + $var_location{'AUTOMAKE_OPTIONS'}{'TRUE'}); + + foreach (@list) + { + $options{$_} = 1; + if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign') + { + &set_strictness ($_); + } + elsif ($_ eq 'cygnus') + { + $cygnus_mode = 1; + } + elsif (/^(.*\/)?ansi2knr$/) + { + # An option like "../lib/ansi2knr" is allowed. With no + # path prefix, we assume the required programs are in this + # directory. We save the actual option for later. + $options{'ansi2knr'} = $_; + } + elsif ($_ eq 'no-installman' || $_ eq 'no-installinfo' + || $_ eq 'dist-shar' || $_ eq 'dist-zip' + || $_ eq 'dist-tarZ' || $_ eq 'dist-bzip2' + || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex' + || $_ eq 'readme-alpha' || $_ eq 'check-news' + || $_ eq 'subdir-objects' || $_ eq 'nostdinc' + || $_ eq 'no-exeext' || $_ eq 'no-define' + || $_ eq 'std-options') + { + # Explicitly recognize these. + } + elsif ($_ eq 'no-dependencies') + { + $use_dependencies = 0; + } + elsif (/^\d+\.\d+(?:\.\d+)?[a-z]?(?:-[A-Za-z0-9]+)?$/) + { + # Got a version number. + if (version_check $&) + { + err ($where, "require Automake $_, but have $VERSION", + uniq_scope => US_GLOBAL); + return 1; + } + } + elsif (/^(?:--warnings=|-W)(.*)$/) + { + foreach my $cat (split (',', $1)) + { + msg 'unsupported', $where, "unknown warning category `$cat'" + if switch_warning $cat; + } + } + else + { + err ($where, "option `$_' not recognized", + uniq_scope => US_GLOBAL); + return 1; + } + } +} + +# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise. +sub handle_options +{ + # Process global options first so that more specific options can + # override. + if (&process_option_list (1, split (' ', $global_options))) + { + return 1; + } + + if (variable_defined ('AUTOMAKE_OPTIONS')) + { + if (&process_option_list (0, &variable_value_as_list_recursive ('AUTOMAKE_OPTIONS', ''))) + { + return 1; + } + } + + if ($strictness == GNITS) + { + $options{'readme-alpha'} = 1; + $options{'std-options'} = 1; + $options{'check-news'} = 1; + } + + return 0; +} + + +# get_object_extension ($OUT) +# --------------------------- +# Return object extension. Just once, put some code into the output. +# OUT is the name of the output file +sub get_object_extension +{ + my ($out) = @_; + + # Maybe require libtool library object files. + my $extension = '.$(OBJEXT)'; + $extension = '.lo' if ($out =~ /\.la$/); + + # Check for automatic de-ANSI-fication. + $extension = '$U' . $extension + if defined $options{'ansi2knr'}; + + $get_object_extension_was_run = 1; + + return $extension; +} + + +# Call finish function for each language that was used. +sub handle_languages +{ + if ($use_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) $config_aux_dir/depcomp"); + &define_variable ('am__depfiles_maybe', 'depfiles'); + + require_conf_file ("$am_file.am", FOREIGN, 'depcomp'); + + my @deplist = sort keys %dep_files; + + # We define this as a conditional variable because BSD + # make can't handle backslashes for continuing comments on + # the following line. + define_pretty_variable ('DEP_FILES', 'AMDEP_TRUE', @deplist); + + # 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', + DEPDIRS => "@depdirs"); + } + } + else + { + &define_variable ('depcomp', ''); + &define_variable ('am__depfiles_maybe', ''); + } + + 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 = (($use_dependencies && $lang->autodep ne 'no') + ? 'AMDEP' : 'FALSE'); + my $FASTDEP = (($use_dependencies && $lang->autodep ne 'no') + ? ('am__fastdep' . $fpfx) : 'FALSE'); + + 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 (($use_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' + && defined $options{'subdir-objects'}); + + # Compute a possible derived extension. + # This is not used by depend2.am. + my $der_ext = (&{$lang->output_extensions} ($ext))[0]; + + $output_rules .= + file_contents ($rule_file, + %transform, + 'GENERIC' => 1, + + 'DERIVED-EXT' => $der_ext, + + # In this situation we know that the + # object is in this directory, so + # $(DEPDIR) is the correct location for + # dependencies. + 'DEPBASE' => '$(DEPDIR)/$*', + 'BASE' => '$*', + 'SOURCE' => '$<', + 'OBJ' => '$@', + 'OBJOBJ' => '$@', + 'LTOBJ' => '$@', + + 'COMPILE' => '$(' . $lang->compiler . ')', + 'LTCOMPILE' => '$(LT' . $lang->compiler . ')', + '-o' => $output_flag); + } + + # 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) = split (' ', $file); + + # For any specially-generated object, we must respect the + # ansi2knr setting so that we don't inadvertently try to + # use the default rule. + if ($lang->ansi && defined $options{'ansi2knr'}) + { + $myext = '$U' . $myext; + } + + # 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 occurence 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 variable_defined ($val); + } + + my $obj_ltcompile = '$(LIBTOOL) --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); + + # Generate a transform which will turn suffix targets in + # depend2.am into real targets for the particular objects we + # are building. + $output_rules .= + file_contents ($rule_file, + (%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)); + } + + # 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', %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 overriden in the Makefile... + my @dont_override = @{$lang->flags}; + # ... and so is LDFLAGS. + push @dont_override, 'LDFLAGS' if $lang->link; + + foreach my $flag (@dont_override) + { + if (exists $var_owner{$flag}) + { + for my $cond (keys %{$var_owner{$flag}}) + { + if ($var_owner{$flag}{$cond} == 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 || ((scalar keys %$suffix_rules) + - (scalar keys %$suffix_rules_default)) > 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; + if (variable_defined ($prefix . $one_file . '_SOURCES')) + { + @files = &variable_value_as_list_recursive ( + ($prefix . $one_file . '_SOURCES'), + 'all'); + } + 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_list ($VAR, $TOPPARENT, $DERIVED, $OBJ, @FILES) +# ----------------------------------------------------------------------- +# 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') +# @FILES is the list of source files to transform +# Result is a list of the names of objects +# %linkers_used will be updated with any linkers needed +sub handle_single_transform_list ($$$$@) +{ + my ($var, $topparent, $derived, $obj, @files) = @_; + 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 (/^\@.*\@$/) + { + err_var ($var, + "`$var' includes configure substitution `$_', and is " . + "referred to\nfrom `$topparent': configure " . + "substitutions are not allowed\nin _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; + my $full_ansi = $full; # We'll add `$U' if needed. + + # 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 (eg, + # 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 (variable_defined ("${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; + if (variable_defined ($derived . '_SHORTNAME')) + { + # FIXME: should use the same conditional as + # the _SOURCES variable. But this is really + # silly overkill -- nobody should have + # conditional shortnames. + $dname = &variable_value ($derived . '_SHORTNAME'); + } + $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 doing dependency tracking, then we can't print + # the rule. If we have a subdir object, we need to + # generate an explicit rule. Actually, in any case + # where the object is not in `.' we need a special + # rule. The per-object rules in this case are + # generated later, by handle_languages. + if ($renamed || $directory ne '') + { + my $obj_sans_ext = substr ($object, 0, + - length ($this_obj_ext)); + if ($lang->ansi && defined $options{'ansi2knr'}) + { + $full_ansi =~ s/$KNOWN_EXTENSIONS_PATTERN$/\$U$&/; + $full_ansi = basename $full_ansi + unless defined $options{'subdir-objects'}; + } + + my $val = ("$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) + { + $val = "$derived $val"; + $aggregate = $derived; + } + else + { + $val = "AM $val"; + } + + # Each item on this list is a string consisting of + # four space-separated values: the derived flag prefix + # (eg, 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}}, $val); + } + } + 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 `$object' 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); + } + + 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 file is in subdirectory, we need explicit + # dependency. + if ($directory ne '' || $renamed) + { + push (@dep_list, $full_ansi); + } + + # 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)')) + if $use_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, $OBJVAR) +# define_objects_from_sources ($VAR, $OBJVAR, $NODEFINE, $ONE_FILE, +# $OBJ, $PARENT, $TOPPARENT) +# --------------------------------------------------------------------- +# 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 (ie either `.o' or `.lo'). +# $PARENT is the variable in which $VAR is used, or $VAR if not applicable. +# $TOPPARENT is the _SOURCES variable being processed. +# +# Result is a pair ($LINKER, $OBJVAR): +# $LINKER is a boolean, true if a linker is needed to deal with the objects, +# $OBJVAR is the name of the variable defined to hold the objects. +# +# %linkers_used, %vars_scanned, @substfroms and @substtos should be cleared +# before use: +# %linkers_used variable will be set to contain the linkers desired. +# %vars_scanned will be used to check for recursive definitions. +# @substfroms and @substtos will be used to keep a stack of variable +# substitutions to be applied. +# +sub define_objects_from_sources ($$$$$$$) +{ + my ($var, $objvar, $nodefine, $one_file, $obj, $parent, $topparent) = @_; + + if (defined $vars_scanned{$var}) + { + err_var $var, "variable `$var' recursively defined"; + return ""; + } + $vars_scanned{$var} = 1; + + my $needlinker = ""; + my @allresults = (); + foreach my $cond (variable_conditions ($var)) + { + my @result; + foreach my $val (&variable_value_as_list ($var, $cond, $parent)) + { + # If $val is a variable (i.e. ${foo} or $(bar), not a filename), + # handle the sub variable recursively. + if ($val =~ /^\$\{([^}]*)\}$/ || $val =~ /^\$\(([^)]*)\)$/) + { + my $subvar = $1; + + # If the user uses a losing variable name, just ignore it. + # This isn't ideal, but people have requested it. + next if ($subvar =~ /\@.*\@/); + + # See if the variable is actually a substitution reference + my ($from, $to); + my @temp_list; + if ($subvar =~ /$SUBST_REF_PATTERN/o) + { + $subvar = $1; + $to = $3; + $from = quotemeta $2; + } + push @substfroms, $from; + push @substtos, $to; + + my ($temp, $varname) + = define_objects_from_sources ($subvar, undef, + $nodefine, $one_file, + $obj, $var, $topparent); + + push (@result, '$('. $varname . ')'); + $needlinker ||= $temp; + + pop @substfroms; + pop @substtos; + } + else # $var is a filename + { + my $substnum=$#substfroms; + while ($substnum >= 0) + { + $val =~ s/$substfroms[$substnum]$/$substtos[$substnum]/ + if defined $substfroms[$substnum]; + $substnum -= 1; + } + + my (@transformed) = + &handle_single_transform_list ($var, $topparent, $one_file, $obj, $val); + push (@result, @transformed); + $needlinker = "true" if @transformed; + } + } + push (@allresults, [$cond, @result]); + } + # Find a name for the variable, unless imposed. + $objvar = subobjname (@allresults) unless defined $objvar; + # Define _OBJECTS conditionally + unless ($nodefine) + { + foreach my $pair (@allresults) + { + my ($cond, @result) = @$pair; + define_pretty_variable ($objvar, $cond, @result); + } + } + + delete $vars_scanned{$var}; + return ($needlinker, $objvar); +} + + +# $VARNAME +# subobjname (@DEFINITIONS) +# ------------------------- +# Return a name for an object variable that with definitions @DEFINITIONS. +# @DEFINITIONS is a list of pair [$COND, @OBJECTS]. +# +# If we already have an object variable containing @DEFINITIONS, reuse it. +# This way, we avoid combinatorial explosion of the generated +# variables. Especially, in a Makefile such as: +# +# | if FOO1 +# | A1=1 +# | endif +# | +# | if FOO2 +# | A2=2 +# | endif +# | +# | ... +# | +# | if FOON +# | AN=N +# | endif +# | +# | B=$(A1) $(A2) ... $(AN) +# | +# | c_SOURCES=$(B) +# | d_SOURCES=$(B) +# +# The generated c_OBJECTS and d_OBJECTS will share the same variable +# definitions. +# +# This setup can be the case of a testsuite containing lots (>100) of +# small C programs, all testing the same set of source files. +sub subobjname (@) +{ + my $key = ''; + foreach my $pair (@_) + { + my ($cond, @values) = @$pair; + $key .= "($cond)@values"; + } + + return $subobjvar{$key} if exists $subobjvar{$key}; + + my $num = 1 + keys (%subobjvar); + my $name = "am__objects_${num}"; + $subobjvar{$key} = $name; + return $name; +} + + +# Handle SOURCE->OBJECT transform for one program or library. +# Arguments are: +# canonical (transformed) name of object to build +# actual name of object to build +# object extension (ie either `.o' or `$o'. +# 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) = @_; + + 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 $var = $prefix . $one_file . "_SOURCES"; + next + if !variable_defined ($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, "\$($var)"; + if ($prefix !~ /^nodist_/) + { + # If the VAR wasn't definined conditionally, we add + # it to DIST_SOURCES as is. Otherwise we create a + # am__VAR_DIST variable which contains all possible values, + # and add this variable to DIST_SOURCES. + my $distvar = "$var"; + my @conds = variable_conditions_recursive ($var); + if (@conds && $conds[0] ne 'TRUE') + { + $distvar = "am__${var}_DIST"; + my @files = + uniq (variable_value_as_list_recursive ($var, 'all')); + define_pretty_variable ($distvar, '', @files); + } + push @dist_sources, "\$($distvar)" + } + + @substfroms = (); + @substtos = (); + %vars_scanned = (); + my ($temp, $objvar) = + define_objects_from_sources ($var, + $xpfx . $one_file . '_OBJECTS', + $prefix =~ /EXTRA_/, + $one_file, $obj, $var, $var); + $needlinker ||= $temp; + } + if ($needlinker) + { + $linker ||= &resolve_linker (%linkers_used); + } + + my @keys = sort keys %used_pfx; + if (scalar @keys == 0) + { + &define_variable ($one_file . "_SOURCES", $unxformed . ".c"); + push (@sources, $unxformed . '.c'); + push (@dist_sources, $unxformed . '.c'); + + %linkers_used = (); + my (@result) = + &handle_single_transform_list ($one_file . '_SOURCES', + $one_file . '_SOURCES', + $one_file, $obj, + "$unxformed.c"); + $linker ||= &resolve_linker (%linkers_used); + define_pretty_variable ($one_file . "_OBJECTS", '', @result) + } + else + { + grep ($_ = '$(' . $_ . $one_file . '_OBJECTS)', @keys); + define_pretty_variable ($one_file . '_OBJECTS', '', @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, $var) = @_; + + prog_error "handle_lib_objects: $var undefined" + if ! variable_defined ($var); + + my $ret = 0; + foreach my $cond (variable_conditions_recursive ($var)) + { + if (&handle_lib_objects_cond ($xname, $var, $cond)) + { + $ret = 1; + } + } + return $ret; +} + +# Subroutine of handle_lib_objects: handle a particular condition. +sub handle_lib_objects_cond +{ + my ($xname, $var, $cond) = @_; + + # We recognize certain things that are commonly put in LIBADD or + # LDADD. + my @dep_list = (); + + my $seen_libobjs = 0; + my $flagvar = 0; + + foreach my $lsearch (&variable_value_as_list_recursive ($var, $cond)) + { + # Skip -lfoo and -Ldir; these are explicitly allowed. + next if $lsearch =~ /^-[lL]/; + if (! $flagvar && $lsearch =~ /^-/) + { + if ($var =~ /^(.*)LDADD$/) + { + # Skip -dlopen and -dlpreopen; these are explicitly allowed. + next if $lsearch =~ /^-dl(pre)?open$/; + my $prefix = $1 || 'AM_'; + err_var ($var, "linker flags such as `$lsearch' belong in " + . "`${prefix}LDFLAGS"); + } + else + { + $var =~ /^(.*)LIBADD$/; + # Only get this error once. + $flagvar = 1; + err_var ($var, "linker flags such as `$lsearch' belong in " + . "`${1}LDFLAGS"); + } + } + + # Assume we have a file of some sort, and push it onto the + # dependency list. Autoconf substitutions are not pushed; + # rarely is a new dependency substituted into (eg) foo_LDADD + # -- but "bad things (eg -lX11) are routinely substituted. + # Note that LIBOBJS and ALLOCA are exceptions to this rule, + # and handled specially below. + push (@dep_list, $lsearch) + unless $lsearch =~ /^\@.*\@$/; + + # Automatically handle LIBOBJS and ALLOCA substitutions. + # Basically this means adding entries to dep_files. + if ($lsearch =~ /^\@(LT)?LIBOBJS\@$/) + { + my $lt = $1 ? $1 : ''; + my $myobjext = ($1 ? 'l' : '') . 'o'; + + push (@dep_list, $lsearch); + $seen_libobjs = 1; + if (! keys %libsources + && ! variable_defined ($lt . 'LIBOBJS')) + { + err_var ($var, "\@${lt}LIBOBJS\@ seen but never set in " + . "`$configure_ac'"); + } + + 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. + if (! variable_defined ('BUILT_SOURCES') + || ! grep (/$rewrite/, + &variable_value_as_list_recursive ( + 'BUILT_SOURCES', 'all'))) + { + require_file_with_macro ($cond, $var, FOREIGN, $iter); + } + } + } + } + elsif ($lsearch =~ /^\@(LT)?ALLOCA\@$/) + { + my $lt = $1 ? $1 : ''; + my $myobjext = ($1 ? 'l' : '') . 'o'; + + push (@dep_list, $lsearch); + err_var ($var, "\@${lt}ALLOCA\@ seen but `AC_FUNC_ALLOCA' not in " + . "`$configure_ac'") + if ! defined $libsources{'alloca.c'}; + $dep_files{'$(DEPDIR)/alloca.P' . $myobjext} = 1; + require_file_with_macro ($cond, $var, FOREIGN, 'alloca.c'); + &saw_extension ('c'); + } + } + + if ($xname ne '') + { + my $depvar = $xname . '_DEPENDENCIES'; + if ((conditional_ambiguous_p ($depvar, $cond, + keys %{$var_value{$depvar}}))[0] ne '') + { + # Note that we've examined this. + &examine_variable ($depvar); + } + else + { + define_pretty_variable ($depvar, $cond, @dep_list); + } + } + + return $seen_libobjs; +} + +# 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 (! defined $options{'nostdinc'}) + { + $default_includes = ' -I. -I$(srcdir)'; + + if (variable_defined ('CONFIG_HEADER')) + { + foreach my $hdr (split (' ', &variable_value ('CONFIG_HEADER'))) + { + $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", + ('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 (defined $options{'ansi2knr'}) + { + require_variables_for_macro ('AUTOMAKE_OPTIONS', + "option `ansi2knr' is used", + "ANSI2KNR", "U"); + + # topdir is where ansi2knr should be. + if ($options{'ansi2knr'} eq 'ansi2knr') + { + # Only require ansi2knr files if they should appear in + # this directory. + require_file_with_macro ('TRUE', 'AUTOMAKE_OPTIONS', FOREIGN, + 'ansi2knr.c', 'ansi2knr.1'); + + # ansi2knr needs to be built before subdirs, so unshift it. + unshift (@all, '$(ANSI2KNR)'); + } + + my $ansi2knr_dir = ''; + $ansi2knr_dir = dirname ($options{'ansi2knr'}) + if $options{'ansi2knr'} ne 'ansi2knr'; + + $output_rules .= &file_contents ('ansi2knr', + ('ANSI2KNR-DIR' => $ansi2knr_dir)); + + } +} + +# handle_libtool () +# ----------------- +# Handle libtool rules. +sub handle_libtool +{ + return unless variable_defined ('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', + ('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 = + variable_defined ('LDADD') && &handle_lib_objects ('', 'LDADD'); + + foreach my $one_file (@proglist) + { + my $seen_libobjs = 0; + my $obj = &get_object_extension ($one_file); + + # Canonicalize names and check for misspellings. + my $xname = &check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS', + '_SOURCES', '_OBJECTS', + '_DEPENDENCIES'); + + my $linker = &handle_source_transform ($xname, $one_file, $obj); + + my $xt = ''; + if (variable_defined ($xname . "_LDADD")) + { + $seen_libobjs = &handle_lib_objects ($xname, $xname . '_LDADD'); + $xt = '_LDADD'; + } + else + { + # User didn't define prog_LDADD override. So do it. + &define_variable ($xname . '_LDADD', '$(LDADD)'); + + # This does a bit too much work. But we need it to + # generate _DEPENDENCIES when appropriate. + if (variable_defined ('LDADD')) + { + $seen_libobjs = &handle_lib_objects ($xname, 'LDADD'); + } + elsif (! variable_defined ($xname . '_DEPENDENCIES')) + { + &define_variable ($xname . '_DEPENDENCIES', ''); + } + $xt = '_SOURCES'; + } + + reject_var ($xname . '_LIBADD', + "use `${xname}_LDADD', not `${xname}_LIBADD'"); + + if (! variable_defined ($xname . '_LDFLAGS')) + { + # Define the prog_LDFLAGS variable. + &define_variable ($xname . '_LDFLAGS', ''); + } + + # Determine program to use for link. + my $xlink; + if (variable_defined ($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); + + # Don't add $(EXEEXT) if user already did. + my $extension = ($one_file !~ /\$\(EXEEXT\)$/ + ? "\$(EXEEXT)" + : ''); + + $output_rules .= &file_contents ('program', + ('PROGRAM' => $one_file, + 'XPROGRAM' => $xname, + 'XLINK' => $xlink, + 'DIRSTAMP' => $dirstamp, + 'EXEEXT' => $extension)); + + if ($seen_libobjs || $seen_global_libobjs) + { + if (variable_defined ($xname . '_LDADD')) + { + &check_libobjs_sources ($xname, $xname . '_LDADD'); + } + elsif (variable_defined ('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'); + + require_variables_for_macro ($prefix[0] . '_LIBRARIES', + 'library used', 'RANLIB') + if (@prefix); + + foreach my $onelib (@liblist) + { + my $seen_libobjs = 0; + # Check that the library fits the standard naming convention. + if (basename ($onelib) !~ /^lib.*\.a/) + { + # FIXME should put line number here. That means mapping + # from library name back to variable name. + err_am "`$onelib' is not a standard library name"; + } + + my $obj = &get_object_extension ($onelib); + + # Canonicalize names and check for misspellings. + my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES', + '_OBJECTS', '_DEPENDENCIES', + '_AR'); + + if (! variable_defined ($xlib . '_AR')) + { + &define_variable ($xlib . '_AR', '$(AR) cru'); + } + + if (variable_defined ($xlib . '_LIBADD')) + { + if (&handle_lib_objects ($xlib, $xlib . '_LIBADD')) + { + $seen_libobjs = 1; + } + } + else + { + # Generate support for conditional object inclusion in + # libraries. + &define_variable ($xlib . "_LIBADD", ''); + } + + reject_var ($xlib . '_LDADD', + "use `${xlib}_LIBADD', not `${xlib}_LDADD'"); + + # Make sure we at look at this. + &examine_variable ($xlib . '_DEPENDENCIES'); + + &handle_source_transform ($xlib, $onelib, $obj); + + # 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', + ('LIBRARY' => $onelib, + 'XLIBRARY' => $xlib, + 'DIRSTAMP' => $dirstamp)); + + if ($seen_libobjs) + { + if (variable_defined ($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 %instdirs; + my @prefix = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib', + 'noinst', 'check'); + + require_variables_for_macro ($prefix[0] . '_LTLIBRARIES', + 'Libtool library used', 'LIBTOOL') + if (@prefix); + + foreach my $key (@prefix) + { + # Get the installation directory of each library. + (my $dir = $key) =~ s/^nobase_//; + for (variable_value_as_list_recursive ($key . '_LTLIBRARIES', 'all')) + { + # We reject libraries which are installed in several places, + # because we don't handle this in the rules (think `-rpath'). + # + # However, we allow the same library to be listed many times + # for the same directory. This is for users who need setups + # like + # if COND1 + # lib_LTLIBRARIES = libfoo.la + # endif + # if COND2 + # lib_LTLIBRARIES = libfoo.la + # endif + # + # Actually this will also allow + # lib_LTLIBRARIES = libfoo.la libfoo.la + # Diagnosing this case doesn't seem worth the plain (we'd + # have to fill $instdirs on a per-condition basis, check + # implied conditions, etc.) + if (defined $instdirs{$_} && $instdirs{$_} ne $dir) + { + err_am ("`$_' is already going to be installed in " + . "`$instdirs{$_}'"); + } + else + { + $instdirs{$_} = $dir; + } + } + } + + foreach my $onelib (@liblist) + { + my $seen_libobjs = 0; + my $obj = &get_object_extension ($onelib); + + # Canonicalize names and check for misspellings. + my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS', + '_SOURCES', '_OBJECTS', + '_DEPENDENCIES'); + + if (! variable_defined ($xlib . '_LDFLAGS')) + { + # Define the lib_LDFLAGS variable. + &define_variable ($xlib . '_LDFLAGS', ''); + } + + # Check that the library fits the standard naming convention. + my $libname_rx = "^lib.*\.la"; + if ((variable_defined ($xlib . '_LDFLAGS') + && grep (/-module/, + &variable_value_as_list_recursive ($xlib . '_LDFLAGS', + 'all'))) + || (variable_defined ('LDFLAGS') + && grep (/-module/, + &variable_value_as_list_recursive ('LDFLAGS', 'all')))) + { + # Relax name checking for libtool modules. + $libname_rx = "\.la"; + } + if (basename ($onelib) !~ /$libname_rx$/) + { + # FIXME should put line number here. That means mapping + # from library name back to variable name. + msg_am ('error-gnu/warn', + "`$onelib' is not a standard libtool library name"); + } + + if (variable_defined ($xlib . '_LIBADD')) + { + if (&handle_lib_objects ($xlib, $xlib . '_LIBADD')) + { + $seen_libobjs = 1; + } + } + else + { + # Generate support for conditional object inclusion in + # libraries. + &define_variable ($xlib . "_LIBADD", ''); + } + + reject_var ("${xlib}_LDADD", + "use `${xlib}_LIBADD', not `${xlib}_LDADD'"); + + # Make sure we at look at this. + &examine_variable ($xlib . '_DEPENDENCIES'); + + my $linker = &handle_source_transform ($xlib, $onelib, $obj); + + # Determine program to use for link. + my $xlink; + if (variable_defined ($xlib . '_LINK')) + { + $xlink = $xlib . '_LINK'; + } + else + { + $xlink = $linker ? $linker : 'LINK'; + } + + my $rpath; + if ($instdirs{$onelib} eq 'EXTRA' + || $instdirs{$onelib} eq 'noinst' + || $instdirs{$onelib} 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. + $rpath = ''; + } + else + { + $rpath = ('-rpath $(' . $instdirs{$onelib} . 'dir)'); + } + + # 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', + ('LTLIBRARY' => $onelib, + 'XLTLIBRARY' => $xlib, + 'RPATH' => $rpath, + 'XLINK' => $xlink, + 'DIRSTAMP' => $dirstamp)); + if ($seen_libobjs) + { + if (variable_defined ($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. + &examine_variable ('AM_LDFLAGS'); + + foreach my $varname (keys %var_value) + { + foreach my $primary ('_SOURCES', '_LIBADD', '_LDADD', '_LDFLAGS', + '_DEPENDENCIES') + { + msg_var 'syntax', $varname, "unused variable: `$varname'" + # Note that a configure variable is always legitimate. + if ($varname =~ /$primary$/ && ! $content_seen{$varname} + && ! exists $configure_vars{$varname}); + } + } +} + + +# Handle scripts. +sub handle_scripts +{ + # NOTE we no longer automatically clean SCRIPTS, because it is + # useful to sometimes distribute scripts verbatim. This happens + # eg in Automake itself. + &am_install_var ('-candist', 'scripts', 'SCRIPTS', + 'bin', 'sbin', 'libexec', 'pkgdata', + 'noinst', 'check'); +} + + +# ($OUTFILE, $VFILE, @CLEAN_FILES) +# &scan_texinfo_file ($FILENAME) +# ------------------------------ +# $OUTFILE is the name of the info file produced by $FILENAME. +# $VFILE is the name of the version.texi file used (empty if none). +# @CLEAN_FILES is the list of by products (indexes etc.) +sub scan_texinfo_file +{ + my ($filename) = @_; + + # These are always created, no matter whether indexes are used or not. + # (Actually tmp is only created if an @macro is used and a certain e-TeX + # feature is not available.) + my @clean_suffixes = qw(aux log toc tmp + cp fn ky vr tp pg); # grep new.*index texinfo.tex + + # There are predefined indexes which don't follow the regular rules. + my %predefined_index = qw(c cps + f fns + k kys + v vrs + t tps + p pgs); + + # There are commands which include a hidden index command. + my %hidden_index = (tp => 'tps'); + $hidden_index{$_} = 'fns' foreach qw(fn un typefn typefun max spec + op typeop method typemethod); + $hidden_index{$_} = 'vrs' foreach qw(vr var typevr typevar opt cv + ivar typeivar); + + # Indexes stored into another one. In this case, the *.??s file + # is not created. + my @syncodeindexes = (); + + my $texi = new Automake::XFile "< $filename"; + verb "reading $filename"; + + my ($outfile, $vfile); + while ($_ = $texi->getline) + { + if (/^\@setfilename +(\S+)/) + { + $outfile = $1; + if ($outfile =~ /\.(.+)$/ && $1 ne 'info') + { + err "$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 what are the indexes which are used. + + # Creating a new category of index. + elsif (/^\@def(code)?index (\w+)/) + { + push @clean_suffixes, $2; + } + + # Storing in a predefined index. + elsif (/^\@([cfkvtp])index /) + { + push @clean_suffixes, $predefined_index{$1}; + } + elsif (/^\@def(\w+) /) + { + push @clean_suffixes, $hidden_index{$1} + if defined $hidden_index{$1}; + } + + # Merging an index into an another. + elsif (/^\@syn(code)?index (\w+) (\w+)/) + { + push @syncodeindexes, "$2s"; + push @clean_suffixes, "$3s"; + } + + } + + if ($outfile eq '') + { + err_am "`$filename' missing \@setfilename"; + return; + } + + my $infobase = basename ($filename); + $infobase =~ s/\.te?xi(nfo)?$//; + my %clean_files = map { +"$infobase.$_" => 1 } @clean_suffixes; + grep { delete $clean_files{"$infobase.$_"} } @syncodeindexes; + return ($outfile, $vfile, (sort keys %clean_files)); +} + +# ($DIRSTAMP, @CLEAN_FILES) +# output_texinfo_build_rules ($SOURCE, $DEST, @DEPENDENCIES) +# ---------------------------------------------------------- +# SOURCE - the source Texinfo file +# DEST - the destination Info file +# DEPENDENCIES - known dependencies +sub output_texinfo_build_rules ($$@) +{ + my ($source, $dest, @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 appropritate when + # $source and $dest lie in the current directory; the "specifix" + # rules is 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"; + } + + # If the resulting file lie into a subdirectory, + # make sure this directory will exist. + my $dirstamp = require_build_directory_maybe ($dest); + + $output_rules .= &file_contents ('texibuild', + GENERIC => $generic, + SOURCE_SUFFIX => $ssfx, + SOURCE => ($generic ? '$<' : $source), + SOURCE_REAL => $source, + DEST_PREFIX => $dpfx, + DEST_SUFFIX => $dsfx, + MAKEINFOFLAGS => $makeinfoflags, + DEPS => "@deps", + DIRSTAMP => $dirstamp); + return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps"); +} + + +# ($DO-SOMETHING, $TEXICLEANS) +# handle_texinfo_helper () +# ------------------------ +# Handle all Texinfo source; helper for handle_texinfo +sub handle_texinfo_helper +{ + reject_var 'TEXINFOS', "`TEXINFOS' is an anachronism; use `info_TEXINFOS'"; + reject_var 'html_TEXINFOS', "HTML generation not yet supported"; + + return (0, '') if ! variable_defined ('info_TEXINFOS'); + + my @texis = &variable_value_as_list_recursive ('info_TEXINFOS', 'all'); + + my (@info_deps_list, @dvis_list, @pdfs_list, @pss_list, @texi_deps); + my %versions; + my $done = 0; + my @texi_cleans; + my $canonical; + + foreach my $info_cursor (@texis) + { + my $infobase = $info_cursor; + $infobase =~ s/\.(txi|texinfo|texi)$//; + + if ($infobase eq $info_cursor) + { + # FIXME: report line number. + err_am "texinfo file `$info_cursor' has unrecognized extension"; + next; + } + + # If 'version.texi' is referenced by input file, then include + # automatic versioning capability. + my ($out_file, $vtexi, @clean_files) = + &scan_texinfo_file ("$relative_dir/$info_cursor") + 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 ($info_cursor) . '/'; + $outdir = "" if $outdir eq './'; + $out_file = $outdir . $out_file; + + # If user specified file_TEXINFOS, then use that as explicit + # dependency list. + @texi_deps = (); + push (@texi_deps, "$outdir$vtexi") if $vtexi; + + my $canonical = &canonicalize ($infobase); + if (variable_defined ($canonical . "_TEXINFOS")) + { + push (@texi_deps, '$(' . $canonical . '_TEXINFOS)'); + &push_dist_common ('$(' . $canonical . '_TEXINFOS)'); + } + + my ($dirstamp, @cfiles) = + output_texinfo_build_rules ($info_cursor, $out_file, @texi_deps); + push (@texi_cleans, @cfiles); + + push (@info_deps_list, $out_file); + push (@dvis_list, $infobase . '.dvi'); + push (@pdfs_list, $infobase . '.pdf'); + push (@pss_list, $infobase . '.ps'); + + # If a vers*.texi file is needed, emit the rule. + if ($vtexi) + { + err_am ("`$vtexi', included in `$info_cursor', " + . "also included in `$versions{$vtexi}'") + if defined $versions{$vtexi}; + $versions{$vtexi} = $info_cursor; + + # 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_in) + { + 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_in) + { + $conf_dir = $config_aux_dir; + $conf_dir .= '/' unless $conf_dir =~ /\/$/; + } + else + { + $conf_dir = '$(srcdir)/'; + } + $output_rules .= &file_contents ('texi-vers', + TEXI => $info_cursor, + VTI => $vti, + STAMPVTI => "${outdir}stamp-$vti", + VTEXI => "$outdir$vtexi", + MDDIR => $conf_dir, + DIRSTAMP => $dirstamp); + } + } + + # Handle location of texinfo.tex. + my $need_texi_file = 0; + my $texinfodir; + if ($cygnus_mode) + { + $texinfodir = '$(top_srcdir)/../texinfo'; + &define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex"); + } + elsif ($config_aux_dir_set_in_configure_in) + { + $texinfodir = $config_aux_dir; + &define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex"); + $need_texi_file = 2; # so that we require_conf_file later + } + elsif (variable_defined ('TEXINFO_TEX')) + { + # The user defined TEXINFO_TEX so assume he knows what he is + # doing. + $texinfodir = ('$(srcdir)/' + . dirname (&variable_value ('TEXINFO_TEX'))); + } + else + { + $texinfodir = '$(srcdir)'; + $need_texi_file = 1; + } + &define_variable ('am__TEXINFO_TEX_DIR', $texinfodir); + + # The return value. + my $texiclean = &pretty_print_internal ("", "\t ", @texi_cleans); + + push (@dist_targets, 'dist-info'); + + if (! defined $options{'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_variable ("INFO_DEPS", "@info_deps_list"); + &define_variable ("DVIS", "@dvis_list"); + &define_variable ("PDFS", "@pdfs_list"); + &define_variable ("PSS", "@pss_list"); + # 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')); + + # 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 && ! defined $options{'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 (1, $texiclean); +} + +# handle_texinfo () +# ----------------- +# Handle all Texinfo source. +sub handle_texinfo +{ + my ($do_something, $texiclean) = handle_texinfo_helper (); + $output_rules .= &file_contents ('texinfos', + ('TEXICLEAN' => $texiclean, + 'LOCAL-TEXIS' => $do_something)); +} + +# 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') + { + if (variable_defined ($pfx . 'man' . $section . '_MANS')) + { + $sections{$section} = 1; + $vlist{'$(' . $pfx . 'man' . $section . '_MANS)'} = 1; + + &push_dist_common ('$(' . $pfx . 'man' . $section . '_MANS)') + if $pfx eq 'dist_'; + } + } + + if (variable_defined ($pfx . 'man_MANS')) + { + $vlist{'$(' . $pfx . 'man_MANS)'} = 1; + foreach (&variable_value_as_list_recursive ($pfx . 'man_MANS', 'all')) + { + # A page like `foo.1c' goes into man1dir. + if (/\.([0-9a-z])([a-z]*)$/) + { + $sections{$1} = 1; + } + } + + &push_dist_common ('$(' . $pfx . 'man_MANS)') + if $pfx eq 'dist_'; + } + } + + return unless %sections; + + # Now for each section, generate an install and unintall rule. + # Sort sections so output is deterministic. + foreach my $section (sort keys %sections) + { + $output_rules .= &file_contents ('mans', ('SECTION' => $section)); + } + + my @mans = sort keys %vlist; + $output_vars .= file_contents ('mans-vars', + ('MANS' => "@mans")); + + if (! defined $options{'no-installman'}) + { + push (@all, '$(MANS)'); + } +} + +# Handle DATA variables. +sub handle_data +{ + &am_install_var ('-noextra', '-candist', 'data', 'DATA', + 'data', 'sysconf', 'sharedstate', 'localstate', + 'pkgdata', 'noinst', 'check'); +} + +# Handle TAGS. +sub handle_tags +{ + my @tag_deps = (); + my @ctag_deps = (); + if (variable_defined ('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) + || variable_defined ('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', + ('CONFIG' => "@config", + 'TAGSDIRS' => "@tag_deps", + 'CTAGSDIRS' => "@ctag_deps")); + &examine_variable ('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'); + } +} + + +# $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 ($MAKEFILE) +# ----------------------- +# Handle 'dist' target. +sub handle_dist +{ + my ($makefile) = @_; + + # `make dist' isn't used in a Cygnus-style tree. + # Omit the rules so that people don't try to use them. + return if $cygnus_mode; + + # 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; + my $auxdir = ''; + if ($relative_dir eq '.' + && $config_aux_dir_set_in_configure_in) + { + ($auxdir = $config_aux_dir) =~ s,^\$\(top_srcdir\)/,,; + if (! &is_make_dir ($auxdir)) + { + $check_aux = 1; + } + } + foreach my $cfile (@common_files) + { + if (-f ($relative_dir . "/" . $cfile) + # The file might be absent, but if it can be built it's ok. + || exists $targets{$cfile}) + { + &push_dist_common ($cfile); + } + + # Don't use `elsif' here because a file might meaningfully + # appear in both directories. + if ($check_aux && -f ($auxdir . '/' . $cfile)) + { + &push_dist_common ($auxdir . '/' . $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 &variable_value_as_list_recursive + # as it recursively expands `$(dist_pkgdata_DATA)' etc. + check_variable_defined_unconditionally ('DIST_COMMON'); + my @dist_common = split (' ', variable_value ('DIST_COMMON', 'TRUE')); + @dist_common = uniq (sort for_dist_common (@dist_common)); + pretty_print ('DIST_COMMON = ', "\t", @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. + if (variable_defined ('EXTRA_DIST')) + { + # FIXME: This should be fixed to work with conditionals. 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 (&variable_value_as_list_recursive ('EXTRA_DIST', '')) + { + next if /^\@.*\@$/; + 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 (&variable_value_as_list_recursive ('DIST_COMMON', 'all')) + { + next if /^\@.*\@$/; + s/\$\(top_srcdir\)/$topsrcdir/; + s/\$\(srcdir\)/./; + next unless s,/+[^/]+$,,; + $dist_dirs{$_} = 1 + unless $_ eq '.'; + } + + # Rule to check whether a distribution is viable. + my %transform = ('DISTCHECK-HOOK' => &target_defined ('distcheck-hook'), + 'GETTEXT' => $seen_gettext); + + # Prepend $(distdir) to each directory given. + my %rewritten = map { '$(distdir)/' . "$_" => 1 } keys %dist_dirs; + $transform{'DISTDIRS'} = join (' ', sort keys %rewritten); + + # If we have SUBDIRS, create all dist subdirectories and do + # recursive build. + if (variable_defined ('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. + my $dist_subdir_name; + # Note that we check DIST_SUBDIRS first on purpose. At least + # one project uses so many conditional subdirectories that + # calling variable_conditionally_defined on SUBDIRS will cause + # automake to grow to 150Mb. Sigh. + if (variable_defined ('DIST_SUBDIRS') + || variable_conditionally_defined ('SUBDIRS')) + { + $dist_subdir_name = 'DIST_SUBDIRS'; + if (! variable_defined ('DIST_SUBDIRS')) + { + define_pretty_variable + ('DIST_SUBDIRS', '', + uniq (&variable_value_as_list_recursive ('SUBDIRS', 'all'))); + } + } + else + { + $dist_subdir_name = 'SUBDIRS'; + # We always define this because that is what `distclean' + # wants. + define_pretty_variable ('DIST_SUBDIRS', '', '$(SUBDIRS)'); + } + + $transform{'DIST_SUBDIR_NAME'} = $dist_subdir_name; + } + + # 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 &target_defined ('dist-hook'); + $transform{'DIST-TARGETS'} = join(' ', @dist_targets); + + # Defining $(DISTDIR). + $transform{'DISTDIR'} = !variable_defined('distdir'); + $transform{'TOP_DISTDIR'} = backname ($relative_dir); + + $output_rules .= &file_contents ('distdir', %transform); +} + + +# Handle subdirectories. +sub handle_subdirs +{ + return + unless variable_defined ('SUBDIRS'); + + my @subdirs = &variable_value_as_list_recursive ('SUBDIRS', 'all'); + my @dsubdirs = (); + @dsubdirs = &variable_value_as_list_recursive ('DIST_SUBDIRS', 'all') + if variable_defined ('DIST_SUBDIRS'); + + # 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_var ('portability', 'SUBDIRS', + "naming a subdirectory `obj' causes troubles with BSD make") + if grep ($_ eq 'obj', @subdirs); + msg_var ('portability', 'DIST_SUBDIRS', + "naming a subdirectory `obj' causes troubles with BSD make") + if grep ($_ eq 'obj', @dsubdirs); + + # Make sure each directory mentioned in SUBDIRS actually exists. + foreach my $dir (@subdirs) + { + # Skip directories substituted by configure. + next if $dir =~ /^\@.*\@$/; + + if (! -d $am_relative_dir . '/' . $dir) + { + err_var ('SUBDIRS', "required directory $am_relative_dir/$dir " + . "does not exist"); + next; + } + + err_var 'SUBDIRS', "directory should not contain `/'" + if $dir =~ /\//; + } + + $output_rules .= &file_contents ('subdirs'); + variable_pretty_output ('RECURSIVE_TARGETS', 'TRUE'); +} + + +# ($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; + + return (0, ()) + unless $relative_dir eq '.'; + + &examine_variable ('CONFIG_STATUS_DEPENDENCIES'); + &examine_variable ('CONFIGURE_DEPENDENCIES'); + + if (-f 'aclocal.m4') + { + &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4'); + &push_dist_common ('aclocal.m4'); + + my $aclocal = new Automake::XFile "< aclocal.m4"; + my $line = $aclocal->getline; + $regen_aclocal = $line =~ 'generated automatically by aclocal'; + } + + my @ac_deps = (); + + if (-f 'acinclude.m4') + { + $regen_aclocal = 1; + push @ac_deps, 'acinclude.m4'; + } + + if (variable_defined ('ACLOCAL_M4_SOURCES')) + { + push (@ac_deps, '$(ACLOCAL_M4_SOURCES)'); + } + elsif (variable_defined ('ACLOCAL_AMFLAGS')) + { + # Scan all -I directories for m4 files. These are our + # dependencies. + my $examine_next = 0; + foreach my $amdir (&variable_value_as_list_recursive ('ACLOCAL_AMFLAGS', '')) + { + if ($examine_next) + { + $examine_next = 0; + if ($amdir !~ /^\// && -d $amdir) + { + foreach my $ac_dep (&my_glob ($amdir . '/*.m4')) + { + $ac_dep =~ s/^\.\/+//; + push (@ac_deps, $ac_dep) + unless $ac_dep eq "aclocal.m4" + || $ac_dep eq "acinclude.m4"; + } + } + } + elsif ($amdir eq '-I') + { + $examine_next = 1; + } + } + } + + # 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); +} + + +# @DEPENDENCY +# &rewrite_inputs_into_dependencies ($ADD_SRCDIR, @INPUTS) +# -------------------------------------------------------- +# Rewrite a list of input files into a form suitable to put on a +# dependency list. The idea is that if an input file has a directory +# part the same as the current directory, then the directory part is +# simply removed. But if the directory part is different, then +# $(top_srcdir) is prepended. Among other things, this is used to +# generate the dependency list for the output files generated by +# AC_OUTPUT. Consider what the dependencies should look like in this +# case: +# AC_OUTPUT(src/out:src/in1:lib/in2) +# The first argument, ADD_SRCDIR, is 1 if $(top_srcdir) should be added. +# If 0 then files that require this addition will simply be ignored. +sub rewrite_inputs_into_dependencies ($@) +{ + my ($add_srcdir, @inputs) = @_; + my @newinputs; + + foreach my $single (@inputs) + { + if (dirname ($single) eq $relative_dir) + { + push (@newinputs, basename ($single)); + } + elsif ($add_srcdir) + { + push (@newinputs, '$(top_srcdir)/' . $single); + } + } + + return @newinputs; +} + +# Handle remaking and configure stuff. +# We need the name of the input file, to do proper remaking rules. +sub handle_configure +{ + my ($local, $input, @secondary_inputs) = @_; + + my $input_base = basename ($input); + my $local_base = basename ($local); + + my $amfile = $input_base . '.am'; + # We know we can always add '.in' because it really should be an + # error if the .in was missing originally. + my $infile = '$(srcdir)/' . $input_base . '.in'; + my $colon_infile = ''; + if ($local ne $input || @secondary_inputs) + { + $colon_infile = ':' . $input . '.in'; + } + $colon_infile .= ':' . join (':', @secondary_inputs) + if @secondary_inputs; + + my @rewritten = rewrite_inputs_into_dependencies (1, @secondary_inputs); + + my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4 (); + + $output_rules .= + &file_contents ('configure', + ('MAKEFILE' + => $local_base, + 'MAKEFILE-DEPS' + => "@rewritten", + 'CONFIG-MAKEFILE' + => ((($relative_dir eq '.') ? '$@' : '$(subdir)/$@') + . $colon_infile), + 'MAKEFILE-IN' + => $infile, + 'MAKEFILE-IN-DEPS' + => "@include_stack", + 'MAKEFILE-AM' + => $amfile, + 'STRICTNESS' + => $cygnus_mode ? 'cygnus' : $strictness_name, + 'USE-DEPS' + => $cmdline_use_dependencies ? '' : ' --ignore-deps', + 'MAKEFILE-AM-SOURCES' + => "$input$colon_infile", + 'REGEN-ACLOCAL-M4' + => $regen_aclocal_m4, + 'ACLOCAL_M4_DEPS' + => "@aclocal_m4_deps")); + + 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 . '/'; + } + } + + # Compute relative path from directory holding output + # header to directory holding input header. FIXME: + # doesn't handle case where we have multiple inputs. + my $in0_sans_dir; + if (dirname ($ins[0]) eq $relative_dir) + { + $in0_sans_dir = basename ($ins[0]); + } + else + { + $in0_sans_dir = backname ($relative_dir) . '/' . $ins[0]; + } + + require_file ($config_header_location, FOREIGN, $in0_sans_dir); + + # 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', + ('FILES' => "@files", + 'CONFIG_H' => $cn_sans_dir, + 'CONFIG_HIN' => $in0_sans_dir, + 'CONFIG_H_PATH' => $config_h_path, + 'STAMP' => "$stamp")); + + push @distclean_config, $cn_sans_dir, $stamp; + } + } + + $output_rules .= file_contents ('clean-hdr', + ('FILES' => "@distclean_config")) + if @distclean_config; + + # Set location of mkinstalldirs. + define_variable ('mkinstalldirs', + ('$(SHELL) ' . $config_aux_dir . '/mkinstalldirs')); + + 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") + 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" + 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 (1, @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); + + # Require all input files. + require_file ($ac_config_files_location, FOREIGN, + rewrite_inputs_into_dependencies (0, @inputs)); + } + + # These files get removed by "make clean". + define_pretty_variable ('CONFIG_CLEAN_FILES', '', @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 /\..*$/; + &saw_extension ($&); + } +} + +sub handle_gettext +{ + return if ! $seen_gettext || $relative_dir ne '.'; + + if (! variable_defined ('SUBDIRS')) + { + err_ac "AM_GNU_GETTEXT used but SUBDIRS not defined"; + return; + } + + my @subdirs = &variable_value_as_list_recursive ('SUBDIRS', 'all'); + err_var '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. + err_var 'SUBDIRS', "AM_GNU_GETTEXT used but `intl' not in SUBDIRS" + 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_target ('.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"; + if (@suffixes || variable_defined ('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 = (variable_defined ('SUFFIXES') + ? &variable_value_as_list_recursive ('SUFFIXES', '') + : ()); + + my %suffixes = map { $_ => 1 } @suffixes; + delete @suffixes{@user_suffixes}; + + $output_header .= (".SUFFIXES: " + . join (' ', @user_suffixes, sort keys %suffixes) + . "\n"); + } + + $output_trailer .= file_contents ('footer'); +} + +# Deal with installdirs target. +sub handle_installdirs () +{ + $output_rules .= + &file_contents ('install', + ('am__installdirs' + => variable_value ('am__installdirs') || '', + 'installdirs-local' + => (target_defined ('installdirs-local') + ? ' installdirs-local' : ''))); +} + + +# 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. + if (&target_defined ("all-local")) + { + push (@all, "all-local"); + &depend ('.PHONY', "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 variable_defined ('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) ' + . (variable_defined ('SUBDIRS') + ? 'all-recursive' : 'all-am') + . "\n\n"); + } + else + { + $output_all .= "all: " . (variable_defined ('SUBDIRS') + ? 'all-recursive' : 'all-am') . "\n\n"; + } +} + + +# Handle check merge target specially. +sub do_check_merge_target +{ + if (&target_defined ('check-local')) + { + # User defined local form of target. So include it. + push (@check_tests, 'check-local'); + &depend ('.PHONY', 'check-local'); + } + + # In --cygnus mode, check doesn't depend on all. + if ($cygnus_mode) + { + # 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'); + $output_rules .= ("check: " + . (variable_defined ('SUBDIRS') + ? 'check-recursive' : 'check-am') + . "\n"); +} + +# Handle all 'clean' targets. +sub handle_clean +{ + # Clean the files listed in user variables if they exist. + $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN + if variable_defined ('MOSTLYCLEANFILES'); + $clean_files{'$(CLEANFILES)'} = CLEAN + if variable_defined ('CLEANFILES'); + $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN + if variable_defined ('DISTCLEANFILES'); + $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN + if variable_defined ('MAINTAINERCLEANFILES'); + + # Built sources are automatically removed by maintainer-clean. + $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN + if variable_defined ('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', + MOSTLYCLEAN_RMS => join ('', @{$rms{&MOSTLY_CLEAN}}), + CLEAN_RMS => join ('', @{$rms{&CLEAN}}), + DISTCLEAN_RMS => join ('', @{$rms{&DIST_CLEAN}}), + MAINTAINER_CLEAN_RMS => join ('', @{$rms{&MAINTAINER_CLEAN}})); +} + + +# &depend ($CATEGORY, @DEPENDENDEES) +# ---------------------------------- +# The target $CATEGORY depends on @DEPENDENDEES. +sub depend +{ + my ($category, @dependendees) = @_; + { + push (@{$dependencies{$category}}, @dependendees); + } +} + + +# &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_target ($utarg, "use `$x', not `$utarg'"); + } + + reject_target ('install-local', + "use `install-data-local' or `install-exec-local', " + . "not `install-local'"); + + reject_target ('install-info-local', + "`install-info-local' target defined but " + . "`no-installinfo' option not in use") + unless defined $options{'no-installinfo'}; + + # Install the -local hooks. + foreach (keys %dependencies) + { + # Hooks are installed on the -am targets. + s/-am$// or next; + if (&target_defined ("$_-local")) + { + depend ("$_-am", "$_-local"); + &depend ('.PHONY', "$_-local"); + } + } + + # Install the -hook hooks. + # FIXME: Why not be as liberal as we are with -local hooks? + foreach ('install-exec', 'install-data', 'uninstall') + { + if (&target_defined ("$_-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{$_}); + &pretty_print_rule ("$_:", "\t", + uniq (sort @{$dependencies{$_}})); + $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'); +} + + +# Handle TESTS variable and other checks. +sub handle_tests +{ + if (defined $options{'dejagnu'}) + { + &handle_tests_dejagnu; + } + else + { + foreach my $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS') + { + reject_var ($c, "`$c' defined but `dejagnu' not in " + . "`AUTOMAKE_OPTIONS'"); + } + } + + if (variable_defined ('TESTS')) + { + push (@check_tests, 'check-TESTS'); + $output_rules .= &file_contents ('check'); + } +} + +# Handle Emacs Lisp. +sub handle_emacs_lisp +{ + my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP', + 'lisp', 'noinst'); + + return if ! @elfiles; + + # Generate .elc files. + my @elcfiles = map { $_ . 'c' } @elfiles; + define_pretty_variable ('ELCFILES', '', @elcfiles); + + push (@all, '$(ELCFILES)'); + + require_variables ("$am_file.am", "Emacs Lisp sources seen", 'TRUE', + 'EMACS', 'lispdir'); + require_conf_file ("$am_file.am", FOREIGN, 'elisp-comp'); + &define_variable ('elisp_comp', $config_aux_dir . '/elisp-comp'); +} + +# Handle Python +sub handle_python +{ + my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON', + 'noinst'); + return if ! @pyfiles; + + require_variables ("$am_file.am", "Python sources seen", 'TRUE', + 'PYTHON'); + require_conf_file ("$am_file.am", FOREIGN, 'py-compile'); + &define_variable ('py_compile', $config_aux_dir . '/py-compile'); +} + +# 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 (defined $options{'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. + require_file_with_macro ('TRUE', 'AUTOMAKE_OPTIONS', + FOREIGN, '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); +} + + +my %make_list; + +# &scan_autoconf_config_files ($CONFIG-FILES) +# ------------------------------------------- +# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES +# (or AC_OUTPUT). +sub scan_autoconf_config_files +{ + my ($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. Note that we ignore + # every input file past the first, though we keep + # those around for later. + my ($local, $input, @rest) = split (/:/); + if (! $input) + { + $input = $local; + } + else + { + # FIXME: should be error if .in is missing. + $input =~ s/\.in$//; + } + + if (-f $input . '.am') + { + # 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, $_); + } + } +} + + +# &scan_autoconf_traces ($FILENAME) +# --------------------------------- +sub scan_autoconf_traces ($) +{ + my ($filename) = @_; + + my @traced = qw(AC_CANONICAL_HOST + AC_CANONICAL_SYSTEM + AC_CONFIG_AUX_DIR + AC_CONFIG_FILES + AC_CONFIG_HEADERS + AC_INIT + AC_LIBSOURCE + AC_SUBST + AM_AUTOMAKE_VERSION + AM_CONDITIONAL + AM_GNU_GETTEXT + AM_INIT_AUTOMAKE + AM_MAINTAINER_MODE + AM_PROG_CC_C_O); + + my $traces = ($ENV{AUTOCONF} || 'autoconf') . " "; + + # 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::\${::}%' } @traced); + + my $tracefh = new Automake::XFile ("$traces $filename |"); + verb "reading $traces"; + + while ($_ = $tracefh->getline) + { + chomp; + my ($here, @args) = split /::/; + my $macro = $args[0]; + + # Alphabetical ordering please. + if ($macro eq 'AC_CANONICAL_HOST') + { + if (! $seen_canonical) + { + $seen_canonical = AC_CANONICAL_HOST; + $canonical_location = $here; + }; + } + elsif ($macro eq 'AC_CANONICAL_SYSTEM') + { + $seen_canonical = AC_CANONICAL_SYSTEM; + $canonical_location = $here; + } + elsif ($macro eq 'AC_CONFIG_AUX_DIR') + { + @config_aux_path = $args[1]; + $config_aux_dir_set_in_configure_in = 1; + } + elsif ($macro eq 'AC_CONFIG_FILES') + { + # Look at potential Makefile.am's. + $ac_config_files_location = $here; + &scan_autoconf_config_files ($args[1]); + } + elsif ($macro eq 'AC_CONFIG_HEADERS') + { + $config_header_location = $here; + push @config_headers, split (' ', $args[1]); + } + elsif ($macro eq 'AC_INIT') + { + if (defined $args[2]) + { + $package_version = $args[2]; + $package_version_location = $here; + } + } + 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]} = $here + if $args[1] =~ /^\w+$/; + } + elsif ($macro eq 'AM_AUTOMAKE_VERSION') + { + err ($here, + "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") + if ($VERSION ne $args[1]); + + $seen_automake_version = 1; + } + elsif ($macro eq 'AM_CONDITIONAL') + { + $configure_cond{$args[1]} = $here; + } + elsif ($macro eq 'AM_GNU_GETTEXT') + { + $seen_gettext = $here; + $ac_gettext_location = $here; + $seen_gettext_external = grep ($_ eq 'external', @args); + } + elsif ($macro eq 'AM_INIT_AUTOMAKE') + { + $seen_init_automake = $here; + if (defined $args[2]) + { + $package_version = $args[2]; + $package_version_location = $here; + } + elsif (defined $args[1]) + { + $global_options = $args[1]; + } + } + elsif ($macro eq 'AM_MAINTAINER_MODE') + { + $seen_maint_mode = $here; + } + elsif ($macro eq 'AM_PROG_CC_C_O') + { + $seen_cc_c_o = $here; + } + } +} + + +# &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 = (); + + $configure_ac = find_configure_ac; + fatal "`configure.ac' or `configure.in' is required\n" + if !$configure_ac; + + scan_autoconf_traces ($configure_ac); + + # Set input and output files if not specified by user. + if (! @input_files) + { + @input_files = sort keys %make_list; + %output_files = %make_list; + } + + @configure_input_files = sort keys %make_list; + + err_ac "`AM_INIT_AUTOMAKE' must be used" + if ! $seen_init_automake; + + if (! $seen_automake_version) + { + if (-f 'aclocal.m4') + { + err ($seen_init_automake || $me, + "your implementation of AM_INIT_AUTOMAKE comes from " . + "an\nold Automake version. You should recreate " . + "aclocal.m4\nwith aclocal and run automake again.\n"); + } + else + { + err ($seen_init_automake || $me, + "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"); + } + } + + # 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 so that + # the file-finding machinery works. + # FIXME: Is this broken because it needs dynamic scopes. + # My tests seems to show it's not the case. + $relative_dir = '.'; + require_conf_file ($configure_ac, FOREIGN, + 'install-sh', 'mkinstalldirs', 'missing'); + err_am "`install.sh' is an anachronism; use `install-sh' instead" + if -f $config_aux_path[0] . '/install.sh'; + + # Preserve dist_common for later. + $configure_dist_common = variable_value ('DIST_COMMON', 'TRUE') || ''; +} + +################################################################ + +# Set up for Cygnus mode. +sub check_cygnus +{ + return unless $cygnus_mode; + + &set_strictness ('foreign'); + $options{'no-installinfo'} = 1; + $options{'no-dependencies'} = 1; + $use_dependencies = 0; + + 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. + + # Accept one of these three licenses; default to COPYING. + my $license = 'COPYING'; + foreach (qw /COPYING.LIB COPYING.LESSER/) + { + $license = $_ if -f $_; + } + require_file ("$am_file.am", GNU, $license, + qw/INSTALL NEWS README AUTHORS ChangeLog/); + } + + for my $opt ('no-installman', 'no-installinfo') + { + msg_var ('error-gnu', 'AUTOMAKE_OPTIONS', + "option `$opt' disallowed by GNU standards") + if (defined $options{$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_list. 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 defined $options{'subdir-objects'} ? LANG_SUBDIR : LANG_PROCESS; +} + +# Rewrite a single C source file. +sub lang_c_rewrite +{ + my ($directory, $base, $ext) = @_; + + if (defined $options{'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 (defined $options{'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 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} = (($relative_dir eq '.' || $relative_dir eq '') + ? '' + : "$relative_dir/"); + } + } + + if (defined $options{'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) > ' . $base . "_.c" + # If ansi2knr fails then we shouldn't + # create the _.c file + . " || rm -f ${base}_.c\n"); + push (@objects, $base . '_.$(OBJEXT)'); + push (@objects, $base . '_.lo') + if variable_defined ('LIBTOOL'); + } + + # 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) = @_; + + my $flag = $aggregate . "_YFLAGS"; + if ((variable_defined ($flag) + && &variable_value ($flag) =~ /$DASH_D_PATTERN/o) + || (variable_defined ('YFLAGS') + && &variable_value ('YFLAGS') =~ /$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. + # FIXME: this fails for `nodist_*_SOURCES'. + $output_rules .= ("${header}: $output\n" + # Recover from removal of $header + . "\t\@if test ! -f \$@; then \\\n" + . "\t rm -f $output; \\\n" + . "\t \$(MAKE) $output; \\\n" + . "\telse :; fi\n"); + &push_dist_common ($header); + # 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'); + if ($config_aux_dir_set_in_configure_in) + { + &define_variable ('YLWRAP', $config_aux_dir . "/ylwrap"); + } + else + { + &define_variable ('YLWRAP', '$(top_srcdir)/ylwrap'); + } +} + +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 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. + grep ($extension_map{$_} = $lang->name, @{$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)) + { + ®ister_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, eg `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. HEAD is what should be printed at the +# beginning of the first line, FILL is what should be printed at the +# beginning of every subsequent line. +sub pretty_print_internal +{ + my ($head, $fill, @values) = @_; + + my $column = length ($head); + my $result = $head; + + # Fill length is number of characters. However, each Tab + # character counts for eight. So we count the number of Tabs and + # multiply by 7. + my $fill_length = length ($fill); + $fill_length += 7 * ($fill =~ tr/\t/\t/d); + + foreach (@values) + { + # "71" because we also print a space. + if ($column + length ($_) > 71) + { + $result .= " \\\n" . $fill; + $column = $fill_length; + } + $result .= ' ' if $result =~ /\S\z/; + $result .= $_; + $column += length ($_) + 1; + } + + $result .= "\n"; + return $result; +} + +# Pretty-print something and append to output_vars. +sub pretty_print +{ + $output_vars .= &pretty_print_internal (@_); +} + +# Pretty-print something and append to output_rules. +sub pretty_print_rule +{ + $output_rules .= &pretty_print_internal (@_); +} + + +################################################################ + + +# $STRING +# &conditional_string(@COND-STACK) +# -------------------------------- +# Build a string which denotes the conditional in @COND-STACK. Some +# simplifications are done: `TRUE' entries are elided, and any `FALSE' +# entry results in a return of `FALSE'. +sub conditional_string +{ + my (@stack) = @_; + + if (grep (/^FALSE$/, @stack)) + { + return 'FALSE'; + } + else + { + return join (' ', uniq sort grep (!/^TRUE$/, @stack)); + } +} + + +# $BOOLEAN +# &conditional_true_when ($COND, $WHEN) +# ------------------------------------- +# See if a conditional is true. Both arguments are conditional +# strings. This returns true if the first conditional is true when +# the second conditional is true. +# For instance with $COND = `BAR FOO', and $WHEN = `BAR BAZ FOO', +# obviously return 1, and 0 when, for instance, $WHEN = `FOO'. +sub conditional_true_when ($$) +{ + my ($cond, $when) = @_; + + # Make a hash holding all the values from $WHEN. + my %cond_vals = map { $_ => 1 } split (' ', $when); + + # Nothing is true when FALSE (not even FALSE itself, but it + # shouldn't hurt if you decide to change that). + return 0 if exists $cond_vals{'FALSE'}; + + # Check each component of $cond, which looks `COND1 COND2'. + foreach my $comp (split (' ', $cond)) + { + # TRUE is always true. + next if $comp eq 'TRUE'; + return 0 if ! defined $cond_vals{$comp}; + } + + return 1; +} + + +# $BOOLEAN +# &conditional_is_redundant ($COND, @WHENS) +# ---------------------------------------- +# Determine whether $COND is redundant with respect to @WHENS. +# +# Returns true if $COND is true for any of the conditions in @WHENS. +# +# If there are no @WHENS, then behave as if @WHENS contained a single empty +# condition. +sub conditional_is_redundant ($@) +{ + my ($cond, @whens) = @_; + + @whens = ("") if @whens == 0; + + foreach my $when (@whens) + { + return 1 if conditional_true_when ($cond, $when); + } + return 0; +} + + +# $BOOLEAN +# &conditional_implies_any ($COND, @CONDS) +# ---------------------------------------- +# Returns true iff $COND implies any of the conditions in @CONDS. +sub conditional_implies_any ($@) +{ + my ($cond, @conds) = @_; + + @conds = ("") if @conds == 0; + + foreach my $c (@conds) + { + return 1 if conditional_true_when ($c, $cond); + } + return 0; +} + + +# $NEGATION +# condition_negate ($COND) +# ------------------------ +sub condition_negate ($) +{ + my ($cond) = @_; + + $cond =~ s/TRUE$/TRUEO/; + $cond =~ s/FALSE$/TRUE/; + $cond =~ s/TRUEO$/FALSE/; + + return $cond; +} + + +# Compare condition names. +# Issue them in alphabetical order, foo_TRUE before foo_FALSE. +sub by_condition +{ + # Be careful we might be comparing `' or `#'. + $a =~ /^(.*)_(TRUE|FALSE)$/; + my ($aname, $abool) = ($1 || '', $2 || ''); + $b =~ /^(.*)_(TRUE|FALSE)$/; + my ($bname, $bbool) = ($1 || '', $2 || ''); + return ($aname cmp $bname + # Don't bother with IFs, given that TRUE is after FALSE + # just cmp in the reverse order. + || $bbool cmp $abool + # Just in case... + || $a cmp $b); +} + + +# &make_condition (@CONDITIONS) +# ----------------------------- +# Transform a list of conditions (themselves can be an internal list +# of conditions, e.g., @CONDITIONS = ('cond1 cond2', 'cond3')) into a +# Make conditional (a pattern for AC_SUBST). +# Correctly returns the empty string when there are no conditions. +sub make_condition +{ + my $res = conditional_string (@_); + + # There are no conditions. + if ($res eq '') + { + # Nothing to do. + } + # It's impossible. + elsif ($res eq 'FALSE') + { + $res = '#'; + } + # Build it. + else + { + $res = '@' . $res . '@'; + $res =~ s/ /@@/g; + } + + return $res; +} + + + +## ------------------------------ ## +## Handling the condition stack. ## +## ------------------------------ ## + + +# $COND_STRING +# cond_stack_if ($NEGATE, $COND, $WHERE) +# -------------------------------------- +sub cond_stack_if ($$$) +{ + my ($negate, $cond, $where) = @_; + + err $where, "$cond does not appear in AM_CONDITIONAL" + if ! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/; + + $cond = "${cond}_TRUE" + unless $cond =~ /^TRUE|FALSE$/; + $cond = condition_negate ($cond) + if $negate; + + push (@cond_stack, $cond); + + return conditional_string (@cond_stack); +} + + +# $COND_STRING +# cond_stack_else ($NEGATE, $COND, $WHERE) +# ---------------------------------------- +sub cond_stack_else ($$$) +{ + my ($negate, $cond, $where) = @_; + + if (! @cond_stack) + { + err $where, "else without if"; + return; + } + + $cond_stack[$#cond_stack] = condition_negate ($cond_stack[$#cond_stack]); + + # If $COND is given, check against it. + if (defined $cond) + { + $cond = "${cond}_TRUE" + unless $cond =~ /^TRUE|FALSE$/; + $cond = condition_negate ($cond) + if $negate; + + err ($where, "else reminder ($negate$cond) incompatible with " + . "current conditional: $cond_stack[$#cond_stack]") + if $cond_stack[$#cond_stack] ne $cond; + } + + return conditional_string (@cond_stack); +} + + +# $COND_STRING +# cond_stack_endif ($NEGATE, $COND, $WHERE) +# ----------------------------------------- +sub cond_stack_endif ($$$) +{ + my ($negate, $cond, $where) = @_; + my $old_cond; + + if (! @cond_stack) + { + err $where, "endif without if: $negate$cond"; + return; + } + + + # If $COND is given, check against it. + if (defined $cond) + { + $cond = "${cond}_TRUE" + unless $cond =~ /^TRUE|FALSE$/; + $cond = condition_negate ($cond) + if $negate; + + err ($where, "endif reminder ($negate$cond) incompatible with " + . "current conditional: $cond_stack[$#cond_stack]") + if $cond_stack[$#cond_stack] ne $cond; + } + + pop @cond_stack; + + return conditional_string (@cond_stack); +} + + + + + +## ------------------------ ## +## Handling the variables. ## +## ------------------------ ## + + +# check_ambiguous_conditional ($VAR, $COND, $WHERE) +# ------------------------------------------------- +# Check for an ambiguous conditional. This is called when a variable +# is being defined conditionally. If we already know about a +# definition that is true under the same conditions, then we have an +# ambiguity. +sub check_ambiguous_conditional ($$$) +{ + my ($var, $cond, $where) = @_; + my ($message, $ambig_cond) = + conditional_ambiguous_p ($var, $cond, keys %{$var_value{$var}}); + if ($message) + { + msg 'syntax', $where, "$message ..."; + msg_var ('syntax', $var, "... `$var' previously defined here."); + verb (macro_dump ($var)); + } +} + +# $STRING, $AMBIG_COND +# conditional_ambiguous_p ($WHAT, $COND, @CONDS) +# ---------------------------------------------- +# Check for an ambiguous conditional. Return an error message and +# the other condition involved if we have one, two empty strings otherwise. +# WHAT: the thing being defined +# COND: the condition under which is is being defined +# CONDS: the conditons under which is had already been defined +sub conditional_ambiguous_p ($$@) +{ + my ($var, $cond, @conds) = @_; + foreach my $vcond (@conds) + { + # Note that these rules doesn't consider the following + # example as ambiguous. + # + # if COND1 + # FOO = foo + # endif + # if COND2 + # FOO = bar + # endif + # + # It's up to the user to not define COND1 and COND2 + # simultaneously. + my $message; + if ($vcond eq $cond) + { + return ("$var multiply defined in condition $cond", $vcond); + } + elsif (&conditional_true_when ($vcond, $cond)) + { + return ("$var was already defined in condition $vcond, " + . "which implies condition $cond", $vcond); + } + elsif (&conditional_true_when ($cond, $vcond)) + { + return ("$var was already defined in condition $vcond, " + . "which is implied by condition $cond", $vcond); + } + } + return ('', ''); +} + +# @MISSING_CONDS +# variable_not_always_defined_in_cond ($VAR, $COND) +# --------------------------------------------- +# Check whether $VAR is always defined for condition $COND. +# Return a list of conditions where the definition is missing. +# +# For instance, given +# +# if COND1 +# if COND2 +# A = foo +# D = d1 +# else +# A = bar +# D = d2 +# endif +# else +# D = d3 +# endif +# if COND3 +# A = baz +# B = mumble +# endif +# C = mumble +# +# we should have: +# variable_not_always_defined_in_cond ('A', 'COND1_TRUE COND2_TRUE') +# => () +# variable_not_always_defined_in_cond ('A', 'COND1_TRUE') +# => () +# variable_not_always_defined_in_cond ('A', 'TRUE') +# => ("COND1_FALSE COND2_FALSE COND3_FALSE", +# "COND1_FALSE COND2_TRUE COND3_FALSE", +# "COND1_TRUE COND2_FALSE COND3_FALSE", +# "COND1_TRUE COND2_TRUE COND3_FALSE") +# variable_not_always_defined_in_cond ('B', 'COND1_TRUE') +# => ("COND3_FALSE") +# variable_not_always_defined_in_cond ('C', 'COND1_TRUE') +# => () +# variable_not_always_defined_in_cond ('D', 'TRUE') +# => () +# variable_not_always_defined_in_cond ('Z', 'TRUE') +# => ("TRUE") +# +sub variable_not_always_defined_in_cond ($$) +{ + my ($var, $cond) = @_; + + # It's easy to answer if the variable is not defined. + return ("TRUE",) unless exists $var_value{$var}; + + # How does it work? Let's take the second example: + # + # variable_not_always_defined_in_cond ('A', 'COND1_TRUE') + # + # (1) First, we get the list of conditions where A is defined: + # + # ("COND1_TRUE COND2_TRUE", "COND1_TRUE COND2_FALSE", "COND3_TRUE") + # + # (2) Then we generate the set of inverted conditions: + # + # ("COND1_FALSE COND2_TRUE COND3_FALSE", + # "COND1_FALSE COND2_FALSE COND3_FALSE") + # + # (3) Finally we remove these conditions which are not implied by + # COND1_TRUE. This yields an empty list and we are done. + + my @res = (); + my @cond_defs = keys %{$var_value{$var}}; # (1) + foreach my $icond (invert_conditions (@cond_defs)) # (2) + { + prog_error "invert_conditions returned an input condition" + if exists $var_value{$var}{$icond}; + + push @res, $icond + if (conditional_true_when ($cond, $icond)); # (3) + } + return @res; +} + +# ¯o_define($VAR, $OWNER, $TYPE, $COND, $VALUE, $WHERE) +# ------------------------------------------------------------- +# The $VAR can go from Automake to user, but not the converse. +sub macro_define ($$$$$$) +{ + my ($var, $owner, $type, $cond, $value, $where) = @_; + + # We will adjust the owener of this variable unless told otherwise. + my $adjust_owner = 1; + + err $where, "bad characters in variable name `$var'" + if $var !~ /$MACRO_PATTERN/o; + + # NEWS-OS 4.2R complains if a Makefile variable begins with `_'. + msg ('portability', $where, + "$var: variable names starting with `_' are not portable") + if $var =~ /^_/; + + # `:='-style assignments are not acknowledged by POSIX. Moreover it + # has multiple meanings. In GNU make or BSD make it means "assign + # with immediate expansion", while in OSF make it is used for + # conditional assignments. + msg ('portability', $where, "`:='-style assignments are not portable") + if $type eq ':'; + + check_variable_expansions ($value, $where); + + $cond ||= 'TRUE'; + + # An Automake variable must be consistently defined with the same + # sign by Automake. A user variable must be set by either `=' or + # `:=', and later promoted to `+='. + if ($owner == VAR_AUTOMAKE) + { + if (exists $var_type{$var} + && exists $var_type{$var}{$cond} + && $var_type{$var}{$cond} ne $type) + { + err ($where, "$var was set with `$var_type{$var}=' " + . "and is now set with `$type='"); + } + } + else + { + if (!exists $var_type{$var} && $type eq '+') + { + err $where, "$var must be set with `=' before using `+='"; + } + } + $var_type{$var}{$cond} = $type; + + # When adding, since we rewrite, don't try to preserve the + # Automake continuation backslashes. + $value =~ s/\\$//mg + if $type eq '+' && $owner == VAR_AUTOMAKE; + + # Differentiate assignment types. + + # 1. append (+=) to a variable defined for current condition + if ($type eq '+' && exists $var_value{$var}{$cond}) + { + if (chomp $var_value{$var}{$cond}) + { + # Insert a backslash before a trailing newline. + $var_value{$var}{$cond} .= "\\\n"; + } + elsif ($var_value{$var}{$cond}) + { + # Insert a separator. + $var_value{$var}{$cond} .= ' '; + } + $var_value{$var}{$cond} .= $value; + } + # 2. append (+=) to a variable defined for *another* condition + elsif ($type eq '+' && keys %{$var_value{$var}}) + { + # * Generally, $cond is not TRUE. For instance: + # FOO = foo + # if COND + # FOO += bar + # endif + # In this case, we declare an helper variable conditionally, + # and append it to FOO: + # FOO = foo $(am__append_1) + # @COND_TRUE@am__append_1 = bar + # Of course if FOO is defined under several conditions, we add + # $(am__append_1) to each definitions. + # + # * If $cond is TRUE, we don't need the helper variable. E.g., in + # if COND1 + # FOO = foo1 + # else + # FOO = foo2 + # endif + # FOO += bar + # we can add bar directly to all definition of FOO, and output + # @COND_TRUE@FOO = foo1 bar + # @COND_FALSE@FOO = foo2 bar + + # Do we need an helper variable? + if ($cond ne 'TRUE') + { + # Does the helper variable already exists? + my $key = "$var:$cond"; + if (exists $appendvar{$key}) + { + # Yes, let's simply append to it. + $var = $appendvar{$key}; + $owner = VAR_AUTOMAKE; + } + else + { + # No, create it. + my $num = 1 + keys (%appendvar); + my $hvar = "am__append_$num"; + $appendvar{$key} = $hvar; + ¯o_define ($hvar, VAR_AUTOMAKE, '+', + $cond, $value, $where); + push @var_list, $hvar; + # Now HVAR is to be added to VAR. + $value = "\$($hvar)"; + } + } + + # Add VALUE to all definitions of VAR. + foreach my $vcond (keys %{$var_value{$var}}) + { + # We have a bit of error detection to do here. + # This: + # if COND1 + # X = Y + # endif + # X += Z + # should be rejected because X is not defined for all conditions + # where `+=' applies. + my @undef_cond = variable_not_always_defined_in_cond $var, $cond; + if (@undef_cond != 0) + { + err ($where, + "Cannot apply `+=' because `$var' is not defined " + . "in\nthe following conditions:\n " + . join ("\n ", @undef_cond) + . "\nEither define `$var' in these conditions," + . " or use\n`+=' in the same conditions as" + . " the definitions."); + } + else + { + ¯o_define ($var, $owner, '+', $vcond, $value, $where); + } + } + # Don't adjust the owner. The above ¯o_define did it in the + # right conditions. + $adjust_owner = 0; + } + # 3. first assignment (=, :=, or +=) + else + { + # If Automake tries to override a value specified by the user, + # just don't let it do. + if (exists $var_value{$var}{$cond} + && $var_owner{$var} != VAR_AUTOMAKE + && $owner == VAR_AUTOMAKE) + { + verb ("refusing to override the user definition of:\n" + . macro_dump ($var) + ."with `$cond' => `$value'"); + } + else + { + # There must be no previous value unless the user is redefining + # an Automake variable or an AC_SUBST variable for an existing + # condition. + check_ambiguous_conditional ($var, $cond, $where) + unless (exists $var_owner{$var}{$cond} + && (($var_owner{$var}{$cond} == VAR_AUTOMAKE + && $owner != VAR_AUTOMAKE) + || $var_owner{$var}{$cond} == VAR_CONFIGURE)); + + $var_value{$var}{$cond} = $value; + # Assignments to a macro set its location. We don't adjust + # locations for `+='. Ideally I suppose we would associate + # line numbers with random bits of text. + $var_location{$var}{$cond} = $where; + } + } + + # The owner of a variable can only increase, because an Automake + # variable can be given to the user, but not the converse. + if ($adjust_owner && + (! exists $var_owner{$var}{$cond} + || $owner > $var_owner{$var}{$cond})) + { + $var_owner{$var}{$cond} = $owner; + # Always adjust the location when the owner changes (even for + # `+=' statements). The risk otherwise is to warn about + # a VAR_MAKEFILE variable and locate it in configure.ac... + $var_location{$var}{$cond} = $where; + } + + # Call var_VAR_trigger if it's defined. + # This hook helps to update some internal state *while* + # parsing the file. For instance the handling of SUFFIXES + # requires this (see var_SUFFIXES_trigger). + my $var_trigger = "var_${var}_trigger"; + &$var_trigger($type, $value) if defined &$var_trigger; +} + + +# ¯o_delete ($VAR, [@CONDS]) +# ------------------------------ +# Forget about $VAR under the conditions @CONDS, or completely if +# @CONDS is empty. +sub macro_delete ($@) +{ + my ($var, @conds) = @_; + + if (!@conds) + { + delete $var_value{$var}; + delete $var_location{$var}; + delete $var_owner{$var}; + delete $var_comment{$var}; + delete $var_type{$var}; + } + else + { + foreach my $cond (@conds) + { + delete $var_value{$var}{$cond}; + delete $var_location{$var}{$cond}; + delete $var_owner{$var}{$cond}; + delete $var_comment{$var}{$cond}; + delete $var_type{$var}{$cond}; + } + } +} + + +# ¯o_dump ($VAR) +# ------------------ +sub macro_dump ($) +{ + my ($var) = @_; + my $text = ''; + + if (!exists $var_value{$var}) + { + $text = " $var does not exist\n"; + } + else + { + $text .= " $var $var_type{$var}=\n {\n"; + foreach my $vcond (sort by_condition keys %{$var_value{$var}}) + { + prog_error ("`$var' is a key in \$var_value, " + . "but not in \$var_owner\n") + unless exists $var_owner{$var}{$vcond}; + + my $var_owner; + if ($var_owner{$var}{$vcond} == VAR_AUTOMAKE) + { + $var_owner = 'Automake'; + } + elsif ($var_owner{$var}{$vcond} == VAR_CONFIGURE) + { + $var_owner = 'Configure'; + } + elsif ($var_owner{$var}{$vcond} == VAR_MAKEFILE) + { + $var_owner = 'Makefile'; + } + else + { + prog_error ("unexpected value for `\$var_owner{$var}{$vcond}': " + . $var_owner{$var}{$vcond}) + unless defined $var_owner; + } + + my $where = (defined $var_location{$var}{$vcond} + ? $var_location{$var}{$vcond} : "undefined"); + $text .= "$var_comment{$var}{$vcond}" + if exists $var_comment{$var}{$vcond}; + $text .= " $vcond => $var_value{$var}{$vcond}\n"; + } + $text .= " }\n"; + } + return $text; +} + + +# ¯os_dump () +# --------------- +sub macros_dump () +{ + my ($var) = @_; + + my $text = "%var_value =\n{\n"; + foreach my $var (sort (keys %var_value)) + { + $text .= macro_dump ($var); + } + $text .= "}\n"; + return $text; +} + + +# $BOOLEAN +# variable_defined ($VAR, [$COND]) +# --------------------------------- +# See if a variable exists. $VAR is the variable name, and $COND is +# the condition which we should check. If no condition is given, we +# currently return true if the variable is defined under any +# condition. +sub variable_defined ($;$) +{ + my ($var, $cond) = @_; + + if (! exists $var_value{$var} + || (defined $cond && ! exists $var_value{$var}{$cond})) + { + # VAR is not defined. + + # Check there is no target defined with the name of the + # variable we check. + + # adl> I'm wondering if this error still makes any sense today. I + # adl> guess it was because targets and variables used to share + # adl> the same namespace in older versions of Automake? + # tom> While what you say is definitely part of it, I think it + # tom> might also have been due to someone making a "spelling error" + # tom> -- writing "foo:..." instead of "foo = ...". + # tom> I'm not sure whether it is really worth diagnosing + # tom> this sort of problem. In the old days I used to add warnings + # tom> and errors like this pretty randomly, based on bug reports I + # tom> got. But there's a plausible argument that I was trying + # tom> too hard to prevent people from making mistakes. + if (exists $targets{$var} + && (! defined $cond || exists $targets{$var}{$cond})) + { + for my $tcond ($cond || keys %{$targets{$var}}) + { + prog_error ("\$targets{$var}{$tcond} exists but " + . "\$target_owner doesn't") + unless exists $target_owner{$var}{$tcond}; + # Diagnose the first user target encountered, if any. + # Restricting this test to user targets allows Automake + # to create rules for things like `bin_PROGRAMS = LDADD'. + if ($target_owner{$var}{$tcond} == TARGET_USER) + { + msg_cond_target ('syntax', $tcond, $var, + "`$var' is a target; " + . "expected a variable"); + return 0; + } + } + } + return 0; + } + + # Even a var_value examination is good enough for us. FIXME: + # really should maintain examined status on a per-condition basis. + $content_seen{$var} = 1; + return 1; +} + + +# $BOOLEAN +# variable_assert ($VAR, $WHERE) +# ------------------------------ +# Make sure a variable exists. $VAR is the variable name, and $WHERE +# is the name of a macro which refers to $VAR. +sub variable_assert ($$) +{ + my ($var, $where) = @_; + + return 1 + if variable_defined $var; + + require_variables ($where, "variable `$var' is used", 'TRUE', $var); + + return 0; +} + +# Mark a variable as examined. +sub examine_variable +{ + my ($var) = @_; + variable_defined ($var); +} + + +# &variable_conditions_recursive ($VAR) +# ------------------------------------- +# Return the set of conditions for which a variable is defined. + +# If the variable is not defined conditionally, and is not defined in +# terms of any variables which are defined conditionally, then this +# returns the empty list. + +# If the variable is defined conditionally, but is not defined in +# terms of any variables which are defined conditionally, then this +# returns the list of conditions for which the variable is defined. + +# If the variable is defined in terms of any variables which are +# defined conditionally, then this returns a full set of permutations +# of the subvariable conditions. For example, if the variable is +# defined in terms of a variable which is defined for COND_TRUE, +# then this returns both COND_TRUE and COND_FALSE. This is +# because we will need to define the variable under both conditions. +sub variable_conditions_recursive ($) +{ + my ($var) = @_; + + %vars_scanned = (); + + my @new_conds = variable_conditions_recursive_sub ($var, ''); + + # Now we want to return all permutations of the subvariable + # conditions. + my %allconds = (); + foreach my $item (@new_conds) + { + foreach (split (' ', $item)) + { + s/^(.*)_(TRUE|FALSE)$/$1_TRUE/; + $allconds{$_} = 1; + } + } + @new_conds = variable_conditions_permutations (sort keys %allconds); + + my %uniqify; + foreach my $cond (@new_conds) + { + my $reduce = variable_conditions_reduce (split (' ', $cond)); + next + if $reduce eq 'FALSE'; + $uniqify{$cond} = 1; + } + + # Note we cannot just do `return sort keys %uniqify', because this + # function is sometimes used in a scalar context. + my @uniq_list = sort by_condition keys %uniqify; + return @uniq_list; +} + + +# @CONDS +# variable_conditions ($VAR) +# -------------------------- +# Get the list of conditions that a variable is defined with, without +# recursing through the conditions of any subvariables. +# Argument is $VAR: the variable to get the conditions of. +# Returns the list of conditions. +sub variable_conditions ($) +{ + my ($var) = @_; + my @conds = keys %{$var_value{$var}}; + return sort by_condition @conds; +} + + +# $BOOLEAN +# &variable_conditionally_defined ($VAR) +# -------------------------------------- +sub variable_conditionally_defined ($) +{ + my ($var) = @_; + foreach my $cond (variable_conditions_recursive ($var)) + { + return 1 + unless $cond =~ /^TRUE|FALSE$/; + } + return 0; +} + +# @LIST +# &scan_variable_expansions ($TEXT) +# --------------------------------- +# Return the list of variable names expanded in $TEXT. +# Note that unlike some other functions, $TEXT is not split +# on spaces before we check for subvariables. +sub scan_variable_expansions ($) +{ + my ($text) = @_; + my @result = (); + + # Strip comments. + $text =~ s/#.*$//; + + # Record each use of ${stuff} or $(stuff) that do not follow a $. + while ($text =~ /(? 0) + { + $cond = shift(@conds); + + # FALSE is absorbent. + return 'FALSE' + if $cond eq 'FALSE'; + + if (!conditional_is_redundant ($cond, @ret, @conds)) + { + push (@ret, $cond); + } + } + + return "TRUE" if @ret == 0; + return @ret; +} + +# @CONDS +# invert_conditions (@CONDS) +# -------------------------- +# Invert a list of conditionals. Returns a set of conditionals which +# are never true for any of the input conditionals, and when taken +# together with the input conditionals cover all possible cases. +# +# For example: +# invert_conditions("A_TRUE B_TRUE", "A_FALSE B_FALSE") +# => ("A_FALSE B_TRUE", "A_TRUE B_FALSE") +# +# invert_conditions("A_TRUE B_TRUE", "A_TRUE B_FALSE", "A_FALSE") +# => () +sub invert_conditions +{ + my (@conds) = @_; + + my @notconds = (); + + # Generate all permutation for all inputs. + my @perm = + map { variable_conditions_permutations (split(' ', $_)); } @conds; + # Remove redundant conditions. + @perm = variable_conditions_reduce @perm; + + # Now remove all conditions which imply one of the input conditions. + foreach my $perm (@perm) + { + push @notconds, $perm + if ! conditional_implies_any ($perm, @conds); + } + return @notconds; +} + +# Return a list of permutations of a conditional string. +# (But never output FALSE conditions, they are useless.) +# +# Examples: +# variable_conditions_permutations ("FOO_FALSE", "BAR_TRUE") +# => ("FOO_FALSE BAR_FALSE", +# "FOO_FALSE BAR_TRUE", +# "FOO_TRUE BAR_FALSE", +# "FOO_TRUE BAR_TRUE") +# variable_conditions_permutations ("FOO_FALSE", "TRUE") +# => ("FOO_FALSE TRUE", +# "FOO_TRUE TRUE") +# variable_conditions_permutations ("TRUE") +# => ("TRUE") +# variable_conditions_permutations ("FALSE") +# => ("TRUE") +sub variable_conditions_permutations +{ + my (@comps) = @_; + return () + if ! @comps; + my $comp = shift (@comps); + return variable_conditions_permutations (@comps) + if $comp eq ''; + my $neg = condition_negate ($comp); + + my @ret; + foreach my $sub (variable_conditions_permutations (@comps)) + { + push (@ret, "$comp $sub") if $comp ne 'FALSE'; + push (@ret, "$neg $sub") if $neg ne 'FALSE'; + } + if (! @ret) + { + push (@ret, $comp) if $comp ne 'FALSE'; + push (@ret, $neg) if $neg ne 'FALSE'; + } + return @ret; +} + + +# $BOOL +# &check_variable_defined_unconditionally($VAR, $PARENT) +# ------------------------------------------------------ +# Warn if a variable is conditionally defined. This is called if we +# are using the value of a variable. +sub check_variable_defined_unconditionally ($$) +{ + my ($var, $parent) = @_; + foreach my $cond (keys %{$var_value{$var}}) + { + next + if $cond =~ /^TRUE|FALSE$/; + + if ($parent) + { + msg_var ('unsupported', $parent, + "automake does not support conditional definition of " + . "$var in $parent"); + } + else + { + msg_var ('unsupported', $var, + "automake does not support $var being defined " + . "conditionally"); + } + } +} + + +# Get the TRUE value of a variable, warn if the variable is +# conditionally defined. +sub variable_value +{ + my ($var) = @_; + &check_variable_defined_unconditionally ($var); + return $var_value{$var}{'TRUE'}; +} + + +# @VALUES +# &value_to_list ($VAR, $VAL, $COND) +# ---------------------------------- +# Convert a variable value to a list, split as whitespace. This will +# recursively follow $(...) and ${...} inclusions. It preserves @...@ +# substitutions. +# +# If COND is 'all', then all values under all conditions should be +# returned; if COND is a particular condition (all conditions are +# surrounded by @...@) then only the value for that condition should +# be returned; otherwise, warn if VAR is conditionally defined. +# SCANNED is a global hash listing whose keys are all the variables +# already scanned; it is an error to rescan a variable. +sub value_to_list ($$$) +{ + my ($var, $val, $cond) = @_; + my @result; + + # Strip backslashes + $val =~ s/\\(\n|$)/ /g; + + foreach (split (' ', $val)) + { + # If a comment seen, just leave. + last if /^#/; + + # Handle variable substitutions. + if (/^\$\{([^}]*)\}$/ || /^\$\(([^)]*)\)$/) + { + my $varname = $1; + + # If the user uses a losing variable name, just ignore it. + # This isn't ideal, but people have requested it. + next if ($varname =~ /\@.*\@/); + + my ($from, $to); + my @temp_list; + if ($varname =~ /$SUBST_REF_PATTERN/o) + { + $varname = $1; + $to = $3; + $from = quotemeta $2; + } + + # Find the value. + @temp_list = + variable_value_as_list_recursive_worker ($1, $cond, $var); + + # Now rewrite the value if appropriate. + if (defined $from) + { + grep (s/$from$/$to/, @temp_list); + } + + push (@result, @temp_list); + } + else + { + push (@result, $_); + } + } + + return @result; +} + + +# @VALUES +# variable_value_as_list ($VAR, $COND, $PARENT) +# --------------------------------------------- +# Get the value of a variable given a specified condition. without +# recursing through any subvariables. +# Arguments are: +# $VAR is the variable +# $COND is the condition. If this is not given, the value for the +# "TRUE" condition will be returned. +# $PARENT is the variable in which the variable is used: this is used +# only for error messages. +# Returns the list of conditions. +# For example, if A is defined as "foo $(B) bar", and B is defined as +# "baz", this will return ("foo", "$(B)", "bar") +sub variable_value_as_list +{ + my ($var, $cond, $parent) = @_; + my @result; + + # Check defined + return + unless variable_assert $var, $parent; + + # Get value for given condition + $cond ||= 'TRUE'; + my $onceflag; + foreach my $vcond (keys %{$var_value{$var}}) + { + my $val = $var_value{$var}{$vcond}; + + if (&conditional_true_when ($vcond, $cond)) + { + # Unless variable is not defined conditionally, there should only + # be one value of $vcond true when $cond. + &check_variable_defined_unconditionally ($var, $parent) + if $onceflag; + $onceflag = 1; + + # Strip backslashes + $val =~ s/\\(\n|$)/ /g; + + foreach (split (' ', $val)) + { + # If a comment seen, just leave. + last if /^#/; + + push (@result, $_); + } + } + } + + return @result; +} + + +# @VALUE +# &variable_value_as_list_recursive_worker ($VAR, $COND, $PARENT) +# --------------------------------------------------------------- +# Return contents of VAR as a list, split on whitespace. This will +# recursively follow $(...) and ${...} inclusions. It preserves @...@ +# substitutions. If COND is 'all', then all values under all +# conditions should be returned; if COND is a particular condition +# (all conditions are surrounded by @...@) then only the value for +# that condition should be returned; otherwise, warn if VAR is +# conditionally defined. If PARENT is specified, it is the name of +# the including variable; this is only used for error reports. +sub variable_value_as_list_recursive_worker ($$$) +{ + my ($var, $cond, $parent) = @_; + my @result = (); + + return + unless variable_assert $var, $parent; + + if (defined $vars_scanned{$var}) + { + # `vars_scanned' is a global we use to keep track of which + # variables we've already examined. + err_var $parent, "variable `$var' recursively defined"; + } + elsif ($cond eq 'all') + { + $vars_scanned{$var} = 1; + foreach my $vcond (keys %{$var_value{$var}}) + { + my $val = $var_value{$var}{$vcond}; + push (@result, &value_to_list ($var, $val, $cond)); + } + } + else + { + $cond ||= 'TRUE'; + $vars_scanned{$var} = 1; + my $onceflag; + foreach my $vcond (keys %{$var_value{$var}}) + { + my $val = $var_value{$var}{$vcond}; + if (&conditional_true_when ($vcond, $cond)) + { + # Warn if we have an ambiguity. It's hard to know how + # to handle this case correctly. + &check_variable_defined_unconditionally ($var, $parent) + if $onceflag; + $onceflag = 1; + push (@result, &value_to_list ($var, $val, $cond)); + } + } + } + + # Unset our entry in vars_scanned. We only care about recursive + # definitions. + delete $vars_scanned{$var}; + + return @result; +} + + +# &variable_output ($VAR, [@CONDS]) +# --------------------------------- +# Output all the values of $VAR is @COND is not specified, else only +# that corresponding to @COND. +sub variable_output ($@) +{ + my ($var, @conds) = @_; + + @conds = keys %{$var_value{$var}} + unless @conds; + + foreach my $cond (sort by_condition @conds) + { + prog_error ("unknown condition `$cond' for `$var'") + unless exists $var_value{$var}{$cond}; + + if (exists $var_comment{$var} && exists $var_comment{$var}{$cond}) + { + $output_vars .= $var_comment{$var}{$cond}; + } + + my $val = $var_value{$var}{$cond}; + my $equals = $var_type{$var}{$cond} eq ':' ? ':=' : '='; + my $output_var = "$var $equals $val"; + $output_var =~ s/^/make_condition ($cond)/meg; + $output_vars .= $output_var . "\n"; + } +} + + +# &variable_pretty_output ($VAR, [@CONDS]) +# ---------------------------------------- +# Likewise, but pretty, i.e., we *split* the values at spaces. Use only +# with variables holding filenames. +sub variable_pretty_output ($@) +{ + my ($var, @conds) = @_; + + @conds = keys %{$var_value{$var}} + unless @conds; + + foreach my $cond (sort by_condition @conds) + { + prog_error ("unknown condition `$cond' for `$var'") + unless exists $var_value{$var}{$cond}; + + if (exists $var_comment{$var} && exists $var_comment{$var}{$cond}) + { + $output_vars .= $var_comment{$var}{$cond}; + } + + my $val = $var_value{$var}{$cond}; + my $equals = $var_type{$var}{$cond} eq ':' ? ':=' : '='; + my $make_condition = make_condition ($cond); + $output_vars .= pretty_print_internal ("$make_condition$var $equals", + "$make_condition\t", + split (' ' , $val)); + } +} + + +# &variable_value_as_list_recursive ($VAR, $COND, $PARENT) +# -------------------------------------------------------- +# This is just a wrapper for variable_value_as_list_recursive_worker that +# initializes the global hash `vars_scanned'. This hash is used to +# avoid infinite recursion. +sub variable_value_as_list_recursive ($$@) +{ + my ($var, $cond, $parent) = @_; + %vars_scanned = (); + return &variable_value_as_list_recursive_worker ($var, $cond, $parent); +} + + +# &define_pretty_variable ($VAR, $COND, @VALUE) +# --------------------------------------------- +# Like define_variable, but the value is a list, and the variable may +# be defined conditionally. The second argument is the conditional +# 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, @value) = @_; + + # Beware that an empty $cond has a different semantics for + # macro_define and variable_pretty_output. + $cond ||= 'TRUE'; + + if (! variable_defined ($var, $cond)) + { + macro_define ($var, VAR_AUTOMAKE, '', $cond, "@value", undef); + variable_pretty_output ($var, $cond || 'TRUE'); + $content_seen{$var} = 1; + } +} + + +# define_variable ($VAR, $VALUE) +# ------------------------------ +# Define a new user variable VAR to VALUE, but only if not already defined. +sub define_variable ($$) +{ + my ($var, $value) = @_; + define_pretty_variable ($var, 'TRUE', $value); +} + + +# Like define_variable, but define a variable to be the configure +# substitution by the same name. +sub define_configure_variable ($) +{ + my ($var) = @_; + if (! variable_defined ($var, 'TRUE') + # Explicitly avoid ANSI2KNR -- we AC_SUBST that in + # protos.m4, but later define it elsewhere. This is + # pretty hacky. We also explicitly avoid AMDEPBACKSLASH: + # it might be subst'd by `\', which certainly would not be + # appreciated by Make. + && ! grep { $_ eq $var } (qw(ANSI2KNR AMDEPBACKSLASH))) + { + macro_define ($var, VAR_CONFIGURE, '', 'TRUE', + subst $var, $configure_vars{$var}); + variable_pretty_output ($var, 'TRUE'); + } +} + + +# 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); + &define_variable ($var, $value); + &define_variable ("LT$var", "\$(LIBTOOL) --mode=compile $value") + if variable_defined ('LIBTOOL'); +} + + +# define_linker_variable ($LANG) +# ------------------------------ +# Define linker variables. +sub define_linker_variable ($) +{ + my ($lang) = @_; + + my ($var, $value) = ($lang->lder, $lang->ld); + # CCLD = $(CC). + &define_variable ($lang->lder, $lang->ld); + # CCLINK = $(CCLD) blah blah... + &define_variable ($lang->linker, + ((variable_defined ('LIBTOOL') + ? '$(LIBTOOL) --mode=link ' : '') + . $lang->link)); +} + +################################################################ + +## ---------------- ## +## Handling rules. ## +## ---------------- ## + +sub register_suffix_rule ($$$) +{ + my ($where, $src, $dest) = @_; + + verb "Sources ending in $src become $dest"; + push @suffixes, $src, $dest; + + # When tranforming sources to objects, Automake uses the + # %suffix_rules to move from each source extension to + # `.$(OBJEXT)', not to `.o' or `.obj'. However some people + # define suffix rules for `.o' or `.obj', so internally we will + # consider these extensions equivalent to `.$(OBJEXT)'. We + # CANNOT rewrite the target (i.e., automagically replace `.o' + # and `.obj' by `.$(OBJEXT)' in the output), or warn the user + # that (s)he'd better use `.$(OBJEXT)', because Automake itself + # output suffix rules for `.o' or `.obj'... + $dest = '.$(OBJEXT)' if ($dest eq '.o' || $dest eq '.obj'); + + # Reading the comments near the declaration of $suffix_rules might + # help to understand the update of $suffix_rules that follows... + + # Register $dest as a possible destination from $src. + # We might have the create the \hash. + if (exists $suffix_rules->{$src}) + { + $suffix_rules->{$src}{$dest} = [ $dest, 1 ]; + } + else + { + $suffix_rules->{$src} = { $dest => [ $dest, 1 ] }; + } + + # If we know how to transform $dest in something else, then + # we know how to transform $src in that "something else". + if (exists $suffix_rules->{$dest}) + { + for my $dest2 (keys %{$suffix_rules->{$dest}}) + { + my $dist = $suffix_rules->{$dest}{$dest2}[1] + 1; + # Overwrite an existing $src->$dest2 path only if + # the path via $dest which is shorter. + if (! exists $suffix_rules->{$src}{$dest2} + || $suffix_rules->{$src}{$dest2}[1] > $dist) + { + $suffix_rules->{$src}{$dest2} = [ $dest, $dist ]; + } + } + } + + # Similarly, any extension that can be derived into $src + # can be derived into the same extenstions as $src can. + my @dest2 = keys %{$suffix_rules->{$src}}; + for my $src2 (keys %$suffix_rules) + { + if (exists $suffix_rules->{$src2}{$src}) + { + for my $dest2 (@dest2) + { + my $dist = $suffix_rules->{$src}{$dest2} + 1; + # Overwrite an existing $src2->$dest2 path only if + # the path via $src is shorter. + if (! exists $suffix_rules->{$src2}{$dest2} + || $suffix_rules->{$src2}{$dest2}[1] > $dist) + { + $suffix_rules->{$src2}{$dest2} = [ $src, $dist ]; + } + } + } + } +} + +# @CONDS +# rule_define ($TARGET, $SOURCE, $OWNER, $COND, $WHERE) +# ----------------------------------------------------- +# Define a new rule. $TARGET is the rule name. $SOURCE +# is the filename the rule comes from. $OWNER is the +# owener of the rule (TARGET_AUTOMAKE or TARGET_USER). +# $COND is the condition string under which the rule is defined. +# $WHERE is where the rule is defined (file name and/or line number). +# Returns a (possibly empty) list of conditions where the rule +# should be defined. +sub rule_define ($$$$$) +{ + my ($target, $source, $owner, $cond, $where) = @_; + + # Don't even think about defining a rule in condition FALSE. + return () if $cond eq 'FALSE'; + + # For now `foo:' will override `foo$(EXEEXT):'. This is temporary, + # though, so we emit a warning. + (my $noexe = $target) =~ s,\$\(EXEEXT\)$,,; + if ($noexe ne $target + && exists $targets{$noexe} + && exists $targets{$noexe}{$cond} + && $target_name{$noexe}{$cond} ne $target) + { + # The no-exeext option enables this feature. + if (! defined $options{'no-exeext'}) + { + msg ('obsolete', $noexe, + "deprecated feature: `$noexe' overrides `$noexe\$(EXEEXT)'\n" + . "change your target to read `$noexe\$(EXEEXT)'"); + } + # Don't define. + return (); + } + + # For now on, strip off $(EXEEXT) from $target, so we can diagnose + # a clash if `ctags$(EXEEXT):' is redefined after `ctags:'. + my $realtarget = $target; + $target = $noexe; + + # A GNU make-style pattern rule has a single "%" in the target name. + msg ('portability', $where, + "`%'-style pattern rules are a GNU make extension") + if $target =~ /^[^%]*%[^%]*$/; + + # Diagnose target redefinitions. + if (exists $target_source{$target}{$cond}) + { + # Sanity checks. + prog_error ("\$target_source{$target}{$cond} exists, but \$target_owner" + . " doesn't.") + unless exists $target_owner{$target}{$cond}; + prog_error ("\$target_source{$target}{$cond} exists, but \$targets" + . " doesn't.") + unless exists $targets{$target}{$cond}; + prog_error ("\$target_source{$target}{$cond} exists, but \$target_name" + . " doesn't.") + unless exists $target_name{$target}{$cond}; + + my $oldowner = $target_owner{$target}{$cond}; + + # Don't mention true conditions in diagnostics. + my $condmsg = $cond ne 'TRUE' ? " in condition `$cond'" : ''; + + if ($owner == TARGET_USER) + { + if ($oldowner eq TARGET_USER) + { + # Ignore `%'-style pattern rules. We'd need the + # dependencies to detect duplicates, and they are + # already diagnosed as unportable by -Wportability. + if ($target !~ /^[^%]*%[^%]*$/) + { + ## FIXME: Presently we can't diagnose duplcate user rules + ## because we doesn't distinguish rules with commands + ## from rules that only add dependencies. E.g., + ## .PHONY: foo + ## .PHONY: bar + ## is legitimate. (This is phony.test.) + + # msg ('syntax', $where, + # "redefinition of `$target'$condmsg..."); + # msg_cond_target ('syntax', $cond, $target, + # "... `$target' previously defined here."); + } + # Return so we don't redefine the rule in our tables, + # don't check for ambiguous conditional, etc. The rule + # will be output anyway beauce &read_am_file ignore the + # return code. + return (); + } + else + { + # Since we parse the user Makefile.am before reading + # the Automake fragments, this condition should never happen. + prog_error ("user target `$target' seen after Automake's " + . "definition\nfrom `$targets{$target}$condmsg'"); + } + } + else # $owner == TARGET_AUTOMAKE + { + if ($oldowner == TARGET_USER) + { + # Don't overwrite the user definition of TARGET. + return (); + } + else # $oldowner == TARGET_AUTOMAKE + { + # Automake should ignore redefinitions of its own + # rules if they came from the same file. This makes + # it easier to process a Makefile fragment several times. + # Hower it's an error if the target is defined in many + # files. E.g., the user might be using bin_PROGRAMS = ctags + # which clashes with our `ctags' rule. + # (It would be more accurate if we had a way to compare + # the *content* of both rules. Then $targets_source would + # be useless.) + my $oldsource = $target_source{$target}{$cond}; + return () if $source eq $oldsource; + + msg ('syntax', $where, "redefinition of `$target'$condmsg..."); + msg_cond_target ('syntax', $cond, $target, + "... `$target' previously defined here."); + return (); + } + } + # Never reached. + prog_error ("Unreachable place reached."); + } + + # Conditions for which the rule should be defined. + my @conds = $cond; + + # Check ambiguous conditional definitions. + my ($message, $ambig_cond) = + conditional_ambiguous_p ($target, $cond, keys %{$targets{$target}}); + if ($message) # We have an ambiguty. + { + if ($owner == TARGET_USER) + { + # For user rules, just diagnose the ambiguity. + msg 'syntax', $where, "$message ..."; + msg_cond_target ('syntax', $ambig_cond, $target, + "... `$target' previously defined here."); + return (); + } + else + { + # FIXME: for Automake rules, we can't diagnose ambiguities yet. + # The point is that Automake doesn't propagate conditionals + # everywhere. For instance &handle_PROGRAMS doesn't care if + # bin_PROGRAMS was defined conditionally or not. + # On the following input + # if COND1 + # foo: + # ... + # else + # bin_PROGRAMS = foo + # endif + # &handle_PROGRAMS will attempt to define a `foo:' rule + # in condition TRUE (which conflicts with COND1). Fixing + # this in &handle_PROGRAMS and siblings seems hard: you'd + # have to explain &file_contents what to do with a + # conditional. So for now we do our best *here*. If `foo:' + # was already defined in condition COND1 and we want to define + # it in condition TRUE, then define it only in condition !COND1. + # (See cond14.test and cond15.test for some test cases.) + my @defined_conds = keys %{$targets{$target}}; + @conds = (); + for my $undefined_cond (invert_conditions(@defined_conds)) + { + push @conds, make_condition ($cond, $undefined_cond); + } + # No conditions left to define the rule. + # Warn, because our workaround is meaningless in this case. + if (scalar @conds == 0) + { + msg 'syntax', $where, "$message ..."; + msg_cond_target ('syntax', $ambig_cond, $target, + "... `$target' previously defined here."); + return (); + } + } + } + + # Finally define this rule. + for my $c (@conds) + { + $targets{$target}{$c} = $where; + $target_source{$target}{$c} = $source; + $target_owner{$target}{$c} = $owner; + $target_name{$target}{$c} = $realtarget; + } + + # Check the rule for being a suffix rule. If so, store in a hash. + # Either it's a rule for two known extensions... + if ($target =~ /^($KNOWN_EXTENSIONS_PATTERN)($KNOWN_EXTENSIONS_PATTERN)$/ + # ...or it's a rule with unknown extensions (.i.e, the rule looks like + # `.foo.bar:' but `.foo' or `.bar' are not declared in SUFFIXES + # and are not known language extensions). + # Automake will complete SUFFIXES from @suffixes automatically + # (see handle_footer). + || ($target =~ /$SUFFIX_RULE_PATTERN/o && accept_extensions($1))) + { + register_suffix_rule ($where, $1, $2); + } + + # Return "" instead of TRUE so it can be used with make_paragraphs + # directly. + return "" if 1 == @conds && $conds[0] eq 'TRUE'; + return @conds; +} + + +# See if a target exists. +sub target_defined +{ + my ($target) = @_; + return exists $targets{$target}; +} + + +################################################################ + +# &append_comments ($VARIABLE, $SPACING, $COMMENT) +# ------------------------------------------------ +# Apped $COMMENT to the other comments for $VARIABLE, using +# $SPACING as separator. +sub append_comments ($$$$) +{ + my ($cond, $var, $spacing, $comment) = @_; + $var_comment{$var}{$cond} .= $spacing + if (!defined $var_comment{$var}{$cond} + || $var_comment{$var}{$cond} !~ /\n$/o); + $var_comment{$var}{$cond} .= $comment; +} + + +# &read_am_file ($AMFILE) +# ----------------------- +# Read Makefile.am and set up %contents. Simultaneously copy lines +# from Makefile.am into $output_trailer or $output_vars 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) = @_; + + my $am_file = new Automake::XFile ("< $amfile"); + verb "reading $amfile"; + + my $spacing = ''; + my $comment = ''; + my $blank = 0; + my $saw_bk = 0; + + 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) + { + if (/$IGNORE_PATTERN/o) + { + # Merely delete comments beginning with two hashes. + } + elsif (/$WHITE_PATTERN/o) + { + err "$amfile:$.", "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 preceeds first block of comments. + $spacing = "\n" unless $blank; + $blank = 1; + $comment .= $spacing . $_; + $spacing = ''; + $prev_state = IN_COMMENT; + } + else + { + last; + } + $saw_bk = /\\$/ && ! /$IGNORE_PATTERN/o; + } + + # We save the conditional stack on entry, and then check to make + # sure it is the same on exit. This lets us conditonally include + # other files. + my @saved_cond_stack = @cond_stack; + my $cond = conditional_string (@cond_stack); + + my $last_var_name = ''; + my $last_var_type = ''; + my $last_var_value = ''; + # FIXME: shouldn't use $_ in this loop; it is too big. + while ($_) + { + my $here = "$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 = /\\$/ && ! /$IGNORE_PATTERN/o; + + 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"; + err $here, "blank line following trailing backslash" + if $saw_bk; + } + elsif (/$COMMENT_PATTERN/o) + { + # Stick comments before the incoming macro or rule. + $comment .= $spacing . $_; + $spacing = ''; + err $here, "comment following trailing backslash" + if $saw_bk && $comment eq ''; + $prev_state = IN_COMMENT; + } + elsif ($saw_bk) + { + if ($prev_state == IN_RULE_DEF) + { + $output_trailer .= &make_condition (@cond_stack); + $output_trailer .= $_; + } + elsif ($prev_state == IN_COMMENT) + { + # If the line doesn't start with a `#', add it. + # We do this because a continuated 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 (!/\\$/) + { + append_comments ($cond || 'TRUE', + $last_var_name, $spacing, $comment); + $comment = $spacing = ''; + macro_define ($last_var_name, VAR_MAKEFILE, + $last_var_type, $cond, + $last_var_value, $here) + if $cond ne 'FALSE'; + push (@var_list, $last_var_name); + } + } + } + + elsif (/$IF_PATTERN/o) + { + $cond = cond_stack_if ($1, $2, $here); + } + elsif (/$ELSE_PATTERN/o) + { + $cond = cond_stack_else ($1, $2, $here); + } + elsif (/$ENDIF_PATTERN/o) + { + $cond = cond_stack_endif ($1, $2, $here); + } + + 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. + rule_define ($1, $amfile, TARGET_USER, $cond || 'TRUE', $here); + + check_variable_expansions ($_, $here); + + $output_trailer .= $comment . $spacing; + $output_trailer .= &make_condition (@cond_stack); + $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; + 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"; + } + + if (!/\\$/) + { + # Accumulating variables must not be output. + append_comments ($cond || 'TRUE', + $last_var_name, $spacing, $comment); + $comment = $spacing = ''; + + macro_define ($last_var_name, VAR_MAKEFILE, + $last_var_type, $cond, + $last_var_value, $here) + if $cond ne 'FALSE'; + push (@var_list, $last_var_name); + } + } + 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 implicitely 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 implicitely 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; + } + &read_am_file ($path); + } + 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 ($_, $here); + $output_trailer .= $comment . $spacing; + $output_trailer .= &make_condition (@cond_stack); + $output_trailer .= $_; + $comment = $spacing = ''; + err $here, "`#' comment at start of rule is unportable" + if $_ =~ /^\t\s*\#/; + } + + $saw_bk = $new_saw_bk; + $_ = $am_file->getline; + } + + $output_trailer .= $comment; + + err_am (@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"); + + # This will output the definitions in $output_vars, which we don't + # want... + foreach my $var (sort keys %configure_vars) + { + &define_configure_variable ($var); + push (@var_list, $var); + } + + # ... hence, we restore $output_vars. + $output_vars = $saved_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 keys %var_value > 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. However, we don't + # want these initial definitions to end up in the output quite + # yet. So we just load them, but output them later. + &define_standard_variables; + + # Read user file, which might override some of our values. + &read_am_file ($amfile); + + # Output all the Automake variables. If the user changed one, + # then it is now marked as VAR_CONFIGURE or VAR_MAKEFILE. + foreach my $var (uniq @var_list) + { + # Some variables, like AMDEPBACKSLASH are in @var_list + # but don't have a owner. This is good, because we don't want + # to output them. + foreach my $cond (keys %{$var_owner{$var}}) + { + variable_output ($var, $cond) + if $var_owner{$var}{$cond} == VAR_AUTOMAKE; + } + } + + # Now dump the user variables that were defined. We do it in the same + # order in which they were defined (skipping duplicates). + foreach my $var (uniq @var_list) + { + foreach my $cond (keys %{$var_owner{$var}}) + { + variable_output ($var, $cond) + if $var_owner{$var}{$cond} != VAR_AUTOMAKE; + } + } +} + +################################################################ + +# $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. + my $command = + "s/$IGNORE_PATTERN//gm;" + . transform (%transform, + + 'CYGNUS' => $cygnus_mode, + 'MAINTAINER-MODE' + => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '', + + 'SHAR' => $options{'dist-shar'} || 0, + 'BZIP2' => $options{'dist-bzip2'} || 0, + 'ZIP' => $options{'dist-zip'} || 0, + 'COMPRESS' => $options{'dist-tarZ'} || 0, + + 'INSTALL-INFO' => !$options{'no-installinfo'}, + 'INSTALL-MAN' => !$options{'no-installman'}, + 'CK-NEWS' => $options{'check-news'} || 0, + + 'SUBDIRS' => variable_defined ('SUBDIRS'), + 'TOPDIR' => backname ($relative_dir), + 'TOPDIR_P' => $relative_dir eq '.', + 'CONFIGURE-AC' => $configure_ac, + + 'BUILD' => $seen_canonical == AC_CANONICAL_SYSTEM, + 'HOST' => $seen_canonical, + 'TARGET' => $seen_canonical == AC_CANONICAL_SYSTEM, + + 'LIBTOOL' => variable_defined ('LIBTOOL')) + # We don't need more than two consecutive new-lines. + . 's/\n{3,}/\n\n/g'; + + # 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 (/(? 0 } @prefixes; + $valid{'EXTRA'} = 0; + foreach my $varname (keys %var_value) + { + # 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). + next + if (exists $var_owner{$varname} + && exists $var_owner{$varname}{'TRUE'} + && $var_owner{$varname}{'TRUE'} != VAR_MAKEFILE); + + if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_$primary$/) + { + my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || ''); + if ($dist ne '' && ! $can_dist) + { + err_var ($varname, + "invalid variable `$varname': `dist' is forbidden"); + } + # Standard directories must be explicitely allowed. + elsif (! defined $valid{$X} && exists $standard_prefix{$X}) + { + err_var ($varname, + "`${X}dir' is not a legitimate directory " . + "for `$primary'"); + } + # A not explicitely valid directory is allowed if Xdir is defined. + elsif (! defined $valid{$X} && + require_variables_for_macro ($varname, "`$varname' is used", + "${X}dir")) + { + # Nothing to do. Any error message has been output + # by require_variables_for_macro. + } + else + { + # Ensure all extended prefixes are actually used. + $valid{"$base$dist$X"} = 1; + } + } + } + + # Return only those which are actually defined. + return sort grep { variable_defined ($_ . '_' . $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 (eg HEADERS), and all +# subsequent arguments are possible installation locations. Returns +# list of all values of all _HOW targets. +# +# 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 = (); + + # True if the iteration is the first one. Used for instance to + # output parts of the associated file only once. + my $first = 1; + foreach my $X (@prefix) + { + my $nodir_name = $X; + my $one_name = $X . '_' . $primary; + + 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)_//; + } + + # Append actual contents of where_PRIMARY variable to + # result. + foreach my $rcurs (&variable_value_as_list_recursive ($one_name, 'all')) + { + # Skip configure substitutions. Possibly bogus. + if ($rcurs =~ /^\@.*\@$/) + { + if ($nodir_name eq 'EXTRA') + { + err_var ($one_name, + "`$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; + } + + next; + } + + push (@result, $rcurs); + } + # 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 + && defined $options{'std-options'}; + + # Singular form of $PRIMARY. + (my $one_primary = $primary) =~ s/S$//; + $output_rules .= &file_contents ($file, + ('FIRST' => $first, + + 'PRIMARY' => $primary, + 'ONE_PRIMARY' => $one_primary, + 'DIR' => $X, + 'NDIR' => $nodir_name, + 'BASE' => $strip_subdir, + + 'EXEC' => $exec_p, + 'INSTALL' => $install_p, + 'DIST' => $dist_p, + 'CK-OPTS' => $check_options_p)); + + $first = 0; + } + + # 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, '', @used); + $output_vars .= "\n"; + } + + err_var ($require_extra, + "`$require_extra' contains configure substitution,\n" + . "but `EXTRA_$primary' not defined") + if ($require_extra && ! variable_defined ('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. + return uniq (sort @result); +} + + +################################################################ + +# 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}; +} + +################################################################ + +# This variable is local to the "require file" set of functions. +my @require_file_paths = (); + + +# &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. + push_dist_common ($fullfile); + return 1; + } + return 0; +} + + +# &require_file_internal ($WHERE, $MYSTRICT, @FILES) +# -------------------------------------------------- +# Verify that the file must exist in the current directory. +# $MYSTRICT is the strictness level at which this file becomes required. +# +# Must set require_file_paths before calling this function. +# require_file_paths is set to hold a single directory (the one in +# which the first file was found) before return. +sub require_file_internal ($$@) +{ + my ($where, $mystrict, @files) = @_; + + foreach my $file (@files) + { + my $fullfile; + my $errdir; + my $errfile; + my $save_dir; + + my $found_it = 0; + my $dangling_sym = 0; + foreach my $dir (@require_file_paths) + { + $fullfile = $dir . "/" . $file; + $errdir = $dir unless $errdir; + + # Use different name for "error filename". Otherwise on + # an error the bad file will be reported as eg + # `../../install-sh' when using the default + # config_aux_path. + $errfile = $errdir . '/' . $file; + + if (-l $fullfile && ! -f $fullfile) + { + $dangling_sym = 1; + last; + } + elsif (-f $fullfile) + { + $found_it = 1; + maybe_push_required_file ($dir, $file, $fullfile); + $save_dir = $dir; + last; + } + } + + # `--force-missing' only has an effect if `--add-missing' is + # specified. + if ($found_it && (! $add_missing || ! $force_missing)) + { + # Prune the path list. + @require_file_paths = $save_dir; + } + 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 $require_file_found{$fullfile}; + $require_file_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 `$errfile' not found"; + if ($add_missing) + { + $suppress = 1; + + if (-f ("$libdir/$file")) + { + # 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 `$errfile'"; + # Windows Perl will hang if we try to delete a + # file that doesn't exist. + unlink ($errfile) if -f $errfile; + if ($symlink_exists && ! $copy_missing) + { + if (! symlink ("$libdir/$file", $errfile)) + { + $suppress = 0; + $trailer = "; error while making link: $!"; + } + } + elsif (system ('cp', "$libdir/$file", $errfile)) + { + $suppress = 0; + $trailer = "\n error while copying"; + } + } + + if (! maybe_push_required_file (dirname ($errfile), + $file, $errfile)) + { + if (! $found_it) + { + # 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). This is unfortunate, + # since it means we are using a file which is not + # distributed! + + # Get Automake to be run again: on the second + # run the file will be found, and pushed into + # the toplevel DIST_COMMON automatically. + $automake_needs_to_reprocess_all_files = 1; + } + } + + # Prune the path list. + @require_file_paths = &dirname ($errfile); + } + + # If --force-missing was specified, and we have + # actually found the file, then do nothing. + next + if $found_it && $force_missing; + + msg ($suppress ? 'note' : 'error', $where, "$message$trailer"); + } + } + } +} + +# &require_file ($WHERE, $MYSTRICT, @FILES) +# ----------------------------------------- +sub require_file ($$@) +{ + my ($where, $mystrict, @files) = @_; + @require_file_paths = $relative_dir; + require_file_internal ($where, $mystrict, @files); +} + +# &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) +# ----------------------------------------------------------- +sub require_file_with_macro ($$$@) +{ + my ($cond, $macro, $mystrict, @files) = @_; + require_file ($var_location{$macro}{$cond}, $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_paths = @config_aux_path; + require_file_internal ($where, $mystrict, @files); + my $dir = $require_file_paths[0]; + @config_aux_path = @require_file_paths; + # Avoid unsightly '/.'s. + $config_aux_dir = '$(top_srcdir)' . ($dir eq '.' ? "" : "/$dir"); +} + + +# &require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) +# ---------------------------------------------------------------- +sub require_conf_file_with_macro ($$$@) +{ + my ($cond, $macro, $mystrict, @files) = @_; + require_conf_file ($var_location{$macro}{$cond}, $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/.dirstamp"; + + # Don't emit the rule twice. + if (! defined $directory_map{$directory}) + { + $directory_map{$directory} = 1; + + # Directory must be removed by `make distclean'. + $clean_files{$dirstamp} = DIST_CLEAN; + + $output_rules .= ("$dirstamp:\n" + . "\t\@\$(mkinstalldirs) $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; + macro_define ('DIST_COMMON', VAR_AUTOMAKE, '+', '', "@_", ''); +} + + +# Set strictness. +sub set_strictness +{ + $strictness_name = $_[0]; + + # FIXME: 'portability' warnings are currently disabled by default. + # Eventually we want to turn them on in GNU and GNITS modes, but + # we don't do this yet in Automake 1.7 to help the 1.6/1.7 transition. + # + # Indeed there would be only two ways to get rid of these new warnings: + # 1. adjusting Makefile.am + # This is not always easy (or wanted). Consider %-rules or + # $(function args) variables. + # 2. using -Wno-portability + # This means there is no way to have the same Makefile.am + # working both with Automake 1.6 and 1.7 (since 1.6 does not + # understand -Wno-portability). + # + # In Automake 1.8 (or whatever it is called) we can turn these + # warnings on, since -Wno-portability will not be an issue for + # the 1.7/1.8 transition. + if ($strictness_name eq 'gnu') + { + $strictness = GNU; + setup_channel 'error-gnu', silent => 0; + setup_channel 'error-gnu/warn', silent => 0, type => 'error'; + setup_channel 'error-gnits', silent => 1; + # setup_channel 'portability', silent => 0; + setup_channel 'gnu', silent => 0; + } + elsif ($strictness_name eq 'gnits') + { + $strictness = GNITS; + setup_channel 'error-gnu', silent => 0; + setup_channel 'error-gnu/warn', silent => 0, type => 'error'; + setup_channel 'error-gnits', silent => 0; + # setup_channel 'portability', silent => 0; + setup_channel 'gnu', silent => 0; + } + elsif ($strictness_name eq 'foreign') + { + $strictness = FOREIGN; + setup_channel 'error-gnu', silent => 1; + setup_channel 'error-gnu/warn', silent => 0, type => 'warning'; + setup_channel 'error-gnits', silent => 1; + # setup_channel 'portability', silent => 1; + setup_channel 'gnu', silent => 1; + } + else + { + prog_error "level `$strictness_name' not recognized\n"; + } +} + + +################################################################ + +# Glob something. Do this to avoid indentation screwups everywhere we +# want to glob. Gross! +sub my_glob +{ + my ($pat) = @_; + return <${pat}>; +} + +################################################################ + +# INTEGER +# require_variables ($WHERE, $REASON, $COND, @VARIABLES) +# ------------------------------------------------------ +# Make sure that each supplied variable is defined in $COND. +# Otherwise, issue a warning. If we know which macro can +# define this variable, hint the user. +# Return the number of undefined variables. +sub require_variables ($$$@) +{ + my ($where, $reason, $cond, @vars) = @_; + my $res = 0; + $reason .= ' but ' unless $reason eq ''; + + VARIABLE: + foreach my $var (@vars) + { + # Nothing to do if the variable exists. The $configure_vars test + # needed for strange variables like AMDEPBACKSLASH or ANSI2KNR + # that are AC_SUBST'ed but never macro_define'd. + next VARIABLE + if ((exists $var_value{$var} && exists $var_value{$var}{$cond}) + || exists $configure_vars{$var}); + + my @undef_cond = variable_not_always_defined_in_cond $var, $cond; + next VARIABLE + unless @undef_cond; + + my $text = "$reason`$var' is undefined\n"; + if (@undef_cond && $undef_cond[0] ne 'TRUE') + { + $text .= ("in the following conditions:\n " + . join ("\n ", @undef_cond)); + } + + ++$res; + + if (exists $am_macro_for_var{$var}) + { + $text .= "\nThe usual way to define `$var' is to add " + . "`$am_macro_for_var{$var}'\nto `$configure_ac' and run " + . "`aclocal' and `autoconf' again."; + } + elsif (exists $ac_macro_for_var{$var}) + { + $text .= "\nThe usual way to define `$var' is to add " + . "`$ac_macro_for_var{$var}'\nto `$configure_ac' and run " + . "`autoconf' again."; + } + + err $where, $text, uniq_scope => US_GLOBAL; + } + return $res; +} + +# INTEGER +# require_variables_for_macro ($MACRO, $REASON, @VARIABLES) +# --------------------------------------------------------- +# Same as require_variables, but take a macro mame as first argument. +sub require_variables_for_macro ($$@) +{ + my ($macro, $reason, @args) = @_; + for my $cond (keys %{$var_value{$macro}}) + { + return require_variables ($var_location{$macro}{$cond}, $reason, + $cond, @args); + } +} + +# 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 + +Warning categories include: + `gnu' GNU coding standards (default in gnu and gnits modes) + `obsolete' obsolete features or constructions + `portability' portability issues + `syntax' dubious syntactic constructs (default) + `unsupported' unsupported or incomplete features (default) + `all' all the warnings + `no-CATEGORY' turn off warnings in CATEGORY + `none' turn off all the warnings + `error' treat warnings as errors +"; + + 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 2002 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; +} + +### 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/autoreconf b/bin/autoreconf index f1dfef26..767ba7fc 100644 --- a/bin/autoreconf +++ b/bin/autoreconf @@ -1,13 +1,12 @@ #! /bin/perl -w # -*- perl -*- -# Generated from autoreconf.in; do not edit by hand. +# @configure_input@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; esac' if 0; # autoreconf - install the GNU Build System in a directory tree -# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,28 +20,18 @@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; es # 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # Written by David J. MacKenzie. # Extended and rewritten in Perl by Akim Demaille. BEGIN { - my $datadir = $ENV{'autom4te_perllibdir'} || '/usr/share/autoconf'; - 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'); + my $perllibdir = $ENV{'autom4te_perllibdir'} || '/usr/share/autoconf'; + unshift @INC, "$perllibdir"; } -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::Configure_ac; -use Autom4te::FileUtils; use Autom4te::General; use Autom4te::XFile; # Do not use Cwd::chdir, since it might hang. @@ -55,16 +44,16 @@ use strict; # $HELP # ----- -$help = "Usage: $0 [OPTION] ... [DIRECTORY] ... +$help = "Usage: $0 [OPTION] ... [CONFIGURE-AC or DIRECTORY] ... Run `autoconf' (and `autoheader', `aclocal', `automake', `autopoint' (formerly `gettextize'), and `libtoolize' where appropriate) -repeatedly to remake the GNU Build System files in specified -DIRECTORIES and their subdirectories (defaulting to `.'). +repeatedly to remake the GNU Build System files in the DIRECTORIES or +the directory trees driven by CONFIGURE-AC (defaulting to `.'). By default, it only remakes those files that are older than their -sources. If you install new versions of the GNU Build System, -you can make `autoreconf' remake all of the files by giving it the +predecessors. If you install new versions of the GNU Build System, +running `autoreconf' remakes all of the files by giving it the `--force' option. Operation modes: @@ -74,12 +63,19 @@ Operation modes: -d, --debug don't remove temporary files -f, --force consider all files obsolete -i, --install copy missing auxiliary files - --no-recursive don't rebuild sub-packages -s, --symlink with -i, install symbolic links instead of copies -m, --make when applicable, re-run ./configure && make -W, --warnings=CATEGORY report the warnings falling in CATEGORY [syntax] -" . Autom4te::ChannelDefs::usage . " +Warning categories include: + \`cross\' cross compilation issues + \`obsolete\' obsolete constructs + \`portability\' portability issues + \`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. Some subtools might support other warning types, using \`all' is encouraged. @@ -89,20 +85,19 @@ Library directories: -I, --include=DIR append directory DIR to search path The environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL, -AUTOPOINT, LIBTOOLIZE, M4 are honored. +AUTOPOINT, LIBTOOLIZE are honored. Report bugs to . "; # $VERSION # -------- -$version = "autoreconf (GNU Autoconf) 2.61 -Copyright (C) 2006 Free Software Foundation, Inc. -This is free software. You may redistribute copies of it under the terms of -the GNU General Public License . -There is NO WARRANTY, to the extent permitted by law. - +$version = "autoreconf (GNU Autoconf) 2.56 Written by David J. MacKenzie and Akim Demaille. + +Copyright 2002 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. "; # Lib files. @@ -117,23 +112,16 @@ my $autopoint = $ENV{'AUTOPOINT'} || 'autopoint'; my $install = 0; # symlink -- when --install, use symlinks instead. my $symlink = 0; -# Does aclocal support --force? -my $aclocal_supports_force = 0; -# Does automake support --force-missing? -my $automake_supports_force_missing = 0; my @prepend_include; my @include; -# List of command line warning requests. +# List of warnings. my @warning; # Rerun `./configure && make'? my $make = 0; -# Recurse into subpackages -my $recursive = 1; - ## ---------- ## ## Routines. ## ## ---------- ## @@ -151,14 +139,11 @@ sub parse_args () 'B|prepend-include=s' => \@prepend_include, 'i|install' => \$install, 's|symlink' => \$symlink, - 'm|make' => \$make, - 'recursive!' => \$recursive); + 'm|make' => \$make); # Split the warnings as a list of elements instead of a list of # lists. @warning = map { split /,/ } @warning; - parse_WARNINGS; - parse_warnings '--warnings', @warning; # Even if the user specified a configure.ac, trim to get the # directory, and look for configure.ac again. Because (i) the code @@ -179,9 +164,6 @@ sub parse_args () } } - $aclocal_supports_force = `$aclocal --help` =~ /--force/; - $automake_supports_force_missing = `$automake --help` =~ /--force-missing/; - # Dispatch autoreconf's option to the tools. # --include; $autoconf .= join (' --include=', '', @include); @@ -199,116 +181,43 @@ sub parse_args () # --force; if ($force) { - $aclocal .= ' --force' - if $aclocal_supports_force; $autoconf .= ' --force'; $autoheader .= ' --force'; - $automake .= ' --force-missing' - if $automake_supports_force_missing; + $automake .= ' --force-missing'; $autopoint .= ' --force'; $libtoolize .= ' --force'; } else { - # The implementation of --no-force is bogus in all implementations - # of Automake up to 1.8, so we avoid it in these cases. (Automake - # 1.8 is the first version where aclocal supports force, hence - # the condition.) - $automake .= ' --no-force' - if $aclocal_supports_force; + $automake .= ' --no-force'; } - # --verbose --verbose or --debug; - if ($verbose > 1 || $debug) + # --debug; + if ($debug) { - $autoconf .= ' --verbose'; - $autoheader .= ' --verbose'; + $autoconf .= ' --verbose --debug'; + $autoheader .= ' --verbose --debug'; $automake .= ' --verbose'; $aclocal .= ' --verbose'; - } - if ($debug) - { - $autoconf .= ' --debug'; - $autoheader .= ' --debug'; $libtoolize .= ' --debug'; } # --warnings; if (@warning) { - my $warn = ' --warnings=' . join (',', @warning); - $autoconf .= $warn; - $autoheader .= $warn; - $automake .= $warn + $autoconf .= ' --warnings=' . join (',', @warning); + $autoheader .= ' --warnings=' . join (',', @warning); + $automake .= ' --warnings=' . join (',', @warning) if `$automake --help` =~ /--warnings/; } } -# &run_aclocal ($ACLOCAL, $FLAGS) -# ------------------------------- -# Update aclocal.m4 as lazily as possible, as aclocal pre-1.8 always -# overwrites aclocal.m4, hence triggers autoconf, autoheader, automake -# etc. uselessly. aclocal 1.8+ does not need this. -sub run_aclocal ($$) -{ - my ($aclocal, $flags) = @_; - - # aclocal 1.8+ does all this for free. It can be recognized by its - # --force support. - if ($aclocal_supports_force) - { - xsystem ("$aclocal $flags"); - } - else - { - xsystem ("$aclocal $flags --output=aclocal.m4t"); - # aclocal may produce no output. - if (-f 'aclocal.m4t') - { - update_file ('aclocal.m4t', 'aclocal.m4'); - # Make sure that the local m4 files are older than - # aclocal.m4. - # - # Why is not always the case? Because we already run - # aclocal at first (before tracing), which, for instance, - # can find Gettext's macros in .../share/aclocal, so we may - # have had the right aclocal.m4 already. Then autopoint is - # run, and installs locally these M4 files. Then - # autoreconf, via update_file, sees it is the _same_ - # aclocal.m4, and doesn't change its timestamp. But later, - # Automake's Makefile expresses that aclocal.m4 depends on - # these local files, which are newer, so it triggers aclocal - # again. - # - # To make sure aclocal.m4 is no older, we change the - # modification times of the local M4 files to be not newer - # than it. - # - # First, where are the local files? - my $aclocal_local_dir = '.'; - if ($flags =~ /-I\s+(\S+)/) - { - $aclocal_local_dir = $1; - } - # All the local files newer than aclocal.m4 are to be - # made not newer than it. - my $aclocal_m4_mtime = mtime ('aclocal.m4'); - for my $file (glob ("$aclocal_local_dir/*.m4"), 'acinclude.m4') - { - if ($aclocal_m4_mtime < mtime ($file)) - { - debug "aging $file to be not newer than aclocal.m4"; - utime $aclocal_m4_mtime, $aclocal_m4_mtime, $file; - } - } - } - } -} - # &autoreconf_current_directory # ----------------------------- sub autoreconf_current_directory () { my $configure_ac = find_configure_ac; + error "cannot find `configure.ac'" + unless $configure_ac; # ---------------------- # # Is it using Autoconf? # @@ -316,21 +225,19 @@ sub autoreconf_current_directory () my $uses_autoconf; my $uses_gettext; - if (-f $configure_ac) - { - my $configure_ac_file = new Autom4te::XFile $configure_ac; - while ($_ = $configure_ac_file->getline) - { - s/#.*//; - s/dnl.*//; - $uses_autoconf = 1 if /AC_INIT/; - # See below for why we look for gettext here. - $uses_gettext = 1 if /^AM_GNU_GETTEXT_VERSION/; - } - } + my $configure_ac_file = new Autom4te::XFile $configure_ac; + while ($_ = $configure_ac_file->getline) + { + s/#.*//; + s/dnl.*//; + $uses_autoconf = 1 if /AC_INIT/; + # See below for why we look for gettext here. + $uses_gettext = 1 if /^AM_GNU_GETTEXT_VERSION/; + } + if (!$uses_autoconf) { - verb "$configure_ac: not using Autoconf"; + verbose "$configure_ac: not using Autoconf"; return; } @@ -357,11 +264,11 @@ sub autoreconf_current_directory () # scanning configure.ac. if (!$uses_gettext) { - verb "$configure_ac: not using Gettext"; + verbose "$configure_ac: not using Gettext"; } elsif (!$install) { - verb "$configure_ac: not running autopoint: --install not given"; + verbose "$configure_ac: not running autopoint: --install not given"; } else { @@ -390,7 +297,7 @@ sub autoreconf_current_directory () my $aclocal_m4 = new Autom4te::XFile 'aclocal.m4'; $_ = $aclocal_m4->getline; $uses_aclocal = 0 - unless defined ($_) && /generated.*by aclocal/; + unless /generated.*by aclocal/; } # If there are flags for aclocal in Makefile.am, use them. @@ -410,11 +317,11 @@ sub autoreconf_current_directory () if (!$uses_aclocal) { - verb "$configure_ac: not using aclocal"; + verbose "$configure_ac: not using aclocal"; } else { - # Some file systems have sub-second time stamps, and if so we may + # Some filesystems have sub-second time stamps, and if so we may # run into trouble later, after we rerun autoconf and set the # time stamps of input files to be no greater than aclocal.m4, # because the time-stamp-setting operation (utime) has a @@ -424,7 +331,10 @@ sub autoreconf_current_directory () # fall. sleep 1; - run_aclocal ($aclocal, $aclocal_flags); + xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t"); + # aclocal may produce no output. + update_file ('aclocal.m4t', 'aclocal.m4') + if -f 'aclocal.m4t'; } # We might have to rerun aclocal if Libtool (or others) imports new @@ -440,40 +350,30 @@ sub autoreconf_current_directory () # Perform a single trace reading to avoid --force forcing a rerun # between two --trace, that's useless. If there is no AC_INIT, then # we are not interested: it looks like a Cygnus thingy. - my $aux_dir; my $uses_gettext_via_traces; my $uses_libtool; - my $uses_libltdl; my $uses_autoheader; - my $uses_automake; my @subdir; - verb "$configure_ac: tracing"; + verbose "$configure_ac: tracing"; my $traces = new Autom4te::XFile ("$autoconf" . join (' --trace=', '', # If you change this list, update the # `Autoreconf-preselections' section of autom4te.in. - 'AC_CONFIG_AUX_DIR:AC_CONFIG_AUX_DIR:\$1', 'AC_CONFIG_HEADERS', 'AC_CONFIG_SUBDIRS:AC_CONFIG_SUBDIRS:\$1', 'AC_INIT', 'AC_PROG_LIBTOOL', - 'LT_INIT', - 'LT_CONFIG_LTDL_DIR', 'AM_GNU_GETTEXT', - 'AM_INIT_AUTOMAKE', ) . ' |'); while ($_ = $traces->getline) { - $aux_dir = $1 if /AC_CONFIG_AUX_DIR:(.*)/; $uses_autoconf = 1 if /AC_INIT/; $uses_gettext_via_traces = 1 if /AM_GNU_GETTEXT/; - $uses_libtool = 1 if /(AC_PROG_LIBTOOL|LT_INIT)/; - $uses_libltdl = 1 if /LT_CONFIG_LTDL_DIR/; + $uses_libtool = 1 if /AC_PROG_LIBTOOL/; $uses_autoheader = 1 if /AC_CONFIG_HEADERS/; - $uses_automake = 1 if /AM_INIT_AUTOMAKE/; - push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/ && $recursive; + push @subdir, split (' ', $1) if /AC_CONFIG_SUBDIRS:(.*)/; } # The subdirs are *optional*, they may not exist. @@ -481,12 +381,12 @@ sub autoreconf_current_directory () { if (-d) { - verb "$configure_ac: adding subdirectory $_ to autoreconf"; + verbose "$configure_ac: subdirectory $_ to autoreconf"; autoreconf ($_); } else { - verb "$configure_ac: subdirectory $_ not present"; + verbose "$configure_ac: subdirectory $_ not present"; } } @@ -497,44 +397,22 @@ sub autoreconf_current_directory () if $uses_gettext && ! $uses_gettext_via_traces; - # ---------------------------- # - # Setting up the source tree. # - # ---------------------------- # - - # libtoolize, automake --add-missing etc. will drop files in the - # $AUX_DIR. But these tools fail to install these files if the - # directory itself does not exist, which valid: just imagine a CVS - # repository with hand written code only (there is not even a need - # for a Makefile.am!). - - if (defined $aux_dir && ! -d $aux_dir) - { - verb "$configure_ac: creating directory $aux_dir"; - mkdir $aux_dir, 0755 - or error "cannot create $aux_dir: $!"; - } - - # -------------------- # # Running libtoolize. # # -------------------- # if (!$uses_libtool) { - verb "$configure_ac: not using Libtool"; + verbose "$configure_ac: not using Libtool"; } elsif ($install) { - if ($uses_libltdl) - { - $libtoolize .= " --ltdl"; - } xsystem ($libtoolize); $rerun_aclocal = 1; } else { - verb "$configure_ac: not running libtoolize: --install not given"; + verbose "$configure_ac: not running libtoolize: --install not given"; } @@ -549,11 +427,51 @@ sub autoreconf_current_directory () { if (!$uses_aclocal) { - verb "$configure_ac: not using aclocal"; + verbose "$configure_ac: not using aclocal"; } else { - run_aclocal ($aclocal, $aclocal_flags); + xsystem ("$aclocal $aclocal_flags --output=aclocal.m4t"); + # aclocal may produce no output. + if (-f 'aclocal.m4t') + { + update_file ('aclocal.m4t', 'aclocal.m4'); + # Make sure that the local m4 files are older than + # aclocal.m4. + # + # Why is not always the case? Because we already run + # aclocal at first (before tracing), which, for instance, + # can find Gettext's macros in .../share/aclocal, so we + # may have had the right aclocal.m4 already. Then + # autopoint is run, and installs locally these M4 + # files. Then autoreconf, via update_file, sees it is + # the _same_ aclocal.m4, and doesn't change its + # timestamp. But later, Automake's Makefile expresses + # that aclocal.m4 depends on these local files, which + # are newer, so it triggers aclocal again. + # + # To make sure aclocal.m4 is no older, we change the + # modification times of the local M4 files to be + # not newer than it. + # + # First, where are the local files? + my $aclocal_local_dir = '.'; + if ($aclocal_flags =~ /-I\s+(\S+)/) + { + $aclocal_local_dir = $1; + } + # All the local files newer than aclocal.m4 are to be + # made not newer than it. + my $aclocal_m4_mtime = mtime ('aclocal.m4'); + for my $file (glob ("$aclocal_local_dir/*.m4"), 'acinclude.m4') + { + if ($aclocal_m4_mtime < mtime ($file)) + { + debug "aging $file to be not newer than aclocal.m4"; + utime $aclocal_m4_mtime, $aclocal_m4_mtime, $file; + } + } + } } } @@ -586,7 +504,7 @@ sub autoreconf_current_directory () # config.h.in when it sees an AC_CONFIG_HEADERS. if (!$uses_autoheader) { - verb "$configure_ac: not using Autoheader"; + verbose "$configure_ac: not using Autoheader"; } else { @@ -598,9 +516,10 @@ sub autoreconf_current_directory () # Running automake. # # ------------------ # - if (!$uses_automake) + # Assumes that there is a Makefile.am in the topmost directory. + if (!-f 'Makefile.am') { - verb "$configure_ac: not using Automake"; + verbose "$configure_ac: not using Automake"; } else { @@ -619,7 +538,7 @@ sub autoreconf_current_directory () { if (!-f "config.status") { - verb "no config.status: cannot re-make"; + verbose "no config.status: cannot re-make"; } else { @@ -627,7 +546,7 @@ sub autoreconf_current_directory () xsystem ("./config.status"); if (!-f "Makefile") { - verb "no Makefile: cannot re-make"; + verbose "no Makefile: cannot re-make"; } else { @@ -648,7 +567,7 @@ sub autoreconf ($) # The format for this message is not free: taken from Emacs, itself # using GNU Make's format. - verb "Entering directory `$directory'"; + verbose "Entering directory `$directory'"; chdir $directory or error "cannot chdir to $directory: $!"; @@ -656,7 +575,7 @@ sub autoreconf ($) # The format is not free: taken from Emacs, itself using GNU Make's # format. - verb "Leaving directory `$directory'"; + verbose "Leaving directory `$directory'"; chdir $cwd or error "cannot chdir to $cwd: $!"; } @@ -672,11 +591,10 @@ mktmpdir ('ar'); $ENV{'TMPDIR'} = $tmp; parse_args; -# Autoreconf all the given configure.ac. Unless `--no-recursive' is passed, -# AC_CONFIG_SUBDIRS will be traversed in &autoreconf_current_directory. +# Autoreconf all the given configure.ac. A while loop, not a for, +# since the list can change at runtime because of AC_CONFIG_SUBDIRS. for my $directory (@ARGV) { - require_configure_ac ($directory); autoreconf ($directory); } diff --git a/bin/autoscan b/bin/autoscan index 32b9c9d9..8a8da7c4 100644 --- a/bin/autoscan +++ b/bin/autoscan @@ -1,10 +1,7 @@ #! /bin/perl -w # -*- perl -*- -# Generated from autoscan.in; do not edit by hand. - # autoscan - Create configure.scan (a preliminary configure.ac) for a package. -# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,8 +15,8 @@ # 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # Written by David MacKenzie . @@ -28,30 +25,21 @@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; es BEGIN { - my $datadir = $ENV{'autom4te_perllibdir'} || '/usr/share/autoconf'; - 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'); + my $perllibdir = $ENV{'autom4te_perllibdir'} || "/usr/share/autoconf"; + unshift @INC, "$perllibdir"; } -use Autom4te::ChannelDefs; -use Autom4te::Configure_ac; use Autom4te::General; -use Autom4te::FileUtils; use Autom4te::XFile; use File::Basename; use File::Find; use strict; -use vars qw(@cfiles @makefiles @shfiles @subdirs %printed); +use vars qw(@cfiles @makefiles @shfiles %printed); # The kind of the words we are looking for. my @kinds = qw (function header identifier program - makevar librarie); + makevar librarie); # For each kind, the default macro. my %generic_macro = @@ -91,7 +79,7 @@ my %needed_macros = ); my $configure_scan = 'configure.scan'; -my $log; +my $log = new Autom4te::XFile ">$me.log"; # Autoconf and lib files. my $autom4te = $ENV{'AUTOM4TE'} || '/usr/bin/autom4te'; @@ -122,14 +110,12 @@ Report bugs to .\n"; # $version # -------- -$version = "autoscan (GNU Autoconf) 2.61 -Copyright (C) 2006 Free Software Foundation, Inc. -This is free software. You may redistribute copies of it under the terms of -the GNU General Public License . -There is NO WARRANTY, to the extent permitted by law. - +$version = "autoscan (GNU Autoconf) 2.56 Written by David J. MacKenzie and Akim Demaille. -"; + +Copyright 2002 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"; @@ -152,7 +138,7 @@ Try `$me --help' for more information.\n" my $srcdir = $ARGV[0] || "."; - verb "srcdir = $srcdir"; + verbose "srcdir = $srcdir"; chdir $srcdir || error "cannot cd to $srcdir: $!"; } @@ -233,17 +219,17 @@ sub used ($$;$) ## ----------------------- ## -# scan_c_file ($FILE-NAME) -# ------------------------ +# scan_c_file ($FILENAME) +# ----------------------- sub scan_c_file ($) { - my ($file_name) = @_; + my ($filename) = @_; push @cfiles, $File::Find::name; # Nonzero if in a multiline comment. my $in_comment = 0; - my $file = new Autom4te::XFile "<$file_name"; + my $file = new Autom4te::XFile "<$filename"; while ($_ = $file->getline) { @@ -306,10 +292,10 @@ sub scan_c_file ($) # ----------------------------- sub scan_makefile ($) { - my ($file_name) = @_; + my ($filename) = @_; push @makefiles, $File::Find::name; - my $file = new Autom4te::XFile "<$file_name"; + my $file = new Autom4te::XFile "<$filename"; while ($_ = $file->getline) { @@ -348,10 +334,10 @@ sub scan_makefile ($) # -------------------------------- sub scan_sh_file ($) { - my ($file_name) = @_; + my ($filename) = @_; push @shfiles, $File::Find::name; - my $file = new Autom4te::XFile "<$file_name"; + my $file = new Autom4te::XFile "<$filename"; while ($_ = $file->getline) { @@ -373,7 +359,7 @@ sub scan_sh_file ($) # scan_file () # ------------ -# Called by &find on each file. $_ contains the current file name with +# Called by &find on each file. $_ contains the current filename with # the current directory of the walk through. sub scan_file () { @@ -387,15 +373,6 @@ sub scan_file () # Strip a useless leading `./'. $File::Find::name =~ s,^\./,,; - if ($_ ne '.' and -d $_ and - -f "$_/configure.in" || - -f "$_/configure.ac" || - -f "$_/configure.gnu" || - -f "$_/configure") - { - $File::Find::prune = 1; - push @subdirs, $File::Find::name; - } if (/\.[chlym](\.in)?$/) { used 'program', 'cc', $File::Find::name; @@ -526,7 +503,7 @@ sub output ($) ("# -*- Autoconf -*-\n" . "# Process this file with autoconf to produce a configure script.\n" . "\n" . - "AC_PREREQ(2.61)\n" . + "AC_PREREQ(2.56)\n" . "AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)\n"); if (defined $cfiles[0]) { @@ -541,7 +518,6 @@ sub output ($) output_kind ($file, 'identifier'); output_kind ($file, 'function'); - print $file "\n"; if (@makefiles) { # Change DIR/Makefile.in to DIR/Makefile. @@ -550,16 +526,10 @@ sub output ($) $m =~ s/\.(?:in|am)$//; $unique_makefiles{$m}++; } - print $file ("AC_CONFIG_FILES([", + print $file ("\nAC_CONFIG_FILES([", join ("\n ", sort keys %unique_makefiles), "])\n"); } - if (@subdirs) - { - print $file ("AC_CONFIG_SUBDIRS([", - join ("\n ", - sort @subdirs), "])\n"); - } print $file "AC_OUTPUT\n"; $file->close; @@ -587,7 +557,7 @@ sub check_configure_ac ($) join (' --trace=', '', uniq (sort (map { s/\(.*//; $_ } keys %needed_macros))); - verb "running: $autoconf $trace_option $configure_ac"; + verbose "running: $autoconf $trace_option $configure_ac"; my $traces = new Autom4te::XFile "$autoconf $trace_option $configure_ac|"; @@ -626,9 +596,9 @@ sub check_configure_ac ($) . "\n"); print $log "$me: warning: missing $macro wanted by: \n"; foreach my $need (@{$needed_macros{$macro}}) - { - print $log "\t$need\n"; - } + { + print $log "\t$need\n"; + } } } @@ -638,8 +608,6 @@ sub check_configure_ac ($) ## -------------- ## parse_args; -$log = new Autom4te::XFile ">$me.log"; - $autoconf .= " --debug" if $debug; $autoconf .= " --verbose" if $verbose; $autoconf .= join (' --include=', '', @include); @@ -649,7 +617,7 @@ my $configure_ac = find_configure_ac; init_tables; scan_files; output ('configure.scan'); -if (-f $configure_ac) +if ($configure_ac) { check_configure_ac ($configure_ac); } diff --git a/bin/autoupdate b/bin/autoupdate index 74bd6e00..c38abf94 100644 --- a/bin/autoupdate +++ b/bin/autoupdate @@ -1,10 +1,7 @@ #! /bin/perl -w # -*- perl -*- -# Generated from autoupdate.in; do not edit by hand. - # autoupdate - modernize an Autoconf file. -# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,8 +15,8 @@ # 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # Originally written by David MacKenzie . # Rewritten by Akim Demaille . @@ -29,23 +26,13 @@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; es BEGIN { - my $datadir = $ENV{'autom4te_perllibdir'} || '/usr/share/autoconf'; - 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'); + my $perllibdir = $ENV{'autom4te_perllibdir'} || "/usr/share/autoconf"; + unshift @INC, "$perllibdir"; } -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::Configure_ac; -use Autom4te::FileUtils; +use File::Basename; use Autom4te::General; use Autom4te::XFile; -use File::Basename; use strict; # Lib files. @@ -56,7 +43,7 @@ my @prepend_include; my @include = ('/usr/share/autoconf'); my $force = 0; # m4. -my $m4 = $ENV{"M4"} || '/bin/m4'; +my $m4 = $ENV{"M4"} || "/bin/m4"; # $HELP @@ -83,13 +70,12 @@ Report bugs to . # $VERSION # -------- -$version = "autoupdate (GNU Autoconf) 2.61 -Copyright (C) 2006 Free Software Foundation, Inc. -This is free software. You may redistribute copies of it under the terms of -the GNU General Public License . -There is NO WARRANTY, to the extent permitted by law. - +$version = "autoupdate (GNU Autoconf) 2.56 Written by David J. MacKenzie and Akim Demaille. + +Copyright 2002 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. "; ## ---------- ## @@ -110,67 +96,105 @@ sub parse_args () if (! @ARGV) { - my $configure_ac = require_configure_ac; + my $configure_ac = find_configure_ac; + error "no input file" + unless $configure_ac; push @ARGV, $configure_ac; } } +# ------------- # +# M4 builtins. # +# ------------- # + +my @m4_builtins; + +# &handle_m4_symbols () +# --------------------- +# Create the following $tmp files: +# m4.m4 -- enable the m4 builtins. +# unm4.m4 -- disable the m4 builtins. +# savem4.m4 -- save the m4 builtins. +sub handle_m4_macros () +{ + # Get the list of builtins. + xsystem ("echo dumpdef | $m4 2>$tmp/m4.defs >/dev/null"); + my $m4_defs = new Autom4te::XFile "$tmp/m4.defs"; + while ($_ = $m4_defs->getline) + { + push @m4_builtins, $1 + if /^(\w+):/; + } + $m4_defs->close; + + # Output the files. + my $m4_m4 = new Autom4te::XFile ">$tmp/m4.m4"; + print $m4_m4 "# m4.m4 -- enable the m4 builtins.\n"; + my $unm4_m4 = new Autom4te::XFile ">$tmp/unm4.m4"; + print $unm4_m4 "# unm4.m4 -- disable the m4 builtins.\n"; + print $unm4_m4 "# Because Autoconf, via M4sugar, redefines some of these\n"; + print $unm4_m4 "# macros, and therefore since unac.m4 disables them,\n"; + print $unm4_m4 "# disable only if defined.\n"; + my $m4save_m4 = new Autom4te::XFile ">$tmp/m4save.m4"; + print $m4save_m4 "# savem4.m4 -- save the m4 builtins.\n"; + foreach (@m4_builtins) + { + print $m4save_m4 "define([_au_$_], defn([$_]))\n"; + print $unm4_m4 "_au_ifdef([$_], [_au_undefine([$_])])\n"; + print $m4_m4 "_au_define([$_], _au_defn([_au_$_]))\n"; + } +} + + # ----------------- # # Autoconf macros. # # ----------------- # -my (%ac_macros, %au_macros, %m4_builtins); + +# @AU_MACROS & AC_MACROS -- AU and AC macros and yet another useful comment. +my (%ac_macros, %au_macros); + # HANDLE_AUTOCONF_MACROS () # ------------------------- # @M4_BUILTINS -- M4 builtins and a useful comment. sub handle_autoconf_macros () { - # Get the builtins. - xsystem ("echo dumpdef | $m4 2>$tmp/m4.defs >/dev/null"); - my $m4_defs = new Autom4te::XFile "$tmp/m4.defs"; - while ($_ = $m4_defs->getline) - { - $m4_builtins{$1} = 1 - if /^(\w+):/; - } - $m4_defs->close; - my $macros = new Autom4te::XFile ("$autoconf" - . " --trace AU_DEFINE:'AU:\$f:\$1'" - . " --trace define:'AC:\$f:\$1'" - . " --melt /dev/null |"); + . " --trace AU_DEFUN:'AU:\$f:\$1'" + . " --trace define:'AC:\$f:\$1'" + . " --melt /dev/null |"); while ($_ = $macros->getline) { chomp; my ($domain, $file, $macro) = /^(AC|AU):(.*):([^:]*)$/ or next; - if ($domain eq "AU") - { - $au_macros{$macro} = 1; - } - elsif ($file =~ /(^|\/)m4sugar\/(m4sugar|version)\.m4$/) + # ../lib/m4sugar/m4sugar.m4 -> m4sugar + # ../lib/autoconf/general.m4 -> autoconf + # aclocal.m4 -> aclocal + my $set = basename (dirname ($file)); + $set = 'aclocal' if $file eq 'aclocal.m4'; + error "unknown set: $set: $_" + unless $set =~ /^(m4sugar|aclocal|autoconf)$/; + if ($domain eq "AC") { - # Add the m4sugar macros to m4_builtins. - $m4_builtins{$macro} = 1; + $ac_macros{$macro} = $set; } else { - # Autoconf, aclocal, and m4sh macros. - $ac_macros{$macro} = 1; + $au_macros{$macro} = $set; } } $macros->close; - # Don't keep AU macros in @AC_MACROS. delete $ac_macros{$_} foreach (keys %au_macros); # Don't keep M4sugar macros which are redefined by Autoconf, # such as `builtin', `changequote' etc. See autoconf/autoconf.m4. delete $ac_macros{$_} - foreach (keys %m4_builtins); + foreach (@m4_builtins); error "no current Autoconf macros found" unless keys %ac_macros; error "no obsolete Autoconf macros found" @@ -190,26 +214,10 @@ sub handle_autoconf_macros () print $ac_m4 "# ac.m4 -- autoquoting definitions of the AC macros.\n"; my $unac_m4 = new Autom4te::XFile ">$tmp/unac.m4"; print $unac_m4 "# unac.m4 -- undefine the AC macros.\n"; - foreach (sort keys %ac_macros) + foreach (sort grep { $ac_macros{$_} ne 'm4sugar' } keys %ac_macros) { - print $ac_m4 "_au_m4_define([$_], [m4_if(\$#, 0, [[\$0]], [[\$0(\$\@)]])])\n"; - print $unac_m4 "_au_m4_undefine([$_])\n"; - } - - # m4save.m4 -- save the m4 builtins. - # unm4.m4 -- disable the m4 builtins. - # m4.m4 -- enable the m4 builtins. - my $m4save_m4 = new Autom4te::XFile ">$tmp/m4save.m4"; - print $m4save_m4 "# m4save.m4 -- save the m4 builtins.\n"; - my $unm4_m4 = new Autom4te::XFile ">$tmp/unm4.m4"; - print $unm4_m4 "# unm4.m4 -- disable the m4 builtins.\n"; - my $m4_m4 = new Autom4te::XFile ">$tmp/m4.m4"; - print $m4_m4 "# m4.m4 -- enable the m4 builtins.\n"; - foreach (sort keys %m4_builtins) - { - print $m4save_m4 "_au__save([$_])\n"; - print $unm4_m4 "_au__undefine([$_])\n"; - print $m4_m4 "_au__restore([$_])\n"; + print $ac_m4 "_au_define([$_], [[\$0(\$\@)]])\n"; + print $unac_m4 "_au_undefine([$_])\n"; } } @@ -226,14 +234,15 @@ $autoconf .= join (' --include=', '', @include); $autoconf .= join (' --prepend-include=', '', @prepend_include); mktmpdir ('au'); +handle_m4_macros; handle_autoconf_macros; # $au_changequote -- enable the quote `[', `]' right before any AU macro. my $au_changequote = - 's/\b(' . join ('|', keys %au_macros) . ')\b/_au_m4_changequote([,])$1/g'; + 's/\b(' . join ('|', keys %au_macros) . ')\b/_au_changequote([,])$1/g'; # au.m4 -- definitions the AU macros. -xsystem ("$autoconf --trace AU_DEFINE:'_au_defun(\@<:\@\$1\@:>\@, +xsystem ("$autoconf --trace AU_DEFUN:'_au_defun(\@<:\@\$1\@:>\@, \@<:\@\$2\@:>\@)' --melt /dev/null " . ">$tmp/au.m4"); @@ -245,6 +254,7 @@ xsystem ("$autoconf --trace AU_DEFINE:'_au_defun(\@<:\@\$1\@:>\@, foreach my $file (@ARGV) { + my $filename = $file; # We need an actual file. if ($file eq '-') { @@ -261,41 +271,22 @@ foreach my $file (@ARGV) # input file. my $input_m4 = <<\EOF; divert(-1) -*- Autoconf -*- - changequote([,]) - - # Define our special macros: - define([_au__defn], defn([defn])) - define([_au__divert], defn([divert])) - define([_au__include], defn([include])) - define([_au__undefine], defn([undefine])) - define([_au__save], [m4_ifdef([$1], [m4_copy([$1], [_au_$1])])]) - define([_au__restore], - [_au_m4_ifdef([_au_$1], - [_au_m4_define([$1], _au__defn([_au_$1]))])]) - - # Set up m4sugar. - include(m4sugar/m4sugar.m4) - - # Redefine __file__ to make warnings nicer; $file is replaced below. - m4_define([__file__], [$file]) - - # Redefine m4_location to fix the line number. - m4_define([m4_location], [__file__:m4_eval(__line__ - _au__first_line)]) + changequote([, ]) # Move all the builtins into the `_au_' pseudo namespace - m4_include([m4save.m4]) + include([m4save.m4]) # _au_defun(NAME, BODY) # --------------------- # Define NAME to BODY, plus AU activation/deactivation. - _au_m4_define([_au_defun], - [_au_m4_define([$1], + _au_define([_au_defun], + [_au_define([$1], [_au_enable()dnl $2[]dnl _au_disable()])]) # Import the definition of the obsolete macros. - _au__include([au.m4]) + _au_include([au.m4]) ## ------------------------ ## @@ -313,69 +304,72 @@ foreach my $file (@ARGV) # __au_enable # ----------- - # Reenable the builtins, m4sugar, and the autoquoting AC macros. - _au_m4_define([__au_enable], - [_au__divert(-1) + # Reenable the builtins, and m4sugar. + _au_define([__au_enable], + [_au_divert(-1) # Enable special characters. - _au_m4_changecom([#]) + _au_changecom([#]) - _au__include([m4.m4]) - _au__include([ac.m4]) + # Enable the m4 builtins, m4sugar and the autoquoting AC macros. + _au_include([m4.m4]) + _au_include([m4sugar/m4sugar.m4]) + _au_include([ac.m4]) - _au__divert(0)]) + _au_divert(0)]) # _au_enable # ---------- - # Called at the beginning of all the obsolete macros. If this is the - # outermost level, call __au_enable. - _au_m4_define([_au_enable], - [_au_m4_ifdef([_au_enabled], - [], - [__au_enable()])_au_dnl - _au_m4_pushdef([_au_enabled])]) + # Called at the beginning of all the obsolete macros. Reenable the + # builtins, and m4sugar if needed. + _au_define([_au_enable], + [_au_ifdef([_au_enabled], + [], + [__au_enable()])_au_dnl + _au_pushdef([_au_enabled])]) # __au_disable # ------------ - # Disable the AC autoquoting macros, m4sugar, and m4. - _au_m4_define([__au_disable], - [_au__divert(-1) - _au__include([unac.m4]) - _au__include([unm4.m4]) + # Disable the builtins, and m4sugar. + _au_define([__au_disable], + [_au_divert(-1) + # Disable m4sugar, the AC autoquoting macros, and m4. + _au_include([unac.m4]) + _au_include([unm4.m4]) # Disable special characters. - _au_m4_changequote() - _au_m4_changecom() + _au_changequote() + _au_changecom() - _au__divert(0)]) + _au_divert(0)]) # _au_disable # ----------- - # Called at the end of all the obsolete macros. If we are at the - # outermost level, call __au_disable. - _au_m4_define([_au_disable], - [_au_m4_popdef([_au_enabled])_au_dnl - _au_m4_ifdef([_au_enabled], - [], - [__au_disable()])]) + # Called at the end of all the obsolete macros. Disable the + # builtins, and m4sugar if needed.. + _au_define([_au_disable], + [_au_popdef([_au_enabled])_au_dnl + _au_ifdef([_au_enabled], + [], + [__au_disable()])]) ## ------------------------------- ## ## Disable, and process the file. ## ## ------------------------------- ## - # The AC autoquoting macros are not loaded yet, hence invoking - # `_au_disable' would be wrong. - _au__include([unm4.m4]) + _au_divert(-1) + # Disable m4: M4sugar and the AC autoquoting macros are not loaded yet, + # hence invoking `_au_disable' is wrong. + _au_include([unm4.m4]) - # Disable special characters, and set the first line number. - _au_m4_changequote() - _au_m4_changecom() + # Disable special characters. + _au_changequote() + _au_changecom() - _au_m4_define(_au__first_line, _au___line__)_au__divert(0)_au_dnl + _au_divert(0)_au_dnl EOF $input_m4 =~ s/^ //mg; - $input_m4 =~ s/\$file/$file/g; # prepared input -- input, but reenables the quote before each AU macro. open INPUT_M4, ">$tmp/input.m4" @@ -404,14 +398,14 @@ EOF exit 0; -# ## ---------------------------- ## -# ## How `autoupdate' functions. ## -# ## ---------------------------- ## +# ## ---------------------------- ## +# ## How `autoupdate' functions. ## +# ## ---------------------------- ## # # The task of `autoupdate' is not trivial: the biggest difficulty being # that you must limit the changes to the parts that really need to be # updated. Finding a satisfying implementation proved to be quite hard, -# as this is the fifth implementation of `autoupdate'. +# as this is the fourth implementation of `autoupdate'. # # Below, we will use a simple example of obsolete macro: # @@ -544,13 +538,13 @@ exit 0; # You first think to design AU_DEFUN like this: # # 1. AC_DEFUN(OLD-NAME, -# [Warn the user OLD-NAME is obsolete. -# NEW-CODE]) +# [Warn the user OLD-NAME is obsolete. +# NEW-CODE]) # # 2. Store for late AU binding([define(OLD_NAME, -# [Reestablish the quotes. -# NEW-CODE -# Disable the quotes.])]) +# [Reestablish the quotes. +# NEW-CODE +# Disable the quotes.])]) # # but this will not work: NEW-CODE has probably $1, $2 etc. and these # guys will be replaced with the argument of `Store for late AU binding' @@ -594,7 +588,7 @@ exit 0; # strings which can become quickly huge, which slows it significantly. # # In particular one should avoid as much as possible to use `define' for -# temporaries. Now that `define' has quite a complex meaning, it is an +# temporaries. Now that `define' as quite a complex meaning, it is an # expensive operations that should be limited to macros. Use # `m4_define' for temporaries. # @@ -659,14 +653,14 @@ exit 0; # dnl The Unbelievable Truth # changequote([, ])OLD(1, 2) # NEW([0, 0], -# 0) +# 0) # # which will result in # # dnl The Unbelievable Truth # NEW(1, 2, m4_eval(1 + 2)) # NEW([0, 0], -# 0) +# 0) # # Grpmh. Two problems. A minor problem: it would have been much better # to have the `m4_eval' computed, and a major problem: you lost the @@ -689,7 +683,7 @@ exit 0; # dnl The Unbelievable Truth # changequote([, ])OLD(1, 2) # changequote([, ])NEW([0, 0], -# 0) +# 0) # # which results in # @@ -709,7 +703,7 @@ exit 0; # No big deal for the semantics (unless the macro depends upon $#, which # is bad), but the users would not be happy. # -# Additionally, we introduced quotes that were not there before, which is +# Additionally, we introduced quotes that we not there before, which is # OK in most cases, but could change the semantics of the file. # # Cruel dilemma: we do want the auto-quoting definition of `NEW' when @@ -737,7 +731,7 @@ exit 0; # dnl The Unbelievable Truth # changequote([, ])OLD(1, 2) # NEW([0, 0], -# 0) +# 0) # # i.e., the new value of `OLD' is precomputed using the auto-quoting # definition of `NEW' and the m4 builtins. We'll see how afterwards, @@ -759,7 +753,7 @@ exit 0; # dnl The Unbelievable Truth # changequote([, ])OLD(1, 2) # NEW([0, 0], -# 0) +# 0) # # i.e., for each call to obsolete macros, we build an array `call => # value', and use a macro to dispatch these values. This results in: @@ -767,7 +761,7 @@ exit 0; # dnl The Unbelievable Truth # NEW([1, 2], [3]) # NEW([0, 0], -# 0) +# 0) # # In French, we say `Youpi !', which you might roughly translate as # `Yippee!'. @@ -795,7 +789,7 @@ exit 0; # dnl The Unbelievable Truth # changequote([, ])OLD(1, 2) # NEW([0, 0], -# 0) +# 0) # # # # Computing the `values' section @@ -867,7 +861,7 @@ exit 0; # dnl The Unbelievable Truth # changequote([, ])OLD(1, 2) # NEW([0, 0], -# 0) +# 0) # # And we just run m4 on it. Et voila`, Monsieur ! Mais oui, mais oui. # @@ -881,10 +875,10 @@ exit 0; # # ------------------------------ # # This approach is heavily based on traces, but then there is an obvious -# problem: non expanded code will never be seen. In particular, the body +# problem: non expanded code will never be seen/ In particular, the body # of a `define' definition is not seen, so on the input # -# define([idem], [OLD(0, [$1])]) +# define([idem], [OLD(0, [$1])]) # # autoupdate would never see the `OLD', and wouldn't have updated it. # Worse yet, if `idem(0)' was used later, then autoupdate sees that @@ -893,7 +887,7 @@ exit 0; # [$1])', the dispatcher would have replaced with... nothing, leading # to # -# define([idem], []) +# define([idem], []) # # With some more thinking, you see that the two step approach is wrong, # the namespace approach was much saner. @@ -947,11 +941,11 @@ exit 0; # this: # # `m4save.m4' -# moves the m4 builtins into the `_au_' pseudo namespace, +# moves the m4 builtins into the `_au_' pseudo namespace # `unm4.m4' -# undefines the builtins, +# undefines the builtins # `m4.m4' -# restores them. +# restores them # # So `input.m4' is: # diff --git a/bin/ifnames b/bin/ifnames index 503ce427..b4e784b4 100644 --- a/bin/ifnames +++ b/bin/ifnames @@ -1,14 +1,14 @@ #! /bin/perl -w # -*- perl -*- -# Generated from ifnames.in; do not edit by hand. +# @configure_input@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; esac' if 0; # ifnames - print the identifiers used in C preprocessor conditionals -# Copyright (C) 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2005, 2006 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1999, 2000, 2001, 2002 Free Software +# Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,8 +22,8 @@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; es # 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. # Reads from stdin if no files are given. # Writes to stdout. @@ -33,14 +33,8 @@ eval 'case $# in 0) exec /bin/perl -S "$0";; *) exec /bin/perl -S "$0" "$@";; es BEGIN { - my $datadir = $ENV{'autom4te_perllibdir'} || '/usr/share/autoconf'; - 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'); + my $datadir = ($ENV{'autom4te_perllibdir'} || '/usr/share/autoconf'); + unshift @INC, "$datadir"; } use Autom4te::General; @@ -59,20 +53,18 @@ space-separated list of the files in which that identifier occurs. -h, --help print this help, then exit -V, --version print version number, then exit -Report bugs to . -"; +Report bugs to ."; # $VERSION # -------- -$version = "ifnames (GNU Autoconf) 2.61 -Copyright (C) 2006 Free Software Foundation, Inc. -This is free software. You may redistribute copies of it under the terms of -the GNU General Public License . -There is NO WARRANTY, to the extent permitted by law. - +$version = "\ +ifnames (GNU Autoconf) 2.56 Written by David J. MacKenzie and Paul Eggert. -"; + +Copyright 2002 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."; # &parse_args () @@ -89,12 +81,12 @@ sub parse_args () my %occurrence; -# &scan_file ($FILE-NAME) -# ----------------------- +# &scan_file ($FILENAME) +# ---------------------- sub scan_file ($) { - my ($file_name) = @_; - my $file = new Autom4te::XFile ($file_name); + my ($filename) = @_; + my $file = new Autom4te::XFile ($filename); while ($_ = $file->getline) { # Continuation lines. @@ -107,12 +99,11 @@ sub scan_file ($) # Remove comments. Not perfect, but close enough. s(/\*.*?\*/)(); s(/\*.*)(); - s(//.*)(); foreach my $word (split (/\W+/)) { next if $word eq 'defined' || $word !~ /^[a-zA-Z_]/; - $occurrence{$word}{$file_name} = 1; + $occurrence{$word}{$filename} = 1; } } } diff --git a/bin/rcp.exe b/bin/rcp.exe new file mode 100644 index 0000000000000000000000000000000000000000..66702cda16ccbcffc17538e8aa83a10e96589df8 GIT binary patch literal 42735 zcwX&&4}4VBndq5h0wDw@0xBZHSV2LDkjzZ}5zt^V3N`3J0#XIXNoJB6n9RhPJN)s1 zrcF{EhivI9Y;B8Mt#pf9wq>{2qD76u8oP_T)bd(dY3uIN-Qk6|%hs%>nlkVEzH`p~ zGdBdyzUOb>zFxRF-~G;azJKRCfA5`pSKYUpaW0ya=;G8=5#i{J@ zq&KfWVrhKy`sPqLVegE`+T;EXd#gVhjVbn)pgo?9+QU(M!#z#*j#waAI%P`HJi){3 zVXVTdytKKbRk`sGbEeAb~XXdY9n18(j^ps3&0IUydW!v^Hw8WULm`k z=n_i&sX2hy%}8nXX)_)B!||W;SeyDy_xYLK%b2&0F~xG?=Q}Uje&D${zyCru+m`as z#gyBiCE>--J1%w~9}4X$sbiV<=QEZ%zwub#78Yphj4MoO?PQ5iFcM+&6N}+ui9H$J z9F1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Y4RoR>k&qLK4ZUz5udDR(0c4n{IM#JXRS3Y0a{KrDts~z!YCF0{u3|}MC7L1oV-74rRXFgo{!DXq-$?&Bw`1|!z zmkWR81M}J#1PH#2r85=M?FrgUpb4~4pVFyqA;*6Ar*&VTHT{Sbj z_>yBwTU%AM+*!;;ICBx@xrj1+OT=2=JxR4)Sk$HRyCpDlT6&Lc8G`>rJU&qJaBN1yu z-C8%3N5hJy6Afv(MB>9;MAhNn6pKTwwD4f@(RaUMQOr}n`s4G3=-2+ij!syG`uuwR zm@oIkLv?P|>EaVL;*u5)J|Cf zv^xKbuLNNOLbpTtu)jk#;M{L1<;Jf1y&u6%S0faUd^R95`DkePd9G@z=tH^l4W;-v zt5q0ICVZnZkspoH(Q0)oCW$_JN!w_Ske?`$&4W)jWc-<&&t1o9$YIn2Zb6?!Rbz;3 z)bJanb+#Fcsh^C}yEZq(^bJL8B0841W|J3ux-HpB`?&Gqn^3B=_-DB!ZEh5B^jM7^ z2$Jz2{ytmhUqh(S?t{$JT*lqagIn+MNX#Dq3G~)I%|NvnwSQ=sn?b{1#O0(ufVZ1b dyAF|OmLnq7SQoNk83Y)605K8QRh!D>e*?F&fullnamemailaddr triplets +logTZ= # time zone for log dates (if empty, use local time) +recursive= # t if we want recursive rlog +revision= # t if we want revision numbers +rlog_options= # options to pass to rlog +tabwidth=8 # width of horizontal tab + +while : +do + case $1 in + -c) changelog=${2?}; shift;; + -i) indent=${2?}; shift;; + -h) hostname=${2?}; shift;; + -l) length=${2?}; shift;; + -[nu]) # -n is obsolescent; it is replaced by -u. + case $1 in + -n) case ${2?}${3?}${4?} in + *"$tab"* | *"$nl"*) + echo >&2 "$0: -n '$2' '$3' '$4': tabs, newlines not allowed" + exit 1 + esac + case $loginFullnameMailaddrs in + '') loginFullnameMailaddrs=$2$tab$3$tab$4;; + ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2$tab$3$tab$4 + esac + shift; shift; shift;; + -u) + # If $2 is not tab-separated, use colon for separator. + case ${2?} in + *"$nl"*) + echo >&2 "$0: -u '$2': newlines not allowed" + exit 1;; + *"$tab"*) + t=$tab;; + *) + t=: + esac + case $2 in + *"$t"*"$t"*"$t"*) + echo >&2 "$0: -u '$2': too many fields" + exit 1;; + *"$t"*"$t"*) + ;; + *) + echo >&2 "$0: -u '$2': not enough fields" + exit 1 + esac + case $loginFullnameMailaddrs in + '') loginFullnameMailaddrs=$2;; + ?*) loginFullnameMailaddrs=$loginFullnameMailaddrs$nl$2 + esac + shift + esac + case $logins in + '') logins=$login;; + ?*) logins=$logins$nl$login + esac + ;; + -r) + case $rlog_options in + '') rlog_options=${2?};; + ?*) rlog_options=$rlog_options$nl${2?} + esac + shift;; + -R) recursive=t;; + -t) tabwidth=${2?}; shift;; + -v) revision=t;; + --version) + set $Id + rcs2logVersion=$3 + echo >&2 "rcs2log (GNU Emacs) $rcs2logVersion$nl$Copyright" + exit 0;; + -*) echo >&2 "Usage: $0 [OPTION]... [FILE ...]$nl$Help" + case $1 in + --help) exit 0;; + *) exit 1 + esac;; + *) break + esac + shift +done + +month_data=' + m[0]="Jan"; m[1]="Feb"; m[2]="Mar" + m[3]="Apr"; m[4]="May"; m[5]="Jun" + m[6]="Jul"; m[7]="Aug"; m[8]="Sep" + m[9]="Oct"; m[10]="Nov"; m[11]="Dec" +' + + +# Put rlog output into $rlogout. + +# If no rlog options are given, +# log the revisions checked in since the first ChangeLog entry. +# Since ChangeLog is only by date, some of these revisions may be duplicates of +# what's already in ChangeLog; it's the user's responsibility to remove them. +case $rlog_options in +'') + if test -s "$changelog" + then + e=' + /^[0-9]+-[0-9][0-9]-[0-9][0-9]/{ + # ISO 8601 date + print $1 + exit + } + /^... ... [ 0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]+ /{ + # old-fashioned date and time (Emacs 19.31 and earlier) + '"$month_data"' + year = $5 + for (i=0; i<=11; i++) if (m[i] == $2) break + dd = $3 + printf "%d-%02d-%02d\n", year, i+1, dd + exit + } + ' + d=`$AWK "$e" <"$changelog"` || exit + case $d in + ?*) datearg="-d>$d" + esac + fi +esac + +# Use TZ specified by ChangeLog local variable, if any. +if test -s "$changelog" +then + extractTZ=' + /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*"\([^"]*\)".*/{ + s//\1/; p; q + } + /^.*change-log-time-zone-rule['"$tab"' ]*:['"$tab"' ]*t.*/{ + s//UTC0/; p; q + } + ' + logTZ=`tail "$changelog" | sed -n "$extractTZ"` + case $logTZ in + ?*) TZ=$logTZ; export TZ + esac +fi + +# If CVS is in use, examine its repository, not the normal RCS files. +if test ! -f CVS/Repository +then + rlog=rlog + repository= +else + rlog='cvs -q log' + repository=`sed 1q &2 "$0: $repository: bad repository (see CVS/Repository)" + exit 1 + fi + esac +fi + +# Use $rlog's -zLT option, if $rlog supports it. +case `$rlog -zLT 2>&1` in +*' option'*) ;; +*) + case $rlog_options in + '') rlog_options=-zLT;; + ?*) rlog_options=-zLT$nl$rlog_options + esac +esac + +# With no arguments, examine all files under the RCS directory. +case $# in +0) + case $repository in + '') + oldIFS=$IFS + IFS=$nl + case $recursive in + t) + RCSdirs=`find . -name RCS -type d -print` + filesFromRCSfiles='s|,v$||; s|/RCS/|/|; s|^\./||' + files=` + { + case $RCSdirs in + ?*) find $RCSdirs \ + -type f \ + ! -name '*_' \ + ! -name ',*,' \ + ! -name '.*_' \ + ! -name .rcsfreeze.log \ + ! -name .rcsfreeze.ver \ + -print + esac + find . -name '*,v' -print + } | + sort -u | + sed "$filesFromRCSfiles" + `;; + *) + files= + for file in RCS/.* RCS/* .*,v *,v + do + case $file in + RCS/. | RCS/.. | RCS/,*, | RCS/*_) continue;; + RCS/.rcsfreeze.log | RCS/.rcsfreeze.ver) continue;; + RCS/.\* | RCS/\* | .\*,v | \*,v) test -f "$file" || continue;; + RCS/*,v | RCS/.*,v) ;; + RCS/* | RCS/.*) test -f "$file" || continue + esac + case $files in + '') files=$file;; + ?*) files=$files$nl$file + esac + done + case $files in + '') exit 0 + esac + esac + set x $files + shift + IFS=$oldIFS + esac +esac + +llogout=$TMPDIR/rcs2log$$l +rlogout=$TMPDIR/rcs2log$$r +trap exit 1 2 13 15 +trap "rm -f $llogout $rlogout; exit 1" 0 + +case $datearg in +?*) $rlog $rlog_options "$datearg" ${1+"$@"} >$rlogout;; +'') $rlog $rlog_options ${1+"$@"} >$rlogout +esac || exit + + +# Get the full name of each author the logs mention, and set initialize_fullname +# to awk code that initializes the `fullname' awk associative array. +# Warning: foreign authors (i.e. not known in the passwd file) are mishandled; +# you have to fix the resulting output by hand. + +initialize_fullname= +initialize_mailaddr= + +case $loginFullnameMailaddrs in +?*) + case $loginFullnameMailaddrs in + *\"* | *\\*) + sed 's/["\\]/\\&/g' >$llogout <$llogout </dev/null | + $AWK -F: "$awkscript" + `$initialize_fullname +esac + + +# Function to print a single log line. +# We don't use awk functions, to stay compatible with old awk versions. +# `Log' is the log message (with \n replaced by \001). +# `files' contains the affected files. +printlogline='{ + + # Following the GNU coding standards, rewrite + # * file: (function): comment + # to + # * file (function): comment + if (Log ~ /^\([^)]*\): /) { + i = index(Log, ")") + files = files " " substr(Log, 1, i) + Log = substr(Log, i+3) + } + + # If "label: comment" is too long, break the line after the ":". + sep = " " + if ('"$length"' <= '"$indent"' + 1 + length(files) + index(Log, SOH)) sep = "\n" indent_string + + # Print the label. + printf "%s*%s:", indent_string, files + + # Print each line of the log, transliterating \001 to \n. + while ((i = index(Log, SOH)) != 0) { + logline = substr(Log, 1, i-1) + if (logline ~ /[^'"$tab"' ]/) { + printf "%s%s\n", sep, logline + } else { + print "" + } + sep = indent_string + Log = substr(Log, i+1) + } +}' + +# Pattern to match the `revision' line of rlog output. +rlog_revision_pattern='^revision [0-9]+\.[0-9]+(\.[0-9]+\.[0-9]+)*(['"$tab"' ]+locked by: [^'"$tab"' $,.0-9:;@]*[^'"$tab"' $,:;@][^'"$tab"' $,.0-9:;@]*;)?['"$tab"' ]*$' + +case $hostname in +'') + hostname=`( + hostname || uname -n || uuname -l || cat /etc/whoami + ) 2>/dev/null` || { + echo >&2 "$0: cannot deduce hostname" + exit 1 + } + + case $hostname in + *.*) ;; + *) + domainname=`(domainname) 2>/dev/null` && + case $domainname in + *.*) hostname=$hostname.$domainname + esac + esac +esac + + +# Process the rlog output, generating ChangeLog style entries. + +# First, reformat the rlog output so that each line contains one log entry. +# Transliterate \n to \001 so that multiline entries fit on a single line. +# Discard irrelevant rlog output. +$AWK <$rlogout ' + BEGIN { repository = "'"$repository"'" } + /^RCS file:/ { + if (repository != "") { + filename = $3 + if (substr(filename, 1, length(repository) + 1) == repository "/") { + filename = substr(filename, length(repository) + 2) + } + if (filename ~ /,v$/) { + filename = substr(filename, 1, length(filename) - 2) + } + if (filename ~ /(^|\/)Attic\/[^\/]*$/) { + i = length(filename) + while (substr(filename, i, 1) != "/") i-- + filename = substr(filename, 1, i - 6) substr(filename, i + 1) + } + } + rev = "?" + } + /^Working file:/ { if (repository == "") filename = $3 } + /'"$rlog_revision_pattern"'/, /^(-----------*|===========*)$/ { + line = $0 + if (line ~ /'"$rlog_revision_pattern"'/) { + rev = $2 + next + } + if (line ~ /^date: [0-9][- +\/0-9:]*;/) { + date = $2 + if (date ~ /\//) { + # This is a traditional RCS format date YYYY/MM/DD. + # Replace "/"s with "-"s to get ISO format. + newdate = "" + while ((i = index(date, "/")) != 0) { + newdate = newdate substr(date, 1, i-1) "-" + date = substr(date, i+1) + } + date = newdate date + } + time = substr($3, 1, length($3) - 1) + author = substr($5, 1, length($5)-1) + printf "%s %s %s %s %s %c", filename, rev, date, time, author, 1 + rev = "?" + next + } + if (line ~ /^branches: /) { next } + if (line ~ /^(-----------*|===========*)$/) { print ""; next } + if (line == "Initial revision" || line ~ /^file .+ was initially added on branch .+\.$/) { + line = "New file." + } + printf "%s%c", line, 1 + } +' | + +# Now each line is of the form +# FILENAME REVISION YYYY-MM-DD HH:MM:SS[+-TIMEZONE] AUTHOR \001LOG +# where \001 stands for a carriage return, +# and each line of the log is terminated by \001 instead of \n. +# Sort the log entries, first by date+time (in reverse order), +# then by author, then by log entry, and finally by file name and revision +# (just in case). +sort +2 -4r +4 +0 | + +# Finally, reformat the sorted log entries. +$AWK ' + BEGIN { + logTZ = "'"$logTZ"'" + revision = "'"$revision"'" + + # Some awk variants do not understand "\001", so we have to + # put the char directly in the file. + SOH="" # <-- There is a single SOH (octal code 001) here. + + # Initialize the fullname and mailaddr associative arrays. + '"$initialize_fullname"' + '"$initialize_mailaddr"' + + # Initialize indent string. + indent_string = "" + i = '"$indent"' + if (0 < '"$tabwidth"') + for (; '"$tabwidth"' <= i; i -= '"$tabwidth"') + indent_string = indent_string "\t" + while (1 <= i--) + indent_string = indent_string " " + } + + { + newlog = substr($0, 1 + index($0, SOH)) + + # Ignore log entries prefixed by "#". + if (newlog ~ /^#/) { next } + + if (Log != newlog || date != $3 || author != $5) { + + # The previous log and this log differ. + + # Print the old log. + if (date != "") '"$printlogline"' + + # Logs that begin with "{clumpname} " should be grouped together, + # and the clumpname should be removed. + # Extract the new clumpname from the log header, + # and use it to decide whether to output a blank line. + newclumpname = "" + sep = "\n" + if (date == "") sep = "" + if (newlog ~ /^\{[^'"$tab"' }]*}['"$tab"' ]/) { + i = index(newlog, "}") + newclumpname = substr(newlog, 1, i) + while (substr(newlog, i+1) ~ /^['"$tab"' ]/) i++ + newlog = substr(newlog, i+1) + if (clumpname == newclumpname) sep = "" + } + printf sep + clumpname = newclumpname + + # Get ready for the next log. + Log = newlog + if (files != "") + for (i in filesknown) + filesknown[i] = 0 + files = "" + } + if (date != $3 || author != $5) { + # The previous date+author and this date+author differ. + # Print the new one. + date = $3 + time = $4 + author = $5 + + zone = "" + if (logTZ && ((i = index(time, "-")) || (i = index(time, "+")))) + zone = " " substr(time, i) + + # Print "date[ timezone] fullname ". + # Get fullname and email address from associative arrays; + # default to author and author@hostname if not in arrays. + if (fullname[author]) + auth = fullname[author] + else + auth = author + printf "%s%s %s ", date, zone, auth + if (mailaddr[author]) + printf "<%s>\n\n", mailaddr[author] + else + printf "<%s@%s>\n\n", author, "'"$hostname"'" + } + if (! filesknown[$1]) { + filesknown[$1] = 1 + if (files == "") files = " " $1 + else files = files ", " $1 + if (revision && $2 != "?") files = files " " $2 + } + } + END { + # Print the last log. + if (date != "") { + '"$printlogline"' + printf "\n" + } + } +' && + + +# Exit successfully. + +exec rm -f $llogout $rlogout + +# Local Variables: +# tab-width:4 +# End: diff --git a/bin/rlogin.exe b/bin/rlogin.exe new file mode 100644 index 0000000000000000000000000000000000000000..7952e940e3157e488c034eec0dfbbe9bb69904a4 GIT binary patch literal 11776 zcwX%~4Rlo1nRoueWHMm}2pBQKLkNP9kO*u;2r>|+>KfWHA)yr_#K|KwaWWHU-UC93 z3=X4=kEz)n>CtYjQ1EY;?Q*O?p$dkC&EVE*^mw``S*2CG4+pzevoK(q+3&mezDdA< z?b&lYXWPD$Z@&BU-TVFA?|%2Y?`7p39mGHgF#@F1gme=2ILKE&VSuqye=(Lkm;I}0 zow}-DO{=FL?dJif`8lErCX{I5*cagU{h|5>llz zl8?TqUZTx=irDlyI(-?r4k~5vw9`*i_)e*@NQBVnpfCJLZTE3 zxbF_MO2P`~^4gn)S>7gpASgD@Cb6?1`}Q*xuxVD;)hP8=bp?o|81@;LIY=U^eu3eP zK1EP4ulPuIiPNZ0X5YJu&6Dk!ICM4ubyARTdOCfPaOK?eRzc=$5y=K=Qr z3FH4S@EpLgEA;;kAYrO%bx)=F(z8VzNH07C z6_w-=^3$imsbM9P6O@VA7~74@o;0afjYZNy&uy@S(rJaR zpTT4WU)qO1@q&o9;CbK_%maFi(JtAf9?ylri-}}XkK|Gr)bRzlVWOV_k?lo_Txu4y z#d?8B^sGD{yv-@IOcTd7M}MQOtJ zyM``Geb4G6lw)m`tNM7+-!C!yH8PJXHUjm9-CO%07^h*w)vWVipr}^gyPEQdcD19qJddM+?zC#=%PjZ5QnHMeRp6cRCpw|L=FWAm z_H4iq=MMP&qFeF?{DRvT2#F9V$Bfd(urSHGLh5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*L{UHk!aQ~IVh{AZFTnEww@mqdZY^-U3;C*+F0nHSskNC8OJ1_RVF z{qO3)Z=l44Z8`$}H3Y(qVvrOV0)kf*F{P0^4ZGpKNXSEm)|BosLrN4GG=M1Rea}Ee zlJ^af##Z3=fg!?s0sjkPHgT4b{Zxg1fx3wQfC%+ljcNZP0#81+nNCGU!7quv@E-7B zu~7&#dwo6_C9AQ{x3-BL*dpX-*w)-f)?*zV*6I~-e|f+th>=Er1jlyJdTSfjJ+$6N z?c9lVShO%uHDNuZ5e2Z$CO>a%PdWLxaZe;5^7Q}q?r~Lbbycpu!{G~3`8n=C4rmoR R1beY#RZ{Ptp8wnDe*k+q)+GP{ literal 0 HcwPel00001 diff --git a/bin/telnet.exe b/bin/telnet.exe new file mode 100644 index 0000000000000000000000000000000000000000..44d66b261221e56f64d8ddde385c2008ca950873 GIT binary patch literal 109127 zcwX$ieSA|z);K;%6PlKk6ex;<5TID96ex&NXr*r{poNB}Euf-?HjtLSncQ2zrBF7l zHVs*E)qQ*L1wrLmU)FV5tiob>*;ZX$>&x!4;wr2Bc5e-?taMA2O1|gJ%)Plu)8anQ z_w#(8KYoQIcV^BxbLPyT4j369MI{Jtm=#t@cODFpj76LR;g3cFy3XXy%zfwGN< zpMQkIWfRgdYn|JT&mYZ1L=B1d*MxADj36yDl${vhcSJaRHp00D`#N~ekB6_jA>9bS zqr%~|29itR+=A=TNf1%5VfA(OU^w#s|NXE0EA{?=p0ndUS%l;eB52%A5lNLUO#2?Kwwx#T&~>vSH-CerPHA;f!j?Qwqtu~}A>5cs9E63cA9wTAZH zX*r}VDaL#B$j;;(()^w#e$xP2XsQE8BGQl6As}rel{{lSVdWjwGg*XQ0jW z>E;bD9$1^oGc^0RAC;p`l;w*5Kke+W#R@7WE{yCCn@ zV@;o4Xib{8Uni`MBABwDM-|NCpAR9JYkxjSFn{`usuJ#mVKguq3L#!SBy$&_ggjdSHxg{L>+b?$V0l|L+Heo4pZ}ZP&z$V!58SUErDGKWL^cCU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hg|06V@u<(aIT%Q-lFKaW;Jo_O~iUMOsB?o-%ism+~ znaZl0IC!Bk3%3H)4qIoii*5n_x^K#{2kUC&$deZb-sh*9A*h8+k=0VRLZxSrEue@( zM)SveISt2EV|KE9eke+ct;R50<>^Cn7K^~JmI*?)+|V2-B1dDwSZP{|Qlpgz+AXAzTe7UUb zCsFQG`gXOQV`9<971>MK#Ui>8ha}E!mv2@v6uae#D!m8CsGX%WuAoi8e`5dt05EYD A(f|Me literal 0 HcwPel00001 diff --git a/bin/tftp.exe b/bin/tftp.exe new file mode 100644 index 0000000000000000000000000000000000000000..dec441580778f9a9ff90ed0f442b3abbe7c6bcf6 GIT binary patch literal 40946 zcwX&&4R{pSb?Dud1VRWTY_I{#_S%+Wu-8J`UH$PBOGt~M=4XurCbsdg+MU%dtajzy zSphECI0A=_P{Vs6jnk3@2RC&an$m^_Y!e$BV%d$;5|=N*fh2C~G|Q9Ql0=W_)e3s& zoO|#5Xav}L{qkO4GcdYm&OP^@pL_1PKQlYC;-S4Pk1>`H=g0_S#~42v*|m=ya8AAT z#i{Jbr0?E#%(48tx3xuMX;)V&*^vr%x7yj)Xm72OmgS2=q;{u_sqvUXbbd}+t76kY#D$^)v zDy?*YK2h18P9wY=?G<2S9y^dO#w#S9H^4aoPLGwY5$V!eupQtQtgnmlHmJAKISbih zqDyP3FW$nqL%6VzosRwP_qDV9*RU^*0wv9y}dm=@8x=DPq4Ye{jD zQbXO5RI-x+pvJn@F!QHU$&@Pu;lNc9p6{wi7qM_G9SWwxY8WuCu3%`BssXkYtK3U+ zE_`rpYw!BP+^@hXb5Gv}0{GAOoEnO@ls2-~+>|>Jai%v@`pObOyf6vW8?HX_tFLPL zvrZH{dQO$@I#IIkL52FG4{TDI8YR=!($Tm*Red}X*S=#F#-gP2#N3Xv$ zFp@dn>n{#$bmne`N_$QWXZ=G!G4N2|H+k9NUjJaA&woD9>pv674UuF+y+pL@#P(ak zXgLLH?S-=8KyK*-VsK$1#IHW>W31PIKGF~2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oyuu{=QMla z3YRzd8;dR&Y{Ql4WF3i&j!;7UCmF`e4EYq27D@_zBZHu1R|p5oN0v5cD5 zgnszLhBW=YA*InToe_p291O|NN6`$Hz8B6bp@9Ks&;kdofWHc$P(l~t8%7AH@I&4N z@lO~b1Ti_7+R90(<02%cd;o7vgrW(U=W_2?+SMq=aE1SJIf_1@;18(jv3I*&y5gBM zp7@~_NkzX^NhTWWndQBZ99tO*>1estJsRN|ji?@tKuKbqU5aA;W{N=a9w08rjRnjH z8fEnRDsc`9%TV4jFr+A!ANyhJsonUp35avav}Wc+S>K@mcm$W$>di8Vuf5R7s^z`mE5Z!fGy^T+~gMVk#ut6Bk0#^Q;Z1cQ!Nqn6B1h7g>HS zNnY}~m2L-GtB-Oub5Ah(fL^2BcZ4a7E*i3kYWdibz(r+?3Dfb +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +], [ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; +], +[am_cv_prog_cc_stdc="$ac_arg"; break]) +done +CC="$ac_save_CC" +]) +if test -z "$am_cv_prog_cc_stdc"; then + AC_MSG_RESULT([none needed]) +else + AC_MSG_RESULT([$am_cv_prog_cc_stdc]) +fi +case "x$am_cv_prog_cc_stdc" in + x|xno) ;; + *) CC="$CC $am_cv_prog_cc_stdc" ;; +esac +]) + +AU_DEFUN([fp_PROG_CC_STDC], [AM_PROG_CC_STDC]) diff --git a/share/aclocal-1.7/cond.m4 b/share/aclocal-1.7/cond.m4 new file mode 100644 index 00000000..09f4073d --- /dev/null +++ b/share/aclocal-1.7/cond.m4 @@ -0,0 +1,43 @@ +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 5 + +AC_PREREQ(2.52) + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[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])]) diff --git a/share/aclocal-1.7/depend.m4 b/share/aclocal-1.7/depend.m4 new file mode 100644 index 00000000..23a48d8e --- /dev/null +++ b/share/aclocal-1.7/depend.m4 @@ -0,0 +1,146 @@ +# serial 4 -*- Autoconf -*- + +# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + + +# 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 + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + echo '#include "conftest.h"' > conftest.c + echo 'int i;' > conftest.h + echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=conftest.c object=conftest.o \ + depfile=conftest.Po tmpdepfile=conftest.TPo \ + $SHELL ./depcomp $depcc -c -o conftest.o conftest.c >/dev/null 2>&1 && + grep conftest.h conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +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], +[rm -f .deps 2>/dev/null +mkdir .deps 2>/dev/null +if test -d .deps; then + DEPDIR=.deps +else + # MS-DOS does not allow filenames that begin with a dot. + DEPDIR=_deps +fi +rmdir .deps 2>/dev/null +AC_SUBST([DEPDIR]) +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking Speeds up one-time builds + --enable-dependency-tracking Do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) diff --git a/share/aclocal-1.7/depout.m4 b/share/aclocal-1.7/depout.m4 new file mode 100644 index 00000000..f1900e10 --- /dev/null +++ b/share/aclocal-1.7/depout.m4 @@ -0,0 +1,83 @@ +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +#serial 2 + +# _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 + grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue + # Extract the definition of DEP_FILES from the Makefile without + # running `make'. + DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` + test -z "$DEPDIR" && continue + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n -e '/^U = / s///p' < "$mf"` + test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" + # We invoke sed twice because it is the simplest approach to + # changing $(DEPDIR) to its actual value in the expansion. + for file in `sed -n -e ' + /^DEP_FILES = .*\\\\$/ { + s/^DEP_FILES = // + :loop + s/\\\\$// + p + n + /\\\\$/ b loop + p + } + /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`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"]) +]) diff --git a/share/aclocal-1.7/dmalloc.m4 b/share/aclocal-1.7/dmalloc.m4 new file mode 100644 index 00000000..ce96de4d --- /dev/null +++ b/share/aclocal-1.7/dmalloc.m4 @@ -0,0 +1,41 @@ +## ----------------------------------- ## +## Check if --with-dmalloc was given. ## +## From Franc,ois Pinard ## +## ----------------------------------- ## + +# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 2 + +AC_DEFUN([AM_WITH_DMALLOC], +[AC_MSG_CHECKING([if malloc debugging is wanted]) +AC_ARG_WITH(dmalloc, +[ --with-dmalloc use dmalloc, as in + http://www.dmalloc.com/dmalloc.tar.gz], +[if test "$withval" = yes; then + AC_MSG_RESULT(yes) + AC_DEFINE(WITH_DMALLOC,1, + [Define if using the dmalloc debugging malloc package]) + LIBS="$LIBS -ldmalloc" + LDFLAGS="$LDFLAGS -g" +else + AC_MSG_RESULT(no) +fi], [AC_MSG_RESULT(no)]) +]) + +AU_DEFUN([fp_WITH_DMALLOC], [AM_WITH_DMALLOC]) diff --git a/share/aclocal-1.7/gcj.m4 b/share/aclocal-1.7/gcj.m4 new file mode 100644 index 00000000..d0cdf9ab --- /dev/null +++ b/share/aclocal-1.7/gcj.m4 @@ -0,0 +1,29 @@ +# Check for Java compiler. +# For now we only handle the GNU compiler. + +# Copyright 1999, 2000, Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_GCJ],[ +AC_CHECK_PROGS(GCJ, gcj, gcj) +test -z "$GCJ" && AC_MSG_ERROR([no acceptable gcj found in \$PATH]) +if test "x${GCJFLAGS-unset}" = xunset; then + GCJFLAGS="-g -O2" +fi +AC_SUBST(GCJFLAGS) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(GCJ)]) +]) diff --git a/share/aclocal-1.7/header.m4 b/share/aclocal-1.7/header.m4 new file mode 100644 index 00000000..1850546a --- /dev/null +++ b/share/aclocal-1.7/header.m4 @@ -0,0 +1,25 @@ +# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_PREREQ([2.52]) + +# serial 6 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) diff --git a/share/aclocal-1.7/init.m4 b/share/aclocal-1.7/init.m4 new file mode 100644 index 00000000..3b74c1cb --- /dev/null +++ b/share/aclocal-1.7/init.m4 @@ -0,0 +1,121 @@ +# Do all the work for Automake. -*- Autoconf -*- + +# 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. + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# 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... + + +AC_PREREQ([2.54]) + +# Autoconf 2.50 wants to disallow AM_ names. We explicitly allow +# the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl + +# 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_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_MISSING_PROG(AMTAR, tar) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl + +_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], +[_am_stamp_count=`expr ${_am_stamp_count-0} + 1` +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) diff --git a/share/aclocal-1.7/install-sh.m4 b/share/aclocal-1.7/install-sh.m4 new file mode 100644 index 00000000..1cb183d8 --- /dev/null +++ b/share/aclocal-1.7/install-sh.m4 @@ -0,0 +1,25 @@ +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +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)]) diff --git a/share/aclocal-1.7/lex.m4 b/share/aclocal-1.7/lex.m4 new file mode 100644 index 00000000..9bde8944 --- /dev/null +++ b/share/aclocal-1.7/lex.m4 @@ -0,0 +1,34 @@ +## Replacement for AC_PROG_LEX. -*- Autoconf -*- +## by Alexandre Oliva + +# Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 3 + +AC_PREREQ(2.50) + +# AM_PROG_LEX +# ----------- +# Autoconf leaves LEX=: if lex or flex can't be found. Change that to a +# "missing" invocation, for better error output. +AC_DEFUN([AM_PROG_LEX], +[AC_REQUIRE([AM_MISSING_HAS_RUN])dnl +AC_REQUIRE([AC_PROG_LEX])dnl +if test "$LEX" = :; then + LEX=${am_missing_run}flex +fi]) diff --git a/share/aclocal-1.7/lispdir.m4 b/share/aclocal-1.7/lispdir.m4 new file mode 100644 index 00000000..42e537e6 --- /dev/null +++ b/share/aclocal-1.7/lispdir.m4 @@ -0,0 +1,66 @@ +## ------------------------ -*- Autoconf -*- +## Emacs LISP file handling +## From Ulrich Drepper +## Almost entirely rewritten by Alexandre Oliva +## ------------------------ + +# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 6 + +# AM_PATH_LISPDIR +# --------------- +AC_DEFUN([AM_PATH_LISPDIR], +[AC_ARG_WITH(lispdir, + [ --with-lispdir Override the default lisp directory ], + [ lispdir="$withval" + AC_MSG_CHECKING([where .elc files should go]) + AC_MSG_RESULT([$lispdir])], + [ + # If set to t, that means we are running in a shell under Emacs. + # If you have an Emacs named "t", then use the full path. + test x"$EMACS" = xt && EMACS= + AC_CHECK_PROGS(EMACS, emacs xemacs, no) + if test $EMACS != "no"; then + if test x${lispdir+set} != xset; then + AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], + [# If $EMACS isn't GNU Emacs or XEmacs, this can blow up pretty badly + # Some emacsen will start up in interactive mode, requiring C-x C-c to exit, + # which is non-obvious for non-emacs users. + # Redirecting /dev/null should help a bit; pity we can't detect "broken" + # emacsen earlier and avoid running this altogether. + AC_RUN_LOG([$EMACS -batch -q -eval '(while load-path (princ (concat (car load-path) "\n")) (setq load-path (cdr load-path)))' conftest.out]) + am_cv_lispdir=`sed -n \ + -e 's,/$,,' \ + -e '/.*\/lib\/\(x\?emacs\/site-lisp\)$/{s,,${libdir}/\1,;p;q;}' \ + -e '/.*\/share\/\(x\?emacs\/site-lisp\)$/{s,,${datadir}/\1,;p;q;}' \ + conftest.out` + rm conftest.out + if test -z "$am_cv_lispdir"; then + am_cv_lispdir='${datadir}/emacs/site-lisp' + fi + ]) + lispdir="$am_cv_lispdir" + fi + fi +]) +AC_SUBST(lispdir) +])# AM_PATH_LISPDIR + +AU_DEFUN([ud_PATH_LISPDIR], [AM_PATH_LISPDIR]) diff --git a/share/aclocal-1.7/maintainer.m4 b/share/aclocal-1.7/maintainer.m4 new file mode 100644 index 00000000..f63e6736 --- /dev/null +++ b/share/aclocal-1.7/maintainer.m4 @@ -0,0 +1,38 @@ +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# Copyright 1996, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 2 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) diff --git a/share/aclocal-1.7/make.m4 b/share/aclocal-1.7/make.m4 new file mode 100644 index 00000000..6e359d89 --- /dev/null +++ b/share/aclocal-1.7/make.m4 @@ -0,0 +1,61 @@ +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 2 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +doit: + @echo done +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | 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 +]) diff --git a/share/aclocal-1.7/minuso.m4 b/share/aclocal-1.7/minuso.m4 new file mode 100644 index 00000000..fb9427e3 --- /dev/null +++ b/share/aclocal-1.7/minuso.m4 @@ -0,0 +1,39 @@ +# serial 2 + +# AM_PROG_CC_C_O +# -------------- +# Like AC_PROG_CC_C_O, but changed for automake. + +# Copyright 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +]) diff --git a/share/aclocal-1.7/missing.m4 b/share/aclocal-1.7/missing.m4 new file mode 100644 index 00000000..82242000 --- /dev/null +++ b/share/aclocal-1.7/missing.m4 @@ -0,0 +1,48 @@ +# -*- Autoconf -*- + +## --------------------------------------------------------- ## +## Fake the existence of programs that GNU maintainers use. ## +## --------------------------------------------------------- ## + +# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# 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 +]) diff --git a/share/aclocal-1.7/multi.m4 b/share/aclocal-1.7/multi.m4 new file mode 100644 index 00000000..016c3b52 --- /dev/null +++ b/share/aclocal-1.7/multi.m4 @@ -0,0 +1,67 @@ +# Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR]) +# --------------------------------------------------- +# Add --enable-multilib to configure. +AC_DEFUN([AM_ENABLE_MULTILIB], +[# Default to --enable-multilib +AC_ARG_ENABLE(multilib, +[ --enable-multilib build many library versions (default)], +[case "$enableval" in + yes) multilib=yes ;; + no) multilib=no ;; + *) AC_MSG_ERROR([bad value $enableval for multilib option]) ;; + esac], + [multilib=yes]) + +# We may get other options which we leave undocumented: +# --with-target-subdir, --with-multisrctop, --with-multisubdir +# See config-ml.in if you want the gory details. + +if test "$srcdir" = "."; then + if test "$with_target_subdir" != "."; then + multi_basedir="$srcdir/$with_multisrctop../$2" + else + multi_basedir="$srcdir/$with_multisrctop$2" + fi +else + multi_basedir="$srcdir/$2" +fi +AC_SUBST(multi_basedir) + +AC_OUTPUT_COMMANDS([ +# Only add multilib support code if we just rebuilt the top-level +# Makefile. +case " $CONFIG_FILES " in + *" ]m4_default([$1],Makefile)[ "*) + ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in + ;; +esac], + [ +srcdir="$srcdir" +host="$host" +target="$target" +with_multisubdir="$with_multisubdir" +with_multisrctop="$with_multisrctop" +with_target_subdir="$with_target_subdir" +ac_configure_args="${multilib_arg} ${ac_configure_args}" +multi_basedir="$multi_basedir" +CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} +CC="$CC"])])dnl diff --git a/share/aclocal-1.7/obsol-gt.m4 b/share/aclocal-1.7/obsol-gt.m4 new file mode 100644 index 00000000..efe7f1de --- /dev/null +++ b/share/aclocal-1.7/obsol-gt.m4 @@ -0,0 +1,23 @@ +# Support for obsolete Gettext macro. -*- Autoconf -*- + +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 1 + +# See comment in obsolete.m4. +AU_DEFUN([ud_GNU_GETTEXT], [AM_GNU_GETTEXT]) diff --git a/share/aclocal-1.7/obsol-lt.m4 b/share/aclocal-1.7/obsol-lt.m4 new file mode 100644 index 00000000..72e7c7a3 --- /dev/null +++ b/share/aclocal-1.7/obsol-lt.m4 @@ -0,0 +1,23 @@ +# Support for obsolete Libtool macro. -*- Autoconf -*- + +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 1 + +# See comment in obsolete.m4. +AU_DEFUN([gm_PROG_LIBTOOL], [AM_PROG_LIBTOOL]) diff --git a/share/aclocal-1.7/obsolete.m4 b/share/aclocal-1.7/obsolete.m4 new file mode 100644 index 00000000..f43c30b0 --- /dev/null +++ b/share/aclocal-1.7/obsolete.m4 @@ -0,0 +1,49 @@ +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 1 + +# Obsolete Automake macros. + +# We put here only the macros whose substitution is not an Automake +# macro; otherwise including this file would trigger dependencies for +# all the subsitutions. Generally, obsolete Automake macros are +# better AU_DEFUNed in the same file as their replacement, or alone in +# a separate file (see obsol-gt.m4 or obsol-lt.m4 for instance). + +AU_DEFUN([AC_FEATURE_CTYPE], [AC_HEADER_STDC]) +AU_DEFUN([AC_FEATURE_ERRNO], [AC_REPLACE_FUNCS([strerror])]) +AU_DEFUN([AM_CYGWIN32], [AC_CYGWIN]) +AU_DEFUN([AM_EXEEXT], [AC_EXEEXT]) +AU_DEFUN([AM_FUNC_MKTIME], [AC_FUNC_MKTIME]) +AU_DEFUN([AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL], + [AC_HEADER_TIOCGWINSZ]) +AU_DEFUN([AM_MINGW32], [AC_MINGW32]) +AU_DEFUN([AM_PROG_INSTALL], [AC_PROG_INSTALL]) +AU_DEFUN([AM_SANITY_CHECK_CC], [AC_PROG_CC]) +AU_DEFUN([AM_SYS_POSIX_TERMIOS], [AC_SYS_POSIX_TERMIOS]) +AU_DEFUN([fp_FUNC_FNMATCH], [AC_FUNC_FNMATCH]) +AU_DEFUN([fp_PROG_INSTALL], [AC_PROG_INSTALL]) +AU_DEFUN([md_TYPE_PTRDIFF_T], [AC_CHECK_TYPES([ptrdiff_t])]) + +# Don't know how to translate these. +# If used, Autoconf will complain that they are possibly unexpended; +# this seems a good enough error message. +# AC_FEATURE_EXIT +# AC_SYSTEM_HEADER diff --git a/share/aclocal-1.7/options.m4 b/share/aclocal-1.7/options.m4 new file mode 100644 index 00000000..2b72148f --- /dev/null +++ b/share/aclocal-1.7/options.m4 @@ -0,0 +1,43 @@ +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 2 + +# _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])]) diff --git a/share/aclocal-1.7/protos.m4 b/share/aclocal-1.7/protos.m4 new file mode 100644 index 00000000..7d007d59 --- /dev/null +++ b/share/aclocal-1.7/protos.m4 @@ -0,0 +1,44 @@ +## ------------------------------- ## +## Check for function prototypes. ## +## From Franc,ois Pinard ## +## ------------------------------- ## + +# Copyright 1996, 1997, 1998, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 2 + +AC_DEFUN([AM_C_PROTOTYPES], +[AC_REQUIRE([AM_PROG_CC_STDC]) +AC_REQUIRE([AC_PROG_CPP]) +AC_MSG_CHECKING([for function prototypes]) +if test "$am_cv_prog_cc_stdc" != no; then + AC_MSG_RESULT(yes) + AC_DEFINE(PROTOTYPES,1,[Define if compiler has function prototypes]) + U= ANSI2KNR= +else + AC_MSG_RESULT(no) + U=_ ANSI2KNR=./ansi2knr +fi +# Ensure some checks needed by ansi2knr itself. +AC_HEADER_STDC +AC_CHECK_HEADERS(string.h) +AC_SUBST(U)dnl +AC_SUBST(ANSI2KNR)dnl +]) + +AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) diff --git a/share/aclocal-1.7/python.m4 b/share/aclocal-1.7/python.m4 new file mode 100644 index 00000000..6014902e --- /dev/null +++ b/share/aclocal-1.7/python.m4 @@ -0,0 +1,159 @@ +## ------------------------ +## Python file handling +## From Andrew Dalke +## Updated by James Henstridge +## ------------------------ + +# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# AM_PATH_PYTHON([MINIMUM-VERSION]) + +# Adds support for distributing Python modules and packages. To +# install modules, copy them to $(pythondir), using the python_PYTHON +# automake variable. To install a package with the same name as the +# automake package, install to $(pkgpythondir), or use the +# pkgpython_PYTHON automake variable. + +# The variables $(pyexecdir) and $(pkgpyexecdir) are provided as +# locations to install python extension modules (shared libraries). +# Another macro is required to find the appropriate flags to compile +# extension modules. + +# If your package is configured with a different prefix to python, +# users will have to add the install directory to the PYTHONPATH +# environment variable, or create a .pth file (see the python +# documentation for details). + +# If the MINIUMUM-VERSION argument is passed, AM_PATH_PYTHON will +# cause an error if the version of python installed on the system +# doesn't meet the requirement. MINIMUM-VERSION should consist of +# numbers and dots only. + +AC_DEFUN([AM_PATH_PYTHON], + [ + dnl Find a Python interpreter. Python versions prior to 1.5 are not + dnl supported because the default installation locations changed from + dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages + dnl in 1.5. + m4_define([_AM_PYTHON_INTERPRETER_LIST], + [python python2 python2.2 python2.1 python2.0 python1.6 python1.5]) + + m4_if([$1],[],[ + dnl No version check is needed. + # Find any Python interpreter. + AC_PATH_PROG([PYTHON], _AM_PYTHON_INTERPRETER_LIST) + am_display_PYTHON=python + ], [ + dnl A version check is needed. + if test -n "$PYTHON"; then + # If the user set $PYTHON, use it and don't search something else. + AC_MSG_CHECKING([whether $PYTHON version >= $1]) + AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], + [AC_MSG_RESULT(yes)], + [AC_MSG_ERROR(too old)]) + else + # Otherwise, try each interpreter until we find one that satisfies + # VERSION. + AC_CACHE_CHECK([for a Python interpreter with version >= $1], + [am_cv_pathless_PYTHON],[ + for am_cv_pathless_PYTHON in _AM_PYTHON_INTERPRETER_LIST : ; do + if test "$am_cv_pathless_PYTHON" = : ; then + AC_MSG_ERROR([no suitable Python interpreter found]) + fi + AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) + done]) + # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. + AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) + am_display_PYTHON=$am_cv_pathless_PYTHON + fi + ]) + + dnl Query Python for its version number. Getting [:3] seems to be + dnl the best way to do this; it's what "site.py" does in the standard + dnl library. + + AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version], + [am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`]) + AC_SUBST([PYTHON_VERSION], [$am_cv_python_version]) + + dnl Use the values of $prefix and $exec_prefix for the corresponding + dnl values of PYTHON_PREFIX and PYTHON_EXEC_PREFIX. These are made + dnl distinct variables so they can be overridden if need be. However, + dnl general consensus is that you shouldn't need this ability. + + AC_SUBST([PYTHON_PREFIX], ['${prefix}']) + AC_SUBST([PYTHON_EXEC_PREFIX], ['${exec_prefix}']) + + dnl At times (like when building shared libraries) you may want + dnl to know which OS platform Python thinks this is. + + AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform], + [am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`]) + AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) + + + dnl Set up 4 directories: + + dnl pythondir -- where to install python scripts. This is the + dnl site-packages directory, not the python standard library + dnl directory like in previous automake betas. This behaviour + dnl is more consistent with lispdir.m4 for example. + dnl + dnl Also, if the package prefix isn't the same as python's prefix, + dnl then the old $(pythondir) was pretty useless. + + AC_SUBST([pythondir], + [$PYTHON_PREFIX"/lib/python"$PYTHON_VERSION/site-packages]) + + dnl pkgpythondir -- $PACKAGE directory under pythondir. Was + dnl PYTHON_SITE_PACKAGE in previous betas, but this naming is + dnl more consistent with the rest of automake. + dnl Maybe this should be put in python.am? + + AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) + + dnl pyexecdir -- directory for installing python extension modules + dnl (shared libraries) Was PYTHON_SITE_EXEC in previous betas. + + AC_SUBST([pyexecdir], + [${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages]) + + dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) + dnl Maybe this should be put in python.am? + + AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) +]) + + +# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------------------- +# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. +# Run ACTION-IF-FALSE otherwise. +# This test uses sys.hexversion instead of the string equivalant (first +# word of sys.version), in order to cope with versions such as 2.2c1. +# hexversion has been introduced in Python 1.5.2; it's probably not +# worth to support older versions (1.5.1 was released on October 31, 1998). +AC_DEFUN([AM_PYTHON_CHECK_VERSION], + [prog="import sys, string +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +minver = map(int, string.split('$2', '.')) + [[0, 0, 0]] +minverhex = 0 +for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]] +sys.exit(sys.hexversion < minverhex)" + AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])]) diff --git a/share/aclocal-1.7/regex.m4 b/share/aclocal-1.7/regex.m4 new file mode 100644 index 00000000..a8fd3aad --- /dev/null +++ b/share/aclocal-1.7/regex.m4 @@ -0,0 +1,65 @@ +## --------------------------------- ## -*- Autoconf -*- +## Check if --with-regex was given. ## +## --------------------------------- ## + +# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# 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. + +# serial 4 +AC_PREREQ(2.50) + +# AM_WITH_REGEX +# ------------- +# +# The idea is to distribute rx.[hc] and regex.[hc] together, for a +# while. The WITH_REGEX symbol is used to decide which of regex.h or +# rx.h should be included in the application. If `./configure +# --with-regex' is given (the default), the package will use gawk's +# regex. If `./configure --without-regex', a check is made to see if +# rx is already installed, as with newer Linux'es. If not found, the +# package will use the rx from the distribution. If found, the +# package will use the system's rx which, on Linux at least, will +# result in a smaller executable file. +# +# FIXME: This macro seems quite obsolete now since rx doesn't seem to +# be maintained, while regex is. +AC_DEFUN([AM_WITH_REGEX], +[AC_LIBSOURCES([rx.h, rx.c, regex.c, regex.h])dnl +AC_MSG_CHECKING([which of GNU rx or gawk's regex is wanted]) +AC_ARG_WITH(regex, +[ --without-regex use GNU rx in lieu of gawk's regex for matching], + [test "$withval" = yes && am_with_regex=1], + [am_with_regex=1]) +if test -n "$am_with_regex"; then + AC_MSG_RESULT(regex) + AC_DEFINE(WITH_REGEX, 1, [Define if using GNU regex]) + AC_CACHE_CHECK([for GNU regex in libc], am_cv_gnu_regex, + [AC_TRY_LINK([], + [extern int re_max_failures; re_max_failures = 1], + [am_cv_gnu_regex=yes], + [am_cv_gnu_regex=no])]) + if test $am_cv_gnu_regex = no; then + AC_LIBOBJ([regex]) + fi +else + AC_MSG_RESULT(rx) + AC_CHECK_FUNC(re_rx_search, , [AC_LIBOBJ([rx])]) +fi +AC_SUBST(LIBOBJS)dnl +]) + +AU_DEFUN([fp_WITH_REGEX], [AM_WITH_REGEX]) diff --git a/share/aclocal-1.7/runlog.m4 b/share/aclocal-1.7/runlog.m4 new file mode 100644 index 00000000..f2525c26 --- /dev/null +++ b/share/aclocal-1.7/runlog.m4 @@ -0,0 +1,27 @@ +# Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- + +# 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. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) diff --git a/share/aclocal-1.7/sanity.m4 b/share/aclocal-1.7/sanity.m4 new file mode 100644 index 00000000..398be24c --- /dev/null +++ b/share/aclocal-1.7/sanity.m4 @@ -0,0 +1,63 @@ +# +# Check to make sure that the build environment is sane. +# + +# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# serial 3 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) diff --git a/share/aclocal-1.7/strip.m4 b/share/aclocal-1.7/strip.m4 new file mode 100644 index 00000000..85182eb8 --- /dev/null +++ b/share/aclocal-1.7/strip.m4 @@ -0,0 +1,38 @@ +# AM_PROG_INSTALL_STRIP + +# Copyright 2001 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# 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])]) diff --git a/share/aclocal/autoopts.m4 b/share/aclocal/autoopts.m4 new file mode 100644 index 00000000..84b0eb2d --- /dev/null +++ b/share/aclocal/autoopts.m4 @@ -0,0 +1,256 @@ +dnl -*- Mode: M4 -*- +dnl -------------------------------------------------------------------- +dnl autoopts.m4 --- Configure paths for autoopts +dnl +dnl Author: Gary V. Vaughan +dnl Maintainer: Gary V. Vaughan +dnl Created: Sun Nov 15 23:37:14 1998 +dnl Last Modified: Mon May 17 01:02:44 1999 +dnl by: bkorb +dnl -------------------------------------------------------------------- +dnl @(#) $Id: autoopts.m4,v 2.6 2002/09/11 03:36:11 bkorb Exp $ +dnl -------------------------------------------------------------------- +dnl +dnl Code: + +# serial 1 + +dnl AG_PATH_AUTOOPTS([MIN-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for AUTOOPTS, and define AUTOGEN, AUTOOPTS_CFLAGS, AUTOGEN_LDFLAGS +dnl and AUTOOPTS_LIBS. +dnl +AC_DEFUN(AG_PATH_AUTOOPTS, +[dnl Get the cflags and libraries from the autoopts-config script +AC_ARG_WITH(opts-prefix, +[ --with-opts-prefix=PFX Prefix where autoopts is installed (optional)]) + +AC_ARG_WITH(opts-exec-prefix, +[ --with-opts-exec-prefix=PFX + Exec prefix where autoopts is installed (optional)]) + +AC_ARG_ENABLE(opts-test, +[ --disable-opts-test Do not try to compile and run a test autoopts program]) + + if test x$with_opts_exec_prefix != x ; then + autoopts_config_args="$autoopts_config_args --exec-prefix=$with_opts_exec_prefix" + if test x${AUTOOPTS_CONFIG+set} != xset ; then + AUTOOPTS_CONFIG=$with_opts_exec_prefix/bin/autoopts-config + fi + fi + if test x$with_opts_prefix != x ; then + autoopts_config_args="$autoopts_config_args --prefix=$with_opts_prefix" + if test x${AUTOOPTS_CONFIG+set} != xset ; then + AUTOOPTS_CONFIG=$with_opts_prefix/bin/autoopts-config + fi + fi + if test -n "$AUTOOPTS_CONFIG"; then + : + else + AC_PATH_PROG(AUTOOPTS_CONFIG, autoopts-config, no) + fi + min_opts_version=ifelse([$1], ,4:2:0,$1) + AC_MSG_CHECKING(for autoopts version >= $min_opts_version) + no_autoopts="" + if test "$AUTOOPTS_CONFIG" = "no" ; then + no_autoopts=yes + else + AUTOGEN=`$AUTOOPTS_CONFIG $autoopts_config_args --autogen` + AUTOOPTS_CFLAGS=`$AUTOOPTS_CONFIG $autoopts_config_args --cflags` + AUTOGEN_LDFLAGS=`$AUTOOPTS_CONFIG $autoopts_config_args --pkgdatadir` + AUTOOPTS_LIBS=`$AUTOOPTS_CONFIG $autoopts_config_args --libs` +changequote(,)dnl + autoopts_config_version=`$AUTOOPTS_CONFIG $autoopts_config_args --version` + autoopts_config_current=`echo $autoopts_config_version | \ + sed 's/\([0-9]*\):\([0-9]*\):\([0-9]*\)/\1/'` + autoopts_config_revision=`echo $autoopts_config_version | \ + sed 's/\([0-9]*\):\([0-9]*\):\([0-9]*\)/\2/'` + autoopts_config_age=`echo $autoopts_config_version | \ + sed 's/\([0-9]*\):\([0-9]*\):\([0-9]*\)/\3/'` +changequote([,])dnl + if test "x$enable_opts_test" != "xno" ; then + AC_LANG_SAVE + AC_LANG_C + ac_save_CFLAGS="$CFLAGS" + ac_save_LDFLAGS="$LDFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $AUTOOPTS_CFLAGS" + LDFLAGS="$LDFLAGS $AUTOOPTS $CFLAGS" + LIBS="$LIBS $AUTOOPTS_LIBS" + dnl + dnl Now check if the installed AUTOOPTS is sufficiently new. (Also + dnl sanity checks the results of autoopts-config to some extent. + dnl + rm -f confopts.def conf.optstest + AC_TRY_RUN([ +#include +#include +#include + +int +main () +{ + int current, revision, age; + int autoopts_current, autoopts_revision, autoopts_age; + char tmp_version[16]; + + system ("touch conf.optstest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + strcpy(tmp_version, "$min_opts_version"); + if (sscanf(tmp_version, "%d:%d:%d", ¤t, &revision, &age) != 3) + { + printf("%s, bad version string\n", "$min_opts_version"); + exit(1); + } + + strcpy(tmp_version, optionVersion()); + if (sscanf(tmp_version, "%d:%d:%d", &autoopts_current, + &autoopts_revision, &autoopts_age) != 3) + { + printf("%s, bad version string\n", optionVersion); + exit(1); + } + + if ((current != $autoopts_config_current) || + (revision != $autoopts_config_revision) || + (age != $autoopts_config_age)) + { + printf("\n*** 'autoopts-config --version' returned %d:%d:%d," + " but autoopts returned (%d:%d:%d)\n", + $autoopts_config_current, + $autoopts_config_revision, $autoopts_config_age, + current, revision, age); + printf("*** If autoopts-config was correct, then it is best to" + "remove the\n"); + printf("*** old version of autoopts. You may also " + "be able to fix the error\n"); + printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, " + "or by editing\n"); + printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that " + "is\n"); + printf("*** required on your system.\n"); + printf("*** If autoopts-config was wrong, set the environment " + "variable AUTOOPTS_CONFIG\n"); + printf("*** to point to the correct copy of autoopts-config, and " + "remove the file\n"); + printf("*** config.cache before re-running configure\n"); + } +#if defined (AO_CURRENT) && defined (AO_REVISION) && defined (AO_AGE) + else if (($autoopts_config_current != AO_CURRENT) || + ($autoopts_config_revision != AO_REVISION) || + ($autoopts_config_age != AO_AGE)) + { + printf("*** autoopts header files (version %d:%d:%d) do not match\n", + AO_CURRENT, AO_REVISION, AO__AGE); + printf("*** library (version %d:%d:%d)\n", autoopts_current, + autoopts_revision, autoopts_age); + } +#endif + else + { + if ((autoopts_current - autoopts_age > current - age) || + ((autoopts_current - autoopts_age == current - age) && + (autoopts_age > age)) || + ((autoopts_current - autoopts_age == current - age) && + (autoopts_age == age) && + (autoopts_revision >= revision))) + { + return 0; + } + else + { + printf("\n*** An old version of autoopts (%d:%d:%d) was found.\n", + autoopts_current, autoopts_revision, autoopts_age); + printf("*** You need a version of autoopts newer than %d:%d:%d. " + "The latest version of\n", current, revision, age); + printf("*** autoopts is always available from " + "ftp://autogen.linuxave.org.\n"); + printf("***\n"); + printf("*** If you have already installed a sufficiently new " + "version, this error\n"); + printf("*** probably means that the wrong copy of the " + "autoopts-config shell script is\n"); + printf("*** being found. The easiest way to fix this is to " + "remove the old version\n"); + printf("*** of autoopts, but you can also set the " + "AUTOOPTS_CONFIG environment to point to the\n"); + printf("*** correct copy of autoopts-config. (In this case, " + "you will have to\n"); + printf("*** modify your LD_LIBRARY_PATH enviroment variable, or " + "edit /etc/ld.so.conf\n"); + printf("*** so that the correct libraries are found at " + "run-time).\n"); + } + } + return 1; +} +],, no_autoopts=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LDFLAGS="$ac_save_LDFLAGS" + LIBS="$ac_save_LIBS" + AC_LANG_RESTORE + fi + fi + + if test "x$no_autoopts" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$AUTOOPTS_CONFIG" = "no" ; then + cat << _EOF_ +*** The autoopts-config script installed by AutoGen could not be found +*** If AutoGen was installed in PREFIX, make sure PREFIX/bin is in +*** your path, or set the AUTOOPTS_CONFIG environment variable to the +*** full path to autoopts-config. +_EOF_ + else + if test -f conf.optstest ; then + : + else + echo "*** Could not run autoopts test program, checking why..." + CFLAGS="$CFLAGS $AUTOOPTS_CFLAGS" + LIBS="$LIBS $AUTOOPTS_LIBS" + AC_LANG_SAVE + AC_LANG_C + AC_TRY_LINK([ +#include +#include +], [ return strcmp("$autoopts_config_current:$autoopts_config_revision:$autoopts_config_age", optionVersion()); ], + [ cat << _EOF_ +*** The test program compiled, but did not run. This usually means that +*** the run-time linker is not finding libopts or finding the wrong version +*** of libopts. If it is not finding libopts, you'll need to set your +*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point +*** to the installed location Also, make sure you have run ldconfig if that +*** is required on your system +*** +*** If you have an old version installed, it is best to remove it, although +*** you may also be able to get things to work by modifying LD_LIBRARY_PATH +_EOF_ +], [cat << _EOF_ +*** The test program failed to compile or link. See the file config.log for +*** the exact error that occured. This usually means AutoGen was incorrectly +*** installed or that you have moved libopts since it was installed. In the +*** latter case, you may want to edit the autoopts-config script: +*** $AUTOOPTS_CONFIG +_EOF_ +]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + AC_LANG_RESTORE + fi + fi + AUTOGEN=: + AUTOOPTS_CFLAGS="" + AUTOOPTS_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(AUTOGEN) + AC_SUBST(AUTOOPTS_CFLAGS) + AC_SUBST(AUTOGEN_LDFLAGS) + AC_SUBST(AUTOOPTS_LIBS) + rm -f confopts.def conf.optstest +]) +dnl +dnl autoopts.m4 ends here diff --git a/share/aclocal/guile.m4 b/share/aclocal/guile.m4 new file mode 100644 index 00000000..020de5a0 --- /dev/null +++ b/share/aclocal/guile.m4 @@ -0,0 +1,221 @@ +## Autoconf macros for working with Guile. +## +## Copyright (C) 1998,2001 Free Software Foundation, Inc. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this software; see the file COPYING. If not, write to +## the Free Software Foundation, Inc., 59 Temple Place, Suite 330, +## Boston, MA 02111-1307 USA +## +## As a special exception, the Free Software Foundation gives permission +## for additional uses of the text contained in its release of GUILE. +## +## The exception is that, if you link the GUILE library with other files +## to produce an executable, this does not by itself cause the +## resulting executable to be covered by the GNU General Public License. +## Your use of that executable is in no way restricted on account of +## linking the GUILE library code into it. +## +## This exception does not however invalidate any other reasons why +## the executable file might be covered by the GNU General Public License. +## +## This exception applies only to the code released by the +## Free Software Foundation under the name GUILE. If you copy +## code from other Free Software Foundation releases into a copy of +## GUILE, as the General Public License permits, the exception does +## not apply to the code that you add in this way. To avoid misleading +## anyone as to the status of such modified files, you must delete +## this exception notice from them. +## +## If you write modifications of your own for GUILE, it is your choice +## whether to permit this exception to apply to your modifications. +## If you do not wish that, delete this exception notice. + +## Index +## ----- +## +## GUILE_PROGS -- set paths to Guile interpreter, config and tool programs +## GUILE_FLAGS -- set flags for compiling and linking with Guile +## GUILE_SITE_DIR -- find path to Guile "site" directory +## GUILE_CHECK -- evaluate Guile Scheme code and capture the return value +## GUILE_MODULE_CHECK -- check feature of a Guile Scheme module +## GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module +## GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable +## GUILE_MODULE_EXPORTS -- check if a module exports a variable +## GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable + +## Code +## ---- + +## NOTE: Comments preceding an AC_DEFUN (starting from "Usage:") are massaged +## into doc/ref/autoconf-macros.texi (see Makefile.am in that directory). + +# GUILE_PROGS -- set paths to Guile interpreter, config and tool programs +# +# Usage: GUILE_PROGS +# +# This macro looks for programs @code{guile}, @code{guile-config} and +# @code{guile-tools}, and sets variables @var{GUILE}, @var{GUILE_CONFIG} and +# @var{GUILE_TOOLS}, to their paths, respectively. If either of the first two +# is not found, signal error. +# +# The variables are marked for substitution, as by @code{AC_SUBST}. +# +AC_DEFUN([GUILE_PROGS], + [AC_PATH_PROG(GUILE,guile) + if test "$GUILE" = "" ; then + AC_MSG_ERROR([guile required but not found]) + fi + AC_SUBST(GUILE) + AC_PATH_PROG(GUILE_CONFIG,guile-config) + if test "$GUILE_CONFIG" = "" ; then + AC_MSG_ERROR([guile-config required but not found]) + fi + AC_SUBST(GUILE_CONFIG) + AC_PATH_PROG(GUILE_TOOLS,guile-tools) + AC_SUBST(GUILE_TOOLS) + ]) + +# GUILE_FLAGS -- set flags for compiling and linking with Guile +# +# Usage: GUILE_FLAGS +# +# This macro runs the @code{guile-config} script, installed with Guile, to +# find out where Guile's header files and libraries are installed. It sets +# two variables, @var{GUILE_CFLAGS} and @var{GUILE_LDFLAGS}. +# +# @var{GUILE_CFLAGS}: flags to pass to a C or C++ compiler to build code that +# uses Guile header files. This is almost always just a @code{-I} flag. +# +# @var{GUILE_LDFLAGS}: flags to pass to the linker to link a program against +# Guile. This includes @code{-lguile} for the Guile library itself, any +# libraries that Guile itself requires (like -lqthreads), and so on. It may +# also include a @code{-L} flag to tell the compiler where to find the +# libraries. +# +# The variables are marked for substitution, as by @code{AC_SUBST}. +# +AC_DEFUN([GUILE_FLAGS], + [AC_REQUIRE([GUILE_PROGS])dnl + AC_MSG_CHECKING([libguile compile flags]) + GUILE_CFLAGS="`$GUILE_CONFIG compile`" + AC_MSG_RESULT([$GUILE_CFLAGS]) + AC_MSG_CHECKING([libguile link flags]) + GUILE_LDFLAGS="`$GUILE_CONFIG link`" + AC_MSG_RESULT([$GUILE_LDFLAGS]) + AC_SUBST(GUILE_CFLAGS) + AC_SUBST(GUILE_LDFLAGS) + ]) + +# GUILE_SITE_DIR -- find path to Guile "site" directory +# +# Usage: GUILE_SITE_DIR +# +# This looks for Guile's "site" directory, usually something like +# PREFIX/share/guile/site, and sets var @var{GUILE_SITE} to the path. +# Note that the var name is different from the macro name. +# +# The variable is marked for substitution, as by @code{AC_SUBST}. +# +AC_DEFUN([GUILE_SITE_DIR], + [AC_REQUIRE([GUILE_PROGS])dnl + AC_MSG_CHECKING(for Guile site directory) + GUILE_SITE=`[$GUILE_CONFIG] info pkgdatadir`/site + AC_MSG_RESULT($GUILE_SITE) + AC_SUBST(GUILE_SITE) + ]) + +# GUILE_CHECK -- evaluate Guile Scheme code and capture the return value +# +# Usage: GUILE_CHECK_RETVAL(var,check) +# +# @var{var} is a shell variable name to be set to the return value. +# @var{check} is a Guile Scheme expression, evaluated with "$GUILE -c", and +# returning either 0 or non-#f to indicate the check passed. +# Non-0 number or #f indicates failure. +# Avoid using the character "#" since that confuses autoconf. +# +AC_DEFUN([GUILE_CHECK], + [AC_REQUIRE([GUILE_PROGS]) + $GUILE -c "$2" > /dev/null 2>&1 + $1=$? + ]) + +# GUILE_MODULE_CHECK -- check feature of a Guile Scheme module +# +# Usage: GUILE_MODULE_CHECK(var,module,featuretest,description) +# +# @var{var} is a shell variable name to be set to "yes" or "no". +# @var{module} is a list of symbols, like: (ice-9 common-list). +# @var{featuretest} is an expression acceptable to GUILE_CHECK, q.v. +# @var{description} is a present-tense verb phrase (passed to AC_MSG_CHECKING). +# +AC_DEFUN([GUILE_MODULE_CHECK], + [AC_MSG_CHECKING([if $2 $4]) + GUILE_CHECK($1,(use-modules $2) (exit ((lambda () $3)))) + if test "$$1" = "0" ; then $1=yes ; else $1=no ; fi + AC_MSG_RESULT($$1) + ]) + +# GUILE_MODULE_AVAILABLE -- check availability of a Guile Scheme module +# +# Usage: GUILE_MODULE_AVAILABLE(var,module) +# +# @var{var} is a shell variable name to be set to "yes" or "no". +# @var{module} is a list of symbols, like: (ice-9 common-list). +# +AC_DEFUN([GUILE_MODULE_AVAILABLE], + [GUILE_MODULE_CHECK($1,$2,0,is available) + ]) + +# GUILE_MODULE_REQUIRED -- fail if a Guile Scheme module is unavailable +# +# Usage: GUILE_MODULE_REQUIRED(symlist) +# +# @var{symlist} is a list of symbols, WITHOUT surrounding parens, +# like: ice-9 common-list. +# +AC_DEFUN([GUILE_MODULE_REQUIRED], + [GUILE_MODULE_AVAILABLE(ac_guile_module_required, ($1)) + if test "$ac_guile_module_required" = "no" ; then + AC_MSG_ERROR([required guile module not found: ($1)]) + fi + ]) + +# GUILE_MODULE_EXPORTS -- check if a module exports a variable +# +# Usage: GUILE_MODULE_EXPORTS(var,module,modvar) +# +# @var{var} is a shell variable to be set to "yes" or "no". +# @var{module} is a list of symbols, like: (ice-9 common-list). +# @var{modvar} is the Guile Scheme variable to check. +# +AC_DEFUN([GUILE_MODULE_EXPORTS], + [GUILE_MODULE_CHECK($1,$2,$3,exports `$3') + ]) + +# GUILE_MODULE_REQUIRED_EXPORT -- fail if a module doesn't export a variable +# +# Usage: GUILE_MODULE_REQUIRED_EXPORT(module,modvar) +# +# @var{module} is a list of symbols, like: (ice-9 common-list). +# @var{modvar} is the Guile Scheme variable to check. +# +AC_DEFUN([GUILE_MODULE_REQUIRED_EXPORT], + [GUILE_MODULE_EXPORTS(guile_module_required_export,$1,$2) + if test "$guile_module_required_export" = "no" ; then + AC_MSG_ERROR([module $1 does not export $2; required]) + fi + ]) + +## guile.m4 ends here diff --git a/share/aclocal/libtool.m4 b/share/aclocal/libtool.m4 new file mode 100644 index 00000000..3c27aad8 --- /dev/null +++ b/share/aclocal/libtool.m4 @@ -0,0 +1,5482 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +## Copyright 1996, 1997, 1998, 1999, 2000, 2001 +## Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 1996 +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 47 AC_PROG_LIBTOOL + + +# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED) +# ----------------------------------------------------------- +# If this macro is not defined by Autoconf, define it here. +m4_ifdef([AC_PROVIDE_IFELSE], + [], + [m4_define([AC_PROVIDE_IFELSE], + [m4_ifdef([AC_PROVIDE_$1], + [$2], [$3])])]) + + +# AC_PROG_LIBTOOL +# --------------- +AC_DEFUN([AC_PROG_LIBTOOL], +[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl +dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX +dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX. + AC_PROVIDE_IFELSE([AC_PROG_CXX], + [AC_LIBTOOL_CXX], + [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX + ])]) +dnl And a similar setup for Fortran 77 support + AC_PROVIDE_IFELSE([AC_PROG_F77], + [AC_LIBTOOL_F77], + [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77 +])]) + +dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly. +dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run +dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both. + AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ], + [AC_LIBTOOL_GCJ], + [ifdef([AC_PROG_GCJ], + [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([A][M_PROG_GCJ], + [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])]) + ifdef([LT_AC_PROG_GCJ], + [define([LT_AC_PROG_GCJ], + defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])]) +])])# AC_PROG_LIBTOOL + + +# _AC_PROG_LIBTOOL +# ---------------- +AC_DEFUN([_AC_PROG_LIBTOOL], +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl +AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl +AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl +AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Prevent multiple expansion +define([AC_PROG_LIBTOOL], []) +])# _AC_PROG_LIBTOOL + + +# AC_LIBTOOL_SETUP +# ---------------- +AC_DEFUN([AC_LIBTOOL_SETUP], +[AC_PREREQ(2.50)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([LT_AC_PROG_SED])dnl + +AC_REQUIRE([AC_PROG_LN_S])dnl +AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl +# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers! +AC_REQUIRE([AC_OBJEXT])dnl +AC_REQUIRE([AC_EXEEXT])dnl +dnl + +AC_LIBTOOL_SYS_MAX_CMD_LEN +AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +AC_LIBTOOL_OBJDIR + +AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +_LT_AC_PROG_ECHO_BACKSLASH + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'] + +# Same as above, but do not quote variable references. +[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'] + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +# Constants: +rm="rm -f" + +# Global variables: +default_ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +libext=a +ltmain="$ac_aux_dir/ltmain.sh" +ofile="$default_ofile" +with_gnu_ld="$lt_cv_prog_gnu_ld" + +AC_CHECK_TOOL(RANLIB, ranlib, :) +AC_CHECK_TOOL(STRIP, strip, :) + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$AR" && AR=ar +test -z "$AR_FLAGS" && AR_FLAGS=cru +test -z "$AS" && AS=as +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$LD" && LD=ld +test -z "$LN_S" && LN_S="ln -s" +test -z "$MAGIC_CMD" && MAGIC_CMD=file +test -z "$NM" && NM=nm +test -z "$SED" && SED=sed +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$RANLIB" && RANLIB=: +test -z "$STRIP" && STRIP=: +test -z "$ac_objext" && ac_objext=o + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="\$RANLIB -t \$oldlib~$old_postinstall_cmds" + ;; + *) + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +# Only perform the check for file, if the check method requires it +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + AC_PATH_MAGIC + fi + ;; +esac + +AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no) +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +enable_win32_dll=yes, enable_win32_dll=no) + +AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +AC_ARG_WITH([pic], + [AC_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) +test -z "$pic_mode" && pic_mode=default + +# Use C for the default configuration in the libtool script +tagname= +AC_LIBTOOL_LANG_C_CONFIG +_LT_AC_TAGCONFIG +])# AC_LIBTOOL_SETUP + + +# _LT_AC_SYS_COMPILER +# ------------------- +AC_DEFUN([_LT_AC_SYS_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="[$]2" +])# _LT_AC_SYS_COMPILER + + +# _LT_AC_SYS_LIBPATH_AIX +# ---------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX], +[AC_LINK_IFELSE(AC_LANG_PROGRAM,[ +aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` +# Check for a 64-bit object if we didn't find anything. +if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'`; fi],[]) +if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi +])# _LT_AC_SYS_LIBPATH_AIX + + +# _LT_AC_SHELL_INIT(ARG) +# ---------------------- +AC_DEFUN([_LT_AC_SHELL_INIT], +[ifdef([AC_DIVERSION_NOTICE], + [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)], + [AC_DIVERT_PUSH(NOTICE)]) +$1 +AC_DIVERT_POP +])# _LT_AC_SHELL_INIT + + +# _LT_AC_PROG_ECHO_BACKSLASH +# -------------------------- +# Add some code to the start of the generated configure script which +# will find an echo command which doesn't interpret backslashes. +AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH], +[_LT_AC_SHELL_INIT([ +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} + +case X$ECHO in +X*--fallback-echo) + # Remove one level of quotation (which was required for Make). + ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','` + ;; +esac + +echo=${ECHO-echo} +if test "X[$]1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X[$]1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec $SHELL "[$]0" --no-reexec ${1+"[$]@"} +fi + +if test "X[$]1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null + then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + : +else + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for dir in $PATH /usr/ucb; do + IFS="$lt_save_ifs" + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$lt_save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running configure again with it. + ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh} + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"} + else + # Try using printf. + echo='printf %s\n' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + # Cool, printf works + : + elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL [$]0 --fallback-echo" + elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` && + test "X$echo_testing_string" = 'X\t' && + echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` && + test "X$echo_testing_string" = "X$echo_test_string"; then + echo="$CONFIG_SHELL [$]0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null + then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "[$]0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi +fi + +# Copy echo and quote the copy suitably for passing to libtool from +# the Makefile, instead of quoting the original, which is used later. +ECHO=$echo +if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then + ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo" +fi + +AC_SUBST(ECHO) +])])# _LT_AC_PROG_ECHO_BACKSLASH + + +# _LT_AC_LOCK +# ----------- +AC_DEFUN([_LT_AC_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AC_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw* | *-*-pw32*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; + ]) +esac + +need_locks="$enable_libtool_lock" + +])# _LT_AC_LOCK + + +# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | sed \ + -e 's:.*FLAGS\}\? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s conftest.err; then + $2=yes + fi + fi + $rm conftest* +]) + +if test x"[$]$2" = xyes; then + ifelse([$5], , :, [$5]) +else + ifelse([$6], , :, [$6]) +fi +])# AC_LIBTOOL_COMPILER_OPTION + + +# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ------------------------------------------------------------ +# Check whether the given compiler option works +AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], +[AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + printf "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + else + $2=yes + fi + fi + $rm conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + ifelse([$4], , :, [$4]) +else + ifelse([$5], , :, [$5]) +fi +])# AC_LIBTOOL_LINKER_OPTION + + +# AC_LIBTOOL_SYS_MAX_CMD_LEN +# -------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], +[# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + testring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + *) + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while (test "X"`$CONFIG_SHELL [$]0 --fallback-echo "X$testring" 2>/dev/null` \ + = "XX$testring") >/dev/null 2>&1 && + new_result=`expr "X$testring" : ".*" 2>&1` && + lt_cv_sys_max_cmd_len=$new_result && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + testring=$testring$testring + done + testring= + # Add a significant safety factor because C++ compilers can tack on massive + # amounts of additional arguments before passing them to the linker. + # It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +])# AC_LIBTOOL_SYS_MAX_CMD_LEN + + +# _LT_AC_CHECK_DLFCN +# -------------------- +AC_DEFUN([_LT_AC_CHECK_DLFCN], +[AC_CHECK_HEADERS(dlfcn.h)dnl +])# _LT_AC_CHECK_DLFCN + + +# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ------------------------------------------------------------------ +AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" void exit (int); +#endif + +void fnord() { int i=42;} +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + /* dlclose (self); */ + } + + exit (status); +}] +EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_unknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_AC_TRY_DLOPEN_SELF + + +# AC_LIBTOOL_DLOPEN_SELF +# ------------------- +AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], +[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + LDFLAGS="$LDFLAGS $link_static_flag" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_AC_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +])# AC_LIBTOOL_DLOPEN_SELF + + +# AC_LIBTOOL_PROG_CC_C_O([TAGNAME]) +# --------------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler +AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $rm -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + # According to Tom Tromey, Ian Lance Taylor reported there are C compilers + # that will create temporary files in the current directory regardless of + # the output directory. Thus, making CWD read-only will cause this test + # to fail, enabling locking or at least warning the user not to do parallel + # builds. + chmod -w . + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | sed \ + -e 's:.*FLAGS\}\? :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test ! -s out/conftest.err; then + _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . + $rm conftest* out/* + rmdir out + cd .. + rmdir conftest + $rm conftest* +]) +])# AC_LIBTOOL_PROG_CC_C_O + + +# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME]) +# ----------------------------------------- +# Check to see if we can do hard links to lock some files if needed +AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], +[AC_REQUIRE([_LT_AC_LOCK])dnl + +hard_links="nottested" +if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS + + +# AC_LIBTOOL_OBJDIR +# ----------------- +AC_DEFUN([AC_LIBTOOL_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +])# AC_LIBTOOL_OBJDIR + + +# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME]) +# ---------------------------------------------- +# Check hardcoding attributes. +AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_AC_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \ + test -n "$_LT_AC_TAGVAR(runpath_var $1)"; then + + # We can hardcode non-existant directories. + if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_AC_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_AC_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_AC_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH + + +# AC_LIBTOOL_SYS_LIB_STRIP +# ------------------------ +AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP], +[striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi +])# AC_LIBTOOL_SYS_LIB_STRIP + + +# AC_LIBTOOL_SYS_DYNAMIC_LINKER +# ----------------------------- +# PORTME Fill in your ld.so characteristics +AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER], +[AC_MSG_CHECKING([dynamic linker characteristics]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +if test "$GCC" = yes; then + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e "s/$PATH_SEPARATOR/ /g"` + fi +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4* | aix5*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}.so$major ${libname}${release}.so$versuffix $libname.so' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}.so$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32*) + version_type=windows + need_version=no + need_lib_prefix=no + + case $GCC,$host_os in + yes,cygwin* | yes,mingw* | yes,pw32*) + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib" + ;; + mingw*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll' + sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g"` + if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH printed by + # mingw gcc, but we are running on Cygwin. Gcc prints its search + # path with ; separators, and with drive letters. We can handle the + # drive letters (cygwin fileutils understands them), so leave them, + # especially as we might pass files found there to a mingw objdump, + # which wouldn't understand a cygwinified path. Ahh. + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e 's/;/ /g'` + else + sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e "s/$PATH_SEPARATOR/ /g"` + fi + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' + ;; + esac + ;; + + *) + library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}.dll $libname.lib' + ;; + esac + dynamic_linker='Win32 ld.exe' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. + library_names_spec='${libname}${release}${versuffix}.$(test .$module = .yes && echo so || echo dylib) ${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib) ${libname}.$(test .$module = .yes && echo so || echo dylib)' + soname_spec='${libname}${release}${major}.$(test .$module = .yes && echo so || echo dylib)' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + if test "$host_cpu" = ia64; then + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + else + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + fi + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) version_type=irix ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so $libname.so' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +nto-qnx) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +openbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + export_dynamic_flag_spec='${wl}-Blargedynsym' + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no +])# AC_LIBTOOL_SYS_DYNAMIC_LINKER + + +# _LT_AC_TAGCONFIG +# ---------------- +AC_DEFUN([_LT_AC_TAGCONFIG], +[AC_ARG_WITH([tags], + [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@], + [include additional configurations @<:@automatic@:>@])], + [tagnames="$withval"]) + +if test -f "$ltmain" && test -n "$tagnames"; then + if test ! -f "${ofile}"; then + AC_MSG_WARN([output file `$ofile' does not exist]) + fi + + if test -z "$LTCC"; then + eval "`$SHELL ${ofile} --config | grep '^LTCC='`" + if test -z "$LTCC"; then + AC_MSG_WARN([output file `$ofile' does not look like a libtool script]) + else + AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile']) + fi + fi + + # Extract list of available tagged configurations in $ofile. + # Note that this assumes the entire list is on one line. + available_tags=`grep "^available_tags=" "${ofile}" | sed -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'` + + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for tagname in $tagnames; do + IFS="$lt_save_ifs" + # Check whether tagname contains only valid characters + case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in + "") ;; + *) AC_MSG_ERROR([invalid tag name: $tagname]) + ;; + esac + + if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null + then + AC_MSG_ERROR([tag name \"$tagname\" already exists]) + fi + + # Update the list of available tags. + if test -n "$tagname"; then + echo appending configuration tag \"$tagname\" to $ofile + + case $tagname in + CXX) + AC_LIBTOOL_LANG_CXX_CONFIG + ;; + + F77) + AC_LIBTOOL_LANG_F77_CONFIG + ;; + + GCJ) + AC_LIBTOOL_LANG_GCJ_CONFIG + ;; + + RC) + AC_LIBTOOL_LANG_RC_CONFIG + ;; + + *) + AC_MSG_ERROR([Unsupported tag name: $tagname]) + ;; + esac + + # Append the new tag name to the list of available tags. + available_tags="$available_tags $tagname" + fi + done + IFS="$lt_save_ifs" + + # Now substitute the updated list of available tags. + if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then + mv "${ofile}T" "$ofile" + chmod +x "$ofile" + else + rm -f "${ofile}T" + AC_MSG_ERROR([unable to update list of available tagged configurations.]) + fi +fi +])# _LT_AC_TAGCONFIG + + +# AC_LIBTOOL_DLOPEN +# ----------------- +# enable checks for dlopen support +AC_DEFUN([AC_LIBTOOL_DLOPEN], + [AC_BEFORE([$0],[AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_DLOPEN + + +# AC_LIBTOOL_WIN32_DLL +# -------------------- +# declare package support for building win32 dll's +AC_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_BEFORE([$0], [AC_LIBTOOL_SETUP]) +])# AC_LIBTOOL_WIN32_DLL + + +# AC_ENABLE_SHARED([DEFAULT]) +# --------------------------- +# implement the --enable-shared flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_SHARED], +[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([shared], + [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]AC_ENABLE_SHARED_DEFAULT) +])# AC_ENABLE_SHARED + + +# AC_DISABLE_SHARED +# ----------------- +#- set the default shared flag to --disable-shared +AC_DEFUN([AC_DISABLE_SHARED], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no) +])# AC_DISABLE_SHARED + + +# AC_ENABLE_STATIC([DEFAULT]) +# --------------------------- +# implement the --enable-static flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_STATIC], +[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([static], + [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]AC_ENABLE_STATIC_DEFAULT) +])# AC_ENABLE_STATIC + + +# AC_DISABLE_STATIC +# ----------------- +# set the default static flag to --disable-static +AC_DEFUN([AC_DISABLE_STATIC], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no) +])# AC_DISABLE_STATIC + + +# AC_ENABLE_FAST_INSTALL([DEFAULT]) +# --------------------------------- +# implement the --enable-fast-install flag +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +AC_DEFUN([AC_ENABLE_FAST_INSTALL], +[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE([fast-install], + [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT) +])# AC_ENABLE_FAST_INSTALL + + +# AC_DISABLE_FAST_INSTALL +# ----------------------- +# set the default to --disable-fast-install +AC_DEFUN([AC_DISABLE_FAST_INSTALL], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no) +])# AC_DISABLE_FAST_INSTALL + + +# AC_LIBTOOL_PICMODE([MODE]) +# -------------------------- +# implement the --with-pic flag +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +AC_DEFUN([AC_LIBTOOL_PICMODE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +pic_mode=ifelse($#,1,$1,default) +])# AC_LIBTOOL_PICMODE + + +# AC_PROG_EGREP +# ------------- +# This is predefined starting with Autoconf 2.54, so this conditional +# definition can be removed once we require Autoconf 2.54 or later. +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP], +[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep], + [if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi]) + EGREP=$ac_cv_prog_egrep + AC_SUBST([EGREP]) +])]) + + +# AC_PATH_TOOL_PREFIX +# ------------------- +# find a file program which can recognise shared library +AC_DEFUN([AC_PATH_TOOL_PREFIX], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +])# AC_PATH_TOOL_PREFIX + + +# AC_PATH_MAGIC +# ------------- +# find a file program which can recognise a shared library +AC_DEFUN([AC_PATH_MAGIC], +[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# AC_PATH_MAGIC + + +# AC_PROG_LD +# ---------- +# find the path to the GNU or non-GNU linker +AC_DEFUN([AC_PROG_LD], +[AC_ARG_WITH([gnu-ld], + [AC_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no]) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 &5; then + lt_cv_prog_gnu_ld=yes +else + lt_cv_prog_gnu_ld=no +fi]) +with_gnu_ld=$lt_cv_prog_gnu_ld +])# AC_PROG_LD_GNU + + +# AC_PROG_LD_RELOAD_FLAG +# ---------------------- +# find reload flag for linker +# -- PORTME Some linkers may need a different reload flag. +AC_DEFUN([AC_PROG_LD_RELOAD_FLAG], +[AC_CACHE_CHECK([for $LD option to reload object files], + lt_cv_ld_reload_flag, + [lt_cv_ld_reload_flag='-r']) +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +])# AC_PROG_LD_RELOAD_FLAG + + +# AC_DEPLIBS_CHECK_METHOD +# ----------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +AC_DEFUN([AC_DEPLIBS_CHECK_METHOD], +[AC_CACHE_CHECK([how to recognise dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix4* | aix5*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi4*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin* | mingw* | pw32*) + # win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='win32_libid' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method='file_magic Mach-O dynamically linked shared library' + lt_cv_file_magic_cmd='/usr/bin/file -L' + case "$host_os" in + rhapsody* | darwin1.[[012]]) + lt_cv_file_magic_test_file=`/System/Library/Frameworks/System.framework/System` + ;; + *) # Darwin 1.3 on + lt_cv_file_magic_test_file='/usr/lib/libSystem.dylib' + ;; + esac + ;; + +freebsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + if test "$host_cpu" = ia64; then + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + else + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + fi + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + irix5* | nonstopux*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method="file_magic ELF ${libmagic} MSB mips-[[1234]] dynamic lib MIPS - version 1" + ;; + esac + lt_cv_file_magic_test_file=`echo /lib${libsuff}/libc.so*` + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux*) + case $host_cpu in + alpha* | hppa* | i*86 | ia64* | m68* | mips | mipsel | powerpc* | sparc* | s390* | sh*) + lt_cv_deplibs_check_method=pass_all ;; + *) + # glibc up to 2.1.1 does not perform some relocations on ARM + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; + esac + lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so` + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +nto-qnx) + lt_cv_deplibs_check_method=unknown + ;; + +openbsd*) + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB shared object' + else + lt_cv_deplibs_check_method='file_magic OpenBSD.* shared library' + fi + ;; + +osf3* | osf4* | osf5*) + # this will be overridden with pass_all, but let us keep it just in case + lt_cv_deplibs_check_method='file_magic COFF format alpha shared library' + lt_cv_file_magic_test_file=/shlib/libc.so + lt_cv_deplibs_check_method=pass_all + ;; + +sco3.2v5*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + lt_cv_file_magic_test_file=/lib/libc.so + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown +])# AC_DEPLIBS_CHECK_METHOD + + +# AC_PROG_NM +# ---------- +# find the path to a BSD-compatible name lister +AC_DEFUN([AC_PROG_NM], +[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/${ac_tool_prefix}nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + esac + fi + done + IFS="$lt_save_ifs" + test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm +fi]) +NM="$lt_cv_path_NM" +])# AC_PROG_NM + + +# AC_CHECK_LIBM +# ------------- +# check for math library +AC_DEFUN([AC_CHECK_LIBM], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cygwin* | *-*-pw32*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +])# AC_CHECK_LIBM + + +# AC_LIBLTDL_CONVENIENCE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and LTDLINCL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN([AC_LIBLTDL_CONVENIENCE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_CONVENIENCE + + +# AC_LIBLTDL_INSTALLABLE([DIRECTORY]) +# ----------------------------------- +# sets LIBLTDL to the link flags for the libltdl installable library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that LIBLTDL +# and LTDLINCL are not AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If +# DIRECTORY is not provided and an installed libltdl is not found, it is +# assumed to be `libltdl'. LIBLTDL will be prefixed with '${top_builddir}/' +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_builddir and top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN([AC_LIBLTDL_INSTALLABLE], +[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLINCL= + fi + # For backwards non-gettext consistent compatibility... + INCLTDL="$LTDLINCL" +])# AC_LIBLTDL_INSTALLABLE + + +# AC_LIBTOOL_CXX +# -------------- +# enable support for C++ libraries +AC_DEFUN([AC_LIBTOOL_CXX], +[AC_REQUIRE([_LT_AC_LANG_CXX]) +])# AC_LIBTOOL_CXX + + +# _LT_AC_LANG_CXX +# --------------- +AC_DEFUN([_LT_AC_LANG_CXX], +[AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,CXX" | sed 's/^,//'`]) +])# _LT_AC_LANG_CXX + + +# AC_LIBTOOL_F77 +# -------------- +# enable support for Fortran 77 libraries +AC_DEFUN([AC_LIBTOOL_F77], +[AC_REQUIRE([_LT_AC_LANG_F77]) +])# AC_LIBTOOL_F77 + + +# _LT_AC_LANG_F77 +# --------------- +AC_DEFUN([_LT_AC_LANG_F77], +[AC_REQUIRE([AC_PROG_F77]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,F77" | sed 's/^,//'`]) +])# _LT_AC_LANG_F77 + + +# AC_LIBTOOL_GCJ +# -------------- +# enable support for GCJ libraries +AC_DEFUN([AC_LIBTOOL_GCJ], +[AC_REQUIRE([_LT_AC_LANG_GCJ]) +])# AC_LIBTOOL_GCJ + + +# _LT_AC_LANG_GCJ +# --------------- +AC_DEFUN([_LT_AC_LANG_GCJ], +[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[], + [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[], + [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])], + [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])], + [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,GCJ" | sed 's/^,//'`]) +])# _LT_AC_LANG_GCJ + + +# AC_LIBTOOL_RC +# -------------- +# enable support for Windows resource files +AC_DEFUN([AC_LIBTOOL_RC], +[AC_REQUIRE([AC_PROG_RC]) +_LT_AC_SHELL_INIT([tagnames=`echo "$tagnames,RC" | sed 's/^,//'`]) +])# AC_LIBTOOL_RC + + +# AC_LIBTOOL_LANG_C_CONFIG +# ------------------------ +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG]) +AC_DEFUN([_LT_AC_LANG_C_CONFIG], +[lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}\n' + +_LT_AC_SYS_COMPILER + +# +# Check for any special shared library compilation flags. +# +_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)= +if test "$GCC" = no; then + case $host_os in + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_cc_shlib, $1)='-belf' + ;; + esac +fi +if test -n "$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)"; then + AC_MSG_WARN([`$CC' requires `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to build shared libraries]) + if echo "$old_CC $old_CFLAGS " | grep "[[ ]]$]_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)[[[ ]]" >/dev/null; then : + else + AC_MSG_WARN([add `$_LT_AC_TAGVAR(lt_prog_cc_shlib, $1)' to the CC or CFLAGS env variable and reconfigure]) + _LT_AC_TAGVAR(lt_cv_prog_cc_can_build_shared, $1)=no + fi +fi + + +# +# Check to make sure the static flag actually works. +# +AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $_LT_AC_TAGVAR(lt_prog_compiler_static, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1), + $_LT_AC_TAGVAR(lt_prog_compiler_static, $1), + [], + [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=]) + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +# Report which librarie types wil actually be built +AC_MSG_CHECKING([if libtool supports shared libraries]) +AC_MSG_RESULT([$can_build_shared]) + +AC_MSG_CHECKING([whether to build shared libraries]) +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; +esac +AC_MSG_RESULT([$enable_shared]) + +AC_MSG_CHECKING([whether to build static libraries]) +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes +AC_MSG_RESULT([$enable_static]) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_C_CONFIG + + +# AC_LIBTOOL_LANG_CXX_CONFIG +# -------------------------- +# Ensure that the configuration vars for the C compiler are +# suitably defined. Those variables are subsequently used by +# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'. +AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)]) +AC_DEFUN([_LT_AC_LANG_CXX_CONFIG], +[AC_LANG_PUSH(C++) +AC_REQUIRE([AC_PROG_CXX]) +AC_REQUIRE([AC_PROG_CXXCPP]) + +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_AC_TAGVAR(allow_undefined_flag, $1)= +_LT_AC_TAGVAR(always_export_symbols, $1)=no +_LT_AC_TAGVAR(archive_expsym_cmds, $1)= +_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_direct, $1)=no +_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_AC_TAGVAR(hardcode_libdir_separator, $1)= +_LT_AC_TAGVAR(hardcode_minus_L, $1)=no +_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown +_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_AC_TAGVAR(no_undefined_flag, $1)= +_LT_AC_TAGVAR(whole_archive_flag_spec, $1)= +_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Dependencies to place before and after the object being linked: +_LT_AC_TAGVAR(predep_objects, $1)= +_LT_AC_TAGVAR(postdep_objects, $1)= +_LT_AC_TAGVAR(predeps, $1)= +_LT_AC_TAGVAR(postdeps, $1)= +_LT_AC_TAGVAR(compiler_lib_search_path, $1)= + +# Source file extension for C test sources. +ac_ext=cc + +# Object file extension for compiled C test sources. +objext=o +_LT_AC_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;\n" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(int, char *[]) { return(0); }\n' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_AC_SYS_COMPILER + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +CC=${CXX-"c++"} +set dummy $CC +compiler="[$]2" +_LT_AC_TAGVAR(compiler, $1)=$CC +cc_basename=`$echo X"$compiler" | $Xsed -e 's%^.*/%%'` + +# We don't want -fno-exception wen compiling C++ code, so set the +# no_builtin_flag separately +if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' +else + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= +fi + +if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if eval "`$CC -print-prog-name=ld` --version 2>&1" | \ + grep 'GNU ld' > /dev/null; then + with_gnu_ld=yes + + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | \ + grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + +else + GXX=no + with_gnu_ld=no + wlarc= +fi + +# PORTME: fill in a description of your system's C++ link characteristics +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +_LT_AC_TAGVAR(ld_shlibs, $1)=yes +case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GXX" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + postinstall_cmds='dlpath=`sh 2>&1 -c '\''. $dir/${file}i;echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog .libs/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`sh 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $rm \$dlpath' + shlibpath_overrides_runpath=yes + ;; + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}-retain-symbols-file $wl$export_symbols ${wl}--out-implib,$lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + dgux*) + case $cc_basename in + ec++) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + freebsd[12]*) + # C++ shared libraries reported to be fairly broken before switch to ELF + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + freebsd-elf*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + freebsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + ;; + gnu*) + ;; + hpux*) + if test $with_gnu_ld = no; then + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + else + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + fi + fi + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + else + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + fi + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + aCC) + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + fi + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $linker_flags $libobjs $deplibs' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + fi + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + irix5* | irix6*) + case $cc_basename in + CC) + # SGI C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -o $lib' + fi + fi + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + linux*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest.so 2>&1 | grep "ld"`; rm -f libconftest.so; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + cxx) + # Compaq C++ + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + esac + ;; + lynxos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + m88k*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + mvs*) + case $cc_basename in + cxx) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | sed -e "s:-lgcc -lc -lgcc::"' + ;; + osf3*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + osf4* | osf5*) + case $cc_basename in + KCC) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_AC_TAGVAR(archive_cmds, $1)='templib=`echo $lib | sed -e "s/\.so\..*/\.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' + ;; + RCC) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + cxx) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry $objdir/so_locations -o $lib~ + $rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | sed "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + psos*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + sco*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + case $cc_basename in + CC) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + lcc) + # Lucid + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -nolib -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -nolib ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp' + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The C++ compiler is used as linker so we must use $wl + # flag to pass the commands to the underlying system + # linker. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep "\-[[LR]]"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | grep -v '^2\.7' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $linker_flags ${wl}-h $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags~$rm $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\"" + fi + + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + fi + ;; + esac + ;; + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + vxworks*) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; +esac +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_AC_TAGVAR(GCC, $1)="$GXX" +_LT_AC_TAGVAR(LD, $1)="$LD" + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +AC_LIBTOOL_POSTDEP_PREDEP($1) +AC_LIBTOOL_PROG_COMPILER_PIC($1) +AC_LIBTOOL_PROG_CC_C_O($1) +AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1) +AC_LIBTOOL_PROG_LD_SHLIBS($1) +AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1) +AC_LIBTOOL_SYS_LIB_STRIP +AC_LIBTOOL_SYS_DYNAMIC_LINKER($1) +AC_LIBTOOL_DLOPEN_SELF($1) + +AC_LIBTOOL_CONFIG($1) + +AC_LANG_POP +CC="$lt_save_CC" +])# AC_LIBTOOL_LANG_CXX_CONFIG + +# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME]) +# ------------------------ +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[ +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +ifelse([$1],[],[cat > conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext < conftest.$ac_ext <> "$cfgfile" +ifelse([$1], [], +[#! $SHELL + +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# +# This file is part of GNU Libtool: +# Originally by Gordon Matzigkeit , 1996 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +# The names of the tagged configurations supported by this script. +available_tags= + +# ### BEGIN LIBTOOL CONFIG], +[# ### BEGIN LIBTOOL TAG CONFIG: $tagname]) + +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1) + +# Whether or not to disallow shared libs when runtime libs are static +allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$lt_echo + +# The archiver. +AR=$lt_AR +AR_FLAGS=$lt_AR_FLAGS + +# A C compiler. +LTCC=$lt_LTCC + +# A language-specific compiler. +CC=$lt_[]_LT_AC_TAGVAR(compiler, $1) + +# Is the compiler the GNU C compiler? +with_gcc=$_LT_AC_TAGVAR(GCC, $1) + +# An ERE matcher. +EGREP=$lt_EGREP + +# The linker used to build libraries. +LD=$lt_[]_LT_AC_TAGVAR(LD, $1) + +# Whether we need hard or soft links. +LN_S=$lt_LN_S + +# A BSD-compatible nm program. +NM=$lt_NM + +# A sed program that does not truncate output. +SED=$lt_SED + +# A symbol stripping program +STRIP=$STRIP + +# Used to examine libraries when file_magic_cmd begins "file" +MAGIC_CMD=$MAGIC_CMD + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# How to pass a linker flag through the compiler. +wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + +# Object file suffix (normally "o"). +objext="$ac_objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) +pic_mode=$pic_mode + +# What is the maximum length of a command? +max_cmd_len=$lt_cv_sys_max_cmd_len + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) + +# Must we lock files when doing compilation ? +need_locks=$lt_need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1) + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1) + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1) + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1) + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$lt_RANLIB +old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1) +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1) + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) + +# Commands used to build and install a shared archive. +archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1) +archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1) +postinstall_cmds=$lt_postinstall_cmds +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + +# Dependencies to place before the objects being linked to create a +# shared library. +predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1) + +# Dependencies to place before the objects being linked to create a +# shared library. +predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1) + +# Dependencies to place after the objects being linked to create a +# shared library. +postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1) + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1) + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$lt_file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1) + +# Flag that forces no undefined symbols. +no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1) + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$lt_finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1) + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1) + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1) + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1) + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1) + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at relink time. +variables_saved_for_relink="$variables_saved_for_relink" + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1) + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)" + +# Set to yes if exported symbols are required. +always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1) + +# The commands to list exported symbols. +export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1) + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1) + +# Symbols that must always be exported. +include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1) + +ifelse([$1],[], +[# ### END LIBTOOL CONFIG], +[# ### END LIBTOOL TAG CONFIG: $tagname]) + +__EOF__ + +ifelse([$1],[], [ + case $host_os in + aix3*) + cat <<\EOF >> "$cfgfile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || \ + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +]) +else + # If there is no Makefile yet, we rely on a make rule to execute + # `config.status --recheck' to rerun these tests and create the + # libtool script then. + test -f Makefile && make "$ltmain" +fi +])# AC_LIBTOOL_CONFIG + + +# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], +[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl + +_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + + AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI + + +# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE +# --------------------------------- +AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_NM]) +AC_REQUIRE([AC_OBJEXT]) +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) # Its linker distinguishes data from code symbols + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'" + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris* | sysv5*) + symcode='[[BDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGISTW]]' ;; +esac + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*\($ac_symprfx\)$sympat$opt_cr$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext < $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if grep ' nm_test_var$' "$nlist" >/dev/null; then + if grep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.$ac_ext +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext' + + cat <> conftest.$ac_ext +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[[]] = +{ +EOF + sed "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext + cat <<\EOF >> conftest.$ac_ext + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_save_LIBS="$LIBS" + lt_save_CFLAGS="$CFLAGS" + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS="$lt_save_LIBS" + CFLAGS="$lt_save_CFLAGS" + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -f conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi +]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE + + +# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME]) +# --------------------------------------- +AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC], +[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_AC_TAGVAR(lt_prog_compiler_static, $1)= + +AC_MSG_CHECKING([for $compiler option to produce PIC]) + ifelse([$1],[CXX],[ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | os2* | pw32*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for IA64 HP-UX, but not for PA HP-UX. + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + fi + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix4* | aix5*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68) + # Green Hills C++ Compiler + # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + dgux*) + case $cc_basename in + ec++) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="${ac_cv_prog_cc_wl}-a ${ac_cv_prog_cc_wl}archive" + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + *) + ;; + esac + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux*) + case $cc_basename in + KCC) + # KAI C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + cxx) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC) + # Rational C++ 2.4.1 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx) + # Digital/Compaq C++ + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + sco*) + case $cc_basename in + CC) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + *) + ;; + esac + ;; + solaris*) + case $cc_basename in + CC) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx) + # Green Hills C++ Compiler + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC) + # Sun C++ 4.x + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc) + # Lucid + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC) + # NonStop-UX NCC 3.20 + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + unixware*) + ;; + vxworks*) + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + + beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + hpux*) + # PIC is the default for IA64 HP-UX, but not for PA HP-UX. + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + fi + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | pw32* | os2*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + newsos6) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + osf3* | osf4* | osf5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kpic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-dn' + ;; + + solaris*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sunos4*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + uts4*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)]) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then + AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works], + _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1), + [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[GCJ],[],[ -DPIC])], [], + [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +case "$host_os" in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[GCJ],[],[ -DPIC])" + ;; +esac +]) + + +# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME]) +# ------------------------------------ +# See if the linker supports building shared libraries. +AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS], +[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +ifelse([$1],[CXX],[ + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' + case $host_os in + aix4* | aix5*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + *) + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +],[ + runpath_var= + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_AC_TAGVAR(archive_cmds, $1)= + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)= + _LT_AC_TAGVAR(archive_expsym_cmds, $1)= + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)= + _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + _LT_AC_TAGVAR(thread_safe_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_AC_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_" + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case $host_os in + aix3* | aix4* | aix5*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can't use + # them. + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32*) + # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=no + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 ${wl}--out-implib,$lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}-retain-symbols-file $wl$export_symbols ${wl}--out-implib,$lib' + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nodefaultlibs $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + _LT_AC_TAGVAR(ld_shlibs, $1)=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sunos4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_AC_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = yes; then + runpath_var=LD_RUN_PATH + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)= + fi + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix4* | aix5*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + if $NM -V 2>&1 | grep 'GNU' > /dev/null; then + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + else + _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_AC_TAGVAR(archive_cmds, $1)='' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + else + # We have old collect2 + _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$no_entry_flag \${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an empty executable. + _LT_AC_SYS_LIBPATH_AIX + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + # -bexpall does not export symbols beginning with underscore (_) + _LT_AC_TAGVAR(always_export_symbols, $1)=yes + # Exported symbols can be pulled into shared objects from archives + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=' ' + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds it's shared libraries. + _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs $compiler_flags ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + # see comment about different semantics on the GNU ld section + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + bsdi4*) + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs' + fix_srcfile_path='`cygpath -w "$srcfile"`' + _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + darwin* | rhapsody*) + case "$host_os" in + rhapsody* | darwin1.[[012]]) + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress' + ;; + *) # Darwin 1.3 on + _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined suppress' + ;; + esac + + # FIXME: Relying on posixy $() will cause problems for + # cross-compilation, but unfortunately the echo tests do not + # yet detect zsh echo's removal of \ escapes. Also zsh mangles + # `"' quotes if we put them in here... so don't! + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r ${wl}-bind_at_load -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test .$module != .yes && echo -install_name $rpath/$soname $verstring)' + # We need to add '_' to the symbols in $export_symbols first + #_LT_AC_TAGVAR(archive_expsym_cmds, $1)="$_LT_AC_TAGVAR(archive_cmds, $1)"' && strip -s $export_symbols' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience' + ;; + + dgux*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9* | hpux10* | hpux11*) + if test "$GCC" = yes; then + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + esac + else + case $host_os in + hpux9*) + _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + ;; + *) + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname -o $lib $libobjs $deplibs $linker_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + ;; + esac + fi + if test "$host_cpu" = ia64; then + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + else + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + fi + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + openbsd*) + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + ;; + + os2*) + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "-exported_symbol " >> $lib.exp; echo "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~ + $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib~$rm $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + sco3.2v5*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; + esac + _LT_AC_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_AC_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_AC_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4.2uw2*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_direct, $1)=yes + _LT_AC_TAGVAR(hardcode_minus_L, $1)=no + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[[78]]* | unixware7*) + _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z ${wl}text' + if test "$GCC" = yes; then + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + runpath_var='LD_RUN_PATH' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv5*) + _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_AC_TAGVAR(ld_shlibs, $1)=no + ;; + esac + fi +]) +AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)]) +test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +# +# Do we need to explicitly link libc? +# +_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes +if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_AC_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_MSG_CHECKING([whether -lc should be explicitly linked in]) + $rm conftest* + printf "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1) + _LT_AC_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) + then + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no + else + _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $rm conftest* + AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)]) + ;; + esac +fi +])# AC_LIBTOOL_PROG_LD_SHLIBS + + +# _LT_AC_FILE_LTDLL_C +# ------------------- +# Be careful that the start marker always follows a newline. +AC_DEFUN([_LT_AC_FILE_LTDLL_C], [ +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ +])# _LT_AC_FILE_LTDLL_C + + +# _LT_AC_TAGVAR(VARNAME, [TAGNAME]) +# --------------------------------- +AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])]) + + +# old names +AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL]) +AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) +AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) +AC_DEFUN([AM_PROG_LD], [AC_PROG_LD]) +AC_DEFUN([AM_PROG_NM], [AC_PROG_NM]) + +# This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL]) + +AC_DEFUN([LT_AC_PROG_GCJ], +[AC_CHECK_TOOL(GCJ, gcj, no) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS) +]) + +AC_DEFUN([LT_AC_PROG_RC], +[AC_CHECK_TOOL(RC, windres, no) +]) + +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +# LT_AC_PROG_SED +# -------------- +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +AC_DEFUN([LT_AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && break + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +SED=$lt_cv_path_SED +]) +AC_MSG_RESULT([$SED]) +]) diff --git a/share/aclocal/ltdl.m4 b/share/aclocal/ltdl.m4 new file mode 100644 index 00000000..26fb0668 --- /dev/null +++ b/share/aclocal/ltdl.m4 @@ -0,0 +1,428 @@ +## ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- +## Copyright (C) 1999-2000 Free Software Foundation, Inc. +## +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, but +## WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +## +## As a special exception to the GNU General Public License, if you +## distribute this file as part of a program that contains a +## configuration script generated by Autoconf, you may include it under +## the same distribution terms that you use for the rest of that program. + +# serial 6 AC_LIB_LTDL + +# AC_WITH_LTDL +# ------------ +# Clients of libltdl can use this macro to allow the installer to +# choose between a shipped copy of the ltdl sources or a preinstalled +# version of the library. +AC_DEFUN([AC_WITH_LTDL], +[AC_REQUIRE([AC_LIB_LTDL]) +AC_SUBST([LIBLTDL]) +AC_SUBST([INCLTDL]) + +# Unless the user asks us to check, assume no installed ltdl exists. +use_installed_libltdl=no + +AC_ARG_WITH([included_ltdl], + [ --with-included-ltdl use the GNU ltdl sources included here]) + +if test "x$with_included_ltdl" != xyes; then + # We are not being forced to use the included libltdl sources, so + # decide whether there is a useful installed version we can use. + AC_CHECK_HEADER([ltdl.h], + [AC_CHECK_LIB([ltdl], [lt_dlcaller_register], + [with_included_ltdl=no], + [with_included_ltdl=yes]) + ]) +fi + +if test "x$enable_ltdl_install" != xyes; then + # If the user did not specify an installable libltdl, then default + # to a convenience lib. + AC_LIBLTDL_CONVENIENCE +fi + +if test "x$with_included_ltdl" = xno; then + # If the included ltdl is not to be used. then Use the + # preinstalled libltdl we found. + AC_DEFINE([HAVE_LTDL], 1, + [Define this if a modern libltdl is already installed]) + LIBLTDL=-lltdl +fi + +# Report our decision... +AC_MSG_CHECKING([whether to use included libltdl]) +AC_MSG_RESULT([$with_included_ltdl]) + +AC_CONFIG_SUBDIRS([libltdl]) +])# AC_WITH_LTDL + + +# AC_LIB_LTDL +# ----------- +# Perform all the checks necessary for compilation of the ltdl objects +# -- including compiler checks and header checks. +AC_DEFUN([AC_LIB_LTDL], +[AC_PREREQ(2.50) +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_C_CONST]) +AC_REQUIRE([AC_HEADER_STDC]) +AC_REQUIRE([AC_HEADER_DIRENT]) +AC_REQUIRE([_LT_AC_CHECK_DLFCN]) +AC_REQUIRE([AC_LTDL_ENABLE_INSTALL]) +AC_REQUIRE([AC_LTDL_SHLIBEXT]) +AC_REQUIRE([AC_LTDL_SHLIBPATH]) +AC_REQUIRE([AC_LTDL_SYSSEARCHPATH]) +AC_REQUIRE([AC_LTDL_OBJDIR]) +AC_REQUIRE([AC_LTDL_DLPREOPEN]) +AC_REQUIRE([AC_LTDL_DLLIB]) +AC_REQUIRE([AC_LTDL_SYMBOL_USCORE]) +AC_REQUIRE([AC_LTDL_DLSYM_USCORE]) +AC_REQUIRE([AC_LTDL_SYS_DLOPEN_DEPLIBS]) +AC_REQUIRE([AC_LTDL_FUNC_ARGZ]) + +AC_CHECK_HEADERS([assert.h ctype.h errno.h malloc.h memory.h stdlib.h \ + stdio.h unistd.h]) +AC_CHECK_HEADERS([dl.h sys/dl.h dld.h]) +AC_CHECK_HEADERS([string.h strings.h], [break]) + +AC_CHECK_FUNCS([strchr index], [break]) +AC_CHECK_FUNCS([strrchr rindex], [break]) +AC_CHECK_FUNCS([memcpy bcopy], [break]) +AC_CHECK_FUNCS([memmove strcmp]) +AC_CHECK_FUNCS([closedir opendir readdir]) +])# AC_LIB_LTDL + + +# AC_LTDL_ENABLE_INSTALL +# ---------------------- +AC_DEFUN([AC_LTDL_ENABLE_INSTALL], +[AC_ARG_ENABLE([ltdl-install], + [AC_HELP_STRING([--enable-ltdl-install], [install libltdl])]) + +AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) +AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno) +])])# AC_LTDL_ENABLE_INSTALL + + +# AC_LTDL_SYS_DLOPEN_DEPLIBS +# -------------------------- +AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_CACHE_CHECK([whether deplibs are loaded by dlopen], + [libltdl_cv_sys_dlopen_deplibs], + [# PORTME does your system automatically load deplibs for dlopen? + # or its logical equivalent (e.g. shl_load for HP-UX < 11) + # For now, we just catch OSes we know something about -- in the + # future, we'll try test this programmatically. + libltdl_cv_sys_dlopen_deplibs=unknown + case "$host_os" in + aix3*|aix4.1.*|aix4.2.*) + # Unknown whether this is true for these versions of AIX, but + # we want this `case' here to explicitly catch those versions. + libltdl_cv_sys_dlopen_deplibs=unknown + ;; + aix[[45]]*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + gnu*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + hpux10*|hpux11*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + irix[[12345]]*|irix6.[[01]]*) + # Catch all versions of IRIX before 6.2, and indicate that we don't + # know how it worked for any of those versions. + libltdl_cv_sys_dlopen_deplibs=unknown + ;; + irix*) + # The case above catches anything before 6.2, and it's known that + # at 6.2 and later dlopen does load deplibs. + libltdl_cv_sys_dlopen_deplibs=yes + ;; + linux*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + netbsd*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + openbsd*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + osf[[1234]]*) + # dlopen did load deplibs (at least at 4.x), but until the 5.x series, + # it did *not* use an RPATH in a shared library to find objects the + # library depends on, so we explictly say `no'. + libltdl_cv_sys_dlopen_deplibs=no + ;; + osf5.0|osf5.0a|osf5.1) + # dlopen *does* load deplibs and with the right loader patch applied + # it even uses RPATH in a shared library to search for shared objects + # that the library depends on, but there's no easy way to know if that + # patch is installed. Since this is the case, all we can really + # say is unknown -- it depends on the patch being installed. If + # it is, this changes to `yes'. Without it, it would be `no'. + libltdl_cv_sys_dlopen_deplibs=unknown + ;; + osf*) + # the two cases above should catch all versions of osf <= 5.1. Read + # the comments above for what we know about them. + # At > 5.1, deplibs are loaded *and* any RPATH in a shared library + # is used to find them so we can finally say `yes'. + libltdl_cv_sys_dlopen_deplibs=yes + ;; + solaris*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + esac + ]) +if test "$libltdl_cv_sys_dlopen_deplibs" != yes; then + AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], + [Define if the OS needs help to load dependent libraries for dlopen().]) +fi +])# AC_LTDL_SYS_DLOPEN_DEPLIBS + + +# AC_LTDL_SHLIBEXT +# ---------------- +AC_DEFUN([AC_LTDL_SHLIBEXT], +[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) +AC_CACHE_CHECK([which extension is used for shared libraries], + [libltdl_cv_shlibext], + [ac_last= + for ac_spec in $library_names_spec; do + ac_last="$ac_spec" + done + echo "$ac_last" | [sed 's/\[.*\]//;s/^[^.]*//;s/\$.*$//;s/\.$//'] > conftest + libltdl_cv_shlibext=`cat conftest` + rm -f conftest + ]) +if test -n "$libltdl_cv_shlibext"; then + AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext", + [Define to the extension used for shared libraries, say, ".so".]) +fi +])# AC_LTDL_SHLIBEXT + + +# AC_LTDL_SHLIBPATH +# ----------------- +AC_DEFUN([AC_LTDL_SHLIBPATH], +[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) +AC_CACHE_CHECK([which variable specifies run-time library path], + [libltdl_cv_shlibpath_var], [libltdl_cv_shlibpath_var="$shlibpath_var"]) +if test -n "$libltdl_cv_shlibpath_var"; then + AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var", + [Define to the name of the environment variable that determines the dynamic library search path.]) +fi +])# AC_LTDL_SHLIBPATH + + +# AC_LTDL_SYSSEARCHPATH +# --------------------- +AC_DEFUN([AC_LTDL_SYSSEARCHPATH], +[AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER]) +AC_CACHE_CHECK([for the default library search path], + [libltdl_cv_sys_search_path], + [libltdl_cv_sys_search_path="$sys_lib_dlsearch_path_spec"]) +if test -n "$libltdl_cv_sys_search_path"; then + sys_search_path= + for dir in $libltdl_cv_sys_search_path; do + if test -z "$sys_search_path"; then + sys_search_path="$dir" + else + sys_search_path="$sys_search_path$PATH_SEPARATOR$dir" + fi + done + AC_DEFINE_UNQUOTED(LTDL_SYSSEARCHPATH, "$sys_search_path", + [Define to the system default library search path.]) +fi +])# AC_LTDL_SYSSEARCHPATH + + +# AC_LTDL_OBJDIR +# -------------- +AC_DEFUN([AC_LTDL_OBJDIR], +[AC_CACHE_CHECK([for objdir], + [libltdl_cv_objdir], + [libltdl_cv_objdir="$objdir" + if test -n "$objdir"; then + : + else + rm -f .libs 2>/dev/null + mkdir .libs 2>/dev/null + if test -d .libs; then + libltdl_cv_objdir=.libs + else + # MS-DOS does not allow filenames that begin with a dot. + libltdl_cv_objdir=_libs + fi + rmdir .libs 2>/dev/null + fi + ]) +AC_DEFINE_UNQUOTED(LTDL_OBJDIR, "$libltdl_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# AC_LTDL_OBJDIR + + +# AC_LTDL_DLPREOPEN +# ----------------- +AC_DEFUN([AC_LTDL_DLPREOPEN], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) +AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], + [libltdl_cv_preloaded_symbols], + [if test -n "$lt_cv_sys_global_symbol_pipe"; then + libltdl_cv_preloaded_symbols=yes + else + libltdl_cv_preloaded_symbols=no + fi + ]) +if test x"$libltdl_cv_preloaded_symbols" = xyes; then + AC_DEFINE(HAVE_PRELOADED_SYMBOLS, 1, + [Define if libtool can extract symbol lists from object files.]) +fi +])# AC_LTDL_DLPREOPEN + + +# AC_LTDL_DLLIB +# ------------- +AC_DEFUN([AC_LTDL_DLLIB], +[LIBADD_DL= +AC_SUBST(LIBADD_DL) +AC_LANG_PUSH([C]) + +AC_CHECK_FUNC([shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.])], + [AC_CHECK_LIB([dld], [shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LIBADD_DL="$LIBADD_DL -ldld"], + [AC_CHECK_LIB([dl], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DL="-ldl" libltdl_cv_lib_dl_dlopen="yes"], + [AC_TRY_LINK([#if HAVE_DLFCN_H +# include +#endif + ], + [dlopen(0, 0);], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) libltdl_cv_func_dlopen="yes"], + [AC_CHECK_LIB([svld], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DL="-lsvld" libltdl_cv_func_dlopen="yes"], + [AC_CHECK_LIB([dld], [dld_link], + [AC_DEFINE([HAVE_DLD], [1], + [Define if you have the GNU dld library.]) + LIBADD_DL="$LIBADD_DL -ldld" + ]) + ]) + ]) + ]) + ]) +]) + +if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes +then + lt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DL" + AC_CHECK_FUNCS([dlerror]) + LIBS="$lt_save_LIBS" +fi +AC_LANG_POP +])# AC_LTDL_DLLIB + + +# AC_LTDL_SYMBOL_USCORE +# --------------------- +# does the compiler prefix global symbols with an underscore? +AC_DEFUN([AC_LTDL_SYMBOL_USCORE], +[AC_REQUIRE([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE]) +AC_CACHE_CHECK([for _ prefix in compiled symbols], + [ac_cv_sys_symbol_underscore], + [ac_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext < $ac_nlist) && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + ac_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&AC_FD_CC + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AC_FD_CC + fi + else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.c >&AC_FD_CC + fi + rm -rf conftest* + ]) +])# AC_LTDL_SYMBOL_USCORE + + +# AC_LTDL_DLSYM_USCORE +# -------------------- +AC_DEFUN([AC_LTDL_DLSYM_USCORE], +[AC_REQUIRE([AC_LTDL_SYMBOL_USCORE]) +if test x"$ac_cv_sys_symbol_underscore" = xyes; then + if test x"$libltdl_cv_func_dlopen" = xyes || + test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then + AC_CACHE_CHECK([whether we have to add an underscore for dlsym], + [libltdl_cv_need_uscore], + [libltdl_cv_need_uscore=unknown + save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DL" + _LT_AC_TRY_DLOPEN_SELF( + [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], + [], [libltdl_cv_need_uscore=cross]) + LIBS="$save_LIBS" + ]) + fi +fi + +if test x"$libltdl_cv_need_uscore" = xyes; then + AC_DEFINE(NEED_USCORE, 1, + [Define if dlsym() requires a leading underscore in symbol names.]) +fi +])# AC_LTDL_DLSYM_USCORE + +# AC_LTDL_FUNC_ARGZ +# ----------------- +AC_DEFUN([AC_LTDL_FUNC_ARGZ], +[AC_CHECK_HEADERS([argz.h]) + +AC_CHECK_TYPES([error_t], + [], + [AC_DEFINE([error_t], [int], + [Define to a type to use for `error_t' if it is not otherwise available.])], + [#if HAVE_ARGZ_H +# include +#endif]) + +AC_CHECK_FUNCS([argz_append argz_create_sep argz_insert argz_next argz_stringify]) +])# AC_LTDL_FUNC_ARGZ diff --git a/share/autoconf/Autom4te/General.pm b/share/autoconf/Autom4te/General.pm index 3a137344..0e007071 100644 --- a/share/autoconf/Autom4te/General.pm +++ b/share/autoconf/Autom4te/General.pm @@ -1,5 +1,5 @@ # autoconf -- create `configure' using m4 macros -# Copyright (C) 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,32 +13,15 @@ # 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., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. package Autom4te::General; -=head1 NAME - -Autom4te::General - general support functions for Autoconf and Automake - -=head1 SYNOPSIS - - use Autom4te::General - -=head1 DESCRIPTION - -This perl module provides various general purpose support functions -used in several executables of the Autoconf and Automake packages. - -=cut - use 5.005_03; use Exporter; -use Autom4te::ChannelDefs; -use Autom4te::Channels; use File::Basename; -use File::Path (); +use File::Spec; use File::stat; use IO::File; use Carp; @@ -54,9 +37,10 @@ my @export_vars = # Functions we define and export. my @export_subs = - qw (&debug - &getopt &mktmpdir - &uniq); + qw (&backname &catfile &canonpath &debug &error + &file_name_is_absolute &find_configure_ac &find_file + &getopt &mktmpdir &mtime + &uniq &update_file &up_to_date_p &verbose &xsystem &xqx); # Functions we forward (coming from modules we use). my @export_forward_subs = @@ -64,148 +48,75 @@ my @export_forward_subs = @EXPORT = (@export_vars, @export_subs, @export_forward_subs); - # Variable we share with the main package. Be sure to have a single # copy of them: using `my' together with multiple inclusion of this # package would introduce several copies. - -=head2 Global Variables - -=over 4 - -=item C<$debug> - -Set this variable to 1 if debug messages should be enabled. Debug -messages are meant for developpers only, or when tracking down an -incorrect execution. - -=cut - use vars qw ($debug); $debug = 0; -=item C<$force> - -Set this variable to 1 to recreate all the files, or to consider all -the output files are obsolete. - -=cut - +# Recreate all the files, or consider all the output files are obsolete. use vars qw ($force); $force = undef; -=item C<$help> - -Set to the help message associated to the option C<--help>. - -=cut - use vars qw ($help); $help = undef; -=item C<$me> - -The name of this application, as should be used in diagostic messages. - -=cut - use vars qw ($me); $me = basename ($0); -=item C<$tmp> - -The name of the temporary directory created by C. Left -C otherwise. - -=cut - # Our tmp dir. use vars qw ($tmp); $tmp = undef; -=item C<$verbose> - -Enable verbosity messages. These messages are meant for ordinary -users, and typically make explicit the steps being performed. - -=cut - use vars qw ($verbose); $verbose = 0; -=item C<$version> - -Set to the version message associated to the option C<--version>. - -=cut - use vars qw ($version); $version = undef; -=back -=cut +## ------------ ## +## Prototypes. ## +## ------------ ## +sub verbose (@); ## ----- ## ## END. ## ## ----- ## -=head2 Functions - -=over 4 - -=item C - -Filter Perl's exit codes, delete any temporary directory (unless -C<$debug>), and exit nonzero whenever closing C fails. - -=cut # END # --- +# Exit nonzero whenever closing STDOUT fails. +# Ideally we should `exit ($? >> 8)', unfortunately, for some reason +# I don't understand, whenever we `exit (1)' somewhere in the code, +# we arrive here with `$? = 29'. I suspect some low level END routine +# might be responsible. In this case, be sure to exit 1, not 29. sub END { - # $? contains the exit status we will return. - # It was set using one of the following ways: - # - # 1) normal termination - # this sets $? = 0 - # 2) calling `exit (n)' - # this sets $? = n - # 3) calling die or friends (croak, confess...): - # a) when $! is non-0 - # this set $? = $! - # b) when $! is 0 but $? is not - # this sets $? = ($? >> 8) (i.e., the exit code of the - # last program executed) - # c) when both $! and $? are 0 - # this sets $? = 255 - # - # Cases 1), 2), and 3b) are fine, but we prefer $? = 1 for 3a) and 3c). - my $status = $?; - $status = 1 if ($! && $! == $?) || $? == 255; - # (Note that we cannot safely distinguish calls to `exit (n)' - # from calls to die when `$! = n'. It's not big deal because - # we only call `exit (0)' or `exit (1)'.) + my $exit_status = $? ? 1 : 0; + + use POSIX qw (_exit); if (!$debug && defined $tmp && -d $tmp) { - local $SIG{__WARN__} = sub { $status = 1; warn $_[0] }; - File::Path::rmtree $tmp; + if (<$tmp/*>) + { + unlink <$tmp/*> + or carp ("$me: cannot empty $tmp: $!\n"), _exit (1); + } + rmdir $tmp + or carp ("$me: cannot remove $tmp: $!\n"), _exit (1); } # This is required if the code might send any output to stdout # E.g., even --version or --help. So it's best to do it unconditionally. - if (! close STDOUT) - { - print STDERR "$me: closing standard output: $!\n"; - $? = 1; - return; - } + close STDOUT + or (carp "$me: closing standard output: $!\n"), _exit (1); - $? = $status; + _exit ($exit_status); } @@ -214,12 +125,55 @@ sub END ## ----------- ## -=item C +# $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 $underscore = $_; + my @res; + + foreach (split (/\//, $file)) + { + next if $_ eq '.' || $_ eq ''; + if ($_ eq '..') + { + pop @res; + } + else + { + push (@res, '..'); + } + } + + $_ = $underscore; + return canonpath (catfile (@res)) +} + + +# $FILE +# &catfile (@COMPONENT) +# --------------------- +sub catfile (@) +{ + my (@component) = @_; + return File::Spec->catfile (@component); +} -If the debug mode is enabled (C<$debug> and C<$verbose>), report the -C<@message> on C, signed with the name of the program. -=cut +# $FILE +# &canonpath ($FILE) +# ------------------ +sub canonpath ($) +{ + my ($file) = @_; + return File::Spec->canonpath ($file); +} + # &debug(@MESSAGE) # ---------------- @@ -231,16 +185,98 @@ sub debug (@) } -=item C +# &error (@MESSAGE) +# ----------------- +# Same as die or confess, depending on $debug. +sub error (@) +{ + if ($debug) + { + confess "$me: ", @_, "\n"; + } + else + { + die "$me: ", @_, "\n"; + } +} + -Wrapper around C. In addition to the user C