diff --git a/third_party/nlbuild-autotools/repo/.default-version b/third_party/nlbuild-autotools/repo/.default-version new file mode 100644 index 000000000..c068b2447 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/.default-version @@ -0,0 +1 @@ +1.4 diff --git a/third_party/nlbuild-autotools/repo/.gitignore b/third_party/nlbuild-autotools/repo/.gitignore new file mode 100644 index 000000000..33232b3f3 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/.gitignore @@ -0,0 +1 @@ +.local-version diff --git a/third_party/nlbuild-autotools/repo/CHANGES b/third_party/nlbuild-autotools/repo/CHANGES new file mode 100644 index 000000000..c96605c6a --- /dev/null +++ b/third_party/nlbuild-autotools/repo/CHANGES @@ -0,0 +1,63 @@ +1.4 (2017-06-15) + + * Remove package archives and prebuilt in-package binaries. + * Ensure that GNU tool build process is completely self-sufficient + and has no dependencies on installed host binaries. + * Add support for generating versioned core and prebuilt package binary + distirubtions. + * Ensure that 'bootstrap' can work with either prebuilt in-package + binaries or with installed host binaries. + +1.3.1 (2017-05-10) + + * Specify the correct m4 URL. + +1.3 (2016-12-05) + + * Added the support for detection of supported C++ version. + +1.2.2 (2016-08-29) + + * Use the arguments passed, as designed and intended, to + NL_PROG_LNDIR rather than hard-coded values for the GNU cp + fallback. + +1.2.1 (2016-07-13) + + * Make the 'pretty' and 'pretty-check' targets dependent on + $(PRETTY_FILES) and then iterate on a filtered version of $(^) so + that make's VPATH engine can be leveraged to find sources and + headers that are not in directly stat-able paths listed in + $(PRETTY_FILES). + +1.2 (2016-06-01) + + * Added support for coding style formatting and checking targets. + +1.1.2 (2016-03-19) + + * Improve the code coverage generation process to cover an entire + project's source. + +1.1.1 (2015-12-10) + + * Properly handle package optionality when using pkg-config to + detect external packages. + +1.1 (2015-11-10) + + * Added support for a recursive 'install-headers' target to allow + packages that wish to leverage it to install their public headers + and only their public headers to DESTDIR on 'make install-headers' + without performing any additional build actions. + +1.0.1 (2015-10-27) + + * Refactored NL_WITH_PACKAGE into NL_WITH_REQUIRED_EXTERNAL_PACKAGE, + NL_WITH_OPTIONAL_EXTERNAL_PACKAGE, NL_WITH_REQUIRED_INTERNAL_PACKAGE, + and NL_WITH_OPTIONAL_INTERNAL_PACKAGE. + +1.0 (2015-03-19) + + * Initial revision with GNU m4 1.4.17, autoconf 2.68, automake 1.14.1, + libtool 2.4.2, make 3.82, and coreutils 8.21. diff --git a/third_party/nlbuild-autotools/repo/Common.mak b/third_party/nlbuild-autotools/repo/Common.mak new file mode 100644 index 000000000..fdfb29ad7 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/Common.mak @@ -0,0 +1,129 @@ +# +# Copyright 2017 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This make file header defines common variables, rules, and +# targets for maintaining nlbuild-autotools distributions. +# + +.DEFAULT_GOAL = all + +# +# This package +# +PACKAGE := nlbuild-autotools + +# +# Tools +# +CAT ?= cat +CHMOD ?= chmod +CMP ?= cmp +FIND ?= find +GZIP ?= gzip +MKDIR ?= mkdir +MV ?= mv +RM ?= rm +SED ?= sed +TAR ?= tar +XZ ?= xz + +dist_tar_ARCHIVE = $(TAR) -chof - + +dist_tgz_ARCHIVE = $(dist_tar_ARCHIVE) +dist_tgz_COMPRESS = $(GZIP) --best -c + +dist_txz_ARCHIVE = $(dist_tar_ARCHIVE) +dist_txz_COMPRESS = $(XZ) --extreme -c + +TGZ_EXTENSION := .tar.gz +TXZ_EXTENSION := .tar.xz + +DIST_TARGETS ?= dist-tgz dist-txz +DIST_ARCHIVES = $(dist_tgz_TARGETS) $(dist_txz_TARGETS) + +# +# Verbosity +# + +NL_DEFAULT_VERBOSITY = 0 + +NL_V_AT = $(NL_V_AT_$(V)) +NL_V_AT_ = $(NL_V_AT_$(NL_DEFAULT_VERBOSITY)) +NL_V_AT_0 = @ +NL_V_AT_1 = + +NL_V_MAKE = $(NL_V_MAKE_$(V)) +NL_V_MAKE_ = $(NL_V_MAKE_$(NL_DEFAULT_VERBOSITY)) +NL_V_MAKE_0 = @echo " MAKE $(@)"; +NL_V_MAKE_1 = + +NL_V_MKDIR_P = $(NL_V_MKDIR_P_$(V)) +NL_V_MKDIR_P_ = $(NL_V_MKDIR_P_$(NL_DEFAULT_VERBOSITY)) +NL_V_MKDIR_P_0 = @echo " MKDIR $(1)"; +NL_V_MKDIR_P_1 = + +NL_V_RMDIR = $(NL_V_RMDIR_$(V)) +NL_V_RMDIR_ = $(NL_V_RMDIR_$(NL_DEFAULT_VERBOSITY)) +NL_V_RMDIR_0 = @echo " RMDIR $(1)"; +NL_V_RMDIR_1 = + +NL_V_TGZ = $(NL_V_TGZ_$(V)) +NL_V_TGZ_ = $(NL_V_TGZ_$(NL_DEFAULT_VERBOSITY)) +NL_V_TGZ_0 = @echo " TGZ $(@)"; +NL_V_TGZ_1 = + +NL_V_TXZ = $(NL_V_TXZ_$(V)) +NL_V_TXZ_ = $(NL_V_TXZ_$(NL_DEFAULT_VERBOSITY)) +NL_V_TXZ_0 = @echo " TXZ $(@)"; +NL_V_TXZ_1 = + +# +# nl-create-dir +# +# Create the specified directory, including any parent directories +# that may not exist. +# +define nl-create-dir +$(NL_V_AT)echo " MKDIR $(1)"; \ +$(MKDIR) -p "$(1)" +endef # nl-create-dir + +# +# nl-remove-dir +# +# If the specified directory exists, then ensure all of the +# directories are writable by the current user, and then forcibly +# remove the directory and all of its contents, sleeping for five (5) +# seconds and failure before trying the removal again. +# +define nl-remove-dir +$(NL_V_RMDIR) \ +if [ -d "$(1)" ]; then \ + $(FIND) "$(1)" -type d ! -perm -200 -exec $(CHMOD) u+w {} ';' \ + && $(RM) -rf "$(1)" \ + || { sleep 5 && $(RM) -rf "$(1)"; }; \ +fi +endef # nl-remove-dir + +clean-local: + $(NL_V_AT)$(RM) -f *~ "#"* + +help: + @echo "This make file shold not be needed for end users and system " + @echo "integrators of $(PACKAGE). It should only be needed by " + @echo "maintainers producing distributions of $(PACKAGE)." diff --git a/third_party/nlbuild-autotools/repo/MANIFEST b/third_party/nlbuild-autotools/repo/MANIFEST new file mode 100644 index 000000000..40f80d421 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/MANIFEST @@ -0,0 +1,86 @@ +.default-version +.gitignore +CHANGES +CONTRIBUTING.md +LICENSE +MANIFEST +Makefile +README.md +autoconf/ar-lib +autoconf/compile +autoconf/config.guess +autoconf/config.sub +autoconf/depcomp +autoconf/install-sh +autoconf/ltmain.sh +autoconf/m4/ax_check_compiler.m4 +autoconf/m4/ax_check_file.m4 +autoconf/m4/ax_check_preprocessor.m4 +autoconf/m4/ax_compare_version.m4 +autoconf/m4/ax_cxx_compile_stdcxx.m4 +autoconf/m4/ax_cxx_compile_stdcxx_0x.m4 +autoconf/m4/ax_cxx_compile_stdcxx_11.m4 +autoconf/m4/ax_cxx_compile_stdcxx_14.m4 +autoconf/m4/ax_jni_include_dir.m4 +autoconf/m4/ax_prog_doxygen.m4 +autoconf/m4/ax_pthread.m4 +autoconf/m4/libtool.m4 +autoconf/m4/ltoptions.m4 +autoconf/m4/ltsugar.m4 +autoconf/m4/ltversion.m4 +autoconf/m4/lt~obsolete.m4 +autoconf/m4/nl_enable_coverage.m4 +autoconf/m4/nl_enable_coverage_reporting.m4 +autoconf/m4/nl_enable_debug.m4 +autoconf/m4/nl_enable_docs.m4 +autoconf/m4/nl_enable_optimization.m4 +autoconf/m4/nl_enable_tests.m4 +autoconf/m4/nl_enable_werror.m4 +autoconf/m4/nl_filtered_canonical.m4 +autoconf/m4/nl_prog_lndir.m4 +autoconf/m4/nl_werror.m4 +autoconf/m4/nl_with_package.m4 +autoconf/m4/pkg.m4 +autoconf/missing +autoconf/mkinstalldirs +autoconf/py-compile +autoconf/test-driver +automake/post.am +automake/post/rules.am +automake/post/rules/coverage.am +automake/post/rules/headers.am +automake/post/rules/pretty.am +automake/pre.am +automake/pre/macros.am +automake/pre/macros/constants.am +automake/pre/macros/coverage.am +automake/pre/macros/paths.am +automake/pre/macros/pretty.am +automake/pre/macros/subdirs.am +automake/pre/macros/verbosity.am +etc/lcov.config +examples/Doxyfile.in +examples/Makefile-doc.am +examples/Makefile-fps.am +examples/Makefile-src.am +examples/Makefile-tests.am +examples/Makefile-toplevel.am +examples/bootstrap +examples/configure.ac +scripts/bootstrap +scripts/bootstrap-configure +scripts/mkskeleton +scripts/mkversion +tools/packages/autoconf/autoconf.url +tools/packages/autoconf/autoconf.version +tools/packages/automake/automake.url +tools/packages/automake/automake.version +tools/packages/coreutils/coreutils.url +tools/packages/coreutils/coreutils.version +tools/packages/libtool/libtool.url +tools/packages/libtool/libtool.version +tools/packages/m4/m4.url +tools/packages/m4/m4.version +tools/packages/make/make.url +tools/packages/make/make.version + diff --git a/third_party/nlbuild-autotools/repo/Makefile b/third_party/nlbuild-autotools/repo/Makefile new file mode 100644 index 000000000..44e53f3f1 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/Makefile @@ -0,0 +1,225 @@ +# +# Copyright 2017 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This make file supports generating distributions of +# nlbuild-autotools. +# + +include Common.mak + +# +# Build directories +# + +builddir := . +top_builddir := . +abs_builddir := $(CURDIR) +abs_top_builddir := $(CURDIR) + +# +# Source directories +# + +srcdir := . +top_srcdir := . +abs_srcdir := $(CURDIR) +abs_top_srcdir := $(CURDIR) + +distdir = $(PACKAGE)-$(VERSION) + +dist_tgz_TARGETS = $(distdir)$(TGZ_EXTENSION) +dist_txz_TARGETS = $(distdir)$(TXZ_EXTENSION) + +DISTFILES := $(shell $(CAT) MANIFEST) + +# +# Package version files: +# +# .default-version - The default package version. This file is ALWAYS checked +# in and should always represent the current baseline +# version of the package. +# +# .dist-version - The distributed package version. This file is NEVER +# checked in within the upstream repository, is auto- +# generated, and is only found in the package distribution. +# +# .local-version - The current source code controlled package version. This +# file is NEVER checked in within the upstream repository, +# is auto-generated, and can always be found in both the +# build tree and distribution. +# +# When present, the .local-version file is preferred first, the +# .dist-version second, and the .default-version last. +# + +VERSION_FILE := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version)) + +PACKAGE_VERSION ?= $(shell $(CAT) $(VERSION_FILE) 2> /dev/null) + +VERSION = $(PACKAGE_VERSION) + +# +# Verbosity +# +_NL_V_COPY = $(_NL_V_COPY_$(V)) +_NL_V_COPY_ = $(_NL_V_COPY_$(NL_DEFAULT_VERBOSITY)) +_NL_V_COPY_0 = @for file in $(DISTFILES); do echo " COPY $${file}"; done; +_NL_V_COPY_1 = + +_NL_V_MAKE = $(_NL_V_MAKE_$(V)) +_NL_V_MAKE_ = $(_NL_V_MAKE_$(NL_DEFAULT_VERBOSITY)) +_NL_V_MAKE_0 = @echo " MAKE dist-hook"; +_NL_V_MAKE_1 = + +# +# check-file +# +# Check whether a file, referenced by the $(@) variable, should be +# updated / regenerated based on its dependencies, referenced by the +# $(<) variable by running the make macro check-file-. +# +# The $(<) is passed as the first argument if the macro wants to process +# it and the prospective new output file, which the macro MUST +# generate, as the second. +# +# This macro will ensure that any required parent directories are created +# prior to invoking check-file-. +# +# This macro is similar to and inspired by that from Linux Kbuild and +# elsewhere. +# +# - The name, suffixed to "check-file-", which indicates +# the make macro to invoke. +# +# +define check-file +$(NL_V_AT)set -e; \ +echo ' CHECK $(@)'; \ +$(MKDIR) -p $(dir $(@)); \ +$(call check-file-$(1),$(<),$(@).N); \ +if [ -r "$(@)" ] && $(CMP) -s "$(@)" "$(@).N"; then \ + $(RM) -f "$(@).N"; \ +else \ + echo ' GEN $(@)'; \ + $(MV) -f "$(@).N" "$(@)"; \ +fi +endef # check-file + +# +# check-file-.local-version +# +# Speculatively regenerate .local-version and check to see if it needs +# to be updated. +# +# If PACKAGE_VERSION has been supplied anywhere other than in this file +# (which is implicitly the contents of .local-version), then use that; +# otherwise, attempt to generate it from the SCM system. +# +# This is called from $(call check-file,.local-version). +# +define check-file-.local-version +if [ "$(origin PACKAGE_VERSION)" != "file" ]; then \ + echo "$(PACKAGE_VERSION)" > "$(2)"; \ +else \ + $(abs_top_srcdir)/scripts/mkversion \ + -b "$(PACKAGE_VERSION)" "$(top_srcdir)" \ + > "$(2)"; \ +fi +endef + +# +# check-file-.dist-version +# +# Speculatively regenerate .dist-version and check to see if it needs +# to be updated. +# +# This is called from $(call check-file,.dist-version). +# +define check-file-.dist-version +$(CAT) "$(1)" > "$(2)" +endef + +# +# Version file regeneration rules. +# +.PHONY: force + +$(builddir)/.local-version: $(srcdir)/.default-version force + +$(distdir)/.dist-version: $(builddir)/.local-version force + +$(distdir)/.dist-version $(builddir)/.local-version: + $(call check-file,$(@F)) + +all: .local-version + +dist-hook: $(distdir)/.dist-version + +# +# Stage the distribution files to a distribution directory +# +stage: $(DISTFILES) .local-version + $(call nl-remove-dir,$(distdir)) + $(call nl-create-dir,$(distdir)) + $(_NL_V_MAKE)$(MAKE) -s distdir="$(distdir)" dist-hook + $(_NL_V_COPY)(cd $(abs_top_srcdir); $(dist_tar_ARCHIVE) $(DISTFILES) | (cd $(abs_builddir)/$(distdir); $(TAR) xfBp -)) + +# +# Produce an architecture-independent distribution using a tar archive +# with gzip compression +# +$(dist_tgz_TARGETS): stage + $(NL_V_TGZ)$(dist_tgz_ARCHIVE) $(distdir) | $(dist_tgz_COMPRESS) > "$(@)" + +# +# Produce an architecture-independent distribution using a tar archive +# with xz compression +# +$(dist_txz_TARGETS): stage + $(NL_V_TXZ)$(dist_txz_ARCHIVE) $(distdir) | $(dist_txz_COMPRESS) > "$(@)" + +# +# Produce an architecture-independent distribution of the +# nlbuild-autotools core. +# +dist: $(DIST_TARGETS) .local-version + $(call nl-remove-dir,$(distdir)) + +dist-tgz: $(dist_tgz_TARGETS) + +dist-txz: $(dist_txz_TARGETS) + +# +# Produce prebuilt GNU autotools binaries for the architecture of the +# CURRENT build machine and install them in THIS nlbuild-autotools +# package. +# +.PHONY: tools +tools: + $(NL_V_MAKE)$(MAKE) -C tools $(@) + +# +# Produce prebuilt GNU autotools architecture-dependent and -independent +# binaries for the architecture of the CURRENT build machine and PACKAGE +# them up for EXTERNAL distribution. +# +toolsdist: .local-version + $(NL_V_MAKE)$(MAKE) -C tools $(@) + +clean: clean-local + $(NL_V_MAKE)$(MAKE) -C tools $(@) diff --git a/third_party/nlbuild-autotools/repo/README.md b/third_party/nlbuild-autotools/repo/README.md index 18000403c..b7831de1b 100644 --- a/third_party/nlbuild-autotools/repo/README.md +++ b/third_party/nlbuild-autotools/repo/README.md @@ -1,32 +1,38 @@ Nest Labs Build - GNU Autotools =============================== -Introduction ------------- +# Introduction The Nest Labs Build - GNU Autotools (nlbuild-autotools) provides a customized, turnkey build system framework, based on GNU autotools, for -standalone Nest Labs software packages that need to support not only -building on and targeting against standalone build host systems but -also embedded target systems using GCC-based or -compatible toolchains. +standalone Nest Labs (or other) software packages that need to support +not only building on and targeting against standalone build host +systems but also embedded target systems using GCC-based or +-compatible toolchains. -Getting Started ---------------- +# Users and System Integrators -This project is typically subtreed into a target project repository -and serves as the seed for that project's build system. +## Getting Started + +This project is typically subtreed (or git submoduled) into a target +project repository and serves as the seed for that project's build +system. Assuming that you already have a project repository established in git, perform the following in your project repository: - > 1. % git remote add nlbuild-autotools ssh:///nlbuild-autotools.git - > 2. % git fetch nlbuild-autotools +``` +1. % git remote add nlbuild-autotools ssh:///nlbuild-autotools.git +2. % git fetch nlbuild-autotools +``` You can place the nlbuild-autotools package anywhere in your project; however, by convention, "third_party/nlbuild-autotools/repo" is recommended: - > 3. % mkdir third_party - > 4. % git subtree add --prefix=third_party/nlbuild-autotools/repo --squash --message="Add subtree mirror of repository 'ssh:///nlbuild-autotools.git' branch 'master' at commit 'HEAD'." nlbuild-autotools HEAD +``` +3. % mkdir third_party +4. % git subtree add --prefix=third_party/nlbuild-autotools/repo --squash --message="Add subtree mirror of repository 'ssh:///nlbuild-autotools.git' branch 'master' at commit 'HEAD'." nlbuild-autotools HEAD +``` At this point, you now have the nlbuild-autotools package integrated into your project. The next step is using the @@ -35,60 +41,75 @@ convenience script has been provided that will get you started. You can tune and customize the results, as needed, for your project. From the top level of your project tree: - > 5. % third_party/nlbuild-autotools/repo/scripts/mkskeleton -I third_party/nlbuild-autotools/repo --package-description "My Fantastic Package" --package-name "mfp" +``` +5. % third_party/nlbuild-autotools/repo/scripts/mkskeleton -I third_party/nlbuild-autotools/repo --package-description "My Fantastic Package" --package-name "mfp" +``` -Supported Build Host Systems ----------------------------- +## Supported Build Host Systems -The nlbuild-autotools system supports the following POSIX-based build -host systems: +For Linux users, you likely already have GNU autotools installed through your system's distribution (e.g. Ubuntu). However, if your GNU autotools packages are incomplete or downrevision relative to what's required from nlbuild-autotools, nlbuild-autotools can be built and installed or can be downloaded and expanded in your local nlbuild-autotools tree. + +The nlbuild-autotools system supports and has been tested against the +following POSIX-based build host systems: * i686-pc-cygwin * i686-pc-linux-gnu * x86_64-apple-darwin * x86_64-unknown-linux-gnu -Support for these systems includes a set of pre-built, qualified -versions of GNU autotools along with integration and automation -scripts to run them. +### Build and Install -If support is required for a new POSIX-compatible build host system, -use the 'build' script in 'tools/packages' to unarchive, build, and -install the tools for your system. +Simply invoke `make tools` at the top-level of your nlbuild-autotools tree. -Please see the FAQ section for more background on why this package -provides these pre-built tools. +### Download and Expand -Package Organization --------------------- +Alongside nlbuild-autotools distributions are pre-built +architecture-independent and -dependent distributions of the form: + + * nlbuild-autotools-common-_version_.tar.{gz,xz} + * nlbuild-autotools-_host_-_version_.tar.{gz,xz} + +Find and download the appropriate pair of nlbuild-autotools-common and +nlbuild-autotools-_host_ for your system and then expand them from the +top-level of your nlbuild-autotools tree with a command similar to the +following example: + +``` +% tar --directory tools/host -zxvf nlbuild-autotools-common-1.1.tar.gz +% tar --directory tools/host -zxvf nlbuild-autotools-x86_64-unknown-linux-gnu-1.1.tar.gz +``` + +Please see the [FAQ](#FAQ) section for more background on why this package +provides options for these pre-built tools. + +## Package Organization The nlbuild-autotools package is laid out as follows: -| Directory | Description | -|-----------------------------------|------------------------------------------------------------------------------------------| -| autoconf/ | GNU autoconf infrastructure provided by nlbuild-autotools. | -| autoconf/m4/ | GNU m4 macros for configure.ac provided by nlbuild-autotools. | -| automake/ | GNU automake Makefile.am header and footer infrastructure provided by nlbuild-autotools. | -| automake/post/ | GNU automake Makefile.am footers. | -| automake/post.am | GNU automake Makefile.am footer included by every makefile. | -| automake/pre/ | GNU automake Makefile.am headers. | -| automake/pre.am | GNU automake Makefile.am header included by every makefile. | -| examples/ | Example template files for starting your own nlbuild-autotools-based project. | -| scripts/ | Automation scripts for regenerating the build system and for managing package versions. | -| tools/ | Qualified packages of and pre-built instances of GNU autotools. | -| tools/host/ | Pre-built instances of GNU autotools. | -| tools/host/i686-pc-cygwin/ | Pre-built instances of GNU autotools for 32-bit Cygwin. | -| tools/host/i686-pc-linux-gnu/ | Pre-built instances of GNU autotools for 32-bit Linux. | -| tools/host/x86_64-apple-darwin/ | Pre-built instances of GNU autotools for 64-bit Mac OS X. | -| tools/host/x86_64-unknown-linux-gnu/ | Pre-built instances of GNU autotools for 64-bit Linux. | -| tools/packages/ | Qualified packages for GNU autotools. | +| Directory | Description | +|--------------------------------------|------------------------------------------------------------------------------------------| +| autoconf/ | GNU autoconf infrastructure provided by nlbuild-autotools. | +| autoconf/m4/ | GNU m4 macros for configure.ac provided by nlbuild-autotools. | +| automake/ | GNU automake Makefile.am header and footer infrastructure provided by nlbuild-autotools. | +| automake/post/ | GNU automake Makefile.am footers. | +| automake/post.am | GNU automake Makefile.am footer included by every makefile. | +| automake/pre/ | GNU automake Makefile.am headers. | +| automake/pre.am | GNU automake Makefile.am header included by every makefile. | +| examples/ | Example template files for starting your own nlbuild-autotools-based project. | +| scripts/ | Automation scripts for regenerating the build system and for managing package versions. | +| tools/ | Qualified packages of and pre-built instances of GNU autotools. | +| tools/host/ | Pre-built instances of GNU autotools (if installed). | +| tools/host/i686-pc-cygwin/ | Pre-built instances of GNU autotools for 32-bit Cygwin (if installed). | +| tools/host/i686-pc-linux-gnu/ | Pre-built instances of GNU autotools for 32-bit Linux (if installed). | +| tools/host/x86_64-apple-darwin/ | Pre-built instances of GNU autotools for 64-bit Mac OS X (if installed). | +| tools/host/x86_64-unknown-linux-gnu/ | Pre-built instances of GNU autotools for 64-bit Linux (if installed). | +| tools/packages/ | Qualified packages for GNU autotools. | -FAQ ---- +# FAQ {#FAQ} -Q: Why does nlbuild-autotools have its own built versions of GNU - autotools rather than leveraging whatever versions exist on the build - host system? +Q: Why does nlbuild-autotools have an option for its own built versions + of GNU autotools rather than leveraging whatever versions exist on + the build host system? A: Some build host systems such as Mac OS X may not have GNU autotools at all. Other build host systems, such as Linux, may have different @@ -102,4 +123,58 @@ A: Some build host systems such as Mac OS X may not have GNU autotools standalone set of scripts to drive them without reliance on those versions of the tools on the build host system. +## Maintainers +If you are maintaining nlbuild-autotools, you have several key things to know: + +1. Generating nlbuild-autotools distributions +2. Generating optional nlbuild-autotools prebuilt binary distributions. +3. Upgrading GNU autotools packages. + +### Generating Distributions + +To generate a nlbuild-autotools distribution, simply invoke: + +``` +% make dist +``` + +The package version will come from tags in the source code control +system, if available; otherwise, from '.default-version'. The version +can be overridden from the PACKAGE_VERSION or VERSION environment +variables. + +The resulting archive will be at the top of the package build +directory. + +### Generating Optional Prebuilt Binary Distributions + +To generate an optional nlbuild-autotools prebuilt binary +distribution, simply invoke: + +``` +% make toolsdist +``` + +The package version will come from the source code control system, if +available; otherwise, from `.default-version`. The version can be +overridden from the _PACKAGE_VERSION_ or _VERSION_ environment variables. + +The resulting archives will be at the top of the package build +directory. + +### Upgrading GNU Autotools Packages + +To change or upgrade GNU autotools packages used by nlbuild-autotools, +edit the metadata for each package in tools/packages/_package_/ +_package_.{url,version}. + +# Versioning + +nlbuild-autools follows the [Semantic Versioning guidelines](http://semver.org/) +for release cycle transparency and to maintain backwards compatibility. + +# License + +nlbuild-autools is released under the [Apache License, Version 2.0 license](https://opensource.org/licenses/Apache-2.0). +See the `LICENSE` file for more information. \ No newline at end of file diff --git a/third_party/nlbuild-autotools/repo/autoconf/m4/ax_compare_version.m4 b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_compare_version.m4 new file mode 100644 index 000000000..74dc0fdd9 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_compare_version.m4 @@ -0,0 +1,177 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_compare_version.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPARE_VERSION(VERSION_A, OP, VERSION_B, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# +# DESCRIPTION +# +# This macro compares two version strings. Due to the various number of +# minor-version numbers that can exist, and the fact that string +# comparisons are not compatible with numeric comparisons, this is not +# necessarily trivial to do in a autoconf script. This macro makes doing +# these comparisons easy. +# +# The six basic comparisons are available, as well as checking equality +# limited to a certain number of minor-version levels. +# +# The operator OP determines what type of comparison to do, and can be one +# of: +# +# eq - equal (test A == B) +# ne - not equal (test A != B) +# le - less than or equal (test A <= B) +# ge - greater than or equal (test A >= B) +# lt - less than (test A < B) +# gt - greater than (test A > B) +# +# Additionally, the eq and ne operator can have a number after it to limit +# the test to that number of minor versions. +# +# eq0 - equal up to the length of the shorter version +# ne0 - not equal up to the length of the shorter version +# eqN - equal up to N sub-version levels +# neN - not equal up to N sub-version levels +# +# When the condition is true, shell commands ACTION-IF-TRUE are run, +# otherwise shell commands ACTION-IF-FALSE are run. The environment +# variable 'ax_compare_version' is always set to either 'true' or 'false' +# as well. +# +# Examples: +# +# AX_COMPARE_VERSION([3.15.7],[lt],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[lt],[3.15.8]) +# +# would both be true. +# +# AX_COMPARE_VERSION([3.15.7],[eq],[3.15.8]) +# AX_COMPARE_VERSION([3.15],[gt],[3.15.8]) +# +# would both be false. +# +# AX_COMPARE_VERSION([3.15.7],[eq2],[3.15.8]) +# +# would be true because it is only comparing two minor versions. +# +# AX_COMPARE_VERSION([3.15.7],[eq0],[3.15]) +# +# would be true because it is only comparing the lesser number of minor +# versions of the two values. +# +# Note: The characters that separate the version numbers do not matter. An +# empty string is the same as version 0. OP is evaluated by autoconf, not +# configure, so must be a string, not a variable. +# +# The author would like to acknowledge Guido Draheim whose advice about +# the m4_case and m4_ifvaln functions make this macro only include the +# portions necessary to perform the specific comparison specified by the +# OP argument in the final configure script. +# +# LICENSE +# +# Copyright (c) 2008 Tim Toolan +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 11 + +dnl ######################################################################### +AC_DEFUN([AX_COMPARE_VERSION], [ + AC_REQUIRE([AC_PROG_AWK]) + + # Used to indicate true or false condition + ax_compare_version=false + + # Convert the two version strings to be compared into a format that + # allows a simple string comparison. The end result is that a version + # string of the form 1.12.5-r617 will be converted to the form + # 0001001200050617. In other words, each number is zero padded to four + # digits, and non digits are removed. + AS_VAR_PUSHDEF([A],[ax_compare_version_A]) + A=`echo "$1" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ + -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/[[^0-9]]//g'` + + AS_VAR_PUSHDEF([B],[ax_compare_version_B]) + B=`echo "$3" | sed -e 's/\([[0-9]]*\)/Z\1Z/g' \ + -e 's/Z\([[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/Z\([[0-9]][[0-9]][[0-9]]\)Z/Z0\1Z/g' \ + -e 's/[[^0-9]]//g'` + + dnl # In the case of le, ge, lt, and gt, the strings are sorted as necessary + dnl # then the first line is used to determine if the condition is true. + dnl # The sed right after the echo is to remove any indented white space. + m4_case(m4_tolower($2), + [lt],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/false/;s/x${B}/true/;1q"` + ], + [gt],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort | sed "s/x${A}/false/;s/x${B}/true/;1q"` + ], + [le],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort | sed "s/x${A}/true/;s/x${B}/false/;1q"` + ], + [ge],[ + ax_compare_version=`echo "x$A +x$B" | sed 's/^ *//' | sort -r | sed "s/x${A}/true/;s/x${B}/false/;1q"` + ],[ + dnl Split the operator from the subversion count if present. + m4_bmatch(m4_substr($2,2), + [0],[ + # A count of zero means use the length of the shorter version. + # Determine the number of characters in A and B. + ax_compare_version_len_A=`echo "$A" | $AWK '{print(length)}'` + ax_compare_version_len_B=`echo "$B" | $AWK '{print(length)}'` + + # Set A to no more than B's length and B to no more than A's length. + A=`echo "$A" | sed "s/\(.\{$ax_compare_version_len_B\}\).*/\1/"` + B=`echo "$B" | sed "s/\(.\{$ax_compare_version_len_A\}\).*/\1/"` + ], + [[0-9]+],[ + # A count greater than zero means use only that many subversions + A=`echo "$A" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` + B=`echo "$B" | sed "s/\(\([[0-9]]\{4\}\)\{m4_substr($2,2)\}\).*/\1/"` + ], + [.+],[ + AC_WARNING( + [illegal OP numeric parameter: $2]) + ],[]) + + # Pad zeros at end of numbers to make same length. + ax_compare_version_tmp_A="$A`echo $B | sed 's/./0/g'`" + B="$B`echo $A | sed 's/./0/g'`" + A="$ax_compare_version_tmp_A" + + # Check for equality or inequality as necessary. + m4_case(m4_tolower(m4_substr($2,0,2)), + [eq],[ + test "x$A" = "x$B" && ax_compare_version=true + ], + [ne],[ + test "x$A" != "x$B" && ax_compare_version=true + ],[ + AC_WARNING([illegal OP parameter: $2]) + ]) + ]) + + AS_VAR_POPDEF([A])dnl + AS_VAR_POPDEF([B])dnl + + dnl # Execute ACTION-IF-TRUE / ACTION-IF-FALSE. + if test "$ax_compare_version" = "true" ; then + m4_ifvaln([$4],[$4],[:])dnl + m4_ifvaln([$5],[else $5])dnl + fi +]) dnl AX_COMPARE_VERSION diff --git a/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx.m4 b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx.m4 new file mode 100644 index 000000000..2c18e49c5 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx.m4 @@ -0,0 +1,562 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the specified +# version of the C++ standard. If necessary, add switches to CXX and +# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard) +# or '14' (for the C++14 standard). +# +# The second argument, if specified, indicates whether you insist on an +# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g. +# -std=c++11). If neither is specified, you get whatever works, with +# preference for an extended mode. +# +# The third argument, if specified 'mandatory' or if left unspecified, +# indicates that baseline support for the specified C++ standard is +# required and that the macro should error out if no mode with that +# support is found. If specified 'optional', then configuration proceeds +# regardless, after defining HAVE_CXX${VERSION} if and only if a +# supporting mode is found. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 4 + +dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro +dnl (serial version number 13). + +AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl + m4_if([$1], [11], [], + [$1], [14], [], + [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], + [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$2], [], [], + [$2], [ext], [], + [$2], [noext], [], + [m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl + m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true], + [$3], [mandatory], [ax_cxx_compile_cxx$1_required=true], + [$3], [optional], [ax_cxx_compile_cxx$1_required=false], + [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) + AC_LANG_PUSH([C++])dnl + ac_success=no + AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, + ax_cv_cxx_compile_cxx$1, + [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [ax_cv_cxx_compile_cxx$1=yes], + [ax_cv_cxx_compile_cxx$1=no])]) + if test x$ax_cv_cxx_compile_cxx$1 = xyes; then + ac_success=yes + fi + + m4_if([$2], [noext], [], [dnl + if test x$ac_success = xno; then + for switch in -std=gnu++$1 -std=gnu++0x; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi]) + + m4_if([$2], [ext], [], [dnl + if test x$ac_success = xno; then + dnl HP's aCC needs +std=c++11 according to: + dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf + dnl Cray's crayCC needs "-h std=c++11" + for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do + cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) + AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, + $cachevar, + [ac_save_CXX="$CXX" + CXX="$CXX $switch" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], + [eval $cachevar=yes], + [eval $cachevar=no]) + CXX="$ac_save_CXX"]) + if eval test x\$$cachevar = xyes; then + CXX="$CXX $switch" + if test -n "$CXXCPP" ; then + CXXCPP="$CXXCPP $switch" + fi + ac_success=yes + break + fi + done + fi]) + AC_LANG_POP([C++]) + if test x$ax_cxx_compile_cxx$1_required = xtrue; then + if test x$ac_success = xno; then + AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.]) + fi + fi + if test x$ac_success = xno; then + HAVE_CXX$1=0 + AC_MSG_NOTICE([No compiler with C++$1 support was found]) + else + HAVE_CXX$1=1 + AC_DEFINE(HAVE_CXX$1,1, + [define if the compiler supports basic C++$1 syntax]) + fi + AC_SUBST(HAVE_CXX$1) +]) + + +dnl Test body for checking C++11 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 +) + + +dnl Test body for checking C++14 support + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14], + _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 + _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 +) + + +dnl Tests for new features in C++11 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[ + +// If the compiler admits that it is not ready for C++11, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201103L + +#error "This is not a C++11 compiler" + +#else + +namespace cxx11 +{ + + namespace test_static_assert + { + + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + } + + namespace test_final_override + { + + struct Base + { + virtual void f() {} + }; + + struct Derived : public Base + { + virtual void f() override {} + }; + + } + + namespace test_double_right_angle_brackets + { + + template < typename T > + struct check {}; + + typedef check single_type; + typedef check> double_type; + typedef check>> triple_type; + typedef check>>> quadruple_type; + + } + + namespace test_decltype + { + + int + f() + { + int a = 1; + decltype(a) b = 2; + return a + b; + } + + } + + namespace test_type_deduction + { + + template < typename T1, typename T2 > + struct is_same + { + static const bool value = false; + }; + + template < typename T > + struct is_same + { + static const bool value = true; + }; + + template < typename T1, typename T2 > + auto + add(T1 a1, T2 a2) -> decltype(a1 + a2) + { + return a1 + a2; + } + + int + test(const int c, volatile int v) + { + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == false, ""); + auto ac = c; + auto av = v; + auto sumi = ac + av + 'x'; + auto sumf = ac + av + 1.0; + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == true, ""); + static_assert(is_same::value == false, ""); + static_assert(is_same::value == true, ""); + return (sumf > 0.0) ? sumi : add(c, v); + } + + } + + namespace test_noexcept + { + + int f() { return 0; } + int g() noexcept { return 0; } + + static_assert(noexcept(f()) == false, ""); + static_assert(noexcept(g()) == true, ""); + + } + + namespace test_constexpr + { + + template < typename CharT > + unsigned long constexpr + strlen_c_r(const CharT *const s, const unsigned long acc) noexcept + { + return *s ? strlen_c_r(s + 1, acc + 1) : acc; + } + + template < typename CharT > + unsigned long constexpr + strlen_c(const CharT *const s) noexcept + { + return strlen_c_r(s, 0UL); + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("1") == 1UL, ""); + static_assert(strlen_c("example") == 7UL, ""); + static_assert(strlen_c("another\0example") == 7UL, ""); + + } + + namespace test_rvalue_references + { + + template < int N > + struct answer + { + static constexpr int value = N; + }; + + answer<1> f(int&) { return answer<1>(); } + answer<2> f(const int&) { return answer<2>(); } + answer<3> f(int&&) { return answer<3>(); } + + void + test() + { + int i = 0; + const int c = 0; + static_assert(decltype(f(i))::value == 1, ""); + static_assert(decltype(f(c))::value == 2, ""); + static_assert(decltype(f(0))::value == 3, ""); + } + + } + + namespace test_uniform_initialization + { + + struct test + { + static const int zero {}; + static const int one {1}; + }; + + static_assert(test::zero == 0, ""); + static_assert(test::one == 1, ""); + + } + + namespace test_lambdas + { + + void + test1() + { + auto lambda1 = [](){}; + auto lambda2 = lambda1; + lambda1(); + lambda2(); + } + + int + test2() + { + auto a = [](int i, int j){ return i + j; }(1, 2); + auto b = []() -> int { return '0'; }(); + auto c = [=](){ return a + b; }(); + auto d = [&](){ return c; }(); + auto e = [a, &b](int x) mutable { + const auto identity = [](int y){ return y; }; + for (auto i = 0; i < a; ++i) + a += b--; + return x + identity(a + b); + }(0); + return a + b + c + d + e; + } + + int + test3() + { + const auto nullary = [](){ return 0; }; + const auto unary = [](int x){ return x; }; + using nullary_t = decltype(nullary); + using unary_t = decltype(unary); + const auto higher1st = [](nullary_t f){ return f(); }; + const auto higher2nd = [unary](nullary_t f1){ + return [unary, f1](unary_t f2){ return f2(unary(f1())); }; + }; + return higher1st(nullary) + higher2nd(nullary)(unary); + } + + } + + namespace test_variadic_templates + { + + template + struct sum; + + template + struct sum + { + static constexpr auto value = N0 + sum::value; + }; + + template <> + struct sum<> + { + static constexpr auto value = 0; + }; + + static_assert(sum<>::value == 0, ""); + static_assert(sum<1>::value == 1, ""); + static_assert(sum<23>::value == 23, ""); + static_assert(sum<1, 2>::value == 3, ""); + static_assert(sum<5, 5, 11>::value == 21, ""); + static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, ""); + + } + + // http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae + // Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function + // because of this. + namespace test_template_alias_sfinae + { + + struct foo {}; + + template + using member = typename T::member_type; + + template + void func(...) {} + + template + void func(member*) {} + + void test(); + + void test() { func(0); } + + } + +} // namespace cxx11 + +#endif // __cplusplus >= 201103L + +]]) + + +dnl Tests for new features in C++14 + +m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[ + +// If the compiler admits that it is not ready for C++14, why torture it? +// Hopefully, this will speed up the test. + +#ifndef __cplusplus + +#error "This is not a C++ compiler" + +#elif __cplusplus < 201402L + +#error "This is not a C++14 compiler" + +#else + +namespace cxx14 +{ + + namespace test_polymorphic_lambdas + { + + int + test() + { + const auto lambda = [](auto&&... args){ + const auto istiny = [](auto x){ + return (sizeof(x) == 1UL) ? 1 : 0; + }; + const int aretiny[] = { istiny(args)... }; + return aretiny[0]; + }; + return lambda(1, 1L, 1.0f, '1'); + } + + } + + namespace test_binary_literals + { + + constexpr auto ivii = 0b0000000000101010; + static_assert(ivii == 42, "wrong value"); + + } + + namespace test_generalized_constexpr + { + + template < typename CharT > + constexpr unsigned long + strlen_c(const CharT *const s) noexcept + { + auto length = 0UL; + for (auto p = s; *p; ++p) + ++length; + return length; + } + + static_assert(strlen_c("") == 0UL, ""); + static_assert(strlen_c("x") == 1UL, ""); + static_assert(strlen_c("test") == 4UL, ""); + static_assert(strlen_c("another\0test") == 7UL, ""); + + } + + namespace test_lambda_init_capture + { + + int + test() + { + auto x = 0; + const auto lambda1 = [a = x](int b){ return a + b; }; + const auto lambda2 = [a = lambda1(x)](){ return a; }; + return lambda2(); + } + + } + + namespace test_digit_seperators + { + + constexpr auto ten_million = 100'000'000; + static_assert(ten_million == 100000000, ""); + + } + + namespace test_return_type_deduction + { + + auto f(int& x) { return x; } + decltype(auto) g(int& x) { return x; } + + template < typename T1, typename T2 > + struct is_same + { + static constexpr auto value = false; + }; + + template < typename T > + struct is_same + { + static constexpr auto value = true; + }; + + int + test() + { + auto x = 0; + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); + return x; + } + + } + +} // namespace cxx14 + +#endif // __cplusplus >= 201402L + +]]) diff --git a/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx_0x.m4 b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx_0x.m4 new file mode 100644 index 000000000..52c398491 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx_0x.m4 @@ -0,0 +1,111 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_0x.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_0X +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++0x +# standard. +# +# This macro is deprecated and has been superseded by the +# AX_CXX_COMPILE_STDCXX_11 macro which should be used instead. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 10 + +AU_ALIAS([AC_CXX_COMPILE_STDCXX_0X], [AX_CXX_COMPILE_STDCXX_0X]) +AC_DEFUN([AX_CXX_COMPILE_STDCXX_0X], [ + AC_OBSOLETE([$0], [; use AX_CXX_COMPILE_STDCXX_11 instead]) + AC_CACHE_CHECK(if g++ supports C++0x features without additional flags, + ax_cv_cxx_compile_cxx0x_native, + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS + AC_TRY_COMPILE([ + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + typedef check> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c);],, + ax_cv_cxx_compile_cxx0x_native=yes, ax_cv_cxx_compile_cxx0x_native=no) + AC_LANG_RESTORE + ]) + + AC_CACHE_CHECK(if g++ supports C++0x features with -std=c++0x, + ax_cv_cxx_compile_cxx0x_cxx, + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXX="$CXX" + CXX="$CXX -std=c++0x" + AC_TRY_COMPILE([ + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + typedef check> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c);],, + ax_cv_cxx_compile_cxx0x_cxx=yes, ax_cv_cxx_compile_cxx0x_cxx=no) + CXX="$ac_save_CXX" + AC_LANG_RESTORE + ]) + + AC_CACHE_CHECK(if g++ supports C++0x features with -std=gnu++0x, + ax_cv_cxx_compile_cxx0x_gxx, + [AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXX="$CXX" + CXX="$CXX -std=gnu++0x" + AC_TRY_COMPILE([ + template + struct check + { + static_assert(sizeof(int) <= sizeof(T), "not big enough"); + }; + + typedef check> right_angle_brackets; + + int a; + decltype(a) b; + + typedef check check_type; + check_type c; + check_type&& cr = static_cast(c);],, + ax_cv_cxx_compile_cxx0x_gxx=yes, ax_cv_cxx_compile_cxx0x_gxx=no) + CXX="$ac_save_CXX" + AC_LANG_RESTORE + ]) + + if test "$ax_cv_cxx_compile_cxx0x_native" = yes || + test "$ax_cv_cxx_compile_cxx0x_cxx" = yes || + test "$ax_cv_cxx_compile_cxx0x_gxx" = yes; then + AC_DEFINE(HAVE_STDCXX_0X,,[Define if g++ supports C++0x features. ]) + fi +]) diff --git a/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx_11.m4 b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx_11.m4 new file mode 100644 index 000000000..0aadeafe7 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx_11.m4 @@ -0,0 +1,39 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++11 +# standard; if necessary, add switches to CXX and CXXCPP to enable +# support. +# +# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX +# macro with the version set to C++11. The two optional arguments are +# forwarded literally as the second and third argument respectively. +# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for +# more information. If you want to use this macro, you also need to +# download the ax_cxx_compile_stdcxx.m4 file. +# +# LICENSE +# +# Copyright (c) 2008 Benjamin Kosnik +# Copyright (c) 2012 Zack Weinberg +# Copyright (c) 2013 Roy Stogner +# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov +# Copyright (c) 2015 Paul Norman +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 17 + +AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) +AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) diff --git a/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx_14.m4 b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx_14.m4 new file mode 100644 index 000000000..51123f2d5 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_cxx_compile_stdcxx_14.m4 @@ -0,0 +1,34 @@ +# ============================================================================ +# http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html +# ============================================================================ +# +# SYNOPSIS +# +# AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional]) +# +# DESCRIPTION +# +# Check for baseline language coverage in the compiler for the C++14 +# standard; if necessary, add switches to CXX and CXXCPP to enable +# support. +# +# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX +# macro with the version set to C++14. The two optional arguments are +# forwarded literally as the second and third argument respectively. +# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for +# more information. If you want to use this macro, you also need to +# download the ax_cxx_compile_stdcxx.m4 file. +# +# LICENSE +# +# Copyright (c) 2015 Moritz Klammler +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 4 + +AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) +AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])]) diff --git a/third_party/nlbuild-autotools/repo/autoconf/m4/ax_pthread.m4 b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_pthread.m4 new file mode 100644 index 000000000..4c4051ea3 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/autoconf/m4/ax_pthread.m4 @@ -0,0 +1,485 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_pthread.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# This macro figures out how to build C programs using POSIX threads. It +# sets the PTHREAD_LIBS output variable to the threads library and linker +# flags, and the PTHREAD_CFLAGS output variable to any special C compiler +# flags that are needed. (The user can also force certain compiler +# flags/libs to be tested by setting these environment variables.) +# +# Also sets PTHREAD_CC to any special C compiler that is needed for +# multi-threaded programs (defaults to the value of CC otherwise). (This +# is necessary on AIX to use the special cc_r compiler alias.) +# +# NOTE: You are assumed to not only compile your program with these flags, +# but also to link with them as well. For example, you might link with +# $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS $LIBS +# +# If you are only building threaded programs, you may wish to use these +# variables in your default LIBS, CFLAGS, and CC: +# +# LIBS="$PTHREAD_LIBS $LIBS" +# CFLAGS="$CFLAGS $PTHREAD_CFLAGS" +# CC="$PTHREAD_CC" +# +# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute constant +# has a nonstandard name, this macro defines PTHREAD_CREATE_JOINABLE to +# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX). +# +# Also HAVE_PTHREAD_PRIO_INHERIT is defined if pthread is found and the +# PTHREAD_PRIO_INHERIT symbol is defined when compiling with +# PTHREAD_CFLAGS. +# +# ACTION-IF-FOUND is a list of shell commands to run if a threads library +# is found, and ACTION-IF-NOT-FOUND is a list of commands to run it if it +# is not found. If ACTION-IF-FOUND is not specified, the default action +# will define HAVE_PTHREAD. +# +# Please let the authors know if this macro fails on any platform, or if +# you have any other suggestions or comments. This macro was based on work +# by SGJ on autoconf scripts for FFTW (http://www.fftw.org/) (with help +# from M. Frigo), as well as ac_pthread and hb_pthread macros posted by +# Alejandro Forero Cuervo to the autoconf macro repository. We are also +# grateful for the helpful feedback of numerous users. +# +# Updated for Autoconf 2.68 by Daniel Richard G. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2011 Daniel Richard G. +# +# 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 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 23 + +AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD]) +AC_DEFUN([AX_PTHREAD], [ +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_PROG_SED]) +AC_LANG_PUSH([C]) +ax_pthread_ok=no + +# We used to check for pthread.h first, but this fails if pthread.h +# requires special compiler flags (e.g. on Tru64 or Sequent). +# It gets checked for in the link test anyway. + +# First of all, check if the user has set any of the PTHREAD_LIBS, +# etcetera environment variables, and if threads linking works using +# them: +if test "x$PTHREAD_CFLAGS$PTHREAD_LIBS" != "x"; then + ax_pthread_save_CC="$CC" + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + AS_IF([test "x$PTHREAD_CC" != "x"], [CC="$PTHREAD_CC"]) + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + AC_MSG_CHECKING([for pthread_join using $CC $PTHREAD_CFLAGS $PTHREAD_LIBS]) + AC_LINK_IFELSE([AC_LANG_CALL([], [pthread_join])], [ax_pthread_ok=yes]) + AC_MSG_RESULT([$ax_pthread_ok]) + if test "x$ax_pthread_ok" = "xno"; then + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" + fi + CC="$ax_pthread_save_CC" + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" +fi + +# We must check for the threads library under a number of different +# names; the ordering is very important because some systems +# (e.g. DEC) have both -lpthread and -lpthreads, where one of the +# libraries is broken (non-POSIX). + +# Create a list of thread flags to try. Items starting with a "-" are +# C compiler flags, and other items are library names, except for "none" +# which indicates that we try without any flags at all, and "pthread-config" +# which is a program returning the flags for the Pth emulation library. + +ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config" + +# The ordering *is* (sometimes) important. Some notes on the +# individual items follow: + +# pthreads: AIX (must check this before -lpthread) +# none: in case threads are in libc; should be tried before -Kthread and +# other compiler flags to prevent continual compiler warnings +# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) +# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads), Tru64 +# (Note: HP C rejects this with "bad form for `-t' option") +# -pthreads: Solaris/gcc (Note: HP C also rejects) +# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it +# doesn't hurt to check since this sometimes defines pthreads and +# -D_REENTRANT too), HP C (must be checked before -lpthread, which +# is present but should not be used directly; and before -mthreads, +# because the compiler interprets this as "-mt" + "-hreads") +# -mthreads: Mingw32/gcc, Lynx/gcc +# pthread: Linux, etcetera +# --thread-safe: KAI C++ +# pthread-config: use pthread-config program (for GNU Pth library) + +case $host_os in + + freebsd*) + + # -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able) + # lthread: LinuxThreads port on FreeBSD (also preferred to -pthread) + + ax_pthread_flags="-kthread lthread $ax_pthread_flags" + ;; + + hpux*) + + # From the cc(1) man page: "[-mt] Sets various -D flags to enable + # multi-threading and also sets -lpthread." + + ax_pthread_flags="-mt -pthread pthread $ax_pthread_flags" + ;; + + openedition*) + + # IBM z/OS requires a feature-test macro to be defined in order to + # enable POSIX threads at all, so give the user a hint if this is + # not set. (We don't define these ourselves, as they can affect + # other portions of the system API in unpredictable ways.) + + AC_EGREP_CPP([AX_PTHREAD_ZOS_MISSING], + [ +# if !defined(_OPEN_THREADS) && !defined(_UNIX03_THREADS) + AX_PTHREAD_ZOS_MISSING +# endif + ], + [AC_MSG_WARN([IBM z/OS requires -D_OPEN_THREADS or -D_UNIX03_THREADS to enable pthreads support.])]) + ;; + + solaris*) + + # On Solaris (at least, for some versions), libc contains stubbed + # (non-functional) versions of the pthreads routines, so link-based + # tests will erroneously succeed. (N.B.: The stubs are missing + # pthread_cleanup_push, or rather a function called by this macro, + # so we could check for that, but who knows whether they'll stub + # that too in a future libc.) So we'll check first for the + # standard Solaris way of linking pthreads (-mt -lpthread). + + ax_pthread_flags="-mt,pthread pthread $ax_pthread_flags" + ;; +esac + +# GCC generally uses -pthread, or -pthreads on some platforms (e.g. SPARC) + +AS_IF([test "x$GCC" = "xyes"], + [ax_pthread_flags="-pthread -pthreads $ax_pthread_flags"]) + +# The presence of a feature test macro requesting re-entrant function +# definitions is, on some systems, a strong hint that pthreads support is +# correctly enabled + +case $host_os in + darwin* | hpux* | linux* | osf* | solaris*) + ax_pthread_check_macro="_REENTRANT" + ;; + + aix*) + ax_pthread_check_macro="_THREAD_SAFE" + ;; + + *) + ax_pthread_check_macro="--" + ;; +esac +AS_IF([test "x$ax_pthread_check_macro" = "x--"], + [ax_pthread_check_cond=0], + [ax_pthread_check_cond="!defined($ax_pthread_check_macro)"]) + +# Are we compiling with Clang? + +AC_CACHE_CHECK([whether $CC is Clang], + [ax_cv_PTHREAD_CLANG], + [ax_cv_PTHREAD_CLANG=no + # Note that Autoconf sets GCC=yes for Clang as well as GCC + if test "x$GCC" = "xyes"; then + AC_EGREP_CPP([AX_PTHREAD_CC_IS_CLANG], + [/* Note: Clang 2.7 lacks __clang_[a-z]+__ */ +# if defined(__clang__) && defined(__llvm__) + AX_PTHREAD_CC_IS_CLANG +# endif + ], + [ax_cv_PTHREAD_CLANG=yes]) + fi + ]) +ax_pthread_clang="$ax_cv_PTHREAD_CLANG" + +ax_pthread_clang_warning=no + +# Clang needs special handling, because older versions handle the -pthread +# option in a rather... idiosyncratic way + +if test "x$ax_pthread_clang" = "xyes"; then + + # Clang takes -pthread; it has never supported any other flag + + # (Note 1: This will need to be revisited if a system that Clang + # supports has POSIX threads in a separate library. This tends not + # to be the way of modern systems, but it's conceivable.) + + # (Note 2: On some systems, notably Darwin, -pthread is not needed + # to get POSIX threads support; the API is always present and + # active. We could reasonably leave PTHREAD_CFLAGS empty. But + # -pthread does define _REENTRANT, and while the Darwin headers + # ignore this macro, third-party headers might not.) + + PTHREAD_CFLAGS="-pthread" + PTHREAD_LIBS= + + ax_pthread_ok=yes + + # However, older versions of Clang make a point of warning the user + # that, in an invocation where only linking and no compilation is + # taking place, the -pthread option has no effect ("argument unused + # during compilation"). They expect -pthread to be passed in only + # when source code is being compiled. + # + # Problem is, this is at odds with the way Automake and most other + # C build frameworks function, which is that the same flags used in + # compilation (CFLAGS) are also used in linking. Many systems + # supported by AX_PTHREAD require exactly this for POSIX threads + # support, and in fact it is often not straightforward to specify a + # flag that is used only in the compilation phase and not in + # linking. Such a scenario is extremely rare in practice. + # + # Even though use of the -pthread flag in linking would only print + # a warning, this can be a nuisance for well-run software projects + # that build with -Werror. So if the active version of Clang has + # this misfeature, we search for an option to squash it. + + AC_CACHE_CHECK([whether Clang needs flag to prevent "argument unused" warning when linking with -pthread], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG], + [ax_cv_PTHREAD_CLANG_NO_WARN_FLAG=unknown + # Create an alternate version of $ac_link that compiles and + # links in two steps (.c -> .o, .o -> exe) instead of one + # (.c -> exe), because the warning occurs only in the second + # step + ax_pthread_save_ac_link="$ac_link" + ax_pthread_sed='s/conftest\.\$ac_ext/conftest.$ac_objext/g' + ax_pthread_link_step=`$as_echo "$ac_link" | sed "$ax_pthread_sed"` + ax_pthread_2step_ac_link="($ac_compile) && (echo ==== >&5) && ($ax_pthread_link_step)" + ax_pthread_save_CFLAGS="$CFLAGS" + for ax_pthread_try in '' -Qunused-arguments -Wno-unused-command-line-argument unknown; do + AS_IF([test "x$ax_pthread_try" = "xunknown"], [break]) + CFLAGS="-Werror -Wunknown-warning-option $ax_pthread_try -pthread $ax_pthread_save_CFLAGS" + ac_link="$ax_pthread_save_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [ac_link="$ax_pthread_2step_ac_link" + AC_LINK_IFELSE([AC_LANG_SOURCE([[int main(void){return 0;}]])], + [break]) + ]) + done + ac_link="$ax_pthread_save_ac_link" + CFLAGS="$ax_pthread_save_CFLAGS" + AS_IF([test "x$ax_pthread_try" = "x"], [ax_pthread_try=no]) + ax_cv_PTHREAD_CLANG_NO_WARN_FLAG="$ax_pthread_try" + ]) + + case "$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG" in + no | unknown) ;; + *) PTHREAD_CFLAGS="$ax_cv_PTHREAD_CLANG_NO_WARN_FLAG $PTHREAD_CFLAGS" ;; + esac + +fi # $ax_pthread_clang = yes + +if test "x$ax_pthread_ok" = "xno"; then +for ax_pthread_try_flag in $ax_pthread_flags; do + + case $ax_pthread_try_flag in + none) + AC_MSG_CHECKING([whether pthreads work without any flags]) + ;; + + -mt,pthread) + AC_MSG_CHECKING([whether pthreads work with -mt -lpthread]) + PTHREAD_CFLAGS="-mt" + PTHREAD_LIBS="-lpthread" + ;; + + -*) + AC_MSG_CHECKING([whether pthreads work with $ax_pthread_try_flag]) + PTHREAD_CFLAGS="$ax_pthread_try_flag" + ;; + + pthread-config) + AC_CHECK_PROG([ax_pthread_config], [pthread-config], [yes], [no]) + AS_IF([test "x$ax_pthread_config" = "xno"], [continue]) + PTHREAD_CFLAGS="`pthread-config --cflags`" + PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`" + ;; + + *) + AC_MSG_CHECKING([for the pthreads library -l$ax_pthread_try_flag]) + PTHREAD_LIBS="-l$ax_pthread_try_flag" + ;; + esac + + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Check for various functions. We must include pthread.h, + # since some functions may be macros. (On the Sequent, we + # need a special flag -Kthread to make this header compile.) + # We check for pthread_join because it is in -lpthread on IRIX + # while pthread_create is in libc. We check for pthread_attr_init + # due to DEC craziness with -lpthreads. We check for + # pthread_cleanup_push because it is one of the few pthread + # functions on Solaris that doesn't have a non-functional libc stub. + # We try pthread_create on general principles. + + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include +# if $ax_pthread_check_cond +# error "$ax_pthread_check_macro must be defined" +# endif + static void routine(void *a) { a = 0; } + static void *start_routine(void *a) { return a; }], + [pthread_t th; pthread_attr_t attr; + pthread_create(&th, 0, start_routine, 0); + pthread_join(th, 0); + pthread_attr_init(&attr); + pthread_cleanup_push(routine, 0); + pthread_cleanup_pop(0) /* ; */])], + [ax_pthread_ok=yes], + []) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + AC_MSG_RESULT([$ax_pthread_ok]) + AS_IF([test "x$ax_pthread_ok" = "xyes"], [break]) + + PTHREAD_LIBS="" + PTHREAD_CFLAGS="" +done +fi + +# Various other checks: +if test "x$ax_pthread_ok" = "xyes"; then + ax_pthread_save_CFLAGS="$CFLAGS" + ax_pthread_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $PTHREAD_CFLAGS" + LIBS="$PTHREAD_LIBS $LIBS" + + # Detect AIX lossage: JOINABLE attribute is called UNDETACHED. + AC_CACHE_CHECK([for joinable pthread attribute], + [ax_cv_PTHREAD_JOINABLE_ATTR], + [ax_cv_PTHREAD_JOINABLE_ATTR=unknown + for ax_pthread_attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do + AC_LINK_IFELSE([AC_LANG_PROGRAM([#include ], + [int attr = $ax_pthread_attr; return attr /* ; */])], + [ax_cv_PTHREAD_JOINABLE_ATTR=$ax_pthread_attr; break], + []) + done + ]) + AS_IF([test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xunknown" && \ + test "x$ax_cv_PTHREAD_JOINABLE_ATTR" != "xPTHREAD_CREATE_JOINABLE" && \ + test "x$ax_pthread_joinable_attr_defined" != "xyes"], + [AC_DEFINE_UNQUOTED([PTHREAD_CREATE_JOINABLE], + [$ax_cv_PTHREAD_JOINABLE_ATTR], + [Define to necessary symbol if this constant + uses a non-standard name on your system.]) + ax_pthread_joinable_attr_defined=yes + ]) + + AC_CACHE_CHECK([whether more special flags are required for pthreads], + [ax_cv_PTHREAD_SPECIAL_FLAGS], + [ax_cv_PTHREAD_SPECIAL_FLAGS=no + case $host_os in + solaris*) + ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS" + ;; + esac + ]) + AS_IF([test "x$ax_cv_PTHREAD_SPECIAL_FLAGS" != "xno" && \ + test "x$ax_pthread_special_flags_added" != "xyes"], + [PTHREAD_CFLAGS="$ax_cv_PTHREAD_SPECIAL_FLAGS $PTHREAD_CFLAGS" + ax_pthread_special_flags_added=yes]) + + AC_CACHE_CHECK([for PTHREAD_PRIO_INHERIT], + [ax_cv_PTHREAD_PRIO_INHERIT], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[int i = PTHREAD_PRIO_INHERIT;]])], + [ax_cv_PTHREAD_PRIO_INHERIT=yes], + [ax_cv_PTHREAD_PRIO_INHERIT=no]) + ]) + AS_IF([test "x$ax_cv_PTHREAD_PRIO_INHERIT" = "xyes" && \ + test "x$ax_pthread_prio_inherit_defined" != "xyes"], + [AC_DEFINE([HAVE_PTHREAD_PRIO_INHERIT], [1], [Have PTHREAD_PRIO_INHERIT.]) + ax_pthread_prio_inherit_defined=yes + ]) + + CFLAGS="$ax_pthread_save_CFLAGS" + LIBS="$ax_pthread_save_LIBS" + + # More AIX lossage: compile with *_r variant + if test "x$GCC" != "xyes"; then + case $host_os in + aix*) + AS_CASE(["x/$CC"], + [x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6], + [#handle absolute path differently from PATH based program lookup + AS_CASE(["x$CC"], + [x/*], + [AS_IF([AS_EXECUTABLE_P([${CC}_r])],[PTHREAD_CC="${CC}_r"])], + [AC_CHECK_PROGS([PTHREAD_CC],[${CC}_r],[$CC])])]) + ;; + esac + fi +fi + +test -n "$PTHREAD_CC" || PTHREAD_CC="$CC" + +AC_SUBST([PTHREAD_LIBS]) +AC_SUBST([PTHREAD_CFLAGS]) +AC_SUBST([PTHREAD_CC]) + +# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND: +if test "x$ax_pthread_ok" = "xyes"; then + ifelse([$1],,[AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])],[$1]) + : +else + ax_pthread_ok=no + $2 +fi +AC_LANG_POP +])dnl AX_PTHREAD diff --git a/third_party/nlbuild-autotools/repo/autoconf/m4/nl_enable_coverage.m4 b/third_party/nlbuild-autotools/repo/autoconf/m4/nl_enable_coverage.m4 index ec7859c48..1d064e441 100644 --- a/third_party/nlbuild-autotools/repo/autoconf/m4/nl_enable_coverage.m4 +++ b/third_party/nlbuild-autotools/repo/autoconf/m4/nl_enable_coverage.m4 @@ -86,7 +86,6 @@ AC_DEFUN([NL_ENABLE_COVERAGE], ]) if test "${nl_cv_build_coverage}" = "yes"; then - AM_EXTRA_RECURSIVE_TARGETS([coverage]) if test "${GCC}" != "yes"; then AC_MSG_ERROR([GCC or a GCC-compatible toolchain is required for --enable-coverage]) diff --git a/third_party/nlbuild-autotools/repo/autoconf/m4/nl_prog_lndir.m4 b/third_party/nlbuild-autotools/repo/autoconf/m4/nl_prog_lndir.m4 index 2a7b22bfa..a958858f0 100644 --- a/third_party/nlbuild-autotools/repo/autoconf/m4/nl_prog_lndir.m4 +++ b/third_party/nlbuild-autotools/repo/autoconf/m4/nl_prog_lndir.m4 @@ -61,8 +61,8 @@ AC_DEFUN([NL_PROG_LNDIR], elif `_NL_CHECK_LNDIR(lndir)`; then LNDIR="lndir -silent" - elif `_NL_CHECK_CP_RS(${ac_abs_confdir}/build/tools/host/${filtered_build}/bin/cp)`; then - LNDIR="\${top_srcdir}/build/tools/host/${filtered_build}/bin/cp -Rs" + elif `_NL_CHECK_CP_RS($1)`; then + LNDIR="$2 -Rs" else AC_MSG_ERROR([Cannot determine how to shadow a directory tree. Neither 'cp -Rs' nor 'lndir -silent' appear to be available or functional. Please consider installing or making available in your PATH one of: GNU coreutils , XQuartz (Mac OS X-only) , or lndir .]) diff --git a/third_party/nlbuild-autotools/repo/automake/post/rules/coverage.am b/third_party/nlbuild-autotools/repo/automake/post/rules/coverage.am index dbe185ba3..aa54820f0 100644 --- a/third_party/nlbuild-autotools/repo/automake/post/rules/coverage.am +++ b/third_party/nlbuild-autotools/repo/automake/post/rules/coverage.am @@ -27,6 +27,13 @@ # automake-specific dependencies to ensure that happens. # -coverage-local: check-am +.PHONY: coverage coverage-recursive + +coverage: coverage-recursive -coverage-local: $(BUILT_SOURCES) +coverage: check-am + +coverage: $(BUILT_SOURCES) + +coverage-recursive: + $(nl-make-subdirs) diff --git a/third_party/nlbuild-autotools/repo/automake/post/rules/pretty.am b/third_party/nlbuild-autotools/repo/automake/post/rules/pretty.am index ad0ce7f0e..91ee60303 100644 --- a/third_party/nlbuild-autotools/repo/automake/post/rules/pretty.am +++ b/third_party/nlbuild-autotools/repo/automake/post/rules/pretty.am @@ -38,14 +38,14 @@ # are the key automake-specific dependencies to ensure that happens. # -# nl-make-pretty +# nl-make-pretty # -# This function iterates over PRETTY_FILES, invoking COMMAND with +# This function iterates over PATHS, invoking COMMAND with # COMMAND ARGUEMENTS on each file. If a non-verbose make has been # requested TERSE OUTPUT COMMAND is emitted to standard output. define nl-make-pretty -$(AM_V_at)for file in $(PRETTY_FILES); do \ +$(AM_V_at)for file in $(4); do \ $(1) \ if test -f $${file}; then d=.; else d=$(srcdir); fi; \ $(2) $(3) $${d}/$${file} \ @@ -59,6 +59,8 @@ pretty: pretty-recursive pretty pretty-check: $(BUILT_SOURCES) +# Map the build action 'lint' to the more vernacular 'pretty-check'. + lint: pretty-check pretty-check: pretty-check-recursive @@ -66,12 +68,12 @@ pretty-check: pretty-check-recursive pretty-recursive pretty-check-recursive: $(call nl-make-subdirs-with-dirs,$(PRETTY_SUBDIRS)) -pretty: +pretty: $(PRETTY_FILES) ifneq ($(PRETTY),) - $(call nl-make-pretty,$(AM_V_PRETTY),$(PRETTY),$(PRETTY_ARGS)) + $(call nl-make-pretty,$(AM_V_PRETTY),$(PRETTY),$(PRETTY_ARGS),$(filter-out $(@)-recursive,$(PRETTY_FILES))) endif -pretty-check: +pretty-check: $(PRETTY_FILES) ifneq ($(PRETTY_CHECK),) - $(call nl-make-pretty,$(AM_V_PRETTY_CHECK),$(PRETTY_CHECK),$(PRETTY_CHECK_ARGS)) + $(call nl-make-pretty,$(AM_V_PRETTY_CHECK),$(PRETTY_CHECK),$(PRETTY_CHECK_ARGS),$(filter-out $(@)-recursive,$(PRETTY_FILES))) endif diff --git a/third_party/nlbuild-autotools/repo/automake/pre/macros/coverage.am b/third_party/nlbuild-autotools/repo/automake/pre/macros/coverage.am index 29b0b3946..f3a762a69 100644 --- a/third_party/nlbuild-autotools/repo/automake/pre/macros/coverage.am +++ b/third_party/nlbuild-autotools/repo/automake/pre/macros/coverage.am @@ -77,5 +77,30 @@ $(NL_V_LCOV)$(LCOV) $(NL_V_LCOV_FLAGS) --config-file="$(abs_top_nlbuild_autotool $(NL_V_GENHTML)$(GENHTML) $(NL_V_GENHTML_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" "$(@)" --output-directory "$(@D)" endef # generate-coverage-report +# +# generate-coverage-report-with-filter +# +# Capture, using lcov, a coverage report from the specified directory 'directory' and a filter 'remove_filter' +# with an final output "info" file as specified by the target variable. +# +# - The directory from which lcov should search for coverage data (*.gcno & *.gcda) +# +# - The filter is a whitespace-separated list of shell wildcard patterns. (note that they may need to be escaped accordingly to prevent +# the shell from expanding them first). Every file entry in tracefile which matches at least one of those patterns will be removed. +# +# - create baseline coverage data file (base.info) with '-i|--initial' option +# - create test coverage data file (test.info) +# - combine baseline and test coverage data to create the final "info" file +# - remove particular coverage data specifiled by the remove_filter (no change if remove_filter is null) +# +# Then, on success, generate an HTML-based coverage report using genhtml. +# +define generate-coverage-report-with-filter +$(NL_V_LCOV)$(LCOV) $(NL_V_LCOV_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" --initial --capture --directory "$(1)" --output-file "base.info" +$(NL_V_LCOV)$(LCOV) $(NL_V_LCOV_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" --capture --directory "$(1)" --output-file "test.info" +$(NL_V_LCOV)$(LCOV) $(NL_V_LCOV_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" --add-tracefile "base.info" --add-tracefile "test.info" --output-file "$(@)" +$(NL_V_LCOV)$(LCOV) $(NL_V_LCOV_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" --remove "$(@)" $(foreach pattern,$(2),"$(pattern)") --output-file "$(@)" +$(NL_V_GENHTML)$(GENHTML) $(NL_V_GENHTML_FLAGS) --config-file="$(abs_top_nlbuild_autotools_dir)/etc/lcov.config" "$(@)" --output-directory "$(@D)" +endef # generate-coverage-report-with-filter diff --git a/third_party/nlbuild-autotools/repo/scripts/bootstrap b/third_party/nlbuild-autotools/repo/scripts/bootstrap index 40c168ec2..5c7100654 100755 --- a/third_party/nlbuild-autotools/repo/scripts/bootstrap +++ b/third_party/nlbuild-autotools/repo/scripts/bootstrap @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright 2014-2016 Nest Labs Inc. All Rights Reserved. +# Copyright 2014-2017 Nest Labs Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -58,8 +58,14 @@ usage() { # script. # removetmp() { - rm -f "${LIBTOOLIZE}" - rm -f "${AUTOM4TE_CFG}" + if [ -n "${LIBTOOLIZE}" ] && [ "${LIBTOOLIZE}" = "${BOOTSTRAP_TMPDIR}/libtoolize" ]; then + rm -f "${LIBTOOLIZE}" + fi + + if [ -n "${AUTOM4TE_CFG}" ]; then + rm -f "${AUTOM4TE_CFG}" + fi + rm -r -f "${BOOTSTRAP_TMPDIR}" } @@ -134,26 +140,50 @@ abs_top_hostdir="${nlbuild_autotools_dir}/tools/host" host=`${nlbuild_autotools_dir}/autoconf/config.guess | sed -e 's/[[:digit:].]*$//g'` -# Attempt to be self-sufficient, relying on GNU autotools executables -# installed along with the SDK itself. +# If possible, attempt to be self-sufficient, relying on GNU autotools +# executables installed along with the SDK itself. -export PATH="${abs_top_hostdir}/bin:${abs_top_hostdir}/${host}/bin:${PATH}" +if [ -d "${abs_top_hostdir}/${host}/bin" ]; then + export PATH="${abs_top_hostdir}/${host}/bin:${PATH}" +fi + +if [ -d "${abs_top_hostdir}/bin" ]; then + export PATH="${abs_top_hostdir}/bin:${PATH}" +fi export ACLOCAL=`which aclocal` export AUTOCONF="`which autoconf`" export AUTOHEADER="`which autoheader`" export AUTOM4TE="`which autom4te`" export AUTOMAKE="`which automake`" +export LIBTOOLIZE="`which libtoolize || which glibtoolize`" export M4=`which m4` -# Establish some SDK-specific directories needed to override various -# paths in GNU autotools that otherwise expect to be absolute -# (e.g. /usr/share, etc.). +# Establish, if necessary, some SDK-specific directories needed to +# override various paths in GNU autotools that otherwise expect to be +# absolute (e.g. /usr/share, etc.). -export AC_MACRODIR="${abs_top_hostdir}/share/autoconf" +if [ -d "${abs_top_hostdir}/share" ]; then + if [ -d "${abs_top_hostdir}/share/autoconf" ]; then + export AC_MACRODIR="${abs_top_hostdir}/share/autoconf" -export autom4te_perllibdir="${abs_top_hostdir}/share/autoconf" -export PERL5LIB="${abs_top_hostdir}/share/automake-1.14:${PERL5LIB}" + export autom4te_perllibdir="${abs_top_hostdir}/share/autoconf" + fi + + if [ -d "${abs_top_hostdir}/share/automake-1.14" ]; then + export PERL5LIB="${abs_top_hostdir}/share/automake-1.14:${PERL5LIB}" + + make_action_options="--libdir ${abs_top_hostdir}/share/automake-1.14" + fi + + if [ -d "${abs_top_hostdir}/share/aclocal-1.14" ]; then + local_action_options="--automake-acdir=${abs_top_hostdir}/share/aclocal-1.14 ${local_action_options}" + fi + + if [ -d "${abs_top_hostdir}/share/aclocal" ]; then + local_action_options="--system-acdir=${abs_top_hostdir}/share/aclocal ${local_action_options}" + fi +fi # Both autom4te.cfg and libtoolize, as installed from source, want to # use absolute file system paths that cannot be @@ -164,9 +194,6 @@ BOOTSTRAP_TMPDIR="`mktemp -d /tmp/tmp.bootstrapXXXXXX`" trap "removetmp" 1 2 3 9 15 -export AUTOM4TE_CFG="${BOOTSTRAP_TMPDIR}/autom4te.cfg" -export LIBTOOLIZE="${BOOTSTRAP_TMPDIR}/libtoolize" - # # Generate any temporary files that need to be patched at run time # with the location of the SDK tree, including: @@ -175,12 +202,23 @@ export LIBTOOLIZE="${BOOTSTRAP_TMPDIR}/libtoolize" # - The libtoolize executable script # -sed -e "s,//share/autoconf,${abs_top_hostdir}/share/autoconf,g" < "${abs_top_hostdir}/share/autoconf/autom4te.cfg" > "${AUTOM4TE_CFG}" +if [ -r "${abs_top_hostdir}/share/autoconf/autom4te.cfg" ]; then + export AUTOM4TE_CFG="${BOOTSTRAP_TMPDIR}/autom4te.cfg" -sed -e "s,//share/libtool,${abs_top_hostdir}/share/libtool,g" -e "s,//share/aclocal,${abs_top_hostdir}/share/aclocal,g" < "${abs_top_hostdir}/${host}/bin/libtoolize" > "${LIBTOOLIZE}" -chmod 775 "${LIBTOOLIZE}" + sed -e "s,//share/autoconf,${abs_top_hostdir}/share/autoconf,g" < "${abs_top_hostdir}/share/autoconf/autom4te.cfg" > "${AUTOM4TE_CFG}" +fi + +if [ -r "${abs_top_hostdir}/${host}/bin/libtoolize" ]; then + export LIBTOOLIZE="${BOOTSTRAP_TMPDIR}/libtoolize" + + sed -e "s,//share/libtool,${abs_top_hostdir}/share/libtool,g" -e "s,//share/aclocal,${abs_top_hostdir}/share/aclocal,g" < "${abs_top_hostdir}/${host}/bin/libtoolize" > "${LIBTOOLIZE}" + + chmod 775 "${LIBTOOLIZE}" +fi if [ -n "${verbose}" ]; then + echo PATH="${PATH}" + echo ACLOCAL="${ACLOCAL}" echo AUTOCONF="${AUTOCONF}" echo AUTOHEADER="${AUTOHEADER}" @@ -193,14 +231,17 @@ if [ -n "${verbose}" ]; then echo AUTOM4TE_CFG="${AUTOM4TE_CFG}" echo PERL5LIB="${PERL5LIB}" echo autom4te_perllibdir="${autom4te_perllibdir}" + + echo local_action_options="${local_action_options}" + echo make_action_options="${make_action_options}" fi # Set up the default actions for each bootstrap stage. -local_action="${ACLOCAL} ${verbose} --automake-acdir=${abs_top_hostdir}/share/aclocal-1.14 --system-acdir=${abs_top_hostdir}/share/aclocal -I${nlbuild_autotools_dir}/autoconf/m4" +local_action="${ACLOCAL} ${verbose} ${local_action_options}" header_action="${AUTOHEADER} ${verbose}" tool_action="${LIBTOOLIZE} ${verbose} --automake --copy --force" -make_action="${AUTOMAKE} ${verbose} --libdir ${abs_top_hostdir}/share/automake-1.14 --add-missing --copy" +make_action="${AUTOMAKE} ${verbose} ${make_action_options} --add-missing --copy" config_action="${AUTOCONF} ${verbose}" # Determine what needs to be short-circuited based on the @@ -236,7 +277,7 @@ esac # Bootstrap the package. -${local_action} && ${header_action} && ${tool_action} && ${make_action} && ${config_action} +${local_action} && ${tool_action} && ${header_action} && ${make_action} && ${config_action} # Clean up any temporary files created. diff --git a/third_party/nlbuild-autotools/repo/tools/Makefile b/third_party/nlbuild-autotools/repo/tools/Makefile new file mode 100644 index 000000000..f6357846b --- /dev/null +++ b/third_party/nlbuild-autotools/repo/tools/Makefile @@ -0,0 +1,139 @@ +# +# Copyright 2017 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This make file supports generating prebuilt architecture +# -independent and -dependent distributions of nlbuild-autotools +# binaries for the architeture of the current build host. +# + +include ../Common.mak + +# +# Build directories +# + +builddir := . +top_builddir := .. +abs_builddir := $(CURDIR) +abs_top_builddir := $(abspath $(top_builddir)) + +# +# Source directories +# + +srcdir := . +top_srcdir := .. +abs_srcdir := $(CURDIR) +abs_top_srcdir := $(abspath $(top_srcdir)) + +# Figure out what sort of build host we are running on, stripping off +# any trailing version number information typically included on Darwin +# / Mac OS X. + +host := $(shell $(top_srcdir)/autoconf/config.guess | $(SED) -e 's/[[:digit:].]*$$//g') + +distdir = $(PACKAGE)-$(VERSION) + +dist_tgz_TARGETS = ${top_builddir}/${PACKAGE}-common-$(VERSION)$(TGZ_EXTENSION) \ + ${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TGZ_EXTENSION) + +dist_txz_TARGETS = ${top_builddir}/${PACKAGE}-common-$(VERSION)$(TXZ_EXTENSION) \ + ${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TXZ_EXTENSION) + +dist_common_DIRS = share include +dist_arch_DIRS = $(host) + +PACKAGE_VERSION = $(shell $(CAT) $(top_builddir)/.local-version) + +VERSION = $(PACKAGE_VERSION) + +DIST_TMPDIR := $(shell mktemp -u -p /tmp -d tmp.$(PACKAGE)-$(VERSION)XXXXXX) +TOOLS_TMPDIR := $(shell mktemp -u -p /tmp -d tmp.$(PACKAGE)-$(VERSION)XXXXXX) + +# +# Verbosity +# +_NL_V_BUILD = $(_NL_V_BUILD_$(V)) +_NL_V_BUILD_ = $(_NL_V_BUILD_$(NL_DEFAULT_VERBOSITY)) +_NL_V_BUILD_0 = @echo " BUILD"; +_NL_V_BUILD_1 = + +dist-tgz: $(dist_tgz_TARGETS) + +dist-txz: $(dist_txz_TARGETS) + +# +# Produce prebuilt GNU autotools binaries for the architecture of the +# current build machine and install them in this nlbuild-autotools +# package. +# +tools: + $(call nl-remove-dir,$(TOOLS_TMPDIR)) + $(call nl-create-dir,$(TOOLS_TMPDIR)) + $(_NL_V_BUILD)${srcdir}/packages/build --arch ${host} --srcdir ${abs_srcdir}/packages --builddir "${TOOLS_TMPDIR}" --destdir "${abs_top_srcdir}/tools/host" + $(call nl-remove-dir,$(TOOLS_TMPDIR)) + +# +# Produce prebuilt GNU autotools architecture-dependent and -independent +# binaries for the architecture of the current build machine and package +# them up for distribution. +# +dist toolsdist: $(DIST_TARGETS) + $(call nl-remove-dir,$(DIST_TMPDIR)) + +# +# Stage the distribution files to a distribution directory +# +stage: + $(call nl-remove-dir,$(DIST_TMPDIR)) + $(call nl-create-dir,$(DIST_TMPDIR)) + $(_NL_V_BUILD)${srcdir}/packages/build --arch ${host} --srcdir ${abs_srcdir}/packages --builddir "${DIST_TMPDIR}" --destdir "${DIST_TMPDIR}" + +# +# Produce prebuilt GNU autotools architecture-independent binaries for +# the architecture of the current build machine and package them up +# for distribution in tar-gzip format. +# +${top_builddir}/${PACKAGE}-common-$(VERSION)$(TGZ_EXTENSION): stage + $(NL_V_TGZ)$(dist_tgz_ARCHIVE) --directory ${DIST_TMPDIR} $(dist_common_DIRS) | $(dist_tgz_COMPRESS) > "$(@)" + +# +# Produce prebuilt GNU autotools architecture-dependent binaries for +# the architecture of the current build machine and package them up +# for distribution in tar-gzip format. +# +${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TGZ_EXTENSION): stage + $(NL_V_TGZ)$(dist_tgz_ARCHIVE) --directory ${DIST_TMPDIR} $(dist_arch_DIRS) | $(dist_tgz_COMPRESS) > "$(@)" + +# +# Produce prebuilt GNU autotools architecture-independent binaries for +# the architecture of the current build machine and package them up +# for distribution in tar-xz format. +# +${top_builddir}/${PACKAGE}-common-$(VERSION)$(TXZ_EXTENSION): stage + $(NL_V_TXZ)$(dist_txz_ARCHIVE) --directory ${DIST_TMPDIR} $(dist_common_DIRS) | $(dist_txz_COMPRESS) > "$(@)" + +# +# Produce prebuilt GNU autotools architecture-dependent binaries for +# the architecture of the current build machine and package them up +# for distribution in tar-xz format. +# +${top_builddir}/${PACKAGE}-${host}-$(VERSION)$(TXZ_EXTENSION): stage + $(NL_V_TXZ)$(dist_txz_ARCHIVE) --directory ${DIST_TMPDIR} $(dist_arch_DIRS) | $(dist_txz_COMPRESS) > "$(@)" + +clean: clean-local diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/aclocal b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/aclocal deleted file mode 100755 index cf7f3edd6..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/aclocal +++ /dev/null @@ -1,1235 +0,0 @@ -#!/usr/bin/perl -w -# -*- perl -*- -# Generated from bin/aclocal.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# aclocal - create aclocal.m4 by scanning configure.ac - -# Copyright (C) 1996-2013 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, see . - -# Written by Tom Tromey , and -# Alexandre Duret-Lutz . - -BEGIN -{ - @Aclocal::perl_libdirs = ('//share/automake-1.14') - unless @Aclocal::perl_libdirs; - unshift @INC, @Aclocal::perl_libdirs; -} - -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::Path (); - -# Some globals. - -# Support AC_CONFIG_MACRO_DIRS also with older autoconf. -# FIXME: To be removed in Automake 2.0, once we can assume autoconf -# 2.70 or later. -# FIXME: keep in sync with 'internal/ac-config-macro-dirs.m4'. -my $ac_config_macro_dirs_fallback = - 'm4_ifndef([AC_CONFIG_MACRO_DIRS], [' . - 'm4_defun([_AM_CONFIG_MACRO_DIRS], [])' . - 'm4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])' . - '])'; - -# We do not operate in threaded mode. -$perl_threads = 0; - -# 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 macros. -# @user_includes can be augmented with -I or AC_CONFIG_MACRO_DIRS. -# @automake_includes can be reset with the '--automake-acdir' option. -# @system_includes can be augmented with the 'dirlist' file or the -# ACLOCAL_PATH environment variable, and reset with the '--system-acdir' -# option. -my @user_includes = (); -my @automake_includes = ("//share/aclocal-$APIVERSION"); -my @system_includes = ('//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. This variable is set by 'trace_used_macros'. -my $ac_version; - -# User directory containing extra m4 files for macros definition, -# as extracted from calls to the macro AC_CONFIG_MACRO_DIRS. -# This variable is updated by 'trace_used_macros'. -my @ac_config_macro_dirs; - -# If set, names a temporary file that must be erased on abnormal exit. -my $erase_me; - -# Constants for the $ERR_LEVEL parameter of the 'scan_m4_dirs' function. -use constant SCAN_M4_DIRS_SILENT => 0; -use constant SCAN_M4_DIRS_WARN => 1; -use constant SCAN_M4_DIRS_ERROR => 2; - -################################################################ - -# Prototypes for all subroutines. - -# BEGIN AUTOMATICALLY GENERATED PROTOTYPES -sub add_file ($); -sub add_macro ($); -sub check_acinclude (); -sub install_file ($$); -sub list_compare (\@\@); -sub parse_ACLOCAL_PATH (); -sub parse_arguments (); -sub reset_maps (); -sub scan_configure (); -sub scan_configure_dep ($); -sub scan_file ($$$); -sub scan_m4_dirs ($$@); -sub scan_m4_files (); -sub strip_redundant_includes (%); -sub trace_used_macros (); -sub unlink_tmp (;$); -sub usage ($); -sub version (); -sub write_aclocal ($@); -sub xmkdir_p ($); -# END AUTOMATICALLY GENERATED PROTOTYPES - -################################################################ - -# Erase temporary file ERASE_ME. Handle signals. -sub unlink_tmp (;$) -{ - my ($sig) = @_; - - if ($sig) - { - verb "caught SIG$sig, bailing out"; - } - if (defined $erase_me && -e $erase_me && !unlink ($erase_me)) - { - fatal "could not remove '$erase_me': $!"; - } - undef $erase_me; - - # reraise default handler. - if ($sig) - { - $SIG{$sig} = 'DEFAULT'; - kill $sig => $$; - } -} - -$SIG{'INT'} = $SIG{'TERM'} = $SIG{'QUIT'} = $SIG{'HUP'} = 'unlink_tmp'; -END { unlink_tmp } - -sub xmkdir_p ($) -{ - my $dir = shift; - local $@ = undef; - return - if -d $dir or eval { File::Path::mkpath $dir }; - chomp $@; - $@ =~ s/\s+at\s.*\bline\s\d+.*$//; - fatal "could not create directory '$dir': $@"; -} - -# 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', "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, $DESTDIR) -sub install_file ($$) -{ - my ($src, $destdir) = @_; - my $dest = $destdir . "/" . basename ($src); - my $diff_dest; - - verb "installing $src to $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) - { - xmkdir_p ($destdir); - 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, $ERR_LEVEL, @DIRS) -# ----------------------------------------------- -# Scan all M4 files installed in @DIRS for new macro definitions. -# Register each file as of type $TYPE (one of the FT_* constants). -# If a directory in @DIRS cannot be read: -# - fail hard if $ERR_LEVEL == SCAN_M4_DIRS_ERROR -# - just print a warning if $ERR_LEVEL == SCAN_M4_DIRS_WA -# - continue silently if $ERR_LEVEL == SCAN_M4_DIRS_SILENT -sub scan_m4_dirs ($$@) -{ - my ($type, $err_level, @dirlist) = @_; - - foreach my $m4dir (@dirlist) - { - if (! opendir (DIR, $m4dir)) - { - # TODO: maybe avoid complaining only if errno == ENONENT? - my $message = "couldn't open directory '$m4dir': $!"; - - if ($err_level == SCAN_M4_DIRS_ERROR) - { - fatal $message; - } - elsif ($err_level == SCAN_M4_DIRS_WARN) - { - msg ('unsupported', $message); - next; - } - elsif ($err_level == SCAN_M4_DIRS_SILENT) - { - next; # Silently ignore. - } - else - { - prog_error "invalid \$err_level value '$err_level'"; - } - } - - # 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. - - if (@user_includes) - { - # Don't explore the same directory multiple times. This is here not - # only for speedup purposes. We need this when the user has e.g. - # specified 'ACLOCAL_AMFLAGS = -I m4' and has also set - # AC_CONFIG_MACRO_DIR[S]([m4]) in configure.ac. This makes the 'm4' - # directory to occur twice here and fail on the second call to - # scan_m4_dirs([m4]) when the 'm4' directory doesn't exist. - # TODO: Shouldn't there be rather a check in scan_m4_dirs for - # @user_includes[0]? - @user_includes = uniq @user_includes; - - # Don't complain if the first user directory doesn't exist, in case - # we need to create it later (can happen if '--install' was given). - scan_m4_dirs (FT_USER, - $install ? SCAN_M4_DIRS_SILENT : SCAN_M4_DIRS_WARN, - $user_includes[0]); - scan_m4_dirs (FT_USER, - SCAN_M4_DIRS_ERROR, - @user_includes[1..$#user_includes]); - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @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", - "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:$.", - "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:$.", "underquoted definition of $2" - . "\n run info Automake 'Extending aclocal'\n" - . " or see http://www.gnu.org/software/automake/manual/" - . "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; - - # When AC_CONFIG_MACRO_DIRS is used, avoid possible spurious warnings - # from autom4te about macros being "m4_require'd but not m4_defun'd"; - # for more background, see: - # http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00004.html - # as well as autoconf commit 'v2.69-44-g1ed0548', "warn: allow aclocal - # to silence m4_require warnings". - my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])"; - - my $traces = ($ENV{AUTOM4TE} || 'autom4te'); - $traces .= " --language Autoconf-without-aclocal-m4 "; - $traces = "echo '$early_m4_code' | $traces - "; - - # Support AC_CONFIG_MACRO_DIRS also with older autoconf. - # Note that we can't use '$ac_config_macro_dirs_fallback' here, because - # a bug in option parsing code of autom4te 2.68 and earlier will cause - # it to read standard input last, even if the "-" argument is specified - # early. - # FIXME: To be removed in Automake 2.0, once we can assume autoconf - # 2.70 or later. - $traces .= "$automake_includes[0]/internal/ac-config-macro-dirs.m4 "; - - # All candidate files. - $traces .= join (' ', - (map { "'$_'" } - (grep { exists $files{$_} } @file_order))) . " "; - - # All candidate macros. - $traces .= join (' ', - (map { "--trace='$_:\$f::\$n::\${::}%'" } - ('AC_DEFUN', - 'AC_DEFUN_ONCE', - 'AU_DEFUN', - '_AM_AUTOCONF_VERSION', - 'AC_CONFIG_MACRO_DIR_TRACE', - # FIXME: Tracing the next two macros is a hack for - # compatibility with older autoconf. Remove this in - # Automake 2.0, when we can assume Autoconf 2.70 or - # later. - 'AC_CONFIG_MACRO_DIR', - '_AM_CONFIG_MACRO_DIRS')), - # 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 |"); - - @ac_config_macro_dirs = (); - - my %traced = (); - - while ($_ = $tracefh->getline) - { - chomp; - my ($file, $macro, $arg1) = split (/::/); - - $traced{$macro} = 1 if exists $macro_seen{$macro}; - - if ($macro eq 'AC_DEFUN' || $macro eq 'AC_DEFUN_ONCE' - || $macro eq 'AU_DEFUN') - { - $map_traced_defs{$arg1} = $file; - } - elsif ($macro eq '_AM_AUTOCONF_VERSION') - { - $ac_version = $arg1; - } - elsif ($macro eq 'AC_CONFIG_MACRO_DIR_TRACE') - { - push @ac_config_macro_dirs, $arg1; - } - # FIXME: We still need to trace AC_CONFIG_MACRO_DIR - # for compatibility with older autoconf. Remove this - # once we can assume Autoconf 2.70 or later. - elsif ($macro eq 'AC_CONFIG_MACRO_DIR') - { - @ac_config_macro_dirs = ($arg1); - } - # FIXME:This is an hack for compatibility with older autoconf. - # Remove this once we can assume Autoconf 2.70 or later. - elsif ($macro eq '_AM_CONFIG_MACRO_DIRS') - { - # Empty leading/trailing fields might be produced by split, - # hence the grep is really needed. - push @ac_config_macro_dirs, grep (/./, (split /\s+/, $arg1)); - } - } - - # FIXME: in Autoconf >= 2.70, AC_CONFIG_MACRO_DIR calls - # AC_CONFIG_MACRO_DIR_TRACE behind the scenes, which could - # leave unwanted duplicates in @ac_config_macro_dirs. - # Remove this in Automake 2.0, when we'll stop tracing - # AC_CONFIG_MACRO_DIR explicitly. - @ac_config_macro_dirs = uniq @ac_config_macro_dirs; - - $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) - { - install_file ($ifile, $user_includes[0]); - } - $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_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [$ac_version],, -[m4_warning([this file was generated for autoconf $ac_version. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -$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-$RELEASE_YEAR 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. - -$ac_config_macro_dirs_fallback -$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 <<'EOF'; -Usage: aclocal [OPTION]... - -Generate 'aclocal.m4' by scanning 'configure.ac' or 'configure.in' - -Options: - --automake-acdir=DIR directory holding automake-provided m4 files - --system-acdir=DIR directory holding third-party system-wide files - --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 system-wide - third-party 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 . -GNU Automake home page: . -General help using GNU software: . -EOF - exit $status; -} - -# Print version and exit. -sub version () -{ - print < -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF - exit 0; -} - -# Parse command line. -sub parse_arguments () -{ - my $print_and_exit = 0; - my $diff_command; - - my %cli_options = - ( - 'help' => sub { usage(0); }, - 'version' => \&version, - 'system-acdir=s' => sub { shift; @system_includes = @_; }, - 'automake-acdir=s' => sub { shift; @automake_includes = @_; }, - '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 Automake::Getopt (); - Automake::Getopt::parse_options %cli_options; - - if (@ARGV > 0) - { - fatal ("non-option arguments are not accepted: '$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; - } - - # 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); - } -} - -# Add any directory listed in the 'ACLOCAL_PATH' environment variable -# to the list of system include directories. -sub parse_ACLOCAL_PATH () -{ - return if not defined $ENV{"ACLOCAL_PATH"}; - # Directories in ACLOCAL_PATH should take precedence over system - # directories, so we use unshift. However, directories that - # come first in ACLOCAL_PATH take precedence over directories - # coming later, which is why the result of split is reversed. - foreach my $dir (reverse split /:/, $ENV{"ACLOCAL_PATH"}) - { - unshift (@system_includes, $dir) if $dir ne '' && -d $dir; - } -} - -################################################################ - -parse_WARNINGS; # Parse the WARNINGS environment variable. -parse_arguments; -parse_ACLOCAL_PATH; -$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; -my $rerun_due_to_macrodir = 0; -while (1) - { - ++$loop; - prog_error "too many loops" if $loop > 2 + $rerun_due_to_macrodir; - - reset_maps; - scan_m4_files; - scan_configure; - last if $exit_code; - my %macro_traced = trace_used_macros; - - if (!$rerun_due_to_macrodir && @ac_config_macro_dirs) - { - # The directory specified in calls to the AC_CONFIG_MACRO_DIRS - # m4 macro (if any) must go after the user includes specified - # explicitly with the '-I' option. - push @user_includes, @ac_config_macro_dirs; - # We might have to scan some new directory of .m4 files. - $rerun_due_to_macrodir++; - next; - } - - if ($install && !@user_includes) - { - fatal "installation of third-party macros impossible without " . - "-I options nor AC_CONFIG_MACRO_DIR{,S} m4 macro(s)"; - } - - 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: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/aclocal-1.14 b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/aclocal-1.14 deleted file mode 100755 index cf7f3edd6..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/aclocal-1.14 +++ /dev/null @@ -1,1235 +0,0 @@ -#!/usr/bin/perl -w -# -*- perl -*- -# Generated from bin/aclocal.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# aclocal - create aclocal.m4 by scanning configure.ac - -# Copyright (C) 1996-2013 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, see . - -# Written by Tom Tromey , and -# Alexandre Duret-Lutz . - -BEGIN -{ - @Aclocal::perl_libdirs = ('//share/automake-1.14') - unless @Aclocal::perl_libdirs; - unshift @INC, @Aclocal::perl_libdirs; -} - -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::Path (); - -# Some globals. - -# Support AC_CONFIG_MACRO_DIRS also with older autoconf. -# FIXME: To be removed in Automake 2.0, once we can assume autoconf -# 2.70 or later. -# FIXME: keep in sync with 'internal/ac-config-macro-dirs.m4'. -my $ac_config_macro_dirs_fallback = - 'm4_ifndef([AC_CONFIG_MACRO_DIRS], [' . - 'm4_defun([_AM_CONFIG_MACRO_DIRS], [])' . - 'm4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])' . - '])'; - -# We do not operate in threaded mode. -$perl_threads = 0; - -# 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 macros. -# @user_includes can be augmented with -I or AC_CONFIG_MACRO_DIRS. -# @automake_includes can be reset with the '--automake-acdir' option. -# @system_includes can be augmented with the 'dirlist' file or the -# ACLOCAL_PATH environment variable, and reset with the '--system-acdir' -# option. -my @user_includes = (); -my @automake_includes = ("//share/aclocal-$APIVERSION"); -my @system_includes = ('//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. This variable is set by 'trace_used_macros'. -my $ac_version; - -# User directory containing extra m4 files for macros definition, -# as extracted from calls to the macro AC_CONFIG_MACRO_DIRS. -# This variable is updated by 'trace_used_macros'. -my @ac_config_macro_dirs; - -# If set, names a temporary file that must be erased on abnormal exit. -my $erase_me; - -# Constants for the $ERR_LEVEL parameter of the 'scan_m4_dirs' function. -use constant SCAN_M4_DIRS_SILENT => 0; -use constant SCAN_M4_DIRS_WARN => 1; -use constant SCAN_M4_DIRS_ERROR => 2; - -################################################################ - -# Prototypes for all subroutines. - -# BEGIN AUTOMATICALLY GENERATED PROTOTYPES -sub add_file ($); -sub add_macro ($); -sub check_acinclude (); -sub install_file ($$); -sub list_compare (\@\@); -sub parse_ACLOCAL_PATH (); -sub parse_arguments (); -sub reset_maps (); -sub scan_configure (); -sub scan_configure_dep ($); -sub scan_file ($$$); -sub scan_m4_dirs ($$@); -sub scan_m4_files (); -sub strip_redundant_includes (%); -sub trace_used_macros (); -sub unlink_tmp (;$); -sub usage ($); -sub version (); -sub write_aclocal ($@); -sub xmkdir_p ($); -# END AUTOMATICALLY GENERATED PROTOTYPES - -################################################################ - -# Erase temporary file ERASE_ME. Handle signals. -sub unlink_tmp (;$) -{ - my ($sig) = @_; - - if ($sig) - { - verb "caught SIG$sig, bailing out"; - } - if (defined $erase_me && -e $erase_me && !unlink ($erase_me)) - { - fatal "could not remove '$erase_me': $!"; - } - undef $erase_me; - - # reraise default handler. - if ($sig) - { - $SIG{$sig} = 'DEFAULT'; - kill $sig => $$; - } -} - -$SIG{'INT'} = $SIG{'TERM'} = $SIG{'QUIT'} = $SIG{'HUP'} = 'unlink_tmp'; -END { unlink_tmp } - -sub xmkdir_p ($) -{ - my $dir = shift; - local $@ = undef; - return - if -d $dir or eval { File::Path::mkpath $dir }; - chomp $@; - $@ =~ s/\s+at\s.*\bline\s\d+.*$//; - fatal "could not create directory '$dir': $@"; -} - -# 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', "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, $DESTDIR) -sub install_file ($$) -{ - my ($src, $destdir) = @_; - my $dest = $destdir . "/" . basename ($src); - my $diff_dest; - - verb "installing $src to $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) - { - xmkdir_p ($destdir); - 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, $ERR_LEVEL, @DIRS) -# ----------------------------------------------- -# Scan all M4 files installed in @DIRS for new macro definitions. -# Register each file as of type $TYPE (one of the FT_* constants). -# If a directory in @DIRS cannot be read: -# - fail hard if $ERR_LEVEL == SCAN_M4_DIRS_ERROR -# - just print a warning if $ERR_LEVEL == SCAN_M4_DIRS_WA -# - continue silently if $ERR_LEVEL == SCAN_M4_DIRS_SILENT -sub scan_m4_dirs ($$@) -{ - my ($type, $err_level, @dirlist) = @_; - - foreach my $m4dir (@dirlist) - { - if (! opendir (DIR, $m4dir)) - { - # TODO: maybe avoid complaining only if errno == ENONENT? - my $message = "couldn't open directory '$m4dir': $!"; - - if ($err_level == SCAN_M4_DIRS_ERROR) - { - fatal $message; - } - elsif ($err_level == SCAN_M4_DIRS_WARN) - { - msg ('unsupported', $message); - next; - } - elsif ($err_level == SCAN_M4_DIRS_SILENT) - { - next; # Silently ignore. - } - else - { - prog_error "invalid \$err_level value '$err_level'"; - } - } - - # 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. - - if (@user_includes) - { - # Don't explore the same directory multiple times. This is here not - # only for speedup purposes. We need this when the user has e.g. - # specified 'ACLOCAL_AMFLAGS = -I m4' and has also set - # AC_CONFIG_MACRO_DIR[S]([m4]) in configure.ac. This makes the 'm4' - # directory to occur twice here and fail on the second call to - # scan_m4_dirs([m4]) when the 'm4' directory doesn't exist. - # TODO: Shouldn't there be rather a check in scan_m4_dirs for - # @user_includes[0]? - @user_includes = uniq @user_includes; - - # Don't complain if the first user directory doesn't exist, in case - # we need to create it later (can happen if '--install' was given). - scan_m4_dirs (FT_USER, - $install ? SCAN_M4_DIRS_SILENT : SCAN_M4_DIRS_WARN, - $user_includes[0]); - scan_m4_dirs (FT_USER, - SCAN_M4_DIRS_ERROR, - @user_includes[1..$#user_includes]); - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @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", - "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:$.", - "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:$.", "underquoted definition of $2" - . "\n run info Automake 'Extending aclocal'\n" - . " or see http://www.gnu.org/software/automake/manual/" - . "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; - - # When AC_CONFIG_MACRO_DIRS is used, avoid possible spurious warnings - # from autom4te about macros being "m4_require'd but not m4_defun'd"; - # for more background, see: - # http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00004.html - # as well as autoconf commit 'v2.69-44-g1ed0548', "warn: allow aclocal - # to silence m4_require warnings". - my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])"; - - my $traces = ($ENV{AUTOM4TE} || 'autom4te'); - $traces .= " --language Autoconf-without-aclocal-m4 "; - $traces = "echo '$early_m4_code' | $traces - "; - - # Support AC_CONFIG_MACRO_DIRS also with older autoconf. - # Note that we can't use '$ac_config_macro_dirs_fallback' here, because - # a bug in option parsing code of autom4te 2.68 and earlier will cause - # it to read standard input last, even if the "-" argument is specified - # early. - # FIXME: To be removed in Automake 2.0, once we can assume autoconf - # 2.70 or later. - $traces .= "$automake_includes[0]/internal/ac-config-macro-dirs.m4 "; - - # All candidate files. - $traces .= join (' ', - (map { "'$_'" } - (grep { exists $files{$_} } @file_order))) . " "; - - # All candidate macros. - $traces .= join (' ', - (map { "--trace='$_:\$f::\$n::\${::}%'" } - ('AC_DEFUN', - 'AC_DEFUN_ONCE', - 'AU_DEFUN', - '_AM_AUTOCONF_VERSION', - 'AC_CONFIG_MACRO_DIR_TRACE', - # FIXME: Tracing the next two macros is a hack for - # compatibility with older autoconf. Remove this in - # Automake 2.0, when we can assume Autoconf 2.70 or - # later. - 'AC_CONFIG_MACRO_DIR', - '_AM_CONFIG_MACRO_DIRS')), - # 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 |"); - - @ac_config_macro_dirs = (); - - my %traced = (); - - while ($_ = $tracefh->getline) - { - chomp; - my ($file, $macro, $arg1) = split (/::/); - - $traced{$macro} = 1 if exists $macro_seen{$macro}; - - if ($macro eq 'AC_DEFUN' || $macro eq 'AC_DEFUN_ONCE' - || $macro eq 'AU_DEFUN') - { - $map_traced_defs{$arg1} = $file; - } - elsif ($macro eq '_AM_AUTOCONF_VERSION') - { - $ac_version = $arg1; - } - elsif ($macro eq 'AC_CONFIG_MACRO_DIR_TRACE') - { - push @ac_config_macro_dirs, $arg1; - } - # FIXME: We still need to trace AC_CONFIG_MACRO_DIR - # for compatibility with older autoconf. Remove this - # once we can assume Autoconf 2.70 or later. - elsif ($macro eq 'AC_CONFIG_MACRO_DIR') - { - @ac_config_macro_dirs = ($arg1); - } - # FIXME:This is an hack for compatibility with older autoconf. - # Remove this once we can assume Autoconf 2.70 or later. - elsif ($macro eq '_AM_CONFIG_MACRO_DIRS') - { - # Empty leading/trailing fields might be produced by split, - # hence the grep is really needed. - push @ac_config_macro_dirs, grep (/./, (split /\s+/, $arg1)); - } - } - - # FIXME: in Autoconf >= 2.70, AC_CONFIG_MACRO_DIR calls - # AC_CONFIG_MACRO_DIR_TRACE behind the scenes, which could - # leave unwanted duplicates in @ac_config_macro_dirs. - # Remove this in Automake 2.0, when we'll stop tracing - # AC_CONFIG_MACRO_DIR explicitly. - @ac_config_macro_dirs = uniq @ac_config_macro_dirs; - - $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) - { - install_file ($ifile, $user_includes[0]); - } - $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_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [$ac_version],, -[m4_warning([this file was generated for autoconf $ac_version. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -$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-$RELEASE_YEAR 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. - -$ac_config_macro_dirs_fallback -$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 <<'EOF'; -Usage: aclocal [OPTION]... - -Generate 'aclocal.m4' by scanning 'configure.ac' or 'configure.in' - -Options: - --automake-acdir=DIR directory holding automake-provided m4 files - --system-acdir=DIR directory holding third-party system-wide files - --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 system-wide - third-party 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 . -GNU Automake home page: . -General help using GNU software: . -EOF - exit $status; -} - -# Print version and exit. -sub version () -{ - print < -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF - exit 0; -} - -# Parse command line. -sub parse_arguments () -{ - my $print_and_exit = 0; - my $diff_command; - - my %cli_options = - ( - 'help' => sub { usage(0); }, - 'version' => \&version, - 'system-acdir=s' => sub { shift; @system_includes = @_; }, - 'automake-acdir=s' => sub { shift; @automake_includes = @_; }, - '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 Automake::Getopt (); - Automake::Getopt::parse_options %cli_options; - - if (@ARGV > 0) - { - fatal ("non-option arguments are not accepted: '$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; - } - - # 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); - } -} - -# Add any directory listed in the 'ACLOCAL_PATH' environment variable -# to the list of system include directories. -sub parse_ACLOCAL_PATH () -{ - return if not defined $ENV{"ACLOCAL_PATH"}; - # Directories in ACLOCAL_PATH should take precedence over system - # directories, so we use unshift. However, directories that - # come first in ACLOCAL_PATH take precedence over directories - # coming later, which is why the result of split is reversed. - foreach my $dir (reverse split /:/, $ENV{"ACLOCAL_PATH"}) - { - unshift (@system_includes, $dir) if $dir ne '' && -d $dir; - } -} - -################################################################ - -parse_WARNINGS; # Parse the WARNINGS environment variable. -parse_arguments; -parse_ACLOCAL_PATH; -$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; -my $rerun_due_to_macrodir = 0; -while (1) - { - ++$loop; - prog_error "too many loops" if $loop > 2 + $rerun_due_to_macrodir; - - reset_maps; - scan_m4_files; - scan_configure; - last if $exit_code; - my %macro_traced = trace_used_macros; - - if (!$rerun_due_to_macrodir && @ac_config_macro_dirs) - { - # The directory specified in calls to the AC_CONFIG_MACRO_DIRS - # m4 macro (if any) must go after the user includes specified - # explicitly with the '-I' option. - push @user_includes, @ac_config_macro_dirs; - # We might have to scan some new directory of .m4 files. - $rerun_due_to_macrodir++; - next; - } - - if ($install && !@user_includes) - { - fatal "installation of third-party macros impossible without " . - "-I options nor AC_CONFIG_MACRO_DIR{,S} m4 macro(s)"; - } - - 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: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoconf b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoconf deleted file mode 100755 index 8bfd5fc93..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoconf +++ /dev/null @@ -1,500 +0,0 @@ -#! /bin/sh -# Generated from autoconf.in; do not edit by hand. -# autoconf -- create `configure' using m4 macros - -# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, -# 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -## -------------------- ## -## 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=: - # Pre-4.2 versions of Zsh do 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_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -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.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -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 - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do 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_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested="" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - break 2 -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - - -# as_fn_error STATUS ERROR -# ------------------------ -# Output "`basename $0`: error: ERROR" to stderr. Then exit the script with -# STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -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 - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -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[:FORMAT] report the list of calls to MACRO - -i, --initialization also trace Autoconf's initialization process - -In tracing mode, no configuration script is created. FORMAT defaults -to \`\$f:\$l:\$n:\$%'; see \`autom4te --help' for information about FORMAT. - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: ." - -version="\ -autoconf (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -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=' - as_fn_error $? "option \`$1'\'' requires an argument$as_nl$help"' -# restore font-lock: ' - -# Variables. -: ${AUTOM4TE='/i686-pc-cygwin/bin/autom4te'} -autom4te_options= -outfile= -verbose=false - -# 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 ) - $as_echo "$usage"; exit ;; - - --verbose | -v ) - verbose=: - autom4te_options="$autom4te_options $1"; shift ;; - - # Arguments passed as is to autom4te. - --debug | -d | \ - --force | -f | \ - --include=* | -I?* | \ - --prepend-include=* | -B?* | \ - --warnings=* | -W?* ) - case $1 in - *\'*) arg=`$as_echo "$1" | sed "s/'/'\\\\\\\\''/g"` ;; #' - *) arg=$1 ;; - esac - autom4te_options="$autom4te_options '$arg'"; shift ;; - # Options with separated arg passed as is to autom4te. - --include | -I | \ - --prepend-include | -B | \ - --warnings | -W ) - test $# = 1 && eval "$exit_missing_arg" - case $2 in - *\'*) arg=`$as_echo "$2" | sed "s/'/'\\\\\\\\''/g"` ;; #' - *) arg=$2 ;; - esac - autom4te_options="$autom4te_options $option '$arg'" - shift; shift ;; - - --trace=* | -t?* ) - traces="$traces --trace='"`$as_echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'" - shift ;; - --trace | -t ) - test $# = 1 && eval "$exit_missing_arg" - traces="$traces --trace='"`$as_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 - as_fn_error $? "invalid option \`$1'$as_nl$help" ;; #` - * ) - break ;; - esac -done - -# Find the input file. -case $# in - 0) - if test -f configure.ac; then - if test -f configure.in; then - $as_echo "$as_me: warning: both \`configure.ac' and \`configure.in' are present." >&2 - $as_echo "$as_me: warning: proceeding with \`configure.ac'." >&2 - fi - infile=configure.ac - elif test -f configure.in; then - infile=configure.in - else - as_fn_error $? "no input file" - fi - test -z "$traces" && test -z "$outfile" && outfile=configure;; - 1) - infile=$1 ;; - *) exec >&2 - as_fn_error $? "invalid number of arguments$as_nl$help" ;; -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_echo "$as_me: running $AUTOM4TE $*" >&2 -exec "$AUTOM4TE" "$@" diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoheader b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoheader deleted file mode 100755 index 5537fc62c..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoheader +++ /dev/null @@ -1,304 +0,0 @@ -#! /usr/bin/perl -# -*- Perl -*- -# Generated from autoheader.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# autoheader -- create `config.h.in' from `configure.ac' - -# Copyright (C) 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Written by Roland McGrath. -# Rewritten in Perl by Akim Demaille. - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, "$pkgdatadir"; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::Configure_ac; -use Autom4te::FileUtils; -use Autom4te::General; -use Autom4te::XFile; -use strict; - -# Using `do FILE', we need `local' vars. -use vars qw ($config_h %verbatim %symbol); - -# Lib files. -my $autom4te = $ENV{'AUTOM4TE'} || '/i686-pc-cygwin/bin/autom4te'; -local $config_h; -my $config_h_in; -my @prepend_include; -my @include; - - -# $HELP -# ----- -$help = "Usage: $0 [OPTION]... [TEMPLATE-FILE] - -Create a template file of C \`\#define\' statements for \`configure\' to -use. To this end, scan TEMPLATE-FILE, or \`configure.ac\' if present, -or else \`configure.in\'. - - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don\'t remove temporary files - -f, --force consider all files obsolete - -W, --warnings=CATEGORY report the warnings falling in CATEGORY - -" . Autom4te::ChannelDefs::usage () . " - -Library directories: - -B, --prepend-include=DIR prepend directory DIR to search path - -I, --include=DIR append directory DIR to search path - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - - -# $VERSION -# -------- -$version = "autoheader (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Roland McGrath and Akim Demaille. -"; - - -## ---------- ## -## Routines. ## -## ---------- ## - - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - my $srcdir; - - parse_WARNINGS; - getopt ('I|include=s' => \@include, - 'B|prepend-include=s' => \@prepend_include, - 'W|warnings=s' => \&parse_warnings); - - if (! @ARGV) - { - my $configure_ac = require_configure_ac; - push @ARGV, $configure_ac; - } -} - - -## -------------- ## -## Main program. ## -## -------------- ## - -mktmpdir ('ah'); -switch_warning 'obsolete'; -parse_args; - -# Preach. -my $config_h_top = find_file ("config.h.top?", - reverse (@prepend_include), @include); -my $config_h_bot = find_file ("config.h.bot?", - reverse (@prepend_include), @include); -my $acconfig_h = find_file ("acconfig.h?", - reverse (@prepend_include), @include); -if ($config_h_top || $config_h_bot || $acconfig_h) - { - my $msg = << "END"; - Using auxiliary files such as \`acconfig.h\', \`config.h.bot\' - and \`config.h.top\', to define templates for \`config.h.in\' - is deprecated and discouraged. - - Using the third argument of \`AC_DEFINE\' and - \`AC_DEFINE_UNQUOTED\' allows one to define a template without - \`acconfig.h\': - - AC_DEFINE([NEED_FUNC_MAIN], 1, - [Define if a function \`main\' is needed.]) - - More sophisticated templates can also be produced, see the - documentation. -END - $msg =~ s/^ /WARNING: /gm; - msg 'obsolete', $msg; - } - -# Set up autoconf. -my $autoconf = "'$autom4te' --language=autoconf "; -$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include); -$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); -$autoconf .= ' --debug' if $debug; -$autoconf .= ' --force' if $force; -$autoconf .= ' --verbose' if $verbose; - -# ----------------------- # -# Real work starts here. # -# ----------------------- # - -# Source what the traces are trying to tell us. -verb "$me: running $autoconf to trace from $ARGV[0]"; -my $quoted_tmp = shell_quote ($tmp); -xsystem ("$autoconf" - # If you change this list, update the - # `Autoheader-preselections' section of autom4te.in. - . ' --trace AC_CONFIG_HEADERS:\'$$config_h ||= \'"\'"\'$1\'"\'"\';\'' - . ' --trace AH_OUTPUT:\'$$verbatim{\'"\'"\'$1\'"\'"\'} = \'"\'"\'$2\'"\'"\';\'' - . ' --trace AC_DEFINE_TRACE_LITERAL:\'$$symbol{\'"\'"\'$1\'"\'"\'} = 1;\'' - . " " . shell_quote ($ARGV[0]) . " >$quoted_tmp/traces.pl"); - -local (%verbatim, %symbol); -debug "$me: \`do'ing $tmp/traces.pl:\n" . `sed 's/^/| /' $quoted_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; - } - -# We template only the first CONFIG_HEADER. -$config_h =~ s/ .*//; -# Support "outfile[:infile]", defaulting infile="outfile.in". -($config_h, $config_h_in) = split (':', $config_h, 2); -$config_h_in ||= "$config_h.in"; - -# %SYMBOL might contain things like `F77_FUNC(name,NAME)', but we keep -# only the name of the macro. -%symbol = map { s/\(.*//; $_ => 1 } keys %symbol; - -my $out = new Autom4te::XFile ("> " . open_quote ("$tmp/config.hin")); - -# Don't write "do not edit" -- it will get copied into the -# config.h, which it's ok to edit. -print $out "/* $config_h_in. Generated from $ARGV[0] by autoheader. */\n"; - -# Dump the top. -if ($config_h_top) - { - my $in = new Autom4te::XFile ("< " . open_quote ($config_h_top)); - while ($_ = $in->getline) - { - print $out $_; - } - } - -# Dump `acconfig.h', except for its bottom portion. -if ($acconfig_h) - { - my $in = new Autom4te::XFile ("< " . open_quote ($acconfig_h)); - while ($_ = $in->getline) - { - last if /\@BOTTOM\@/; - next if /\@TOP\@/; - print $out $_; - } - } - -# Dump the templates from `configure.ac'. -foreach (sort keys %verbatim) - { - print $out "\n$verbatim{$_}\n"; - } - -# Dump bottom portion of `acconfig.h'. -if ($acconfig_h) - { - my $in = new Autom4te::XFile ("< " . open_quote ($acconfig_h)); - my $dump = 0; - while ($_ = $in->getline) - { - print $out $_ if $dump; - $dump = 1 if /\@BOTTOM\@/; - } - } - -# Dump the bottom. -if ($config_h_bot) - { - my $in = new Autom4te::XFile ("< " . open_quote ($config_h_bot)); - while ($_ = $in->getline) - { - print $out $_; - } - } - -$out->close; - -# Check that all the symbols have a template. -{ - my $in = new Autom4te::XFile ("< " . open_quote ("$tmp/config.hin")); - my $suggest_ac_define = 1; - while ($_ = $in->getline) - { - my ($symbol) = /^\#\s*\w+\s+(\w+)/ - or next; - delete $symbol{$symbol}; - } - foreach (sort keys %symbol) - { - msg 'syntax', "warning: missing template: $_"; - if ($suggest_ac_define) - { - msg 'syntax', "Use AC_DEFINE([$_], [], [Description])"; - $suggest_ac_define = 0; - } - - } - exit 1 - if keys %symbol; -} - -update_file ("$tmp/config.hin", "$config_h_in", $force); - -### 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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autom4te b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autom4te deleted file mode 100755 index d29ca29ba..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autom4te +++ /dev/null @@ -1,1075 +0,0 @@ -#! /usr/bin/perl -w -# -*- perl -*- -# Generated from autom4te.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# autom4te - Wrapper around M4 libraries. -# Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 -# 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::C4che; -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::FileUtils; -use Autom4te::General; -use Autom4te::XFile; -use File::Basename; -use strict; - -# Data directory. -my $pkgdatadir = $ENV{'AC_MACRODIR'} || '//share/autoconf'; - -# $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE. -my %language; - -my $output = '-'; - -# Mode of the output file except for traces. -my $mode = "0666"; - -# If melt, don't use frozen files. -my $melt = 0; - -# Names of the cache directory, cache directory index, trace cache -# prefix, and output cache prefix. And the IO object for the index. -my $cache; -my $icache; -my $tcache; -my $ocache; -my $icache_file; - -my $flock_implemented = 'yes'; - -# The macros to trace mapped to their format, as specified by the -# user. -my %trace; - -# The macros the user will want to trace in the future. -# We need `include' to get the included file, `m4_pattern_forbid' and -# `m4_pattern_allow' to check the output. -# -# FIXME: What about `sinclude'? -my @preselect = ('include', - 'm4_pattern_allow', 'm4_pattern_forbid', - '_m4_warn'); - -# M4 include path. -my @include; - -# Do we freeze? -my $freeze = 0; - -# $M4. -my $m4 = $ENV{"M4"} || '/usr/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" - 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]*) /; - - -# @M4_BUILTIN -- M4 builtins and a useful comment. -my @m4_builtin = `echo dumpdef | $m4 2>&1 >/dev/null`; -map { s/:.*//;s/\W// } @m4_builtin; - - -# %M4_BUILTIN_ALTERNATE_NAME -# -------------------------- -# The builtins are renamed, e.g., `define' is renamed `m4_define'. -# So map `define' to `m4_define' and conversely. -# Some macros don't follow this scheme: be sure to properly map to their -# alternate name too. -# -# FIXME: Trace status of renamed builtins was fixed in M4 1.4.5, which -# we now depend on; do we still need to do this mapping? -# -# So we will merge them, i.e., tracing `BUILTIN' or tracing -# `m4_BUILTIN' will be the same: tracing both, but honoring the -# *last* trace specification. -# -# FIXME: This is not enough: in the output `$0' will be `BUILTIN' -# sometimes and `m4_BUILTIN' at others. We should return a unique name, -# the one specified by the user. -# -# FIXME: To be absolutely rigorous, I would say that given that we -# _redefine_ divert (instead of _copying_ it), divert and the like -# should not be part of this list. -my %m4_builtin_alternate_name; -@m4_builtin_alternate_name{"$_", "m4_$_"} = ("m4_$_", "$_") - foreach (grep { !/m4wrap|m4exit|dnl|ifelse|__.*__/ } @m4_builtin); -@m4_builtin_alternate_name{"ifelse", "m4_if"} = ("m4_if", "ifelse"); -@m4_builtin_alternate_name{"m4exit", "m4_exit"} = ("m4_exit", "m4exit"); -@m4_builtin_alternate_name{"m4wrap", "m4_wrap"} = ("m4_wrap", "m4wrap"); - - -# $HELP -# ----- -$help = "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. - -If some of the FILES are named \`FILE.m4f\' they are considered to be M4 -frozen files of all the previous files (which are therefore not loaded). -If \`FILE.m4f\' is not found, then \`FILE.m4\' will be used, together with -all the previous files. - -Some files may be optional, i.e., will only be processed if found in the -include path, but then must end in \`.m4?\'; the question mark is not part of -the actual file name. - -Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don\'t remove temporary files - -o, --output=FILE save output in FILE (defaults to \`-\', stdout) - -f, --force don\'t rely on cached values - -W, --warnings=CATEGORY report the warnings falling in CATEGORY - -l, --language=LANG specify the set of M4 macros to use - -C, --cache=DIRECTORY preserve results for future runs in DIRECTORY - --no-cache disable the cache - -m, --mode=OCTAL change the non trace output file mode (0666) - -M, --melt don\'t use M4 frozen files - -Languages include: - \`Autoconf\' create Autoconf configure scripts - \`Autotest\' create Autotest test suites - \`M4sh\' create M4sh shell scripts - \`M4sugar\' create M4sugar output - -" . Autom4te::ChannelDefs::usage . " - -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[:FORMAT] report the MACRO invocations - -p, --preselect=MACRO prepare to trace MACRO in a future run - -Freezing: - -F, --freeze produce an M4 frozen state file for FILES - -FORMAT defaults to \`\$f:\$l:\$n:\$%\', and can use the following escapes: - \$\$ literal \$ - \$f file where macro was called - \$l line where macro was called - \$d nesting depth of macro call - \$n name of the macro - \$NUM argument NUM, unquoted and with newlines - \$SEP\@ all arguments, with newlines, quoted, and separated by SEP - \$SEP* all arguments, with newlines, unquoted, and separated by SEP - \$SEP% all arguments, without newlines, unquoted, and separated by SEP -SEP can be empty for the default (comma for \@ and *, colon for %), -a single character for that character, or {STRING} to use a string. - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - -# $VERSION -# -------- -$version = <<"EOF"; -autom4te (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Akim Demaille. -EOF - - -## ---------- ## -## Routines. ## -## ---------- ## - - -# $OPTION -# files_to_options (@FILE) -# ------------------------ -# Transform Autom4te conventions (e.g., using foo.m4f to designate a frozen -# file) into a suitable command line for M4 (e.g., using --reload-state). -# parse_args guarantees that we will see at most one frozen file, and that -# if a frozen file is present, it is the first argument. -sub files_to_options (@) -{ - my (@file) = @_; - my @res; - foreach my $file (@file) - { - my $arg = shell_quote ($file); - if ($file =~ /\.m4f$/) - { - $arg = "--reload-state=$arg"; - # If the user downgraded M4 from 1.6 to 1.4.x after freezing - # the file, then we ensure the frozen __m4_version__ will - # not cause m4_init to make the wrong decision about the - # current M4 version. - $arg .= " --undefine=__m4_version__" - unless grep {/__m4_version__/} @m4_builtin; - } - push @res, $arg; - } - return join ' ', @res; -} - - -# load_configuration ($FILE) -# -------------------------- -# Load the configuration $FILE. -sub load_configuration ($) -{ - my ($file) = @_; - use Text::ParseWords; - - my $cfg = new Autom4te::XFile ("< " . open_quote ($file)); - my $lang; - while ($_ = $cfg->getline) - { - chomp; - # Comments. - next - if /^\s*(\#.*)?$/; - - my @words = shellwords ($_); - my $type = shift @words; - if ($type eq 'begin-language:') - { - fatal "$file:$.: end-language missing for: $lang" - if defined $lang; - $lang = lc $words[0]; - } - elsif ($type eq 'end-language:') - { - error "$file:$.: end-language mismatch: $lang" - if $lang ne lc $words[0]; - $lang = undef; - } - elsif ($type eq 'args:') - { - fatal "$file:$.: no current language" - unless defined $lang; - push @{$language{$lang}}, @words; - } - else - { - error "$file:$.: unknown directive: $type"; - } - } -} - - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - # We want to look for the early options, which should not be found - # in the configuration file. Prepend to the user arguments. - # Perform this repeatedly so that we can use --language in language - # definitions. Beware that there can be several --language - # invocations. - my @language; - do { - @language = (); - use Getopt::Long; - Getopt::Long::Configure ("pass_through", "permute"); - GetOptions ("l|language=s" => \@language); - - foreach (@language) - { - error "unknown language: $_" - unless exists $language{lc $_}; - unshift @ARGV, @{$language{lc $_}}; - } - } while @language; - - # --debug is useless: it is parsed below. - if (exists $ENV{'AUTOM4TE_DEBUG'}) - { - print STDERR "$me: concrete arguments:\n"; - foreach my $arg (@ARGV) - { - print STDERR "| $arg\n"; - } - } - - # 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, - "m|mode=s" => \$mode, - "M|melt" => \$melt, - - # Library directories: - "B|prepend-include=s" => \@prepend_include, - "I|include=s" => \@include, - - # Tracing: - # Using a hash for traces is seducing. Unfortunately, upon `-t FOO', - # instead of mapping `FOO' to undef, Getopt maps it to `1', preventing - # us from distinguishing `-t FOO' from `-t FOO=1'. So let's do it - # by hand. - "t|trace=s" => \@trace, - "p|preselect=s" => \@preselect, - - # Freezing. - "F|freeze" => \$freeze, - - # Caching. - "C|cache=s" => \$cache, - "no-cache" => sub { $cache = undef; }, - ); - - fatal "too few arguments -Try `$me --help' for more information." - unless @ARGV; - - # Freezing: - # We cannot trace at the same time (well, we can, but it sounds insane). - # 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" - if $freeze && @trace; - $melt = 1 - if $freeze; - - # Names of the cache directory, cache directory index, trace cache - # prefix, and output cache prefix. If the cache is not to be - # preserved, default to a temporary directory (automatically removed - # on exit). - $cache = $tmp - unless $cache; - $icache = "$cache/requests"; - $tcache = "$cache/traces."; - $ocache = "$cache/output."; - - # Normalize the includes: the first occurrence is enough, several is - # a pain since it introduces a useless difference in the path which - # invalidates the cache. And strip `.' which is implicit and always - # first. - @include = grep { !/^\.$/ } uniq (reverse(@prepend_include), @include); - - # Convert @trace to %trace, and work around the M4 builtins tracing - # problem. - # The default format is `$f:$l:$n:$%'. - foreach (@trace) - { - /^([^:]+)(?::(.*))?$/ms; - $trace{$1} = defined $2 ? $2 : '$f:$l:$n:$%'; - $trace{$m4_builtin_alternate_name{$1}} = $trace{$1} - if exists $m4_builtin_alternate_name{$1}; - } - - # Work around the M4 builtins tracing problem for @PRESELECT. - # FIXME: Is this still needed, now that we rely on M4 1.4.5? - push (@preselect, - map { $m4_builtin_alternate_name{$_} } - grep { exists $m4_builtin_alternate_name{$_} } @preselect); - - # If we find frozen files, then all the files before it are - # discarded: the frozen file is supposed to include them all. - # - # We don't want to depend upon m4's --include to find the top level - # files, so we use `find_file' here. Try to get a canonical name, - # as it's part of the key for caching. And some files are optional - # (also handled by `find_file'). - my @argv; - foreach (@ARGV) - { - if ($_ eq '-') - { - push @argv, $_; - } - elsif (/\.m4f$/) - { - # Frozen files are optional => pass a `?' to `find_file'. - my $file = find_file ("$_?", @include); - if (!$melt && $file) - { - @argv = ($file); - } - else - { - s/\.m4f$/.m4/; - push @argv, find_file ($_, @include); - } - } - else - { - my $file = find_file ($_, @include); - push @argv, $file - if $file; - } - } - @ARGV = @argv; -} - - -# handle_m4 ($REQ, @MACRO) -# ------------------------ -# Run m4 on the input files, and save the traces on the @MACRO. -sub handle_m4 ($@) -{ - my ($req, @macro) = @_; - - # GNU m4 appends when using --debugfile/--error-output. - unlink ($tcache . $req->id . "t"); - - # Run m4. - # - # We don't output directly to the cache files, to avoid problems - # when we are interrupted (that leaves corrupted files). - xsystem ("$m4 --gnu" - . join (' --include=', '', map { shell_quote ($_) } @include) - . ' --debug=aflq' - . (!exists $ENV{'AUTOM4TE_NO_FATAL'} ? ' --fatal-warning' : '') - . " --debugfile=" . shell_quote ("$tcache" . $req->id . "t") - . join (' --trace=', '', map { shell_quote ($_) } sort @macro) - . " " . files_to_options (@ARGV) - . " > " . shell_quote ("$ocache" . $req->id . "t")); - - # Everything went ok: preserve the outputs. - foreach my $file (map { $_ . $req->id } ($tcache, $ocache)) - { - use File::Copy; - move ("${file}t", "$file") - or fatal "cannot rename ${file}t as $file: $!"; - } -} - - -# warn_forbidden ($WHERE, $WORD, %FORBIDDEN) -# ------------------------------------------ -# $WORD is forbidden. Warn with a dedicated error message if in -# %FORBIDDEN, otherwise a simple `error: possibly undefined macro' -# will do. -my $first_warn_forbidden = 1; -sub warn_forbidden ($$%) -{ - my ($where, $word, %forbidden) = @_; - my $message; - - for my $re (sort keys %forbidden) - { - if ($word =~ $re) - { - $message = $forbidden{$re}; - last; - } - } - $message ||= "possibly undefined macro: $word"; - warn "$where: error: $message\n"; - if ($first_warn_forbidden) - { - warn < 'forbid:$1:$2', - 'm4_pattern_allow' => 'allow:$1')); - my @patterns = new Autom4te::XFile ("< " . open_quote ("$tmp/patterns"))->getlines; - chomp @patterns; - my %forbidden = - map { /^forbid:([^:]+):.+$/ => /^forbid:[^:]+:(.+)$/ } @patterns; - my $forbidden = join ('|', map { /^forbid:([^:]+)/ } @patterns) || "^\$"; - my $allowed = join ('|', map { /^allow:([^:]+)/ } @patterns) || "^\$"; - - verb "forbidden tokens: $forbidden"; - verb "forbidden token : $_ => $forbidden{$_}" - foreach (sort keys %forbidden); - verb "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 - # stdout is to be handled by hand :(. Don't use fdopen as it means - # we will close STDOUT, which we already do in END. - my $out = new Autom4te::XFile; - if ($output eq '-') - { - $out->open (">$output"); - } - else - { - $out->open($output, O_CREAT | O_WRONLY | O_TRUNC, oct ($mode)); - } - fatal "cannot create $output: $!" - unless $out; - my $in = new Autom4te::XFile ("< " . open_quote ($ocache . $req->id)); - - my %prohibited; - my $res; - while ($_ = $in->getline) - { - s/\s+$//; - s/__oline__/$./g; - s/\@<:\@/[/g; - s/\@:>\@/]/g; - s/\@\{:\@/(/g; - s/\@:\}\@/)/g; - s/\@S\|\@/\$/g; - s/\@%:\@/#/g; - - $res = $_; - - # Don't complain in comments. Well, until we have something - # better, don't consider `#include' etc. are comments. - s/\#.*// - unless /^\#\s*(if|include|endif|ifdef|ifndef|define)\b/; - foreach (split (/\W+/)) - { - $prohibited{$_} = $. - if !/^$/ && /$forbidden/o && !/$allowed/o && ! exists $prohibited{$_}; - } - - # Performed *last*: the empty quadrigraph. - $res =~ s/\@&t\@//g; - - print $out "$res\n"; - } - - $out->close(); - - # If no forbidden words, we're done. - return - if ! %prohibited; - - # Locate the forbidden words in the last input file. - # This is unsatisfying but... - $exit_code = 1; - if ($ARGV[$#ARGV] ne '-') - { - my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b'; - my $file = new Autom4te::XFile ("< " . open_quote ($ARGV[$#ARGV])); - - while ($_ = $file->getline) - { - # Don't complain in comments. Well, until we have something - # better, don't consider `#include' etc. to be comments. - s/\#.*// - unless /^\#(if|include|endif|ifdef|ifndef|define)\b/; - - # Complain once per word, but possibly several times per line. - while (/$prohibited/) - { - my $word = $1; - warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden); - delete $prohibited{$word}; - # If we're done, exit. - return - if ! %prohibited; - $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b'; - } - } - } - warn_forbidden ("$output:$prohibited{$_}", $_, %forbidden) - foreach (sort { $prohibited{$a} <=> $prohibited{$b} } keys %prohibited); -} - - -## --------------------- ## -## Handling the traces. ## -## --------------------- ## - - -# $M4_MACRO -# trace_format_to_m4 ($FORMAT) -# ---------------------------- -# Convert a trace $FORMAT into a M4 trace processing macro's body. -sub trace_format_to_m4 ($) -{ - my ($format) = @_; - my $underscore = $_; - my %escape = (# File name. - 'f' => '$1', - # Line number. - 'l' => '$2', - # Depth. - 'd' => '$3', - # Name (also available as $0). - 'n' => '$4', - # Escaped dollar. - '$' => '$'); - - my $res = ''; - $_ = $format; - while ($_) - { - # $n -> $(n + 4) - if (s/^\$(\d+)//) - { - $res .= "\$" . ($1 + 4); - } - # $x, no separator given. - elsif (s/^\$([fldn\$])//) - { - $res .= $escape{$1}; - } - # $.x or ${sep}x. - elsif (s/^\$\{([^}]*)\}([@*%])// - || s/^\$(.?)([@*%])//) - { - # $@, list of quoted effective arguments. - if ($2 eq '@') - { - $res .= ']at_at([' . ($1 ? $1 : ',') . '], $@)['; - } - # $*, list of unquoted effective arguments. - elsif ($2 eq '*') - { - $res .= ']at_star([' . ($1 ? $1 : ',') . '], $@)['; - } - # $%, list of flattened unquoted effective arguments. - elsif ($2 eq '%') - { - $res .= ']at_percent([' . ($1 ? $1 : ':') . '], $@)['; - } - } - elsif (/^(\$.)/) - { - error "invalid escape: $1"; - } - else - { - s/^([^\$]+)//; - $res .= $1; - } - } - - $_ = $underscore; - return '[[' . $res . ']]'; -} - - -# handle_traces($REQ, $OUTPUT, %TRACE) -# ------------------------------------ -# We use M4 itself to process the traces. But to avoid name clashes when -# processing the traces, the builtins are disabled, and moved into `at_'. -# Actually, all the low level processing macros are in `at_' (and `_at_'). -# To avoid clashes between user macros and `at_' macros, the macros which -# implement tracing are in `AT_'. -# -# Having $REQ is needed to neutralize the macros which have been traced, -# but are not wanted now. -sub handle_traces ($$%) -{ - my ($req, $output, %trace) = @_; - - verb "formatting traces for `$output': " . join (', ', sort keys %trace); - - # Processing the traces. - my $trace_m4 = new Autom4te::XFile ("> " . open_quote ("$tmp/traces.m4")); - - $_ = <<'EOF'; - divert(-1) - changequote([, ]) - # _at_MODE(SEPARATOR, ELT1, ELT2...) - # ---------------------------------- - # List the elements, separating then with SEPARATOR. - # MODE can be: - # `at' -- the elements are enclosed in brackets. - # `star' -- the elements are listed as are. - # `percent' -- the elements are `flattened': spaces are singled out, - # and no new line remains. - define([_at_at], - [at_ifelse([$#], [1], [], - [$#], [2], [[[$2]]], - [[[$2]][$1]$0([$1], at_shift(at_shift($@)))])]) - - define([_at_percent], - [at_ifelse([$#], [1], [], - [$#], [2], [at_flatten([$2])], - [at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) - - define([_at_star], - [at_ifelse([$#], [1], [], - [$#], [2], [[$2]], - [[$2][$1]$0([$1], at_shift(at_shift($@)))])]) - - # FLATTEN quotes its result. - # Note that the second pattern is `newline, tab or space'. Don't lose - # the tab! - define([at_flatten], - [at_patsubst(at_patsubst([[[$1]]], [\\\n]), [[\n\t ]+], [ ])]) - - define([at_args], [at_shift(at_shift(at_shift(at_shift(at_shift($@)))))]) - define([at_at], [_$0([$1], at_args($@))]) - define([at_percent], [_$0([$1], at_args($@))]) - define([at_star], [_$0([$1], at_args($@))]) - -EOF - s/^ //mg;s/\\t/\t/mg;s/\\n/\n/mg; - print $trace_m4 $_; - - # If you trace `define', then on `define([m4_exit], defn([m4exit])' you - # will produce - # - # AT_define([m4sugar.m4], [115], [1], [define], [m4_exit], ) - # - # Since `' is not quoted, the outer m4, when processing - # `trace.m4' will exit prematurely. Hence, move all the builtins to - # the `at_' name space. - - print $trace_m4 "# Copy the builtins.\n"; - map { print $trace_m4 "define([at_$_], defn([$_]))\n" } @m4_builtin; - print $trace_m4 "\n"; - - print $trace_m4 "# Disable them.\n"; - map { print $trace_m4 "at_undefine([$_])\n" } @m4_builtin; - print $trace_m4 "\n"; - - - # Neutralize traces: we don't want traces of cached requests (%REQUEST). - print $trace_m4 - "## -------------------------------------- ##\n", - "## By default neutralize all the traces. ##\n", - "## -------------------------------------- ##\n", - "\n"; - print $trace_m4 "at_define([AT_$_], [at_dnl])\n" - foreach (sort keys %{$req->macro}); - print $trace_m4 "\n"; - - # Implement traces for current requests (%TRACE). - print $trace_m4 - "## ------------------------- ##\n", - "## Trace processing macros. ##\n", - "## ------------------------- ##\n", - "\n"; - foreach (sort keys %trace) - { - # Trace request can be embed \n. - (my $comment = "Trace $_:$trace{$_}") =~ s/^/\# /; - print $trace_m4 "$comment\n"; - print $trace_m4 "at_define([AT_$_],\n"; - print $trace_m4 trace_format_to_m4 ($trace{$_}) . ")\n\n"; - } - print $trace_m4 "\n"; - - # Reenable output. - print $trace_m4 "at_divert(0)at_dnl\n"; - - # Transform the traces from m4 into an m4 input file. - # Typically, transform: - # - # | m4trace:configure.ac:3: -1- AC_SUBST([exec_prefix], [NONE]) - # - # into - # - # | AT_AC_SUBST([configure.ac], [3], [1], [AC_SUBST], [exec_prefix], [NONE]) - # - # Pay attention that the file name might include colons, if under DOS - # for instance, so we don't use `[^:]+'. - my $traces = new Autom4te::XFile ("< " . open_quote ($tcache . $req->id)); - while ($_ = $traces->getline) - { - # Trace with arguments, as the example above. We don't try - # to match the trailing parenthesis as it might be on a - # separate line. - s{^m4trace:(.+):(\d+): -(\d+)- ([^(]+)\((.*)$} - {AT_$4([$1], [$2], [$3], [$4], $5}; - # Traces without arguments, always on a single line. - s{^m4trace:(.+):(\d+): -(\d+)- ([^)]*)\n$} - {AT_$4([$1], [$2], [$3], [$4])\n}; - print $trace_m4 "$_"; - } - $trace_m4->close; - - my $in = new Autom4te::XFile ("$m4 " . shell_quote ("$tmp/traces.m4") . " |"); - my $out = new Autom4te::XFile ("> " . open_quote ($output)); - - # This is dubious: should we really transform the quadrigraphs in - # traces? It might break balanced [ ] etc. in the output. The - # consensus seeems to be that traces are more useful this way. - while ($_ = $in->getline) - { - # It makes no sense to try to transform __oline__. - s/\@<:\@/[/g; - s/\@:>\@/]/g; - s/\@\{:\@/(/g; - s/\@:\}\@/)/g; - s/\@S\|\@/\$/g; - s/\@%:\@/#/g; - s/\@&t\@//g; - print $out $_; - } -} - - -# $BOOL -# up_to_date ($REQ) -# ----------------- -# Are the cache files of $REQ up to date? -# $REQ is `valid' if it corresponds to the request and exists, which -# does not mean it is up to date. It is up to date if, in addition, -# its files are younger than its dependencies. -sub up_to_date ($) -{ - my ($req) = @_; - - return 0 - if ! $req->valid; - - my $tfile = $tcache . $req->id; - my $ofile = $ocache . $req->id; - - # We can't answer properly if the traces are not computed since we - # need to know what other files were included. Actually, if any of - # the cache files is missing, we are not up to date. - return 0 - if ! -f $tfile || ! -f $ofile; - - # The youngest of the cache files must be older than the oldest of - # the dependencies. - my $tmtime = mtime ($tfile); - my $omtime = mtime ($ofile); - my ($file, $mtime) = ($tmtime < $omtime - ? ($ofile, $omtime) : ($tfile, $tmtime)); - - # We depend at least upon the arguments. - my @dep = @ARGV; - - # stdin is always out of date. - if (grep { $_ eq '-' } @dep) - { return 0 } - - # Files may include others. We can use traces since we just checked - # if they are available. - handle_traces ($req, "$tmp/dependencies", - ('include' => '$1', - 'm4_include' => '$1')); - my $deps = new Autom4te::XFile ("< " . open_quote ("$tmp/dependencies")); - while ($_ = $deps->getline) - { - chomp; - my $file = find_file ("$_?", @include); - # If a file which used to be included is no longer there, then - # don't say it's missing (it might no longer be included). But - # of course, that causes the output to be outdated (as if the - # time stamp of that missing file was newer). - return 0 - if ! $file; - push @dep, $file; - } - - # If $FILE is younger than one of its dependencies, it is outdated. - return up_to_date_p ($file, @dep); -} - - -## ---------- ## -## Freezing. ## -## ---------- ## - -# freeze ($OUTPUT) -# ---------------- -sub freeze ($) -{ - my ($output) = @_; - - # When processing the file with diversion disabled, there must be no - # output but comments and empty lines. - my $result = xqx ("$m4" - . ' --fatal-warning' - . join (' --include=', '', map { shell_quote ($_) } @include) - . ' --define=divert' - . " " . files_to_options (@ARGV) - . ' lock (LOCK_EX) - if ($flock_implemented eq "yes"); - -# Read the cache index if available and older than autom4te itself. -# If autom4te is younger, then some structures such as C4che might -# have changed, which would corrupt its processing. -Autom4te::C4che->load ($icache_file) - 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]); - -# If $REQ's cache files are not up to date, or simply if the user -# discarded them (-f), declare it invalid. -$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; - -# We need to run M4 if (i) the user 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 - # In particular, m4_warn guarantees that either $stackdump is empty, or - # it consists of lines where only the last line ends in "top level". - my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4); - msg $cat, $loc, "warning: $msg", - partial => ($stacktrace =~ /top level$/) + 0; - for (split /\n/, $stacktrace) - { - my ($loc, $trace) = split (': ', $_, 2); - msg $cat, $loc, $trace, partial => ($trace !~ /top level$/) + 0; - } -} - -# Now output... -if (%trace) - { - # Always produce traces, since even if the output is young enough, - # there is no guarantee that the traces use the same *format* - # (e.g., `-t FOO:foo' and `-t FOO:bar' are both using the same M4 - # traces, hence the M4 traces cache is usable, but its formatting - # will yield different results). - handle_traces ($req, $output, %trace); - } -else - { - # Actual M4 expansion, if the user wants it, or if $output is old - # (STDOUT is pretty old). - handle_output ($req, $output) - if $force || mtime ($output) < mtime ($ocache . $req->id); - } - -# If we ran up to here, the cache is valid. -$req->valid (1); -Autom4te::C4che->save ($icache_file); - -exit $exit_code; - -### Setup "GNU" style for perl-mode and cperl-mode. -## Local Variables: -## perl-indent-level: 2 -## perl-continued-statement-offset: 2 -## perl-continued-brace-offset: 0 -## perl-brace-offset: 0 -## perl-brace-imaginary-offset: 0 -## perl-label-offset: -2 -## cperl-indent-level: 2 -## cperl-brace-offset: 0 -## cperl-continued-brace-offset: 0 -## cperl-label-offset: -2 -## cperl-extra-newline-before-brace: t -## cperl-merge-trailing-else: nil -## cperl-continued-statement-offset: 2 -## End: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/automake b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/automake deleted file mode 100755 index c7f9cea7f..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/automake +++ /dev/null @@ -1,8298 +0,0 @@ -#!/usr/bin/perl -w -# -*- perl -*- -# Generated from bin/automake.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# automake - create Makefile.in from Makefile.am -# Copyright (C) 1994-2013 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, see . - -# Originally written by David Mackenzie . -# Perl reimplementation by Tom Tromey , and -# Alexandre Duret-Lutz . - -package Automake; - -use strict; - -BEGIN -{ - @Automake::perl_libdirs = ('//share/automake-1.14') - unless @Automake::perl_libdirs; - unshift @INC, @Automake::perl_libdirs; - - # 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{'DJDIR'}; -} - -use Automake::Config; -BEGIN -{ - if ($perl_threads) - { - require threads; - import threads; - require Thread::Queue; - import Thread::Queue; - } -} -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::Variable; -use Automake::VarDef; -use Automake::Rule; -use Automake::RuleDef; -use Automake::Wrap 'makefile_wrap'; -use Automake::Language; -use File::Basename; -use File::Spec; -use Carp; - -## ----------------------- ## -## Subroutine prototypes. ## -## ----------------------- ## - -# BEGIN AUTOMATICALLY GENERATED PROTOTYPES -sub append_exeext (&$); -sub check_gnits_standards (); -sub check_gnu_standards (); -sub check_trailing_slash ($\$); -sub check_typos (); -sub define_files_variable ($\@$$); -sub define_standard_variables (); -sub define_verbose_libtool (); -sub define_verbose_texinfo (); -sub do_check_merge_target (); -sub get_number_of_threads (); -sub handle_compile (); -sub handle_data (); -sub handle_dist (); -sub handle_emacs_lisp (); -sub handle_factored_dependencies (); -sub handle_footer (); -sub handle_gettext (); -sub handle_headers (); -sub handle_install (); -sub handle_java (); -sub handle_languages (); -sub handle_libraries (); -sub handle_libtool (); -sub handle_ltlibraries (); -sub handle_makefiles_serial (); -sub handle_man_pages (); -sub handle_minor_options (); -sub handle_options (); -sub handle_programs (); -sub handle_python (); -sub handle_scripts (); -sub handle_silent (); -sub handle_subdirs (); -sub handle_tags (); -sub handle_tests (); -sub handle_tests_dejagnu (); -sub handle_texinfo (); -sub handle_user_recursion (); -sub initialize_per_input (); -sub lang_lex_finish (); -sub lang_sub_obj (); -sub lang_vala_finish (); -sub lang_yacc_finish (); -sub locate_aux_dir (); -sub parse_arguments (); -sub scan_aclocal_m4 (); -sub scan_autoconf_files (); -sub silent_flag (); -sub transform ($\%); -sub transform_token ($\%$); -sub usage (); -sub version (); -sub yacc_lex_finish_helper (); -# END AUTOMATICALLY GENERATED PROTOTYPES - - -## ----------- ## -## Constants. ## -## ----------- ## - -# Some regular expressions. One reason to put them here is that it -# makes indentation work better in Emacs. - -# Writing singled-quoted-$-terminated regexes is a pain because -# perl-mode thinks of $' as the ${'} variable (instead of a $ followed -# by a closing quote. Letting perl-mode think the quote is not closed -# leads to all sort of misindentations. On the other hand, defining -# regexes as double-quoted strings is far less readable. So usually -# we will write: -# -# $REGEX = '^regex_value' . "\$"; - -my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n'; -my $WHITE_PATTERN = '^\s*' . "\$"; -my $COMMENT_PATTERN = '^#'; -my $TARGET_PATTERN='[$a-zA-Z0-9_.@%][-.a-zA-Z0-9_(){}/$+@%]*'; -# A rule has three parts: a list of targets, a list of dependencies, -# and optionally actions. -my $RULE_PATTERN = - "^($TARGET_PATTERN(?:(?:\\\\\n|\\s)+$TARGET_PATTERN)*) *:([^=].*|)\$"; - -# Only recognize leading spaces, not leading tabs. If we recognize -# leading tabs here then we need to make the reader smarter, because -# otherwise it will think rules like 'foo=bar; \' are errors. -my $ASSIGNMENT_PATTERN = '^ *([^ \t=:+]*)\s*([:+]?)=\s*(.*)' . "\$"; -# This pattern recognizes a Gnits version id and sets $1 if the -# release is an alpha release. We also allow a suffix which can be -# used to extend the version number with a "fork" identifier. -my $GNITS_VERSION_PATTERN = '\d+\.\d+([a-z]|\.\d+)?(-[A-Za-z0-9]+)?'; - -my $IF_PATTERN = '^if\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*)\s*(?:#.*)?' . "\$"; -my $ELSE_PATTERN = - '^else(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; -my $ENDIF_PATTERN = - '^endif(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; -my $PATH_PATTERN = '(\w|[+/.-])+'; -# This will pass through anything not of the prescribed form. -my $INCLUDE_PATTERN = ('^include\s+' - . '((\$\(top_srcdir\)/' . $PATH_PATTERN . ')' - . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')' - . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$"); - -# Directories installed during 'install-exec' phase. -my $EXEC_DIR_PATTERN = - '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$"; - -# Values for AC_CANONICAL_* -use constant AC_CANONICAL_BUILD => 1; -use constant AC_CANONICAL_HOST => 2; -use constant AC_CANONICAL_TARGET => 3; - -# Values indicating when something should be cleaned. -use constant MOSTLY_CLEAN => 0; -use constant CLEAN => 1; -use constant DIST_CLEAN => 2; -use constant MAINTAINER_CLEAN => 3; - -# Libtool files. -my @libtool_files = qw(ltmain.sh config.guess config.sub); -# ltconfig appears here for compatibility with old versions of libtool. -my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh); - -# Commonly found files we look for and automatically include in -# DISTFILES. -my @common_files = - (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB - COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO - ar-lib compile config.guess config.rpath - config.sub depcomp install-sh libversion.in mdate-sh - missing mkinstalldirs py-compile texinfo.tex ylwrap), - @libtool_files, @libtool_sometimes); - -# Commonly used files we auto-include, but only sometimes. This list -# is used for the --help output only. -my @common_sometimes = - qw(aclocal.m4 acconfig.h config.h.top config.h.bot configure - configure.ac configure.in stamp-vti); - -# Standard directories from the GNU Coding Standards, and additional -# pkg* directories from Automake. Stored in a hash for fast member check. -my %standard_prefix = - map { $_ => 1 } (qw(bin data dataroot doc dvi exec html include info - lib libexec lisp locale localstate man man1 man2 - man3 man4 man5 man6 man7 man8 man9 oldinclude pdf - pkgdata pkginclude pkglib pkglibexec ps sbin - sharedstate sysconf)); - -# Copyright on generated Makefile.ins. -my $gen_copyright = "\ -# Copyright (C) 1994-$RELEASE_YEAR 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 the lang_*_rewrite functions. -# LANG_SUBDIR means that the resulting object file should be in a -# subdir if the source file is. In this case the file name cannot -# have '..' components. -use constant LANG_IGNORE => 0; -use constant LANG_PROCESS => 1; -use constant LANG_SUBDIR => 2; - -# These are used when keeping track of whether an object can be built -# by two different paths. -use constant COMPILE_LIBTOOL => 1; -use constant COMPILE_ORDINARY => 2; - -# We can't always associate a location to a variable or a rule, -# when it's defined by Automake. We use INTERNAL in this case. -use constant INTERNAL => new Automake::Location; - -# Serialization keys for message queues. -use constant QUEUE_MESSAGE => "msg"; -use constant QUEUE_CONF_FILE => "conf file"; -use constant QUEUE_LOCATION => "location"; -use constant QUEUE_STRING => "string"; - -## ---------------------------------- ## -## Variables related to the options. ## -## ---------------------------------- ## - -# TRUE if we should always generate Makefile.in. -my $force_generation = 1; - -# From the Perl manual. -my $symlink_exists = (eval 'symlink ("", "");', $@ eq ''); - -# TRUE if missing standard files should be installed. -my $add_missing = 0; - -# TRUE if we should copy missing files; otherwise symlink if possible. -my $copy_missing = 0; - -# TRUE if we should always update files that we know about. -my $force_missing = 0; - - -## ---------------------------------------- ## -## Variables filled during files scanning. ## -## ---------------------------------------- ## - -# Name of the configure.ac file. -my $configure_ac; - -# Files found by scanning configure.ac for LIBOBJS. -my %libsources = (); - -# Names used in AC_CONFIG_HEADERS call. -my @config_headers = (); - -# Names used in AC_CONFIG_LINKS call. -my @config_links = (); - -# List of Makefile.am's to process, and their corresponding outputs. -my @input_files = (); -my %output_files = (); - -# Complete list of Makefile.am's that exist. -my @configure_input_files = (); - -# List of files in AC_CONFIG_FILES/AC_OUTPUT without Makefile.am's, -# and their outputs. -my @other_input_files = (); -# Where each AC_CONFIG_FILES/AC_OUTPUT/AC_CONFIG_LINK/AC_CONFIG_HEADERS -# appears. The keys are the files created by these macros. -my %ac_config_files_location = (); -# The condition under which AC_CONFIG_FOOS appears. -my %ac_config_files_condition = (); - -# 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 = ''; - -# Directory to search for AC_LIBSOURCE files, as set by AC_CONFIG_LIBOBJ_DIR -# in configure.ac. -my $config_libobj_dir = ''; - -# Whether AM_GNU_GETTEXT has been seen in configure.ac. -my $seen_gettext = 0; -# Whether AM_GNU_GETTEXT([external]) is used. -my $seen_gettext_external = 0; -# Where AM_GNU_GETTEXT appears. -my $ac_gettext_location; -# Whether AM_GNU_GETTEXT_INTL_SUBDIR has been seen. -my $seen_gettext_intl = 0; - -# The arguments of the AM_EXTRA_RECURSIVE_TARGETS call (if any). -my @extra_recursive_targets = (); - -# 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. -my $seen_canonical = 0; - -# 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 AM_PROG_AR -my $seen_ar = 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; - -# 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 = (); - -# Ignored configure substitutions (i.e., variables not to be output in -# Makefile.in) -my %ignored_configure_vars = (); - -# Files included by $configure_ac. -my @configure_deps = (); - -# Greatest timestamp of configure's dependencies. -my $configure_deps_greatest_timestamp = 0; - -# Hash table of AM_CONDITIONAL variables seen in configure. -my %configure_cond = (); - -# This maps extensions onto language names. -my %extension_map = (); - -# List of the DIST_COMMON files we discovered while reading -# configure.ac. -my $configure_dist_common = ''; - -# This maps languages names onto objects. -my %languages = (); -# Maps each linker variable onto a language object. -my %link_languages = (); - -# maps extensions to needed source flags. -my %sourceflags = (); - -# 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... - 'html-am' => 1, - 'dvi-am' => 1, - 'pdf-am' => 1, - 'ps-am' => 1, - 'info-am' => 1, - 'install-data-am' => 1, - 'install-exec-am' => 1, - 'install-html-am' => 1, - 'install-dvi-am' => 1, - 'install-pdf-am' => 1, - 'install-ps-am' => 1, - 'install-info-am' => 1, - 'installcheck-am' => 1, - 'uninstall-am' => 1, - 'tags-am' => 1, - 'ctags-am' => 1, - 'cscopelist-am' => 1, - 'install-man' => 1, - ); - -# Queue to push require_conf_file requirements to. -my $required_conf_file_queue; - -# The name of the Makefile currently being processed. -my $am_file = 'BUG'; - -################################################################ - -## ------------------------------------------ ## -## Variables reset by &initialize_per_input. ## -## ------------------------------------------ ## - -# Relative dir of the output makefile. -my $relative_dir; - -# Greatest timestamp of the output's dependencies (excluding -# configure's dependencies). -my $output_deps_greatest_timestamp; - -# These variables are used when generating each Makefile.in. -# They hold the Makefile.in until it is ready to be printed. -my $output_vars; -my $output_all; -my $output_header; -my $output_rules; -my $output_trailer; - -# This is the conditional stack, updated on if/else/endif, and -# used to build Condition objects. -my @cond_stack; - -# This holds the set of included files. -my @include_stack; - -# List of dependencies for the obvious targets. -my @all; -my @check; -my @check_tests; - -# Keys in this hash table are files to delete. The associated -# value tells when this should happen (MOSTLY_CLEAN, DIST_CLEAN, etc.) -my %clean_files; - -# Keys in this hash table are object files or other files in -# subdirectories which need to be removed. This only holds files -# which are created by compilations. The value in the hash indicates -# when the file should be removed. -my %compile_clean_files; - -# Keys in this hash table are directories where we expect to build a -# libtool object. We use this information to decide what directories -# to delete. -my %libtool_clean_directories; - -# Value of $(SOURCES), used by tags.am. -my @sources; -# Sources which go in the distribution. -my @dist_sources; - -# This hash maps object file names onto their corresponding source -# file names. This is used to ensure that each object is created -# by a single source file. -my %object_map; - -# This hash maps object file names onto an integer value representing -# whether this object has been built via ordinary compilation or -# libtool compilation (the COMPILE_* constants). -my %object_compilation_map; - - -# This keeps track of the directories for which we've already -# created dirstamp code. Keys are directories, values are stamp files. -# Several keys can share the same stamp files if they are equivalent -# (as are './/foo' and 'foo'). -my %directory_map; - -# All .P files. -my %dep_files; - -# 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). @substitutions@ are not listed. -my %known_programs; -my %known_libraries; - -# 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; - -# Does the generated Makefile have to build some compiled object -# (for binary programs, or plain or libtool libraries)? -my $must_handle_compiled_objects; - -# Record each file processed by make_paragraphs. -my %transformed_files; - -################################################################ - -## ---------------------------------------------- ## -## Variables not reset by &initialize_per_input. ## -## ---------------------------------------------- ## - -# 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; - -################################################################ - -# 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); - -################################################################ - - -# initialize_per_input () -# ----------------------- -# (Re)-Initialize per-Makefile.am variables. -sub initialize_per_input () -{ - reset_local_duplicates (); - - $relative_dir = undef; - - $output_deps_greatest_timestamp = 0; - - $output_vars = ''; - $output_all = ''; - $output_header = ''; - $output_rules = ''; - $output_trailer = ''; - - Automake::Options::reset; - Automake::Variable::reset; - Automake::Rule::reset; - - @cond_stack = (); - - @include_stack = (); - - @all = (); - @check = (); - @check_tests = (); - - %clean_files = (); - %compile_clean_files = (); - - # We always include '.'. This isn't strictly correct. - %libtool_clean_directories = ('.' => 1); - - @sources = (); - @dist_sources = (); - - %object_map = (); - %object_compilation_map = (); - - %directory_map = (); - - %dep_files = (); - - @dist_targets = (); - - %known_programs = (); - %known_libraries= (); - - %extension_seen = (); - - %language_scratch = (); - - %lang_specific_files = (); - - $handle_dist_run = 0; - - $need_link = 0; - - $must_handle_compiled_objects = 0; - - %transformed_files = (); -} - - -################################################################ - -# Initialize our list of languages that are internally supported. - -my @cpplike_flags = - qw{ - $(DEFS) - $(DEFAULT_INCLUDES) - $(INCLUDES) - $(AM_CPPFLAGS) - $(CPPFLAGS) - }; - -# C. -register_language ('name' => 'c', - 'Name' => 'C', - 'config_vars' => ['CC'], - 'autodep' => '', - 'flags' => ['CFLAGS', 'CPPFLAGS'], - 'ccer' => 'CC', - 'compiler' => 'COMPILE', - 'compile' => "\$(CC) @cpplike_flags \$(AM_CFLAGS) \$(CFLAGS)", - 'lder' => 'CCLD', - 'ld' => '$(CC)', - 'linker' => 'LINK', - 'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'CC', - 'extensions' => ['.c']); - -# 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) @cpplike_flags \$(AM_CXXFLAGS) \$(CXXFLAGS)", - 'ccer' => 'CXX', - 'compiler' => 'CXXCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'CXX', - 'lder' => 'CXXLD', - 'ld' => '$(CXX)', - 'pure' => 1, - 'extensions' => ['.c++', '.cc', '.cpp', '.cxx', '.C']); - -# Objective C. -register_language ('name' => 'objc', - 'Name' => 'Objective C', - 'config_vars' => ['OBJC'], - 'linker' => 'OBJCLINK', - 'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'OBJC', - 'flags' => ['OBJCFLAGS', 'CPPFLAGS'], - 'compile' => "\$(OBJC) @cpplike_flags \$(AM_OBJCFLAGS) \$(OBJCFLAGS)", - 'ccer' => 'OBJC', - 'compiler' => 'OBJCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'OBJCLD', - 'ld' => '$(OBJC)', - 'pure' => 1, - 'extensions' => ['.m']); - -# Objective C++. -register_language ('name' => 'objcxx', - 'Name' => 'Objective C++', - 'config_vars' => ['OBJCXX'], - 'linker' => 'OBJCXXLINK', - 'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'OBJCXX', - 'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'], - 'compile' => "\$(OBJCXX) @cpplike_flags \$(AM_OBJCXXFLAGS) \$(OBJCXXFLAGS)", - 'ccer' => 'OBJCXX', - 'compiler' => 'OBJCXXCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'OBJCXXLD', - 'ld' => '$(OBJCXX)', - 'pure' => 1, - 'extensions' => ['.mm']); - -# 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) @cpplike_flags \$(AM_UPCFLAGS) \$(UPCFLAGS)", - 'ccer' => 'UPC', - 'compiler' => 'UPCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'UPCLD', - 'ld' => '$(UPC)', - 'pure' => 1, - 'extensions' => ['.upc']); - -# 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 { }); - -# Vala -register_language ('name' => 'vala', - 'Name' => 'Vala', - 'config_vars' => ['VALAC'], - 'flags' => [], - 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)', - 'ccer' => 'VALAC', - 'compiler' => 'VALACOMPILE', - 'extensions' => ['.vala'], - 'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/; - return ($ext,) }, - 'rule_file' => 'vala', - '_finish' => \&lang_vala_finish, - '_target_hook' => \&lang_vala_target_hook, - 'nodist_specific' => 1); - -# Yacc (C & C++). -register_language ('name' => 'yacc', - 'Name' => 'Yacc', - 'config_vars' => ['YACC'], - 'flags' => ['YFLAGS'], - 'compile' => '$(YACC) $(AM_YFLAGS) $(YFLAGS)', - 'ccer' => 'YACC', - '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, - 'nodist_specific' => 1); -register_language ('name' => 'yaccxx', - 'Name' => 'Yacc (C++)', - 'config_vars' => ['YACC'], - 'rule_file' => 'yacc', - 'flags' => ['YFLAGS'], - 'ccer' => 'YACC', - 'compiler' => 'YACCCOMPILE', - 'compile' => '$(YACC) $(AM_YFLAGS) $(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, - 'nodist_specific' => 1); - -# Lex (C & C++). -register_language ('name' => 'lex', - 'Name' => 'Lex', - 'config_vars' => ['LEX'], - 'rule_file' => 'lex', - 'flags' => ['LFLAGS'], - 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)', - 'ccer' => 'LEX', - '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, - 'nodist_specific' => 1); -register_language ('name' => 'lexxx', - 'Name' => 'Lex (C++)', - 'config_vars' => ['LEX'], - 'rule_file' => 'lex', - 'flags' => ['LFLAGS'], - 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)', - 'ccer' => 'LEX', - '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, - 'nodist_specific' => 1); - -# Assembler. -register_language ('name' => 'asm', - 'Name' => 'Assembler', - '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. - 'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)', - 'ccer' => 'CCAS', - 'compiler' => 'CCASCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'extensions' => ['.s']); - -# Preprocessed Assembler. -register_language ('name' => 'cppasm', - 'Name' => 'Preprocessed Assembler', - 'config_vars' => ['CCAS', 'CCASFLAGS'], - - 'autodep' => 'CCAS', - 'flags' => ['CCASFLAGS', 'CPPFLAGS'], - 'compile' => "\$(CCAS) @cpplike_flags \$(AM_CCASFLAGS) \$(CCASFLAGS)", - 'ccer' => 'CPPAS', - 'compiler' => 'CPPASCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'extensions' => ['.S', '.sx']); - -# 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'], - 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)', - 'ccer' => '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)', - 'ccer' => 'FC', - 'compiler' => 'FCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'FC', - 'lder' => 'FCLD', - 'ld' => '$(FC)', - 'pure' => 1, - 'extensions' => ['.f90', '.f95', '.f03', '.f08']); - -# 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'], - 'ccer' => 'PPFC', - 'compiler' => 'PPFCCOMPILE', - 'compile' => "\$(FC) @cpplike_flags \$(AM_FCFLAGS) \$(FCFLAGS)", - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'FC', - 'pure' => 1, - 'extensions' => ['.F90','.F95', '.F03', '.F08']); - -# 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'], - 'ccer' => 'PPF77', - 'compiler' => 'PPF77COMPILE', - 'compile' => "\$(F77) @cpplike_flags \$(AM_FFLAGS) \$(FFLAGS)", - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'F77', - 'pure' => 1, - 'extensions' => ['.F']); - -# Ratfor. -register_language ('name' => 'ratfor', - 'Name' => 'Ratfor', - 'config_vars' => ['F77'], - 'linker' => 'F77LINK', - 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'lder' => 'F77LD', - 'ld' => '$(F77)', - 'flags' => ['RFLAGS', 'FFLAGS'], - # FIXME also FFLAGS. - 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)', - 'ccer' => 'F77', - 'compiler' => 'RCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'F77', - 'pure' => 1, - 'extensions' => ['.r']); - -# Java via gcj. -register_language ('name' => 'java', - 'Name' => 'Java', - 'config_vars' => ['GCJ'], - 'linker' => 'GCJLINK', - 'link' => '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'GCJ', - 'flags' => ['GCJFLAGS'], - 'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)', - 'ccer' => 'GCJ', - 'compiler' => 'GCJCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'GCJ', - 'lder' => 'GCJLD', - 'ld' => '$(GCJ)', - 'pure' => 1, - 'extensions' => ['.java', '.class', '.zip', '.jar']); - -################################################################ - -# Error reporting functions. - -# err_am ($MESSAGE, [%OPTIONS]) -# ----------------------------- -# Uncategorized errors about the current Makefile.am. -sub err_am -{ - msg_am ('error', @_); -} - -# err_ac ($MESSAGE, [%OPTIONS]) -# ----------------------------- -# Uncategorized errors about configure.ac. -sub err_ac -{ - msg_ac ('error', @_); -} - -# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS]) -# --------------------------------------- -# Messages about about the current Makefile.am. -sub msg_am -{ - my ($channel, $msg, %opts) = @_; - msg $channel, "${am_file}.am", $msg, %opts; -} - -# msg_ac ($CHANNEL, $MESSAGE, [%OPTIONS]) -# --------------------------------------- -# Messages about about configure.ac. -sub msg_ac -{ - my ($channel, $msg, %opts) = @_; - msg $channel, $configure_ac, $msg, %opts; -} - -################################################################ - -# subst ($TEXT) -# ------------- -# Return a configure-style substitution using the indicated text. -# We do this to avoid having the substitutions directly in automake.in; -# when we do that they are sometimes removed and this causes confusion -# and bugs. -sub subst -{ - my ($text) = @_; - return '@' . $text . '@'; -} - -################################################################ - - -# $BACKPATH -# backname ($RELDIR) -# ------------------- -# If I "cd $RELDIR", 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 - or prog_error ("trying to reverse path '$file' pointing outside tree"); - } - else - { - push (@res, '..'); - } - } - return join ('/', @res) || '.'; -} - -################################################################ - -# Silent rules handling functions. - -# verbose_var (NAME) -# ------------------ -# The public variable stem used to implement silent rules. -sub verbose_var -{ - my ($name) = @_; - return 'AM_V_' . $name; -} - -# verbose_private_var (NAME) -# -------------------------- -# The naming policy for the private variables for silent rules. -sub verbose_private_var -{ - my ($name) = @_; - return 'am__v_' . $name; -} - -# define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE]) -# ---------------------------------------------------------- -# For silent rules, setup VAR and dispatcher, to expand to -# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to -# empty) if not. -sub define_verbose_var -{ - my ($name, $silent_val, $verbose_val) = @_; - $verbose_val = '' unless defined $verbose_val; - my $var = verbose_var ($name); - my $pvar = verbose_private_var ($name); - my $silent_var = $pvar . '_0'; - my $verbose_var = $pvar . '_1'; - # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V) - # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY). - # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead. - # See AM_SILENT_RULES in m4/silent.m4. - define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL); - define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', - INTERNAL); - Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, - $silent_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($silent_var, TRUE)); - Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE, - $verbose_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($verbose_var, TRUE)); -} - -# verbose_flag (NAME) -# ------------------- -# Contents of '%VERBOSE%' variable to expand before rule command. -sub verbose_flag -{ - my ($name) = @_; - return '$(' . verbose_var ($name) . ')'; -} - -sub verbose_nodep_flag -{ - my ($name) = @_; - return '$(' . verbose_var ($name) . subst ('am__nodep') . ')'; -} - -# silent_flag -# ----------- -# Contents of %SILENT%: variable to expand to '@' when silent. -sub silent_flag () -{ - return verbose_flag ('at'); -} - -# define_verbose_tagvar (NAME) -# ---------------------------- -# Engage the needed silent rules machinery for tag NAME. -sub define_verbose_tagvar -{ - my ($name) = @_; - define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;'); -} - -# Engage the needed silent rules machinery for assorted texinfo commands. -sub define_verbose_texinfo () -{ - my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF'); - foreach my $tag (@tagvars) - { - define_verbose_tagvar($tag); - } - define_verbose_var('texinfo', '-q'); - define_verbose_var('texidevnull', '> /dev/null'); -} - -# Engage the needed silent rules machinery for 'libtool --silent'. -sub define_verbose_libtool () -{ - define_verbose_var ('lt', '--silent'); - return verbose_flag ('lt'); -} - -sub handle_silent () -{ - # Define "$(AM_V_P)", expanding to a shell conditional that can be - # used in make recipes to determine whether we are being run in - # silent mode or not. The choice of the name derives from the LISP - # convention of appending the letter 'P' to denote a predicate (see - # also "the '-P' convention" in the Jargon File); we do so for lack - # of a better convention. - define_verbose_var ('P', 'false', ':'); - # *Always* provide the user with '$(AM_V_GEN)', unconditionally. - define_verbose_tagvar ('GEN'); - define_verbose_var ('at', '@'); -} - - -################################################################ - - -# Handle AUTOMAKE_OPTIONS variable. Return 0 on error, 1 otherwise. -sub handle_options () -{ - my $var = var ('AUTOMAKE_OPTIONS'); - if ($var) - { - if ($var->has_conditional_contents) - { - msg_var ('unsupported', $var, - "'AUTOMAKE_OPTIONS' cannot have conditional contents"); - } - my @options = map { { option => $_->[1], where => $_->[0] } } - $var->value_as_list_recursive (cond_filter => TRUE, - location => 1); - return 0 unless process_option_list (@options); - } - - if ($strictness == GNITS) - { - set_option ('readme-alpha', INTERNAL); - set_option ('std-options', INTERNAL); - set_option ('check-news', INTERNAL); - } - - return 1; -} - -# 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 an am__VAR_DIST variable which contains -# all possible values, and return $(am__VAR_DIST). -sub shadow_unconditionally -{ - my ($varname, $where) = @_; - my $var = var $varname; - if ($var->has_conditional_contents) - { - $varname = "am__${varname}_DIST"; - my @files = uniq ($var->value_as_list_recursive); - define_pretty_variable ($varname, TRUE, $where, @files); - } - return "\$($varname)" -} - -# 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) - { - 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"); - } - } - } - } -} - -# Call finish function for each language that was used. -sub handle_languages () -{ - if (! option 'no-dependencies') - { - # Include auto-dep code. Don't include it if DEP_FILES would - # be empty. - if (keys %extension_seen && keys %dep_files) - { - # Set location of depcomp. - define_variable ('depcomp', - "\$(SHELL) $am_config_aux_dir/depcomp", - INTERNAL); - define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL); - - require_conf_file ("$am_file.am", FOREIGN, 'depcomp'); - - my @deplist = sort keys %dep_files; - # Generate each 'include' individually. Irix 6 make will - # not properly include several files resulting from a - # variable expansion; generating many separate includes - # seems safest. - $output_rules .= "\n"; - foreach my $iter (@deplist) - { - $output_rules .= (subst ('AMDEP_TRUE') - . subst ('am__include') - . ' ' - . subst ('am__quote') - . $iter - . subst ('am__quote') - . "\n"); - } - - # Compute the set of directories to remove in distclean-depend. - my @depdirs = uniq (map { dirname ($_) } @deplist); - $output_rules .= file_contents ('depend', - new Automake::Location, - DEPDIRS => "@depdirs"); - } - } - else - { - define_variable ('depcomp', '', INTERNAL); - define_variable ('am__depfiles_maybe', '', INTERNAL); - } - - my %done; - - # Is the C linker needed? - my $needs_c = 0; - foreach my $ext (sort keys %extension_seen) - { - next unless $extension_map{$ext}; - - my $lang = $languages{$extension_map{$ext}}; - - my $rule_file = $lang->rule_file || 'depend2'; - - # Get information on $LANG. - my $pfx = $lang->autodep; - my $fpfx = ($pfx eq '') ? 'CC' : $pfx; - - my ($AMDEP, $FASTDEP) = - (option 'no-dependencies' || $lang->autodep eq 'no') - ? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx"); - - my $verbose = verbose_flag ($lang->ccer || 'GEN'); - my $verbose_nodep = ($AMDEP eq 'FALSE') - ? $verbose : verbose_nodep_flag ($lang->ccer || 'GEN'); - my $silent = silent_flag (); - - my %transform = ('EXT' => $ext, - 'PFX' => $pfx, - 'FPFX' => $fpfx, - '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, - VERBOSE => $verbose, - 'VERBOSE-NODEP' => $verbose_nodep, - SILENT => $silent, - ); - - # Generate the appropriate rules for this extension. - if (((! option 'no-dependencies') && $lang->autodep ne 'no') - || defined $lang->compile) - { - # 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, - - 'DERIVED-EXT' => $der_ext, - - DEPBASE => $depbase, - BASE => '$*', - SOURCE => '$<', - SOURCEFLAG => $sourceflags{$ext} || '', - OBJ => '$@', - OBJOBJ => '$@', - LTOBJ => '$@', - - COMPILE => '$(' . $lang->compiler . ')', - LTCOMPILE => '$(LT' . $lang->compiler . ')', - -o => $lang->output_flag, - SUBDIROBJ => !! option 'subdir-objects'); - } - - # Now include code for each specially handled object with this - # language. - my %seen_files = (); - foreach my $file (@{$lang_specific_files{$lang->name}}) - { - my ($derived, $source, $obj, $myext, $srcext, %file_transform) = @$file; - - # We might see a given object twice, for instance if it is - # used under different conditions. - next if defined $seen_files{$obj}; - $seen_files{$obj} = 1; - - prog_error ("found " . $lang->name . - " in handle_languages, but compiler not defined") - unless defined $lang->compile; - - my $obj_compile = $lang->compile; - - # Rewrite each occurrence of 'AM_$flag' in the compile - # rule into '${derived}_$flag' if it exists. - for my $flag (@{$lang->flags}) - { - my $val = "${derived}_$flag"; - $obj_compile =~ s/\(AM_$flag\)/\($val\)/ - if set_seen ($val); - } - - my $libtool_tag = ''; - if ($lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}) - { - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - } - - my $ptltflags = "${derived}_LIBTOOLFLAGS"; - $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags; - - my $ltverbose = define_verbose_libtool (); - my $obj_ltcompile = - "\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) " - . "--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); - - $output_rules .= - file_contents ($rule_file, - new Automake::Location, - %transform, - GENERIC => 0, - - DEPBASE => $depbase, - BASE => $obj, - SOURCE => $source, - SOURCEFLAG => $sourceflags{$srcext} || '', - # 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", - - VERBOSE => $verbose, - 'VERBOSE-NODEP' => $verbose_nodep, - SILENT => $silent, - COMPILE => $obj_compile, - LTCOMPILE => $obj_ltcompile, - -o => $output_flag, - %file_transform); - } - - # The rest of the loop is done once per language. - next if defined $done{$lang}; - $done{$lang} = 1; - - # Load the language dependent Makefile chunks. - my %lang = map { uc ($_) => 0 } keys %languages; - $lang{uc ($lang->name)} = 1; - $output_rules .= file_contents ('lang-compile', - new Automake::Location, - %transform, %lang); - - # If the source to a program consists entirely of code from a - # 'pure' language, for instance C++ or Fortran 77, then we - # don't need the C compiler code. However if we run into - # something unusual then we do generate the C code. There are - # probably corner cases here that do not work properly. - # People linking Java code to Fortran code deserve pain. - $needs_c ||= ! $lang->pure; - - define_compiler_variable ($lang) - if ($lang->compile); - - define_linker_variable ($lang) - if ($lang->link); - - require_variables ("$am_file.am", $lang->Name . " source seen", - TRUE, @{$lang->config_vars}); - - # Call the finisher. - $lang->finish; - - # Flags listed in '->flags' are user variables (per GNU Standards), - # they should not be overridden in the Makefile... - my @dont_override = @{$lang->flags}; - # ... and so is LDFLAGS. - push @dont_override, 'LDFLAGS' if $lang->link; - - check_user_variables @dont_override; - } - - # 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. - my @languages_seen = map { $languages{$extension_map{$_}}->name } - (keys %extension_seen); - @languages_seen = uniq (@languages_seen); - $needs_c = 1 if @languages_seen > 1; - if ($need_link || $needs_c) - { - define_compiler_variable ($languages{'c'}) - unless defined $done{$languages{'c'}}; - define_linker_variable ($languages{'c'}); - } -} - - -# 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 -# do this check. -sub check_libobjs_sources -{ - my ($one_file, $unxformed) = @_; - - foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', - 'dist_EXTRA_', 'nodist_EXTRA_') - { - my @files; - my $varname = $prefix . $one_file . '_SOURCES'; - my $var = var ($varname); - if ($var) - { - @files = $var->value_as_list_recursive; - } - elsif ($prefix eq '') - { - @files = ($unxformed . '.c'); - } - else - { - next; - } - - foreach my $file (@files) - { - err_var ($prefix . $one_file . '_SOURCES', - "automatically discovered file '$file' should not" . - " be explicitly mentioned") - if defined $libsources{$file}; - } - } -} - - -# @OBJECTS -# handle_single_transform ($VAR, $TOPPARENT, $DERIVED, $OBJ, $FILE, %TRANSFORM) -# ----------------------------------------------------------------------------- -# Does much of the actual work for handle_source_transform. -# Arguments are: -# $VAR is the name of the variable that the source filenames come from -# $TOPPARENT is the name of the _SOURCES variable which is being processed -# $DERIVED is the name of resulting executable or library -# $OBJ is the object extension (e.g., '.lo') -# $FILE the source file to transform -# %TRANSFORM contains extras arguments to pass to file_contents -# when producing explicit rules -# Result is a list of the names of objects -# %linkers_used will be updated with any linkers needed -sub handle_single_transform -{ - my ($var, $topparent, $derived, $obj, $_file, %transform) = @_; - my @files = ($_file); - my @result = (); - - # Turn sources into objects. We use a while loop like this - # because we might add to @files in the loop. - while (scalar @files > 0) - { - $_ = shift @files; - - # Configure substitutions in _SOURCES variables are errors. - if (/^\@.*\@$/) - { - my $parent_msg = ''; - $parent_msg = "\nand is referred to from '$topparent'" - if $topparent ne $var->name; - err_var ($var, - "'" . $var->name . "' includes configure substitution '$_'" - . $parent_msg . ";\nconfigure " . - "substitutions are not allowed in _SOURCES variables"); - next; - } - - # If the source file is in a subdirectory then the '.o' is put - # into the current directory, unless the subdir-objects option - # is in effect. - - # Split file name into base and extension. - next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/; - my $full = $_; - my $directory = $1 || ''; - my $base = $2; - my $extension = $3; - - # We must generate a rule for the object if it requires its own flags. - my $renamed = 0; - my ($linker, $object); - - # This records whether we've seen a derived source file (e.g. - # yacc output). - my $derived_source = 0; - - # This holds the 'aggregate context' of the file we are - # currently examining. If the file is compiled with - # per-object flags, then it will be the name of the object. - # Otherwise it will be 'AM'. This is used by the target hook - # language function. - my $aggregate = 'AM'; - - $extension = derive_suffix ($extension, $obj); - my $lang; - if ($extension_map{$extension} && - ($lang = $languages{$extension_map{$extension}})) - { - # 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 $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 - # 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'}; - defined &$subr or $subr = \&lang_sub_obj; - my ($r, $source_extension) - = &$subr ($directory, $base, $extension, - $obj, $have_per_exec_flags, $var); - # 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; - } - else - { - $this_obj_ext = $obj; - } - $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 - # name that is too long for losing systems, in - # some situations. So we provide _SHORTNAME to - # override. - - my $dname = $derived; - my $var = var ($derived . '_SHORTNAME'); - if ($var) - { - # FIXME: should use the same Condition as - # the _SOURCES variable. But this is really - # silly overkill -- nobody should have - # conditional shortnames. - $dname = $var->variable_value; - } - $object = $dname . '-' . $object; - - 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 ($directory ne '') - { - if ($r == LANG_SUBDIR) - { - $object = $directory . '/' . $object; - } - else - { - # Since the next major version of automake (2.0) will - # make the behaviour so far only activated with the - # 'subdir-object' option mandatory, it's better if we - # start warning users not using that option. - # As suggested by Peter Johansson, we strive to avoid - # the warning when it would be irrelevant, i.e., if - # all source files sit in "current" directory. - msg_var 'unsupported', $var, - "source file '$full' is in a subdirectory," - . "\nbut option 'subdir-objects' is disabled"; - msg 'unsupported', INTERNAL, <<'EOF', uniq_scope => US_GLOBAL; -possible forward-incompatibility. -At least a source file is in a subdirectory, but the 'subdir-objects' -automake option hasn't been enabled. For now, the corresponding output -object file(s) will be placed in the top-level directory. However, -this behaviour will change in future Automake versions: they will -unconditionally cause object files to be placed in the same subdirectory -of the corresponding sources. -You are advised to start using 'subdir-objects' option throughout your -project, to avoid future incompatibilities. -EOF - } - } - - # 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'})) - { - my $obj_sans_ext = substr ($object, 0, - - length ($this_obj_ext)); - my $full_ansi; - if ($directory ne '') - { - $full_ansi = $directory . '/' . $base . $extension; - } - else - { - $full_ansi = $base . $extension; - } - - 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'), - $extension); - - # If we renamed the object then we want to use the - # per-executable flag name. But if this is simply a - # subdir build then we still want to use the AM_ flag - # name. - if ($renamed) - { - unshift @specifics, $derived; - $aggregate = $derived; - } - else - { - unshift @specifics, 'AM'; - } - - # Each item on this list is a reference to a list consisting - # of four values followed by additional transform flags for - # file_contents. The four values are the derived flag prefix - # (e.g. for 'foo_CFLAGS', it is 'foo'), the name of the - # source file, the base name of the output file, and - # the extension for the object file. - push (@{$lang_specific_files{$lang->name}}, - [@specifics, %transform]); - } - } - elsif ($extension eq $obj) - { - # 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 - { - # No error message here. Used to have one, but it was - # very unpopular. - # FIXME: we could potentially do more processing here, - # perhaps treating the new extension as though it were a - # new source extension (as above). This would require - # more restructuring than is appropriate right now. - next; - } - - err_am "object '$object' created by '$full' and '$object_map{$object}'" - if (defined $object_map{$object} - && $object_map{$object} ne $full); - - my $comp_val = (($object =~ /\.lo$/) - ? COMPILE_LIBTOOL : COMPILE_ORDINARY); - (my $comp_obj = $object) =~ s/\.lo$/.\$(OBJEXT)/; - if (defined $object_compilation_map{$comp_obj} - && $object_compilation_map{$comp_obj} != 0 - # Only see the error once. - && ($object_compilation_map{$comp_obj} - != (COMPILE_LIBTOOL | COMPILE_ORDINARY)) - && $object_compilation_map{$comp_obj} != $comp_val) - { - err_am "object '$comp_obj' created both with libtool and without"; - } - $object_compilation_map{$comp_obj} |= $comp_val; - - if (defined $lang) - { - # Let the language do some special magic if required. - $lang->target_hook ($aggregate, $object, $full, %transform); - } - - if ($derived_source) - { - prog_error ($lang->name . " has automatic dependency tracking") - if $lang->autodep ne 'no'; - # Make sure this new source file is handled next. That will - # make it appear to be at the right place in the list. - unshift (@files, $object); - # Distribute derived sources unless the source they are - # derived from is not. - push_dist_common ($object) - unless ($topparent =~ /^(?:nobase_)?nodist_/); - next; - } - - $linkers_used{$linker} = 1; - - push (@result, $object); - - if (! defined $object_map{$object}) - { - my @dep_list = (); - $object_map{$object} = $full; - - # If resulting object is in subdir, we need to make - # sure the subdir exists at build time. - if ($object =~ /\//) - { - # FIXME: check that $DIRECTORY is somewhere in the - # project - - # For Java, the way we're handling it right now, a - # '..' component doesn't make sense. - if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//) - { - err_am "'$full' should not contain a '..' component"; - } - - # Make sure *all* objects files in the subdirectory are - # removed by "make mostlyclean". Not only this is more - # efficient than listing the object files to be removed - # individually (which would cause an 'rm' invocation for - # each of them -- very inefficient, see bug#10697), it - # would also leave stale object files in the subdirectory - # whenever a source file there is removed or renamed. - $compile_clean_files{"$directory/*.\$(OBJEXT)"} = MOSTLY_CLEAN; - if ($object =~ /\.lo$/) - { - # If we have a libtool object, then we also must remove - # any '.lo' objects in its same subdirectory. - $compile_clean_files{"$directory/*.lo"} = MOSTLY_CLEAN; - # Remember to cleanup .libs/ in this directory. - $libtool_clean_directories{$directory} = 1; - } - - push (@dep_list, require_build_directory ($directory)); - - # If we're generating dependencies, we also want - # to make sure that the appropriate subdir of the - # .deps directory is created. - push (@dep_list, - require_build_directory ($directory . '/$(DEPDIR)')) - unless option 'no-dependencies'; - } - - pretty_print_rule ($object . ':', "\t", @dep_list) - if scalar @dep_list > 0; - } - - # Transform .o or $o file into .P file (for automatic - # dependency code). - # Properly flatten multiple adjacent slashes, as Solaris 10 make - # might fail over them in an include statement. - # Leading double slashes may be special, as per Posix, so deal - # with them carefully. - if ($lang && $lang->autodep ne 'no') - { - my $depfile = $object; - $depfile =~ s/\.([^.]*)$/.P$1/; - $depfile =~ s/\$\(OBJEXT\)$/o/; - my $maybe_extra_leading_slash = ''; - $maybe_extra_leading_slash = '/' if $depfile =~ m,^//[^/],; - $depfile =~ s,/+,/,g; - my $basename = basename ($depfile); - # This might make $dirname empty, but we account for that below. - (my $dirname = dirname ($depfile)) =~ s/\/*$//; - $dirname = $maybe_extra_leading_slash . $dirname; - $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1; - } - } - - return @result; -} - - -# $LINKER -# define_objects_from_sources ($VAR, $OBJVAR, $NODEFINE, $ONE_FILE, -# $OBJ, $PARENT, $TOPPARENT, $WHERE, %TRANSFORM) -# --------------------------------------------------------------------------- -# Define an _OBJECTS variable for a _SOURCES variable (or subvariable) -# -# Arguments are: -# $VAR is the name of the _SOURCES variable -# $OBJVAR is the name of the _OBJECTS variable if known (otherwise -# it will be generated and returned). -# $NODEFINE is a boolean: if true, $OBJVAR will not be defined (but -# work done to determine the linker will be). -# $ONE_FILE is the canonical (transformed) name of object to build -# $OBJ is the object extension (i.e. either '.o' or '.lo'). -# $TOPPARENT is the _SOURCES variable being processed. -# $WHERE context into which this definition is done -# %TRANSFORM extra arguments to pass to file_contents when producing -# rules -# -# Result is a pair ($LINKER, $OBJVAR): -# $LINKER is a boolean, true if a linker is needed to deal with the objects -sub define_objects_from_sources -{ - my ($var, $objvar, $nodefine, $one_file, - $obj, $topparent, $where, %transform) = @_; - - my $needlinker = ""; - - transform_variable_recursively - ($var, $objvar, 'am__objects', $nodefine, $where, - # The transform code to run on each filename. - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - my @trans = handle_single_transform ($subvar, $topparent, - $one_file, $obj, $val, - %transform); - $needlinker = "true" if @trans; - return @trans; - }); - - return $needlinker; -} - - -# handle_source_transform ($CANON_TARGET, $TARGET, $OBJEXT, $WHERE, %TRANSFORM) -# ----------------------------------------------------------------------------- -# Handle SOURCE->OBJECT transform for one program or library. -# Arguments are: -# canonical (transformed) name of target to build -# actual target of object to build -# object extension (i.e., either '.o' or '$o') -# location of the source variable -# extra arguments to pass to file_contents when producing rules -# Return the name of the linker variable that must be used. -# Empty return means just use 'LINK'. -sub handle_source_transform -{ - # one_file is canonical name. unxformed is given name. obj is - # object extension. - my ($one_file, $unxformed, $obj, $where, %transform) = @_; - - my $linker = ''; - - # No point in continuing if _OBJECTS is defined. - return if reject_var ($one_file . '_OBJECTS', - $one_file . '_OBJECTS should not be defined'); - - my %used_pfx = (); - my $needlinker; - %linkers_used = (); - foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', - 'dist_EXTRA_', 'nodist_EXTRA_') - { - my $varname = $prefix . $one_file . "_SOURCES"; - my $var = var $varname; - next unless $var; - - # We are going to define _OBJECTS variables using the prefix. - # Then we glom them all together. So we can't use the null - # prefix here as we need it later. - my $xpfx = ($prefix eq '') ? 'am_' : $prefix; - - # Keep track of which prefixes we saw. - $used_pfx{$xpfx} = 1 - unless $prefix =~ /EXTRA_/; - - push @sources, "\$($varname)"; - push @dist_sources, shadow_unconditionally ($varname, $where) - unless (option ('no-dist') || $prefix =~ /^nodist_/); - - $needlinker |= - define_objects_from_sources ($varname, - $xpfx . $one_file . '_OBJECTS', - !!($prefix =~ /EXTRA_/), - $one_file, $obj, $varname, $where, - DIST_SOURCE => ($prefix !~ /^nodist_/), - %transform); - } - if ($needlinker) - { - $linker ||= resolve_linker (%linkers_used); - } - - my @keys = sort keys %used_pfx; - if (scalar @keys == 0) - { - # The default source for libfoo.la is libfoo.c, but for - # backward compatibility we first look at libfoo_la.c, - # if no default source suffix is given. - my $old_default_source = "$one_file.c"; - my $ext_var = var ('AM_DEFAULT_SOURCE_EXT'); - my $default_source_ext = $ext_var ? variable_value ($ext_var) : '.c'; - msg_var ('unsupported', $ext_var, $ext_var->name . " can assume at most one value") - if $default_source_ext =~ /[\t ]/; - (my $default_source = $unxformed) =~ s,(\.[^./\\]*)?$,$default_source_ext,; - # TODO: Remove this backward-compatibility hack in Automake 2.0. - if ($old_default_source ne $default_source - && !$ext_var - && (rule $old_default_source - || rule '$(srcdir)/' . $old_default_source - || rule '${srcdir}/' . $old_default_source - || -f $old_default_source)) - { - my $loc = $where->clone; - $loc->pop_context; - msg ('obsolete', $loc, - "the default source for '$unxformed' has been changed " - . "to '$default_source'.\n(Using '$old_default_source' for " - . "backward compatibility.)"); - $default_source = $old_default_source; - } - # If a rule exists to build this source with a $(srcdir) - # prefix, use that prefix in our variables too. This is for - # the sake of BSD Make. - if (rule '$(srcdir)/' . $default_source - || rule '${srcdir}/' . $default_source) - { - $default_source = '$(srcdir)/' . $default_source; - } - - define_variable ($one_file . "_SOURCES", $default_source, $where); - push (@sources, $default_source); - push (@dist_sources, $default_source); - - %linkers_used = (); - my (@result) = - handle_single_transform ($one_file . '_SOURCES', - $one_file . '_SOURCES', - $one_file, $obj, - $default_source, %transform); - $linker ||= resolve_linker (%linkers_used); - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result); - } - else - { - @keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys; - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys); - } - - # If we want to use 'LINK' we must make sure it is defined. - if ($linker eq '') - { - $need_link = 1; - } - - return $linker; -} - - -# handle_lib_objects ($XNAME, $VAR) -# --------------------------------- -# Special-case ALLOCA and LIBOBJS substitutions in _LDADD or _LIBADD variables. -# Also, generate _DEPENDENCIES variable if appropriate. -# Arguments are: -# transformed name of object being built, or empty string if no object -# name of _LDADD/_LIBADD-type variable to examine -# Returns 1 if LIBOBJS seen, 0 otherwise. -sub handle_lib_objects -{ - my ($xname, $varname) = @_; - - my $var = var ($varname); - prog_error "'$varname' undefined" - unless $var; - prog_error "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 - # lax here since this code also applies to non-libtool - # libraries or programs, for which -dlopen and -dlopreopen - # are pure nonsense. Diagnosing this doesn't seem very - # important: the developer will quickly get complaints from - # the linker.) - $val !~ /^-dl(?:pre)?open$/ && - # Only get this error once. - ! $flagvar) - { - $flagvar = 1; - # FIXME: should display a stack of nested variables - # as context when $var != $subvar. - err_var ($var, "linker flags such as '$val' belong in " - . "'${prefix}LDFLAGS'"); - } - return (); - } - elsif ($val !~ /^\@.*\@$/) - { - # Assume we have a file of some sort, and output it into the - # dependency variable. Autoconf substitutions are not output; - # rarely is a new dependency substituted into e.g. foo_LDADD - # -- but bad things (e.g. -lX11) are routinely substituted. - # Note that LIBOBJS and ALLOCA are exceptions to this rule, - # and handled specially below. - return $val; - } - elsif ($val =~ /^\@(LT)?LIBOBJS\@$/) - { - handle_LIBOBJS ($subvar, $cond, $1); - $seen_libobjs = 1; - return $val; - } - elsif ($val =~ /^\@(LT)?ALLOCA\@$/) - { - handle_ALLOCA ($subvar, $cond, $1); - return $val; - } - else - { - return (); - } - }); - - return $seen_libobjs; -} - -# 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 -{ - my ($var) = @_; - - my $dir = ''; - - # 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 = backname ($relative_dir) . "/$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//; - } - else - { - error ("'\$($var)' cannot be used outside '$config_libobj_dir' if" - . " 'subdir-objects' is not set"); - } - } - - return $dir; -} - -sub handle_LIBOBJS -{ - my ($var, $cond, $lt) = @_; - my $myobjext = $lt ? 'lo' : 'o'; - $lt ||= ''; - - $var->requires_variables ("\@${lt}LIBOBJS\@ used", $lt . 'LIBOBJS') - if ! keys %libsources; - - my $dir = handle_LIBOBJS_or_ALLOCA "${lt}LIBOBJS"; - - foreach my $iter (keys %libsources) - { - if ($iter =~ /\.[cly]$/) - { - saw_extension ($&); - saw_extension ('.c'); - } - - if ($iter =~ /\.h$/) - { - require_libsource_with_macro ($cond, $var, FOREIGN, $iter); - } - elsif ($iter ne 'alloca.c') - { - 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); - } - } - } -} - -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'); -} - -# 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; -} - -# Set up the compile suite. -sub handle_compile () -{ - return if ! $must_handle_compiled_objects; - - # Boilerplate. - my $default_includes = ''; - if (! option 'nostdinc') - { - my @incs = ('-I.', subst ('am__isrc')); - - my $var = var 'CONFIG_HEADER'; - if ($var) - { - foreach my $hdr (split (' ', $var->variable_value)) - { - push @incs, '-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 put @am__isrc@ right after '-I.', without a space. - ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/; - } - - my (@mostly_rms, @dist_rms); - foreach my $item (sort keys %compile_clean_files) - { - if ($compile_clean_files{$item} == MOSTLY_CLEAN) - { - push (@mostly_rms, "\t-rm -f $item"); - } - elsif ($compile_clean_files{$item} == DIST_CLEAN) - { - push (@dist_rms, "\t-rm -f $item"); - } - else - { - prog_error 'invalid entry in %compile_clean_files'; - } - } - - my ($coms, $vars, $rules) = - file_contents_internal (1, "$libdir/am/compile.am", - new Automake::Location, - 'DEFAULT_INCLUDES' => $default_includes, - 'MOSTLYRMS' => join ("\n", @mostly_rms), - 'DISTRMS' => join ("\n", @dist_rms)); - $output_vars .= $vars; - $output_rules .= "$coms$rules"; -} - -# Handle libtool rules. -sub handle_libtool () -{ - return unless var ('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; - - 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"); - } - - check_user_variables 'LIBTOOLFLAGS'; - - # Output the libtool compilation rules. - $output_rules .= file_contents ('libtool', - new Automake::Location, - LTRMS => join ("\n", @libtool_rms)); -} - - -sub handle_programs () -{ - my @proglist = am_install_var ('progs', 'PROGRAMS', - 'bin', 'sbin', 'libexec', 'pkglibexec', - 'noinst', 'check'); - return if ! @proglist; - $must_handle_compiled_objects = 1; - - my $seen_global_libobjs = - var ('LDADD') && handle_lib_objects ('', 'LDADD'); - - foreach my $pair (@proglist) - { - my ($where, $one_file) = @$pair; - - my $seen_libobjs = 0; - my $obj = '.$(OBJEXT)'; - - $known_programs{$one_file} = $where; - - # Canonicalize names and check for misspellings. - my $xname = check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS', - '_SOURCES', '_OBJECTS', - '_DEPENDENCIES'); - - $where->push_context ("while processing program '$one_file'"); - $where->set (INTERNAL->get); - - my $linker = handle_source_transform ($xname, $one_file, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); - - if (var ($xname . "_LDADD")) - { - $seen_libobjs = handle_lib_objects ($xname, $xname . '_LDADD'); - } - else - { - # User didn't define prog_LDADD override. So do it. - define_variable ($xname . '_LDADD', '$(LDADD)', $where); - - # This does a bit too much work. But we need it to - # generate _DEPENDENCIES when appropriate. - if (var ('LDADD')) - { - $seen_libobjs = handle_lib_objects ($xname, 'LDADD'); - } - } - - reject_var ($xname . '_LIBADD', - "use '${xname}_LDADD', not '${xname}_LIBADD'"); - - set_seen ($xname . '_DEPENDENCIES'); - set_seen ('EXTRA_' . $xname . '_DEPENDENCIES'); - set_seen ($xname . '_LDFLAGS'); - - # Determine program to use for link. - my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname); - $vlink = verbose_flag ($vlink || 'GEN'); - - # If the resulting program lies in a subdirectory, - # ensure that the directory exists before we need it. - my $dirstamp = require_build_directory_maybe ($one_file); - - $libtool_clean_directories{dirname ($one_file)} = 1; - - $output_rules .= file_contents ('program', - $where, - PROGRAM => $one_file, - XPROGRAM => $xname, - XLINK => $xlink, - VERBOSE => $vlink, - DIRSTAMP => $dirstamp, - EXEEXT => '$(EXEEXT)'); - - if ($seen_libobjs || $seen_global_libobjs) - { - if (var ($xname . '_LDADD')) - { - check_libobjs_sources ($xname, $xname . '_LDADD'); - } - elsif (var ('LDADD')) - { - check_libobjs_sources ($xname, 'LDADD'); - } - } - } -} - - -sub handle_libraries () -{ - my @liblist = am_install_var ('libs', 'LIBRARIES', - 'lib', 'pkglib', 'noinst', 'check'); - return if ! @liblist; - $must_handle_compiled_objects = 1; - - 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); - define_verbose_tagvar ('AR'); - - foreach my $pair (@liblist) - { - my ($where, $onelib) = @$pair; - - my $seen_libobjs = 0; - # Check that the library fits the standard naming convention. - my $bn = basename ($onelib); - if ($bn !~ /^lib.*\.a$/) - { - $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.a/; - my $suggestion = dirname ($onelib) . "/$bn"; - $suggestion =~ s|^\./||g; - msg ('error-gnu/warn', $where, - "'$onelib' is not a standard library name\n" - . "did you mean '$suggestion'?") - } - - ($known_libraries{$onelib} = $bn) =~ s/\.a$//; - - $where->push_context ("while processing library '$onelib'"); - $where->set (INTERNAL->get); - - my $obj = '.$(OBJEXT)'; - - # Canonicalize names and check for misspellings. - my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES', - '_OBJECTS', '_DEPENDENCIES', - '_AR'); - - if (! var ($xlib . '_AR')) - { - define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where); - } - - # Generate support for conditional object inclusion in - # libraries. - if (var ($xlib . '_LIBADD')) - { - if (handle_lib_objects ($xlib, $xlib . '_LIBADD')) - { - $seen_libobjs = 1; - } - } - else - { - define_variable ($xlib . "_LIBADD", '', $where); - } - - reject_var ($xlib . '_LDADD', - "use '${xlib}_LIBADD', not '${xlib}_LDADD'"); - - # Make sure we at look at this. - set_seen ($xlib . '_DEPENDENCIES'); - set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES'); - - handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); - - # If the resulting library lies in a subdirectory, - # make sure this directory will exist. - my $dirstamp = require_build_directory_maybe ($onelib); - my $verbose = verbose_flag ('AR'); - my $silent = silent_flag (); - - $output_rules .= file_contents ('library', - $where, - VERBOSE => $verbose, - SILENT => $silent, - LIBRARY => $onelib, - XLIBRARY => $xlib, - DIRSTAMP => $dirstamp); - - if ($seen_libobjs) - { - if (var ($xlib . '_LIBADD')) - { - check_libobjs_sources ($xlib, $xlib . '_LIBADD'); - } - } - - if (! $seen_ar) - { - msg ('extra-portability', $where, - "'$onelib': linking libraries using a non-POSIX\n" - . "archiver requires 'AM_PROG_AR' in '$configure_ac'") - } - } -} - - -sub handle_ltlibraries () -{ - my @liblist = am_install_var ('ltlib', 'LTLIBRARIES', - 'noinst', 'lib', 'pkglib', 'check'); - return if ! @liblist; - $must_handle_compiled_objects = 1; - - 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 %instsubdirs = (); - my %instconds = (); - my %liblocations = (); # Location (in Makefile.am) of each library. - - foreach my $key (@prefix) - { - # Get the installation directory of each library. - my $dir = $key; - my $strip_subdir = 1; - if ($dir =~ /^nobase_/) - { - $dir =~ s/^nobase_//; - $strip_subdir = 0; - } - 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; - my $ldir = ''; - $ldir = '/' . dirname ($val) - if (!$strip_subdir); - # A library cannot be installed in different directories - # 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 " . ($strip_subdir ? "in" : "below") . " '$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; - $instsubdirs{$val}{$full_cond} = $ldir; - $liblocations{$val}{$full_cond} = $where; - $instconds{$val} = $instconds{$val}->merge ($full_cond); - }, - sub - { - return (); - }, - skip_ac_subst => 1); - } - - foreach my $pair (@liblist) - { - my ($where, $onelib) = @$pair; - - my $seen_libobjs = 0; - my $obj = '.lo'; - - # Canonicalize names and check for misspellings. - my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS', - '_SOURCES', '_OBJECTS', - '_DEPENDENCIES'); - - # Check that the library fits the standard naming convention. - my $libname_rx = '^lib.*\.la'; - my $ldvar = var ("${xlib}_LDFLAGS") || var ('AM_LDFLAGS'); - my $ldvar2 = var ('LDFLAGS'); - if (($ldvar && grep (/-module/, $ldvar->value_as_list_recursive)) - || ($ldvar2 && grep (/-module/, $ldvar2->value_as_list_recursive))) - { - # Relax name checking for libtool modules. - $libname_rx = '\.la'; - } - - my $bn = basename ($onelib); - if ($bn !~ /$libname_rx$/) - { - my $type = 'library'; - if ($libname_rx eq '\.la') - { - $bn =~ s/^(lib|)(.*?)(?:\.[^.]*)?$/$1$2.la/; - $type = 'module'; - } - else - { - $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.la/; - } - my $suggestion = dirname ($onelib) . "/$bn"; - $suggestion =~ s|^\./||g; - msg ('error-gnu/warn', $where, - "'$onelib' is not a standard libtool $type name\n" - . "did you mean '$suggestion'?") - } - - ($known_libraries{$onelib} = $bn) =~ s/\.la$//; - - $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'); - set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES'); - - # Generate support for conditional object inclusion in - # libraries. - if (var ($xlib . '_LIBADD')) - { - if (handle_lib_objects ($xlib, $xlib . '_LIBADD')) - { - $seen_libobjs = 1; - } - } - else - { - define_variable ($xlib . "_LIBADD", '', $where); - } - - reject_var ("${xlib}_LDADD", - "use '${xlib}_LIBADD', not '${xlib}_LDADD'"); - - - my $linker = handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 0, LIBTOOL => 1); - - # Determine program to use for link. - my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xlib); - $vlink = verbose_flag ($vlink || 'GEN'); - - 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)'); - $val .= $instsubdirs{$onelib}{$rcond} - if defined $instsubdirs{$onelib}{$rcond}; - } - if ($rcond->true) - { - # If $rcond is true there is only one condition and - # there is no point defining an helper variable. - $rpath = $val; - } - else - { - define_pretty_variable ($rpathvar, $rcond, INTERNAL, $val); - } - } - - # If the resulting library lies in a subdirectory, - # make sure this directory will exist. - my $dirstamp = require_build_directory_maybe ($onelib); - - # Remember to cleanup .libs/ in this directory. - my $dirname = dirname $onelib; - $libtool_clean_directories{$dirname} = 1; - - $output_rules .= file_contents ('ltlibrary', - $where, - LTLIBRARY => $onelib, - XLTLIBRARY => $xlib, - RPATH => $rpath, - XLINK => $xlink, - VERBOSE => $vlink, - DIRSTAMP => $dirstamp); - if ($seen_libobjs) - { - if (var ($xlib . '_LIBADD')) - { - check_libobjs_sources ($xlib, $xlib . '_LIBADD'); - } - } - - if (! $seen_ar) - { - msg ('extra-portability', $where, - "'$onelib': linking libtool libraries using a non-POSIX\n" - . "archiver requires 'AM_PROG_AR' in '$configure_ac'") - } - } -} - -# See if any _SOURCES variable were misspelled. -sub check_typos () -{ - # It is ok if the user sets this particular variable. - set_seen 'AM_LDFLAGS'; - - foreach my $primary ('SOURCES', 'LIBADD', 'LDADD', 'LDFLAGS', 'DEPENDENCIES') - { - foreach my $var (variables $primary) - { - my $varname = $var->name; - # A configure variable is always legitimate. - next if exists $configure_vars{$varname}; - - for my $cond ($var->conditions->conds) - { - $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/; - msg_var ('syntax', $var, "variable '$varname' is defined but no" - . " program or\nlibrary has '$1' as canonical name" - . " (possible typo)") - unless $var->rdef ($cond)->seen; - } - } - } -} - - -sub handle_scripts () -{ - # NOTE we no longer automatically clean SCRIPTS, because it is - # useful to sometimes distribute scripts verbatim. This happens - # e.g. in Automake itself. - am_install_var ('-candist', 'scripts', 'SCRIPTS', - 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata', - 'noinst', 'check'); -} - - -## ------------------------ ## -## Handling Texinfo files. ## -## ------------------------ ## - -# ($OUTFILE, $VFILE) -# scan_texinfo_file ($FILENAME) -# ----------------------------- -# $OUTFILE - name of the info file produced by $FILENAME. -# $VFILE - name of the version.texi file used (undef if none). -sub scan_texinfo_file -{ - my ($filename) = @_; - - 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 (index ($outfile, '.') < 0) - { - msg 'obsolete', "$filename:$.", - "use of suffix-less info files is discouraged" - } - elsif ($outfile !~ /\.info$/) - { - error ("$filename:$.", - "output '$outfile' has unrecognized extension"); - return; - } - } - # A "version.texi" file is actually any file whose name matches - # "vers*.texi". - elsif (/^\@include\s+(vers[^.]*\.texi)\s*$/) - { - $vfile = $1; - } - } - - if (! $outfile) - { - err_am "'$filename' missing \@setfilename"; - return; - } - - return ($outfile, $vfile); -} - - -# ($DIRSTAMP, @CLEAN_FILES) -# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES) -# ------------------------------------------------------------------ -# SOURCE - the source Texinfo file -# DEST - the destination Info file -# INSRC - whether DEST should be built in the source tree -# DEPENDENCIES - known dependencies -sub output_texinfo_build_rules -{ - my ($source, $dest, $insrc, @deps) = @_; - - # Split 'a.texi' into 'a' and '.texi'. - my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/); - my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/); - - $ssfx ||= ""; - $dsfx ||= ""; - - # We can output two kinds of rules: the "generic" rules use Make - # suffix rules and are appropriate when $source and $dest do not lie - # in a sub-directory; the "specific" rules are needed in the other - # case. - # - # The former are output only once (this is not really apparent here, - # but just remember that some logic deeper in Automake will not - # output the same rule twice); while the later need to be output for - # each Texinfo source. - my $generic; - my $makeinfoflags; - my $sdir = dirname $source; - if ($sdir eq '.' && dirname ($dest) eq '.') - { - $generic = 1; - $makeinfoflags = '-I $(srcdir)'; - } - else - { - $generic = 0; - $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir"; - } - - # A directory can contain two kinds of info files: some built in the - # source tree, and some built in the build tree. The rules are - # different in each case. However we cannot output two different - # set of generic rules. Because in-source builds are more usual, we - # use generic rules in this case and fall back to "specific" rules - # for build-dir builds. (It should not be a problem to invert this - # if needed.) - $generic = 0 unless $insrc; - - # We cannot use a suffix rule to build info files with an empty - # extension. Otherwise we would output a single suffix inference - # rule, with separate dependencies, as in - # - # .texi: - # $(MAKEINFO) ... - # foo.info: foo.texi - # - # which confuse Solaris make. (See the Autoconf manual for - # details.) Therefore we use a specific rule in this case. This - # applies to info files only (dvi and pdf files always have an - # extension). - my $generic_info = ($generic && $dsfx) ? 1 : 0; - - # If the resulting file lies in 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, - AM_V_MAKEINFO => verbose_flag('MAKEINFO'), - AM_V_TEXI2DVI => verbose_flag('TEXI2DVI'), - AM_V_TEXI2PDF => verbose_flag('TEXI2PDF'), - DEPS => "@deps", - DEST_PREFIX => $dpfx, - DEST_INFO_PREFIX => $dipfx, - DEST_SUFFIX => $dsfx, - DIRSTAMP => $dirstamp, - GENERIC => $generic, - GENERIC_INFO => $generic_info, - INSRC => $insrc, - MAKEINFOFLAGS => $makeinfoflags, - SILENT => silent_flag(), - SOURCE => ($generic - ? '$<' : $source), - SOURCE_INFO => ($generic_info - ? '$<' : $source), - SOURCE_REAL => $source, - SOURCE_SUFFIX => $ssfx, - TEXIQUIET => verbose_flag('texinfo'), - TEXIDEVNULL => verbose_flag('texidevnull'), - ); - return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html"); -} - - -# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN) -# 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 (@mostly_cleans, @texi_cleans, @maint_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; - if ($infobase =~ s/\.texi$//) - { - 1; # Nothing more to do. - } - elsif ($infobase =~ s/\.(txi|texinfo)$//) - { - msg_var 'obsolete', $info_texinfos, - "suffix '.$1' for Texinfo files is discouraged;" . - " use '.texi' instead"; - } - else - { - # 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) = - scan_texinfo_file ("$relative_dir/$texi") - or next; - # Directory of auxiliary files and build by-products used by texi2dvi - # and texi2pdf. - push @mostly_cleans, "$infobase.t2d"; - push @mostly_cleans, "$infobase.t2p"; - - # 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_TEXINFOS = foo.texi - # nodist_foo_TEXINFOS = 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 - # wants to distribute .texi files, but does 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 in two cases: - # (1) 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. - # (2) When the undocumented option 'info-in-builddir' is given. - # This is done to allow the developers of GCC, GDB, GNU - # binutils and the GNU bfd library to force the '.info' files - # to be generated in the builddir rather than the srcdir, as - # was once done when the (now removed) 'cygnus' option was - # given. See automake bug#11034 for more discussion. - my $insrc = 1; - my $soutdir = '$(srcdir)/' . $outdir; - - if (option 'info-in-builddir') - { - $insrc = 0; - } - elsif ($out_file =~ $user_cleaned_files) - { - $insrc = 0; - msg 'obsolete', "$am_file.am", < $texi, - VTI => $vti, - STAMPVTI => "${soutdir}stamp-$vti", - VTEXI => "$soutdir$vtexi", - MDDIR => $conf_dir, - DIRSTAMP => $dirstamp); - } - } - - # Handle location of texinfo.tex. - my $need_texi_file = 0; - my $texinfodir; - if (var ('TEXINFO_TEX')) - { - # The user defined TEXINFO_TEX so assume he knows what he is - # doing. - $texinfodir = ('$(srcdir)/' - . dirname (variable_value ('TEXINFO_TEX'))); - } - elsif ($config_aux_dir_set_in_configure_ac) - { - $texinfodir = $am_config_aux_dir; - define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL); - $need_texi_file = 2; # so that we require_conf_file later - } - else - { - $texinfodir = '$(srcdir)'; - $need_texi_file = 1; - } - define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL); - - push (@dist_targets, 'dist-info'); - - if (! option 'no-installinfo') - { - # Make sure documentation is made and installed first. Use - # $(INFO_DEPS), not 'info', because otherwise recursive makes - # get run twice during "make all". - unshift (@all, '$(INFO_DEPS)'); - } - - define_files_variable ("DVIS", @infobase, 'dvi', INTERNAL); - define_files_variable ("PDFS", @infobase, 'pdf', INTERNAL); - define_files_variable ("PSS", @infobase, 'ps', INTERNAL); - define_files_variable ("HTMLS", @infobase, 'html', INTERNAL); - - # This next isn't strictly needed now -- the places that look here - # could easily be changed to look in info_TEXINFOS. But this is - # probably better, in case noinst_TEXINFOS is ever supported. - define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL); - - # Do some error checking. Note that this file is not required - # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly - # up above. - if ($need_texi_file && ! option 'no-texinfo.tex') - { - if ($need_texi_file > 1) - { - require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); - } - else - { - require_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); - } - } - - return (makefile_wrap ("", "\t ", @mostly_cleans), - makefile_wrap ("", "\t ", @texi_cleans), - makefile_wrap ("", "\t ", @maint_cleans)); -} - - -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 ($mostlyclean, $clean, $maintclean) = ('', '', ''); - if ($info_texinfos) - { - define_verbose_texinfo; - ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos); - chomp $mostlyclean; - chomp $clean; - chomp $maintclean; - } - - $output_rules .= file_contents ('texinfos', - new Automake::Location, - AM_V_DVIPS => verbose_flag('DVIPS'), - MOSTLYCLEAN => $mostlyclean, - TEXICLEAN => $clean, - MAINTCLEAN => $maintclean, - 'LOCAL-TEXIS' => !!$info_texinfos, - TEXIQUIET => verbose_flag('texinfo')); -} - - -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, %notrans_sections, %trans_sections, - %notrans_vars, %trans_vars, %notrans_sect_vars, %trans_sect_vars); - # We handle nodist_ for uniformity. man pages aren't distributed - # by default so it isn't actually very important. - foreach my $npfx ('', 'notrans_') - { - foreach my $pfx ('', 'dist_', 'nodist_') - { - # Add more sections as needed. - foreach my $section ('0'..'9', 'n', 'l') - { - my $varname = $npfx . $pfx . 'man' . $section . '_MANS'; - if (var ($varname)) - { - $sections{$section} = 1; - $varname = '$(' . $varname . ')'; - if ($npfx eq 'notrans_') - { - $notrans_sections{$section} = 1; - $notrans_sect_vars{$varname} = 1; - } - else - { - $trans_sections{$section} = 1; - $trans_sect_vars{$varname} = 1; - } - - push_dist_common ($varname) - if $pfx eq 'dist_'; - } - } - - my $varname = $npfx . $pfx . 'man_MANS'; - my $var = var ($varname); - if ($var) - { - foreach ($var->value_as_list_recursive) - { - # A page like 'foo.1c' goes into man1dir. - if (/\.([0-9a-z])([a-z]*)$/) - { - $sections{$1} = 1; - if ($npfx eq 'notrans_') - { - $notrans_sections{$1} = 1; - } - else - { - $trans_sections{$1} = 1; - } - } - } - - $varname = '$(' . $varname . ')'; - if ($npfx eq 'notrans_') - { - $notrans_vars{$varname} = 1; - } - else - { - $trans_vars{$varname} = 1; - } - push_dist_common ($varname) - if $pfx eq 'dist_'; - } - } - } - - return unless %sections; - - my @unsorted_deps; - - # Build section independent variables. - my $have_notrans = %notrans_vars; - my @notrans_list = sort keys %notrans_vars; - my $have_trans = %trans_vars; - my @trans_list = sort keys %trans_vars; - - # Now for each section, generate an install and uninstall rule. - # Sort sections so output is deterministic. - foreach my $section (sort keys %sections) - { - # Build section dependent variables. - my $notrans_mans = $have_notrans || exists $notrans_sections{$section}; - my $trans_mans = $have_trans || exists $trans_sections{$section}; - my (%notrans_this_sect, %trans_this_sect); - my $expr = 'man' . $section . '_MANS'; - foreach my $varname (keys %notrans_sect_vars) - { - if ($varname =~ /$expr/) - { - $notrans_this_sect{$varname} = 1; - } - } - foreach my $varname (keys %trans_sect_vars) - { - if ($varname =~ /$expr/) - { - $trans_this_sect{$varname} = 1; - } - } - my @notrans_sect_list = sort keys %notrans_this_sect; - my @trans_sect_list = sort keys %trans_this_sect; - @unsorted_deps = (keys %notrans_vars, keys %trans_vars, - keys %notrans_this_sect, keys %trans_this_sect); - my @deps = sort @unsorted_deps; - $output_rules .= file_contents ('mans', - new Automake::Location, - SECTION => $section, - DEPS => "@deps", - NOTRANS_MANS => $notrans_mans, - NOTRANS_SECT_LIST => "@notrans_sect_list", - HAVE_NOTRANS => $have_notrans, - NOTRANS_LIST => "@notrans_list", - TRANS_MANS => $trans_mans, - TRANS_SECT_LIST => "@trans_sect_list", - HAVE_TRANS => $have_trans, - TRANS_LIST => "@trans_list"); - } - - @unsorted_deps = (keys %notrans_vars, keys %trans_vars, - keys %notrans_sect_vars, keys %trans_sect_vars); - my @mans = sort @unsorted_deps; - $output_vars .= file_contents ('mans-vars', - new Automake::Location, - MANS => "@mans"); - - push (@all, '$(MANS)') - unless option 'no-installman'; -} - - -sub handle_data () -{ - am_install_var ('-noextra', '-candist', 'data', 'DATA', - 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf', - 'ps', 'sysconf', 'sharedstate', 'localstate', - 'pkgdata', 'lisp', 'noinst', 'check'); -} - - -sub handle_tags () -{ - 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); - } - } - - define_variable ('am__tagged_files', - '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)' - . "@config", INTERNAL); - - if (rvar('am__tagged_files')->value_as_list_recursive - || var ('ETAGS_ARGS') || var ('SUBDIRS')) - { - $output_rules .= file_contents ('tags', new Automake::Location); - set_seen 'TAGS_DEPENDENCIES'; - } - else - { - reject_var ('TAGS_DEPENDENCIES', - "it doesn't make sense to define 'TAGS_DEPENDENCIES'" - . " without\nsources or 'ETAGS_ARGS'"); - # 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. Ditto ctags and - # cscope. - $output_rules .= - "tags TAGS:\n\n" . - "ctags CTAGS:\n\n" . - "cscope cscopelist:\n\n"; - } -} - - -# user_phony_rule ($NAME) -# ----------------------- -# Return false if rule $NAME does not exist. Otherwise, -# declare it as phony, complete its definition (in case it is -# conditional), and return its Automake::Rule instance. -sub user_phony_rule -{ - my ($name) = @_; - my $rule = rule $name; - if ($rule) - { - depend ('.PHONY', $name); - # Define $NAME in all condition where it is not already defined, - # so that it is always OK to depend on $NAME. - for my $c ($rule->not_always_defined_in_cond (TRUE)->conds) - { - Automake::Rule::define ($name, 'internal', RULE_AUTOMAKE, - $c, INTERNAL); - $output_rules .= $c->subst_string . "$name:\n"; - } - } - return $rule; -} - - -# Handle 'dist' target. -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'; - - # 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-$_" } qw(shar zip tarZ bzip2 lzip xz); - error (option 'no-dist-gzip', - "no-dist-gzip specified but no dist-* specified,\n" - . "at least one archive format must be enabled") - unless $archive_defined; - } - - # Look for common files that should be included in distribution. - # If the aux dir is set, and it does not have a Makefile.am, then - # we check for these files there as well. - my $check_aux = 0; - if ($relative_dir eq '.' - && $config_aux_dir_set_in_configure_ac) - { - if (! is_make_dir ($config_aux_dir)) - { - $check_aux = 1; - } - } - foreach my $cfile (@common_files) - { - if (dir_has_case_matching_file ($relative_dir, $cfile) - # The file might be absent, but if it can be built it's ok. - || rule $cfile) - { - push_dist_common ($cfile); - } - - # Don't use 'elsif' here because a file might meaningfully - # appear in both directories. - if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile)) - { - push_dist_common ("$config_aux_dir/$cfile") - } - } - - # We might copy elements from $configure_dist_common to - # %dist_common if we think we need to. If the file appears in our - # directory, we would have discovered it already, so we don't - # check that. But if the file is in a subdir without a Makefile, - # we want to distribute it here if we are doing '.'. Ugly! - # Also, in some corner cases, it's possible that the following code - # will cause the same file to appear in the $(DIST_COMMON) variables - # of two distinct Makefiles; but this is not a problem, since the - # 'distdir' target in 'lib/am/distdir.am' can deal with the same - # file being distributed multiple times. - # See also automake bug#9651. - if ($relative_dir eq '.') - { - foreach my $file (split (' ' , $configure_dist_common)) - { - my $dir = dirname ($file); - push_dist_common ($file) - if ($dir eq '.' || ! is_make_dir ($dir)); - } - } - - # 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 (@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; - - $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook'; - $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external; - - # If the target 'dist-hook' exists, make sure it is run. This - # allows users to do random weird things to the distribution - # before it is packaged up. - push (@dist_targets, 'dist-hook') - if user_phony_rule 'dist-hook'; - $transform{'DIST-TARGETS'} = join (' ', @dist_targets); - - my $flm = option ('filename-length-max'); - my $filename_filter = $flm ? '.' x $flm->[1] : ''; - - $output_rules .= file_contents ('distdir', - new Automake::Location, - %transform, - FILENAME_FILTER => $filename_filter); -} - - -# check_directory ($NAME, $WHERE [, $RELATIVE_DIR = "."]) -# ------------------------------------------------------- -# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane -# name. Use $WHERE as a location in the diagnostic, if any. -sub check_directory -{ - my ($dir, $where, $reldir) = @_; - $reldir = '.' unless defined $reldir; - - error $where, "required directory $reldir/$dir does not exist" - unless -d "$reldir/$dir"; - - # If an 'obj/' directory exists, BSD make will enter it before - # reading 'Makefile'. Hence the 'Makefile' in the current directory - # will not be read. - # - # % cat Makefile - # all: - # echo Hello - # % cat obj/Makefile - # all: - # echo World - # % make # GNU make - # echo Hello - # Hello - # % pmake # BSD make - # echo World - # World - msg ('portability', $where, - "naming a subdirectory 'obj' causes troubles with BSD make") - if $dir eq 'obj'; - - # 'aux' is probably the most important of the following forbidden name, - # since it's tempting to use it as an AC_CONFIG_AUX_DIR. - msg ('portability', $where, - "name '$dir' is reserved on W32 and DOS platforms") - if grep (/^\Q$dir\E$/i, qw/aux lpt1 lpt2 lpt3 com1 com2 com3 com4 con prn/); -} - -# check_directories_in_var ($VARIABLE) -# ------------------------------------ -# Recursively check all items in variables $VARIABLE as directories -sub check_directories_in_var -{ - my ($var) = @_; - $var->traverse_recursively - (sub - { - my ($var, $val, $cond, $full_cond) = @_; - check_directory ($val, $var->rdef ($cond)->location, $relative_dir); - return (); - }, - undef, - skip_ac_subst => 1); -} - - -sub handle_subdirs () -{ - my $subdirs = var ('SUBDIRS'); - return - unless $subdirs; - - check_directories_in_var $subdirs; - - my $dsubdirs = var ('DIST_SUBDIRS'); - check_directories_in_var $dsubdirs - if $dsubdirs; - - $output_rules .= file_contents ('subdirs', new Automake::Location); - rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross! -} - - -# ($REGEN, @DEPENDENCIES) -# scan_aclocal_m4 -# --------------- -# If aclocal.m4 creation is automated, return the list of its dependencies. -sub scan_aclocal_m4 () -{ - my $regen_aclocal = 0; - - set_seen 'CONFIG_STATUS_DEPENDENCIES'; - set_seen 'CONFIGURE_DEPENDENCIES'; - - if (-f 'aclocal.m4') - { - define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL); - - my $aclocal = new Automake::XFile "< aclocal.m4"; - my $line = $aclocal->getline; - $regen_aclocal = $line =~ 'generated automatically by aclocal'; - } - - my @ac_deps = (); - - if (set_seen ('ACLOCAL_M4_SOURCES')) - { - push (@ac_deps, '$(ACLOCAL_M4_SOURCES)'); - msg_var ('obsolete', 'ACLOCAL_M4_SOURCES', - "'ACLOCAL_M4_SOURCES' is obsolete.\n" - . "It should be safe to simply remove it"); - } - - # Note that it might be possible that aclocal.m4 doesn't exist but - # should be auto-generated. This case probably isn't very - # important. - - return ($regen_aclocal, @ac_deps); -} - - -# 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 (dirname ($single) eq $relative_dir) - { - push (@newinputs, '$(srcdir)/' . basename ($single)); - } - else - { - push (@newinputs, '$(top_srcdir)/' . $single); - } - } - return @newinputs; -} - -# @DEPENDENCIES -# rewrite_inputs_into_dependencies ($OUTPUT, @INPUTS) -# --------------------------------------------------- -# Compute a list of dependencies appropriate for the rebuild -# rule of -# AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...) -# Also distribute $INPUTs which are not built by another AC_CONFIG_FOOs. -sub rewrite_inputs_into_dependencies -{ - my ($file, @inputs) = @_; - my @res = (); - - for my $i (@inputs) - { - # We cannot create dependencies on shell variables. - next if (substitute_ac_subst_variables $i) =~ /\$/; - - if (exists $ac_config_files_location{$i} && $i ne $file) - { - my $di = dirname $i; - if ($di eq $relative_dir) - { - $i = basename $i; - } - # In the top-level Makefile we do not use $(top_builddir), because - # we are already there, and since the targets are built without - # a $(top_builddir), it helps BSD Make to match them with - # dependencies. - elsif ($relative_dir ne '.') - { - $i = '$(top_builddir)/' . $i; - } - } - else - { - msg ('error', $ac_config_files_location{$file}, - "required file '$i' not found") - unless $i =~ /\$/ || exists $output_files{$i} || -f $i; - ($i) = prepend_srcdir ($i); - push_dist_common ($i); - } - push @res, $i; - } - return @res; -} - - - -# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS) -# ----------------------------------------------------------------- -# Handle remaking and configure stuff. -# We need the name of the input file, to do proper remaking rules. -sub handle_configure -{ - my ($makefile_am, $makefile_in, $makefile, @inputs) = @_; - - prog_error 'empty @inputs' - unless @inputs; - - my ($rel_makefile_am, $rel_makefile_in) = prepend_srcdir ($makefile_am, - $makefile_in); - my $rel_makefile = basename $makefile; - - my $colon_infile = ':' . join (':', @inputs); - $colon_infile = '' if $colon_infile eq ":$makefile.in"; - my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs); - my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4; - define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL, - @configure_deps, @aclocal_m4_deps, - '$(top_srcdir)/' . $configure_ac); - my @configuredeps = ('$(am__aclocal_m4_deps)', '$(CONFIGURE_DEPENDENCIES)'); - push @configuredeps, '$(ACLOCAL_M4)' if -f 'aclocal.m4'; - define_pretty_variable ('am__configure_deps', TRUE, INTERNAL, - @configuredeps); - - my $automake_options = '--' . $strictness_name . - (global_option 'no-dependencies' ? ' --ignore-deps' : ''); - - $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, - 'HAVE-MAKEFILE-IN-DEPS' => (@include_stack > 0), - 'MAKEFILE-IN-DEPS' => "@include_stack", - 'MAKEFILE-AM' => $rel_makefile_am, - 'AUTOMAKE-OPTIONS' => $automake_options, - 'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile", - 'REGEN-ACLOCAL-M4' => $regen_aclocal_m4, - VERBOSE => verbose_flag ('GEN')); - - if ($relative_dir eq '.') - { - push_dist_common ('acconfig.h') - if -f 'acconfig.h'; - } - - # If we have a configure header, require it. - my $hdr_index = 0; - my @distclean_config; - foreach my $spec (@config_headers) - { - $hdr_index += 1; - # $CONFIG_H_PATH: config.h from top level. - my ($config_h_path, @ins) = split_config_file_spec ($spec); - my $config_h_dir = dirname ($config_h_path); - - # If the header is in the current directory we want to build - # the header here. Otherwise, if we're at the topmost - # directory and the header's directory doesn't have a - # Makefile, then we also want to build the header. - if ($relative_dir eq $config_h_dir - || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir))) - { - my ($cn_sans_dir, $stamp_dir); - if ($relative_dir eq $config_h_dir) - { - $cn_sans_dir = basename ($config_h_path); - $stamp_dir = ''; - } - else - { - $cn_sans_dir = $config_h_path; - if ($config_h_dir eq '.') - { - $stamp_dir = ''; - } - else - { - $stamp_dir = $config_h_dir . '/'; - } - } - - # This will also distribute all inputs. - @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins); - - # Cannot define rebuild rules for filenames with shell variables. - next if (substitute_ac_subst_variables $config_h_path) =~ /\$/; - - # Header defined in this directory. - my @files; - if (-f $config_h_path . '.top') - { - push (@files, "$cn_sans_dir.top"); - } - if (-f $config_h_path . '.bot') - { - push (@files, "$cn_sans_dir.bot"); - } - - push_dist_common (@files); - - # For now, acconfig.h can only appear in the top srcdir. - if (-f 'acconfig.h') - { - push (@files, '$(top_srcdir)/acconfig.h'); - } - - my $stamp = "${stamp_dir}stamp-h${hdr_index}"; - $output_rules .= - file_contents ('remake-hdr', - new Automake::Location, - FILES => "@files", - 'FIRST-HDR' => ($hdr_index == 1), - CONFIG_H => $cn_sans_dir, - CONFIG_HIN => $ins[0], - CONFIG_H_DEPS => "@ins", - CONFIG_H_PATH => $config_h_path, - STAMP => "$stamp"); - - push @distclean_config, $cn_sans_dir, $stamp; - } - } - - $output_rules .= file_contents ('clean-hdr', - new Automake::Location, - FILES => "@distclean_config") - if @distclean_config; - - # Distribute and define mkinstalldirs only if it is already present - # in the package, for backward compatibility (some people may still - # use $(mkinstalldirs)). - # TODO: start warning about this in Automake 1.14, and have - # TODO: Automake 2.0 drop it (and the mkinstalldirs script - # TODO: as well). - 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); - } - - reject_var ('CONFIG_HEADER', - "'CONFIG_HEADER' is an anachronism; now determined " - . "automatically\nfrom '$configure_ac'"); - - my @config_h; - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - # Generate CONFIG_HEADER define. - if ($relative_dir eq dirname ($out)) - { - push @config_h, basename ($out); - } - else - { - push @config_h, "\$(top_builddir)/$out"; - } - } - define_variable ("CONFIG_HEADER", "@config_h", INTERNAL) - if @config_h; - - # Now look for other files in this directory which must be remade - # by config.status, and generate rules for them. - my @actual_other_files = (); - # These get cleaned only in a VPATH build. - my @actual_other_vpath_files = (); - foreach my $lfile (@other_input_files) - { - my $file; - my @inputs; - if ($lfile =~ /^([^:]*):(.*)$/) - { - # This is the ":" syntax of AC_OUTPUT. - $file = $1; - @inputs = split (':', $2); - } - else - { - # Normal usage. - $file = $lfile; - @inputs = $file . '.in'; - } - - # Automake files should not be stored in here, but in %MAKE_LIST. - prog_error ("$lfile in \@other_input_files\n" - . "\@other_input_files = (@other_input_files)") - if -f $file . '.am'; - - my $local = basename ($file); - - # We skip files that aren't in this directory. However, if - # the file's directory does not have a Makefile, and we are - # currently doing '.', then we create a rule to rebuild the - # file in the subdir. - my $fd = dirname ($file); - if ($fd ne $relative_dir) - { - if ($relative_dir eq '.' && ! is_make_dir ($fd)) - { - $local = $file; - } - else - { - next; - } - } - - my @rewritten_inputs = rewrite_inputs_into_dependencies ($file, @inputs); - - # Cannot output rules for shell variables. - next if (substitute_ac_subst_variables $local) =~ /\$/; - - my $condstr = ''; - my $cond = $ac_config_files_condition{$lfile}; - if (defined $cond) - { - $condstr = $cond->subst_string; - Automake::Rule::define ($local, $configure_ac, RULE_AUTOMAKE, $cond, - $ac_config_files_location{$file}); - } - $output_rules .= ($condstr . $local . ': ' - . '$(top_builddir)/config.status ' - . "@rewritten_inputs\n" - . $condstr . "\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 links that aren't in this directory. However, if - # the link's directory does not have a Makefile, and we are - # currently doing '.', then we add the link to CONFIG_CLEAN_FILES - # in '.'s Makefile.in. - my $local = basename ($link); - my $fd = dirname ($link); - if ($fd ne $relative_dir) - { - if ($relative_dir eq '.' && ! is_make_dir ($fd)) - { - $local = $link; - } - else - { - $local = undef; - } - } - if ($file ne $link) - { - push @actual_other_files, $local if $local; - } - else - { - push @actual_other_vpath_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))) - { - # The following will distribute $file as a side-effect when - # it is appropriate (i.e., when $file is not already an output). - # We do not need the result, just the side-effect. - rewrite_inputs_into_dependencies ($link, $file); - } - } - } - - # These files get removed by "make distclean". - define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL, - @actual_other_files); - define_pretty_variable ('CONFIG_CLEAN_VPATH_FILES', TRUE, INTERNAL, - @actual_other_vpath_files); -} - -sub handle_headers () -{ - my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include', - 'oldinclude', 'pkginclude', - 'noinst', 'check'); - foreach (@r) - { - next unless $_->[1] =~ /\..*$/; - saw_extension ($&); - } -} - -sub handle_gettext () -{ - return if ! $seen_gettext || $relative_dir ne '.'; - - my $subdirs = var 'SUBDIRS'; - - if (! $subdirs) - { - err_ac "AM_GNU_GETTEXT used but SUBDIRS not defined"; - return; - } - - # Perform some sanity checks to help users get the right setup. - # We disable these tests when po/ doesn't exist in order not to disallow - # unusual gettext setups. - # - # Bruno Haible: - # | The idea is: - # | - # | 1) If a package doesn't have a directory po/ at top level, it - # | will likely have multiple po/ directories in subpackages. - # | - # | 2) It is useful to warn for the absence of intl/ if AM_GNU_GETTEXT - # | is used without 'external'. It is also useful to warn for the - # | presence of intl/ if AM_GNU_GETTEXT([external]) is used. Both - # | warnings apply only to the usual layout of packages, therefore - # | they should both be disabled if no po/ directory is found at - # | top level. - - if (-d 'po') - { - my @subdirs = $subdirs->value_as_list_recursive; - - msg_var ('syntax', $subdirs, - "AM_GNU_GETTEXT used but 'po' not in SUBDIRS") - if ! grep ($_ eq 'po', @subdirs); - - # intl/ is not required when AM_GNU_GETTEXT is called with the - # 'external' option 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)); - } - - require_file ($ac_gettext_location, GNU, 'ABOUT-NLS'); -} - -# Emit makefile footer. -sub handle_footer () -{ - reject_rule ('.SUFFIXES', - "use variable 'SUFFIXES', not target '.SUFFIXES'"); - - # Note: AIX 4.1 /bin/make will fail if any suffix rule appears - # before .SUFFIXES. So we make sure that .SUFFIXES appears before - # anything else, by sticking it right after the default: target. - $output_header .= ".SUFFIXES:\n"; - my $suffixes = var 'SUFFIXES'; - my @suffixes = Automake::Rule::suffixes; - if (@suffixes || $suffixes) - { - # Make sure SUFFIXES has unique elements. Sort them to ensure - # the output remains consistent. However, $(SUFFIXES) is - # always at the start of the list, unsorted. This is done - # because make will choose rules depending on the ordering of - # suffixes, and this lets the user have some control. Push - # actual suffixes, and not $(SUFFIXES). Some versions of make - # do not like variable substitutions on the .SUFFIXES line. - my @user_suffixes = ($suffixes - ? $suffixes->value_as_list_recursive : ()); - - my %suffixes = map { $_ => 1 } @suffixes; - delete @suffixes{@user_suffixes}; - - $output_header .= (".SUFFIXES: " - . join (' ', @user_suffixes, sort keys %suffixes) - . "\n"); - } - - $output_trailer .= file_contents ('footer', new Automake::Location); -} - - -# Generate 'make install' rules. -sub handle_install () -{ - $output_rules .= file_contents - ('install', - new Automake::Location, - maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES') - ? (" \$(BUILT_SOURCES)\n" - . "\t\$(MAKE) \$(AM_MAKEFLAGS)") - : ''), - 'installdirs-local' => (user_phony_rule ('installdirs-local') - ? ' installdirs-local' : ''), - am__installdirs => variable_value ('am__installdirs') || ''); -} - - -# handle_all ($MAKEFILE) -#----------------------- -# Deal with 'all' and 'all-am'. -sub handle_all -{ - my ($makefile) = @_; - - # Output 'all-am'. - - # Put this at the beginning for the sake of non-GNU makes. This - # is still wrong if these makes can run parallel jobs. But it is - # right enough. - unshift (@all, basename ($makefile)); - - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push (@all, basename ($out)) - if dirname ($out) eq $relative_dir; - } - - # Install 'all' hooks. - push (@all, "all-local") - if user_phony_rule "all-local"; - - pretty_print_rule ("all-am:", "\t\t", @all); - depend ('.PHONY', 'all-am', 'all'); - - - # Output 'all'. - - my @local_headers = (); - push @local_headers, '$(BUILT_SOURCES)' - if var ('BUILT_SOURCES'); - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push @local_headers, basename ($out) - if dirname ($out) eq $relative_dir; - } - - if (@local_headers) - { - # We need to make sure config.h is built before we recurse. - # We also want to make sure that built sources are built - # before any ordinary 'all' targets are run. We can't do this - # by changing the order of dependencies to the "all" because - # that breaks when using parallel makes. Instead we handle - # things explicitly. - $output_all .= ("all: @local_headers" - . "\n\t" - . '$(MAKE) $(AM_MAKEFLAGS) ' - . (var ('SUBDIRS') ? 'all-recursive' : 'all-am') - . "\n\n"); - depend ('.MAKE', 'all'); - } - else - { - $output_all .= "all: " . (var ('SUBDIRS') - ? 'all-recursive' : 'all-am') . "\n\n"; - } -} - -# Generate helper targets for user-defined recursive targets, where needed. -sub handle_user_recursion () -{ - return unless @extra_recursive_targets; - - define_pretty_variable ('am__extra_recursive_targets', TRUE, INTERNAL, - map { "$_-recursive" } @extra_recursive_targets); - my $aux = var ('SUBDIRS') ? 'recursive' : 'am'; - foreach my $target (@extra_recursive_targets) - { - # This allows the default target's rules to be overridden in - # Makefile.am. - user_phony_rule ($target); - depend ("$target", "$target-$aux"); - depend ("$target-am", "$target-local"); - # Every user-defined recursive target 'foo' *must* have a valid - # associated 'foo-local' rule; we define it as an empty rule by - # default, so that the user can transparently extend it in his - # own Makefile.am. - pretty_print_rule ("$target-local:", '', ''); - # $target-recursive might as well be undefined, so do not add - # it here; it's taken care of in subdirs.am anyway. - depend (".PHONY", "$target-am", "$target-local"); - } -} - - -# Handle check merge target specially. -sub do_check_merge_target () -{ - # Include user-defined local form of target. - push @check_tests, 'check-local' - if user_phony_rule 'check-local'; - - # 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"; - if (@check) - { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check); - depend ('.MAKE', 'check-am'); - } - - if (@check_tests) - { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", - @check_tests); - depend ('.MAKE', 'check-am'); - } - - 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"); - depend ('.MAKE', 'check') - if var ('BUILT_SOURCES'); -} - -# Handle all 'clean' targets. -sub handle_clean -{ - my ($makefile) = @_; - - # Clean the files listed in user variables if they exist. - $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN - if var ('MOSTLYCLEANFILES'); - $clean_files{'$(CLEANFILES)'} = CLEAN - if var ('CLEANFILES'); - $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN - if var ('DISTCLEANFILES'); - $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN - if var ('MAINTAINERCLEANFILES'); - - # Built sources are automatically removed by maintainer-clean. - $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN - if var ('BUILT_SOURCES'); - - # Compute a list of "rm"s to run for each target. - my %rms = (MOSTLY_CLEAN, [], - CLEAN, [], - DIST_CLEAN, [], - MAINTAINER_CLEAN, []); - - foreach my $file (keys %clean_files) - { - my $when = $clean_files{$file}; - prog_error 'invalid entry in %clean_files' - unless exists $rms{$when}; - - my $rm = "rm -f $file"; - # If file is a variable, make sure when don't call 'rm -f' without args. - $rm ="test -z \"$file\" || $rm" - if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/); - - push @{$rms{$when}}, "\t-$rm\n"; - } - - $output_rules .= file_contents - ('clean', - new Automake::Location, - MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}), - CLEAN_RMS => join ('', sort @{$rms{&CLEAN}}), - DISTCLEAN_RMS => join ('', sort @{$rms{&DIST_CLEAN}}), - MAINTAINER_CLEAN_RMS => join ('', sort @{$rms{&MAINTAINER_CLEAN}}), - MAKEFILE => basename $makefile, - ); -} - - -# Subroutine for handle_factored_dependencies() to let '.PHONY' and -# other '.TARGETS' be last. This is meant to be used as a comparison -# subroutine passed to the sort built-int. -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; -} - - -# 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', - 'uninstall-dvi-local', - 'uninstall-html-local', - 'uninstall-info-local', - 'uninstall-pdf-local', - 'uninstall-ps-local') - { - my $x = $utarg; - $x =~ s/-.*-/-/; - reject_rule ($utarg, "use '$x', not '$utarg'"); - } - - reject_rule ('install-local', - "use 'install-data-local' or 'install-exec-local', " - . "not 'install-local'"); - - reject_rule ('install-hook', - "use 'install-data-hook' or 'install-exec-hook', " - . "not 'install-hook'"); - - # Install the -local hooks. - foreach (keys %dependencies) - { - # Hooks are installed on the -am targets. - s/-am$// or next; - depend ("$_-am", "$_-local") - if user_phony_rule "$_-local"; - } - - # Install the -hook hooks. - # FIXME: Why not be as liberal as we are with -local hooks? - foreach ('install-exec', 'install-data', 'uninstall') - { - if (user_phony_rule "$_-hook") - { - depend ('.MAKE', "$_-am"); - register_action("$_-am", - ("\t\@\$(NORMAL_INSTALL)\n" - . "\t\$(MAKE) \$(AM_MAKEFLAGS) $_-hook")); - } - } - - # All the required targets are phony. - depend ('.PHONY', keys %required_targets); - - # Actually output gathered targets. - foreach (sort target_cmp keys %dependencies) - { - # If there is nothing about this guy, skip it. - next - unless (@{$dependencies{$_}} - || $actions{$_} - || $required_targets{$_}); - - # Define gathered targets in undefined conditions. - # FIXME: Right now we must handle .PHONY as an exception, - # because people write things like - # .PHONY: myphonytarget - # to append dependencies. This would not work if Automake - # refrained from defining its own .PHONY target as it does - # with other overridden targets. - # 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"; - } - } -} - - -sub handle_tests_dejagnu () -{ - push (@check_tests, 'check-DEJAGNU'); - $output_rules .= file_contents ('dejagnu', new Automake::Location); -} - -# handle_per_suffix_test ($TEST_SUFFIX, [%TRANSFORM]) -#---------------------------------------------------- -sub handle_per_suffix_test -{ - my ($test_suffix, %transform) = @_; - my ($pfx, $generic, $am_exeext); - if ($test_suffix eq '') - { - $pfx = ''; - $generic = 0; - $am_exeext = 'FALSE'; - } - else - { - prog_error ("test suffix '$test_suffix' lacks leading dot") - unless $test_suffix =~ m/^\.(.*)/; - $pfx = uc ($1) . '_'; - $generic = 1; - $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT' - : 'FALSE'; - } - # The "test driver" program, deputed to handle tests protocol used by - # test scripts. By default, it's assumed that no protocol is used, so - # we fall back to the old behaviour, implemented by the 'test-driver' - # auxiliary script. - if (! var "${pfx}LOG_DRIVER") - { - require_conf_file ("parallel-tests", FOREIGN, 'test-driver'); - define_variable ("${pfx}LOG_DRIVER", - "\$(SHELL) $am_config_aux_dir/test-driver", - INTERNAL); - } - my $driver = '$(' . $pfx . 'LOG_DRIVER)'; - my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)' - . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)'; - my $compile = "${pfx}LOG_COMPILE"; - define_variable ($compile, - '$(' . $pfx . 'LOG_COMPILER)' - . ' $(AM_' . $pfx . 'LOG_FLAGS)' - . ' $(' . $pfx . 'LOG_FLAGS)', - INTERNAL); - $output_rules .= file_contents ('check2', new Automake::Location, - GENERIC => $generic, - DRIVER => $driver, - DRIVER_FLAGS => $driver_flags, - COMPILE => '$(' . $compile . ')', - EXT => $test_suffix, - am__EXEEXT => $am_exeext, - %transform); -} - -# is_valid_test_extension ($EXT) -# ------------------------------ -# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false -# otherwise. -sub is_valid_test_extension -{ - my $ext = shift; - return 1 - if ($ext =~ /^\.[a-zA-Z_][a-zA-Z0-9_]*$/); - return 1 - if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT')); - return 0; -} - - -sub handle_tests () -{ - if (option 'dejagnu') - { - handle_tests_dejagnu; - } - else - { - foreach my $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS') - { - reject_var ($c, "'$c' defined but 'dejagnu' not in " - . "'AUTOMAKE_OPTIONS'"); - } - } - - if (var ('TESTS')) - { - push (@check_tests, 'check-TESTS'); - my $check_deps = "@check"; - $output_rules .= file_contents ('check', new Automake::Location, - SERIAL_TESTS => !! option 'serial-tests', - CHECK_DEPS => $check_deps); - - # Tests that are known programs should have $(EXEEXT) appended. - # For matching purposes, we need to adjust XFAIL_TESTS as well. - append_exeext { exists $known_programs{$_[0]} } 'TESTS'; - append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS' - if (var ('XFAIL_TESTS')); - - if (! option 'serial-tests') - { - define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL); - my $suff = '.test'; - my $at_exeext = ''; - my $handle_exeext = exists $configure_vars{'EXEEXT'}; - if ($handle_exeext) - { - $at_exeext = subst ('EXEEXT'); - $suff = $at_exeext . ' ' . $suff; - } - if (! var 'TEST_EXTENSIONS') - { - define_variable ('TEST_EXTENSIONS', $suff, INTERNAL); - } - my $var = var 'TEST_EXTENSIONS'; - # Currently, we are not able to deal with conditional contents - # in TEST_EXTENSIONS. - if ($var->has_conditional_contents) - { - msg_var 'unsupported', $var, - "'TEST_EXTENSIONS' cannot have conditional contents"; - } - my @test_suffixes = $var->value_as_list_recursive; - if ((my @invalid_test_suffixes = - grep { !is_valid_test_extension $_ } @test_suffixes) > 0) - { - error $var->rdef (TRUE)->location, - "invalid test extensions: @invalid_test_suffixes"; - } - @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes; - if ($handle_exeext) - { - unshift (@test_suffixes, $at_exeext) - unless $test_suffixes[0] eq $at_exeext; - } - unshift (@test_suffixes, ''); - - transform_variable_recursively - ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL, - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - my $obj = $val; - return $obj - if $val =~ /^\@.*\@$/; - $obj =~ s/\$\(EXEEXT\)$//o; - - if ($val =~ /(\$\((top_)?srcdir\))\//o) - { - msg ('error', $subvar->rdef ($cond)->location, - "using '$1' in TESTS is currently broken: '$val'"); - } - - foreach my $test_suffix (@test_suffixes) - { - next - if $test_suffix eq $at_exeext || $test_suffix eq ''; - return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log' - if substr ($obj, - length ($test_suffix)) eq $test_suffix; - } - my $base = $obj; - $obj .= '.log'; - handle_per_suffix_test ('', - OBJ => $obj, - BASE => $base, - SOURCE => $val); - return $obj; - }); - - my $nhelper=1; - my $prev = 'TESTS'; - my $post = ''; - my $last_suffix = $test_suffixes[$#test_suffixes]; - my $cur = ''; - foreach my $test_suffix (@test_suffixes) - { - if ($test_suffix eq $last_suffix) - { - $cur = 'TEST_LOGS'; - } - else - { - $cur = 'am__test_logs' . $nhelper; - } - define_variable ($cur, - '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL); - $post = '.log'; - $prev = $cur; - $nhelper++; - if ($test_suffix ne $at_exeext && $test_suffix ne '') - { - handle_per_suffix_test ($test_suffix, - OBJ => '', - BASE => '$*', - SOURCE => '$<'); - } - } - $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN; - } - } -} - -sub handle_emacs_lisp () -{ - my @elfiles = am_install_var ('-candist', 'lisp', 'LISP', - 'lisp', 'noinst'); - - return if ! @elfiles; - - define_pretty_variable ('am__ELFILES', TRUE, INTERNAL, - map { $_->[1] } @elfiles); - define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL, - '$(am__ELFILES:.el=.elc)'); - # This one can be overridden by users. - define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(LISP:.el=.elc)'); - - push @all, '$(ELCFILES)'; - - require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE, - 'EMACS', 'lispdir'); -} - -sub handle_python () -{ - my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON', - 'noinst'); - return if ! @pyfiles; - - require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON'); - require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile'); - define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL); -} - -sub handle_java () -{ - my @sourcelist = am_install_var ('-candist', - 'java', 'JAVA', - 'noinst', 'check'); - return if ! @sourcelist; - - my @prefixes = am_primary_prefixes ('JAVA', 1, - 'noinst', 'check'); - - my $dir; - my @java_sources = (); - foreach my $prefix (@prefixes) - { - (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//; - - next - if $curs eq 'EXTRA'; - - push @java_sources, '$(' . $prefix . '_JAVA' . ')'; - - if (defined $dir) - { - err_var "${curs}_JAVA", "multiple _JAVA primaries in use" - unless $curs eq $dir; - } - - $dir = $curs; - } - - define_pretty_variable ('am__java_sources', TRUE, INTERNAL, - "@java_sources"); - - if ($dir eq 'check') - { - push (@check, "class$dir.stamp"); - } - else - { - push (@all, "class$dir.stamp"); - } -} - - -sub handle_minor_options () -{ - if (option 'readme-alpha') - { - if ($relative_dir eq '.') - { - if ($package_version !~ /^$GNITS_VERSION_PATTERN$/) - { - msg ('error-gnits', $package_version_location, - "version '$package_version' doesn't follow " . - "Gnits standards"); - } - if (defined $1 && -f 'README-alpha') - { - # This means we have an alpha release. See - # GNITS_VERSION_PATTERN for details. - push_dist_common ('README-alpha'); - } - } - } -} - -################################################################ - -# ($OUTPUT, @INPUTS) -# split_config_file_spec ($SPEC) -# ------------------------------ -# Decode the Autoconf syntax for config files (files, headers, links -# etc.). -sub split_config_file_spec -{ - my ($spec) = @_; - my ($output, @inputs) = split (/:/, $spec); - - push @inputs, "$output.in" - unless @inputs; - - return ($output, @inputs); -} - -# $input -# locate_am (@POSSIBLE_SOURCES) -# ----------------------------- -# AC_CONFIG_FILES allow specifications such as Makefile:top.in:mid.in:bot.in -# This functions returns the first *.in file for which a *.am exists. -# It returns undef otherwise. -sub locate_am -{ - my (@rest) = @_; - my $input; - foreach my $file (@rest) - { - if (($file =~ /^(.*)\.in$/) && -f "$1.am") - { - $input = $file; - last; - } - } - return $input; -} - -my %make_list; - -# scan_autoconf_config_files ($WHERE, $CONFIG-FILES) -# -------------------------------------------------- -# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES -# (or AC_OUTPUT). -sub scan_autoconf_config_files -{ - my ($where, $config_files) = @_; - - # Look at potential Makefile.am's. - foreach (split ' ', $config_files) - { - # Must skip empty string for Perl 4. - next if $_ eq "\\" || $_ eq ''; - - # Handle $local:$input syntax. - my ($local, @rest) = split (/:/); - @rest = ("$local.in",) unless @rest; - # Keep in sync with test 'conffile-leading-dot.sh'. - msg ('unsupported', $where, - "omit leading './' from config file names such as '$local';" - . "\nremake rules might be subtly broken otherwise") - if ($local =~ /^\.\//); - my $input = locate_am @rest; - if ($input) - { - # We have a file that automake should generate. - $make_list{$input} = join (':', ($local, @rest)); - } - else - { - # We have a file that automake should cause to be - # rebuilt, but shouldn't generate itself. - push (@other_input_files, $_); - } - $ac_config_files_location{$local} = $where; - $ac_config_files_condition{$local} = - new Automake::Condition (@cond_stack) - if (@cond_stack); - } -} - - -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_FC_SRCEXT => 1, - AC_INIT => 0, - AC_LIBSOURCE => 1, - AC_REQUIRE_AUX_FILE => 1, - AC_SUBST_TRACE => 1, - AM_AUTOMAKE_VERSION => 1, - AM_PROG_MKDIR_P => 0, - AM_CONDITIONAL => 2, - AM_EXTRA_RECURSIVE_TARGETS => 1, - AM_GNU_GETTEXT => 0, - AM_GNU_GETTEXT_INTL_SUBDIR => 0, - AM_INIT_AUTOMAKE => 0, - AM_MAINTAINER_MODE => 0, - AM_PROG_AR => 0, - _AM_SUBST_NOTMAKE => 1, - _AM_COND_IF => 1, - _AM_COND_ELSE => 1, - _AM_COND_ENDIF => 1, - LT_SUPPORTED_TAG => 1, - _LT_AC_TAGCONFIG => 0, - m4_include => 1, - m4_sinclude => 1, - sinclude => 1, - ); - - 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::\$d::\$n::\${::}%' } - (keys %traced)); - - my $tracefh = new Automake::XFile ("$traces $filename |"); - verb "reading $traces"; - - @cond_stack = (); - my $where; - - while ($_ = $tracefh->getline) - { - chomp; - my ($here, $depth, @args) = split (/::/); - $where = new Automake::Location $here; - my $macro = $args[0]; - - prog_error ("unrequested trace '$macro'") - unless exists $traced{$macro}; - - # Skip and diagnose malformed calls. - if ($#args < $traced{$macro}) - { - msg ('syntax', $where, "not enough arguments for $macro"); - next; - } - - # Alphabetical ordering please. - if ($macro eq 'AC_CANONICAL_BUILD') - { - if ($seen_canonical <= AC_CANONICAL_BUILD) - { - $seen_canonical = AC_CANONICAL_BUILD; - } - } - elsif ($macro eq 'AC_CANONICAL_HOST') - { - if ($seen_canonical <= AC_CANONICAL_HOST) - { - $seen_canonical = AC_CANONICAL_HOST; - } - } - elsif ($macro eq 'AC_CANONICAL_TARGET') - { - $seen_canonical = AC_CANONICAL_TARGET; - } - 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; - check_directory ($config_aux_dir, $where); - } - elsif ($macro eq 'AC_CONFIG_FILES') - { - # Look at potential Makefile.am's. - scan_autoconf_config_files ($where, $args[1]); - } - elsif ($macro eq 'AC_CONFIG_HEADERS') - { - foreach my $spec (split (' ', $args[1])) - { - my ($dest, @src) = split (':', $spec); - $ac_config_files_location{$dest} = $where; - push @config_headers, $spec; - } - } - elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR') - { - $config_libobj_dir = $args[1]; - 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; - } - } - elsif ($macro eq 'AC_FC_SRCEXT') - { - my $suffix = $args[1]; - # These flags are used as %SOURCEFLAG% in depend2.am, - # where the trailing space is important. - $sourceflags{'.' . $suffix} = '$(FCFLAGS_' . $suffix . ') ' - if ($suffix eq 'f90' || $suffix eq 'f95' || $suffix eq 'f03' || $suffix eq 'f08'); - } - elsif ($macro eq 'AC_INIT') - { - if (defined $args[2]) - { - $package_version = $args[2]; - $package_version_location = $where; - } - } - elsif ($macro eq 'AC_LIBSOURCE') - { - $libsources{$args[1]} = $here; - } - elsif ($macro eq 'AC_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') - { - # Just check for alphanumeric in AC_SUBST_TRACE. If you do - # AC_SUBST(5), then too bad. - $configure_vars{$args[1]} = $where - if $args[1] =~ /^\w+$/; - } - elsif ($macro eq 'AM_AUTOMAKE_VERSION') - { - error ($where, - "version mismatch. This is Automake $VERSION,\n" . - "but the definition used by this AM_INIT_AUTOMAKE\n" . - "comes from Automake $args[1]. You should recreate\n" . - "aclocal.m4 with aclocal and run automake again.\n", - # $? = 63 is used to indicate version mismatch to missing. - exit_code => 63) - if $VERSION ne $args[1]; - - $seen_automake_version = 1; - } - elsif ($macro eq 'AM_PROG_MKDIR_P') - { - msg 'obsolete', $where, <<'EOF'; -The 'AM_PROG_MKDIR_P' macro is deprecated, and its use is discouraged. -You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead, -and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files. -EOF - } - elsif ($macro eq 'AM_CONDITIONAL') - { - $configure_cond{$args[1]} = $where; - } - elsif ($macro eq 'AM_EXTRA_RECURSIVE_TARGETS') - { - # Empty leading/trailing fields might be produced by split, - # hence the grep is really needed. - push @extra_recursive_targets, - grep (/./, (split /\s+/, $args[1])); - } - elsif ($macro eq 'AM_GNU_GETTEXT') - { - $seen_gettext = $where; - $ac_gettext_location = $where; - $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; - if (defined $args[2]) - { - msg 'obsolete', $where, <<'EOF'; -AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see: -http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation -EOF - $package_version = $args[2]; - $package_version_location = $where; - } - elsif (defined $args[1]) - { - my @opts = split (' ', $args[1]); - @opts = map { { option => $_, where => $where } } @opts; - exit $exit_code unless process_global_option_list (@opts); - } - } - elsif ($macro eq 'AM_MAINTAINER_MODE') - { - $seen_maint_mode = $where; - } - elsif ($macro eq 'AM_PROG_AR') - { - $seen_ar = $where; - } - elsif ($macro eq '_AM_COND_IF') - { - cond_stack_if ('', $args[1], $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - elsif ($macro eq '_AM_COND_ELSE') - { - cond_stack_else ('!', $args[1], $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - elsif ($macro eq '_AM_COND_ENDIF') - { - cond_stack_endif (undef, undef, $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - 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); - } - } - } - - error ($where, "condition stack not properly closed") - if (@cond_stack); - - $tracefh->close; -} - - -# Check whether we use 'configure.ac' or 'configure.in'. -# Scan it (and possibly 'aclocal.m4') for interesting things. -# We must scan aclocal.m4 because there might be AC_SUBSTs and such there. -sub scan_autoconf_files () -{ - # Reinitialize libsources here. This isn't really necessary, - # since we currently assume there is only one configure.ac. But - # that won't always be the case. - %libsources = (); - - # Keep track of the youngest configure dependency. - $configure_deps_greatest_timestamp = mtime $configure_ac; - if (-e 'aclocal.m4') - { - my $mtime = mtime 'aclocal.m4'; - $configure_deps_greatest_timestamp = $mtime - if $mtime > $configure_deps_greatest_timestamp; - } - - scan_autoconf_traces ($configure_ac); - - @configure_input_files = sort keys %make_list; - # Set input and output files if not specified by user. - if (! @input_files) - { - @input_files = @configure_input_files; - %output_files = %make_list; - } - - - if (! $seen_init_automake) - { - err_ac ("no proper invocation of AM_INIT_AUTOMAKE was found.\nYou " - . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE," - . "\nthat aclocal.m4 is present in the top-level directory,\n" - . "and that aclocal.m4 was recently regenerated " - . "(using aclocal)"); - } - else - { - if (! $seen_automake_version) - { - if (-f 'aclocal.m4') - { - error ($seen_init_automake, - "your implementation of AM_INIT_AUTOMAKE comes from " . - "an\nold Automake version. You should recreate " . - "aclocal.m4\nwith aclocal and run automake again", - # $? = 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"); - } - } - } - - locate_aux_dir (); - - # 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 - # push_required_file to work. - # Sort the files for stable verbose output. - $relative_dir = '.'; - foreach my $file (sort 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'; - - # Preserve dist_common for later. - $configure_dist_common = variable_value ('DIST_COMMON') || ''; - -} - -################################################################ - -# Do any extra checking for GNU standards. -sub check_gnu_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNU, - qw/INSTALL NEWS README AUTHORS ChangeLog/); - - # Accept one of these three licenses; default to COPYING. - # Make sure we do not overwrite an existing license. - my $license; - foreach (qw /COPYING COPYING.LIB COPYING.LESSER/) - { - if (-f $_) - { - $license = $_; - last; - } - } - require_file ("$am_file.am", GNU, 'COPYING') - unless $license; - } - - for my $opt ('no-installman', 'no-installinfo') - { - msg ('error-gnu', option $opt, - "option '$opt' disallowed by GNU standards") - if option $opt; - } -} - -# Do any extra checking for GNITS standards. -sub check_gnits_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNITS, 'THANKS'); - } -} - -################################################################ -# -# Functions to handle files of each language. - -# Each 'lang_X_rewrite($DIRECTORY, $BASE, $EXT)' function follows a -# simple formula: Return value is LANG_SUBDIR if the resulting object -# file should be in a subdir if the source file is, LANG_PROCESS if -# file is to be dealt with, LANG_IGNORE otherwise. - -# Much of the actual processing is handled in -# handle_single_transform. These functions exist so that -# auxiliary information can be recorded for a later cleanup pass. -# Note that the calls to these functions are computed, so don't bother -# searching for their precise names in the source. - -# This is just a convenience function that can be used to determine -# when a subdir object should be used. -sub lang_sub_obj () -{ - return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS; -} - -# Rewrite a single header file. -sub lang_header_rewrite -{ - # Header files are simply ignored. - return LANG_IGNORE; -} - -# Rewrite a single Vala source file. -sub lang_vala_rewrite -{ - my ($directory, $base, $ext) = @_; - - (my $newext = $ext) =~ s/vala$/c/; - return (LANG_SUBDIR, $newext); -} - -# Rewrite a single yacc/yacc++ file. -sub lang_yacc_rewrite -{ - my ($directory, $base, $ext) = @_; - - my $r = lang_sub_obj; - (my $newext = $ext) =~ tr/y/c/; - return ($r, $newext); -} -sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); }; - -# Rewrite a single lex/lex++ file. -sub lang_lex_rewrite -{ - my ($directory, $base, $ext) = @_; - - my $r = lang_sub_obj; - (my $newext = $ext) =~ tr/l/c/; - return ($r, $newext); -} -sub lang_lexxx_rewrite { lang_lex_rewrite (@_); }; - -# 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_vala_finish_target -{ - my ($self, $name) = @_; - - my $derived = canonicalize ($name); - my $var = var "${derived}_SOURCES"; - return unless $var; - - my @vala_sources = grep { /\.(vala|vapi)$/ } ($var->value_as_list_recursive); - - # For automake bug#11229. - return unless @vala_sources; - - foreach my $vala_file (@vala_sources) - { - my $c_file = $vala_file; - if ($c_file =~ s/(.*)\.vala$/$1.c/) - { - $c_file = "\$(srcdir)/$c_file"; - $output_rules .= "$c_file: \$(srcdir)/${derived}_vala.stamp\n" - . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n" - . "\t\@if test -f \$@; then :; else \\\n" - . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n" - . "\tfi\n"; - $clean_files{$c_file} = MAINTAINER_CLEAN; - } - } - - # Add rebuild rules for generated header and vapi files - my $flags = var ($derived . '_VALAFLAGS'); - if ($flags) - { - my $lastflag = ''; - foreach my $flag ($flags->value_as_list_recursive) - { - if (grep (/$lastflag/, ('-H', '-h', '--header', '--internal-header', - '--vapi', '--internal-vapi', '--gir'))) - { - my $headerfile = "\$(srcdir)/$flag"; - $output_rules .= "$headerfile: \$(srcdir)/${derived}_vala.stamp\n" - . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n" - . "\t\@if test -f \$@; then :; else \\\n" - . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n" - . "\tfi\n"; - - # valac is not used when building from dist tarballs - # distribute the generated files - push_dist_common ($headerfile); - $clean_files{$headerfile} = MAINTAINER_CLEAN; - } - $lastflag = $flag; - } - } - - my $compile = $self->compile; - - # Rewrite each occurrence of 'AM_VALAFLAGS' in the compile - # rule into '${derived}_VALAFLAGS' if it exists. - my $val = "${derived}_VALAFLAGS"; - $compile =~ s/\(AM_VALAFLAGS\)/\($val\)/ - if set_seen ($val); - - # VALAFLAGS is a user variable (per GNU Standards), - # it should not be overridden in the Makefile... - check_user_variables 'VALAFLAGS'; - - my $dirname = dirname ($name); - - # Only generate C code, do not run C compiler - $compile .= " -C"; - - my $verbose = verbose_flag ('VALAC'); - my $silent = silent_flag (); - my $stampfile = "\$(srcdir)/${derived}_vala.stamp"; - - $output_rules .= - "\$(srcdir)/${derived}_vala.stamp: @vala_sources\n". -# Since the C files generated from the vala sources depend on the -# ${derived}_vala.stamp file, we must ensure its timestamp is older than -# those of the C files generated by the valac invocation below (this is -# especially important on systems with sub-second timestamp resolution). -# Thus we need to create the stamp file *before* invoking valac, and to -# move it to its final location only after valac has been invoked. - "\t${silent}rm -f \$\@ && echo stamp > \$\@-t\n". - "\t${verbose}\$(am__cd) \$(srcdir) && $compile @vala_sources\n". - "\t${silent}mv -f \$\@-t \$\@\n"; - - push_dist_common ($stampfile); - - $clean_files{$stampfile} = MAINTAINER_CLEAN; -} - -# Add output rules to invoke valac and create stamp file as a witness -# to handle multiple outputs. This function is called after all source -# file processing is done. -sub lang_vala_finish () -{ - my ($self) = @_; - - foreach my $prog (keys %known_programs) - { - lang_vala_finish_target ($self, $prog); - } - - while (my ($name) = each %known_libraries) - { - lang_vala_finish_target ($self, $name); - } -} - -# The built .c files should be cleaned only on maintainer-clean -# as the .c files are distributed. This function is called for each -# .vala source file. -sub lang_vala_target_hook -{ - my ($self, $aggregate, $output, $input, %transform) = @_; - - $clean_files{$output} = MAINTAINER_CLEAN; -} - -# This is a yacc helper which is called whenever we have decided to -# compile a yacc file. -sub lang_yacc_target_hook -{ - my ($self, $aggregate, $output, $input, %transform) = @_; - - # If some relevant *YFLAGS variable contains the '-d' flag, we'll - # have to to generate special code. - my $yflags_contains_minus_d = 0; - - foreach my $pfx ("", "${aggregate}_") - { - my $yflagsvar = var ("${pfx}YFLAGS"); - next unless $yflagsvar; - # We cannot work reliably with conditionally-defined YFLAGS. - if ($yflagsvar->has_conditional_contents) - { - msg_var ('unsupported', $yflagsvar, - "'${pfx}YFLAGS' cannot have conditional contents"); - } - else - { - $yflags_contains_minus_d = 1 - if grep (/^-d$/, $yflagsvar->value_as_list_recursive); - } - } - - if ($yflags_contains_minus_d) - { - # 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. - - # The extension of the output file (e.g., '.c' or '.cxx'). - # We'll need it to compute the name of the generated header file. - (my $output_ext = basename ($output)) =~ s/.*(\.[^.]+)$/$1/; - - # We know that a yacc input should be turned into either a C or - # C++ output file. We depend on this fact (here and in yacc.am), - # so check that it really holds. - my $lang = $languages{$extension_map{$output_ext}}; - prog_error "invalid output name '$output' for yacc file '$input'" - if (!$lang || ($lang->name ne 'c' && $lang->name ne 'cxx')); - - (my $header_ext = $output_ext) =~ s/c/h/g; - # Quote $output_ext in the regexp, so that dots in it are taken - # as literal dots, not as metacharacters. - (my $header = $output) =~ s/\Q$output_ext\E$/$header_ext/; - - 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 rm -f $output; else :; fi\n" - . "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; 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'}; - - # The GNU rules say that yacc/lex output files should be removed - # by maintainer-clean. However, if the files are not distributed, - # then we want to remove them with "make clean"; otherwise, - # "make distcheck" will fail. - $clean_files{$header} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN; - } - # See the comment above for $HEADER. - $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : 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, %transform) = @_; - # The GNU rules say that yacc/lex output files should be removed - # by maintainer-clean. However, if the files are not distributed, - # then we want to remove them with "make clean"; otherwise, - # "make distcheck" will fail. - $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : 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; - - # FIXME: for now, no line number. - require_conf_file ($configure_ac, FOREIGN, 'ylwrap'); - define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL); -} - -sub lang_yacc_finish () -{ - return if defined $language_scratch{'yacc-done'}; - $language_scratch{'yacc-done'} = 1; - - reject_var 'YACCFLAGS', "'YACCFLAGS' obsolete; use 'YFLAGS' instead"; - - yacc_lex_finish_helper; -} - - -sub lang_lex_finish () -{ - return if defined $language_scratch{'lex-done'}; - $language_scratch{'lex-done'} = 1; - - yacc_lex_finish_helper; -} - - -# 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 OBJCXXLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK)) - { - return $l if defined $linkers{$l}; - } - return 'LINK'; -} - -# Called to indicate that an extension was used. -sub saw_extension -{ - my ($ext) = @_; - $extension_seen{$ext} = 1; -} - -# register_language (%ATTRIBUTE) -# ------------------------------ -# Register a single language. -# Each %ATTRIBUTE is of the form ATTRIBUTE => VALUE. -sub register_language -{ - my (%option) = @_; - - # Set the defaults. - $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'}; - $option{'nodist_specific'} = 0 - unless defined $option{'nodist_specific'}; - - my $lang = new Automake::Language (%option); - - # Fill indexes. - $extension_map{$_} = $lang->name foreach @{$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}); - - # Update the suffix rules map. - foreach my $suffix (@{$lang->extensions}) - { - foreach my $dest ($lang->output_extensions->($suffix)) - { - register_suffix_rule (INTERNAL, $suffix, $dest); - } - } -} - -# derive_suffix ($EXT, $OBJ) -# -------------------------- -# This function is used to find a path from a user-specified suffix $EXT -# to $OBJ or to some other suffix we recognize internally, e.g. 'cc'. -sub derive_suffix -{ - my ($source_ext, $obj) = @_; - - while (!$extension_map{$source_ext} && $source_ext ne $obj) - { - my $new_source_ext = next_in_suffix_chain ($source_ext, $obj); - last if not defined $new_source_ext; - $source_ext = $new_source_ext; - } - - return $source_ext; -} - - -# Pretty-print something and append to '$output_rules'. -sub pretty_print_rule -{ - $output_rules .= makefile_wrap (shift, shift, @_); -} - - -################################################################ - - -## -------------------------------- ## -## Handling the conditional stack. ## -## -------------------------------- ## - - -# $STRING -# make_conditional_string ($NEGATE, $COND) -# ---------------------------------------- -sub make_conditional_string -{ - my ($negate, $cond) = @_; - $cond = "${cond}_TRUE" - unless $cond =~ /^TRUE|FALSE$/; - $cond = Automake::Condition::conditional_negate ($cond) - if $negate; - return $cond; -} - - -my %_am_macro_for_cond = - ( - AMDEP => "one of the compiler tests\n" - . " AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,\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__fastdepOBJCXX => 'AC_PROG_OBJCXX', - am__fastdepUPC => 'AM_PROG_UPC' - ); - -# $COND -# cond_stack_if ($NEGATE, $COND, $WHERE) -# -------------------------------------- -sub cond_stack_if -{ - my ($negate, $cond, $where) = @_; - - if (! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/) - { - 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; - } - error $where, $text, uniq_scope => $scope; - } - - push (@cond_stack, make_conditional_string ($negate, $cond)); - - return new Automake::Condition (@cond_stack); -} - - -# $COND -# cond_stack_else ($NEGATE, $COND, $WHERE) -# ---------------------------------------- -sub cond_stack_else -{ - my ($negate, $cond, $where) = @_; - - if (! @cond_stack) - { - error $where, "else without if"; - return FALSE; - } - - $cond_stack[$#cond_stack] = - Automake::Condition::conditional_negate ($cond_stack[$#cond_stack]); - - # If $COND is given, check against it. - if (defined $cond) - { - $cond = make_conditional_string ($negate, $cond); - - error ($where, "else reminder ($negate$cond) incompatible with " - . "current conditional: $cond_stack[$#cond_stack]") - if $cond_stack[$#cond_stack] ne $cond; - } - - return new Automake::Condition (@cond_stack); -} - - -# $COND -# cond_stack_endif ($NEGATE, $COND, $WHERE) -# ----------------------------------------- -sub cond_stack_endif -{ - my ($negate, $cond, $where) = @_; - my $old_cond; - - if (! @cond_stack) - { - error $where, "endif without if"; - return TRUE; - } - - # If $COND is given, check against it. - if (defined $cond) - { - $cond = make_conditional_string ($negate, $cond); - - error ($where, "endif reminder ($negate$cond) incompatible with " - . "current conditional: $cond_stack[$#cond_stack]") - if $cond_stack[$#cond_stack] ne $cond; - } - - pop @cond_stack; - - return new Automake::Condition (@cond_stack); -} - - - - - -## ------------------------ ## -## Handling the variables. ## -## ------------------------ ## - - -# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE) -# ---------------------------------------------------- -# Like define_variable, but the value is a list, and the variable may -# be defined conditionally. The second argument is the condition -# under which the value should be defined; this should be the empty -# string to define the variable unconditionally. The third argument -# is a list holding the values to use for the variable. The value is -# pretty printed in the output file. -sub define_pretty_variable -{ - my ($var, $cond, $where, @value) = @_; - - if (! vardef ($var, $cond)) - { - Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value", - '', $where, VAR_PRETTY); - rvar ($var)->rdef ($cond)->set_seen; - } -} - - -# define_variable ($VAR, $VALUE, $WHERE) -# -------------------------------------- -# Define a new 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 ($\@$$) -{ - my ($var, $basename, $extension, $where) = @_; - define_variable ($var, - join (' ', map { "$_.$extension" } @$basename), - $where); -} - - -# Like define_variable, but define a variable to be the configure -# substitution by the same name. -sub define_configure_variable -{ - my ($var) = @_; - # 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 `\`. - my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS; - Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var), - '', $configure_vars{$var}, $pretty); -} - - -# define_compiler_variable ($LANG) -# -------------------------------- -# Define a compiler variable. We also handle defining the 'LT' -# version of the command when using libtool. -sub define_compiler_variable -{ - my ($lang) = @_; - - my ($var, $value) = ($lang->compiler, $lang->compile); - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; - define_variable ($var, $value, INTERNAL); - if (var ('LIBTOOL')) - { - my $verbose = define_verbose_libtool (); - define_variable ("LT$var", - "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)" - . " \$(LIBTOOLFLAGS) --mode=compile $value", - INTERNAL); - } - define_verbose_tagvar ($lang->ccer || 'GEN'); -} - - -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}; - # CCLD = $(CC). - define_variable ($lang->lder, $lang->ld, INTERNAL); - # CCLINK = $(CCLD) blah blah... - my $link = ''; - if (var ('LIBTOOL')) - { - my $verbose = define_verbose_libtool (); - $link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) " - . "\$(LIBTOOLFLAGS) --mode=link "; - } - define_variable ($lang->linker, $link . $lang->link, INTERNAL); - define_variable ($lang->compiler, $lang, INTERNAL); - define_verbose_tagvar ($lang->lder || 'GEN'); -} - -sub define_per_target_linker_variable -{ - my ($linker, $target) = @_; - - # If the user wrote a custom link command, we don't define ours. - return "${target}_LINK" - if set_seen "${target}_LINK"; - - my $xlink = $linker ? $linker : 'LINK'; - - my $lang = $link_languages{$xlink}; - prog_error "Unknown language for linker variable '$xlink'" - unless $lang; - - my $link_command = $lang->link; - if (var 'LIBTOOL') - { - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; - - my $verbose = define_verbose_libtool (); - $link_command = - "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) " - . "--mode=link " . $link_command; - } - - # 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) - { - my $val = "${target}_$flag"; - $link_command =~ s/\(AM_$flag\)/\($val\)/ - if set_seen ($val); - } - - # If the computed command is the same as the generic command, use - # the command linker variable. - return ($lang->linker, $lang->lder) - if $link_command eq $orig_command; - - define_variable ("${target}_LINK", $link_command, INTERNAL); - return ("${target}_LINK", $lang->lder); -} - -################################################################ - -# check_trailing_slash ($WHERE, $LINE) -# ------------------------------------ -# Return 1 iff $LINE ends with a slash. -# Might modify $LINE. -sub check_trailing_slash ($\$) -{ - my ($where, $line) = @_; - - # Ignore '##' lines. - return 0 if $$line =~ /$IGNORE_PATTERN/o; - - # Catch and fix a common error. - msg "syntax", $where, "whitespace following trailing backslash" - if $$line =~ s/\\\s+\n$/\\\n/; - - return $$line =~ /\\$/; -} - - -# read_am_file ($AMFILE, $WHERE, $RELDIR) -# --------------------------------------- -# Read Makefile.am and set up %contents. Simultaneously copy lines -# from Makefile.am into $output_trailer, or define variables as -# appropriate. NOTE we put rules in the trailer section. We want -# user rules to come after our generated stuff. -sub read_am_file -{ - my ($amfile, $where, $reldir) = @_; - my $canon_reldir = &canonicalize ($reldir); - - my $am_file = new Automake::XFile ("< $amfile"); - verb "reading $amfile"; - - # Keep track of the youngest output dependency. - my $mtime = mtime $amfile; - $output_deps_greatest_timestamp = $mtime - if $mtime > $output_deps_greatest_timestamp; - - my $spacing = ''; - my $comment = ''; - my $blank = 0; - my $saw_bk = 0; - my $var_look = VAR_ASIS; - - use constant IN_VAR_DEF => 0; - use constant IN_RULE_DEF => 1; - use constant IN_COMMENT => 2; - my $prev_state = IN_RULE_DEF; - - while ($_ = $am_file->getline) - { - $where->set ("$amfile:$."); - if (/$IGNORE_PATTERN/o) - { - # Merely delete comments beginning with two hashes. - } - elsif (/$WHITE_PATTERN/o) - { - error $where, "blank line following trailing backslash" - if $saw_bk; - # Stick a single white line before the incoming macro or rule. - $spacing = "\n"; - $blank = 1; - # Flush all comments seen so far. - if ($comment ne '') - { - $output_vars .= $comment; - $comment = ''; - } - } - elsif (/$COMMENT_PATTERN/o) - { - # Stick comments before the incoming macro or rule. Make - # sure a blank line precedes the first block of comments. - $spacing = "\n" unless $blank; - $blank = 1; - $comment .= $spacing . $_; - $spacing = ''; - $prev_state = IN_COMMENT; - } - else - { - last; - } - $saw_bk = check_trailing_slash ($where, $_); - } - - # We save the conditional stack on entry, and then check to make - # sure it is the same on exit. This lets us conditionally include - # other files. - my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); - - my $last_var_name = ''; - my $last_var_type = ''; - my $last_var_value = ''; - my $last_where; - # FIXME: shouldn't use $_ in this loop; it is too big. - while ($_) - { - $where->set ("$amfile:$."); - - # Make sure the line is \n-terminated. - chomp; - $_ .= "\n"; - - # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be - # used by users. @MAINT@ is an anachronism now. - $_ =~ s/\@MAINT\@//g - unless $seen_maint_mode; - - my $new_saw_bk = check_trailing_slash ($where, $_); - - if ($reldir eq '.') - { - # If present, eat the following '_' or '/', converting - # "%reldir%/foo" and "%canon_reldir%_foo" into plain "foo" - # when $reldir is '.'. - $_ =~ s,%(D|reldir)%/,,g; - $_ =~ s,%(C|canon_reldir)%_,,g; - } - $_ =~ s/%(D|reldir)%/${reldir}/g; - $_ =~ s/%(C|canon_reldir)%/${canon_reldir}/g; - - 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" - if $saw_bk; - } - elsif (/$COMMENT_PATTERN/o) - { - error $where, "comment following trailing backslash" - if $saw_bk && $prev_state != IN_COMMENT; - - # Stick comments before the incoming macro or rule. - $comment .= $spacing . $_; - $spacing = ''; - $prev_state = IN_COMMENT; - } - elsif ($saw_bk) - { - if ($prev_state == IN_RULE_DEF) - { - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - } - elsif ($prev_state == IN_COMMENT) - { - # If the line doesn't start with a '#', add it. - # We do this because a continued comment like - # # A = foo \ - # bar \ - # baz - # is not portable. BSD make doesn't honor - # escaped newlines in comments. - s/^#?/#/; - $comment .= $spacing . $_; - } - else # $prev_state == IN_VAR_DEF - { - $last_var_value .= ' ' - unless $last_var_value =~ /\s$/; - $last_var_value .= $_; - - if (!/\\$/) - { - Automake::Variable::define ($last_var_name, VAR_MAKEFILE, - $last_var_type, $cond, - $last_var_value, $comment, - $last_where, VAR_ASIS) - if $cond != FALSE; - $comment = $spacing = ''; - } - } - } - - elsif (/$IF_PATTERN/o) - { - $cond = cond_stack_if ($1, $2, $where); - } - elsif (/$ELSE_PATTERN/o) - { - $cond = cond_stack_else ($1, $2, $where); - } - elsif (/$ENDIF_PATTERN/o) - { - $cond = cond_stack_endif ($1, $2, $where); - } - - elsif (/$RULE_PATTERN/o) - { - # Found a rule. - $prev_state = IN_RULE_DEF; - - # For now we have to output all definitions of user rules - # and can't diagnose duplicates (see the comment in - # Automake::Rule::define). So we go on and ignore the return value. - Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where); - - check_variable_expansions ($_, $where); - - $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - $comment = $spacing = ''; - } - elsif (/$ASSIGNMENT_PATTERN/o) - { - # Found a macro definition. - $prev_state = IN_VAR_DEF; - $last_var_name = $1; - $last_var_type = $2; - $last_var_value = $3; - $last_where = $where->clone; - if ($3 ne '' && substr ($3, -1) eq "\\") - { - # We preserve the '\' because otherwise the long lines - # that are generated will be truncated by broken - # 'sed's. - $last_var_value = $3 . "\n"; - } - # Normally we try to output variable definitions in the - # same format they were input. However, POSIX compliant - # systems are not required to support lines longer than - # 2048 bytes (most notably, some sed implementation are - # limited to 4000 bytes, and sed is used by config.status - # to rewrite Makefile.in into Makefile). Moreover nobody - # would really write such long lines by hand since it is - # hardly maintainable. So if a line is longer that 1000 - # bytes (an arbitrary limit), assume it has been - # automatically generated by some tools, and flatten the - # variable definition. Otherwise, keep the variable as it - # as been input. - $var_look = VAR_PRETTY if length ($last_var_value) >= 1000; - - if (!/\\$/) - { - Automake::Variable::define ($last_var_name, VAR_MAKEFILE, - $last_var_type, $cond, - $last_var_value, $comment, - $last_where, $var_look) - if $cond != FALSE; - $comment = $spacing = ''; - $var_look = VAR_ASIS; - } - } - elsif (/$INCLUDE_PATTERN/o) - { - my $path = $1; - - if ($path =~ s/^\$\(top_srcdir\)\///) - { - push (@include_stack, "\$\(top_srcdir\)/$path"); - # Distribute any included file. - - # Always use the $(top_srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included - # file in the build tree during "make distdir" to satisfy - # the dependency. - # (subdir-am-cond.sh and subdir-ac-cond.sh will fail) - push_dist_common ("\$\(top_srcdir\)/$path"); - } - else - { - $path =~ s/\$\(srcdir\)\///; - push (@include_stack, "\$\(srcdir\)/$path"); - # Always use the $(srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included - # file in the build tree during "make distdir" to satisfy - # the dependency. - # (subdir-am-cond.sh and subdir-ac-cond.sh will fail) - push_dist_common ("\$\(srcdir\)/$path"); - $path = $relative_dir . "/" . $path if $relative_dir ne '.'; - } - my $new_reldir = File::Spec->abs2rel ($path, $relative_dir); - $new_reldir = '.' if $new_reldir !~ s,/[^/]*$,,; - $where->push_context ("'$path' included from here"); - read_am_file ($path, $where, $new_reldir); - $where->pop_context; - } - else - { - # This isn't an error; it is probably a continued rule. - # In fact, this is what we assume. - $prev_state = IN_RULE_DEF; - check_variable_expansions ($_, $where); - $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - $comment = $spacing = ''; - error $where, "'#' comment at start of rule is unportable" - if $_ =~ /^\t\s*\#/; - } - - $saw_bk = $new_saw_bk; - $_ = $am_file->getline; - } - - $output_trailer .= $comment; - - error ($where, "trailing backslash on last line") - if $saw_bk; - - error ($where, (@cond_stack ? "unterminated conditionals: @cond_stack" - : "too many conditionals closed in include file")) - if "@saved_cond_stack" ne "@cond_stack"; -} - - -# A helper for read_main_am_file which initializes configure variables -# and variables from header-vars.am. -sub define_standard_variables () -{ - my $saved_output_vars = $output_vars; - my ($comments, undef, $rules) = - file_contents_internal (1, "$libdir/am/header-vars.am", - new Automake::Location); - - foreach my $var (sort keys %configure_vars) - { - define_configure_variable ($var); - } - - $output_vars .= $comments . $rules; -} - - -# read_main_am_file ($MAKEFILE_AM, $MAKEFILE_IN) -# ---------------------------------------------- -sub read_main_am_file -{ - my ($amfile, $infile) = @_; - - # This supports the strange variable tricks we are about to play. - prog_error ("variable defined before read_main_am_file\n" . variables_dump ()) - if (scalar (variables) > 0); - - # Generate copyright header for generated Makefile.in. - # We do discard the output of predefined variables, handled below. - $output_vars = ("# " . basename ($infile) . " generated by automake " - . $VERSION . " from " . basename ($amfile) . ".\n"); - $output_vars .= '# ' . subst ('configure_input') . "\n"; - $output_vars .= $gen_copyright; - - # We want to predefine as many variables as possible. This lets - # the user set them with '+=' in Makefile.am. - define_standard_variables; - - # Read user file, which might override some of our values. - read_am_file ($amfile, new Automake::Location, '.'); -} - - - -################################################################ - -# $STRING -# flatten ($ORIGINAL_STRING) -# -------------------------- -sub flatten -{ - $_ = shift; - - s/\\\n//somg; - s/\s+/ /g; - s/^ //; - s/ $//; - - return $_; -} - - -# transform_token ($TOKEN, \%PAIRS, $KEY) -# --------------------------------------- -# Return the value associated to $KEY in %PAIRS, as used on $TOKEN -# (which should be ?KEY? or any of the special %% requests).. -sub transform_token ($\%$) -{ - my ($token, $transform, $key) = @_; - my $res = $transform->{$key}; - prog_error "Unknown key '$key' in '$token'" unless defined $res; - return $res; -} - - -# transform ($TOKEN, \%PAIRS) -# --------------------------- -# If ($TOKEN, $VAL) is in %PAIRS: -# - replaces %KEY% with $VAL, -# - enables/disables ?KEY? and ?!KEY?, -# - replaces %?KEY% with TRUE or FALSE. -sub transform ($\%) -{ - my ($token, $transform) = @_; - - # %KEY%. - # Must be before the following pattern to exclude the case - # when there is neither IFTRUE nor IFFALSE. - if ($token =~ /^%([\w\-]+)%$/) - { - return transform_token ($token, %$transform, $1); - } - # %?KEY%. - elsif ($token =~ /^%\?([\w\-]+)%$/) - { - return transform_token ($token, %$transform, $1) ? 'TRUE' : 'FALSE'; - } - # ?KEY? and ?!KEY?. - elsif ($token =~ /^ \? (!?) ([\w\-]+) \? $/x) - { - my $neg = ($1 eq '!') ? 1 : 0; - my $val = transform_token ($token, %$transform, $2); - return (!!$val == $neg) ? '##%' : ''; - } - else - { - prog_error "Unknown request format: $token"; - } -} - -# $TEXT -# preprocess_file ($MAKEFILE, [%TRANSFORM]) -# ----------------------------------------- -# Load a $MAKEFILE, apply the %TRANSFORM, and return the result. -# No extra parsing or post-processing is done (i.e., recognition of -# rules declaration or of make variables definitions). -sub preprocess_file -{ - my ($file, %transform) = @_; - - # Complete %transform with global options. - # Note that %transform goes last, so it overrides global options. - %transform = ( 'MAINTAINER-MODE' - => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '', - - 'XZ' => !! option 'dist-xz', - 'LZIP' => !! option 'dist-lzip', - '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, - %transform); - - if (! defined ($_ = $am_file_cache{$file})) - { - 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; - # Remember the contents of the just-read file. - $am_file_cache{$file} = $_; - } - - # Substitute Automake template tokens. - s/(?: % \?? [\w\-]+ % - | \? !? [\w\-]+ \? - )/transform($&, %transform)/gex; - # 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; - - 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) = @_; - $transform{FIRST} = !$transformed_files{$file}; - $transformed_files{$file} = 1; - - my @lines = split /(?set ($file); - - my $result_vars = ''; - my $result_rules = ''; - my $comment = ''; - my $spacing = ''; - - # The following flags are used to track rules spanning across - # multiple paragraphs. - my $is_rule = 0; # 1 if we are processing a rule. - my $discard_rule = 0; # 1 if the current rule should not be output. - - # We save the conditional stack on entry, and then check to make - # sure it is the same on exit. This lets us conditionally include - # other files. - my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); - - foreach (make_paragraphs ($file, %transform)) - { - # FIXME: no line number available. - $where->set ($file); - - # Sanity checks. - error $where, "blank line following trailing backslash:\n$_" - if /\\$/; - error $where, "comment following trailing backslash:\n$_" - if /\\#/; - - if (/^$/) - { - $is_rule = 0; - # Stick empty line before the incoming macro or rule. - $spacing = "\n"; - } - elsif (/$COMMENT_PATTERN/mso) - { - $is_rule = 0; - # Stick comments before the incoming macro or rule. - $comment = "$_\n"; - } - - # Handle inclusion of other files. - elsif (/$INCLUDE_PATTERN/o) - { - if ($cond != FALSE) - { - my $file = ($is_am ? "$libdir/am/" : '') . $1; - $where->push_context ("'$file' included from here"); - # N-ary '.=' fails. - my ($com, $vars, $rules) - = file_contents_internal ($is_am, $file, $where, %transform); - $where->pop_context; - $comment .= $com; - $result_vars .= $vars; - $result_rules .= $rules; - } - } - - # Handling the conditionals. - elsif (/$IF_PATTERN/o) - { - $cond = cond_stack_if ($1, $2, $file); - } - elsif (/$ELSE_PATTERN/o) - { - $cond = cond_stack_else ($1, $2, $file); - } - elsif (/$ENDIF_PATTERN/o) - { - $cond = cond_stack_endif ($1, $2, $file); - } - - # Handling rules. - elsif (/$RULE_PATTERN/mso) - { - $is_rule = 1; - $discard_rule = 0; - # Separate relationship from optional actions: the first - # `new-line tab" not preceded by backslash (continuation - # line). - my $paragraph = $_; - /^(.*?)(?:(?subst_string/gme; - $result_rules .= "$spacing$comment$condparagraph\n"; - } - if (scalar @undefined_conds == 0) - { - # Remember to discard next paragraphs - # if they belong to this rule. - # (but see also FIXME: #2 above.) - $discard_rule = 1; - } - $comment = $spacing = ''; - last; - } - } - } - - elsif (/$ASSIGNMENT_PATTERN/mso) - { - my ($var, $type, $val) = ($1, $2, $3); - error $where, "variable '$var' with trailing backslash" - if /\\$/; - - $is_rule = 0; - - Automake::Variable::define ($var, - $is_am ? VAR_AUTOMAKE : VAR_MAKEFILE, - $type, $cond, $val, $comment, $where, - VAR_ASIS) - if $cond != FALSE; - - $comment = $spacing = ''; - } - else - { - # This isn't an error; it is probably some tokens which - # configure is supposed to replace, such as '@SET-MAKE@', - # or some part of a rule cut by an if/endif. - if (! $cond->false && ! ($is_rule && $discard_rule)) - { - s/^/$cond->subst_string/gme; - $result_rules .= "$spacing$comment$_\n"; - } - $comment = $spacing = ''; - } - } - - error ($where, @cond_stack ? - "unterminated conditionals: @cond_stack" : - "too many conditionals closed in include file") - if "@saved_cond_stack" ne "@cond_stack"; - - return ($comment, $result_vars, $result_rules); -} - - -# $CONTENTS -# file_contents ($BASENAME, $WHERE, [%TRANSFORM]) -# ----------------------------------------------- -# Return contents of a file from $libdir/am, automatically skipping -# macros or rules which are already known. -sub file_contents -{ - my ($basename, $where, %transform) = @_; - my ($comments, $variables, $rules) = - file_contents_internal (1, "$libdir/am/$basename.am", $where, - %transform); - return "$comments$variables$rules"; -} - - -# @PREFIX -# am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES) -# ---------------------------------------------------- -# Find all variable prefixes that are used for install directories. A -# prefix 'zar' qualifies iff: -# -# * 'zardir' is a variable. -# * 'zar_PRIMARY' is a variable. -# -# As a side effect, it looks for misspellings. It is an error to have -# a variable ending in a "reserved" suffix whose prefix is unknown, e.g. -# "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 -# need it. -sub am_primary_prefixes -{ - my ($primary, $can_dist, @prefixes) = @_; - - local $_; - my %valid = map { $_ => 0 } @prefixes; - $valid{'EXTRA'} = 0; - foreach my $var (variables $primary) - { - # Automake is allowed to define variables that look like primaries - # but which aren't. E.g. INSTALL_sh_DATA. - # Autoconf can also define variables like INSTALL_DATA, so - # ignore all configure variables (at least those which are not - # redefined in Makefile.am). - # FIXME: We should make sure that these variables are not - # conditionally defined (or else adjust the condition below). - my $def = $var->def (TRUE); - next if $def && $def->owner != VAR_MAKEFILE; - - my $varname = $var->name; - - if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_[[:alnum:]]+$/) - { - my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || ''); - if ($dist ne '' && ! $can_dist) - { - err_var ($var, - "invalid variable '$varname': 'dist' is forbidden"); - } - # Standard directories must be explicitly allowed. - elsif (! defined $valid{$X} && exists $standard_prefix{$X}) - { - err_var ($var, - "'${X}dir' is not a legitimate directory " . - "for '$primary'"); - } - # A not explicitly valid directory is allowed if Xdir is defined. - elsif (! defined $valid{$X} && - $var->requires_variables ("'$varname' is used", "${X}dir")) - { - # Nothing to do. Any error message has been output - # by $var->requires_variables. - } - else - { - # Ensure all extended prefixes are actually used. - $valid{"$base$dist$X"} = 1; - } - } - else - { - prog_error "unexpected variable name: $varname"; - } - } - - # Return only those which are actually defined. - return sort grep { var ($_ . '_' . $primary) } keys %valid; -} - - -# am_install_var (-OPTION..., file, HOW, where...) -# ------------------------------------------------ -# -# Handle 'where_HOW' variable magic. Does all lookups, generates -# install code, and possibly generates code to define the primary -# variable. The first argument is the name of the .am file to munge, -# the second argument is the primary variable (e.g. HEADERS), and all -# subsequent arguments are possible installation locations. -# -# Returns list of [$location, $value] pairs, where -# $value's are the values in all where_HOW variable, and $location -# there associated location (the place here their parent variables were -# defined). -# -# FIXME: this should be rewritten to be cleaner. It should be broken -# up into multiple functions. -# -sub am_install_var -{ - my (@args) = @_; - - my $do_require = 1; - my $can_dist = 0; - my $default_dist = 0; - while (@args) - { - if ($args[0] eq '-noextra') - { - $do_require = 0; - } - elsif ($args[0] eq '-candist') - { - $can_dist = 1; - } - elsif ($args[0] eq '-defaultdist') - { - $default_dist = 1; - $can_dist = 1; - } - elsif ($args[0] !~ /^-/) - { - last; - } - shift (@args); - } - - my ($file, $primary, @prefix) = @args; - - # Now that configure substitutions are allowed in where_HOW - # variables, it is an error to actually define the primary. We - # allow 'JAVA', as it is customarily used to mean the Java - # interpreter. This is but one of several Java hacks. Similarly, - # 'PYTHON' is customarily used to mean the Python interpreter. - reject_var $primary, "'$primary' is an anachronism" - unless $primary eq 'JAVA' || $primary eq 'PYTHON'; - - # Get the prefixes which are valid and actually used. - @prefix = am_primary_prefixes ($primary, $can_dist, @prefix); - - # If a primary includes a configure substitution, then the EXTRA_ - # form is required. Otherwise we can't properly do our job. - my $require_extra; - - my @used = (); - my @result = (); - - foreach my $X (@prefix) - { - my $nodir_name = $X; - my $one_name = $X . '_' . $primary; - my $one_var = var $one_name; - - my $strip_subdir = 1; - # If subdir prefix should be preserved, do so. - if ($nodir_name =~ /^nobase_/) - { - $strip_subdir = 0; - $nodir_name =~ s/^nobase_//; - } - - # If files should be distributed, do so. - my $dist_p = 0; - if ($can_dist) - { - $dist_p = (($default_dist && $nodir_name !~ /^nodist_/) - || (! $default_dist && $nodir_name =~ /^dist_/)); - $nodir_name =~ s/^(dist|nodist)_//; - } - - - # Use the location of the currently processed variable. - # We are not processing a particular condition, so pick the first - # available. - my $tmpcond = $one_var->conditions->one_cond; - my $where = $one_var->rdef ($tmpcond)->location->clone; - - # Append actual contents of where_PRIMARY variable to - # @result, skipping @substitutions@. - foreach my $locvals ($one_var->value_as_list_recursive (location => 1)) - { - my ($loc, $value) = @$locvals; - # Skip configure substitutions. - if ($value =~ /^\@.*\@$/) - { - if ($nodir_name eq 'EXTRA') - { - error ($where, - "'$one_name' contains configure substitution, " - . "but shouldn't"); - } - # Check here to make sure variables defined in - # configure.ac do not imply that EXTRA_PRIMARY - # must be defined. - elsif (! defined $configure_vars{$one_name}) - { - $require_extra = $one_name - if $do_require; - } - } - else - { - # 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. - # Do it here rather than in handle_programs so the - # uniquifying at the end of this function works. - ${$locvals}[1] =~ s/\$\(EXEEXT\)$// - if $primary eq 'PROGRAMS'; - - 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'; - - if ($nodir_name eq 'check') - { - push (@check, '$(' . $one_name . ')'); - } - else - { - push (@used, '$(' . $one_name . ')'); - } - - # Is this to be installed? - my $install_p = $nodir_name ne 'noinst' && $nodir_name ne 'check'; - - # If so, with install-exec? (or install-data?). - my $exec_p = ($nodir_name =~ /$EXEC_DIR_PATTERN/o); - - my $check_options_p = $install_p && !! option 'std-options'; - - # Use the location of the currently processed variable as context. - $where->push_context ("while processing '$one_name'"); - - # The variable containing all files to distribute. - my $distvar = "\$($one_name)"; - $distvar = shadow_unconditionally ($one_name, $where) - if ($dist_p && $one_var->has_conditional_contents); - - # Singular form of $PRIMARY. - (my $one_primary = $primary) =~ s/S$//; - $output_rules .= file_contents ($file, $where, - PRIMARY => $primary, - ONE_PRIMARY => $one_primary, - DIR => $X, - NDIR => $nodir_name, - BASE => $strip_subdir, - EXEC => $exec_p, - INSTALL => $install_p, - DIST => $dist_p, - DISTVAR => $distvar, - 'CK-OPTS' => $check_options_p); - } - - # The JAVA variable is used as the name of the Java interpreter. - # The PYTHON variable is used as the name of the Python interpreter. - if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON') - { - # Define it. - define_pretty_variable ($primary, TRUE, INTERNAL, @used); - $output_vars .= "\n"; - } - - err_var ($require_extra, - "'$require_extra' contains configure substitution,\n" - . "but 'EXTRA_$primary' not defined") - if ($require_extra && ! var ('EXTRA_' . $primary)); - - # Push here because PRIMARY might be configure time determined. - push (@all, '$(' . $primary . ')') - if @used && $primary ne 'JAVA' && $primary ne 'PYTHON'; - - # Make the result unique. This lets the user use conditionals in - # a natural way, but still lets us program lazily -- we don't have - # to worry about handling a particular object more than once. - # We will keep only one location per object. - my %result = (); - for my $pair (@result) - { - my ($loc, $val) = @$pair; - $result{$val} = $loc; - } - my @l = sort keys %result; - return map { [$result{$_}->clone, $_] } @l; -} - - -################################################################ - -# Each key in this hash is the name of a directory holding a -# Makefile.in. These variables are local to 'is_make_dir'. -my %make_dirs = (); -my $make_dirs_set = 0; - -# is_make_dir ($DIRECTORY) -# ------------------------ -sub is_make_dir -{ - my ($dir) = @_; - if (! $make_dirs_set) - { - foreach my $iter (@configure_input_files) - { - $make_dirs{dirname ($iter)} = 1; - } - # We also want to notice Makefile.in's. - foreach my $iter (@other_input_files) - { - if ($iter =~ /Makefile\.in$/) - { - $make_dirs{dirname ($iter)} = 1; - } - } - $make_dirs_set = 1; - } - return defined $make_dirs{$dir}; -} - -################################################################ - -# Find the aux dir. This should match the algorithm used by -# ./configure. (See the Autoconf documentation for for -# AC_CONFIG_AUX_DIR.) -sub locate_aux_dir () -{ - if (! $config_aux_dir_set_in_configure_ac) - { - # The default auxiliary directory is the first - # of ., .., or ../.. that contains install-sh. - # Assume . if install-sh doesn't exist yet. - for my $dir (qw (. .. ../..)) - { - if (-f "$dir/install-sh") - { - $config_aux_dir = $dir; - last; - } - } - $config_aux_dir = '.' unless $config_aux_dir; - } - # Avoid unsightly '/.'s. - $am_config_aux_dir = - '$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir"); - $am_config_aux_dir =~ s,/*$,,; -} - - -# push_required_file ($DIR, $FILE, $FULLFILE) -# ------------------------------------------- -# Push the given file onto DIST_COMMON. -sub push_required_file -{ - my ($dir, $file, $fullfile) = @_; - - # If the file to be distributed is in the same directory of the - # currently processed Makefile.am, then we want to distribute it - # from this same Makefile.am. - if ($dir eq $relative_dir) - { - push_dist_common ($file); - } - # This is needed to allow a construct in a non-top-level Makefile.am - # to require a file in the build-aux directory (see at least the test - # script 'test-driver-is-distributed.sh'). This is related to the - # automake bug#9546. Note that the use of $config_aux_dir instead - # of $am_config_aux_dir here is deliberate and necessary. - elsif ($dir eq $config_aux_dir) - { - push_dist_common ("$am_config_aux_dir/$file"); - } - # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support. - # We probably need some refactoring of this function and its callers, - # to have a more explicit and systematic handling of all the special - # cases; but, since there are only two of them, this is low-priority - # ATM. - elsif ($config_libobj_dir && $dir eq $config_libobj_dir) - { - # Avoid unsightly '/.'s. - my $am_config_libobj_dir = - '$(top_srcdir)' . - ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir"); - $am_config_libobj_dir =~ s|/*$||; - push_dist_common ("$am_config_libobj_dir/$file"); - } - 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); - } - else - { - prog_error "a Makefile in relative directory $relative_dir " . - "can't add files in directory $dir to DIST_COMMON"; - } -} - - -# 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 = (); - -# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE) -# ------------------------------------------------------- -# Verify that the file must exist in $DIRECTORY, or install it. -sub required_file_check_or_copy -{ - my ($where, $dir, $file) = @_; - - my $fullfile = "$dir/$file"; - my $found_it = 0; - my $dangling_sym = 0; - - if (-l $fullfile && ! -f $fullfile) - { - $dangling_sym = 1; - } - elsif (dir_has_case_matching_file ($dir, $file)) - { - $found_it = 1; - } - - # '--force-missing' only has an effect if '--add-missing' is - # specified. - return - if $found_it && (! $add_missing || ! $force_missing); - - # 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) - { - return if defined $required_file_not_found{$fullfile}; - $required_file_not_found{$fullfile} = 1; - } - if ($dangling_sym && $add_missing) - { - unlink ($fullfile); - } - - my $trailer = ''; - my $trailer2 = ''; - my $suppress = 0; - - # Only install missing files according to our desired - # strictness level. - my $message = "required file '$fullfile' not found"; - if ($add_missing) - { - if (-f "$libdir/$file") - { - $suppress = 1; - - # Install the missing file. Symlink if we - # can, copy if we must. Note: delete the file - # first, in case it is a dangling symlink. - $message = "installing '$fullfile'"; - - # The license file should not be volatile. - if ($file eq "COPYING") - { - $message .= " using GNU General Public License v3 file"; - $trailer2 = "\n Consider adding the COPYING file" - . " to the version control system" - . "\n for your code, to avoid questions" - . " about which license your project uses"; - } - - # Windows Perl will hang if we try to delete a - # file that doesn't exist. - unlink ($fullfile) if -f $fullfile; - if ($symlink_exists && ! $copy_missing) - { - if (! symlink ("$libdir/$file", $fullfile) - || ! -e $fullfile) - { - $suppress = 0; - $trailer = "; error while making link: $!"; - } - } - elsif (system ('cp', "$libdir/$file", $fullfile)) - { - $suppress = 0; - $trailer = "\n error while copying"; - } - set_dir_cache_file ($dir, $file); - } - } - 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. - return - if $found_it && $force_missing; - - # 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. - return - if !$suppress && rule $file; - - msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2"); -} - - -# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES) -# --------------------------------------------------------------------- -# Verify that the file must exist in $DIRECTORY, or install it. -# $MYSTRICT is the strictness level at which this file becomes required. -# Worker threads may queue up the action to be serialized by the master, -# if $QUEUE is true -sub require_file_internal -{ - my ($where, $mystrict, $dir, $queue, @files) = @_; - - return - unless $strictness >= $mystrict; - - foreach my $file (@files) - { - push_required_file ($dir, $file, "$dir/$file"); - if ($queue) - { - queue_required_file_check_or_copy ($required_conf_file_queue, - QUEUE_CONF_FILE, $relative_dir, - $where, $mystrict, @files); - } - else - { - required_file_check_or_copy ($where, $dir, $file); - } - } -} - -# require_file ($WHERE, $MYSTRICT, @FILES) -# ---------------------------------------- -sub require_file -{ - my ($where, $mystrict, @files) = @_; - require_file_internal ($where, $mystrict, $relative_dir, 0, @files); -} - -# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) -# ---------------------------------------------------------- -sub require_file_with_macro -{ - my ($cond, $macro, $mystrict, @files) = @_; - $macro = rvar ($macro) unless ref $macro; - require_file ($macro->rdef ($cond)->location, $mystrict, @files); -} - -# require_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, 0, @files); - } - else - { - require_file ($macro->rdef ($cond)->location, $mystrict, @files); - } -} - -# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE, -# $MYSTRICT, @FILES) -# -------------------------------------------------------------- -sub queue_required_file_check_or_copy -{ - my ($queue, $key, $dir, $where, $mystrict, @files) = @_; - my @serial_loc; - if (ref $where) - { - @serial_loc = (QUEUE_LOCATION, $where->serialize ()); - } - else - { - @serial_loc = (QUEUE_STRING, $where); - } - $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files); -} - -# require_queued_file_check_or_copy ($QUEUE) -# ------------------------------------------ -sub require_queued_file_check_or_copy -{ - my ($queue) = @_; - my $where; - my $dir = $queue->dequeue (); - my $loc_key = $queue->dequeue (); - if ($loc_key eq QUEUE_LOCATION) - { - $where = Automake::Location::deserialize ($queue); - } - elsif ($loc_key eq QUEUE_STRING) - { - $where = $queue->dequeue (); - } - else - { - prog_error "unexpected key $loc_key"; - } - my $mystrict = $queue->dequeue (); - my $nfiles = $queue->dequeue (); - my @files; - push @files, $queue->dequeue () - foreach (1 .. $nfiles); - return - unless $strictness >= $mystrict; - foreach my $file (@files) - { - required_file_check_or_copy ($where, $config_aux_dir, $file); - } -} - -# 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) = @_; - my $queue = defined $required_conf_file_queue ? 1 : 0; - require_file_internal ($where, $mystrict, $config_aux_dir, - $queue, @files); -} - - -# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) -# --------------------------------------------------------------- -sub require_conf_file_with_macro -{ - my ($cond, $macro, $mystrict, @files) = @_; - require_conf_file (rvar ($macro)->rdef ($cond)->location, - $mystrict, @files); -} - -################################################################ - -# require_build_directory ($DIRECTORY) -# ------------------------------------ -# Emit rules to create $DIRECTORY if needed, and return -# the file that any target requiring this directory should be made -# dependent upon. -# 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); - - if (exists $directory_map{$cdir}) - { - 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 must be removed by 'make distclean'. - $clean_files{$dirstamp} = DIST_CLEAN; - - $output_rules .= ("$dirstamp:\n" - . "\t\@\$(MKDIR_P) $directory\n" - . "\t\@: > $dirstamp\n"); - - return $dirstamp; -} - -# require_build_directory_maybe ($FILE) -# ------------------------------------- -# If $FILE lies in a subdirectory, emit a rule to create this -# directory and return the file that $FILE should be made -# dependent upon. Otherwise, just return the empty string. -sub require_build_directory_maybe -{ - my $file = shift; - my $directory = dirname ($file); - - if ($directory ne '.') - { - return require_build_directory ($directory); - } - else - { - return ''; - } -} - -################################################################ - -# Push a list of files onto '@dist_common'. -sub push_dist_common -{ - prog_error "push_dist_common run after handle_dist" - if $handle_dist_run; - Automake::Variable::define ('DIST_COMMON', VAR_AUTOMAKE, '+', TRUE, "@_", - '', INTERNAL, VAR_PRETTY); -} - - -################################################################ - -# generate_makefile ($MAKEFILE_AM, $MAKEFILE_IN) -# ---------------------------------------------- -# Generate a Makefile.in given the name of the corresponding Makefile and -# the name of the file output by config.status. -sub generate_makefile -{ - my ($makefile_am, $makefile_in) = @_; - - # Reset all the Makefile.am related variables. - initialize_per_input; - - # AUTOMAKE_OPTIONS can contains -W flags to disable or enable - # warnings for this file. So hold any warning issued before - # we have processed AUTOMAKE_OPTIONS. - buffer_messages ('warning'); - - # $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 the subroutine - # 'scan_autoconf_files' for details. - my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in}); - - $relative_dir = dirname ($makefile); - - read_main_am_file ($makefile_am, $makefile_in); - if (not handle_options) - { - # Process buffered warnings. - flush_messages; - # Fatal error. Just return, so we can continue with next file. - return; - } - # Process buffered warnings. - flush_messages; - - # There are a few install-related variables that you should not define. - foreach my $var ('PRE_INSTALL', 'POST_INSTALL', 'NORMAL_INSTALL') - { - my $v = var $var; - if ($v) - { - my $def = $v->def (TRUE); - prog_error "$var not defined in condition TRUE" - unless $def; - reject_var $var, "'$var' should not be defined" - if $def->owner != VAR_AUTOMAKE; - } - } - - # Catch some obsolete variables. - msg_var ('obsolete', 'INCLUDES', - "'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')") - if var ('INCLUDES'); - - # 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_gnu_standards; - check_gnits_standards; - - handle_configure ($makefile_am, $makefile_in, $makefile, @inputs); - handle_gettext; - handle_libraries; - handle_ltlibraries; - handle_programs; - handle_scripts; - - handle_silent; - - # 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_texinfo; - handle_emacs_lisp; - handle_python; - handle_java; - handle_man_pages; - handle_data; - handle_headers; - handle_subdirs; - handle_user_recursion; - handle_tags; - handle_minor_options; - # Must come after handle_programs so that %known_programs is up-to-date. - handle_tests; - - # This must come after most other rules. - handle_dist; - - handle_footer; - do_check_merge_target; - handle_all ($makefile); - - # FIXME: Gross! - if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS')) - { - $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n"; - } - if (var ('nobase_lib_LTLIBRARIES') && var ('bin_PROGRAMS')) - { - $output_rules .= "install-binPROGRAMS: install-nobase_libLTLIBRARIES\n\n"; - } - - handle_install; - handle_clean ($makefile); - handle_factored_dependencies; - - # Comes last, because all the above procedures may have - # defined or overridden variables. - $output_vars .= output_variables; - - check_typos; - - if ($exit_code != 0) - { - verb "not writing $makefile_in because of earlier errors"; - return; - } - - my $am_relative_dir = dirname ($makefile_am); - mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir; - - # 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 $makefile_in; - if (! $force_generation - && $configure_deps_greatest_timestamp < $timestamp - && $output_deps_greatest_timestamp < $timestamp - && $output eq contents ($makefile_in)) - { - verb "$makefile_in unchanged"; - # No need to update. - return; - } - - if (-e $makefile_in) - { - unlink ($makefile_in) - or fatal "cannot remove $makefile_in: $!"; - } - - my $gm_file = new Automake::XFile "> $makefile_in"; - verb "creating $makefile_in"; - print $gm_file $output; -} - - -################################################################ - - -# Helper function for usage(). -sub print_autodist_files -{ - # NOTE: we need to call our 'uniq' function with the leading '&' - # here, because otherwise perl complains that "Unquoted string - # 'uniq' may clash with future reserved word". - my @lcomm = sort (&uniq (@_)); - - my @four; - format USAGE_FORMAT = - @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< - $four[0], $four[1], $four[2], $four[3] -. - local $~ = "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; - } -} - - -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: - --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 set directory storing library files - --print-libdir print directory storing library files - -c, --copy with -a, copy missing files (default is symlink) - -f, --force-missing force update of standard files - -"; - Automake::ChannelDefs::usage; - - print "\nFiles automatically distributed if found " . - "(always):\n"; - print_autodist_files @common_files; - print "\nFiles automatically distributed if found " . - "(under certain conditions):\n"; - print_autodist_files @common_sometimes; - - print ' -Report bugs to . -GNU Automake home page: . -General help using GNU software: . -'; - - # --help always returns 0 per GNU standards. - exit 0; -} - - -sub version () -{ - print < -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF - # --version always returns 0 per GNU standards. - exit 0; -} - -################################################################ - -# Parse command line. -sub parse_arguments () -{ - my $strict = 'gnu'; - my $ignore_deps = 0; - my @warnings = (); - - my %cli_options = - ( - 'version' => \&version, - 'help' => \&usage, - 'libdir=s' => \$libdir, - 'print-libdir' => sub { print "$libdir\n"; exit 0; }, - 'gnu' => sub { $strict = 'gnu'; }, - 'gnits' => sub { $strict = 'gnits'; }, - 'foreign' => sub { $strict = 'foreign'; }, - 'include-deps' => sub { $ignore_deps = 0; }, - 'i|ignore-deps' => sub { $ignore_deps = 1; }, - 'no-force' => sub { $force_generation = 0; }, - 'f|force-missing' => \$force_missing, - 'a|add-missing' => \$add_missing, - 'c|copy' => \$copy_missing, - 'v|verbose' => sub { setup_channel 'verb', silent => 0; }, - 'W|warnings=s' => \@warnings, - ); - - use Automake::Getopt (); - Automake::Getopt::parse_options %cli_options; - - set_strictness ($strict); - my $cli_where = new Automake::Location; - set_global_option ('no-dependencies', $cli_where) if $ignore_deps; - for my $warning (@warnings) - { - parse_warnings ('-W', $warning); - } - - return unless @ARGV; - - 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; -} - - -# handle_makefile ($MAKEFILE) -# --------------------------- -sub handle_makefile -{ - my ($file) = @_; - ($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; - } -} - -# Deal with all makefiles, without threads. -sub handle_makefiles_serial () -{ - foreach my $file (@input_files) - { - handle_makefile ($file); - } -} - -# Logic for deciding how many worker threads to use. -sub get_number_of_threads () -{ - my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0; - - $nthreads = 0 - unless $nthreads =~ /^[0-9]+$/; - - # It doesn't make sense to use more threads than makefiles, - my $max_threads = @input_files; - - if ($nthreads > $max_threads) - { - $nthreads = $max_threads; - } - return $nthreads; -} - -# handle_makefiles_threaded ($NTHREADS) -# ------------------------------------- -# Deal with all makefiles, using threads. The general strategy is to -# spawn NTHREADS worker threads, dispatch makefiles to them, and let the -# worker threads push back everything that needs serialization: -# * warning and (normal) error messages, for stable stderr output -# order and content (avoiding duplicates, for example), -# * races when installing aux files (and respective messages), -# * races when collecting aux files for distribution. -# -# The latter requires that the makefile that deals with the aux dir -# files be handled last, done by the master thread. -sub handle_makefiles_threaded -{ - my ($nthreads) = @_; - - # The file queue distributes all makefiles, the message queues - # collect all serializations needed for respective files. - my $file_queue = Thread::Queue->new; - my %msg_queues; - foreach my $file (@input_files) - { - $msg_queues{$file} = Thread::Queue->new; - } - - verb "spawning $nthreads worker threads"; - my @threads = (1 .. $nthreads); - foreach my $t (@threads) - { - $t = threads->new (sub - { - while (my $file = $file_queue->dequeue) - { - verb "handling $file"; - my $queue = $msg_queues{$file}; - setup_channel_queue ($queue, QUEUE_MESSAGE); - $required_conf_file_queue = $queue; - handle_makefile ($file); - $queue->enqueue (undef); - setup_channel_queue (undef, undef); - $required_conf_file_queue = undef; - } - return $exit_code; - }); - } - - # Queue all makefiles. - verb "queuing " . @input_files . " input files"; - $file_queue->enqueue (@input_files, (undef) x @threads); - - # Collect and process serializations. - foreach my $file (@input_files) - { - verb "dequeuing messages for " . $file; - reset_local_duplicates (); - my $queue = $msg_queues{$file}; - while (my $key = $queue->dequeue) - { - if ($key eq QUEUE_MESSAGE) - { - pop_channel_queue ($queue); - } - elsif ($key eq QUEUE_CONF_FILE) - { - require_queued_file_check_or_copy ($queue); - } - else - { - prog_error "unexpected key $key"; - } - } - } - - foreach my $t (@threads) - { - my @exit_thread = $t->join; - $exit_code = $exit_thread[0] - if ($exit_thread[0] > $exit_code); - } -} - -################################################################ - -# 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"); - } - -my $nthreads = get_number_of_threads (); - -if ($perl_threads && $nthreads >= 1) - { - handle_makefiles_threaded ($nthreads); - } -else - { - handle_makefiles_serial (); - } - -exit $exit_code; - - -### Setup "GNU" style for perl-mode and cperl-mode. -## Local Variables: -## perl-indent-level: 2 -## perl-continued-statement-offset: 2 -## perl-continued-brace-offset: 0 -## perl-brace-offset: 0 -## perl-brace-imaginary-offset: 0 -## perl-label-offset: -2 -## cperl-indent-level: 2 -## cperl-brace-offset: 0 -## cperl-continued-brace-offset: 0 -## cperl-label-offset: -2 -## cperl-extra-newline-before-brace: t -## cperl-merge-trailing-else: nil -## cperl-continued-statement-offset: 2 -## End: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/automake-1.14 b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/automake-1.14 deleted file mode 100755 index 9c74dd31d..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/automake-1.14 +++ /dev/null @@ -1,8298 +0,0 @@ -#!/usr/bin/perl -w -# -*- perl -*- -# Generated from bin/automake.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# automake - create Makefile.in from Makefile.am -# Copyright (C) 1994-2013 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, see . - -# Originally written by David Mackenzie . -# Perl reimplementation by Tom Tromey , and -# Alexandre Duret-Lutz . - -package Automake; - -use strict; - -BEGIN -{ - @Automake::perl_libdirs = ('//share/automake-1.14') - unless @Automake::perl_libdirs; - unshift @INC, @Automake::perl_libdirs; - - # 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{'DJDIR'}; -} - -use Automake::Config; -BEGIN -{ - if ($perl_threads) - { - require threads; - import threads; - require Thread::Queue; - import Thread::Queue; - } -} -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::Variable; -use Automake::VarDef; -use Automake::Rule; -use Automake::RuleDef; -use Automake::Wrap 'makefile_wrap'; -use Automake::Language; -use File::Basename; -use File::Spec; -use Carp; - -## ----------------------- ## -## Subroutine prototypes. ## -## ----------------------- ## - -# BEGIN AUTOMATICALLY GENERATED PROTOTYPES -sub append_exeext (&$); -sub check_gnits_standards (); -sub check_gnu_standards (); -sub check_trailing_slash ($\$); -sub check_typos (); -sub define_files_variable ($\@$$); -sub define_standard_variables (); -sub define_verbose_libtool (); -sub define_verbose_texinfo (); -sub do_check_merge_target (); -sub get_number_of_threads (); -sub handle_compile (); -sub handle_data (); -sub handle_dist (); -sub handle_emacs_lisp (); -sub handle_factored_dependencies (); -sub handle_footer (); -sub handle_gettext (); -sub handle_headers (); -sub handle_install (); -sub handle_java (); -sub handle_languages (); -sub handle_libraries (); -sub handle_libtool (); -sub handle_ltlibraries (); -sub handle_makefiles_serial (); -sub handle_man_pages (); -sub handle_minor_options (); -sub handle_options (); -sub handle_programs (); -sub handle_python (); -sub handle_scripts (); -sub handle_silent (); -sub handle_subdirs (); -sub handle_tags (); -sub handle_tests (); -sub handle_tests_dejagnu (); -sub handle_texinfo (); -sub handle_user_recursion (); -sub initialize_per_input (); -sub lang_lex_finish (); -sub lang_sub_obj (); -sub lang_vala_finish (); -sub lang_yacc_finish (); -sub locate_aux_dir (); -sub parse_arguments (); -sub scan_aclocal_m4 (); -sub scan_autoconf_files (); -sub silent_flag (); -sub transform ($\%); -sub transform_token ($\%$); -sub usage (); -sub version (); -sub yacc_lex_finish_helper (); -# END AUTOMATICALLY GENERATED PROTOTYPES - - -## ----------- ## -## Constants. ## -## ----------- ## - -# Some regular expressions. One reason to put them here is that it -# makes indentation work better in Emacs. - -# Writing singled-quoted-$-terminated regexes is a pain because -# perl-mode thinks of $' as the ${'} variable (instead of a $ followed -# by a closing quote. Letting perl-mode think the quote is not closed -# leads to all sort of misindentations. On the other hand, defining -# regexes as double-quoted strings is far less readable. So usually -# we will write: -# -# $REGEX = '^regex_value' . "\$"; - -my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n'; -my $WHITE_PATTERN = '^\s*' . "\$"; -my $COMMENT_PATTERN = '^#'; -my $TARGET_PATTERN='[$a-zA-Z0-9_.@%][-.a-zA-Z0-9_(){}/$+@%]*'; -# A rule has three parts: a list of targets, a list of dependencies, -# and optionally actions. -my $RULE_PATTERN = - "^($TARGET_PATTERN(?:(?:\\\\\n|\\s)+$TARGET_PATTERN)*) *:([^=].*|)\$"; - -# Only recognize leading spaces, not leading tabs. If we recognize -# leading tabs here then we need to make the reader smarter, because -# otherwise it will think rules like 'foo=bar; \' are errors. -my $ASSIGNMENT_PATTERN = '^ *([^ \t=:+]*)\s*([:+]?)=\s*(.*)' . "\$"; -# This pattern recognizes a Gnits version id and sets $1 if the -# release is an alpha release. We also allow a suffix which can be -# used to extend the version number with a "fork" identifier. -my $GNITS_VERSION_PATTERN = '\d+\.\d+([a-z]|\.\d+)?(-[A-Za-z0-9]+)?'; - -my $IF_PATTERN = '^if\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*)\s*(?:#.*)?' . "\$"; -my $ELSE_PATTERN = - '^else(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; -my $ENDIF_PATTERN = - '^endif(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; -my $PATH_PATTERN = '(\w|[+/.-])+'; -# This will pass through anything not of the prescribed form. -my $INCLUDE_PATTERN = ('^include\s+' - . '((\$\(top_srcdir\)/' . $PATH_PATTERN . ')' - . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')' - . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$"); - -# Directories installed during 'install-exec' phase. -my $EXEC_DIR_PATTERN = - '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$"; - -# Values for AC_CANONICAL_* -use constant AC_CANONICAL_BUILD => 1; -use constant AC_CANONICAL_HOST => 2; -use constant AC_CANONICAL_TARGET => 3; - -# Values indicating when something should be cleaned. -use constant MOSTLY_CLEAN => 0; -use constant CLEAN => 1; -use constant DIST_CLEAN => 2; -use constant MAINTAINER_CLEAN => 3; - -# Libtool files. -my @libtool_files = qw(ltmain.sh config.guess config.sub); -# ltconfig appears here for compatibility with old versions of libtool. -my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh); - -# Commonly found files we look for and automatically include in -# DISTFILES. -my @common_files = - (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB - COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO - ar-lib compile config.guess config.rpath - config.sub depcomp install-sh libversion.in mdate-sh - missing mkinstalldirs py-compile texinfo.tex ylwrap), - @libtool_files, @libtool_sometimes); - -# Commonly used files we auto-include, but only sometimes. This list -# is used for the --help output only. -my @common_sometimes = - qw(aclocal.m4 acconfig.h config.h.top config.h.bot configure - configure.ac configure.in stamp-vti); - -# Standard directories from the GNU Coding Standards, and additional -# pkg* directories from Automake. Stored in a hash for fast member check. -my %standard_prefix = - map { $_ => 1 } (qw(bin data dataroot doc dvi exec html include info - lib libexec lisp locale localstate man man1 man2 - man3 man4 man5 man6 man7 man8 man9 oldinclude pdf - pkgdata pkginclude pkglib pkglibexec ps sbin - sharedstate sysconf)); - -# Copyright on generated Makefile.ins. -my $gen_copyright = "\ -# Copyright (C) 1994-$RELEASE_YEAR 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 the lang_*_rewrite functions. -# LANG_SUBDIR means that the resulting object file should be in a -# subdir if the source file is. In this case the file name cannot -# have '..' components. -use constant LANG_IGNORE => 0; -use constant LANG_PROCESS => 1; -use constant LANG_SUBDIR => 2; - -# These are used when keeping track of whether an object can be built -# by two different paths. -use constant COMPILE_LIBTOOL => 1; -use constant COMPILE_ORDINARY => 2; - -# We can't always associate a location to a variable or a rule, -# when it's defined by Automake. We use INTERNAL in this case. -use constant INTERNAL => new Automake::Location; - -# Serialization keys for message queues. -use constant QUEUE_MESSAGE => "msg"; -use constant QUEUE_CONF_FILE => "conf file"; -use constant QUEUE_LOCATION => "location"; -use constant QUEUE_STRING => "string"; - -## ---------------------------------- ## -## Variables related to the options. ## -## ---------------------------------- ## - -# TRUE if we should always generate Makefile.in. -my $force_generation = 1; - -# From the Perl manual. -my $symlink_exists = (eval 'symlink ("", "");', $@ eq ''); - -# TRUE if missing standard files should be installed. -my $add_missing = 0; - -# TRUE if we should copy missing files; otherwise symlink if possible. -my $copy_missing = 0; - -# TRUE if we should always update files that we know about. -my $force_missing = 0; - - -## ---------------------------------------- ## -## Variables filled during files scanning. ## -## ---------------------------------------- ## - -# Name of the configure.ac file. -my $configure_ac; - -# Files found by scanning configure.ac for LIBOBJS. -my %libsources = (); - -# Names used in AC_CONFIG_HEADERS call. -my @config_headers = (); - -# Names used in AC_CONFIG_LINKS call. -my @config_links = (); - -# List of Makefile.am's to process, and their corresponding outputs. -my @input_files = (); -my %output_files = (); - -# Complete list of Makefile.am's that exist. -my @configure_input_files = (); - -# List of files in AC_CONFIG_FILES/AC_OUTPUT without Makefile.am's, -# and their outputs. -my @other_input_files = (); -# Where each AC_CONFIG_FILES/AC_OUTPUT/AC_CONFIG_LINK/AC_CONFIG_HEADERS -# appears. The keys are the files created by these macros. -my %ac_config_files_location = (); -# The condition under which AC_CONFIG_FOOS appears. -my %ac_config_files_condition = (); - -# 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 = ''; - -# Directory to search for AC_LIBSOURCE files, as set by AC_CONFIG_LIBOBJ_DIR -# in configure.ac. -my $config_libobj_dir = ''; - -# Whether AM_GNU_GETTEXT has been seen in configure.ac. -my $seen_gettext = 0; -# Whether AM_GNU_GETTEXT([external]) is used. -my $seen_gettext_external = 0; -# Where AM_GNU_GETTEXT appears. -my $ac_gettext_location; -# Whether AM_GNU_GETTEXT_INTL_SUBDIR has been seen. -my $seen_gettext_intl = 0; - -# The arguments of the AM_EXTRA_RECURSIVE_TARGETS call (if any). -my @extra_recursive_targets = (); - -# 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. -my $seen_canonical = 0; - -# 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 AM_PROG_AR -my $seen_ar = 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; - -# 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 = (); - -# Ignored configure substitutions (i.e., variables not to be output in -# Makefile.in) -my %ignored_configure_vars = (); - -# Files included by $configure_ac. -my @configure_deps = (); - -# Greatest timestamp of configure's dependencies. -my $configure_deps_greatest_timestamp = 0; - -# Hash table of AM_CONDITIONAL variables seen in configure. -my %configure_cond = (); - -# This maps extensions onto language names. -my %extension_map = (); - -# List of the DIST_COMMON files we discovered while reading -# configure.ac. -my $configure_dist_common = ''; - -# This maps languages names onto objects. -my %languages = (); -# Maps each linker variable onto a language object. -my %link_languages = (); - -# maps extensions to needed source flags. -my %sourceflags = (); - -# 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... - 'html-am' => 1, - 'dvi-am' => 1, - 'pdf-am' => 1, - 'ps-am' => 1, - 'info-am' => 1, - 'install-data-am' => 1, - 'install-exec-am' => 1, - 'install-html-am' => 1, - 'install-dvi-am' => 1, - 'install-pdf-am' => 1, - 'install-ps-am' => 1, - 'install-info-am' => 1, - 'installcheck-am' => 1, - 'uninstall-am' => 1, - 'tags-am' => 1, - 'ctags-am' => 1, - 'cscopelist-am' => 1, - 'install-man' => 1, - ); - -# Queue to push require_conf_file requirements to. -my $required_conf_file_queue; - -# The name of the Makefile currently being processed. -my $am_file = 'BUG'; - -################################################################ - -## ------------------------------------------ ## -## Variables reset by &initialize_per_input. ## -## ------------------------------------------ ## - -# Relative dir of the output makefile. -my $relative_dir; - -# Greatest timestamp of the output's dependencies (excluding -# configure's dependencies). -my $output_deps_greatest_timestamp; - -# These variables are used when generating each Makefile.in. -# They hold the Makefile.in until it is ready to be printed. -my $output_vars; -my $output_all; -my $output_header; -my $output_rules; -my $output_trailer; - -# This is the conditional stack, updated on if/else/endif, and -# used to build Condition objects. -my @cond_stack; - -# This holds the set of included files. -my @include_stack; - -# List of dependencies for the obvious targets. -my @all; -my @check; -my @check_tests; - -# Keys in this hash table are files to delete. The associated -# value tells when this should happen (MOSTLY_CLEAN, DIST_CLEAN, etc.) -my %clean_files; - -# Keys in this hash table are object files or other files in -# subdirectories which need to be removed. This only holds files -# which are created by compilations. The value in the hash indicates -# when the file should be removed. -my %compile_clean_files; - -# Keys in this hash table are directories where we expect to build a -# libtool object. We use this information to decide what directories -# to delete. -my %libtool_clean_directories; - -# Value of $(SOURCES), used by tags.am. -my @sources; -# Sources which go in the distribution. -my @dist_sources; - -# This hash maps object file names onto their corresponding source -# file names. This is used to ensure that each object is created -# by a single source file. -my %object_map; - -# This hash maps object file names onto an integer value representing -# whether this object has been built via ordinary compilation or -# libtool compilation (the COMPILE_* constants). -my %object_compilation_map; - - -# This keeps track of the directories for which we've already -# created dirstamp code. Keys are directories, values are stamp files. -# Several keys can share the same stamp files if they are equivalent -# (as are './/foo' and 'foo'). -my %directory_map; - -# All .P files. -my %dep_files; - -# 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). @substitutions@ are not listed. -my %known_programs; -my %known_libraries; - -# 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; - -# Does the generated Makefile have to build some compiled object -# (for binary programs, or plain or libtool libraries)? -my $must_handle_compiled_objects; - -# Record each file processed by make_paragraphs. -my %transformed_files; - -################################################################ - -## ---------------------------------------------- ## -## Variables not reset by &initialize_per_input. ## -## ---------------------------------------------- ## - -# 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; - -################################################################ - -# 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); - -################################################################ - - -# initialize_per_input () -# ----------------------- -# (Re)-Initialize per-Makefile.am variables. -sub initialize_per_input () -{ - reset_local_duplicates (); - - $relative_dir = undef; - - $output_deps_greatest_timestamp = 0; - - $output_vars = ''; - $output_all = ''; - $output_header = ''; - $output_rules = ''; - $output_trailer = ''; - - Automake::Options::reset; - Automake::Variable::reset; - Automake::Rule::reset; - - @cond_stack = (); - - @include_stack = (); - - @all = (); - @check = (); - @check_tests = (); - - %clean_files = (); - %compile_clean_files = (); - - # We always include '.'. This isn't strictly correct. - %libtool_clean_directories = ('.' => 1); - - @sources = (); - @dist_sources = (); - - %object_map = (); - %object_compilation_map = (); - - %directory_map = (); - - %dep_files = (); - - @dist_targets = (); - - %known_programs = (); - %known_libraries= (); - - %extension_seen = (); - - %language_scratch = (); - - %lang_specific_files = (); - - $handle_dist_run = 0; - - $need_link = 0; - - $must_handle_compiled_objects = 0; - - %transformed_files = (); -} - - -################################################################ - -# Initialize our list of languages that are internally supported. - -my @cpplike_flags = - qw{ - $(DEFS) - $(DEFAULT_INCLUDES) - $(INCLUDES) - $(AM_CPPFLAGS) - $(CPPFLAGS) - }; - -# C. -register_language ('name' => 'c', - 'Name' => 'C', - 'config_vars' => ['CC'], - 'autodep' => '', - 'flags' => ['CFLAGS', 'CPPFLAGS'], - 'ccer' => 'CC', - 'compiler' => 'COMPILE', - 'compile' => "\$(CC) @cpplike_flags \$(AM_CFLAGS) \$(CFLAGS)", - 'lder' => 'CCLD', - 'ld' => '$(CC)', - 'linker' => 'LINK', - 'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'CC', - 'extensions' => ['.c']); - -# 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) @cpplike_flags \$(AM_CXXFLAGS) \$(CXXFLAGS)", - 'ccer' => 'CXX', - 'compiler' => 'CXXCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'CXX', - 'lder' => 'CXXLD', - 'ld' => '$(CXX)', - 'pure' => 1, - 'extensions' => ['.c++', '.cc', '.cpp', '.cxx', '.C']); - -# Objective C. -register_language ('name' => 'objc', - 'Name' => 'Objective C', - 'config_vars' => ['OBJC'], - 'linker' => 'OBJCLINK', - 'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'OBJC', - 'flags' => ['OBJCFLAGS', 'CPPFLAGS'], - 'compile' => "\$(OBJC) @cpplike_flags \$(AM_OBJCFLAGS) \$(OBJCFLAGS)", - 'ccer' => 'OBJC', - 'compiler' => 'OBJCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'OBJCLD', - 'ld' => '$(OBJC)', - 'pure' => 1, - 'extensions' => ['.m']); - -# Objective C++. -register_language ('name' => 'objcxx', - 'Name' => 'Objective C++', - 'config_vars' => ['OBJCXX'], - 'linker' => 'OBJCXXLINK', - 'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'OBJCXX', - 'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'], - 'compile' => "\$(OBJCXX) @cpplike_flags \$(AM_OBJCXXFLAGS) \$(OBJCXXFLAGS)", - 'ccer' => 'OBJCXX', - 'compiler' => 'OBJCXXCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'OBJCXXLD', - 'ld' => '$(OBJCXX)', - 'pure' => 1, - 'extensions' => ['.mm']); - -# 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) @cpplike_flags \$(AM_UPCFLAGS) \$(UPCFLAGS)", - 'ccer' => 'UPC', - 'compiler' => 'UPCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'UPCLD', - 'ld' => '$(UPC)', - 'pure' => 1, - 'extensions' => ['.upc']); - -# 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 { }); - -# Vala -register_language ('name' => 'vala', - 'Name' => 'Vala', - 'config_vars' => ['VALAC'], - 'flags' => [], - 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)', - 'ccer' => 'VALAC', - 'compiler' => 'VALACOMPILE', - 'extensions' => ['.vala'], - 'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/; - return ($ext,) }, - 'rule_file' => 'vala', - '_finish' => \&lang_vala_finish, - '_target_hook' => \&lang_vala_target_hook, - 'nodist_specific' => 1); - -# Yacc (C & C++). -register_language ('name' => 'yacc', - 'Name' => 'Yacc', - 'config_vars' => ['YACC'], - 'flags' => ['YFLAGS'], - 'compile' => '$(YACC) $(AM_YFLAGS) $(YFLAGS)', - 'ccer' => 'YACC', - '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, - 'nodist_specific' => 1); -register_language ('name' => 'yaccxx', - 'Name' => 'Yacc (C++)', - 'config_vars' => ['YACC'], - 'rule_file' => 'yacc', - 'flags' => ['YFLAGS'], - 'ccer' => 'YACC', - 'compiler' => 'YACCCOMPILE', - 'compile' => '$(YACC) $(AM_YFLAGS) $(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, - 'nodist_specific' => 1); - -# Lex (C & C++). -register_language ('name' => 'lex', - 'Name' => 'Lex', - 'config_vars' => ['LEX'], - 'rule_file' => 'lex', - 'flags' => ['LFLAGS'], - 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)', - 'ccer' => 'LEX', - '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, - 'nodist_specific' => 1); -register_language ('name' => 'lexxx', - 'Name' => 'Lex (C++)', - 'config_vars' => ['LEX'], - 'rule_file' => 'lex', - 'flags' => ['LFLAGS'], - 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)', - 'ccer' => 'LEX', - '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, - 'nodist_specific' => 1); - -# Assembler. -register_language ('name' => 'asm', - 'Name' => 'Assembler', - '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. - 'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)', - 'ccer' => 'CCAS', - 'compiler' => 'CCASCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'extensions' => ['.s']); - -# Preprocessed Assembler. -register_language ('name' => 'cppasm', - 'Name' => 'Preprocessed Assembler', - 'config_vars' => ['CCAS', 'CCASFLAGS'], - - 'autodep' => 'CCAS', - 'flags' => ['CCASFLAGS', 'CPPFLAGS'], - 'compile' => "\$(CCAS) @cpplike_flags \$(AM_CCASFLAGS) \$(CCASFLAGS)", - 'ccer' => 'CPPAS', - 'compiler' => 'CPPASCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'extensions' => ['.S', '.sx']); - -# 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'], - 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)', - 'ccer' => '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)', - 'ccer' => 'FC', - 'compiler' => 'FCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'FC', - 'lder' => 'FCLD', - 'ld' => '$(FC)', - 'pure' => 1, - 'extensions' => ['.f90', '.f95', '.f03', '.f08']); - -# 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'], - 'ccer' => 'PPFC', - 'compiler' => 'PPFCCOMPILE', - 'compile' => "\$(FC) @cpplike_flags \$(AM_FCFLAGS) \$(FCFLAGS)", - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'FC', - 'pure' => 1, - 'extensions' => ['.F90','.F95', '.F03', '.F08']); - -# 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'], - 'ccer' => 'PPF77', - 'compiler' => 'PPF77COMPILE', - 'compile' => "\$(F77) @cpplike_flags \$(AM_FFLAGS) \$(FFLAGS)", - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'F77', - 'pure' => 1, - 'extensions' => ['.F']); - -# Ratfor. -register_language ('name' => 'ratfor', - 'Name' => 'Ratfor', - 'config_vars' => ['F77'], - 'linker' => 'F77LINK', - 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'lder' => 'F77LD', - 'ld' => '$(F77)', - 'flags' => ['RFLAGS', 'FFLAGS'], - # FIXME also FFLAGS. - 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)', - 'ccer' => 'F77', - 'compiler' => 'RCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'F77', - 'pure' => 1, - 'extensions' => ['.r']); - -# Java via gcj. -register_language ('name' => 'java', - 'Name' => 'Java', - 'config_vars' => ['GCJ'], - 'linker' => 'GCJLINK', - 'link' => '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'GCJ', - 'flags' => ['GCJFLAGS'], - 'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)', - 'ccer' => 'GCJ', - 'compiler' => 'GCJCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'GCJ', - 'lder' => 'GCJLD', - 'ld' => '$(GCJ)', - 'pure' => 1, - 'extensions' => ['.java', '.class', '.zip', '.jar']); - -################################################################ - -# Error reporting functions. - -# err_am ($MESSAGE, [%OPTIONS]) -# ----------------------------- -# Uncategorized errors about the current Makefile.am. -sub err_am -{ - msg_am ('error', @_); -} - -# err_ac ($MESSAGE, [%OPTIONS]) -# ----------------------------- -# Uncategorized errors about configure.ac. -sub err_ac -{ - msg_ac ('error', @_); -} - -# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS]) -# --------------------------------------- -# Messages about about the current Makefile.am. -sub msg_am -{ - my ($channel, $msg, %opts) = @_; - msg $channel, "${am_file}.am", $msg, %opts; -} - -# msg_ac ($CHANNEL, $MESSAGE, [%OPTIONS]) -# --------------------------------------- -# Messages about about configure.ac. -sub msg_ac -{ - my ($channel, $msg, %opts) = @_; - msg $channel, $configure_ac, $msg, %opts; -} - -################################################################ - -# subst ($TEXT) -# ------------- -# Return a configure-style substitution using the indicated text. -# We do this to avoid having the substitutions directly in automake.in; -# when we do that they are sometimes removed and this causes confusion -# and bugs. -sub subst -{ - my ($text) = @_; - return '@' . $text . '@'; -} - -################################################################ - - -# $BACKPATH -# backname ($RELDIR) -# ------------------- -# If I "cd $RELDIR", 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 - or prog_error ("trying to reverse path '$file' pointing outside tree"); - } - else - { - push (@res, '..'); - } - } - return join ('/', @res) || '.'; -} - -################################################################ - -# Silent rules handling functions. - -# verbose_var (NAME) -# ------------------ -# The public variable stem used to implement silent rules. -sub verbose_var -{ - my ($name) = @_; - return 'AM_V_' . $name; -} - -# verbose_private_var (NAME) -# -------------------------- -# The naming policy for the private variables for silent rules. -sub verbose_private_var -{ - my ($name) = @_; - return 'am__v_' . $name; -} - -# define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE]) -# ---------------------------------------------------------- -# For silent rules, setup VAR and dispatcher, to expand to -# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to -# empty) if not. -sub define_verbose_var -{ - my ($name, $silent_val, $verbose_val) = @_; - $verbose_val = '' unless defined $verbose_val; - my $var = verbose_var ($name); - my $pvar = verbose_private_var ($name); - my $silent_var = $pvar . '_0'; - my $verbose_var = $pvar . '_1'; - # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V) - # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY). - # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead. - # See AM_SILENT_RULES in m4/silent.m4. - define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL); - define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', - INTERNAL); - Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, - $silent_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($silent_var, TRUE)); - Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE, - $verbose_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($verbose_var, TRUE)); -} - -# verbose_flag (NAME) -# ------------------- -# Contents of '%VERBOSE%' variable to expand before rule command. -sub verbose_flag -{ - my ($name) = @_; - return '$(' . verbose_var ($name) . ')'; -} - -sub verbose_nodep_flag -{ - my ($name) = @_; - return '$(' . verbose_var ($name) . subst ('am__nodep') . ')'; -} - -# silent_flag -# ----------- -# Contents of %SILENT%: variable to expand to '@' when silent. -sub silent_flag () -{ - return verbose_flag ('at'); -} - -# define_verbose_tagvar (NAME) -# ---------------------------- -# Engage the needed silent rules machinery for tag NAME. -sub define_verbose_tagvar -{ - my ($name) = @_; - define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;'); -} - -# Engage the needed silent rules machinery for assorted texinfo commands. -sub define_verbose_texinfo () -{ - my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF'); - foreach my $tag (@tagvars) - { - define_verbose_tagvar($tag); - } - define_verbose_var('texinfo', '-q'); - define_verbose_var('texidevnull', '> /dev/null'); -} - -# Engage the needed silent rules machinery for 'libtool --silent'. -sub define_verbose_libtool () -{ - define_verbose_var ('lt', '--silent'); - return verbose_flag ('lt'); -} - -sub handle_silent () -{ - # Define "$(AM_V_P)", expanding to a shell conditional that can be - # used in make recipes to determine whether we are being run in - # silent mode or not. The choice of the name derives from the LISP - # convention of appending the letter 'P' to denote a predicate (see - # also "the '-P' convention" in the Jargon File); we do so for lack - # of a better convention. - define_verbose_var ('P', 'false', ':'); - # *Always* provide the user with '$(AM_V_GEN)', unconditionally. - define_verbose_tagvar ('GEN'); - define_verbose_var ('at', '@'); -} - - -################################################################ - - -# Handle AUTOMAKE_OPTIONS variable. Return 0 on error, 1 otherwise. -sub handle_options () -{ - my $var = var ('AUTOMAKE_OPTIONS'); - if ($var) - { - if ($var->has_conditional_contents) - { - msg_var ('unsupported', $var, - "'AUTOMAKE_OPTIONS' cannot have conditional contents"); - } - my @options = map { { option => $_->[1], where => $_->[0] } } - $var->value_as_list_recursive (cond_filter => TRUE, - location => 1); - return 0 unless process_option_list (@options); - } - - if ($strictness == GNITS) - { - set_option ('readme-alpha', INTERNAL); - set_option ('std-options', INTERNAL); - set_option ('check-news', INTERNAL); - } - - return 1; -} - -# 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 an am__VAR_DIST variable which contains -# all possible values, and return $(am__VAR_DIST). -sub shadow_unconditionally -{ - my ($varname, $where) = @_; - my $var = var $varname; - if ($var->has_conditional_contents) - { - $varname = "am__${varname}_DIST"; - my @files = uniq ($var->value_as_list_recursive); - define_pretty_variable ($varname, TRUE, $where, @files); - } - return "\$($varname)" -} - -# 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) - { - 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"); - } - } - } - } -} - -# Call finish function for each language that was used. -sub handle_languages () -{ - if (! option 'no-dependencies') - { - # Include auto-dep code. Don't include it if DEP_FILES would - # be empty. - if (keys %extension_seen && keys %dep_files) - { - # Set location of depcomp. - define_variable ('depcomp', - "\$(SHELL) $am_config_aux_dir/depcomp", - INTERNAL); - define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL); - - require_conf_file ("$am_file.am", FOREIGN, 'depcomp'); - - my @deplist = sort keys %dep_files; - # Generate each 'include' individually. Irix 6 make will - # not properly include several files resulting from a - # variable expansion; generating many separate includes - # seems safest. - $output_rules .= "\n"; - foreach my $iter (@deplist) - { - $output_rules .= (subst ('AMDEP_TRUE') - . subst ('am__include') - . ' ' - . subst ('am__quote') - . $iter - . subst ('am__quote') - . "\n"); - } - - # Compute the set of directories to remove in distclean-depend. - my @depdirs = uniq (map { dirname ($_) } @deplist); - $output_rules .= file_contents ('depend', - new Automake::Location, - DEPDIRS => "@depdirs"); - } - } - else - { - define_variable ('depcomp', '', INTERNAL); - define_variable ('am__depfiles_maybe', '', INTERNAL); - } - - my %done; - - # Is the C linker needed? - my $needs_c = 0; - foreach my $ext (sort keys %extension_seen) - { - next unless $extension_map{$ext}; - - my $lang = $languages{$extension_map{$ext}}; - - my $rule_file = $lang->rule_file || 'depend2'; - - # Get information on $LANG. - my $pfx = $lang->autodep; - my $fpfx = ($pfx eq '') ? 'CC' : $pfx; - - my ($AMDEP, $FASTDEP) = - (option 'no-dependencies' || $lang->autodep eq 'no') - ? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx"); - - my $verbose = verbose_flag ($lang->ccer || 'GEN'); - my $verbose_nodep = ($AMDEP eq 'FALSE') - ? $verbose : verbose_nodep_flag ($lang->ccer || 'GEN'); - my $silent = silent_flag (); - - my %transform = ('EXT' => $ext, - 'PFX' => $pfx, - 'FPFX' => $fpfx, - '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, - VERBOSE => $verbose, - 'VERBOSE-NODEP' => $verbose_nodep, - SILENT => $silent, - ); - - # Generate the appropriate rules for this extension. - if (((! option 'no-dependencies') && $lang->autodep ne 'no') - || defined $lang->compile) - { - # 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, - - 'DERIVED-EXT' => $der_ext, - - DEPBASE => $depbase, - BASE => '$*', - SOURCE => '$<', - SOURCEFLAG => $sourceflags{$ext} || '', - OBJ => '$@', - OBJOBJ => '$@', - LTOBJ => '$@', - - COMPILE => '$(' . $lang->compiler . ')', - LTCOMPILE => '$(LT' . $lang->compiler . ')', - -o => $lang->output_flag, - SUBDIROBJ => !! option 'subdir-objects'); - } - - # Now include code for each specially handled object with this - # language. - my %seen_files = (); - foreach my $file (@{$lang_specific_files{$lang->name}}) - { - my ($derived, $source, $obj, $myext, $srcext, %file_transform) = @$file; - - # We might see a given object twice, for instance if it is - # used under different conditions. - next if defined $seen_files{$obj}; - $seen_files{$obj} = 1; - - prog_error ("found " . $lang->name . - " in handle_languages, but compiler not defined") - unless defined $lang->compile; - - my $obj_compile = $lang->compile; - - # Rewrite each occurrence of 'AM_$flag' in the compile - # rule into '${derived}_$flag' if it exists. - for my $flag (@{$lang->flags}) - { - my $val = "${derived}_$flag"; - $obj_compile =~ s/\(AM_$flag\)/\($val\)/ - if set_seen ($val); - } - - my $libtool_tag = ''; - if ($lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}) - { - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - } - - my $ptltflags = "${derived}_LIBTOOLFLAGS"; - $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags; - - my $ltverbose = define_verbose_libtool (); - my $obj_ltcompile = - "\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) " - . "--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); - - $output_rules .= - file_contents ($rule_file, - new Automake::Location, - %transform, - GENERIC => 0, - - DEPBASE => $depbase, - BASE => $obj, - SOURCE => $source, - SOURCEFLAG => $sourceflags{$srcext} || '', - # 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", - - VERBOSE => $verbose, - 'VERBOSE-NODEP' => $verbose_nodep, - SILENT => $silent, - COMPILE => $obj_compile, - LTCOMPILE => $obj_ltcompile, - -o => $output_flag, - %file_transform); - } - - # The rest of the loop is done once per language. - next if defined $done{$lang}; - $done{$lang} = 1; - - # Load the language dependent Makefile chunks. - my %lang = map { uc ($_) => 0 } keys %languages; - $lang{uc ($lang->name)} = 1; - $output_rules .= file_contents ('lang-compile', - new Automake::Location, - %transform, %lang); - - # If the source to a program consists entirely of code from a - # 'pure' language, for instance C++ or Fortran 77, then we - # don't need the C compiler code. However if we run into - # something unusual then we do generate the C code. There are - # probably corner cases here that do not work properly. - # People linking Java code to Fortran code deserve pain. - $needs_c ||= ! $lang->pure; - - define_compiler_variable ($lang) - if ($lang->compile); - - define_linker_variable ($lang) - if ($lang->link); - - require_variables ("$am_file.am", $lang->Name . " source seen", - TRUE, @{$lang->config_vars}); - - # Call the finisher. - $lang->finish; - - # Flags listed in '->flags' are user variables (per GNU Standards), - # they should not be overridden in the Makefile... - my @dont_override = @{$lang->flags}; - # ... and so is LDFLAGS. - push @dont_override, 'LDFLAGS' if $lang->link; - - check_user_variables @dont_override; - } - - # 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. - my @languages_seen = map { $languages{$extension_map{$_}}->name } - (keys %extension_seen); - @languages_seen = uniq (@languages_seen); - $needs_c = 1 if @languages_seen > 1; - if ($need_link || $needs_c) - { - define_compiler_variable ($languages{'c'}) - unless defined $done{$languages{'c'}}; - define_linker_variable ($languages{'c'}); - } -} - - -# 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 -# do this check. -sub check_libobjs_sources -{ - my ($one_file, $unxformed) = @_; - - foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', - 'dist_EXTRA_', 'nodist_EXTRA_') - { - my @files; - my $varname = $prefix . $one_file . '_SOURCES'; - my $var = var ($varname); - if ($var) - { - @files = $var->value_as_list_recursive; - } - elsif ($prefix eq '') - { - @files = ($unxformed . '.c'); - } - else - { - next; - } - - foreach my $file (@files) - { - err_var ($prefix . $one_file . '_SOURCES', - "automatically discovered file '$file' should not" . - " be explicitly mentioned") - if defined $libsources{$file}; - } - } -} - - -# @OBJECTS -# handle_single_transform ($VAR, $TOPPARENT, $DERIVED, $OBJ, $FILE, %TRANSFORM) -# ----------------------------------------------------------------------------- -# Does much of the actual work for handle_source_transform. -# Arguments are: -# $VAR is the name of the variable that the source filenames come from -# $TOPPARENT is the name of the _SOURCES variable which is being processed -# $DERIVED is the name of resulting executable or library -# $OBJ is the object extension (e.g., '.lo') -# $FILE the source file to transform -# %TRANSFORM contains extras arguments to pass to file_contents -# when producing explicit rules -# Result is a list of the names of objects -# %linkers_used will be updated with any linkers needed -sub handle_single_transform -{ - my ($var, $topparent, $derived, $obj, $_file, %transform) = @_; - my @files = ($_file); - my @result = (); - - # Turn sources into objects. We use a while loop like this - # because we might add to @files in the loop. - while (scalar @files > 0) - { - $_ = shift @files; - - # Configure substitutions in _SOURCES variables are errors. - if (/^\@.*\@$/) - { - my $parent_msg = ''; - $parent_msg = "\nand is referred to from '$topparent'" - if $topparent ne $var->name; - err_var ($var, - "'" . $var->name . "' includes configure substitution '$_'" - . $parent_msg . ";\nconfigure " . - "substitutions are not allowed in _SOURCES variables"); - next; - } - - # If the source file is in a subdirectory then the '.o' is put - # into the current directory, unless the subdir-objects option - # is in effect. - - # Split file name into base and extension. - next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/; - my $full = $_; - my $directory = $1 || ''; - my $base = $2; - my $extension = $3; - - # We must generate a rule for the object if it requires its own flags. - my $renamed = 0; - my ($linker, $object); - - # This records whether we've seen a derived source file (e.g. - # yacc output). - my $derived_source = 0; - - # This holds the 'aggregate context' of the file we are - # currently examining. If the file is compiled with - # per-object flags, then it will be the name of the object. - # Otherwise it will be 'AM'. This is used by the target hook - # language function. - my $aggregate = 'AM'; - - $extension = derive_suffix ($extension, $obj); - my $lang; - if ($extension_map{$extension} && - ($lang = $languages{$extension_map{$extension}})) - { - # 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 $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 - # 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'}; - defined &$subr or $subr = \&lang_sub_obj; - my ($r, $source_extension) - = &$subr ($directory, $base, $extension, - $obj, $have_per_exec_flags, $var); - # 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; - } - else - { - $this_obj_ext = $obj; - } - $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 - # name that is too long for losing systems, in - # some situations. So we provide _SHORTNAME to - # override. - - my $dname = $derived; - my $var = var ($derived . '_SHORTNAME'); - if ($var) - { - # FIXME: should use the same Condition as - # the _SOURCES variable. But this is really - # silly overkill -- nobody should have - # conditional shortnames. - $dname = $var->variable_value; - } - $object = $dname . '-' . $object; - - 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 ($directory ne '') - { - if ($r == LANG_SUBDIR) - { - $object = $directory . '/' . $object; - } - else - { - # Since the next major version of automake (2.0) will - # make the behaviour so far only activated with the - # 'subdir-object' option mandatory, it's better if we - # start warning users not using that option. - # As suggested by Peter Johansson, we strive to avoid - # the warning when it would be irrelevant, i.e., if - # all source files sit in "current" directory. - msg_var 'unsupported', $var, - "source file '$full' is in a subdirectory," - . "\nbut option 'subdir-objects' is disabled"; - msg 'unsupported', INTERNAL, <<'EOF', uniq_scope => US_GLOBAL; -possible forward-incompatibility. -At least a source file is in a subdirectory, but the 'subdir-objects' -automake option hasn't been enabled. For now, the corresponding output -object file(s) will be placed in the top-level directory. However, -this behaviour will change in future Automake versions: they will -unconditionally cause object files to be placed in the same subdirectory -of the corresponding sources. -You are advised to start using 'subdir-objects' option throughout your -project, to avoid future incompatibilities. -EOF - } - } - - # 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'})) - { - my $obj_sans_ext = substr ($object, 0, - - length ($this_obj_ext)); - my $full_ansi; - if ($directory ne '') - { - $full_ansi = $directory . '/' . $base . $extension; - } - else - { - $full_ansi = $base . $extension; - } - - 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'), - $extension); - - # If we renamed the object then we want to use the - # per-executable flag name. But if this is simply a - # subdir build then we still want to use the AM_ flag - # name. - if ($renamed) - { - unshift @specifics, $derived; - $aggregate = $derived; - } - else - { - unshift @specifics, 'AM'; - } - - # Each item on this list is a reference to a list consisting - # of four values followed by additional transform flags for - # file_contents. The four values are the derived flag prefix - # (e.g. for 'foo_CFLAGS', it is 'foo'), the name of the - # source file, the base name of the output file, and - # the extension for the object file. - push (@{$lang_specific_files{$lang->name}}, - [@specifics, %transform]); - } - } - elsif ($extension eq $obj) - { - # 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 - { - # No error message here. Used to have one, but it was - # very unpopular. - # FIXME: we could potentially do more processing here, - # perhaps treating the new extension as though it were a - # new source extension (as above). This would require - # more restructuring than is appropriate right now. - next; - } - - err_am "object '$object' created by '$full' and '$object_map{$object}'" - if (defined $object_map{$object} - && $object_map{$object} ne $full); - - my $comp_val = (($object =~ /\.lo$/) - ? COMPILE_LIBTOOL : COMPILE_ORDINARY); - (my $comp_obj = $object) =~ s/\.lo$/.\$(OBJEXT)/; - if (defined $object_compilation_map{$comp_obj} - && $object_compilation_map{$comp_obj} != 0 - # Only see the error once. - && ($object_compilation_map{$comp_obj} - != (COMPILE_LIBTOOL | COMPILE_ORDINARY)) - && $object_compilation_map{$comp_obj} != $comp_val) - { - err_am "object '$comp_obj' created both with libtool and without"; - } - $object_compilation_map{$comp_obj} |= $comp_val; - - if (defined $lang) - { - # Let the language do some special magic if required. - $lang->target_hook ($aggregate, $object, $full, %transform); - } - - if ($derived_source) - { - prog_error ($lang->name . " has automatic dependency tracking") - if $lang->autodep ne 'no'; - # Make sure this new source file is handled next. That will - # make it appear to be at the right place in the list. - unshift (@files, $object); - # Distribute derived sources unless the source they are - # derived from is not. - push_dist_common ($object) - unless ($topparent =~ /^(?:nobase_)?nodist_/); - next; - } - - $linkers_used{$linker} = 1; - - push (@result, $object); - - if (! defined $object_map{$object}) - { - my @dep_list = (); - $object_map{$object} = $full; - - # If resulting object is in subdir, we need to make - # sure the subdir exists at build time. - if ($object =~ /\//) - { - # FIXME: check that $DIRECTORY is somewhere in the - # project - - # For Java, the way we're handling it right now, a - # '..' component doesn't make sense. - if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//) - { - err_am "'$full' should not contain a '..' component"; - } - - # Make sure *all* objects files in the subdirectory are - # removed by "make mostlyclean". Not only this is more - # efficient than listing the object files to be removed - # individually (which would cause an 'rm' invocation for - # each of them -- very inefficient, see bug#10697), it - # would also leave stale object files in the subdirectory - # whenever a source file there is removed or renamed. - $compile_clean_files{"$directory/*.\$(OBJEXT)"} = MOSTLY_CLEAN; - if ($object =~ /\.lo$/) - { - # If we have a libtool object, then we also must remove - # any '.lo' objects in its same subdirectory. - $compile_clean_files{"$directory/*.lo"} = MOSTLY_CLEAN; - # Remember to cleanup .libs/ in this directory. - $libtool_clean_directories{$directory} = 1; - } - - push (@dep_list, require_build_directory ($directory)); - - # If we're generating dependencies, we also want - # to make sure that the appropriate subdir of the - # .deps directory is created. - push (@dep_list, - require_build_directory ($directory . '/$(DEPDIR)')) - unless option 'no-dependencies'; - } - - pretty_print_rule ($object . ':', "\t", @dep_list) - if scalar @dep_list > 0; - } - - # Transform .o or $o file into .P file (for automatic - # dependency code). - # Properly flatten multiple adjacent slashes, as Solaris 10 make - # might fail over them in an include statement. - # Leading double slashes may be special, as per Posix, so deal - # with them carefully. - if ($lang && $lang->autodep ne 'no') - { - my $depfile = $object; - $depfile =~ s/\.([^.]*)$/.P$1/; - $depfile =~ s/\$\(OBJEXT\)$/o/; - my $maybe_extra_leading_slash = ''; - $maybe_extra_leading_slash = '/' if $depfile =~ m,^//[^/],; - $depfile =~ s,/+,/,g; - my $basename = basename ($depfile); - # This might make $dirname empty, but we account for that below. - (my $dirname = dirname ($depfile)) =~ s/\/*$//; - $dirname = $maybe_extra_leading_slash . $dirname; - $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1; - } - } - - return @result; -} - - -# $LINKER -# define_objects_from_sources ($VAR, $OBJVAR, $NODEFINE, $ONE_FILE, -# $OBJ, $PARENT, $TOPPARENT, $WHERE, %TRANSFORM) -# --------------------------------------------------------------------------- -# Define an _OBJECTS variable for a _SOURCES variable (or subvariable) -# -# Arguments are: -# $VAR is the name of the _SOURCES variable -# $OBJVAR is the name of the _OBJECTS variable if known (otherwise -# it will be generated and returned). -# $NODEFINE is a boolean: if true, $OBJVAR will not be defined (but -# work done to determine the linker will be). -# $ONE_FILE is the canonical (transformed) name of object to build -# $OBJ is the object extension (i.e. either '.o' or '.lo'). -# $TOPPARENT is the _SOURCES variable being processed. -# $WHERE context into which this definition is done -# %TRANSFORM extra arguments to pass to file_contents when producing -# rules -# -# Result is a pair ($LINKER, $OBJVAR): -# $LINKER is a boolean, true if a linker is needed to deal with the objects -sub define_objects_from_sources -{ - my ($var, $objvar, $nodefine, $one_file, - $obj, $topparent, $where, %transform) = @_; - - my $needlinker = ""; - - transform_variable_recursively - ($var, $objvar, 'am__objects', $nodefine, $where, - # The transform code to run on each filename. - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - my @trans = handle_single_transform ($subvar, $topparent, - $one_file, $obj, $val, - %transform); - $needlinker = "true" if @trans; - return @trans; - }); - - return $needlinker; -} - - -# handle_source_transform ($CANON_TARGET, $TARGET, $OBJEXT, $WHERE, %TRANSFORM) -# ----------------------------------------------------------------------------- -# Handle SOURCE->OBJECT transform for one program or library. -# Arguments are: -# canonical (transformed) name of target to build -# actual target of object to build -# object extension (i.e., either '.o' or '$o') -# location of the source variable -# extra arguments to pass to file_contents when producing rules -# Return the name of the linker variable that must be used. -# Empty return means just use 'LINK'. -sub handle_source_transform -{ - # one_file is canonical name. unxformed is given name. obj is - # object extension. - my ($one_file, $unxformed, $obj, $where, %transform) = @_; - - my $linker = ''; - - # No point in continuing if _OBJECTS is defined. - return if reject_var ($one_file . '_OBJECTS', - $one_file . '_OBJECTS should not be defined'); - - my %used_pfx = (); - my $needlinker; - %linkers_used = (); - foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', - 'dist_EXTRA_', 'nodist_EXTRA_') - { - my $varname = $prefix . $one_file . "_SOURCES"; - my $var = var $varname; - next unless $var; - - # We are going to define _OBJECTS variables using the prefix. - # Then we glom them all together. So we can't use the null - # prefix here as we need it later. - my $xpfx = ($prefix eq '') ? 'am_' : $prefix; - - # Keep track of which prefixes we saw. - $used_pfx{$xpfx} = 1 - unless $prefix =~ /EXTRA_/; - - push @sources, "\$($varname)"; - push @dist_sources, shadow_unconditionally ($varname, $where) - unless (option ('no-dist') || $prefix =~ /^nodist_/); - - $needlinker |= - define_objects_from_sources ($varname, - $xpfx . $one_file . '_OBJECTS', - !!($prefix =~ /EXTRA_/), - $one_file, $obj, $varname, $where, - DIST_SOURCE => ($prefix !~ /^nodist_/), - %transform); - } - if ($needlinker) - { - $linker ||= resolve_linker (%linkers_used); - } - - my @keys = sort keys %used_pfx; - if (scalar @keys == 0) - { - # The default source for libfoo.la is libfoo.c, but for - # backward compatibility we first look at libfoo_la.c, - # if no default source suffix is given. - my $old_default_source = "$one_file.c"; - my $ext_var = var ('AM_DEFAULT_SOURCE_EXT'); - my $default_source_ext = $ext_var ? variable_value ($ext_var) : '.c'; - msg_var ('unsupported', $ext_var, $ext_var->name . " can assume at most one value") - if $default_source_ext =~ /[\t ]/; - (my $default_source = $unxformed) =~ s,(\.[^./\\]*)?$,$default_source_ext,; - # TODO: Remove this backward-compatibility hack in Automake 2.0. - if ($old_default_source ne $default_source - && !$ext_var - && (rule $old_default_source - || rule '$(srcdir)/' . $old_default_source - || rule '${srcdir}/' . $old_default_source - || -f $old_default_source)) - { - my $loc = $where->clone; - $loc->pop_context; - msg ('obsolete', $loc, - "the default source for '$unxformed' has been changed " - . "to '$default_source'.\n(Using '$old_default_source' for " - . "backward compatibility.)"); - $default_source = $old_default_source; - } - # If a rule exists to build this source with a $(srcdir) - # prefix, use that prefix in our variables too. This is for - # the sake of BSD Make. - if (rule '$(srcdir)/' . $default_source - || rule '${srcdir}/' . $default_source) - { - $default_source = '$(srcdir)/' . $default_source; - } - - define_variable ($one_file . "_SOURCES", $default_source, $where); - push (@sources, $default_source); - push (@dist_sources, $default_source); - - %linkers_used = (); - my (@result) = - handle_single_transform ($one_file . '_SOURCES', - $one_file . '_SOURCES', - $one_file, $obj, - $default_source, %transform); - $linker ||= resolve_linker (%linkers_used); - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result); - } - else - { - @keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys; - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys); - } - - # If we want to use 'LINK' we must make sure it is defined. - if ($linker eq '') - { - $need_link = 1; - } - - return $linker; -} - - -# handle_lib_objects ($XNAME, $VAR) -# --------------------------------- -# Special-case ALLOCA and LIBOBJS substitutions in _LDADD or _LIBADD variables. -# Also, generate _DEPENDENCIES variable if appropriate. -# Arguments are: -# transformed name of object being built, or empty string if no object -# name of _LDADD/_LIBADD-type variable to examine -# Returns 1 if LIBOBJS seen, 0 otherwise. -sub handle_lib_objects -{ - my ($xname, $varname) = @_; - - my $var = var ($varname); - prog_error "'$varname' undefined" - unless $var; - prog_error "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 - # lax here since this code also applies to non-libtool - # libraries or programs, for which -dlopen and -dlopreopen - # are pure nonsense. Diagnosing this doesn't seem very - # important: the developer will quickly get complaints from - # the linker.) - $val !~ /^-dl(?:pre)?open$/ && - # Only get this error once. - ! $flagvar) - { - $flagvar = 1; - # FIXME: should display a stack of nested variables - # as context when $var != $subvar. - err_var ($var, "linker flags such as '$val' belong in " - . "'${prefix}LDFLAGS'"); - } - return (); - } - elsif ($val !~ /^\@.*\@$/) - { - # Assume we have a file of some sort, and output it into the - # dependency variable. Autoconf substitutions are not output; - # rarely is a new dependency substituted into e.g. foo_LDADD - # -- but bad things (e.g. -lX11) are routinely substituted. - # Note that LIBOBJS and ALLOCA are exceptions to this rule, - # and handled specially below. - return $val; - } - elsif ($val =~ /^\@(LT)?LIBOBJS\@$/) - { - handle_LIBOBJS ($subvar, $cond, $1); - $seen_libobjs = 1; - return $val; - } - elsif ($val =~ /^\@(LT)?ALLOCA\@$/) - { - handle_ALLOCA ($subvar, $cond, $1); - return $val; - } - else - { - return (); - } - }); - - return $seen_libobjs; -} - -# 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 -{ - my ($var) = @_; - - my $dir = ''; - - # 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 = backname ($relative_dir) . "/$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//; - } - else - { - error ("'\$($var)' cannot be used outside '$config_libobj_dir' if" - . " 'subdir-objects' is not set"); - } - } - - return $dir; -} - -sub handle_LIBOBJS -{ - my ($var, $cond, $lt) = @_; - my $myobjext = $lt ? 'lo' : 'o'; - $lt ||= ''; - - $var->requires_variables ("\@${lt}LIBOBJS\@ used", $lt . 'LIBOBJS') - if ! keys %libsources; - - my $dir = handle_LIBOBJS_or_ALLOCA "${lt}LIBOBJS"; - - foreach my $iter (keys %libsources) - { - if ($iter =~ /\.[cly]$/) - { - saw_extension ($&); - saw_extension ('.c'); - } - - if ($iter =~ /\.h$/) - { - require_libsource_with_macro ($cond, $var, FOREIGN, $iter); - } - elsif ($iter ne 'alloca.c') - { - 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); - } - } - } -} - -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'); -} - -# 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; -} - -# Set up the compile suite. -sub handle_compile () -{ - return if ! $must_handle_compiled_objects; - - # Boilerplate. - my $default_includes = ''; - if (! option 'nostdinc') - { - my @incs = ('-I.', subst ('am__isrc')); - - my $var = var 'CONFIG_HEADER'; - if ($var) - { - foreach my $hdr (split (' ', $var->variable_value)) - { - push @incs, '-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 put @am__isrc@ right after '-I.', without a space. - ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/; - } - - my (@mostly_rms, @dist_rms); - foreach my $item (sort keys %compile_clean_files) - { - if ($compile_clean_files{$item} == MOSTLY_CLEAN) - { - push (@mostly_rms, "\t-rm -f $item"); - } - elsif ($compile_clean_files{$item} == DIST_CLEAN) - { - push (@dist_rms, "\t-rm -f $item"); - } - else - { - prog_error 'invalid entry in %compile_clean_files'; - } - } - - my ($coms, $vars, $rules) = - file_contents_internal (1, "$libdir/am/compile.am", - new Automake::Location, - 'DEFAULT_INCLUDES' => $default_includes, - 'MOSTLYRMS' => join ("\n", @mostly_rms), - 'DISTRMS' => join ("\n", @dist_rms)); - $output_vars .= $vars; - $output_rules .= "$coms$rules"; -} - -# Handle libtool rules. -sub handle_libtool () -{ - return unless var ('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; - - 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"); - } - - check_user_variables 'LIBTOOLFLAGS'; - - # Output the libtool compilation rules. - $output_rules .= file_contents ('libtool', - new Automake::Location, - LTRMS => join ("\n", @libtool_rms)); -} - - -sub handle_programs () -{ - my @proglist = am_install_var ('progs', 'PROGRAMS', - 'bin', 'sbin', 'libexec', 'pkglibexec', - 'noinst', 'check'); - return if ! @proglist; - $must_handle_compiled_objects = 1; - - my $seen_global_libobjs = - var ('LDADD') && handle_lib_objects ('', 'LDADD'); - - foreach my $pair (@proglist) - { - my ($where, $one_file) = @$pair; - - my $seen_libobjs = 0; - my $obj = '.$(OBJEXT)'; - - $known_programs{$one_file} = $where; - - # Canonicalize names and check for misspellings. - my $xname = check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS', - '_SOURCES', '_OBJECTS', - '_DEPENDENCIES'); - - $where->push_context ("while processing program '$one_file'"); - $where->set (INTERNAL->get); - - my $linker = handle_source_transform ($xname, $one_file, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); - - if (var ($xname . "_LDADD")) - { - $seen_libobjs = handle_lib_objects ($xname, $xname . '_LDADD'); - } - else - { - # User didn't define prog_LDADD override. So do it. - define_variable ($xname . '_LDADD', '$(LDADD)', $where); - - # This does a bit too much work. But we need it to - # generate _DEPENDENCIES when appropriate. - if (var ('LDADD')) - { - $seen_libobjs = handle_lib_objects ($xname, 'LDADD'); - } - } - - reject_var ($xname . '_LIBADD', - "use '${xname}_LDADD', not '${xname}_LIBADD'"); - - set_seen ($xname . '_DEPENDENCIES'); - set_seen ('EXTRA_' . $xname . '_DEPENDENCIES'); - set_seen ($xname . '_LDFLAGS'); - - # Determine program to use for link. - my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname); - $vlink = verbose_flag ($vlink || 'GEN'); - - # If the resulting program lies in a subdirectory, - # ensure that the directory exists before we need it. - my $dirstamp = require_build_directory_maybe ($one_file); - - $libtool_clean_directories{dirname ($one_file)} = 1; - - $output_rules .= file_contents ('program', - $where, - PROGRAM => $one_file, - XPROGRAM => $xname, - XLINK => $xlink, - VERBOSE => $vlink, - DIRSTAMP => $dirstamp, - EXEEXT => '$(EXEEXT)'); - - if ($seen_libobjs || $seen_global_libobjs) - { - if (var ($xname . '_LDADD')) - { - check_libobjs_sources ($xname, $xname . '_LDADD'); - } - elsif (var ('LDADD')) - { - check_libobjs_sources ($xname, 'LDADD'); - } - } - } -} - - -sub handle_libraries () -{ - my @liblist = am_install_var ('libs', 'LIBRARIES', - 'lib', 'pkglib', 'noinst', 'check'); - return if ! @liblist; - $must_handle_compiled_objects = 1; - - 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); - define_verbose_tagvar ('AR'); - - foreach my $pair (@liblist) - { - my ($where, $onelib) = @$pair; - - my $seen_libobjs = 0; - # Check that the library fits the standard naming convention. - my $bn = basename ($onelib); - if ($bn !~ /^lib.*\.a$/) - { - $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.a/; - my $suggestion = dirname ($onelib) . "/$bn"; - $suggestion =~ s|^\./||g; - msg ('error-gnu/warn', $where, - "'$onelib' is not a standard library name\n" - . "did you mean '$suggestion'?") - } - - ($known_libraries{$onelib} = $bn) =~ s/\.a$//; - - $where->push_context ("while processing library '$onelib'"); - $where->set (INTERNAL->get); - - my $obj = '.$(OBJEXT)'; - - # Canonicalize names and check for misspellings. - my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES', - '_OBJECTS', '_DEPENDENCIES', - '_AR'); - - if (! var ($xlib . '_AR')) - { - define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where); - } - - # Generate support for conditional object inclusion in - # libraries. - if (var ($xlib . '_LIBADD')) - { - if (handle_lib_objects ($xlib, $xlib . '_LIBADD')) - { - $seen_libobjs = 1; - } - } - else - { - define_variable ($xlib . "_LIBADD", '', $where); - } - - reject_var ($xlib . '_LDADD', - "use '${xlib}_LIBADD', not '${xlib}_LDADD'"); - - # Make sure we at look at this. - set_seen ($xlib . '_DEPENDENCIES'); - set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES'); - - handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); - - # If the resulting library lies in a subdirectory, - # make sure this directory will exist. - my $dirstamp = require_build_directory_maybe ($onelib); - my $verbose = verbose_flag ('AR'); - my $silent = silent_flag (); - - $output_rules .= file_contents ('library', - $where, - VERBOSE => $verbose, - SILENT => $silent, - LIBRARY => $onelib, - XLIBRARY => $xlib, - DIRSTAMP => $dirstamp); - - if ($seen_libobjs) - { - if (var ($xlib . '_LIBADD')) - { - check_libobjs_sources ($xlib, $xlib . '_LIBADD'); - } - } - - if (! $seen_ar) - { - msg ('extra-portability', $where, - "'$onelib': linking libraries using a non-POSIX\n" - . "archiver requires 'AM_PROG_AR' in '$configure_ac'") - } - } -} - - -sub handle_ltlibraries () -{ - my @liblist = am_install_var ('ltlib', 'LTLIBRARIES', - 'noinst', 'lib', 'pkglib', 'check'); - return if ! @liblist; - $must_handle_compiled_objects = 1; - - 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 %instsubdirs = (); - my %instconds = (); - my %liblocations = (); # Location (in Makefile.am) of each library. - - foreach my $key (@prefix) - { - # Get the installation directory of each library. - my $dir = $key; - my $strip_subdir = 1; - if ($dir =~ /^nobase_/) - { - $dir =~ s/^nobase_//; - $strip_subdir = 0; - } - 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; - my $ldir = ''; - $ldir = '/' . dirname ($val) - if (!$strip_subdir); - # A library cannot be installed in different directories - # 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 " . ($strip_subdir ? "in" : "below") . " '$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; - $instsubdirs{$val}{$full_cond} = $ldir; - $liblocations{$val}{$full_cond} = $where; - $instconds{$val} = $instconds{$val}->merge ($full_cond); - }, - sub - { - return (); - }, - skip_ac_subst => 1); - } - - foreach my $pair (@liblist) - { - my ($where, $onelib) = @$pair; - - my $seen_libobjs = 0; - my $obj = '.lo'; - - # Canonicalize names and check for misspellings. - my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS', - '_SOURCES', '_OBJECTS', - '_DEPENDENCIES'); - - # Check that the library fits the standard naming convention. - my $libname_rx = '^lib.*\.la'; - my $ldvar = var ("${xlib}_LDFLAGS") || var ('AM_LDFLAGS'); - my $ldvar2 = var ('LDFLAGS'); - if (($ldvar && grep (/-module/, $ldvar->value_as_list_recursive)) - || ($ldvar2 && grep (/-module/, $ldvar2->value_as_list_recursive))) - { - # Relax name checking for libtool modules. - $libname_rx = '\.la'; - } - - my $bn = basename ($onelib); - if ($bn !~ /$libname_rx$/) - { - my $type = 'library'; - if ($libname_rx eq '\.la') - { - $bn =~ s/^(lib|)(.*?)(?:\.[^.]*)?$/$1$2.la/; - $type = 'module'; - } - else - { - $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.la/; - } - my $suggestion = dirname ($onelib) . "/$bn"; - $suggestion =~ s|^\./||g; - msg ('error-gnu/warn', $where, - "'$onelib' is not a standard libtool $type name\n" - . "did you mean '$suggestion'?") - } - - ($known_libraries{$onelib} = $bn) =~ s/\.la$//; - - $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'); - set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES'); - - # Generate support for conditional object inclusion in - # libraries. - if (var ($xlib . '_LIBADD')) - { - if (handle_lib_objects ($xlib, $xlib . '_LIBADD')) - { - $seen_libobjs = 1; - } - } - else - { - define_variable ($xlib . "_LIBADD", '', $where); - } - - reject_var ("${xlib}_LDADD", - "use '${xlib}_LIBADD', not '${xlib}_LDADD'"); - - - my $linker = handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 0, LIBTOOL => 1); - - # Determine program to use for link. - my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xlib); - $vlink = verbose_flag ($vlink || 'GEN'); - - 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)'); - $val .= $instsubdirs{$onelib}{$rcond} - if defined $instsubdirs{$onelib}{$rcond}; - } - if ($rcond->true) - { - # If $rcond is true there is only one condition and - # there is no point defining an helper variable. - $rpath = $val; - } - else - { - define_pretty_variable ($rpathvar, $rcond, INTERNAL, $val); - } - } - - # If the resulting library lies in a subdirectory, - # make sure this directory will exist. - my $dirstamp = require_build_directory_maybe ($onelib); - - # Remember to cleanup .libs/ in this directory. - my $dirname = dirname $onelib; - $libtool_clean_directories{$dirname} = 1; - - $output_rules .= file_contents ('ltlibrary', - $where, - LTLIBRARY => $onelib, - XLTLIBRARY => $xlib, - RPATH => $rpath, - XLINK => $xlink, - VERBOSE => $vlink, - DIRSTAMP => $dirstamp); - if ($seen_libobjs) - { - if (var ($xlib . '_LIBADD')) - { - check_libobjs_sources ($xlib, $xlib . '_LIBADD'); - } - } - - if (! $seen_ar) - { - msg ('extra-portability', $where, - "'$onelib': linking libtool libraries using a non-POSIX\n" - . "archiver requires 'AM_PROG_AR' in '$configure_ac'") - } - } -} - -# See if any _SOURCES variable were misspelled. -sub check_typos () -{ - # It is ok if the user sets this particular variable. - set_seen 'AM_LDFLAGS'; - - foreach my $primary ('SOURCES', 'LIBADD', 'LDADD', 'LDFLAGS', 'DEPENDENCIES') - { - foreach my $var (variables $primary) - { - my $varname = $var->name; - # A configure variable is always legitimate. - next if exists $configure_vars{$varname}; - - for my $cond ($var->conditions->conds) - { - $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/; - msg_var ('syntax', $var, "variable '$varname' is defined but no" - . " program or\nlibrary has '$1' as canonical name" - . " (possible typo)") - unless $var->rdef ($cond)->seen; - } - } - } -} - - -sub handle_scripts () -{ - # NOTE we no longer automatically clean SCRIPTS, because it is - # useful to sometimes distribute scripts verbatim. This happens - # e.g. in Automake itself. - am_install_var ('-candist', 'scripts', 'SCRIPTS', - 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata', - 'noinst', 'check'); -} - - -## ------------------------ ## -## Handling Texinfo files. ## -## ------------------------ ## - -# ($OUTFILE, $VFILE) -# scan_texinfo_file ($FILENAME) -# ----------------------------- -# $OUTFILE - name of the info file produced by $FILENAME. -# $VFILE - name of the version.texi file used (undef if none). -sub scan_texinfo_file -{ - my ($filename) = @_; - - 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 (index ($outfile, '.') < 0) - { - msg 'obsolete', "$filename:$.", - "use of suffix-less info files is discouraged" - } - elsif ($outfile !~ /\.info$/) - { - error ("$filename:$.", - "output '$outfile' has unrecognized extension"); - return; - } - } - # A "version.texi" file is actually any file whose name matches - # "vers*.texi". - elsif (/^\@include\s+(vers[^.]*\.texi)\s*$/) - { - $vfile = $1; - } - } - - if (! $outfile) - { - err_am "'$filename' missing \@setfilename"; - return; - } - - return ($outfile, $vfile); -} - - -# ($DIRSTAMP, @CLEAN_FILES) -# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES) -# ------------------------------------------------------------------ -# SOURCE - the source Texinfo file -# DEST - the destination Info file -# INSRC - whether DEST should be built in the source tree -# DEPENDENCIES - known dependencies -sub output_texinfo_build_rules -{ - my ($source, $dest, $insrc, @deps) = @_; - - # Split 'a.texi' into 'a' and '.texi'. - my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/); - my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/); - - $ssfx ||= ""; - $dsfx ||= ""; - - # We can output two kinds of rules: the "generic" rules use Make - # suffix rules and are appropriate when $source and $dest do not lie - # in a sub-directory; the "specific" rules are needed in the other - # case. - # - # The former are output only once (this is not really apparent here, - # but just remember that some logic deeper in Automake will not - # output the same rule twice); while the later need to be output for - # each Texinfo source. - my $generic; - my $makeinfoflags; - my $sdir = dirname $source; - if ($sdir eq '.' && dirname ($dest) eq '.') - { - $generic = 1; - $makeinfoflags = '-I $(srcdir)'; - } - else - { - $generic = 0; - $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir"; - } - - # A directory can contain two kinds of info files: some built in the - # source tree, and some built in the build tree. The rules are - # different in each case. However we cannot output two different - # set of generic rules. Because in-source builds are more usual, we - # use generic rules in this case and fall back to "specific" rules - # for build-dir builds. (It should not be a problem to invert this - # if needed.) - $generic = 0 unless $insrc; - - # We cannot use a suffix rule to build info files with an empty - # extension. Otherwise we would output a single suffix inference - # rule, with separate dependencies, as in - # - # .texi: - # $(MAKEINFO) ... - # foo.info: foo.texi - # - # which confuse Solaris make. (See the Autoconf manual for - # details.) Therefore we use a specific rule in this case. This - # applies to info files only (dvi and pdf files always have an - # extension). - my $generic_info = ($generic && $dsfx) ? 1 : 0; - - # If the resulting file lies in 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, - AM_V_MAKEINFO => verbose_flag('MAKEINFO'), - AM_V_TEXI2DVI => verbose_flag('TEXI2DVI'), - AM_V_TEXI2PDF => verbose_flag('TEXI2PDF'), - DEPS => "@deps", - DEST_PREFIX => $dpfx, - DEST_INFO_PREFIX => $dipfx, - DEST_SUFFIX => $dsfx, - DIRSTAMP => $dirstamp, - GENERIC => $generic, - GENERIC_INFO => $generic_info, - INSRC => $insrc, - MAKEINFOFLAGS => $makeinfoflags, - SILENT => silent_flag(), - SOURCE => ($generic - ? '$<' : $source), - SOURCE_INFO => ($generic_info - ? '$<' : $source), - SOURCE_REAL => $source, - SOURCE_SUFFIX => $ssfx, - TEXIQUIET => verbose_flag('texinfo'), - TEXIDEVNULL => verbose_flag('texidevnull'), - ); - return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html"); -} - - -# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN) -# 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 (@mostly_cleans, @texi_cleans, @maint_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; - if ($infobase =~ s/\.texi$//) - { - 1; # Nothing more to do. - } - elsif ($infobase =~ s/\.(txi|texinfo)$//) - { - msg_var 'obsolete', $info_texinfos, - "suffix '.$1' for Texinfo files is discouraged;" . - " use '.texi' instead"; - } - else - { - # 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) = - scan_texinfo_file ("$relative_dir/$texi") - or next; - # Directory of auxiliary files and build by-products used by texi2dvi - # and texi2pdf. - push @mostly_cleans, "$infobase.t2d"; - push @mostly_cleans, "$infobase.t2p"; - - # 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_TEXINFOS = foo.texi - # nodist_foo_TEXINFOS = 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 - # wants to distribute .texi files, but does 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 in two cases: - # (1) 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. - # (2) When the undocumented option 'info-in-builddir' is given. - # This is done to allow the developers of GCC, GDB, GNU - # binutils and the GNU bfd library to force the '.info' files - # to be generated in the builddir rather than the srcdir, as - # was once done when the (now removed) 'cygnus' option was - # given. See automake bug#11034 for more discussion. - my $insrc = 1; - my $soutdir = '$(srcdir)/' . $outdir; - - if (option 'info-in-builddir') - { - $insrc = 0; - } - elsif ($out_file =~ $user_cleaned_files) - { - $insrc = 0; - msg 'obsolete', "$am_file.am", < $texi, - VTI => $vti, - STAMPVTI => "${soutdir}stamp-$vti", - VTEXI => "$soutdir$vtexi", - MDDIR => $conf_dir, - DIRSTAMP => $dirstamp); - } - } - - # Handle location of texinfo.tex. - my $need_texi_file = 0; - my $texinfodir; - if (var ('TEXINFO_TEX')) - { - # The user defined TEXINFO_TEX so assume he knows what he is - # doing. - $texinfodir = ('$(srcdir)/' - . dirname (variable_value ('TEXINFO_TEX'))); - } - elsif ($config_aux_dir_set_in_configure_ac) - { - $texinfodir = $am_config_aux_dir; - define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL); - $need_texi_file = 2; # so that we require_conf_file later - } - else - { - $texinfodir = '$(srcdir)'; - $need_texi_file = 1; - } - define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL); - - push (@dist_targets, 'dist-info'); - - if (! option 'no-installinfo') - { - # Make sure documentation is made and installed first. Use - # $(INFO_DEPS), not 'info', because otherwise recursive makes - # get run twice during "make all". - unshift (@all, '$(INFO_DEPS)'); - } - - define_files_variable ("DVIS", @infobase, 'dvi', INTERNAL); - define_files_variable ("PDFS", @infobase, 'pdf', INTERNAL); - define_files_variable ("PSS", @infobase, 'ps', INTERNAL); - define_files_variable ("HTMLS", @infobase, 'html', INTERNAL); - - # This next isn't strictly needed now -- the places that look here - # could easily be changed to look in info_TEXINFOS. But this is - # probably better, in case noinst_TEXINFOS is ever supported. - define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL); - - # Do some error checking. Note that this file is not required - # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly - # up above. - if ($need_texi_file && ! option 'no-texinfo.tex') - { - if ($need_texi_file > 1) - { - require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); - } - else - { - require_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); - } - } - - return (makefile_wrap ("", "\t ", @mostly_cleans), - makefile_wrap ("", "\t ", @texi_cleans), - makefile_wrap ("", "\t ", @maint_cleans)); -} - - -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 ($mostlyclean, $clean, $maintclean) = ('', '', ''); - if ($info_texinfos) - { - define_verbose_texinfo; - ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos); - chomp $mostlyclean; - chomp $clean; - chomp $maintclean; - } - - $output_rules .= file_contents ('texinfos', - new Automake::Location, - AM_V_DVIPS => verbose_flag('DVIPS'), - MOSTLYCLEAN => $mostlyclean, - TEXICLEAN => $clean, - MAINTCLEAN => $maintclean, - 'LOCAL-TEXIS' => !!$info_texinfos, - TEXIQUIET => verbose_flag('texinfo')); -} - - -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, %notrans_sections, %trans_sections, - %notrans_vars, %trans_vars, %notrans_sect_vars, %trans_sect_vars); - # We handle nodist_ for uniformity. man pages aren't distributed - # by default so it isn't actually very important. - foreach my $npfx ('', 'notrans_') - { - foreach my $pfx ('', 'dist_', 'nodist_') - { - # Add more sections as needed. - foreach my $section ('0'..'9', 'n', 'l') - { - my $varname = $npfx . $pfx . 'man' . $section . '_MANS'; - if (var ($varname)) - { - $sections{$section} = 1; - $varname = '$(' . $varname . ')'; - if ($npfx eq 'notrans_') - { - $notrans_sections{$section} = 1; - $notrans_sect_vars{$varname} = 1; - } - else - { - $trans_sections{$section} = 1; - $trans_sect_vars{$varname} = 1; - } - - push_dist_common ($varname) - if $pfx eq 'dist_'; - } - } - - my $varname = $npfx . $pfx . 'man_MANS'; - my $var = var ($varname); - if ($var) - { - foreach ($var->value_as_list_recursive) - { - # A page like 'foo.1c' goes into man1dir. - if (/\.([0-9a-z])([a-z]*)$/) - { - $sections{$1} = 1; - if ($npfx eq 'notrans_') - { - $notrans_sections{$1} = 1; - } - else - { - $trans_sections{$1} = 1; - } - } - } - - $varname = '$(' . $varname . ')'; - if ($npfx eq 'notrans_') - { - $notrans_vars{$varname} = 1; - } - else - { - $trans_vars{$varname} = 1; - } - push_dist_common ($varname) - if $pfx eq 'dist_'; - } - } - } - - return unless %sections; - - my @unsorted_deps; - - # Build section independent variables. - my $have_notrans = %notrans_vars; - my @notrans_list = sort keys %notrans_vars; - my $have_trans = %trans_vars; - my @trans_list = sort keys %trans_vars; - - # Now for each section, generate an install and uninstall rule. - # Sort sections so output is deterministic. - foreach my $section (sort keys %sections) - { - # Build section dependent variables. - my $notrans_mans = $have_notrans || exists $notrans_sections{$section}; - my $trans_mans = $have_trans || exists $trans_sections{$section}; - my (%notrans_this_sect, %trans_this_sect); - my $expr = 'man' . $section . '_MANS'; - foreach my $varname (keys %notrans_sect_vars) - { - if ($varname =~ /$expr/) - { - $notrans_this_sect{$varname} = 1; - } - } - foreach my $varname (keys %trans_sect_vars) - { - if ($varname =~ /$expr/) - { - $trans_this_sect{$varname} = 1; - } - } - my @notrans_sect_list = sort keys %notrans_this_sect; - my @trans_sect_list = sort keys %trans_this_sect; - @unsorted_deps = (keys %notrans_vars, keys %trans_vars, - keys %notrans_this_sect, keys %trans_this_sect); - my @deps = sort @unsorted_deps; - $output_rules .= file_contents ('mans', - new Automake::Location, - SECTION => $section, - DEPS => "@deps", - NOTRANS_MANS => $notrans_mans, - NOTRANS_SECT_LIST => "@notrans_sect_list", - HAVE_NOTRANS => $have_notrans, - NOTRANS_LIST => "@notrans_list", - TRANS_MANS => $trans_mans, - TRANS_SECT_LIST => "@trans_sect_list", - HAVE_TRANS => $have_trans, - TRANS_LIST => "@trans_list"); - } - - @unsorted_deps = (keys %notrans_vars, keys %trans_vars, - keys %notrans_sect_vars, keys %trans_sect_vars); - my @mans = sort @unsorted_deps; - $output_vars .= file_contents ('mans-vars', - new Automake::Location, - MANS => "@mans"); - - push (@all, '$(MANS)') - unless option 'no-installman'; -} - - -sub handle_data () -{ - am_install_var ('-noextra', '-candist', 'data', 'DATA', - 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf', - 'ps', 'sysconf', 'sharedstate', 'localstate', - 'pkgdata', 'lisp', 'noinst', 'check'); -} - - -sub handle_tags () -{ - 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); - } - } - - define_variable ('am__tagged_files', - '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)' - . "@config", INTERNAL); - - if (rvar('am__tagged_files')->value_as_list_recursive - || var ('ETAGS_ARGS') || var ('SUBDIRS')) - { - $output_rules .= file_contents ('tags', new Automake::Location); - set_seen 'TAGS_DEPENDENCIES'; - } - else - { - reject_var ('TAGS_DEPENDENCIES', - "it doesn't make sense to define 'TAGS_DEPENDENCIES'" - . " without\nsources or 'ETAGS_ARGS'"); - # 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. Ditto ctags and - # cscope. - $output_rules .= - "tags TAGS:\n\n" . - "ctags CTAGS:\n\n" . - "cscope cscopelist:\n\n"; - } -} - - -# user_phony_rule ($NAME) -# ----------------------- -# Return false if rule $NAME does not exist. Otherwise, -# declare it as phony, complete its definition (in case it is -# conditional), and return its Automake::Rule instance. -sub user_phony_rule -{ - my ($name) = @_; - my $rule = rule $name; - if ($rule) - { - depend ('.PHONY', $name); - # Define $NAME in all condition where it is not already defined, - # so that it is always OK to depend on $NAME. - for my $c ($rule->not_always_defined_in_cond (TRUE)->conds) - { - Automake::Rule::define ($name, 'internal', RULE_AUTOMAKE, - $c, INTERNAL); - $output_rules .= $c->subst_string . "$name:\n"; - } - } - return $rule; -} - - -# Handle 'dist' target. -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'; - - # 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-$_" } qw(shar zip tarZ bzip2 lzip xz); - error (option 'no-dist-gzip', - "no-dist-gzip specified but no dist-* specified,\n" - . "at least one archive format must be enabled") - unless $archive_defined; - } - - # Look for common files that should be included in distribution. - # If the aux dir is set, and it does not have a Makefile.am, then - # we check for these files there as well. - my $check_aux = 0; - if ($relative_dir eq '.' - && $config_aux_dir_set_in_configure_ac) - { - if (! is_make_dir ($config_aux_dir)) - { - $check_aux = 1; - } - } - foreach my $cfile (@common_files) - { - if (dir_has_case_matching_file ($relative_dir, $cfile) - # The file might be absent, but if it can be built it's ok. - || rule $cfile) - { - push_dist_common ($cfile); - } - - # Don't use 'elsif' here because a file might meaningfully - # appear in both directories. - if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile)) - { - push_dist_common ("$config_aux_dir/$cfile") - } - } - - # We might copy elements from $configure_dist_common to - # %dist_common if we think we need to. If the file appears in our - # directory, we would have discovered it already, so we don't - # check that. But if the file is in a subdir without a Makefile, - # we want to distribute it here if we are doing '.'. Ugly! - # Also, in some corner cases, it's possible that the following code - # will cause the same file to appear in the $(DIST_COMMON) variables - # of two distinct Makefiles; but this is not a problem, since the - # 'distdir' target in 'lib/am/distdir.am' can deal with the same - # file being distributed multiple times. - # See also automake bug#9651. - if ($relative_dir eq '.') - { - foreach my $file (split (' ' , $configure_dist_common)) - { - my $dir = dirname ($file); - push_dist_common ($file) - if ($dir eq '.' || ! is_make_dir ($dir)); - } - } - - # 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 (@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; - - $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook'; - $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external; - - # If the target 'dist-hook' exists, make sure it is run. This - # allows users to do random weird things to the distribution - # before it is packaged up. - push (@dist_targets, 'dist-hook') - if user_phony_rule 'dist-hook'; - $transform{'DIST-TARGETS'} = join (' ', @dist_targets); - - my $flm = option ('filename-length-max'); - my $filename_filter = $flm ? '.' x $flm->[1] : ''; - - $output_rules .= file_contents ('distdir', - new Automake::Location, - %transform, - FILENAME_FILTER => $filename_filter); -} - - -# check_directory ($NAME, $WHERE [, $RELATIVE_DIR = "."]) -# ------------------------------------------------------- -# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane -# name. Use $WHERE as a location in the diagnostic, if any. -sub check_directory -{ - my ($dir, $where, $reldir) = @_; - $reldir = '.' unless defined $reldir; - - error $where, "required directory $reldir/$dir does not exist" - unless -d "$reldir/$dir"; - - # If an 'obj/' directory exists, BSD make will enter it before - # reading 'Makefile'. Hence the 'Makefile' in the current directory - # will not be read. - # - # % cat Makefile - # all: - # echo Hello - # % cat obj/Makefile - # all: - # echo World - # % make # GNU make - # echo Hello - # Hello - # % pmake # BSD make - # echo World - # World - msg ('portability', $where, - "naming a subdirectory 'obj' causes troubles with BSD make") - if $dir eq 'obj'; - - # 'aux' is probably the most important of the following forbidden name, - # since it's tempting to use it as an AC_CONFIG_AUX_DIR. - msg ('portability', $where, - "name '$dir' is reserved on W32 and DOS platforms") - if grep (/^\Q$dir\E$/i, qw/aux lpt1 lpt2 lpt3 com1 com2 com3 com4 con prn/); -} - -# check_directories_in_var ($VARIABLE) -# ------------------------------------ -# Recursively check all items in variables $VARIABLE as directories -sub check_directories_in_var -{ - my ($var) = @_; - $var->traverse_recursively - (sub - { - my ($var, $val, $cond, $full_cond) = @_; - check_directory ($val, $var->rdef ($cond)->location, $relative_dir); - return (); - }, - undef, - skip_ac_subst => 1); -} - - -sub handle_subdirs () -{ - my $subdirs = var ('SUBDIRS'); - return - unless $subdirs; - - check_directories_in_var $subdirs; - - my $dsubdirs = var ('DIST_SUBDIRS'); - check_directories_in_var $dsubdirs - if $dsubdirs; - - $output_rules .= file_contents ('subdirs', new Automake::Location); - rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross! -} - - -# ($REGEN, @DEPENDENCIES) -# scan_aclocal_m4 -# --------------- -# If aclocal.m4 creation is automated, return the list of its dependencies. -sub scan_aclocal_m4 () -{ - my $regen_aclocal = 0; - - set_seen 'CONFIG_STATUS_DEPENDENCIES'; - set_seen 'CONFIGURE_DEPENDENCIES'; - - if (-f 'aclocal.m4') - { - define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL); - - my $aclocal = new Automake::XFile "< aclocal.m4"; - my $line = $aclocal->getline; - $regen_aclocal = $line =~ 'generated automatically by aclocal'; - } - - my @ac_deps = (); - - if (set_seen ('ACLOCAL_M4_SOURCES')) - { - push (@ac_deps, '$(ACLOCAL_M4_SOURCES)'); - msg_var ('obsolete', 'ACLOCAL_M4_SOURCES', - "'ACLOCAL_M4_SOURCES' is obsolete.\n" - . "It should be safe to simply remove it"); - } - - # Note that it might be possible that aclocal.m4 doesn't exist but - # should be auto-generated. This case probably isn't very - # important. - - return ($regen_aclocal, @ac_deps); -} - - -# 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 (dirname ($single) eq $relative_dir) - { - push (@newinputs, '$(srcdir)/' . basename ($single)); - } - else - { - push (@newinputs, '$(top_srcdir)/' . $single); - } - } - return @newinputs; -} - -# @DEPENDENCIES -# rewrite_inputs_into_dependencies ($OUTPUT, @INPUTS) -# --------------------------------------------------- -# Compute a list of dependencies appropriate for the rebuild -# rule of -# AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...) -# Also distribute $INPUTs which are not built by another AC_CONFIG_FOOs. -sub rewrite_inputs_into_dependencies -{ - my ($file, @inputs) = @_; - my @res = (); - - for my $i (@inputs) - { - # We cannot create dependencies on shell variables. - next if (substitute_ac_subst_variables $i) =~ /\$/; - - if (exists $ac_config_files_location{$i} && $i ne $file) - { - my $di = dirname $i; - if ($di eq $relative_dir) - { - $i = basename $i; - } - # In the top-level Makefile we do not use $(top_builddir), because - # we are already there, and since the targets are built without - # a $(top_builddir), it helps BSD Make to match them with - # dependencies. - elsif ($relative_dir ne '.') - { - $i = '$(top_builddir)/' . $i; - } - } - else - { - msg ('error', $ac_config_files_location{$file}, - "required file '$i' not found") - unless $i =~ /\$/ || exists $output_files{$i} || -f $i; - ($i) = prepend_srcdir ($i); - push_dist_common ($i); - } - push @res, $i; - } - return @res; -} - - - -# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS) -# ----------------------------------------------------------------- -# Handle remaking and configure stuff. -# We need the name of the input file, to do proper remaking rules. -sub handle_configure -{ - my ($makefile_am, $makefile_in, $makefile, @inputs) = @_; - - prog_error 'empty @inputs' - unless @inputs; - - my ($rel_makefile_am, $rel_makefile_in) = prepend_srcdir ($makefile_am, - $makefile_in); - my $rel_makefile = basename $makefile; - - my $colon_infile = ':' . join (':', @inputs); - $colon_infile = '' if $colon_infile eq ":$makefile.in"; - my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs); - my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4; - define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL, - @configure_deps, @aclocal_m4_deps, - '$(top_srcdir)/' . $configure_ac); - my @configuredeps = ('$(am__aclocal_m4_deps)', '$(CONFIGURE_DEPENDENCIES)'); - push @configuredeps, '$(ACLOCAL_M4)' if -f 'aclocal.m4'; - define_pretty_variable ('am__configure_deps', TRUE, INTERNAL, - @configuredeps); - - my $automake_options = '--' . $strictness_name . - (global_option 'no-dependencies' ? ' --ignore-deps' : ''); - - $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, - 'HAVE-MAKEFILE-IN-DEPS' => (@include_stack > 0), - 'MAKEFILE-IN-DEPS' => "@include_stack", - 'MAKEFILE-AM' => $rel_makefile_am, - 'AUTOMAKE-OPTIONS' => $automake_options, - 'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile", - 'REGEN-ACLOCAL-M4' => $regen_aclocal_m4, - VERBOSE => verbose_flag ('GEN')); - - if ($relative_dir eq '.') - { - push_dist_common ('acconfig.h') - if -f 'acconfig.h'; - } - - # If we have a configure header, require it. - my $hdr_index = 0; - my @distclean_config; - foreach my $spec (@config_headers) - { - $hdr_index += 1; - # $CONFIG_H_PATH: config.h from top level. - my ($config_h_path, @ins) = split_config_file_spec ($spec); - my $config_h_dir = dirname ($config_h_path); - - # If the header is in the current directory we want to build - # the header here. Otherwise, if we're at the topmost - # directory and the header's directory doesn't have a - # Makefile, then we also want to build the header. - if ($relative_dir eq $config_h_dir - || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir))) - { - my ($cn_sans_dir, $stamp_dir); - if ($relative_dir eq $config_h_dir) - { - $cn_sans_dir = basename ($config_h_path); - $stamp_dir = ''; - } - else - { - $cn_sans_dir = $config_h_path; - if ($config_h_dir eq '.') - { - $stamp_dir = ''; - } - else - { - $stamp_dir = $config_h_dir . '/'; - } - } - - # This will also distribute all inputs. - @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins); - - # Cannot define rebuild rules for filenames with shell variables. - next if (substitute_ac_subst_variables $config_h_path) =~ /\$/; - - # Header defined in this directory. - my @files; - if (-f $config_h_path . '.top') - { - push (@files, "$cn_sans_dir.top"); - } - if (-f $config_h_path . '.bot') - { - push (@files, "$cn_sans_dir.bot"); - } - - push_dist_common (@files); - - # For now, acconfig.h can only appear in the top srcdir. - if (-f 'acconfig.h') - { - push (@files, '$(top_srcdir)/acconfig.h'); - } - - my $stamp = "${stamp_dir}stamp-h${hdr_index}"; - $output_rules .= - file_contents ('remake-hdr', - new Automake::Location, - FILES => "@files", - 'FIRST-HDR' => ($hdr_index == 1), - CONFIG_H => $cn_sans_dir, - CONFIG_HIN => $ins[0], - CONFIG_H_DEPS => "@ins", - CONFIG_H_PATH => $config_h_path, - STAMP => "$stamp"); - - push @distclean_config, $cn_sans_dir, $stamp; - } - } - - $output_rules .= file_contents ('clean-hdr', - new Automake::Location, - FILES => "@distclean_config") - if @distclean_config; - - # Distribute and define mkinstalldirs only if it is already present - # in the package, for backward compatibility (some people may still - # use $(mkinstalldirs)). - # TODO: start warning about this in Automake 1.14, and have - # TODO: Automake 2.0 drop it (and the mkinstalldirs script - # TODO: as well). - 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); - } - - reject_var ('CONFIG_HEADER', - "'CONFIG_HEADER' is an anachronism; now determined " - . "automatically\nfrom '$configure_ac'"); - - my @config_h; - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - # Generate CONFIG_HEADER define. - if ($relative_dir eq dirname ($out)) - { - push @config_h, basename ($out); - } - else - { - push @config_h, "\$(top_builddir)/$out"; - } - } - define_variable ("CONFIG_HEADER", "@config_h", INTERNAL) - if @config_h; - - # Now look for other files in this directory which must be remade - # by config.status, and generate rules for them. - my @actual_other_files = (); - # These get cleaned only in a VPATH build. - my @actual_other_vpath_files = (); - foreach my $lfile (@other_input_files) - { - my $file; - my @inputs; - if ($lfile =~ /^([^:]*):(.*)$/) - { - # This is the ":" syntax of AC_OUTPUT. - $file = $1; - @inputs = split (':', $2); - } - else - { - # Normal usage. - $file = $lfile; - @inputs = $file . '.in'; - } - - # Automake files should not be stored in here, but in %MAKE_LIST. - prog_error ("$lfile in \@other_input_files\n" - . "\@other_input_files = (@other_input_files)") - if -f $file . '.am'; - - my $local = basename ($file); - - # We skip files that aren't in this directory. However, if - # the file's directory does not have a Makefile, and we are - # currently doing '.', then we create a rule to rebuild the - # file in the subdir. - my $fd = dirname ($file); - if ($fd ne $relative_dir) - { - if ($relative_dir eq '.' && ! is_make_dir ($fd)) - { - $local = $file; - } - else - { - next; - } - } - - my @rewritten_inputs = rewrite_inputs_into_dependencies ($file, @inputs); - - # Cannot output rules for shell variables. - next if (substitute_ac_subst_variables $local) =~ /\$/; - - my $condstr = ''; - my $cond = $ac_config_files_condition{$lfile}; - if (defined $cond) - { - $condstr = $cond->subst_string; - Automake::Rule::define ($local, $configure_ac, RULE_AUTOMAKE, $cond, - $ac_config_files_location{$file}); - } - $output_rules .= ($condstr . $local . ': ' - . '$(top_builddir)/config.status ' - . "@rewritten_inputs\n" - . $condstr . "\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 links that aren't in this directory. However, if - # the link's directory does not have a Makefile, and we are - # currently doing '.', then we add the link to CONFIG_CLEAN_FILES - # in '.'s Makefile.in. - my $local = basename ($link); - my $fd = dirname ($link); - if ($fd ne $relative_dir) - { - if ($relative_dir eq '.' && ! is_make_dir ($fd)) - { - $local = $link; - } - else - { - $local = undef; - } - } - if ($file ne $link) - { - push @actual_other_files, $local if $local; - } - else - { - push @actual_other_vpath_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))) - { - # The following will distribute $file as a side-effect when - # it is appropriate (i.e., when $file is not already an output). - # We do not need the result, just the side-effect. - rewrite_inputs_into_dependencies ($link, $file); - } - } - } - - # These files get removed by "make distclean". - define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL, - @actual_other_files); - define_pretty_variable ('CONFIG_CLEAN_VPATH_FILES', TRUE, INTERNAL, - @actual_other_vpath_files); -} - -sub handle_headers () -{ - my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include', - 'oldinclude', 'pkginclude', - 'noinst', 'check'); - foreach (@r) - { - next unless $_->[1] =~ /\..*$/; - saw_extension ($&); - } -} - -sub handle_gettext () -{ - return if ! $seen_gettext || $relative_dir ne '.'; - - my $subdirs = var 'SUBDIRS'; - - if (! $subdirs) - { - err_ac "AM_GNU_GETTEXT used but SUBDIRS not defined"; - return; - } - - # Perform some sanity checks to help users get the right setup. - # We disable these tests when po/ doesn't exist in order not to disallow - # unusual gettext setups. - # - # Bruno Haible: - # | The idea is: - # | - # | 1) If a package doesn't have a directory po/ at top level, it - # | will likely have multiple po/ directories in subpackages. - # | - # | 2) It is useful to warn for the absence of intl/ if AM_GNU_GETTEXT - # | is used without 'external'. It is also useful to warn for the - # | presence of intl/ if AM_GNU_GETTEXT([external]) is used. Both - # | warnings apply only to the usual layout of packages, therefore - # | they should both be disabled if no po/ directory is found at - # | top level. - - if (-d 'po') - { - my @subdirs = $subdirs->value_as_list_recursive; - - msg_var ('syntax', $subdirs, - "AM_GNU_GETTEXT used but 'po' not in SUBDIRS") - if ! grep ($_ eq 'po', @subdirs); - - # intl/ is not required when AM_GNU_GETTEXT is called with the - # 'external' option 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)); - } - - require_file ($ac_gettext_location, GNU, 'ABOUT-NLS'); -} - -# Emit makefile footer. -sub handle_footer () -{ - reject_rule ('.SUFFIXES', - "use variable 'SUFFIXES', not target '.SUFFIXES'"); - - # Note: AIX 4.1 /bin/make will fail if any suffix rule appears - # before .SUFFIXES. So we make sure that .SUFFIXES appears before - # anything else, by sticking it right after the default: target. - $output_header .= ".SUFFIXES:\n"; - my $suffixes = var 'SUFFIXES'; - my @suffixes = Automake::Rule::suffixes; - if (@suffixes || $suffixes) - { - # Make sure SUFFIXES has unique elements. Sort them to ensure - # the output remains consistent. However, $(SUFFIXES) is - # always at the start of the list, unsorted. This is done - # because make will choose rules depending on the ordering of - # suffixes, and this lets the user have some control. Push - # actual suffixes, and not $(SUFFIXES). Some versions of make - # do not like variable substitutions on the .SUFFIXES line. - my @user_suffixes = ($suffixes - ? $suffixes->value_as_list_recursive : ()); - - my %suffixes = map { $_ => 1 } @suffixes; - delete @suffixes{@user_suffixes}; - - $output_header .= (".SUFFIXES: " - . join (' ', @user_suffixes, sort keys %suffixes) - . "\n"); - } - - $output_trailer .= file_contents ('footer', new Automake::Location); -} - - -# Generate 'make install' rules. -sub handle_install () -{ - $output_rules .= file_contents - ('install', - new Automake::Location, - maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES') - ? (" \$(BUILT_SOURCES)\n" - . "\t\$(MAKE) \$(AM_MAKEFLAGS)") - : ''), - 'installdirs-local' => (user_phony_rule ('installdirs-local') - ? ' installdirs-local' : ''), - am__installdirs => variable_value ('am__installdirs') || ''); -} - - -# handle_all ($MAKEFILE) -#----------------------- -# Deal with 'all' and 'all-am'. -sub handle_all -{ - my ($makefile) = @_; - - # Output 'all-am'. - - # Put this at the beginning for the sake of non-GNU makes. This - # is still wrong if these makes can run parallel jobs. But it is - # right enough. - unshift (@all, basename ($makefile)); - - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push (@all, basename ($out)) - if dirname ($out) eq $relative_dir; - } - - # Install 'all' hooks. - push (@all, "all-local") - if user_phony_rule "all-local"; - - pretty_print_rule ("all-am:", "\t\t", @all); - depend ('.PHONY', 'all-am', 'all'); - - - # Output 'all'. - - my @local_headers = (); - push @local_headers, '$(BUILT_SOURCES)' - if var ('BUILT_SOURCES'); - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push @local_headers, basename ($out) - if dirname ($out) eq $relative_dir; - } - - if (@local_headers) - { - # We need to make sure config.h is built before we recurse. - # We also want to make sure that built sources are built - # before any ordinary 'all' targets are run. We can't do this - # by changing the order of dependencies to the "all" because - # that breaks when using parallel makes. Instead we handle - # things explicitly. - $output_all .= ("all: @local_headers" - . "\n\t" - . '$(MAKE) $(AM_MAKEFLAGS) ' - . (var ('SUBDIRS') ? 'all-recursive' : 'all-am') - . "\n\n"); - depend ('.MAKE', 'all'); - } - else - { - $output_all .= "all: " . (var ('SUBDIRS') - ? 'all-recursive' : 'all-am') . "\n\n"; - } -} - -# Generate helper targets for user-defined recursive targets, where needed. -sub handle_user_recursion () -{ - return unless @extra_recursive_targets; - - define_pretty_variable ('am__extra_recursive_targets', TRUE, INTERNAL, - map { "$_-recursive" } @extra_recursive_targets); - my $aux = var ('SUBDIRS') ? 'recursive' : 'am'; - foreach my $target (@extra_recursive_targets) - { - # This allows the default target's rules to be overridden in - # Makefile.am. - user_phony_rule ($target); - depend ("$target", "$target-$aux"); - depend ("$target-am", "$target-local"); - # Every user-defined recursive target 'foo' *must* have a valid - # associated 'foo-local' rule; we define it as an empty rule by - # default, so that the user can transparently extend it in his - # own Makefile.am. - pretty_print_rule ("$target-local:", '', ''); - # $target-recursive might as well be undefined, so do not add - # it here; it's taken care of in subdirs.am anyway. - depend (".PHONY", "$target-am", "$target-local"); - } -} - - -# Handle check merge target specially. -sub do_check_merge_target () -{ - # Include user-defined local form of target. - push @check_tests, 'check-local' - if user_phony_rule 'check-local'; - - # 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"; - if (@check) - { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check); - depend ('.MAKE', 'check-am'); - } - - if (@check_tests) - { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", - @check_tests); - depend ('.MAKE', 'check-am'); - } - - 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"); - depend ('.MAKE', 'check') - if var ('BUILT_SOURCES'); -} - -# Handle all 'clean' targets. -sub handle_clean -{ - my ($makefile) = @_; - - # Clean the files listed in user variables if they exist. - $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN - if var ('MOSTLYCLEANFILES'); - $clean_files{'$(CLEANFILES)'} = CLEAN - if var ('CLEANFILES'); - $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN - if var ('DISTCLEANFILES'); - $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN - if var ('MAINTAINERCLEANFILES'); - - # Built sources are automatically removed by maintainer-clean. - $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN - if var ('BUILT_SOURCES'); - - # Compute a list of "rm"s to run for each target. - my %rms = (MOSTLY_CLEAN, [], - CLEAN, [], - DIST_CLEAN, [], - MAINTAINER_CLEAN, []); - - foreach my $file (keys %clean_files) - { - my $when = $clean_files{$file}; - prog_error 'invalid entry in %clean_files' - unless exists $rms{$when}; - - my $rm = "rm -f $file"; - # If file is a variable, make sure when don't call 'rm -f' without args. - $rm ="test -z \"$file\" || $rm" - if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/); - - push @{$rms{$when}}, "\t-$rm\n"; - } - - $output_rules .= file_contents - ('clean', - new Automake::Location, - MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}), - CLEAN_RMS => join ('', sort @{$rms{&CLEAN}}), - DISTCLEAN_RMS => join ('', sort @{$rms{&DIST_CLEAN}}), - MAINTAINER_CLEAN_RMS => join ('', sort @{$rms{&MAINTAINER_CLEAN}}), - MAKEFILE => basename $makefile, - ); -} - - -# Subroutine for handle_factored_dependencies() to let '.PHONY' and -# other '.TARGETS' be last. This is meant to be used as a comparison -# subroutine passed to the sort built-int. -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; -} - - -# 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', - 'uninstall-dvi-local', - 'uninstall-html-local', - 'uninstall-info-local', - 'uninstall-pdf-local', - 'uninstall-ps-local') - { - my $x = $utarg; - $x =~ s/-.*-/-/; - reject_rule ($utarg, "use '$x', not '$utarg'"); - } - - reject_rule ('install-local', - "use 'install-data-local' or 'install-exec-local', " - . "not 'install-local'"); - - reject_rule ('install-hook', - "use 'install-data-hook' or 'install-exec-hook', " - . "not 'install-hook'"); - - # Install the -local hooks. - foreach (keys %dependencies) - { - # Hooks are installed on the -am targets. - s/-am$// or next; - depend ("$_-am", "$_-local") - if user_phony_rule "$_-local"; - } - - # Install the -hook hooks. - # FIXME: Why not be as liberal as we are with -local hooks? - foreach ('install-exec', 'install-data', 'uninstall') - { - if (user_phony_rule "$_-hook") - { - depend ('.MAKE', "$_-am"); - register_action("$_-am", - ("\t\@\$(NORMAL_INSTALL)\n" - . "\t\$(MAKE) \$(AM_MAKEFLAGS) $_-hook")); - } - } - - # All the required targets are phony. - depend ('.PHONY', keys %required_targets); - - # Actually output gathered targets. - foreach (sort target_cmp keys %dependencies) - { - # If there is nothing about this guy, skip it. - next - unless (@{$dependencies{$_}} - || $actions{$_} - || $required_targets{$_}); - - # Define gathered targets in undefined conditions. - # FIXME: Right now we must handle .PHONY as an exception, - # because people write things like - # .PHONY: myphonytarget - # to append dependencies. This would not work if Automake - # refrained from defining its own .PHONY target as it does - # with other overridden targets. - # 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"; - } - } -} - - -sub handle_tests_dejagnu () -{ - push (@check_tests, 'check-DEJAGNU'); - $output_rules .= file_contents ('dejagnu', new Automake::Location); -} - -# handle_per_suffix_test ($TEST_SUFFIX, [%TRANSFORM]) -#---------------------------------------------------- -sub handle_per_suffix_test -{ - my ($test_suffix, %transform) = @_; - my ($pfx, $generic, $am_exeext); - if ($test_suffix eq '') - { - $pfx = ''; - $generic = 0; - $am_exeext = 'FALSE'; - } - else - { - prog_error ("test suffix '$test_suffix' lacks leading dot") - unless $test_suffix =~ m/^\.(.*)/; - $pfx = uc ($1) . '_'; - $generic = 1; - $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT' - : 'FALSE'; - } - # The "test driver" program, deputed to handle tests protocol used by - # test scripts. By default, it's assumed that no protocol is used, so - # we fall back to the old behaviour, implemented by the 'test-driver' - # auxiliary script. - if (! var "${pfx}LOG_DRIVER") - { - require_conf_file ("parallel-tests", FOREIGN, 'test-driver'); - define_variable ("${pfx}LOG_DRIVER", - "\$(SHELL) $am_config_aux_dir/test-driver", - INTERNAL); - } - my $driver = '$(' . $pfx . 'LOG_DRIVER)'; - my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)' - . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)'; - my $compile = "${pfx}LOG_COMPILE"; - define_variable ($compile, - '$(' . $pfx . 'LOG_COMPILER)' - . ' $(AM_' . $pfx . 'LOG_FLAGS)' - . ' $(' . $pfx . 'LOG_FLAGS)', - INTERNAL); - $output_rules .= file_contents ('check2', new Automake::Location, - GENERIC => $generic, - DRIVER => $driver, - DRIVER_FLAGS => $driver_flags, - COMPILE => '$(' . $compile . ')', - EXT => $test_suffix, - am__EXEEXT => $am_exeext, - %transform); -} - -# is_valid_test_extension ($EXT) -# ------------------------------ -# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false -# otherwise. -sub is_valid_test_extension -{ - my $ext = shift; - return 1 - if ($ext =~ /^\.[a-zA-Z_][a-zA-Z0-9_]*$/); - return 1 - if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT')); - return 0; -} - - -sub handle_tests () -{ - if (option 'dejagnu') - { - handle_tests_dejagnu; - } - else - { - foreach my $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS') - { - reject_var ($c, "'$c' defined but 'dejagnu' not in " - . "'AUTOMAKE_OPTIONS'"); - } - } - - if (var ('TESTS')) - { - push (@check_tests, 'check-TESTS'); - my $check_deps = "@check"; - $output_rules .= file_contents ('check', new Automake::Location, - SERIAL_TESTS => !! option 'serial-tests', - CHECK_DEPS => $check_deps); - - # Tests that are known programs should have $(EXEEXT) appended. - # For matching purposes, we need to adjust XFAIL_TESTS as well. - append_exeext { exists $known_programs{$_[0]} } 'TESTS'; - append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS' - if (var ('XFAIL_TESTS')); - - if (! option 'serial-tests') - { - define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL); - my $suff = '.test'; - my $at_exeext = ''; - my $handle_exeext = exists $configure_vars{'EXEEXT'}; - if ($handle_exeext) - { - $at_exeext = subst ('EXEEXT'); - $suff = $at_exeext . ' ' . $suff; - } - if (! var 'TEST_EXTENSIONS') - { - define_variable ('TEST_EXTENSIONS', $suff, INTERNAL); - } - my $var = var 'TEST_EXTENSIONS'; - # Currently, we are not able to deal with conditional contents - # in TEST_EXTENSIONS. - if ($var->has_conditional_contents) - { - msg_var 'unsupported', $var, - "'TEST_EXTENSIONS' cannot have conditional contents"; - } - my @test_suffixes = $var->value_as_list_recursive; - if ((my @invalid_test_suffixes = - grep { !is_valid_test_extension $_ } @test_suffixes) > 0) - { - error $var->rdef (TRUE)->location, - "invalid test extensions: @invalid_test_suffixes"; - } - @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes; - if ($handle_exeext) - { - unshift (@test_suffixes, $at_exeext) - unless $test_suffixes[0] eq $at_exeext; - } - unshift (@test_suffixes, ''); - - transform_variable_recursively - ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL, - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - my $obj = $val; - return $obj - if $val =~ /^\@.*\@$/; - $obj =~ s/\$\(EXEEXT\)$//o; - - if ($val =~ /(\$\((top_)?srcdir\))\//o) - { - msg ('error', $subvar->rdef ($cond)->location, - "using '$1' in TESTS is currently broken: '$val'"); - } - - foreach my $test_suffix (@test_suffixes) - { - next - if $test_suffix eq $at_exeext || $test_suffix eq ''; - return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log' - if substr ($obj, - length ($test_suffix)) eq $test_suffix; - } - my $base = $obj; - $obj .= '.log'; - handle_per_suffix_test ('', - OBJ => $obj, - BASE => $base, - SOURCE => $val); - return $obj; - }); - - my $nhelper=1; - my $prev = 'TESTS'; - my $post = ''; - my $last_suffix = $test_suffixes[$#test_suffixes]; - my $cur = ''; - foreach my $test_suffix (@test_suffixes) - { - if ($test_suffix eq $last_suffix) - { - $cur = 'TEST_LOGS'; - } - else - { - $cur = 'am__test_logs' . $nhelper; - } - define_variable ($cur, - '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL); - $post = '.log'; - $prev = $cur; - $nhelper++; - if ($test_suffix ne $at_exeext && $test_suffix ne '') - { - handle_per_suffix_test ($test_suffix, - OBJ => '', - BASE => '$*', - SOURCE => '$<'); - } - } - $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN; - } - } -} - -sub handle_emacs_lisp () -{ - my @elfiles = am_install_var ('-candist', 'lisp', 'LISP', - 'lisp', 'noinst'); - - return if ! @elfiles; - - define_pretty_variable ('am__ELFILES', TRUE, INTERNAL, - map { $_->[1] } @elfiles); - define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL, - '$(am__ELFILES:.el=.elc)'); - # This one can be overridden by users. - define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(LISP:.el=.elc)'); - - push @all, '$(ELCFILES)'; - - require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE, - 'EMACS', 'lispdir'); -} - -sub handle_python () -{ - my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON', - 'noinst'); - return if ! @pyfiles; - - require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON'); - require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile'); - define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL); -} - -sub handle_java () -{ - my @sourcelist = am_install_var ('-candist', - 'java', 'JAVA', - 'noinst', 'check'); - return if ! @sourcelist; - - my @prefixes = am_primary_prefixes ('JAVA', 1, - 'noinst', 'check'); - - my $dir; - my @java_sources = (); - foreach my $prefix (@prefixes) - { - (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//; - - next - if $curs eq 'EXTRA'; - - push @java_sources, '$(' . $prefix . '_JAVA' . ')'; - - if (defined $dir) - { - err_var "${curs}_JAVA", "multiple _JAVA primaries in use" - unless $curs eq $dir; - } - - $dir = $curs; - } - - define_pretty_variable ('am__java_sources', TRUE, INTERNAL, - "@java_sources"); - - if ($dir eq 'check') - { - push (@check, "class$dir.stamp"); - } - else - { - push (@all, "class$dir.stamp"); - } -} - - -sub handle_minor_options () -{ - if (option 'readme-alpha') - { - if ($relative_dir eq '.') - { - if ($package_version !~ /^$GNITS_VERSION_PATTERN$/) - { - msg ('error-gnits', $package_version_location, - "version '$package_version' doesn't follow " . - "Gnits standards"); - } - if (defined $1 && -f 'README-alpha') - { - # This means we have an alpha release. See - # GNITS_VERSION_PATTERN for details. - push_dist_common ('README-alpha'); - } - } - } -} - -################################################################ - -# ($OUTPUT, @INPUTS) -# split_config_file_spec ($SPEC) -# ------------------------------ -# Decode the Autoconf syntax for config files (files, headers, links -# etc.). -sub split_config_file_spec -{ - my ($spec) = @_; - my ($output, @inputs) = split (/:/, $spec); - - push @inputs, "$output.in" - unless @inputs; - - return ($output, @inputs); -} - -# $input -# locate_am (@POSSIBLE_SOURCES) -# ----------------------------- -# AC_CONFIG_FILES allow specifications such as Makefile:top.in:mid.in:bot.in -# This functions returns the first *.in file for which a *.am exists. -# It returns undef otherwise. -sub locate_am -{ - my (@rest) = @_; - my $input; - foreach my $file (@rest) - { - if (($file =~ /^(.*)\.in$/) && -f "$1.am") - { - $input = $file; - last; - } - } - return $input; -} - -my %make_list; - -# scan_autoconf_config_files ($WHERE, $CONFIG-FILES) -# -------------------------------------------------- -# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES -# (or AC_OUTPUT). -sub scan_autoconf_config_files -{ - my ($where, $config_files) = @_; - - # Look at potential Makefile.am's. - foreach (split ' ', $config_files) - { - # Must skip empty string for Perl 4. - next if $_ eq "\\" || $_ eq ''; - - # Handle $local:$input syntax. - my ($local, @rest) = split (/:/); - @rest = ("$local.in",) unless @rest; - # Keep in sync with test 'conffile-leading-dot.sh'. - msg ('unsupported', $where, - "omit leading './' from config file names such as '$local';" - . "\nremake rules might be subtly broken otherwise") - if ($local =~ /^\.\//); - my $input = locate_am @rest; - if ($input) - { - # We have a file that automake should generate. - $make_list{$input} = join (':', ($local, @rest)); - } - else - { - # We have a file that automake should cause to be - # rebuilt, but shouldn't generate itself. - push (@other_input_files, $_); - } - $ac_config_files_location{$local} = $where; - $ac_config_files_condition{$local} = - new Automake::Condition (@cond_stack) - if (@cond_stack); - } -} - - -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_FC_SRCEXT => 1, - AC_INIT => 0, - AC_LIBSOURCE => 1, - AC_REQUIRE_AUX_FILE => 1, - AC_SUBST_TRACE => 1, - AM_AUTOMAKE_VERSION => 1, - AM_PROG_MKDIR_P => 0, - AM_CONDITIONAL => 2, - AM_EXTRA_RECURSIVE_TARGETS => 1, - AM_GNU_GETTEXT => 0, - AM_GNU_GETTEXT_INTL_SUBDIR => 0, - AM_INIT_AUTOMAKE => 0, - AM_MAINTAINER_MODE => 0, - AM_PROG_AR => 0, - _AM_SUBST_NOTMAKE => 1, - _AM_COND_IF => 1, - _AM_COND_ELSE => 1, - _AM_COND_ENDIF => 1, - LT_SUPPORTED_TAG => 1, - _LT_AC_TAGCONFIG => 0, - m4_include => 1, - m4_sinclude => 1, - sinclude => 1, - ); - - 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::\$d::\$n::\${::}%' } - (keys %traced)); - - my $tracefh = new Automake::XFile ("$traces $filename |"); - verb "reading $traces"; - - @cond_stack = (); - my $where; - - while ($_ = $tracefh->getline) - { - chomp; - my ($here, $depth, @args) = split (/::/); - $where = new Automake::Location $here; - my $macro = $args[0]; - - prog_error ("unrequested trace '$macro'") - unless exists $traced{$macro}; - - # Skip and diagnose malformed calls. - if ($#args < $traced{$macro}) - { - msg ('syntax', $where, "not enough arguments for $macro"); - next; - } - - # Alphabetical ordering please. - if ($macro eq 'AC_CANONICAL_BUILD') - { - if ($seen_canonical <= AC_CANONICAL_BUILD) - { - $seen_canonical = AC_CANONICAL_BUILD; - } - } - elsif ($macro eq 'AC_CANONICAL_HOST') - { - if ($seen_canonical <= AC_CANONICAL_HOST) - { - $seen_canonical = AC_CANONICAL_HOST; - } - } - elsif ($macro eq 'AC_CANONICAL_TARGET') - { - $seen_canonical = AC_CANONICAL_TARGET; - } - 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; - check_directory ($config_aux_dir, $where); - } - elsif ($macro eq 'AC_CONFIG_FILES') - { - # Look at potential Makefile.am's. - scan_autoconf_config_files ($where, $args[1]); - } - elsif ($macro eq 'AC_CONFIG_HEADERS') - { - foreach my $spec (split (' ', $args[1])) - { - my ($dest, @src) = split (':', $spec); - $ac_config_files_location{$dest} = $where; - push @config_headers, $spec; - } - } - elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR') - { - $config_libobj_dir = $args[1]; - 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; - } - } - elsif ($macro eq 'AC_FC_SRCEXT') - { - my $suffix = $args[1]; - # These flags are used as %SOURCEFLAG% in depend2.am, - # where the trailing space is important. - $sourceflags{'.' . $suffix} = '$(FCFLAGS_' . $suffix . ') ' - if ($suffix eq 'f90' || $suffix eq 'f95' || $suffix eq 'f03' || $suffix eq 'f08'); - } - elsif ($macro eq 'AC_INIT') - { - if (defined $args[2]) - { - $package_version = $args[2]; - $package_version_location = $where; - } - } - elsif ($macro eq 'AC_LIBSOURCE') - { - $libsources{$args[1]} = $here; - } - elsif ($macro eq 'AC_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') - { - # Just check for alphanumeric in AC_SUBST_TRACE. If you do - # AC_SUBST(5), then too bad. - $configure_vars{$args[1]} = $where - if $args[1] =~ /^\w+$/; - } - elsif ($macro eq 'AM_AUTOMAKE_VERSION') - { - error ($where, - "version mismatch. This is Automake $VERSION,\n" . - "but the definition used by this AM_INIT_AUTOMAKE\n" . - "comes from Automake $args[1]. You should recreate\n" . - "aclocal.m4 with aclocal and run automake again.\n", - # $? = 63 is used to indicate version mismatch to missing. - exit_code => 63) - if $VERSION ne $args[1]; - - $seen_automake_version = 1; - } - elsif ($macro eq 'AM_PROG_MKDIR_P') - { - msg 'obsolete', $where, <<'EOF'; -The 'AM_PROG_MKDIR_P' macro is deprecated, and its use is discouraged. -You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead, -and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files. -EOF - } - elsif ($macro eq 'AM_CONDITIONAL') - { - $configure_cond{$args[1]} = $where; - } - elsif ($macro eq 'AM_EXTRA_RECURSIVE_TARGETS') - { - # Empty leading/trailing fields might be produced by split, - # hence the grep is really needed. - push @extra_recursive_targets, - grep (/./, (split /\s+/, $args[1])); - } - elsif ($macro eq 'AM_GNU_GETTEXT') - { - $seen_gettext = $where; - $ac_gettext_location = $where; - $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; - if (defined $args[2]) - { - msg 'obsolete', $where, <<'EOF'; -AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see: -http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation -EOF - $package_version = $args[2]; - $package_version_location = $where; - } - elsif (defined $args[1]) - { - my @opts = split (' ', $args[1]); - @opts = map { { option => $_, where => $where } } @opts; - exit $exit_code unless process_global_option_list (@opts); - } - } - elsif ($macro eq 'AM_MAINTAINER_MODE') - { - $seen_maint_mode = $where; - } - elsif ($macro eq 'AM_PROG_AR') - { - $seen_ar = $where; - } - elsif ($macro eq '_AM_COND_IF') - { - cond_stack_if ('', $args[1], $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - elsif ($macro eq '_AM_COND_ELSE') - { - cond_stack_else ('!', $args[1], $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - elsif ($macro eq '_AM_COND_ENDIF') - { - cond_stack_endif (undef, undef, $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - 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); - } - } - } - - error ($where, "condition stack not properly closed") - if (@cond_stack); - - $tracefh->close; -} - - -# Check whether we use 'configure.ac' or 'configure.in'. -# Scan it (and possibly 'aclocal.m4') for interesting things. -# We must scan aclocal.m4 because there might be AC_SUBSTs and such there. -sub scan_autoconf_files () -{ - # Reinitialize libsources here. This isn't really necessary, - # since we currently assume there is only one configure.ac. But - # that won't always be the case. - %libsources = (); - - # Keep track of the youngest configure dependency. - $configure_deps_greatest_timestamp = mtime $configure_ac; - if (-e 'aclocal.m4') - { - my $mtime = mtime 'aclocal.m4'; - $configure_deps_greatest_timestamp = $mtime - if $mtime > $configure_deps_greatest_timestamp; - } - - scan_autoconf_traces ($configure_ac); - - @configure_input_files = sort keys %make_list; - # Set input and output files if not specified by user. - if (! @input_files) - { - @input_files = @configure_input_files; - %output_files = %make_list; - } - - - if (! $seen_init_automake) - { - err_ac ("no proper invocation of AM_INIT_AUTOMAKE was found.\nYou " - . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE," - . "\nthat aclocal.m4 is present in the top-level directory,\n" - . "and that aclocal.m4 was recently regenerated " - . "(using aclocal)"); - } - else - { - if (! $seen_automake_version) - { - if (-f 'aclocal.m4') - { - error ($seen_init_automake, - "your implementation of AM_INIT_AUTOMAKE comes from " . - "an\nold Automake version. You should recreate " . - "aclocal.m4\nwith aclocal and run automake again", - # $? = 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"); - } - } - } - - locate_aux_dir (); - - # 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 - # push_required_file to work. - # Sort the files for stable verbose output. - $relative_dir = '.'; - foreach my $file (sort 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'; - - # Preserve dist_common for later. - $configure_dist_common = variable_value ('DIST_COMMON') || ''; - -} - -################################################################ - -# Do any extra checking for GNU standards. -sub check_gnu_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNU, - qw/INSTALL NEWS README AUTHORS ChangeLog/); - - # Accept one of these three licenses; default to COPYING. - # Make sure we do not overwrite an existing license. - my $license; - foreach (qw /COPYING COPYING.LIB COPYING.LESSER/) - { - if (-f $_) - { - $license = $_; - last; - } - } - require_file ("$am_file.am", GNU, 'COPYING') - unless $license; - } - - for my $opt ('no-installman', 'no-installinfo') - { - msg ('error-gnu', option $opt, - "option '$opt' disallowed by GNU standards") - if option $opt; - } -} - -# Do any extra checking for GNITS standards. -sub check_gnits_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNITS, 'THANKS'); - } -} - -################################################################ -# -# Functions to handle files of each language. - -# Each 'lang_X_rewrite($DIRECTORY, $BASE, $EXT)' function follows a -# simple formula: Return value is LANG_SUBDIR if the resulting object -# file should be in a subdir if the source file is, LANG_PROCESS if -# file is to be dealt with, LANG_IGNORE otherwise. - -# Much of the actual processing is handled in -# handle_single_transform. These functions exist so that -# auxiliary information can be recorded for a later cleanup pass. -# Note that the calls to these functions are computed, so don't bother -# searching for their precise names in the source. - -# This is just a convenience function that can be used to determine -# when a subdir object should be used. -sub lang_sub_obj () -{ - return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS; -} - -# Rewrite a single header file. -sub lang_header_rewrite -{ - # Header files are simply ignored. - return LANG_IGNORE; -} - -# Rewrite a single Vala source file. -sub lang_vala_rewrite -{ - my ($directory, $base, $ext) = @_; - - (my $newext = $ext) =~ s/vala$/c/; - return (LANG_SUBDIR, $newext); -} - -# Rewrite a single yacc/yacc++ file. -sub lang_yacc_rewrite -{ - my ($directory, $base, $ext) = @_; - - my $r = lang_sub_obj; - (my $newext = $ext) =~ tr/y/c/; - return ($r, $newext); -} -sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); }; - -# Rewrite a single lex/lex++ file. -sub lang_lex_rewrite -{ - my ($directory, $base, $ext) = @_; - - my $r = lang_sub_obj; - (my $newext = $ext) =~ tr/l/c/; - return ($r, $newext); -} -sub lang_lexxx_rewrite { lang_lex_rewrite (@_); }; - -# 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_vala_finish_target -{ - my ($self, $name) = @_; - - my $derived = canonicalize ($name); - my $var = var "${derived}_SOURCES"; - return unless $var; - - my @vala_sources = grep { /\.(vala|vapi)$/ } ($var->value_as_list_recursive); - - # For automake bug#11229. - return unless @vala_sources; - - foreach my $vala_file (@vala_sources) - { - my $c_file = $vala_file; - if ($c_file =~ s/(.*)\.vala$/$1.c/) - { - $c_file = "\$(srcdir)/$c_file"; - $output_rules .= "$c_file: \$(srcdir)/${derived}_vala.stamp\n" - . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n" - . "\t\@if test -f \$@; then :; else \\\n" - . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n" - . "\tfi\n"; - $clean_files{$c_file} = MAINTAINER_CLEAN; - } - } - - # Add rebuild rules for generated header and vapi files - my $flags = var ($derived . '_VALAFLAGS'); - if ($flags) - { - my $lastflag = ''; - foreach my $flag ($flags->value_as_list_recursive) - { - if (grep (/$lastflag/, ('-H', '-h', '--header', '--internal-header', - '--vapi', '--internal-vapi', '--gir'))) - { - my $headerfile = "\$(srcdir)/$flag"; - $output_rules .= "$headerfile: \$(srcdir)/${derived}_vala.stamp\n" - . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n" - . "\t\@if test -f \$@; then :; else \\\n" - . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n" - . "\tfi\n"; - - # valac is not used when building from dist tarballs - # distribute the generated files - push_dist_common ($headerfile); - $clean_files{$headerfile} = MAINTAINER_CLEAN; - } - $lastflag = $flag; - } - } - - my $compile = $self->compile; - - # Rewrite each occurrence of 'AM_VALAFLAGS' in the compile - # rule into '${derived}_VALAFLAGS' if it exists. - my $val = "${derived}_VALAFLAGS"; - $compile =~ s/\(AM_VALAFLAGS\)/\($val\)/ - if set_seen ($val); - - # VALAFLAGS is a user variable (per GNU Standards), - # it should not be overridden in the Makefile... - check_user_variables 'VALAFLAGS'; - - my $dirname = dirname ($name); - - # Only generate C code, do not run C compiler - $compile .= " -C"; - - my $verbose = verbose_flag ('VALAC'); - my $silent = silent_flag (); - my $stampfile = "\$(srcdir)/${derived}_vala.stamp"; - - $output_rules .= - "\$(srcdir)/${derived}_vala.stamp: @vala_sources\n". -# Since the C files generated from the vala sources depend on the -# ${derived}_vala.stamp file, we must ensure its timestamp is older than -# those of the C files generated by the valac invocation below (this is -# especially important on systems with sub-second timestamp resolution). -# Thus we need to create the stamp file *before* invoking valac, and to -# move it to its final location only after valac has been invoked. - "\t${silent}rm -f \$\@ && echo stamp > \$\@-t\n". - "\t${verbose}\$(am__cd) \$(srcdir) && $compile @vala_sources\n". - "\t${silent}mv -f \$\@-t \$\@\n"; - - push_dist_common ($stampfile); - - $clean_files{$stampfile} = MAINTAINER_CLEAN; -} - -# Add output rules to invoke valac and create stamp file as a witness -# to handle multiple outputs. This function is called after all source -# file processing is done. -sub lang_vala_finish () -{ - my ($self) = @_; - - foreach my $prog (keys %known_programs) - { - lang_vala_finish_target ($self, $prog); - } - - while (my ($name) = each %known_libraries) - { - lang_vala_finish_target ($self, $name); - } -} - -# The built .c files should be cleaned only on maintainer-clean -# as the .c files are distributed. This function is called for each -# .vala source file. -sub lang_vala_target_hook -{ - my ($self, $aggregate, $output, $input, %transform) = @_; - - $clean_files{$output} = MAINTAINER_CLEAN; -} - -# This is a yacc helper which is called whenever we have decided to -# compile a yacc file. -sub lang_yacc_target_hook -{ - my ($self, $aggregate, $output, $input, %transform) = @_; - - # If some relevant *YFLAGS variable contains the '-d' flag, we'll - # have to to generate special code. - my $yflags_contains_minus_d = 0; - - foreach my $pfx ("", "${aggregate}_") - { - my $yflagsvar = var ("${pfx}YFLAGS"); - next unless $yflagsvar; - # We cannot work reliably with conditionally-defined YFLAGS. - if ($yflagsvar->has_conditional_contents) - { - msg_var ('unsupported', $yflagsvar, - "'${pfx}YFLAGS' cannot have conditional contents"); - } - else - { - $yflags_contains_minus_d = 1 - if grep (/^-d$/, $yflagsvar->value_as_list_recursive); - } - } - - if ($yflags_contains_minus_d) - { - # 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. - - # The extension of the output file (e.g., '.c' or '.cxx'). - # We'll need it to compute the name of the generated header file. - (my $output_ext = basename ($output)) =~ s/.*(\.[^.]+)$/$1/; - - # We know that a yacc input should be turned into either a C or - # C++ output file. We depend on this fact (here and in yacc.am), - # so check that it really holds. - my $lang = $languages{$extension_map{$output_ext}}; - prog_error "invalid output name '$output' for yacc file '$input'" - if (!$lang || ($lang->name ne 'c' && $lang->name ne 'cxx')); - - (my $header_ext = $output_ext) =~ s/c/h/g; - # Quote $output_ext in the regexp, so that dots in it are taken - # as literal dots, not as metacharacters. - (my $header = $output) =~ s/\Q$output_ext\E$/$header_ext/; - - 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 rm -f $output; else :; fi\n" - . "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; 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'}; - - # The GNU rules say that yacc/lex output files should be removed - # by maintainer-clean. However, if the files are not distributed, - # then we want to remove them with "make clean"; otherwise, - # "make distcheck" will fail. - $clean_files{$header} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN; - } - # See the comment above for $HEADER. - $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : 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, %transform) = @_; - # The GNU rules say that yacc/lex output files should be removed - # by maintainer-clean. However, if the files are not distributed, - # then we want to remove them with "make clean"; otherwise, - # "make distcheck" will fail. - $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : 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; - - # FIXME: for now, no line number. - require_conf_file ($configure_ac, FOREIGN, 'ylwrap'); - define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL); -} - -sub lang_yacc_finish () -{ - return if defined $language_scratch{'yacc-done'}; - $language_scratch{'yacc-done'} = 1; - - reject_var 'YACCFLAGS', "'YACCFLAGS' obsolete; use 'YFLAGS' instead"; - - yacc_lex_finish_helper; -} - - -sub lang_lex_finish () -{ - return if defined $language_scratch{'lex-done'}; - $language_scratch{'lex-done'} = 1; - - yacc_lex_finish_helper; -} - - -# 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 OBJCXXLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK)) - { - return $l if defined $linkers{$l}; - } - return 'LINK'; -} - -# Called to indicate that an extension was used. -sub saw_extension -{ - my ($ext) = @_; - $extension_seen{$ext} = 1; -} - -# register_language (%ATTRIBUTE) -# ------------------------------ -# Register a single language. -# Each %ATTRIBUTE is of the form ATTRIBUTE => VALUE. -sub register_language -{ - my (%option) = @_; - - # Set the defaults. - $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'}; - $option{'nodist_specific'} = 0 - unless defined $option{'nodist_specific'}; - - my $lang = new Automake::Language (%option); - - # Fill indexes. - $extension_map{$_} = $lang->name foreach @{$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}); - - # Update the suffix rules map. - foreach my $suffix (@{$lang->extensions}) - { - foreach my $dest ($lang->output_extensions->($suffix)) - { - register_suffix_rule (INTERNAL, $suffix, $dest); - } - } -} - -# derive_suffix ($EXT, $OBJ) -# -------------------------- -# This function is used to find a path from a user-specified suffix $EXT -# to $OBJ or to some other suffix we recognize internally, e.g. 'cc'. -sub derive_suffix -{ - my ($source_ext, $obj) = @_; - - while (!$extension_map{$source_ext} && $source_ext ne $obj) - { - my $new_source_ext = next_in_suffix_chain ($source_ext, $obj); - last if not defined $new_source_ext; - $source_ext = $new_source_ext; - } - - return $source_ext; -} - - -# Pretty-print something and append to '$output_rules'. -sub pretty_print_rule -{ - $output_rules .= makefile_wrap (shift, shift, @_); -} - - -################################################################ - - -## -------------------------------- ## -## Handling the conditional stack. ## -## -------------------------------- ## - - -# $STRING -# make_conditional_string ($NEGATE, $COND) -# ---------------------------------------- -sub make_conditional_string -{ - my ($negate, $cond) = @_; - $cond = "${cond}_TRUE" - unless $cond =~ /^TRUE|FALSE$/; - $cond = Automake::Condition::conditional_negate ($cond) - if $negate; - return $cond; -} - - -my %_am_macro_for_cond = - ( - AMDEP => "one of the compiler tests\n" - . " AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,\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__fastdepOBJCXX => 'AC_PROG_OBJCXX', - am__fastdepUPC => 'AM_PROG_UPC' - ); - -# $COND -# cond_stack_if ($NEGATE, $COND, $WHERE) -# -------------------------------------- -sub cond_stack_if -{ - my ($negate, $cond, $where) = @_; - - if (! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/) - { - 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; - } - error $where, $text, uniq_scope => $scope; - } - - push (@cond_stack, make_conditional_string ($negate, $cond)); - - return new Automake::Condition (@cond_stack); -} - - -# $COND -# cond_stack_else ($NEGATE, $COND, $WHERE) -# ---------------------------------------- -sub cond_stack_else -{ - my ($negate, $cond, $where) = @_; - - if (! @cond_stack) - { - error $where, "else without if"; - return FALSE; - } - - $cond_stack[$#cond_stack] = - Automake::Condition::conditional_negate ($cond_stack[$#cond_stack]); - - # If $COND is given, check against it. - if (defined $cond) - { - $cond = make_conditional_string ($negate, $cond); - - error ($where, "else reminder ($negate$cond) incompatible with " - . "current conditional: $cond_stack[$#cond_stack]") - if $cond_stack[$#cond_stack] ne $cond; - } - - return new Automake::Condition (@cond_stack); -} - - -# $COND -# cond_stack_endif ($NEGATE, $COND, $WHERE) -# ----------------------------------------- -sub cond_stack_endif -{ - my ($negate, $cond, $where) = @_; - my $old_cond; - - if (! @cond_stack) - { - error $where, "endif without if"; - return TRUE; - } - - # If $COND is given, check against it. - if (defined $cond) - { - $cond = make_conditional_string ($negate, $cond); - - error ($where, "endif reminder ($negate$cond) incompatible with " - . "current conditional: $cond_stack[$#cond_stack]") - if $cond_stack[$#cond_stack] ne $cond; - } - - pop @cond_stack; - - return new Automake::Condition (@cond_stack); -} - - - - - -## ------------------------ ## -## Handling the variables. ## -## ------------------------ ## - - -# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE) -# ---------------------------------------------------- -# Like define_variable, but the value is a list, and the variable may -# be defined conditionally. The second argument is the condition -# under which the value should be defined; this should be the empty -# string to define the variable unconditionally. The third argument -# is a list holding the values to use for the variable. The value is -# pretty printed in the output file. -sub define_pretty_variable -{ - my ($var, $cond, $where, @value) = @_; - - if (! vardef ($var, $cond)) - { - Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value", - '', $where, VAR_PRETTY); - rvar ($var)->rdef ($cond)->set_seen; - } -} - - -# define_variable ($VAR, $VALUE, $WHERE) -# -------------------------------------- -# Define a new 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 ($\@$$) -{ - my ($var, $basename, $extension, $where) = @_; - define_variable ($var, - join (' ', map { "$_.$extension" } @$basename), - $where); -} - - -# Like define_variable, but define a variable to be the configure -# substitution by the same name. -sub define_configure_variable -{ - my ($var) = @_; - # 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 `\`. - my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS; - Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var), - '', $configure_vars{$var}, $pretty); -} - - -# define_compiler_variable ($LANG) -# -------------------------------- -# Define a compiler variable. We also handle defining the 'LT' -# version of the command when using libtool. -sub define_compiler_variable -{ - my ($lang) = @_; - - my ($var, $value) = ($lang->compiler, $lang->compile); - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; - define_variable ($var, $value, INTERNAL); - if (var ('LIBTOOL')) - { - my $verbose = define_verbose_libtool (); - define_variable ("LT$var", - "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)" - . " \$(LIBTOOLFLAGS) --mode=compile $value", - INTERNAL); - } - define_verbose_tagvar ($lang->ccer || 'GEN'); -} - - -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}; - # CCLD = $(CC). - define_variable ($lang->lder, $lang->ld, INTERNAL); - # CCLINK = $(CCLD) blah blah... - my $link = ''; - if (var ('LIBTOOL')) - { - my $verbose = define_verbose_libtool (); - $link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) " - . "\$(LIBTOOLFLAGS) --mode=link "; - } - define_variable ($lang->linker, $link . $lang->link, INTERNAL); - define_variable ($lang->compiler, $lang, INTERNAL); - define_verbose_tagvar ($lang->lder || 'GEN'); -} - -sub define_per_target_linker_variable -{ - my ($linker, $target) = @_; - - # If the user wrote a custom link command, we don't define ours. - return "${target}_LINK" - if set_seen "${target}_LINK"; - - my $xlink = $linker ? $linker : 'LINK'; - - my $lang = $link_languages{$xlink}; - prog_error "Unknown language for linker variable '$xlink'" - unless $lang; - - my $link_command = $lang->link; - if (var 'LIBTOOL') - { - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; - - my $verbose = define_verbose_libtool (); - $link_command = - "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) " - . "--mode=link " . $link_command; - } - - # 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) - { - my $val = "${target}_$flag"; - $link_command =~ s/\(AM_$flag\)/\($val\)/ - if set_seen ($val); - } - - # If the computed command is the same as the generic command, use - # the command linker variable. - return ($lang->linker, $lang->lder) - if $link_command eq $orig_command; - - define_variable ("${target}_LINK", $link_command, INTERNAL); - return ("${target}_LINK", $lang->lder); -} - -################################################################ - -# check_trailing_slash ($WHERE, $LINE) -# ------------------------------------ -# Return 1 iff $LINE ends with a slash. -# Might modify $LINE. -sub check_trailing_slash ($\$) -{ - my ($where, $line) = @_; - - # Ignore '##' lines. - return 0 if $$line =~ /$IGNORE_PATTERN/o; - - # Catch and fix a common error. - msg "syntax", $where, "whitespace following trailing backslash" - if $$line =~ s/\\\s+\n$/\\\n/; - - return $$line =~ /\\$/; -} - - -# read_am_file ($AMFILE, $WHERE, $RELDIR) -# --------------------------------------- -# Read Makefile.am and set up %contents. Simultaneously copy lines -# from Makefile.am into $output_trailer, or define variables as -# appropriate. NOTE we put rules in the trailer section. We want -# user rules to come after our generated stuff. -sub read_am_file -{ - my ($amfile, $where, $reldir) = @_; - my $canon_reldir = &canonicalize ($reldir); - - my $am_file = new Automake::XFile ("< $amfile"); - verb "reading $amfile"; - - # Keep track of the youngest output dependency. - my $mtime = mtime $amfile; - $output_deps_greatest_timestamp = $mtime - if $mtime > $output_deps_greatest_timestamp; - - my $spacing = ''; - my $comment = ''; - my $blank = 0; - my $saw_bk = 0; - my $var_look = VAR_ASIS; - - use constant IN_VAR_DEF => 0; - use constant IN_RULE_DEF => 1; - use constant IN_COMMENT => 2; - my $prev_state = IN_RULE_DEF; - - while ($_ = $am_file->getline) - { - $where->set ("$amfile:$."); - if (/$IGNORE_PATTERN/o) - { - # Merely delete comments beginning with two hashes. - } - elsif (/$WHITE_PATTERN/o) - { - error $where, "blank line following trailing backslash" - if $saw_bk; - # Stick a single white line before the incoming macro or rule. - $spacing = "\n"; - $blank = 1; - # Flush all comments seen so far. - if ($comment ne '') - { - $output_vars .= $comment; - $comment = ''; - } - } - elsif (/$COMMENT_PATTERN/o) - { - # Stick comments before the incoming macro or rule. Make - # sure a blank line precedes the first block of comments. - $spacing = "\n" unless $blank; - $blank = 1; - $comment .= $spacing . $_; - $spacing = ''; - $prev_state = IN_COMMENT; - } - else - { - last; - } - $saw_bk = check_trailing_slash ($where, $_); - } - - # We save the conditional stack on entry, and then check to make - # sure it is the same on exit. This lets us conditionally include - # other files. - my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); - - my $last_var_name = ''; - my $last_var_type = ''; - my $last_var_value = ''; - my $last_where; - # FIXME: shouldn't use $_ in this loop; it is too big. - while ($_) - { - $where->set ("$amfile:$."); - - # Make sure the line is \n-terminated. - chomp; - $_ .= "\n"; - - # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be - # used by users. @MAINT@ is an anachronism now. - $_ =~ s/\@MAINT\@//g - unless $seen_maint_mode; - - my $new_saw_bk = check_trailing_slash ($where, $_); - - if ($reldir eq '.') - { - # If present, eat the following '_' or '/', converting - # "%reldir%/foo" and "%canon_reldir%_foo" into plain "foo" - # when $reldir is '.'. - $_ =~ s,%(D|reldir)%/,,g; - $_ =~ s,%(C|canon_reldir)%_,,g; - } - $_ =~ s/%(D|reldir)%/${reldir}/g; - $_ =~ s/%(C|canon_reldir)%/${canon_reldir}/g; - - 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" - if $saw_bk; - } - elsif (/$COMMENT_PATTERN/o) - { - error $where, "comment following trailing backslash" - if $saw_bk && $prev_state != IN_COMMENT; - - # Stick comments before the incoming macro or rule. - $comment .= $spacing . $_; - $spacing = ''; - $prev_state = IN_COMMENT; - } - elsif ($saw_bk) - { - if ($prev_state == IN_RULE_DEF) - { - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - } - elsif ($prev_state == IN_COMMENT) - { - # If the line doesn't start with a '#', add it. - # We do this because a continued comment like - # # A = foo \ - # bar \ - # baz - # is not portable. BSD make doesn't honor - # escaped newlines in comments. - s/^#?/#/; - $comment .= $spacing . $_; - } - else # $prev_state == IN_VAR_DEF - { - $last_var_value .= ' ' - unless $last_var_value =~ /\s$/; - $last_var_value .= $_; - - if (!/\\$/) - { - Automake::Variable::define ($last_var_name, VAR_MAKEFILE, - $last_var_type, $cond, - $last_var_value, $comment, - $last_where, VAR_ASIS) - if $cond != FALSE; - $comment = $spacing = ''; - } - } - } - - elsif (/$IF_PATTERN/o) - { - $cond = cond_stack_if ($1, $2, $where); - } - elsif (/$ELSE_PATTERN/o) - { - $cond = cond_stack_else ($1, $2, $where); - } - elsif (/$ENDIF_PATTERN/o) - { - $cond = cond_stack_endif ($1, $2, $where); - } - - elsif (/$RULE_PATTERN/o) - { - # Found a rule. - $prev_state = IN_RULE_DEF; - - # For now we have to output all definitions of user rules - # and can't diagnose duplicates (see the comment in - # Automake::Rule::define). So we go on and ignore the return value. - Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where); - - check_variable_expansions ($_, $where); - - $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - $comment = $spacing = ''; - } - elsif (/$ASSIGNMENT_PATTERN/o) - { - # Found a macro definition. - $prev_state = IN_VAR_DEF; - $last_var_name = $1; - $last_var_type = $2; - $last_var_value = $3; - $last_where = $where->clone; - if ($3 ne '' && substr ($3, -1) eq "\\") - { - # We preserve the '\' because otherwise the long lines - # that are generated will be truncated by broken - # 'sed's. - $last_var_value = $3 . "\n"; - } - # Normally we try to output variable definitions in the - # same format they were input. However, POSIX compliant - # systems are not required to support lines longer than - # 2048 bytes (most notably, some sed implementation are - # limited to 4000 bytes, and sed is used by config.status - # to rewrite Makefile.in into Makefile). Moreover nobody - # would really write such long lines by hand since it is - # hardly maintainable. So if a line is longer that 1000 - # bytes (an arbitrary limit), assume it has been - # automatically generated by some tools, and flatten the - # variable definition. Otherwise, keep the variable as it - # as been input. - $var_look = VAR_PRETTY if length ($last_var_value) >= 1000; - - if (!/\\$/) - { - Automake::Variable::define ($last_var_name, VAR_MAKEFILE, - $last_var_type, $cond, - $last_var_value, $comment, - $last_where, $var_look) - if $cond != FALSE; - $comment = $spacing = ''; - $var_look = VAR_ASIS; - } - } - elsif (/$INCLUDE_PATTERN/o) - { - my $path = $1; - - if ($path =~ s/^\$\(top_srcdir\)\///) - { - push (@include_stack, "\$\(top_srcdir\)/$path"); - # Distribute any included file. - - # Always use the $(top_srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included - # file in the build tree during "make distdir" to satisfy - # the dependency. - # (subdir-am-cond.sh and subdir-ac-cond.sh will fail) - push_dist_common ("\$\(top_srcdir\)/$path"); - } - else - { - $path =~ s/\$\(srcdir\)\///; - push (@include_stack, "\$\(srcdir\)/$path"); - # Always use the $(srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included - # file in the build tree during "make distdir" to satisfy - # the dependency. - # (subdir-am-cond.sh and subdir-ac-cond.sh will fail) - push_dist_common ("\$\(srcdir\)/$path"); - $path = $relative_dir . "/" . $path if $relative_dir ne '.'; - } - my $new_reldir = File::Spec->abs2rel ($path, $relative_dir); - $new_reldir = '.' if $new_reldir !~ s,/[^/]*$,,; - $where->push_context ("'$path' included from here"); - read_am_file ($path, $where, $new_reldir); - $where->pop_context; - } - else - { - # This isn't an error; it is probably a continued rule. - # In fact, this is what we assume. - $prev_state = IN_RULE_DEF; - check_variable_expansions ($_, $where); - $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - $comment = $spacing = ''; - error $where, "'#' comment at start of rule is unportable" - if $_ =~ /^\t\s*\#/; - } - - $saw_bk = $new_saw_bk; - $_ = $am_file->getline; - } - - $output_trailer .= $comment; - - error ($where, "trailing backslash on last line") - if $saw_bk; - - error ($where, (@cond_stack ? "unterminated conditionals: @cond_stack" - : "too many conditionals closed in include file")) - if "@saved_cond_stack" ne "@cond_stack"; -} - - -# A helper for read_main_am_file which initializes configure variables -# and variables from header-vars.am. -sub define_standard_variables () -{ - my $saved_output_vars = $output_vars; - my ($comments, undef, $rules) = - file_contents_internal (1, "$libdir/am/header-vars.am", - new Automake::Location); - - foreach my $var (sort keys %configure_vars) - { - define_configure_variable ($var); - } - - $output_vars .= $comments . $rules; -} - - -# read_main_am_file ($MAKEFILE_AM, $MAKEFILE_IN) -# ---------------------------------------------- -sub read_main_am_file -{ - my ($amfile, $infile) = @_; - - # This supports the strange variable tricks we are about to play. - prog_error ("variable defined before read_main_am_file\n" . variables_dump ()) - if (scalar (variables) > 0); - - # Generate copyright header for generated Makefile.in. - # We do discard the output of predefined variables, handled below. - $output_vars = ("# " . basename ($infile) . " generated by automake " - . $VERSION . " from " . basename ($amfile) . ".\n"); - $output_vars .= '# ' . subst ('configure_input') . "\n"; - $output_vars .= $gen_copyright; - - # We want to predefine as many variables as possible. This lets - # the user set them with '+=' in Makefile.am. - define_standard_variables; - - # Read user file, which might override some of our values. - read_am_file ($amfile, new Automake::Location, '.'); -} - - - -################################################################ - -# $STRING -# flatten ($ORIGINAL_STRING) -# -------------------------- -sub flatten -{ - $_ = shift; - - s/\\\n//somg; - s/\s+/ /g; - s/^ //; - s/ $//; - - return $_; -} - - -# transform_token ($TOKEN, \%PAIRS, $KEY) -# --------------------------------------- -# Return the value associated to $KEY in %PAIRS, as used on $TOKEN -# (which should be ?KEY? or any of the special %% requests).. -sub transform_token ($\%$) -{ - my ($token, $transform, $key) = @_; - my $res = $transform->{$key}; - prog_error "Unknown key '$key' in '$token'" unless defined $res; - return $res; -} - - -# transform ($TOKEN, \%PAIRS) -# --------------------------- -# If ($TOKEN, $VAL) is in %PAIRS: -# - replaces %KEY% with $VAL, -# - enables/disables ?KEY? and ?!KEY?, -# - replaces %?KEY% with TRUE or FALSE. -sub transform ($\%) -{ - my ($token, $transform) = @_; - - # %KEY%. - # Must be before the following pattern to exclude the case - # when there is neither IFTRUE nor IFFALSE. - if ($token =~ /^%([\w\-]+)%$/) - { - return transform_token ($token, %$transform, $1); - } - # %?KEY%. - elsif ($token =~ /^%\?([\w\-]+)%$/) - { - return transform_token ($token, %$transform, $1) ? 'TRUE' : 'FALSE'; - } - # ?KEY? and ?!KEY?. - elsif ($token =~ /^ \? (!?) ([\w\-]+) \? $/x) - { - my $neg = ($1 eq '!') ? 1 : 0; - my $val = transform_token ($token, %$transform, $2); - return (!!$val == $neg) ? '##%' : ''; - } - else - { - prog_error "Unknown request format: $token"; - } -} - -# $TEXT -# preprocess_file ($MAKEFILE, [%TRANSFORM]) -# ----------------------------------------- -# Load a $MAKEFILE, apply the %TRANSFORM, and return the result. -# No extra parsing or post-processing is done (i.e., recognition of -# rules declaration or of make variables definitions). -sub preprocess_file -{ - my ($file, %transform) = @_; - - # Complete %transform with global options. - # Note that %transform goes last, so it overrides global options. - %transform = ( 'MAINTAINER-MODE' - => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '', - - 'XZ' => !! option 'dist-xz', - 'LZIP' => !! option 'dist-lzip', - '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, - %transform); - - if (! defined ($_ = $am_file_cache{$file})) - { - 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; - # Remember the contents of the just-read file. - $am_file_cache{$file} = $_; - } - - # Substitute Automake template tokens. - s/(?: % \?? [\w\-]+ % - | \? !? [\w\-]+ \? - )/transform($&, %transform)/gex; - # 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; - - 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) = @_; - $transform{FIRST} = !$transformed_files{$file}; - $transformed_files{$file} = 1; - - my @lines = split /(?set ($file); - - my $result_vars = ''; - my $result_rules = ''; - my $comment = ''; - my $spacing = ''; - - # The following flags are used to track rules spanning across - # multiple paragraphs. - my $is_rule = 0; # 1 if we are processing a rule. - my $discard_rule = 0; # 1 if the current rule should not be output. - - # We save the conditional stack on entry, and then check to make - # sure it is the same on exit. This lets us conditionally include - # other files. - my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); - - foreach (make_paragraphs ($file, %transform)) - { - # FIXME: no line number available. - $where->set ($file); - - # Sanity checks. - error $where, "blank line following trailing backslash:\n$_" - if /\\$/; - error $where, "comment following trailing backslash:\n$_" - if /\\#/; - - if (/^$/) - { - $is_rule = 0; - # Stick empty line before the incoming macro or rule. - $spacing = "\n"; - } - elsif (/$COMMENT_PATTERN/mso) - { - $is_rule = 0; - # Stick comments before the incoming macro or rule. - $comment = "$_\n"; - } - - # Handle inclusion of other files. - elsif (/$INCLUDE_PATTERN/o) - { - if ($cond != FALSE) - { - my $file = ($is_am ? "$libdir/am/" : '') . $1; - $where->push_context ("'$file' included from here"); - # N-ary '.=' fails. - my ($com, $vars, $rules) - = file_contents_internal ($is_am, $file, $where, %transform); - $where->pop_context; - $comment .= $com; - $result_vars .= $vars; - $result_rules .= $rules; - } - } - - # Handling the conditionals. - elsif (/$IF_PATTERN/o) - { - $cond = cond_stack_if ($1, $2, $file); - } - elsif (/$ELSE_PATTERN/o) - { - $cond = cond_stack_else ($1, $2, $file); - } - elsif (/$ENDIF_PATTERN/o) - { - $cond = cond_stack_endif ($1, $2, $file); - } - - # Handling rules. - elsif (/$RULE_PATTERN/mso) - { - $is_rule = 1; - $discard_rule = 0; - # Separate relationship from optional actions: the first - # `new-line tab" not preceded by backslash (continuation - # line). - my $paragraph = $_; - /^(.*?)(?:(?subst_string/gme; - $result_rules .= "$spacing$comment$condparagraph\n"; - } - if (scalar @undefined_conds == 0) - { - # Remember to discard next paragraphs - # if they belong to this rule. - # (but see also FIXME: #2 above.) - $discard_rule = 1; - } - $comment = $spacing = ''; - last; - } - } - } - - elsif (/$ASSIGNMENT_PATTERN/mso) - { - my ($var, $type, $val) = ($1, $2, $3); - error $where, "variable '$var' with trailing backslash" - if /\\$/; - - $is_rule = 0; - - Automake::Variable::define ($var, - $is_am ? VAR_AUTOMAKE : VAR_MAKEFILE, - $type, $cond, $val, $comment, $where, - VAR_ASIS) - if $cond != FALSE; - - $comment = $spacing = ''; - } - else - { - # This isn't an error; it is probably some tokens which - # configure is supposed to replace, such as '@SET-MAKE@', - # or some part of a rule cut by an if/endif. - if (! $cond->false && ! ($is_rule && $discard_rule)) - { - s/^/$cond->subst_string/gme; - $result_rules .= "$spacing$comment$_\n"; - } - $comment = $spacing = ''; - } - } - - error ($where, @cond_stack ? - "unterminated conditionals: @cond_stack" : - "too many conditionals closed in include file") - if "@saved_cond_stack" ne "@cond_stack"; - - return ($comment, $result_vars, $result_rules); -} - - -# $CONTENTS -# file_contents ($BASENAME, $WHERE, [%TRANSFORM]) -# ----------------------------------------------- -# Return contents of a file from $libdir/am, automatically skipping -# macros or rules which are already known. -sub file_contents -{ - my ($basename, $where, %transform) = @_; - my ($comments, $variables, $rules) = - file_contents_internal (1, "$libdir/am/$basename.am", $where, - %transform); - return "$comments$variables$rules"; -} - - -# @PREFIX -# am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES) -# ---------------------------------------------------- -# Find all variable prefixes that are used for install directories. A -# prefix 'zar' qualifies iff: -# -# * 'zardir' is a variable. -# * 'zar_PRIMARY' is a variable. -# -# As a side effect, it looks for misspellings. It is an error to have -# a variable ending in a "reserved" suffix whose prefix is unknown, e.g. -# "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 -# need it. -sub am_primary_prefixes -{ - my ($primary, $can_dist, @prefixes) = @_; - - local $_; - my %valid = map { $_ => 0 } @prefixes; - $valid{'EXTRA'} = 0; - foreach my $var (variables $primary) - { - # Automake is allowed to define variables that look like primaries - # but which aren't. E.g. INSTALL_sh_DATA. - # Autoconf can also define variables like INSTALL_DATA, so - # ignore all configure variables (at least those which are not - # redefined in Makefile.am). - # FIXME: We should make sure that these variables are not - # conditionally defined (or else adjust the condition below). - my $def = $var->def (TRUE); - next if $def && $def->owner != VAR_MAKEFILE; - - my $varname = $var->name; - - if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_[[:alnum:]]+$/) - { - my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || ''); - if ($dist ne '' && ! $can_dist) - { - err_var ($var, - "invalid variable '$varname': 'dist' is forbidden"); - } - # Standard directories must be explicitly allowed. - elsif (! defined $valid{$X} && exists $standard_prefix{$X}) - { - err_var ($var, - "'${X}dir' is not a legitimate directory " . - "for '$primary'"); - } - # A not explicitly valid directory is allowed if Xdir is defined. - elsif (! defined $valid{$X} && - $var->requires_variables ("'$varname' is used", "${X}dir")) - { - # Nothing to do. Any error message has been output - # by $var->requires_variables. - } - else - { - # Ensure all extended prefixes are actually used. - $valid{"$base$dist$X"} = 1; - } - } - else - { - prog_error "unexpected variable name: $varname"; - } - } - - # Return only those which are actually defined. - return sort grep { var ($_ . '_' . $primary) } keys %valid; -} - - -# am_install_var (-OPTION..., file, HOW, where...) -# ------------------------------------------------ -# -# Handle 'where_HOW' variable magic. Does all lookups, generates -# install code, and possibly generates code to define the primary -# variable. The first argument is the name of the .am file to munge, -# the second argument is the primary variable (e.g. HEADERS), and all -# subsequent arguments are possible installation locations. -# -# Returns list of [$location, $value] pairs, where -# $value's are the values in all where_HOW variable, and $location -# there associated location (the place here their parent variables were -# defined). -# -# FIXME: this should be rewritten to be cleaner. It should be broken -# up into multiple functions. -# -sub am_install_var -{ - my (@args) = @_; - - my $do_require = 1; - my $can_dist = 0; - my $default_dist = 0; - while (@args) - { - if ($args[0] eq '-noextra') - { - $do_require = 0; - } - elsif ($args[0] eq '-candist') - { - $can_dist = 1; - } - elsif ($args[0] eq '-defaultdist') - { - $default_dist = 1; - $can_dist = 1; - } - elsif ($args[0] !~ /^-/) - { - last; - } - shift (@args); - } - - my ($file, $primary, @prefix) = @args; - - # Now that configure substitutions are allowed in where_HOW - # variables, it is an error to actually define the primary. We - # allow 'JAVA', as it is customarily used to mean the Java - # interpreter. This is but one of several Java hacks. Similarly, - # 'PYTHON' is customarily used to mean the Python interpreter. - reject_var $primary, "'$primary' is an anachronism" - unless $primary eq 'JAVA' || $primary eq 'PYTHON'; - - # Get the prefixes which are valid and actually used. - @prefix = am_primary_prefixes ($primary, $can_dist, @prefix); - - # If a primary includes a configure substitution, then the EXTRA_ - # form is required. Otherwise we can't properly do our job. - my $require_extra; - - my @used = (); - my @result = (); - - foreach my $X (@prefix) - { - my $nodir_name = $X; - my $one_name = $X . '_' . $primary; - my $one_var = var $one_name; - - my $strip_subdir = 1; - # If subdir prefix should be preserved, do so. - if ($nodir_name =~ /^nobase_/) - { - $strip_subdir = 0; - $nodir_name =~ s/^nobase_//; - } - - # If files should be distributed, do so. - my $dist_p = 0; - if ($can_dist) - { - $dist_p = (($default_dist && $nodir_name !~ /^nodist_/) - || (! $default_dist && $nodir_name =~ /^dist_/)); - $nodir_name =~ s/^(dist|nodist)_//; - } - - - # Use the location of the currently processed variable. - # We are not processing a particular condition, so pick the first - # available. - my $tmpcond = $one_var->conditions->one_cond; - my $where = $one_var->rdef ($tmpcond)->location->clone; - - # Append actual contents of where_PRIMARY variable to - # @result, skipping @substitutions@. - foreach my $locvals ($one_var->value_as_list_recursive (location => 1)) - { - my ($loc, $value) = @$locvals; - # Skip configure substitutions. - if ($value =~ /^\@.*\@$/) - { - if ($nodir_name eq 'EXTRA') - { - error ($where, - "'$one_name' contains configure substitution, " - . "but shouldn't"); - } - # Check here to make sure variables defined in - # configure.ac do not imply that EXTRA_PRIMARY - # must be defined. - elsif (! defined $configure_vars{$one_name}) - { - $require_extra = $one_name - if $do_require; - } - } - else - { - # 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. - # Do it here rather than in handle_programs so the - # uniquifying at the end of this function works. - ${$locvals}[1] =~ s/\$\(EXEEXT\)$// - if $primary eq 'PROGRAMS'; - - 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'; - - if ($nodir_name eq 'check') - { - push (@check, '$(' . $one_name . ')'); - } - else - { - push (@used, '$(' . $one_name . ')'); - } - - # Is this to be installed? - my $install_p = $nodir_name ne 'noinst' && $nodir_name ne 'check'; - - # If so, with install-exec? (or install-data?). - my $exec_p = ($nodir_name =~ /$EXEC_DIR_PATTERN/o); - - my $check_options_p = $install_p && !! option 'std-options'; - - # Use the location of the currently processed variable as context. - $where->push_context ("while processing '$one_name'"); - - # The variable containing all files to distribute. - my $distvar = "\$($one_name)"; - $distvar = shadow_unconditionally ($one_name, $where) - if ($dist_p && $one_var->has_conditional_contents); - - # Singular form of $PRIMARY. - (my $one_primary = $primary) =~ s/S$//; - $output_rules .= file_contents ($file, $where, - PRIMARY => $primary, - ONE_PRIMARY => $one_primary, - DIR => $X, - NDIR => $nodir_name, - BASE => $strip_subdir, - EXEC => $exec_p, - INSTALL => $install_p, - DIST => $dist_p, - DISTVAR => $distvar, - 'CK-OPTS' => $check_options_p); - } - - # The JAVA variable is used as the name of the Java interpreter. - # The PYTHON variable is used as the name of the Python interpreter. - if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON') - { - # Define it. - define_pretty_variable ($primary, TRUE, INTERNAL, @used); - $output_vars .= "\n"; - } - - err_var ($require_extra, - "'$require_extra' contains configure substitution,\n" - . "but 'EXTRA_$primary' not defined") - if ($require_extra && ! var ('EXTRA_' . $primary)); - - # Push here because PRIMARY might be configure time determined. - push (@all, '$(' . $primary . ')') - if @used && $primary ne 'JAVA' && $primary ne 'PYTHON'; - - # Make the result unique. This lets the user use conditionals in - # a natural way, but still lets us program lazily -- we don't have - # to worry about handling a particular object more than once. - # We will keep only one location per object. - my %result = (); - for my $pair (@result) - { - my ($loc, $val) = @$pair; - $result{$val} = $loc; - } - my @l = sort keys %result; - return map { [$result{$_}->clone, $_] } @l; -} - - -################################################################ - -# Each key in this hash is the name of a directory holding a -# Makefile.in. These variables are local to 'is_make_dir'. -my %make_dirs = (); -my $make_dirs_set = 0; - -# is_make_dir ($DIRECTORY) -# ------------------------ -sub is_make_dir -{ - my ($dir) = @_; - if (! $make_dirs_set) - { - foreach my $iter (@configure_input_files) - { - $make_dirs{dirname ($iter)} = 1; - } - # We also want to notice Makefile.in's. - foreach my $iter (@other_input_files) - { - if ($iter =~ /Makefile\.in$/) - { - $make_dirs{dirname ($iter)} = 1; - } - } - $make_dirs_set = 1; - } - return defined $make_dirs{$dir}; -} - -################################################################ - -# Find the aux dir. This should match the algorithm used by -# ./configure. (See the Autoconf documentation for for -# AC_CONFIG_AUX_DIR.) -sub locate_aux_dir () -{ - if (! $config_aux_dir_set_in_configure_ac) - { - # The default auxiliary directory is the first - # of ., .., or ../.. that contains install-sh. - # Assume . if install-sh doesn't exist yet. - for my $dir (qw (. .. ../..)) - { - if (-f "$dir/install-sh") - { - $config_aux_dir = $dir; - last; - } - } - $config_aux_dir = '.' unless $config_aux_dir; - } - # Avoid unsightly '/.'s. - $am_config_aux_dir = - '$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir"); - $am_config_aux_dir =~ s,/*$,,; -} - - -# push_required_file ($DIR, $FILE, $FULLFILE) -# ------------------------------------------- -# Push the given file onto DIST_COMMON. -sub push_required_file -{ - my ($dir, $file, $fullfile) = @_; - - # If the file to be distributed is in the same directory of the - # currently processed Makefile.am, then we want to distribute it - # from this same Makefile.am. - if ($dir eq $relative_dir) - { - push_dist_common ($file); - } - # This is needed to allow a construct in a non-top-level Makefile.am - # to require a file in the build-aux directory (see at least the test - # script 'test-driver-is-distributed.sh'). This is related to the - # automake bug#9546. Note that the use of $config_aux_dir instead - # of $am_config_aux_dir here is deliberate and necessary. - elsif ($dir eq $config_aux_dir) - { - push_dist_common ("$am_config_aux_dir/$file"); - } - # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support. - # We probably need some refactoring of this function and its callers, - # to have a more explicit and systematic handling of all the special - # cases; but, since there are only two of them, this is low-priority - # ATM. - elsif ($config_libobj_dir && $dir eq $config_libobj_dir) - { - # Avoid unsightly '/.'s. - my $am_config_libobj_dir = - '$(top_srcdir)' . - ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir"); - $am_config_libobj_dir =~ s|/*$||; - push_dist_common ("$am_config_libobj_dir/$file"); - } - 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); - } - else - { - prog_error "a Makefile in relative directory $relative_dir " . - "can't add files in directory $dir to DIST_COMMON"; - } -} - - -# 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 = (); - -# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE) -# ------------------------------------------------------- -# Verify that the file must exist in $DIRECTORY, or install it. -sub required_file_check_or_copy -{ - my ($where, $dir, $file) = @_; - - my $fullfile = "$dir/$file"; - my $found_it = 0; - my $dangling_sym = 0; - - if (-l $fullfile && ! -f $fullfile) - { - $dangling_sym = 1; - } - elsif (dir_has_case_matching_file ($dir, $file)) - { - $found_it = 1; - } - - # '--force-missing' only has an effect if '--add-missing' is - # specified. - return - if $found_it && (! $add_missing || ! $force_missing); - - # 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) - { - return if defined $required_file_not_found{$fullfile}; - $required_file_not_found{$fullfile} = 1; - } - if ($dangling_sym && $add_missing) - { - unlink ($fullfile); - } - - my $trailer = ''; - my $trailer2 = ''; - my $suppress = 0; - - # Only install missing files according to our desired - # strictness level. - my $message = "required file '$fullfile' not found"; - if ($add_missing) - { - if (-f "$libdir/$file") - { - $suppress = 1; - - # Install the missing file. Symlink if we - # can, copy if we must. Note: delete the file - # first, in case it is a dangling symlink. - $message = "installing '$fullfile'"; - - # The license file should not be volatile. - if ($file eq "COPYING") - { - $message .= " using GNU General Public License v3 file"; - $trailer2 = "\n Consider adding the COPYING file" - . " to the version control system" - . "\n for your code, to avoid questions" - . " about which license your project uses"; - } - - # Windows Perl will hang if we try to delete a - # file that doesn't exist. - unlink ($fullfile) if -f $fullfile; - if ($symlink_exists && ! $copy_missing) - { - if (! symlink ("$libdir/$file", $fullfile) - || ! -e $fullfile) - { - $suppress = 0; - $trailer = "; error while making link: $!"; - } - } - elsif (system ('cp', "$libdir/$file", $fullfile)) - { - $suppress = 0; - $trailer = "\n error while copying"; - } - set_dir_cache_file ($dir, $file); - } - } - 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. - return - if $found_it && $force_missing; - - # 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. - return - if !$suppress && rule $file; - - msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2"); -} - - -# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES) -# --------------------------------------------------------------------- -# Verify that the file must exist in $DIRECTORY, or install it. -# $MYSTRICT is the strictness level at which this file becomes required. -# Worker threads may queue up the action to be serialized by the master, -# if $QUEUE is true -sub require_file_internal -{ - my ($where, $mystrict, $dir, $queue, @files) = @_; - - return - unless $strictness >= $mystrict; - - foreach my $file (@files) - { - push_required_file ($dir, $file, "$dir/$file"); - if ($queue) - { - queue_required_file_check_or_copy ($required_conf_file_queue, - QUEUE_CONF_FILE, $relative_dir, - $where, $mystrict, @files); - } - else - { - required_file_check_or_copy ($where, $dir, $file); - } - } -} - -# require_file ($WHERE, $MYSTRICT, @FILES) -# ---------------------------------------- -sub require_file -{ - my ($where, $mystrict, @files) = @_; - require_file_internal ($where, $mystrict, $relative_dir, 0, @files); -} - -# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) -# ---------------------------------------------------------- -sub require_file_with_macro -{ - my ($cond, $macro, $mystrict, @files) = @_; - $macro = rvar ($macro) unless ref $macro; - require_file ($macro->rdef ($cond)->location, $mystrict, @files); -} - -# require_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, 0, @files); - } - else - { - require_file ($macro->rdef ($cond)->location, $mystrict, @files); - } -} - -# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE, -# $MYSTRICT, @FILES) -# -------------------------------------------------------------- -sub queue_required_file_check_or_copy -{ - my ($queue, $key, $dir, $where, $mystrict, @files) = @_; - my @serial_loc; - if (ref $where) - { - @serial_loc = (QUEUE_LOCATION, $where->serialize ()); - } - else - { - @serial_loc = (QUEUE_STRING, $where); - } - $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files); -} - -# require_queued_file_check_or_copy ($QUEUE) -# ------------------------------------------ -sub require_queued_file_check_or_copy -{ - my ($queue) = @_; - my $where; - my $dir = $queue->dequeue (); - my $loc_key = $queue->dequeue (); - if ($loc_key eq QUEUE_LOCATION) - { - $where = Automake::Location::deserialize ($queue); - } - elsif ($loc_key eq QUEUE_STRING) - { - $where = $queue->dequeue (); - } - else - { - prog_error "unexpected key $loc_key"; - } - my $mystrict = $queue->dequeue (); - my $nfiles = $queue->dequeue (); - my @files; - push @files, $queue->dequeue () - foreach (1 .. $nfiles); - return - unless $strictness >= $mystrict; - foreach my $file (@files) - { - required_file_check_or_copy ($where, $config_aux_dir, $file); - } -} - -# 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) = @_; - my $queue = defined $required_conf_file_queue ? 1 : 0; - require_file_internal ($where, $mystrict, $config_aux_dir, - $queue, @files); -} - - -# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) -# --------------------------------------------------------------- -sub require_conf_file_with_macro -{ - my ($cond, $macro, $mystrict, @files) = @_; - require_conf_file (rvar ($macro)->rdef ($cond)->location, - $mystrict, @files); -} - -################################################################ - -# require_build_directory ($DIRECTORY) -# ------------------------------------ -# Emit rules to create $DIRECTORY if needed, and return -# the file that any target requiring this directory should be made -# dependent upon. -# 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); - - if (exists $directory_map{$cdir}) - { - 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 must be removed by 'make distclean'. - $clean_files{$dirstamp} = DIST_CLEAN; - - $output_rules .= ("$dirstamp:\n" - . "\t\@\$(MKDIR_P) $directory\n" - . "\t\@: > $dirstamp\n"); - - return $dirstamp; -} - -# require_build_directory_maybe ($FILE) -# ------------------------------------- -# If $FILE lies in a subdirectory, emit a rule to create this -# directory and return the file that $FILE should be made -# dependent upon. Otherwise, just return the empty string. -sub require_build_directory_maybe -{ - my $file = shift; - my $directory = dirname ($file); - - if ($directory ne '.') - { - return require_build_directory ($directory); - } - else - { - return ''; - } -} - -################################################################ - -# Push a list of files onto '@dist_common'. -sub push_dist_common -{ - prog_error "push_dist_common run after handle_dist" - if $handle_dist_run; - Automake::Variable::define ('DIST_COMMON', VAR_AUTOMAKE, '+', TRUE, "@_", - '', INTERNAL, VAR_PRETTY); -} - - -################################################################ - -# generate_makefile ($MAKEFILE_AM, $MAKEFILE_IN) -# ---------------------------------------------- -# Generate a Makefile.in given the name of the corresponding Makefile and -# the name of the file output by config.status. -sub generate_makefile -{ - my ($makefile_am, $makefile_in) = @_; - - # Reset all the Makefile.am related variables. - initialize_per_input; - - # AUTOMAKE_OPTIONS can contains -W flags to disable or enable - # warnings for this file. So hold any warning issued before - # we have processed AUTOMAKE_OPTIONS. - buffer_messages ('warning'); - - # $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 the subroutine - # 'scan_autoconf_files' for details. - my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in}); - - $relative_dir = dirname ($makefile); - - read_main_am_file ($makefile_am, $makefile_in); - if (not handle_options) - { - # Process buffered warnings. - flush_messages; - # Fatal error. Just return, so we can continue with next file. - return; - } - # Process buffered warnings. - flush_messages; - - # There are a few install-related variables that you should not define. - foreach my $var ('PRE_INSTALL', 'POST_INSTALL', 'NORMAL_INSTALL') - { - my $v = var $var; - if ($v) - { - my $def = $v->def (TRUE); - prog_error "$var not defined in condition TRUE" - unless $def; - reject_var $var, "'$var' should not be defined" - if $def->owner != VAR_AUTOMAKE; - } - } - - # Catch some obsolete variables. - msg_var ('obsolete', 'INCLUDES', - "'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')") - if var ('INCLUDES'); - - # 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_gnu_standards; - check_gnits_standards; - - handle_configure ($makefile_am, $makefile_in, $makefile, @inputs); - handle_gettext; - handle_libraries; - handle_ltlibraries; - handle_programs; - handle_scripts; - - handle_silent; - - # 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_texinfo; - handle_emacs_lisp; - handle_python; - handle_java; - handle_man_pages; - handle_data; - handle_headers; - handle_subdirs; - handle_user_recursion; - handle_tags; - handle_minor_options; - # Must come after handle_programs so that %known_programs is up-to-date. - handle_tests; - - # This must come after most other rules. - handle_dist; - - handle_footer; - do_check_merge_target; - handle_all ($makefile); - - # FIXME: Gross! - if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS')) - { - $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n"; - } - if (var ('nobase_lib_LTLIBRARIES') && var ('bin_PROGRAMS')) - { - $output_rules .= "install-binPROGRAMS: install-nobase_libLTLIBRARIES\n\n"; - } - - handle_install; - handle_clean ($makefile); - handle_factored_dependencies; - - # Comes last, because all the above procedures may have - # defined or overridden variables. - $output_vars .= output_variables; - - check_typos; - - if ($exit_code != 0) - { - verb "not writing $makefile_in because of earlier errors"; - return; - } - - my $am_relative_dir = dirname ($makefile_am); - mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir; - - # 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 $makefile_in; - if (! $force_generation - && $configure_deps_greatest_timestamp < $timestamp - && $output_deps_greatest_timestamp < $timestamp - && $output eq contents ($makefile_in)) - { - verb "$makefile_in unchanged"; - # No need to update. - return; - } - - if (-e $makefile_in) - { - unlink ($makefile_in) - or fatal "cannot remove $makefile_in: $!"; - } - - my $gm_file = new Automake::XFile "> $makefile_in"; - verb "creating $makefile_in"; - print $gm_file $output; -} - - -################################################################ - - -# Helper function for usage(). -sub print_autodist_files -{ - # NOTE: we need to call our 'uniq' function with the leading '&' - # here, because otherwise perl complains that "Unquoted string - # 'uniq' may clash with future reserved word". - my @lcomm = sort (&uniq (@_)); - - my @four; - format USAGE_FORMAT = - @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< - $four[0], $four[1], $four[2], $four[3] -. - local $~ = "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; - } -} - - -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: - --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 set directory storing library files - --print-libdir print directory storing library files - -c, --copy with -a, copy missing files (default is symlink) - -f, --force-missing force update of standard files - -"; - Automake::ChannelDefs::usage; - - print "\nFiles automatically distributed if found " . - "(always):\n"; - print_autodist_files @common_files; - print "\nFiles automatically distributed if found " . - "(under certain conditions):\n"; - print_autodist_files @common_sometimes; - - print ' -Report bugs to . -GNU Automake home page: . -General help using GNU software: . -'; - - # --help always returns 0 per GNU standards. - exit 0; -} - - -sub version () -{ - print < -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF - # --version always returns 0 per GNU standards. - exit 0; -} - -################################################################ - -# Parse command line. -sub parse_arguments () -{ - my $strict = 'gnu'; - my $ignore_deps = 0; - my @warnings = (); - - my %cli_options = - ( - 'version' => \&version, - 'help' => \&usage, - 'libdir=s' => \$libdir, - 'print-libdir' => sub { print "$libdir\n"; exit 0; }, - 'gnu' => sub { $strict = 'gnu'; }, - 'gnits' => sub { $strict = 'gnits'; }, - 'foreign' => sub { $strict = 'foreign'; }, - 'include-deps' => sub { $ignore_deps = 0; }, - 'i|ignore-deps' => sub { $ignore_deps = 1; }, - 'no-force' => sub { $force_generation = 0; }, - 'f|force-missing' => \$force_missing, - 'a|add-missing' => \$add_missing, - 'c|copy' => \$copy_missing, - 'v|verbose' => sub { setup_channel 'verb', silent => 0; }, - 'W|warnings=s' => \@warnings, - ); - - use Automake::Getopt (); - Automake::Getopt::parse_options %cli_options; - - set_strictness ($strict); - my $cli_where = new Automake::Location; - set_global_option ('no-dependencies', $cli_where) if $ignore_deps; - for my $warning (@warnings) - { - parse_warnings ('-W', $warning); - } - - return unless @ARGV; - - 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; -} - - -# handle_makefile ($MAKEFILE) -# --------------------------- -sub handle_makefile -{ - my ($file) = @_; - ($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; - } -} - -# Deal with all makefiles, without threads. -sub handle_makefiles_serial () -{ - foreach my $file (@input_files) - { - handle_makefile ($file); - } -} - -# Logic for deciding how many worker threads to use. -sub get_number_of_threads () -{ - my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0; - - $nthreads = 0 - unless $nthreads =~ /^[0-9]+$/; - - # It doesn't make sense to use more threads than makefiles, - my $max_threads = @input_files; - - if ($nthreads > $max_threads) - { - $nthreads = $max_threads; - } - return $nthreads; -} - -# handle_makefiles_threaded ($NTHREADS) -# ------------------------------------- -# Deal with all makefiles, using threads. The general strategy is to -# spawn NTHREADS worker threads, dispatch makefiles to them, and let the -# worker threads push back everything that needs serialization: -# * warning and (normal) error messages, for stable stderr output -# order and content (avoiding duplicates, for example), -# * races when installing aux files (and respective messages), -# * races when collecting aux files for distribution. -# -# The latter requires that the makefile that deals with the aux dir -# files be handled last, done by the master thread. -sub handle_makefiles_threaded -{ - my ($nthreads) = @_; - - # The file queue distributes all makefiles, the message queues - # collect all serializations needed for respective files. - my $file_queue = Thread::Queue->new; - my %msg_queues; - foreach my $file (@input_files) - { - $msg_queues{$file} = Thread::Queue->new; - } - - verb "spawning $nthreads worker threads"; - my @threads = (1 .. $nthreads); - foreach my $t (@threads) - { - $t = threads->new (sub - { - while (my $file = $file_queue->dequeue) - { - verb "handling $file"; - my $queue = $msg_queues{$file}; - setup_channel_queue ($queue, QUEUE_MESSAGE); - $required_conf_file_queue = $queue; - handle_makefile ($file); - $queue->enqueue (undef); - setup_channel_queue (undef, undef); - $required_conf_file_queue = undef; - } - return $exit_code; - }); - } - - # Queue all makefiles. - verb "queuing " . @input_files . " input files"; - $file_queue->enqueue (@input_files, (undef) x @threads); - - # Collect and process serializations. - foreach my $file (@input_files) - { - verb "dequeuing messages for " . $file; - reset_local_duplicates (); - my $queue = $msg_queues{$file}; - while (my $key = $queue->dequeue) - { - if ($key eq QUEUE_MESSAGE) - { - pop_channel_queue ($queue); - } - elsif ($key eq QUEUE_CONF_FILE) - { - require_queued_file_check_or_copy ($queue); - } - else - { - prog_error "unexpected key $key"; - } - } - } - - foreach my $t (@threads) - { - my @exit_thread = $t->join; - $exit_code = $exit_thread[0] - if ($exit_thread[0] > $exit_code); - } -} - -################################################################ - -# 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"); - } - -my $nthreads = get_number_of_threads (); - -if ($perl_threads && $nthreads >= 1) - { - handle_makefiles_threaded ($nthreads); - } -else - { - handle_makefiles_serial (); - } - -exit $exit_code; - - -### Setup "GNU" style for perl-mode and cperl-mode. -## Local Variables: -## perl-indent-level: 2 -## perl-continued-statement-offset: 2 -## perl-continued-brace-offset: 0 -## perl-brace-offset: 0 -## perl-brace-imaginary-offset: 0 -## perl-label-offset: -2 -## cperl-indent-level: 2 -## cperl-brace-offset: 0 -## cperl-continued-brace-offset: 0 -## cperl-label-offset: -2 -## cperl-extra-newline-before-brace: t -## cperl-merge-trailing-else: nil -## cperl-continued-statement-offset: 2 -## End: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoreconf b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoreconf deleted file mode 100755 index 46372b54c..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoreconf +++ /dev/null @@ -1,718 +0,0 @@ -#! /usr/bin/perl -w -# -*- perl -*- -# Generated from autoreconf.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# autoreconf - install the GNU Build System in a directory tree -# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Written by David J. MacKenzie. -# Extended and rewritten in Perl by Akim Demaille. - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::Configure_ac; -use Autom4te::FileUtils; -use Autom4te::General; -use Autom4te::XFile; -# Do not use Cwd::chdir, since it might hang. -use Cwd 'cwd'; -use strict; - -## ----------- ## -## Variables. ## -## ----------- ## - -# $HELP -# ----- -$help = "Usage: $0 [OPTION]... [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 `.'). - -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 -`--force' option. - -Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don't remove temporary files - -f, --force consider 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 . " - -The environment variable \`WARNINGS\' is honored. Some subtools might -support other warning types, using \`all' is encouraged. - -Library directories: - -B, --prepend-include=DIR prepend directory DIR to search path - -I, --include=DIR append directory DIR to search path - -The environment variables AUTOM4TE, AUTOCONF, AUTOHEADER, AUTOMAKE, -ACLOCAL, AUTOPOINT, LIBTOOLIZE, M4, and MAKE are honored. - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - -# $VERSION -# -------- -$version = "autoreconf (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by David J. MacKenzie and Akim Demaille. -"; - -# Lib files. -my $autoconf = $ENV{'AUTOCONF'} || '/i686-pc-cygwin/bin/autoconf'; -my $autoheader = $ENV{'AUTOHEADER'} || '/i686-pc-cygwin/bin/autoheader'; -my $autom4te = $ENV{'AUTOM4TE'} || '/i686-pc-cygwin/bin/autom4te'; -my $automake = $ENV{'AUTOMAKE'} || 'automake'; -my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; -my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; -my $autopoint = $ENV{'AUTOPOINT'} || 'autopoint'; -my $make = $ENV{'MAKE'} || 'make'; - -# --install -- as --add-missing in other tools. -my $install = 0; -# symlink -- when --install, use symlinks instead. -my $symlink = 0; -# Does aclocal support --force? -my $aclocal_supports_force = 0; -# Does aclocal support -Wfoo? -my $aclocal_supports_warnings = 0; -# Does automake support --force-missing? -my $automake_supports_force_missing = 0; -# Does automake support -Wfoo? -my $automake_supports_warnings = 0; - -my @prepend_include; -my @include; - -# List of command line warning requests. -my @warning; - -# Rerun `./configure && make'? -my $run_make = 0; - -# Recurse into subpackages -my $recursive = 1; - -## ---------- ## -## Routines. ## -## ---------- ## - - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - my $srcdir; - - getopt ("W|warnings=s" => \@warning, - 'I|include=s' => \@include, - 'B|prepend-include=s' => \@prepend_include, - 'i|install' => \$install, - 's|symlink' => \$symlink, - 'm|make' => \$run_make, - 'recursive!' => \$recursive); - - # 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 - # is simpler, and (ii) we are still able to diagnose simultaneous - # presence of configure.ac and configure.in. - @ARGV = map { /configure\.(ac|in)$/ ? dirname ($_) : $_ } @ARGV; - push @ARGV, '.' unless @ARGV; - - if ($verbose && $debug) - { - for my $prog ($autoconf, $autoheader, - $automake, $aclocal, - $autopoint, - $libtoolize) - { - xsystem ("$prog --version | sed 1q >&2"); - print STDERR "\n"; - } - } - - my $aclocal_help = `$aclocal --help 2>/dev/null`; - my $automake_help = `$automake --help 2>/dev/null`; - $aclocal_supports_force = $aclocal_help =~ /--force/; - $aclocal_supports_warnings = $aclocal_help =~ /--warnings/; - $automake_supports_force_missing = $automake_help =~ /--force-missing/; - $automake_supports_warnings = $automake_help =~ /--warnings/; - - # Dispatch autoreconf's option to the tools. - # --include; - $aclocal .= join (' -I ', '', map { shell_quote ($_) } @include); - $autoconf .= join (' --include=', '', map { shell_quote ($_) } @include); - $autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); - $autoheader .= join (' --include=', '', map { shell_quote ($_) } @include); - $autoheader .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); - - # --install and --symlink; - if ($install) - { - $automake .= ' --add-missing'; - $automake .= ' --copy' unless $symlink; - $libtoolize .= ' --copy' unless $symlink; - } - # --force; - if ($force) - { - $aclocal .= ' --force' - if $aclocal_supports_force; - $autoconf .= ' --force'; - $autoheader .= ' --force'; - $automake .= ' --force-missing' - if $automake_supports_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; - } - # --verbose --verbose or --debug; - if ($verbose > 1 || $debug) - { - $autoconf .= ' --verbose'; - $autoheader .= ' --verbose'; - $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 - if $automake_supports_warnings; - $aclocal .= $warn - if $aclocal_supports_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; - - # ---------------------- # - # Is it using Autoconf? # - # ---------------------- # - - 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/; - } - } - if (!$uses_autoconf) - { - verb "$configure_ac: not using Autoconf"; - return; - } - - - # ------------------- # - # Running autopoint. # - # ------------------- # - - # Gettext is a bit of a problem: its macros are not necessarily - # visible to aclocal, so if we start with a completely striped down - # package (think of a fresh CVS checkout), running `aclocal' first - # will fail: the Gettext macros are missing. - # - # Therefore, we can't use the traces to decide if we use Gettext or - # not. I guess that once Gettext move to 2.5x we will be able to, - # but in the meanwhile forget it. - # - # We can only grep for AM_GNU_GETTEXT_VERSION in configure.ac. You - # might think this approach is naive, and indeed it is, as it - # prevents one to embed AM_GNU_GETTEXT_VERSION in another *.m4, but - # anyway we don't limit the generality, since... that's what - # autopoint does. Actually, it is even more restrictive, as it - # greps for `^AM_GNU_GETTEXT_VERSION('. We did this above, while - # scanning configure.ac. - if (!$uses_gettext) - { - verb "$configure_ac: not using Gettext"; - } - elsif (!$install) - { - verb "$configure_ac: not running autopoint: --install not given"; - } - else - { - xsystem_hint ("autopoint is needed because this package uses Gettext", "$autopoint"); - } - - - # ----------------- # - # Running aclocal. # - # ----------------- # - - # Run it first: it might discover new macros to add, e.g., - # AC_PROG_LIBTOOL, which we will trace later to see if Libtool is - # used. - # - # Always run it. Tracking its sources for up-to-dateness is too - # complex and too error prone. The best we can do is avoiding - # nuking the time stamp. - my $uses_aclocal = 1; - - # Nevertheless, if aclocal.m4 exists and is not made by aclocal, - # don't run aclocal. - - if (-f 'aclocal.m4') - { - my $aclocal_m4 = new Autom4te::XFile 'aclocal.m4'; - $_ = $aclocal_m4->getline; - $uses_aclocal = 0 - unless defined ($_) && /generated.*by aclocal/; - } - - # If there are flags for aclocal in Makefile.am, use them. - my $aclocal_flags = ''; - if ($uses_aclocal && -f 'Makefile.am') - { - my $makefile = new Autom4te::XFile 'Makefile.am'; - while ($_ = $makefile->getline) - { - if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/) - { - $aclocal_flags = $1; - last; - } - } - } - - if (!$uses_aclocal) - { - verb "$configure_ac: not using aclocal"; - } - else - { - # Some file systems 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 - # resolution of only 1 second. Work around the problem by - # ensuring that there is at least a one-second window before the - # time stamp of aclocal.m4t in which no file time stamps can - # fall. - sleep 1; - - run_aclocal ($aclocal, $aclocal_flags); - } - - # We might have to rerun aclocal if Libtool (or others) imports new - # macros. - my $rerun_aclocal = 0; - - - - # ------------------------------- # - # See what tools will be needed. # - # ------------------------------- # - - # 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"; - my $traces = new Autom4te::XFile - ("$autoconf" - . join (' ', - map { ' --trace=' . $_ . ':\$n::\${::}%' } - # If you change this list, update the - # `Autoreconf-preselections' section of autom4te.in. - 'AC_CONFIG_AUX_DIR', - 'AC_CONFIG_HEADERS', - 'AC_CONFIG_SUBDIRS', - 'AC_INIT', - 'AC_PROG_LIBTOOL', - 'LT_INIT', - 'LT_CONFIG_LTDL_DIR', - 'AM_GNU_GETTEXT', - 'AM_INIT_AUTOMAKE', - ) - . ' |'); - while ($_ = $traces->getline) - { - chomp; - my ($macro, @args) = split (/::/); - $aux_dir = $args[0] if $macro eq "AC_CONFIG_AUX_DIR"; - $uses_autoconf = 1 if $macro eq "AC_INIT"; - $uses_gettext_via_traces = 1 if $macro eq "AM_GNU_GETTEXT"; - $uses_libtool = 1 if $macro eq "AC_PROG_LIBTOOL" - || $macro eq "LT_INIT"; - $uses_libltdl = 1 if $macro eq "LT_CONFIG_LTDL_DIR"; - $uses_autoheader = 1 if $macro eq "AC_CONFIG_HEADERS"; - $uses_automake = 1 if $macro eq "AM_INIT_AUTOMAKE"; - push @subdir, split (' ', $args[0]) - if $macro eq "AC_CONFIG_SUBDIRS" && $recursive; - } - - # The subdirs are *optional*, they may not exist. - foreach (@subdir) - { - if (-d) - { - verb "$configure_ac: adding subdirectory $_ to autoreconf"; - autoreconf ($_); - } - else - { - verb "$configure_ac: subdirectory $_ not present"; - } - } - - # Gettext consistency checks... - error "$configure_ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION" - if $uses_gettext_via_traces && ! $uses_gettext; - error "$configure_ac: AM_GNU_GETTEXT_VERSION is used, but not AM_GNU_GETTEXT" - 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"; - } - elsif ($install) - { - if ($uses_libltdl) - { - $libtoolize .= " --ltdl"; - } - xsystem_hint ("libtoolize is needed because this package uses Libtool", $libtoolize); - $rerun_aclocal = 1; - } - else - { - verb "$configure_ac: not running libtoolize: --install not given"; - } - - - - # ------------------- # - # Rerunning aclocal. # - # ------------------- # - - # If we re-installed Libtool or Gettext, the macros might have changed. - # Automake also needs an up-to-date aclocal.m4. - if ($rerun_aclocal) - { - if (!$uses_aclocal) - { - verb "$configure_ac: not using aclocal"; - } - else - { - run_aclocal ($aclocal, $aclocal_flags); - } - } - - - # ------------------ # - # Running autoconf. # - # ------------------ # - - # Don't try to be smarter than `autoconf', which does its own up to - # date checks. - # - # We prefer running autoconf before autoheader, because (i) the - # latter runs the former, and (ii) autoconf is stricter than - # autoheader. So all in all, autoconf should give better error - # messages. - xsystem ($autoconf); - - - # -------------------- # - # Running autoheader. # - # -------------------- # - - # We now consider that if AC_CONFIG_HEADERS is used, then autoheader - # is used too. - # - # Just as for autoconf, up to date ness is performed by the tool - # itself. - # - # Run it before automake, since the latter checks the presence of - # config.h.in when it sees an AC_CONFIG_HEADERS. - if (!$uses_autoheader) - { - verb "$configure_ac: not using Autoheader"; - } - else - { - xsystem ($autoheader); - } - - - # ------------------ # - # Running automake. # - # ------------------ # - - if (!$uses_automake) - { - verb "$configure_ac: not using Automake"; - } - else - { - # We should always run automake, and let it decide whether it shall - # update the file or not. In fact, the effect of `$force' is already - # included in `$automake' via `--no-force'. - xsystem ($automake); - } - - - # -------------- # - # Running make. # - # -------------- # - - if ($run_make) - { - if (!-f "config.status") - { - verb "no config.status: cannot re-make"; - } - else - { - xsystem ("./config.status --recheck"); - xsystem ("./config.status"); - if (!-f "Makefile") - { - verb "no Makefile: cannot re-make"; - } - else - { - xsystem ("$make"); - } - } - } -} - - -# &autoreconf ($DIRECTORY) -# ------------------------ -# Reconf the $DIRECTORY. -sub autoreconf ($) -{ - my ($directory) = @_; - my $cwd = cwd; - - # The format for this message is not free: taken from Emacs, itself - # using GNU Make's format. - verb "Entering directory `$directory'"; - chdir $directory - or error "cannot chdir to $directory: $!"; - - autoreconf_current_directory; - - # The format is not free: taken from Emacs, itself using GNU Make's - # format. - verb "Leaving directory `$directory'"; - chdir $cwd - or error "cannot chdir to $cwd: $!"; -} - - -## ------ ## -## Main. ## -## ------ ## - -# When debugging, it is convenient that all the related temporary -# files be at the same place. -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. -$ENV{'AUTOM4TE'} = $autom4te; -for my $directory (@ARGV) - { - require_configure_ac ($directory); - autoreconf ($directory); - } - -### 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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoscan b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoscan deleted file mode 100755 index 57497fb2d..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoscan +++ /dev/null @@ -1,679 +0,0 @@ -#! /usr/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, -# 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Written by David MacKenzie . - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::ChannelDefs; -use Autom4te::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); - -# The kind of the words we are looking for. -my @kinds = qw (function header identifier program - makevar librarie); - -# For each kind, the default macro. -my %generic_macro = - ( - 'function' => 'AC_CHECK_FUNCS', - 'header' => 'AC_CHECK_HEADERS', - 'identifier' => 'AC_CHECK_TYPES', - 'program' => 'AC_CHECK_PROGS', - 'library' => 'AC_CHECK_LIB' - ); - -my %kind_comment = - ( - 'function' => 'Checks for library functions.', - 'header' => 'Checks for header files.', - 'identifier' => 'Checks for typedefs, structures, and compiler characteristics.', - 'program' => 'Checks for programs.', - ); - -# $USED{KIND}{ITEM} is the list of locations where the ITEM (of KIND) was used -# in the user package. -# For instance $USED{function}{alloca} is the list of `file:line' where -# `alloca (...)' appears. -my %used = (); - -# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM. -# Initialized from lib/autoscan/*. E.g., $MACRO{function}{alloca} contains -# the singleton AC_FUNC_ALLOCA. Some require several checks. -my %macro = (); - -# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO. -# E.g., $NEEDED_MACROS{AC_FUNC_ALLOC} the list of `file:line' containing -# `alloca (...)'. -my %needed_macros = - ( - 'AC_PREREQ' => [$me], - ); - -my $configure_scan = 'configure.scan'; -my $log; - -# Autoconf and lib files. -my $autom4te = $ENV{'AUTOM4TE'} || '/i686-pc-cygwin/bin/autom4te'; -my $autoconf = "$autom4te --language=autoconf"; -my @prepend_include; -my @include = ('//share/autoconf'); - -# $help -# ----- -$help = "Usage: $0 [OPTION]... [SRCDIR] - -Examine source files in the directory tree rooted at SRCDIR, or the -current directory if none is given. Search the source files for -common portability problems, check for incompleteness of -`configure.ac', and create a file `$configure_scan' which is a -preliminary `configure.ac' for that package. - - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don't remove temporary files - -Library directories: - -B, --prepend-include=DIR prepend directory DIR to search path - -I, --include=DIR append directory DIR to search path - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - -# $version -# -------- -$version = "autoscan (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by David J. MacKenzie and Akim Demaille. -"; - - - - -## ------------------------ ## -## Command line interface. ## -## ------------------------ ## - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - getopt ('I|include=s' => \@include, - 'B|prepend-include=s' => \@prepend_include); - - die "$me: too many arguments -Try `$me --help' for more information.\n" - if @ARGV > 1; - - my $srcdir = $ARGV[0] || "."; - - verb "srcdir = $srcdir"; - chdir $srcdir || error "cannot cd to $srcdir: $!"; -} - - -# init_tables () -# -------------- -# Put values in the tables of what to do with each token. -sub init_tables () -{ - # The data file format supports only one line of macros per function. - # If more than that is required for a common portability problem, - # a new Autoconf macro should probably be written for that case, - # instead of duplicating the code in lots of configure.ac files. - my $file = find_file ("autoscan/autoscan.list", - reverse (@prepend_include), @include); - my $table = new Autom4te::XFile "< " . open_quote ($file); - my $tables_are_consistent = 1; - - while ($_ = $table->getline) - { - # Ignore blank lines and comments. - next - if /^\s*$/ || /^\s*\#/; - - # ': ' or... - # ': warn: '. - if (/^(\S+):\s+(\S+)\s+(\S.*)$/) - { - my ($kind, $word, $macro) = ($1, $2, $3); - error "$file:$.: invalid kind: $_" - unless grep { $_ eq $kind } @kinds; - push @{$macro{$kind}{$word}}, $macro; - } - else - { - error "$file:$.: invalid definition: $_"; - } - } - - if ($debug) - { - foreach my $kind (@kinds) - { - foreach my $word (sort keys %{$macro{$kind}}) - { - print "$kind: $word: @{$macro{$kind}{$word}}\n"; - } - } - - } -} - - -# used ($KIND, $WORD, [$WHERE]) -# ----------------------------- -# $WORD is used as a $KIND. -sub used ($$;$) -{ - my ($kind, $word, $where) = @_; - $where ||= "$File::Find::name:$."; - if ( - # Check for all the libraries. But `-links' is certainly a - # `find' argument, and `-le', a `test' argument. - ($kind eq 'library' && $word !~ /^(e|inks)$/) - # Other than libraries are to be checked only if listed in - # the Autoscan library files. - || defined $macro{$kind}{$word} - ) - { - push (@{$used{$kind}{$word}}, $where); - } -} - - - -## ----------------------- ## -## Scanning source files. ## -## ----------------------- ## - - -# scan_c_file ($FILE-NAME) -# ------------------------ -sub scan_c_file ($) -{ - my ($file_name) = @_; - push @cfiles, $File::Find::name; - - # Nonzero if in a multiline comment. - my $in_comment = 0; - - my $file = new Autom4te::XFile "< " . open_quote ($file_name); - - while ($_ = $file->getline) - { - # Strip out comments. - if ($in_comment && s,^.*?\*/,,) - { - $in_comment = 0; - } - # The whole line is inside a commment. - next if $in_comment; - # All on one line. - s,/\*.*?\*/,,g; - - # Starting on this line. - if (s,/\*.*$,,) - { - $in_comment = 1; - } - - # Preprocessor directives. - if (s/^\s*\#\s*//) - { - if (/^include\s*<([^>]*)>/) - { - used ('header', $1); - } - if (s/^(if|ifdef|ifndef|elif)\s+//) - { - foreach my $word (split (/\W+/)) - { - used ('identifier', $word) - unless $word eq 'defined' || $word !~ /^[a-zA-Z_]/; - } - } - # Ignore other preprocessor directives. - next; - } - - # Remove string and character constants. - s,\"[^\"]*\",,g; - s,\'[^\']*\',,g; - - # Tokens in the code. - # Maybe we should ignore function definitions (in column 0)? - while (s/\b([a-zA-Z_]\w*)\s*\(/ /) - { - used ('function', $1); - } - while (s/\b([a-zA-Z_]\w*)\b/ /) - { - used ('identifier', $1); - } - } - - $file->close; -} - - -# scan_makefile($MAKEFILE-NAME) -# ----------------------------- -sub scan_makefile ($) -{ - my ($file_name) = @_; - push @makefiles, $File::Find::name; - - my $file = new Autom4te::XFile "< " . open_quote ($file_name); - - while ($_ = $file->getline) - { - # Strip out comments. - s/#.*//; - - # Variable assignments. - while (s/\b([a-zA-Z_]\w*)\s*=/ /) - { - used ('makevar', $1); - } - # Be sure to catch a whole word. For instance `lex$U.$(OBJEXT)' - # is a single token. Otherwise we might believe `lex' is needed. - foreach my $word (split (/\s+/)) - { - # Libraries. - if ($word =~ /^-l([a-zA-Z_]\w*)$/) - { - used ('library', $1); - } - # Tokens in the code. - # We allow some additional characters, e.g., `+', since - # autoscan/programs includes `c++'. - if ($word =~ /^[a-zA-Z_][\w+]*$/) - { - used ('program', $word); - } - } - } - - $file->close; -} - - -# scan_sh_file($SHELL-SCRIPT-NAME) -# -------------------------------- -sub scan_sh_file ($) -{ - my ($file_name) = @_; - push @shfiles, $File::Find::name; - - my $file = new Autom4te::XFile "< " . open_quote ($file_name); - - while ($_ = $file->getline) - { - # Strip out comments and variable references. - s/#.*//; - s/\${[^\}]*}//g; - s/@[^@]*@//g; - - # Tokens in the code. - while (s/\b([a-zA-Z_]\w*)\b/ /) - { - used ('program', $1); - } - } - - $file->close; -} - - -# scan_file () -# ------------ -# Called by &find on each file. $_ contains the current file name with -# the current directory of the walk through. -sub scan_file () -{ - # Wanted only if there is no corresponding FILE.in. - return - if -f "$_.in"; - - # Save $_ as Find::File requires it to be preserved. - local $_ = $_; - - # 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; - scan_c_file ($_); - } - elsif (/\.(cc|cpp|cxx|CC|C|hh|hpp|hxx|HH|H|yy|ypp|ll|lpp)(\.in)?$/) - { - used 'program', 'c++', $File::Find::name; - scan_c_file ($_); - } - elsif ((/^((?:GNUm|M|m)akefile)(\.in)?$/ && ! -f "$1.am") - || /^(?:GNUm|M|m)akefile(\.am)?$/) - { - scan_makefile ($_); - } - elsif (/\.sh(\.in)?$/) - { - scan_sh_file ($_); - } -} - - -# scan_files () -# ------------- -# Read through the files and collect lists of tokens in them -# that might create nonportabilities. -sub scan_files () -{ - find (\&scan_file, '.'); - - if ($verbose) - { - print "cfiles: @cfiles\n"; - print "makefiles: @makefiles\n"; - print "shfiles: @shfiles\n"; - - foreach my $kind (@kinds) - { - print "\n$kind:\n"; - foreach my $word (sort keys %{$used{$kind}}) - { - print "$word: @{$used{$kind}{$word}}\n"; - } - } - } -} - - -## ----------------------- ## -## Output configure.scan. ## -## ----------------------- ## - - -# output_kind ($FILE, $KIND) -# -------------------------- -sub output_kind ($$) -{ - my ($file, $kind) = @_; - # Lists of words to be checked with the generic macro. - my @have; - - print $file "\n# $kind_comment{$kind}\n" - if exists $kind_comment{$kind}; - foreach my $word (sort keys %{$used{$kind}}) - { - # Output the needed macro invocations in $configure_scan if not - # already printed, and remember these macros are needed. - foreach my $macro (@{$macro{$kind}{$word}}) - { - if ($macro =~ /^warn:\s+(.*)/) - { - my $message = $1; - foreach my $location (@{$used{$kind}{$word}}) - { - warn "$location: warning: $message\n"; - } - } - elsif (exists $generic_macro{$kind} - && $macro eq $generic_macro{$kind}) - { - push (@have, $word); - push (@{$needed_macros{"$generic_macro{$kind}([$word])"}}, - @{$used{$kind}{$word}}); - } - else - { - if (! $printed{$macro}) - { - print $file "$macro\n"; - $printed{$macro} = 1; - } - push (@{$needed_macros{$macro}}, - @{$used{$kind}{$word}}); - } - } - } - print $file "$generic_macro{$kind}([" . join(' ', sort(@have)) . "])\n" - if @have; -} - - -# output_libraries ($FILE) -# ------------------------ -sub output_libraries ($) -{ - my ($file) = @_; - - print $file "\n# Checks for libraries.\n"; - foreach my $word (sort keys %{$used{'library'}}) - { - print $file "# FIXME: Replace `main' with a function in `-l$word':\n"; - print $file "AC_CHECK_LIB([$word], [main])\n"; - } -} - - -# output ($CONFIGURE_SCAN) -# ------------------------ -# Print a proto configure.ac. -sub output ($) -{ - my $configure_scan = shift; - my %unique_makefiles; - - my $file = new Autom4te::XFile "> " . open_quote ($configure_scan); - - print $file - ("# -*- Autoconf -*-\n" . - "# Process this file with autoconf to produce a configure script.\n" . - "\n" . - "AC_PREREQ([2.68])\n" . - "AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])\n"); - if (defined $cfiles[0]) - { - print $file "AC_CONFIG_SRCDIR([$cfiles[0]])\n"; - print $file "AC_CONFIG_HEADERS([config.h])\n"; - } - - output_kind ($file, 'program'); - output_kind ($file, 'makevar'); - output_libraries ($file); - output_kind ($file, 'header'); - output_kind ($file, 'identifier'); - output_kind ($file, 'function'); - - print $file "\n"; - if (@makefiles) - { - # Change DIR/Makefile.in to DIR/Makefile. - foreach my $m (@makefiles) - { - $m =~ s/\.(?:in|am)$//; - $unique_makefiles{$m}++; - } - print $file ("AC_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; -} - - - -## --------------------------------------- ## -## Checking the accuracy of configure.ac. ## -## --------------------------------------- ## - - -# &check_configure_ac ($CONFIGURE_AC) -# ----------------------------------- -# Use autoconf to check if all the suggested macros are included -# in CONFIGURE_AC. -sub check_configure_ac ($) -{ - my ($configure_ac) = @_; - - # Find what needed macros are invoked in CONFIGURE_AC. - # I'd be very happy if someone could explain to me why sort (uniq ...) - # doesn't work properly: I need `uniq (sort ...)'. --akim - my $trace_option = - join (' --trace=', '', - uniq (sort (map { s/\(.*//; $_ } keys %needed_macros))); - - verb "running: $autoconf $trace_option $configure_ac"; - my $traces = - new Autom4te::XFile "$autoconf $trace_option $configure_ac |"; - - while ($_ = $traces->getline) - { - chomp; - my ($file, $line, $macro, @args) = split (/:/, $_); - if ($macro =~ /^AC_CHECK_(HEADER|FUNC|TYPE|MEMBER)S$/) - { - # To be rigorous, we should distinguish between space and comma - # separated macros. But there is no point. - foreach my $word (split (/\s|,/, $args[0])) - { - # AC_CHECK_MEMBERS wants `struct' or `union'. - if ($macro eq "AC_CHECK_MEMBERS" - && $word =~ /^stat.st_/) - { - $word = "struct " . $word; - } - delete $needed_macros{"$macro([$word])"}; - } - } - else - { - delete $needed_macros{$macro}; - } - } - - $traces->close; - - # Report the missing macros. - foreach my $macro (sort keys %needed_macros) - { - warn ("$configure_ac: warning: missing $macro wanted by: " - . (${$needed_macros{$macro}}[0]) - . "\n"); - print $log "$me: warning: missing $macro wanted by: \n"; - foreach my $need (@{$needed_macros{$macro}}) - { - print $log "\t$need\n"; - } - } -} - - -## -------------- ## -## Main program. ## -## -------------- ## - -parse_args; -$log = new Autom4te::XFile "> " . open_quote ("$me.log"); - -$autoconf .= " --debug" if $debug; -$autoconf .= " --verbose" if $verbose; -$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include); -$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); - -my $configure_ac = find_configure_ac; -init_tables; -scan_files; -output ('configure.scan'); -if (-f $configure_ac) - { - check_configure_ac ($configure_ac); - } -# This close is really needed. For some reason, probably best named -# a bug, it seems that the dtor of $LOG is not called automatically -# at END. It results in a truncated file. -$log->close; -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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoupdate b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoupdate deleted file mode 100755 index b5666362d..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/autoupdate +++ /dev/null @@ -1,1064 +0,0 @@ -#! /usr/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, -# 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Originally written by David MacKenzie . -# Rewritten by Akim Demaille . - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::Configure_ac; -use Autom4te::FileUtils; -use Autom4te::General; -use Autom4te::XFile; -use File::Basename; -use strict; - -# Lib files. -my $autom4te = $ENV{'AUTOM4TE'} || '/i686-pc-cygwin/bin/autom4te'; -my $autoconf = "$autom4te --language=autoconf"; -# We need to find m4sugar. -my @prepend_include; -my @include = ('//share/autoconf'); -my $force = 0; -# m4. -my $m4 = $ENV{"M4"} || '/usr/bin/m4'; - - -# $HELP -# ----- -$help = "Usage: $0 [OPTION]... [TEMPLATE-FILE]... - -Update each TEMPLATE-FILE if given, or `configure.ac' if present, -or else `configure.in', to the syntax of the current version of -Autoconf. The original files are backed up. - -Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don't remove temporary files - -f, --force consider all files obsolete - -Library directories: - -B, --prepend-include=DIR prepend directory DIR to search path - -I, --include=DIR append directory DIR to search path - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - -# $VERSION -# -------- -$version = "autoupdate (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by David J. MacKenzie and Akim Demaille. -"; - -## ---------- ## -## Routines. ## -## ---------- ## - - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - my $srcdir; - - getopt ('I|include=s' => \@include, - 'B|prepend-include=s' => \@prepend_include, - 'f|force' => \$force); - - if (! @ARGV) - { - my $configure_ac = require_configure_ac; - push @ARGV, $configure_ac; - } -} - - - -# ----------------- # -# Autoconf macros. # -# ----------------- # - -my (%ac_macros, %au_macros, %m4_builtins); - -# HANDLE_AUTOCONF_MACROS () -# ------------------------- -# @M4_BUILTINS -- M4 builtins and a useful comment. -sub handle_autoconf_macros () -{ - # Get the builtins. - xsystem ("echo dumpdef | $m4 2>" . shell_quote ("$tmp/m4.defs") . " >/dev/null"); - my $m4_defs = new Autom4te::XFile "< " . open_quote ("$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 |"); - 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$/) - { - # Add the m4sugar macros to m4_builtins. - $m4_builtins{$macro} = 1; - } - else - { - # Autoconf, aclocal, and m4sh macros. - $ac_macros{$macro} = 1; - } - } - $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); - error "no current Autoconf macros found" - unless keys %ac_macros; - error "no obsolete Autoconf macros found" - unless keys %au_macros; - - if ($debug) - { - print STDERR "Current Autoconf macros:\n"; - print STDERR join (' ', sort keys %ac_macros) . "\n\n"; - print STDERR "Obsolete Autoconf macros:\n"; - print STDERR join (' ', sort keys %au_macros) . "\n\n"; - } - - # ac.m4 -- autoquoting definitions of the AC macros (M4sugar excluded). - # unac.m4 -- undefine the AC macros. - my $ac_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/ac.m4"); - print $ac_m4 "# ac.m4 -- autoquoting definitions of the AC macros.\n"; - my $unac_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/unac.m4"); - print $unac_m4 "# unac.m4 -- undefine the AC macros.\n"; - foreach (sort 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 "> " . open_quote ("$tmp/m4save.m4"); - print $m4save_m4 "# m4save.m4 -- save the m4 builtins.\n"; - my $unm4_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/unm4.m4"); - print $unm4_m4 "# unm4.m4 -- disable the m4 builtins.\n"; - my $m4_m4 = new Autom4te::XFile "> " . open_quote ("$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"; - } -} - - -## -------------- ## -## Main program. ## -## -------------- ## - -parse_args; -$autoconf .= " --debug" if $debug; -$autoconf .= " --force" if $force; -$autoconf .= " --verbose" if $verbose; -$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include); -$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); - -mktmpdir ('au'); -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'; - -# au.m4 -- definitions the AU macros. -xsystem ("$autoconf --trace AU_DEFINE:'_au_defun(\@<:\@\$1\@:>\@, -\@<:\@\$2\@:>\@)' --melt /dev/null " - . ">" . shell_quote ("$tmp/au.m4")); - - - -## ------------------- ## -## Process the files. ## -## ------------------- ## - -foreach my $file (@ARGV) - { - # We need an actual file. - if ($file eq '-') - { - $file = "$tmp/stdin"; - system "cat >" . shell_quote ($file); - } - elsif (! -r "$file") - { - die "$me: $file: No such file or directory"; - } - - # input.m4 -- m4 program to produce the updated file. - # Load the values, the dispatcher, neutralize m4, and the prepared - # input file. - my $input_m4 = <<\EOF; - divert(-1) -*- Autoconf -*- - changequote([,]) - - # Define our special macros: - define([_au__defn], defn([defn])) - define([_au__divert], defn([divert])) - define([_au__ifdef], defn([ifdef])) - define([_au__include], defn([include])) - define([_au___undefine], defn([undefine])) - define([_au__undefine], [_au__ifdef([$1], [_au___undefine([$1])])]) - define([_au__save], [m4_ifdef([$1], - [m4_define([_au_$1], _m4_defn([$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)]) - - # Move all the builtins into the `_au_' pseudo namespace - 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_enable()dnl - $2[]dnl - _au_disable()])]) - - # Import the definition of the obsolete macros. - _au__include([au.m4]) - - - ## ------------------------ ## - ## _au_enable/_au_disable. ## - ## ------------------------ ## - - # They work by pair: each time an AU macro is activated, it runs - # _au_enable, and at its end its runs _au_disable (see _au_defun - # above). AU macros might use AU macros, which should - # enable/disable only for the outer AU macros. - # - # `_au_enabled' is used to this end, determining whether we really - # enable/disable. - - - # __au_enable - # ----------- - # Reenable the builtins, m4sugar, and the autoquoting AC macros. - _au_m4_define([__au_enable], - [_au__divert(-1) - # Enable special characters. - _au_m4_changecom([#]) - - _au__include([m4.m4]) - _au__include([ac.m4]) - - _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])]) - - - # __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 special characters. - _au_m4_changequote() - _au_m4_changecom() - - _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()])]) - - - ## ------------------------------- ## - ## Disable, and process the file. ## - ## ------------------------------- ## - # The AC autoquoting macros are not loaded yet, hence invoking - # `_au_disable' would be wrong. - _au__include([unm4.m4]) - - # Disable special characters, and set the first line number. - _au_m4_changequote() - _au_m4_changecom() - - _au_m4_define(_au__first_line, _au___line__)_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, "> " . open_quote ("$tmp/input.m4") - or error "cannot open: $!"; - open FILE, "< " . open_quote ($file) - or error "cannot open: $!"; - print INPUT_M4 "$input_m4"; - while () - { - eval $au_changequote; - print INPUT_M4; - } - close FILE - or error "cannot close $file: $!"; - close INPUT_M4 - or error "cannot close $tmp/input.m4: $!"; - - # Now ask m4 to perform the update. - xsystem ("$m4 --include=" . shell_quote ($tmp) - . join (' --include=', '', map { shell_quote ($_) } reverse (@prepend_include)) - . join (' --include=', '', map { shell_quote ($_) } @include) - . " " . shell_quote ("$tmp/input.m4") . " > " . shell_quote ("$tmp/updated")); - update_file ("$tmp/updated", - "$file" eq "$tmp/stdin" ? '-' : "$file"); - } -exit 0; - - -# ## ---------------------------- ## -# ## How `autoupdate' functions. ## -# ## ---------------------------- ## -# -# The task of `autoupdate' is not trivial: the biggest difficulty being -# that you must limit the changes to the parts that really need to be -# updated. Finding a satisfying implementation proved to be quite hard, -# as this is the fifth implementation of `autoupdate'. -# -# Below, we will use a simple example of an obsolete macro: -# -# AU_DEFUN([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))]) -# AC_DEFUN([NEW], [echo "sum($1) = $2"]) -# -# the input file contains -# -# dnl The Unbelievable Truth -# OLD(1, 2) -# NEW([0, 0], [0]) -# -# Of course the expected output is -# -# dnl The Unbelievable Truth -# NEW([1, 2], [3]) -# NEW([0, 0], [0]) -# -# -# # First implementation: sed -# # ========================= -# -# The first implementation was only able to change the name of obsolete -# macros. -# -# The file `acoldnames.m4' defined the old names based on the new names. -# It was simple then to produce a sed script such as: -# -# s/OLD/NEW/g -# -# Updating merely consisted in running this script on the file to -# update. -# -# This scheme suffers from an obvious limitation: that `autoupdate' was -# unable to cope with new macros that just swap some of its arguments -# compared to the old macro. Fortunately, that was enough to upgrade -# from Autoconf 1 to Autoconf 2. (But I have no idea whether the -# changes in Autoconf 2 were precisely limited by this constraint.) -# -# -# # Second implementation: hooks -# # ============================ -# -# The version 2.15 of Autoconf brought a vast number of changes compared -# to 2.13, so a solution was needed. One could think of extending the -# `sed' scripts with specialized code for complex macros. However, this -# approach is of course full of flaws: -# -# a. the Autoconf maintainers have to write these snippets, which we -# just don't want to, -# -# b. I really don't think you'll ever manage to handle the quoting of -# m4 with a sed script. -# -# To satisfy a., let's remark that the code which implements the old -# features in term of the new feature is exactly the code which should -# replace the old code. -# -# To answer point b, as usual in the history of Autoconf, the answer, at -# least on the paper, is simple: m4 is the best tool to parse m4, so -# let's use m4. -# -# Therefore the specification is: -# -# I want to be able to tell Autoconf, well, m4, that the macro I -# am currently defining is an obsolete macro (so that the user is -# warned), and its code is the code to use when running autoconf, -# but that the very same code has to be used when running -# autoupdate. To summarize, the interface I want is -# `AU_DEFUN(OLD-NAME, NEW-CODE)'. -# -# -# Now for the technical details. -# -# When running autoconf, except for the warning, AU_DEFUN is basically -# AC_DEFUN. -# -# When running autoupdate, we want *only* OLD-NAMEs to be expanded. -# This obviously means that acgeneral.m4 and acspecific.m4 must not be -# loaded. Nonetheless, because we want to use a rich set of m4 -# features, m4sugar.m4 is needed. Please note that the fact that -# Autoconf's macros are not loaded is positive on two points: -# -# - we do get an updated `configure.ac', not a `configure'! -# -# - the old macros are replaced by *calls* to the new-macros, not the -# body of the new macros, since their body is not defined!!! -# (Whoa, that's really beautiful!). -# -# Additionally we need to disable the quotes when reading the input for -# two reasons: first because otherwise `m4' will swallow the quotes of -# other macros: -# -# NEW([1, 2], 3) -# => NEW(1, 2, 3) -# -# and second, because we want to update the macro calls which are -# quoted, i.e., we want -# -# FOO([OLD(1, 2)]) -# => FOO([NEW([1, 2], [3])]) -# -# If we don't disable the quotes, only the macros called at the top -# level would be updated. -# -# So, let's disable the quotes. -# -# Well, not quite: m4sugar.m4 still needs to use quotes for some macros. -# Well, in this case, when running in autoupdate code, each macro first -# reestablishes the quotes, expands itself, and disables the quotes. -# -# Thinking a bit more, you realize that in fact, people may use `define', -# `ifelse' etc. in their files, and you certainly don't want to process -# them. Another example is `dnl': you don't want to remove the -# comments. You then realize you don't want exactly to import m4sugar: -# you want to specify when it is enabled (macros active), and disabled. -# m4sugar provides m4_disable/m4_enable to this end. -# -# You're getting close to it. Now remains one task: how to handle -# twofold definitions? -# -# Remember that the same AU_DEFUN must be understood in two different -# ways, the AC way, and the AU way. -# -# One first solution is to check whether acgeneral.m4 was loaded. But -# that's definitely not cute. Another is simply to install `hooks', -# that is to say, to keep in some place m4 knows, late `define' to be -# triggered *only* in AU mode. -# -# You first think of designing AU_DEFUN like this: -# -# 1. AC_DEFUN(OLD-NAME, -# [Warn the user OLD-NAME is obsolete. -# NEW-CODE]) -# -# 2. Store for late AU binding([define(OLD_NAME, -# [Reestablish the quotes. -# NEW-CODE -# Disable the quotes.])]) -# -# but this will not work: NEW-CODE probably uses $1, $2 etc. and these -# guys will be replaced with the argument of `Store for late AU binding' -# when you call it. -# -# I don't think there is a means to avoid this using this technology -# (remember that $1 etc. are *always* expanded in m4). You may also try -# to replace them with $[1] to preserve them for a later evaluation, but -# if `Store for late AU binding' is properly written, it will remain -# quoted till the end... -# -# You have to change technology. Since the problem is that `$1' -# etc. should be `consumed' right away, one solution is to define now a -# second macro, `AU_OLD-NAME', and to install a hook than binds OLD-NAME -# to AU_OLD-NAME. Then, autoupdate.m4 just need to run the hooks. By -# the way, the same method was used in autoheader. -# -# -# # Third implementation: m4 namespaces by m4sugar -# # ============================================== -# -# Actually, this implementation was just a clean up of the previous -# implementation: instead of defining hooks by hand, m4sugar was equipped -# with `namespaces'. What are they? -# -# Sometimes we want to disable some *set* of macros, and restore them -# later. We provide support for this via namespaces. -# -# There are basically three characters playing this scene: defining a -# macro in a namespace, disabling a namespace, and restoring a namespace -# (i.e., all the definitions it holds). -# -# Technically, to define a MACRO in NAMESPACE means to define the macro -# named `NAMESPACE::MACRO' to the VALUE. At the same time, we append -# `undefine(NAME)' in the macro named `m4_disable(NAMESPACE)', and -# similarly a binding of NAME to the value of `NAMESPACE::MACRO' in -# `m4_enable(NAMESPACE)'. These mechanisms allow to bind the macro of -# NAMESPACE and to unbind them at will. -# -# Of course this implementation is really inefficient: m4 has to grow -# strings which can become quickly huge, which slows it significantly. -# -# In particular one should avoid as much as possible to use `define' for -# temporaries. Now that `define' has quite a complex meaning, it is an -# expensive operations that should be limited to macros. Use -# `m4_define' for temporaries. -# -# Private copies of the macros we used in entering / exiting the m4sugar -# namespace. It is much more convenient than fighting with the renamed -# version of define etc. -# -# -# -# Those two implementations suffered from serious problems: -# -# - namespaces were really expensive, and incurred a major performance -# loss on `autoconf' itself, not only `autoupdate'. One solution -# would have been the limit the use of namespaces to `autoupdate', but -# that's again some complications on m4sugar, which really doesn't need -# this. So we wanted to get rid of the namespaces. -# -# - since the quotes were disabled, autoupdate was sometimes making -# wrong guesses, for instance on: -# -# foo([1, 2]) -# -# m4 saw 2 arguments: `[1'and `2]'. A simple solution, somewhat -# fragile, is to reestablish the quotes right before all the obsolete -# macros, i.e., to use sed so that the previous text becomes -# -# changequote([, ])foo([1, 2]) -# -# To this end, one wants to trace the definition of obsolete macros. -# -# It was there that the limitations of the namespace approach became -# painful: because it was a complex machinery playing a lot with the -# builtins of m4 (hence, quite fragile), tracing was almost impossible. -# -# -# So this approach was dropped. -# -# -# # The fourth implementation: two steps -# # ==================================== -# -# If you drop the uses of namespaces, you no longer can compute the -# updated value, and replace the old call with it simultaneously. -# -# Obviously you will use m4 to compute the updated values, but you may -# use some other tool to achieve the replacement. Personally, I trust -# nobody but m4 to parse m4, so below, m4 will perform the two tasks. -# -# How can m4 be used to replace *some* macros calls with newer values. -# Well, that's dead simple: m4 should learn the definitions of obsolete -# macros, forget its builtins, disable the quotes, and then run on the -# input file, which amounts to doing this: -# -# divert(-1)dnl -# changequote([, ]) -# define([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))changequote()]) -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# which will result in -# -# dnl The Unbelievable Truth -# NEW(1, 2, m4_eval(1 + 2)) -# NEW([0, 0], -# 0) -# -# Grpmh. Two problems. A minor problem: it would have been much better -# to have the `m4_eval' computed, and a major problem: you lost the -# quotation in the result. -# -# Let's address the big problem first. One solution is to define any -# modern macro to rewrite its calls with the proper quotation, thanks to -# `$@'. Again, tracing the `define's makes it possible to know which -# are these macros, so you input is: -# -# divert(-1)dnl -# changequote([, ]) -# define([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))changequote()]) -# define([NEW], [[NEW($@)]changequote()]) -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# changequote([, ])NEW([0, 0], -# 0) -# -# which results in -# -# dnl The Unbelievable Truth -# NEW([1, 2],[m4_eval(1 + 2)]) -# NEW([0, 0],[0]) -# -# Our problem is solved, i.e., the first call to `NEW' is properly -# quoted, but introduced another problem: we changed the layout of the -# second calls, which can be a drama in the case of huge macro calls -# (think of `AC_TRY_RUN' for instance). This example didn't show it, -# but we also introduced parens to macros which did not have some: -# -# AC_INIT -# => AC_INIT() -# -# No big deal for the semantics (unless the macro depends upon $#, which -# is bad), but the users would not be happy. -# -# Additionally, we introduced quotes that were not there before, which is -# OK in most cases, but could change the semantics of the file. -# -# Cruel dilemma: we do want the auto-quoting definition of `NEW' when -# evaluating `OLD', but we don't when we evaluate the second `NEW'. -# Back to namespaces? -# -# No. -# -# -# # Second step: replacement -# # ------------------------ -# -# No, as announced above, we will work in two steps: in a first step we -# compute the updated values, and in a second step we replace them. Our -# goal is something like this: -# -# divert(-1)dnl -# changequote([, ]) -# define([OLD], [NEW([1, 2], [3])changequote()]) -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# i.e., the new value of `OLD' is precomputed using the auto-quoting -# definition of `NEW' and the m4 builtins. We'll see how afterwards, -# let's finish with the replacement. -# -# Of course the solution above is wrong: if there were other calls to -# `OLD' with different values, we would smash them to the same value. -# But it is quite easy to generalize the scheme above: -# -# divert(-1)dnl -# changequote([, ]) -# define([OLD([1],[2])], [NEW([1, 2], [3])]) -# define([OLD], [defn([OLD($@)])changequote()]) -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# i.e., for each call to obsolete macros, we build an array `call => -# value', and use a macro to dispatch these values. This results in: -# -# dnl The Unbelievable Truth -# NEW([1, 2], [3]) -# NEW([0, 0], -# 0) -# -# In French, we say `Youpi !', which you might roughly translate as -# `Yippee!'. -# -# -# # First step: computation -# # ----------------------- -# -# Let's study the anatomy of the file, and name its sections: -# -# prologue -# divert(-1)dnl -# changequote([, ]) -# values -# define([OLD([1],[2])], [NEW([1, 2], [3])]) -# dispatcher -# define([OLD], [defn([OLD($@)])changequote()]) -# disabler -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# input -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# -# # Computing the `values' section -# # .............................. -# -# First we need to get the list of all the AU macro uses. To this end, -# first get the list of all the AU macros names by tracing `AU_DEFUN' in -# the initialization of autoconf. This list is computed in the file -# `au.txt' below. -# -# Then use this list to trace all the AU macro uses in the input. The -# goal is obtain in the case of our example: -# -# [define([OLD([1],[2])],]@<<@OLD([1],[2])@>>@[)] -# -# This is the file `values.in' below. -# -# We want to evaluate this with only the builtins (in fact m4sugar), the -# auto-quoting definitions of the new macros (`new.m4'), and the -# definition of the old macros (`old.m4'). Computing these last two -# files is easy: it's just a matter of using the right `--trace' option. -# -# So the content of `values.in' is: -# -# include($autoconf_dir/m4sugar.m4) -# m4_include(new.m4) -# m4_include(old.m4) -# divert(0)dnl -# [define([OLD([1],[2])],]@<<@OLD([1],[2])@>>@[)] -# -# We run m4 on it, which yields: -# -# define([OLD([1],[2])],@<<@NEW([1, 2], [3])@>>@) -# -# Transform `@<<@' and `@>>@' into quotes and we get -# -# define([OLD([1],[2])],[NEW([1, 2], [3])]) -# -# This is `values.m4'. -# -# -# # Computing the `dispatcher' section -# # .................................. -# -# The `prologue', and the `disabler' are simple and need no commenting. -# -# To compute the `dispatcher' (`dispatch.m4'), again, it is a simple -# matter of using the right `--trace'. -# -# Finally, the input is not exactly the input file, rather it is the -# input file with the added `changequote'. To this end, we build -# `quote.sed'. -# -# -# # Putting it all together -# # ....................... -# -# We build the file `input.m4' which contains: -# -# divert(-1)dnl -# changequote([, ]) -# include(values.m4) -# include(dispatch.m4) -# undefine([dnl]) -# undefine([eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# And we just run m4 on it. Et voila`, Monsieur ! Mais oui, mais oui. -# -# Well, there are a few additional technicalities. For instance, we -# rely on `changequote', `ifelse' and `defn', but we don't want to -# interpret the changequotes of the user, so we simply use another name: -# `_au_changequote' etc. -# -# -# # Failure of the fourth approach -# # ------------------------------ -# -# This approach is heavily based on traces, but then there is an obvious -# problem: non expanded code will never be seen. In particular, the body -# of a `define' definition is not seen, so on the input -# -# define([idem], [OLD(0, [$1])]) -# -# autoupdate would never see the `OLD', and wouldn't have updated it. -# Worse yet, if `idem(0)' was used later, then autoupdate sees that -# `OLD' is used, computes the result for `OLD(0, 0)' and sets up a -# dispatcher for `OLD'. Since there was no computed value for `OLD(0, -# [$1])', the dispatcher would have replaced with... nothing, leading -# to -# -# define([idem], []) -# -# With some more thinking, you see that the two step approach is wrong, -# the namespace approach was much saner. -# -# But you learned a lot, in particular you realized that using traces -# can make it possible to simulate namespaces! -# -# -# -# # The fifth implementation: m4 namespaces by files -# # ================================================ -# -# The fourth implementation demonstrated something unsurprising: you -# cannot precompute, i.e., the namespace approach was the right one. -# Still, we no longer want them, they're too expensive. Let's have a -# look at the way it worked. -# -# When updating -# -# dnl The Unbelievable Truth -# OLD(1, 2) -# NEW([0, 0], [0]) -# -# you evaluate `input.m4': -# -# divert(-1) -# changequote([, ]) -# define([OLD], -# [m4_enable()NEW([$1, $2], m4_eval([$1 + $2]))m4_disable()]) -# ... -# m4_disable() -# dnl The Unbelievable Truth -# OLD(1, 2) -# NEW([0, 0], [0]) -# -# where `m4_disable' undefines the m4 and m4sugar, and disables the quotes -# and comments: -# -# define([m4_disable], -# [undefine([__file__]) -# ... -# changecom(#) -# changequote()]) -# -# `m4_enable' does the converse: reestablish quotes and comments -# --easy--, reestablish m4sugar --easy: just load `m4sugar.m4' again-- and -# reenable the builtins. This later task requires that you first save -# the builtins. And BTW, the definition above of `m4_disable' cannot -# work: you undefined `changequote' before using it! So you need to use -# your privates copies of the builtins. Let's introduce three files for -# this: -# -# `m4save.m4' -# moves the m4 builtins into the `_au_' pseudo namespace, -# `unm4.m4' -# undefines the builtins, -# `m4.m4' -# restores them. -# -# So `input.m4' is: -# -# divert(-1) -# changequote([, ]) -# -# include([m4save.m4]) -# -# # Import AU. -# define([OLD], -# [m4_enable()NEW([$1, $2], m4_eval([$1 + $2]))m4_disable()]) -# -# define([_au_enable], -# [_au_changecom([#]) -# _au_include([m4.m4]) -# _au_include(m4sugar.m4)]) -# -# define([_au_disable], -# [# Disable m4sugar. -# # Disable the m4 builtins. -# _au_include([unm4.m4]) -# # 1. Disable special characters. -# _au_changequote() -# _au_changecom()]) -# -# m4_disable() -# dnl The Unbelievable Truth -# OLD(1, 2) -# NEW([0, 0], [0]) -# -# Based on what we learned in the fourth implementation we know that we -# have to enable the quotes *before* any AU macro, and we know we need -# to build autoquoting versions of the AC macros. But the autoquoting -# AC definitions must be disabled in the rest of the file, and enabled -# inside AU macros. -# -# Using `autoconf --trace' it is easy to build the files -# -# `ac.m4' -# define the autoquoting AC fake macros -# `disable.m4' -# undefine the m4sugar and AC autoquoting macros. -# `au.m4' -# definitions of the AU macros (such as `OLD' above). -# -# Now, `input.m4' is: -# -# divert(-1) -# changequote([, ]) -# -# include([m4save.m4]) -# # Import AU. -# include([au.m4]) -# -# define([_au_enable], -# [_au_changecom([#]) -# _au_include([m4.m4]) -# _au_include(m4sugar.m4) -# _au_include(ac.m4)]) -# -# define([_au_disable], -# [_au_include([disable.m4]) -# _au_include([unm4.m4]) -# # 1. Disable special characters. -# _au_changequote() -# _au_changecom()]) -# -# m4_disable() -# dnl The Unbelievable Truth -# _au_changequote([, ])OLD(1, 2) -# NEW([0, 0], [0]) -# -# Finally, version V is ready. -# -# Well... almost. -# -# There is a slight problem that remains: if an AU macro OUTER includes -# an AU macro INNER, then _au_enable will be run when entering OUTER -# and when entering INNER (not good, but not too bad yet). But when -# getting out of INNER, _au_disable will disable everything while we -# were still in OUTER. Badaboom. -# -# Therefore _au_enable and _au_disable have to be written to work by -# pairs: each _au_enable pushdef's _au_enabled, and each _au_disable -# popdef's _au_enabled. And of course _au_enable and _au_disable are -# effective when _au_enabled is *not* defined. -# -# Finally, version V' is ready. And there is much rejoicing. (And I -# have free time again. I think. Yeah, right.) - -### 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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/cygltdl-7.dll b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/cygltdl-7.dll deleted file mode 100755 index b7ab1dc13..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/cygltdl-7.dll and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/ifnames b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/ifnames deleted file mode 100755 index 69bffb2c8..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/ifnames +++ /dev/null @@ -1,153 +0,0 @@ -#! /usr/bin/perl -w -# -*- perl -*- -# Generated from ifnames.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# ifnames - print the identifiers used in C preprocessor conditionals - -# Copyright (C) 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2005, 2006, -# 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Reads from stdin if no files are given. -# Writes to stdout. - -# Written by David MacKenzie -# and Paul Eggert . - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::General; -use Autom4te::XFile; -use Autom4te::FileUtils; - -# $HELP -# ----- -$help = "Usage: $0 [OPTION]... [FILE]... - -Scan all of the C source FILES (or the standard input, if none are -given) and write to the standard output a sorted list of all the -identifiers that appear in those files in `#if', `#elif', `#ifdef', or -`#ifndef' directives. Print each identifier on a line, followed by a -space-separated list of the files in which that identifier occurs. - - -h, --help print this help, then exit - -V, --version print version number, then exit - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - - -# $VERSION -# -------- -$version = "ifnames (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by David J. MacKenzie and Paul Eggert. -"; - - -# &parse_args () -# -------------- -# Process any command line arguments. -sub parse_args () -{ - getopt (); -} - - -# %OCCURRENCE -# ----------- -my %occurrence; - - -# &scan_file ($FILE-NAME) -# ----------------------- -sub scan_file ($) -{ - my ($file_name) = @_; - my $file = new Autom4te::XFile ("< " . open_quote ($file_name)); - while ($_ = $file->getline) - { - # Continuation lines. - $_ .= $file->getline - while (s/\\$//); - - # Preprocessor directives. - if (s/^\s*\#\s*(if|ifdef|ifndef|elif)\s+//) - { - # 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; - } - } - } -} - - -## ------ ## -## Main. ## -## ------ ## - -parse_args(); -foreach (@ARGV) - { - scan_file ($_); - } -foreach (sort keys %occurrence) - { - print "$_ ", join (' ', sort keys %{$occurrence{$_}}), "\n"; - } - -### 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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/libtoolize b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/libtoolize deleted file mode 100755 index 96134217d..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/libtoolize +++ /dev/null @@ -1,2555 +0,0 @@ -#! /bin/sh -# Generated from libtoolize.m4sh by GNU Autoconf 2.68. - -# libtoolize (GNU libtool) 2.4.2 -# Written by Gary V. Vaughan , 2003 - -# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -# 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. - -# Libtoolize 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. -# -# Libtoolize 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 libtoolize; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... -# -# Prepare a package to use libtool. -# -# -c, --copy copy files rather than symlinking them -# --debug enable verbose shell tracing -# -n, --dry-run print commands rather than running them -# -f, --force replace existing files -# -i, --install copy missing auxiliary files -# --ltdl[=DIR] install libltdl sources [default: libltdl] -# --no-warn don't display warning messages -# --nonrecursive prepare ltdl for non-recursive make -# -q, --quiet work silently -# --recursive prepare ltdl for recursive make -# --subproject prepare ltdl to configure and build independently -# -v, --verbose verbosely report processing -# --version print version information and exit -# -h, --help print short or long help message -# -# The following space or comma delimited options can be passed to $progname -# via the environment variable LIBTOOLIZE_OPTIONS, unknown environment -# options are ignored: -# -# --debug enable verbose shell tracing -# --no-warn don't display warning messages -# --quiet work silently -# --verbose verbosely report processing -# -# You must `cd' to the top directory of your package before you run -# `$progname'. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: i686-pc-cygwin -# $progname: (GNU libtool) 2.4.2 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . - -: ${TAR=tar} - -PROGRAM=libtoolize - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -## -------------------- ## -## 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=: - # Pre-4.2 versions of Zsh do 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_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -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.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -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 - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do 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_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested="" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - break 2 -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -## -------------------- ## -## Main body of script. ## -## -------------------- ## - - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${EGREP="/usr/bin/grep -E"} -: ${FGREP="/usr/bin/grep -F"} -: ${GREP="/usr/bin/grep"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SED="/usr/bin/sed"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation - - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation - - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=${PATH_SEPARATOR-:} - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $opt_debug - - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $opt_debug - - func_error "missing argument for $1." - exit_cmd=exit -} - - -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' - - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' - - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation - -exit_cmd=: - - - - - -# ltdl can be installed to be self-contained (subproject, the default); -# or to be configured by a parent project, either with a recursive or -# nonrecursive automake driven make: -ltdl_mode= - -# Locations for important files: -ltdldir= - -# Parse environment options -{ - my_sed_env_opt='1s/^\([^,:; ]*\).*$/\1/;q' - my_sed_env_rest='1s/^[^,:; ]*[,:; ]*\(.*\)$/\1/;q' - - while test -n "$LIBTOOLIZE_OPTIONS"; do - opt=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_opt"` - LIBTOOLIZE_OPTIONS=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_rest"` - - case $opt in - --debug|--no-warn|--quiet|--verbose) - envopts="${envopts+$envopts }$opt" ;; - --*) env_warning="${env_warning+$env_warning -}unrecognized environment option \`$opt'" ;; - *) func_fatal_help "garbled LIBTOOLIZE_OPTIONS near \`$opt'" ;; - esac - done - - test -n "$envopts" && { - func_quote_for_eval "$envopts" - eval set dummy "$func_quote_for_eval_result" ${1+"$@"} - shift - } -} - - - -# Option defaults: -opt_debug=: -opt_copy=false -opt_force=false -opt_install=false -opt_dry_run=false -opt_quiet=false -opt_verbose=false -opt_warning=: -opt_nonrecursive=false -opt_recursive=false -opt_standalone=false -opt_ltdl="false" - - -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --copy|-c) - opt_copy=: - ;; - --force|-f) - opt_force=: - ;; - --install|-i) - opt_install=: - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: -CP="func_echo_all $CP" -test -n "$LN_S" && LN_S="func_echo_all $LN_S" -MKDIR="func_echo_all $MKDIR" -RM="func_echo_all $RM" -TAR="func_echo_all $TAR" - ;; - --quiet|--automake|-q) - opt_quiet=: - ;; - --verbose|-v) - opt_verbose=: - ;; - --no-warning|--no-warn) - opt_warning=false - ;; - --nonrecursive|--non-recursive) - opt_nonrecursive=: - ;; - --recursive) - opt_recursive=: - ;; - --standalone) - opt_standalone=: - ;; - --ltdl) - optarg="$1" - if test $# -gt 0; then - case $optarg in # (( - -*) ;; - *) opt_ltdl="$optarg"; shift ;; - esac - fi -# This is tricky, since we're overloading $opt_ltdl to be the -# optarg for --ltdl during option processing, but then stashing -# the (optional) optarg in $ltdldir and reusing $opt_ltdl to -# indicate that --ltdl was seen during option processing. Also, -# be careful that --ltdl=foo --ltdl=bar results in ltdldir=bar: -case $opt_ltdl in - false|:) ;; # a bare '--ltdl' followed by another option - *) ltdldir=`$ECHO "$optarg" | $SED 's,/*$,,'` ;; -esac -opt_ltdl=: - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-c*|-f*|-i*|-n*|-q*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - - # Validate options: - - # show any warnings saved by LIBTOOLIZE_OPTIONS parsing - test -n "$env_warning" && - echo "$env_warning" |while read line; do func_warning "$line"; done - - # validate $opt_nonrecursive, $opt_recursive and $opt_standalone - if $opt_nonrecursive; then - if $opt_recursive || $opt_standalone; then - func_error "you can have at most one of --non-recursive, --recursive and --standalone" - fi - ltdl_mode=nonrecursive - elif $opt_recursive; then - $opt_standalone && - func_error "you can have at most one of --non-recursive, --recursive and --standalone" - ltdl_mode=recursive - elif $opt_standalone; then - ltdl_mode=standalone - fi - - # any remaining arguments are an error - test $# -gt 0 && - func_fatal_help "unknown additional arguments: \`${1+}'" - - - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} - - - - -# func_echo_once msg_var -# Calls func_echo with the value of MSG_VAR, and then sets MSG_VAR="" so -# that subsequent calls have no effect. -func_echo_once () -{ - $opt_debug - if test -n "$1"; then - eval my_msg=\$$1 - - if test -n "$my_msg"; then - func_echo "$my_msg" - eval $1="" - fi - fi -} - - -# func_copy srcfile destfile [msg_var] -# A wrapper for func_copy_cb that accepts arguments in the same order -# as the cp(1) shell command. -func_copy () -{ - $opt_debug - - test -f "$1" || \ - { func_error "\`$1' not copied: not a regular file"; return 1; } - - func_dirname_and_basename "$1" - my_f1=$func_basename_result - - if test -d "$2"; then - - func_copy_cb "$my_f1" \ - `$ECHO "$1" | $SED "$dirname"` "$2" "$3" - - else - - # Supporting this would mean changing the timestamp: - func_dirname_and_basename "$2" - my_tname=$func_basename_result - test "X$my_f1" = "X$my_tname" \ - || func_fatal_error "func_copy() cannot change filename on copy" - - func_copy_cb "$my_f1" \ - `$ECHO "$1" | $SED "$dirname"` \ - `$ECHO "$2" | $SED "$dirname"` \ - "$3" - - fi - - return $copy_return_status # set in func_copy_cb -} - - -# func_copy_cb filename srcdir destdir [msg_var] -# If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE fails, -# then try to copy SRCFILE to DESTFILE (without changing the timestamp if -# possible). -func_copy_cb () -{ - $opt_debug - my_file="$1" - my_srcdir="$2" - my_destdir="$3" - my_msg_var="$4" - copy_return_status=1 - - # Libtool is probably misinstalled if this happens: - test -f "$my_srcdir/$my_file" || - func_fatal_error "\`$my_file' not found in \`$my_srcdir'" - - case $opt_verbose in - false) my_copy_msg="file \`$my_destdir/$my_file'" ;; - *) my_copy_msg="file from \`$my_srcdir/$my_file'" ;; - esac - func_mkdir_p `$ECHO "$my_destdir/$my_file" | $SED "$dirname"` - - $RM "$my_destdir/$my_file" - if $opt_copy; then - if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \ - | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1; } \ - && touch "$my_destdir/$my_file"; then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet || func_echo "copying $my_copy_msg" - copy_return_status=0 - fi - else - if test "$my_file" = "aclocal.m4"; then - if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \ - | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1 ; } - then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet || func_echo "copying $my_copy_msg" - copy_return_status=0 - fi - else - if $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet || func_echo "linking $my_copy_msg" - copy_return_status=0 - fi - fi - fi - if test "$copy_return_status" != 0; then - $opt_quiet || func_echo_once "$my_msg_var" - func_error "can not copy \`$my_srcdir/$my_file' to \`$my_destdir/'" - exit_status=$EXIT_FAILURE - fi -} - - -# func_copy_some_files srcfile_spec srcdir destdir [msg_var] [cb=func_copy_cb] -# Call COPY_CB for each regular file in SRCDIR named by the ':' delimited -# names in SRCFILE_SPEC. The odd calling convention is needed to allow -# spaces in file and directory names. -func_copy_some_files () -{ - $opt_debug - my_srcfile_spec="$1" - my_srcdir="$2" - my_destdir="$3" - my_msg_var="$4" - my_copy_cb="${5-func_copy_cb}" - - my_save_IFS="$IFS" - IFS=: - for my_filename in $my_srcfile_spec; do - IFS="$my_save_IFS" - if test -f "$my_srcdir/$my_filename"; then - if test "X$my_copy_cb" = Xfunc_copy_cb; then - $opt_force || if test -f "$my_destdir/$my_filename"; then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet \ - || func_error "\`$my_destdir/$my_filename' exists: use \`--force' to overwrite" - continue - fi - fi - else - func_echo_once "$my_msg_var" - func_fatal_error "\`$my_filename' not found in \`$my_srcdir'" - fi - - $my_copy_cb "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var" - done - IFS="$my_save_IFS" -} - - -# func_fixup_Makefile srcfile srcdir destdir -func_fixup_Makefile () -{ - $opt_debug - my_filename="$1" - my_srcdir="$2" - my_destdir="$3" - my_fixup_non_subpackage_script="\ - s,(LIBOBJS),(ltdl_LIBOBJS),g - s,(LTLIBOBJS),(ltdl_LTLIBOBJS),g - s,libltdl/configure.ac,, - s,libltdl/configure,, - s,libltdl/aclocal.m4,, - s,libltdl/config-h.in,, - s,libltdl/Makefile.am,, - s,libltdl/Makefile.in,, - /^[ ]*\\\\\$/d" - case $my_filename in - Makefile.am) - my_fixup_non_subpackage_script=`echo "$my_fixup_non_subpackage_script" | \ - sed 's,libltdl/,,'` - my_fixup_inc_paths_script= ;; - Makefile.inc) - repl=$ltdldir - repl_uscore=`$ECHO "$repl" | $SED 's,[/.+-],_,g'` - my_fixup_inc_paths_script="\ - s,libltdl_,@repl_uscore@_, - s,libltdl/,@repl@/, - s,: libltdl/,: @repl@/, - s, -Ilibltdl , -I@repl@ , - s,\\\$(libltdl_,\$(@repl_uscore@_, - s,)/libltdl ,)/@repl@ , - s,@repl_uscore@,${repl_uscore},g - s,@repl@,${repl},g" - ;; - esac - - $RM "$my_destdir/$my_filename" 2>/dev/null - $opt_quiet || func_echo "creating file \`$my_destdir/$my_filename'" - if $opt_dry_run; then :; - else - $SED "$my_fixup_non_subpackage_script - $my_fixup_inc_paths_script" \ - < "$my_srcdir/$my_filename" > "$my_destdir/$my_filename" || - func_fatal_error "cannot create $my_destdir/$my_filename" - fi -} - -# func_scan_files -# Scan configure.(ac|in) and aclocal.m4 (if present) for use of libltdl -# and libtool. Possibly running some of these tools if necessary. -# Libtoolize affects the contents of aclocal.m4, and should be run before -# aclocal, so we can't use configure --trace which relies on a consistent -# configure.(ac|in) and aclocal.m4. -func_scan_files () -{ - $opt_debug - # Prefer configure.ac to configure.in - test -f configure.ac && configure_ac=configure.ac - test -f "$configure_ac" || configure_ac= - - # Set local variables to reflect contents of configure.ac - my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,; - /AC_INIT/ { - s,^.*$,seen_autoconf=:, - p - } - d' - test -z "$configure_ac" \ - || eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"` - - $seen_autoconf || { - my_configure_ac= - test -n "$configure_ac" && my_configure_ac="$configure_ac: " - func_verbose "${my_configure_ac}not using Autoconf" - - # Make sure ltdldir and ltdl_mode have sensible defaults - # since we return early here: - test -n "$ltdldir" || ltdldir=libltdl - test -n "$ltdl_mode" || ltdl_mode=subproject - - return - } - - # ---------------------------------------------------- # - # Probe macro usage in configure.ac and/or aclocal.m4. # - # ---------------------------------------------------- # - - my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,, - s,^.*AC_REQUIRE(.*$,,; s,^.*m4_require(.*$,,; - s,^.*m4_define(.*$,, - s,^.*A[CU]_DEFUN(.*$,,; s,^.*m4_defun(.*$,, - /AC_CONFIG_AUX_DIR(/ { - s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,ac_auxdir=\1, - p - } - /AC_CONFIG_MACRO_DIR(/ { - s,^.*AC_CONFIG_MACRO_DIR([[ ]*\([^])]*\).*$,ac_macrodir=\1, - p - } - /_LT_CONFIG_LTDL_DIR(/d - /LT_CONFIG_LTDL_DIR(/ { - s,^.*LT_CONFIG_LTDL_DIR([[ ]*\([^])]*\).*$,ac_ltdldir=\1, - p - } - /\[A[CM]_PROG_LIBTOOL/d - /A[CM]_PROG_LIBTOOL/ { - s,^.*$,seen_libtool=:, - p - } - /the.*option into.*LT_INIT.*parameter/d - /\[LT_INIT/d - /LT_INIT/ { - s,^.*$,seen_libtool=:, - p - } - /\[LTDL_INIT/d - /LTDL_INIT/ { - s,^.*LTDL_INIT([[ ]*\([^])]*\).*$,ltdl_options="\1", - s,^.*LTDL_INIT[ ]*$,seen_ltdl=:, - p - } - /LT_WITH_LTDL/ { - s,^.*$,seen_ltdl=:, - p - } - /AC_LIB_LTDL/ { - s,^.*$,seen_ltdl=:, - p - } - /AC_WITH_LTDL/ { - s,^.*$,seen_ltdl=:, - p - } - d' - eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"` - - - # ----------------- # - # Validate ltdldir. # - # ----------------- # - - ac_ltdldir=`$ECHO "$ac_ltdldir" | $SED 's,/*$,,'` - - # If $configure_ac contains AC_CONFIG_LTDL_DIR, check that its - # arguments were not given in terms of a shell variable! - case "$ac_ltdldir" in - *\$*) - func_fatal_error "can not handle variables in LT_CONFIG_LTDL_DIR" - ;; - esac - - # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to - # `libltdl'. If both are specified, they must be the same. Otherwise, - # take the one that is given! (If LT_CONFIG_LTDL_DIR is not specified - # we suggest adding it later in this code.) - case x$ac_ltdldir,x$ltdldir in - x,x) ltdldir=libltdl ;; - x*,x) ltdldir=$ac_ltdldir ;; - x,x*) ltdldir=$ltdldir ;; - *) - test x"$ac_ltdldir" = x"$ltdldir" || \ - func_fatal_error "--ltdl='$ltdldir' does not match LT_CONFIG_LTDL_DIR($ac_ltdldir)" - ;; - esac - - - # ------------------- # - # Validate ltdl_mode. # - # ------------------- # - - test -n "$ltdl_options" && seen_ltdl=: - - # If $configure_ac contains LTDL_INIT, check that its - # arguments were not given in terms of a shell variable! - case "$ltdl_options" in - *\$*) - func_fatal_error "can not handle variables in LTDL_INIT" - ;; - esac - - # Extract mode name from ltdl_options - # FIXME: Diagnose multiple conflicting modes in ltdl_options - ac_ltdl_mode= - case " $ltdl_options " in - *" nonrecursive "*) ac_ltdl_mode=nonrecursive ;; - *" recursive "*) ac_ltdl_mode=recursive ;; - *" subproject "*) ac_ltdl_mode=subproject ;; - esac - - # If neither --ltdl nor an LTDL_INIT mode are specified, default to - # `subproject'. If both are specified, they must be the same. Otherwise, - # take the one that is given! - case x$ac_ltdl_mode,x$ltdl_mode in - x,x) ltdl_mode=subproject ;; - x*,x) ltdl_mode=$ac_ltdl_mode ;; - x,x*) ltdl_mode=$ltdl_mode ;; - *) - test x"$ac_ltdl_mode" = x"$ltdl_mode" || \ - func_fatal_error "--$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)" - ;; - esac - - # ---------------- # - # Validate auxdir. # - # ---------------- # - - if test -n "$ac_auxdir"; then - # If $configure_ac contains AC_CONFIG_AUX_DIR, check that it was - # not given in terms of a shell variable! - case "$ac_auxdir" in - *\$*) - func_fatal_error "can not handle variables in AC_CONFIG_AUX_DIR" - ;; - *) - auxdir=$ac_auxdir - ;; - esac - else - # Try to discover auxdir the same way it is discovered by configure. - # Note that we default to the current directory. - for dir in . .. ../..; do - if test -f "$dir/install-sh"; then - auxdir=$dir - break - elif test -f "$dir/install.sh"; then - auxdir="$dir" - break - fi - done - fi - - # Just use the current directory if all else fails. - test -n "$auxdir" || auxdir=. - - - # ------------------------------ # - # Find local m4 macro directory. # - # ------------------------------ # - - # Hunt for ACLOCAL_AMFLAGS in `Makefile.am' for a `-I' argument. - - my_sed_aclocal_flags=' - /^[ ]*ACLOCAL_[A-Z_]*FLAGS[ ]*=[ ]*/ { - s,,, - q - } - d' - if test -f Makefile.am; then - my_macrodir_is_next=false - for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do - if $my_macrodir_is_next; then - am_macrodir="$arg" - break - else - case $arg in - -I) my_macrodir_is_next=: ;; - -I*) - am_macrodir=`$ECHO "$arg" | sed 's,^-I,,'` - break - ;; - *) my_macrodir_is_next=false ;; - esac - fi - done - fi - - macrodir="$ac_macrodir" - test -z "$macrodir" && macrodir="$am_macrodir" - - if test -n "$am_macrodir" && test -n "$ac_macrodir"; then - test "$am_macrodir" = "$ac_macrodir" \ - || func_fatal_error "AC_CONFIG_MACRO_DIR([$ac_macrodir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macrodir." - fi -} - -# func_included_files searchfile -# Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE. -func_included_files () -{ - $opt_debug - my_searchfile="$1" - - my_include_regex= - my_sed_include=' - /^m4_include(\[.*\])$/ { - s,^m4_include(\[\(.*\)\])$,\1, - p - } - d' - - if test -f "$my_searchfile"; then - $ECHO "$my_searchfile" - - # Only recurse when we don't care if all the variables we use get - # trashed, since they are in global scope. - for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do - func_included_files $my_filename - done - fi -} - - -# func_serial filename [macro_regex] -# Output the value of the serial number comment in FILENAME, where the -# comment line must also match MACRO_REGEX, if given. -func_serial () -{ - $opt_debug - my_filename="$1" - my_macro_regex="$2" - my_sed_serial=' - /^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ { - s,^# serial \([1-9][0-9.]*\).*$,\1, - q - } - d' - - # Search FILENAME and all the files it m4_includes for a serial number - # in the file that AC_DEFUNs MACRO_REGEX. - my_serial= - func_dirname_and_basename "$my_filename" - my_filebase=$func_basename_result - for my_file in `func_included_files "$my_filename"`; do - if test -z "$my_macro_regex" || - test "$my_filename" = aclocal.m4 || - test "X$my_macro_regex" = "X$my_filebase" || - func_grep '^AC_DEFUN(\['"$my_macro_regex" "$my_file" - then - my_serial=`$SED -e "$my_sed_serial" "$my_file"` - break - fi - done - - # If the file has no serial number, we assume it's ancient. - test -n "$my_serial" || my_serial=0 - - $ECHO "$my_serial" -} - - -# func_serial_max serial1 serial2 -# Compare (possibly multi-part, '.' delimited) serial numbers, and -# return the largest in $func_serial_max_result. If they are the -# same, func_serial_max_result will be empty. -func_serial_max () -{ - $opt_debug - my_serial1="$1" - my_serial2="$2" - - my_sed_dot='s/\..*$//g' - my_sed_rest='s/^[0-9][1-9]*\.*//' - my_sed_digits='s/[^0-9.]//g' - - # Incase they turn out to be the same, we'll set it to empty - func_serial_max_result= - - test "X$1$2" = X`$ECHO "$1$2" | $SED "$my_sed_digits"` || { - func_error "serial numbers \`$1' or \`$2' contain non-digit chars" - return - } - - while test -n "$my_serial1$my_serial2"; do - my_serial1_part=`$ECHO "$my_serial1" | $SED "$my_sed_dot"` - my_serial2_part=`$ECHO "$my_serial2" | $SED "$my_sed_dot"` - - test -z "$my_serial1_part$my_serial2_part" \ - && break - - test -z "$my_serial1_part" \ - && { func_serial_max_result="$2"; break; } - - test -z "$my_serial2_part" \ - && { func_serial_max_result="$1"; break; } - - test "$my_serial1_part" -gt "$my_serial2_part" \ - && { func_serial_max_result="$1"; break; } - - test "$my_serial2_part" -gt "$my_serial1_part" \ - && { func_serial_max_result="$2"; break; } - - my_serial1=`$ECHO "$my_serial1" | $SED "$my_sed_rest"` - my_serial2=`$ECHO "$my_serial2" | $SED "$my_sed_rest"` - done -} - - -# func_serial_update_check srcfile src_serial destfile dest_serial -# Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check -# to 'false'. -func_serial_update_check () -{ - $opt_debug - my_srcfile="$1" - my_src_serial="$2" - my_destfile="$3" - my_dest_serial="$4" - my_update_p=: - - if test -f "$my_destfile"; then - test "X$my_src_serial" = "X0" && { - func_warning "no serial number on \`$my_srcfile', not copying." - return - } - - # Determine whether the destination has an older serial. - func_serial_max "$my_src_serial" "$my_dest_serial" - test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false - - test "X$my_src_serial" = "X$func_serial_max_result" \ - && func_verbose "\`$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in \`$my_destfile'" - - if test "X$my_dest_serial" = "X$func_serial_max_result"; then - func_verbose "\`$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in \`$my_destfile'" - $opt_force || if test -n "$ac_macrodir$ac_ltdldir"; then - func_error "\`$my_destfile' is newer: use \`--force' to overwrite" - fi - fi - fi - - func_serial_update_check_result="$my_update_p" -} - - -# func_aclocal_update_check filename -# Unless serial number of FILENAME is newer than the matching serial number -# in aclocal.m4, set $func_aclocal_update_check to 'false'. -func_aclocal_update_check () -{ - $opt_debug - my_srcfile="$aclocaldir/$1" - my_destfile="aclocal.m4" - - case $need in - libtool.m4) - my_src_serial=`func_serial "$my_srcfile" LT_INIT` - my_dest_serial=`func_serial "$my_destfile" LT_INIT` - - # Strictly, this libtoolize ought not to have to deal with ancient - # serial formats, but we accept them here to be complete: - test "X$my_src_serial" = "X0" && - my_src_serial=`func_serial "$my_srcfile" 'A[CM]_PROG_LIBTOOL'` - test "X$my_dest_serial" = "X0" && - my_dest_serial=`func_serial "$my_destfile" 'A[CM]_PROG_LIBTOOL'` - ;; - ltdl.m4) - my_src_serial=`func_serial "$my_srcfile" LTDL_INIT` - my_dest_serial=`func_serial "$my_destfile" LTDL_INIT` - ;; - *) - my_src_serial=`func_serial "$my_srcfile" "$need"` - my_dest_serial=`func_serial "$my_destfile" "$need"` - ;; - esac - - func_serial_update_check \ - "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial" - - func_aclocal_update_check_result="$func_serial_update_check_result" -} - - -# func_serial_update filename srcdir destdir [msg_var] [macro_re] [old_macro_re] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer serial number, or DESTFILE does not yet exist, or the user -# specified `--force' at the command line. If given, MACRO_REGEX or -# OLD_MACRO_REGEX must match any text after "# serial N" in both files. -func_serial_update () -{ - $opt_debug - my_filename="$1" - my_srcdir="$2" - my_destdir="$3" - my_msg_var="$4" - my_macro_regex="$5" - my_old_macro_regex="$6" - - my_serial_update_p=: - my_return_status=1 - my_srcfile="$my_srcdir/$my_filename" - my_destfile="$my_destdir/$my_filename" - - test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist." - - if test -f "$my_destfile"; then - my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"` - my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"` - - # Strictly, this libtoolize ought not to have to deal with ancient - # serial formats, but we accept them here to be complete: - test "X$my_src_serial" = "X0" && - my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"` - - test "X$my_dest_serial" = "X0" && - my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"` - - func_serial_update_check \ - "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial" - my_serial_update_p="$func_serial_update_check_result" - fi - - if $my_serial_update_p || $opt_force; then - func_copy "$my_srcfile" "$my_destfile" "$my_msg_var" - my_return_status=$? - elif $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet \ - || func_echo "\`$my_destfile' is already up to date." - fi - - # Do this after the copy for hand maintained `aclocal.m4', incase - # it has `m4_include([DESTFILE])', so the copy effectively already - # updated `aclocal.m4'. - my_included_files=`func_included_files aclocal.m4` - case `echo " $my_included_files " | $NL2SP` in - - # Skip included files: - *" $my_destfile "*) ;; - - # Otherwise compare to aclocal.m4 serial number (func_serial - # returns 0 for older macro serial numbers before we provided - # serial tags, so the update message will be correctly given - # if aclocal.m4 contains an untagged --i.e older-- macro file): - *) - if test -f aclocal.m4; then - func_serial_max \ - "$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"` - if test "X$my_src_serial" = "X$func_serial_max_result"; then - func_echo_once "$my_msg_var" - func_echo "You should add the contents of \`$my_destfile' to \`aclocal.m4'." - fi - fi - ;; - esac - return $my_return_status -} - - -# func_keyword_update filename srcdir destdir sed_script [msg_var] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer revision according to the serial number extracted by -# SED_SCRIPT, or DESTFILE does not yet exist, or the user specified -# `--force' at the command line. -func_keyword_update () -{ - $opt_debug - my_filename="$1" - my_srcdir="$2" - my_destdir="$3" - my_sed_script="$4" - my_msg_var="$5" - - my_srcfile="$my_srcdir/$my_filename" - my_destfile="$my_destdir/$my_filename" - - my_keyword_update_p=: - - test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist." - - if test -f "$my_destfile"; then - my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"` - test -z "$my_src_serial" && { - func_warning "no serial number in \`$my_srcfile', not copying." - return - } - - my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"` - test -n "$my_dest_serial" || my_dest_serial=0 - - func_serial_update_check \ - "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial" - my_keyword_update_p="$func_serial_update_check_result" - fi - - if $my_keyword_update_p || $opt_force; then - func_copy "$my_srcfile" "$my_destfile" "$my_msg_var" - elif $opt_verbose || $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then - func_echo_once "$my_msg_var" - func_echo "\`$my_destfile' is already up to date." - fi -} - - -# func_ltmain_update filename srcdir destdir [msg_var] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer revision, or DESTFILE does not yet exist, or the user -# specified `--force' at the command line. -func_ltmain_update () -{ - $opt_debug - my_sed_ltmain=' - /^package_revision='\''*[0-9][1-9.]*'\''*/ { - s,^package_revision='\''*\([0-9.]*\)'\''*[ ]*$,\1, - p - } - d' - - func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain" "$4" - - return $my_return_status -} - - -# func_config_update filename srcdir destdir [msg_var] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer timestamp, or DESTFILE does not yet exist, or the user -# specified `--force' at the command line. -func_config_update () -{ - $opt_debug - my_sed_config=' - /^timestamp='\''*[0-9][1-9-]*'\''*/ { - s,^timestamp='\''*\([0-9-]*\)'\''*,\1, - s/-/./g - p - } - d' - - func_keyword_update "$1" "$2" "$3" "$my_sed_config" "$4" - - return $my_return_status -} - - -# func_install_update filename srcdir destdir [msg_var] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer timestamp, or DESTFILE does not yet exist, or the user -# specified `--force' at the command line. -func_install_update () -{ - $opt_debug - my_sed_install=' - /^scriptversion='\''*[0-9][1-9.-]*'\''*/ { - s,[#;].*,, - s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1, - s/-/./g - p - } - d' - - func_keyword_update "$1" "$2" "$3" "$my_sed_install" "$4" - - return $my_return_status -} - - -# func_massage_aclocal_DATA [glob_exclude] -# @aclocal_DATA\@ is substituted as per its value in Makefile.am; -# this function massages it into a suitable format for func_copy_some_files. -func_massage_aclocal_DATA () -{ - $opt_debug - pkgmacro_files= # GLOBAL VAR - - my_glob_exclude="$1" - - # Massage a value for pkgmacro_files from the value used in Makefile.am. - for my_filename in m4/argz.m4 m4/libtool.m4 m4/ltdl.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4; do - func_dirname_and_basename "$my_filename" - my_filename=$func_basename_result - - # ignore excluded filenames - if test -n "$my_glob_exclude"; then - my_cont=false - eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac' - $my_cont && continue - fi - - pkgmacro_files="$pkgmacro_files:$my_filename" - done - - # strip spurious leading `:' - pkgmacro_files=`$ECHO "$pkgmacro_files" | $SED 's,^:*,,'` -} - - -# func_install_pkgmacro_subproject -# Unless --quiet was passed, display a message. Then copy pkgmacro_files -# from libtool installation tree to subproject libltdl tree. -func_install_pkgmacro_subproject () -{ - $opt_debug - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgmacro_files; do - test -f "$subproject_macrodir/$file" && func_verbose "rm -f '$subproject_macrodir/$file'" - rm -f "$subproject_macrodir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified a macrodir. - $opt_quiet || if test "x$macrodir" != "x$subproject_macrodir"; then - pkgmacro_header="putting macros in \`$subproject_macrodir'." - elif test -n "$subproject_macrodir"; then - pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$subproject_macrodir'." - fi - - func_copy_some_files "argz.m4:libtool.m4:ltdl.m4:$pkgmacro_files" \ - "$aclocaldir" "$subproject_macrodir" pkgmacro_header -} - - -# func_install_pkgmacro_parent -# Unless --quiet was passed, or AC_CONFIG_MACRO_DIR was not seen, display -# a message. Then update appropriate macros if newer ones are available -# from the libtool installation tree. -func_install_pkgmacro_parent () -{ - $opt_debug - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgmacro_files; do - test -f "$macrodir/$file" && func_verbose "rm -f '$macrodir/$file'" - rm -f "$macrodir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified a macrodir. - $opt_quiet || if test -n "$ac_macrodir"; then - my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macrodir'." - elif test -n "$macrodir"; then - my_pkgmacro_header="putting macros in \`$macrodir'." - fi - - if $opt_ltdl; then - func_serial_update argz.m4 "$aclocaldir" "$macrodir" \ - my_pkgmacro_header argz.m4 - else - func_verbose "Not copying \`$macrodir/argz.m4', libltdl not used." - fi - - func_serial_update libtool.m4 "$aclocaldir" "$macrodir" \ - my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL' - - if $opt_ltdl; then - func_serial_update ltdl.m4 "$aclocaldir" "$macrodir" \ - my_pkgmacro_header 'LTDL_INIT' - else - func_verbose "Not copying \`$macrodir/ltdl.m4', libltdl not used." - fi - - my_save_IFS="$IFS" - IFS=: - for file in $pkgmacro_files; do - IFS="$my_save_IFS" - func_serial_update "$file" "$aclocaldir" "$macrodir" \ - my_pkgmacro_header "$file" - done - IFS="$my_save_IFS" -} - - -# func_install_pkgmacro_files -# Install copies of the libtool and libltdl m4 macros into this package. -func_install_pkgmacro_files () -{ - $opt_debug - - # argz.m4, libtool.m4 and ltdl.m4 are handled specially: - func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4' - - # 1. Parent has separate macrodir to subproject ltdl: - if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && - test -n "$macrodir" && test "x$macrodir" != "x$subproject_macrodir" - then - func_install_pkgmacro_parent - func_install_pkgmacro_subproject - - # 2. Parent shares macrodir with subproject ltdl: - elif $opt_ltdl && test "x$ltdl_mode" = "xsubproject" - # && test "x$macrodir" = "x$subproject_macrodir" - then - func_install_pkgmacro_subproject - - # 3. Not a subproject, but macrodir was specified in parent: - elif test -n "$macrodir"; then - func_install_pkgmacro_parent - - # 4. AC_CONFIG_MACRO_DIR was not specified: - else - func_verbose "AC_CONFIG_MACRO_DIR not defined, not copying libtool macros." - fi -} - - -# func_massage_pkgltdl_files [glob_exclude] -# @pkgltdl_files\@ is substituted as per its value in Makefile.am; this -# function massages it into a suitable format for func_copy_some_files. -func_massage_pkgltdl_files () -{ - $opt_debug - pkgltdl_files= # GLOBAL VAR - - my_glob_exclude="$1" - - # Massage a value for pkgltdl_files from the value used in Makefile.am - for my_filename in libltdl/COPYING.LIB libltdl/README libltdl/Makefile.inc libltdl/Makefile.am libltdl/configure.ac libltdl/aclocal.m4 libltdl/Makefile.in libltdl/config-h.in libltdl/configure libltdl/argz_.h libltdl/argz.c libltdl/loaders/dld_link.c libltdl/loaders/dlopen.c libltdl/loaders/dyld.c libltdl/loaders/load_add_on.c libltdl/loaders/loadlibrary.c libltdl/loaders/shl_load.c libltdl/lt__dirent.c libltdl/lt__strl.c libltdl/libltdl/lt__alloc.h libltdl/libltdl/lt__dirent.h libltdl/libltdl/lt__glibc.h libltdl/libltdl/lt__private.h libltdl/libltdl/lt__strl.h libltdl/libltdl/lt_dlloader.h libltdl/libltdl/lt_error.h libltdl/libltdl/lt_system.h libltdl/libltdl/slist.h libltdl/loaders/preopen.c libltdl/lt__alloc.c libltdl/lt_dlloader.c libltdl/lt_error.c libltdl/ltdl.c libltdl/ltdl.h libltdl/slist.c; do - - # Strip surplus leading 'libltdl/': - my_filename=`expr "X$my_filename" : 'Xlibltdl/\(.*\)'` - - # ignore excluded filenames - if test -n "$my_glob_exclude"; then - my_cont=false - eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac' - $my_cont && continue - fi - - # ignore duplicates - case :$pkgltdl_files: in - *:$my_filename:*) ;; - *) pkgltdl_files="$pkgltdl_files:$my_filename" ;; - esac - done - - # strip spurious leading `:' - pkgltdl_files=`$ECHO "$pkgltdl_files" | $SED 's,^:*,,'` -} - - -# func_install_pkgltdl_files -# Install copies of the libltdl files into this package. Any auxiliary -# or m4 macro files needed in the libltdl tree will also be copied by -# func_install_pkgconfig_files and func_install_pkgmacro_files resp. -func_install_pkgltdl_files () -{ - $opt_debug - $opt_ltdl || return - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgltdl_files; do - test -f "$ltdldir/$file" && func_verbose "rm -f '$ltdldir/$file'" - rm -f "$ltdldir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified `--ltdl'. - $opt_quiet || if test -n "$ac_ltdldir"; then - pkgltdl_header="putting libltdl files in LT_CONFIG_LTDL_DIR, \`$ac_ltdldir'." - elif test -n "$ltdldir"; then - pkgltdl_header="putting libltdl files in \`$ltdldir'." - fi - - # These files are handled specially, depending on ltdl_mode: - if test "x$ltdl_mode" = "xsubproject"; then - func_massage_pkgltdl_files 'Makefile.inc' - else - func_massage_pkgltdl_files 'Makefile.am|Makefile.in*|aclocal.m4|config*' - fi - - func_copy_some_files "$pkgltdl_files" \ - "$pkgltdldir/libltdl" "$ltdldir" pkgltdl_header - - # For recursive ltdl modes, copy a suitable Makefile.{am,inc}: - case $ltdl_mode in - recursive) - func_fixup_Makefile "Makefile.am" "$pkgltdldir/libltdl" "$ltdldir" - ;; - nonrecursive) - func_fixup_Makefile "Makefile.inc" "$pkgltdldir/libltdl" "$ltdldir" - ;; - esac -} - - -# func_massage_pkgconfig_files [glob_exclude] -# @pkgconfig_files\@ is substituted as per its value in Makefile.am; this -# function massages it into a suitable format for func_copy_some_files. -func_massage_pkgconfig_files () -{ - $opt_debug - pkgconfig_files= # GLOBAL VAR - - my_glob_exclude="$1" - - # Massage a value for pkgconfig_files from the value used in Makefile.am - for my_filename in config/compile config/config.guess config/config.sub config/depcomp config/install-sh config/missing config/ltmain.sh; do - - # ignore excluded filenames - if test -n "$my_glob_exclude"; then - my_cont=false - eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac' - $my_cont && continue - fi - - # ignore duplicates - case :$pkgconfig_files: in - *:$my_filename:*) ;; - *) pkgconfig_files="$pkgconfig_files:$my_filename" ;; - esac - done - - # strip spurious leading `:' - pkgconfig_files=`$ECHO "$pkgconfig_files" | $SED 's,^:*,,'` -} - - -# func_install_pkgconfig_subproject -# Unless --quiet was passed, display a message. Then copy pkgconfig_files -# from libtool installation tree to subproject libltdl tree. -func_install_pkgconfig_subproject () -{ - $opt_debug - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgconfig_files; do - test -f "$subproject_auxdir/$file" && func_verbose "rm -f '$subproject_auxdir/$file'" - rm -f "$subproject_auxdir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified an auxdir. - $opt_quiet || if test "x$ac_auxdir" = "x$subproject_auxdir"; then - pkgconfig_header="putting auxiliary files in AC_CONFIG_AUX_DIR, \`$subproject_auxdir'." - elif test -n "$auxdir"; then - pkgconfig_header="putting auxiliary files in \`$auxdir'." - fi - - func_copy_some_files "$pkgconfig_files" \ - "$pkgdatadir" "$ltdldir" pkgconfig_header -} - - -# func_install_pkgconfig_parent -# Unless --quiet was passed, or AC_CONFIG_AUX_DIR was not seen, display a -# message. Then update appropriate auxiliary files if newer ones are -# available from the libtool installation tree. -func_install_pkgconfig_parent () -{ - $opt_debug - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgconfig_files; do - test -f "$auxdir/$file" && func_verbose "rm -f '$auxdir/$file'" - rm -f "$auxdir/$file" - done - - if test -n "$ac_auxdir"; then - pkgconfig_header="putting auxiliary files in AC_CONFIG_AUX_DIR, \`$ac_auxdir'." - elif test -n "$auxdir" || test "x$ltdldir" = "x."; then - pkgconfig_header="putting auxiliary files in \`$auxdir'." - fi - - if $opt_install; then - func_config_update config.guess \ - "$pkgdatadir/config" "$auxdir" pkgconfig_header - func_config_update config.sub \ - "$pkgdatadir/config" "$auxdir" pkgconfig_header - func_install_update install-sh \ - "$pkgdatadir/config" "$auxdir" pkgconfig_header - fi - func_ltmain_update ltmain.sh \ - "$pkgdatadir/config" "$auxdir" pkgconfig_header -} - - -# func_install_pkgconfig_files -# Install copies of the auxiliary files into this package according to -# the whether libltdl is included as a subproject, and whether the parent -# shares the AC_CONFIG_AUX_DIR setting. -func_install_pkgconfig_files () -{ - $opt_debug - func_massage_pkgconfig_files - - # 1. Parent shares auxdir with subproject ltdl: - if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && - test "x$ac_auxdir" = "x$subproject_auxdir" - then - func_install_pkgconfig_subproject - - # 2. Parent has separate auxdir to subproject ltdl: - elif $opt_ltdl && test "x$ltdl_mode" = "xsubproject" - # && test "x$auxdir" != "x$subproject_auxdir" is implied - then - if $seen_autoconf; then - func_install_pkgconfig_parent - fi - func_install_pkgconfig_subproject - - # 3. Not subproject, but AC_CONFIG_AUX_DIR was used in parent: - elif test -n "$ac_auxdir" || test "x$auxdir" = "x."; then - func_install_pkgconfig_parent - - # 4. AC_CONFIG_AUX_DIR was not specified: - else - func_verbose "AC_CONFIG_AUX_DIR not defined, not copying libtool auxiliary files." - fi -} - - -# func_nonemptydir_p dirvar -# DIRVAR is the name of a variable to evaluate. Unless DIRVAR names -# a directory that exists and is non-empty abort with a diagnostic. -func_nonemptydir_p () -{ - $opt_debug - my_dirvar="$1" - my_dir=`eval echo "\\\$$my_dirvar"` - - # Is it a directory at all? - test -d "$my_dir" \ - || func_fatal_error "\$$my_dirvar is not a directory: \`$my_dir'" - - # check that the directories contents can be ls'ed - test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \ - || func_fatal_error "can not list files: \`$my_dir'" -} - - -# func_check_macros -# Sanity check macros from aclocal.m4 against installed versions. -func_check_macros () -{ - $opt_debug - $opt_quiet && return - $seen_autoconf || return - - ac_config_macro_dir_advised=false - - if test -n "$ac_macrodir$ltdldir" && test -z "$macrodir"; then - my_ac_config_macro_srcdir="$aclocaldir" - if $opt_ltdl && test "$macrodir" != "$subproject_macrodir"; then - my_ac_config_macro_srcdir="$subproject_macrodir" - fi - - my_needed="libtool.m4 ltoptions.m4 ltversion.m4 ltsugar.m4 lt~obsolete.m4" - $opt_ltdl && my_needed="$my_needed argz.m4 ltdl.m4" - - if test -f "aclocal.m4"; then - for need in $my_needed; do - func_aclocal_update_check $need - $func_aclocal_update_check_result && my_missing="$my_missing $need" - done - else - my_missing="$my_needed" - fi - - if test -n "$my_missing"; then - func_echo "You should add the contents of the following files to \`aclocal.m4':" - for need in $my_missing; do - func_echo " \`$my_ac_config_macro_srcdir/$need'" - done - - if test "$my_ac_config_macro_srcdir" != "$aclocaldir"; then - func_echo "or else add \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' to $configure_ac." - ac_config_macro_dir_advised=: - fi - fi - fi - - ## ---------------------------------------------------------- ## - ## Since we return early here when --no-warn was given: ## - ## DO NOT PUT ANYTHING BUT UPGRADE ADVICE MESSAGES BELOW HERE ## - ## ---------------------------------------------------------- ## - - $opt_warning || return - - $seen_libtool || - func_echo "Remember to add \`LT_INIT' to $configure_ac." - - # Suggest using LTDL_INIT if appropriate: - $opt_ltdl && if test x$seen_ltdl != x:; then - case $ltdl_mode in - subproject) ltdl_init_args="" ;; - *) ltdl_init_args="([$ltdl_mode])" ;; - esac - func_echo "Remember to add \`LTDL_INIT$ltdl_init_args' to $configure_ac." - fi - - if $opt_ltdl; then - # Remind the user to call LT_CONFIG_LTDL_DIR: - test -n "$ac_ltdldir" || - func_echo "Remember to add \`LT_CONFIG_LTDL_DIR([$ltdldir])' to \`$configure_ac'." - - # For subproject mode, offer some suggestions for avoiding duplicate - # files in a project that uses libltdl: - if test "x$ltdl_mode" = "xsubproject"; then - test "$subproject_auxdir" = "$auxdir" || - func_echo "Consider using \`AC_CONFIG_AUX_DIR([$subproject_auxdir])' in $configure_ac." - $ac_config_macro_dir_advised || test "$subproject_macrodir" = "$macrodir" || - func_echo "Consider using \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' in $configure_ac." - ac_config_macro_dir_advised=: - fi - fi - - # Suggest modern idioms for storing autoconf macros: - $ac_config_macro_dir_advised || if test -z "$ac_macrodir" || test x"$macrodir" = x.; then - func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac and" - func_echo "rerunning $progname, to keep the correct libtool macros in-tree." - ac_config_macro_dir_advised=: - - elif test -z "$ac_macrodir$ltdldir"; then - func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([$macrodir])' to $configure_ac," - func_echo "and rerunning $progname and aclocal." - ac_config_macro_dir_advised=: - fi - - if test -z "$am_macrodir$macrodir"; then - func_echo "Consider adding \`-I m4' to ACLOCAL_AMFLAGS in Makefile.am." - - elif test -z "$am_macrodir"; then - if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && test "$subproject_macrodir" != "$macrodir"; then - func_echo "Consider adding \`-I $subproject_macrodir' to ACLOCAL_AMFLAGS in Makefile.am." - else - func_echo "Consider adding \`-I $macrodir' to ACLOCAL_AMFLAGS in Makefile.am." - fi - fi - - # Don't trace for this, we're just checking the user didn't invoke it - # directly from configure.ac. - $SED 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB >/dev/null && - func_echo "\`AC_PROG_RANLIB' is rendered obsolete by \`LT_INIT'" - - # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release -} - - -## ----------- ## -## Main. ## -## ----------- ## - -{ - # Lists of all files libtoolize has ever installed. These are removed - # before installing the latest files when --force was passed to help - # ensure a clean upgrade. - # Do not remove config.guess nor config.sub, we don't install them - # without --install, and the project may not be using Automake. - all_pkgconfig_files="ltmain.sh" - all_pkgmacro_files="argz.m4 libtool.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 ltversion.in ltversion.m4 lt~obsolete.m4" - all_pkgltdl_files="COPYING.LIB Makefile Makefile.in Makefile.inc Makefile.am README acinclude.m4 aclocal.m4 argz_.h argz.c config.h.in config-h.in configure configure.ac configure.in libltdl/lt__alloc.h libltdl/lt__dirent.h libltdl/lt__glibc.h libltdl/lt__private.h libltdl/lt__strl.h libltdl/lt_dlloader.h libltdl/lt_error.h libltdl/lt_system.h libltdl/slist.h loaders/dld_link.c loaders/dlopen.c loaders/dyld.c loaders/load_add_on.c loaders/loadlibrary.c loaders/preopen.c loaders/shl_load.c lt__alloc.c lt__dirent.c lt__strl.c lt_dlloader.c lt_error.c ltdl.c ltdl.h slist.c" - - # Locations for important files: - prefix=/ - datadir=//share - pkgdatadir=//share/libtool - pkgltdldir=//share/libtool - aclocaldir=//share/aclocal - auxdir= - macrodir= - configure_ac=configure.in - - seen_autoconf=false - seen_libtool=false - seen_ltdl=false - - # test EBCDIC or ASCII - case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - SP2NL='tr \040 \012' - NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - SP2NL='tr \100 \n' - NL2SP='tr \r\n \100\100' - ;; - esac - - # Allow the user to override the master libtoolize repository: - if test -n "$_lt_pkgdatadir"; then - pkgltdldir="$_lt_pkgdatadir" - pkgdatadir="$_lt_pkgdatadir/libltdl" - aclocaldir="$_lt_pkgdatadir/libltdl/m4" - fi - func_nonemptydir_p pkgltdldir - func_nonemptydir_p pkgdatadir - func_nonemptydir_p aclocaldir - - func_scan_files - - case $ltdldir in - .) ltdlprefix= ;; - *) ltdlprefix=$ltdldir/ ;; - esac - subproject_auxdir=${ltdlprefix}config - subproject_macrodir=${ltdlprefix}m4 - - # :::BE CAREFUL HERE::: - # func_check_macros needs to check whether --ltdl was specified when - # LTDL_INIT was not seen, so we can't just use one variable for both - # conditions, or that check will be impossible. No need to clutter the - # rest of the code with '$opt_ltdl || $seen_ltdl' though, because we CAN - # safely set opt_ltdl to true if LTDL_INIT was seen: - $seen_ltdl && opt_ltdl=: - - func_install_pkgconfig_files - func_install_pkgmacro_files - func_install_pkgltdl_files - - func_check_macros -} - -exit $exit_status - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: - diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/m4.exe b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/m4.exe deleted file mode 100755 index 301655853..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/m4.exe and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/make.exe b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/make.exe deleted file mode 100755 index 23ed513f8..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-cygwin/bin/make.exe and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/aclocal b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/aclocal deleted file mode 100755 index cf7f3edd6..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/aclocal +++ /dev/null @@ -1,1235 +0,0 @@ -#!/usr/bin/perl -w -# -*- perl -*- -# Generated from bin/aclocal.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# aclocal - create aclocal.m4 by scanning configure.ac - -# Copyright (C) 1996-2013 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, see . - -# Written by Tom Tromey , and -# Alexandre Duret-Lutz . - -BEGIN -{ - @Aclocal::perl_libdirs = ('//share/automake-1.14') - unless @Aclocal::perl_libdirs; - unshift @INC, @Aclocal::perl_libdirs; -} - -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::Path (); - -# Some globals. - -# Support AC_CONFIG_MACRO_DIRS also with older autoconf. -# FIXME: To be removed in Automake 2.0, once we can assume autoconf -# 2.70 or later. -# FIXME: keep in sync with 'internal/ac-config-macro-dirs.m4'. -my $ac_config_macro_dirs_fallback = - 'm4_ifndef([AC_CONFIG_MACRO_DIRS], [' . - 'm4_defun([_AM_CONFIG_MACRO_DIRS], [])' . - 'm4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])' . - '])'; - -# We do not operate in threaded mode. -$perl_threads = 0; - -# 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 macros. -# @user_includes can be augmented with -I or AC_CONFIG_MACRO_DIRS. -# @automake_includes can be reset with the '--automake-acdir' option. -# @system_includes can be augmented with the 'dirlist' file or the -# ACLOCAL_PATH environment variable, and reset with the '--system-acdir' -# option. -my @user_includes = (); -my @automake_includes = ("//share/aclocal-$APIVERSION"); -my @system_includes = ('//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. This variable is set by 'trace_used_macros'. -my $ac_version; - -# User directory containing extra m4 files for macros definition, -# as extracted from calls to the macro AC_CONFIG_MACRO_DIRS. -# This variable is updated by 'trace_used_macros'. -my @ac_config_macro_dirs; - -# If set, names a temporary file that must be erased on abnormal exit. -my $erase_me; - -# Constants for the $ERR_LEVEL parameter of the 'scan_m4_dirs' function. -use constant SCAN_M4_DIRS_SILENT => 0; -use constant SCAN_M4_DIRS_WARN => 1; -use constant SCAN_M4_DIRS_ERROR => 2; - -################################################################ - -# Prototypes for all subroutines. - -# BEGIN AUTOMATICALLY GENERATED PROTOTYPES -sub add_file ($); -sub add_macro ($); -sub check_acinclude (); -sub install_file ($$); -sub list_compare (\@\@); -sub parse_ACLOCAL_PATH (); -sub parse_arguments (); -sub reset_maps (); -sub scan_configure (); -sub scan_configure_dep ($); -sub scan_file ($$$); -sub scan_m4_dirs ($$@); -sub scan_m4_files (); -sub strip_redundant_includes (%); -sub trace_used_macros (); -sub unlink_tmp (;$); -sub usage ($); -sub version (); -sub write_aclocal ($@); -sub xmkdir_p ($); -# END AUTOMATICALLY GENERATED PROTOTYPES - -################################################################ - -# Erase temporary file ERASE_ME. Handle signals. -sub unlink_tmp (;$) -{ - my ($sig) = @_; - - if ($sig) - { - verb "caught SIG$sig, bailing out"; - } - if (defined $erase_me && -e $erase_me && !unlink ($erase_me)) - { - fatal "could not remove '$erase_me': $!"; - } - undef $erase_me; - - # reraise default handler. - if ($sig) - { - $SIG{$sig} = 'DEFAULT'; - kill $sig => $$; - } -} - -$SIG{'INT'} = $SIG{'TERM'} = $SIG{'QUIT'} = $SIG{'HUP'} = 'unlink_tmp'; -END { unlink_tmp } - -sub xmkdir_p ($) -{ - my $dir = shift; - local $@ = undef; - return - if -d $dir or eval { File::Path::mkpath $dir }; - chomp $@; - $@ =~ s/\s+at\s.*\bline\s\d+.*$//; - fatal "could not create directory '$dir': $@"; -} - -# 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', "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, $DESTDIR) -sub install_file ($$) -{ - my ($src, $destdir) = @_; - my $dest = $destdir . "/" . basename ($src); - my $diff_dest; - - verb "installing $src to $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) - { - xmkdir_p ($destdir); - 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, $ERR_LEVEL, @DIRS) -# ----------------------------------------------- -# Scan all M4 files installed in @DIRS for new macro definitions. -# Register each file as of type $TYPE (one of the FT_* constants). -# If a directory in @DIRS cannot be read: -# - fail hard if $ERR_LEVEL == SCAN_M4_DIRS_ERROR -# - just print a warning if $ERR_LEVEL == SCAN_M4_DIRS_WA -# - continue silently if $ERR_LEVEL == SCAN_M4_DIRS_SILENT -sub scan_m4_dirs ($$@) -{ - my ($type, $err_level, @dirlist) = @_; - - foreach my $m4dir (@dirlist) - { - if (! opendir (DIR, $m4dir)) - { - # TODO: maybe avoid complaining only if errno == ENONENT? - my $message = "couldn't open directory '$m4dir': $!"; - - if ($err_level == SCAN_M4_DIRS_ERROR) - { - fatal $message; - } - elsif ($err_level == SCAN_M4_DIRS_WARN) - { - msg ('unsupported', $message); - next; - } - elsif ($err_level == SCAN_M4_DIRS_SILENT) - { - next; # Silently ignore. - } - else - { - prog_error "invalid \$err_level value '$err_level'"; - } - } - - # 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. - - if (@user_includes) - { - # Don't explore the same directory multiple times. This is here not - # only for speedup purposes. We need this when the user has e.g. - # specified 'ACLOCAL_AMFLAGS = -I m4' and has also set - # AC_CONFIG_MACRO_DIR[S]([m4]) in configure.ac. This makes the 'm4' - # directory to occur twice here and fail on the second call to - # scan_m4_dirs([m4]) when the 'm4' directory doesn't exist. - # TODO: Shouldn't there be rather a check in scan_m4_dirs for - # @user_includes[0]? - @user_includes = uniq @user_includes; - - # Don't complain if the first user directory doesn't exist, in case - # we need to create it later (can happen if '--install' was given). - scan_m4_dirs (FT_USER, - $install ? SCAN_M4_DIRS_SILENT : SCAN_M4_DIRS_WARN, - $user_includes[0]); - scan_m4_dirs (FT_USER, - SCAN_M4_DIRS_ERROR, - @user_includes[1..$#user_includes]); - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @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", - "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:$.", - "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:$.", "underquoted definition of $2" - . "\n run info Automake 'Extending aclocal'\n" - . " or see http://www.gnu.org/software/automake/manual/" - . "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; - - # When AC_CONFIG_MACRO_DIRS is used, avoid possible spurious warnings - # from autom4te about macros being "m4_require'd but not m4_defun'd"; - # for more background, see: - # http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00004.html - # as well as autoconf commit 'v2.69-44-g1ed0548', "warn: allow aclocal - # to silence m4_require warnings". - my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])"; - - my $traces = ($ENV{AUTOM4TE} || 'autom4te'); - $traces .= " --language Autoconf-without-aclocal-m4 "; - $traces = "echo '$early_m4_code' | $traces - "; - - # Support AC_CONFIG_MACRO_DIRS also with older autoconf. - # Note that we can't use '$ac_config_macro_dirs_fallback' here, because - # a bug in option parsing code of autom4te 2.68 and earlier will cause - # it to read standard input last, even if the "-" argument is specified - # early. - # FIXME: To be removed in Automake 2.0, once we can assume autoconf - # 2.70 or later. - $traces .= "$automake_includes[0]/internal/ac-config-macro-dirs.m4 "; - - # All candidate files. - $traces .= join (' ', - (map { "'$_'" } - (grep { exists $files{$_} } @file_order))) . " "; - - # All candidate macros. - $traces .= join (' ', - (map { "--trace='$_:\$f::\$n::\${::}%'" } - ('AC_DEFUN', - 'AC_DEFUN_ONCE', - 'AU_DEFUN', - '_AM_AUTOCONF_VERSION', - 'AC_CONFIG_MACRO_DIR_TRACE', - # FIXME: Tracing the next two macros is a hack for - # compatibility with older autoconf. Remove this in - # Automake 2.0, when we can assume Autoconf 2.70 or - # later. - 'AC_CONFIG_MACRO_DIR', - '_AM_CONFIG_MACRO_DIRS')), - # 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 |"); - - @ac_config_macro_dirs = (); - - my %traced = (); - - while ($_ = $tracefh->getline) - { - chomp; - my ($file, $macro, $arg1) = split (/::/); - - $traced{$macro} = 1 if exists $macro_seen{$macro}; - - if ($macro eq 'AC_DEFUN' || $macro eq 'AC_DEFUN_ONCE' - || $macro eq 'AU_DEFUN') - { - $map_traced_defs{$arg1} = $file; - } - elsif ($macro eq '_AM_AUTOCONF_VERSION') - { - $ac_version = $arg1; - } - elsif ($macro eq 'AC_CONFIG_MACRO_DIR_TRACE') - { - push @ac_config_macro_dirs, $arg1; - } - # FIXME: We still need to trace AC_CONFIG_MACRO_DIR - # for compatibility with older autoconf. Remove this - # once we can assume Autoconf 2.70 or later. - elsif ($macro eq 'AC_CONFIG_MACRO_DIR') - { - @ac_config_macro_dirs = ($arg1); - } - # FIXME:This is an hack for compatibility with older autoconf. - # Remove this once we can assume Autoconf 2.70 or later. - elsif ($macro eq '_AM_CONFIG_MACRO_DIRS') - { - # Empty leading/trailing fields might be produced by split, - # hence the grep is really needed. - push @ac_config_macro_dirs, grep (/./, (split /\s+/, $arg1)); - } - } - - # FIXME: in Autoconf >= 2.70, AC_CONFIG_MACRO_DIR calls - # AC_CONFIG_MACRO_DIR_TRACE behind the scenes, which could - # leave unwanted duplicates in @ac_config_macro_dirs. - # Remove this in Automake 2.0, when we'll stop tracing - # AC_CONFIG_MACRO_DIR explicitly. - @ac_config_macro_dirs = uniq @ac_config_macro_dirs; - - $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) - { - install_file ($ifile, $user_includes[0]); - } - $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_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [$ac_version],, -[m4_warning([this file was generated for autoconf $ac_version. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -$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-$RELEASE_YEAR 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. - -$ac_config_macro_dirs_fallback -$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 <<'EOF'; -Usage: aclocal [OPTION]... - -Generate 'aclocal.m4' by scanning 'configure.ac' or 'configure.in' - -Options: - --automake-acdir=DIR directory holding automake-provided m4 files - --system-acdir=DIR directory holding third-party system-wide files - --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 system-wide - third-party 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 . -GNU Automake home page: . -General help using GNU software: . -EOF - exit $status; -} - -# Print version and exit. -sub version () -{ - print < -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF - exit 0; -} - -# Parse command line. -sub parse_arguments () -{ - my $print_and_exit = 0; - my $diff_command; - - my %cli_options = - ( - 'help' => sub { usage(0); }, - 'version' => \&version, - 'system-acdir=s' => sub { shift; @system_includes = @_; }, - 'automake-acdir=s' => sub { shift; @automake_includes = @_; }, - '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 Automake::Getopt (); - Automake::Getopt::parse_options %cli_options; - - if (@ARGV > 0) - { - fatal ("non-option arguments are not accepted: '$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; - } - - # 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); - } -} - -# Add any directory listed in the 'ACLOCAL_PATH' environment variable -# to the list of system include directories. -sub parse_ACLOCAL_PATH () -{ - return if not defined $ENV{"ACLOCAL_PATH"}; - # Directories in ACLOCAL_PATH should take precedence over system - # directories, so we use unshift. However, directories that - # come first in ACLOCAL_PATH take precedence over directories - # coming later, which is why the result of split is reversed. - foreach my $dir (reverse split /:/, $ENV{"ACLOCAL_PATH"}) - { - unshift (@system_includes, $dir) if $dir ne '' && -d $dir; - } -} - -################################################################ - -parse_WARNINGS; # Parse the WARNINGS environment variable. -parse_arguments; -parse_ACLOCAL_PATH; -$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; -my $rerun_due_to_macrodir = 0; -while (1) - { - ++$loop; - prog_error "too many loops" if $loop > 2 + $rerun_due_to_macrodir; - - reset_maps; - scan_m4_files; - scan_configure; - last if $exit_code; - my %macro_traced = trace_used_macros; - - if (!$rerun_due_to_macrodir && @ac_config_macro_dirs) - { - # The directory specified in calls to the AC_CONFIG_MACRO_DIRS - # m4 macro (if any) must go after the user includes specified - # explicitly with the '-I' option. - push @user_includes, @ac_config_macro_dirs; - # We might have to scan some new directory of .m4 files. - $rerun_due_to_macrodir++; - next; - } - - if ($install && !@user_includes) - { - fatal "installation of third-party macros impossible without " . - "-I options nor AC_CONFIG_MACRO_DIR{,S} m4 macro(s)"; - } - - 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: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/aclocal-1.14 b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/aclocal-1.14 deleted file mode 100755 index cf7f3edd6..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/aclocal-1.14 +++ /dev/null @@ -1,1235 +0,0 @@ -#!/usr/bin/perl -w -# -*- perl -*- -# Generated from bin/aclocal.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# aclocal - create aclocal.m4 by scanning configure.ac - -# Copyright (C) 1996-2013 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, see . - -# Written by Tom Tromey , and -# Alexandre Duret-Lutz . - -BEGIN -{ - @Aclocal::perl_libdirs = ('//share/automake-1.14') - unless @Aclocal::perl_libdirs; - unshift @INC, @Aclocal::perl_libdirs; -} - -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::Path (); - -# Some globals. - -# Support AC_CONFIG_MACRO_DIRS also with older autoconf. -# FIXME: To be removed in Automake 2.0, once we can assume autoconf -# 2.70 or later. -# FIXME: keep in sync with 'internal/ac-config-macro-dirs.m4'. -my $ac_config_macro_dirs_fallback = - 'm4_ifndef([AC_CONFIG_MACRO_DIRS], [' . - 'm4_defun([_AM_CONFIG_MACRO_DIRS], [])' . - 'm4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])' . - '])'; - -# We do not operate in threaded mode. -$perl_threads = 0; - -# 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 macros. -# @user_includes can be augmented with -I or AC_CONFIG_MACRO_DIRS. -# @automake_includes can be reset with the '--automake-acdir' option. -# @system_includes can be augmented with the 'dirlist' file or the -# ACLOCAL_PATH environment variable, and reset with the '--system-acdir' -# option. -my @user_includes = (); -my @automake_includes = ("//share/aclocal-$APIVERSION"); -my @system_includes = ('//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. This variable is set by 'trace_used_macros'. -my $ac_version; - -# User directory containing extra m4 files for macros definition, -# as extracted from calls to the macro AC_CONFIG_MACRO_DIRS. -# This variable is updated by 'trace_used_macros'. -my @ac_config_macro_dirs; - -# If set, names a temporary file that must be erased on abnormal exit. -my $erase_me; - -# Constants for the $ERR_LEVEL parameter of the 'scan_m4_dirs' function. -use constant SCAN_M4_DIRS_SILENT => 0; -use constant SCAN_M4_DIRS_WARN => 1; -use constant SCAN_M4_DIRS_ERROR => 2; - -################################################################ - -# Prototypes for all subroutines. - -# BEGIN AUTOMATICALLY GENERATED PROTOTYPES -sub add_file ($); -sub add_macro ($); -sub check_acinclude (); -sub install_file ($$); -sub list_compare (\@\@); -sub parse_ACLOCAL_PATH (); -sub parse_arguments (); -sub reset_maps (); -sub scan_configure (); -sub scan_configure_dep ($); -sub scan_file ($$$); -sub scan_m4_dirs ($$@); -sub scan_m4_files (); -sub strip_redundant_includes (%); -sub trace_used_macros (); -sub unlink_tmp (;$); -sub usage ($); -sub version (); -sub write_aclocal ($@); -sub xmkdir_p ($); -# END AUTOMATICALLY GENERATED PROTOTYPES - -################################################################ - -# Erase temporary file ERASE_ME. Handle signals. -sub unlink_tmp (;$) -{ - my ($sig) = @_; - - if ($sig) - { - verb "caught SIG$sig, bailing out"; - } - if (defined $erase_me && -e $erase_me && !unlink ($erase_me)) - { - fatal "could not remove '$erase_me': $!"; - } - undef $erase_me; - - # reraise default handler. - if ($sig) - { - $SIG{$sig} = 'DEFAULT'; - kill $sig => $$; - } -} - -$SIG{'INT'} = $SIG{'TERM'} = $SIG{'QUIT'} = $SIG{'HUP'} = 'unlink_tmp'; -END { unlink_tmp } - -sub xmkdir_p ($) -{ - my $dir = shift; - local $@ = undef; - return - if -d $dir or eval { File::Path::mkpath $dir }; - chomp $@; - $@ =~ s/\s+at\s.*\bline\s\d+.*$//; - fatal "could not create directory '$dir': $@"; -} - -# 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', "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, $DESTDIR) -sub install_file ($$) -{ - my ($src, $destdir) = @_; - my $dest = $destdir . "/" . basename ($src); - my $diff_dest; - - verb "installing $src to $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) - { - xmkdir_p ($destdir); - 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, $ERR_LEVEL, @DIRS) -# ----------------------------------------------- -# Scan all M4 files installed in @DIRS for new macro definitions. -# Register each file as of type $TYPE (one of the FT_* constants). -# If a directory in @DIRS cannot be read: -# - fail hard if $ERR_LEVEL == SCAN_M4_DIRS_ERROR -# - just print a warning if $ERR_LEVEL == SCAN_M4_DIRS_WA -# - continue silently if $ERR_LEVEL == SCAN_M4_DIRS_SILENT -sub scan_m4_dirs ($$@) -{ - my ($type, $err_level, @dirlist) = @_; - - foreach my $m4dir (@dirlist) - { - if (! opendir (DIR, $m4dir)) - { - # TODO: maybe avoid complaining only if errno == ENONENT? - my $message = "couldn't open directory '$m4dir': $!"; - - if ($err_level == SCAN_M4_DIRS_ERROR) - { - fatal $message; - } - elsif ($err_level == SCAN_M4_DIRS_WARN) - { - msg ('unsupported', $message); - next; - } - elsif ($err_level == SCAN_M4_DIRS_SILENT) - { - next; # Silently ignore. - } - else - { - prog_error "invalid \$err_level value '$err_level'"; - } - } - - # 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. - - if (@user_includes) - { - # Don't explore the same directory multiple times. This is here not - # only for speedup purposes. We need this when the user has e.g. - # specified 'ACLOCAL_AMFLAGS = -I m4' and has also set - # AC_CONFIG_MACRO_DIR[S]([m4]) in configure.ac. This makes the 'm4' - # directory to occur twice here and fail on the second call to - # scan_m4_dirs([m4]) when the 'm4' directory doesn't exist. - # TODO: Shouldn't there be rather a check in scan_m4_dirs for - # @user_includes[0]? - @user_includes = uniq @user_includes; - - # Don't complain if the first user directory doesn't exist, in case - # we need to create it later (can happen if '--install' was given). - scan_m4_dirs (FT_USER, - $install ? SCAN_M4_DIRS_SILENT : SCAN_M4_DIRS_WARN, - $user_includes[0]); - scan_m4_dirs (FT_USER, - SCAN_M4_DIRS_ERROR, - @user_includes[1..$#user_includes]); - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @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", - "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:$.", - "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:$.", "underquoted definition of $2" - . "\n run info Automake 'Extending aclocal'\n" - . " or see http://www.gnu.org/software/automake/manual/" - . "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; - - # When AC_CONFIG_MACRO_DIRS is used, avoid possible spurious warnings - # from autom4te about macros being "m4_require'd but not m4_defun'd"; - # for more background, see: - # http://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00004.html - # as well as autoconf commit 'v2.69-44-g1ed0548', "warn: allow aclocal - # to silence m4_require warnings". - my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])"; - - my $traces = ($ENV{AUTOM4TE} || 'autom4te'); - $traces .= " --language Autoconf-without-aclocal-m4 "; - $traces = "echo '$early_m4_code' | $traces - "; - - # Support AC_CONFIG_MACRO_DIRS also with older autoconf. - # Note that we can't use '$ac_config_macro_dirs_fallback' here, because - # a bug in option parsing code of autom4te 2.68 and earlier will cause - # it to read standard input last, even if the "-" argument is specified - # early. - # FIXME: To be removed in Automake 2.0, once we can assume autoconf - # 2.70 or later. - $traces .= "$automake_includes[0]/internal/ac-config-macro-dirs.m4 "; - - # All candidate files. - $traces .= join (' ', - (map { "'$_'" } - (grep { exists $files{$_} } @file_order))) . " "; - - # All candidate macros. - $traces .= join (' ', - (map { "--trace='$_:\$f::\$n::\${::}%'" } - ('AC_DEFUN', - 'AC_DEFUN_ONCE', - 'AU_DEFUN', - '_AM_AUTOCONF_VERSION', - 'AC_CONFIG_MACRO_DIR_TRACE', - # FIXME: Tracing the next two macros is a hack for - # compatibility with older autoconf. Remove this in - # Automake 2.0, when we can assume Autoconf 2.70 or - # later. - 'AC_CONFIG_MACRO_DIR', - '_AM_CONFIG_MACRO_DIRS')), - # 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 |"); - - @ac_config_macro_dirs = (); - - my %traced = (); - - while ($_ = $tracefh->getline) - { - chomp; - my ($file, $macro, $arg1) = split (/::/); - - $traced{$macro} = 1 if exists $macro_seen{$macro}; - - if ($macro eq 'AC_DEFUN' || $macro eq 'AC_DEFUN_ONCE' - || $macro eq 'AU_DEFUN') - { - $map_traced_defs{$arg1} = $file; - } - elsif ($macro eq '_AM_AUTOCONF_VERSION') - { - $ac_version = $arg1; - } - elsif ($macro eq 'AC_CONFIG_MACRO_DIR_TRACE') - { - push @ac_config_macro_dirs, $arg1; - } - # FIXME: We still need to trace AC_CONFIG_MACRO_DIR - # for compatibility with older autoconf. Remove this - # once we can assume Autoconf 2.70 or later. - elsif ($macro eq 'AC_CONFIG_MACRO_DIR') - { - @ac_config_macro_dirs = ($arg1); - } - # FIXME:This is an hack for compatibility with older autoconf. - # Remove this once we can assume Autoconf 2.70 or later. - elsif ($macro eq '_AM_CONFIG_MACRO_DIRS') - { - # Empty leading/trailing fields might be produced by split, - # hence the grep is really needed. - push @ac_config_macro_dirs, grep (/./, (split /\s+/, $arg1)); - } - } - - # FIXME: in Autoconf >= 2.70, AC_CONFIG_MACRO_DIR calls - # AC_CONFIG_MACRO_DIR_TRACE behind the scenes, which could - # leave unwanted duplicates in @ac_config_macro_dirs. - # Remove this in Automake 2.0, when we'll stop tracing - # AC_CONFIG_MACRO_DIR explicitly. - @ac_config_macro_dirs = uniq @ac_config_macro_dirs; - - $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) - { - install_file ($ifile, $user_includes[0]); - } - $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_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [$ac_version],, -[m4_warning([this file was generated for autoconf $ac_version. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) - -$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-$RELEASE_YEAR 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. - -$ac_config_macro_dirs_fallback -$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 <<'EOF'; -Usage: aclocal [OPTION]... - -Generate 'aclocal.m4' by scanning 'configure.ac' or 'configure.in' - -Options: - --automake-acdir=DIR directory holding automake-provided m4 files - --system-acdir=DIR directory holding third-party system-wide files - --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 system-wide - third-party 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 . -GNU Automake home page: . -General help using GNU software: . -EOF - exit $status; -} - -# Print version and exit. -sub version () -{ - print < -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF - exit 0; -} - -# Parse command line. -sub parse_arguments () -{ - my $print_and_exit = 0; - my $diff_command; - - my %cli_options = - ( - 'help' => sub { usage(0); }, - 'version' => \&version, - 'system-acdir=s' => sub { shift; @system_includes = @_; }, - 'automake-acdir=s' => sub { shift; @automake_includes = @_; }, - '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 Automake::Getopt (); - Automake::Getopt::parse_options %cli_options; - - if (@ARGV > 0) - { - fatal ("non-option arguments are not accepted: '$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; - } - - # 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); - } -} - -# Add any directory listed in the 'ACLOCAL_PATH' environment variable -# to the list of system include directories. -sub parse_ACLOCAL_PATH () -{ - return if not defined $ENV{"ACLOCAL_PATH"}; - # Directories in ACLOCAL_PATH should take precedence over system - # directories, so we use unshift. However, directories that - # come first in ACLOCAL_PATH take precedence over directories - # coming later, which is why the result of split is reversed. - foreach my $dir (reverse split /:/, $ENV{"ACLOCAL_PATH"}) - { - unshift (@system_includes, $dir) if $dir ne '' && -d $dir; - } -} - -################################################################ - -parse_WARNINGS; # Parse the WARNINGS environment variable. -parse_arguments; -parse_ACLOCAL_PATH; -$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; -my $rerun_due_to_macrodir = 0; -while (1) - { - ++$loop; - prog_error "too many loops" if $loop > 2 + $rerun_due_to_macrodir; - - reset_maps; - scan_m4_files; - scan_configure; - last if $exit_code; - my %macro_traced = trace_used_macros; - - if (!$rerun_due_to_macrodir && @ac_config_macro_dirs) - { - # The directory specified in calls to the AC_CONFIG_MACRO_DIRS - # m4 macro (if any) must go after the user includes specified - # explicitly with the '-I' option. - push @user_includes, @ac_config_macro_dirs; - # We might have to scan some new directory of .m4 files. - $rerun_due_to_macrodir++; - next; - } - - if ($install && !@user_includes) - { - fatal "installation of third-party macros impossible without " . - "-I options nor AC_CONFIG_MACRO_DIR{,S} m4 macro(s)"; - } - - 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: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoconf b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoconf deleted file mode 100755 index 47d8dcb0e..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoconf +++ /dev/null @@ -1,500 +0,0 @@ -#! /bin/sh -# Generated from autoconf.in; do not edit by hand. -# autoconf -- create `configure' using m4 macros - -# Copyright (C) 1992, 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2003, -# 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -## -------------------- ## -## 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=: - # Pre-4.2 versions of Zsh do 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_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -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.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -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 - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do 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_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested="" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - break 2 -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - - -# as_fn_error STATUS ERROR -# ------------------------ -# Output "`basename $0`: error: ERROR" to stderr. Then exit the script with -# STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -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 - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -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[:FORMAT] report the list of calls to MACRO - -i, --initialization also trace Autoconf's initialization process - -In tracing mode, no configuration script is created. FORMAT defaults -to \`\$f:\$l:\$n:\$%'; see \`autom4te --help' for information about FORMAT. - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: ." - -version="\ -autoconf (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -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=' - as_fn_error $? "option \`$1'\'' requires an argument$as_nl$help"' -# restore font-lock: ' - -# Variables. -: ${AUTOM4TE='/i686-pc-linux-gnu/bin/autom4te'} -autom4te_options= -outfile= -verbose=false - -# 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 ) - $as_echo "$usage"; exit ;; - - --verbose | -v ) - verbose=: - autom4te_options="$autom4te_options $1"; shift ;; - - # Arguments passed as is to autom4te. - --debug | -d | \ - --force | -f | \ - --include=* | -I?* | \ - --prepend-include=* | -B?* | \ - --warnings=* | -W?* ) - case $1 in - *\'*) arg=`$as_echo "$1" | sed "s/'/'\\\\\\\\''/g"` ;; #' - *) arg=$1 ;; - esac - autom4te_options="$autom4te_options '$arg'"; shift ;; - # Options with separated arg passed as is to autom4te. - --include | -I | \ - --prepend-include | -B | \ - --warnings | -W ) - test $# = 1 && eval "$exit_missing_arg" - case $2 in - *\'*) arg=`$as_echo "$2" | sed "s/'/'\\\\\\\\''/g"` ;; #' - *) arg=$2 ;; - esac - autom4te_options="$autom4te_options $option '$arg'" - shift; shift ;; - - --trace=* | -t?* ) - traces="$traces --trace='"`$as_echo "$optarg" | sed "s/'/'\\\\\\\\''/g"`"'" - shift ;; - --trace | -t ) - test $# = 1 && eval "$exit_missing_arg" - traces="$traces --trace='"`$as_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 - as_fn_error $? "invalid option \`$1'$as_nl$help" ;; #` - * ) - break ;; - esac -done - -# Find the input file. -case $# in - 0) - if test -f configure.ac; then - if test -f configure.in; then - $as_echo "$as_me: warning: both \`configure.ac' and \`configure.in' are present." >&2 - $as_echo "$as_me: warning: proceeding with \`configure.ac'." >&2 - fi - infile=configure.ac - elif test -f configure.in; then - infile=configure.in - else - as_fn_error $? "no input file" - fi - test -z "$traces" && test -z "$outfile" && outfile=configure;; - 1) - infile=$1 ;; - *) exec >&2 - as_fn_error $? "invalid number of arguments$as_nl$help" ;; -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_echo "$as_me: running $AUTOM4TE $*" >&2 -exec "$AUTOM4TE" "$@" diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoheader b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoheader deleted file mode 100755 index 5f5d0c5e8..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoheader +++ /dev/null @@ -1,304 +0,0 @@ -#! /usr/bin/perl -# -*- Perl -*- -# Generated from autoheader.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# autoheader -- create `config.h.in' from `configure.ac' - -# Copyright (C) 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Written by Roland McGrath. -# Rewritten in Perl by Akim Demaille. - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, "$pkgdatadir"; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::Configure_ac; -use Autom4te::FileUtils; -use Autom4te::General; -use Autom4te::XFile; -use strict; - -# Using `do FILE', we need `local' vars. -use vars qw ($config_h %verbatim %symbol); - -# Lib files. -my $autom4te = $ENV{'AUTOM4TE'} || '/i686-pc-linux-gnu/bin/autom4te'; -local $config_h; -my $config_h_in; -my @prepend_include; -my @include; - - -# $HELP -# ----- -$help = "Usage: $0 [OPTION]... [TEMPLATE-FILE] - -Create a template file of C \`\#define\' statements for \`configure\' to -use. To this end, scan TEMPLATE-FILE, or \`configure.ac\' if present, -or else \`configure.in\'. - - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don\'t remove temporary files - -f, --force consider all files obsolete - -W, --warnings=CATEGORY report the warnings falling in CATEGORY - -" . Autom4te::ChannelDefs::usage () . " - -Library directories: - -B, --prepend-include=DIR prepend directory DIR to search path - -I, --include=DIR append directory DIR to search path - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - - -# $VERSION -# -------- -$version = "autoheader (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Roland McGrath and Akim Demaille. -"; - - -## ---------- ## -## Routines. ## -## ---------- ## - - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - my $srcdir; - - parse_WARNINGS; - getopt ('I|include=s' => \@include, - 'B|prepend-include=s' => \@prepend_include, - 'W|warnings=s' => \&parse_warnings); - - if (! @ARGV) - { - my $configure_ac = require_configure_ac; - push @ARGV, $configure_ac; - } -} - - -## -------------- ## -## Main program. ## -## -------------- ## - -mktmpdir ('ah'); -switch_warning 'obsolete'; -parse_args; - -# Preach. -my $config_h_top = find_file ("config.h.top?", - reverse (@prepend_include), @include); -my $config_h_bot = find_file ("config.h.bot?", - reverse (@prepend_include), @include); -my $acconfig_h = find_file ("acconfig.h?", - reverse (@prepend_include), @include); -if ($config_h_top || $config_h_bot || $acconfig_h) - { - my $msg = << "END"; - Using auxiliary files such as \`acconfig.h\', \`config.h.bot\' - and \`config.h.top\', to define templates for \`config.h.in\' - is deprecated and discouraged. - - Using the third argument of \`AC_DEFINE\' and - \`AC_DEFINE_UNQUOTED\' allows one to define a template without - \`acconfig.h\': - - AC_DEFINE([NEED_FUNC_MAIN], 1, - [Define if a function \`main\' is needed.]) - - More sophisticated templates can also be produced, see the - documentation. -END - $msg =~ s/^ /WARNING: /gm; - msg 'obsolete', $msg; - } - -# Set up autoconf. -my $autoconf = "'$autom4te' --language=autoconf "; -$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include); -$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); -$autoconf .= ' --debug' if $debug; -$autoconf .= ' --force' if $force; -$autoconf .= ' --verbose' if $verbose; - -# ----------------------- # -# Real work starts here. # -# ----------------------- # - -# Source what the traces are trying to tell us. -verb "$me: running $autoconf to trace from $ARGV[0]"; -my $quoted_tmp = shell_quote ($tmp); -xsystem ("$autoconf" - # If you change this list, update the - # `Autoheader-preselections' section of autom4te.in. - . ' --trace AC_CONFIG_HEADERS:\'$$config_h ||= \'"\'"\'$1\'"\'"\';\'' - . ' --trace AH_OUTPUT:\'$$verbatim{\'"\'"\'$1\'"\'"\'} = \'"\'"\'$2\'"\'"\';\'' - . ' --trace AC_DEFINE_TRACE_LITERAL:\'$$symbol{\'"\'"\'$1\'"\'"\'} = 1;\'' - . " " . shell_quote ($ARGV[0]) . " >$quoted_tmp/traces.pl"); - -local (%verbatim, %symbol); -debug "$me: \`do'ing $tmp/traces.pl:\n" . `sed 's/^/| /' $quoted_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; - } - -# We template only the first CONFIG_HEADER. -$config_h =~ s/ .*//; -# Support "outfile[:infile]", defaulting infile="outfile.in". -($config_h, $config_h_in) = split (':', $config_h, 2); -$config_h_in ||= "$config_h.in"; - -# %SYMBOL might contain things like `F77_FUNC(name,NAME)', but we keep -# only the name of the macro. -%symbol = map { s/\(.*//; $_ => 1 } keys %symbol; - -my $out = new Autom4te::XFile ("> " . open_quote ("$tmp/config.hin")); - -# Don't write "do not edit" -- it will get copied into the -# config.h, which it's ok to edit. -print $out "/* $config_h_in. Generated from $ARGV[0] by autoheader. */\n"; - -# Dump the top. -if ($config_h_top) - { - my $in = new Autom4te::XFile ("< " . open_quote ($config_h_top)); - while ($_ = $in->getline) - { - print $out $_; - } - } - -# Dump `acconfig.h', except for its bottom portion. -if ($acconfig_h) - { - my $in = new Autom4te::XFile ("< " . open_quote ($acconfig_h)); - while ($_ = $in->getline) - { - last if /\@BOTTOM\@/; - next if /\@TOP\@/; - print $out $_; - } - } - -# Dump the templates from `configure.ac'. -foreach (sort keys %verbatim) - { - print $out "\n$verbatim{$_}\n"; - } - -# Dump bottom portion of `acconfig.h'. -if ($acconfig_h) - { - my $in = new Autom4te::XFile ("< " . open_quote ($acconfig_h)); - my $dump = 0; - while ($_ = $in->getline) - { - print $out $_ if $dump; - $dump = 1 if /\@BOTTOM\@/; - } - } - -# Dump the bottom. -if ($config_h_bot) - { - my $in = new Autom4te::XFile ("< " . open_quote ($config_h_bot)); - while ($_ = $in->getline) - { - print $out $_; - } - } - -$out->close; - -# Check that all the symbols have a template. -{ - my $in = new Autom4te::XFile ("< " . open_quote ("$tmp/config.hin")); - my $suggest_ac_define = 1; - while ($_ = $in->getline) - { - my ($symbol) = /^\#\s*\w+\s+(\w+)/ - or next; - delete $symbol{$symbol}; - } - foreach (sort keys %symbol) - { - msg 'syntax', "warning: missing template: $_"; - if ($suggest_ac_define) - { - msg 'syntax', "Use AC_DEFINE([$_], [], [Description])"; - $suggest_ac_define = 0; - } - - } - exit 1 - if keys %symbol; -} - -update_file ("$tmp/config.hin", "$config_h_in", $force); - -### 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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autom4te b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autom4te deleted file mode 100755 index d29ca29ba..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autom4te +++ /dev/null @@ -1,1075 +0,0 @@ -#! /usr/bin/perl -w -# -*- perl -*- -# Generated from autom4te.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# autom4te - Wrapper around M4 libraries. -# Copyright (C) 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010 -# 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::C4che; -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::FileUtils; -use Autom4te::General; -use Autom4te::XFile; -use File::Basename; -use strict; - -# Data directory. -my $pkgdatadir = $ENV{'AC_MACRODIR'} || '//share/autoconf'; - -# $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE. -my %language; - -my $output = '-'; - -# Mode of the output file except for traces. -my $mode = "0666"; - -# If melt, don't use frozen files. -my $melt = 0; - -# Names of the cache directory, cache directory index, trace cache -# prefix, and output cache prefix. And the IO object for the index. -my $cache; -my $icache; -my $tcache; -my $ocache; -my $icache_file; - -my $flock_implemented = 'yes'; - -# The macros to trace mapped to their format, as specified by the -# user. -my %trace; - -# The macros the user will want to trace in the future. -# We need `include' to get the included file, `m4_pattern_forbid' and -# `m4_pattern_allow' to check the output. -# -# FIXME: What about `sinclude'? -my @preselect = ('include', - 'm4_pattern_allow', 'm4_pattern_forbid', - '_m4_warn'); - -# M4 include path. -my @include; - -# Do we freeze? -my $freeze = 0; - -# $M4. -my $m4 = $ENV{"M4"} || '/usr/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" - 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]*) /; - - -# @M4_BUILTIN -- M4 builtins and a useful comment. -my @m4_builtin = `echo dumpdef | $m4 2>&1 >/dev/null`; -map { s/:.*//;s/\W// } @m4_builtin; - - -# %M4_BUILTIN_ALTERNATE_NAME -# -------------------------- -# The builtins are renamed, e.g., `define' is renamed `m4_define'. -# So map `define' to `m4_define' and conversely. -# Some macros don't follow this scheme: be sure to properly map to their -# alternate name too. -# -# FIXME: Trace status of renamed builtins was fixed in M4 1.4.5, which -# we now depend on; do we still need to do this mapping? -# -# So we will merge them, i.e., tracing `BUILTIN' or tracing -# `m4_BUILTIN' will be the same: tracing both, but honoring the -# *last* trace specification. -# -# FIXME: This is not enough: in the output `$0' will be `BUILTIN' -# sometimes and `m4_BUILTIN' at others. We should return a unique name, -# the one specified by the user. -# -# FIXME: To be absolutely rigorous, I would say that given that we -# _redefine_ divert (instead of _copying_ it), divert and the like -# should not be part of this list. -my %m4_builtin_alternate_name; -@m4_builtin_alternate_name{"$_", "m4_$_"} = ("m4_$_", "$_") - foreach (grep { !/m4wrap|m4exit|dnl|ifelse|__.*__/ } @m4_builtin); -@m4_builtin_alternate_name{"ifelse", "m4_if"} = ("m4_if", "ifelse"); -@m4_builtin_alternate_name{"m4exit", "m4_exit"} = ("m4_exit", "m4exit"); -@m4_builtin_alternate_name{"m4wrap", "m4_wrap"} = ("m4_wrap", "m4wrap"); - - -# $HELP -# ----- -$help = "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. - -If some of the FILES are named \`FILE.m4f\' they are considered to be M4 -frozen files of all the previous files (which are therefore not loaded). -If \`FILE.m4f\' is not found, then \`FILE.m4\' will be used, together with -all the previous files. - -Some files may be optional, i.e., will only be processed if found in the -include path, but then must end in \`.m4?\'; the question mark is not part of -the actual file name. - -Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don\'t remove temporary files - -o, --output=FILE save output in FILE (defaults to \`-\', stdout) - -f, --force don\'t rely on cached values - -W, --warnings=CATEGORY report the warnings falling in CATEGORY - -l, --language=LANG specify the set of M4 macros to use - -C, --cache=DIRECTORY preserve results for future runs in DIRECTORY - --no-cache disable the cache - -m, --mode=OCTAL change the non trace output file mode (0666) - -M, --melt don\'t use M4 frozen files - -Languages include: - \`Autoconf\' create Autoconf configure scripts - \`Autotest\' create Autotest test suites - \`M4sh\' create M4sh shell scripts - \`M4sugar\' create M4sugar output - -" . Autom4te::ChannelDefs::usage . " - -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[:FORMAT] report the MACRO invocations - -p, --preselect=MACRO prepare to trace MACRO in a future run - -Freezing: - -F, --freeze produce an M4 frozen state file for FILES - -FORMAT defaults to \`\$f:\$l:\$n:\$%\', and can use the following escapes: - \$\$ literal \$ - \$f file where macro was called - \$l line where macro was called - \$d nesting depth of macro call - \$n name of the macro - \$NUM argument NUM, unquoted and with newlines - \$SEP\@ all arguments, with newlines, quoted, and separated by SEP - \$SEP* all arguments, with newlines, unquoted, and separated by SEP - \$SEP% all arguments, without newlines, unquoted, and separated by SEP -SEP can be empty for the default (comma for \@ and *, colon for %), -a single character for that character, or {STRING} to use a string. - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - -# $VERSION -# -------- -$version = <<"EOF"; -autom4te (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Akim Demaille. -EOF - - -## ---------- ## -## Routines. ## -## ---------- ## - - -# $OPTION -# files_to_options (@FILE) -# ------------------------ -# Transform Autom4te conventions (e.g., using foo.m4f to designate a frozen -# file) into a suitable command line for M4 (e.g., using --reload-state). -# parse_args guarantees that we will see at most one frozen file, and that -# if a frozen file is present, it is the first argument. -sub files_to_options (@) -{ - my (@file) = @_; - my @res; - foreach my $file (@file) - { - my $arg = shell_quote ($file); - if ($file =~ /\.m4f$/) - { - $arg = "--reload-state=$arg"; - # If the user downgraded M4 from 1.6 to 1.4.x after freezing - # the file, then we ensure the frozen __m4_version__ will - # not cause m4_init to make the wrong decision about the - # current M4 version. - $arg .= " --undefine=__m4_version__" - unless grep {/__m4_version__/} @m4_builtin; - } - push @res, $arg; - } - return join ' ', @res; -} - - -# load_configuration ($FILE) -# -------------------------- -# Load the configuration $FILE. -sub load_configuration ($) -{ - my ($file) = @_; - use Text::ParseWords; - - my $cfg = new Autom4te::XFile ("< " . open_quote ($file)); - my $lang; - while ($_ = $cfg->getline) - { - chomp; - # Comments. - next - if /^\s*(\#.*)?$/; - - my @words = shellwords ($_); - my $type = shift @words; - if ($type eq 'begin-language:') - { - fatal "$file:$.: end-language missing for: $lang" - if defined $lang; - $lang = lc $words[0]; - } - elsif ($type eq 'end-language:') - { - error "$file:$.: end-language mismatch: $lang" - if $lang ne lc $words[0]; - $lang = undef; - } - elsif ($type eq 'args:') - { - fatal "$file:$.: no current language" - unless defined $lang; - push @{$language{$lang}}, @words; - } - else - { - error "$file:$.: unknown directive: $type"; - } - } -} - - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - # We want to look for the early options, which should not be found - # in the configuration file. Prepend to the user arguments. - # Perform this repeatedly so that we can use --language in language - # definitions. Beware that there can be several --language - # invocations. - my @language; - do { - @language = (); - use Getopt::Long; - Getopt::Long::Configure ("pass_through", "permute"); - GetOptions ("l|language=s" => \@language); - - foreach (@language) - { - error "unknown language: $_" - unless exists $language{lc $_}; - unshift @ARGV, @{$language{lc $_}}; - } - } while @language; - - # --debug is useless: it is parsed below. - if (exists $ENV{'AUTOM4TE_DEBUG'}) - { - print STDERR "$me: concrete arguments:\n"; - foreach my $arg (@ARGV) - { - print STDERR "| $arg\n"; - } - } - - # 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, - "m|mode=s" => \$mode, - "M|melt" => \$melt, - - # Library directories: - "B|prepend-include=s" => \@prepend_include, - "I|include=s" => \@include, - - # Tracing: - # Using a hash for traces is seducing. Unfortunately, upon `-t FOO', - # instead of mapping `FOO' to undef, Getopt maps it to `1', preventing - # us from distinguishing `-t FOO' from `-t FOO=1'. So let's do it - # by hand. - "t|trace=s" => \@trace, - "p|preselect=s" => \@preselect, - - # Freezing. - "F|freeze" => \$freeze, - - # Caching. - "C|cache=s" => \$cache, - "no-cache" => sub { $cache = undef; }, - ); - - fatal "too few arguments -Try `$me --help' for more information." - unless @ARGV; - - # Freezing: - # We cannot trace at the same time (well, we can, but it sounds insane). - # 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" - if $freeze && @trace; - $melt = 1 - if $freeze; - - # Names of the cache directory, cache directory index, trace cache - # prefix, and output cache prefix. If the cache is not to be - # preserved, default to a temporary directory (automatically removed - # on exit). - $cache = $tmp - unless $cache; - $icache = "$cache/requests"; - $tcache = "$cache/traces."; - $ocache = "$cache/output."; - - # Normalize the includes: the first occurrence is enough, several is - # a pain since it introduces a useless difference in the path which - # invalidates the cache. And strip `.' which is implicit and always - # first. - @include = grep { !/^\.$/ } uniq (reverse(@prepend_include), @include); - - # Convert @trace to %trace, and work around the M4 builtins tracing - # problem. - # The default format is `$f:$l:$n:$%'. - foreach (@trace) - { - /^([^:]+)(?::(.*))?$/ms; - $trace{$1} = defined $2 ? $2 : '$f:$l:$n:$%'; - $trace{$m4_builtin_alternate_name{$1}} = $trace{$1} - if exists $m4_builtin_alternate_name{$1}; - } - - # Work around the M4 builtins tracing problem for @PRESELECT. - # FIXME: Is this still needed, now that we rely on M4 1.4.5? - push (@preselect, - map { $m4_builtin_alternate_name{$_} } - grep { exists $m4_builtin_alternate_name{$_} } @preselect); - - # If we find frozen files, then all the files before it are - # discarded: the frozen file is supposed to include them all. - # - # We don't want to depend upon m4's --include to find the top level - # files, so we use `find_file' here. Try to get a canonical name, - # as it's part of the key for caching. And some files are optional - # (also handled by `find_file'). - my @argv; - foreach (@ARGV) - { - if ($_ eq '-') - { - push @argv, $_; - } - elsif (/\.m4f$/) - { - # Frozen files are optional => pass a `?' to `find_file'. - my $file = find_file ("$_?", @include); - if (!$melt && $file) - { - @argv = ($file); - } - else - { - s/\.m4f$/.m4/; - push @argv, find_file ($_, @include); - } - } - else - { - my $file = find_file ($_, @include); - push @argv, $file - if $file; - } - } - @ARGV = @argv; -} - - -# handle_m4 ($REQ, @MACRO) -# ------------------------ -# Run m4 on the input files, and save the traces on the @MACRO. -sub handle_m4 ($@) -{ - my ($req, @macro) = @_; - - # GNU m4 appends when using --debugfile/--error-output. - unlink ($tcache . $req->id . "t"); - - # Run m4. - # - # We don't output directly to the cache files, to avoid problems - # when we are interrupted (that leaves corrupted files). - xsystem ("$m4 --gnu" - . join (' --include=', '', map { shell_quote ($_) } @include) - . ' --debug=aflq' - . (!exists $ENV{'AUTOM4TE_NO_FATAL'} ? ' --fatal-warning' : '') - . " --debugfile=" . shell_quote ("$tcache" . $req->id . "t") - . join (' --trace=', '', map { shell_quote ($_) } sort @macro) - . " " . files_to_options (@ARGV) - . " > " . shell_quote ("$ocache" . $req->id . "t")); - - # Everything went ok: preserve the outputs. - foreach my $file (map { $_ . $req->id } ($tcache, $ocache)) - { - use File::Copy; - move ("${file}t", "$file") - or fatal "cannot rename ${file}t as $file: $!"; - } -} - - -# warn_forbidden ($WHERE, $WORD, %FORBIDDEN) -# ------------------------------------------ -# $WORD is forbidden. Warn with a dedicated error message if in -# %FORBIDDEN, otherwise a simple `error: possibly undefined macro' -# will do. -my $first_warn_forbidden = 1; -sub warn_forbidden ($$%) -{ - my ($where, $word, %forbidden) = @_; - my $message; - - for my $re (sort keys %forbidden) - { - if ($word =~ $re) - { - $message = $forbidden{$re}; - last; - } - } - $message ||= "possibly undefined macro: $word"; - warn "$where: error: $message\n"; - if ($first_warn_forbidden) - { - warn < 'forbid:$1:$2', - 'm4_pattern_allow' => 'allow:$1')); - my @patterns = new Autom4te::XFile ("< " . open_quote ("$tmp/patterns"))->getlines; - chomp @patterns; - my %forbidden = - map { /^forbid:([^:]+):.+$/ => /^forbid:[^:]+:(.+)$/ } @patterns; - my $forbidden = join ('|', map { /^forbid:([^:]+)/ } @patterns) || "^\$"; - my $allowed = join ('|', map { /^allow:([^:]+)/ } @patterns) || "^\$"; - - verb "forbidden tokens: $forbidden"; - verb "forbidden token : $_ => $forbidden{$_}" - foreach (sort keys %forbidden); - verb "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 - # stdout is to be handled by hand :(. Don't use fdopen as it means - # we will close STDOUT, which we already do in END. - my $out = new Autom4te::XFile; - if ($output eq '-') - { - $out->open (">$output"); - } - else - { - $out->open($output, O_CREAT | O_WRONLY | O_TRUNC, oct ($mode)); - } - fatal "cannot create $output: $!" - unless $out; - my $in = new Autom4te::XFile ("< " . open_quote ($ocache . $req->id)); - - my %prohibited; - my $res; - while ($_ = $in->getline) - { - s/\s+$//; - s/__oline__/$./g; - s/\@<:\@/[/g; - s/\@:>\@/]/g; - s/\@\{:\@/(/g; - s/\@:\}\@/)/g; - s/\@S\|\@/\$/g; - s/\@%:\@/#/g; - - $res = $_; - - # Don't complain in comments. Well, until we have something - # better, don't consider `#include' etc. are comments. - s/\#.*// - unless /^\#\s*(if|include|endif|ifdef|ifndef|define)\b/; - foreach (split (/\W+/)) - { - $prohibited{$_} = $. - if !/^$/ && /$forbidden/o && !/$allowed/o && ! exists $prohibited{$_}; - } - - # Performed *last*: the empty quadrigraph. - $res =~ s/\@&t\@//g; - - print $out "$res\n"; - } - - $out->close(); - - # If no forbidden words, we're done. - return - if ! %prohibited; - - # Locate the forbidden words in the last input file. - # This is unsatisfying but... - $exit_code = 1; - if ($ARGV[$#ARGV] ne '-') - { - my $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b'; - my $file = new Autom4te::XFile ("< " . open_quote ($ARGV[$#ARGV])); - - while ($_ = $file->getline) - { - # Don't complain in comments. Well, until we have something - # better, don't consider `#include' etc. to be comments. - s/\#.*// - unless /^\#(if|include|endif|ifdef|ifndef|define)\b/; - - # Complain once per word, but possibly several times per line. - while (/$prohibited/) - { - my $word = $1; - warn_forbidden ("$ARGV[$#ARGV]:$.", $word, %forbidden); - delete $prohibited{$word}; - # If we're done, exit. - return - if ! %prohibited; - $prohibited = '\b(' . join ('|', keys %prohibited) . ')\b'; - } - } - } - warn_forbidden ("$output:$prohibited{$_}", $_, %forbidden) - foreach (sort { $prohibited{$a} <=> $prohibited{$b} } keys %prohibited); -} - - -## --------------------- ## -## Handling the traces. ## -## --------------------- ## - - -# $M4_MACRO -# trace_format_to_m4 ($FORMAT) -# ---------------------------- -# Convert a trace $FORMAT into a M4 trace processing macro's body. -sub trace_format_to_m4 ($) -{ - my ($format) = @_; - my $underscore = $_; - my %escape = (# File name. - 'f' => '$1', - # Line number. - 'l' => '$2', - # Depth. - 'd' => '$3', - # Name (also available as $0). - 'n' => '$4', - # Escaped dollar. - '$' => '$'); - - my $res = ''; - $_ = $format; - while ($_) - { - # $n -> $(n + 4) - if (s/^\$(\d+)//) - { - $res .= "\$" . ($1 + 4); - } - # $x, no separator given. - elsif (s/^\$([fldn\$])//) - { - $res .= $escape{$1}; - } - # $.x or ${sep}x. - elsif (s/^\$\{([^}]*)\}([@*%])// - || s/^\$(.?)([@*%])//) - { - # $@, list of quoted effective arguments. - if ($2 eq '@') - { - $res .= ']at_at([' . ($1 ? $1 : ',') . '], $@)['; - } - # $*, list of unquoted effective arguments. - elsif ($2 eq '*') - { - $res .= ']at_star([' . ($1 ? $1 : ',') . '], $@)['; - } - # $%, list of flattened unquoted effective arguments. - elsif ($2 eq '%') - { - $res .= ']at_percent([' . ($1 ? $1 : ':') . '], $@)['; - } - } - elsif (/^(\$.)/) - { - error "invalid escape: $1"; - } - else - { - s/^([^\$]+)//; - $res .= $1; - } - } - - $_ = $underscore; - return '[[' . $res . ']]'; -} - - -# handle_traces($REQ, $OUTPUT, %TRACE) -# ------------------------------------ -# We use M4 itself to process the traces. But to avoid name clashes when -# processing the traces, the builtins are disabled, and moved into `at_'. -# Actually, all the low level processing macros are in `at_' (and `_at_'). -# To avoid clashes between user macros and `at_' macros, the macros which -# implement tracing are in `AT_'. -# -# Having $REQ is needed to neutralize the macros which have been traced, -# but are not wanted now. -sub handle_traces ($$%) -{ - my ($req, $output, %trace) = @_; - - verb "formatting traces for `$output': " . join (', ', sort keys %trace); - - # Processing the traces. - my $trace_m4 = new Autom4te::XFile ("> " . open_quote ("$tmp/traces.m4")); - - $_ = <<'EOF'; - divert(-1) - changequote([, ]) - # _at_MODE(SEPARATOR, ELT1, ELT2...) - # ---------------------------------- - # List the elements, separating then with SEPARATOR. - # MODE can be: - # `at' -- the elements are enclosed in brackets. - # `star' -- the elements are listed as are. - # `percent' -- the elements are `flattened': spaces are singled out, - # and no new line remains. - define([_at_at], - [at_ifelse([$#], [1], [], - [$#], [2], [[[$2]]], - [[[$2]][$1]$0([$1], at_shift(at_shift($@)))])]) - - define([_at_percent], - [at_ifelse([$#], [1], [], - [$#], [2], [at_flatten([$2])], - [at_flatten([$2])[$1]$0([$1], at_shift(at_shift($@)))])]) - - define([_at_star], - [at_ifelse([$#], [1], [], - [$#], [2], [[$2]], - [[$2][$1]$0([$1], at_shift(at_shift($@)))])]) - - # FLATTEN quotes its result. - # Note that the second pattern is `newline, tab or space'. Don't lose - # the tab! - define([at_flatten], - [at_patsubst(at_patsubst([[[$1]]], [\\\n]), [[\n\t ]+], [ ])]) - - define([at_args], [at_shift(at_shift(at_shift(at_shift(at_shift($@)))))]) - define([at_at], [_$0([$1], at_args($@))]) - define([at_percent], [_$0([$1], at_args($@))]) - define([at_star], [_$0([$1], at_args($@))]) - -EOF - s/^ //mg;s/\\t/\t/mg;s/\\n/\n/mg; - print $trace_m4 $_; - - # If you trace `define', then on `define([m4_exit], defn([m4exit])' you - # will produce - # - # AT_define([m4sugar.m4], [115], [1], [define], [m4_exit], ) - # - # Since `' is not quoted, the outer m4, when processing - # `trace.m4' will exit prematurely. Hence, move all the builtins to - # the `at_' name space. - - print $trace_m4 "# Copy the builtins.\n"; - map { print $trace_m4 "define([at_$_], defn([$_]))\n" } @m4_builtin; - print $trace_m4 "\n"; - - print $trace_m4 "# Disable them.\n"; - map { print $trace_m4 "at_undefine([$_])\n" } @m4_builtin; - print $trace_m4 "\n"; - - - # Neutralize traces: we don't want traces of cached requests (%REQUEST). - print $trace_m4 - "## -------------------------------------- ##\n", - "## By default neutralize all the traces. ##\n", - "## -------------------------------------- ##\n", - "\n"; - print $trace_m4 "at_define([AT_$_], [at_dnl])\n" - foreach (sort keys %{$req->macro}); - print $trace_m4 "\n"; - - # Implement traces for current requests (%TRACE). - print $trace_m4 - "## ------------------------- ##\n", - "## Trace processing macros. ##\n", - "## ------------------------- ##\n", - "\n"; - foreach (sort keys %trace) - { - # Trace request can be embed \n. - (my $comment = "Trace $_:$trace{$_}") =~ s/^/\# /; - print $trace_m4 "$comment\n"; - print $trace_m4 "at_define([AT_$_],\n"; - print $trace_m4 trace_format_to_m4 ($trace{$_}) . ")\n\n"; - } - print $trace_m4 "\n"; - - # Reenable output. - print $trace_m4 "at_divert(0)at_dnl\n"; - - # Transform the traces from m4 into an m4 input file. - # Typically, transform: - # - # | m4trace:configure.ac:3: -1- AC_SUBST([exec_prefix], [NONE]) - # - # into - # - # | AT_AC_SUBST([configure.ac], [3], [1], [AC_SUBST], [exec_prefix], [NONE]) - # - # Pay attention that the file name might include colons, if under DOS - # for instance, so we don't use `[^:]+'. - my $traces = new Autom4te::XFile ("< " . open_quote ($tcache . $req->id)); - while ($_ = $traces->getline) - { - # Trace with arguments, as the example above. We don't try - # to match the trailing parenthesis as it might be on a - # separate line. - s{^m4trace:(.+):(\d+): -(\d+)- ([^(]+)\((.*)$} - {AT_$4([$1], [$2], [$3], [$4], $5}; - # Traces without arguments, always on a single line. - s{^m4trace:(.+):(\d+): -(\d+)- ([^)]*)\n$} - {AT_$4([$1], [$2], [$3], [$4])\n}; - print $trace_m4 "$_"; - } - $trace_m4->close; - - my $in = new Autom4te::XFile ("$m4 " . shell_quote ("$tmp/traces.m4") . " |"); - my $out = new Autom4te::XFile ("> " . open_quote ($output)); - - # This is dubious: should we really transform the quadrigraphs in - # traces? It might break balanced [ ] etc. in the output. The - # consensus seeems to be that traces are more useful this way. - while ($_ = $in->getline) - { - # It makes no sense to try to transform __oline__. - s/\@<:\@/[/g; - s/\@:>\@/]/g; - s/\@\{:\@/(/g; - s/\@:\}\@/)/g; - s/\@S\|\@/\$/g; - s/\@%:\@/#/g; - s/\@&t\@//g; - print $out $_; - } -} - - -# $BOOL -# up_to_date ($REQ) -# ----------------- -# Are the cache files of $REQ up to date? -# $REQ is `valid' if it corresponds to the request and exists, which -# does not mean it is up to date. It is up to date if, in addition, -# its files are younger than its dependencies. -sub up_to_date ($) -{ - my ($req) = @_; - - return 0 - if ! $req->valid; - - my $tfile = $tcache . $req->id; - my $ofile = $ocache . $req->id; - - # We can't answer properly if the traces are not computed since we - # need to know what other files were included. Actually, if any of - # the cache files is missing, we are not up to date. - return 0 - if ! -f $tfile || ! -f $ofile; - - # The youngest of the cache files must be older than the oldest of - # the dependencies. - my $tmtime = mtime ($tfile); - my $omtime = mtime ($ofile); - my ($file, $mtime) = ($tmtime < $omtime - ? ($ofile, $omtime) : ($tfile, $tmtime)); - - # We depend at least upon the arguments. - my @dep = @ARGV; - - # stdin is always out of date. - if (grep { $_ eq '-' } @dep) - { return 0 } - - # Files may include others. We can use traces since we just checked - # if they are available. - handle_traces ($req, "$tmp/dependencies", - ('include' => '$1', - 'm4_include' => '$1')); - my $deps = new Autom4te::XFile ("< " . open_quote ("$tmp/dependencies")); - while ($_ = $deps->getline) - { - chomp; - my $file = find_file ("$_?", @include); - # If a file which used to be included is no longer there, then - # don't say it's missing (it might no longer be included). But - # of course, that causes the output to be outdated (as if the - # time stamp of that missing file was newer). - return 0 - if ! $file; - push @dep, $file; - } - - # If $FILE is younger than one of its dependencies, it is outdated. - return up_to_date_p ($file, @dep); -} - - -## ---------- ## -## Freezing. ## -## ---------- ## - -# freeze ($OUTPUT) -# ---------------- -sub freeze ($) -{ - my ($output) = @_; - - # When processing the file with diversion disabled, there must be no - # output but comments and empty lines. - my $result = xqx ("$m4" - . ' --fatal-warning' - . join (' --include=', '', map { shell_quote ($_) } @include) - . ' --define=divert' - . " " . files_to_options (@ARGV) - . ' lock (LOCK_EX) - if ($flock_implemented eq "yes"); - -# Read the cache index if available and older than autom4te itself. -# If autom4te is younger, then some structures such as C4che might -# have changed, which would corrupt its processing. -Autom4te::C4che->load ($icache_file) - 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]); - -# If $REQ's cache files are not up to date, or simply if the user -# discarded them (-f), declare it invalid. -$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; - -# We need to run M4 if (i) the user 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 - # In particular, m4_warn guarantees that either $stackdump is empty, or - # it consists of lines where only the last line ends in "top level". - my ($cat, $loc, $msg, $stacktrace) = split ('::', $_, 4); - msg $cat, $loc, "warning: $msg", - partial => ($stacktrace =~ /top level$/) + 0; - for (split /\n/, $stacktrace) - { - my ($loc, $trace) = split (': ', $_, 2); - msg $cat, $loc, $trace, partial => ($trace !~ /top level$/) + 0; - } -} - -# Now output... -if (%trace) - { - # Always produce traces, since even if the output is young enough, - # there is no guarantee that the traces use the same *format* - # (e.g., `-t FOO:foo' and `-t FOO:bar' are both using the same M4 - # traces, hence the M4 traces cache is usable, but its formatting - # will yield different results). - handle_traces ($req, $output, %trace); - } -else - { - # Actual M4 expansion, if the user wants it, or if $output is old - # (STDOUT is pretty old). - handle_output ($req, $output) - if $force || mtime ($output) < mtime ($ocache . $req->id); - } - -# If we ran up to here, the cache is valid. -$req->valid (1); -Autom4te::C4che->save ($icache_file); - -exit $exit_code; - -### Setup "GNU" style for perl-mode and cperl-mode. -## Local Variables: -## perl-indent-level: 2 -## perl-continued-statement-offset: 2 -## perl-continued-brace-offset: 0 -## perl-brace-offset: 0 -## perl-brace-imaginary-offset: 0 -## perl-label-offset: -2 -## cperl-indent-level: 2 -## cperl-brace-offset: 0 -## cperl-continued-brace-offset: 0 -## cperl-label-offset: -2 -## cperl-extra-newline-before-brace: t -## cperl-merge-trailing-else: nil -## cperl-continued-statement-offset: 2 -## End: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/automake b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/automake deleted file mode 100755 index c7f9cea7f..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/automake +++ /dev/null @@ -1,8298 +0,0 @@ -#!/usr/bin/perl -w -# -*- perl -*- -# Generated from bin/automake.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# automake - create Makefile.in from Makefile.am -# Copyright (C) 1994-2013 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, see . - -# Originally written by David Mackenzie . -# Perl reimplementation by Tom Tromey , and -# Alexandre Duret-Lutz . - -package Automake; - -use strict; - -BEGIN -{ - @Automake::perl_libdirs = ('//share/automake-1.14') - unless @Automake::perl_libdirs; - unshift @INC, @Automake::perl_libdirs; - - # 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{'DJDIR'}; -} - -use Automake::Config; -BEGIN -{ - if ($perl_threads) - { - require threads; - import threads; - require Thread::Queue; - import Thread::Queue; - } -} -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::Variable; -use Automake::VarDef; -use Automake::Rule; -use Automake::RuleDef; -use Automake::Wrap 'makefile_wrap'; -use Automake::Language; -use File::Basename; -use File::Spec; -use Carp; - -## ----------------------- ## -## Subroutine prototypes. ## -## ----------------------- ## - -# BEGIN AUTOMATICALLY GENERATED PROTOTYPES -sub append_exeext (&$); -sub check_gnits_standards (); -sub check_gnu_standards (); -sub check_trailing_slash ($\$); -sub check_typos (); -sub define_files_variable ($\@$$); -sub define_standard_variables (); -sub define_verbose_libtool (); -sub define_verbose_texinfo (); -sub do_check_merge_target (); -sub get_number_of_threads (); -sub handle_compile (); -sub handle_data (); -sub handle_dist (); -sub handle_emacs_lisp (); -sub handle_factored_dependencies (); -sub handle_footer (); -sub handle_gettext (); -sub handle_headers (); -sub handle_install (); -sub handle_java (); -sub handle_languages (); -sub handle_libraries (); -sub handle_libtool (); -sub handle_ltlibraries (); -sub handle_makefiles_serial (); -sub handle_man_pages (); -sub handle_minor_options (); -sub handle_options (); -sub handle_programs (); -sub handle_python (); -sub handle_scripts (); -sub handle_silent (); -sub handle_subdirs (); -sub handle_tags (); -sub handle_tests (); -sub handle_tests_dejagnu (); -sub handle_texinfo (); -sub handle_user_recursion (); -sub initialize_per_input (); -sub lang_lex_finish (); -sub lang_sub_obj (); -sub lang_vala_finish (); -sub lang_yacc_finish (); -sub locate_aux_dir (); -sub parse_arguments (); -sub scan_aclocal_m4 (); -sub scan_autoconf_files (); -sub silent_flag (); -sub transform ($\%); -sub transform_token ($\%$); -sub usage (); -sub version (); -sub yacc_lex_finish_helper (); -# END AUTOMATICALLY GENERATED PROTOTYPES - - -## ----------- ## -## Constants. ## -## ----------- ## - -# Some regular expressions. One reason to put them here is that it -# makes indentation work better in Emacs. - -# Writing singled-quoted-$-terminated regexes is a pain because -# perl-mode thinks of $' as the ${'} variable (instead of a $ followed -# by a closing quote. Letting perl-mode think the quote is not closed -# leads to all sort of misindentations. On the other hand, defining -# regexes as double-quoted strings is far less readable. So usually -# we will write: -# -# $REGEX = '^regex_value' . "\$"; - -my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n'; -my $WHITE_PATTERN = '^\s*' . "\$"; -my $COMMENT_PATTERN = '^#'; -my $TARGET_PATTERN='[$a-zA-Z0-9_.@%][-.a-zA-Z0-9_(){}/$+@%]*'; -# A rule has three parts: a list of targets, a list of dependencies, -# and optionally actions. -my $RULE_PATTERN = - "^($TARGET_PATTERN(?:(?:\\\\\n|\\s)+$TARGET_PATTERN)*) *:([^=].*|)\$"; - -# Only recognize leading spaces, not leading tabs. If we recognize -# leading tabs here then we need to make the reader smarter, because -# otherwise it will think rules like 'foo=bar; \' are errors. -my $ASSIGNMENT_PATTERN = '^ *([^ \t=:+]*)\s*([:+]?)=\s*(.*)' . "\$"; -# This pattern recognizes a Gnits version id and sets $1 if the -# release is an alpha release. We also allow a suffix which can be -# used to extend the version number with a "fork" identifier. -my $GNITS_VERSION_PATTERN = '\d+\.\d+([a-z]|\.\d+)?(-[A-Za-z0-9]+)?'; - -my $IF_PATTERN = '^if\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*)\s*(?:#.*)?' . "\$"; -my $ELSE_PATTERN = - '^else(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; -my $ENDIF_PATTERN = - '^endif(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; -my $PATH_PATTERN = '(\w|[+/.-])+'; -# This will pass through anything not of the prescribed form. -my $INCLUDE_PATTERN = ('^include\s+' - . '((\$\(top_srcdir\)/' . $PATH_PATTERN . ')' - . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')' - . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$"); - -# Directories installed during 'install-exec' phase. -my $EXEC_DIR_PATTERN = - '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$"; - -# Values for AC_CANONICAL_* -use constant AC_CANONICAL_BUILD => 1; -use constant AC_CANONICAL_HOST => 2; -use constant AC_CANONICAL_TARGET => 3; - -# Values indicating when something should be cleaned. -use constant MOSTLY_CLEAN => 0; -use constant CLEAN => 1; -use constant DIST_CLEAN => 2; -use constant MAINTAINER_CLEAN => 3; - -# Libtool files. -my @libtool_files = qw(ltmain.sh config.guess config.sub); -# ltconfig appears here for compatibility with old versions of libtool. -my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh); - -# Commonly found files we look for and automatically include in -# DISTFILES. -my @common_files = - (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB - COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO - ar-lib compile config.guess config.rpath - config.sub depcomp install-sh libversion.in mdate-sh - missing mkinstalldirs py-compile texinfo.tex ylwrap), - @libtool_files, @libtool_sometimes); - -# Commonly used files we auto-include, but only sometimes. This list -# is used for the --help output only. -my @common_sometimes = - qw(aclocal.m4 acconfig.h config.h.top config.h.bot configure - configure.ac configure.in stamp-vti); - -# Standard directories from the GNU Coding Standards, and additional -# pkg* directories from Automake. Stored in a hash for fast member check. -my %standard_prefix = - map { $_ => 1 } (qw(bin data dataroot doc dvi exec html include info - lib libexec lisp locale localstate man man1 man2 - man3 man4 man5 man6 man7 man8 man9 oldinclude pdf - pkgdata pkginclude pkglib pkglibexec ps sbin - sharedstate sysconf)); - -# Copyright on generated Makefile.ins. -my $gen_copyright = "\ -# Copyright (C) 1994-$RELEASE_YEAR 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 the lang_*_rewrite functions. -# LANG_SUBDIR means that the resulting object file should be in a -# subdir if the source file is. In this case the file name cannot -# have '..' components. -use constant LANG_IGNORE => 0; -use constant LANG_PROCESS => 1; -use constant LANG_SUBDIR => 2; - -# These are used when keeping track of whether an object can be built -# by two different paths. -use constant COMPILE_LIBTOOL => 1; -use constant COMPILE_ORDINARY => 2; - -# We can't always associate a location to a variable or a rule, -# when it's defined by Automake. We use INTERNAL in this case. -use constant INTERNAL => new Automake::Location; - -# Serialization keys for message queues. -use constant QUEUE_MESSAGE => "msg"; -use constant QUEUE_CONF_FILE => "conf file"; -use constant QUEUE_LOCATION => "location"; -use constant QUEUE_STRING => "string"; - -## ---------------------------------- ## -## Variables related to the options. ## -## ---------------------------------- ## - -# TRUE if we should always generate Makefile.in. -my $force_generation = 1; - -# From the Perl manual. -my $symlink_exists = (eval 'symlink ("", "");', $@ eq ''); - -# TRUE if missing standard files should be installed. -my $add_missing = 0; - -# TRUE if we should copy missing files; otherwise symlink if possible. -my $copy_missing = 0; - -# TRUE if we should always update files that we know about. -my $force_missing = 0; - - -## ---------------------------------------- ## -## Variables filled during files scanning. ## -## ---------------------------------------- ## - -# Name of the configure.ac file. -my $configure_ac; - -# Files found by scanning configure.ac for LIBOBJS. -my %libsources = (); - -# Names used in AC_CONFIG_HEADERS call. -my @config_headers = (); - -# Names used in AC_CONFIG_LINKS call. -my @config_links = (); - -# List of Makefile.am's to process, and their corresponding outputs. -my @input_files = (); -my %output_files = (); - -# Complete list of Makefile.am's that exist. -my @configure_input_files = (); - -# List of files in AC_CONFIG_FILES/AC_OUTPUT without Makefile.am's, -# and their outputs. -my @other_input_files = (); -# Where each AC_CONFIG_FILES/AC_OUTPUT/AC_CONFIG_LINK/AC_CONFIG_HEADERS -# appears. The keys are the files created by these macros. -my %ac_config_files_location = (); -# The condition under which AC_CONFIG_FOOS appears. -my %ac_config_files_condition = (); - -# 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 = ''; - -# Directory to search for AC_LIBSOURCE files, as set by AC_CONFIG_LIBOBJ_DIR -# in configure.ac. -my $config_libobj_dir = ''; - -# Whether AM_GNU_GETTEXT has been seen in configure.ac. -my $seen_gettext = 0; -# Whether AM_GNU_GETTEXT([external]) is used. -my $seen_gettext_external = 0; -# Where AM_GNU_GETTEXT appears. -my $ac_gettext_location; -# Whether AM_GNU_GETTEXT_INTL_SUBDIR has been seen. -my $seen_gettext_intl = 0; - -# The arguments of the AM_EXTRA_RECURSIVE_TARGETS call (if any). -my @extra_recursive_targets = (); - -# 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. -my $seen_canonical = 0; - -# 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 AM_PROG_AR -my $seen_ar = 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; - -# 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 = (); - -# Ignored configure substitutions (i.e., variables not to be output in -# Makefile.in) -my %ignored_configure_vars = (); - -# Files included by $configure_ac. -my @configure_deps = (); - -# Greatest timestamp of configure's dependencies. -my $configure_deps_greatest_timestamp = 0; - -# Hash table of AM_CONDITIONAL variables seen in configure. -my %configure_cond = (); - -# This maps extensions onto language names. -my %extension_map = (); - -# List of the DIST_COMMON files we discovered while reading -# configure.ac. -my $configure_dist_common = ''; - -# This maps languages names onto objects. -my %languages = (); -# Maps each linker variable onto a language object. -my %link_languages = (); - -# maps extensions to needed source flags. -my %sourceflags = (); - -# 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... - 'html-am' => 1, - 'dvi-am' => 1, - 'pdf-am' => 1, - 'ps-am' => 1, - 'info-am' => 1, - 'install-data-am' => 1, - 'install-exec-am' => 1, - 'install-html-am' => 1, - 'install-dvi-am' => 1, - 'install-pdf-am' => 1, - 'install-ps-am' => 1, - 'install-info-am' => 1, - 'installcheck-am' => 1, - 'uninstall-am' => 1, - 'tags-am' => 1, - 'ctags-am' => 1, - 'cscopelist-am' => 1, - 'install-man' => 1, - ); - -# Queue to push require_conf_file requirements to. -my $required_conf_file_queue; - -# The name of the Makefile currently being processed. -my $am_file = 'BUG'; - -################################################################ - -## ------------------------------------------ ## -## Variables reset by &initialize_per_input. ## -## ------------------------------------------ ## - -# Relative dir of the output makefile. -my $relative_dir; - -# Greatest timestamp of the output's dependencies (excluding -# configure's dependencies). -my $output_deps_greatest_timestamp; - -# These variables are used when generating each Makefile.in. -# They hold the Makefile.in until it is ready to be printed. -my $output_vars; -my $output_all; -my $output_header; -my $output_rules; -my $output_trailer; - -# This is the conditional stack, updated on if/else/endif, and -# used to build Condition objects. -my @cond_stack; - -# This holds the set of included files. -my @include_stack; - -# List of dependencies for the obvious targets. -my @all; -my @check; -my @check_tests; - -# Keys in this hash table are files to delete. The associated -# value tells when this should happen (MOSTLY_CLEAN, DIST_CLEAN, etc.) -my %clean_files; - -# Keys in this hash table are object files or other files in -# subdirectories which need to be removed. This only holds files -# which are created by compilations. The value in the hash indicates -# when the file should be removed. -my %compile_clean_files; - -# Keys in this hash table are directories where we expect to build a -# libtool object. We use this information to decide what directories -# to delete. -my %libtool_clean_directories; - -# Value of $(SOURCES), used by tags.am. -my @sources; -# Sources which go in the distribution. -my @dist_sources; - -# This hash maps object file names onto their corresponding source -# file names. This is used to ensure that each object is created -# by a single source file. -my %object_map; - -# This hash maps object file names onto an integer value representing -# whether this object has been built via ordinary compilation or -# libtool compilation (the COMPILE_* constants). -my %object_compilation_map; - - -# This keeps track of the directories for which we've already -# created dirstamp code. Keys are directories, values are stamp files. -# Several keys can share the same stamp files if they are equivalent -# (as are './/foo' and 'foo'). -my %directory_map; - -# All .P files. -my %dep_files; - -# 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). @substitutions@ are not listed. -my %known_programs; -my %known_libraries; - -# 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; - -# Does the generated Makefile have to build some compiled object -# (for binary programs, or plain or libtool libraries)? -my $must_handle_compiled_objects; - -# Record each file processed by make_paragraphs. -my %transformed_files; - -################################################################ - -## ---------------------------------------------- ## -## Variables not reset by &initialize_per_input. ## -## ---------------------------------------------- ## - -# 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; - -################################################################ - -# 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); - -################################################################ - - -# initialize_per_input () -# ----------------------- -# (Re)-Initialize per-Makefile.am variables. -sub initialize_per_input () -{ - reset_local_duplicates (); - - $relative_dir = undef; - - $output_deps_greatest_timestamp = 0; - - $output_vars = ''; - $output_all = ''; - $output_header = ''; - $output_rules = ''; - $output_trailer = ''; - - Automake::Options::reset; - Automake::Variable::reset; - Automake::Rule::reset; - - @cond_stack = (); - - @include_stack = (); - - @all = (); - @check = (); - @check_tests = (); - - %clean_files = (); - %compile_clean_files = (); - - # We always include '.'. This isn't strictly correct. - %libtool_clean_directories = ('.' => 1); - - @sources = (); - @dist_sources = (); - - %object_map = (); - %object_compilation_map = (); - - %directory_map = (); - - %dep_files = (); - - @dist_targets = (); - - %known_programs = (); - %known_libraries= (); - - %extension_seen = (); - - %language_scratch = (); - - %lang_specific_files = (); - - $handle_dist_run = 0; - - $need_link = 0; - - $must_handle_compiled_objects = 0; - - %transformed_files = (); -} - - -################################################################ - -# Initialize our list of languages that are internally supported. - -my @cpplike_flags = - qw{ - $(DEFS) - $(DEFAULT_INCLUDES) - $(INCLUDES) - $(AM_CPPFLAGS) - $(CPPFLAGS) - }; - -# C. -register_language ('name' => 'c', - 'Name' => 'C', - 'config_vars' => ['CC'], - 'autodep' => '', - 'flags' => ['CFLAGS', 'CPPFLAGS'], - 'ccer' => 'CC', - 'compiler' => 'COMPILE', - 'compile' => "\$(CC) @cpplike_flags \$(AM_CFLAGS) \$(CFLAGS)", - 'lder' => 'CCLD', - 'ld' => '$(CC)', - 'linker' => 'LINK', - 'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'CC', - 'extensions' => ['.c']); - -# 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) @cpplike_flags \$(AM_CXXFLAGS) \$(CXXFLAGS)", - 'ccer' => 'CXX', - 'compiler' => 'CXXCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'CXX', - 'lder' => 'CXXLD', - 'ld' => '$(CXX)', - 'pure' => 1, - 'extensions' => ['.c++', '.cc', '.cpp', '.cxx', '.C']); - -# Objective C. -register_language ('name' => 'objc', - 'Name' => 'Objective C', - 'config_vars' => ['OBJC'], - 'linker' => 'OBJCLINK', - 'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'OBJC', - 'flags' => ['OBJCFLAGS', 'CPPFLAGS'], - 'compile' => "\$(OBJC) @cpplike_flags \$(AM_OBJCFLAGS) \$(OBJCFLAGS)", - 'ccer' => 'OBJC', - 'compiler' => 'OBJCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'OBJCLD', - 'ld' => '$(OBJC)', - 'pure' => 1, - 'extensions' => ['.m']); - -# Objective C++. -register_language ('name' => 'objcxx', - 'Name' => 'Objective C++', - 'config_vars' => ['OBJCXX'], - 'linker' => 'OBJCXXLINK', - 'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'OBJCXX', - 'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'], - 'compile' => "\$(OBJCXX) @cpplike_flags \$(AM_OBJCXXFLAGS) \$(OBJCXXFLAGS)", - 'ccer' => 'OBJCXX', - 'compiler' => 'OBJCXXCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'OBJCXXLD', - 'ld' => '$(OBJCXX)', - 'pure' => 1, - 'extensions' => ['.mm']); - -# 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) @cpplike_flags \$(AM_UPCFLAGS) \$(UPCFLAGS)", - 'ccer' => 'UPC', - 'compiler' => 'UPCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'UPCLD', - 'ld' => '$(UPC)', - 'pure' => 1, - 'extensions' => ['.upc']); - -# 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 { }); - -# Vala -register_language ('name' => 'vala', - 'Name' => 'Vala', - 'config_vars' => ['VALAC'], - 'flags' => [], - 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)', - 'ccer' => 'VALAC', - 'compiler' => 'VALACOMPILE', - 'extensions' => ['.vala'], - 'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/; - return ($ext,) }, - 'rule_file' => 'vala', - '_finish' => \&lang_vala_finish, - '_target_hook' => \&lang_vala_target_hook, - 'nodist_specific' => 1); - -# Yacc (C & C++). -register_language ('name' => 'yacc', - 'Name' => 'Yacc', - 'config_vars' => ['YACC'], - 'flags' => ['YFLAGS'], - 'compile' => '$(YACC) $(AM_YFLAGS) $(YFLAGS)', - 'ccer' => 'YACC', - '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, - 'nodist_specific' => 1); -register_language ('name' => 'yaccxx', - 'Name' => 'Yacc (C++)', - 'config_vars' => ['YACC'], - 'rule_file' => 'yacc', - 'flags' => ['YFLAGS'], - 'ccer' => 'YACC', - 'compiler' => 'YACCCOMPILE', - 'compile' => '$(YACC) $(AM_YFLAGS) $(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, - 'nodist_specific' => 1); - -# Lex (C & C++). -register_language ('name' => 'lex', - 'Name' => 'Lex', - 'config_vars' => ['LEX'], - 'rule_file' => 'lex', - 'flags' => ['LFLAGS'], - 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)', - 'ccer' => 'LEX', - '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, - 'nodist_specific' => 1); -register_language ('name' => 'lexxx', - 'Name' => 'Lex (C++)', - 'config_vars' => ['LEX'], - 'rule_file' => 'lex', - 'flags' => ['LFLAGS'], - 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)', - 'ccer' => 'LEX', - '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, - 'nodist_specific' => 1); - -# Assembler. -register_language ('name' => 'asm', - 'Name' => 'Assembler', - '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. - 'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)', - 'ccer' => 'CCAS', - 'compiler' => 'CCASCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'extensions' => ['.s']); - -# Preprocessed Assembler. -register_language ('name' => 'cppasm', - 'Name' => 'Preprocessed Assembler', - 'config_vars' => ['CCAS', 'CCASFLAGS'], - - 'autodep' => 'CCAS', - 'flags' => ['CCASFLAGS', 'CPPFLAGS'], - 'compile' => "\$(CCAS) @cpplike_flags \$(AM_CCASFLAGS) \$(CCASFLAGS)", - 'ccer' => 'CPPAS', - 'compiler' => 'CPPASCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'extensions' => ['.S', '.sx']); - -# 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'], - 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)', - 'ccer' => '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)', - 'ccer' => 'FC', - 'compiler' => 'FCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'FC', - 'lder' => 'FCLD', - 'ld' => '$(FC)', - 'pure' => 1, - 'extensions' => ['.f90', '.f95', '.f03', '.f08']); - -# 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'], - 'ccer' => 'PPFC', - 'compiler' => 'PPFCCOMPILE', - 'compile' => "\$(FC) @cpplike_flags \$(AM_FCFLAGS) \$(FCFLAGS)", - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'FC', - 'pure' => 1, - 'extensions' => ['.F90','.F95', '.F03', '.F08']); - -# 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'], - 'ccer' => 'PPF77', - 'compiler' => 'PPF77COMPILE', - 'compile' => "\$(F77) @cpplike_flags \$(AM_FFLAGS) \$(FFLAGS)", - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'F77', - 'pure' => 1, - 'extensions' => ['.F']); - -# Ratfor. -register_language ('name' => 'ratfor', - 'Name' => 'Ratfor', - 'config_vars' => ['F77'], - 'linker' => 'F77LINK', - 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'lder' => 'F77LD', - 'ld' => '$(F77)', - 'flags' => ['RFLAGS', 'FFLAGS'], - # FIXME also FFLAGS. - 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)', - 'ccer' => 'F77', - 'compiler' => 'RCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'F77', - 'pure' => 1, - 'extensions' => ['.r']); - -# Java via gcj. -register_language ('name' => 'java', - 'Name' => 'Java', - 'config_vars' => ['GCJ'], - 'linker' => 'GCJLINK', - 'link' => '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'GCJ', - 'flags' => ['GCJFLAGS'], - 'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)', - 'ccer' => 'GCJ', - 'compiler' => 'GCJCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'GCJ', - 'lder' => 'GCJLD', - 'ld' => '$(GCJ)', - 'pure' => 1, - 'extensions' => ['.java', '.class', '.zip', '.jar']); - -################################################################ - -# Error reporting functions. - -# err_am ($MESSAGE, [%OPTIONS]) -# ----------------------------- -# Uncategorized errors about the current Makefile.am. -sub err_am -{ - msg_am ('error', @_); -} - -# err_ac ($MESSAGE, [%OPTIONS]) -# ----------------------------- -# Uncategorized errors about configure.ac. -sub err_ac -{ - msg_ac ('error', @_); -} - -# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS]) -# --------------------------------------- -# Messages about about the current Makefile.am. -sub msg_am -{ - my ($channel, $msg, %opts) = @_; - msg $channel, "${am_file}.am", $msg, %opts; -} - -# msg_ac ($CHANNEL, $MESSAGE, [%OPTIONS]) -# --------------------------------------- -# Messages about about configure.ac. -sub msg_ac -{ - my ($channel, $msg, %opts) = @_; - msg $channel, $configure_ac, $msg, %opts; -} - -################################################################ - -# subst ($TEXT) -# ------------- -# Return a configure-style substitution using the indicated text. -# We do this to avoid having the substitutions directly in automake.in; -# when we do that they are sometimes removed and this causes confusion -# and bugs. -sub subst -{ - my ($text) = @_; - return '@' . $text . '@'; -} - -################################################################ - - -# $BACKPATH -# backname ($RELDIR) -# ------------------- -# If I "cd $RELDIR", 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 - or prog_error ("trying to reverse path '$file' pointing outside tree"); - } - else - { - push (@res, '..'); - } - } - return join ('/', @res) || '.'; -} - -################################################################ - -# Silent rules handling functions. - -# verbose_var (NAME) -# ------------------ -# The public variable stem used to implement silent rules. -sub verbose_var -{ - my ($name) = @_; - return 'AM_V_' . $name; -} - -# verbose_private_var (NAME) -# -------------------------- -# The naming policy for the private variables for silent rules. -sub verbose_private_var -{ - my ($name) = @_; - return 'am__v_' . $name; -} - -# define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE]) -# ---------------------------------------------------------- -# For silent rules, setup VAR and dispatcher, to expand to -# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to -# empty) if not. -sub define_verbose_var -{ - my ($name, $silent_val, $verbose_val) = @_; - $verbose_val = '' unless defined $verbose_val; - my $var = verbose_var ($name); - my $pvar = verbose_private_var ($name); - my $silent_var = $pvar . '_0'; - my $verbose_var = $pvar . '_1'; - # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V) - # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY). - # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead. - # See AM_SILENT_RULES in m4/silent.m4. - define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL); - define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', - INTERNAL); - Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, - $silent_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($silent_var, TRUE)); - Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE, - $verbose_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($verbose_var, TRUE)); -} - -# verbose_flag (NAME) -# ------------------- -# Contents of '%VERBOSE%' variable to expand before rule command. -sub verbose_flag -{ - my ($name) = @_; - return '$(' . verbose_var ($name) . ')'; -} - -sub verbose_nodep_flag -{ - my ($name) = @_; - return '$(' . verbose_var ($name) . subst ('am__nodep') . ')'; -} - -# silent_flag -# ----------- -# Contents of %SILENT%: variable to expand to '@' when silent. -sub silent_flag () -{ - return verbose_flag ('at'); -} - -# define_verbose_tagvar (NAME) -# ---------------------------- -# Engage the needed silent rules machinery for tag NAME. -sub define_verbose_tagvar -{ - my ($name) = @_; - define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;'); -} - -# Engage the needed silent rules machinery for assorted texinfo commands. -sub define_verbose_texinfo () -{ - my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF'); - foreach my $tag (@tagvars) - { - define_verbose_tagvar($tag); - } - define_verbose_var('texinfo', '-q'); - define_verbose_var('texidevnull', '> /dev/null'); -} - -# Engage the needed silent rules machinery for 'libtool --silent'. -sub define_verbose_libtool () -{ - define_verbose_var ('lt', '--silent'); - return verbose_flag ('lt'); -} - -sub handle_silent () -{ - # Define "$(AM_V_P)", expanding to a shell conditional that can be - # used in make recipes to determine whether we are being run in - # silent mode or not. The choice of the name derives from the LISP - # convention of appending the letter 'P' to denote a predicate (see - # also "the '-P' convention" in the Jargon File); we do so for lack - # of a better convention. - define_verbose_var ('P', 'false', ':'); - # *Always* provide the user with '$(AM_V_GEN)', unconditionally. - define_verbose_tagvar ('GEN'); - define_verbose_var ('at', '@'); -} - - -################################################################ - - -# Handle AUTOMAKE_OPTIONS variable. Return 0 on error, 1 otherwise. -sub handle_options () -{ - my $var = var ('AUTOMAKE_OPTIONS'); - if ($var) - { - if ($var->has_conditional_contents) - { - msg_var ('unsupported', $var, - "'AUTOMAKE_OPTIONS' cannot have conditional contents"); - } - my @options = map { { option => $_->[1], where => $_->[0] } } - $var->value_as_list_recursive (cond_filter => TRUE, - location => 1); - return 0 unless process_option_list (@options); - } - - if ($strictness == GNITS) - { - set_option ('readme-alpha', INTERNAL); - set_option ('std-options', INTERNAL); - set_option ('check-news', INTERNAL); - } - - return 1; -} - -# 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 an am__VAR_DIST variable which contains -# all possible values, and return $(am__VAR_DIST). -sub shadow_unconditionally -{ - my ($varname, $where) = @_; - my $var = var $varname; - if ($var->has_conditional_contents) - { - $varname = "am__${varname}_DIST"; - my @files = uniq ($var->value_as_list_recursive); - define_pretty_variable ($varname, TRUE, $where, @files); - } - return "\$($varname)" -} - -# 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) - { - 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"); - } - } - } - } -} - -# Call finish function for each language that was used. -sub handle_languages () -{ - if (! option 'no-dependencies') - { - # Include auto-dep code. Don't include it if DEP_FILES would - # be empty. - if (keys %extension_seen && keys %dep_files) - { - # Set location of depcomp. - define_variable ('depcomp', - "\$(SHELL) $am_config_aux_dir/depcomp", - INTERNAL); - define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL); - - require_conf_file ("$am_file.am", FOREIGN, 'depcomp'); - - my @deplist = sort keys %dep_files; - # Generate each 'include' individually. Irix 6 make will - # not properly include several files resulting from a - # variable expansion; generating many separate includes - # seems safest. - $output_rules .= "\n"; - foreach my $iter (@deplist) - { - $output_rules .= (subst ('AMDEP_TRUE') - . subst ('am__include') - . ' ' - . subst ('am__quote') - . $iter - . subst ('am__quote') - . "\n"); - } - - # Compute the set of directories to remove in distclean-depend. - my @depdirs = uniq (map { dirname ($_) } @deplist); - $output_rules .= file_contents ('depend', - new Automake::Location, - DEPDIRS => "@depdirs"); - } - } - else - { - define_variable ('depcomp', '', INTERNAL); - define_variable ('am__depfiles_maybe', '', INTERNAL); - } - - my %done; - - # Is the C linker needed? - my $needs_c = 0; - foreach my $ext (sort keys %extension_seen) - { - next unless $extension_map{$ext}; - - my $lang = $languages{$extension_map{$ext}}; - - my $rule_file = $lang->rule_file || 'depend2'; - - # Get information on $LANG. - my $pfx = $lang->autodep; - my $fpfx = ($pfx eq '') ? 'CC' : $pfx; - - my ($AMDEP, $FASTDEP) = - (option 'no-dependencies' || $lang->autodep eq 'no') - ? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx"); - - my $verbose = verbose_flag ($lang->ccer || 'GEN'); - my $verbose_nodep = ($AMDEP eq 'FALSE') - ? $verbose : verbose_nodep_flag ($lang->ccer || 'GEN'); - my $silent = silent_flag (); - - my %transform = ('EXT' => $ext, - 'PFX' => $pfx, - 'FPFX' => $fpfx, - '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, - VERBOSE => $verbose, - 'VERBOSE-NODEP' => $verbose_nodep, - SILENT => $silent, - ); - - # Generate the appropriate rules for this extension. - if (((! option 'no-dependencies') && $lang->autodep ne 'no') - || defined $lang->compile) - { - # 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, - - 'DERIVED-EXT' => $der_ext, - - DEPBASE => $depbase, - BASE => '$*', - SOURCE => '$<', - SOURCEFLAG => $sourceflags{$ext} || '', - OBJ => '$@', - OBJOBJ => '$@', - LTOBJ => '$@', - - COMPILE => '$(' . $lang->compiler . ')', - LTCOMPILE => '$(LT' . $lang->compiler . ')', - -o => $lang->output_flag, - SUBDIROBJ => !! option 'subdir-objects'); - } - - # Now include code for each specially handled object with this - # language. - my %seen_files = (); - foreach my $file (@{$lang_specific_files{$lang->name}}) - { - my ($derived, $source, $obj, $myext, $srcext, %file_transform) = @$file; - - # We might see a given object twice, for instance if it is - # used under different conditions. - next if defined $seen_files{$obj}; - $seen_files{$obj} = 1; - - prog_error ("found " . $lang->name . - " in handle_languages, but compiler not defined") - unless defined $lang->compile; - - my $obj_compile = $lang->compile; - - # Rewrite each occurrence of 'AM_$flag' in the compile - # rule into '${derived}_$flag' if it exists. - for my $flag (@{$lang->flags}) - { - my $val = "${derived}_$flag"; - $obj_compile =~ s/\(AM_$flag\)/\($val\)/ - if set_seen ($val); - } - - my $libtool_tag = ''; - if ($lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}) - { - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - } - - my $ptltflags = "${derived}_LIBTOOLFLAGS"; - $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags; - - my $ltverbose = define_verbose_libtool (); - my $obj_ltcompile = - "\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) " - . "--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); - - $output_rules .= - file_contents ($rule_file, - new Automake::Location, - %transform, - GENERIC => 0, - - DEPBASE => $depbase, - BASE => $obj, - SOURCE => $source, - SOURCEFLAG => $sourceflags{$srcext} || '', - # 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", - - VERBOSE => $verbose, - 'VERBOSE-NODEP' => $verbose_nodep, - SILENT => $silent, - COMPILE => $obj_compile, - LTCOMPILE => $obj_ltcompile, - -o => $output_flag, - %file_transform); - } - - # The rest of the loop is done once per language. - next if defined $done{$lang}; - $done{$lang} = 1; - - # Load the language dependent Makefile chunks. - my %lang = map { uc ($_) => 0 } keys %languages; - $lang{uc ($lang->name)} = 1; - $output_rules .= file_contents ('lang-compile', - new Automake::Location, - %transform, %lang); - - # If the source to a program consists entirely of code from a - # 'pure' language, for instance C++ or Fortran 77, then we - # don't need the C compiler code. However if we run into - # something unusual then we do generate the C code. There are - # probably corner cases here that do not work properly. - # People linking Java code to Fortran code deserve pain. - $needs_c ||= ! $lang->pure; - - define_compiler_variable ($lang) - if ($lang->compile); - - define_linker_variable ($lang) - if ($lang->link); - - require_variables ("$am_file.am", $lang->Name . " source seen", - TRUE, @{$lang->config_vars}); - - # Call the finisher. - $lang->finish; - - # Flags listed in '->flags' are user variables (per GNU Standards), - # they should not be overridden in the Makefile... - my @dont_override = @{$lang->flags}; - # ... and so is LDFLAGS. - push @dont_override, 'LDFLAGS' if $lang->link; - - check_user_variables @dont_override; - } - - # 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. - my @languages_seen = map { $languages{$extension_map{$_}}->name } - (keys %extension_seen); - @languages_seen = uniq (@languages_seen); - $needs_c = 1 if @languages_seen > 1; - if ($need_link || $needs_c) - { - define_compiler_variable ($languages{'c'}) - unless defined $done{$languages{'c'}}; - define_linker_variable ($languages{'c'}); - } -} - - -# 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 -# do this check. -sub check_libobjs_sources -{ - my ($one_file, $unxformed) = @_; - - foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', - 'dist_EXTRA_', 'nodist_EXTRA_') - { - my @files; - my $varname = $prefix . $one_file . '_SOURCES'; - my $var = var ($varname); - if ($var) - { - @files = $var->value_as_list_recursive; - } - elsif ($prefix eq '') - { - @files = ($unxformed . '.c'); - } - else - { - next; - } - - foreach my $file (@files) - { - err_var ($prefix . $one_file . '_SOURCES', - "automatically discovered file '$file' should not" . - " be explicitly mentioned") - if defined $libsources{$file}; - } - } -} - - -# @OBJECTS -# handle_single_transform ($VAR, $TOPPARENT, $DERIVED, $OBJ, $FILE, %TRANSFORM) -# ----------------------------------------------------------------------------- -# Does much of the actual work for handle_source_transform. -# Arguments are: -# $VAR is the name of the variable that the source filenames come from -# $TOPPARENT is the name of the _SOURCES variable which is being processed -# $DERIVED is the name of resulting executable or library -# $OBJ is the object extension (e.g., '.lo') -# $FILE the source file to transform -# %TRANSFORM contains extras arguments to pass to file_contents -# when producing explicit rules -# Result is a list of the names of objects -# %linkers_used will be updated with any linkers needed -sub handle_single_transform -{ - my ($var, $topparent, $derived, $obj, $_file, %transform) = @_; - my @files = ($_file); - my @result = (); - - # Turn sources into objects. We use a while loop like this - # because we might add to @files in the loop. - while (scalar @files > 0) - { - $_ = shift @files; - - # Configure substitutions in _SOURCES variables are errors. - if (/^\@.*\@$/) - { - my $parent_msg = ''; - $parent_msg = "\nand is referred to from '$topparent'" - if $topparent ne $var->name; - err_var ($var, - "'" . $var->name . "' includes configure substitution '$_'" - . $parent_msg . ";\nconfigure " . - "substitutions are not allowed in _SOURCES variables"); - next; - } - - # If the source file is in a subdirectory then the '.o' is put - # into the current directory, unless the subdir-objects option - # is in effect. - - # Split file name into base and extension. - next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/; - my $full = $_; - my $directory = $1 || ''; - my $base = $2; - my $extension = $3; - - # We must generate a rule for the object if it requires its own flags. - my $renamed = 0; - my ($linker, $object); - - # This records whether we've seen a derived source file (e.g. - # yacc output). - my $derived_source = 0; - - # This holds the 'aggregate context' of the file we are - # currently examining. If the file is compiled with - # per-object flags, then it will be the name of the object. - # Otherwise it will be 'AM'. This is used by the target hook - # language function. - my $aggregate = 'AM'; - - $extension = derive_suffix ($extension, $obj); - my $lang; - if ($extension_map{$extension} && - ($lang = $languages{$extension_map{$extension}})) - { - # 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 $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 - # 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'}; - defined &$subr or $subr = \&lang_sub_obj; - my ($r, $source_extension) - = &$subr ($directory, $base, $extension, - $obj, $have_per_exec_flags, $var); - # 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; - } - else - { - $this_obj_ext = $obj; - } - $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 - # name that is too long for losing systems, in - # some situations. So we provide _SHORTNAME to - # override. - - my $dname = $derived; - my $var = var ($derived . '_SHORTNAME'); - if ($var) - { - # FIXME: should use the same Condition as - # the _SOURCES variable. But this is really - # silly overkill -- nobody should have - # conditional shortnames. - $dname = $var->variable_value; - } - $object = $dname . '-' . $object; - - 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 ($directory ne '') - { - if ($r == LANG_SUBDIR) - { - $object = $directory . '/' . $object; - } - else - { - # Since the next major version of automake (2.0) will - # make the behaviour so far only activated with the - # 'subdir-object' option mandatory, it's better if we - # start warning users not using that option. - # As suggested by Peter Johansson, we strive to avoid - # the warning when it would be irrelevant, i.e., if - # all source files sit in "current" directory. - msg_var 'unsupported', $var, - "source file '$full' is in a subdirectory," - . "\nbut option 'subdir-objects' is disabled"; - msg 'unsupported', INTERNAL, <<'EOF', uniq_scope => US_GLOBAL; -possible forward-incompatibility. -At least a source file is in a subdirectory, but the 'subdir-objects' -automake option hasn't been enabled. For now, the corresponding output -object file(s) will be placed in the top-level directory. However, -this behaviour will change in future Automake versions: they will -unconditionally cause object files to be placed in the same subdirectory -of the corresponding sources. -You are advised to start using 'subdir-objects' option throughout your -project, to avoid future incompatibilities. -EOF - } - } - - # 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'})) - { - my $obj_sans_ext = substr ($object, 0, - - length ($this_obj_ext)); - my $full_ansi; - if ($directory ne '') - { - $full_ansi = $directory . '/' . $base . $extension; - } - else - { - $full_ansi = $base . $extension; - } - - 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'), - $extension); - - # If we renamed the object then we want to use the - # per-executable flag name. But if this is simply a - # subdir build then we still want to use the AM_ flag - # name. - if ($renamed) - { - unshift @specifics, $derived; - $aggregate = $derived; - } - else - { - unshift @specifics, 'AM'; - } - - # Each item on this list is a reference to a list consisting - # of four values followed by additional transform flags for - # file_contents. The four values are the derived flag prefix - # (e.g. for 'foo_CFLAGS', it is 'foo'), the name of the - # source file, the base name of the output file, and - # the extension for the object file. - push (@{$lang_specific_files{$lang->name}}, - [@specifics, %transform]); - } - } - elsif ($extension eq $obj) - { - # 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 - { - # No error message here. Used to have one, but it was - # very unpopular. - # FIXME: we could potentially do more processing here, - # perhaps treating the new extension as though it were a - # new source extension (as above). This would require - # more restructuring than is appropriate right now. - next; - } - - err_am "object '$object' created by '$full' and '$object_map{$object}'" - if (defined $object_map{$object} - && $object_map{$object} ne $full); - - my $comp_val = (($object =~ /\.lo$/) - ? COMPILE_LIBTOOL : COMPILE_ORDINARY); - (my $comp_obj = $object) =~ s/\.lo$/.\$(OBJEXT)/; - if (defined $object_compilation_map{$comp_obj} - && $object_compilation_map{$comp_obj} != 0 - # Only see the error once. - && ($object_compilation_map{$comp_obj} - != (COMPILE_LIBTOOL | COMPILE_ORDINARY)) - && $object_compilation_map{$comp_obj} != $comp_val) - { - err_am "object '$comp_obj' created both with libtool and without"; - } - $object_compilation_map{$comp_obj} |= $comp_val; - - if (defined $lang) - { - # Let the language do some special magic if required. - $lang->target_hook ($aggregate, $object, $full, %transform); - } - - if ($derived_source) - { - prog_error ($lang->name . " has automatic dependency tracking") - if $lang->autodep ne 'no'; - # Make sure this new source file is handled next. That will - # make it appear to be at the right place in the list. - unshift (@files, $object); - # Distribute derived sources unless the source they are - # derived from is not. - push_dist_common ($object) - unless ($topparent =~ /^(?:nobase_)?nodist_/); - next; - } - - $linkers_used{$linker} = 1; - - push (@result, $object); - - if (! defined $object_map{$object}) - { - my @dep_list = (); - $object_map{$object} = $full; - - # If resulting object is in subdir, we need to make - # sure the subdir exists at build time. - if ($object =~ /\//) - { - # FIXME: check that $DIRECTORY is somewhere in the - # project - - # For Java, the way we're handling it right now, a - # '..' component doesn't make sense. - if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//) - { - err_am "'$full' should not contain a '..' component"; - } - - # Make sure *all* objects files in the subdirectory are - # removed by "make mostlyclean". Not only this is more - # efficient than listing the object files to be removed - # individually (which would cause an 'rm' invocation for - # each of them -- very inefficient, see bug#10697), it - # would also leave stale object files in the subdirectory - # whenever a source file there is removed or renamed. - $compile_clean_files{"$directory/*.\$(OBJEXT)"} = MOSTLY_CLEAN; - if ($object =~ /\.lo$/) - { - # If we have a libtool object, then we also must remove - # any '.lo' objects in its same subdirectory. - $compile_clean_files{"$directory/*.lo"} = MOSTLY_CLEAN; - # Remember to cleanup .libs/ in this directory. - $libtool_clean_directories{$directory} = 1; - } - - push (@dep_list, require_build_directory ($directory)); - - # If we're generating dependencies, we also want - # to make sure that the appropriate subdir of the - # .deps directory is created. - push (@dep_list, - require_build_directory ($directory . '/$(DEPDIR)')) - unless option 'no-dependencies'; - } - - pretty_print_rule ($object . ':', "\t", @dep_list) - if scalar @dep_list > 0; - } - - # Transform .o or $o file into .P file (for automatic - # dependency code). - # Properly flatten multiple adjacent slashes, as Solaris 10 make - # might fail over them in an include statement. - # Leading double slashes may be special, as per Posix, so deal - # with them carefully. - if ($lang && $lang->autodep ne 'no') - { - my $depfile = $object; - $depfile =~ s/\.([^.]*)$/.P$1/; - $depfile =~ s/\$\(OBJEXT\)$/o/; - my $maybe_extra_leading_slash = ''; - $maybe_extra_leading_slash = '/' if $depfile =~ m,^//[^/],; - $depfile =~ s,/+,/,g; - my $basename = basename ($depfile); - # This might make $dirname empty, but we account for that below. - (my $dirname = dirname ($depfile)) =~ s/\/*$//; - $dirname = $maybe_extra_leading_slash . $dirname; - $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1; - } - } - - return @result; -} - - -# $LINKER -# define_objects_from_sources ($VAR, $OBJVAR, $NODEFINE, $ONE_FILE, -# $OBJ, $PARENT, $TOPPARENT, $WHERE, %TRANSFORM) -# --------------------------------------------------------------------------- -# Define an _OBJECTS variable for a _SOURCES variable (or subvariable) -# -# Arguments are: -# $VAR is the name of the _SOURCES variable -# $OBJVAR is the name of the _OBJECTS variable if known (otherwise -# it will be generated and returned). -# $NODEFINE is a boolean: if true, $OBJVAR will not be defined (but -# work done to determine the linker will be). -# $ONE_FILE is the canonical (transformed) name of object to build -# $OBJ is the object extension (i.e. either '.o' or '.lo'). -# $TOPPARENT is the _SOURCES variable being processed. -# $WHERE context into which this definition is done -# %TRANSFORM extra arguments to pass to file_contents when producing -# rules -# -# Result is a pair ($LINKER, $OBJVAR): -# $LINKER is a boolean, true if a linker is needed to deal with the objects -sub define_objects_from_sources -{ - my ($var, $objvar, $nodefine, $one_file, - $obj, $topparent, $where, %transform) = @_; - - my $needlinker = ""; - - transform_variable_recursively - ($var, $objvar, 'am__objects', $nodefine, $where, - # The transform code to run on each filename. - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - my @trans = handle_single_transform ($subvar, $topparent, - $one_file, $obj, $val, - %transform); - $needlinker = "true" if @trans; - return @trans; - }); - - return $needlinker; -} - - -# handle_source_transform ($CANON_TARGET, $TARGET, $OBJEXT, $WHERE, %TRANSFORM) -# ----------------------------------------------------------------------------- -# Handle SOURCE->OBJECT transform for one program or library. -# Arguments are: -# canonical (transformed) name of target to build -# actual target of object to build -# object extension (i.e., either '.o' or '$o') -# location of the source variable -# extra arguments to pass to file_contents when producing rules -# Return the name of the linker variable that must be used. -# Empty return means just use 'LINK'. -sub handle_source_transform -{ - # one_file is canonical name. unxformed is given name. obj is - # object extension. - my ($one_file, $unxformed, $obj, $where, %transform) = @_; - - my $linker = ''; - - # No point in continuing if _OBJECTS is defined. - return if reject_var ($one_file . '_OBJECTS', - $one_file . '_OBJECTS should not be defined'); - - my %used_pfx = (); - my $needlinker; - %linkers_used = (); - foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', - 'dist_EXTRA_', 'nodist_EXTRA_') - { - my $varname = $prefix . $one_file . "_SOURCES"; - my $var = var $varname; - next unless $var; - - # We are going to define _OBJECTS variables using the prefix. - # Then we glom them all together. So we can't use the null - # prefix here as we need it later. - my $xpfx = ($prefix eq '') ? 'am_' : $prefix; - - # Keep track of which prefixes we saw. - $used_pfx{$xpfx} = 1 - unless $prefix =~ /EXTRA_/; - - push @sources, "\$($varname)"; - push @dist_sources, shadow_unconditionally ($varname, $where) - unless (option ('no-dist') || $prefix =~ /^nodist_/); - - $needlinker |= - define_objects_from_sources ($varname, - $xpfx . $one_file . '_OBJECTS', - !!($prefix =~ /EXTRA_/), - $one_file, $obj, $varname, $where, - DIST_SOURCE => ($prefix !~ /^nodist_/), - %transform); - } - if ($needlinker) - { - $linker ||= resolve_linker (%linkers_used); - } - - my @keys = sort keys %used_pfx; - if (scalar @keys == 0) - { - # The default source for libfoo.la is libfoo.c, but for - # backward compatibility we first look at libfoo_la.c, - # if no default source suffix is given. - my $old_default_source = "$one_file.c"; - my $ext_var = var ('AM_DEFAULT_SOURCE_EXT'); - my $default_source_ext = $ext_var ? variable_value ($ext_var) : '.c'; - msg_var ('unsupported', $ext_var, $ext_var->name . " can assume at most one value") - if $default_source_ext =~ /[\t ]/; - (my $default_source = $unxformed) =~ s,(\.[^./\\]*)?$,$default_source_ext,; - # TODO: Remove this backward-compatibility hack in Automake 2.0. - if ($old_default_source ne $default_source - && !$ext_var - && (rule $old_default_source - || rule '$(srcdir)/' . $old_default_source - || rule '${srcdir}/' . $old_default_source - || -f $old_default_source)) - { - my $loc = $where->clone; - $loc->pop_context; - msg ('obsolete', $loc, - "the default source for '$unxformed' has been changed " - . "to '$default_source'.\n(Using '$old_default_source' for " - . "backward compatibility.)"); - $default_source = $old_default_source; - } - # If a rule exists to build this source with a $(srcdir) - # prefix, use that prefix in our variables too. This is for - # the sake of BSD Make. - if (rule '$(srcdir)/' . $default_source - || rule '${srcdir}/' . $default_source) - { - $default_source = '$(srcdir)/' . $default_source; - } - - define_variable ($one_file . "_SOURCES", $default_source, $where); - push (@sources, $default_source); - push (@dist_sources, $default_source); - - %linkers_used = (); - my (@result) = - handle_single_transform ($one_file . '_SOURCES', - $one_file . '_SOURCES', - $one_file, $obj, - $default_source, %transform); - $linker ||= resolve_linker (%linkers_used); - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result); - } - else - { - @keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys; - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys); - } - - # If we want to use 'LINK' we must make sure it is defined. - if ($linker eq '') - { - $need_link = 1; - } - - return $linker; -} - - -# handle_lib_objects ($XNAME, $VAR) -# --------------------------------- -# Special-case ALLOCA and LIBOBJS substitutions in _LDADD or _LIBADD variables. -# Also, generate _DEPENDENCIES variable if appropriate. -# Arguments are: -# transformed name of object being built, or empty string if no object -# name of _LDADD/_LIBADD-type variable to examine -# Returns 1 if LIBOBJS seen, 0 otherwise. -sub handle_lib_objects -{ - my ($xname, $varname) = @_; - - my $var = var ($varname); - prog_error "'$varname' undefined" - unless $var; - prog_error "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 - # lax here since this code also applies to non-libtool - # libraries or programs, for which -dlopen and -dlopreopen - # are pure nonsense. Diagnosing this doesn't seem very - # important: the developer will quickly get complaints from - # the linker.) - $val !~ /^-dl(?:pre)?open$/ && - # Only get this error once. - ! $flagvar) - { - $flagvar = 1; - # FIXME: should display a stack of nested variables - # as context when $var != $subvar. - err_var ($var, "linker flags such as '$val' belong in " - . "'${prefix}LDFLAGS'"); - } - return (); - } - elsif ($val !~ /^\@.*\@$/) - { - # Assume we have a file of some sort, and output it into the - # dependency variable. Autoconf substitutions are not output; - # rarely is a new dependency substituted into e.g. foo_LDADD - # -- but bad things (e.g. -lX11) are routinely substituted. - # Note that LIBOBJS and ALLOCA are exceptions to this rule, - # and handled specially below. - return $val; - } - elsif ($val =~ /^\@(LT)?LIBOBJS\@$/) - { - handle_LIBOBJS ($subvar, $cond, $1); - $seen_libobjs = 1; - return $val; - } - elsif ($val =~ /^\@(LT)?ALLOCA\@$/) - { - handle_ALLOCA ($subvar, $cond, $1); - return $val; - } - else - { - return (); - } - }); - - return $seen_libobjs; -} - -# 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 -{ - my ($var) = @_; - - my $dir = ''; - - # 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 = backname ($relative_dir) . "/$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//; - } - else - { - error ("'\$($var)' cannot be used outside '$config_libobj_dir' if" - . " 'subdir-objects' is not set"); - } - } - - return $dir; -} - -sub handle_LIBOBJS -{ - my ($var, $cond, $lt) = @_; - my $myobjext = $lt ? 'lo' : 'o'; - $lt ||= ''; - - $var->requires_variables ("\@${lt}LIBOBJS\@ used", $lt . 'LIBOBJS') - if ! keys %libsources; - - my $dir = handle_LIBOBJS_or_ALLOCA "${lt}LIBOBJS"; - - foreach my $iter (keys %libsources) - { - if ($iter =~ /\.[cly]$/) - { - saw_extension ($&); - saw_extension ('.c'); - } - - if ($iter =~ /\.h$/) - { - require_libsource_with_macro ($cond, $var, FOREIGN, $iter); - } - elsif ($iter ne 'alloca.c') - { - 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); - } - } - } -} - -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'); -} - -# 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; -} - -# Set up the compile suite. -sub handle_compile () -{ - return if ! $must_handle_compiled_objects; - - # Boilerplate. - my $default_includes = ''; - if (! option 'nostdinc') - { - my @incs = ('-I.', subst ('am__isrc')); - - my $var = var 'CONFIG_HEADER'; - if ($var) - { - foreach my $hdr (split (' ', $var->variable_value)) - { - push @incs, '-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 put @am__isrc@ right after '-I.', without a space. - ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/; - } - - my (@mostly_rms, @dist_rms); - foreach my $item (sort keys %compile_clean_files) - { - if ($compile_clean_files{$item} == MOSTLY_CLEAN) - { - push (@mostly_rms, "\t-rm -f $item"); - } - elsif ($compile_clean_files{$item} == DIST_CLEAN) - { - push (@dist_rms, "\t-rm -f $item"); - } - else - { - prog_error 'invalid entry in %compile_clean_files'; - } - } - - my ($coms, $vars, $rules) = - file_contents_internal (1, "$libdir/am/compile.am", - new Automake::Location, - 'DEFAULT_INCLUDES' => $default_includes, - 'MOSTLYRMS' => join ("\n", @mostly_rms), - 'DISTRMS' => join ("\n", @dist_rms)); - $output_vars .= $vars; - $output_rules .= "$coms$rules"; -} - -# Handle libtool rules. -sub handle_libtool () -{ - return unless var ('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; - - 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"); - } - - check_user_variables 'LIBTOOLFLAGS'; - - # Output the libtool compilation rules. - $output_rules .= file_contents ('libtool', - new Automake::Location, - LTRMS => join ("\n", @libtool_rms)); -} - - -sub handle_programs () -{ - my @proglist = am_install_var ('progs', 'PROGRAMS', - 'bin', 'sbin', 'libexec', 'pkglibexec', - 'noinst', 'check'); - return if ! @proglist; - $must_handle_compiled_objects = 1; - - my $seen_global_libobjs = - var ('LDADD') && handle_lib_objects ('', 'LDADD'); - - foreach my $pair (@proglist) - { - my ($where, $one_file) = @$pair; - - my $seen_libobjs = 0; - my $obj = '.$(OBJEXT)'; - - $known_programs{$one_file} = $where; - - # Canonicalize names and check for misspellings. - my $xname = check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS', - '_SOURCES', '_OBJECTS', - '_DEPENDENCIES'); - - $where->push_context ("while processing program '$one_file'"); - $where->set (INTERNAL->get); - - my $linker = handle_source_transform ($xname, $one_file, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); - - if (var ($xname . "_LDADD")) - { - $seen_libobjs = handle_lib_objects ($xname, $xname . '_LDADD'); - } - else - { - # User didn't define prog_LDADD override. So do it. - define_variable ($xname . '_LDADD', '$(LDADD)', $where); - - # This does a bit too much work. But we need it to - # generate _DEPENDENCIES when appropriate. - if (var ('LDADD')) - { - $seen_libobjs = handle_lib_objects ($xname, 'LDADD'); - } - } - - reject_var ($xname . '_LIBADD', - "use '${xname}_LDADD', not '${xname}_LIBADD'"); - - set_seen ($xname . '_DEPENDENCIES'); - set_seen ('EXTRA_' . $xname . '_DEPENDENCIES'); - set_seen ($xname . '_LDFLAGS'); - - # Determine program to use for link. - my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname); - $vlink = verbose_flag ($vlink || 'GEN'); - - # If the resulting program lies in a subdirectory, - # ensure that the directory exists before we need it. - my $dirstamp = require_build_directory_maybe ($one_file); - - $libtool_clean_directories{dirname ($one_file)} = 1; - - $output_rules .= file_contents ('program', - $where, - PROGRAM => $one_file, - XPROGRAM => $xname, - XLINK => $xlink, - VERBOSE => $vlink, - DIRSTAMP => $dirstamp, - EXEEXT => '$(EXEEXT)'); - - if ($seen_libobjs || $seen_global_libobjs) - { - if (var ($xname . '_LDADD')) - { - check_libobjs_sources ($xname, $xname . '_LDADD'); - } - elsif (var ('LDADD')) - { - check_libobjs_sources ($xname, 'LDADD'); - } - } - } -} - - -sub handle_libraries () -{ - my @liblist = am_install_var ('libs', 'LIBRARIES', - 'lib', 'pkglib', 'noinst', 'check'); - return if ! @liblist; - $must_handle_compiled_objects = 1; - - 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); - define_verbose_tagvar ('AR'); - - foreach my $pair (@liblist) - { - my ($where, $onelib) = @$pair; - - my $seen_libobjs = 0; - # Check that the library fits the standard naming convention. - my $bn = basename ($onelib); - if ($bn !~ /^lib.*\.a$/) - { - $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.a/; - my $suggestion = dirname ($onelib) . "/$bn"; - $suggestion =~ s|^\./||g; - msg ('error-gnu/warn', $where, - "'$onelib' is not a standard library name\n" - . "did you mean '$suggestion'?") - } - - ($known_libraries{$onelib} = $bn) =~ s/\.a$//; - - $where->push_context ("while processing library '$onelib'"); - $where->set (INTERNAL->get); - - my $obj = '.$(OBJEXT)'; - - # Canonicalize names and check for misspellings. - my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES', - '_OBJECTS', '_DEPENDENCIES', - '_AR'); - - if (! var ($xlib . '_AR')) - { - define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where); - } - - # Generate support for conditional object inclusion in - # libraries. - if (var ($xlib . '_LIBADD')) - { - if (handle_lib_objects ($xlib, $xlib . '_LIBADD')) - { - $seen_libobjs = 1; - } - } - else - { - define_variable ($xlib . "_LIBADD", '', $where); - } - - reject_var ($xlib . '_LDADD', - "use '${xlib}_LIBADD', not '${xlib}_LDADD'"); - - # Make sure we at look at this. - set_seen ($xlib . '_DEPENDENCIES'); - set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES'); - - handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); - - # If the resulting library lies in a subdirectory, - # make sure this directory will exist. - my $dirstamp = require_build_directory_maybe ($onelib); - my $verbose = verbose_flag ('AR'); - my $silent = silent_flag (); - - $output_rules .= file_contents ('library', - $where, - VERBOSE => $verbose, - SILENT => $silent, - LIBRARY => $onelib, - XLIBRARY => $xlib, - DIRSTAMP => $dirstamp); - - if ($seen_libobjs) - { - if (var ($xlib . '_LIBADD')) - { - check_libobjs_sources ($xlib, $xlib . '_LIBADD'); - } - } - - if (! $seen_ar) - { - msg ('extra-portability', $where, - "'$onelib': linking libraries using a non-POSIX\n" - . "archiver requires 'AM_PROG_AR' in '$configure_ac'") - } - } -} - - -sub handle_ltlibraries () -{ - my @liblist = am_install_var ('ltlib', 'LTLIBRARIES', - 'noinst', 'lib', 'pkglib', 'check'); - return if ! @liblist; - $must_handle_compiled_objects = 1; - - 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 %instsubdirs = (); - my %instconds = (); - my %liblocations = (); # Location (in Makefile.am) of each library. - - foreach my $key (@prefix) - { - # Get the installation directory of each library. - my $dir = $key; - my $strip_subdir = 1; - if ($dir =~ /^nobase_/) - { - $dir =~ s/^nobase_//; - $strip_subdir = 0; - } - 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; - my $ldir = ''; - $ldir = '/' . dirname ($val) - if (!$strip_subdir); - # A library cannot be installed in different directories - # 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 " . ($strip_subdir ? "in" : "below") . " '$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; - $instsubdirs{$val}{$full_cond} = $ldir; - $liblocations{$val}{$full_cond} = $where; - $instconds{$val} = $instconds{$val}->merge ($full_cond); - }, - sub - { - return (); - }, - skip_ac_subst => 1); - } - - foreach my $pair (@liblist) - { - my ($where, $onelib) = @$pair; - - my $seen_libobjs = 0; - my $obj = '.lo'; - - # Canonicalize names and check for misspellings. - my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS', - '_SOURCES', '_OBJECTS', - '_DEPENDENCIES'); - - # Check that the library fits the standard naming convention. - my $libname_rx = '^lib.*\.la'; - my $ldvar = var ("${xlib}_LDFLAGS") || var ('AM_LDFLAGS'); - my $ldvar2 = var ('LDFLAGS'); - if (($ldvar && grep (/-module/, $ldvar->value_as_list_recursive)) - || ($ldvar2 && grep (/-module/, $ldvar2->value_as_list_recursive))) - { - # Relax name checking for libtool modules. - $libname_rx = '\.la'; - } - - my $bn = basename ($onelib); - if ($bn !~ /$libname_rx$/) - { - my $type = 'library'; - if ($libname_rx eq '\.la') - { - $bn =~ s/^(lib|)(.*?)(?:\.[^.]*)?$/$1$2.la/; - $type = 'module'; - } - else - { - $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.la/; - } - my $suggestion = dirname ($onelib) . "/$bn"; - $suggestion =~ s|^\./||g; - msg ('error-gnu/warn', $where, - "'$onelib' is not a standard libtool $type name\n" - . "did you mean '$suggestion'?") - } - - ($known_libraries{$onelib} = $bn) =~ s/\.la$//; - - $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'); - set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES'); - - # Generate support for conditional object inclusion in - # libraries. - if (var ($xlib . '_LIBADD')) - { - if (handle_lib_objects ($xlib, $xlib . '_LIBADD')) - { - $seen_libobjs = 1; - } - } - else - { - define_variable ($xlib . "_LIBADD", '', $where); - } - - reject_var ("${xlib}_LDADD", - "use '${xlib}_LIBADD', not '${xlib}_LDADD'"); - - - my $linker = handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 0, LIBTOOL => 1); - - # Determine program to use for link. - my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xlib); - $vlink = verbose_flag ($vlink || 'GEN'); - - 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)'); - $val .= $instsubdirs{$onelib}{$rcond} - if defined $instsubdirs{$onelib}{$rcond}; - } - if ($rcond->true) - { - # If $rcond is true there is only one condition and - # there is no point defining an helper variable. - $rpath = $val; - } - else - { - define_pretty_variable ($rpathvar, $rcond, INTERNAL, $val); - } - } - - # If the resulting library lies in a subdirectory, - # make sure this directory will exist. - my $dirstamp = require_build_directory_maybe ($onelib); - - # Remember to cleanup .libs/ in this directory. - my $dirname = dirname $onelib; - $libtool_clean_directories{$dirname} = 1; - - $output_rules .= file_contents ('ltlibrary', - $where, - LTLIBRARY => $onelib, - XLTLIBRARY => $xlib, - RPATH => $rpath, - XLINK => $xlink, - VERBOSE => $vlink, - DIRSTAMP => $dirstamp); - if ($seen_libobjs) - { - if (var ($xlib . '_LIBADD')) - { - check_libobjs_sources ($xlib, $xlib . '_LIBADD'); - } - } - - if (! $seen_ar) - { - msg ('extra-portability', $where, - "'$onelib': linking libtool libraries using a non-POSIX\n" - . "archiver requires 'AM_PROG_AR' in '$configure_ac'") - } - } -} - -# See if any _SOURCES variable were misspelled. -sub check_typos () -{ - # It is ok if the user sets this particular variable. - set_seen 'AM_LDFLAGS'; - - foreach my $primary ('SOURCES', 'LIBADD', 'LDADD', 'LDFLAGS', 'DEPENDENCIES') - { - foreach my $var (variables $primary) - { - my $varname = $var->name; - # A configure variable is always legitimate. - next if exists $configure_vars{$varname}; - - for my $cond ($var->conditions->conds) - { - $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/; - msg_var ('syntax', $var, "variable '$varname' is defined but no" - . " program or\nlibrary has '$1' as canonical name" - . " (possible typo)") - unless $var->rdef ($cond)->seen; - } - } - } -} - - -sub handle_scripts () -{ - # NOTE we no longer automatically clean SCRIPTS, because it is - # useful to sometimes distribute scripts verbatim. This happens - # e.g. in Automake itself. - am_install_var ('-candist', 'scripts', 'SCRIPTS', - 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata', - 'noinst', 'check'); -} - - -## ------------------------ ## -## Handling Texinfo files. ## -## ------------------------ ## - -# ($OUTFILE, $VFILE) -# scan_texinfo_file ($FILENAME) -# ----------------------------- -# $OUTFILE - name of the info file produced by $FILENAME. -# $VFILE - name of the version.texi file used (undef if none). -sub scan_texinfo_file -{ - my ($filename) = @_; - - 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 (index ($outfile, '.') < 0) - { - msg 'obsolete', "$filename:$.", - "use of suffix-less info files is discouraged" - } - elsif ($outfile !~ /\.info$/) - { - error ("$filename:$.", - "output '$outfile' has unrecognized extension"); - return; - } - } - # A "version.texi" file is actually any file whose name matches - # "vers*.texi". - elsif (/^\@include\s+(vers[^.]*\.texi)\s*$/) - { - $vfile = $1; - } - } - - if (! $outfile) - { - err_am "'$filename' missing \@setfilename"; - return; - } - - return ($outfile, $vfile); -} - - -# ($DIRSTAMP, @CLEAN_FILES) -# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES) -# ------------------------------------------------------------------ -# SOURCE - the source Texinfo file -# DEST - the destination Info file -# INSRC - whether DEST should be built in the source tree -# DEPENDENCIES - known dependencies -sub output_texinfo_build_rules -{ - my ($source, $dest, $insrc, @deps) = @_; - - # Split 'a.texi' into 'a' and '.texi'. - my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/); - my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/); - - $ssfx ||= ""; - $dsfx ||= ""; - - # We can output two kinds of rules: the "generic" rules use Make - # suffix rules and are appropriate when $source and $dest do not lie - # in a sub-directory; the "specific" rules are needed in the other - # case. - # - # The former are output only once (this is not really apparent here, - # but just remember that some logic deeper in Automake will not - # output the same rule twice); while the later need to be output for - # each Texinfo source. - my $generic; - my $makeinfoflags; - my $sdir = dirname $source; - if ($sdir eq '.' && dirname ($dest) eq '.') - { - $generic = 1; - $makeinfoflags = '-I $(srcdir)'; - } - else - { - $generic = 0; - $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir"; - } - - # A directory can contain two kinds of info files: some built in the - # source tree, and some built in the build tree. The rules are - # different in each case. However we cannot output two different - # set of generic rules. Because in-source builds are more usual, we - # use generic rules in this case and fall back to "specific" rules - # for build-dir builds. (It should not be a problem to invert this - # if needed.) - $generic = 0 unless $insrc; - - # We cannot use a suffix rule to build info files with an empty - # extension. Otherwise we would output a single suffix inference - # rule, with separate dependencies, as in - # - # .texi: - # $(MAKEINFO) ... - # foo.info: foo.texi - # - # which confuse Solaris make. (See the Autoconf manual for - # details.) Therefore we use a specific rule in this case. This - # applies to info files only (dvi and pdf files always have an - # extension). - my $generic_info = ($generic && $dsfx) ? 1 : 0; - - # If the resulting file lies in 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, - AM_V_MAKEINFO => verbose_flag('MAKEINFO'), - AM_V_TEXI2DVI => verbose_flag('TEXI2DVI'), - AM_V_TEXI2PDF => verbose_flag('TEXI2PDF'), - DEPS => "@deps", - DEST_PREFIX => $dpfx, - DEST_INFO_PREFIX => $dipfx, - DEST_SUFFIX => $dsfx, - DIRSTAMP => $dirstamp, - GENERIC => $generic, - GENERIC_INFO => $generic_info, - INSRC => $insrc, - MAKEINFOFLAGS => $makeinfoflags, - SILENT => silent_flag(), - SOURCE => ($generic - ? '$<' : $source), - SOURCE_INFO => ($generic_info - ? '$<' : $source), - SOURCE_REAL => $source, - SOURCE_SUFFIX => $ssfx, - TEXIQUIET => verbose_flag('texinfo'), - TEXIDEVNULL => verbose_flag('texidevnull'), - ); - return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html"); -} - - -# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN) -# 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 (@mostly_cleans, @texi_cleans, @maint_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; - if ($infobase =~ s/\.texi$//) - { - 1; # Nothing more to do. - } - elsif ($infobase =~ s/\.(txi|texinfo)$//) - { - msg_var 'obsolete', $info_texinfos, - "suffix '.$1' for Texinfo files is discouraged;" . - " use '.texi' instead"; - } - else - { - # 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) = - scan_texinfo_file ("$relative_dir/$texi") - or next; - # Directory of auxiliary files and build by-products used by texi2dvi - # and texi2pdf. - push @mostly_cleans, "$infobase.t2d"; - push @mostly_cleans, "$infobase.t2p"; - - # 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_TEXINFOS = foo.texi - # nodist_foo_TEXINFOS = 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 - # wants to distribute .texi files, but does 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 in two cases: - # (1) 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. - # (2) When the undocumented option 'info-in-builddir' is given. - # This is done to allow the developers of GCC, GDB, GNU - # binutils and the GNU bfd library to force the '.info' files - # to be generated in the builddir rather than the srcdir, as - # was once done when the (now removed) 'cygnus' option was - # given. See automake bug#11034 for more discussion. - my $insrc = 1; - my $soutdir = '$(srcdir)/' . $outdir; - - if (option 'info-in-builddir') - { - $insrc = 0; - } - elsif ($out_file =~ $user_cleaned_files) - { - $insrc = 0; - msg 'obsolete', "$am_file.am", < $texi, - VTI => $vti, - STAMPVTI => "${soutdir}stamp-$vti", - VTEXI => "$soutdir$vtexi", - MDDIR => $conf_dir, - DIRSTAMP => $dirstamp); - } - } - - # Handle location of texinfo.tex. - my $need_texi_file = 0; - my $texinfodir; - if (var ('TEXINFO_TEX')) - { - # The user defined TEXINFO_TEX so assume he knows what he is - # doing. - $texinfodir = ('$(srcdir)/' - . dirname (variable_value ('TEXINFO_TEX'))); - } - elsif ($config_aux_dir_set_in_configure_ac) - { - $texinfodir = $am_config_aux_dir; - define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL); - $need_texi_file = 2; # so that we require_conf_file later - } - else - { - $texinfodir = '$(srcdir)'; - $need_texi_file = 1; - } - define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL); - - push (@dist_targets, 'dist-info'); - - if (! option 'no-installinfo') - { - # Make sure documentation is made and installed first. Use - # $(INFO_DEPS), not 'info', because otherwise recursive makes - # get run twice during "make all". - unshift (@all, '$(INFO_DEPS)'); - } - - define_files_variable ("DVIS", @infobase, 'dvi', INTERNAL); - define_files_variable ("PDFS", @infobase, 'pdf', INTERNAL); - define_files_variable ("PSS", @infobase, 'ps', INTERNAL); - define_files_variable ("HTMLS", @infobase, 'html', INTERNAL); - - # This next isn't strictly needed now -- the places that look here - # could easily be changed to look in info_TEXINFOS. But this is - # probably better, in case noinst_TEXINFOS is ever supported. - define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL); - - # Do some error checking. Note that this file is not required - # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly - # up above. - if ($need_texi_file && ! option 'no-texinfo.tex') - { - if ($need_texi_file > 1) - { - require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); - } - else - { - require_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); - } - } - - return (makefile_wrap ("", "\t ", @mostly_cleans), - makefile_wrap ("", "\t ", @texi_cleans), - makefile_wrap ("", "\t ", @maint_cleans)); -} - - -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 ($mostlyclean, $clean, $maintclean) = ('', '', ''); - if ($info_texinfos) - { - define_verbose_texinfo; - ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos); - chomp $mostlyclean; - chomp $clean; - chomp $maintclean; - } - - $output_rules .= file_contents ('texinfos', - new Automake::Location, - AM_V_DVIPS => verbose_flag('DVIPS'), - MOSTLYCLEAN => $mostlyclean, - TEXICLEAN => $clean, - MAINTCLEAN => $maintclean, - 'LOCAL-TEXIS' => !!$info_texinfos, - TEXIQUIET => verbose_flag('texinfo')); -} - - -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, %notrans_sections, %trans_sections, - %notrans_vars, %trans_vars, %notrans_sect_vars, %trans_sect_vars); - # We handle nodist_ for uniformity. man pages aren't distributed - # by default so it isn't actually very important. - foreach my $npfx ('', 'notrans_') - { - foreach my $pfx ('', 'dist_', 'nodist_') - { - # Add more sections as needed. - foreach my $section ('0'..'9', 'n', 'l') - { - my $varname = $npfx . $pfx . 'man' . $section . '_MANS'; - if (var ($varname)) - { - $sections{$section} = 1; - $varname = '$(' . $varname . ')'; - if ($npfx eq 'notrans_') - { - $notrans_sections{$section} = 1; - $notrans_sect_vars{$varname} = 1; - } - else - { - $trans_sections{$section} = 1; - $trans_sect_vars{$varname} = 1; - } - - push_dist_common ($varname) - if $pfx eq 'dist_'; - } - } - - my $varname = $npfx . $pfx . 'man_MANS'; - my $var = var ($varname); - if ($var) - { - foreach ($var->value_as_list_recursive) - { - # A page like 'foo.1c' goes into man1dir. - if (/\.([0-9a-z])([a-z]*)$/) - { - $sections{$1} = 1; - if ($npfx eq 'notrans_') - { - $notrans_sections{$1} = 1; - } - else - { - $trans_sections{$1} = 1; - } - } - } - - $varname = '$(' . $varname . ')'; - if ($npfx eq 'notrans_') - { - $notrans_vars{$varname} = 1; - } - else - { - $trans_vars{$varname} = 1; - } - push_dist_common ($varname) - if $pfx eq 'dist_'; - } - } - } - - return unless %sections; - - my @unsorted_deps; - - # Build section independent variables. - my $have_notrans = %notrans_vars; - my @notrans_list = sort keys %notrans_vars; - my $have_trans = %trans_vars; - my @trans_list = sort keys %trans_vars; - - # Now for each section, generate an install and uninstall rule. - # Sort sections so output is deterministic. - foreach my $section (sort keys %sections) - { - # Build section dependent variables. - my $notrans_mans = $have_notrans || exists $notrans_sections{$section}; - my $trans_mans = $have_trans || exists $trans_sections{$section}; - my (%notrans_this_sect, %trans_this_sect); - my $expr = 'man' . $section . '_MANS'; - foreach my $varname (keys %notrans_sect_vars) - { - if ($varname =~ /$expr/) - { - $notrans_this_sect{$varname} = 1; - } - } - foreach my $varname (keys %trans_sect_vars) - { - if ($varname =~ /$expr/) - { - $trans_this_sect{$varname} = 1; - } - } - my @notrans_sect_list = sort keys %notrans_this_sect; - my @trans_sect_list = sort keys %trans_this_sect; - @unsorted_deps = (keys %notrans_vars, keys %trans_vars, - keys %notrans_this_sect, keys %trans_this_sect); - my @deps = sort @unsorted_deps; - $output_rules .= file_contents ('mans', - new Automake::Location, - SECTION => $section, - DEPS => "@deps", - NOTRANS_MANS => $notrans_mans, - NOTRANS_SECT_LIST => "@notrans_sect_list", - HAVE_NOTRANS => $have_notrans, - NOTRANS_LIST => "@notrans_list", - TRANS_MANS => $trans_mans, - TRANS_SECT_LIST => "@trans_sect_list", - HAVE_TRANS => $have_trans, - TRANS_LIST => "@trans_list"); - } - - @unsorted_deps = (keys %notrans_vars, keys %trans_vars, - keys %notrans_sect_vars, keys %trans_sect_vars); - my @mans = sort @unsorted_deps; - $output_vars .= file_contents ('mans-vars', - new Automake::Location, - MANS => "@mans"); - - push (@all, '$(MANS)') - unless option 'no-installman'; -} - - -sub handle_data () -{ - am_install_var ('-noextra', '-candist', 'data', 'DATA', - 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf', - 'ps', 'sysconf', 'sharedstate', 'localstate', - 'pkgdata', 'lisp', 'noinst', 'check'); -} - - -sub handle_tags () -{ - 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); - } - } - - define_variable ('am__tagged_files', - '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)' - . "@config", INTERNAL); - - if (rvar('am__tagged_files')->value_as_list_recursive - || var ('ETAGS_ARGS') || var ('SUBDIRS')) - { - $output_rules .= file_contents ('tags', new Automake::Location); - set_seen 'TAGS_DEPENDENCIES'; - } - else - { - reject_var ('TAGS_DEPENDENCIES', - "it doesn't make sense to define 'TAGS_DEPENDENCIES'" - . " without\nsources or 'ETAGS_ARGS'"); - # 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. Ditto ctags and - # cscope. - $output_rules .= - "tags TAGS:\n\n" . - "ctags CTAGS:\n\n" . - "cscope cscopelist:\n\n"; - } -} - - -# user_phony_rule ($NAME) -# ----------------------- -# Return false if rule $NAME does not exist. Otherwise, -# declare it as phony, complete its definition (in case it is -# conditional), and return its Automake::Rule instance. -sub user_phony_rule -{ - my ($name) = @_; - my $rule = rule $name; - if ($rule) - { - depend ('.PHONY', $name); - # Define $NAME in all condition where it is not already defined, - # so that it is always OK to depend on $NAME. - for my $c ($rule->not_always_defined_in_cond (TRUE)->conds) - { - Automake::Rule::define ($name, 'internal', RULE_AUTOMAKE, - $c, INTERNAL); - $output_rules .= $c->subst_string . "$name:\n"; - } - } - return $rule; -} - - -# Handle 'dist' target. -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'; - - # 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-$_" } qw(shar zip tarZ bzip2 lzip xz); - error (option 'no-dist-gzip', - "no-dist-gzip specified but no dist-* specified,\n" - . "at least one archive format must be enabled") - unless $archive_defined; - } - - # Look for common files that should be included in distribution. - # If the aux dir is set, and it does not have a Makefile.am, then - # we check for these files there as well. - my $check_aux = 0; - if ($relative_dir eq '.' - && $config_aux_dir_set_in_configure_ac) - { - if (! is_make_dir ($config_aux_dir)) - { - $check_aux = 1; - } - } - foreach my $cfile (@common_files) - { - if (dir_has_case_matching_file ($relative_dir, $cfile) - # The file might be absent, but if it can be built it's ok. - || rule $cfile) - { - push_dist_common ($cfile); - } - - # Don't use 'elsif' here because a file might meaningfully - # appear in both directories. - if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile)) - { - push_dist_common ("$config_aux_dir/$cfile") - } - } - - # We might copy elements from $configure_dist_common to - # %dist_common if we think we need to. If the file appears in our - # directory, we would have discovered it already, so we don't - # check that. But if the file is in a subdir without a Makefile, - # we want to distribute it here if we are doing '.'. Ugly! - # Also, in some corner cases, it's possible that the following code - # will cause the same file to appear in the $(DIST_COMMON) variables - # of two distinct Makefiles; but this is not a problem, since the - # 'distdir' target in 'lib/am/distdir.am' can deal with the same - # file being distributed multiple times. - # See also automake bug#9651. - if ($relative_dir eq '.') - { - foreach my $file (split (' ' , $configure_dist_common)) - { - my $dir = dirname ($file); - push_dist_common ($file) - if ($dir eq '.' || ! is_make_dir ($dir)); - } - } - - # 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 (@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; - - $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook'; - $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external; - - # If the target 'dist-hook' exists, make sure it is run. This - # allows users to do random weird things to the distribution - # before it is packaged up. - push (@dist_targets, 'dist-hook') - if user_phony_rule 'dist-hook'; - $transform{'DIST-TARGETS'} = join (' ', @dist_targets); - - my $flm = option ('filename-length-max'); - my $filename_filter = $flm ? '.' x $flm->[1] : ''; - - $output_rules .= file_contents ('distdir', - new Automake::Location, - %transform, - FILENAME_FILTER => $filename_filter); -} - - -# check_directory ($NAME, $WHERE [, $RELATIVE_DIR = "."]) -# ------------------------------------------------------- -# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane -# name. Use $WHERE as a location in the diagnostic, if any. -sub check_directory -{ - my ($dir, $where, $reldir) = @_; - $reldir = '.' unless defined $reldir; - - error $where, "required directory $reldir/$dir does not exist" - unless -d "$reldir/$dir"; - - # If an 'obj/' directory exists, BSD make will enter it before - # reading 'Makefile'. Hence the 'Makefile' in the current directory - # will not be read. - # - # % cat Makefile - # all: - # echo Hello - # % cat obj/Makefile - # all: - # echo World - # % make # GNU make - # echo Hello - # Hello - # % pmake # BSD make - # echo World - # World - msg ('portability', $where, - "naming a subdirectory 'obj' causes troubles with BSD make") - if $dir eq 'obj'; - - # 'aux' is probably the most important of the following forbidden name, - # since it's tempting to use it as an AC_CONFIG_AUX_DIR. - msg ('portability', $where, - "name '$dir' is reserved on W32 and DOS platforms") - if grep (/^\Q$dir\E$/i, qw/aux lpt1 lpt2 lpt3 com1 com2 com3 com4 con prn/); -} - -# check_directories_in_var ($VARIABLE) -# ------------------------------------ -# Recursively check all items in variables $VARIABLE as directories -sub check_directories_in_var -{ - my ($var) = @_; - $var->traverse_recursively - (sub - { - my ($var, $val, $cond, $full_cond) = @_; - check_directory ($val, $var->rdef ($cond)->location, $relative_dir); - return (); - }, - undef, - skip_ac_subst => 1); -} - - -sub handle_subdirs () -{ - my $subdirs = var ('SUBDIRS'); - return - unless $subdirs; - - check_directories_in_var $subdirs; - - my $dsubdirs = var ('DIST_SUBDIRS'); - check_directories_in_var $dsubdirs - if $dsubdirs; - - $output_rules .= file_contents ('subdirs', new Automake::Location); - rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross! -} - - -# ($REGEN, @DEPENDENCIES) -# scan_aclocal_m4 -# --------------- -# If aclocal.m4 creation is automated, return the list of its dependencies. -sub scan_aclocal_m4 () -{ - my $regen_aclocal = 0; - - set_seen 'CONFIG_STATUS_DEPENDENCIES'; - set_seen 'CONFIGURE_DEPENDENCIES'; - - if (-f 'aclocal.m4') - { - define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL); - - my $aclocal = new Automake::XFile "< aclocal.m4"; - my $line = $aclocal->getline; - $regen_aclocal = $line =~ 'generated automatically by aclocal'; - } - - my @ac_deps = (); - - if (set_seen ('ACLOCAL_M4_SOURCES')) - { - push (@ac_deps, '$(ACLOCAL_M4_SOURCES)'); - msg_var ('obsolete', 'ACLOCAL_M4_SOURCES', - "'ACLOCAL_M4_SOURCES' is obsolete.\n" - . "It should be safe to simply remove it"); - } - - # Note that it might be possible that aclocal.m4 doesn't exist but - # should be auto-generated. This case probably isn't very - # important. - - return ($regen_aclocal, @ac_deps); -} - - -# 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 (dirname ($single) eq $relative_dir) - { - push (@newinputs, '$(srcdir)/' . basename ($single)); - } - else - { - push (@newinputs, '$(top_srcdir)/' . $single); - } - } - return @newinputs; -} - -# @DEPENDENCIES -# rewrite_inputs_into_dependencies ($OUTPUT, @INPUTS) -# --------------------------------------------------- -# Compute a list of dependencies appropriate for the rebuild -# rule of -# AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...) -# Also distribute $INPUTs which are not built by another AC_CONFIG_FOOs. -sub rewrite_inputs_into_dependencies -{ - my ($file, @inputs) = @_; - my @res = (); - - for my $i (@inputs) - { - # We cannot create dependencies on shell variables. - next if (substitute_ac_subst_variables $i) =~ /\$/; - - if (exists $ac_config_files_location{$i} && $i ne $file) - { - my $di = dirname $i; - if ($di eq $relative_dir) - { - $i = basename $i; - } - # In the top-level Makefile we do not use $(top_builddir), because - # we are already there, and since the targets are built without - # a $(top_builddir), it helps BSD Make to match them with - # dependencies. - elsif ($relative_dir ne '.') - { - $i = '$(top_builddir)/' . $i; - } - } - else - { - msg ('error', $ac_config_files_location{$file}, - "required file '$i' not found") - unless $i =~ /\$/ || exists $output_files{$i} || -f $i; - ($i) = prepend_srcdir ($i); - push_dist_common ($i); - } - push @res, $i; - } - return @res; -} - - - -# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS) -# ----------------------------------------------------------------- -# Handle remaking and configure stuff. -# We need the name of the input file, to do proper remaking rules. -sub handle_configure -{ - my ($makefile_am, $makefile_in, $makefile, @inputs) = @_; - - prog_error 'empty @inputs' - unless @inputs; - - my ($rel_makefile_am, $rel_makefile_in) = prepend_srcdir ($makefile_am, - $makefile_in); - my $rel_makefile = basename $makefile; - - my $colon_infile = ':' . join (':', @inputs); - $colon_infile = '' if $colon_infile eq ":$makefile.in"; - my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs); - my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4; - define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL, - @configure_deps, @aclocal_m4_deps, - '$(top_srcdir)/' . $configure_ac); - my @configuredeps = ('$(am__aclocal_m4_deps)', '$(CONFIGURE_DEPENDENCIES)'); - push @configuredeps, '$(ACLOCAL_M4)' if -f 'aclocal.m4'; - define_pretty_variable ('am__configure_deps', TRUE, INTERNAL, - @configuredeps); - - my $automake_options = '--' . $strictness_name . - (global_option 'no-dependencies' ? ' --ignore-deps' : ''); - - $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, - 'HAVE-MAKEFILE-IN-DEPS' => (@include_stack > 0), - 'MAKEFILE-IN-DEPS' => "@include_stack", - 'MAKEFILE-AM' => $rel_makefile_am, - 'AUTOMAKE-OPTIONS' => $automake_options, - 'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile", - 'REGEN-ACLOCAL-M4' => $regen_aclocal_m4, - VERBOSE => verbose_flag ('GEN')); - - if ($relative_dir eq '.') - { - push_dist_common ('acconfig.h') - if -f 'acconfig.h'; - } - - # If we have a configure header, require it. - my $hdr_index = 0; - my @distclean_config; - foreach my $spec (@config_headers) - { - $hdr_index += 1; - # $CONFIG_H_PATH: config.h from top level. - my ($config_h_path, @ins) = split_config_file_spec ($spec); - my $config_h_dir = dirname ($config_h_path); - - # If the header is in the current directory we want to build - # the header here. Otherwise, if we're at the topmost - # directory and the header's directory doesn't have a - # Makefile, then we also want to build the header. - if ($relative_dir eq $config_h_dir - || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir))) - { - my ($cn_sans_dir, $stamp_dir); - if ($relative_dir eq $config_h_dir) - { - $cn_sans_dir = basename ($config_h_path); - $stamp_dir = ''; - } - else - { - $cn_sans_dir = $config_h_path; - if ($config_h_dir eq '.') - { - $stamp_dir = ''; - } - else - { - $stamp_dir = $config_h_dir . '/'; - } - } - - # This will also distribute all inputs. - @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins); - - # Cannot define rebuild rules for filenames with shell variables. - next if (substitute_ac_subst_variables $config_h_path) =~ /\$/; - - # Header defined in this directory. - my @files; - if (-f $config_h_path . '.top') - { - push (@files, "$cn_sans_dir.top"); - } - if (-f $config_h_path . '.bot') - { - push (@files, "$cn_sans_dir.bot"); - } - - push_dist_common (@files); - - # For now, acconfig.h can only appear in the top srcdir. - if (-f 'acconfig.h') - { - push (@files, '$(top_srcdir)/acconfig.h'); - } - - my $stamp = "${stamp_dir}stamp-h${hdr_index}"; - $output_rules .= - file_contents ('remake-hdr', - new Automake::Location, - FILES => "@files", - 'FIRST-HDR' => ($hdr_index == 1), - CONFIG_H => $cn_sans_dir, - CONFIG_HIN => $ins[0], - CONFIG_H_DEPS => "@ins", - CONFIG_H_PATH => $config_h_path, - STAMP => "$stamp"); - - push @distclean_config, $cn_sans_dir, $stamp; - } - } - - $output_rules .= file_contents ('clean-hdr', - new Automake::Location, - FILES => "@distclean_config") - if @distclean_config; - - # Distribute and define mkinstalldirs only if it is already present - # in the package, for backward compatibility (some people may still - # use $(mkinstalldirs)). - # TODO: start warning about this in Automake 1.14, and have - # TODO: Automake 2.0 drop it (and the mkinstalldirs script - # TODO: as well). - 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); - } - - reject_var ('CONFIG_HEADER', - "'CONFIG_HEADER' is an anachronism; now determined " - . "automatically\nfrom '$configure_ac'"); - - my @config_h; - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - # Generate CONFIG_HEADER define. - if ($relative_dir eq dirname ($out)) - { - push @config_h, basename ($out); - } - else - { - push @config_h, "\$(top_builddir)/$out"; - } - } - define_variable ("CONFIG_HEADER", "@config_h", INTERNAL) - if @config_h; - - # Now look for other files in this directory which must be remade - # by config.status, and generate rules for them. - my @actual_other_files = (); - # These get cleaned only in a VPATH build. - my @actual_other_vpath_files = (); - foreach my $lfile (@other_input_files) - { - my $file; - my @inputs; - if ($lfile =~ /^([^:]*):(.*)$/) - { - # This is the ":" syntax of AC_OUTPUT. - $file = $1; - @inputs = split (':', $2); - } - else - { - # Normal usage. - $file = $lfile; - @inputs = $file . '.in'; - } - - # Automake files should not be stored in here, but in %MAKE_LIST. - prog_error ("$lfile in \@other_input_files\n" - . "\@other_input_files = (@other_input_files)") - if -f $file . '.am'; - - my $local = basename ($file); - - # We skip files that aren't in this directory. However, if - # the file's directory does not have a Makefile, and we are - # currently doing '.', then we create a rule to rebuild the - # file in the subdir. - my $fd = dirname ($file); - if ($fd ne $relative_dir) - { - if ($relative_dir eq '.' && ! is_make_dir ($fd)) - { - $local = $file; - } - else - { - next; - } - } - - my @rewritten_inputs = rewrite_inputs_into_dependencies ($file, @inputs); - - # Cannot output rules for shell variables. - next if (substitute_ac_subst_variables $local) =~ /\$/; - - my $condstr = ''; - my $cond = $ac_config_files_condition{$lfile}; - if (defined $cond) - { - $condstr = $cond->subst_string; - Automake::Rule::define ($local, $configure_ac, RULE_AUTOMAKE, $cond, - $ac_config_files_location{$file}); - } - $output_rules .= ($condstr . $local . ': ' - . '$(top_builddir)/config.status ' - . "@rewritten_inputs\n" - . $condstr . "\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 links that aren't in this directory. However, if - # the link's directory does not have a Makefile, and we are - # currently doing '.', then we add the link to CONFIG_CLEAN_FILES - # in '.'s Makefile.in. - my $local = basename ($link); - my $fd = dirname ($link); - if ($fd ne $relative_dir) - { - if ($relative_dir eq '.' && ! is_make_dir ($fd)) - { - $local = $link; - } - else - { - $local = undef; - } - } - if ($file ne $link) - { - push @actual_other_files, $local if $local; - } - else - { - push @actual_other_vpath_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))) - { - # The following will distribute $file as a side-effect when - # it is appropriate (i.e., when $file is not already an output). - # We do not need the result, just the side-effect. - rewrite_inputs_into_dependencies ($link, $file); - } - } - } - - # These files get removed by "make distclean". - define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL, - @actual_other_files); - define_pretty_variable ('CONFIG_CLEAN_VPATH_FILES', TRUE, INTERNAL, - @actual_other_vpath_files); -} - -sub handle_headers () -{ - my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include', - 'oldinclude', 'pkginclude', - 'noinst', 'check'); - foreach (@r) - { - next unless $_->[1] =~ /\..*$/; - saw_extension ($&); - } -} - -sub handle_gettext () -{ - return if ! $seen_gettext || $relative_dir ne '.'; - - my $subdirs = var 'SUBDIRS'; - - if (! $subdirs) - { - err_ac "AM_GNU_GETTEXT used but SUBDIRS not defined"; - return; - } - - # Perform some sanity checks to help users get the right setup. - # We disable these tests when po/ doesn't exist in order not to disallow - # unusual gettext setups. - # - # Bruno Haible: - # | The idea is: - # | - # | 1) If a package doesn't have a directory po/ at top level, it - # | will likely have multiple po/ directories in subpackages. - # | - # | 2) It is useful to warn for the absence of intl/ if AM_GNU_GETTEXT - # | is used without 'external'. It is also useful to warn for the - # | presence of intl/ if AM_GNU_GETTEXT([external]) is used. Both - # | warnings apply only to the usual layout of packages, therefore - # | they should both be disabled if no po/ directory is found at - # | top level. - - if (-d 'po') - { - my @subdirs = $subdirs->value_as_list_recursive; - - msg_var ('syntax', $subdirs, - "AM_GNU_GETTEXT used but 'po' not in SUBDIRS") - if ! grep ($_ eq 'po', @subdirs); - - # intl/ is not required when AM_GNU_GETTEXT is called with the - # 'external' option 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)); - } - - require_file ($ac_gettext_location, GNU, 'ABOUT-NLS'); -} - -# Emit makefile footer. -sub handle_footer () -{ - reject_rule ('.SUFFIXES', - "use variable 'SUFFIXES', not target '.SUFFIXES'"); - - # Note: AIX 4.1 /bin/make will fail if any suffix rule appears - # before .SUFFIXES. So we make sure that .SUFFIXES appears before - # anything else, by sticking it right after the default: target. - $output_header .= ".SUFFIXES:\n"; - my $suffixes = var 'SUFFIXES'; - my @suffixes = Automake::Rule::suffixes; - if (@suffixes || $suffixes) - { - # Make sure SUFFIXES has unique elements. Sort them to ensure - # the output remains consistent. However, $(SUFFIXES) is - # always at the start of the list, unsorted. This is done - # because make will choose rules depending on the ordering of - # suffixes, and this lets the user have some control. Push - # actual suffixes, and not $(SUFFIXES). Some versions of make - # do not like variable substitutions on the .SUFFIXES line. - my @user_suffixes = ($suffixes - ? $suffixes->value_as_list_recursive : ()); - - my %suffixes = map { $_ => 1 } @suffixes; - delete @suffixes{@user_suffixes}; - - $output_header .= (".SUFFIXES: " - . join (' ', @user_suffixes, sort keys %suffixes) - . "\n"); - } - - $output_trailer .= file_contents ('footer', new Automake::Location); -} - - -# Generate 'make install' rules. -sub handle_install () -{ - $output_rules .= file_contents - ('install', - new Automake::Location, - maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES') - ? (" \$(BUILT_SOURCES)\n" - . "\t\$(MAKE) \$(AM_MAKEFLAGS)") - : ''), - 'installdirs-local' => (user_phony_rule ('installdirs-local') - ? ' installdirs-local' : ''), - am__installdirs => variable_value ('am__installdirs') || ''); -} - - -# handle_all ($MAKEFILE) -#----------------------- -# Deal with 'all' and 'all-am'. -sub handle_all -{ - my ($makefile) = @_; - - # Output 'all-am'. - - # Put this at the beginning for the sake of non-GNU makes. This - # is still wrong if these makes can run parallel jobs. But it is - # right enough. - unshift (@all, basename ($makefile)); - - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push (@all, basename ($out)) - if dirname ($out) eq $relative_dir; - } - - # Install 'all' hooks. - push (@all, "all-local") - if user_phony_rule "all-local"; - - pretty_print_rule ("all-am:", "\t\t", @all); - depend ('.PHONY', 'all-am', 'all'); - - - # Output 'all'. - - my @local_headers = (); - push @local_headers, '$(BUILT_SOURCES)' - if var ('BUILT_SOURCES'); - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push @local_headers, basename ($out) - if dirname ($out) eq $relative_dir; - } - - if (@local_headers) - { - # We need to make sure config.h is built before we recurse. - # We also want to make sure that built sources are built - # before any ordinary 'all' targets are run. We can't do this - # by changing the order of dependencies to the "all" because - # that breaks when using parallel makes. Instead we handle - # things explicitly. - $output_all .= ("all: @local_headers" - . "\n\t" - . '$(MAKE) $(AM_MAKEFLAGS) ' - . (var ('SUBDIRS') ? 'all-recursive' : 'all-am') - . "\n\n"); - depend ('.MAKE', 'all'); - } - else - { - $output_all .= "all: " . (var ('SUBDIRS') - ? 'all-recursive' : 'all-am') . "\n\n"; - } -} - -# Generate helper targets for user-defined recursive targets, where needed. -sub handle_user_recursion () -{ - return unless @extra_recursive_targets; - - define_pretty_variable ('am__extra_recursive_targets', TRUE, INTERNAL, - map { "$_-recursive" } @extra_recursive_targets); - my $aux = var ('SUBDIRS') ? 'recursive' : 'am'; - foreach my $target (@extra_recursive_targets) - { - # This allows the default target's rules to be overridden in - # Makefile.am. - user_phony_rule ($target); - depend ("$target", "$target-$aux"); - depend ("$target-am", "$target-local"); - # Every user-defined recursive target 'foo' *must* have a valid - # associated 'foo-local' rule; we define it as an empty rule by - # default, so that the user can transparently extend it in his - # own Makefile.am. - pretty_print_rule ("$target-local:", '', ''); - # $target-recursive might as well be undefined, so do not add - # it here; it's taken care of in subdirs.am anyway. - depend (".PHONY", "$target-am", "$target-local"); - } -} - - -# Handle check merge target specially. -sub do_check_merge_target () -{ - # Include user-defined local form of target. - push @check_tests, 'check-local' - if user_phony_rule 'check-local'; - - # 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"; - if (@check) - { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check); - depend ('.MAKE', 'check-am'); - } - - if (@check_tests) - { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", - @check_tests); - depend ('.MAKE', 'check-am'); - } - - 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"); - depend ('.MAKE', 'check') - if var ('BUILT_SOURCES'); -} - -# Handle all 'clean' targets. -sub handle_clean -{ - my ($makefile) = @_; - - # Clean the files listed in user variables if they exist. - $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN - if var ('MOSTLYCLEANFILES'); - $clean_files{'$(CLEANFILES)'} = CLEAN - if var ('CLEANFILES'); - $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN - if var ('DISTCLEANFILES'); - $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN - if var ('MAINTAINERCLEANFILES'); - - # Built sources are automatically removed by maintainer-clean. - $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN - if var ('BUILT_SOURCES'); - - # Compute a list of "rm"s to run for each target. - my %rms = (MOSTLY_CLEAN, [], - CLEAN, [], - DIST_CLEAN, [], - MAINTAINER_CLEAN, []); - - foreach my $file (keys %clean_files) - { - my $when = $clean_files{$file}; - prog_error 'invalid entry in %clean_files' - unless exists $rms{$when}; - - my $rm = "rm -f $file"; - # If file is a variable, make sure when don't call 'rm -f' without args. - $rm ="test -z \"$file\" || $rm" - if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/); - - push @{$rms{$when}}, "\t-$rm\n"; - } - - $output_rules .= file_contents - ('clean', - new Automake::Location, - MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}), - CLEAN_RMS => join ('', sort @{$rms{&CLEAN}}), - DISTCLEAN_RMS => join ('', sort @{$rms{&DIST_CLEAN}}), - MAINTAINER_CLEAN_RMS => join ('', sort @{$rms{&MAINTAINER_CLEAN}}), - MAKEFILE => basename $makefile, - ); -} - - -# Subroutine for handle_factored_dependencies() to let '.PHONY' and -# other '.TARGETS' be last. This is meant to be used as a comparison -# subroutine passed to the sort built-int. -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; -} - - -# 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', - 'uninstall-dvi-local', - 'uninstall-html-local', - 'uninstall-info-local', - 'uninstall-pdf-local', - 'uninstall-ps-local') - { - my $x = $utarg; - $x =~ s/-.*-/-/; - reject_rule ($utarg, "use '$x', not '$utarg'"); - } - - reject_rule ('install-local', - "use 'install-data-local' or 'install-exec-local', " - . "not 'install-local'"); - - reject_rule ('install-hook', - "use 'install-data-hook' or 'install-exec-hook', " - . "not 'install-hook'"); - - # Install the -local hooks. - foreach (keys %dependencies) - { - # Hooks are installed on the -am targets. - s/-am$// or next; - depend ("$_-am", "$_-local") - if user_phony_rule "$_-local"; - } - - # Install the -hook hooks. - # FIXME: Why not be as liberal as we are with -local hooks? - foreach ('install-exec', 'install-data', 'uninstall') - { - if (user_phony_rule "$_-hook") - { - depend ('.MAKE', "$_-am"); - register_action("$_-am", - ("\t\@\$(NORMAL_INSTALL)\n" - . "\t\$(MAKE) \$(AM_MAKEFLAGS) $_-hook")); - } - } - - # All the required targets are phony. - depend ('.PHONY', keys %required_targets); - - # Actually output gathered targets. - foreach (sort target_cmp keys %dependencies) - { - # If there is nothing about this guy, skip it. - next - unless (@{$dependencies{$_}} - || $actions{$_} - || $required_targets{$_}); - - # Define gathered targets in undefined conditions. - # FIXME: Right now we must handle .PHONY as an exception, - # because people write things like - # .PHONY: myphonytarget - # to append dependencies. This would not work if Automake - # refrained from defining its own .PHONY target as it does - # with other overridden targets. - # 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"; - } - } -} - - -sub handle_tests_dejagnu () -{ - push (@check_tests, 'check-DEJAGNU'); - $output_rules .= file_contents ('dejagnu', new Automake::Location); -} - -# handle_per_suffix_test ($TEST_SUFFIX, [%TRANSFORM]) -#---------------------------------------------------- -sub handle_per_suffix_test -{ - my ($test_suffix, %transform) = @_; - my ($pfx, $generic, $am_exeext); - if ($test_suffix eq '') - { - $pfx = ''; - $generic = 0; - $am_exeext = 'FALSE'; - } - else - { - prog_error ("test suffix '$test_suffix' lacks leading dot") - unless $test_suffix =~ m/^\.(.*)/; - $pfx = uc ($1) . '_'; - $generic = 1; - $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT' - : 'FALSE'; - } - # The "test driver" program, deputed to handle tests protocol used by - # test scripts. By default, it's assumed that no protocol is used, so - # we fall back to the old behaviour, implemented by the 'test-driver' - # auxiliary script. - if (! var "${pfx}LOG_DRIVER") - { - require_conf_file ("parallel-tests", FOREIGN, 'test-driver'); - define_variable ("${pfx}LOG_DRIVER", - "\$(SHELL) $am_config_aux_dir/test-driver", - INTERNAL); - } - my $driver = '$(' . $pfx . 'LOG_DRIVER)'; - my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)' - . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)'; - my $compile = "${pfx}LOG_COMPILE"; - define_variable ($compile, - '$(' . $pfx . 'LOG_COMPILER)' - . ' $(AM_' . $pfx . 'LOG_FLAGS)' - . ' $(' . $pfx . 'LOG_FLAGS)', - INTERNAL); - $output_rules .= file_contents ('check2', new Automake::Location, - GENERIC => $generic, - DRIVER => $driver, - DRIVER_FLAGS => $driver_flags, - COMPILE => '$(' . $compile . ')', - EXT => $test_suffix, - am__EXEEXT => $am_exeext, - %transform); -} - -# is_valid_test_extension ($EXT) -# ------------------------------ -# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false -# otherwise. -sub is_valid_test_extension -{ - my $ext = shift; - return 1 - if ($ext =~ /^\.[a-zA-Z_][a-zA-Z0-9_]*$/); - return 1 - if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT')); - return 0; -} - - -sub handle_tests () -{ - if (option 'dejagnu') - { - handle_tests_dejagnu; - } - else - { - foreach my $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS') - { - reject_var ($c, "'$c' defined but 'dejagnu' not in " - . "'AUTOMAKE_OPTIONS'"); - } - } - - if (var ('TESTS')) - { - push (@check_tests, 'check-TESTS'); - my $check_deps = "@check"; - $output_rules .= file_contents ('check', new Automake::Location, - SERIAL_TESTS => !! option 'serial-tests', - CHECK_DEPS => $check_deps); - - # Tests that are known programs should have $(EXEEXT) appended. - # For matching purposes, we need to adjust XFAIL_TESTS as well. - append_exeext { exists $known_programs{$_[0]} } 'TESTS'; - append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS' - if (var ('XFAIL_TESTS')); - - if (! option 'serial-tests') - { - define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL); - my $suff = '.test'; - my $at_exeext = ''; - my $handle_exeext = exists $configure_vars{'EXEEXT'}; - if ($handle_exeext) - { - $at_exeext = subst ('EXEEXT'); - $suff = $at_exeext . ' ' . $suff; - } - if (! var 'TEST_EXTENSIONS') - { - define_variable ('TEST_EXTENSIONS', $suff, INTERNAL); - } - my $var = var 'TEST_EXTENSIONS'; - # Currently, we are not able to deal with conditional contents - # in TEST_EXTENSIONS. - if ($var->has_conditional_contents) - { - msg_var 'unsupported', $var, - "'TEST_EXTENSIONS' cannot have conditional contents"; - } - my @test_suffixes = $var->value_as_list_recursive; - if ((my @invalid_test_suffixes = - grep { !is_valid_test_extension $_ } @test_suffixes) > 0) - { - error $var->rdef (TRUE)->location, - "invalid test extensions: @invalid_test_suffixes"; - } - @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes; - if ($handle_exeext) - { - unshift (@test_suffixes, $at_exeext) - unless $test_suffixes[0] eq $at_exeext; - } - unshift (@test_suffixes, ''); - - transform_variable_recursively - ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL, - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - my $obj = $val; - return $obj - if $val =~ /^\@.*\@$/; - $obj =~ s/\$\(EXEEXT\)$//o; - - if ($val =~ /(\$\((top_)?srcdir\))\//o) - { - msg ('error', $subvar->rdef ($cond)->location, - "using '$1' in TESTS is currently broken: '$val'"); - } - - foreach my $test_suffix (@test_suffixes) - { - next - if $test_suffix eq $at_exeext || $test_suffix eq ''; - return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log' - if substr ($obj, - length ($test_suffix)) eq $test_suffix; - } - my $base = $obj; - $obj .= '.log'; - handle_per_suffix_test ('', - OBJ => $obj, - BASE => $base, - SOURCE => $val); - return $obj; - }); - - my $nhelper=1; - my $prev = 'TESTS'; - my $post = ''; - my $last_suffix = $test_suffixes[$#test_suffixes]; - my $cur = ''; - foreach my $test_suffix (@test_suffixes) - { - if ($test_suffix eq $last_suffix) - { - $cur = 'TEST_LOGS'; - } - else - { - $cur = 'am__test_logs' . $nhelper; - } - define_variable ($cur, - '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL); - $post = '.log'; - $prev = $cur; - $nhelper++; - if ($test_suffix ne $at_exeext && $test_suffix ne '') - { - handle_per_suffix_test ($test_suffix, - OBJ => '', - BASE => '$*', - SOURCE => '$<'); - } - } - $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN; - } - } -} - -sub handle_emacs_lisp () -{ - my @elfiles = am_install_var ('-candist', 'lisp', 'LISP', - 'lisp', 'noinst'); - - return if ! @elfiles; - - define_pretty_variable ('am__ELFILES', TRUE, INTERNAL, - map { $_->[1] } @elfiles); - define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL, - '$(am__ELFILES:.el=.elc)'); - # This one can be overridden by users. - define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(LISP:.el=.elc)'); - - push @all, '$(ELCFILES)'; - - require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE, - 'EMACS', 'lispdir'); -} - -sub handle_python () -{ - my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON', - 'noinst'); - return if ! @pyfiles; - - require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON'); - require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile'); - define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL); -} - -sub handle_java () -{ - my @sourcelist = am_install_var ('-candist', - 'java', 'JAVA', - 'noinst', 'check'); - return if ! @sourcelist; - - my @prefixes = am_primary_prefixes ('JAVA', 1, - 'noinst', 'check'); - - my $dir; - my @java_sources = (); - foreach my $prefix (@prefixes) - { - (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//; - - next - if $curs eq 'EXTRA'; - - push @java_sources, '$(' . $prefix . '_JAVA' . ')'; - - if (defined $dir) - { - err_var "${curs}_JAVA", "multiple _JAVA primaries in use" - unless $curs eq $dir; - } - - $dir = $curs; - } - - define_pretty_variable ('am__java_sources', TRUE, INTERNAL, - "@java_sources"); - - if ($dir eq 'check') - { - push (@check, "class$dir.stamp"); - } - else - { - push (@all, "class$dir.stamp"); - } -} - - -sub handle_minor_options () -{ - if (option 'readme-alpha') - { - if ($relative_dir eq '.') - { - if ($package_version !~ /^$GNITS_VERSION_PATTERN$/) - { - msg ('error-gnits', $package_version_location, - "version '$package_version' doesn't follow " . - "Gnits standards"); - } - if (defined $1 && -f 'README-alpha') - { - # This means we have an alpha release. See - # GNITS_VERSION_PATTERN for details. - push_dist_common ('README-alpha'); - } - } - } -} - -################################################################ - -# ($OUTPUT, @INPUTS) -# split_config_file_spec ($SPEC) -# ------------------------------ -# Decode the Autoconf syntax for config files (files, headers, links -# etc.). -sub split_config_file_spec -{ - my ($spec) = @_; - my ($output, @inputs) = split (/:/, $spec); - - push @inputs, "$output.in" - unless @inputs; - - return ($output, @inputs); -} - -# $input -# locate_am (@POSSIBLE_SOURCES) -# ----------------------------- -# AC_CONFIG_FILES allow specifications such as Makefile:top.in:mid.in:bot.in -# This functions returns the first *.in file for which a *.am exists. -# It returns undef otherwise. -sub locate_am -{ - my (@rest) = @_; - my $input; - foreach my $file (@rest) - { - if (($file =~ /^(.*)\.in$/) && -f "$1.am") - { - $input = $file; - last; - } - } - return $input; -} - -my %make_list; - -# scan_autoconf_config_files ($WHERE, $CONFIG-FILES) -# -------------------------------------------------- -# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES -# (or AC_OUTPUT). -sub scan_autoconf_config_files -{ - my ($where, $config_files) = @_; - - # Look at potential Makefile.am's. - foreach (split ' ', $config_files) - { - # Must skip empty string for Perl 4. - next if $_ eq "\\" || $_ eq ''; - - # Handle $local:$input syntax. - my ($local, @rest) = split (/:/); - @rest = ("$local.in",) unless @rest; - # Keep in sync with test 'conffile-leading-dot.sh'. - msg ('unsupported', $where, - "omit leading './' from config file names such as '$local';" - . "\nremake rules might be subtly broken otherwise") - if ($local =~ /^\.\//); - my $input = locate_am @rest; - if ($input) - { - # We have a file that automake should generate. - $make_list{$input} = join (':', ($local, @rest)); - } - else - { - # We have a file that automake should cause to be - # rebuilt, but shouldn't generate itself. - push (@other_input_files, $_); - } - $ac_config_files_location{$local} = $where; - $ac_config_files_condition{$local} = - new Automake::Condition (@cond_stack) - if (@cond_stack); - } -} - - -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_FC_SRCEXT => 1, - AC_INIT => 0, - AC_LIBSOURCE => 1, - AC_REQUIRE_AUX_FILE => 1, - AC_SUBST_TRACE => 1, - AM_AUTOMAKE_VERSION => 1, - AM_PROG_MKDIR_P => 0, - AM_CONDITIONAL => 2, - AM_EXTRA_RECURSIVE_TARGETS => 1, - AM_GNU_GETTEXT => 0, - AM_GNU_GETTEXT_INTL_SUBDIR => 0, - AM_INIT_AUTOMAKE => 0, - AM_MAINTAINER_MODE => 0, - AM_PROG_AR => 0, - _AM_SUBST_NOTMAKE => 1, - _AM_COND_IF => 1, - _AM_COND_ELSE => 1, - _AM_COND_ENDIF => 1, - LT_SUPPORTED_TAG => 1, - _LT_AC_TAGCONFIG => 0, - m4_include => 1, - m4_sinclude => 1, - sinclude => 1, - ); - - 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::\$d::\$n::\${::}%' } - (keys %traced)); - - my $tracefh = new Automake::XFile ("$traces $filename |"); - verb "reading $traces"; - - @cond_stack = (); - my $where; - - while ($_ = $tracefh->getline) - { - chomp; - my ($here, $depth, @args) = split (/::/); - $where = new Automake::Location $here; - my $macro = $args[0]; - - prog_error ("unrequested trace '$macro'") - unless exists $traced{$macro}; - - # Skip and diagnose malformed calls. - if ($#args < $traced{$macro}) - { - msg ('syntax', $where, "not enough arguments for $macro"); - next; - } - - # Alphabetical ordering please. - if ($macro eq 'AC_CANONICAL_BUILD') - { - if ($seen_canonical <= AC_CANONICAL_BUILD) - { - $seen_canonical = AC_CANONICAL_BUILD; - } - } - elsif ($macro eq 'AC_CANONICAL_HOST') - { - if ($seen_canonical <= AC_CANONICAL_HOST) - { - $seen_canonical = AC_CANONICAL_HOST; - } - } - elsif ($macro eq 'AC_CANONICAL_TARGET') - { - $seen_canonical = AC_CANONICAL_TARGET; - } - 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; - check_directory ($config_aux_dir, $where); - } - elsif ($macro eq 'AC_CONFIG_FILES') - { - # Look at potential Makefile.am's. - scan_autoconf_config_files ($where, $args[1]); - } - elsif ($macro eq 'AC_CONFIG_HEADERS') - { - foreach my $spec (split (' ', $args[1])) - { - my ($dest, @src) = split (':', $spec); - $ac_config_files_location{$dest} = $where; - push @config_headers, $spec; - } - } - elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR') - { - $config_libobj_dir = $args[1]; - 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; - } - } - elsif ($macro eq 'AC_FC_SRCEXT') - { - my $suffix = $args[1]; - # These flags are used as %SOURCEFLAG% in depend2.am, - # where the trailing space is important. - $sourceflags{'.' . $suffix} = '$(FCFLAGS_' . $suffix . ') ' - if ($suffix eq 'f90' || $suffix eq 'f95' || $suffix eq 'f03' || $suffix eq 'f08'); - } - elsif ($macro eq 'AC_INIT') - { - if (defined $args[2]) - { - $package_version = $args[2]; - $package_version_location = $where; - } - } - elsif ($macro eq 'AC_LIBSOURCE') - { - $libsources{$args[1]} = $here; - } - elsif ($macro eq 'AC_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') - { - # Just check for alphanumeric in AC_SUBST_TRACE. If you do - # AC_SUBST(5), then too bad. - $configure_vars{$args[1]} = $where - if $args[1] =~ /^\w+$/; - } - elsif ($macro eq 'AM_AUTOMAKE_VERSION') - { - error ($where, - "version mismatch. This is Automake $VERSION,\n" . - "but the definition used by this AM_INIT_AUTOMAKE\n" . - "comes from Automake $args[1]. You should recreate\n" . - "aclocal.m4 with aclocal and run automake again.\n", - # $? = 63 is used to indicate version mismatch to missing. - exit_code => 63) - if $VERSION ne $args[1]; - - $seen_automake_version = 1; - } - elsif ($macro eq 'AM_PROG_MKDIR_P') - { - msg 'obsolete', $where, <<'EOF'; -The 'AM_PROG_MKDIR_P' macro is deprecated, and its use is discouraged. -You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead, -and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files. -EOF - } - elsif ($macro eq 'AM_CONDITIONAL') - { - $configure_cond{$args[1]} = $where; - } - elsif ($macro eq 'AM_EXTRA_RECURSIVE_TARGETS') - { - # Empty leading/trailing fields might be produced by split, - # hence the grep is really needed. - push @extra_recursive_targets, - grep (/./, (split /\s+/, $args[1])); - } - elsif ($macro eq 'AM_GNU_GETTEXT') - { - $seen_gettext = $where; - $ac_gettext_location = $where; - $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; - if (defined $args[2]) - { - msg 'obsolete', $where, <<'EOF'; -AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see: -http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation -EOF - $package_version = $args[2]; - $package_version_location = $where; - } - elsif (defined $args[1]) - { - my @opts = split (' ', $args[1]); - @opts = map { { option => $_, where => $where } } @opts; - exit $exit_code unless process_global_option_list (@opts); - } - } - elsif ($macro eq 'AM_MAINTAINER_MODE') - { - $seen_maint_mode = $where; - } - elsif ($macro eq 'AM_PROG_AR') - { - $seen_ar = $where; - } - elsif ($macro eq '_AM_COND_IF') - { - cond_stack_if ('', $args[1], $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - elsif ($macro eq '_AM_COND_ELSE') - { - cond_stack_else ('!', $args[1], $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - elsif ($macro eq '_AM_COND_ENDIF') - { - cond_stack_endif (undef, undef, $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - 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); - } - } - } - - error ($where, "condition stack not properly closed") - if (@cond_stack); - - $tracefh->close; -} - - -# Check whether we use 'configure.ac' or 'configure.in'. -# Scan it (and possibly 'aclocal.m4') for interesting things. -# We must scan aclocal.m4 because there might be AC_SUBSTs and such there. -sub scan_autoconf_files () -{ - # Reinitialize libsources here. This isn't really necessary, - # since we currently assume there is only one configure.ac. But - # that won't always be the case. - %libsources = (); - - # Keep track of the youngest configure dependency. - $configure_deps_greatest_timestamp = mtime $configure_ac; - if (-e 'aclocal.m4') - { - my $mtime = mtime 'aclocal.m4'; - $configure_deps_greatest_timestamp = $mtime - if $mtime > $configure_deps_greatest_timestamp; - } - - scan_autoconf_traces ($configure_ac); - - @configure_input_files = sort keys %make_list; - # Set input and output files if not specified by user. - if (! @input_files) - { - @input_files = @configure_input_files; - %output_files = %make_list; - } - - - if (! $seen_init_automake) - { - err_ac ("no proper invocation of AM_INIT_AUTOMAKE was found.\nYou " - . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE," - . "\nthat aclocal.m4 is present in the top-level directory,\n" - . "and that aclocal.m4 was recently regenerated " - . "(using aclocal)"); - } - else - { - if (! $seen_automake_version) - { - if (-f 'aclocal.m4') - { - error ($seen_init_automake, - "your implementation of AM_INIT_AUTOMAKE comes from " . - "an\nold Automake version. You should recreate " . - "aclocal.m4\nwith aclocal and run automake again", - # $? = 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"); - } - } - } - - locate_aux_dir (); - - # 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 - # push_required_file to work. - # Sort the files for stable verbose output. - $relative_dir = '.'; - foreach my $file (sort 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'; - - # Preserve dist_common for later. - $configure_dist_common = variable_value ('DIST_COMMON') || ''; - -} - -################################################################ - -# Do any extra checking for GNU standards. -sub check_gnu_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNU, - qw/INSTALL NEWS README AUTHORS ChangeLog/); - - # Accept one of these three licenses; default to COPYING. - # Make sure we do not overwrite an existing license. - my $license; - foreach (qw /COPYING COPYING.LIB COPYING.LESSER/) - { - if (-f $_) - { - $license = $_; - last; - } - } - require_file ("$am_file.am", GNU, 'COPYING') - unless $license; - } - - for my $opt ('no-installman', 'no-installinfo') - { - msg ('error-gnu', option $opt, - "option '$opt' disallowed by GNU standards") - if option $opt; - } -} - -# Do any extra checking for GNITS standards. -sub check_gnits_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNITS, 'THANKS'); - } -} - -################################################################ -# -# Functions to handle files of each language. - -# Each 'lang_X_rewrite($DIRECTORY, $BASE, $EXT)' function follows a -# simple formula: Return value is LANG_SUBDIR if the resulting object -# file should be in a subdir if the source file is, LANG_PROCESS if -# file is to be dealt with, LANG_IGNORE otherwise. - -# Much of the actual processing is handled in -# handle_single_transform. These functions exist so that -# auxiliary information can be recorded for a later cleanup pass. -# Note that the calls to these functions are computed, so don't bother -# searching for their precise names in the source. - -# This is just a convenience function that can be used to determine -# when a subdir object should be used. -sub lang_sub_obj () -{ - return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS; -} - -# Rewrite a single header file. -sub lang_header_rewrite -{ - # Header files are simply ignored. - return LANG_IGNORE; -} - -# Rewrite a single Vala source file. -sub lang_vala_rewrite -{ - my ($directory, $base, $ext) = @_; - - (my $newext = $ext) =~ s/vala$/c/; - return (LANG_SUBDIR, $newext); -} - -# Rewrite a single yacc/yacc++ file. -sub lang_yacc_rewrite -{ - my ($directory, $base, $ext) = @_; - - my $r = lang_sub_obj; - (my $newext = $ext) =~ tr/y/c/; - return ($r, $newext); -} -sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); }; - -# Rewrite a single lex/lex++ file. -sub lang_lex_rewrite -{ - my ($directory, $base, $ext) = @_; - - my $r = lang_sub_obj; - (my $newext = $ext) =~ tr/l/c/; - return ($r, $newext); -} -sub lang_lexxx_rewrite { lang_lex_rewrite (@_); }; - -# 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_vala_finish_target -{ - my ($self, $name) = @_; - - my $derived = canonicalize ($name); - my $var = var "${derived}_SOURCES"; - return unless $var; - - my @vala_sources = grep { /\.(vala|vapi)$/ } ($var->value_as_list_recursive); - - # For automake bug#11229. - return unless @vala_sources; - - foreach my $vala_file (@vala_sources) - { - my $c_file = $vala_file; - if ($c_file =~ s/(.*)\.vala$/$1.c/) - { - $c_file = "\$(srcdir)/$c_file"; - $output_rules .= "$c_file: \$(srcdir)/${derived}_vala.stamp\n" - . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n" - . "\t\@if test -f \$@; then :; else \\\n" - . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n" - . "\tfi\n"; - $clean_files{$c_file} = MAINTAINER_CLEAN; - } - } - - # Add rebuild rules for generated header and vapi files - my $flags = var ($derived . '_VALAFLAGS'); - if ($flags) - { - my $lastflag = ''; - foreach my $flag ($flags->value_as_list_recursive) - { - if (grep (/$lastflag/, ('-H', '-h', '--header', '--internal-header', - '--vapi', '--internal-vapi', '--gir'))) - { - my $headerfile = "\$(srcdir)/$flag"; - $output_rules .= "$headerfile: \$(srcdir)/${derived}_vala.stamp\n" - . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n" - . "\t\@if test -f \$@; then :; else \\\n" - . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n" - . "\tfi\n"; - - # valac is not used when building from dist tarballs - # distribute the generated files - push_dist_common ($headerfile); - $clean_files{$headerfile} = MAINTAINER_CLEAN; - } - $lastflag = $flag; - } - } - - my $compile = $self->compile; - - # Rewrite each occurrence of 'AM_VALAFLAGS' in the compile - # rule into '${derived}_VALAFLAGS' if it exists. - my $val = "${derived}_VALAFLAGS"; - $compile =~ s/\(AM_VALAFLAGS\)/\($val\)/ - if set_seen ($val); - - # VALAFLAGS is a user variable (per GNU Standards), - # it should not be overridden in the Makefile... - check_user_variables 'VALAFLAGS'; - - my $dirname = dirname ($name); - - # Only generate C code, do not run C compiler - $compile .= " -C"; - - my $verbose = verbose_flag ('VALAC'); - my $silent = silent_flag (); - my $stampfile = "\$(srcdir)/${derived}_vala.stamp"; - - $output_rules .= - "\$(srcdir)/${derived}_vala.stamp: @vala_sources\n". -# Since the C files generated from the vala sources depend on the -# ${derived}_vala.stamp file, we must ensure its timestamp is older than -# those of the C files generated by the valac invocation below (this is -# especially important on systems with sub-second timestamp resolution). -# Thus we need to create the stamp file *before* invoking valac, and to -# move it to its final location only after valac has been invoked. - "\t${silent}rm -f \$\@ && echo stamp > \$\@-t\n". - "\t${verbose}\$(am__cd) \$(srcdir) && $compile @vala_sources\n". - "\t${silent}mv -f \$\@-t \$\@\n"; - - push_dist_common ($stampfile); - - $clean_files{$stampfile} = MAINTAINER_CLEAN; -} - -# Add output rules to invoke valac and create stamp file as a witness -# to handle multiple outputs. This function is called after all source -# file processing is done. -sub lang_vala_finish () -{ - my ($self) = @_; - - foreach my $prog (keys %known_programs) - { - lang_vala_finish_target ($self, $prog); - } - - while (my ($name) = each %known_libraries) - { - lang_vala_finish_target ($self, $name); - } -} - -# The built .c files should be cleaned only on maintainer-clean -# as the .c files are distributed. This function is called for each -# .vala source file. -sub lang_vala_target_hook -{ - my ($self, $aggregate, $output, $input, %transform) = @_; - - $clean_files{$output} = MAINTAINER_CLEAN; -} - -# This is a yacc helper which is called whenever we have decided to -# compile a yacc file. -sub lang_yacc_target_hook -{ - my ($self, $aggregate, $output, $input, %transform) = @_; - - # If some relevant *YFLAGS variable contains the '-d' flag, we'll - # have to to generate special code. - my $yflags_contains_minus_d = 0; - - foreach my $pfx ("", "${aggregate}_") - { - my $yflagsvar = var ("${pfx}YFLAGS"); - next unless $yflagsvar; - # We cannot work reliably with conditionally-defined YFLAGS. - if ($yflagsvar->has_conditional_contents) - { - msg_var ('unsupported', $yflagsvar, - "'${pfx}YFLAGS' cannot have conditional contents"); - } - else - { - $yflags_contains_minus_d = 1 - if grep (/^-d$/, $yflagsvar->value_as_list_recursive); - } - } - - if ($yflags_contains_minus_d) - { - # 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. - - # The extension of the output file (e.g., '.c' or '.cxx'). - # We'll need it to compute the name of the generated header file. - (my $output_ext = basename ($output)) =~ s/.*(\.[^.]+)$/$1/; - - # We know that a yacc input should be turned into either a C or - # C++ output file. We depend on this fact (here and in yacc.am), - # so check that it really holds. - my $lang = $languages{$extension_map{$output_ext}}; - prog_error "invalid output name '$output' for yacc file '$input'" - if (!$lang || ($lang->name ne 'c' && $lang->name ne 'cxx')); - - (my $header_ext = $output_ext) =~ s/c/h/g; - # Quote $output_ext in the regexp, so that dots in it are taken - # as literal dots, not as metacharacters. - (my $header = $output) =~ s/\Q$output_ext\E$/$header_ext/; - - 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 rm -f $output; else :; fi\n" - . "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; 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'}; - - # The GNU rules say that yacc/lex output files should be removed - # by maintainer-clean. However, if the files are not distributed, - # then we want to remove them with "make clean"; otherwise, - # "make distcheck" will fail. - $clean_files{$header} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN; - } - # See the comment above for $HEADER. - $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : 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, %transform) = @_; - # The GNU rules say that yacc/lex output files should be removed - # by maintainer-clean. However, if the files are not distributed, - # then we want to remove them with "make clean"; otherwise, - # "make distcheck" will fail. - $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : 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; - - # FIXME: for now, no line number. - require_conf_file ($configure_ac, FOREIGN, 'ylwrap'); - define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL); -} - -sub lang_yacc_finish () -{ - return if defined $language_scratch{'yacc-done'}; - $language_scratch{'yacc-done'} = 1; - - reject_var 'YACCFLAGS', "'YACCFLAGS' obsolete; use 'YFLAGS' instead"; - - yacc_lex_finish_helper; -} - - -sub lang_lex_finish () -{ - return if defined $language_scratch{'lex-done'}; - $language_scratch{'lex-done'} = 1; - - yacc_lex_finish_helper; -} - - -# 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 OBJCXXLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK)) - { - return $l if defined $linkers{$l}; - } - return 'LINK'; -} - -# Called to indicate that an extension was used. -sub saw_extension -{ - my ($ext) = @_; - $extension_seen{$ext} = 1; -} - -# register_language (%ATTRIBUTE) -# ------------------------------ -# Register a single language. -# Each %ATTRIBUTE is of the form ATTRIBUTE => VALUE. -sub register_language -{ - my (%option) = @_; - - # Set the defaults. - $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'}; - $option{'nodist_specific'} = 0 - unless defined $option{'nodist_specific'}; - - my $lang = new Automake::Language (%option); - - # Fill indexes. - $extension_map{$_} = $lang->name foreach @{$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}); - - # Update the suffix rules map. - foreach my $suffix (@{$lang->extensions}) - { - foreach my $dest ($lang->output_extensions->($suffix)) - { - register_suffix_rule (INTERNAL, $suffix, $dest); - } - } -} - -# derive_suffix ($EXT, $OBJ) -# -------------------------- -# This function is used to find a path from a user-specified suffix $EXT -# to $OBJ or to some other suffix we recognize internally, e.g. 'cc'. -sub derive_suffix -{ - my ($source_ext, $obj) = @_; - - while (!$extension_map{$source_ext} && $source_ext ne $obj) - { - my $new_source_ext = next_in_suffix_chain ($source_ext, $obj); - last if not defined $new_source_ext; - $source_ext = $new_source_ext; - } - - return $source_ext; -} - - -# Pretty-print something and append to '$output_rules'. -sub pretty_print_rule -{ - $output_rules .= makefile_wrap (shift, shift, @_); -} - - -################################################################ - - -## -------------------------------- ## -## Handling the conditional stack. ## -## -------------------------------- ## - - -# $STRING -# make_conditional_string ($NEGATE, $COND) -# ---------------------------------------- -sub make_conditional_string -{ - my ($negate, $cond) = @_; - $cond = "${cond}_TRUE" - unless $cond =~ /^TRUE|FALSE$/; - $cond = Automake::Condition::conditional_negate ($cond) - if $negate; - return $cond; -} - - -my %_am_macro_for_cond = - ( - AMDEP => "one of the compiler tests\n" - . " AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,\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__fastdepOBJCXX => 'AC_PROG_OBJCXX', - am__fastdepUPC => 'AM_PROG_UPC' - ); - -# $COND -# cond_stack_if ($NEGATE, $COND, $WHERE) -# -------------------------------------- -sub cond_stack_if -{ - my ($negate, $cond, $where) = @_; - - if (! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/) - { - 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; - } - error $where, $text, uniq_scope => $scope; - } - - push (@cond_stack, make_conditional_string ($negate, $cond)); - - return new Automake::Condition (@cond_stack); -} - - -# $COND -# cond_stack_else ($NEGATE, $COND, $WHERE) -# ---------------------------------------- -sub cond_stack_else -{ - my ($negate, $cond, $where) = @_; - - if (! @cond_stack) - { - error $where, "else without if"; - return FALSE; - } - - $cond_stack[$#cond_stack] = - Automake::Condition::conditional_negate ($cond_stack[$#cond_stack]); - - # If $COND is given, check against it. - if (defined $cond) - { - $cond = make_conditional_string ($negate, $cond); - - error ($where, "else reminder ($negate$cond) incompatible with " - . "current conditional: $cond_stack[$#cond_stack]") - if $cond_stack[$#cond_stack] ne $cond; - } - - return new Automake::Condition (@cond_stack); -} - - -# $COND -# cond_stack_endif ($NEGATE, $COND, $WHERE) -# ----------------------------------------- -sub cond_stack_endif -{ - my ($negate, $cond, $where) = @_; - my $old_cond; - - if (! @cond_stack) - { - error $where, "endif without if"; - return TRUE; - } - - # If $COND is given, check against it. - if (defined $cond) - { - $cond = make_conditional_string ($negate, $cond); - - error ($where, "endif reminder ($negate$cond) incompatible with " - . "current conditional: $cond_stack[$#cond_stack]") - if $cond_stack[$#cond_stack] ne $cond; - } - - pop @cond_stack; - - return new Automake::Condition (@cond_stack); -} - - - - - -## ------------------------ ## -## Handling the variables. ## -## ------------------------ ## - - -# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE) -# ---------------------------------------------------- -# Like define_variable, but the value is a list, and the variable may -# be defined conditionally. The second argument is the condition -# under which the value should be defined; this should be the empty -# string to define the variable unconditionally. The third argument -# is a list holding the values to use for the variable. The value is -# pretty printed in the output file. -sub define_pretty_variable -{ - my ($var, $cond, $where, @value) = @_; - - if (! vardef ($var, $cond)) - { - Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value", - '', $where, VAR_PRETTY); - rvar ($var)->rdef ($cond)->set_seen; - } -} - - -# define_variable ($VAR, $VALUE, $WHERE) -# -------------------------------------- -# Define a new 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 ($\@$$) -{ - my ($var, $basename, $extension, $where) = @_; - define_variable ($var, - join (' ', map { "$_.$extension" } @$basename), - $where); -} - - -# Like define_variable, but define a variable to be the configure -# substitution by the same name. -sub define_configure_variable -{ - my ($var) = @_; - # 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 `\`. - my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS; - Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var), - '', $configure_vars{$var}, $pretty); -} - - -# define_compiler_variable ($LANG) -# -------------------------------- -# Define a compiler variable. We also handle defining the 'LT' -# version of the command when using libtool. -sub define_compiler_variable -{ - my ($lang) = @_; - - my ($var, $value) = ($lang->compiler, $lang->compile); - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; - define_variable ($var, $value, INTERNAL); - if (var ('LIBTOOL')) - { - my $verbose = define_verbose_libtool (); - define_variable ("LT$var", - "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)" - . " \$(LIBTOOLFLAGS) --mode=compile $value", - INTERNAL); - } - define_verbose_tagvar ($lang->ccer || 'GEN'); -} - - -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}; - # CCLD = $(CC). - define_variable ($lang->lder, $lang->ld, INTERNAL); - # CCLINK = $(CCLD) blah blah... - my $link = ''; - if (var ('LIBTOOL')) - { - my $verbose = define_verbose_libtool (); - $link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) " - . "\$(LIBTOOLFLAGS) --mode=link "; - } - define_variable ($lang->linker, $link . $lang->link, INTERNAL); - define_variable ($lang->compiler, $lang, INTERNAL); - define_verbose_tagvar ($lang->lder || 'GEN'); -} - -sub define_per_target_linker_variable -{ - my ($linker, $target) = @_; - - # If the user wrote a custom link command, we don't define ours. - return "${target}_LINK" - if set_seen "${target}_LINK"; - - my $xlink = $linker ? $linker : 'LINK'; - - my $lang = $link_languages{$xlink}; - prog_error "Unknown language for linker variable '$xlink'" - unless $lang; - - my $link_command = $lang->link; - if (var 'LIBTOOL') - { - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; - - my $verbose = define_verbose_libtool (); - $link_command = - "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) " - . "--mode=link " . $link_command; - } - - # 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) - { - my $val = "${target}_$flag"; - $link_command =~ s/\(AM_$flag\)/\($val\)/ - if set_seen ($val); - } - - # If the computed command is the same as the generic command, use - # the command linker variable. - return ($lang->linker, $lang->lder) - if $link_command eq $orig_command; - - define_variable ("${target}_LINK", $link_command, INTERNAL); - return ("${target}_LINK", $lang->lder); -} - -################################################################ - -# check_trailing_slash ($WHERE, $LINE) -# ------------------------------------ -# Return 1 iff $LINE ends with a slash. -# Might modify $LINE. -sub check_trailing_slash ($\$) -{ - my ($where, $line) = @_; - - # Ignore '##' lines. - return 0 if $$line =~ /$IGNORE_PATTERN/o; - - # Catch and fix a common error. - msg "syntax", $where, "whitespace following trailing backslash" - if $$line =~ s/\\\s+\n$/\\\n/; - - return $$line =~ /\\$/; -} - - -# read_am_file ($AMFILE, $WHERE, $RELDIR) -# --------------------------------------- -# Read Makefile.am and set up %contents. Simultaneously copy lines -# from Makefile.am into $output_trailer, or define variables as -# appropriate. NOTE we put rules in the trailer section. We want -# user rules to come after our generated stuff. -sub read_am_file -{ - my ($amfile, $where, $reldir) = @_; - my $canon_reldir = &canonicalize ($reldir); - - my $am_file = new Automake::XFile ("< $amfile"); - verb "reading $amfile"; - - # Keep track of the youngest output dependency. - my $mtime = mtime $amfile; - $output_deps_greatest_timestamp = $mtime - if $mtime > $output_deps_greatest_timestamp; - - my $spacing = ''; - my $comment = ''; - my $blank = 0; - my $saw_bk = 0; - my $var_look = VAR_ASIS; - - use constant IN_VAR_DEF => 0; - use constant IN_RULE_DEF => 1; - use constant IN_COMMENT => 2; - my $prev_state = IN_RULE_DEF; - - while ($_ = $am_file->getline) - { - $where->set ("$amfile:$."); - if (/$IGNORE_PATTERN/o) - { - # Merely delete comments beginning with two hashes. - } - elsif (/$WHITE_PATTERN/o) - { - error $where, "blank line following trailing backslash" - if $saw_bk; - # Stick a single white line before the incoming macro or rule. - $spacing = "\n"; - $blank = 1; - # Flush all comments seen so far. - if ($comment ne '') - { - $output_vars .= $comment; - $comment = ''; - } - } - elsif (/$COMMENT_PATTERN/o) - { - # Stick comments before the incoming macro or rule. Make - # sure a blank line precedes the first block of comments. - $spacing = "\n" unless $blank; - $blank = 1; - $comment .= $spacing . $_; - $spacing = ''; - $prev_state = IN_COMMENT; - } - else - { - last; - } - $saw_bk = check_trailing_slash ($where, $_); - } - - # We save the conditional stack on entry, and then check to make - # sure it is the same on exit. This lets us conditionally include - # other files. - my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); - - my $last_var_name = ''; - my $last_var_type = ''; - my $last_var_value = ''; - my $last_where; - # FIXME: shouldn't use $_ in this loop; it is too big. - while ($_) - { - $where->set ("$amfile:$."); - - # Make sure the line is \n-terminated. - chomp; - $_ .= "\n"; - - # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be - # used by users. @MAINT@ is an anachronism now. - $_ =~ s/\@MAINT\@//g - unless $seen_maint_mode; - - my $new_saw_bk = check_trailing_slash ($where, $_); - - if ($reldir eq '.') - { - # If present, eat the following '_' or '/', converting - # "%reldir%/foo" and "%canon_reldir%_foo" into plain "foo" - # when $reldir is '.'. - $_ =~ s,%(D|reldir)%/,,g; - $_ =~ s,%(C|canon_reldir)%_,,g; - } - $_ =~ s/%(D|reldir)%/${reldir}/g; - $_ =~ s/%(C|canon_reldir)%/${canon_reldir}/g; - - 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" - if $saw_bk; - } - elsif (/$COMMENT_PATTERN/o) - { - error $where, "comment following trailing backslash" - if $saw_bk && $prev_state != IN_COMMENT; - - # Stick comments before the incoming macro or rule. - $comment .= $spacing . $_; - $spacing = ''; - $prev_state = IN_COMMENT; - } - elsif ($saw_bk) - { - if ($prev_state == IN_RULE_DEF) - { - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - } - elsif ($prev_state == IN_COMMENT) - { - # If the line doesn't start with a '#', add it. - # We do this because a continued comment like - # # A = foo \ - # bar \ - # baz - # is not portable. BSD make doesn't honor - # escaped newlines in comments. - s/^#?/#/; - $comment .= $spacing . $_; - } - else # $prev_state == IN_VAR_DEF - { - $last_var_value .= ' ' - unless $last_var_value =~ /\s$/; - $last_var_value .= $_; - - if (!/\\$/) - { - Automake::Variable::define ($last_var_name, VAR_MAKEFILE, - $last_var_type, $cond, - $last_var_value, $comment, - $last_where, VAR_ASIS) - if $cond != FALSE; - $comment = $spacing = ''; - } - } - } - - elsif (/$IF_PATTERN/o) - { - $cond = cond_stack_if ($1, $2, $where); - } - elsif (/$ELSE_PATTERN/o) - { - $cond = cond_stack_else ($1, $2, $where); - } - elsif (/$ENDIF_PATTERN/o) - { - $cond = cond_stack_endif ($1, $2, $where); - } - - elsif (/$RULE_PATTERN/o) - { - # Found a rule. - $prev_state = IN_RULE_DEF; - - # For now we have to output all definitions of user rules - # and can't diagnose duplicates (see the comment in - # Automake::Rule::define). So we go on and ignore the return value. - Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where); - - check_variable_expansions ($_, $where); - - $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - $comment = $spacing = ''; - } - elsif (/$ASSIGNMENT_PATTERN/o) - { - # Found a macro definition. - $prev_state = IN_VAR_DEF; - $last_var_name = $1; - $last_var_type = $2; - $last_var_value = $3; - $last_where = $where->clone; - if ($3 ne '' && substr ($3, -1) eq "\\") - { - # We preserve the '\' because otherwise the long lines - # that are generated will be truncated by broken - # 'sed's. - $last_var_value = $3 . "\n"; - } - # Normally we try to output variable definitions in the - # same format they were input. However, POSIX compliant - # systems are not required to support lines longer than - # 2048 bytes (most notably, some sed implementation are - # limited to 4000 bytes, and sed is used by config.status - # to rewrite Makefile.in into Makefile). Moreover nobody - # would really write such long lines by hand since it is - # hardly maintainable. So if a line is longer that 1000 - # bytes (an arbitrary limit), assume it has been - # automatically generated by some tools, and flatten the - # variable definition. Otherwise, keep the variable as it - # as been input. - $var_look = VAR_PRETTY if length ($last_var_value) >= 1000; - - if (!/\\$/) - { - Automake::Variable::define ($last_var_name, VAR_MAKEFILE, - $last_var_type, $cond, - $last_var_value, $comment, - $last_where, $var_look) - if $cond != FALSE; - $comment = $spacing = ''; - $var_look = VAR_ASIS; - } - } - elsif (/$INCLUDE_PATTERN/o) - { - my $path = $1; - - if ($path =~ s/^\$\(top_srcdir\)\///) - { - push (@include_stack, "\$\(top_srcdir\)/$path"); - # Distribute any included file. - - # Always use the $(top_srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included - # file in the build tree during "make distdir" to satisfy - # the dependency. - # (subdir-am-cond.sh and subdir-ac-cond.sh will fail) - push_dist_common ("\$\(top_srcdir\)/$path"); - } - else - { - $path =~ s/\$\(srcdir\)\///; - push (@include_stack, "\$\(srcdir\)/$path"); - # Always use the $(srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included - # file in the build tree during "make distdir" to satisfy - # the dependency. - # (subdir-am-cond.sh and subdir-ac-cond.sh will fail) - push_dist_common ("\$\(srcdir\)/$path"); - $path = $relative_dir . "/" . $path if $relative_dir ne '.'; - } - my $new_reldir = File::Spec->abs2rel ($path, $relative_dir); - $new_reldir = '.' if $new_reldir !~ s,/[^/]*$,,; - $where->push_context ("'$path' included from here"); - read_am_file ($path, $where, $new_reldir); - $where->pop_context; - } - else - { - # This isn't an error; it is probably a continued rule. - # In fact, this is what we assume. - $prev_state = IN_RULE_DEF; - check_variable_expansions ($_, $where); - $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - $comment = $spacing = ''; - error $where, "'#' comment at start of rule is unportable" - if $_ =~ /^\t\s*\#/; - } - - $saw_bk = $new_saw_bk; - $_ = $am_file->getline; - } - - $output_trailer .= $comment; - - error ($where, "trailing backslash on last line") - if $saw_bk; - - error ($where, (@cond_stack ? "unterminated conditionals: @cond_stack" - : "too many conditionals closed in include file")) - if "@saved_cond_stack" ne "@cond_stack"; -} - - -# A helper for read_main_am_file which initializes configure variables -# and variables from header-vars.am. -sub define_standard_variables () -{ - my $saved_output_vars = $output_vars; - my ($comments, undef, $rules) = - file_contents_internal (1, "$libdir/am/header-vars.am", - new Automake::Location); - - foreach my $var (sort keys %configure_vars) - { - define_configure_variable ($var); - } - - $output_vars .= $comments . $rules; -} - - -# read_main_am_file ($MAKEFILE_AM, $MAKEFILE_IN) -# ---------------------------------------------- -sub read_main_am_file -{ - my ($amfile, $infile) = @_; - - # This supports the strange variable tricks we are about to play. - prog_error ("variable defined before read_main_am_file\n" . variables_dump ()) - if (scalar (variables) > 0); - - # Generate copyright header for generated Makefile.in. - # We do discard the output of predefined variables, handled below. - $output_vars = ("# " . basename ($infile) . " generated by automake " - . $VERSION . " from " . basename ($amfile) . ".\n"); - $output_vars .= '# ' . subst ('configure_input') . "\n"; - $output_vars .= $gen_copyright; - - # We want to predefine as many variables as possible. This lets - # the user set them with '+=' in Makefile.am. - define_standard_variables; - - # Read user file, which might override some of our values. - read_am_file ($amfile, new Automake::Location, '.'); -} - - - -################################################################ - -# $STRING -# flatten ($ORIGINAL_STRING) -# -------------------------- -sub flatten -{ - $_ = shift; - - s/\\\n//somg; - s/\s+/ /g; - s/^ //; - s/ $//; - - return $_; -} - - -# transform_token ($TOKEN, \%PAIRS, $KEY) -# --------------------------------------- -# Return the value associated to $KEY in %PAIRS, as used on $TOKEN -# (which should be ?KEY? or any of the special %% requests).. -sub transform_token ($\%$) -{ - my ($token, $transform, $key) = @_; - my $res = $transform->{$key}; - prog_error "Unknown key '$key' in '$token'" unless defined $res; - return $res; -} - - -# transform ($TOKEN, \%PAIRS) -# --------------------------- -# If ($TOKEN, $VAL) is in %PAIRS: -# - replaces %KEY% with $VAL, -# - enables/disables ?KEY? and ?!KEY?, -# - replaces %?KEY% with TRUE or FALSE. -sub transform ($\%) -{ - my ($token, $transform) = @_; - - # %KEY%. - # Must be before the following pattern to exclude the case - # when there is neither IFTRUE nor IFFALSE. - if ($token =~ /^%([\w\-]+)%$/) - { - return transform_token ($token, %$transform, $1); - } - # %?KEY%. - elsif ($token =~ /^%\?([\w\-]+)%$/) - { - return transform_token ($token, %$transform, $1) ? 'TRUE' : 'FALSE'; - } - # ?KEY? and ?!KEY?. - elsif ($token =~ /^ \? (!?) ([\w\-]+) \? $/x) - { - my $neg = ($1 eq '!') ? 1 : 0; - my $val = transform_token ($token, %$transform, $2); - return (!!$val == $neg) ? '##%' : ''; - } - else - { - prog_error "Unknown request format: $token"; - } -} - -# $TEXT -# preprocess_file ($MAKEFILE, [%TRANSFORM]) -# ----------------------------------------- -# Load a $MAKEFILE, apply the %TRANSFORM, and return the result. -# No extra parsing or post-processing is done (i.e., recognition of -# rules declaration or of make variables definitions). -sub preprocess_file -{ - my ($file, %transform) = @_; - - # Complete %transform with global options. - # Note that %transform goes last, so it overrides global options. - %transform = ( 'MAINTAINER-MODE' - => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '', - - 'XZ' => !! option 'dist-xz', - 'LZIP' => !! option 'dist-lzip', - '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, - %transform); - - if (! defined ($_ = $am_file_cache{$file})) - { - 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; - # Remember the contents of the just-read file. - $am_file_cache{$file} = $_; - } - - # Substitute Automake template tokens. - s/(?: % \?? [\w\-]+ % - | \? !? [\w\-]+ \? - )/transform($&, %transform)/gex; - # 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; - - 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) = @_; - $transform{FIRST} = !$transformed_files{$file}; - $transformed_files{$file} = 1; - - my @lines = split /(?set ($file); - - my $result_vars = ''; - my $result_rules = ''; - my $comment = ''; - my $spacing = ''; - - # The following flags are used to track rules spanning across - # multiple paragraphs. - my $is_rule = 0; # 1 if we are processing a rule. - my $discard_rule = 0; # 1 if the current rule should not be output. - - # We save the conditional stack on entry, and then check to make - # sure it is the same on exit. This lets us conditionally include - # other files. - my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); - - foreach (make_paragraphs ($file, %transform)) - { - # FIXME: no line number available. - $where->set ($file); - - # Sanity checks. - error $where, "blank line following trailing backslash:\n$_" - if /\\$/; - error $where, "comment following trailing backslash:\n$_" - if /\\#/; - - if (/^$/) - { - $is_rule = 0; - # Stick empty line before the incoming macro or rule. - $spacing = "\n"; - } - elsif (/$COMMENT_PATTERN/mso) - { - $is_rule = 0; - # Stick comments before the incoming macro or rule. - $comment = "$_\n"; - } - - # Handle inclusion of other files. - elsif (/$INCLUDE_PATTERN/o) - { - if ($cond != FALSE) - { - my $file = ($is_am ? "$libdir/am/" : '') . $1; - $where->push_context ("'$file' included from here"); - # N-ary '.=' fails. - my ($com, $vars, $rules) - = file_contents_internal ($is_am, $file, $where, %transform); - $where->pop_context; - $comment .= $com; - $result_vars .= $vars; - $result_rules .= $rules; - } - } - - # Handling the conditionals. - elsif (/$IF_PATTERN/o) - { - $cond = cond_stack_if ($1, $2, $file); - } - elsif (/$ELSE_PATTERN/o) - { - $cond = cond_stack_else ($1, $2, $file); - } - elsif (/$ENDIF_PATTERN/o) - { - $cond = cond_stack_endif ($1, $2, $file); - } - - # Handling rules. - elsif (/$RULE_PATTERN/mso) - { - $is_rule = 1; - $discard_rule = 0; - # Separate relationship from optional actions: the first - # `new-line tab" not preceded by backslash (continuation - # line). - my $paragraph = $_; - /^(.*?)(?:(?subst_string/gme; - $result_rules .= "$spacing$comment$condparagraph\n"; - } - if (scalar @undefined_conds == 0) - { - # Remember to discard next paragraphs - # if they belong to this rule. - # (but see also FIXME: #2 above.) - $discard_rule = 1; - } - $comment = $spacing = ''; - last; - } - } - } - - elsif (/$ASSIGNMENT_PATTERN/mso) - { - my ($var, $type, $val) = ($1, $2, $3); - error $where, "variable '$var' with trailing backslash" - if /\\$/; - - $is_rule = 0; - - Automake::Variable::define ($var, - $is_am ? VAR_AUTOMAKE : VAR_MAKEFILE, - $type, $cond, $val, $comment, $where, - VAR_ASIS) - if $cond != FALSE; - - $comment = $spacing = ''; - } - else - { - # This isn't an error; it is probably some tokens which - # configure is supposed to replace, such as '@SET-MAKE@', - # or some part of a rule cut by an if/endif. - if (! $cond->false && ! ($is_rule && $discard_rule)) - { - s/^/$cond->subst_string/gme; - $result_rules .= "$spacing$comment$_\n"; - } - $comment = $spacing = ''; - } - } - - error ($where, @cond_stack ? - "unterminated conditionals: @cond_stack" : - "too many conditionals closed in include file") - if "@saved_cond_stack" ne "@cond_stack"; - - return ($comment, $result_vars, $result_rules); -} - - -# $CONTENTS -# file_contents ($BASENAME, $WHERE, [%TRANSFORM]) -# ----------------------------------------------- -# Return contents of a file from $libdir/am, automatically skipping -# macros or rules which are already known. -sub file_contents -{ - my ($basename, $where, %transform) = @_; - my ($comments, $variables, $rules) = - file_contents_internal (1, "$libdir/am/$basename.am", $where, - %transform); - return "$comments$variables$rules"; -} - - -# @PREFIX -# am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES) -# ---------------------------------------------------- -# Find all variable prefixes that are used for install directories. A -# prefix 'zar' qualifies iff: -# -# * 'zardir' is a variable. -# * 'zar_PRIMARY' is a variable. -# -# As a side effect, it looks for misspellings. It is an error to have -# a variable ending in a "reserved" suffix whose prefix is unknown, e.g. -# "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 -# need it. -sub am_primary_prefixes -{ - my ($primary, $can_dist, @prefixes) = @_; - - local $_; - my %valid = map { $_ => 0 } @prefixes; - $valid{'EXTRA'} = 0; - foreach my $var (variables $primary) - { - # Automake is allowed to define variables that look like primaries - # but which aren't. E.g. INSTALL_sh_DATA. - # Autoconf can also define variables like INSTALL_DATA, so - # ignore all configure variables (at least those which are not - # redefined in Makefile.am). - # FIXME: We should make sure that these variables are not - # conditionally defined (or else adjust the condition below). - my $def = $var->def (TRUE); - next if $def && $def->owner != VAR_MAKEFILE; - - my $varname = $var->name; - - if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_[[:alnum:]]+$/) - { - my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || ''); - if ($dist ne '' && ! $can_dist) - { - err_var ($var, - "invalid variable '$varname': 'dist' is forbidden"); - } - # Standard directories must be explicitly allowed. - elsif (! defined $valid{$X} && exists $standard_prefix{$X}) - { - err_var ($var, - "'${X}dir' is not a legitimate directory " . - "for '$primary'"); - } - # A not explicitly valid directory is allowed if Xdir is defined. - elsif (! defined $valid{$X} && - $var->requires_variables ("'$varname' is used", "${X}dir")) - { - # Nothing to do. Any error message has been output - # by $var->requires_variables. - } - else - { - # Ensure all extended prefixes are actually used. - $valid{"$base$dist$X"} = 1; - } - } - else - { - prog_error "unexpected variable name: $varname"; - } - } - - # Return only those which are actually defined. - return sort grep { var ($_ . '_' . $primary) } keys %valid; -} - - -# am_install_var (-OPTION..., file, HOW, where...) -# ------------------------------------------------ -# -# Handle 'where_HOW' variable magic. Does all lookups, generates -# install code, and possibly generates code to define the primary -# variable. The first argument is the name of the .am file to munge, -# the second argument is the primary variable (e.g. HEADERS), and all -# subsequent arguments are possible installation locations. -# -# Returns list of [$location, $value] pairs, where -# $value's are the values in all where_HOW variable, and $location -# there associated location (the place here their parent variables were -# defined). -# -# FIXME: this should be rewritten to be cleaner. It should be broken -# up into multiple functions. -# -sub am_install_var -{ - my (@args) = @_; - - my $do_require = 1; - my $can_dist = 0; - my $default_dist = 0; - while (@args) - { - if ($args[0] eq '-noextra') - { - $do_require = 0; - } - elsif ($args[0] eq '-candist') - { - $can_dist = 1; - } - elsif ($args[0] eq '-defaultdist') - { - $default_dist = 1; - $can_dist = 1; - } - elsif ($args[0] !~ /^-/) - { - last; - } - shift (@args); - } - - my ($file, $primary, @prefix) = @args; - - # Now that configure substitutions are allowed in where_HOW - # variables, it is an error to actually define the primary. We - # allow 'JAVA', as it is customarily used to mean the Java - # interpreter. This is but one of several Java hacks. Similarly, - # 'PYTHON' is customarily used to mean the Python interpreter. - reject_var $primary, "'$primary' is an anachronism" - unless $primary eq 'JAVA' || $primary eq 'PYTHON'; - - # Get the prefixes which are valid and actually used. - @prefix = am_primary_prefixes ($primary, $can_dist, @prefix); - - # If a primary includes a configure substitution, then the EXTRA_ - # form is required. Otherwise we can't properly do our job. - my $require_extra; - - my @used = (); - my @result = (); - - foreach my $X (@prefix) - { - my $nodir_name = $X; - my $one_name = $X . '_' . $primary; - my $one_var = var $one_name; - - my $strip_subdir = 1; - # If subdir prefix should be preserved, do so. - if ($nodir_name =~ /^nobase_/) - { - $strip_subdir = 0; - $nodir_name =~ s/^nobase_//; - } - - # If files should be distributed, do so. - my $dist_p = 0; - if ($can_dist) - { - $dist_p = (($default_dist && $nodir_name !~ /^nodist_/) - || (! $default_dist && $nodir_name =~ /^dist_/)); - $nodir_name =~ s/^(dist|nodist)_//; - } - - - # Use the location of the currently processed variable. - # We are not processing a particular condition, so pick the first - # available. - my $tmpcond = $one_var->conditions->one_cond; - my $where = $one_var->rdef ($tmpcond)->location->clone; - - # Append actual contents of where_PRIMARY variable to - # @result, skipping @substitutions@. - foreach my $locvals ($one_var->value_as_list_recursive (location => 1)) - { - my ($loc, $value) = @$locvals; - # Skip configure substitutions. - if ($value =~ /^\@.*\@$/) - { - if ($nodir_name eq 'EXTRA') - { - error ($where, - "'$one_name' contains configure substitution, " - . "but shouldn't"); - } - # Check here to make sure variables defined in - # configure.ac do not imply that EXTRA_PRIMARY - # must be defined. - elsif (! defined $configure_vars{$one_name}) - { - $require_extra = $one_name - if $do_require; - } - } - else - { - # 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. - # Do it here rather than in handle_programs so the - # uniquifying at the end of this function works. - ${$locvals}[1] =~ s/\$\(EXEEXT\)$// - if $primary eq 'PROGRAMS'; - - 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'; - - if ($nodir_name eq 'check') - { - push (@check, '$(' . $one_name . ')'); - } - else - { - push (@used, '$(' . $one_name . ')'); - } - - # Is this to be installed? - my $install_p = $nodir_name ne 'noinst' && $nodir_name ne 'check'; - - # If so, with install-exec? (or install-data?). - my $exec_p = ($nodir_name =~ /$EXEC_DIR_PATTERN/o); - - my $check_options_p = $install_p && !! option 'std-options'; - - # Use the location of the currently processed variable as context. - $where->push_context ("while processing '$one_name'"); - - # The variable containing all files to distribute. - my $distvar = "\$($one_name)"; - $distvar = shadow_unconditionally ($one_name, $where) - if ($dist_p && $one_var->has_conditional_contents); - - # Singular form of $PRIMARY. - (my $one_primary = $primary) =~ s/S$//; - $output_rules .= file_contents ($file, $where, - PRIMARY => $primary, - ONE_PRIMARY => $one_primary, - DIR => $X, - NDIR => $nodir_name, - BASE => $strip_subdir, - EXEC => $exec_p, - INSTALL => $install_p, - DIST => $dist_p, - DISTVAR => $distvar, - 'CK-OPTS' => $check_options_p); - } - - # The JAVA variable is used as the name of the Java interpreter. - # The PYTHON variable is used as the name of the Python interpreter. - if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON') - { - # Define it. - define_pretty_variable ($primary, TRUE, INTERNAL, @used); - $output_vars .= "\n"; - } - - err_var ($require_extra, - "'$require_extra' contains configure substitution,\n" - . "but 'EXTRA_$primary' not defined") - if ($require_extra && ! var ('EXTRA_' . $primary)); - - # Push here because PRIMARY might be configure time determined. - push (@all, '$(' . $primary . ')') - if @used && $primary ne 'JAVA' && $primary ne 'PYTHON'; - - # Make the result unique. This lets the user use conditionals in - # a natural way, but still lets us program lazily -- we don't have - # to worry about handling a particular object more than once. - # We will keep only one location per object. - my %result = (); - for my $pair (@result) - { - my ($loc, $val) = @$pair; - $result{$val} = $loc; - } - my @l = sort keys %result; - return map { [$result{$_}->clone, $_] } @l; -} - - -################################################################ - -# Each key in this hash is the name of a directory holding a -# Makefile.in. These variables are local to 'is_make_dir'. -my %make_dirs = (); -my $make_dirs_set = 0; - -# is_make_dir ($DIRECTORY) -# ------------------------ -sub is_make_dir -{ - my ($dir) = @_; - if (! $make_dirs_set) - { - foreach my $iter (@configure_input_files) - { - $make_dirs{dirname ($iter)} = 1; - } - # We also want to notice Makefile.in's. - foreach my $iter (@other_input_files) - { - if ($iter =~ /Makefile\.in$/) - { - $make_dirs{dirname ($iter)} = 1; - } - } - $make_dirs_set = 1; - } - return defined $make_dirs{$dir}; -} - -################################################################ - -# Find the aux dir. This should match the algorithm used by -# ./configure. (See the Autoconf documentation for for -# AC_CONFIG_AUX_DIR.) -sub locate_aux_dir () -{ - if (! $config_aux_dir_set_in_configure_ac) - { - # The default auxiliary directory is the first - # of ., .., or ../.. that contains install-sh. - # Assume . if install-sh doesn't exist yet. - for my $dir (qw (. .. ../..)) - { - if (-f "$dir/install-sh") - { - $config_aux_dir = $dir; - last; - } - } - $config_aux_dir = '.' unless $config_aux_dir; - } - # Avoid unsightly '/.'s. - $am_config_aux_dir = - '$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir"); - $am_config_aux_dir =~ s,/*$,,; -} - - -# push_required_file ($DIR, $FILE, $FULLFILE) -# ------------------------------------------- -# Push the given file onto DIST_COMMON. -sub push_required_file -{ - my ($dir, $file, $fullfile) = @_; - - # If the file to be distributed is in the same directory of the - # currently processed Makefile.am, then we want to distribute it - # from this same Makefile.am. - if ($dir eq $relative_dir) - { - push_dist_common ($file); - } - # This is needed to allow a construct in a non-top-level Makefile.am - # to require a file in the build-aux directory (see at least the test - # script 'test-driver-is-distributed.sh'). This is related to the - # automake bug#9546. Note that the use of $config_aux_dir instead - # of $am_config_aux_dir here is deliberate and necessary. - elsif ($dir eq $config_aux_dir) - { - push_dist_common ("$am_config_aux_dir/$file"); - } - # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support. - # We probably need some refactoring of this function and its callers, - # to have a more explicit and systematic handling of all the special - # cases; but, since there are only two of them, this is low-priority - # ATM. - elsif ($config_libobj_dir && $dir eq $config_libobj_dir) - { - # Avoid unsightly '/.'s. - my $am_config_libobj_dir = - '$(top_srcdir)' . - ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir"); - $am_config_libobj_dir =~ s|/*$||; - push_dist_common ("$am_config_libobj_dir/$file"); - } - 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); - } - else - { - prog_error "a Makefile in relative directory $relative_dir " . - "can't add files in directory $dir to DIST_COMMON"; - } -} - - -# 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 = (); - -# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE) -# ------------------------------------------------------- -# Verify that the file must exist in $DIRECTORY, or install it. -sub required_file_check_or_copy -{ - my ($where, $dir, $file) = @_; - - my $fullfile = "$dir/$file"; - my $found_it = 0; - my $dangling_sym = 0; - - if (-l $fullfile && ! -f $fullfile) - { - $dangling_sym = 1; - } - elsif (dir_has_case_matching_file ($dir, $file)) - { - $found_it = 1; - } - - # '--force-missing' only has an effect if '--add-missing' is - # specified. - return - if $found_it && (! $add_missing || ! $force_missing); - - # 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) - { - return if defined $required_file_not_found{$fullfile}; - $required_file_not_found{$fullfile} = 1; - } - if ($dangling_sym && $add_missing) - { - unlink ($fullfile); - } - - my $trailer = ''; - my $trailer2 = ''; - my $suppress = 0; - - # Only install missing files according to our desired - # strictness level. - my $message = "required file '$fullfile' not found"; - if ($add_missing) - { - if (-f "$libdir/$file") - { - $suppress = 1; - - # Install the missing file. Symlink if we - # can, copy if we must. Note: delete the file - # first, in case it is a dangling symlink. - $message = "installing '$fullfile'"; - - # The license file should not be volatile. - if ($file eq "COPYING") - { - $message .= " using GNU General Public License v3 file"; - $trailer2 = "\n Consider adding the COPYING file" - . " to the version control system" - . "\n for your code, to avoid questions" - . " about which license your project uses"; - } - - # Windows Perl will hang if we try to delete a - # file that doesn't exist. - unlink ($fullfile) if -f $fullfile; - if ($symlink_exists && ! $copy_missing) - { - if (! symlink ("$libdir/$file", $fullfile) - || ! -e $fullfile) - { - $suppress = 0; - $trailer = "; error while making link: $!"; - } - } - elsif (system ('cp', "$libdir/$file", $fullfile)) - { - $suppress = 0; - $trailer = "\n error while copying"; - } - set_dir_cache_file ($dir, $file); - } - } - 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. - return - if $found_it && $force_missing; - - # 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. - return - if !$suppress && rule $file; - - msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2"); -} - - -# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES) -# --------------------------------------------------------------------- -# Verify that the file must exist in $DIRECTORY, or install it. -# $MYSTRICT is the strictness level at which this file becomes required. -# Worker threads may queue up the action to be serialized by the master, -# if $QUEUE is true -sub require_file_internal -{ - my ($where, $mystrict, $dir, $queue, @files) = @_; - - return - unless $strictness >= $mystrict; - - foreach my $file (@files) - { - push_required_file ($dir, $file, "$dir/$file"); - if ($queue) - { - queue_required_file_check_or_copy ($required_conf_file_queue, - QUEUE_CONF_FILE, $relative_dir, - $where, $mystrict, @files); - } - else - { - required_file_check_or_copy ($where, $dir, $file); - } - } -} - -# require_file ($WHERE, $MYSTRICT, @FILES) -# ---------------------------------------- -sub require_file -{ - my ($where, $mystrict, @files) = @_; - require_file_internal ($where, $mystrict, $relative_dir, 0, @files); -} - -# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) -# ---------------------------------------------------------- -sub require_file_with_macro -{ - my ($cond, $macro, $mystrict, @files) = @_; - $macro = rvar ($macro) unless ref $macro; - require_file ($macro->rdef ($cond)->location, $mystrict, @files); -} - -# require_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, 0, @files); - } - else - { - require_file ($macro->rdef ($cond)->location, $mystrict, @files); - } -} - -# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE, -# $MYSTRICT, @FILES) -# -------------------------------------------------------------- -sub queue_required_file_check_or_copy -{ - my ($queue, $key, $dir, $where, $mystrict, @files) = @_; - my @serial_loc; - if (ref $where) - { - @serial_loc = (QUEUE_LOCATION, $where->serialize ()); - } - else - { - @serial_loc = (QUEUE_STRING, $where); - } - $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files); -} - -# require_queued_file_check_or_copy ($QUEUE) -# ------------------------------------------ -sub require_queued_file_check_or_copy -{ - my ($queue) = @_; - my $where; - my $dir = $queue->dequeue (); - my $loc_key = $queue->dequeue (); - if ($loc_key eq QUEUE_LOCATION) - { - $where = Automake::Location::deserialize ($queue); - } - elsif ($loc_key eq QUEUE_STRING) - { - $where = $queue->dequeue (); - } - else - { - prog_error "unexpected key $loc_key"; - } - my $mystrict = $queue->dequeue (); - my $nfiles = $queue->dequeue (); - my @files; - push @files, $queue->dequeue () - foreach (1 .. $nfiles); - return - unless $strictness >= $mystrict; - foreach my $file (@files) - { - required_file_check_or_copy ($where, $config_aux_dir, $file); - } -} - -# 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) = @_; - my $queue = defined $required_conf_file_queue ? 1 : 0; - require_file_internal ($where, $mystrict, $config_aux_dir, - $queue, @files); -} - - -# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) -# --------------------------------------------------------------- -sub require_conf_file_with_macro -{ - my ($cond, $macro, $mystrict, @files) = @_; - require_conf_file (rvar ($macro)->rdef ($cond)->location, - $mystrict, @files); -} - -################################################################ - -# require_build_directory ($DIRECTORY) -# ------------------------------------ -# Emit rules to create $DIRECTORY if needed, and return -# the file that any target requiring this directory should be made -# dependent upon. -# 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); - - if (exists $directory_map{$cdir}) - { - 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 must be removed by 'make distclean'. - $clean_files{$dirstamp} = DIST_CLEAN; - - $output_rules .= ("$dirstamp:\n" - . "\t\@\$(MKDIR_P) $directory\n" - . "\t\@: > $dirstamp\n"); - - return $dirstamp; -} - -# require_build_directory_maybe ($FILE) -# ------------------------------------- -# If $FILE lies in a subdirectory, emit a rule to create this -# directory and return the file that $FILE should be made -# dependent upon. Otherwise, just return the empty string. -sub require_build_directory_maybe -{ - my $file = shift; - my $directory = dirname ($file); - - if ($directory ne '.') - { - return require_build_directory ($directory); - } - else - { - return ''; - } -} - -################################################################ - -# Push a list of files onto '@dist_common'. -sub push_dist_common -{ - prog_error "push_dist_common run after handle_dist" - if $handle_dist_run; - Automake::Variable::define ('DIST_COMMON', VAR_AUTOMAKE, '+', TRUE, "@_", - '', INTERNAL, VAR_PRETTY); -} - - -################################################################ - -# generate_makefile ($MAKEFILE_AM, $MAKEFILE_IN) -# ---------------------------------------------- -# Generate a Makefile.in given the name of the corresponding Makefile and -# the name of the file output by config.status. -sub generate_makefile -{ - my ($makefile_am, $makefile_in) = @_; - - # Reset all the Makefile.am related variables. - initialize_per_input; - - # AUTOMAKE_OPTIONS can contains -W flags to disable or enable - # warnings for this file. So hold any warning issued before - # we have processed AUTOMAKE_OPTIONS. - buffer_messages ('warning'); - - # $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 the subroutine - # 'scan_autoconf_files' for details. - my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in}); - - $relative_dir = dirname ($makefile); - - read_main_am_file ($makefile_am, $makefile_in); - if (not handle_options) - { - # Process buffered warnings. - flush_messages; - # Fatal error. Just return, so we can continue with next file. - return; - } - # Process buffered warnings. - flush_messages; - - # There are a few install-related variables that you should not define. - foreach my $var ('PRE_INSTALL', 'POST_INSTALL', 'NORMAL_INSTALL') - { - my $v = var $var; - if ($v) - { - my $def = $v->def (TRUE); - prog_error "$var not defined in condition TRUE" - unless $def; - reject_var $var, "'$var' should not be defined" - if $def->owner != VAR_AUTOMAKE; - } - } - - # Catch some obsolete variables. - msg_var ('obsolete', 'INCLUDES', - "'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')") - if var ('INCLUDES'); - - # 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_gnu_standards; - check_gnits_standards; - - handle_configure ($makefile_am, $makefile_in, $makefile, @inputs); - handle_gettext; - handle_libraries; - handle_ltlibraries; - handle_programs; - handle_scripts; - - handle_silent; - - # 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_texinfo; - handle_emacs_lisp; - handle_python; - handle_java; - handle_man_pages; - handle_data; - handle_headers; - handle_subdirs; - handle_user_recursion; - handle_tags; - handle_minor_options; - # Must come after handle_programs so that %known_programs is up-to-date. - handle_tests; - - # This must come after most other rules. - handle_dist; - - handle_footer; - do_check_merge_target; - handle_all ($makefile); - - # FIXME: Gross! - if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS')) - { - $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n"; - } - if (var ('nobase_lib_LTLIBRARIES') && var ('bin_PROGRAMS')) - { - $output_rules .= "install-binPROGRAMS: install-nobase_libLTLIBRARIES\n\n"; - } - - handle_install; - handle_clean ($makefile); - handle_factored_dependencies; - - # Comes last, because all the above procedures may have - # defined or overridden variables. - $output_vars .= output_variables; - - check_typos; - - if ($exit_code != 0) - { - verb "not writing $makefile_in because of earlier errors"; - return; - } - - my $am_relative_dir = dirname ($makefile_am); - mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir; - - # 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 $makefile_in; - if (! $force_generation - && $configure_deps_greatest_timestamp < $timestamp - && $output_deps_greatest_timestamp < $timestamp - && $output eq contents ($makefile_in)) - { - verb "$makefile_in unchanged"; - # No need to update. - return; - } - - if (-e $makefile_in) - { - unlink ($makefile_in) - or fatal "cannot remove $makefile_in: $!"; - } - - my $gm_file = new Automake::XFile "> $makefile_in"; - verb "creating $makefile_in"; - print $gm_file $output; -} - - -################################################################ - - -# Helper function for usage(). -sub print_autodist_files -{ - # NOTE: we need to call our 'uniq' function with the leading '&' - # here, because otherwise perl complains that "Unquoted string - # 'uniq' may clash with future reserved word". - my @lcomm = sort (&uniq (@_)); - - my @four; - format USAGE_FORMAT = - @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< - $four[0], $four[1], $four[2], $four[3] -. - local $~ = "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; - } -} - - -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: - --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 set directory storing library files - --print-libdir print directory storing library files - -c, --copy with -a, copy missing files (default is symlink) - -f, --force-missing force update of standard files - -"; - Automake::ChannelDefs::usage; - - print "\nFiles automatically distributed if found " . - "(always):\n"; - print_autodist_files @common_files; - print "\nFiles automatically distributed if found " . - "(under certain conditions):\n"; - print_autodist_files @common_sometimes; - - print ' -Report bugs to . -GNU Automake home page: . -General help using GNU software: . -'; - - # --help always returns 0 per GNU standards. - exit 0; -} - - -sub version () -{ - print < -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF - # --version always returns 0 per GNU standards. - exit 0; -} - -################################################################ - -# Parse command line. -sub parse_arguments () -{ - my $strict = 'gnu'; - my $ignore_deps = 0; - my @warnings = (); - - my %cli_options = - ( - 'version' => \&version, - 'help' => \&usage, - 'libdir=s' => \$libdir, - 'print-libdir' => sub { print "$libdir\n"; exit 0; }, - 'gnu' => sub { $strict = 'gnu'; }, - 'gnits' => sub { $strict = 'gnits'; }, - 'foreign' => sub { $strict = 'foreign'; }, - 'include-deps' => sub { $ignore_deps = 0; }, - 'i|ignore-deps' => sub { $ignore_deps = 1; }, - 'no-force' => sub { $force_generation = 0; }, - 'f|force-missing' => \$force_missing, - 'a|add-missing' => \$add_missing, - 'c|copy' => \$copy_missing, - 'v|verbose' => sub { setup_channel 'verb', silent => 0; }, - 'W|warnings=s' => \@warnings, - ); - - use Automake::Getopt (); - Automake::Getopt::parse_options %cli_options; - - set_strictness ($strict); - my $cli_where = new Automake::Location; - set_global_option ('no-dependencies', $cli_where) if $ignore_deps; - for my $warning (@warnings) - { - parse_warnings ('-W', $warning); - } - - return unless @ARGV; - - 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; -} - - -# handle_makefile ($MAKEFILE) -# --------------------------- -sub handle_makefile -{ - my ($file) = @_; - ($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; - } -} - -# Deal with all makefiles, without threads. -sub handle_makefiles_serial () -{ - foreach my $file (@input_files) - { - handle_makefile ($file); - } -} - -# Logic for deciding how many worker threads to use. -sub get_number_of_threads () -{ - my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0; - - $nthreads = 0 - unless $nthreads =~ /^[0-9]+$/; - - # It doesn't make sense to use more threads than makefiles, - my $max_threads = @input_files; - - if ($nthreads > $max_threads) - { - $nthreads = $max_threads; - } - return $nthreads; -} - -# handle_makefiles_threaded ($NTHREADS) -# ------------------------------------- -# Deal with all makefiles, using threads. The general strategy is to -# spawn NTHREADS worker threads, dispatch makefiles to them, and let the -# worker threads push back everything that needs serialization: -# * warning and (normal) error messages, for stable stderr output -# order and content (avoiding duplicates, for example), -# * races when installing aux files (and respective messages), -# * races when collecting aux files for distribution. -# -# The latter requires that the makefile that deals with the aux dir -# files be handled last, done by the master thread. -sub handle_makefiles_threaded -{ - my ($nthreads) = @_; - - # The file queue distributes all makefiles, the message queues - # collect all serializations needed for respective files. - my $file_queue = Thread::Queue->new; - my %msg_queues; - foreach my $file (@input_files) - { - $msg_queues{$file} = Thread::Queue->new; - } - - verb "spawning $nthreads worker threads"; - my @threads = (1 .. $nthreads); - foreach my $t (@threads) - { - $t = threads->new (sub - { - while (my $file = $file_queue->dequeue) - { - verb "handling $file"; - my $queue = $msg_queues{$file}; - setup_channel_queue ($queue, QUEUE_MESSAGE); - $required_conf_file_queue = $queue; - handle_makefile ($file); - $queue->enqueue (undef); - setup_channel_queue (undef, undef); - $required_conf_file_queue = undef; - } - return $exit_code; - }); - } - - # Queue all makefiles. - verb "queuing " . @input_files . " input files"; - $file_queue->enqueue (@input_files, (undef) x @threads); - - # Collect and process serializations. - foreach my $file (@input_files) - { - verb "dequeuing messages for " . $file; - reset_local_duplicates (); - my $queue = $msg_queues{$file}; - while (my $key = $queue->dequeue) - { - if ($key eq QUEUE_MESSAGE) - { - pop_channel_queue ($queue); - } - elsif ($key eq QUEUE_CONF_FILE) - { - require_queued_file_check_or_copy ($queue); - } - else - { - prog_error "unexpected key $key"; - } - } - } - - foreach my $t (@threads) - { - my @exit_thread = $t->join; - $exit_code = $exit_thread[0] - if ($exit_thread[0] > $exit_code); - } -} - -################################################################ - -# 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"); - } - -my $nthreads = get_number_of_threads (); - -if ($perl_threads && $nthreads >= 1) - { - handle_makefiles_threaded ($nthreads); - } -else - { - handle_makefiles_serial (); - } - -exit $exit_code; - - -### Setup "GNU" style for perl-mode and cperl-mode. -## Local Variables: -## perl-indent-level: 2 -## perl-continued-statement-offset: 2 -## perl-continued-brace-offset: 0 -## perl-brace-offset: 0 -## perl-brace-imaginary-offset: 0 -## perl-label-offset: -2 -## cperl-indent-level: 2 -## cperl-brace-offset: 0 -## cperl-continued-brace-offset: 0 -## cperl-label-offset: -2 -## cperl-extra-newline-before-brace: t -## cperl-merge-trailing-else: nil -## cperl-continued-statement-offset: 2 -## End: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/automake-1.14 b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/automake-1.14 deleted file mode 100755 index 9c74dd31d..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/automake-1.14 +++ /dev/null @@ -1,8298 +0,0 @@ -#!/usr/bin/perl -w -# -*- perl -*- -# Generated from bin/automake.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# automake - create Makefile.in from Makefile.am -# Copyright (C) 1994-2013 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, see . - -# Originally written by David Mackenzie . -# Perl reimplementation by Tom Tromey , and -# Alexandre Duret-Lutz . - -package Automake; - -use strict; - -BEGIN -{ - @Automake::perl_libdirs = ('//share/automake-1.14') - unless @Automake::perl_libdirs; - unshift @INC, @Automake::perl_libdirs; - - # 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{'DJDIR'}; -} - -use Automake::Config; -BEGIN -{ - if ($perl_threads) - { - require threads; - import threads; - require Thread::Queue; - import Thread::Queue; - } -} -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::Variable; -use Automake::VarDef; -use Automake::Rule; -use Automake::RuleDef; -use Automake::Wrap 'makefile_wrap'; -use Automake::Language; -use File::Basename; -use File::Spec; -use Carp; - -## ----------------------- ## -## Subroutine prototypes. ## -## ----------------------- ## - -# BEGIN AUTOMATICALLY GENERATED PROTOTYPES -sub append_exeext (&$); -sub check_gnits_standards (); -sub check_gnu_standards (); -sub check_trailing_slash ($\$); -sub check_typos (); -sub define_files_variable ($\@$$); -sub define_standard_variables (); -sub define_verbose_libtool (); -sub define_verbose_texinfo (); -sub do_check_merge_target (); -sub get_number_of_threads (); -sub handle_compile (); -sub handle_data (); -sub handle_dist (); -sub handle_emacs_lisp (); -sub handle_factored_dependencies (); -sub handle_footer (); -sub handle_gettext (); -sub handle_headers (); -sub handle_install (); -sub handle_java (); -sub handle_languages (); -sub handle_libraries (); -sub handle_libtool (); -sub handle_ltlibraries (); -sub handle_makefiles_serial (); -sub handle_man_pages (); -sub handle_minor_options (); -sub handle_options (); -sub handle_programs (); -sub handle_python (); -sub handle_scripts (); -sub handle_silent (); -sub handle_subdirs (); -sub handle_tags (); -sub handle_tests (); -sub handle_tests_dejagnu (); -sub handle_texinfo (); -sub handle_user_recursion (); -sub initialize_per_input (); -sub lang_lex_finish (); -sub lang_sub_obj (); -sub lang_vala_finish (); -sub lang_yacc_finish (); -sub locate_aux_dir (); -sub parse_arguments (); -sub scan_aclocal_m4 (); -sub scan_autoconf_files (); -sub silent_flag (); -sub transform ($\%); -sub transform_token ($\%$); -sub usage (); -sub version (); -sub yacc_lex_finish_helper (); -# END AUTOMATICALLY GENERATED PROTOTYPES - - -## ----------- ## -## Constants. ## -## ----------- ## - -# Some regular expressions. One reason to put them here is that it -# makes indentation work better in Emacs. - -# Writing singled-quoted-$-terminated regexes is a pain because -# perl-mode thinks of $' as the ${'} variable (instead of a $ followed -# by a closing quote. Letting perl-mode think the quote is not closed -# leads to all sort of misindentations. On the other hand, defining -# regexes as double-quoted strings is far less readable. So usually -# we will write: -# -# $REGEX = '^regex_value' . "\$"; - -my $IGNORE_PATTERN = '^\s*##([^#\n].*)?\n'; -my $WHITE_PATTERN = '^\s*' . "\$"; -my $COMMENT_PATTERN = '^#'; -my $TARGET_PATTERN='[$a-zA-Z0-9_.@%][-.a-zA-Z0-9_(){}/$+@%]*'; -# A rule has three parts: a list of targets, a list of dependencies, -# and optionally actions. -my $RULE_PATTERN = - "^($TARGET_PATTERN(?:(?:\\\\\n|\\s)+$TARGET_PATTERN)*) *:([^=].*|)\$"; - -# Only recognize leading spaces, not leading tabs. If we recognize -# leading tabs here then we need to make the reader smarter, because -# otherwise it will think rules like 'foo=bar; \' are errors. -my $ASSIGNMENT_PATTERN = '^ *([^ \t=:+]*)\s*([:+]?)=\s*(.*)' . "\$"; -# This pattern recognizes a Gnits version id and sets $1 if the -# release is an alpha release. We also allow a suffix which can be -# used to extend the version number with a "fork" identifier. -my $GNITS_VERSION_PATTERN = '\d+\.\d+([a-z]|\.\d+)?(-[A-Za-z0-9]+)?'; - -my $IF_PATTERN = '^if\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*)\s*(?:#.*)?' . "\$"; -my $ELSE_PATTERN = - '^else(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; -my $ENDIF_PATTERN = - '^endif(?:\s+(!?)\s*([A-Za-z][A-Za-z0-9_]*))?\s*(?:#.*)?' . "\$"; -my $PATH_PATTERN = '(\w|[+/.-])+'; -# This will pass through anything not of the prescribed form. -my $INCLUDE_PATTERN = ('^include\s+' - . '((\$\(top_srcdir\)/' . $PATH_PATTERN . ')' - . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')' - . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$"); - -# Directories installed during 'install-exec' phase. -my $EXEC_DIR_PATTERN = - '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$"; - -# Values for AC_CANONICAL_* -use constant AC_CANONICAL_BUILD => 1; -use constant AC_CANONICAL_HOST => 2; -use constant AC_CANONICAL_TARGET => 3; - -# Values indicating when something should be cleaned. -use constant MOSTLY_CLEAN => 0; -use constant CLEAN => 1; -use constant DIST_CLEAN => 2; -use constant MAINTAINER_CLEAN => 3; - -# Libtool files. -my @libtool_files = qw(ltmain.sh config.guess config.sub); -# ltconfig appears here for compatibility with old versions of libtool. -my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh); - -# Commonly found files we look for and automatically include in -# DISTFILES. -my @common_files = - (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB - COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO - ar-lib compile config.guess config.rpath - config.sub depcomp install-sh libversion.in mdate-sh - missing mkinstalldirs py-compile texinfo.tex ylwrap), - @libtool_files, @libtool_sometimes); - -# Commonly used files we auto-include, but only sometimes. This list -# is used for the --help output only. -my @common_sometimes = - qw(aclocal.m4 acconfig.h config.h.top config.h.bot configure - configure.ac configure.in stamp-vti); - -# Standard directories from the GNU Coding Standards, and additional -# pkg* directories from Automake. Stored in a hash for fast member check. -my %standard_prefix = - map { $_ => 1 } (qw(bin data dataroot doc dvi exec html include info - lib libexec lisp locale localstate man man1 man2 - man3 man4 man5 man6 man7 man8 man9 oldinclude pdf - pkgdata pkginclude pkglib pkglibexec ps sbin - sharedstate sysconf)); - -# Copyright on generated Makefile.ins. -my $gen_copyright = "\ -# Copyright (C) 1994-$RELEASE_YEAR 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 the lang_*_rewrite functions. -# LANG_SUBDIR means that the resulting object file should be in a -# subdir if the source file is. In this case the file name cannot -# have '..' components. -use constant LANG_IGNORE => 0; -use constant LANG_PROCESS => 1; -use constant LANG_SUBDIR => 2; - -# These are used when keeping track of whether an object can be built -# by two different paths. -use constant COMPILE_LIBTOOL => 1; -use constant COMPILE_ORDINARY => 2; - -# We can't always associate a location to a variable or a rule, -# when it's defined by Automake. We use INTERNAL in this case. -use constant INTERNAL => new Automake::Location; - -# Serialization keys for message queues. -use constant QUEUE_MESSAGE => "msg"; -use constant QUEUE_CONF_FILE => "conf file"; -use constant QUEUE_LOCATION => "location"; -use constant QUEUE_STRING => "string"; - -## ---------------------------------- ## -## Variables related to the options. ## -## ---------------------------------- ## - -# TRUE if we should always generate Makefile.in. -my $force_generation = 1; - -# From the Perl manual. -my $symlink_exists = (eval 'symlink ("", "");', $@ eq ''); - -# TRUE if missing standard files should be installed. -my $add_missing = 0; - -# TRUE if we should copy missing files; otherwise symlink if possible. -my $copy_missing = 0; - -# TRUE if we should always update files that we know about. -my $force_missing = 0; - - -## ---------------------------------------- ## -## Variables filled during files scanning. ## -## ---------------------------------------- ## - -# Name of the configure.ac file. -my $configure_ac; - -# Files found by scanning configure.ac for LIBOBJS. -my %libsources = (); - -# Names used in AC_CONFIG_HEADERS call. -my @config_headers = (); - -# Names used in AC_CONFIG_LINKS call. -my @config_links = (); - -# List of Makefile.am's to process, and their corresponding outputs. -my @input_files = (); -my %output_files = (); - -# Complete list of Makefile.am's that exist. -my @configure_input_files = (); - -# List of files in AC_CONFIG_FILES/AC_OUTPUT without Makefile.am's, -# and their outputs. -my @other_input_files = (); -# Where each AC_CONFIG_FILES/AC_OUTPUT/AC_CONFIG_LINK/AC_CONFIG_HEADERS -# appears. The keys are the files created by these macros. -my %ac_config_files_location = (); -# The condition under which AC_CONFIG_FOOS appears. -my %ac_config_files_condition = (); - -# 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 = ''; - -# Directory to search for AC_LIBSOURCE files, as set by AC_CONFIG_LIBOBJ_DIR -# in configure.ac. -my $config_libobj_dir = ''; - -# Whether AM_GNU_GETTEXT has been seen in configure.ac. -my $seen_gettext = 0; -# Whether AM_GNU_GETTEXT([external]) is used. -my $seen_gettext_external = 0; -# Where AM_GNU_GETTEXT appears. -my $ac_gettext_location; -# Whether AM_GNU_GETTEXT_INTL_SUBDIR has been seen. -my $seen_gettext_intl = 0; - -# The arguments of the AM_EXTRA_RECURSIVE_TARGETS call (if any). -my @extra_recursive_targets = (); - -# 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. -my $seen_canonical = 0; - -# 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 AM_PROG_AR -my $seen_ar = 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; - -# 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 = (); - -# Ignored configure substitutions (i.e., variables not to be output in -# Makefile.in) -my %ignored_configure_vars = (); - -# Files included by $configure_ac. -my @configure_deps = (); - -# Greatest timestamp of configure's dependencies. -my $configure_deps_greatest_timestamp = 0; - -# Hash table of AM_CONDITIONAL variables seen in configure. -my %configure_cond = (); - -# This maps extensions onto language names. -my %extension_map = (); - -# List of the DIST_COMMON files we discovered while reading -# configure.ac. -my $configure_dist_common = ''; - -# This maps languages names onto objects. -my %languages = (); -# Maps each linker variable onto a language object. -my %link_languages = (); - -# maps extensions to needed source flags. -my %sourceflags = (); - -# 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... - 'html-am' => 1, - 'dvi-am' => 1, - 'pdf-am' => 1, - 'ps-am' => 1, - 'info-am' => 1, - 'install-data-am' => 1, - 'install-exec-am' => 1, - 'install-html-am' => 1, - 'install-dvi-am' => 1, - 'install-pdf-am' => 1, - 'install-ps-am' => 1, - 'install-info-am' => 1, - 'installcheck-am' => 1, - 'uninstall-am' => 1, - 'tags-am' => 1, - 'ctags-am' => 1, - 'cscopelist-am' => 1, - 'install-man' => 1, - ); - -# Queue to push require_conf_file requirements to. -my $required_conf_file_queue; - -# The name of the Makefile currently being processed. -my $am_file = 'BUG'; - -################################################################ - -## ------------------------------------------ ## -## Variables reset by &initialize_per_input. ## -## ------------------------------------------ ## - -# Relative dir of the output makefile. -my $relative_dir; - -# Greatest timestamp of the output's dependencies (excluding -# configure's dependencies). -my $output_deps_greatest_timestamp; - -# These variables are used when generating each Makefile.in. -# They hold the Makefile.in until it is ready to be printed. -my $output_vars; -my $output_all; -my $output_header; -my $output_rules; -my $output_trailer; - -# This is the conditional stack, updated on if/else/endif, and -# used to build Condition objects. -my @cond_stack; - -# This holds the set of included files. -my @include_stack; - -# List of dependencies for the obvious targets. -my @all; -my @check; -my @check_tests; - -# Keys in this hash table are files to delete. The associated -# value tells when this should happen (MOSTLY_CLEAN, DIST_CLEAN, etc.) -my %clean_files; - -# Keys in this hash table are object files or other files in -# subdirectories which need to be removed. This only holds files -# which are created by compilations. The value in the hash indicates -# when the file should be removed. -my %compile_clean_files; - -# Keys in this hash table are directories where we expect to build a -# libtool object. We use this information to decide what directories -# to delete. -my %libtool_clean_directories; - -# Value of $(SOURCES), used by tags.am. -my @sources; -# Sources which go in the distribution. -my @dist_sources; - -# This hash maps object file names onto their corresponding source -# file names. This is used to ensure that each object is created -# by a single source file. -my %object_map; - -# This hash maps object file names onto an integer value representing -# whether this object has been built via ordinary compilation or -# libtool compilation (the COMPILE_* constants). -my %object_compilation_map; - - -# This keeps track of the directories for which we've already -# created dirstamp code. Keys are directories, values are stamp files. -# Several keys can share the same stamp files if they are equivalent -# (as are './/foo' and 'foo'). -my %directory_map; - -# All .P files. -my %dep_files; - -# 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). @substitutions@ are not listed. -my %known_programs; -my %known_libraries; - -# 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; - -# Does the generated Makefile have to build some compiled object -# (for binary programs, or plain or libtool libraries)? -my $must_handle_compiled_objects; - -# Record each file processed by make_paragraphs. -my %transformed_files; - -################################################################ - -## ---------------------------------------------- ## -## Variables not reset by &initialize_per_input. ## -## ---------------------------------------------- ## - -# 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; - -################################################################ - -# 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); - -################################################################ - - -# initialize_per_input () -# ----------------------- -# (Re)-Initialize per-Makefile.am variables. -sub initialize_per_input () -{ - reset_local_duplicates (); - - $relative_dir = undef; - - $output_deps_greatest_timestamp = 0; - - $output_vars = ''; - $output_all = ''; - $output_header = ''; - $output_rules = ''; - $output_trailer = ''; - - Automake::Options::reset; - Automake::Variable::reset; - Automake::Rule::reset; - - @cond_stack = (); - - @include_stack = (); - - @all = (); - @check = (); - @check_tests = (); - - %clean_files = (); - %compile_clean_files = (); - - # We always include '.'. This isn't strictly correct. - %libtool_clean_directories = ('.' => 1); - - @sources = (); - @dist_sources = (); - - %object_map = (); - %object_compilation_map = (); - - %directory_map = (); - - %dep_files = (); - - @dist_targets = (); - - %known_programs = (); - %known_libraries= (); - - %extension_seen = (); - - %language_scratch = (); - - %lang_specific_files = (); - - $handle_dist_run = 0; - - $need_link = 0; - - $must_handle_compiled_objects = 0; - - %transformed_files = (); -} - - -################################################################ - -# Initialize our list of languages that are internally supported. - -my @cpplike_flags = - qw{ - $(DEFS) - $(DEFAULT_INCLUDES) - $(INCLUDES) - $(AM_CPPFLAGS) - $(CPPFLAGS) - }; - -# C. -register_language ('name' => 'c', - 'Name' => 'C', - 'config_vars' => ['CC'], - 'autodep' => '', - 'flags' => ['CFLAGS', 'CPPFLAGS'], - 'ccer' => 'CC', - 'compiler' => 'COMPILE', - 'compile' => "\$(CC) @cpplike_flags \$(AM_CFLAGS) \$(CFLAGS)", - 'lder' => 'CCLD', - 'ld' => '$(CC)', - 'linker' => 'LINK', - 'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'CC', - 'extensions' => ['.c']); - -# 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) @cpplike_flags \$(AM_CXXFLAGS) \$(CXXFLAGS)", - 'ccer' => 'CXX', - 'compiler' => 'CXXCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'CXX', - 'lder' => 'CXXLD', - 'ld' => '$(CXX)', - 'pure' => 1, - 'extensions' => ['.c++', '.cc', '.cpp', '.cxx', '.C']); - -# Objective C. -register_language ('name' => 'objc', - 'Name' => 'Objective C', - 'config_vars' => ['OBJC'], - 'linker' => 'OBJCLINK', - 'link' => '$(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'OBJC', - 'flags' => ['OBJCFLAGS', 'CPPFLAGS'], - 'compile' => "\$(OBJC) @cpplike_flags \$(AM_OBJCFLAGS) \$(OBJCFLAGS)", - 'ccer' => 'OBJC', - 'compiler' => 'OBJCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'OBJCLD', - 'ld' => '$(OBJC)', - 'pure' => 1, - 'extensions' => ['.m']); - -# Objective C++. -register_language ('name' => 'objcxx', - 'Name' => 'Objective C++', - 'config_vars' => ['OBJCXX'], - 'linker' => 'OBJCXXLINK', - 'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'OBJCXX', - 'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'], - 'compile' => "\$(OBJCXX) @cpplike_flags \$(AM_OBJCXXFLAGS) \$(OBJCXXFLAGS)", - 'ccer' => 'OBJCXX', - 'compiler' => 'OBJCXXCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'OBJCXXLD', - 'ld' => '$(OBJCXX)', - 'pure' => 1, - 'extensions' => ['.mm']); - -# 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) @cpplike_flags \$(AM_UPCFLAGS) \$(UPCFLAGS)", - 'ccer' => 'UPC', - 'compiler' => 'UPCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'lder' => 'UPCLD', - 'ld' => '$(UPC)', - 'pure' => 1, - 'extensions' => ['.upc']); - -# 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 { }); - -# Vala -register_language ('name' => 'vala', - 'Name' => 'Vala', - 'config_vars' => ['VALAC'], - 'flags' => [], - 'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)', - 'ccer' => 'VALAC', - 'compiler' => 'VALACOMPILE', - 'extensions' => ['.vala'], - 'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/; - return ($ext,) }, - 'rule_file' => 'vala', - '_finish' => \&lang_vala_finish, - '_target_hook' => \&lang_vala_target_hook, - 'nodist_specific' => 1); - -# Yacc (C & C++). -register_language ('name' => 'yacc', - 'Name' => 'Yacc', - 'config_vars' => ['YACC'], - 'flags' => ['YFLAGS'], - 'compile' => '$(YACC) $(AM_YFLAGS) $(YFLAGS)', - 'ccer' => 'YACC', - '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, - 'nodist_specific' => 1); -register_language ('name' => 'yaccxx', - 'Name' => 'Yacc (C++)', - 'config_vars' => ['YACC'], - 'rule_file' => 'yacc', - 'flags' => ['YFLAGS'], - 'ccer' => 'YACC', - 'compiler' => 'YACCCOMPILE', - 'compile' => '$(YACC) $(AM_YFLAGS) $(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, - 'nodist_specific' => 1); - -# Lex (C & C++). -register_language ('name' => 'lex', - 'Name' => 'Lex', - 'config_vars' => ['LEX'], - 'rule_file' => 'lex', - 'flags' => ['LFLAGS'], - 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)', - 'ccer' => 'LEX', - '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, - 'nodist_specific' => 1); -register_language ('name' => 'lexxx', - 'Name' => 'Lex (C++)', - 'config_vars' => ['LEX'], - 'rule_file' => 'lex', - 'flags' => ['LFLAGS'], - 'compile' => '$(LEX) $(AM_LFLAGS) $(LFLAGS)', - 'ccer' => 'LEX', - '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, - 'nodist_specific' => 1); - -# Assembler. -register_language ('name' => 'asm', - 'Name' => 'Assembler', - '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. - 'compile' => '$(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)', - 'ccer' => 'CCAS', - 'compiler' => 'CCASCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'extensions' => ['.s']); - -# Preprocessed Assembler. -register_language ('name' => 'cppasm', - 'Name' => 'Preprocessed Assembler', - 'config_vars' => ['CCAS', 'CCASFLAGS'], - - 'autodep' => 'CCAS', - 'flags' => ['CCASFLAGS', 'CPPFLAGS'], - 'compile' => "\$(CCAS) @cpplike_flags \$(AM_CCASFLAGS) \$(CCASFLAGS)", - 'ccer' => 'CPPAS', - 'compiler' => 'CPPASCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'extensions' => ['.S', '.sx']); - -# 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'], - 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS)', - 'ccer' => '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)', - 'ccer' => 'FC', - 'compiler' => 'FCCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'FC', - 'lder' => 'FCLD', - 'ld' => '$(FC)', - 'pure' => 1, - 'extensions' => ['.f90', '.f95', '.f03', '.f08']); - -# 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'], - 'ccer' => 'PPFC', - 'compiler' => 'PPFCCOMPILE', - 'compile' => "\$(FC) @cpplike_flags \$(AM_FCFLAGS) \$(FCFLAGS)", - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'FC', - 'pure' => 1, - 'extensions' => ['.F90','.F95', '.F03', '.F08']); - -# 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'], - 'ccer' => 'PPF77', - 'compiler' => 'PPF77COMPILE', - 'compile' => "\$(F77) @cpplike_flags \$(AM_FFLAGS) \$(FFLAGS)", - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'F77', - 'pure' => 1, - 'extensions' => ['.F']); - -# Ratfor. -register_language ('name' => 'ratfor', - 'Name' => 'Ratfor', - 'config_vars' => ['F77'], - 'linker' => 'F77LINK', - 'link' => '$(F77LD) $(AM_FFLAGS) $(FFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'lder' => 'F77LD', - 'ld' => '$(F77)', - 'flags' => ['RFLAGS', 'FFLAGS'], - # FIXME also FFLAGS. - 'compile' => '$(F77) $(AM_FFLAGS) $(FFLAGS) $(AM_RFLAGS) $(RFLAGS)', - 'ccer' => 'F77', - 'compiler' => 'RCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'F77', - 'pure' => 1, - 'extensions' => ['.r']); - -# Java via gcj. -register_language ('name' => 'java', - 'Name' => 'Java', - 'config_vars' => ['GCJ'], - 'linker' => 'GCJLINK', - 'link' => '$(GCJLD) $(AM_GCJFLAGS) $(GCJFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@', - 'autodep' => 'GCJ', - 'flags' => ['GCJFLAGS'], - 'compile' => '$(GCJ) $(AM_GCJFLAGS) $(GCJFLAGS)', - 'ccer' => 'GCJ', - 'compiler' => 'GCJCOMPILE', - 'compile_flag' => '-c', - 'output_flag' => '-o', - 'libtool_tag' => 'GCJ', - 'lder' => 'GCJLD', - 'ld' => '$(GCJ)', - 'pure' => 1, - 'extensions' => ['.java', '.class', '.zip', '.jar']); - -################################################################ - -# Error reporting functions. - -# err_am ($MESSAGE, [%OPTIONS]) -# ----------------------------- -# Uncategorized errors about the current Makefile.am. -sub err_am -{ - msg_am ('error', @_); -} - -# err_ac ($MESSAGE, [%OPTIONS]) -# ----------------------------- -# Uncategorized errors about configure.ac. -sub err_ac -{ - msg_ac ('error', @_); -} - -# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS]) -# --------------------------------------- -# Messages about about the current Makefile.am. -sub msg_am -{ - my ($channel, $msg, %opts) = @_; - msg $channel, "${am_file}.am", $msg, %opts; -} - -# msg_ac ($CHANNEL, $MESSAGE, [%OPTIONS]) -# --------------------------------------- -# Messages about about configure.ac. -sub msg_ac -{ - my ($channel, $msg, %opts) = @_; - msg $channel, $configure_ac, $msg, %opts; -} - -################################################################ - -# subst ($TEXT) -# ------------- -# Return a configure-style substitution using the indicated text. -# We do this to avoid having the substitutions directly in automake.in; -# when we do that they are sometimes removed and this causes confusion -# and bugs. -sub subst -{ - my ($text) = @_; - return '@' . $text . '@'; -} - -################################################################ - - -# $BACKPATH -# backname ($RELDIR) -# ------------------- -# If I "cd $RELDIR", 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 - or prog_error ("trying to reverse path '$file' pointing outside tree"); - } - else - { - push (@res, '..'); - } - } - return join ('/', @res) || '.'; -} - -################################################################ - -# Silent rules handling functions. - -# verbose_var (NAME) -# ------------------ -# The public variable stem used to implement silent rules. -sub verbose_var -{ - my ($name) = @_; - return 'AM_V_' . $name; -} - -# verbose_private_var (NAME) -# -------------------------- -# The naming policy for the private variables for silent rules. -sub verbose_private_var -{ - my ($name) = @_; - return 'am__v_' . $name; -} - -# define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE]) -# ---------------------------------------------------------- -# For silent rules, setup VAR and dispatcher, to expand to -# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to -# empty) if not. -sub define_verbose_var -{ - my ($name, $silent_val, $verbose_val) = @_; - $verbose_val = '' unless defined $verbose_val; - my $var = verbose_var ($name); - my $pvar = verbose_private_var ($name); - my $silent_var = $pvar . '_0'; - my $verbose_var = $pvar . '_1'; - # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V) - # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY). - # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead. - # See AM_SILENT_RULES in m4/silent.m4. - define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL); - define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', - INTERNAL); - Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, - $silent_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($silent_var, TRUE)); - Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE, - $verbose_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($verbose_var, TRUE)); -} - -# verbose_flag (NAME) -# ------------------- -# Contents of '%VERBOSE%' variable to expand before rule command. -sub verbose_flag -{ - my ($name) = @_; - return '$(' . verbose_var ($name) . ')'; -} - -sub verbose_nodep_flag -{ - my ($name) = @_; - return '$(' . verbose_var ($name) . subst ('am__nodep') . ')'; -} - -# silent_flag -# ----------- -# Contents of %SILENT%: variable to expand to '@' when silent. -sub silent_flag () -{ - return verbose_flag ('at'); -} - -# define_verbose_tagvar (NAME) -# ---------------------------- -# Engage the needed silent rules machinery for tag NAME. -sub define_verbose_tagvar -{ - my ($name) = @_; - define_verbose_var ($name, '@echo " '. $name . ' ' x (8 - length ($name)) . '" $@;'); -} - -# Engage the needed silent rules machinery for assorted texinfo commands. -sub define_verbose_texinfo () -{ - my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF'); - foreach my $tag (@tagvars) - { - define_verbose_tagvar($tag); - } - define_verbose_var('texinfo', '-q'); - define_verbose_var('texidevnull', '> /dev/null'); -} - -# Engage the needed silent rules machinery for 'libtool --silent'. -sub define_verbose_libtool () -{ - define_verbose_var ('lt', '--silent'); - return verbose_flag ('lt'); -} - -sub handle_silent () -{ - # Define "$(AM_V_P)", expanding to a shell conditional that can be - # used in make recipes to determine whether we are being run in - # silent mode or not. The choice of the name derives from the LISP - # convention of appending the letter 'P' to denote a predicate (see - # also "the '-P' convention" in the Jargon File); we do so for lack - # of a better convention. - define_verbose_var ('P', 'false', ':'); - # *Always* provide the user with '$(AM_V_GEN)', unconditionally. - define_verbose_tagvar ('GEN'); - define_verbose_var ('at', '@'); -} - - -################################################################ - - -# Handle AUTOMAKE_OPTIONS variable. Return 0 on error, 1 otherwise. -sub handle_options () -{ - my $var = var ('AUTOMAKE_OPTIONS'); - if ($var) - { - if ($var->has_conditional_contents) - { - msg_var ('unsupported', $var, - "'AUTOMAKE_OPTIONS' cannot have conditional contents"); - } - my @options = map { { option => $_->[1], where => $_->[0] } } - $var->value_as_list_recursive (cond_filter => TRUE, - location => 1); - return 0 unless process_option_list (@options); - } - - if ($strictness == GNITS) - { - set_option ('readme-alpha', INTERNAL); - set_option ('std-options', INTERNAL); - set_option ('check-news', INTERNAL); - } - - return 1; -} - -# 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 an am__VAR_DIST variable which contains -# all possible values, and return $(am__VAR_DIST). -sub shadow_unconditionally -{ - my ($varname, $where) = @_; - my $var = var $varname; - if ($var->has_conditional_contents) - { - $varname = "am__${varname}_DIST"; - my @files = uniq ($var->value_as_list_recursive); - define_pretty_variable ($varname, TRUE, $where, @files); - } - return "\$($varname)" -} - -# 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) - { - 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"); - } - } - } - } -} - -# Call finish function for each language that was used. -sub handle_languages () -{ - if (! option 'no-dependencies') - { - # Include auto-dep code. Don't include it if DEP_FILES would - # be empty. - if (keys %extension_seen && keys %dep_files) - { - # Set location of depcomp. - define_variable ('depcomp', - "\$(SHELL) $am_config_aux_dir/depcomp", - INTERNAL); - define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL); - - require_conf_file ("$am_file.am", FOREIGN, 'depcomp'); - - my @deplist = sort keys %dep_files; - # Generate each 'include' individually. Irix 6 make will - # not properly include several files resulting from a - # variable expansion; generating many separate includes - # seems safest. - $output_rules .= "\n"; - foreach my $iter (@deplist) - { - $output_rules .= (subst ('AMDEP_TRUE') - . subst ('am__include') - . ' ' - . subst ('am__quote') - . $iter - . subst ('am__quote') - . "\n"); - } - - # Compute the set of directories to remove in distclean-depend. - my @depdirs = uniq (map { dirname ($_) } @deplist); - $output_rules .= file_contents ('depend', - new Automake::Location, - DEPDIRS => "@depdirs"); - } - } - else - { - define_variable ('depcomp', '', INTERNAL); - define_variable ('am__depfiles_maybe', '', INTERNAL); - } - - my %done; - - # Is the C linker needed? - my $needs_c = 0; - foreach my $ext (sort keys %extension_seen) - { - next unless $extension_map{$ext}; - - my $lang = $languages{$extension_map{$ext}}; - - my $rule_file = $lang->rule_file || 'depend2'; - - # Get information on $LANG. - my $pfx = $lang->autodep; - my $fpfx = ($pfx eq '') ? 'CC' : $pfx; - - my ($AMDEP, $FASTDEP) = - (option 'no-dependencies' || $lang->autodep eq 'no') - ? ('FALSE', 'FALSE') : ('AMDEP', "am__fastdep$fpfx"); - - my $verbose = verbose_flag ($lang->ccer || 'GEN'); - my $verbose_nodep = ($AMDEP eq 'FALSE') - ? $verbose : verbose_nodep_flag ($lang->ccer || 'GEN'); - my $silent = silent_flag (); - - my %transform = ('EXT' => $ext, - 'PFX' => $pfx, - 'FPFX' => $fpfx, - '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, - VERBOSE => $verbose, - 'VERBOSE-NODEP' => $verbose_nodep, - SILENT => $silent, - ); - - # Generate the appropriate rules for this extension. - if (((! option 'no-dependencies') && $lang->autodep ne 'no') - || defined $lang->compile) - { - # 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, - - 'DERIVED-EXT' => $der_ext, - - DEPBASE => $depbase, - BASE => '$*', - SOURCE => '$<', - SOURCEFLAG => $sourceflags{$ext} || '', - OBJ => '$@', - OBJOBJ => '$@', - LTOBJ => '$@', - - COMPILE => '$(' . $lang->compiler . ')', - LTCOMPILE => '$(LT' . $lang->compiler . ')', - -o => $lang->output_flag, - SUBDIROBJ => !! option 'subdir-objects'); - } - - # Now include code for each specially handled object with this - # language. - my %seen_files = (); - foreach my $file (@{$lang_specific_files{$lang->name}}) - { - my ($derived, $source, $obj, $myext, $srcext, %file_transform) = @$file; - - # We might see a given object twice, for instance if it is - # used under different conditions. - next if defined $seen_files{$obj}; - $seen_files{$obj} = 1; - - prog_error ("found " . $lang->name . - " in handle_languages, but compiler not defined") - unless defined $lang->compile; - - my $obj_compile = $lang->compile; - - # Rewrite each occurrence of 'AM_$flag' in the compile - # rule into '${derived}_$flag' if it exists. - for my $flag (@{$lang->flags}) - { - my $val = "${derived}_$flag"; - $obj_compile =~ s/\(AM_$flag\)/\($val\)/ - if set_seen ($val); - } - - my $libtool_tag = ''; - if ($lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}) - { - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - } - - my $ptltflags = "${derived}_LIBTOOLFLAGS"; - $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags; - - my $ltverbose = define_verbose_libtool (); - my $obj_ltcompile = - "\$(LIBTOOL) $ltverbose $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) " - . "--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); - - $output_rules .= - file_contents ($rule_file, - new Automake::Location, - %transform, - GENERIC => 0, - - DEPBASE => $depbase, - BASE => $obj, - SOURCE => $source, - SOURCEFLAG => $sourceflags{$srcext} || '', - # 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", - - VERBOSE => $verbose, - 'VERBOSE-NODEP' => $verbose_nodep, - SILENT => $silent, - COMPILE => $obj_compile, - LTCOMPILE => $obj_ltcompile, - -o => $output_flag, - %file_transform); - } - - # The rest of the loop is done once per language. - next if defined $done{$lang}; - $done{$lang} = 1; - - # Load the language dependent Makefile chunks. - my %lang = map { uc ($_) => 0 } keys %languages; - $lang{uc ($lang->name)} = 1; - $output_rules .= file_contents ('lang-compile', - new Automake::Location, - %transform, %lang); - - # If the source to a program consists entirely of code from a - # 'pure' language, for instance C++ or Fortran 77, then we - # don't need the C compiler code. However if we run into - # something unusual then we do generate the C code. There are - # probably corner cases here that do not work properly. - # People linking Java code to Fortran code deserve pain. - $needs_c ||= ! $lang->pure; - - define_compiler_variable ($lang) - if ($lang->compile); - - define_linker_variable ($lang) - if ($lang->link); - - require_variables ("$am_file.am", $lang->Name . " source seen", - TRUE, @{$lang->config_vars}); - - # Call the finisher. - $lang->finish; - - # Flags listed in '->flags' are user variables (per GNU Standards), - # they should not be overridden in the Makefile... - my @dont_override = @{$lang->flags}; - # ... and so is LDFLAGS. - push @dont_override, 'LDFLAGS' if $lang->link; - - check_user_variables @dont_override; - } - - # 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. - my @languages_seen = map { $languages{$extension_map{$_}}->name } - (keys %extension_seen); - @languages_seen = uniq (@languages_seen); - $needs_c = 1 if @languages_seen > 1; - if ($need_link || $needs_c) - { - define_compiler_variable ($languages{'c'}) - unless defined $done{$languages{'c'}}; - define_linker_variable ($languages{'c'}); - } -} - - -# 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 -# do this check. -sub check_libobjs_sources -{ - my ($one_file, $unxformed) = @_; - - foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', - 'dist_EXTRA_', 'nodist_EXTRA_') - { - my @files; - my $varname = $prefix . $one_file . '_SOURCES'; - my $var = var ($varname); - if ($var) - { - @files = $var->value_as_list_recursive; - } - elsif ($prefix eq '') - { - @files = ($unxformed . '.c'); - } - else - { - next; - } - - foreach my $file (@files) - { - err_var ($prefix . $one_file . '_SOURCES', - "automatically discovered file '$file' should not" . - " be explicitly mentioned") - if defined $libsources{$file}; - } - } -} - - -# @OBJECTS -# handle_single_transform ($VAR, $TOPPARENT, $DERIVED, $OBJ, $FILE, %TRANSFORM) -# ----------------------------------------------------------------------------- -# Does much of the actual work for handle_source_transform. -# Arguments are: -# $VAR is the name of the variable that the source filenames come from -# $TOPPARENT is the name of the _SOURCES variable which is being processed -# $DERIVED is the name of resulting executable or library -# $OBJ is the object extension (e.g., '.lo') -# $FILE the source file to transform -# %TRANSFORM contains extras arguments to pass to file_contents -# when producing explicit rules -# Result is a list of the names of objects -# %linkers_used will be updated with any linkers needed -sub handle_single_transform -{ - my ($var, $topparent, $derived, $obj, $_file, %transform) = @_; - my @files = ($_file); - my @result = (); - - # Turn sources into objects. We use a while loop like this - # because we might add to @files in the loop. - while (scalar @files > 0) - { - $_ = shift @files; - - # Configure substitutions in _SOURCES variables are errors. - if (/^\@.*\@$/) - { - my $parent_msg = ''; - $parent_msg = "\nand is referred to from '$topparent'" - if $topparent ne $var->name; - err_var ($var, - "'" . $var->name . "' includes configure substitution '$_'" - . $parent_msg . ";\nconfigure " . - "substitutions are not allowed in _SOURCES variables"); - next; - } - - # If the source file is in a subdirectory then the '.o' is put - # into the current directory, unless the subdir-objects option - # is in effect. - - # Split file name into base and extension. - next if ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/; - my $full = $_; - my $directory = $1 || ''; - my $base = $2; - my $extension = $3; - - # We must generate a rule for the object if it requires its own flags. - my $renamed = 0; - my ($linker, $object); - - # This records whether we've seen a derived source file (e.g. - # yacc output). - my $derived_source = 0; - - # This holds the 'aggregate context' of the file we are - # currently examining. If the file is compiled with - # per-object flags, then it will be the name of the object. - # Otherwise it will be 'AM'. This is used by the target hook - # language function. - my $aggregate = 'AM'; - - $extension = derive_suffix ($extension, $obj); - my $lang; - if ($extension_map{$extension} && - ($lang = $languages{$extension_map{$extension}})) - { - # 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 $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 - # 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'}; - defined &$subr or $subr = \&lang_sub_obj; - my ($r, $source_extension) - = &$subr ($directory, $base, $extension, - $obj, $have_per_exec_flags, $var); - # 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; - } - else - { - $this_obj_ext = $obj; - } - $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 - # name that is too long for losing systems, in - # some situations. So we provide _SHORTNAME to - # override. - - my $dname = $derived; - my $var = var ($derived . '_SHORTNAME'); - if ($var) - { - # FIXME: should use the same Condition as - # the _SOURCES variable. But this is really - # silly overkill -- nobody should have - # conditional shortnames. - $dname = $var->variable_value; - } - $object = $dname . '-' . $object; - - 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 ($directory ne '') - { - if ($r == LANG_SUBDIR) - { - $object = $directory . '/' . $object; - } - else - { - # Since the next major version of automake (2.0) will - # make the behaviour so far only activated with the - # 'subdir-object' option mandatory, it's better if we - # start warning users not using that option. - # As suggested by Peter Johansson, we strive to avoid - # the warning when it would be irrelevant, i.e., if - # all source files sit in "current" directory. - msg_var 'unsupported', $var, - "source file '$full' is in a subdirectory," - . "\nbut option 'subdir-objects' is disabled"; - msg 'unsupported', INTERNAL, <<'EOF', uniq_scope => US_GLOBAL; -possible forward-incompatibility. -At least a source file is in a subdirectory, but the 'subdir-objects' -automake option hasn't been enabled. For now, the corresponding output -object file(s) will be placed in the top-level directory. However, -this behaviour will change in future Automake versions: they will -unconditionally cause object files to be placed in the same subdirectory -of the corresponding sources. -You are advised to start using 'subdir-objects' option throughout your -project, to avoid future incompatibilities. -EOF - } - } - - # 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'})) - { - my $obj_sans_ext = substr ($object, 0, - - length ($this_obj_ext)); - my $full_ansi; - if ($directory ne '') - { - $full_ansi = $directory . '/' . $base . $extension; - } - else - { - $full_ansi = $base . $extension; - } - - 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'), - $extension); - - # If we renamed the object then we want to use the - # per-executable flag name. But if this is simply a - # subdir build then we still want to use the AM_ flag - # name. - if ($renamed) - { - unshift @specifics, $derived; - $aggregate = $derived; - } - else - { - unshift @specifics, 'AM'; - } - - # Each item on this list is a reference to a list consisting - # of four values followed by additional transform flags for - # file_contents. The four values are the derived flag prefix - # (e.g. for 'foo_CFLAGS', it is 'foo'), the name of the - # source file, the base name of the output file, and - # the extension for the object file. - push (@{$lang_specific_files{$lang->name}}, - [@specifics, %transform]); - } - } - elsif ($extension eq $obj) - { - # 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 - { - # No error message here. Used to have one, but it was - # very unpopular. - # FIXME: we could potentially do more processing here, - # perhaps treating the new extension as though it were a - # new source extension (as above). This would require - # more restructuring than is appropriate right now. - next; - } - - err_am "object '$object' created by '$full' and '$object_map{$object}'" - if (defined $object_map{$object} - && $object_map{$object} ne $full); - - my $comp_val = (($object =~ /\.lo$/) - ? COMPILE_LIBTOOL : COMPILE_ORDINARY); - (my $comp_obj = $object) =~ s/\.lo$/.\$(OBJEXT)/; - if (defined $object_compilation_map{$comp_obj} - && $object_compilation_map{$comp_obj} != 0 - # Only see the error once. - && ($object_compilation_map{$comp_obj} - != (COMPILE_LIBTOOL | COMPILE_ORDINARY)) - && $object_compilation_map{$comp_obj} != $comp_val) - { - err_am "object '$comp_obj' created both with libtool and without"; - } - $object_compilation_map{$comp_obj} |= $comp_val; - - if (defined $lang) - { - # Let the language do some special magic if required. - $lang->target_hook ($aggregate, $object, $full, %transform); - } - - if ($derived_source) - { - prog_error ($lang->name . " has automatic dependency tracking") - if $lang->autodep ne 'no'; - # Make sure this new source file is handled next. That will - # make it appear to be at the right place in the list. - unshift (@files, $object); - # Distribute derived sources unless the source they are - # derived from is not. - push_dist_common ($object) - unless ($topparent =~ /^(?:nobase_)?nodist_/); - next; - } - - $linkers_used{$linker} = 1; - - push (@result, $object); - - if (! defined $object_map{$object}) - { - my @dep_list = (); - $object_map{$object} = $full; - - # If resulting object is in subdir, we need to make - # sure the subdir exists at build time. - if ($object =~ /\//) - { - # FIXME: check that $DIRECTORY is somewhere in the - # project - - # For Java, the way we're handling it right now, a - # '..' component doesn't make sense. - if ($lang && $lang->name eq 'java' && $object =~ /(\/|^)\.\.\//) - { - err_am "'$full' should not contain a '..' component"; - } - - # Make sure *all* objects files in the subdirectory are - # removed by "make mostlyclean". Not only this is more - # efficient than listing the object files to be removed - # individually (which would cause an 'rm' invocation for - # each of them -- very inefficient, see bug#10697), it - # would also leave stale object files in the subdirectory - # whenever a source file there is removed or renamed. - $compile_clean_files{"$directory/*.\$(OBJEXT)"} = MOSTLY_CLEAN; - if ($object =~ /\.lo$/) - { - # If we have a libtool object, then we also must remove - # any '.lo' objects in its same subdirectory. - $compile_clean_files{"$directory/*.lo"} = MOSTLY_CLEAN; - # Remember to cleanup .libs/ in this directory. - $libtool_clean_directories{$directory} = 1; - } - - push (@dep_list, require_build_directory ($directory)); - - # If we're generating dependencies, we also want - # to make sure that the appropriate subdir of the - # .deps directory is created. - push (@dep_list, - require_build_directory ($directory . '/$(DEPDIR)')) - unless option 'no-dependencies'; - } - - pretty_print_rule ($object . ':', "\t", @dep_list) - if scalar @dep_list > 0; - } - - # Transform .o or $o file into .P file (for automatic - # dependency code). - # Properly flatten multiple adjacent slashes, as Solaris 10 make - # might fail over them in an include statement. - # Leading double slashes may be special, as per Posix, so deal - # with them carefully. - if ($lang && $lang->autodep ne 'no') - { - my $depfile = $object; - $depfile =~ s/\.([^.]*)$/.P$1/; - $depfile =~ s/\$\(OBJEXT\)$/o/; - my $maybe_extra_leading_slash = ''; - $maybe_extra_leading_slash = '/' if $depfile =~ m,^//[^/],; - $depfile =~ s,/+,/,g; - my $basename = basename ($depfile); - # This might make $dirname empty, but we account for that below. - (my $dirname = dirname ($depfile)) =~ s/\/*$//; - $dirname = $maybe_extra_leading_slash . $dirname; - $dep_files{$dirname . '/$(DEPDIR)/' . $basename} = 1; - } - } - - return @result; -} - - -# $LINKER -# define_objects_from_sources ($VAR, $OBJVAR, $NODEFINE, $ONE_FILE, -# $OBJ, $PARENT, $TOPPARENT, $WHERE, %TRANSFORM) -# --------------------------------------------------------------------------- -# Define an _OBJECTS variable for a _SOURCES variable (or subvariable) -# -# Arguments are: -# $VAR is the name of the _SOURCES variable -# $OBJVAR is the name of the _OBJECTS variable if known (otherwise -# it will be generated and returned). -# $NODEFINE is a boolean: if true, $OBJVAR will not be defined (but -# work done to determine the linker will be). -# $ONE_FILE is the canonical (transformed) name of object to build -# $OBJ is the object extension (i.e. either '.o' or '.lo'). -# $TOPPARENT is the _SOURCES variable being processed. -# $WHERE context into which this definition is done -# %TRANSFORM extra arguments to pass to file_contents when producing -# rules -# -# Result is a pair ($LINKER, $OBJVAR): -# $LINKER is a boolean, true if a linker is needed to deal with the objects -sub define_objects_from_sources -{ - my ($var, $objvar, $nodefine, $one_file, - $obj, $topparent, $where, %transform) = @_; - - my $needlinker = ""; - - transform_variable_recursively - ($var, $objvar, 'am__objects', $nodefine, $where, - # The transform code to run on each filename. - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - my @trans = handle_single_transform ($subvar, $topparent, - $one_file, $obj, $val, - %transform); - $needlinker = "true" if @trans; - return @trans; - }); - - return $needlinker; -} - - -# handle_source_transform ($CANON_TARGET, $TARGET, $OBJEXT, $WHERE, %TRANSFORM) -# ----------------------------------------------------------------------------- -# Handle SOURCE->OBJECT transform for one program or library. -# Arguments are: -# canonical (transformed) name of target to build -# actual target of object to build -# object extension (i.e., either '.o' or '$o') -# location of the source variable -# extra arguments to pass to file_contents when producing rules -# Return the name of the linker variable that must be used. -# Empty return means just use 'LINK'. -sub handle_source_transform -{ - # one_file is canonical name. unxformed is given name. obj is - # object extension. - my ($one_file, $unxformed, $obj, $where, %transform) = @_; - - my $linker = ''; - - # No point in continuing if _OBJECTS is defined. - return if reject_var ($one_file . '_OBJECTS', - $one_file . '_OBJECTS should not be defined'); - - my %used_pfx = (); - my $needlinker; - %linkers_used = (); - foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_', - 'dist_EXTRA_', 'nodist_EXTRA_') - { - my $varname = $prefix . $one_file . "_SOURCES"; - my $var = var $varname; - next unless $var; - - # We are going to define _OBJECTS variables using the prefix. - # Then we glom them all together. So we can't use the null - # prefix here as we need it later. - my $xpfx = ($prefix eq '') ? 'am_' : $prefix; - - # Keep track of which prefixes we saw. - $used_pfx{$xpfx} = 1 - unless $prefix =~ /EXTRA_/; - - push @sources, "\$($varname)"; - push @dist_sources, shadow_unconditionally ($varname, $where) - unless (option ('no-dist') || $prefix =~ /^nodist_/); - - $needlinker |= - define_objects_from_sources ($varname, - $xpfx . $one_file . '_OBJECTS', - !!($prefix =~ /EXTRA_/), - $one_file, $obj, $varname, $where, - DIST_SOURCE => ($prefix !~ /^nodist_/), - %transform); - } - if ($needlinker) - { - $linker ||= resolve_linker (%linkers_used); - } - - my @keys = sort keys %used_pfx; - if (scalar @keys == 0) - { - # The default source for libfoo.la is libfoo.c, but for - # backward compatibility we first look at libfoo_la.c, - # if no default source suffix is given. - my $old_default_source = "$one_file.c"; - my $ext_var = var ('AM_DEFAULT_SOURCE_EXT'); - my $default_source_ext = $ext_var ? variable_value ($ext_var) : '.c'; - msg_var ('unsupported', $ext_var, $ext_var->name . " can assume at most one value") - if $default_source_ext =~ /[\t ]/; - (my $default_source = $unxformed) =~ s,(\.[^./\\]*)?$,$default_source_ext,; - # TODO: Remove this backward-compatibility hack in Automake 2.0. - if ($old_default_source ne $default_source - && !$ext_var - && (rule $old_default_source - || rule '$(srcdir)/' . $old_default_source - || rule '${srcdir}/' . $old_default_source - || -f $old_default_source)) - { - my $loc = $where->clone; - $loc->pop_context; - msg ('obsolete', $loc, - "the default source for '$unxformed' has been changed " - . "to '$default_source'.\n(Using '$old_default_source' for " - . "backward compatibility.)"); - $default_source = $old_default_source; - } - # If a rule exists to build this source with a $(srcdir) - # prefix, use that prefix in our variables too. This is for - # the sake of BSD Make. - if (rule '$(srcdir)/' . $default_source - || rule '${srcdir}/' . $default_source) - { - $default_source = '$(srcdir)/' . $default_source; - } - - define_variable ($one_file . "_SOURCES", $default_source, $where); - push (@sources, $default_source); - push (@dist_sources, $default_source); - - %linkers_used = (); - my (@result) = - handle_single_transform ($one_file . '_SOURCES', - $one_file . '_SOURCES', - $one_file, $obj, - $default_source, %transform); - $linker ||= resolve_linker (%linkers_used); - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result); - } - else - { - @keys = map { '$(' . $_ . $one_file . '_OBJECTS)' } @keys; - define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @keys); - } - - # If we want to use 'LINK' we must make sure it is defined. - if ($linker eq '') - { - $need_link = 1; - } - - return $linker; -} - - -# handle_lib_objects ($XNAME, $VAR) -# --------------------------------- -# Special-case ALLOCA and LIBOBJS substitutions in _LDADD or _LIBADD variables. -# Also, generate _DEPENDENCIES variable if appropriate. -# Arguments are: -# transformed name of object being built, or empty string if no object -# name of _LDADD/_LIBADD-type variable to examine -# Returns 1 if LIBOBJS seen, 0 otherwise. -sub handle_lib_objects -{ - my ($xname, $varname) = @_; - - my $var = var ($varname); - prog_error "'$varname' undefined" - unless $var; - prog_error "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 - # lax here since this code also applies to non-libtool - # libraries or programs, for which -dlopen and -dlopreopen - # are pure nonsense. Diagnosing this doesn't seem very - # important: the developer will quickly get complaints from - # the linker.) - $val !~ /^-dl(?:pre)?open$/ && - # Only get this error once. - ! $flagvar) - { - $flagvar = 1; - # FIXME: should display a stack of nested variables - # as context when $var != $subvar. - err_var ($var, "linker flags such as '$val' belong in " - . "'${prefix}LDFLAGS'"); - } - return (); - } - elsif ($val !~ /^\@.*\@$/) - { - # Assume we have a file of some sort, and output it into the - # dependency variable. Autoconf substitutions are not output; - # rarely is a new dependency substituted into e.g. foo_LDADD - # -- but bad things (e.g. -lX11) are routinely substituted. - # Note that LIBOBJS and ALLOCA are exceptions to this rule, - # and handled specially below. - return $val; - } - elsif ($val =~ /^\@(LT)?LIBOBJS\@$/) - { - handle_LIBOBJS ($subvar, $cond, $1); - $seen_libobjs = 1; - return $val; - } - elsif ($val =~ /^\@(LT)?ALLOCA\@$/) - { - handle_ALLOCA ($subvar, $cond, $1); - return $val; - } - else - { - return (); - } - }); - - return $seen_libobjs; -} - -# 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 -{ - my ($var) = @_; - - my $dir = ''; - - # 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 = backname ($relative_dir) . "/$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//; - } - else - { - error ("'\$($var)' cannot be used outside '$config_libobj_dir' if" - . " 'subdir-objects' is not set"); - } - } - - return $dir; -} - -sub handle_LIBOBJS -{ - my ($var, $cond, $lt) = @_; - my $myobjext = $lt ? 'lo' : 'o'; - $lt ||= ''; - - $var->requires_variables ("\@${lt}LIBOBJS\@ used", $lt . 'LIBOBJS') - if ! keys %libsources; - - my $dir = handle_LIBOBJS_or_ALLOCA "${lt}LIBOBJS"; - - foreach my $iter (keys %libsources) - { - if ($iter =~ /\.[cly]$/) - { - saw_extension ($&); - saw_extension ('.c'); - } - - if ($iter =~ /\.h$/) - { - require_libsource_with_macro ($cond, $var, FOREIGN, $iter); - } - elsif ($iter ne 'alloca.c') - { - 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); - } - } - } -} - -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'); -} - -# 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; -} - -# Set up the compile suite. -sub handle_compile () -{ - return if ! $must_handle_compiled_objects; - - # Boilerplate. - my $default_includes = ''; - if (! option 'nostdinc') - { - my @incs = ('-I.', subst ('am__isrc')); - - my $var = var 'CONFIG_HEADER'; - if ($var) - { - foreach my $hdr (split (' ', $var->variable_value)) - { - push @incs, '-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 put @am__isrc@ right after '-I.', without a space. - ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/; - } - - my (@mostly_rms, @dist_rms); - foreach my $item (sort keys %compile_clean_files) - { - if ($compile_clean_files{$item} == MOSTLY_CLEAN) - { - push (@mostly_rms, "\t-rm -f $item"); - } - elsif ($compile_clean_files{$item} == DIST_CLEAN) - { - push (@dist_rms, "\t-rm -f $item"); - } - else - { - prog_error 'invalid entry in %compile_clean_files'; - } - } - - my ($coms, $vars, $rules) = - file_contents_internal (1, "$libdir/am/compile.am", - new Automake::Location, - 'DEFAULT_INCLUDES' => $default_includes, - 'MOSTLYRMS' => join ("\n", @mostly_rms), - 'DISTRMS' => join ("\n", @dist_rms)); - $output_vars .= $vars; - $output_rules .= "$coms$rules"; -} - -# Handle libtool rules. -sub handle_libtool () -{ - return unless var ('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; - - 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"); - } - - check_user_variables 'LIBTOOLFLAGS'; - - # Output the libtool compilation rules. - $output_rules .= file_contents ('libtool', - new Automake::Location, - LTRMS => join ("\n", @libtool_rms)); -} - - -sub handle_programs () -{ - my @proglist = am_install_var ('progs', 'PROGRAMS', - 'bin', 'sbin', 'libexec', 'pkglibexec', - 'noinst', 'check'); - return if ! @proglist; - $must_handle_compiled_objects = 1; - - my $seen_global_libobjs = - var ('LDADD') && handle_lib_objects ('', 'LDADD'); - - foreach my $pair (@proglist) - { - my ($where, $one_file) = @$pair; - - my $seen_libobjs = 0; - my $obj = '.$(OBJEXT)'; - - $known_programs{$one_file} = $where; - - # Canonicalize names and check for misspellings. - my $xname = check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS', - '_SOURCES', '_OBJECTS', - '_DEPENDENCIES'); - - $where->push_context ("while processing program '$one_file'"); - $where->set (INTERNAL->get); - - my $linker = handle_source_transform ($xname, $one_file, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); - - if (var ($xname . "_LDADD")) - { - $seen_libobjs = handle_lib_objects ($xname, $xname . '_LDADD'); - } - else - { - # User didn't define prog_LDADD override. So do it. - define_variable ($xname . '_LDADD', '$(LDADD)', $where); - - # This does a bit too much work. But we need it to - # generate _DEPENDENCIES when appropriate. - if (var ('LDADD')) - { - $seen_libobjs = handle_lib_objects ($xname, 'LDADD'); - } - } - - reject_var ($xname . '_LIBADD', - "use '${xname}_LDADD', not '${xname}_LIBADD'"); - - set_seen ($xname . '_DEPENDENCIES'); - set_seen ('EXTRA_' . $xname . '_DEPENDENCIES'); - set_seen ($xname . '_LDFLAGS'); - - # Determine program to use for link. - my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname); - $vlink = verbose_flag ($vlink || 'GEN'); - - # If the resulting program lies in a subdirectory, - # ensure that the directory exists before we need it. - my $dirstamp = require_build_directory_maybe ($one_file); - - $libtool_clean_directories{dirname ($one_file)} = 1; - - $output_rules .= file_contents ('program', - $where, - PROGRAM => $one_file, - XPROGRAM => $xname, - XLINK => $xlink, - VERBOSE => $vlink, - DIRSTAMP => $dirstamp, - EXEEXT => '$(EXEEXT)'); - - if ($seen_libobjs || $seen_global_libobjs) - { - if (var ($xname . '_LDADD')) - { - check_libobjs_sources ($xname, $xname . '_LDADD'); - } - elsif (var ('LDADD')) - { - check_libobjs_sources ($xname, 'LDADD'); - } - } - } -} - - -sub handle_libraries () -{ - my @liblist = am_install_var ('libs', 'LIBRARIES', - 'lib', 'pkglib', 'noinst', 'check'); - return if ! @liblist; - $must_handle_compiled_objects = 1; - - 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); - define_verbose_tagvar ('AR'); - - foreach my $pair (@liblist) - { - my ($where, $onelib) = @$pair; - - my $seen_libobjs = 0; - # Check that the library fits the standard naming convention. - my $bn = basename ($onelib); - if ($bn !~ /^lib.*\.a$/) - { - $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.a/; - my $suggestion = dirname ($onelib) . "/$bn"; - $suggestion =~ s|^\./||g; - msg ('error-gnu/warn', $where, - "'$onelib' is not a standard library name\n" - . "did you mean '$suggestion'?") - } - - ($known_libraries{$onelib} = $bn) =~ s/\.a$//; - - $where->push_context ("while processing library '$onelib'"); - $where->set (INTERNAL->get); - - my $obj = '.$(OBJEXT)'; - - # Canonicalize names and check for misspellings. - my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES', - '_OBJECTS', '_DEPENDENCIES', - '_AR'); - - if (! var ($xlib . '_AR')) - { - define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where); - } - - # Generate support for conditional object inclusion in - # libraries. - if (var ($xlib . '_LIBADD')) - { - if (handle_lib_objects ($xlib, $xlib . '_LIBADD')) - { - $seen_libobjs = 1; - } - } - else - { - define_variable ($xlib . "_LIBADD", '', $where); - } - - reject_var ($xlib . '_LDADD', - "use '${xlib}_LIBADD', not '${xlib}_LDADD'"); - - # Make sure we at look at this. - set_seen ($xlib . '_DEPENDENCIES'); - set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES'); - - handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 1, LIBTOOL => 0); - - # If the resulting library lies in a subdirectory, - # make sure this directory will exist. - my $dirstamp = require_build_directory_maybe ($onelib); - my $verbose = verbose_flag ('AR'); - my $silent = silent_flag (); - - $output_rules .= file_contents ('library', - $where, - VERBOSE => $verbose, - SILENT => $silent, - LIBRARY => $onelib, - XLIBRARY => $xlib, - DIRSTAMP => $dirstamp); - - if ($seen_libobjs) - { - if (var ($xlib . '_LIBADD')) - { - check_libobjs_sources ($xlib, $xlib . '_LIBADD'); - } - } - - if (! $seen_ar) - { - msg ('extra-portability', $where, - "'$onelib': linking libraries using a non-POSIX\n" - . "archiver requires 'AM_PROG_AR' in '$configure_ac'") - } - } -} - - -sub handle_ltlibraries () -{ - my @liblist = am_install_var ('ltlib', 'LTLIBRARIES', - 'noinst', 'lib', 'pkglib', 'check'); - return if ! @liblist; - $must_handle_compiled_objects = 1; - - 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 %instsubdirs = (); - my %instconds = (); - my %liblocations = (); # Location (in Makefile.am) of each library. - - foreach my $key (@prefix) - { - # Get the installation directory of each library. - my $dir = $key; - my $strip_subdir = 1; - if ($dir =~ /^nobase_/) - { - $dir =~ s/^nobase_//; - $strip_subdir = 0; - } - 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; - my $ldir = ''; - $ldir = '/' . dirname ($val) - if (!$strip_subdir); - # A library cannot be installed in different directories - # 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 " . ($strip_subdir ? "in" : "below") . " '$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; - $instsubdirs{$val}{$full_cond} = $ldir; - $liblocations{$val}{$full_cond} = $where; - $instconds{$val} = $instconds{$val}->merge ($full_cond); - }, - sub - { - return (); - }, - skip_ac_subst => 1); - } - - foreach my $pair (@liblist) - { - my ($where, $onelib) = @$pair; - - my $seen_libobjs = 0; - my $obj = '.lo'; - - # Canonicalize names and check for misspellings. - my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS', - '_SOURCES', '_OBJECTS', - '_DEPENDENCIES'); - - # Check that the library fits the standard naming convention. - my $libname_rx = '^lib.*\.la'; - my $ldvar = var ("${xlib}_LDFLAGS") || var ('AM_LDFLAGS'); - my $ldvar2 = var ('LDFLAGS'); - if (($ldvar && grep (/-module/, $ldvar->value_as_list_recursive)) - || ($ldvar2 && grep (/-module/, $ldvar2->value_as_list_recursive))) - { - # Relax name checking for libtool modules. - $libname_rx = '\.la'; - } - - my $bn = basename ($onelib); - if ($bn !~ /$libname_rx$/) - { - my $type = 'library'; - if ($libname_rx eq '\.la') - { - $bn =~ s/^(lib|)(.*?)(?:\.[^.]*)?$/$1$2.la/; - $type = 'module'; - } - else - { - $bn =~ s/^(?:lib)?(.*?)(?:\.[^.]*)?$/lib$1.la/; - } - my $suggestion = dirname ($onelib) . "/$bn"; - $suggestion =~ s|^\./||g; - msg ('error-gnu/warn', $where, - "'$onelib' is not a standard libtool $type name\n" - . "did you mean '$suggestion'?") - } - - ($known_libraries{$onelib} = $bn) =~ s/\.la$//; - - $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'); - set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES'); - - # Generate support for conditional object inclusion in - # libraries. - if (var ($xlib . '_LIBADD')) - { - if (handle_lib_objects ($xlib, $xlib . '_LIBADD')) - { - $seen_libobjs = 1; - } - } - else - { - define_variable ($xlib . "_LIBADD", '', $where); - } - - reject_var ("${xlib}_LDADD", - "use '${xlib}_LIBADD', not '${xlib}_LDADD'"); - - - my $linker = handle_source_transform ($xlib, $onelib, $obj, $where, - NONLIBTOOL => 0, LIBTOOL => 1); - - # Determine program to use for link. - my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xlib); - $vlink = verbose_flag ($vlink || 'GEN'); - - 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)'); - $val .= $instsubdirs{$onelib}{$rcond} - if defined $instsubdirs{$onelib}{$rcond}; - } - if ($rcond->true) - { - # If $rcond is true there is only one condition and - # there is no point defining an helper variable. - $rpath = $val; - } - else - { - define_pretty_variable ($rpathvar, $rcond, INTERNAL, $val); - } - } - - # If the resulting library lies in a subdirectory, - # make sure this directory will exist. - my $dirstamp = require_build_directory_maybe ($onelib); - - # Remember to cleanup .libs/ in this directory. - my $dirname = dirname $onelib; - $libtool_clean_directories{$dirname} = 1; - - $output_rules .= file_contents ('ltlibrary', - $where, - LTLIBRARY => $onelib, - XLTLIBRARY => $xlib, - RPATH => $rpath, - XLINK => $xlink, - VERBOSE => $vlink, - DIRSTAMP => $dirstamp); - if ($seen_libobjs) - { - if (var ($xlib . '_LIBADD')) - { - check_libobjs_sources ($xlib, $xlib . '_LIBADD'); - } - } - - if (! $seen_ar) - { - msg ('extra-portability', $where, - "'$onelib': linking libtool libraries using a non-POSIX\n" - . "archiver requires 'AM_PROG_AR' in '$configure_ac'") - } - } -} - -# See if any _SOURCES variable were misspelled. -sub check_typos () -{ - # It is ok if the user sets this particular variable. - set_seen 'AM_LDFLAGS'; - - foreach my $primary ('SOURCES', 'LIBADD', 'LDADD', 'LDFLAGS', 'DEPENDENCIES') - { - foreach my $var (variables $primary) - { - my $varname = $var->name; - # A configure variable is always legitimate. - next if exists $configure_vars{$varname}; - - for my $cond ($var->conditions->conds) - { - $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/; - msg_var ('syntax', $var, "variable '$varname' is defined but no" - . " program or\nlibrary has '$1' as canonical name" - . " (possible typo)") - unless $var->rdef ($cond)->seen; - } - } - } -} - - -sub handle_scripts () -{ - # NOTE we no longer automatically clean SCRIPTS, because it is - # useful to sometimes distribute scripts verbatim. This happens - # e.g. in Automake itself. - am_install_var ('-candist', 'scripts', 'SCRIPTS', - 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata', - 'noinst', 'check'); -} - - -## ------------------------ ## -## Handling Texinfo files. ## -## ------------------------ ## - -# ($OUTFILE, $VFILE) -# scan_texinfo_file ($FILENAME) -# ----------------------------- -# $OUTFILE - name of the info file produced by $FILENAME. -# $VFILE - name of the version.texi file used (undef if none). -sub scan_texinfo_file -{ - my ($filename) = @_; - - 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 (index ($outfile, '.') < 0) - { - msg 'obsolete', "$filename:$.", - "use of suffix-less info files is discouraged" - } - elsif ($outfile !~ /\.info$/) - { - error ("$filename:$.", - "output '$outfile' has unrecognized extension"); - return; - } - } - # A "version.texi" file is actually any file whose name matches - # "vers*.texi". - elsif (/^\@include\s+(vers[^.]*\.texi)\s*$/) - { - $vfile = $1; - } - } - - if (! $outfile) - { - err_am "'$filename' missing \@setfilename"; - return; - } - - return ($outfile, $vfile); -} - - -# ($DIRSTAMP, @CLEAN_FILES) -# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES) -# ------------------------------------------------------------------ -# SOURCE - the source Texinfo file -# DEST - the destination Info file -# INSRC - whether DEST should be built in the source tree -# DEPENDENCIES - known dependencies -sub output_texinfo_build_rules -{ - my ($source, $dest, $insrc, @deps) = @_; - - # Split 'a.texi' into 'a' and '.texi'. - my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/); - my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/); - - $ssfx ||= ""; - $dsfx ||= ""; - - # We can output two kinds of rules: the "generic" rules use Make - # suffix rules and are appropriate when $source and $dest do not lie - # in a sub-directory; the "specific" rules are needed in the other - # case. - # - # The former are output only once (this is not really apparent here, - # but just remember that some logic deeper in Automake will not - # output the same rule twice); while the later need to be output for - # each Texinfo source. - my $generic; - my $makeinfoflags; - my $sdir = dirname $source; - if ($sdir eq '.' && dirname ($dest) eq '.') - { - $generic = 1; - $makeinfoflags = '-I $(srcdir)'; - } - else - { - $generic = 0; - $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir"; - } - - # A directory can contain two kinds of info files: some built in the - # source tree, and some built in the build tree. The rules are - # different in each case. However we cannot output two different - # set of generic rules. Because in-source builds are more usual, we - # use generic rules in this case and fall back to "specific" rules - # for build-dir builds. (It should not be a problem to invert this - # if needed.) - $generic = 0 unless $insrc; - - # We cannot use a suffix rule to build info files with an empty - # extension. Otherwise we would output a single suffix inference - # rule, with separate dependencies, as in - # - # .texi: - # $(MAKEINFO) ... - # foo.info: foo.texi - # - # which confuse Solaris make. (See the Autoconf manual for - # details.) Therefore we use a specific rule in this case. This - # applies to info files only (dvi and pdf files always have an - # extension). - my $generic_info = ($generic && $dsfx) ? 1 : 0; - - # If the resulting file lies in 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, - AM_V_MAKEINFO => verbose_flag('MAKEINFO'), - AM_V_TEXI2DVI => verbose_flag('TEXI2DVI'), - AM_V_TEXI2PDF => verbose_flag('TEXI2PDF'), - DEPS => "@deps", - DEST_PREFIX => $dpfx, - DEST_INFO_PREFIX => $dipfx, - DEST_SUFFIX => $dsfx, - DIRSTAMP => $dirstamp, - GENERIC => $generic, - GENERIC_INFO => $generic_info, - INSRC => $insrc, - MAKEINFOFLAGS => $makeinfoflags, - SILENT => silent_flag(), - SOURCE => ($generic - ? '$<' : $source), - SOURCE_INFO => ($generic_info - ? '$<' : $source), - SOURCE_REAL => $source, - SOURCE_SUFFIX => $ssfx, - TEXIQUIET => verbose_flag('texinfo'), - TEXIDEVNULL => verbose_flag('texidevnull'), - ); - return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html"); -} - - -# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN) -# 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 (@mostly_cleans, @texi_cleans, @maint_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; - if ($infobase =~ s/\.texi$//) - { - 1; # Nothing more to do. - } - elsif ($infobase =~ s/\.(txi|texinfo)$//) - { - msg_var 'obsolete', $info_texinfos, - "suffix '.$1' for Texinfo files is discouraged;" . - " use '.texi' instead"; - } - else - { - # 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) = - scan_texinfo_file ("$relative_dir/$texi") - or next; - # Directory of auxiliary files and build by-products used by texi2dvi - # and texi2pdf. - push @mostly_cleans, "$infobase.t2d"; - push @mostly_cleans, "$infobase.t2p"; - - # 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_TEXINFOS = foo.texi - # nodist_foo_TEXINFOS = 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 - # wants to distribute .texi files, but does 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 in two cases: - # (1) 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. - # (2) When the undocumented option 'info-in-builddir' is given. - # This is done to allow the developers of GCC, GDB, GNU - # binutils and the GNU bfd library to force the '.info' files - # to be generated in the builddir rather than the srcdir, as - # was once done when the (now removed) 'cygnus' option was - # given. See automake bug#11034 for more discussion. - my $insrc = 1; - my $soutdir = '$(srcdir)/' . $outdir; - - if (option 'info-in-builddir') - { - $insrc = 0; - } - elsif ($out_file =~ $user_cleaned_files) - { - $insrc = 0; - msg 'obsolete', "$am_file.am", < $texi, - VTI => $vti, - STAMPVTI => "${soutdir}stamp-$vti", - VTEXI => "$soutdir$vtexi", - MDDIR => $conf_dir, - DIRSTAMP => $dirstamp); - } - } - - # Handle location of texinfo.tex. - my $need_texi_file = 0; - my $texinfodir; - if (var ('TEXINFO_TEX')) - { - # The user defined TEXINFO_TEX so assume he knows what he is - # doing. - $texinfodir = ('$(srcdir)/' - . dirname (variable_value ('TEXINFO_TEX'))); - } - elsif ($config_aux_dir_set_in_configure_ac) - { - $texinfodir = $am_config_aux_dir; - define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL); - $need_texi_file = 2; # so that we require_conf_file later - } - else - { - $texinfodir = '$(srcdir)'; - $need_texi_file = 1; - } - define_variable ('am__TEXINFO_TEX_DIR', $texinfodir, INTERNAL); - - push (@dist_targets, 'dist-info'); - - if (! option 'no-installinfo') - { - # Make sure documentation is made and installed first. Use - # $(INFO_DEPS), not 'info', because otherwise recursive makes - # get run twice during "make all". - unshift (@all, '$(INFO_DEPS)'); - } - - define_files_variable ("DVIS", @infobase, 'dvi', INTERNAL); - define_files_variable ("PDFS", @infobase, 'pdf', INTERNAL); - define_files_variable ("PSS", @infobase, 'ps', INTERNAL); - define_files_variable ("HTMLS", @infobase, 'html', INTERNAL); - - # This next isn't strictly needed now -- the places that look here - # could easily be changed to look in info_TEXINFOS. But this is - # probably better, in case noinst_TEXINFOS is ever supported. - define_variable ("TEXINFOS", variable_value ('info_TEXINFOS'), INTERNAL); - - # Do some error checking. Note that this file is not required - # when in Cygnus mode; instead we defined TEXINFO_TEX explicitly - # up above. - if ($need_texi_file && ! option 'no-texinfo.tex') - { - if ($need_texi_file > 1) - { - require_conf_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); - } - else - { - require_file_with_macro (TRUE, 'info_TEXINFOS', FOREIGN, - 'texinfo.tex'); - } - } - - return (makefile_wrap ("", "\t ", @mostly_cleans), - makefile_wrap ("", "\t ", @texi_cleans), - makefile_wrap ("", "\t ", @maint_cleans)); -} - - -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 ($mostlyclean, $clean, $maintclean) = ('', '', ''); - if ($info_texinfos) - { - define_verbose_texinfo; - ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos); - chomp $mostlyclean; - chomp $clean; - chomp $maintclean; - } - - $output_rules .= file_contents ('texinfos', - new Automake::Location, - AM_V_DVIPS => verbose_flag('DVIPS'), - MOSTLYCLEAN => $mostlyclean, - TEXICLEAN => $clean, - MAINTCLEAN => $maintclean, - 'LOCAL-TEXIS' => !!$info_texinfos, - TEXIQUIET => verbose_flag('texinfo')); -} - - -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, %notrans_sections, %trans_sections, - %notrans_vars, %trans_vars, %notrans_sect_vars, %trans_sect_vars); - # We handle nodist_ for uniformity. man pages aren't distributed - # by default so it isn't actually very important. - foreach my $npfx ('', 'notrans_') - { - foreach my $pfx ('', 'dist_', 'nodist_') - { - # Add more sections as needed. - foreach my $section ('0'..'9', 'n', 'l') - { - my $varname = $npfx . $pfx . 'man' . $section . '_MANS'; - if (var ($varname)) - { - $sections{$section} = 1; - $varname = '$(' . $varname . ')'; - if ($npfx eq 'notrans_') - { - $notrans_sections{$section} = 1; - $notrans_sect_vars{$varname} = 1; - } - else - { - $trans_sections{$section} = 1; - $trans_sect_vars{$varname} = 1; - } - - push_dist_common ($varname) - if $pfx eq 'dist_'; - } - } - - my $varname = $npfx . $pfx . 'man_MANS'; - my $var = var ($varname); - if ($var) - { - foreach ($var->value_as_list_recursive) - { - # A page like 'foo.1c' goes into man1dir. - if (/\.([0-9a-z])([a-z]*)$/) - { - $sections{$1} = 1; - if ($npfx eq 'notrans_') - { - $notrans_sections{$1} = 1; - } - else - { - $trans_sections{$1} = 1; - } - } - } - - $varname = '$(' . $varname . ')'; - if ($npfx eq 'notrans_') - { - $notrans_vars{$varname} = 1; - } - else - { - $trans_vars{$varname} = 1; - } - push_dist_common ($varname) - if $pfx eq 'dist_'; - } - } - } - - return unless %sections; - - my @unsorted_deps; - - # Build section independent variables. - my $have_notrans = %notrans_vars; - my @notrans_list = sort keys %notrans_vars; - my $have_trans = %trans_vars; - my @trans_list = sort keys %trans_vars; - - # Now for each section, generate an install and uninstall rule. - # Sort sections so output is deterministic. - foreach my $section (sort keys %sections) - { - # Build section dependent variables. - my $notrans_mans = $have_notrans || exists $notrans_sections{$section}; - my $trans_mans = $have_trans || exists $trans_sections{$section}; - my (%notrans_this_sect, %trans_this_sect); - my $expr = 'man' . $section . '_MANS'; - foreach my $varname (keys %notrans_sect_vars) - { - if ($varname =~ /$expr/) - { - $notrans_this_sect{$varname} = 1; - } - } - foreach my $varname (keys %trans_sect_vars) - { - if ($varname =~ /$expr/) - { - $trans_this_sect{$varname} = 1; - } - } - my @notrans_sect_list = sort keys %notrans_this_sect; - my @trans_sect_list = sort keys %trans_this_sect; - @unsorted_deps = (keys %notrans_vars, keys %trans_vars, - keys %notrans_this_sect, keys %trans_this_sect); - my @deps = sort @unsorted_deps; - $output_rules .= file_contents ('mans', - new Automake::Location, - SECTION => $section, - DEPS => "@deps", - NOTRANS_MANS => $notrans_mans, - NOTRANS_SECT_LIST => "@notrans_sect_list", - HAVE_NOTRANS => $have_notrans, - NOTRANS_LIST => "@notrans_list", - TRANS_MANS => $trans_mans, - TRANS_SECT_LIST => "@trans_sect_list", - HAVE_TRANS => $have_trans, - TRANS_LIST => "@trans_list"); - } - - @unsorted_deps = (keys %notrans_vars, keys %trans_vars, - keys %notrans_sect_vars, keys %trans_sect_vars); - my @mans = sort @unsorted_deps; - $output_vars .= file_contents ('mans-vars', - new Automake::Location, - MANS => "@mans"); - - push (@all, '$(MANS)') - unless option 'no-installman'; -} - - -sub handle_data () -{ - am_install_var ('-noextra', '-candist', 'data', 'DATA', - 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf', - 'ps', 'sysconf', 'sharedstate', 'localstate', - 'pkgdata', 'lisp', 'noinst', 'check'); -} - - -sub handle_tags () -{ - 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); - } - } - - define_variable ('am__tagged_files', - '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)' - . "@config", INTERNAL); - - if (rvar('am__tagged_files')->value_as_list_recursive - || var ('ETAGS_ARGS') || var ('SUBDIRS')) - { - $output_rules .= file_contents ('tags', new Automake::Location); - set_seen 'TAGS_DEPENDENCIES'; - } - else - { - reject_var ('TAGS_DEPENDENCIES', - "it doesn't make sense to define 'TAGS_DEPENDENCIES'" - . " without\nsources or 'ETAGS_ARGS'"); - # 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. Ditto ctags and - # cscope. - $output_rules .= - "tags TAGS:\n\n" . - "ctags CTAGS:\n\n" . - "cscope cscopelist:\n\n"; - } -} - - -# user_phony_rule ($NAME) -# ----------------------- -# Return false if rule $NAME does not exist. Otherwise, -# declare it as phony, complete its definition (in case it is -# conditional), and return its Automake::Rule instance. -sub user_phony_rule -{ - my ($name) = @_; - my $rule = rule $name; - if ($rule) - { - depend ('.PHONY', $name); - # Define $NAME in all condition where it is not already defined, - # so that it is always OK to depend on $NAME. - for my $c ($rule->not_always_defined_in_cond (TRUE)->conds) - { - Automake::Rule::define ($name, 'internal', RULE_AUTOMAKE, - $c, INTERNAL); - $output_rules .= $c->subst_string . "$name:\n"; - } - } - return $rule; -} - - -# Handle 'dist' target. -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'; - - # 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-$_" } qw(shar zip tarZ bzip2 lzip xz); - error (option 'no-dist-gzip', - "no-dist-gzip specified but no dist-* specified,\n" - . "at least one archive format must be enabled") - unless $archive_defined; - } - - # Look for common files that should be included in distribution. - # If the aux dir is set, and it does not have a Makefile.am, then - # we check for these files there as well. - my $check_aux = 0; - if ($relative_dir eq '.' - && $config_aux_dir_set_in_configure_ac) - { - if (! is_make_dir ($config_aux_dir)) - { - $check_aux = 1; - } - } - foreach my $cfile (@common_files) - { - if (dir_has_case_matching_file ($relative_dir, $cfile) - # The file might be absent, but if it can be built it's ok. - || rule $cfile) - { - push_dist_common ($cfile); - } - - # Don't use 'elsif' here because a file might meaningfully - # appear in both directories. - if ($check_aux && dir_has_case_matching_file ($config_aux_dir, $cfile)) - { - push_dist_common ("$config_aux_dir/$cfile") - } - } - - # We might copy elements from $configure_dist_common to - # %dist_common if we think we need to. If the file appears in our - # directory, we would have discovered it already, so we don't - # check that. But if the file is in a subdir without a Makefile, - # we want to distribute it here if we are doing '.'. Ugly! - # Also, in some corner cases, it's possible that the following code - # will cause the same file to appear in the $(DIST_COMMON) variables - # of two distinct Makefiles; but this is not a problem, since the - # 'distdir' target in 'lib/am/distdir.am' can deal with the same - # file being distributed multiple times. - # See also automake bug#9651. - if ($relative_dir eq '.') - { - foreach my $file (split (' ' , $configure_dist_common)) - { - my $dir = dirname ($file); - push_dist_common ($file) - if ($dir eq '.' || ! is_make_dir ($dir)); - } - } - - # 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 (@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; - - $transform{'DISTCHECK-HOOK'} = !! rule 'distcheck-hook'; - $transform{'GETTEXT'} = $seen_gettext && !$seen_gettext_external; - - # If the target 'dist-hook' exists, make sure it is run. This - # allows users to do random weird things to the distribution - # before it is packaged up. - push (@dist_targets, 'dist-hook') - if user_phony_rule 'dist-hook'; - $transform{'DIST-TARGETS'} = join (' ', @dist_targets); - - my $flm = option ('filename-length-max'); - my $filename_filter = $flm ? '.' x $flm->[1] : ''; - - $output_rules .= file_contents ('distdir', - new Automake::Location, - %transform, - FILENAME_FILTER => $filename_filter); -} - - -# check_directory ($NAME, $WHERE [, $RELATIVE_DIR = "."]) -# ------------------------------------------------------- -# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane -# name. Use $WHERE as a location in the diagnostic, if any. -sub check_directory -{ - my ($dir, $where, $reldir) = @_; - $reldir = '.' unless defined $reldir; - - error $where, "required directory $reldir/$dir does not exist" - unless -d "$reldir/$dir"; - - # If an 'obj/' directory exists, BSD make will enter it before - # reading 'Makefile'. Hence the 'Makefile' in the current directory - # will not be read. - # - # % cat Makefile - # all: - # echo Hello - # % cat obj/Makefile - # all: - # echo World - # % make # GNU make - # echo Hello - # Hello - # % pmake # BSD make - # echo World - # World - msg ('portability', $where, - "naming a subdirectory 'obj' causes troubles with BSD make") - if $dir eq 'obj'; - - # 'aux' is probably the most important of the following forbidden name, - # since it's tempting to use it as an AC_CONFIG_AUX_DIR. - msg ('portability', $where, - "name '$dir' is reserved on W32 and DOS platforms") - if grep (/^\Q$dir\E$/i, qw/aux lpt1 lpt2 lpt3 com1 com2 com3 com4 con prn/); -} - -# check_directories_in_var ($VARIABLE) -# ------------------------------------ -# Recursively check all items in variables $VARIABLE as directories -sub check_directories_in_var -{ - my ($var) = @_; - $var->traverse_recursively - (sub - { - my ($var, $val, $cond, $full_cond) = @_; - check_directory ($val, $var->rdef ($cond)->location, $relative_dir); - return (); - }, - undef, - skip_ac_subst => 1); -} - - -sub handle_subdirs () -{ - my $subdirs = var ('SUBDIRS'); - return - unless $subdirs; - - check_directories_in_var $subdirs; - - my $dsubdirs = var ('DIST_SUBDIRS'); - check_directories_in_var $dsubdirs - if $dsubdirs; - - $output_rules .= file_contents ('subdirs', new Automake::Location); - rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross! -} - - -# ($REGEN, @DEPENDENCIES) -# scan_aclocal_m4 -# --------------- -# If aclocal.m4 creation is automated, return the list of its dependencies. -sub scan_aclocal_m4 () -{ - my $regen_aclocal = 0; - - set_seen 'CONFIG_STATUS_DEPENDENCIES'; - set_seen 'CONFIGURE_DEPENDENCIES'; - - if (-f 'aclocal.m4') - { - define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL); - - my $aclocal = new Automake::XFile "< aclocal.m4"; - my $line = $aclocal->getline; - $regen_aclocal = $line =~ 'generated automatically by aclocal'; - } - - my @ac_deps = (); - - if (set_seen ('ACLOCAL_M4_SOURCES')) - { - push (@ac_deps, '$(ACLOCAL_M4_SOURCES)'); - msg_var ('obsolete', 'ACLOCAL_M4_SOURCES', - "'ACLOCAL_M4_SOURCES' is obsolete.\n" - . "It should be safe to simply remove it"); - } - - # Note that it might be possible that aclocal.m4 doesn't exist but - # should be auto-generated. This case probably isn't very - # important. - - return ($regen_aclocal, @ac_deps); -} - - -# 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 (dirname ($single) eq $relative_dir) - { - push (@newinputs, '$(srcdir)/' . basename ($single)); - } - else - { - push (@newinputs, '$(top_srcdir)/' . $single); - } - } - return @newinputs; -} - -# @DEPENDENCIES -# rewrite_inputs_into_dependencies ($OUTPUT, @INPUTS) -# --------------------------------------------------- -# Compute a list of dependencies appropriate for the rebuild -# rule of -# AC_CONFIG_FILES($OUTPUT:$INPUT[0]:$INPUTS[1]:...) -# Also distribute $INPUTs which are not built by another AC_CONFIG_FOOs. -sub rewrite_inputs_into_dependencies -{ - my ($file, @inputs) = @_; - my @res = (); - - for my $i (@inputs) - { - # We cannot create dependencies on shell variables. - next if (substitute_ac_subst_variables $i) =~ /\$/; - - if (exists $ac_config_files_location{$i} && $i ne $file) - { - my $di = dirname $i; - if ($di eq $relative_dir) - { - $i = basename $i; - } - # In the top-level Makefile we do not use $(top_builddir), because - # we are already there, and since the targets are built without - # a $(top_builddir), it helps BSD Make to match them with - # dependencies. - elsif ($relative_dir ne '.') - { - $i = '$(top_builddir)/' . $i; - } - } - else - { - msg ('error', $ac_config_files_location{$file}, - "required file '$i' not found") - unless $i =~ /\$/ || exists $output_files{$i} || -f $i; - ($i) = prepend_srcdir ($i); - push_dist_common ($i); - } - push @res, $i; - } - return @res; -} - - - -# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS) -# ----------------------------------------------------------------- -# Handle remaking and configure stuff. -# We need the name of the input file, to do proper remaking rules. -sub handle_configure -{ - my ($makefile_am, $makefile_in, $makefile, @inputs) = @_; - - prog_error 'empty @inputs' - unless @inputs; - - my ($rel_makefile_am, $rel_makefile_in) = prepend_srcdir ($makefile_am, - $makefile_in); - my $rel_makefile = basename $makefile; - - my $colon_infile = ':' . join (':', @inputs); - $colon_infile = '' if $colon_infile eq ":$makefile.in"; - my @rewritten = rewrite_inputs_into_dependencies ($makefile, @inputs); - my ($regen_aclocal_m4, @aclocal_m4_deps) = scan_aclocal_m4; - define_pretty_variable ('am__aclocal_m4_deps', TRUE, INTERNAL, - @configure_deps, @aclocal_m4_deps, - '$(top_srcdir)/' . $configure_ac); - my @configuredeps = ('$(am__aclocal_m4_deps)', '$(CONFIGURE_DEPENDENCIES)'); - push @configuredeps, '$(ACLOCAL_M4)' if -f 'aclocal.m4'; - define_pretty_variable ('am__configure_deps', TRUE, INTERNAL, - @configuredeps); - - my $automake_options = '--' . $strictness_name . - (global_option 'no-dependencies' ? ' --ignore-deps' : ''); - - $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, - 'HAVE-MAKEFILE-IN-DEPS' => (@include_stack > 0), - 'MAKEFILE-IN-DEPS' => "@include_stack", - 'MAKEFILE-AM' => $rel_makefile_am, - 'AUTOMAKE-OPTIONS' => $automake_options, - 'MAKEFILE-AM-SOURCES' => "$makefile$colon_infile", - 'REGEN-ACLOCAL-M4' => $regen_aclocal_m4, - VERBOSE => verbose_flag ('GEN')); - - if ($relative_dir eq '.') - { - push_dist_common ('acconfig.h') - if -f 'acconfig.h'; - } - - # If we have a configure header, require it. - my $hdr_index = 0; - my @distclean_config; - foreach my $spec (@config_headers) - { - $hdr_index += 1; - # $CONFIG_H_PATH: config.h from top level. - my ($config_h_path, @ins) = split_config_file_spec ($spec); - my $config_h_dir = dirname ($config_h_path); - - # If the header is in the current directory we want to build - # the header here. Otherwise, if we're at the topmost - # directory and the header's directory doesn't have a - # Makefile, then we also want to build the header. - if ($relative_dir eq $config_h_dir - || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir))) - { - my ($cn_sans_dir, $stamp_dir); - if ($relative_dir eq $config_h_dir) - { - $cn_sans_dir = basename ($config_h_path); - $stamp_dir = ''; - } - else - { - $cn_sans_dir = $config_h_path; - if ($config_h_dir eq '.') - { - $stamp_dir = ''; - } - else - { - $stamp_dir = $config_h_dir . '/'; - } - } - - # This will also distribute all inputs. - @ins = rewrite_inputs_into_dependencies ($config_h_path, @ins); - - # Cannot define rebuild rules for filenames with shell variables. - next if (substitute_ac_subst_variables $config_h_path) =~ /\$/; - - # Header defined in this directory. - my @files; - if (-f $config_h_path . '.top') - { - push (@files, "$cn_sans_dir.top"); - } - if (-f $config_h_path . '.bot') - { - push (@files, "$cn_sans_dir.bot"); - } - - push_dist_common (@files); - - # For now, acconfig.h can only appear in the top srcdir. - if (-f 'acconfig.h') - { - push (@files, '$(top_srcdir)/acconfig.h'); - } - - my $stamp = "${stamp_dir}stamp-h${hdr_index}"; - $output_rules .= - file_contents ('remake-hdr', - new Automake::Location, - FILES => "@files", - 'FIRST-HDR' => ($hdr_index == 1), - CONFIG_H => $cn_sans_dir, - CONFIG_HIN => $ins[0], - CONFIG_H_DEPS => "@ins", - CONFIG_H_PATH => $config_h_path, - STAMP => "$stamp"); - - push @distclean_config, $cn_sans_dir, $stamp; - } - } - - $output_rules .= file_contents ('clean-hdr', - new Automake::Location, - FILES => "@distclean_config") - if @distclean_config; - - # Distribute and define mkinstalldirs only if it is already present - # in the package, for backward compatibility (some people may still - # use $(mkinstalldirs)). - # TODO: start warning about this in Automake 1.14, and have - # TODO: Automake 2.0 drop it (and the mkinstalldirs script - # TODO: as well). - 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); - } - - reject_var ('CONFIG_HEADER', - "'CONFIG_HEADER' is an anachronism; now determined " - . "automatically\nfrom '$configure_ac'"); - - my @config_h; - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - # Generate CONFIG_HEADER define. - if ($relative_dir eq dirname ($out)) - { - push @config_h, basename ($out); - } - else - { - push @config_h, "\$(top_builddir)/$out"; - } - } - define_variable ("CONFIG_HEADER", "@config_h", INTERNAL) - if @config_h; - - # Now look for other files in this directory which must be remade - # by config.status, and generate rules for them. - my @actual_other_files = (); - # These get cleaned only in a VPATH build. - my @actual_other_vpath_files = (); - foreach my $lfile (@other_input_files) - { - my $file; - my @inputs; - if ($lfile =~ /^([^:]*):(.*)$/) - { - # This is the ":" syntax of AC_OUTPUT. - $file = $1; - @inputs = split (':', $2); - } - else - { - # Normal usage. - $file = $lfile; - @inputs = $file . '.in'; - } - - # Automake files should not be stored in here, but in %MAKE_LIST. - prog_error ("$lfile in \@other_input_files\n" - . "\@other_input_files = (@other_input_files)") - if -f $file . '.am'; - - my $local = basename ($file); - - # We skip files that aren't in this directory. However, if - # the file's directory does not have a Makefile, and we are - # currently doing '.', then we create a rule to rebuild the - # file in the subdir. - my $fd = dirname ($file); - if ($fd ne $relative_dir) - { - if ($relative_dir eq '.' && ! is_make_dir ($fd)) - { - $local = $file; - } - else - { - next; - } - } - - my @rewritten_inputs = rewrite_inputs_into_dependencies ($file, @inputs); - - # Cannot output rules for shell variables. - next if (substitute_ac_subst_variables $local) =~ /\$/; - - my $condstr = ''; - my $cond = $ac_config_files_condition{$lfile}; - if (defined $cond) - { - $condstr = $cond->subst_string; - Automake::Rule::define ($local, $configure_ac, RULE_AUTOMAKE, $cond, - $ac_config_files_location{$file}); - } - $output_rules .= ($condstr . $local . ': ' - . '$(top_builddir)/config.status ' - . "@rewritten_inputs\n" - . $condstr . "\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 links that aren't in this directory. However, if - # the link's directory does not have a Makefile, and we are - # currently doing '.', then we add the link to CONFIG_CLEAN_FILES - # in '.'s Makefile.in. - my $local = basename ($link); - my $fd = dirname ($link); - if ($fd ne $relative_dir) - { - if ($relative_dir eq '.' && ! is_make_dir ($fd)) - { - $local = $link; - } - else - { - $local = undef; - } - } - if ($file ne $link) - { - push @actual_other_files, $local if $local; - } - else - { - push @actual_other_vpath_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))) - { - # The following will distribute $file as a side-effect when - # it is appropriate (i.e., when $file is not already an output). - # We do not need the result, just the side-effect. - rewrite_inputs_into_dependencies ($link, $file); - } - } - } - - # These files get removed by "make distclean". - define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL, - @actual_other_files); - define_pretty_variable ('CONFIG_CLEAN_VPATH_FILES', TRUE, INTERNAL, - @actual_other_vpath_files); -} - -sub handle_headers () -{ - my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include', - 'oldinclude', 'pkginclude', - 'noinst', 'check'); - foreach (@r) - { - next unless $_->[1] =~ /\..*$/; - saw_extension ($&); - } -} - -sub handle_gettext () -{ - return if ! $seen_gettext || $relative_dir ne '.'; - - my $subdirs = var 'SUBDIRS'; - - if (! $subdirs) - { - err_ac "AM_GNU_GETTEXT used but SUBDIRS not defined"; - return; - } - - # Perform some sanity checks to help users get the right setup. - # We disable these tests when po/ doesn't exist in order not to disallow - # unusual gettext setups. - # - # Bruno Haible: - # | The idea is: - # | - # | 1) If a package doesn't have a directory po/ at top level, it - # | will likely have multiple po/ directories in subpackages. - # | - # | 2) It is useful to warn for the absence of intl/ if AM_GNU_GETTEXT - # | is used without 'external'. It is also useful to warn for the - # | presence of intl/ if AM_GNU_GETTEXT([external]) is used. Both - # | warnings apply only to the usual layout of packages, therefore - # | they should both be disabled if no po/ directory is found at - # | top level. - - if (-d 'po') - { - my @subdirs = $subdirs->value_as_list_recursive; - - msg_var ('syntax', $subdirs, - "AM_GNU_GETTEXT used but 'po' not in SUBDIRS") - if ! grep ($_ eq 'po', @subdirs); - - # intl/ is not required when AM_GNU_GETTEXT is called with the - # 'external' option 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)); - } - - require_file ($ac_gettext_location, GNU, 'ABOUT-NLS'); -} - -# Emit makefile footer. -sub handle_footer () -{ - reject_rule ('.SUFFIXES', - "use variable 'SUFFIXES', not target '.SUFFIXES'"); - - # Note: AIX 4.1 /bin/make will fail if any suffix rule appears - # before .SUFFIXES. So we make sure that .SUFFIXES appears before - # anything else, by sticking it right after the default: target. - $output_header .= ".SUFFIXES:\n"; - my $suffixes = var 'SUFFIXES'; - my @suffixes = Automake::Rule::suffixes; - if (@suffixes || $suffixes) - { - # Make sure SUFFIXES has unique elements. Sort them to ensure - # the output remains consistent. However, $(SUFFIXES) is - # always at the start of the list, unsorted. This is done - # because make will choose rules depending on the ordering of - # suffixes, and this lets the user have some control. Push - # actual suffixes, and not $(SUFFIXES). Some versions of make - # do not like variable substitutions on the .SUFFIXES line. - my @user_suffixes = ($suffixes - ? $suffixes->value_as_list_recursive : ()); - - my %suffixes = map { $_ => 1 } @suffixes; - delete @suffixes{@user_suffixes}; - - $output_header .= (".SUFFIXES: " - . join (' ', @user_suffixes, sort keys %suffixes) - . "\n"); - } - - $output_trailer .= file_contents ('footer', new Automake::Location); -} - - -# Generate 'make install' rules. -sub handle_install () -{ - $output_rules .= file_contents - ('install', - new Automake::Location, - maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES') - ? (" \$(BUILT_SOURCES)\n" - . "\t\$(MAKE) \$(AM_MAKEFLAGS)") - : ''), - 'installdirs-local' => (user_phony_rule ('installdirs-local') - ? ' installdirs-local' : ''), - am__installdirs => variable_value ('am__installdirs') || ''); -} - - -# handle_all ($MAKEFILE) -#----------------------- -# Deal with 'all' and 'all-am'. -sub handle_all -{ - my ($makefile) = @_; - - # Output 'all-am'. - - # Put this at the beginning for the sake of non-GNU makes. This - # is still wrong if these makes can run parallel jobs. But it is - # right enough. - unshift (@all, basename ($makefile)); - - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push (@all, basename ($out)) - if dirname ($out) eq $relative_dir; - } - - # Install 'all' hooks. - push (@all, "all-local") - if user_phony_rule "all-local"; - - pretty_print_rule ("all-am:", "\t\t", @all); - depend ('.PHONY', 'all-am', 'all'); - - - # Output 'all'. - - my @local_headers = (); - push @local_headers, '$(BUILT_SOURCES)' - if var ('BUILT_SOURCES'); - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push @local_headers, basename ($out) - if dirname ($out) eq $relative_dir; - } - - if (@local_headers) - { - # We need to make sure config.h is built before we recurse. - # We also want to make sure that built sources are built - # before any ordinary 'all' targets are run. We can't do this - # by changing the order of dependencies to the "all" because - # that breaks when using parallel makes. Instead we handle - # things explicitly. - $output_all .= ("all: @local_headers" - . "\n\t" - . '$(MAKE) $(AM_MAKEFLAGS) ' - . (var ('SUBDIRS') ? 'all-recursive' : 'all-am') - . "\n\n"); - depend ('.MAKE', 'all'); - } - else - { - $output_all .= "all: " . (var ('SUBDIRS') - ? 'all-recursive' : 'all-am') . "\n\n"; - } -} - -# Generate helper targets for user-defined recursive targets, where needed. -sub handle_user_recursion () -{ - return unless @extra_recursive_targets; - - define_pretty_variable ('am__extra_recursive_targets', TRUE, INTERNAL, - map { "$_-recursive" } @extra_recursive_targets); - my $aux = var ('SUBDIRS') ? 'recursive' : 'am'; - foreach my $target (@extra_recursive_targets) - { - # This allows the default target's rules to be overridden in - # Makefile.am. - user_phony_rule ($target); - depend ("$target", "$target-$aux"); - depend ("$target-am", "$target-local"); - # Every user-defined recursive target 'foo' *must* have a valid - # associated 'foo-local' rule; we define it as an empty rule by - # default, so that the user can transparently extend it in his - # own Makefile.am. - pretty_print_rule ("$target-local:", '', ''); - # $target-recursive might as well be undefined, so do not add - # it here; it's taken care of in subdirs.am anyway. - depend (".PHONY", "$target-am", "$target-local"); - } -} - - -# Handle check merge target specially. -sub do_check_merge_target () -{ - # Include user-defined local form of target. - push @check_tests, 'check-local' - if user_phony_rule 'check-local'; - - # 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"; - if (@check) - { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check); - depend ('.MAKE', 'check-am'); - } - - if (@check_tests) - { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", - @check_tests); - depend ('.MAKE', 'check-am'); - } - - 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"); - depend ('.MAKE', 'check') - if var ('BUILT_SOURCES'); -} - -# Handle all 'clean' targets. -sub handle_clean -{ - my ($makefile) = @_; - - # Clean the files listed in user variables if they exist. - $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN - if var ('MOSTLYCLEANFILES'); - $clean_files{'$(CLEANFILES)'} = CLEAN - if var ('CLEANFILES'); - $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN - if var ('DISTCLEANFILES'); - $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN - if var ('MAINTAINERCLEANFILES'); - - # Built sources are automatically removed by maintainer-clean. - $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN - if var ('BUILT_SOURCES'); - - # Compute a list of "rm"s to run for each target. - my %rms = (MOSTLY_CLEAN, [], - CLEAN, [], - DIST_CLEAN, [], - MAINTAINER_CLEAN, []); - - foreach my $file (keys %clean_files) - { - my $when = $clean_files{$file}; - prog_error 'invalid entry in %clean_files' - unless exists $rms{$when}; - - my $rm = "rm -f $file"; - # If file is a variable, make sure when don't call 'rm -f' without args. - $rm ="test -z \"$file\" || $rm" - if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/); - - push @{$rms{$when}}, "\t-$rm\n"; - } - - $output_rules .= file_contents - ('clean', - new Automake::Location, - MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}), - CLEAN_RMS => join ('', sort @{$rms{&CLEAN}}), - DISTCLEAN_RMS => join ('', sort @{$rms{&DIST_CLEAN}}), - MAINTAINER_CLEAN_RMS => join ('', sort @{$rms{&MAINTAINER_CLEAN}}), - MAKEFILE => basename $makefile, - ); -} - - -# Subroutine for handle_factored_dependencies() to let '.PHONY' and -# other '.TARGETS' be last. This is meant to be used as a comparison -# subroutine passed to the sort built-int. -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; -} - - -# 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', - 'uninstall-dvi-local', - 'uninstall-html-local', - 'uninstall-info-local', - 'uninstall-pdf-local', - 'uninstall-ps-local') - { - my $x = $utarg; - $x =~ s/-.*-/-/; - reject_rule ($utarg, "use '$x', not '$utarg'"); - } - - reject_rule ('install-local', - "use 'install-data-local' or 'install-exec-local', " - . "not 'install-local'"); - - reject_rule ('install-hook', - "use 'install-data-hook' or 'install-exec-hook', " - . "not 'install-hook'"); - - # Install the -local hooks. - foreach (keys %dependencies) - { - # Hooks are installed on the -am targets. - s/-am$// or next; - depend ("$_-am", "$_-local") - if user_phony_rule "$_-local"; - } - - # Install the -hook hooks. - # FIXME: Why not be as liberal as we are with -local hooks? - foreach ('install-exec', 'install-data', 'uninstall') - { - if (user_phony_rule "$_-hook") - { - depend ('.MAKE', "$_-am"); - register_action("$_-am", - ("\t\@\$(NORMAL_INSTALL)\n" - . "\t\$(MAKE) \$(AM_MAKEFLAGS) $_-hook")); - } - } - - # All the required targets are phony. - depend ('.PHONY', keys %required_targets); - - # Actually output gathered targets. - foreach (sort target_cmp keys %dependencies) - { - # If there is nothing about this guy, skip it. - next - unless (@{$dependencies{$_}} - || $actions{$_} - || $required_targets{$_}); - - # Define gathered targets in undefined conditions. - # FIXME: Right now we must handle .PHONY as an exception, - # because people write things like - # .PHONY: myphonytarget - # to append dependencies. This would not work if Automake - # refrained from defining its own .PHONY target as it does - # with other overridden targets. - # 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"; - } - } -} - - -sub handle_tests_dejagnu () -{ - push (@check_tests, 'check-DEJAGNU'); - $output_rules .= file_contents ('dejagnu', new Automake::Location); -} - -# handle_per_suffix_test ($TEST_SUFFIX, [%TRANSFORM]) -#---------------------------------------------------- -sub handle_per_suffix_test -{ - my ($test_suffix, %transform) = @_; - my ($pfx, $generic, $am_exeext); - if ($test_suffix eq '') - { - $pfx = ''; - $generic = 0; - $am_exeext = 'FALSE'; - } - else - { - prog_error ("test suffix '$test_suffix' lacks leading dot") - unless $test_suffix =~ m/^\.(.*)/; - $pfx = uc ($1) . '_'; - $generic = 1; - $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT' - : 'FALSE'; - } - # The "test driver" program, deputed to handle tests protocol used by - # test scripts. By default, it's assumed that no protocol is used, so - # we fall back to the old behaviour, implemented by the 'test-driver' - # auxiliary script. - if (! var "${pfx}LOG_DRIVER") - { - require_conf_file ("parallel-tests", FOREIGN, 'test-driver'); - define_variable ("${pfx}LOG_DRIVER", - "\$(SHELL) $am_config_aux_dir/test-driver", - INTERNAL); - } - my $driver = '$(' . $pfx . 'LOG_DRIVER)'; - my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)' - . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)'; - my $compile = "${pfx}LOG_COMPILE"; - define_variable ($compile, - '$(' . $pfx . 'LOG_COMPILER)' - . ' $(AM_' . $pfx . 'LOG_FLAGS)' - . ' $(' . $pfx . 'LOG_FLAGS)', - INTERNAL); - $output_rules .= file_contents ('check2', new Automake::Location, - GENERIC => $generic, - DRIVER => $driver, - DRIVER_FLAGS => $driver_flags, - COMPILE => '$(' . $compile . ')', - EXT => $test_suffix, - am__EXEEXT => $am_exeext, - %transform); -} - -# is_valid_test_extension ($EXT) -# ------------------------------ -# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false -# otherwise. -sub is_valid_test_extension -{ - my $ext = shift; - return 1 - if ($ext =~ /^\.[a-zA-Z_][a-zA-Z0-9_]*$/); - return 1 - if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT')); - return 0; -} - - -sub handle_tests () -{ - if (option 'dejagnu') - { - handle_tests_dejagnu; - } - else - { - foreach my $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS') - { - reject_var ($c, "'$c' defined but 'dejagnu' not in " - . "'AUTOMAKE_OPTIONS'"); - } - } - - if (var ('TESTS')) - { - push (@check_tests, 'check-TESTS'); - my $check_deps = "@check"; - $output_rules .= file_contents ('check', new Automake::Location, - SERIAL_TESTS => !! option 'serial-tests', - CHECK_DEPS => $check_deps); - - # Tests that are known programs should have $(EXEEXT) appended. - # For matching purposes, we need to adjust XFAIL_TESTS as well. - append_exeext { exists $known_programs{$_[0]} } 'TESTS'; - append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS' - if (var ('XFAIL_TESTS')); - - if (! option 'serial-tests') - { - define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL); - my $suff = '.test'; - my $at_exeext = ''; - my $handle_exeext = exists $configure_vars{'EXEEXT'}; - if ($handle_exeext) - { - $at_exeext = subst ('EXEEXT'); - $suff = $at_exeext . ' ' . $suff; - } - if (! var 'TEST_EXTENSIONS') - { - define_variable ('TEST_EXTENSIONS', $suff, INTERNAL); - } - my $var = var 'TEST_EXTENSIONS'; - # Currently, we are not able to deal with conditional contents - # in TEST_EXTENSIONS. - if ($var->has_conditional_contents) - { - msg_var 'unsupported', $var, - "'TEST_EXTENSIONS' cannot have conditional contents"; - } - my @test_suffixes = $var->value_as_list_recursive; - if ((my @invalid_test_suffixes = - grep { !is_valid_test_extension $_ } @test_suffixes) > 0) - { - error $var->rdef (TRUE)->location, - "invalid test extensions: @invalid_test_suffixes"; - } - @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes; - if ($handle_exeext) - { - unshift (@test_suffixes, $at_exeext) - unless $test_suffixes[0] eq $at_exeext; - } - unshift (@test_suffixes, ''); - - transform_variable_recursively - ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL, - sub { - my ($subvar, $val, $cond, $full_cond) = @_; - my $obj = $val; - return $obj - if $val =~ /^\@.*\@$/; - $obj =~ s/\$\(EXEEXT\)$//o; - - if ($val =~ /(\$\((top_)?srcdir\))\//o) - { - msg ('error', $subvar->rdef ($cond)->location, - "using '$1' in TESTS is currently broken: '$val'"); - } - - foreach my $test_suffix (@test_suffixes) - { - next - if $test_suffix eq $at_exeext || $test_suffix eq ''; - return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log' - if substr ($obj, - length ($test_suffix)) eq $test_suffix; - } - my $base = $obj; - $obj .= '.log'; - handle_per_suffix_test ('', - OBJ => $obj, - BASE => $base, - SOURCE => $val); - return $obj; - }); - - my $nhelper=1; - my $prev = 'TESTS'; - my $post = ''; - my $last_suffix = $test_suffixes[$#test_suffixes]; - my $cur = ''; - foreach my $test_suffix (@test_suffixes) - { - if ($test_suffix eq $last_suffix) - { - $cur = 'TEST_LOGS'; - } - else - { - $cur = 'am__test_logs' . $nhelper; - } - define_variable ($cur, - '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL); - $post = '.log'; - $prev = $cur; - $nhelper++; - if ($test_suffix ne $at_exeext && $test_suffix ne '') - { - handle_per_suffix_test ($test_suffix, - OBJ => '', - BASE => '$*', - SOURCE => '$<'); - } - } - $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN; - $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN; - } - } -} - -sub handle_emacs_lisp () -{ - my @elfiles = am_install_var ('-candist', 'lisp', 'LISP', - 'lisp', 'noinst'); - - return if ! @elfiles; - - define_pretty_variable ('am__ELFILES', TRUE, INTERNAL, - map { $_->[1] } @elfiles); - define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL, - '$(am__ELFILES:.el=.elc)'); - # This one can be overridden by users. - define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(LISP:.el=.elc)'); - - push @all, '$(ELCFILES)'; - - require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE, - 'EMACS', 'lispdir'); -} - -sub handle_python () -{ - my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON', - 'noinst'); - return if ! @pyfiles; - - require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON'); - require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile'); - define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL); -} - -sub handle_java () -{ - my @sourcelist = am_install_var ('-candist', - 'java', 'JAVA', - 'noinst', 'check'); - return if ! @sourcelist; - - my @prefixes = am_primary_prefixes ('JAVA', 1, - 'noinst', 'check'); - - my $dir; - my @java_sources = (); - foreach my $prefix (@prefixes) - { - (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//; - - next - if $curs eq 'EXTRA'; - - push @java_sources, '$(' . $prefix . '_JAVA' . ')'; - - if (defined $dir) - { - err_var "${curs}_JAVA", "multiple _JAVA primaries in use" - unless $curs eq $dir; - } - - $dir = $curs; - } - - define_pretty_variable ('am__java_sources', TRUE, INTERNAL, - "@java_sources"); - - if ($dir eq 'check') - { - push (@check, "class$dir.stamp"); - } - else - { - push (@all, "class$dir.stamp"); - } -} - - -sub handle_minor_options () -{ - if (option 'readme-alpha') - { - if ($relative_dir eq '.') - { - if ($package_version !~ /^$GNITS_VERSION_PATTERN$/) - { - msg ('error-gnits', $package_version_location, - "version '$package_version' doesn't follow " . - "Gnits standards"); - } - if (defined $1 && -f 'README-alpha') - { - # This means we have an alpha release. See - # GNITS_VERSION_PATTERN for details. - push_dist_common ('README-alpha'); - } - } - } -} - -################################################################ - -# ($OUTPUT, @INPUTS) -# split_config_file_spec ($SPEC) -# ------------------------------ -# Decode the Autoconf syntax for config files (files, headers, links -# etc.). -sub split_config_file_spec -{ - my ($spec) = @_; - my ($output, @inputs) = split (/:/, $spec); - - push @inputs, "$output.in" - unless @inputs; - - return ($output, @inputs); -} - -# $input -# locate_am (@POSSIBLE_SOURCES) -# ----------------------------- -# AC_CONFIG_FILES allow specifications such as Makefile:top.in:mid.in:bot.in -# This functions returns the first *.in file for which a *.am exists. -# It returns undef otherwise. -sub locate_am -{ - my (@rest) = @_; - my $input; - foreach my $file (@rest) - { - if (($file =~ /^(.*)\.in$/) && -f "$1.am") - { - $input = $file; - last; - } - } - return $input; -} - -my %make_list; - -# scan_autoconf_config_files ($WHERE, $CONFIG-FILES) -# -------------------------------------------------- -# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES -# (or AC_OUTPUT). -sub scan_autoconf_config_files -{ - my ($where, $config_files) = @_; - - # Look at potential Makefile.am's. - foreach (split ' ', $config_files) - { - # Must skip empty string for Perl 4. - next if $_ eq "\\" || $_ eq ''; - - # Handle $local:$input syntax. - my ($local, @rest) = split (/:/); - @rest = ("$local.in",) unless @rest; - # Keep in sync with test 'conffile-leading-dot.sh'. - msg ('unsupported', $where, - "omit leading './' from config file names such as '$local';" - . "\nremake rules might be subtly broken otherwise") - if ($local =~ /^\.\//); - my $input = locate_am @rest; - if ($input) - { - # We have a file that automake should generate. - $make_list{$input} = join (':', ($local, @rest)); - } - else - { - # We have a file that automake should cause to be - # rebuilt, but shouldn't generate itself. - push (@other_input_files, $_); - } - $ac_config_files_location{$local} = $where; - $ac_config_files_condition{$local} = - new Automake::Condition (@cond_stack) - if (@cond_stack); - } -} - - -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_FC_SRCEXT => 1, - AC_INIT => 0, - AC_LIBSOURCE => 1, - AC_REQUIRE_AUX_FILE => 1, - AC_SUBST_TRACE => 1, - AM_AUTOMAKE_VERSION => 1, - AM_PROG_MKDIR_P => 0, - AM_CONDITIONAL => 2, - AM_EXTRA_RECURSIVE_TARGETS => 1, - AM_GNU_GETTEXT => 0, - AM_GNU_GETTEXT_INTL_SUBDIR => 0, - AM_INIT_AUTOMAKE => 0, - AM_MAINTAINER_MODE => 0, - AM_PROG_AR => 0, - _AM_SUBST_NOTMAKE => 1, - _AM_COND_IF => 1, - _AM_COND_ELSE => 1, - _AM_COND_ENDIF => 1, - LT_SUPPORTED_TAG => 1, - _LT_AC_TAGCONFIG => 0, - m4_include => 1, - m4_sinclude => 1, - sinclude => 1, - ); - - 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::\$d::\$n::\${::}%' } - (keys %traced)); - - my $tracefh = new Automake::XFile ("$traces $filename |"); - verb "reading $traces"; - - @cond_stack = (); - my $where; - - while ($_ = $tracefh->getline) - { - chomp; - my ($here, $depth, @args) = split (/::/); - $where = new Automake::Location $here; - my $macro = $args[0]; - - prog_error ("unrequested trace '$macro'") - unless exists $traced{$macro}; - - # Skip and diagnose malformed calls. - if ($#args < $traced{$macro}) - { - msg ('syntax', $where, "not enough arguments for $macro"); - next; - } - - # Alphabetical ordering please. - if ($macro eq 'AC_CANONICAL_BUILD') - { - if ($seen_canonical <= AC_CANONICAL_BUILD) - { - $seen_canonical = AC_CANONICAL_BUILD; - } - } - elsif ($macro eq 'AC_CANONICAL_HOST') - { - if ($seen_canonical <= AC_CANONICAL_HOST) - { - $seen_canonical = AC_CANONICAL_HOST; - } - } - elsif ($macro eq 'AC_CANONICAL_TARGET') - { - $seen_canonical = AC_CANONICAL_TARGET; - } - 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; - check_directory ($config_aux_dir, $where); - } - elsif ($macro eq 'AC_CONFIG_FILES') - { - # Look at potential Makefile.am's. - scan_autoconf_config_files ($where, $args[1]); - } - elsif ($macro eq 'AC_CONFIG_HEADERS') - { - foreach my $spec (split (' ', $args[1])) - { - my ($dest, @src) = split (':', $spec); - $ac_config_files_location{$dest} = $where; - push @config_headers, $spec; - } - } - elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR') - { - $config_libobj_dir = $args[1]; - 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; - } - } - elsif ($macro eq 'AC_FC_SRCEXT') - { - my $suffix = $args[1]; - # These flags are used as %SOURCEFLAG% in depend2.am, - # where the trailing space is important. - $sourceflags{'.' . $suffix} = '$(FCFLAGS_' . $suffix . ') ' - if ($suffix eq 'f90' || $suffix eq 'f95' || $suffix eq 'f03' || $suffix eq 'f08'); - } - elsif ($macro eq 'AC_INIT') - { - if (defined $args[2]) - { - $package_version = $args[2]; - $package_version_location = $where; - } - } - elsif ($macro eq 'AC_LIBSOURCE') - { - $libsources{$args[1]} = $here; - } - elsif ($macro eq 'AC_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') - { - # Just check for alphanumeric in AC_SUBST_TRACE. If you do - # AC_SUBST(5), then too bad. - $configure_vars{$args[1]} = $where - if $args[1] =~ /^\w+$/; - } - elsif ($macro eq 'AM_AUTOMAKE_VERSION') - { - error ($where, - "version mismatch. This is Automake $VERSION,\n" . - "but the definition used by this AM_INIT_AUTOMAKE\n" . - "comes from Automake $args[1]. You should recreate\n" . - "aclocal.m4 with aclocal and run automake again.\n", - # $? = 63 is used to indicate version mismatch to missing. - exit_code => 63) - if $VERSION ne $args[1]; - - $seen_automake_version = 1; - } - elsif ($macro eq 'AM_PROG_MKDIR_P') - { - msg 'obsolete', $where, <<'EOF'; -The 'AM_PROG_MKDIR_P' macro is deprecated, and its use is discouraged. -You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead, -and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files. -EOF - } - elsif ($macro eq 'AM_CONDITIONAL') - { - $configure_cond{$args[1]} = $where; - } - elsif ($macro eq 'AM_EXTRA_RECURSIVE_TARGETS') - { - # Empty leading/trailing fields might be produced by split, - # hence the grep is really needed. - push @extra_recursive_targets, - grep (/./, (split /\s+/, $args[1])); - } - elsif ($macro eq 'AM_GNU_GETTEXT') - { - $seen_gettext = $where; - $ac_gettext_location = $where; - $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; - if (defined $args[2]) - { - msg 'obsolete', $where, <<'EOF'; -AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated. For more info, see: -http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation -EOF - $package_version = $args[2]; - $package_version_location = $where; - } - elsif (defined $args[1]) - { - my @opts = split (' ', $args[1]); - @opts = map { { option => $_, where => $where } } @opts; - exit $exit_code unless process_global_option_list (@opts); - } - } - elsif ($macro eq 'AM_MAINTAINER_MODE') - { - $seen_maint_mode = $where; - } - elsif ($macro eq 'AM_PROG_AR') - { - $seen_ar = $where; - } - elsif ($macro eq '_AM_COND_IF') - { - cond_stack_if ('', $args[1], $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - elsif ($macro eq '_AM_COND_ELSE') - { - cond_stack_else ('!', $args[1], $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - elsif ($macro eq '_AM_COND_ENDIF') - { - cond_stack_endif (undef, undef, $where); - error ($where, "missing m4 quoting, macro depth $depth") - if ($depth != 1); - } - 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); - } - } - } - - error ($where, "condition stack not properly closed") - if (@cond_stack); - - $tracefh->close; -} - - -# Check whether we use 'configure.ac' or 'configure.in'. -# Scan it (and possibly 'aclocal.m4') for interesting things. -# We must scan aclocal.m4 because there might be AC_SUBSTs and such there. -sub scan_autoconf_files () -{ - # Reinitialize libsources here. This isn't really necessary, - # since we currently assume there is only one configure.ac. But - # that won't always be the case. - %libsources = (); - - # Keep track of the youngest configure dependency. - $configure_deps_greatest_timestamp = mtime $configure_ac; - if (-e 'aclocal.m4') - { - my $mtime = mtime 'aclocal.m4'; - $configure_deps_greatest_timestamp = $mtime - if $mtime > $configure_deps_greatest_timestamp; - } - - scan_autoconf_traces ($configure_ac); - - @configure_input_files = sort keys %make_list; - # Set input and output files if not specified by user. - if (! @input_files) - { - @input_files = @configure_input_files; - %output_files = %make_list; - } - - - if (! $seen_init_automake) - { - err_ac ("no proper invocation of AM_INIT_AUTOMAKE was found.\nYou " - . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE," - . "\nthat aclocal.m4 is present in the top-level directory,\n" - . "and that aclocal.m4 was recently regenerated " - . "(using aclocal)"); - } - else - { - if (! $seen_automake_version) - { - if (-f 'aclocal.m4') - { - error ($seen_init_automake, - "your implementation of AM_INIT_AUTOMAKE comes from " . - "an\nold Automake version. You should recreate " . - "aclocal.m4\nwith aclocal and run automake again", - # $? = 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"); - } - } - } - - locate_aux_dir (); - - # 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 - # push_required_file to work. - # Sort the files for stable verbose output. - $relative_dir = '.'; - foreach my $file (sort 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'; - - # Preserve dist_common for later. - $configure_dist_common = variable_value ('DIST_COMMON') || ''; - -} - -################################################################ - -# Do any extra checking for GNU standards. -sub check_gnu_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNU, - qw/INSTALL NEWS README AUTHORS ChangeLog/); - - # Accept one of these three licenses; default to COPYING. - # Make sure we do not overwrite an existing license. - my $license; - foreach (qw /COPYING COPYING.LIB COPYING.LESSER/) - { - if (-f $_) - { - $license = $_; - last; - } - } - require_file ("$am_file.am", GNU, 'COPYING') - unless $license; - } - - for my $opt ('no-installman', 'no-installinfo') - { - msg ('error-gnu', option $opt, - "option '$opt' disallowed by GNU standards") - if option $opt; - } -} - -# Do any extra checking for GNITS standards. -sub check_gnits_standards () -{ - if ($relative_dir eq '.') - { - # In top level (or only) directory. - require_file ("$am_file.am", GNITS, 'THANKS'); - } -} - -################################################################ -# -# Functions to handle files of each language. - -# Each 'lang_X_rewrite($DIRECTORY, $BASE, $EXT)' function follows a -# simple formula: Return value is LANG_SUBDIR if the resulting object -# file should be in a subdir if the source file is, LANG_PROCESS if -# file is to be dealt with, LANG_IGNORE otherwise. - -# Much of the actual processing is handled in -# handle_single_transform. These functions exist so that -# auxiliary information can be recorded for a later cleanup pass. -# Note that the calls to these functions are computed, so don't bother -# searching for their precise names in the source. - -# This is just a convenience function that can be used to determine -# when a subdir object should be used. -sub lang_sub_obj () -{ - return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS; -} - -# Rewrite a single header file. -sub lang_header_rewrite -{ - # Header files are simply ignored. - return LANG_IGNORE; -} - -# Rewrite a single Vala source file. -sub lang_vala_rewrite -{ - my ($directory, $base, $ext) = @_; - - (my $newext = $ext) =~ s/vala$/c/; - return (LANG_SUBDIR, $newext); -} - -# Rewrite a single yacc/yacc++ file. -sub lang_yacc_rewrite -{ - my ($directory, $base, $ext) = @_; - - my $r = lang_sub_obj; - (my $newext = $ext) =~ tr/y/c/; - return ($r, $newext); -} -sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); }; - -# Rewrite a single lex/lex++ file. -sub lang_lex_rewrite -{ - my ($directory, $base, $ext) = @_; - - my $r = lang_sub_obj; - (my $newext = $ext) =~ tr/l/c/; - return ($r, $newext); -} -sub lang_lexxx_rewrite { lang_lex_rewrite (@_); }; - -# 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_vala_finish_target -{ - my ($self, $name) = @_; - - my $derived = canonicalize ($name); - my $var = var "${derived}_SOURCES"; - return unless $var; - - my @vala_sources = grep { /\.(vala|vapi)$/ } ($var->value_as_list_recursive); - - # For automake bug#11229. - return unless @vala_sources; - - foreach my $vala_file (@vala_sources) - { - my $c_file = $vala_file; - if ($c_file =~ s/(.*)\.vala$/$1.c/) - { - $c_file = "\$(srcdir)/$c_file"; - $output_rules .= "$c_file: \$(srcdir)/${derived}_vala.stamp\n" - . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n" - . "\t\@if test -f \$@; then :; else \\\n" - . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n" - . "\tfi\n"; - $clean_files{$c_file} = MAINTAINER_CLEAN; - } - } - - # Add rebuild rules for generated header and vapi files - my $flags = var ($derived . '_VALAFLAGS'); - if ($flags) - { - my $lastflag = ''; - foreach my $flag ($flags->value_as_list_recursive) - { - if (grep (/$lastflag/, ('-H', '-h', '--header', '--internal-header', - '--vapi', '--internal-vapi', '--gir'))) - { - my $headerfile = "\$(srcdir)/$flag"; - $output_rules .= "$headerfile: \$(srcdir)/${derived}_vala.stamp\n" - . "\t\@if test -f \$@; then :; else rm -f \$(srcdir)/${derived}_vala.stamp; fi\n" - . "\t\@if test -f \$@; then :; else \\\n" - . "\t \$(MAKE) \$(AM_MAKEFLAGS) \$(srcdir)/${derived}_vala.stamp; \\\n" - . "\tfi\n"; - - # valac is not used when building from dist tarballs - # distribute the generated files - push_dist_common ($headerfile); - $clean_files{$headerfile} = MAINTAINER_CLEAN; - } - $lastflag = $flag; - } - } - - my $compile = $self->compile; - - # Rewrite each occurrence of 'AM_VALAFLAGS' in the compile - # rule into '${derived}_VALAFLAGS' if it exists. - my $val = "${derived}_VALAFLAGS"; - $compile =~ s/\(AM_VALAFLAGS\)/\($val\)/ - if set_seen ($val); - - # VALAFLAGS is a user variable (per GNU Standards), - # it should not be overridden in the Makefile... - check_user_variables 'VALAFLAGS'; - - my $dirname = dirname ($name); - - # Only generate C code, do not run C compiler - $compile .= " -C"; - - my $verbose = verbose_flag ('VALAC'); - my $silent = silent_flag (); - my $stampfile = "\$(srcdir)/${derived}_vala.stamp"; - - $output_rules .= - "\$(srcdir)/${derived}_vala.stamp: @vala_sources\n". -# Since the C files generated from the vala sources depend on the -# ${derived}_vala.stamp file, we must ensure its timestamp is older than -# those of the C files generated by the valac invocation below (this is -# especially important on systems with sub-second timestamp resolution). -# Thus we need to create the stamp file *before* invoking valac, and to -# move it to its final location only after valac has been invoked. - "\t${silent}rm -f \$\@ && echo stamp > \$\@-t\n". - "\t${verbose}\$(am__cd) \$(srcdir) && $compile @vala_sources\n". - "\t${silent}mv -f \$\@-t \$\@\n"; - - push_dist_common ($stampfile); - - $clean_files{$stampfile} = MAINTAINER_CLEAN; -} - -# Add output rules to invoke valac and create stamp file as a witness -# to handle multiple outputs. This function is called after all source -# file processing is done. -sub lang_vala_finish () -{ - my ($self) = @_; - - foreach my $prog (keys %known_programs) - { - lang_vala_finish_target ($self, $prog); - } - - while (my ($name) = each %known_libraries) - { - lang_vala_finish_target ($self, $name); - } -} - -# The built .c files should be cleaned only on maintainer-clean -# as the .c files are distributed. This function is called for each -# .vala source file. -sub lang_vala_target_hook -{ - my ($self, $aggregate, $output, $input, %transform) = @_; - - $clean_files{$output} = MAINTAINER_CLEAN; -} - -# This is a yacc helper which is called whenever we have decided to -# compile a yacc file. -sub lang_yacc_target_hook -{ - my ($self, $aggregate, $output, $input, %transform) = @_; - - # If some relevant *YFLAGS variable contains the '-d' flag, we'll - # have to to generate special code. - my $yflags_contains_minus_d = 0; - - foreach my $pfx ("", "${aggregate}_") - { - my $yflagsvar = var ("${pfx}YFLAGS"); - next unless $yflagsvar; - # We cannot work reliably with conditionally-defined YFLAGS. - if ($yflagsvar->has_conditional_contents) - { - msg_var ('unsupported', $yflagsvar, - "'${pfx}YFLAGS' cannot have conditional contents"); - } - else - { - $yflags_contains_minus_d = 1 - if grep (/^-d$/, $yflagsvar->value_as_list_recursive); - } - } - - if ($yflags_contains_minus_d) - { - # 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. - - # The extension of the output file (e.g., '.c' or '.cxx'). - # We'll need it to compute the name of the generated header file. - (my $output_ext = basename ($output)) =~ s/.*(\.[^.]+)$/$1/; - - # We know that a yacc input should be turned into either a C or - # C++ output file. We depend on this fact (here and in yacc.am), - # so check that it really holds. - my $lang = $languages{$extension_map{$output_ext}}; - prog_error "invalid output name '$output' for yacc file '$input'" - if (!$lang || ($lang->name ne 'c' && $lang->name ne 'cxx')); - - (my $header_ext = $output_ext) =~ s/c/h/g; - # Quote $output_ext in the regexp, so that dots in it are taken - # as literal dots, not as metacharacters. - (my $header = $output) =~ s/\Q$output_ext\E$/$header_ext/; - - 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 rm -f $output; else :; fi\n" - . "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; 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'}; - - # The GNU rules say that yacc/lex output files should be removed - # by maintainer-clean. However, if the files are not distributed, - # then we want to remove them with "make clean"; otherwise, - # "make distcheck" will fail. - $clean_files{$header} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN; - } - # See the comment above for $HEADER. - $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : 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, %transform) = @_; - # The GNU rules say that yacc/lex output files should be removed - # by maintainer-clean. However, if the files are not distributed, - # then we want to remove them with "make clean"; otherwise, - # "make distcheck" will fail. - $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : 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; - - # FIXME: for now, no line number. - require_conf_file ($configure_ac, FOREIGN, 'ylwrap'); - define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL); -} - -sub lang_yacc_finish () -{ - return if defined $language_scratch{'yacc-done'}; - $language_scratch{'yacc-done'} = 1; - - reject_var 'YACCFLAGS', "'YACCFLAGS' obsolete; use 'YFLAGS' instead"; - - yacc_lex_finish_helper; -} - - -sub lang_lex_finish () -{ - return if defined $language_scratch{'lex-done'}; - $language_scratch{'lex-done'} = 1; - - yacc_lex_finish_helper; -} - - -# 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 OBJCXXLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK)) - { - return $l if defined $linkers{$l}; - } - return 'LINK'; -} - -# Called to indicate that an extension was used. -sub saw_extension -{ - my ($ext) = @_; - $extension_seen{$ext} = 1; -} - -# register_language (%ATTRIBUTE) -# ------------------------------ -# Register a single language. -# Each %ATTRIBUTE is of the form ATTRIBUTE => VALUE. -sub register_language -{ - my (%option) = @_; - - # Set the defaults. - $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'}; - $option{'nodist_specific'} = 0 - unless defined $option{'nodist_specific'}; - - my $lang = new Automake::Language (%option); - - # Fill indexes. - $extension_map{$_} = $lang->name foreach @{$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}); - - # Update the suffix rules map. - foreach my $suffix (@{$lang->extensions}) - { - foreach my $dest ($lang->output_extensions->($suffix)) - { - register_suffix_rule (INTERNAL, $suffix, $dest); - } - } -} - -# derive_suffix ($EXT, $OBJ) -# -------------------------- -# This function is used to find a path from a user-specified suffix $EXT -# to $OBJ or to some other suffix we recognize internally, e.g. 'cc'. -sub derive_suffix -{ - my ($source_ext, $obj) = @_; - - while (!$extension_map{$source_ext} && $source_ext ne $obj) - { - my $new_source_ext = next_in_suffix_chain ($source_ext, $obj); - last if not defined $new_source_ext; - $source_ext = $new_source_ext; - } - - return $source_ext; -} - - -# Pretty-print something and append to '$output_rules'. -sub pretty_print_rule -{ - $output_rules .= makefile_wrap (shift, shift, @_); -} - - -################################################################ - - -## -------------------------------- ## -## Handling the conditional stack. ## -## -------------------------------- ## - - -# $STRING -# make_conditional_string ($NEGATE, $COND) -# ---------------------------------------- -sub make_conditional_string -{ - my ($negate, $cond) = @_; - $cond = "${cond}_TRUE" - unless $cond =~ /^TRUE|FALSE$/; - $cond = Automake::Condition::conditional_negate ($cond) - if $negate; - return $cond; -} - - -my %_am_macro_for_cond = - ( - AMDEP => "one of the compiler tests\n" - . " AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,\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__fastdepOBJCXX => 'AC_PROG_OBJCXX', - am__fastdepUPC => 'AM_PROG_UPC' - ); - -# $COND -# cond_stack_if ($NEGATE, $COND, $WHERE) -# -------------------------------------- -sub cond_stack_if -{ - my ($negate, $cond, $where) = @_; - - if (! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/) - { - 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; - } - error $where, $text, uniq_scope => $scope; - } - - push (@cond_stack, make_conditional_string ($negate, $cond)); - - return new Automake::Condition (@cond_stack); -} - - -# $COND -# cond_stack_else ($NEGATE, $COND, $WHERE) -# ---------------------------------------- -sub cond_stack_else -{ - my ($negate, $cond, $where) = @_; - - if (! @cond_stack) - { - error $where, "else without if"; - return FALSE; - } - - $cond_stack[$#cond_stack] = - Automake::Condition::conditional_negate ($cond_stack[$#cond_stack]); - - # If $COND is given, check against it. - if (defined $cond) - { - $cond = make_conditional_string ($negate, $cond); - - error ($where, "else reminder ($negate$cond) incompatible with " - . "current conditional: $cond_stack[$#cond_stack]") - if $cond_stack[$#cond_stack] ne $cond; - } - - return new Automake::Condition (@cond_stack); -} - - -# $COND -# cond_stack_endif ($NEGATE, $COND, $WHERE) -# ----------------------------------------- -sub cond_stack_endif -{ - my ($negate, $cond, $where) = @_; - my $old_cond; - - if (! @cond_stack) - { - error $where, "endif without if"; - return TRUE; - } - - # If $COND is given, check against it. - if (defined $cond) - { - $cond = make_conditional_string ($negate, $cond); - - error ($where, "endif reminder ($negate$cond) incompatible with " - . "current conditional: $cond_stack[$#cond_stack]") - if $cond_stack[$#cond_stack] ne $cond; - } - - pop @cond_stack; - - return new Automake::Condition (@cond_stack); -} - - - - - -## ------------------------ ## -## Handling the variables. ## -## ------------------------ ## - - -# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE) -# ---------------------------------------------------- -# Like define_variable, but the value is a list, and the variable may -# be defined conditionally. The second argument is the condition -# under which the value should be defined; this should be the empty -# string to define the variable unconditionally. The third argument -# is a list holding the values to use for the variable. The value is -# pretty printed in the output file. -sub define_pretty_variable -{ - my ($var, $cond, $where, @value) = @_; - - if (! vardef ($var, $cond)) - { - Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value", - '', $where, VAR_PRETTY); - rvar ($var)->rdef ($cond)->set_seen; - } -} - - -# define_variable ($VAR, $VALUE, $WHERE) -# -------------------------------------- -# Define a new 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 ($\@$$) -{ - my ($var, $basename, $extension, $where) = @_; - define_variable ($var, - join (' ', map { "$_.$extension" } @$basename), - $where); -} - - -# Like define_variable, but define a variable to be the configure -# substitution by the same name. -sub define_configure_variable -{ - my ($var) = @_; - # 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 `\`. - my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS; - Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst ($var), - '', $configure_vars{$var}, $pretty); -} - - -# define_compiler_variable ($LANG) -# -------------------------------- -# Define a compiler variable. We also handle defining the 'LT' -# version of the command when using libtool. -sub define_compiler_variable -{ - my ($lang) = @_; - - my ($var, $value) = ($lang->compiler, $lang->compile); - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; - define_variable ($var, $value, INTERNAL); - if (var ('LIBTOOL')) - { - my $verbose = define_verbose_libtool (); - define_variable ("LT$var", - "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)" - . " \$(LIBTOOLFLAGS) --mode=compile $value", - INTERNAL); - } - define_verbose_tagvar ($lang->ccer || 'GEN'); -} - - -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}; - # CCLD = $(CC). - define_variable ($lang->lder, $lang->ld, INTERNAL); - # CCLINK = $(CCLD) blah blah... - my $link = ''; - if (var ('LIBTOOL')) - { - my $verbose = define_verbose_libtool (); - $link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) " - . "\$(LIBTOOLFLAGS) --mode=link "; - } - define_variable ($lang->linker, $link . $lang->link, INTERNAL); - define_variable ($lang->compiler, $lang, INTERNAL); - define_verbose_tagvar ($lang->lder || 'GEN'); -} - -sub define_per_target_linker_variable -{ - my ($linker, $target) = @_; - - # If the user wrote a custom link command, we don't define ours. - return "${target}_LINK" - if set_seen "${target}_LINK"; - - my $xlink = $linker ? $linker : 'LINK'; - - my $lang = $link_languages{$xlink}; - prog_error "Unknown language for linker variable '$xlink'" - unless $lang; - - my $link_command = $lang->link; - if (var 'LIBTOOL') - { - my $libtool_tag = ''; - $libtool_tag = '--tag=' . $lang->libtool_tag . ' ' - if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag}; - - my $verbose = define_verbose_libtool (); - $link_command = - "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) \$(LIBTOOLFLAGS) " - . "--mode=link " . $link_command; - } - - # 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) - { - my $val = "${target}_$flag"; - $link_command =~ s/\(AM_$flag\)/\($val\)/ - if set_seen ($val); - } - - # If the computed command is the same as the generic command, use - # the command linker variable. - return ($lang->linker, $lang->lder) - if $link_command eq $orig_command; - - define_variable ("${target}_LINK", $link_command, INTERNAL); - return ("${target}_LINK", $lang->lder); -} - -################################################################ - -# check_trailing_slash ($WHERE, $LINE) -# ------------------------------------ -# Return 1 iff $LINE ends with a slash. -# Might modify $LINE. -sub check_trailing_slash ($\$) -{ - my ($where, $line) = @_; - - # Ignore '##' lines. - return 0 if $$line =~ /$IGNORE_PATTERN/o; - - # Catch and fix a common error. - msg "syntax", $where, "whitespace following trailing backslash" - if $$line =~ s/\\\s+\n$/\\\n/; - - return $$line =~ /\\$/; -} - - -# read_am_file ($AMFILE, $WHERE, $RELDIR) -# --------------------------------------- -# Read Makefile.am and set up %contents. Simultaneously copy lines -# from Makefile.am into $output_trailer, or define variables as -# appropriate. NOTE we put rules in the trailer section. We want -# user rules to come after our generated stuff. -sub read_am_file -{ - my ($amfile, $where, $reldir) = @_; - my $canon_reldir = &canonicalize ($reldir); - - my $am_file = new Automake::XFile ("< $amfile"); - verb "reading $amfile"; - - # Keep track of the youngest output dependency. - my $mtime = mtime $amfile; - $output_deps_greatest_timestamp = $mtime - if $mtime > $output_deps_greatest_timestamp; - - my $spacing = ''; - my $comment = ''; - my $blank = 0; - my $saw_bk = 0; - my $var_look = VAR_ASIS; - - use constant IN_VAR_DEF => 0; - use constant IN_RULE_DEF => 1; - use constant IN_COMMENT => 2; - my $prev_state = IN_RULE_DEF; - - while ($_ = $am_file->getline) - { - $where->set ("$amfile:$."); - if (/$IGNORE_PATTERN/o) - { - # Merely delete comments beginning with two hashes. - } - elsif (/$WHITE_PATTERN/o) - { - error $where, "blank line following trailing backslash" - if $saw_bk; - # Stick a single white line before the incoming macro or rule. - $spacing = "\n"; - $blank = 1; - # Flush all comments seen so far. - if ($comment ne '') - { - $output_vars .= $comment; - $comment = ''; - } - } - elsif (/$COMMENT_PATTERN/o) - { - # Stick comments before the incoming macro or rule. Make - # sure a blank line precedes the first block of comments. - $spacing = "\n" unless $blank; - $blank = 1; - $comment .= $spacing . $_; - $spacing = ''; - $prev_state = IN_COMMENT; - } - else - { - last; - } - $saw_bk = check_trailing_slash ($where, $_); - } - - # We save the conditional stack on entry, and then check to make - # sure it is the same on exit. This lets us conditionally include - # other files. - my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); - - my $last_var_name = ''; - my $last_var_type = ''; - my $last_var_value = ''; - my $last_where; - # FIXME: shouldn't use $_ in this loop; it is too big. - while ($_) - { - $where->set ("$amfile:$."); - - # Make sure the line is \n-terminated. - chomp; - $_ .= "\n"; - - # Don't look at MAINTAINER_MODE_TRUE here. That shouldn't be - # used by users. @MAINT@ is an anachronism now. - $_ =~ s/\@MAINT\@//g - unless $seen_maint_mode; - - my $new_saw_bk = check_trailing_slash ($where, $_); - - if ($reldir eq '.') - { - # If present, eat the following '_' or '/', converting - # "%reldir%/foo" and "%canon_reldir%_foo" into plain "foo" - # when $reldir is '.'. - $_ =~ s,%(D|reldir)%/,,g; - $_ =~ s,%(C|canon_reldir)%_,,g; - } - $_ =~ s/%(D|reldir)%/${reldir}/g; - $_ =~ s/%(C|canon_reldir)%/${canon_reldir}/g; - - 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" - if $saw_bk; - } - elsif (/$COMMENT_PATTERN/o) - { - error $where, "comment following trailing backslash" - if $saw_bk && $prev_state != IN_COMMENT; - - # Stick comments before the incoming macro or rule. - $comment .= $spacing . $_; - $spacing = ''; - $prev_state = IN_COMMENT; - } - elsif ($saw_bk) - { - if ($prev_state == IN_RULE_DEF) - { - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - } - elsif ($prev_state == IN_COMMENT) - { - # If the line doesn't start with a '#', add it. - # We do this because a continued comment like - # # A = foo \ - # bar \ - # baz - # is not portable. BSD make doesn't honor - # escaped newlines in comments. - s/^#?/#/; - $comment .= $spacing . $_; - } - else # $prev_state == IN_VAR_DEF - { - $last_var_value .= ' ' - unless $last_var_value =~ /\s$/; - $last_var_value .= $_; - - if (!/\\$/) - { - Automake::Variable::define ($last_var_name, VAR_MAKEFILE, - $last_var_type, $cond, - $last_var_value, $comment, - $last_where, VAR_ASIS) - if $cond != FALSE; - $comment = $spacing = ''; - } - } - } - - elsif (/$IF_PATTERN/o) - { - $cond = cond_stack_if ($1, $2, $where); - } - elsif (/$ELSE_PATTERN/o) - { - $cond = cond_stack_else ($1, $2, $where); - } - elsif (/$ENDIF_PATTERN/o) - { - $cond = cond_stack_endif ($1, $2, $where); - } - - elsif (/$RULE_PATTERN/o) - { - # Found a rule. - $prev_state = IN_RULE_DEF; - - # For now we have to output all definitions of user rules - # and can't diagnose duplicates (see the comment in - # Automake::Rule::define). So we go on and ignore the return value. - Automake::Rule::define ($1, $amfile, RULE_USER, $cond, $where); - - check_variable_expansions ($_, $where); - - $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - $comment = $spacing = ''; - } - elsif (/$ASSIGNMENT_PATTERN/o) - { - # Found a macro definition. - $prev_state = IN_VAR_DEF; - $last_var_name = $1; - $last_var_type = $2; - $last_var_value = $3; - $last_where = $where->clone; - if ($3 ne '' && substr ($3, -1) eq "\\") - { - # We preserve the '\' because otherwise the long lines - # that are generated will be truncated by broken - # 'sed's. - $last_var_value = $3 . "\n"; - } - # Normally we try to output variable definitions in the - # same format they were input. However, POSIX compliant - # systems are not required to support lines longer than - # 2048 bytes (most notably, some sed implementation are - # limited to 4000 bytes, and sed is used by config.status - # to rewrite Makefile.in into Makefile). Moreover nobody - # would really write such long lines by hand since it is - # hardly maintainable. So if a line is longer that 1000 - # bytes (an arbitrary limit), assume it has been - # automatically generated by some tools, and flatten the - # variable definition. Otherwise, keep the variable as it - # as been input. - $var_look = VAR_PRETTY if length ($last_var_value) >= 1000; - - if (!/\\$/) - { - Automake::Variable::define ($last_var_name, VAR_MAKEFILE, - $last_var_type, $cond, - $last_var_value, $comment, - $last_where, $var_look) - if $cond != FALSE; - $comment = $spacing = ''; - $var_look = VAR_ASIS; - } - } - elsif (/$INCLUDE_PATTERN/o) - { - my $path = $1; - - if ($path =~ s/^\$\(top_srcdir\)\///) - { - push (@include_stack, "\$\(top_srcdir\)/$path"); - # Distribute any included file. - - # Always use the $(top_srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included - # file in the build tree during "make distdir" to satisfy - # the dependency. - # (subdir-am-cond.sh and subdir-ac-cond.sh will fail) - push_dist_common ("\$\(top_srcdir\)/$path"); - } - else - { - $path =~ s/\$\(srcdir\)\///; - push (@include_stack, "\$\(srcdir\)/$path"); - # Always use the $(srcdir) prefix in DIST_COMMON, - # otherwise OSF make will implicitly copy the included - # file in the build tree during "make distdir" to satisfy - # the dependency. - # (subdir-am-cond.sh and subdir-ac-cond.sh will fail) - push_dist_common ("\$\(srcdir\)/$path"); - $path = $relative_dir . "/" . $path if $relative_dir ne '.'; - } - my $new_reldir = File::Spec->abs2rel ($path, $relative_dir); - $new_reldir = '.' if $new_reldir !~ s,/[^/]*$,,; - $where->push_context ("'$path' included from here"); - read_am_file ($path, $where, $new_reldir); - $where->pop_context; - } - else - { - # This isn't an error; it is probably a continued rule. - # In fact, this is what we assume. - $prev_state = IN_RULE_DEF; - check_variable_expansions ($_, $where); - $output_trailer .= $comment . $spacing; - my $cond = new Automake::Condition @cond_stack; - $output_trailer .= $cond->subst_string; - $output_trailer .= $_; - $comment = $spacing = ''; - error $where, "'#' comment at start of rule is unportable" - if $_ =~ /^\t\s*\#/; - } - - $saw_bk = $new_saw_bk; - $_ = $am_file->getline; - } - - $output_trailer .= $comment; - - error ($where, "trailing backslash on last line") - if $saw_bk; - - error ($where, (@cond_stack ? "unterminated conditionals: @cond_stack" - : "too many conditionals closed in include file")) - if "@saved_cond_stack" ne "@cond_stack"; -} - - -# A helper for read_main_am_file which initializes configure variables -# and variables from header-vars.am. -sub define_standard_variables () -{ - my $saved_output_vars = $output_vars; - my ($comments, undef, $rules) = - file_contents_internal (1, "$libdir/am/header-vars.am", - new Automake::Location); - - foreach my $var (sort keys %configure_vars) - { - define_configure_variable ($var); - } - - $output_vars .= $comments . $rules; -} - - -# read_main_am_file ($MAKEFILE_AM, $MAKEFILE_IN) -# ---------------------------------------------- -sub read_main_am_file -{ - my ($amfile, $infile) = @_; - - # This supports the strange variable tricks we are about to play. - prog_error ("variable defined before read_main_am_file\n" . variables_dump ()) - if (scalar (variables) > 0); - - # Generate copyright header for generated Makefile.in. - # We do discard the output of predefined variables, handled below. - $output_vars = ("# " . basename ($infile) . " generated by automake " - . $VERSION . " from " . basename ($amfile) . ".\n"); - $output_vars .= '# ' . subst ('configure_input') . "\n"; - $output_vars .= $gen_copyright; - - # We want to predefine as many variables as possible. This lets - # the user set them with '+=' in Makefile.am. - define_standard_variables; - - # Read user file, which might override some of our values. - read_am_file ($amfile, new Automake::Location, '.'); -} - - - -################################################################ - -# $STRING -# flatten ($ORIGINAL_STRING) -# -------------------------- -sub flatten -{ - $_ = shift; - - s/\\\n//somg; - s/\s+/ /g; - s/^ //; - s/ $//; - - return $_; -} - - -# transform_token ($TOKEN, \%PAIRS, $KEY) -# --------------------------------------- -# Return the value associated to $KEY in %PAIRS, as used on $TOKEN -# (which should be ?KEY? or any of the special %% requests).. -sub transform_token ($\%$) -{ - my ($token, $transform, $key) = @_; - my $res = $transform->{$key}; - prog_error "Unknown key '$key' in '$token'" unless defined $res; - return $res; -} - - -# transform ($TOKEN, \%PAIRS) -# --------------------------- -# If ($TOKEN, $VAL) is in %PAIRS: -# - replaces %KEY% with $VAL, -# - enables/disables ?KEY? and ?!KEY?, -# - replaces %?KEY% with TRUE or FALSE. -sub transform ($\%) -{ - my ($token, $transform) = @_; - - # %KEY%. - # Must be before the following pattern to exclude the case - # when there is neither IFTRUE nor IFFALSE. - if ($token =~ /^%([\w\-]+)%$/) - { - return transform_token ($token, %$transform, $1); - } - # %?KEY%. - elsif ($token =~ /^%\?([\w\-]+)%$/) - { - return transform_token ($token, %$transform, $1) ? 'TRUE' : 'FALSE'; - } - # ?KEY? and ?!KEY?. - elsif ($token =~ /^ \? (!?) ([\w\-]+) \? $/x) - { - my $neg = ($1 eq '!') ? 1 : 0; - my $val = transform_token ($token, %$transform, $2); - return (!!$val == $neg) ? '##%' : ''; - } - else - { - prog_error "Unknown request format: $token"; - } -} - -# $TEXT -# preprocess_file ($MAKEFILE, [%TRANSFORM]) -# ----------------------------------------- -# Load a $MAKEFILE, apply the %TRANSFORM, and return the result. -# No extra parsing or post-processing is done (i.e., recognition of -# rules declaration or of make variables definitions). -sub preprocess_file -{ - my ($file, %transform) = @_; - - # Complete %transform with global options. - # Note that %transform goes last, so it overrides global options. - %transform = ( 'MAINTAINER-MODE' - => $seen_maint_mode ? subst ('MAINTAINER_MODE_TRUE') : '', - - 'XZ' => !! option 'dist-xz', - 'LZIP' => !! option 'dist-lzip', - '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, - %transform); - - if (! defined ($_ = $am_file_cache{$file})) - { - 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; - # Remember the contents of the just-read file. - $am_file_cache{$file} = $_; - } - - # Substitute Automake template tokens. - s/(?: % \?? [\w\-]+ % - | \? !? [\w\-]+ \? - )/transform($&, %transform)/gex; - # 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; - - 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) = @_; - $transform{FIRST} = !$transformed_files{$file}; - $transformed_files{$file} = 1; - - my @lines = split /(?set ($file); - - my $result_vars = ''; - my $result_rules = ''; - my $comment = ''; - my $spacing = ''; - - # The following flags are used to track rules spanning across - # multiple paragraphs. - my $is_rule = 0; # 1 if we are processing a rule. - my $discard_rule = 0; # 1 if the current rule should not be output. - - # We save the conditional stack on entry, and then check to make - # sure it is the same on exit. This lets us conditionally include - # other files. - my @saved_cond_stack = @cond_stack; - my $cond = new Automake::Condition (@cond_stack); - - foreach (make_paragraphs ($file, %transform)) - { - # FIXME: no line number available. - $where->set ($file); - - # Sanity checks. - error $where, "blank line following trailing backslash:\n$_" - if /\\$/; - error $where, "comment following trailing backslash:\n$_" - if /\\#/; - - if (/^$/) - { - $is_rule = 0; - # Stick empty line before the incoming macro or rule. - $spacing = "\n"; - } - elsif (/$COMMENT_PATTERN/mso) - { - $is_rule = 0; - # Stick comments before the incoming macro or rule. - $comment = "$_\n"; - } - - # Handle inclusion of other files. - elsif (/$INCLUDE_PATTERN/o) - { - if ($cond != FALSE) - { - my $file = ($is_am ? "$libdir/am/" : '') . $1; - $where->push_context ("'$file' included from here"); - # N-ary '.=' fails. - my ($com, $vars, $rules) - = file_contents_internal ($is_am, $file, $where, %transform); - $where->pop_context; - $comment .= $com; - $result_vars .= $vars; - $result_rules .= $rules; - } - } - - # Handling the conditionals. - elsif (/$IF_PATTERN/o) - { - $cond = cond_stack_if ($1, $2, $file); - } - elsif (/$ELSE_PATTERN/o) - { - $cond = cond_stack_else ($1, $2, $file); - } - elsif (/$ENDIF_PATTERN/o) - { - $cond = cond_stack_endif ($1, $2, $file); - } - - # Handling rules. - elsif (/$RULE_PATTERN/mso) - { - $is_rule = 1; - $discard_rule = 0; - # Separate relationship from optional actions: the first - # `new-line tab" not preceded by backslash (continuation - # line). - my $paragraph = $_; - /^(.*?)(?:(?subst_string/gme; - $result_rules .= "$spacing$comment$condparagraph\n"; - } - if (scalar @undefined_conds == 0) - { - # Remember to discard next paragraphs - # if they belong to this rule. - # (but see also FIXME: #2 above.) - $discard_rule = 1; - } - $comment = $spacing = ''; - last; - } - } - } - - elsif (/$ASSIGNMENT_PATTERN/mso) - { - my ($var, $type, $val) = ($1, $2, $3); - error $where, "variable '$var' with trailing backslash" - if /\\$/; - - $is_rule = 0; - - Automake::Variable::define ($var, - $is_am ? VAR_AUTOMAKE : VAR_MAKEFILE, - $type, $cond, $val, $comment, $where, - VAR_ASIS) - if $cond != FALSE; - - $comment = $spacing = ''; - } - else - { - # This isn't an error; it is probably some tokens which - # configure is supposed to replace, such as '@SET-MAKE@', - # or some part of a rule cut by an if/endif. - if (! $cond->false && ! ($is_rule && $discard_rule)) - { - s/^/$cond->subst_string/gme; - $result_rules .= "$spacing$comment$_\n"; - } - $comment = $spacing = ''; - } - } - - error ($where, @cond_stack ? - "unterminated conditionals: @cond_stack" : - "too many conditionals closed in include file") - if "@saved_cond_stack" ne "@cond_stack"; - - return ($comment, $result_vars, $result_rules); -} - - -# $CONTENTS -# file_contents ($BASENAME, $WHERE, [%TRANSFORM]) -# ----------------------------------------------- -# Return contents of a file from $libdir/am, automatically skipping -# macros or rules which are already known. -sub file_contents -{ - my ($basename, $where, %transform) = @_; - my ($comments, $variables, $rules) = - file_contents_internal (1, "$libdir/am/$basename.am", $where, - %transform); - return "$comments$variables$rules"; -} - - -# @PREFIX -# am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES) -# ---------------------------------------------------- -# Find all variable prefixes that are used for install directories. A -# prefix 'zar' qualifies iff: -# -# * 'zardir' is a variable. -# * 'zar_PRIMARY' is a variable. -# -# As a side effect, it looks for misspellings. It is an error to have -# a variable ending in a "reserved" suffix whose prefix is unknown, e.g. -# "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 -# need it. -sub am_primary_prefixes -{ - my ($primary, $can_dist, @prefixes) = @_; - - local $_; - my %valid = map { $_ => 0 } @prefixes; - $valid{'EXTRA'} = 0; - foreach my $var (variables $primary) - { - # Automake is allowed to define variables that look like primaries - # but which aren't. E.g. INSTALL_sh_DATA. - # Autoconf can also define variables like INSTALL_DATA, so - # ignore all configure variables (at least those which are not - # redefined in Makefile.am). - # FIXME: We should make sure that these variables are not - # conditionally defined (or else adjust the condition below). - my $def = $var->def (TRUE); - next if $def && $def->owner != VAR_MAKEFILE; - - my $varname = $var->name; - - if ($varname =~ /^(nobase_)?(dist_|nodist_)?(.*)_[[:alnum:]]+$/) - { - my ($base, $dist, $X) = ($1 || '', $2 || '', $3 || ''); - if ($dist ne '' && ! $can_dist) - { - err_var ($var, - "invalid variable '$varname': 'dist' is forbidden"); - } - # Standard directories must be explicitly allowed. - elsif (! defined $valid{$X} && exists $standard_prefix{$X}) - { - err_var ($var, - "'${X}dir' is not a legitimate directory " . - "for '$primary'"); - } - # A not explicitly valid directory is allowed if Xdir is defined. - elsif (! defined $valid{$X} && - $var->requires_variables ("'$varname' is used", "${X}dir")) - { - # Nothing to do. Any error message has been output - # by $var->requires_variables. - } - else - { - # Ensure all extended prefixes are actually used. - $valid{"$base$dist$X"} = 1; - } - } - else - { - prog_error "unexpected variable name: $varname"; - } - } - - # Return only those which are actually defined. - return sort grep { var ($_ . '_' . $primary) } keys %valid; -} - - -# am_install_var (-OPTION..., file, HOW, where...) -# ------------------------------------------------ -# -# Handle 'where_HOW' variable magic. Does all lookups, generates -# install code, and possibly generates code to define the primary -# variable. The first argument is the name of the .am file to munge, -# the second argument is the primary variable (e.g. HEADERS), and all -# subsequent arguments are possible installation locations. -# -# Returns list of [$location, $value] pairs, where -# $value's are the values in all where_HOW variable, and $location -# there associated location (the place here their parent variables were -# defined). -# -# FIXME: this should be rewritten to be cleaner. It should be broken -# up into multiple functions. -# -sub am_install_var -{ - my (@args) = @_; - - my $do_require = 1; - my $can_dist = 0; - my $default_dist = 0; - while (@args) - { - if ($args[0] eq '-noextra') - { - $do_require = 0; - } - elsif ($args[0] eq '-candist') - { - $can_dist = 1; - } - elsif ($args[0] eq '-defaultdist') - { - $default_dist = 1; - $can_dist = 1; - } - elsif ($args[0] !~ /^-/) - { - last; - } - shift (@args); - } - - my ($file, $primary, @prefix) = @args; - - # Now that configure substitutions are allowed in where_HOW - # variables, it is an error to actually define the primary. We - # allow 'JAVA', as it is customarily used to mean the Java - # interpreter. This is but one of several Java hacks. Similarly, - # 'PYTHON' is customarily used to mean the Python interpreter. - reject_var $primary, "'$primary' is an anachronism" - unless $primary eq 'JAVA' || $primary eq 'PYTHON'; - - # Get the prefixes which are valid and actually used. - @prefix = am_primary_prefixes ($primary, $can_dist, @prefix); - - # If a primary includes a configure substitution, then the EXTRA_ - # form is required. Otherwise we can't properly do our job. - my $require_extra; - - my @used = (); - my @result = (); - - foreach my $X (@prefix) - { - my $nodir_name = $X; - my $one_name = $X . '_' . $primary; - my $one_var = var $one_name; - - my $strip_subdir = 1; - # If subdir prefix should be preserved, do so. - if ($nodir_name =~ /^nobase_/) - { - $strip_subdir = 0; - $nodir_name =~ s/^nobase_//; - } - - # If files should be distributed, do so. - my $dist_p = 0; - if ($can_dist) - { - $dist_p = (($default_dist && $nodir_name !~ /^nodist_/) - || (! $default_dist && $nodir_name =~ /^dist_/)); - $nodir_name =~ s/^(dist|nodist)_//; - } - - - # Use the location of the currently processed variable. - # We are not processing a particular condition, so pick the first - # available. - my $tmpcond = $one_var->conditions->one_cond; - my $where = $one_var->rdef ($tmpcond)->location->clone; - - # Append actual contents of where_PRIMARY variable to - # @result, skipping @substitutions@. - foreach my $locvals ($one_var->value_as_list_recursive (location => 1)) - { - my ($loc, $value) = @$locvals; - # Skip configure substitutions. - if ($value =~ /^\@.*\@$/) - { - if ($nodir_name eq 'EXTRA') - { - error ($where, - "'$one_name' contains configure substitution, " - . "but shouldn't"); - } - # Check here to make sure variables defined in - # configure.ac do not imply that EXTRA_PRIMARY - # must be defined. - elsif (! defined $configure_vars{$one_name}) - { - $require_extra = $one_name - if $do_require; - } - } - else - { - # 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. - # Do it here rather than in handle_programs so the - # uniquifying at the end of this function works. - ${$locvals}[1] =~ s/\$\(EXEEXT\)$// - if $primary eq 'PROGRAMS'; - - 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'; - - if ($nodir_name eq 'check') - { - push (@check, '$(' . $one_name . ')'); - } - else - { - push (@used, '$(' . $one_name . ')'); - } - - # Is this to be installed? - my $install_p = $nodir_name ne 'noinst' && $nodir_name ne 'check'; - - # If so, with install-exec? (or install-data?). - my $exec_p = ($nodir_name =~ /$EXEC_DIR_PATTERN/o); - - my $check_options_p = $install_p && !! option 'std-options'; - - # Use the location of the currently processed variable as context. - $where->push_context ("while processing '$one_name'"); - - # The variable containing all files to distribute. - my $distvar = "\$($one_name)"; - $distvar = shadow_unconditionally ($one_name, $where) - if ($dist_p && $one_var->has_conditional_contents); - - # Singular form of $PRIMARY. - (my $one_primary = $primary) =~ s/S$//; - $output_rules .= file_contents ($file, $where, - PRIMARY => $primary, - ONE_PRIMARY => $one_primary, - DIR => $X, - NDIR => $nodir_name, - BASE => $strip_subdir, - EXEC => $exec_p, - INSTALL => $install_p, - DIST => $dist_p, - DISTVAR => $distvar, - 'CK-OPTS' => $check_options_p); - } - - # The JAVA variable is used as the name of the Java interpreter. - # The PYTHON variable is used as the name of the Python interpreter. - if (@used && $primary ne 'JAVA' && $primary ne 'PYTHON') - { - # Define it. - define_pretty_variable ($primary, TRUE, INTERNAL, @used); - $output_vars .= "\n"; - } - - err_var ($require_extra, - "'$require_extra' contains configure substitution,\n" - . "but 'EXTRA_$primary' not defined") - if ($require_extra && ! var ('EXTRA_' . $primary)); - - # Push here because PRIMARY might be configure time determined. - push (@all, '$(' . $primary . ')') - if @used && $primary ne 'JAVA' && $primary ne 'PYTHON'; - - # Make the result unique. This lets the user use conditionals in - # a natural way, but still lets us program lazily -- we don't have - # to worry about handling a particular object more than once. - # We will keep only one location per object. - my %result = (); - for my $pair (@result) - { - my ($loc, $val) = @$pair; - $result{$val} = $loc; - } - my @l = sort keys %result; - return map { [$result{$_}->clone, $_] } @l; -} - - -################################################################ - -# Each key in this hash is the name of a directory holding a -# Makefile.in. These variables are local to 'is_make_dir'. -my %make_dirs = (); -my $make_dirs_set = 0; - -# is_make_dir ($DIRECTORY) -# ------------------------ -sub is_make_dir -{ - my ($dir) = @_; - if (! $make_dirs_set) - { - foreach my $iter (@configure_input_files) - { - $make_dirs{dirname ($iter)} = 1; - } - # We also want to notice Makefile.in's. - foreach my $iter (@other_input_files) - { - if ($iter =~ /Makefile\.in$/) - { - $make_dirs{dirname ($iter)} = 1; - } - } - $make_dirs_set = 1; - } - return defined $make_dirs{$dir}; -} - -################################################################ - -# Find the aux dir. This should match the algorithm used by -# ./configure. (See the Autoconf documentation for for -# AC_CONFIG_AUX_DIR.) -sub locate_aux_dir () -{ - if (! $config_aux_dir_set_in_configure_ac) - { - # The default auxiliary directory is the first - # of ., .., or ../.. that contains install-sh. - # Assume . if install-sh doesn't exist yet. - for my $dir (qw (. .. ../..)) - { - if (-f "$dir/install-sh") - { - $config_aux_dir = $dir; - last; - } - } - $config_aux_dir = '.' unless $config_aux_dir; - } - # Avoid unsightly '/.'s. - $am_config_aux_dir = - '$(top_srcdir)' . ($config_aux_dir eq '.' ? "" : "/$config_aux_dir"); - $am_config_aux_dir =~ s,/*$,,; -} - - -# push_required_file ($DIR, $FILE, $FULLFILE) -# ------------------------------------------- -# Push the given file onto DIST_COMMON. -sub push_required_file -{ - my ($dir, $file, $fullfile) = @_; - - # If the file to be distributed is in the same directory of the - # currently processed Makefile.am, then we want to distribute it - # from this same Makefile.am. - if ($dir eq $relative_dir) - { - push_dist_common ($file); - } - # This is needed to allow a construct in a non-top-level Makefile.am - # to require a file in the build-aux directory (see at least the test - # script 'test-driver-is-distributed.sh'). This is related to the - # automake bug#9546. Note that the use of $config_aux_dir instead - # of $am_config_aux_dir here is deliberate and necessary. - elsif ($dir eq $config_aux_dir) - { - push_dist_common ("$am_config_aux_dir/$file"); - } - # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support. - # We probably need some refactoring of this function and its callers, - # to have a more explicit and systematic handling of all the special - # cases; but, since there are only two of them, this is low-priority - # ATM. - elsif ($config_libobj_dir && $dir eq $config_libobj_dir) - { - # Avoid unsightly '/.'s. - my $am_config_libobj_dir = - '$(top_srcdir)' . - ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir"); - $am_config_libobj_dir =~ s|/*$||; - push_dist_common ("$am_config_libobj_dir/$file"); - } - 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); - } - else - { - prog_error "a Makefile in relative directory $relative_dir " . - "can't add files in directory $dir to DIST_COMMON"; - } -} - - -# 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 = (); - -# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE) -# ------------------------------------------------------- -# Verify that the file must exist in $DIRECTORY, or install it. -sub required_file_check_or_copy -{ - my ($where, $dir, $file) = @_; - - my $fullfile = "$dir/$file"; - my $found_it = 0; - my $dangling_sym = 0; - - if (-l $fullfile && ! -f $fullfile) - { - $dangling_sym = 1; - } - elsif (dir_has_case_matching_file ($dir, $file)) - { - $found_it = 1; - } - - # '--force-missing' only has an effect if '--add-missing' is - # specified. - return - if $found_it && (! $add_missing || ! $force_missing); - - # 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) - { - return if defined $required_file_not_found{$fullfile}; - $required_file_not_found{$fullfile} = 1; - } - if ($dangling_sym && $add_missing) - { - unlink ($fullfile); - } - - my $trailer = ''; - my $trailer2 = ''; - my $suppress = 0; - - # Only install missing files according to our desired - # strictness level. - my $message = "required file '$fullfile' not found"; - if ($add_missing) - { - if (-f "$libdir/$file") - { - $suppress = 1; - - # Install the missing file. Symlink if we - # can, copy if we must. Note: delete the file - # first, in case it is a dangling symlink. - $message = "installing '$fullfile'"; - - # The license file should not be volatile. - if ($file eq "COPYING") - { - $message .= " using GNU General Public License v3 file"; - $trailer2 = "\n Consider adding the COPYING file" - . " to the version control system" - . "\n for your code, to avoid questions" - . " about which license your project uses"; - } - - # Windows Perl will hang if we try to delete a - # file that doesn't exist. - unlink ($fullfile) if -f $fullfile; - if ($symlink_exists && ! $copy_missing) - { - if (! symlink ("$libdir/$file", $fullfile) - || ! -e $fullfile) - { - $suppress = 0; - $trailer = "; error while making link: $!"; - } - } - elsif (system ('cp', "$libdir/$file", $fullfile)) - { - $suppress = 0; - $trailer = "\n error while copying"; - } - set_dir_cache_file ($dir, $file); - } - } - 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. - return - if $found_it && $force_missing; - - # 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. - return - if !$suppress && rule $file; - - msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2"); -} - - -# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES) -# --------------------------------------------------------------------- -# Verify that the file must exist in $DIRECTORY, or install it. -# $MYSTRICT is the strictness level at which this file becomes required. -# Worker threads may queue up the action to be serialized by the master, -# if $QUEUE is true -sub require_file_internal -{ - my ($where, $mystrict, $dir, $queue, @files) = @_; - - return - unless $strictness >= $mystrict; - - foreach my $file (@files) - { - push_required_file ($dir, $file, "$dir/$file"); - if ($queue) - { - queue_required_file_check_or_copy ($required_conf_file_queue, - QUEUE_CONF_FILE, $relative_dir, - $where, $mystrict, @files); - } - else - { - required_file_check_or_copy ($where, $dir, $file); - } - } -} - -# require_file ($WHERE, $MYSTRICT, @FILES) -# ---------------------------------------- -sub require_file -{ - my ($where, $mystrict, @files) = @_; - require_file_internal ($where, $mystrict, $relative_dir, 0, @files); -} - -# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) -# ---------------------------------------------------------- -sub require_file_with_macro -{ - my ($cond, $macro, $mystrict, @files) = @_; - $macro = rvar ($macro) unless ref $macro; - require_file ($macro->rdef ($cond)->location, $mystrict, @files); -} - -# require_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, 0, @files); - } - else - { - require_file ($macro->rdef ($cond)->location, $mystrict, @files); - } -} - -# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE, -# $MYSTRICT, @FILES) -# -------------------------------------------------------------- -sub queue_required_file_check_or_copy -{ - my ($queue, $key, $dir, $where, $mystrict, @files) = @_; - my @serial_loc; - if (ref $where) - { - @serial_loc = (QUEUE_LOCATION, $where->serialize ()); - } - else - { - @serial_loc = (QUEUE_STRING, $where); - } - $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files); -} - -# require_queued_file_check_or_copy ($QUEUE) -# ------------------------------------------ -sub require_queued_file_check_or_copy -{ - my ($queue) = @_; - my $where; - my $dir = $queue->dequeue (); - my $loc_key = $queue->dequeue (); - if ($loc_key eq QUEUE_LOCATION) - { - $where = Automake::Location::deserialize ($queue); - } - elsif ($loc_key eq QUEUE_STRING) - { - $where = $queue->dequeue (); - } - else - { - prog_error "unexpected key $loc_key"; - } - my $mystrict = $queue->dequeue (); - my $nfiles = $queue->dequeue (); - my @files; - push @files, $queue->dequeue () - foreach (1 .. $nfiles); - return - unless $strictness >= $mystrict; - foreach my $file (@files) - { - required_file_check_or_copy ($where, $config_aux_dir, $file); - } -} - -# 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) = @_; - my $queue = defined $required_conf_file_queue ? 1 : 0; - require_file_internal ($where, $mystrict, $config_aux_dir, - $queue, @files); -} - - -# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES) -# --------------------------------------------------------------- -sub require_conf_file_with_macro -{ - my ($cond, $macro, $mystrict, @files) = @_; - require_conf_file (rvar ($macro)->rdef ($cond)->location, - $mystrict, @files); -} - -################################################################ - -# require_build_directory ($DIRECTORY) -# ------------------------------------ -# Emit rules to create $DIRECTORY if needed, and return -# the file that any target requiring this directory should be made -# dependent upon. -# 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); - - if (exists $directory_map{$cdir}) - { - 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 must be removed by 'make distclean'. - $clean_files{$dirstamp} = DIST_CLEAN; - - $output_rules .= ("$dirstamp:\n" - . "\t\@\$(MKDIR_P) $directory\n" - . "\t\@: > $dirstamp\n"); - - return $dirstamp; -} - -# require_build_directory_maybe ($FILE) -# ------------------------------------- -# If $FILE lies in a subdirectory, emit a rule to create this -# directory and return the file that $FILE should be made -# dependent upon. Otherwise, just return the empty string. -sub require_build_directory_maybe -{ - my $file = shift; - my $directory = dirname ($file); - - if ($directory ne '.') - { - return require_build_directory ($directory); - } - else - { - return ''; - } -} - -################################################################ - -# Push a list of files onto '@dist_common'. -sub push_dist_common -{ - prog_error "push_dist_common run after handle_dist" - if $handle_dist_run; - Automake::Variable::define ('DIST_COMMON', VAR_AUTOMAKE, '+', TRUE, "@_", - '', INTERNAL, VAR_PRETTY); -} - - -################################################################ - -# generate_makefile ($MAKEFILE_AM, $MAKEFILE_IN) -# ---------------------------------------------- -# Generate a Makefile.in given the name of the corresponding Makefile and -# the name of the file output by config.status. -sub generate_makefile -{ - my ($makefile_am, $makefile_in) = @_; - - # Reset all the Makefile.am related variables. - initialize_per_input; - - # AUTOMAKE_OPTIONS can contains -W flags to disable or enable - # warnings for this file. So hold any warning issued before - # we have processed AUTOMAKE_OPTIONS. - buffer_messages ('warning'); - - # $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 the subroutine - # 'scan_autoconf_files' for details. - my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in}); - - $relative_dir = dirname ($makefile); - - read_main_am_file ($makefile_am, $makefile_in); - if (not handle_options) - { - # Process buffered warnings. - flush_messages; - # Fatal error. Just return, so we can continue with next file. - return; - } - # Process buffered warnings. - flush_messages; - - # There are a few install-related variables that you should not define. - foreach my $var ('PRE_INSTALL', 'POST_INSTALL', 'NORMAL_INSTALL') - { - my $v = var $var; - if ($v) - { - my $def = $v->def (TRUE); - prog_error "$var not defined in condition TRUE" - unless $def; - reject_var $var, "'$var' should not be defined" - if $def->owner != VAR_AUTOMAKE; - } - } - - # Catch some obsolete variables. - msg_var ('obsolete', 'INCLUDES', - "'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')") - if var ('INCLUDES'); - - # 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_gnu_standards; - check_gnits_standards; - - handle_configure ($makefile_am, $makefile_in, $makefile, @inputs); - handle_gettext; - handle_libraries; - handle_ltlibraries; - handle_programs; - handle_scripts; - - handle_silent; - - # 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_texinfo; - handle_emacs_lisp; - handle_python; - handle_java; - handle_man_pages; - handle_data; - handle_headers; - handle_subdirs; - handle_user_recursion; - handle_tags; - handle_minor_options; - # Must come after handle_programs so that %known_programs is up-to-date. - handle_tests; - - # This must come after most other rules. - handle_dist; - - handle_footer; - do_check_merge_target; - handle_all ($makefile); - - # FIXME: Gross! - if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS')) - { - $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n"; - } - if (var ('nobase_lib_LTLIBRARIES') && var ('bin_PROGRAMS')) - { - $output_rules .= "install-binPROGRAMS: install-nobase_libLTLIBRARIES\n\n"; - } - - handle_install; - handle_clean ($makefile); - handle_factored_dependencies; - - # Comes last, because all the above procedures may have - # defined or overridden variables. - $output_vars .= output_variables; - - check_typos; - - if ($exit_code != 0) - { - verb "not writing $makefile_in because of earlier errors"; - return; - } - - my $am_relative_dir = dirname ($makefile_am); - mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir; - - # 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 $makefile_in; - if (! $force_generation - && $configure_deps_greatest_timestamp < $timestamp - && $output_deps_greatest_timestamp < $timestamp - && $output eq contents ($makefile_in)) - { - verb "$makefile_in unchanged"; - # No need to update. - return; - } - - if (-e $makefile_in) - { - unlink ($makefile_in) - or fatal "cannot remove $makefile_in: $!"; - } - - my $gm_file = new Automake::XFile "> $makefile_in"; - verb "creating $makefile_in"; - print $gm_file $output; -} - - -################################################################ - - -# Helper function for usage(). -sub print_autodist_files -{ - # NOTE: we need to call our 'uniq' function with the leading '&' - # here, because otherwise perl complains that "Unquoted string - # 'uniq' may clash with future reserved word". - my @lcomm = sort (&uniq (@_)); - - my @four; - format USAGE_FORMAT = - @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<< - $four[0], $four[1], $four[2], $four[3] -. - local $~ = "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; - } -} - - -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: - --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 set directory storing library files - --print-libdir print directory storing library files - -c, --copy with -a, copy missing files (default is symlink) - -f, --force-missing force update of standard files - -"; - Automake::ChannelDefs::usage; - - print "\nFiles automatically distributed if found " . - "(always):\n"; - print_autodist_files @common_files; - print "\nFiles automatically distributed if found " . - "(under certain conditions):\n"; - print_autodist_files @common_sometimes; - - print ' -Report bugs to . -GNU Automake home page: . -General help using GNU software: . -'; - - # --help always returns 0 per GNU standards. - exit 0; -} - - -sub version () -{ - print < -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by Tom Tromey - and Alexandre Duret-Lutz . -EOF - # --version always returns 0 per GNU standards. - exit 0; -} - -################################################################ - -# Parse command line. -sub parse_arguments () -{ - my $strict = 'gnu'; - my $ignore_deps = 0; - my @warnings = (); - - my %cli_options = - ( - 'version' => \&version, - 'help' => \&usage, - 'libdir=s' => \$libdir, - 'print-libdir' => sub { print "$libdir\n"; exit 0; }, - 'gnu' => sub { $strict = 'gnu'; }, - 'gnits' => sub { $strict = 'gnits'; }, - 'foreign' => sub { $strict = 'foreign'; }, - 'include-deps' => sub { $ignore_deps = 0; }, - 'i|ignore-deps' => sub { $ignore_deps = 1; }, - 'no-force' => sub { $force_generation = 0; }, - 'f|force-missing' => \$force_missing, - 'a|add-missing' => \$add_missing, - 'c|copy' => \$copy_missing, - 'v|verbose' => sub { setup_channel 'verb', silent => 0; }, - 'W|warnings=s' => \@warnings, - ); - - use Automake::Getopt (); - Automake::Getopt::parse_options %cli_options; - - set_strictness ($strict); - my $cli_where = new Automake::Location; - set_global_option ('no-dependencies', $cli_where) if $ignore_deps; - for my $warning (@warnings) - { - parse_warnings ('-W', $warning); - } - - return unless @ARGV; - - 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; -} - - -# handle_makefile ($MAKEFILE) -# --------------------------- -sub handle_makefile -{ - my ($file) = @_; - ($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; - } -} - -# Deal with all makefiles, without threads. -sub handle_makefiles_serial () -{ - foreach my $file (@input_files) - { - handle_makefile ($file); - } -} - -# Logic for deciding how many worker threads to use. -sub get_number_of_threads () -{ - my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0; - - $nthreads = 0 - unless $nthreads =~ /^[0-9]+$/; - - # It doesn't make sense to use more threads than makefiles, - my $max_threads = @input_files; - - if ($nthreads > $max_threads) - { - $nthreads = $max_threads; - } - return $nthreads; -} - -# handle_makefiles_threaded ($NTHREADS) -# ------------------------------------- -# Deal with all makefiles, using threads. The general strategy is to -# spawn NTHREADS worker threads, dispatch makefiles to them, and let the -# worker threads push back everything that needs serialization: -# * warning and (normal) error messages, for stable stderr output -# order and content (avoiding duplicates, for example), -# * races when installing aux files (and respective messages), -# * races when collecting aux files for distribution. -# -# The latter requires that the makefile that deals with the aux dir -# files be handled last, done by the master thread. -sub handle_makefiles_threaded -{ - my ($nthreads) = @_; - - # The file queue distributes all makefiles, the message queues - # collect all serializations needed for respective files. - my $file_queue = Thread::Queue->new; - my %msg_queues; - foreach my $file (@input_files) - { - $msg_queues{$file} = Thread::Queue->new; - } - - verb "spawning $nthreads worker threads"; - my @threads = (1 .. $nthreads); - foreach my $t (@threads) - { - $t = threads->new (sub - { - while (my $file = $file_queue->dequeue) - { - verb "handling $file"; - my $queue = $msg_queues{$file}; - setup_channel_queue ($queue, QUEUE_MESSAGE); - $required_conf_file_queue = $queue; - handle_makefile ($file); - $queue->enqueue (undef); - setup_channel_queue (undef, undef); - $required_conf_file_queue = undef; - } - return $exit_code; - }); - } - - # Queue all makefiles. - verb "queuing " . @input_files . " input files"; - $file_queue->enqueue (@input_files, (undef) x @threads); - - # Collect and process serializations. - foreach my $file (@input_files) - { - verb "dequeuing messages for " . $file; - reset_local_duplicates (); - my $queue = $msg_queues{$file}; - while (my $key = $queue->dequeue) - { - if ($key eq QUEUE_MESSAGE) - { - pop_channel_queue ($queue); - } - elsif ($key eq QUEUE_CONF_FILE) - { - require_queued_file_check_or_copy ($queue); - } - else - { - prog_error "unexpected key $key"; - } - } - } - - foreach my $t (@threads) - { - my @exit_thread = $t->join; - $exit_code = $exit_thread[0] - if ($exit_thread[0] > $exit_code); - } -} - -################################################################ - -# 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"); - } - -my $nthreads = get_number_of_threads (); - -if ($perl_threads && $nthreads >= 1) - { - handle_makefiles_threaded ($nthreads); - } -else - { - handle_makefiles_serial (); - } - -exit $exit_code; - - -### Setup "GNU" style for perl-mode and cperl-mode. -## Local Variables: -## perl-indent-level: 2 -## perl-continued-statement-offset: 2 -## perl-continued-brace-offset: 0 -## perl-brace-offset: 0 -## perl-brace-imaginary-offset: 0 -## perl-label-offset: -2 -## cperl-indent-level: 2 -## cperl-brace-offset: 0 -## cperl-continued-brace-offset: 0 -## cperl-label-offset: -2 -## cperl-extra-newline-before-brace: t -## cperl-merge-trailing-else: nil -## cperl-continued-statement-offset: 2 -## End: diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoreconf b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoreconf deleted file mode 100755 index fac800ba3..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoreconf +++ /dev/null @@ -1,718 +0,0 @@ -#! /usr/bin/perl -w -# -*- perl -*- -# Generated from autoreconf.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# autoreconf - install the GNU Build System in a directory tree -# Copyright (C) 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Written by David J. MacKenzie. -# Extended and rewritten in Perl by Akim Demaille. - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::Configure_ac; -use Autom4te::FileUtils; -use Autom4te::General; -use Autom4te::XFile; -# Do not use Cwd::chdir, since it might hang. -use Cwd 'cwd'; -use strict; - -## ----------- ## -## Variables. ## -## ----------- ## - -# $HELP -# ----- -$help = "Usage: $0 [OPTION]... [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 `.'). - -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 -`--force' option. - -Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don't remove temporary files - -f, --force consider 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 . " - -The environment variable \`WARNINGS\' is honored. Some subtools might -support other warning types, using \`all' is encouraged. - -Library directories: - -B, --prepend-include=DIR prepend directory DIR to search path - -I, --include=DIR append directory DIR to search path - -The environment variables AUTOM4TE, AUTOCONF, AUTOHEADER, AUTOMAKE, -ACLOCAL, AUTOPOINT, LIBTOOLIZE, M4, and MAKE are honored. - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - -# $VERSION -# -------- -$version = "autoreconf (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by David J. MacKenzie and Akim Demaille. -"; - -# Lib files. -my $autoconf = $ENV{'AUTOCONF'} || '/i686-pc-linux-gnu/bin/autoconf'; -my $autoheader = $ENV{'AUTOHEADER'} || '/i686-pc-linux-gnu/bin/autoheader'; -my $autom4te = $ENV{'AUTOM4TE'} || '/i686-pc-linux-gnu/bin/autom4te'; -my $automake = $ENV{'AUTOMAKE'} || 'automake'; -my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; -my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; -my $autopoint = $ENV{'AUTOPOINT'} || 'autopoint'; -my $make = $ENV{'MAKE'} || 'make'; - -# --install -- as --add-missing in other tools. -my $install = 0; -# symlink -- when --install, use symlinks instead. -my $symlink = 0; -# Does aclocal support --force? -my $aclocal_supports_force = 0; -# Does aclocal support -Wfoo? -my $aclocal_supports_warnings = 0; -# Does automake support --force-missing? -my $automake_supports_force_missing = 0; -# Does automake support -Wfoo? -my $automake_supports_warnings = 0; - -my @prepend_include; -my @include; - -# List of command line warning requests. -my @warning; - -# Rerun `./configure && make'? -my $run_make = 0; - -# Recurse into subpackages -my $recursive = 1; - -## ---------- ## -## Routines. ## -## ---------- ## - - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - my $srcdir; - - getopt ("W|warnings=s" => \@warning, - 'I|include=s' => \@include, - 'B|prepend-include=s' => \@prepend_include, - 'i|install' => \$install, - 's|symlink' => \$symlink, - 'm|make' => \$run_make, - 'recursive!' => \$recursive); - - # 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 - # is simpler, and (ii) we are still able to diagnose simultaneous - # presence of configure.ac and configure.in. - @ARGV = map { /configure\.(ac|in)$/ ? dirname ($_) : $_ } @ARGV; - push @ARGV, '.' unless @ARGV; - - if ($verbose && $debug) - { - for my $prog ($autoconf, $autoheader, - $automake, $aclocal, - $autopoint, - $libtoolize) - { - xsystem ("$prog --version | sed 1q >&2"); - print STDERR "\n"; - } - } - - my $aclocal_help = `$aclocal --help 2>/dev/null`; - my $automake_help = `$automake --help 2>/dev/null`; - $aclocal_supports_force = $aclocal_help =~ /--force/; - $aclocal_supports_warnings = $aclocal_help =~ /--warnings/; - $automake_supports_force_missing = $automake_help =~ /--force-missing/; - $automake_supports_warnings = $automake_help =~ /--warnings/; - - # Dispatch autoreconf's option to the tools. - # --include; - $aclocal .= join (' -I ', '', map { shell_quote ($_) } @include); - $autoconf .= join (' --include=', '', map { shell_quote ($_) } @include); - $autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); - $autoheader .= join (' --include=', '', map { shell_quote ($_) } @include); - $autoheader .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); - - # --install and --symlink; - if ($install) - { - $automake .= ' --add-missing'; - $automake .= ' --copy' unless $symlink; - $libtoolize .= ' --copy' unless $symlink; - } - # --force; - if ($force) - { - $aclocal .= ' --force' - if $aclocal_supports_force; - $autoconf .= ' --force'; - $autoheader .= ' --force'; - $automake .= ' --force-missing' - if $automake_supports_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; - } - # --verbose --verbose or --debug; - if ($verbose > 1 || $debug) - { - $autoconf .= ' --verbose'; - $autoheader .= ' --verbose'; - $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 - if $automake_supports_warnings; - $aclocal .= $warn - if $aclocal_supports_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; - - # ---------------------- # - # Is it using Autoconf? # - # ---------------------- # - - 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/; - } - } - if (!$uses_autoconf) - { - verb "$configure_ac: not using Autoconf"; - return; - } - - - # ------------------- # - # Running autopoint. # - # ------------------- # - - # Gettext is a bit of a problem: its macros are not necessarily - # visible to aclocal, so if we start with a completely striped down - # package (think of a fresh CVS checkout), running `aclocal' first - # will fail: the Gettext macros are missing. - # - # Therefore, we can't use the traces to decide if we use Gettext or - # not. I guess that once Gettext move to 2.5x we will be able to, - # but in the meanwhile forget it. - # - # We can only grep for AM_GNU_GETTEXT_VERSION in configure.ac. You - # might think this approach is naive, and indeed it is, as it - # prevents one to embed AM_GNU_GETTEXT_VERSION in another *.m4, but - # anyway we don't limit the generality, since... that's what - # autopoint does. Actually, it is even more restrictive, as it - # greps for `^AM_GNU_GETTEXT_VERSION('. We did this above, while - # scanning configure.ac. - if (!$uses_gettext) - { - verb "$configure_ac: not using Gettext"; - } - elsif (!$install) - { - verb "$configure_ac: not running autopoint: --install not given"; - } - else - { - xsystem_hint ("autopoint is needed because this package uses Gettext", "$autopoint"); - } - - - # ----------------- # - # Running aclocal. # - # ----------------- # - - # Run it first: it might discover new macros to add, e.g., - # AC_PROG_LIBTOOL, which we will trace later to see if Libtool is - # used. - # - # Always run it. Tracking its sources for up-to-dateness is too - # complex and too error prone. The best we can do is avoiding - # nuking the time stamp. - my $uses_aclocal = 1; - - # Nevertheless, if aclocal.m4 exists and is not made by aclocal, - # don't run aclocal. - - if (-f 'aclocal.m4') - { - my $aclocal_m4 = new Autom4te::XFile 'aclocal.m4'; - $_ = $aclocal_m4->getline; - $uses_aclocal = 0 - unless defined ($_) && /generated.*by aclocal/; - } - - # If there are flags for aclocal in Makefile.am, use them. - my $aclocal_flags = ''; - if ($uses_aclocal && -f 'Makefile.am') - { - my $makefile = new Autom4te::XFile 'Makefile.am'; - while ($_ = $makefile->getline) - { - if (/^ACLOCAL_[A-Z_]*FLAGS\s*=\s*(.*)/) - { - $aclocal_flags = $1; - last; - } - } - } - - if (!$uses_aclocal) - { - verb "$configure_ac: not using aclocal"; - } - else - { - # Some file systems 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 - # resolution of only 1 second. Work around the problem by - # ensuring that there is at least a one-second window before the - # time stamp of aclocal.m4t in which no file time stamps can - # fall. - sleep 1; - - run_aclocal ($aclocal, $aclocal_flags); - } - - # We might have to rerun aclocal if Libtool (or others) imports new - # macros. - my $rerun_aclocal = 0; - - - - # ------------------------------- # - # See what tools will be needed. # - # ------------------------------- # - - # 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"; - my $traces = new Autom4te::XFile - ("$autoconf" - . join (' ', - map { ' --trace=' . $_ . ':\$n::\${::}%' } - # If you change this list, update the - # `Autoreconf-preselections' section of autom4te.in. - 'AC_CONFIG_AUX_DIR', - 'AC_CONFIG_HEADERS', - 'AC_CONFIG_SUBDIRS', - 'AC_INIT', - 'AC_PROG_LIBTOOL', - 'LT_INIT', - 'LT_CONFIG_LTDL_DIR', - 'AM_GNU_GETTEXT', - 'AM_INIT_AUTOMAKE', - ) - . ' |'); - while ($_ = $traces->getline) - { - chomp; - my ($macro, @args) = split (/::/); - $aux_dir = $args[0] if $macro eq "AC_CONFIG_AUX_DIR"; - $uses_autoconf = 1 if $macro eq "AC_INIT"; - $uses_gettext_via_traces = 1 if $macro eq "AM_GNU_GETTEXT"; - $uses_libtool = 1 if $macro eq "AC_PROG_LIBTOOL" - || $macro eq "LT_INIT"; - $uses_libltdl = 1 if $macro eq "LT_CONFIG_LTDL_DIR"; - $uses_autoheader = 1 if $macro eq "AC_CONFIG_HEADERS"; - $uses_automake = 1 if $macro eq "AM_INIT_AUTOMAKE"; - push @subdir, split (' ', $args[0]) - if $macro eq "AC_CONFIG_SUBDIRS" && $recursive; - } - - # The subdirs are *optional*, they may not exist. - foreach (@subdir) - { - if (-d) - { - verb "$configure_ac: adding subdirectory $_ to autoreconf"; - autoreconf ($_); - } - else - { - verb "$configure_ac: subdirectory $_ not present"; - } - } - - # Gettext consistency checks... - error "$configure_ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION" - if $uses_gettext_via_traces && ! $uses_gettext; - error "$configure_ac: AM_GNU_GETTEXT_VERSION is used, but not AM_GNU_GETTEXT" - 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"; - } - elsif ($install) - { - if ($uses_libltdl) - { - $libtoolize .= " --ltdl"; - } - xsystem_hint ("libtoolize is needed because this package uses Libtool", $libtoolize); - $rerun_aclocal = 1; - } - else - { - verb "$configure_ac: not running libtoolize: --install not given"; - } - - - - # ------------------- # - # Rerunning aclocal. # - # ------------------- # - - # If we re-installed Libtool or Gettext, the macros might have changed. - # Automake also needs an up-to-date aclocal.m4. - if ($rerun_aclocal) - { - if (!$uses_aclocal) - { - verb "$configure_ac: not using aclocal"; - } - else - { - run_aclocal ($aclocal, $aclocal_flags); - } - } - - - # ------------------ # - # Running autoconf. # - # ------------------ # - - # Don't try to be smarter than `autoconf', which does its own up to - # date checks. - # - # We prefer running autoconf before autoheader, because (i) the - # latter runs the former, and (ii) autoconf is stricter than - # autoheader. So all in all, autoconf should give better error - # messages. - xsystem ($autoconf); - - - # -------------------- # - # Running autoheader. # - # -------------------- # - - # We now consider that if AC_CONFIG_HEADERS is used, then autoheader - # is used too. - # - # Just as for autoconf, up to date ness is performed by the tool - # itself. - # - # Run it before automake, since the latter checks the presence of - # config.h.in when it sees an AC_CONFIG_HEADERS. - if (!$uses_autoheader) - { - verb "$configure_ac: not using Autoheader"; - } - else - { - xsystem ($autoheader); - } - - - # ------------------ # - # Running automake. # - # ------------------ # - - if (!$uses_automake) - { - verb "$configure_ac: not using Automake"; - } - else - { - # We should always run automake, and let it decide whether it shall - # update the file or not. In fact, the effect of `$force' is already - # included in `$automake' via `--no-force'. - xsystem ($automake); - } - - - # -------------- # - # Running make. # - # -------------- # - - if ($run_make) - { - if (!-f "config.status") - { - verb "no config.status: cannot re-make"; - } - else - { - xsystem ("./config.status --recheck"); - xsystem ("./config.status"); - if (!-f "Makefile") - { - verb "no Makefile: cannot re-make"; - } - else - { - xsystem ("$make"); - } - } - } -} - - -# &autoreconf ($DIRECTORY) -# ------------------------ -# Reconf the $DIRECTORY. -sub autoreconf ($) -{ - my ($directory) = @_; - my $cwd = cwd; - - # The format for this message is not free: taken from Emacs, itself - # using GNU Make's format. - verb "Entering directory `$directory'"; - chdir $directory - or error "cannot chdir to $directory: $!"; - - autoreconf_current_directory; - - # The format is not free: taken from Emacs, itself using GNU Make's - # format. - verb "Leaving directory `$directory'"; - chdir $cwd - or error "cannot chdir to $cwd: $!"; -} - - -## ------ ## -## Main. ## -## ------ ## - -# When debugging, it is convenient that all the related temporary -# files be at the same place. -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. -$ENV{'AUTOM4TE'} = $autom4te; -for my $directory (@ARGV) - { - require_configure_ac ($directory); - autoreconf ($directory); - } - -### 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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoscan b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoscan deleted file mode 100755 index 008cda33b..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoscan +++ /dev/null @@ -1,679 +0,0 @@ -#! /usr/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, -# 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Written by David MacKenzie . - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::ChannelDefs; -use Autom4te::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); - -# The kind of the words we are looking for. -my @kinds = qw (function header identifier program - makevar librarie); - -# For each kind, the default macro. -my %generic_macro = - ( - 'function' => 'AC_CHECK_FUNCS', - 'header' => 'AC_CHECK_HEADERS', - 'identifier' => 'AC_CHECK_TYPES', - 'program' => 'AC_CHECK_PROGS', - 'library' => 'AC_CHECK_LIB' - ); - -my %kind_comment = - ( - 'function' => 'Checks for library functions.', - 'header' => 'Checks for header files.', - 'identifier' => 'Checks for typedefs, structures, and compiler characteristics.', - 'program' => 'Checks for programs.', - ); - -# $USED{KIND}{ITEM} is the list of locations where the ITEM (of KIND) was used -# in the user package. -# For instance $USED{function}{alloca} is the list of `file:line' where -# `alloca (...)' appears. -my %used = (); - -# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM. -# Initialized from lib/autoscan/*. E.g., $MACRO{function}{alloca} contains -# the singleton AC_FUNC_ALLOCA. Some require several checks. -my %macro = (); - -# $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO. -# E.g., $NEEDED_MACROS{AC_FUNC_ALLOC} the list of `file:line' containing -# `alloca (...)'. -my %needed_macros = - ( - 'AC_PREREQ' => [$me], - ); - -my $configure_scan = 'configure.scan'; -my $log; - -# Autoconf and lib files. -my $autom4te = $ENV{'AUTOM4TE'} || '/i686-pc-linux-gnu/bin/autom4te'; -my $autoconf = "$autom4te --language=autoconf"; -my @prepend_include; -my @include = ('//share/autoconf'); - -# $help -# ----- -$help = "Usage: $0 [OPTION]... [SRCDIR] - -Examine source files in the directory tree rooted at SRCDIR, or the -current directory if none is given. Search the source files for -common portability problems, check for incompleteness of -`configure.ac', and create a file `$configure_scan' which is a -preliminary `configure.ac' for that package. - - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don't remove temporary files - -Library directories: - -B, --prepend-include=DIR prepend directory DIR to search path - -I, --include=DIR append directory DIR to search path - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - -# $version -# -------- -$version = "autoscan (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by David J. MacKenzie and Akim Demaille. -"; - - - - -## ------------------------ ## -## Command line interface. ## -## ------------------------ ## - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - getopt ('I|include=s' => \@include, - 'B|prepend-include=s' => \@prepend_include); - - die "$me: too many arguments -Try `$me --help' for more information.\n" - if @ARGV > 1; - - my $srcdir = $ARGV[0] || "."; - - verb "srcdir = $srcdir"; - chdir $srcdir || error "cannot cd to $srcdir: $!"; -} - - -# init_tables () -# -------------- -# Put values in the tables of what to do with each token. -sub init_tables () -{ - # The data file format supports only one line of macros per function. - # If more than that is required for a common portability problem, - # a new Autoconf macro should probably be written for that case, - # instead of duplicating the code in lots of configure.ac files. - my $file = find_file ("autoscan/autoscan.list", - reverse (@prepend_include), @include); - my $table = new Autom4te::XFile "< " . open_quote ($file); - my $tables_are_consistent = 1; - - while ($_ = $table->getline) - { - # Ignore blank lines and comments. - next - if /^\s*$/ || /^\s*\#/; - - # ': ' or... - # ': warn: '. - if (/^(\S+):\s+(\S+)\s+(\S.*)$/) - { - my ($kind, $word, $macro) = ($1, $2, $3); - error "$file:$.: invalid kind: $_" - unless grep { $_ eq $kind } @kinds; - push @{$macro{$kind}{$word}}, $macro; - } - else - { - error "$file:$.: invalid definition: $_"; - } - } - - if ($debug) - { - foreach my $kind (@kinds) - { - foreach my $word (sort keys %{$macro{$kind}}) - { - print "$kind: $word: @{$macro{$kind}{$word}}\n"; - } - } - - } -} - - -# used ($KIND, $WORD, [$WHERE]) -# ----------------------------- -# $WORD is used as a $KIND. -sub used ($$;$) -{ - my ($kind, $word, $where) = @_; - $where ||= "$File::Find::name:$."; - if ( - # Check for all the libraries. But `-links' is certainly a - # `find' argument, and `-le', a `test' argument. - ($kind eq 'library' && $word !~ /^(e|inks)$/) - # Other than libraries are to be checked only if listed in - # the Autoscan library files. - || defined $macro{$kind}{$word} - ) - { - push (@{$used{$kind}{$word}}, $where); - } -} - - - -## ----------------------- ## -## Scanning source files. ## -## ----------------------- ## - - -# scan_c_file ($FILE-NAME) -# ------------------------ -sub scan_c_file ($) -{ - my ($file_name) = @_; - push @cfiles, $File::Find::name; - - # Nonzero if in a multiline comment. - my $in_comment = 0; - - my $file = new Autom4te::XFile "< " . open_quote ($file_name); - - while ($_ = $file->getline) - { - # Strip out comments. - if ($in_comment && s,^.*?\*/,,) - { - $in_comment = 0; - } - # The whole line is inside a commment. - next if $in_comment; - # All on one line. - s,/\*.*?\*/,,g; - - # Starting on this line. - if (s,/\*.*$,,) - { - $in_comment = 1; - } - - # Preprocessor directives. - if (s/^\s*\#\s*//) - { - if (/^include\s*<([^>]*)>/) - { - used ('header', $1); - } - if (s/^(if|ifdef|ifndef|elif)\s+//) - { - foreach my $word (split (/\W+/)) - { - used ('identifier', $word) - unless $word eq 'defined' || $word !~ /^[a-zA-Z_]/; - } - } - # Ignore other preprocessor directives. - next; - } - - # Remove string and character constants. - s,\"[^\"]*\",,g; - s,\'[^\']*\',,g; - - # Tokens in the code. - # Maybe we should ignore function definitions (in column 0)? - while (s/\b([a-zA-Z_]\w*)\s*\(/ /) - { - used ('function', $1); - } - while (s/\b([a-zA-Z_]\w*)\b/ /) - { - used ('identifier', $1); - } - } - - $file->close; -} - - -# scan_makefile($MAKEFILE-NAME) -# ----------------------------- -sub scan_makefile ($) -{ - my ($file_name) = @_; - push @makefiles, $File::Find::name; - - my $file = new Autom4te::XFile "< " . open_quote ($file_name); - - while ($_ = $file->getline) - { - # Strip out comments. - s/#.*//; - - # Variable assignments. - while (s/\b([a-zA-Z_]\w*)\s*=/ /) - { - used ('makevar', $1); - } - # Be sure to catch a whole word. For instance `lex$U.$(OBJEXT)' - # is a single token. Otherwise we might believe `lex' is needed. - foreach my $word (split (/\s+/)) - { - # Libraries. - if ($word =~ /^-l([a-zA-Z_]\w*)$/) - { - used ('library', $1); - } - # Tokens in the code. - # We allow some additional characters, e.g., `+', since - # autoscan/programs includes `c++'. - if ($word =~ /^[a-zA-Z_][\w+]*$/) - { - used ('program', $word); - } - } - } - - $file->close; -} - - -# scan_sh_file($SHELL-SCRIPT-NAME) -# -------------------------------- -sub scan_sh_file ($) -{ - my ($file_name) = @_; - push @shfiles, $File::Find::name; - - my $file = new Autom4te::XFile "< " . open_quote ($file_name); - - while ($_ = $file->getline) - { - # Strip out comments and variable references. - s/#.*//; - s/\${[^\}]*}//g; - s/@[^@]*@//g; - - # Tokens in the code. - while (s/\b([a-zA-Z_]\w*)\b/ /) - { - used ('program', $1); - } - } - - $file->close; -} - - -# scan_file () -# ------------ -# Called by &find on each file. $_ contains the current file name with -# the current directory of the walk through. -sub scan_file () -{ - # Wanted only if there is no corresponding FILE.in. - return - if -f "$_.in"; - - # Save $_ as Find::File requires it to be preserved. - local $_ = $_; - - # 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; - scan_c_file ($_); - } - elsif (/\.(cc|cpp|cxx|CC|C|hh|hpp|hxx|HH|H|yy|ypp|ll|lpp)(\.in)?$/) - { - used 'program', 'c++', $File::Find::name; - scan_c_file ($_); - } - elsif ((/^((?:GNUm|M|m)akefile)(\.in)?$/ && ! -f "$1.am") - || /^(?:GNUm|M|m)akefile(\.am)?$/) - { - scan_makefile ($_); - } - elsif (/\.sh(\.in)?$/) - { - scan_sh_file ($_); - } -} - - -# scan_files () -# ------------- -# Read through the files and collect lists of tokens in them -# that might create nonportabilities. -sub scan_files () -{ - find (\&scan_file, '.'); - - if ($verbose) - { - print "cfiles: @cfiles\n"; - print "makefiles: @makefiles\n"; - print "shfiles: @shfiles\n"; - - foreach my $kind (@kinds) - { - print "\n$kind:\n"; - foreach my $word (sort keys %{$used{$kind}}) - { - print "$word: @{$used{$kind}{$word}}\n"; - } - } - } -} - - -## ----------------------- ## -## Output configure.scan. ## -## ----------------------- ## - - -# output_kind ($FILE, $KIND) -# -------------------------- -sub output_kind ($$) -{ - my ($file, $kind) = @_; - # Lists of words to be checked with the generic macro. - my @have; - - print $file "\n# $kind_comment{$kind}\n" - if exists $kind_comment{$kind}; - foreach my $word (sort keys %{$used{$kind}}) - { - # Output the needed macro invocations in $configure_scan if not - # already printed, and remember these macros are needed. - foreach my $macro (@{$macro{$kind}{$word}}) - { - if ($macro =~ /^warn:\s+(.*)/) - { - my $message = $1; - foreach my $location (@{$used{$kind}{$word}}) - { - warn "$location: warning: $message\n"; - } - } - elsif (exists $generic_macro{$kind} - && $macro eq $generic_macro{$kind}) - { - push (@have, $word); - push (@{$needed_macros{"$generic_macro{$kind}([$word])"}}, - @{$used{$kind}{$word}}); - } - else - { - if (! $printed{$macro}) - { - print $file "$macro\n"; - $printed{$macro} = 1; - } - push (@{$needed_macros{$macro}}, - @{$used{$kind}{$word}}); - } - } - } - print $file "$generic_macro{$kind}([" . join(' ', sort(@have)) . "])\n" - if @have; -} - - -# output_libraries ($FILE) -# ------------------------ -sub output_libraries ($) -{ - my ($file) = @_; - - print $file "\n# Checks for libraries.\n"; - foreach my $word (sort keys %{$used{'library'}}) - { - print $file "# FIXME: Replace `main' with a function in `-l$word':\n"; - print $file "AC_CHECK_LIB([$word], [main])\n"; - } -} - - -# output ($CONFIGURE_SCAN) -# ------------------------ -# Print a proto configure.ac. -sub output ($) -{ - my $configure_scan = shift; - my %unique_makefiles; - - my $file = new Autom4te::XFile "> " . open_quote ($configure_scan); - - print $file - ("# -*- Autoconf -*-\n" . - "# Process this file with autoconf to produce a configure script.\n" . - "\n" . - "AC_PREREQ([2.68])\n" . - "AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])\n"); - if (defined $cfiles[0]) - { - print $file "AC_CONFIG_SRCDIR([$cfiles[0]])\n"; - print $file "AC_CONFIG_HEADERS([config.h])\n"; - } - - output_kind ($file, 'program'); - output_kind ($file, 'makevar'); - output_libraries ($file); - output_kind ($file, 'header'); - output_kind ($file, 'identifier'); - output_kind ($file, 'function'); - - print $file "\n"; - if (@makefiles) - { - # Change DIR/Makefile.in to DIR/Makefile. - foreach my $m (@makefiles) - { - $m =~ s/\.(?:in|am)$//; - $unique_makefiles{$m}++; - } - print $file ("AC_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; -} - - - -## --------------------------------------- ## -## Checking the accuracy of configure.ac. ## -## --------------------------------------- ## - - -# &check_configure_ac ($CONFIGURE_AC) -# ----------------------------------- -# Use autoconf to check if all the suggested macros are included -# in CONFIGURE_AC. -sub check_configure_ac ($) -{ - my ($configure_ac) = @_; - - # Find what needed macros are invoked in CONFIGURE_AC. - # I'd be very happy if someone could explain to me why sort (uniq ...) - # doesn't work properly: I need `uniq (sort ...)'. --akim - my $trace_option = - join (' --trace=', '', - uniq (sort (map { s/\(.*//; $_ } keys %needed_macros))); - - verb "running: $autoconf $trace_option $configure_ac"; - my $traces = - new Autom4te::XFile "$autoconf $trace_option $configure_ac |"; - - while ($_ = $traces->getline) - { - chomp; - my ($file, $line, $macro, @args) = split (/:/, $_); - if ($macro =~ /^AC_CHECK_(HEADER|FUNC|TYPE|MEMBER)S$/) - { - # To be rigorous, we should distinguish between space and comma - # separated macros. But there is no point. - foreach my $word (split (/\s|,/, $args[0])) - { - # AC_CHECK_MEMBERS wants `struct' or `union'. - if ($macro eq "AC_CHECK_MEMBERS" - && $word =~ /^stat.st_/) - { - $word = "struct " . $word; - } - delete $needed_macros{"$macro([$word])"}; - } - } - else - { - delete $needed_macros{$macro}; - } - } - - $traces->close; - - # Report the missing macros. - foreach my $macro (sort keys %needed_macros) - { - warn ("$configure_ac: warning: missing $macro wanted by: " - . (${$needed_macros{$macro}}[0]) - . "\n"); - print $log "$me: warning: missing $macro wanted by: \n"; - foreach my $need (@{$needed_macros{$macro}}) - { - print $log "\t$need\n"; - } - } -} - - -## -------------- ## -## Main program. ## -## -------------- ## - -parse_args; -$log = new Autom4te::XFile "> " . open_quote ("$me.log"); - -$autoconf .= " --debug" if $debug; -$autoconf .= " --verbose" if $verbose; -$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include); -$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); - -my $configure_ac = find_configure_ac; -init_tables; -scan_files; -output ('configure.scan'); -if (-f $configure_ac) - { - check_configure_ac ($configure_ac); - } -# This close is really needed. For some reason, probably best named -# a bug, it seems that the dtor of $LOG is not called automatically -# at END. It results in a truncated file. -$log->close; -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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoupdate b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoupdate deleted file mode 100755 index 9cdd962d4..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/autoupdate +++ /dev/null @@ -1,1064 +0,0 @@ -#! /usr/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, -# 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Originally written by David MacKenzie . -# Rewritten by Akim Demaille . - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::ChannelDefs; -use Autom4te::Channels; -use Autom4te::Configure_ac; -use Autom4te::FileUtils; -use Autom4te::General; -use Autom4te::XFile; -use File::Basename; -use strict; - -# Lib files. -my $autom4te = $ENV{'AUTOM4TE'} || '/i686-pc-linux-gnu/bin/autom4te'; -my $autoconf = "$autom4te --language=autoconf"; -# We need to find m4sugar. -my @prepend_include; -my @include = ('//share/autoconf'); -my $force = 0; -# m4. -my $m4 = $ENV{"M4"} || '/usr/bin/m4'; - - -# $HELP -# ----- -$help = "Usage: $0 [OPTION]... [TEMPLATE-FILE]... - -Update each TEMPLATE-FILE if given, or `configure.ac' if present, -or else `configure.in', to the syntax of the current version of -Autoconf. The original files are backed up. - -Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit - -v, --verbose verbosely report processing - -d, --debug don't remove temporary files - -f, --force consider all files obsolete - -Library directories: - -B, --prepend-include=DIR prepend directory DIR to search path - -I, --include=DIR append directory DIR to search path - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - -# $VERSION -# -------- -$version = "autoupdate (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by David J. MacKenzie and Akim Demaille. -"; - -## ---------- ## -## Routines. ## -## ---------- ## - - -# parse_args () -# ------------- -# Process any command line arguments. -sub parse_args () -{ - my $srcdir; - - getopt ('I|include=s' => \@include, - 'B|prepend-include=s' => \@prepend_include, - 'f|force' => \$force); - - if (! @ARGV) - { - my $configure_ac = require_configure_ac; - push @ARGV, $configure_ac; - } -} - - - -# ----------------- # -# Autoconf macros. # -# ----------------- # - -my (%ac_macros, %au_macros, %m4_builtins); - -# HANDLE_AUTOCONF_MACROS () -# ------------------------- -# @M4_BUILTINS -- M4 builtins and a useful comment. -sub handle_autoconf_macros () -{ - # Get the builtins. - xsystem ("echo dumpdef | $m4 2>" . shell_quote ("$tmp/m4.defs") . " >/dev/null"); - my $m4_defs = new Autom4te::XFile "< " . open_quote ("$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 |"); - 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$/) - { - # Add the m4sugar macros to m4_builtins. - $m4_builtins{$macro} = 1; - } - else - { - # Autoconf, aclocal, and m4sh macros. - $ac_macros{$macro} = 1; - } - } - $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); - error "no current Autoconf macros found" - unless keys %ac_macros; - error "no obsolete Autoconf macros found" - unless keys %au_macros; - - if ($debug) - { - print STDERR "Current Autoconf macros:\n"; - print STDERR join (' ', sort keys %ac_macros) . "\n\n"; - print STDERR "Obsolete Autoconf macros:\n"; - print STDERR join (' ', sort keys %au_macros) . "\n\n"; - } - - # ac.m4 -- autoquoting definitions of the AC macros (M4sugar excluded). - # unac.m4 -- undefine the AC macros. - my $ac_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/ac.m4"); - print $ac_m4 "# ac.m4 -- autoquoting definitions of the AC macros.\n"; - my $unac_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/unac.m4"); - print $unac_m4 "# unac.m4 -- undefine the AC macros.\n"; - foreach (sort 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 "> " . open_quote ("$tmp/m4save.m4"); - print $m4save_m4 "# m4save.m4 -- save the m4 builtins.\n"; - my $unm4_m4 = new Autom4te::XFile "> " . open_quote ("$tmp/unm4.m4"); - print $unm4_m4 "# unm4.m4 -- disable the m4 builtins.\n"; - my $m4_m4 = new Autom4te::XFile "> " . open_quote ("$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"; - } -} - - -## -------------- ## -## Main program. ## -## -------------- ## - -parse_args; -$autoconf .= " --debug" if $debug; -$autoconf .= " --force" if $force; -$autoconf .= " --verbose" if $verbose; -$autoconf .= join (' --include=', '', map { shell_quote ($_) } @include); -$autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include); - -mktmpdir ('au'); -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'; - -# au.m4 -- definitions the AU macros. -xsystem ("$autoconf --trace AU_DEFINE:'_au_defun(\@<:\@\$1\@:>\@, -\@<:\@\$2\@:>\@)' --melt /dev/null " - . ">" . shell_quote ("$tmp/au.m4")); - - - -## ------------------- ## -## Process the files. ## -## ------------------- ## - -foreach my $file (@ARGV) - { - # We need an actual file. - if ($file eq '-') - { - $file = "$tmp/stdin"; - system "cat >" . shell_quote ($file); - } - elsif (! -r "$file") - { - die "$me: $file: No such file or directory"; - } - - # input.m4 -- m4 program to produce the updated file. - # Load the values, the dispatcher, neutralize m4, and the prepared - # input file. - my $input_m4 = <<\EOF; - divert(-1) -*- Autoconf -*- - changequote([,]) - - # Define our special macros: - define([_au__defn], defn([defn])) - define([_au__divert], defn([divert])) - define([_au__ifdef], defn([ifdef])) - define([_au__include], defn([include])) - define([_au___undefine], defn([undefine])) - define([_au__undefine], [_au__ifdef([$1], [_au___undefine([$1])])]) - define([_au__save], [m4_ifdef([$1], - [m4_define([_au_$1], _m4_defn([$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)]) - - # Move all the builtins into the `_au_' pseudo namespace - 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_enable()dnl - $2[]dnl - _au_disable()])]) - - # Import the definition of the obsolete macros. - _au__include([au.m4]) - - - ## ------------------------ ## - ## _au_enable/_au_disable. ## - ## ------------------------ ## - - # They work by pair: each time an AU macro is activated, it runs - # _au_enable, and at its end its runs _au_disable (see _au_defun - # above). AU macros might use AU macros, which should - # enable/disable only for the outer AU macros. - # - # `_au_enabled' is used to this end, determining whether we really - # enable/disable. - - - # __au_enable - # ----------- - # Reenable the builtins, m4sugar, and the autoquoting AC macros. - _au_m4_define([__au_enable], - [_au__divert(-1) - # Enable special characters. - _au_m4_changecom([#]) - - _au__include([m4.m4]) - _au__include([ac.m4]) - - _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])]) - - - # __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 special characters. - _au_m4_changequote() - _au_m4_changecom() - - _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()])]) - - - ## ------------------------------- ## - ## Disable, and process the file. ## - ## ------------------------------- ## - # The AC autoquoting macros are not loaded yet, hence invoking - # `_au_disable' would be wrong. - _au__include([unm4.m4]) - - # Disable special characters, and set the first line number. - _au_m4_changequote() - _au_m4_changecom() - - _au_m4_define(_au__first_line, _au___line__)_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, "> " . open_quote ("$tmp/input.m4") - or error "cannot open: $!"; - open FILE, "< " . open_quote ($file) - or error "cannot open: $!"; - print INPUT_M4 "$input_m4"; - while () - { - eval $au_changequote; - print INPUT_M4; - } - close FILE - or error "cannot close $file: $!"; - close INPUT_M4 - or error "cannot close $tmp/input.m4: $!"; - - # Now ask m4 to perform the update. - xsystem ("$m4 --include=" . shell_quote ($tmp) - . join (' --include=', '', map { shell_quote ($_) } reverse (@prepend_include)) - . join (' --include=', '', map { shell_quote ($_) } @include) - . " " . shell_quote ("$tmp/input.m4") . " > " . shell_quote ("$tmp/updated")); - update_file ("$tmp/updated", - "$file" eq "$tmp/stdin" ? '-' : "$file"); - } -exit 0; - - -# ## ---------------------------- ## -# ## How `autoupdate' functions. ## -# ## ---------------------------- ## -# -# The task of `autoupdate' is not trivial: the biggest difficulty being -# that you must limit the changes to the parts that really need to be -# updated. Finding a satisfying implementation proved to be quite hard, -# as this is the fifth implementation of `autoupdate'. -# -# Below, we will use a simple example of an obsolete macro: -# -# AU_DEFUN([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))]) -# AC_DEFUN([NEW], [echo "sum($1) = $2"]) -# -# the input file contains -# -# dnl The Unbelievable Truth -# OLD(1, 2) -# NEW([0, 0], [0]) -# -# Of course the expected output is -# -# dnl The Unbelievable Truth -# NEW([1, 2], [3]) -# NEW([0, 0], [0]) -# -# -# # First implementation: sed -# # ========================= -# -# The first implementation was only able to change the name of obsolete -# macros. -# -# The file `acoldnames.m4' defined the old names based on the new names. -# It was simple then to produce a sed script such as: -# -# s/OLD/NEW/g -# -# Updating merely consisted in running this script on the file to -# update. -# -# This scheme suffers from an obvious limitation: that `autoupdate' was -# unable to cope with new macros that just swap some of its arguments -# compared to the old macro. Fortunately, that was enough to upgrade -# from Autoconf 1 to Autoconf 2. (But I have no idea whether the -# changes in Autoconf 2 were precisely limited by this constraint.) -# -# -# # Second implementation: hooks -# # ============================ -# -# The version 2.15 of Autoconf brought a vast number of changes compared -# to 2.13, so a solution was needed. One could think of extending the -# `sed' scripts with specialized code for complex macros. However, this -# approach is of course full of flaws: -# -# a. the Autoconf maintainers have to write these snippets, which we -# just don't want to, -# -# b. I really don't think you'll ever manage to handle the quoting of -# m4 with a sed script. -# -# To satisfy a., let's remark that the code which implements the old -# features in term of the new feature is exactly the code which should -# replace the old code. -# -# To answer point b, as usual in the history of Autoconf, the answer, at -# least on the paper, is simple: m4 is the best tool to parse m4, so -# let's use m4. -# -# Therefore the specification is: -# -# I want to be able to tell Autoconf, well, m4, that the macro I -# am currently defining is an obsolete macro (so that the user is -# warned), and its code is the code to use when running autoconf, -# but that the very same code has to be used when running -# autoupdate. To summarize, the interface I want is -# `AU_DEFUN(OLD-NAME, NEW-CODE)'. -# -# -# Now for the technical details. -# -# When running autoconf, except for the warning, AU_DEFUN is basically -# AC_DEFUN. -# -# When running autoupdate, we want *only* OLD-NAMEs to be expanded. -# This obviously means that acgeneral.m4 and acspecific.m4 must not be -# loaded. Nonetheless, because we want to use a rich set of m4 -# features, m4sugar.m4 is needed. Please note that the fact that -# Autoconf's macros are not loaded is positive on two points: -# -# - we do get an updated `configure.ac', not a `configure'! -# -# - the old macros are replaced by *calls* to the new-macros, not the -# body of the new macros, since their body is not defined!!! -# (Whoa, that's really beautiful!). -# -# Additionally we need to disable the quotes when reading the input for -# two reasons: first because otherwise `m4' will swallow the quotes of -# other macros: -# -# NEW([1, 2], 3) -# => NEW(1, 2, 3) -# -# and second, because we want to update the macro calls which are -# quoted, i.e., we want -# -# FOO([OLD(1, 2)]) -# => FOO([NEW([1, 2], [3])]) -# -# If we don't disable the quotes, only the macros called at the top -# level would be updated. -# -# So, let's disable the quotes. -# -# Well, not quite: m4sugar.m4 still needs to use quotes for some macros. -# Well, in this case, when running in autoupdate code, each macro first -# reestablishes the quotes, expands itself, and disables the quotes. -# -# Thinking a bit more, you realize that in fact, people may use `define', -# `ifelse' etc. in their files, and you certainly don't want to process -# them. Another example is `dnl': you don't want to remove the -# comments. You then realize you don't want exactly to import m4sugar: -# you want to specify when it is enabled (macros active), and disabled. -# m4sugar provides m4_disable/m4_enable to this end. -# -# You're getting close to it. Now remains one task: how to handle -# twofold definitions? -# -# Remember that the same AU_DEFUN must be understood in two different -# ways, the AC way, and the AU way. -# -# One first solution is to check whether acgeneral.m4 was loaded. But -# that's definitely not cute. Another is simply to install `hooks', -# that is to say, to keep in some place m4 knows, late `define' to be -# triggered *only* in AU mode. -# -# You first think of designing AU_DEFUN like this: -# -# 1. AC_DEFUN(OLD-NAME, -# [Warn the user OLD-NAME is obsolete. -# NEW-CODE]) -# -# 2. Store for late AU binding([define(OLD_NAME, -# [Reestablish the quotes. -# NEW-CODE -# Disable the quotes.])]) -# -# but this will not work: NEW-CODE probably uses $1, $2 etc. and these -# guys will be replaced with the argument of `Store for late AU binding' -# when you call it. -# -# I don't think there is a means to avoid this using this technology -# (remember that $1 etc. are *always* expanded in m4). You may also try -# to replace them with $[1] to preserve them for a later evaluation, but -# if `Store for late AU binding' is properly written, it will remain -# quoted till the end... -# -# You have to change technology. Since the problem is that `$1' -# etc. should be `consumed' right away, one solution is to define now a -# second macro, `AU_OLD-NAME', and to install a hook than binds OLD-NAME -# to AU_OLD-NAME. Then, autoupdate.m4 just need to run the hooks. By -# the way, the same method was used in autoheader. -# -# -# # Third implementation: m4 namespaces by m4sugar -# # ============================================== -# -# Actually, this implementation was just a clean up of the previous -# implementation: instead of defining hooks by hand, m4sugar was equipped -# with `namespaces'. What are they? -# -# Sometimes we want to disable some *set* of macros, and restore them -# later. We provide support for this via namespaces. -# -# There are basically three characters playing this scene: defining a -# macro in a namespace, disabling a namespace, and restoring a namespace -# (i.e., all the definitions it holds). -# -# Technically, to define a MACRO in NAMESPACE means to define the macro -# named `NAMESPACE::MACRO' to the VALUE. At the same time, we append -# `undefine(NAME)' in the macro named `m4_disable(NAMESPACE)', and -# similarly a binding of NAME to the value of `NAMESPACE::MACRO' in -# `m4_enable(NAMESPACE)'. These mechanisms allow to bind the macro of -# NAMESPACE and to unbind them at will. -# -# Of course this implementation is really inefficient: m4 has to grow -# strings which can become quickly huge, which slows it significantly. -# -# In particular one should avoid as much as possible to use `define' for -# temporaries. Now that `define' has quite a complex meaning, it is an -# expensive operations that should be limited to macros. Use -# `m4_define' for temporaries. -# -# Private copies of the macros we used in entering / exiting the m4sugar -# namespace. It is much more convenient than fighting with the renamed -# version of define etc. -# -# -# -# Those two implementations suffered from serious problems: -# -# - namespaces were really expensive, and incurred a major performance -# loss on `autoconf' itself, not only `autoupdate'. One solution -# would have been the limit the use of namespaces to `autoupdate', but -# that's again some complications on m4sugar, which really doesn't need -# this. So we wanted to get rid of the namespaces. -# -# - since the quotes were disabled, autoupdate was sometimes making -# wrong guesses, for instance on: -# -# foo([1, 2]) -# -# m4 saw 2 arguments: `[1'and `2]'. A simple solution, somewhat -# fragile, is to reestablish the quotes right before all the obsolete -# macros, i.e., to use sed so that the previous text becomes -# -# changequote([, ])foo([1, 2]) -# -# To this end, one wants to trace the definition of obsolete macros. -# -# It was there that the limitations of the namespace approach became -# painful: because it was a complex machinery playing a lot with the -# builtins of m4 (hence, quite fragile), tracing was almost impossible. -# -# -# So this approach was dropped. -# -# -# # The fourth implementation: two steps -# # ==================================== -# -# If you drop the uses of namespaces, you no longer can compute the -# updated value, and replace the old call with it simultaneously. -# -# Obviously you will use m4 to compute the updated values, but you may -# use some other tool to achieve the replacement. Personally, I trust -# nobody but m4 to parse m4, so below, m4 will perform the two tasks. -# -# How can m4 be used to replace *some* macros calls with newer values. -# Well, that's dead simple: m4 should learn the definitions of obsolete -# macros, forget its builtins, disable the quotes, and then run on the -# input file, which amounts to doing this: -# -# divert(-1)dnl -# changequote([, ]) -# define([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))changequote()]) -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# which will result in -# -# dnl The Unbelievable Truth -# NEW(1, 2, m4_eval(1 + 2)) -# NEW([0, 0], -# 0) -# -# Grpmh. Two problems. A minor problem: it would have been much better -# to have the `m4_eval' computed, and a major problem: you lost the -# quotation in the result. -# -# Let's address the big problem first. One solution is to define any -# modern macro to rewrite its calls with the proper quotation, thanks to -# `$@'. Again, tracing the `define's makes it possible to know which -# are these macros, so you input is: -# -# divert(-1)dnl -# changequote([, ]) -# define([OLD], [NEW([$1, $2], m4_eval([$1 + $2]))changequote()]) -# define([NEW], [[NEW($@)]changequote()]) -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# changequote([, ])NEW([0, 0], -# 0) -# -# which results in -# -# dnl The Unbelievable Truth -# NEW([1, 2],[m4_eval(1 + 2)]) -# NEW([0, 0],[0]) -# -# Our problem is solved, i.e., the first call to `NEW' is properly -# quoted, but introduced another problem: we changed the layout of the -# second calls, which can be a drama in the case of huge macro calls -# (think of `AC_TRY_RUN' for instance). This example didn't show it, -# but we also introduced parens to macros which did not have some: -# -# AC_INIT -# => AC_INIT() -# -# No big deal for the semantics (unless the macro depends upon $#, which -# is bad), but the users would not be happy. -# -# Additionally, we introduced quotes that were not there before, which is -# OK in most cases, but could change the semantics of the file. -# -# Cruel dilemma: we do want the auto-quoting definition of `NEW' when -# evaluating `OLD', but we don't when we evaluate the second `NEW'. -# Back to namespaces? -# -# No. -# -# -# # Second step: replacement -# # ------------------------ -# -# No, as announced above, we will work in two steps: in a first step we -# compute the updated values, and in a second step we replace them. Our -# goal is something like this: -# -# divert(-1)dnl -# changequote([, ]) -# define([OLD], [NEW([1, 2], [3])changequote()]) -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# i.e., the new value of `OLD' is precomputed using the auto-quoting -# definition of `NEW' and the m4 builtins. We'll see how afterwards, -# let's finish with the replacement. -# -# Of course the solution above is wrong: if there were other calls to -# `OLD' with different values, we would smash them to the same value. -# But it is quite easy to generalize the scheme above: -# -# divert(-1)dnl -# changequote([, ]) -# define([OLD([1],[2])], [NEW([1, 2], [3])]) -# define([OLD], [defn([OLD($@)])changequote()]) -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# i.e., for each call to obsolete macros, we build an array `call => -# value', and use a macro to dispatch these values. This results in: -# -# dnl The Unbelievable Truth -# NEW([1, 2], [3]) -# NEW([0, 0], -# 0) -# -# In French, we say `Youpi !', which you might roughly translate as -# `Yippee!'. -# -# -# # First step: computation -# # ----------------------- -# -# Let's study the anatomy of the file, and name its sections: -# -# prologue -# divert(-1)dnl -# changequote([, ]) -# values -# define([OLD([1],[2])], [NEW([1, 2], [3])]) -# dispatcher -# define([OLD], [defn([OLD($@)])changequote()]) -# disabler -# undefine([dnl]) -# undefine([m4_eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# input -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# -# # Computing the `values' section -# # .............................. -# -# First we need to get the list of all the AU macro uses. To this end, -# first get the list of all the AU macros names by tracing `AU_DEFUN' in -# the initialization of autoconf. This list is computed in the file -# `au.txt' below. -# -# Then use this list to trace all the AU macro uses in the input. The -# goal is obtain in the case of our example: -# -# [define([OLD([1],[2])],]@<<@OLD([1],[2])@>>@[)] -# -# This is the file `values.in' below. -# -# We want to evaluate this with only the builtins (in fact m4sugar), the -# auto-quoting definitions of the new macros (`new.m4'), and the -# definition of the old macros (`old.m4'). Computing these last two -# files is easy: it's just a matter of using the right `--trace' option. -# -# So the content of `values.in' is: -# -# include($autoconf_dir/m4sugar.m4) -# m4_include(new.m4) -# m4_include(old.m4) -# divert(0)dnl -# [define([OLD([1],[2])],]@<<@OLD([1],[2])@>>@[)] -# -# We run m4 on it, which yields: -# -# define([OLD([1],[2])],@<<@NEW([1, 2], [3])@>>@) -# -# Transform `@<<@' and `@>>@' into quotes and we get -# -# define([OLD([1],[2])],[NEW([1, 2], [3])]) -# -# This is `values.m4'. -# -# -# # Computing the `dispatcher' section -# # .................................. -# -# The `prologue', and the `disabler' are simple and need no commenting. -# -# To compute the `dispatcher' (`dispatch.m4'), again, it is a simple -# matter of using the right `--trace'. -# -# Finally, the input is not exactly the input file, rather it is the -# input file with the added `changequote'. To this end, we build -# `quote.sed'. -# -# -# # Putting it all together -# # ....................... -# -# We build the file `input.m4' which contains: -# -# divert(-1)dnl -# changequote([, ]) -# include(values.m4) -# include(dispatch.m4) -# undefine([dnl]) -# undefine([eval]) -# # Some more undefines... -# changequote() -# divert(0)dnl -# dnl The Unbelievable Truth -# changequote([, ])OLD(1, 2) -# NEW([0, 0], -# 0) -# -# And we just run m4 on it. Et voila`, Monsieur ! Mais oui, mais oui. -# -# Well, there are a few additional technicalities. For instance, we -# rely on `changequote', `ifelse' and `defn', but we don't want to -# interpret the changequotes of the user, so we simply use another name: -# `_au_changequote' etc. -# -# -# # Failure of the fourth approach -# # ------------------------------ -# -# This approach is heavily based on traces, but then there is an obvious -# problem: non expanded code will never be seen. In particular, the body -# of a `define' definition is not seen, so on the input -# -# define([idem], [OLD(0, [$1])]) -# -# autoupdate would never see the `OLD', and wouldn't have updated it. -# Worse yet, if `idem(0)' was used later, then autoupdate sees that -# `OLD' is used, computes the result for `OLD(0, 0)' and sets up a -# dispatcher for `OLD'. Since there was no computed value for `OLD(0, -# [$1])', the dispatcher would have replaced with... nothing, leading -# to -# -# define([idem], []) -# -# With some more thinking, you see that the two step approach is wrong, -# the namespace approach was much saner. -# -# But you learned a lot, in particular you realized that using traces -# can make it possible to simulate namespaces! -# -# -# -# # The fifth implementation: m4 namespaces by files -# # ================================================ -# -# The fourth implementation demonstrated something unsurprising: you -# cannot precompute, i.e., the namespace approach was the right one. -# Still, we no longer want them, they're too expensive. Let's have a -# look at the way it worked. -# -# When updating -# -# dnl The Unbelievable Truth -# OLD(1, 2) -# NEW([0, 0], [0]) -# -# you evaluate `input.m4': -# -# divert(-1) -# changequote([, ]) -# define([OLD], -# [m4_enable()NEW([$1, $2], m4_eval([$1 + $2]))m4_disable()]) -# ... -# m4_disable() -# dnl The Unbelievable Truth -# OLD(1, 2) -# NEW([0, 0], [0]) -# -# where `m4_disable' undefines the m4 and m4sugar, and disables the quotes -# and comments: -# -# define([m4_disable], -# [undefine([__file__]) -# ... -# changecom(#) -# changequote()]) -# -# `m4_enable' does the converse: reestablish quotes and comments -# --easy--, reestablish m4sugar --easy: just load `m4sugar.m4' again-- and -# reenable the builtins. This later task requires that you first save -# the builtins. And BTW, the definition above of `m4_disable' cannot -# work: you undefined `changequote' before using it! So you need to use -# your privates copies of the builtins. Let's introduce three files for -# this: -# -# `m4save.m4' -# moves the m4 builtins into the `_au_' pseudo namespace, -# `unm4.m4' -# undefines the builtins, -# `m4.m4' -# restores them. -# -# So `input.m4' is: -# -# divert(-1) -# changequote([, ]) -# -# include([m4save.m4]) -# -# # Import AU. -# define([OLD], -# [m4_enable()NEW([$1, $2], m4_eval([$1 + $2]))m4_disable()]) -# -# define([_au_enable], -# [_au_changecom([#]) -# _au_include([m4.m4]) -# _au_include(m4sugar.m4)]) -# -# define([_au_disable], -# [# Disable m4sugar. -# # Disable the m4 builtins. -# _au_include([unm4.m4]) -# # 1. Disable special characters. -# _au_changequote() -# _au_changecom()]) -# -# m4_disable() -# dnl The Unbelievable Truth -# OLD(1, 2) -# NEW([0, 0], [0]) -# -# Based on what we learned in the fourth implementation we know that we -# have to enable the quotes *before* any AU macro, and we know we need -# to build autoquoting versions of the AC macros. But the autoquoting -# AC definitions must be disabled in the rest of the file, and enabled -# inside AU macros. -# -# Using `autoconf --trace' it is easy to build the files -# -# `ac.m4' -# define the autoquoting AC fake macros -# `disable.m4' -# undefine the m4sugar and AC autoquoting macros. -# `au.m4' -# definitions of the AU macros (such as `OLD' above). -# -# Now, `input.m4' is: -# -# divert(-1) -# changequote([, ]) -# -# include([m4save.m4]) -# # Import AU. -# include([au.m4]) -# -# define([_au_enable], -# [_au_changecom([#]) -# _au_include([m4.m4]) -# _au_include(m4sugar.m4) -# _au_include(ac.m4)]) -# -# define([_au_disable], -# [_au_include([disable.m4]) -# _au_include([unm4.m4]) -# # 1. Disable special characters. -# _au_changequote() -# _au_changecom()]) -# -# m4_disable() -# dnl The Unbelievable Truth -# _au_changequote([, ])OLD(1, 2) -# NEW([0, 0], [0]) -# -# Finally, version V is ready. -# -# Well... almost. -# -# There is a slight problem that remains: if an AU macro OUTER includes -# an AU macro INNER, then _au_enable will be run when entering OUTER -# and when entering INNER (not good, but not too bad yet). But when -# getting out of INNER, _au_disable will disable everything while we -# were still in OUTER. Badaboom. -# -# Therefore _au_enable and _au_disable have to be written to work by -# pairs: each _au_enable pushdef's _au_enabled, and each _au_disable -# popdef's _au_enabled. And of course _au_enable and _au_disable are -# effective when _au_enabled is *not* defined. -# -# Finally, version V' is ready. And there is much rejoicing. (And I -# have free time again. I think. Yeah, right.) - -### 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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/ifnames b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/ifnames deleted file mode 100755 index 69bffb2c8..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/ifnames +++ /dev/null @@ -1,153 +0,0 @@ -#! /usr/bin/perl -w -# -*- perl -*- -# Generated from ifnames.in; do not edit by hand. - -eval 'case $# in 0) exec /usr/bin/perl -S "$0";; *) exec /usr/bin/perl -S "$0" "$@";; esac' - if 0; - -# ifnames - print the identifiers used in C preprocessor conditionals - -# Copyright (C) 1994, 1995, 1999, 2000, 2001, 2002, 2003, 2005, 2006, -# 2007, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Reads from stdin if no files are given. -# Writes to stdout. - -# Written by David MacKenzie -# and Paul Eggert . - -BEGIN -{ - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '//share/autoconf'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell - # that can handle redirection and quote arguments correctly, - # e.g.: COMMAND.COM. For DJGPP always use the shell that configure - # has detected. - $ENV{'SHELL'} = '/bin/sh' if ($^O eq 'dos'); -} - -use Autom4te::General; -use Autom4te::XFile; -use Autom4te::FileUtils; - -# $HELP -# ----- -$help = "Usage: $0 [OPTION]... [FILE]... - -Scan all of the C source FILES (or the standard input, if none are -given) and write to the standard output a sorted list of all the -identifiers that appear in those files in `#if', `#elif', `#ifdef', or -`#ifndef' directives. Print each identifier on a line, followed by a -space-separated list of the files in which that identifier occurs. - - -h, --help print this help, then exit - -V, --version print version number, then exit - -Report bugs to . -GNU Autoconf home page: . -General help using GNU software: . -"; - - -# $VERSION -# -------- -$version = "ifnames (GNU Autoconf) 2.68 -Copyright (C) 2010 Free Software Foundation, Inc. -License GPLv3+/Autoconf: GNU GPL version 3 or later -, -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Written by David J. MacKenzie and Paul Eggert. -"; - - -# &parse_args () -# -------------- -# Process any command line arguments. -sub parse_args () -{ - getopt (); -} - - -# %OCCURRENCE -# ----------- -my %occurrence; - - -# &scan_file ($FILE-NAME) -# ----------------------- -sub scan_file ($) -{ - my ($file_name) = @_; - my $file = new Autom4te::XFile ("< " . open_quote ($file_name)); - while ($_ = $file->getline) - { - # Continuation lines. - $_ .= $file->getline - while (s/\\$//); - - # Preprocessor directives. - if (s/^\s*\#\s*(if|ifdef|ifndef|elif)\s+//) - { - # 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; - } - } - } -} - - -## ------ ## -## Main. ## -## ------ ## - -parse_args(); -foreach (@ARGV) - { - scan_file ($_); - } -foreach (sort keys %occurrence) - { - print "$_ ", join (' ', sort keys %{$occurrence{$_}}), "\n"; - } - -### 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/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/libtool b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/libtool deleted file mode 100755 index d1473ff98..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/libtool +++ /dev/null @@ -1,10988 +0,0 @@ -#! /bin/sh - -# libtool - Provide generalized library-building support services. -# Generated automatically by config.status (libtool) 2.4.2 -# Libtool was configured on host ubuntu-pradip: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="CXX F77 FC GO GCJ RC " - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=2.4.2 -macro_revision=1.3337 - -# Assembler program. -AS="as" - -# DLL creation program. -DLLTOOL="false" - -# Object dumper program. -OBJDUMP="objdump" - -# Whether or not to build shared libraries. -build_libtool_libs=yes - -# Whether or not to build static libraries. -build_old_libs=yes - -# What type of objects to build. -pic_mode=default - -# Whether or not to optimize for fast installation. -fast_install=yes - -# Shell to use when invoking shell scripts. -SHELL="/bin/sh" - -# An echo program that protects backslashes. -ECHO="printf %s\\n" - -# The PATH separator for the build system. -PATH_SEPARATOR=":" - -# The host system. -host_alias= -host=i686-pc-linux-gnu -host_os=linux-gnu - -# The build system. -build_alias= -build=i686-pc-linux-gnu -build_os=linux-gnu - -# A sed program that does not truncate output. -SED="/bin/sed" - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP="/bin/grep" - -# An ERE matcher. -EGREP="/bin/grep -E" - -# A literal string matcher. -FGREP="/bin/grep -F" - -# A BSD- or MS-compatible name lister. -NM="/usr/bin/nm -B" - -# Whether we need soft or hard links. -LN_S="ln -s" - -# What is the maximum length of a command? -max_cmd_len=1572864 - -# Object file suffix (normally "o"). -objext=o - -# Executable file suffix (normally ""). -exeext= - -# whether the shell understands "unset". -lt_unset=unset - -# turn spaces into newlines. -SP2NL="tr \\040 \\012" - -# turn newlines into spaces. -NL2SP="tr \\015\\012 \\040\\040" - -# convert $build file names to $host format. -to_host_file_cmd=func_convert_file_noop - -# convert $build files to toolchain format. -to_tool_file_cmd=func_convert_file_noop - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method="pass_all" - -# Command to use when deplibs_check_method = "file_magic". -file_magic_cmd="\$MAGIC_CMD" - -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob="" - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob="no" - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd="printf %s\\n" - -# The archiver. -AR="ar" - -# Flags to create an archive. -AR_FLAGS="cru" - -# How to feed a file listing to the archiver. -archiver_list_spec="@" - -# A symbol stripping program. -STRIP="strip" - -# Commands used to install an old-style archive. -RANLIB="ranlib" -old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib" -old_postuninstall_cmds="" - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=no - -# A C compiler. -LTCC="gcc" - -# LTCC compiler flags. -LTCFLAGS="-g -O2" - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'" - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'" - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'" - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\)[ ]*\$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'" - -# Specify filename containing input files for $NM. -nm_file_list_spec="@" - -# The root where to search for dependent libraries,and in which our libraries should be installed. -lt_sysroot= - -# The name of the directory that contains temporary libtool files. -objdir=.libs - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=file - -# Must we lock files when doing compilation? -need_locks="no" - -# Manifest tool. -MANIFEST_TOOL=":" - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL="" - -# Tool to change global to local symbols on Mac OS X. -NMEDIT="" - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO="" - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL="" - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64="" - -# Old archive suffix (normally "a"). -libext=a - -# Shared library suffix (normally ".so"). -shrext_cmds=".so" - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds="" - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" - -# Do we need the "lib" prefix for modules? -need_lib_prefix=no - -# Do we need a version for libraries? -need_version=no - -# Library versioning type. -version_type=linux - -# Shared library runtime path variable. -runpath_var=LD_RUN_PATH - -# Shared library path variable. -shlibpath_var=LD_LIBRARY_PATH - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=no - -# Format of library name prefix. -libname_spec="lib\$name" - -# 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="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}" - -# The coded name of the library, if different from the real name. -soname_spec="\${libname}\${release}\${shared_ext}\$major" - -# Permission mode override for installation of shared libraries. -install_override_mode="" - -# Command to use after installation of a shared archive. -postinstall_cmds="" - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds="" - -# Commands used to finish a libtool library installation in a directory. -finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir" - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval="" - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=yes - -# Compile-time system search path for libraries. -sys_lib_search_path_spec="/usr/lib/gcc/i686-linux-gnu/4.6 /usr/lib/i386-linux-gnu /usr/lib /lib/i386-linux-gnu /lib " - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/i386-linux-gnu/mesa-egl /usr/lib/i386-linux-gnu/mesa /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /usr/lib/vmware-tools/lib32/libvmGuestLib.so /usr/lib/vmware-tools/lib64/libvmGuestLib.so /usr/lib/vmware-tools/lib32/libvmGuestLibJava.so /usr/lib/vmware-tools/lib64/libvmGuestLibJava.so /usr/lib/vmware-tools/lib32/libDeployPkg.so /usr/lib/vmware-tools/lib64/libDeployPkg.so " - -# Whether dlopen is supported. -dlopen_support=yes - -# Whether dlopen of programs is supported. -dlopen_self=yes - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=no - -# Commands to strip libraries. -old_striplib="strip --strip-debug" -striplib="strip --strip-unneeded" - - -# The linker used to build libraries. -LD="/usr/bin/ld" - -# How to create reloadable object files. -reload_flag=" -r" -reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" - -# Commands used to build an old-style archive. -old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" - -# A language specific compiler. -CC="gcc" - -# Is the compiler the GNU compiler? -with_gcc=yes - -# Compiler flag to turn off builtin functions. -no_builtin_flag=" -fno-builtin" - -# Additional compiler flags for building library objects. -pic_flag=" -fPIC -DPIC" - -# How to pass a linker flag through the compiler. -wl="-Wl," - -# Compiler flag to prevent dynamic linking. -link_static_flag="-static" - -# Does compiler simultaneously support -c and -o options? -compiler_c_o="yes" - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=no - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=no - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec="\${wl}--export-dynamic" - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object="no" - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds="" - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds="" - -# Commands used to build a shared archive. -archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" -archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~ - cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~ - echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~ - \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-version-script \${wl}\$output_objdir/\$libname.ver -o \$lib" - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds="" -module_expsym_cmds="" - -# Whether we are building with GNU ld or not. -with_gnu_ld="yes" - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag="" - -# Flag that enforces no undefined symbols. -no_undefined_flag="" - -# Flag to hardcode $libdir into a binary during linking. -# This must work even if $libdir does not exist -hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir" - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator="" - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=no - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting ${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=no - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=no - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=unsupported - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=no - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=no - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=unknown - -# Set to "yes" if exported symbols are required. -always_export_symbols=no - -# The commands to list exported symbols. -export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" - -# Symbols that must always be exported. -include_expsyms="" - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds="" - -# Commands necessary for finishing linking programs. -postlink_cmds="" - -# Specify filename containing input files. -file_list_spec="" - -# How to hardcode a shared library path into an executable. -hardcode_action=immediate - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs="" - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects="" -postdep_objects="" -predeps="" -postdeps="" - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path="" - -# ### END LIBTOOL CONFIG - - -# libtool (GNU libtool) 2.4.2 -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010, 2011 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. - -# GNU Libtool 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. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --no-warn don't display warning messages -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . - -PROGRAM=libtool -PACKAGE=libtool -VERSION=2.4.2 -TIMESTAMP="" -package_revision=1.3337 - -# 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+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL - -$lt_unset CDPATH - - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac -} # Extended-shell func_dirname implementation - - -# func_basename file -func_basename () -{ - func_basename_result="${1##*/}" -} # Extended-shell func_basename implementation - - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}" -} # Extended-shell func_dirname_and_basename implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"} -} # Extended-shell func_stripname implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=${PATH_SEPARATOR-:} - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $opt_debug - - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $opt_debug - - func_error "missing argument for $1." - exit_cmd=exit -} - - -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"} -} # Extended-shell func_split_short_opt implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - func_split_long_opt_name=${1%%=*} - func_split_long_opt_arg=${1#*=} -} # Extended-shell func_split_long_opt implementation - -exit_cmd=: - - - - - -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" - -# Global variables. -nonopt= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "${1}+=\${2}" -} # Extended-shell func_append implementation - -# func_append_quoted var value -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -func_append_quoted () -{ - func_quote_for_eval "${2}" - eval "${1}+=\\ \$func_quote_for_eval_result" -} # Extended-shell func_append_quoted implementation - - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=$(( $* )) -} # Extended-shell func_arith implementation - - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=${#1} -} # Extended-shell func_len implementation - - -# func_lo2o object -func_lo2o () -{ - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac -} # Extended-shell func_lo2o implementation - - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=${1%.*}.lo -} # Extended-shell func_xform implementation - - -# func_fatal_configuration arg... -# Echo program name prefixed message to standard error, followed by -# a configuration failure hint, and exit. -func_fatal_configuration () -{ - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." -} - - -# func_config -# Display the configuration for all the tags in this script. -func_config () -{ - re_begincf='^# ### BEGIN LIBTOOL' - re_endcf='^# ### END LIBTOOL' - - # Default configuration. - $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" - - # Now print the configurations for the tags. - for tagname in $taglist; do - $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" - done - - exit $? -} - -# func_features -# Display the features supported by this script. -func_features () -{ - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - - exit $? -} - -# func_enable_tag tagname -# Verify that TAGNAME is valid, and either flag an error and exit, or -# enable the TAGNAME tag. We also add TAGNAME to the global $taglist -# variable here. -func_enable_tag () -{ - # Global variable: - tagname="$1" - - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac - - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; - *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac - - - -# Option defaults: -opt_debug=: -opt_dry_run=false -opt_config=false -opt_preserve_dup_deps=false -opt_features=false -opt_finish=false -opt_help=false -opt_help_all=false -opt_silent=: -opt_warning=: -opt_verbose=: -opt_silent=false -opt_verbose=false - - -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - --config) - opt_config=: -func_config - ;; - --dlopen|-dlopen) - optarg="$1" - opt_dlopen="${opt_dlopen+$opt_dlopen -}$optarg" - shift - ;; - --preserve-dup-deps) - opt_preserve_dup_deps=: - ;; - --features) - opt_features=: -func_features - ;; - --finish) - opt_finish=: -set dummy --mode finish ${1+"$@"}; shift - ;; - --help) - opt_help=: - ;; - --help-all) - opt_help_all=: -opt_help=': help-all' - ;; - --mode) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_mode="$optarg" -case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; -esac - shift - ;; - --no-silent|--no-quiet) - opt_silent=false -preserve_args+=" $opt" - ;; - --no-warning|--no-warn) - opt_warning=false -preserve_args+=" $opt" - ;; - --no-verbose) - opt_verbose=false -preserve_args+=" $opt" - ;; - --silent|--quiet) - opt_silent=: -preserve_args+=" $opt" - opt_verbose=false - ;; - --verbose|-v) - opt_verbose=: -preserve_args+=" $opt" -opt_silent=false - ;; - --tag) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_tag="$optarg" -preserve_args+=" $opt $optarg" -func_enable_tag "$optarg" - shift - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-n*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - - # Validate options: - - # save first non-option argument - if test "$#" -gt 0; then - nonopt="$opt" - shift - fi - - # preserve --debug - test "$opt_debug" = : || preserve_args+=" --debug" - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps - ;; - esac - - $opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test "$opt_mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$opt_mode' for more information." - } - - - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} - - - - -## ----------- ## -## Main. ## -## ----------- ## - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_resolve_sysroot PATH -# Replace a leading = in PATH with a sysroot. Store the result into -# func_resolve_sysroot_result -func_resolve_sysroot () -{ - func_resolve_sysroot_result=$1 - case $func_resolve_sysroot_result in - =*) - func_stripname '=' '' "$func_resolve_sysroot_result" - func_resolve_sysroot_result=$lt_sysroot$func_stripname_result - ;; - esac -} - -# func_replace_sysroot PATH -# If PATH begins with the sysroot, replace it with = and -# store the result into func_replace_sysroot_result. -func_replace_sysroot () -{ - case "$lt_sysroot:$1" in - ?*:"$lt_sysroot"*) - func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result="=$func_stripname_result" - ;; - *) - # Including no sysroot. - func_replace_sysroot_result=$1 - ;; - esac -} - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T </dev/null` - if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then - func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$lt_sed_naive_backslashify"` - else - func_convert_core_file_wine_to_w32_result= - fi - fi -} -# end: func_convert_core_file_wine_to_w32 - - -# func_convert_core_path_wine_to_w32 ARG -# Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. -# -# ARG is path to be converted from $build format to win32. -# Result is available in $func_convert_core_path_wine_to_w32_result. -# Unconvertible file (directory) names in ARG are skipped; if no directory names -# are convertible, then the result may be empty. -func_convert_core_path_wine_to_w32 () -{ - $opt_debug - # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result="" - if test -n "$1"; then - oldIFS=$IFS - IFS=: - for func_convert_core_path_wine_to_w32_f in $1; do - IFS=$oldIFS - func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result" ; then - if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" - else - func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" - fi - fi - done - IFS=$oldIFS - fi -} -# end: func_convert_core_path_wine_to_w32 - - -# func_cygpath ARGS... -# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when -# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) -# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or -# (2), returns the Cygwin file name or path in func_cygpath_result (input -# file name or path is assumed to be in w32 format, as previously converted -# from $build's *nix or MSYS format). In case (3), returns the w32 file name -# or path in func_cygpath_result (input file name or path is assumed to be in -# Cygwin format). Returns an empty string on error. -# -# ARGS are passed to cygpath, with the last one being the file name or path to -# be converted. -# -# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH -# environment variable; do not put it in $PATH. -func_cygpath () -{ - $opt_debug - if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then - func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` - if test "$?" -ne 0; then - # on failure, ensure result is empty - func_cygpath_result= - fi - else - func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" - fi -} -#end: func_cygpath - - -# func_convert_core_msys_to_w32 ARG -# Convert file name or path ARG from MSYS format to w32 format. Return -# result in func_convert_core_msys_to_w32_result. -func_convert_core_msys_to_w32 () -{ - $opt_debug - # awkward: cmd appends spaces to result - func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` -} -#end: func_convert_core_msys_to_w32 - - -# func_convert_file_check ARG1 ARG2 -# Verify that ARG1 (a file name in $build format) was converted to $host -# format in ARG2. Otherwise, emit an error message, but continue (resetting -# func_to_host_file_result to ARG1). -func_convert_file_check () -{ - $opt_debug - if test -z "$2" && test -n "$1" ; then - func_error "Could not determine host file name corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_file_result="$1" - fi -} -# end func_convert_file_check - - -# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH -# Verify that FROM_PATH (a path in $build format) was converted to $host -# format in TO_PATH. Otherwise, emit an error message, but continue, resetting -# func_to_host_file_result to a simplistic fallback value (see below). -func_convert_path_check () -{ - $opt_debug - if test -z "$4" && test -n "$3"; then - func_error "Could not determine the host path corresponding to" - func_error " \`$3'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This is a deliberately simplistic "conversion" and - # should not be "improved". See libtool.info. - if test "x$1" != "x$2"; then - lt_replace_pathsep_chars="s|$1|$2|g" - func_to_host_path_result=`echo "$3" | - $SED -e "$lt_replace_pathsep_chars"` - else - func_to_host_path_result="$3" - fi - fi -} -# end func_convert_path_check - - -# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG -# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT -# and appending REPL if ORIG matches BACKPAT. -func_convert_path_front_back_pathsep () -{ - $opt_debug - case $4 in - $1 ) func_to_host_path_result="$3$func_to_host_path_result" - ;; - esac - case $4 in - $2 ) func_to_host_path_result+="$3" - ;; - esac -} -# end func_convert_path_front_back_pathsep - - -################################################## -# $build to $host FILE NAME CONVERSION FUNCTIONS # -################################################## -# invoked via `$to_host_file_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# Result will be available in $func_to_host_file_result. - - -# func_to_host_file ARG -# Converts the file name ARG from $build format to $host format. Return result -# in func_to_host_file_result. -func_to_host_file () -{ - $opt_debug - $to_host_file_cmd "$1" -} -# end func_to_host_file - - -# func_to_tool_file ARG LAZY -# converts the file name ARG from $build format to toolchain format. Return -# result in func_to_tool_file_result. If the conversion in use is listed -# in (the comma separated) LAZY, no conversion takes place. -func_to_tool_file () -{ - $opt_debug - case ,$2, in - *,"$to_tool_file_cmd",*) - func_to_tool_file_result=$1 - ;; - *) - $to_tool_file_cmd "$1" - func_to_tool_file_result=$func_to_host_file_result - ;; - esac -} -# end func_to_tool_file - - -# func_convert_file_noop ARG -# Copy ARG to func_to_host_file_result. -func_convert_file_noop () -{ - func_to_host_file_result="$1" -} -# end func_convert_file_noop - - -# func_convert_file_msys_to_w32 ARG -# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_file_result. -func_convert_file_msys_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_to_host_file_result="$func_convert_core_msys_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_w32 - - -# func_convert_file_cygwin_to_w32 ARG -# Convert file name ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_file_cygwin_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # because $build is cygwin, we call "the" cygpath in $PATH; no need to use - # LT_CYGPATH in this case. - func_to_host_file_result=`cygpath -m "$1"` - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_cygwin_to_w32 - - -# func_convert_file_nix_to_w32 ARG -# Convert file name ARG from *nix to w32 format. Requires a wine environment -# and a working winepath. Returns result in func_to_host_file_result. -func_convert_file_nix_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_w32 - - -# func_convert_file_msys_to_cygwin ARG -# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_file_msys_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_cygwin - - -# func_convert_file_nix_to_cygwin ARG -# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed -# in a wine environment, working winepath, and LT_CYGPATH set. Returns result -# in func_to_host_file_result. -func_convert_file_nix_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. - func_convert_core_file_wine_to_w32 "$1" - func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_cygwin - - -############################################# -# $build to $host PATH CONVERSION FUNCTIONS # -############################################# -# invoked via `$to_host_path_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# The result will be available in $func_to_host_path_result. -# -# Path separators are also converted from $build format to $host format. If -# ARG begins or ends with a path separator character, it is preserved (but -# converted to $host format) on output. -# -# All path conversion functions are named using the following convention: -# file name conversion function : func_convert_file_X_to_Y () -# path conversion function : func_convert_path_X_to_Y () -# where, for any given $build/$host combination the 'X_to_Y' value is the -# same. If conversion functions are added for new $build/$host combinations, -# the two new functions must follow this pattern, or func_init_to_host_path_cmd -# will break. - - -# func_init_to_host_path_cmd -# Ensures that function "pointer" variable $to_host_path_cmd is set to the -# appropriate value, based on the value of $to_host_file_cmd. -to_host_path_cmd= -func_init_to_host_path_cmd () -{ - $opt_debug - if test -z "$to_host_path_cmd"; then - func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd="func_convert_path_${func_stripname_result}" - fi -} - - -# func_to_host_path ARG -# Converts the path ARG from $build format to $host format. Return result -# in func_to_host_path_result. -func_to_host_path () -{ - $opt_debug - func_init_to_host_path_cmd - $to_host_path_cmd "$1" -} -# end func_to_host_path - - -# func_convert_path_noop ARG -# Copy ARG to func_to_host_path_result. -func_convert_path_noop () -{ - func_to_host_path_result="$1" -} -# end func_convert_path_noop - - -# func_convert_path_msys_to_w32 ARG -# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_path_result. -func_convert_path_msys_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from ARG. MSYS - # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; - # and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_msys_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_msys_to_w32 - - -# func_convert_path_cygwin_to_w32 ARG -# Convert path ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_path_cygwin_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_cygwin_to_w32 - - -# func_convert_path_nix_to_w32 ARG -# Convert path ARG from *nix to w32 format. Requires a wine environment and -# a working winepath. Returns result in func_to_host_file_result. -func_convert_path_nix_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_nix_to_w32 - - -# func_convert_path_msys_to_cygwin ARG -# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_path_msys_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_msys_to_cygwin - - -# func_convert_path_nix_to_cygwin ARG -# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a -# a wine environment, working winepath, and LT_CYGPATH set. Returns result in -# func_to_host_file_result. -func_convert_path_nix_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_nix_to_cygwin - - -# func_mode_compile arg... -func_mode_compile () -{ - $opt_debug - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - pie_flag= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - test -n "$libobj" && \ - func_fatal_error "you cannot specify \`-o' more than once" - arg_mode=target - continue - ;; - - -pie | -fpie | -fPIE) - pie_flag+=" $arg" - continue - ;; - - -shared | -static | -prefer-pic | -prefer-non-pic) - later+=" $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - func_append_quoted lastarg "$arg" - done - IFS="$save_ifs" - func_stripname ' ' '' "$lastarg" - lastarg=$func_stripname_result - - # Add the arguments to base_compile. - base_compile+=" $lastarg" - continue - ;; - - *) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - func_append_quoted base_compile "$lastarg" - done # for arg - - case $arg_mode in - arg) - func_fatal_error "you must specify an argument for -Xcompile" - ;; - target) - func_fatal_error "you must specify a target with \`-o'" - ;; - *) - # Get the name of the library object. - test -z "$libobj" && { - func_basename "$srcfile" - libobj="$func_basename_result" - } - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - case $libobj in - *.[cCFSifmso] | \ - *.ada | *.adb | *.ads | *.asm | \ - *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) - func_xform "$libobj" - libobj=$func_xform_result - ;; - esac - - case $libobj in - *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; - *) - func_fatal_error "cannot determine name of library object from \`$libobj'" - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - continue - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - func_quote_for_eval "$libobj" - test "X$libobj" != "X$func_quote_for_eval_result" \ - && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - removelist+=" $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - removelist+=" $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 - srcfile=$func_to_tool_file_result - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - command+=" -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - command+=" -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - command+="$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { - test "$opt_mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $opt_mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to build PIC objects only - -prefer-non-pic try to build non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$opt_mode'" - ;; - esac - - echo - $ECHO "Try \`$progname --help' for more information about other modes." -} - -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $opt_dlopen; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - dir+="/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -* | *.la | *.lo ) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_append_quoted args "$file" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libs= - libdirs= - admincmds= - - for opt in "$nonopt" ${1+"$@"} - do - if test -d "$opt"; then - libdirs+=" $opt" - - elif test -f "$opt"; then - if func_lalib_unsafe_p "$opt"; then - libs+=" $opt" - else - func_warning "\`$opt' is not a valid libtool archive" - fi - - else - func_fatal_error "invalid argument \`$opt'" - fi - done - - if test -n "$libs"; then - if test -n "$lt_sysroot"; then - sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` - sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" - else - sysroot_cmd= - fi - - # Remove sysroot references - if $opt_dry_run; then - for lib in $libs; do - echo "removing references to $lt_sysroot and \`=' prefixes from $lib" - done - else - tmpdir=`func_mktempdir` - for lib in $libs; do - sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ - > $tmpdir/tmp-la - mv -f $tmpdir/tmp-la $lib - done - ${RM}r "$tmpdir" - fi - fi - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || admincmds+=" - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - - echo "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" - fi - exit $EXIT_SUCCESS -} - -test "$opt_mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - install_prog+="$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - no_mode=: - for arg - do - arg2= - if test -n "$dest"; then - files+=" $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - if $install_cp; then :; else - prev=$arg - fi - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - install_prog+=" $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - install_shared_prog+=" $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - install_shared_prog+=" -m $func_quote_for_eval_result" - fi - fi - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs+=" $file" - ;; - - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs+=" $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs+=" $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - dir+="$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs+=" $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 - tool_oldlib=$func_to_tool_file_result - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $tool_oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" - $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - case $host in - *cygwin* | *mingw* | *cegcc* ) - # if an import library, we need to obtain dlname - if func_win32_import_lib_p "$dlprefile"; then - func_tr_sh "$dlprefile" - eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename="" - if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then - # Use subshell, to avoid clobbering current variable values - dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname" ; then - func_basename "$dlprefile_dlname" - dlprefile_dlbasename="$func_basename_result" - else - # no lafile. user explicitly requested -dlpreopen . - $sharedlib_from_linklib_cmd "$dlprefile" - dlprefile_dlbasename=$sharedlib_from_linklib_result - fi - fi - $opt_dry_run || { - if test -n "$dlprefile_dlbasename" ; then - eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' - else - func_warning "Could not compute DLL name from $name" - eval '$ECHO ": $name " >> "$nlist"' - fi - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | - $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" - } - else # not an import lib - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - fi - ;; - *) - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - ;; - esac - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - echo >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -extern LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - echo >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) symtab_cflags+=" $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -# Despite the name, also deal with 64 bit binaries. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - -# func_cygming_dll_for_implib ARG -# -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib () -{ - $opt_debug - sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` -} - -# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs -# -# The is the core of a fallback implementation of a -# platform-specific function to extract the name of the -# DLL associated with the specified import library LIBNAME. -# -# SECTION_NAME is either .idata$6 or .idata$7, depending -# on the platform and compiler that created the implib. -# -# Echos the name of the DLL associated with the -# specified import library. -func_cygming_dll_for_implib_fallback_core () -{ - $opt_debug - match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` - $OBJDUMP -s --section "$1" "$2" 2>/dev/null | - $SED '/^Contents of section '"$match_literal"':/{ - # Place marker at beginning of archive member dllname section - s/.*/====MARK====/ - p - d - } - # These lines can sometimes be longer than 43 characters, but - # are always uninteresting - /:[ ]*file format pe[i]\{,1\}-/d - /^In archive [^:]*:/d - # Ensure marker is printed - /^====MARK====/p - # Remove all lines with less than 43 characters - /^.\{43\}/!d - # From remaining lines, remove first 43 characters - s/^.\{43\}//' | - $SED -n ' - # Join marker and all lines until next marker into a single line - /^====MARK====/ b para - H - $ b para - b - :para - x - s/\n//g - # Remove the marker - s/^====MARK====// - # Remove trailing dots and whitespace - s/[\. \t]*$// - # Print - /./p' | - # we now have a list, one entry per line, of the stringified - # contents of the appropriate section of all members of the - # archive which possess that section. Heuristic: eliminate - # all those which have a first or second character that is - # a '.' (that is, objdump's representation of an unprintable - # character.) This should work for all archives with less than - # 0x302f exports -- but will fail for DLLs whose name actually - # begins with a literal '.' or a single character followed by - # a '.'. - # - # Of those that remain, print the first one. - $SED -e '/^\./d;/^.\./d;q' -} - -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - -# func_cygming_dll_for_implib_fallback ARG -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# -# This fallback implementation is for use when $DLLTOOL -# does not support the --identify-strict option. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib_fallback () -{ - $opt_debug - if func_cygming_gnu_implib_p "$1" ; then - # binutils import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1" ; then - # ms-generated import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` - else - # unknown - sharedlib_from_linklib_result="" - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=${1-no} - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='$sed_quote_subst' - -# 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+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's $0 value, followed by "$@". -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=\$0 - shift - for lt_opt - do - case \"\$lt_opt\" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` - test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. - lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` - cat \"\$lt_dump_D/\$lt_dump_F\" - exit 0 - ;; - --lt-*) - \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" - lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from \$@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - case \" \$* \" in - *\\ --lt-*) - for lt_wr_arg - do - case \$lt_wr_arg in - --lt-*) ;; - *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; - esac - shift - done ;; - esac - func_exec_program_core \${1+\"\$@\"} -} - - # Parse options - func_parse_lt_options \"\$0\" \${1+\"\$@\"} - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # fixup the dll searchpath if we need to. - # - # Fix the DLL searchpath if we need to. Do this before prepending - # to shlibpath, because on Windows, both are PATH and uninstalled - # libraries must come first. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` - - export $shlibpath_var -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - func_exec_program \${1+\"\$@\"} - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} - - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -#else -# include -# include -# ifdef __CYGWIN__ -# include -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -/* path handling portability macros */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#if defined(LT_DEBUGWRAPPER) -static int lt_debug = 1; -#else -static int lt_debug = 0; -#endif - -const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_debugprintf (const char *file, int line, const char *fmt, ...); -void lt_fatal (const char *file, int line, const char *message, ...); -static const char *nonnull (const char *s); -static const char *nonempty (const char *s); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); -EOF - - cat <= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", - nonempty (path)); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", - nonempty (wrapper)); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - lt_debugprintf (__FILE__, __LINE__, - "checking path component for symlinks: %s\n", - tmp_pathspec); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - lt_fatal (__FILE__, __LINE__, - "error accessing file \"%s\": %s", - tmp_pathspec, nonnull (strerror (errno))); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal (__FILE__, __LINE__, - "could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -void -lt_debugprintf (const char *file, int line, const char *fmt, ...) -{ - va_list args; - if (lt_debug) - { - (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); - } -} - -static void -lt_error_core (int exit_status, const char *file, - int line, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *file, int line, const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); - va_end (ap); -} - -static const char * -nonnull (const char *s) -{ - return s ? s : "(null)"; -} - -static const char * -nonempty (const char *s) -{ - return (s && !*s) ? "(empty)" : nonnull (s); -} - -void -lt_setenv (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_setenv) setting '%s' to '%s'\n", - nonnull (name), nonnull (value)); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -n -e ' -s/^\(.\{79\}\)\(..*\)/\1\ -\2/ -h -s/\([\\"]\)/\\\1/g -s/$/\\n/ -s/\([^\n]*\).*/ fputs ("\1", f);/p -g -D' - cat <<"EOF" -} -EOF -} -# end: func_emit_cwrapperexe_src - -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - bindir= - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - libtool_args+=" $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command+=" @OUTPUT@" - finalize_command+=" @OUTPUT@" - ;; - esac - - case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command+=" @SYMFILE@" - finalize_command+=" @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles+=" $arg" - else - dlprefiles+=" $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) deplibs+=" $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# moreargs+=" $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles+=" $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles+=" $pic_object" - prev= - fi - - # A PIC object. - libobjs+=" $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects+=" $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - non_pic_objects+=" $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - libobjs+=" $pic_object" - non_pic_objects+=" $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath+=" $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath+=" $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - weak_libs+=" $arg" - prev= - continue - ;; - xcclinker) - linker_flags+=" $qarg" - compiler_flags+=" $qarg" - prev= - compile_command+=" $qarg" - finalize_command+=" $qarg" - continue - ;; - xcompiler) - compiler_flags+=" $qarg" - prev= - compile_command+=" $qarg" - finalize_command+=" $qarg" - continue - ;; - xlinker) - linker_flags+=" $qarg" - compiler_flags+=" $wl$qarg" - prev= - compile_command+=" $wl$qarg" - finalize_command+=" $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - compile_command+=" $link_static_flag" - finalize_command+=" $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -bindir) - prev=bindir - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - compile_command+=" $arg" - finalize_command+=" $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname "-L" '' "$arg" - if test -z "$func_stripname_result"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "* | *" $arg "*) - # Will only happen for absolute or sysroot arguments - ;; - *) - # Preserve sysroot, but never include relative directories - case $dir in - [\\/]* | [A-Za-z]:[\\/]* | =*) deplibs+=" $arg" ;; - *) deplibs+=" -L$dir" ;; - esac - lib_search_path+=" $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) dllsearchpath+=":$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath+=":$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - deplibs+=" System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - deplibs+=" $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot|--sysroot) - compiler_flags+=" $arg" - compile_command+=" $arg" - finalize_command+=" $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - compiler_flags+=" $arg" - compile_command+=" $arg" - finalize_command+=" $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) new_inherited_linker_flags+=" $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - =*) - func_stripname '=' '' "$dir" - dir=$lt_sysroot$func_stripname_result - ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath+=" $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg+=" $func_quote_for_eval_result" - compiler_flags+=" $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - arg+=" $wl$func_quote_for_eval_result" - compiler_flags+=" $wl$func_quote_for_eval_result" - linker_flags+=" $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # Flags to be passed through unchanged, with rationale: - # -64, -mips[0-9] enable 64-bit mode for the SGI compiler - # -r[0-9][0-9]* specify processor for the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler - # +DA*, +DD* enable 64-bit mode for the HP compiler - # -q* compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* architecture-specific flags for GCC - # -F/path path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - # --sysroot=* for sysroot support - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-flto*|-fwhopr*|-fuse-linker-plugin) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - compile_command+=" $arg" - finalize_command+=" $arg" - compiler_flags+=" $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - objs+=" $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - dlfiles+=" $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - dlprefiles+=" $pic_object" - prev= - fi - - # A PIC object. - libobjs+=" $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - non_pic_objects+=" $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - non_pic_objects+=" $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - libobjs+=" $pic_object" - non_pic_objects+=" $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - deplibs+=" $arg" - old_deplibs+=" $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - func_resolve_sysroot "$arg" - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles+=" $func_resolve_sysroot_result" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles+=" $func_resolve_sysroot_result" - prev= - else - deplibs+=" $func_resolve_sysroot_result" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command+=" $arg" - finalize_command+=" $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command+=" $arg" - finalize_command+=" $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - func_to_tool_file "$output_objdir/" - tool_output_objdir=$func_to_tool_file_result - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_preserve_dup_deps ; then - case "$libs " in - *" $deplib "*) specialdeplibs+=" $deplib" ;; - esac - fi - libs+=" $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) specialdeplibs+=" $pre_post_deps" ;; - esac - pre_post_deps+=" $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - func_resolve_sysroot "$lib" - case $lib in - *.la) func_source "$func_resolve_sysroot_result" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result - case " $weak_libs " in - *" $deplib_base "*) ;; - *) deplibs+=" $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ - |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags+=" $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags+=" $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) new_inherited_linker_flags+=" $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - newlib_search_path+=" $func_resolve_sysroot_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - newlib_search_path+=" $func_resolve_sysroot_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath+=" $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) - func_resolve_sysroot "$deplib" - lib=$func_resolve_sysroot_result - ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - echo - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles+=" $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles+=" $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) new_inherited_linker_flags+=" $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles+=" $dlopen" - test -n "$dlpreopen" && dlprefiles+=" $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - convenience+=" $ladir/$objdir/$old_library" - old_convenience+=" $ladir/$objdir/$old_library" - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs+=" $deplib" ;; - esac - fi - tmp_libs+=" $deplib" - done - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - if test -n "$old_library" && - { test "$prefer_static_libs" = yes || - test "$prefer_static_libs,$installed" = "built,no"; }; then - linklib=$old_library - else - for l in $old_library $library_names; do - linklib="$l" - done - fi - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles+=" $lib $dependency_libs" - else - newdlfiles+=" $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$lt_sysroot$libdir" - absdir="$lt_sysroot$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - notinst_path+=" $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - notinst_path+=" $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - case "$host" in - # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) - # Linker will automatically link against shared library if both - # static and shared are present. Therefore, ensure we extract - # symbols from the import library if a shared library is present - # (otherwise, the dlopen module name will be incorrect). We do - # this by putting the import library name into $newdlprefiles. - # We recover the dlopen module name by 'saving' the la file - # name in a special purpose variable, and (later) extracting the - # dlname from the la file. - if test -n "$dlname"; then - func_tr_sh "$dir/$linklib" - eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" - newdlprefiles+=" $dir/$linklib" - else - newdlprefiles+=" $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs+=" $dir/$old_library" - fi - ;; - * ) - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles+=" $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - dlpreconveniencelibs+=" $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles+=" $dir/$dlname" - else - newdlprefiles+=" $dir/$linklib" - fi - ;; - esac - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path+=" $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - newlib_search_path+=" $func_resolve_sysroot_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs+=" $deplib" ;; - esac - fi - tmp_libs+=" $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) temp_rpath+="$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath+=" $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath+=" $libdir" ;; - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - notinst_deplibs+=" $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - notinst_deplibs+=" $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath+=" $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath+=" $libdir" ;; - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$opt_mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$absdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir+=" -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath+="$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath+="$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$opt_mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath+="$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir+=" -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath+=" $temp_xrpath";; - esac;; - *) temp_deplibs+=" $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path+=" $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result";; - *) func_resolve_sysroot "$deplib" ;; - esac - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $func_resolve_sysroot_result "*) - specialdeplibs+=" $func_resolve_sysroot_result" ;; - esac - fi - tmp_libs+=" $func_resolve_sysroot_result" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_resolve_sysroot "$deplib" - deplib=$func_resolve_sysroot_result - func_dirname "$deplib" "" "." - dir=$func_dirname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - compiler_flags+=" ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - linker_flags+=" -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path+=" $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs+=" $deplib" ;; - esac - ;; - *) tmp_libs+=" $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs+=" $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs+="$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - libobjs+=" $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - # correct linux to gnu/linux during the next big refactor - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) # correct to gnu/linux during the next big refactor - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring+=":${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - libobjs+=" $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$opt_mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - removelist+=" $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs+=" $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - func_replace_sysroot "$libdir" - temp_xrpath+=" -R$func_replace_sysroot_result" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath+=" $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles+=" $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles+=" $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs+=" System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - deplibs+=" -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - $nocaseglob - else - potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` - fi - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs+=" $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs+=" $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - newdeplibs+=" $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - newdeplibs+=" $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - newdeplibs+=" $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` - done - fi - case $tmp_deplibs in - *[!\ \ ]*) - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - ;; - esac - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - new_libs+=" -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs+=" $deplib" ;; - esac - ;; - *) new_libs+=" $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - # Remove ${wl} instances when linking with ld. - # FIXME: should test the right _cmds variable. - case $archive_cmds in - *\$LD\ *) wl= ;; - esac - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$opt_mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs+="$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath+=" $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath+=" $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath+="$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - linknames+=" $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - delfiles+=" $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd1 in $cmds; do - IFS="$save_ifs" - # Take the normal branch if the nm_file_list_spec branch - # doesn't work or if tool conversion is not needed. - case $nm_file_list_spec~$to_tool_file_cmd in - *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) - try_normal_branch=yes - eval cmd=\"$cmd1\" - func_len " $cmd" - len=$func_len_result - ;; - *) - try_normal_branch=no - ;; - esac - if test "$try_normal_branch" = yes \ - && { test "$len" -lt "$max_cmd_len" \ - || test "$max_cmd_len" -le -1; } - then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - elif test -n "$nm_file_list_spec"; then - func_basename "$output" - output_la=$func_basename_result - save_libobjs=$libobjs - save_output=$output - output=${output_objdir}/${output_la}.nm - func_to_tool_file "$output" - libobjs=$nm_file_list_spec$func_to_tool_file_result - delfiles+=" $output" - func_verbose "creating $NM input file list: $output" - for obj in $save_libobjs; do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > "$output" - eval cmd=\"$cmd1\" - func_show_eval "$cmd" 'exit $?' - output=$save_output - libobjs=$save_libobjs - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles+=" $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - tmp_deplibs+=" $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - generated+=" $gentop" - - func_extract_archives $gentop $convenience - libobjs+=" $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - linker_flags+=" $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - func_basename "$output" - output_la=$func_basename_result - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - echo ')' >> $output - delfiles+=" $output" - func_to_tool_file "$output" - output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - delfiles+=" $output" - func_to_tool_file "$output" - output=$firstobj\"$file_list_spec$func_to_tool_file_result\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - objlist+=" $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval concat_cmds=\"$reload_cmds\" - else - # All subsequent reloadable object files will link in - # the last one created. - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - delfiles+=" $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - delfiles+=" $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated+=" $gentop" - - func_extract_archives $gentop $dlprefiles - libobjs+=" $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - generated+=" $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # If we're not building shared, we need to use non_pic_objs - test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - compile_command+=" ${wl}-bind_at_load" - finalize_command+=" ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - new_libs+=" -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs+=" $deplib" ;; - esac - ;; - *) new_libs+=" $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - compile_command+=" $compile_deplibs" - finalize_command+=" $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath+=" $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs+="$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath+=" $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath+=" $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) dllsearchpath+=":$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) dllsearchpath+=":$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs+="$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath+=" $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath+=" $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath+="$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath+="$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output_objdir/$outputname" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - oldobjs+=" $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - generated+=" $gentop" - - func_extract_archives $gentop $addlibs - oldobjs+=" $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - generated+=" $gentop" - - func_extract_archives $gentop $dlprefiles - oldobjs+=" $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - generated+=" $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - oldobjs+=" $gentop/$newobj" - ;; - *) oldobjs+=" $obj" ;; - esac - done - fi - func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 - tool_oldlib=$func_to_tool_file_result - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - elif test -n "$archiver_list_spec"; then - func_verbose "using command file archive linking..." - for obj in $oldobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > $output_objdir/$libname.libcmd - func_to_tool_file "$output_objdir/$libname.libcmd" - oldobjs=" $archiver_list_spec$func_to_tool_file_result" - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - objlist+=" $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - func_resolve_sysroot "$deplib" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - newdependency_libs+=" ${lt_sysroot:+=}$libdir/$name" - ;; - -L*) - func_stripname -L '' "$deplib" - func_replace_sysroot "$func_stripname_result" - newdependency_libs+=" -L$func_replace_sysroot_result" - ;; - -R*) - func_stripname -R '' "$deplib" - func_replace_sysroot "$func_stripname_result" - newdependency_libs+=" -R$func_replace_sysroot_result" - ;; - *) newdependency_libs+=" $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlfiles+=" ${lt_sysroot:+=}$libdir/$name" - ;; - *) newdlfiles+=" $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - newdlprefiles+=" ${lt_sysroot:+=}$libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlfiles+=" $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - newdlprefiles+=" $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$opt_mode" = link || test "$opt_mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) RM+=" $arg"; rmforce=yes ;; - -*) RM+=" $arg" ;; - *) files+=" $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - odir="$objdir" - else - odir="$dir/$objdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$opt_mode" = uninstall && odir="$dir" - - # Remember odir for removal later, being careful to avoid duplicates - if test "$opt_mode" = clean; then - case " $rmdirs " in - *" $odir "*) ;; - *) rmdirs+=" $odir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles+=" $odir/$n" - done - test -n "$old_library" && rmfiles+=" $odir/$old_library" - - case "$opt_mode" in - clean) - case " $library_names " in - *" $dlname "*) ;; - *) test -n "$dlname" && rmfiles+=" $odir/$dlname" ;; - esac - test -n "$libdir" && rmfiles+=" $odir/$name $odir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - rmfiles+=" $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - rmfiles+=" $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$opt_mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - rmfiles+=" $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - rmfiles+=" $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - rmfiles+=" $odir/$name $odir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - rmfiles+=" $odir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - rmfiles+=" $odir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$opt_mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$opt_mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - - -# ### BEGIN LIBTOOL TAG CONFIG: CXX - -# The linker used to build libraries. -LD="/usr/bin/ld" - -# How to create reloadable object files. -reload_flag=" -r" -reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" - -# Commands used to build an old-style archive. -old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" - -# A language specific compiler. -CC="g++" - -# Is the compiler the GNU compiler? -with_gcc=yes - -# Compiler flag to turn off builtin functions. -no_builtin_flag=" -fno-builtin" - -# Additional compiler flags for building library objects. -pic_flag=" -fPIC -DPIC" - -# How to pass a linker flag through the compiler. -wl="-Wl," - -# Compiler flag to prevent dynamic linking. -link_static_flag="-static" - -# Does compiler simultaneously support -c and -o options? -compiler_c_o="yes" - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=no - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=no - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec="\${wl}--export-dynamic" - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive" - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object="no" - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds="" - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds="" - -# Commands used to build a shared archive. -archive_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib" -archive_expsym_cmds="\$CC \$pic_flag -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib" - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds="" -module_expsym_cmds="" - -# Whether we are building with GNU ld or not. -with_gnu_ld="yes" - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag="" - -# Flag that enforces no undefined symbols. -no_undefined_flag="" - -# Flag to hardcode $libdir into a binary during linking. -# This must work even if $libdir does not exist -hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir" - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator="" - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=no - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting ${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=no - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=no - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=unsupported - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=no - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=no - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=unknown - -# Set to "yes" if exported symbols are required. -always_export_symbols=no - -# The commands to list exported symbols. -export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols" - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*" - -# Symbols that must always be exported. -include_expsyms="" - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds="" - -# Commands necessary for finishing linking programs. -postlink_cmds="" - -# Specify filename containing input files. -file_list_spec="" - -# How to hardcode a shared library path into an executable. -hardcode_action=immediate - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs="/usr/lib/gcc/i686-linux-gnu/4.6 /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu /usr/lib/gcc/i686-linux-gnu/4.6/../../../../lib /lib/i386-linux-gnu /lib/../lib /usr/lib/i386-linux-gnu /usr/lib/../lib /usr/lib/gcc/i686-linux-gnu/4.6/../../.." - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects="/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crti.o /usr/lib/gcc/i686-linux-gnu/4.6/crtbeginS.o" -postdep_objects="/usr/lib/gcc/i686-linux-gnu/4.6/crtendS.o /usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu/crtn.o" -predeps="" -postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s" - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path="-L/usr/lib/gcc/i686-linux-gnu/4.6 -L/usr/lib/gcc/i686-linux-gnu/4.6/../../../i386-linux-gnu -L/usr/lib/gcc/i686-linux-gnu/4.6/../../../../lib -L/lib/i386-linux-gnu -L/lib/../lib -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/i686-linux-gnu/4.6/../../.." - -# ### END LIBTOOL TAG CONFIG: CXX - -# ### BEGIN LIBTOOL TAG CONFIG: F77 - -# The linker used to build libraries. -LD="" - -# How to create reloadable object files. -reload_flag=" -r" -reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" - -# Commands used to build an old-style archive. -old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" - -# A language specific compiler. -CC="" - -# Is the compiler the GNU compiler? -with_gcc= - -# Compiler flag to turn off builtin functions. -no_builtin_flag="" - -# Additional compiler flags for building library objects. -pic_flag="" - -# How to pass a linker flag through the compiler. -wl="" - -# Compiler flag to prevent dynamic linking. -link_static_flag="" - -# Does compiler simultaneously support -c and -o options? -compiler_c_o="" - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=no - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=no - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec="" - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec="" - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object="" - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds="" - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds="" - -# Commands used to build a shared archive. -archive_cmds="" -archive_expsym_cmds="" - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds="" -module_expsym_cmds="" - -# Whether we are building with GNU ld or not. -with_gnu_ld="" - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag="" - -# Flag that enforces no undefined symbols. -no_undefined_flag="" - -# Flag to hardcode $libdir into a binary during linking. -# This must work even if $libdir does not exist -hardcode_libdir_flag_spec="" - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator="" - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=no - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting ${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=no - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=no - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var= - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=no - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=no - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=unknown - -# Set to "yes" if exported symbols are required. -always_export_symbols=no - -# The commands to list exported symbols. -export_symbols_cmds="" - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms="" - -# Symbols that must always be exported. -include_expsyms="" - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds="" - -# Commands necessary for finishing linking programs. -postlink_cmds="" - -# Specify filename containing input files. -file_list_spec="" - -# How to hardcode a shared library path into an executable. -hardcode_action= - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs="" - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects="" -postdep_objects="" -predeps="" -postdeps="" - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path="" - -# ### END LIBTOOL TAG CONFIG: F77 - -# ### BEGIN LIBTOOL TAG CONFIG: FC - -# The linker used to build libraries. -LD="" - -# How to create reloadable object files. -reload_flag=" -r" -reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" - -# Commands used to build an old-style archive. -old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" - -# A language specific compiler. -CC="" - -# Is the compiler the GNU compiler? -with_gcc= - -# Compiler flag to turn off builtin functions. -no_builtin_flag="" - -# Additional compiler flags for building library objects. -pic_flag="" - -# How to pass a linker flag through the compiler. -wl="" - -# Compiler flag to prevent dynamic linking. -link_static_flag="" - -# Does compiler simultaneously support -c and -o options? -compiler_c_o="" - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=no - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=no - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec="" - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec="" - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object="" - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds="" - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds="" - -# Commands used to build a shared archive. -archive_cmds="" -archive_expsym_cmds="" - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds="" -module_expsym_cmds="" - -# Whether we are building with GNU ld or not. -with_gnu_ld="" - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag="" - -# Flag that enforces no undefined symbols. -no_undefined_flag="" - -# Flag to hardcode $libdir into a binary during linking. -# This must work even if $libdir does not exist -hardcode_libdir_flag_spec="" - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator="" - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=no - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting ${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=no - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=no - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var= - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=no - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=no - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=unknown - -# Set to "yes" if exported symbols are required. -always_export_symbols=no - -# The commands to list exported symbols. -export_symbols_cmds="" - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms="" - -# Symbols that must always be exported. -include_expsyms="" - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds="" - -# Commands necessary for finishing linking programs. -postlink_cmds="" - -# Specify filename containing input files. -file_list_spec="" - -# How to hardcode a shared library path into an executable. -hardcode_action= - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs="" - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects="" -postdep_objects="" -predeps="" -postdeps="" - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path="" - -# ### END LIBTOOL TAG CONFIG: FC - -# ### BEGIN LIBTOOL TAG CONFIG: GO - -# The linker used to build libraries. -LD="/usr/bin/ld" - -# How to create reloadable object files. -reload_flag=" -r" -reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" - -# Commands used to build an old-style archive. -old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" - -# A language specific compiler. -CC="" - -# Is the compiler the GNU compiler? -with_gcc= - -# Compiler flag to turn off builtin functions. -no_builtin_flag="" - -# Additional compiler flags for building library objects. -pic_flag="" - -# How to pass a linker flag through the compiler. -wl="" - -# Compiler flag to prevent dynamic linking. -link_static_flag="" - -# Does compiler simultaneously support -c and -o options? -compiler_c_o="" - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=no - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes= - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec="" - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec="" - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object="" - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds="" - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds="" - -# Commands used to build a shared archive. -archive_cmds="" -archive_expsym_cmds="" - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds="" -module_expsym_cmds="" - -# Whether we are building with GNU ld or not. -with_gnu_ld="" - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag="" - -# Flag that enforces no undefined symbols. -no_undefined_flag="" - -# Flag to hardcode $libdir into a binary during linking. -# This must work even if $libdir does not exist -hardcode_libdir_flag_spec="" - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator="" - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct= - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting ${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute= - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L= - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var= - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic= - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath= - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs= - -# Set to "yes" if exported symbols are required. -always_export_symbols= - -# The commands to list exported symbols. -export_symbols_cmds="" - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms="" - -# Symbols that must always be exported. -include_expsyms="" - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds="" - -# Commands necessary for finishing linking programs. -postlink_cmds="" - -# Specify filename containing input files. -file_list_spec="" - -# How to hardcode a shared library path into an executable. -hardcode_action= - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs="" - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects="" -postdep_objects="" -predeps="" -postdeps="" - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path="" - -# ### END LIBTOOL TAG CONFIG: GO - -# ### BEGIN LIBTOOL TAG CONFIG: GCJ - -# The linker used to build libraries. -LD="/usr/bin/ld" - -# How to create reloadable object files. -reload_flag=" -r" -reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs" - -# Commands used to build an old-style archive. -old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib" - -# A language specific compiler. -CC="" - -# Is the compiler the GNU compiler? -with_gcc= - -# Compiler flag to turn off builtin functions. -no_builtin_flag="" - -# Additional compiler flags for building library objects. -pic_flag="" - -# How to pass a linker flag through the compiler. -wl="" - -# Compiler flag to prevent dynamic linking. -link_static_flag="" - -# Does compiler simultaneously support -c and -o options? -compiler_c_o="" - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=no - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes= - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec="" - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec="" - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object="" - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds="" - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds="" - -# Commands used to build a shared archive. -archive_cmds="" -archive_expsym_cmds="" - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds="" -module_expsym_cmds="" - -# Whether we are building with GNU ld or not. -with_gnu_ld="" - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag="" - -# Flag that enforces no undefined symbols. -no_undefined_flag="" - -# Flag to hardcode $libdir into a binary during linking. -# This must work even if $libdir does not exist -hardcode_libdir_flag_spec="" - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator="" - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct= - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting ${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute= - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L= - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var= - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic= - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath= - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs= - -# Set to "yes" if exported symbols are required. -always_export_symbols= - -# The commands to list exported symbols. -export_symbols_cmds="" - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms="" - -# Symbols that must always be exported. -include_expsyms="" - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds="" - -# Commands necessary for finishing linking programs. -postlink_cmds="" - -# Specify filename containing input files. -file_list_spec="" - -# How to hardcode a shared library path into an executable. -hardcode_action= - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs="" - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects="" -postdep_objects="" -predeps="" -postdeps="" - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path="" - -# ### END LIBTOOL TAG CONFIG: GCJ - -# ### BEGIN LIBTOOL TAG CONFIG: RC - -# The linker used to build libraries. -LD="" - -# How to create reloadable object files. -reload_flag="" -reload_cmds="" - -# Commands used to build an old-style archive. -old_archive_cmds="" - -# A language specific compiler. -CC="" - -# Is the compiler the GNU compiler? -with_gcc= - -# Compiler flag to turn off builtin functions. -no_builtin_flag="" - -# Additional compiler flags for building library objects. -pic_flag="" - -# How to pass a linker flag through the compiler. -wl="" - -# Compiler flag to prevent dynamic linking. -link_static_flag="" - -# Does compiler simultaneously support -c and -o options? -compiler_c_o="yes" - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc= - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes= - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec="" - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec="" - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object="" - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds="" - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds="" - -# Commands used to build a shared archive. -archive_cmds="" -archive_expsym_cmds="" - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds="" -module_expsym_cmds="" - -# Whether we are building with GNU ld or not. -with_gnu_ld="" - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag="" - -# Flag that enforces no undefined symbols. -no_undefined_flag="" - -# Flag to hardcode $libdir into a binary during linking. -# This must work even if $libdir does not exist -hardcode_libdir_flag_spec="" - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator="" - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct= - -# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting ${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute= - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L= - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var= - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic= - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath= - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs= - -# Set to "yes" if exported symbols are required. -always_export_symbols= - -# The commands to list exported symbols. -export_symbols_cmds="" - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms="" - -# Symbols that must always be exported. -include_expsyms="" - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds="" - -# Commands necessary for finishing linking programs. -postlink_cmds="" - -# Specify filename containing input files. -file_list_spec="" - -# How to hardcode a shared library path into an executable. -hardcode_action= - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs="" - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects="" -postdep_objects="" -predeps="" -postdeps="" - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path="" - -# ### END LIBTOOL TAG CONFIG: RC diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/libtoolize b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/libtoolize deleted file mode 100755 index 44d8b0eb9..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/libtoolize +++ /dev/null @@ -1,2555 +0,0 @@ -#! /bin/sh -# Generated from libtoolize.m4sh by GNU Autoconf 2.68. - -# libtoolize (GNU libtool) 2.4.2 -# Written by Gary V. Vaughan , 2003 - -# Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 -# 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. - -# Libtoolize 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. -# -# Libtoolize 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 libtoolize; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... -# -# Prepare a package to use libtool. -# -# -c, --copy copy files rather than symlinking them -# --debug enable verbose shell tracing -# -n, --dry-run print commands rather than running them -# -f, --force replace existing files -# -i, --install copy missing auxiliary files -# --ltdl[=DIR] install libltdl sources [default: libltdl] -# --no-warn don't display warning messages -# --nonrecursive prepare ltdl for non-recursive make -# -q, --quiet work silently -# --recursive prepare ltdl for recursive make -# --subproject prepare ltdl to configure and build independently -# -v, --verbose verbosely report processing -# --version print version information and exit -# -h, --help print short or long help message -# -# The following space or comma delimited options can be passed to $progname -# via the environment variable LIBTOOLIZE_OPTIONS, unknown environment -# options are ignored: -# -# --debug enable verbose shell tracing -# --no-warn don't display warning messages -# --quiet work silently -# --verbose verbosely report processing -# -# You must `cd' to the top directory of your package before you run -# `$progname'. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: i686-pc-linux-gnu -# $progname: (GNU libtool) 2.4.2 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . - -: ${TAR=tar} - -PROGRAM=libtoolize - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - -## -------------------- ## -## 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=: - # Pre-4.2 versions of Zsh do 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_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -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.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -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 - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do 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_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested="" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - break 2 -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -## -------------------- ## -## Main body of script. ## -## -------------------- ## - - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${EGREP="/bin/grep -E"} -: ${FGREP="/bin/grep -F"} -: ${GREP="/bin/grep"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SED="/bin/sed"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation - - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation - - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=${PATH_SEPARATOR-:} - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $opt_debug - - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $opt_debug - - func_error "missing argument for $1." - exit_cmd=exit -} - - -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' - - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' - - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation - -exit_cmd=: - - - - - -# ltdl can be installed to be self-contained (subproject, the default); -# or to be configured by a parent project, either with a recursive or -# nonrecursive automake driven make: -ltdl_mode= - -# Locations for important files: -ltdldir= - -# Parse environment options -{ - my_sed_env_opt='1s/^\([^,:; ]*\).*$/\1/;q' - my_sed_env_rest='1s/^[^,:; ]*[,:; ]*\(.*\)$/\1/;q' - - while test -n "$LIBTOOLIZE_OPTIONS"; do - opt=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_opt"` - LIBTOOLIZE_OPTIONS=`echo "$LIBTOOLIZE_OPTIONS" | sed "$my_sed_env_rest"` - - case $opt in - --debug|--no-warn|--quiet|--verbose) - envopts="${envopts+$envopts }$opt" ;; - --*) env_warning="${env_warning+$env_warning -}unrecognized environment option \`$opt'" ;; - *) func_fatal_help "garbled LIBTOOLIZE_OPTIONS near \`$opt'" ;; - esac - done - - test -n "$envopts" && { - func_quote_for_eval "$envopts" - eval set dummy "$func_quote_for_eval_result" ${1+"$@"} - shift - } -} - - - -# Option defaults: -opt_debug=: -opt_copy=false -opt_force=false -opt_install=false -opt_dry_run=false -opt_quiet=false -opt_verbose=false -opt_warning=: -opt_nonrecursive=false -opt_recursive=false -opt_standalone=false -opt_ltdl="false" - - -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --copy|-c) - opt_copy=: - ;; - --force|-f) - opt_force=: - ;; - --install|-i) - opt_install=: - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: -CP="func_echo_all $CP" -test -n "$LN_S" && LN_S="func_echo_all $LN_S" -MKDIR="func_echo_all $MKDIR" -RM="func_echo_all $RM" -TAR="func_echo_all $TAR" - ;; - --quiet|--automake|-q) - opt_quiet=: - ;; - --verbose|-v) - opt_verbose=: - ;; - --no-warning|--no-warn) - opt_warning=false - ;; - --nonrecursive|--non-recursive) - opt_nonrecursive=: - ;; - --recursive) - opt_recursive=: - ;; - --standalone) - opt_standalone=: - ;; - --ltdl) - optarg="$1" - if test $# -gt 0; then - case $optarg in # (( - -*) ;; - *) opt_ltdl="$optarg"; shift ;; - esac - fi -# This is tricky, since we're overloading $opt_ltdl to be the -# optarg for --ltdl during option processing, but then stashing -# the (optional) optarg in $ltdldir and reusing $opt_ltdl to -# indicate that --ltdl was seen during option processing. Also, -# be careful that --ltdl=foo --ltdl=bar results in ltdldir=bar: -case $opt_ltdl in - false|:) ;; # a bare '--ltdl' followed by another option - *) ltdldir=`$ECHO "$optarg" | $SED 's,/*$,,'` ;; -esac -opt_ltdl=: - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-c*|-f*|-i*|-n*|-q*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - - # Validate options: - - # show any warnings saved by LIBTOOLIZE_OPTIONS parsing - test -n "$env_warning" && - echo "$env_warning" |while read line; do func_warning "$line"; done - - # validate $opt_nonrecursive, $opt_recursive and $opt_standalone - if $opt_nonrecursive; then - if $opt_recursive || $opt_standalone; then - func_error "you can have at most one of --non-recursive, --recursive and --standalone" - fi - ltdl_mode=nonrecursive - elif $opt_recursive; then - $opt_standalone && - func_error "you can have at most one of --non-recursive, --recursive and --standalone" - ltdl_mode=recursive - elif $opt_standalone; then - ltdl_mode=standalone - fi - - # any remaining arguments are an error - test $# -gt 0 && - func_fatal_help "unknown additional arguments: \`${1+}'" - - - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} - - - - -# func_echo_once msg_var -# Calls func_echo with the value of MSG_VAR, and then sets MSG_VAR="" so -# that subsequent calls have no effect. -func_echo_once () -{ - $opt_debug - if test -n "$1"; then - eval my_msg=\$$1 - - if test -n "$my_msg"; then - func_echo "$my_msg" - eval $1="" - fi - fi -} - - -# func_copy srcfile destfile [msg_var] -# A wrapper for func_copy_cb that accepts arguments in the same order -# as the cp(1) shell command. -func_copy () -{ - $opt_debug - - test -f "$1" || \ - { func_error "\`$1' not copied: not a regular file"; return 1; } - - func_dirname_and_basename "$1" - my_f1=$func_basename_result - - if test -d "$2"; then - - func_copy_cb "$my_f1" \ - `$ECHO "$1" | $SED "$dirname"` "$2" "$3" - - else - - # Supporting this would mean changing the timestamp: - func_dirname_and_basename "$2" - my_tname=$func_basename_result - test "X$my_f1" = "X$my_tname" \ - || func_fatal_error "func_copy() cannot change filename on copy" - - func_copy_cb "$my_f1" \ - `$ECHO "$1" | $SED "$dirname"` \ - `$ECHO "$2" | $SED "$dirname"` \ - "$3" - - fi - - return $copy_return_status # set in func_copy_cb -} - - -# func_copy_cb filename srcdir destdir [msg_var] -# If option `--copy' was specified, or soft-linking SRCFILE to DESTFILE fails, -# then try to copy SRCFILE to DESTFILE (without changing the timestamp if -# possible). -func_copy_cb () -{ - $opt_debug - my_file="$1" - my_srcdir="$2" - my_destdir="$3" - my_msg_var="$4" - copy_return_status=1 - - # Libtool is probably misinstalled if this happens: - test -f "$my_srcdir/$my_file" || - func_fatal_error "\`$my_file' not found in \`$my_srcdir'" - - case $opt_verbose in - false) my_copy_msg="file \`$my_destdir/$my_file'" ;; - *) my_copy_msg="file from \`$my_srcdir/$my_file'" ;; - esac - func_mkdir_p `$ECHO "$my_destdir/$my_file" | $SED "$dirname"` - - $RM "$my_destdir/$my_file" - if $opt_copy; then - if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \ - | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1; } \ - && touch "$my_destdir/$my_file"; then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet || func_echo "copying $my_copy_msg" - copy_return_status=0 - fi - else - if test "$my_file" = "aclocal.m4"; then - if { ( cd "$my_srcdir" && $TAR chf - "$my_file" ) 2>/dev/null \ - | ( umask 0 && cd "$my_destdir" && $TAR xf - ) >/dev/null 2>&1 ; } - then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet || func_echo "copying $my_copy_msg" - copy_return_status=0 - fi - else - if $LN_S "$my_srcdir/$my_file" "$my_destdir/$my_file"; then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet || func_echo "linking $my_copy_msg" - copy_return_status=0 - fi - fi - fi - if test "$copy_return_status" != 0; then - $opt_quiet || func_echo_once "$my_msg_var" - func_error "can not copy \`$my_srcdir/$my_file' to \`$my_destdir/'" - exit_status=$EXIT_FAILURE - fi -} - - -# func_copy_some_files srcfile_spec srcdir destdir [msg_var] [cb=func_copy_cb] -# Call COPY_CB for each regular file in SRCDIR named by the ':' delimited -# names in SRCFILE_SPEC. The odd calling convention is needed to allow -# spaces in file and directory names. -func_copy_some_files () -{ - $opt_debug - my_srcfile_spec="$1" - my_srcdir="$2" - my_destdir="$3" - my_msg_var="$4" - my_copy_cb="${5-func_copy_cb}" - - my_save_IFS="$IFS" - IFS=: - for my_filename in $my_srcfile_spec; do - IFS="$my_save_IFS" - if test -f "$my_srcdir/$my_filename"; then - if test "X$my_copy_cb" = Xfunc_copy_cb; then - $opt_force || if test -f "$my_destdir/$my_filename"; then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet \ - || func_error "\`$my_destdir/$my_filename' exists: use \`--force' to overwrite" - continue - fi - fi - else - func_echo_once "$my_msg_var" - func_fatal_error "\`$my_filename' not found in \`$my_srcdir'" - fi - - $my_copy_cb "$my_filename" "$my_srcdir" "$my_destdir" "$my_msg_var" - done - IFS="$my_save_IFS" -} - - -# func_fixup_Makefile srcfile srcdir destdir -func_fixup_Makefile () -{ - $opt_debug - my_filename="$1" - my_srcdir="$2" - my_destdir="$3" - my_fixup_non_subpackage_script="\ - s,(LIBOBJS),(ltdl_LIBOBJS),g - s,(LTLIBOBJS),(ltdl_LTLIBOBJS),g - s,libltdl/configure.ac,, - s,libltdl/configure,, - s,libltdl/aclocal.m4,, - s,libltdl/config-h.in,, - s,libltdl/Makefile.am,, - s,libltdl/Makefile.in,, - /^[ ]*\\\\\$/d" - case $my_filename in - Makefile.am) - my_fixup_non_subpackage_script=`echo "$my_fixup_non_subpackage_script" | \ - sed 's,libltdl/,,'` - my_fixup_inc_paths_script= ;; - Makefile.inc) - repl=$ltdldir - repl_uscore=`$ECHO "$repl" | $SED 's,[/.+-],_,g'` - my_fixup_inc_paths_script="\ - s,libltdl_,@repl_uscore@_, - s,libltdl/,@repl@/, - s,: libltdl/,: @repl@/, - s, -Ilibltdl , -I@repl@ , - s,\\\$(libltdl_,\$(@repl_uscore@_, - s,)/libltdl ,)/@repl@ , - s,@repl_uscore@,${repl_uscore},g - s,@repl@,${repl},g" - ;; - esac - - $RM "$my_destdir/$my_filename" 2>/dev/null - $opt_quiet || func_echo "creating file \`$my_destdir/$my_filename'" - if $opt_dry_run; then :; - else - $SED "$my_fixup_non_subpackage_script - $my_fixup_inc_paths_script" \ - < "$my_srcdir/$my_filename" > "$my_destdir/$my_filename" || - func_fatal_error "cannot create $my_destdir/$my_filename" - fi -} - -# func_scan_files -# Scan configure.(ac|in) and aclocal.m4 (if present) for use of libltdl -# and libtool. Possibly running some of these tools if necessary. -# Libtoolize affects the contents of aclocal.m4, and should be run before -# aclocal, so we can't use configure --trace which relies on a consistent -# configure.(ac|in) and aclocal.m4. -func_scan_files () -{ - $opt_debug - # Prefer configure.ac to configure.in - test -f configure.ac && configure_ac=configure.ac - test -f "$configure_ac" || configure_ac= - - # Set local variables to reflect contents of configure.ac - my_sed_scan_configure_ac='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,,; - /AC_INIT/ { - s,^.*$,seen_autoconf=:, - p - } - d' - test -z "$configure_ac" \ - || eval `$SED "$my_sed_scan_configure_ac" "$configure_ac"` - - $seen_autoconf || { - my_configure_ac= - test -n "$configure_ac" && my_configure_ac="$configure_ac: " - func_verbose "${my_configure_ac}not using Autoconf" - - # Make sure ltdldir and ltdl_mode have sensible defaults - # since we return early here: - test -n "$ltdldir" || ltdldir=libltdl - test -n "$ltdl_mode" || ltdl_mode=subproject - - return - } - - # ---------------------------------------------------- # - # Probe macro usage in configure.ac and/or aclocal.m4. # - # ---------------------------------------------------- # - - my_sed_traces='s,#.*$,,; s,^dnl .*$,,; s, dnl .*$,, - s,^.*AC_REQUIRE(.*$,,; s,^.*m4_require(.*$,,; - s,^.*m4_define(.*$,, - s,^.*A[CU]_DEFUN(.*$,,; s,^.*m4_defun(.*$,, - /AC_CONFIG_AUX_DIR(/ { - s,^.*AC_CONFIG_AUX_DIR([[ ]*\([^])]*\).*$,ac_auxdir=\1, - p - } - /AC_CONFIG_MACRO_DIR(/ { - s,^.*AC_CONFIG_MACRO_DIR([[ ]*\([^])]*\).*$,ac_macrodir=\1, - p - } - /_LT_CONFIG_LTDL_DIR(/d - /LT_CONFIG_LTDL_DIR(/ { - s,^.*LT_CONFIG_LTDL_DIR([[ ]*\([^])]*\).*$,ac_ltdldir=\1, - p - } - /\[A[CM]_PROG_LIBTOOL/d - /A[CM]_PROG_LIBTOOL/ { - s,^.*$,seen_libtool=:, - p - } - /the.*option into.*LT_INIT.*parameter/d - /\[LT_INIT/d - /LT_INIT/ { - s,^.*$,seen_libtool=:, - p - } - /\[LTDL_INIT/d - /LTDL_INIT/ { - s,^.*LTDL_INIT([[ ]*\([^])]*\).*$,ltdl_options="\1", - s,^.*LTDL_INIT[ ]*$,seen_ltdl=:, - p - } - /LT_WITH_LTDL/ { - s,^.*$,seen_ltdl=:, - p - } - /AC_LIB_LTDL/ { - s,^.*$,seen_ltdl=:, - p - } - /AC_WITH_LTDL/ { - s,^.*$,seen_ltdl=:, - p - } - d' - eval `cat aclocal.m4 "$configure_ac" 2>/dev/null | $SED "$my_sed_traces"` - - - # ----------------- # - # Validate ltdldir. # - # ----------------- # - - ac_ltdldir=`$ECHO "$ac_ltdldir" | $SED 's,/*$,,'` - - # If $configure_ac contains AC_CONFIG_LTDL_DIR, check that its - # arguments were not given in terms of a shell variable! - case "$ac_ltdldir" in - *\$*) - func_fatal_error "can not handle variables in LT_CONFIG_LTDL_DIR" - ;; - esac - - # If neither --ltdl nor LT_CONFIG_LTDL_DIR are specified, default to - # `libltdl'. If both are specified, they must be the same. Otherwise, - # take the one that is given! (If LT_CONFIG_LTDL_DIR is not specified - # we suggest adding it later in this code.) - case x$ac_ltdldir,x$ltdldir in - x,x) ltdldir=libltdl ;; - x*,x) ltdldir=$ac_ltdldir ;; - x,x*) ltdldir=$ltdldir ;; - *) - test x"$ac_ltdldir" = x"$ltdldir" || \ - func_fatal_error "--ltdl='$ltdldir' does not match LT_CONFIG_LTDL_DIR($ac_ltdldir)" - ;; - esac - - - # ------------------- # - # Validate ltdl_mode. # - # ------------------- # - - test -n "$ltdl_options" && seen_ltdl=: - - # If $configure_ac contains LTDL_INIT, check that its - # arguments were not given in terms of a shell variable! - case "$ltdl_options" in - *\$*) - func_fatal_error "can not handle variables in LTDL_INIT" - ;; - esac - - # Extract mode name from ltdl_options - # FIXME: Diagnose multiple conflicting modes in ltdl_options - ac_ltdl_mode= - case " $ltdl_options " in - *" nonrecursive "*) ac_ltdl_mode=nonrecursive ;; - *" recursive "*) ac_ltdl_mode=recursive ;; - *" subproject "*) ac_ltdl_mode=subproject ;; - esac - - # If neither --ltdl nor an LTDL_INIT mode are specified, default to - # `subproject'. If both are specified, they must be the same. Otherwise, - # take the one that is given! - case x$ac_ltdl_mode,x$ltdl_mode in - x,x) ltdl_mode=subproject ;; - x*,x) ltdl_mode=$ac_ltdl_mode ;; - x,x*) ltdl_mode=$ltdl_mode ;; - *) - test x"$ac_ltdl_mode" = x"$ltdl_mode" || \ - func_fatal_error "--$ltdl_mode does not match LTDL_INIT($ac_ltdl_mode)" - ;; - esac - - # ---------------- # - # Validate auxdir. # - # ---------------- # - - if test -n "$ac_auxdir"; then - # If $configure_ac contains AC_CONFIG_AUX_DIR, check that it was - # not given in terms of a shell variable! - case "$ac_auxdir" in - *\$*) - func_fatal_error "can not handle variables in AC_CONFIG_AUX_DIR" - ;; - *) - auxdir=$ac_auxdir - ;; - esac - else - # Try to discover auxdir the same way it is discovered by configure. - # Note that we default to the current directory. - for dir in . .. ../..; do - if test -f "$dir/install-sh"; then - auxdir=$dir - break - elif test -f "$dir/install.sh"; then - auxdir="$dir" - break - fi - done - fi - - # Just use the current directory if all else fails. - test -n "$auxdir" || auxdir=. - - - # ------------------------------ # - # Find local m4 macro directory. # - # ------------------------------ # - - # Hunt for ACLOCAL_AMFLAGS in `Makefile.am' for a `-I' argument. - - my_sed_aclocal_flags=' - /^[ ]*ACLOCAL_[A-Z_]*FLAGS[ ]*=[ ]*/ { - s,,, - q - } - d' - if test -f Makefile.am; then - my_macrodir_is_next=false - for arg in `$SED "$my_sed_aclocal_flags" Makefile.am`; do - if $my_macrodir_is_next; then - am_macrodir="$arg" - break - else - case $arg in - -I) my_macrodir_is_next=: ;; - -I*) - am_macrodir=`$ECHO "$arg" | sed 's,^-I,,'` - break - ;; - *) my_macrodir_is_next=false ;; - esac - fi - done - fi - - macrodir="$ac_macrodir" - test -z "$macrodir" && macrodir="$am_macrodir" - - if test -n "$am_macrodir" && test -n "$ac_macrodir"; then - test "$am_macrodir" = "$ac_macrodir" \ - || func_fatal_error "AC_CONFIG_MACRO_DIR([$ac_macrodir]) conflicts with ACLOCAL_AMFLAGS=-I $am_macrodir." - fi -} - -# func_included_files searchfile -# Output INCLUDEFILE if SEARCHFILE m4_includes it, else output SEARCHFILE. -func_included_files () -{ - $opt_debug - my_searchfile="$1" - - my_include_regex= - my_sed_include=' - /^m4_include(\[.*\])$/ { - s,^m4_include(\[\(.*\)\])$,\1, - p - } - d' - - if test -f "$my_searchfile"; then - $ECHO "$my_searchfile" - - # Only recurse when we don't care if all the variables we use get - # trashed, since they are in global scope. - for my_filename in `$SED "$my_sed_include" "$my_searchfile"`; do - func_included_files $my_filename - done - fi -} - - -# func_serial filename [macro_regex] -# Output the value of the serial number comment in FILENAME, where the -# comment line must also match MACRO_REGEX, if given. -func_serial () -{ - $opt_debug - my_filename="$1" - my_macro_regex="$2" - my_sed_serial=' - /^# serial [1-9][0-9.]*[ ]*'"$my_macro_regex"'[ ]*$/ { - s,^# serial \([1-9][0-9.]*\).*$,\1, - q - } - d' - - # Search FILENAME and all the files it m4_includes for a serial number - # in the file that AC_DEFUNs MACRO_REGEX. - my_serial= - func_dirname_and_basename "$my_filename" - my_filebase=$func_basename_result - for my_file in `func_included_files "$my_filename"`; do - if test -z "$my_macro_regex" || - test "$my_filename" = aclocal.m4 || - test "X$my_macro_regex" = "X$my_filebase" || - func_grep '^AC_DEFUN(\['"$my_macro_regex" "$my_file" - then - my_serial=`$SED -e "$my_sed_serial" "$my_file"` - break - fi - done - - # If the file has no serial number, we assume it's ancient. - test -n "$my_serial" || my_serial=0 - - $ECHO "$my_serial" -} - - -# func_serial_max serial1 serial2 -# Compare (possibly multi-part, '.' delimited) serial numbers, and -# return the largest in $func_serial_max_result. If they are the -# same, func_serial_max_result will be empty. -func_serial_max () -{ - $opt_debug - my_serial1="$1" - my_serial2="$2" - - my_sed_dot='s/\..*$//g' - my_sed_rest='s/^[0-9][1-9]*\.*//' - my_sed_digits='s/[^0-9.]//g' - - # Incase they turn out to be the same, we'll set it to empty - func_serial_max_result= - - test "X$1$2" = X`$ECHO "$1$2" | $SED "$my_sed_digits"` || { - func_error "serial numbers \`$1' or \`$2' contain non-digit chars" - return - } - - while test -n "$my_serial1$my_serial2"; do - my_serial1_part=`$ECHO "$my_serial1" | $SED "$my_sed_dot"` - my_serial2_part=`$ECHO "$my_serial2" | $SED "$my_sed_dot"` - - test -z "$my_serial1_part$my_serial2_part" \ - && break - - test -z "$my_serial1_part" \ - && { func_serial_max_result="$2"; break; } - - test -z "$my_serial2_part" \ - && { func_serial_max_result="$1"; break; } - - test "$my_serial1_part" -gt "$my_serial2_part" \ - && { func_serial_max_result="$1"; break; } - - test "$my_serial2_part" -gt "$my_serial1_part" \ - && { func_serial_max_result="$2"; break; } - - my_serial1=`$ECHO "$my_serial1" | $SED "$my_sed_rest"` - my_serial2=`$ECHO "$my_serial2" | $SED "$my_sed_rest"` - done -} - - -# func_serial_update_check srcfile src_serial destfile dest_serial -# Unless SRC_SERIAL is newer than DEST_SERIAL set $func_serial_update_check -# to 'false'. -func_serial_update_check () -{ - $opt_debug - my_srcfile="$1" - my_src_serial="$2" - my_destfile="$3" - my_dest_serial="$4" - my_update_p=: - - if test -f "$my_destfile"; then - test "X$my_src_serial" = "X0" && { - func_warning "no serial number on \`$my_srcfile', not copying." - return - } - - # Determine whether the destination has an older serial. - func_serial_max "$my_src_serial" "$my_dest_serial" - test "X$my_src_serial" = "X$func_serial_max_result" || my_update_p=false - - test "X$my_src_serial" = "X$func_serial_max_result" \ - && func_verbose "\`$my_srcfile' is serial $my_src_serial, greater than $my_dest_serial in \`$my_destfile'" - - if test "X$my_dest_serial" = "X$func_serial_max_result"; then - func_verbose "\`$my_srcfile' is serial $my_src_serial, less than $my_dest_serial in \`$my_destfile'" - $opt_force || if test -n "$ac_macrodir$ac_ltdldir"; then - func_error "\`$my_destfile' is newer: use \`--force' to overwrite" - fi - fi - fi - - func_serial_update_check_result="$my_update_p" -} - - -# func_aclocal_update_check filename -# Unless serial number of FILENAME is newer than the matching serial number -# in aclocal.m4, set $func_aclocal_update_check to 'false'. -func_aclocal_update_check () -{ - $opt_debug - my_srcfile="$aclocaldir/$1" - my_destfile="aclocal.m4" - - case $need in - libtool.m4) - my_src_serial=`func_serial "$my_srcfile" LT_INIT` - my_dest_serial=`func_serial "$my_destfile" LT_INIT` - - # Strictly, this libtoolize ought not to have to deal with ancient - # serial formats, but we accept them here to be complete: - test "X$my_src_serial" = "X0" && - my_src_serial=`func_serial "$my_srcfile" 'A[CM]_PROG_LIBTOOL'` - test "X$my_dest_serial" = "X0" && - my_dest_serial=`func_serial "$my_destfile" 'A[CM]_PROG_LIBTOOL'` - ;; - ltdl.m4) - my_src_serial=`func_serial "$my_srcfile" LTDL_INIT` - my_dest_serial=`func_serial "$my_destfile" LTDL_INIT` - ;; - *) - my_src_serial=`func_serial "$my_srcfile" "$need"` - my_dest_serial=`func_serial "$my_destfile" "$need"` - ;; - esac - - func_serial_update_check \ - "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial" - - func_aclocal_update_check_result="$func_serial_update_check_result" -} - - -# func_serial_update filename srcdir destdir [msg_var] [macro_re] [old_macro_re] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer serial number, or DESTFILE does not yet exist, or the user -# specified `--force' at the command line. If given, MACRO_REGEX or -# OLD_MACRO_REGEX must match any text after "# serial N" in both files. -func_serial_update () -{ - $opt_debug - my_filename="$1" - my_srcdir="$2" - my_destdir="$3" - my_msg_var="$4" - my_macro_regex="$5" - my_old_macro_regex="$6" - - my_serial_update_p=: - my_return_status=1 - my_srcfile="$my_srcdir/$my_filename" - my_destfile="$my_destdir/$my_filename" - - test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist." - - if test -f "$my_destfile"; then - my_src_serial=`func_serial "$my_srcfile" "$my_macro_regex"` - my_dest_serial=`func_serial "$my_destfile" "$my_macro_regex"` - - # Strictly, this libtoolize ought not to have to deal with ancient - # serial formats, but we accept them here to be complete: - test "X$my_src_serial" = "X0" && - my_src_serial=`func_serial "$my_srcfile" "$my_old_macro_regex"` - - test "X$my_dest_serial" = "X0" && - my_dest_serial=`func_serial "$my_destfile" "$my_old_macro_regex"` - - func_serial_update_check \ - "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial" - my_serial_update_p="$func_serial_update_check_result" - fi - - if $my_serial_update_p || $opt_force; then - func_copy "$my_srcfile" "$my_destfile" "$my_msg_var" - my_return_status=$? - elif $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then - $opt_quiet || func_echo_once "$my_msg_var" - $opt_quiet \ - || func_echo "\`$my_destfile' is already up to date." - fi - - # Do this after the copy for hand maintained `aclocal.m4', incase - # it has `m4_include([DESTFILE])', so the copy effectively already - # updated `aclocal.m4'. - my_included_files=`func_included_files aclocal.m4` - case `echo " $my_included_files " | $NL2SP` in - - # Skip included files: - *" $my_destfile "*) ;; - - # Otherwise compare to aclocal.m4 serial number (func_serial - # returns 0 for older macro serial numbers before we provided - # serial tags, so the update message will be correctly given - # if aclocal.m4 contains an untagged --i.e older-- macro file): - *) - if test -f aclocal.m4; then - func_serial_max \ - "$my_src_serial" `func_serial aclocal.m4 "$my_macro_regex"` - if test "X$my_src_serial" = "X$func_serial_max_result"; then - func_echo_once "$my_msg_var" - func_echo "You should add the contents of \`$my_destfile' to \`aclocal.m4'." - fi - fi - ;; - esac - return $my_return_status -} - - -# func_keyword_update filename srcdir destdir sed_script [msg_var] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer revision according to the serial number extracted by -# SED_SCRIPT, or DESTFILE does not yet exist, or the user specified -# `--force' at the command line. -func_keyword_update () -{ - $opt_debug - my_filename="$1" - my_srcdir="$2" - my_destdir="$3" - my_sed_script="$4" - my_msg_var="$5" - - my_srcfile="$my_srcdir/$my_filename" - my_destfile="$my_destdir/$my_filename" - - my_keyword_update_p=: - - test -f "$my_srcfile" || func_fatal_error "\`$my_srcfile' does not exist." - - if test -f "$my_destfile"; then - my_src_serial=`$SED -e "$my_sed_script" "$my_srcfile"` - test -z "$my_src_serial" && { - func_warning "no serial number in \`$my_srcfile', not copying." - return - } - - my_dest_serial=`$SED -e "$my_sed_script" "$my_destfile"` - test -n "$my_dest_serial" || my_dest_serial=0 - - func_serial_update_check \ - "$my_srcfile" "$my_src_serial" "$my_destfile" "$my_dest_serial" - my_keyword_update_p="$func_serial_update_check_result" - fi - - if $my_keyword_update_p || $opt_force; then - func_copy "$my_srcfile" "$my_destfile" "$my_msg_var" - elif $opt_verbose || $opt_force && test "X$my_dest_serial" = "X$my_src_serial"; then - func_echo_once "$my_msg_var" - func_echo "\`$my_destfile' is already up to date." - fi -} - - -# func_ltmain_update filename srcdir destdir [msg_var] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer revision, or DESTFILE does not yet exist, or the user -# specified `--force' at the command line. -func_ltmain_update () -{ - $opt_debug - my_sed_ltmain=' - /^package_revision='\''*[0-9][1-9.]*'\''*/ { - s,^package_revision='\''*\([0-9.]*\)'\''*[ ]*$,\1, - p - } - d' - - func_keyword_update "$1" "$2" "$3" "$my_sed_ltmain" "$4" - - return $my_return_status -} - - -# func_config_update filename srcdir destdir [msg_var] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer timestamp, or DESTFILE does not yet exist, or the user -# specified `--force' at the command line. -func_config_update () -{ - $opt_debug - my_sed_config=' - /^timestamp='\''*[0-9][1-9-]*'\''*/ { - s,^timestamp='\''*\([0-9-]*\)'\''*,\1, - s/-/./g - p - } - d' - - func_keyword_update "$1" "$2" "$3" "$my_sed_config" "$4" - - return $my_return_status -} - - -# func_install_update filename srcdir destdir [msg_var] -# Copy the FILENAME from a SRCDIR to DESTDIR provided that either FILENAME -# has a newer timestamp, or DESTFILE does not yet exist, or the user -# specified `--force' at the command line. -func_install_update () -{ - $opt_debug - my_sed_install=' - /^scriptversion='\''*[0-9][1-9.-]*'\''*/ { - s,[#;].*,, - s,^scriptversion='\''*\([0-9.-]*\)'\''*,\1, - s/-/./g - p - } - d' - - func_keyword_update "$1" "$2" "$3" "$my_sed_install" "$4" - - return $my_return_status -} - - -# func_massage_aclocal_DATA [glob_exclude] -# @aclocal_DATA\@ is substituted as per its value in Makefile.am; -# this function massages it into a suitable format for func_copy_some_files. -func_massage_aclocal_DATA () -{ - $opt_debug - pkgmacro_files= # GLOBAL VAR - - my_glob_exclude="$1" - - # Massage a value for pkgmacro_files from the value used in Makefile.am. - for my_filename in m4/argz.m4 m4/libtool.m4 m4/ltdl.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4; do - func_dirname_and_basename "$my_filename" - my_filename=$func_basename_result - - # ignore excluded filenames - if test -n "$my_glob_exclude"; then - my_cont=false - eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac' - $my_cont && continue - fi - - pkgmacro_files="$pkgmacro_files:$my_filename" - done - - # strip spurious leading `:' - pkgmacro_files=`$ECHO "$pkgmacro_files" | $SED 's,^:*,,'` -} - - -# func_install_pkgmacro_subproject -# Unless --quiet was passed, display a message. Then copy pkgmacro_files -# from libtool installation tree to subproject libltdl tree. -func_install_pkgmacro_subproject () -{ - $opt_debug - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgmacro_files; do - test -f "$subproject_macrodir/$file" && func_verbose "rm -f '$subproject_macrodir/$file'" - rm -f "$subproject_macrodir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified a macrodir. - $opt_quiet || if test "x$macrodir" != "x$subproject_macrodir"; then - pkgmacro_header="putting macros in \`$subproject_macrodir'." - elif test -n "$subproject_macrodir"; then - pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$subproject_macrodir'." - fi - - func_copy_some_files "argz.m4:libtool.m4:ltdl.m4:$pkgmacro_files" \ - "$aclocaldir" "$subproject_macrodir" pkgmacro_header -} - - -# func_install_pkgmacro_parent -# Unless --quiet was passed, or AC_CONFIG_MACRO_DIR was not seen, display -# a message. Then update appropriate macros if newer ones are available -# from the libtool installation tree. -func_install_pkgmacro_parent () -{ - $opt_debug - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgmacro_files; do - test -f "$macrodir/$file" && func_verbose "rm -f '$macrodir/$file'" - rm -f "$macrodir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified a macrodir. - $opt_quiet || if test -n "$ac_macrodir"; then - my_pkgmacro_header="putting macros in AC_CONFIG_MACRO_DIR, \`$ac_macrodir'." - elif test -n "$macrodir"; then - my_pkgmacro_header="putting macros in \`$macrodir'." - fi - - if $opt_ltdl; then - func_serial_update argz.m4 "$aclocaldir" "$macrodir" \ - my_pkgmacro_header argz.m4 - else - func_verbose "Not copying \`$macrodir/argz.m4', libltdl not used." - fi - - func_serial_update libtool.m4 "$aclocaldir" "$macrodir" \ - my_pkgmacro_header LT_INIT 'A[CM]_PROG_LIBTOOL' - - if $opt_ltdl; then - func_serial_update ltdl.m4 "$aclocaldir" "$macrodir" \ - my_pkgmacro_header 'LTDL_INIT' - else - func_verbose "Not copying \`$macrodir/ltdl.m4', libltdl not used." - fi - - my_save_IFS="$IFS" - IFS=: - for file in $pkgmacro_files; do - IFS="$my_save_IFS" - func_serial_update "$file" "$aclocaldir" "$macrodir" \ - my_pkgmacro_header "$file" - done - IFS="$my_save_IFS" -} - - -# func_install_pkgmacro_files -# Install copies of the libtool and libltdl m4 macros into this package. -func_install_pkgmacro_files () -{ - $opt_debug - - # argz.m4, libtool.m4 and ltdl.m4 are handled specially: - func_massage_aclocal_DATA 'argz.m4|libtool.m4|ltdl.m4' - - # 1. Parent has separate macrodir to subproject ltdl: - if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && - test -n "$macrodir" && test "x$macrodir" != "x$subproject_macrodir" - then - func_install_pkgmacro_parent - func_install_pkgmacro_subproject - - # 2. Parent shares macrodir with subproject ltdl: - elif $opt_ltdl && test "x$ltdl_mode" = "xsubproject" - # && test "x$macrodir" = "x$subproject_macrodir" - then - func_install_pkgmacro_subproject - - # 3. Not a subproject, but macrodir was specified in parent: - elif test -n "$macrodir"; then - func_install_pkgmacro_parent - - # 4. AC_CONFIG_MACRO_DIR was not specified: - else - func_verbose "AC_CONFIG_MACRO_DIR not defined, not copying libtool macros." - fi -} - - -# func_massage_pkgltdl_files [glob_exclude] -# @pkgltdl_files\@ is substituted as per its value in Makefile.am; this -# function massages it into a suitable format for func_copy_some_files. -func_massage_pkgltdl_files () -{ - $opt_debug - pkgltdl_files= # GLOBAL VAR - - my_glob_exclude="$1" - - # Massage a value for pkgltdl_files from the value used in Makefile.am - for my_filename in libltdl/COPYING.LIB libltdl/README libltdl/Makefile.inc libltdl/Makefile.am libltdl/configure.ac libltdl/aclocal.m4 libltdl/Makefile.in libltdl/config-h.in libltdl/configure libltdl/argz_.h libltdl/argz.c libltdl/loaders/dld_link.c libltdl/loaders/dlopen.c libltdl/loaders/dyld.c libltdl/loaders/load_add_on.c libltdl/loaders/loadlibrary.c libltdl/loaders/shl_load.c libltdl/lt__dirent.c libltdl/lt__strl.c libltdl/libltdl/lt__alloc.h libltdl/libltdl/lt__dirent.h libltdl/libltdl/lt__glibc.h libltdl/libltdl/lt__private.h libltdl/libltdl/lt__strl.h libltdl/libltdl/lt_dlloader.h libltdl/libltdl/lt_error.h libltdl/libltdl/lt_system.h libltdl/libltdl/slist.h libltdl/loaders/preopen.c libltdl/lt__alloc.c libltdl/lt_dlloader.c libltdl/lt_error.c libltdl/ltdl.c libltdl/ltdl.h libltdl/slist.c; do - - # Strip surplus leading 'libltdl/': - my_filename=`expr "X$my_filename" : 'Xlibltdl/\(.*\)'` - - # ignore excluded filenames - if test -n "$my_glob_exclude"; then - my_cont=false - eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac' - $my_cont && continue - fi - - # ignore duplicates - case :$pkgltdl_files: in - *:$my_filename:*) ;; - *) pkgltdl_files="$pkgltdl_files:$my_filename" ;; - esac - done - - # strip spurious leading `:' - pkgltdl_files=`$ECHO "$pkgltdl_files" | $SED 's,^:*,,'` -} - - -# func_install_pkgltdl_files -# Install copies of the libltdl files into this package. Any auxiliary -# or m4 macro files needed in the libltdl tree will also be copied by -# func_install_pkgconfig_files and func_install_pkgmacro_files resp. -func_install_pkgltdl_files () -{ - $opt_debug - $opt_ltdl || return - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgltdl_files; do - test -f "$ltdldir/$file" && func_verbose "rm -f '$ltdldir/$file'" - rm -f "$ltdldir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified `--ltdl'. - $opt_quiet || if test -n "$ac_ltdldir"; then - pkgltdl_header="putting libltdl files in LT_CONFIG_LTDL_DIR, \`$ac_ltdldir'." - elif test -n "$ltdldir"; then - pkgltdl_header="putting libltdl files in \`$ltdldir'." - fi - - # These files are handled specially, depending on ltdl_mode: - if test "x$ltdl_mode" = "xsubproject"; then - func_massage_pkgltdl_files 'Makefile.inc' - else - func_massage_pkgltdl_files 'Makefile.am|Makefile.in*|aclocal.m4|config*' - fi - - func_copy_some_files "$pkgltdl_files" \ - "$pkgltdldir/libltdl" "$ltdldir" pkgltdl_header - - # For recursive ltdl modes, copy a suitable Makefile.{am,inc}: - case $ltdl_mode in - recursive) - func_fixup_Makefile "Makefile.am" "$pkgltdldir/libltdl" "$ltdldir" - ;; - nonrecursive) - func_fixup_Makefile "Makefile.inc" "$pkgltdldir/libltdl" "$ltdldir" - ;; - esac -} - - -# func_massage_pkgconfig_files [glob_exclude] -# @pkgconfig_files\@ is substituted as per its value in Makefile.am; this -# function massages it into a suitable format for func_copy_some_files. -func_massage_pkgconfig_files () -{ - $opt_debug - pkgconfig_files= # GLOBAL VAR - - my_glob_exclude="$1" - - # Massage a value for pkgconfig_files from the value used in Makefile.am - for my_filename in config/compile config/config.guess config/config.sub config/depcomp config/install-sh config/missing config/ltmain.sh; do - - # ignore excluded filenames - if test -n "$my_glob_exclude"; then - my_cont=false - eval 'case $my_filename in '$my_glob_exclude') my_cont=: ;; esac' - $my_cont && continue - fi - - # ignore duplicates - case :$pkgconfig_files: in - *:$my_filename:*) ;; - *) pkgconfig_files="$pkgconfig_files:$my_filename" ;; - esac - done - - # strip spurious leading `:' - pkgconfig_files=`$ECHO "$pkgconfig_files" | $SED 's,^:*,,'` -} - - -# func_install_pkgconfig_subproject -# Unless --quiet was passed, display a message. Then copy pkgconfig_files -# from libtool installation tree to subproject libltdl tree. -func_install_pkgconfig_subproject () -{ - $opt_debug - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgconfig_files; do - test -f "$subproject_auxdir/$file" && func_verbose "rm -f '$subproject_auxdir/$file'" - rm -f "$subproject_auxdir/$file" - done - - # Copy all the files from installed libltdl to this project, if the - # user specified an auxdir. - $opt_quiet || if test "x$ac_auxdir" = "x$subproject_auxdir"; then - pkgconfig_header="putting auxiliary files in AC_CONFIG_AUX_DIR, \`$subproject_auxdir'." - elif test -n "$auxdir"; then - pkgconfig_header="putting auxiliary files in \`$auxdir'." - fi - - func_copy_some_files "$pkgconfig_files" \ - "$pkgdatadir" "$ltdldir" pkgconfig_header -} - - -# func_install_pkgconfig_parent -# Unless --quiet was passed, or AC_CONFIG_AUX_DIR was not seen, display a -# message. Then update appropriate auxiliary files if newer ones are -# available from the libtool installation tree. -func_install_pkgconfig_parent () -{ - $opt_debug - - # Remove any lingering files that my have been installed by some - # previous libtoolize release: - $opt_force && for file in $all_pkgconfig_files; do - test -f "$auxdir/$file" && func_verbose "rm -f '$auxdir/$file'" - rm -f "$auxdir/$file" - done - - if test -n "$ac_auxdir"; then - pkgconfig_header="putting auxiliary files in AC_CONFIG_AUX_DIR, \`$ac_auxdir'." - elif test -n "$auxdir" || test "x$ltdldir" = "x."; then - pkgconfig_header="putting auxiliary files in \`$auxdir'." - fi - - if $opt_install; then - func_config_update config.guess \ - "$pkgdatadir/config" "$auxdir" pkgconfig_header - func_config_update config.sub \ - "$pkgdatadir/config" "$auxdir" pkgconfig_header - func_install_update install-sh \ - "$pkgdatadir/config" "$auxdir" pkgconfig_header - fi - func_ltmain_update ltmain.sh \ - "$pkgdatadir/config" "$auxdir" pkgconfig_header -} - - -# func_install_pkgconfig_files -# Install copies of the auxiliary files into this package according to -# the whether libltdl is included as a subproject, and whether the parent -# shares the AC_CONFIG_AUX_DIR setting. -func_install_pkgconfig_files () -{ - $opt_debug - func_massage_pkgconfig_files - - # 1. Parent shares auxdir with subproject ltdl: - if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && - test "x$ac_auxdir" = "x$subproject_auxdir" - then - func_install_pkgconfig_subproject - - # 2. Parent has separate auxdir to subproject ltdl: - elif $opt_ltdl && test "x$ltdl_mode" = "xsubproject" - # && test "x$auxdir" != "x$subproject_auxdir" is implied - then - if $seen_autoconf; then - func_install_pkgconfig_parent - fi - func_install_pkgconfig_subproject - - # 3. Not subproject, but AC_CONFIG_AUX_DIR was used in parent: - elif test -n "$ac_auxdir" || test "x$auxdir" = "x."; then - func_install_pkgconfig_parent - - # 4. AC_CONFIG_AUX_DIR was not specified: - else - func_verbose "AC_CONFIG_AUX_DIR not defined, not copying libtool auxiliary files." - fi -} - - -# func_nonemptydir_p dirvar -# DIRVAR is the name of a variable to evaluate. Unless DIRVAR names -# a directory that exists and is non-empty abort with a diagnostic. -func_nonemptydir_p () -{ - $opt_debug - my_dirvar="$1" - my_dir=`eval echo "\\\$$my_dirvar"` - - # Is it a directory at all? - test -d "$my_dir" \ - || func_fatal_error "\$$my_dirvar is not a directory: \`$my_dir'" - - # check that the directories contents can be ls'ed - test -n "`{ cd $my_dir && ls; } 2>/dev/null`" \ - || func_fatal_error "can not list files: \`$my_dir'" -} - - -# func_check_macros -# Sanity check macros from aclocal.m4 against installed versions. -func_check_macros () -{ - $opt_debug - $opt_quiet && return - $seen_autoconf || return - - ac_config_macro_dir_advised=false - - if test -n "$ac_macrodir$ltdldir" && test -z "$macrodir"; then - my_ac_config_macro_srcdir="$aclocaldir" - if $opt_ltdl && test "$macrodir" != "$subproject_macrodir"; then - my_ac_config_macro_srcdir="$subproject_macrodir" - fi - - my_needed="libtool.m4 ltoptions.m4 ltversion.m4 ltsugar.m4 lt~obsolete.m4" - $opt_ltdl && my_needed="$my_needed argz.m4 ltdl.m4" - - if test -f "aclocal.m4"; then - for need in $my_needed; do - func_aclocal_update_check $need - $func_aclocal_update_check_result && my_missing="$my_missing $need" - done - else - my_missing="$my_needed" - fi - - if test -n "$my_missing"; then - func_echo "You should add the contents of the following files to \`aclocal.m4':" - for need in $my_missing; do - func_echo " \`$my_ac_config_macro_srcdir/$need'" - done - - if test "$my_ac_config_macro_srcdir" != "$aclocaldir"; then - func_echo "or else add \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' to $configure_ac." - ac_config_macro_dir_advised=: - fi - fi - fi - - ## ---------------------------------------------------------- ## - ## Since we return early here when --no-warn was given: ## - ## DO NOT PUT ANYTHING BUT UPGRADE ADVICE MESSAGES BELOW HERE ## - ## ---------------------------------------------------------- ## - - $opt_warning || return - - $seen_libtool || - func_echo "Remember to add \`LT_INIT' to $configure_ac." - - # Suggest using LTDL_INIT if appropriate: - $opt_ltdl && if test x$seen_ltdl != x:; then - case $ltdl_mode in - subproject) ltdl_init_args="" ;; - *) ltdl_init_args="([$ltdl_mode])" ;; - esac - func_echo "Remember to add \`LTDL_INIT$ltdl_init_args' to $configure_ac." - fi - - if $opt_ltdl; then - # Remind the user to call LT_CONFIG_LTDL_DIR: - test -n "$ac_ltdldir" || - func_echo "Remember to add \`LT_CONFIG_LTDL_DIR([$ltdldir])' to \`$configure_ac'." - - # For subproject mode, offer some suggestions for avoiding duplicate - # files in a project that uses libltdl: - if test "x$ltdl_mode" = "xsubproject"; then - test "$subproject_auxdir" = "$auxdir" || - func_echo "Consider using \`AC_CONFIG_AUX_DIR([$subproject_auxdir])' in $configure_ac." - $ac_config_macro_dir_advised || test "$subproject_macrodir" = "$macrodir" || - func_echo "Consider using \`AC_CONFIG_MACRO_DIR([$subproject_macrodir])' in $configure_ac." - ac_config_macro_dir_advised=: - fi - fi - - # Suggest modern idioms for storing autoconf macros: - $ac_config_macro_dir_advised || if test -z "$ac_macrodir" || test x"$macrodir" = x.; then - func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([m4])' to $configure_ac and" - func_echo "rerunning $progname, to keep the correct libtool macros in-tree." - ac_config_macro_dir_advised=: - - elif test -z "$ac_macrodir$ltdldir"; then - func_echo "Consider adding \`AC_CONFIG_MACRO_DIR([$macrodir])' to $configure_ac," - func_echo "and rerunning $progname and aclocal." - ac_config_macro_dir_advised=: - fi - - if test -z "$am_macrodir$macrodir"; then - func_echo "Consider adding \`-I m4' to ACLOCAL_AMFLAGS in Makefile.am." - - elif test -z "$am_macrodir"; then - if $opt_ltdl && test "x$ltdl_mode" = "xsubproject" && test "$subproject_macrodir" != "$macrodir"; then - func_echo "Consider adding \`-I $subproject_macrodir' to ACLOCAL_AMFLAGS in Makefile.am." - else - func_echo "Consider adding \`-I $macrodir' to ACLOCAL_AMFLAGS in Makefile.am." - fi - fi - - # Don't trace for this, we're just checking the user didn't invoke it - # directly from configure.ac. - $SED 's,dnl .*$,,; s,# .*$,,' "$configure_ac" | grep AC_PROG_RANLIB >/dev/null && - func_echo "\`AC_PROG_RANLIB' is rendered obsolete by \`LT_INIT'" - - # FIXME: Ensure ltmain.sh, libtool.m4 and ltdl.m4 are from the same release -} - - -## ----------- ## -## Main. ## -## ----------- ## - -{ - # Lists of all files libtoolize has ever installed. These are removed - # before installing the latest files when --force was passed to help - # ensure a clean upgrade. - # Do not remove config.guess nor config.sub, we don't install them - # without --install, and the project may not be using Automake. - all_pkgconfig_files="ltmain.sh" - all_pkgmacro_files="argz.m4 libtool.m4 ltdl.m4 ltoptions.m4 ltsugar.m4 ltversion.in ltversion.m4 lt~obsolete.m4" - all_pkgltdl_files="COPYING.LIB Makefile Makefile.in Makefile.inc Makefile.am README acinclude.m4 aclocal.m4 argz_.h argz.c config.h.in config-h.in configure configure.ac configure.in libltdl/lt__alloc.h libltdl/lt__dirent.h libltdl/lt__glibc.h libltdl/lt__private.h libltdl/lt__strl.h libltdl/lt_dlloader.h libltdl/lt_error.h libltdl/lt_system.h libltdl/slist.h loaders/dld_link.c loaders/dlopen.c loaders/dyld.c loaders/load_add_on.c loaders/loadlibrary.c loaders/preopen.c loaders/shl_load.c lt__alloc.c lt__dirent.c lt__strl.c lt_dlloader.c lt_error.c ltdl.c ltdl.h slist.c" - - # Locations for important files: - prefix=/ - datadir=//share - pkgdatadir=//share/libtool - pkgltdldir=//share/libtool - aclocaldir=//share/aclocal - auxdir= - macrodir= - configure_ac=configure.in - - seen_autoconf=false - seen_libtool=false - seen_ltdl=false - - # test EBCDIC or ASCII - case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - SP2NL='tr \040 \012' - NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - SP2NL='tr \100 \n' - NL2SP='tr \r\n \100\100' - ;; - esac - - # Allow the user to override the master libtoolize repository: - if test -n "$_lt_pkgdatadir"; then - pkgltdldir="$_lt_pkgdatadir" - pkgdatadir="$_lt_pkgdatadir/libltdl" - aclocaldir="$_lt_pkgdatadir/libltdl/m4" - fi - func_nonemptydir_p pkgltdldir - func_nonemptydir_p pkgdatadir - func_nonemptydir_p aclocaldir - - func_scan_files - - case $ltdldir in - .) ltdlprefix= ;; - *) ltdlprefix=$ltdldir/ ;; - esac - subproject_auxdir=${ltdlprefix}config - subproject_macrodir=${ltdlprefix}m4 - - # :::BE CAREFUL HERE::: - # func_check_macros needs to check whether --ltdl was specified when - # LTDL_INIT was not seen, so we can't just use one variable for both - # conditions, or that check will be impossible. No need to clutter the - # rest of the code with '$opt_ltdl || $seen_ltdl' though, because we CAN - # safely set opt_ltdl to true if LTDL_INIT was seen: - $seen_ltdl && opt_ltdl=: - - func_install_pkgconfig_files - func_install_pkgmacro_files - func_install_pkgltdl_files - - func_check_macros -} - -exit $exit_status - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: - diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/m4 b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/m4 deleted file mode 100755 index 34a616201..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/m4 and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/make b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/make deleted file mode 100755 index 35a95860d..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/bin/make and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.a b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.a deleted file mode 100644 index b8c513f30..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.a and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.la b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.la deleted file mode 100755 index 4864bdc9e..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.la +++ /dev/null @@ -1,41 +0,0 @@ -# libltdl.la - a libtool library file -# Generated by libtool (GNU libtool) 2.4.2 -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='libltdl.so.7' - -# Names of this library. -library_names='libltdl.so.7.3.0 libltdl.so.7 libltdl.so' - -# The name of the static archive. -old_library='libltdl.a' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='' - -# Libraries that this one depends upon. -dependency_libs=' -ldl' - -# Names of additional weak libraries provided by this library -weak_library_names='' - -# Version information for libltdl. -current=10 -age=3 -revision=0 - -# Is this an already installed library? -installed=yes - -# Should we warn about portability when linking against -modules? -shouldnotlink=no - -# Files to dlopen/dlpreopen -dlopen='' -dlpreopen='' - -# Directory that this library needs to be installed in: -libdir='/i686-pc-linux-gnu/lib' diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so deleted file mode 120000 index 2fac5cb73..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so +++ /dev/null @@ -1 +0,0 @@ -libltdl.so.7.3.0 \ No newline at end of file diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7 b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7 deleted file mode 120000 index 2fac5cb73..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7 +++ /dev/null @@ -1 +0,0 @@ -libltdl.so.7.3.0 \ No newline at end of file diff --git a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7.3.0 b/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7.3.0 deleted file mode 100755 index 3ef80f635..000000000 Binary files a/third_party/nlbuild-autotools/repo/tools/host/i686-pc-linux-gnu/lib/libltdl.so.7.3.0 and /dev/null differ diff --git a/third_party/nlbuild-autotools/repo/tools/host/include/libltdl/lt_dlloader.h b/third_party/nlbuild-autotools/repo/tools/host/include/libltdl/lt_dlloader.h deleted file mode 100644 index 589fd0dc3..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/include/libltdl/lt_dlloader.h +++ /dev/null @@ -1,90 +0,0 @@ -/* lt_dlloader.h -- dynamic library loader interface - - Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc. - Written by Gary V. Vaughan, 2004 - - NOTE: The canonical source of this file is maintained with the - GNU Libtool package. Report bugs to bug-libtool@gnu.org. - -GNU Libltdl is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -As a special exception to the GNU Lesser General Public License, -if you distribute this file as part of a program or library that -is built using GNU Libtool, you may include this file under the -same distribution terms that you use for the rest of that program. - -GNU Libltdl 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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with GNU Libltdl; see the file COPYING.LIB. If not, a -copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, -or obtained by writing to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#if !defined(LT_DLLOADER_H) -#define LT_DLLOADER_H 1 - -#include - -LT_BEGIN_C_DECLS - -typedef void * lt_dlloader; -typedef void * lt_module; -typedef void * lt_user_data; -typedef struct lt__advise * lt_dladvise; - -/* Function pointer types for module loader vtable entries: */ -typedef lt_module lt_module_open (lt_user_data data, - const char *filename, - lt_dladvise advise); -typedef int lt_module_close (lt_user_data data, - lt_module module); -typedef void * lt_find_sym (lt_user_data data, lt_module module, - const char *symbolname); -typedef int lt_dlloader_init (lt_user_data data); -typedef int lt_dlloader_exit (lt_user_data data); - -/* Default priority is LT_DLLOADER_PREPEND if none is explicitly given. */ -typedef enum { - LT_DLLOADER_PREPEND = 0, LT_DLLOADER_APPEND -} lt_dlloader_priority; - -/* This structure defines a module loader, as populated by the get_vtable - entry point of each loader. */ -typedef struct { - const char * name; - const char * sym_prefix; - lt_module_open * module_open; - lt_module_close * module_close; - lt_find_sym * find_sym; - lt_dlloader_init * dlloader_init; - lt_dlloader_exit * dlloader_exit; - lt_user_data dlloader_data; - lt_dlloader_priority priority; -} lt_dlvtable; - -LT_SCOPE int lt_dlloader_add (const lt_dlvtable *vtable); -LT_SCOPE lt_dlloader lt_dlloader_next (const lt_dlloader loader); - -LT_SCOPE lt_dlvtable * lt_dlloader_remove (const char *name); -LT_SCOPE const lt_dlvtable *lt_dlloader_find (const char *name); -LT_SCOPE const lt_dlvtable *lt_dlloader_get (lt_dlloader loader); - - -/* Type of a function to get a loader's vtable: */ -typedef const lt_dlvtable *lt_get_vtable (lt_user_data data); - -#ifdef LT_DEBUG_LOADERS -LT_SCOPE void lt_dlloader_dump (void); -#endif - -LT_END_C_DECLS - -#endif /*!defined(LT_DLLOADER_H)*/ diff --git a/third_party/nlbuild-autotools/repo/tools/host/include/libltdl/lt_error.h b/third_party/nlbuild-autotools/repo/tools/host/include/libltdl/lt_error.h deleted file mode 100644 index e789b3a4e..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/include/libltdl/lt_error.h +++ /dev/null @@ -1,85 +0,0 @@ -/* lt_error.h -- error propogation interface - - Copyright (C) 1999, 2000, 2001, 2004, 2007 Free Software Foundation, Inc. - Written by Thomas Tanner, 1999 - - NOTE: The canonical source of this file is maintained with the - GNU Libtool package. Report bugs to bug-libtool@gnu.org. - -GNU Libltdl is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -As a special exception to the GNU Lesser General Public License, -if you distribute this file as part of a program or library that -is built using GNU Libtool, you may include this file under the -same distribution terms that you use for the rest of that program. - -GNU Libltdl 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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with GNU Libltdl; see the file COPYING.LIB. If not, a -copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, -or obtained by writing to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -/* Only include this header file once. */ -#if !defined(LT_ERROR_H) -#define LT_ERROR_H 1 - -#include - -LT_BEGIN_C_DECLS - -/* Defining error strings alongside their symbolic names in a macro in - this way allows us to expand the macro in different contexts with - confidence that the enumeration of symbolic names will map correctly - onto the table of error strings. \0 is appended to the strings to - expilicitely initialize the string terminator. */ -#define lt_dlerror_table \ - LT_ERROR(UNKNOWN, "unknown error\0") \ - LT_ERROR(DLOPEN_NOT_SUPPORTED, "dlopen support not available\0") \ - LT_ERROR(INVALID_LOADER, "invalid loader\0") \ - LT_ERROR(INIT_LOADER, "loader initialization failed\0") \ - LT_ERROR(REMOVE_LOADER, "loader removal failed\0") \ - LT_ERROR(FILE_NOT_FOUND, "file not found\0") \ - LT_ERROR(DEPLIB_NOT_FOUND, "dependency library not found\0") \ - LT_ERROR(NO_SYMBOLS, "no symbols defined\0") \ - LT_ERROR(CANNOT_OPEN, "can't open the module\0") \ - LT_ERROR(CANNOT_CLOSE, "can't close the module\0") \ - LT_ERROR(SYMBOL_NOT_FOUND, "symbol not found\0") \ - LT_ERROR(NO_MEMORY, "not enough memory\0") \ - LT_ERROR(INVALID_HANDLE, "invalid module handle\0") \ - LT_ERROR(BUFFER_OVERFLOW, "internal buffer overflow\0") \ - LT_ERROR(INVALID_ERRORCODE, "invalid errorcode\0") \ - LT_ERROR(SHUTDOWN, "library already shutdown\0") \ - LT_ERROR(CLOSE_RESIDENT_MODULE, "can't close resident module\0") \ - LT_ERROR(INVALID_MUTEX_ARGS, "internal error (code withdrawn)\0")\ - LT_ERROR(INVALID_POSITION, "invalid search path insert position\0")\ - LT_ERROR(CONFLICTING_FLAGS, "symbol visibility can be global or local\0") - -/* Enumerate the symbolic error names. */ -enum { -#define LT_ERROR(name, diagnostic) LT_CONC(LT_ERROR_, name), - lt_dlerror_table -#undef LT_ERROR - - LT_ERROR_MAX -}; - -/* Should be max of the error string lengths above (plus one for C++) */ -#define LT_ERROR_LEN_MAX (41) - -/* These functions are only useful from inside custom module loaders. */ -LT_SCOPE int lt_dladderror (const char *diagnostic); -LT_SCOPE int lt_dlseterror (int errorcode); - - -LT_END_C_DECLS - -#endif /*!defined(LT_ERROR_H)*/ diff --git a/third_party/nlbuild-autotools/repo/tools/host/include/libltdl/lt_system.h b/third_party/nlbuild-autotools/repo/tools/host/include/libltdl/lt_system.h deleted file mode 100644 index f1545ce3d..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/include/libltdl/lt_system.h +++ /dev/null @@ -1,166 +0,0 @@ -/* lt_system.h -- system portability abstraction layer - - Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc. - Written by Gary V. Vaughan, 2004 - - NOTE: The canonical source of this file is maintained with the - GNU Libtool package. Report bugs to bug-libtool@gnu.org. - -GNU Libltdl is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -As a special exception to the GNU Lesser General Public License, -if you distribute this file as part of a program or library that -is built using GNU Libtool, you may include this file under the -same distribution terms that you use for the rest of that program. - -GNU Libltdl 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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with GNU Libltdl; see the file COPYING.LIB. If not, a -copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, -or obtained by writing to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#if !defined(LT_SYSTEM_H) -#define LT_SYSTEM_H 1 - -#include -#include -#include - -/* Some systems do not define EXIT_*, even with STDC_HEADERS. */ -#if !defined(EXIT_SUCCESS) -# define EXIT_SUCCESS 0 -#endif -#if !defined(EXIT_FAILURE) -# define EXIT_FAILURE 1 -#endif - -/* Just pick a big number... */ -#define LT_FILENAME_MAX 2048 - - -/* Saves on those hard to debug '\0' typos.... */ -#define LT_EOS_CHAR '\0' - -/* LTDL_BEGIN_C_DECLS should be used at the beginning of your declarations, - so that C++ compilers don't mangle their names. Use LTDL_END_C_DECLS at - the end of C declarations. */ -#if defined(__cplusplus) -# define LT_BEGIN_C_DECLS extern "C" { -# define LT_END_C_DECLS } -#else -# define LT_BEGIN_C_DECLS /* empty */ -# define LT_END_C_DECLS /* empty */ -#endif - -/* LT_STMT_START/END are used to create macros which expand to a - a single compound statement in a portable way. */ -#if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) -# define LT_STMT_START (void)( -# define LT_STMT_END ) -#else -# if (defined (sun) || defined (__sun__)) -# define LT_STMT_START if (1) -# define LT_STMT_END else (void)0 -# else -# define LT_STMT_START do -# define LT_STMT_END while (0) -# endif -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -/* Canonicalise Windows and Cygwin recognition macros. - To match the values set by recent Cygwin compilers, make sure that if - __CYGWIN__ is defined (after canonicalisation), __WINDOWS__ is NOT! */ -#if defined(__CYGWIN32__) && !defined(__CYGWIN__) -# define __CYGWIN__ __CYGWIN32__ -#endif -#if defined(__CYGWIN__) -# if defined(__WINDOWS__) -# undef __WINDOWS__ -# endif -#elif defined(_WIN32) -# define __WINDOWS__ _WIN32 -#elif defined(WIN32) -# define __WINDOWS__ WIN32 -#endif -#if defined(__CYGWIN__) && defined(__WINDOWS__) -# undef __WINDOWS__ -#endif - - -/* DLL building support on win32 hosts; mostly to workaround their - ridiculous implementation of data symbol exporting. */ -#if !defined(LT_SCOPE) -# if defined(__WINDOWS__) || defined(__CYGWIN__) -# if defined(DLL_EXPORT) /* defined by libtool (if required) */ -# define LT_SCOPE extern __declspec(dllexport) -# endif -# if defined(LIBLTDL_DLL_IMPORT) /* define if linking with this dll */ - /* note: cygwin/mingw compilers can rely instead on auto-import */ -# define LT_SCOPE extern __declspec(dllimport) -# endif -# endif -# if !defined(LT_SCOPE) /* static linking or !__WINDOWS__ */ -# define LT_SCOPE extern -# endif -#endif - -#if defined(__WINDOWS__) -/* LT_DIRSEP_CHAR is accepted *in addition* to '/' as a directory - separator when it is set. */ -# define LT_DIRSEP_CHAR '\\' -# define LT_PATHSEP_CHAR ';' -#else -# define LT_PATHSEP_CHAR ':' -#endif - -#if defined(_MSC_VER) /* Visual Studio */ -# define R_OK 4 -#endif - -/* fopen() mode flags for reading a text file */ -#undef LT_READTEXT_MODE -#if defined(__WINDOWS__) || defined(__CYGWIN__) -# define LT_READTEXT_MODE "rt" -#else -# define LT_READTEXT_MODE "r" -#endif - -/* The extra indirection to the LT__STR and LT__CONC macros is required so - that if the arguments to LT_STR() (or LT_CONC()) are themselves macros, - they will be expanded before being quoted. */ -#ifndef LT_STR -# define LT__STR(arg) #arg -# define LT_STR(arg) LT__STR(arg) -#endif - -#ifndef LT_CONC -# define LT__CONC(a, b) a##b -# define LT_CONC(a, b) LT__CONC(a, b) -#endif -#ifndef LT_CONC3 -# define LT__CONC3(a, b, c) a##b##c -# define LT_CONC3(a, b, c) LT__CONC3(a, b, c) -#endif - -#endif /*!defined(LT_SYSTEM_H)*/ diff --git a/third_party/nlbuild-autotools/repo/tools/host/include/ltdl.h b/third_party/nlbuild-autotools/repo/tools/host/include/ltdl.h deleted file mode 100644 index 749a54d68..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/include/ltdl.h +++ /dev/null @@ -1,163 +0,0 @@ -/* ltdl.h -- generic dlopen functions - - Copyright (C) 1998-2000, 2004, 2005, - 2007, 2008 Free Software Foundation, Inc. - Written by Thomas Tanner, 1998 - - NOTE: The canonical source of this file is maintained with the - GNU Libtool package. Report bugs to bug-libtool@gnu.org. - -GNU Libltdl is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2 of the License, or (at your option) any later version. - -As a special exception to the GNU Lesser General Public License, -if you distribute this file as part of a program or library that -is built using GNU Libtool, you may include this file under the -same distribution terms that you use for the rest of that program. - -GNU Libltdl 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 Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with GNU Libltdl; see the file COPYING.LIB. If not, a -copy can be downloaded from http://www.gnu.org/licenses/lgpl.html, -or obtained by writing to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -/* Only include this header file once. */ -#if !defined(LTDL_H) -#define LTDL_H 1 - -#include -#include -#include - -LT_BEGIN_C_DECLS - - -/* LT_STRLEN can be used safely on NULL pointers. */ -#define LT_STRLEN(s) (((s) && (s)[0]) ? strlen (s) : 0) - - -/* --- DYNAMIC MODULE LOADING API --- */ - - -typedef struct lt__handle *lt_dlhandle; /* A loaded module. */ - -/* Initialisation and finalisation functions for libltdl. */ -LT_SCOPE int lt_dlinit (void); -LT_SCOPE int lt_dlexit (void); - -/* Module search path manipulation. */ -LT_SCOPE int lt_dladdsearchdir (const char *search_dir); -LT_SCOPE int lt_dlinsertsearchdir (const char *before, - const char *search_dir); -LT_SCOPE int lt_dlsetsearchpath (const char *search_path); -LT_SCOPE const char *lt_dlgetsearchpath (void); -LT_SCOPE int lt_dlforeachfile ( - const char *search_path, - int (*func) (const char *filename, void *data), - void *data); - -/* User module loading advisors. */ -LT_SCOPE int lt_dladvise_init (lt_dladvise *advise); -LT_SCOPE int lt_dladvise_destroy (lt_dladvise *advise); -LT_SCOPE int lt_dladvise_ext (lt_dladvise *advise); -LT_SCOPE int lt_dladvise_resident (lt_dladvise *advise); -LT_SCOPE int lt_dladvise_local (lt_dladvise *advise); -LT_SCOPE int lt_dladvise_global (lt_dladvise *advise); -LT_SCOPE int lt_dladvise_preload (lt_dladvise *advise); - -/* Portable libltdl versions of the system dlopen() API. */ -LT_SCOPE lt_dlhandle lt_dlopen (const char *filename); -LT_SCOPE lt_dlhandle lt_dlopenext (const char *filename); -LT_SCOPE lt_dlhandle lt_dlopenadvise (const char *filename, - lt_dladvise advise); -LT_SCOPE void * lt_dlsym (lt_dlhandle handle, const char *name); -LT_SCOPE const char *lt_dlerror (void); -LT_SCOPE int lt_dlclose (lt_dlhandle handle); - - - -/* --- PRELOADED MODULE SUPPORT --- */ - - -/* A preopened symbol. Arrays of this type comprise the exported - symbols for a dlpreopened module. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; - -typedef int lt_dlpreload_callback_func (lt_dlhandle handle); - -LT_SCOPE int lt_dlpreload (const lt_dlsymlist *preloaded); -LT_SCOPE int lt_dlpreload_default (const lt_dlsymlist *preloaded); -LT_SCOPE int lt_dlpreload_open (const char *originator, - lt_dlpreload_callback_func *func); - -#define lt_preloaded_symbols lt__PROGRAM__LTX_preloaded_symbols -/* Ensure C linkage. */ -extern LT_DLSYM_CONST lt_dlsymlist lt__PROGRAM__LTX_preloaded_symbols[]; - -#define LTDL_SET_PRELOADED_SYMBOLS() \ - lt_dlpreload_default(lt_preloaded_symbols) - - - - -/* --- MODULE INFORMATION --- */ - - -/* Associating user data with loaded modules. */ -typedef void * lt_dlinterface_id; -typedef int lt_dlhandle_interface (lt_dlhandle handle, const char *id_string); - -LT_SCOPE lt_dlinterface_id lt_dlinterface_register (const char *id_string, - lt_dlhandle_interface *iface); -LT_SCOPE void lt_dlinterface_free (lt_dlinterface_id key); -LT_SCOPE void * lt_dlcaller_set_data (lt_dlinterface_id key, - lt_dlhandle handle, void *data); -LT_SCOPE void * lt_dlcaller_get_data (lt_dlinterface_id key, - lt_dlhandle handle); - - -/* Read only information pertaining to a loaded module. */ -typedef struct { - char * filename; /* file name */ - char * name; /* module name */ - int ref_count; /* number of times lt_dlopened minus - number of times lt_dlclosed. */ - unsigned int is_resident:1; /* module can't be unloaded. */ - unsigned int is_symglobal:1; /* module symbols can satisfy - subsequently loaded modules. */ - unsigned int is_symlocal:1; /* module symbols are only available - locally. */ -} lt_dlinfo; - -LT_SCOPE const lt_dlinfo *lt_dlgetinfo (lt_dlhandle handle); - -LT_SCOPE lt_dlhandle lt_dlhandle_iterate (lt_dlinterface_id iface, - lt_dlhandle place); -LT_SCOPE lt_dlhandle lt_dlhandle_fetch (lt_dlinterface_id iface, - const char *module_name); -LT_SCOPE int lt_dlhandle_map (lt_dlinterface_id iface, - int (*func) (lt_dlhandle handle, void *data), - void *data); - - - -/* Deprecated module residency management API. */ -LT_SCOPE int lt_dlmakeresident (lt_dlhandle handle); -LT_SCOPE int lt_dlisresident (lt_dlhandle handle); - -#define lt_ptr void * - -LT_END_C_DECLS - -#endif /*!defined(LTDL_H)*/ diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/amversion.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/amversion.m4 deleted file mode 100644 index 0454321f6..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/amversion.m4 +++ /dev/null @@ -1,37 +0,0 @@ -## -*- Autoconf -*- -## Generated from amversion.in; do not edit by hand. -# Copyright (C) 2002-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_AUTOMAKE_VERSION(VERSION) -# ---------------------------- -# Automake X.Y traces this macro to ensure aclocal.m4 has been -# generated from the m4 files accompanying Automake X.Y. -# (This private macro should not be called outside this file.) -AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.14' -dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to -dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.14.1], [], - [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl -]) - -# _AM_AUTOCONF_VERSION(VERSION) -# ----------------------------- -# aclocal traces this macro to find the Autoconf version. -# This is a private macro too. Using m4_define simplifies -# the logic in aclocal, which can simply ignore this definition. -m4_define([_AM_AUTOCONF_VERSION], []) - -# AM_SET_CURRENT_AUTOMAKE_VERSION -# ------------------------------- -# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. -AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.14.1])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/ar-lib.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/ar-lib.m4 deleted file mode 100644 index 58726d0b0..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/ar-lib.m4 +++ /dev/null @@ -1,60 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 2011-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_AR([ACT-IF-FAIL]) -# ------------------------- -# Try to determine the archiver interface, and trigger the ar-lib wrapper -# if it is needed. If the detection of archiver interface fails, run -# ACT-IF-FAIL (default is to abort configure with a proper error message). -AC_DEFUN([AM_PROG_AR], -[AC_BEFORE([$0], [LT_INIT])dnl -AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl -AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([ar-lib])dnl -AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) -: ${AR=ar} - -AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], - [AC_LANG_PUSH([C]) - am_cv_ar_interface=ar - AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], - [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=ar - else - am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([am_ar_try]) - if test "$ac_status" -eq 0; then - am_cv_ar_interface=lib - else - am_cv_ar_interface=unknown - fi - fi - rm -f conftest.lib libconftest.a - ]) - AC_LANG_POP([C])]) - -case $am_cv_ar_interface in -ar) - ;; -lib) - # Microsoft lib, so override with the ar-lib wrapper script. - # FIXME: It is wrong to rewrite AR. - # 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__AR in this case, - # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something - # similar. - AR="$am_aux_dir/ar-lib $AR" - ;; -unknown) - m4_default([$1], - [AC_MSG_ERROR([could not determine $AR interface])]) - ;; -esac -AC_SUBST([AR])dnl -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/as.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/as.m4 deleted file mode 100644 index 46695dd85..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/as.m4 +++ /dev/null @@ -1,19 +0,0 @@ -# Figure out how to run the assembler. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_AS -# ---------- -AC_DEFUN([AM_PROG_AS], -[# By default we simply use the C compiler to build assembly code. -AC_REQUIRE([AC_PROG_CC]) -test "${CCAS+set}" = set || CCAS=$CC -test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS -AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) -AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) -_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/auxdir.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/auxdir.m4 deleted file mode 100644 index a34f38ef4..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/auxdir.m4 +++ /dev/null @@ -1,52 +0,0 @@ -# AM_AUX_DIR_EXPAND -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to -# '$srcdir', '$srcdir/..', or '$srcdir/../..'. -# -# Of course, Automake must honor this variable whenever it calls a -# tool from the auxiliary directory. The problem is that $srcdir (and -# therefore $ac_aux_dir as well) can be either absolute or relative, -# depending on how configure is run. This is pretty annoying, since -# it makes $ac_aux_dir quite unusable in subdirectories: in the top -# source directory, any form will work fine, but in subdirectories a -# relative path needs to be adjusted first. -# -# $ac_aux_dir/missing -# fails when called from a subdirectory if $ac_aux_dir is relative -# $top_srcdir/$ac_aux_dir/missing -# fails if $ac_aux_dir is absolute, -# fails when called from a subdirectory in a VPATH build with -# a relative $ac_aux_dir -# -# The reason of the latter failure is that $top_srcdir and $ac_aux_dir -# are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is '.', but things will broke when you -# start a VPATH build or use an absolute $srcdir. -# -# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, -# iff we strip the leading $srcdir from $ac_aux_dir. That would be: -# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` -# and then we would define $MISSING as -# MISSING="\${SHELL} $am_aux_dir/missing" -# This will work as long as MISSING is not called from configure, because -# unfortunately $(top_srcdir) has no meaning in configure. -# However there are other variables, like CC, which are often used in -# configure, and could therefore not use this "fixed" $ac_aux_dir. -# -# Another solution, used here, is to always expand $ac_aux_dir to an -# absolute PATH. The drawback is that using absolute paths prevent a -# configured tree to be moved without reconfiguration. - -AC_DEFUN([AM_AUX_DIR_EXPAND], -[dnl Rely on autoconf to set up CDPATH properly. -AC_PREREQ([2.50])dnl -# expand $ac_aux_dir to an absolute path -am_aux_dir=`cd $ac_aux_dir && pwd` -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/cond-if.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/cond-if.m4 deleted file mode 100644 index b6b372de8..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/cond-if.m4 +++ /dev/null @@ -1,36 +0,0 @@ -# AM_COND_IF -*- Autoconf -*- - -# Copyright (C) 2008-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_COND_IF -# _AM_COND_ELSE -# _AM_COND_ENDIF -# -------------- -# These macros are only used for tracing. -m4_define([_AM_COND_IF]) -m4_define([_AM_COND_ELSE]) -m4_define([_AM_COND_ENDIF]) - -# AM_COND_IF(COND, [IF-TRUE], [IF-FALSE]) -# --------------------------------------- -# If the shell condition COND is true, execute IF-TRUE, otherwise execute -# IF-FALSE. Allow automake to learn about conditional instantiating macros -# (the AC_CONFIG_FOOS). -AC_DEFUN([AM_COND_IF], -[m4_ifndef([_AM_COND_VALUE_$1], - [m4_fatal([$0: no such condition "$1"])])dnl -_AM_COND_IF([$1])dnl -if test -z "$$1_TRUE"; then : - m4_n([$2])[]dnl -m4_ifval([$3], -[_AM_COND_ELSE([$1])dnl -else - $3 -])dnl -_AM_COND_ENDIF([$1])dnl -fi[]dnl -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/cond.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/cond.m4 deleted file mode 100644 index 2f91e0580..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/cond.m4 +++ /dev/null @@ -1,32 +0,0 @@ -# AM_CONDITIONAL -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_CONDITIONAL(NAME, SHELL-CONDITION) -# ------------------------------------- -# Define a conditional. -AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ([2.52])dnl - m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl -AC_SUBST([$1_TRUE])dnl -AC_SUBST([$1_FALSE])dnl -_AM_SUBST_NOTMAKE([$1_TRUE])dnl -_AM_SUBST_NOTMAKE([$1_FALSE])dnl -m4_define([_AM_COND_VALUE_$1], [$2])dnl -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/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/depend.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/depend.m4 deleted file mode 100644 index a34cd5c20..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/depend.m4 +++ /dev/null @@ -1,189 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 1999-2013 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. - - -# 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", "OBJC", "OBJCXX", "UPC", or "GJC". -# 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 - -m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], - [$1], [CXX], [depcc="$CXX" am_compiler_list=], - [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], - [$1], [UPC], [depcc="$UPC" am_compiler_list=], - [$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". - rm -rf conftest.dir - mkdir conftest.dir - # Copy depcomp to subdir because otherwise we won't find it if we're - # using a relative directory. - cp "$am_depcomp" conftest.dir - cd conftest.dir - # We will build objects and dependencies in a subdirectory because - # it helps to detect inapplicable dependency modes. For instance - # both Tru64's cc and ICC support -MD to output dependencies as a - # side effect of compilation, but ICC will put the dependencies in - # the current directory while Tru64 will put them in the object - # directory. - mkdir sub - - am_cv_$1_dependencies_compiler_type=none - if test "$am_compiler_list" = ""; then - am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` - fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - - for depmode in $am_compiler_list; do - # Setup a source with many dependencies, because some compilers - # like to wrap large dependency lists on column 80 (with \), and - # we should not choose a depcomp mode which is confused by this. - # - # We need to recreate these files for each test, as the compiler may - # overwrite some of them when testing with obscure command lines. - # This happens at least with the AIX C compiler. - : > sub/conftest.c - for i in 1 2 3 4 5 6; do - echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h - done - echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - - # 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. Also, some Intel - # versions had trouble with output in subdirs. - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" - case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; - 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 - ;; - msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; - none) break ;; - esac - if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ - depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ - >/dev/null 2>conftest.err && - grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && - grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && - ${MAKE-make} -s -f confmf > /dev/null 2>&1; then - # icc doesn't choke on unknown options, it will just issue warnings - # or remarks (even with -Werror). So we grep stderr for any message - # that says an option was ignored or not supported. - # When given -MP, icc 7.0 and 7.1 complain thusly: - # icc: Command line warning: ignoring option '-M'; no argument required - # The diagnosis changed in icc 8.0: - # icc: Command line remark: option '-MP' not supported - if (grep 'ignoring option' conftest.err || - grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else - am_cv_$1_dependencies_compiler_type=$depmode - break - fi - fi - done - - cd .. - rm -rf conftest.dir -else - am_cv_$1_dependencies_compiler_type=none -fi -]) -AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) -AM_CONDITIONAL([am__fastdep$1], [ - test "x$enable_dependency_tracking" != xno \ - && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) -]) - - -# AM_SET_DEPDIR -# ------------- -# Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES. -AC_DEFUN([AM_SET_DEPDIR], -[AC_REQUIRE([AM_SET_LEADING_DOT])dnl -AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl -]) - - -# AM_DEP_TRACK -# ------------ -AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE([dependency-tracking], [dnl -AS_HELP_STRING( - [--enable-dependency-tracking], - [do not reject slow dependency extractors]) -AS_HELP_STRING( - [--disable-dependency-tracking], - [speeds up one-time build])]) -if test "x$enable_dependency_tracking" != xno; then - am_depcomp="$ac_aux_dir/depcomp" - AMDEPBACKSLASH='\' - am__nodep='_no' -fi -AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) -AC_SUBST([AMDEPBACKSLASH])dnl -_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl -AC_SUBST([am__nodep])dnl -_AM_SUBST_NOTMAKE([am__nodep])dnl -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/depout.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/depout.m4 deleted file mode 100644 index c79d04bb7..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/depout.m4 +++ /dev/null @@ -1,75 +0,0 @@ -# Generate code to set up dependency tracking. -*- Autoconf -*- - -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# _AM_OUTPUT_DEPENDENCY_COMMANDS -# ------------------------------ -AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Older Autoconf quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - 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. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running 'make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "$am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; 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/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/dmalloc.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/dmalloc.m4 deleted file mode 100644 index d8819c9e8..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/dmalloc.m4 +++ /dev/null @@ -1,26 +0,0 @@ -## ----------------------------------- ## -*- Autoconf -*- -## Check if --with-dmalloc was given. ## -## From Franc,ois Pinard ## -## ----------------------------------- ## - -# Copyright (C) 1996-2013 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. - -AC_DEFUN([AM_WITH_DMALLOC], -[AC_MSG_CHECKING([if malloc debugging is wanted]) -AC_ARG_WITH([dmalloc], -[AS_HELP_STRING([--with-dmalloc], - [use dmalloc, as in http://www.dmalloc.com])], -[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])]) -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/extra-recurs.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/extra-recurs.m4 deleted file mode 100644 index 02cc53fc1..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/extra-recurs.m4 +++ /dev/null @@ -1,16 +0,0 @@ -# AM_EXTRA_RECURSIVE_TARGETS -*- Autoconf -*- - -# Copyright (C) 2012-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_EXTRA_RECURSIVE_TARGETS -# -------------------------- -# Define the list of user recursive targets. This macro exists only to -# be traced by Automake, which will ensure that a proper definition of -# user-defined recursive targets (and associated rules) is propagated -# into all the generated Makefiles. -# TODO: We should really reject non-literal arguments here... -AC_DEFUN([AM_EXTRA_RECURSIVE_TARGETS], []) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/gcj.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/gcj.m4 deleted file mode 100644 index aebabc1da..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/gcj.m4 +++ /dev/null @@ -1,18 +0,0 @@ -# Check for Java compiler. -*- Autoconf -*- -# For now we only handle the GNU compiler. - -# Copyright (C) 1999-2013 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. - -AC_DEFUN([AM_PROG_GCJ], -[AC_CHECK_TOOLS([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/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/init.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/init.m4 deleted file mode 100644 index 432ff200c..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/init.m4 +++ /dev/null @@ -1,194 +0,0 @@ -# Do all the work for Automake. -*- Autoconf -*- - -# Copyright (C) 1996-2013 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 macro actually does too much. Some checks are only needed if -# your package does certain things. But this isn't really a big deal. - -dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. -m4_define([AC_PROG_CC], -m4_defn([AC_PROG_CC]) -[_AM_PROG_CC_C_O -]) - -# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) -# AM_INIT_AUTOMAKE([OPTIONS]) -# ----------------------------------------------- -# The call with PACKAGE and VERSION arguments is the old style -# call (pre autoconf-2.50), which is being phased out. PACKAGE -# and VERSION should now be passed to AC_INIT and removed from -# the call to AM_INIT_AUTOMAKE. -# We support both call styles for the transition. After -# the next Automake release, Autoconf can make the AC_INIT -# arguments mandatory, and then we can depend on a new Autoconf -# release and drop the old call support. -AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.65])dnl -dnl Autoconf wants to disallow AM_ names. We explicitly allow -dnl the ones we care about. -m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl -AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl -AC_REQUIRE([AC_PROG_INSTALL])dnl -if test "`cd $srcdir && pwd`" != "`pwd`"; then - # Use -I$(srcdir) only when $(srcdir) != ., so that make's output - # is not polluted with repeated "-I." - AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl - # test to see if srcdir already configured - if test -f $srcdir/config.status; then - AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) - fi -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], -[AC_DIAGNOSE([obsolete], - [$0: two- and three-arguments forms are deprecated.]) -m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl - AC_SUBST([PACKAGE], [$1])dnl - AC_SUBST([VERSION], [$2])], -[_AM_SET_OPTIONS([$1])dnl -dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), - [ok:ok],, - [m4_fatal([AC_INIT should be called with package and version arguments])])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]) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target. The system "awk" is bad on -# some platforms. -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([AC_PROG_MAKE_SET])dnl -AC_REQUIRE([AM_SET_LEADING_DOT])dnl -_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], - [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], - [_AM_PROG_TAR([v7])])]) -_AM_IF_OPTION([no-dependencies],, -[AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES([CC])], - [m4_define([AC_PROG_CC], - m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES([CXX])], - [m4_define([AC_PROG_CXX], - m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES([OBJC])], - [m4_define([AC_PROG_OBJC], - m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], - [_AM_DEPENDENCIES([OBJCXX])], - [m4_define([AC_PROG_OBJCXX], - m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl -]) -AC_REQUIRE([AM_SILENT_RULES])dnl -dnl The testsuite driver may need to know about EXEEXT, so add the -dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This -dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. -AC_CONFIG_COMMANDS_PRE(dnl -[m4_provide_if([_AM_COMPILER_EXEEXT], - [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi]) - -dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not -dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further -dnl mangled by Autoconf and run in a shell conditional statement. -m4_define([_AC_COMPILER_EXEEXT], -m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) - -# When config.status generates a header, we must update the stamp-h file. -# This file resides in the same directory as the config header -# that is generated. The stamp files are numbered to have different names. - -# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the -# loop where config.status creates the headers, so we can generate -# our stamp files there. -AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], -[# Compute $1's index in $config_headers. -_am_arg=$1 -_am_stamp_count=1 -for _am_header in $config_headers :; do - case $_am_header in - $_am_arg | $_am_arg:* ) - break ;; - * ) - _am_stamp_count=`expr $_am_stamp_count + 1` ;; - esac -done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/install-sh.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/install-sh.m4 deleted file mode 100644 index dca2b691c..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/install-sh.m4 +++ /dev/null @@ -1,21 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_SH -# ------------------ -# Define $install_sh. -AC_DEFUN([AM_PROG_INSTALL_SH], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; - *) - install_sh="\${SHELL} $am_aux_dir/install-sh" - esac -fi -AC_SUBST([install_sh])]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/internal/ac-config-macro-dirs.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/internal/ac-config-macro-dirs.m4 deleted file mode 100644 index 268488357..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/internal/ac-config-macro-dirs.m4 +++ /dev/null @@ -1,15 +0,0 @@ -# Support AC_CONFIG_MACRO_DIRS with older autoconf. -*- Autoconf -*- -# FIXME: To be removed in Automake 2.0, once we can assume autoconf -# 2.70 or later. -# FIXME: keep in sync with the contents of the variable -# '$ac_config_macro_dirs_fallback' in aclocal.in. - -# Copyright (C) 2012-2013 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. - -m4_ifndef([AC_CONFIG_MACRO_DIRS], -[m4_defun([_AM_CONFIG_MACRO_DIRS],[])]dnl -[m4_defun([AC_CONFIG_MACRO_DIRS],[_AM_CONFIG_MACRO_DIRS($@)])]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/lead-dot.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/lead-dot.m4 deleted file mode 100644 index 4dd798b93..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/lead-dot.m4 +++ /dev/null @@ -1,19 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 2003-2013 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. - -# Check whether the underlying file-system supports filenames -# with a leading dot. For instance MS-DOS doesn't. -AC_DEFUN([AM_SET_LEADING_DOT], -[rm -rf .tst 2>/dev/null -mkdir .tst 2>/dev/null -if test -d .tst; then - am__leading_dot=. -else - am__leading_dot=_ -fi -rmdir .tst 2>/dev/null -AC_SUBST([am__leading_dot])]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/lex.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/lex.m4 deleted file mode 100644 index d97daa353..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/lex.m4 +++ /dev/null @@ -1,19 +0,0 @@ -## Replacement for AC_PROG_LEX. -*- Autoconf -*- -## by Alexandre Oliva -# Copyright (C) 1998-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_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_PREREQ([2.50])dnl -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/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/lispdir.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/lispdir.m4 deleted file mode 100644 index 4e0c9140d..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/lispdir.m4 +++ /dev/null @@ -1,51 +0,0 @@ -## ------------------------ -*- Autoconf -*- -## Emacs LISP file handling -## From Ulrich Drepper -## Almost entirely rewritten by Alexandre Oliva -## ------------------------ -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PATH_LISPDIR -# --------------- -AC_DEFUN([AM_PATH_LISPDIR], -[AC_PREREQ([2.60])dnl - # 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]) - AC_ARG_VAR([EMACS], [the Emacs editor command]) - AC_ARG_VAR([EMACSLOADPATH], [the Emacs library search path]) - AC_ARG_WITH([lispdir], - [AS_HELP_STRING([--with-lispdir], - [override the default lisp directory])], - [ lispdir="$withval" - AC_MSG_CHECKING([where .elc files should go]) - AC_MSG_RESULT([$lispdir])], - [ - AC_CACHE_CHECK([where .elc files should go], [am_cv_lispdir], [ - if test $EMACS != "no"; then - if test x${lispdir+set} != xset; then - # 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,.*/lib/\(x*emacs/site-lisp\)$,${libdir}/\1,;p;q;}' \ - -e '/.*\/share\/x*emacs\/site-lisp$/{s,.*/share/\(x*emacs/site-lisp\),${datarootdir}/\1,;p;q;}' \ - conftest.out` - rm conftest.out - fi - fi - test -z "$am_cv_lispdir" && am_cv_lispdir='${datadir}/emacs/site-lisp' - ]) - lispdir="$am_cv_lispdir" -]) -AC_SUBST([lispdir]) -])# AM_PATH_LISPDIR diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/maintainer.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/maintainer.m4 deleted file mode 100644 index fc98244ec..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/maintainer.m4 +++ /dev/null @@ -1,35 +0,0 @@ -# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- -# From Jim Meyering - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAINTAINER_MODE([DEFAULT-MODE]) -# ---------------------------------- -# Control maintainer-specific portions of Makefiles. -# Default is to disable them, unless 'enable' is passed literally. -# For symmetry, 'disable' may be passed as well. Anyway, the user -# can override the default with the --enable/--disable switch. -AC_DEFUN([AM_MAINTAINER_MODE], -[m4_case(m4_default([$1], [disable]), - [enable], [m4_define([am_maintainer_other], [disable])], - [disable], [m4_define([am_maintainer_other], [enable])], - [m4_define([am_maintainer_other], [enable]) - m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) -AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) - dnl maintainer-mode's default is 'disable' unless 'enable' is passed - AC_ARG_ENABLE([maintainer-mode], - [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], - am_maintainer_other[ make rules and dependencies not useful - (and sometimes confusing) to the casual installer])], - [USE_MAINTAINER_MODE=$enableval], - [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) - AC_MSG_RESULT([$USE_MAINTAINER_MODE]) - AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) - MAINT=$MAINTAINER_MODE_TRUE - AC_SUBST([MAINT])dnl -] -) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/make.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/make.m4 deleted file mode 100644 index 3412d1714..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/make.m4 +++ /dev/null @@ -1,49 +0,0 @@ -# Check to see how 'make' treats includes. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_MAKE_INCLUDE() -# ----------------- -# Check to see how make treats includes. -AC_DEFUN([AM_MAKE_INCLUDE], -[am_make=${MAKE-make} -cat > confinc << 'END' -am__doit: - @echo this is the am__doit target -.PHONY: am__doit -END -# If we don't find an include directive, just comment out the code. -AC_MSG_CHECKING([for style of include used by $am_make]) -am__include="#" -am__quote= -_am_result=none -# First try GNU make style include. -echo "include confinc" > confmf -# Ignore all kinds of additional output from 'make'. -case `$am_make -s -f confmf 2> /dev/null` in #( -*the\ am__doit\ target*) - am__include=include - am__quote= - _am_result=GNU - ;; -esac -# Now try BSD make style include. -if test "$am__include" = "#"; then - echo '.include "confinc"' > confmf - case `$am_make -s -f confmf 2> /dev/null` in #( - *the\ am__doit\ target*) - am__include=.include - am__quote="\"" - _am_result=BSD - ;; - esac -fi -AC_SUBST([am__include]) -AC_SUBST([am__quote]) -AC_MSG_RESULT([$_am_result]) -rm -f confinc confmf -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/missing.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/missing.m4 deleted file mode 100644 index 6dea461d4..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/missing.m4 +++ /dev/null @@ -1,38 +0,0 @@ -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_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 is modern enough. -# If it is, set am_missing_run to use it, otherwise, to nothing. -AC_DEFUN([AM_MISSING_HAS_RUN], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([missing])dnl -if test x"${MISSING+set}" != xset; then - case $am_aux_dir in - *\ * | *\ *) - MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; - *) - MISSING="\${SHELL} $am_aux_dir/missing" ;; - esac -fi -# Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " -else - am_missing_run= - AC_MSG_WARN(['missing' script is too old or missing]) -fi -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/mkdirp.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/mkdirp.m4 deleted file mode 100644 index 0b90d2c0a..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/mkdirp.m4 +++ /dev/null @@ -1,32 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 2003-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_MKDIR_P -# --------------- -# Check for 'mkdir -p'. -AC_DEFUN([AM_PROG_MKDIR_P], -[AC_PREREQ([2.60])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -dnl FIXME we are no longer going to remove this! adjust warning -dnl FIXME message accordingly. -AC_DIAGNOSE([obsolete], -[$0: this macro is deprecated, and will soon be removed. -You should use the Autoconf-provided 'AC][_PROG_MKDIR_P' macro instead, -and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.]) -dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, -dnl while keeping a definition of mkdir_p for backward compatibility. -dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. -dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of -dnl Makefile.ins that do not define MKDIR_P, so we do our own -dnl adjustment using top_builddir (which is defined more often than -dnl MKDIR_P). -AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl -case $mkdir_p in - [[\\/$]]* | ?:[[\\/]]*) ;; - */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; -esac -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/obsolete.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/obsolete.m4 deleted file mode 100644 index f7ec1dbcd..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/obsolete.m4 +++ /dev/null @@ -1,28 +0,0 @@ -# -*- Autoconf -*- -# Obsolete and "removed" macros, that must however still report explicit -# error messages when used, to smooth transition. -# -# Copyright (C) 1996-2013 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. - -AC_DEFUN([AM_CONFIG_HEADER], -[AC_DIAGNOSE([obsolete], -['$0': this macro is obsolete. -You should use the 'AC][_CONFIG_HEADERS' macro instead.])dnl -AC_CONFIG_HEADERS($@)]) - -AC_DEFUN([AM_PROG_CC_STDC], -[AC_PROG_CC -am_cv_prog_cc_stdc=$ac_cv_prog_cc_stdc -AC_DIAGNOSE([obsolete], -['$0': this macro is obsolete. -You should simply use the 'AC][_PROG_CC' macro instead. -Also, your code should no longer depend upon 'am_cv_prog_cc_stdc', -but upon 'ac_cv_prog_cc_stdc'.])]) - -AC_DEFUN([AM_C_PROTOTYPES], - [AC_FATAL([automatic de-ANSI-fication support has been removed])]) -AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/options.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/options.m4 deleted file mode 100644 index 01ce20c0d..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/options.m4 +++ /dev/null @@ -1,30 +0,0 @@ -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_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], -[m4_foreach_w([_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/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/prog-cc-c-o.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/prog-cc-c-o.m4 deleted file mode 100644 index 3b2a849b0..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/prog-cc-c-o.m4 +++ /dev/null @@ -1,47 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_CC_C_O -# --------------- -# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC -# to automatically call this. -AC_DEFUN([_AM_PROG_CC_C_O], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -AC_LANG_PUSH([C])dnl -AC_CACHE_CHECK( - [whether $CC understands -c and -o together], - [am_cv_prog_cc_c_o], - [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i]) -if test "$am_cv_prog_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 -AC_LANG_POP([C])]) - -# For backward compatibility. -AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/python.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/python.m4 deleted file mode 100644 index 4f16355ad..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/python.m4 +++ /dev/null @@ -1,239 +0,0 @@ -## ------------------------ -*- Autoconf -*- -## Python file handling -## From Andrew Dalke -## Updated by James Henstridge -## ------------------------ -# Copyright (C) 1999-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - - -# AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# --------------------------------------------------------------------------- -# 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 MINIMUM-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 2.0 are not - dnl supported. (2.0 was released on October 16, 2000). - m4_define_default([_AM_PYTHON_INTERPRETER_LIST], -[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl - python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0]) - - AC_ARG_VAR([PYTHON], [the Python interpreter]) - - m4_if([$1],[],[ - dnl No version check is needed. - # Find any Python interpreter. - if test -z "$PYTHON"; then - AC_PATH_PROGS([PYTHON], _AM_PYTHON_INTERPRETER_LIST, :) - fi - 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 is >= $1]) - AM_PYTHON_CHECK_VERSION([$PYTHON], [$1], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Python interpreter is too old])]) - am_display_PYTHON=$PYTHON - 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 none; do - test "$am_cv_pathless_PYTHON" = none && break - AM_PYTHON_CHECK_VERSION([$am_cv_pathless_PYTHON], [$1], [break]) - done]) - # Set $PYTHON to the absolute path of $am_cv_pathless_PYTHON. - if test "$am_cv_pathless_PYTHON" = none; then - PYTHON=: - else - AC_PATH_PROG([PYTHON], [$am_cv_pathless_PYTHON]) - fi - am_display_PYTHON=$am_cv_pathless_PYTHON - fi - ]) - - if test "$PYTHON" = :; then - dnl Run any user-specified action, or abort. - m4_default([$3], [AC_MSG_ERROR([no suitable Python interpreter found])]) - else - - 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; sys.stdout.write(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; sys.stdout.write(sys.platform)"`]) - AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform]) - - # Just factor out some code duplication. - am_python_setup_sysconfig="\ -import sys -# Prefer sysconfig over distutils.sysconfig, for better compatibility -# with python 3.x. See automake bug#10227. -try: - import sysconfig -except ImportError: - can_use_sysconfig = 0 -else: - can_use_sysconfig = 1 -# Can't use sysconfig in CPython 2.7, since it's broken in virtualenvs: -# -try: - from platform import python_implementation - if python_implementation() == 'CPython' and sys.version[[:3]] == '2.7': - can_use_sysconfig = 0 -except ImportError: - pass" - - 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 behavior - dnl is more consistent with lispdir.m4 for example. - dnl Query distutils for this directory. - AC_CACHE_CHECK([for $am_display_PYTHON script directory], - [am_cv_python_pythondir], - [if test "x$prefix" = xNONE - then - am_py_prefix=$ac_default_prefix - else - am_py_prefix=$prefix - fi - am_cv_python_pythondir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('purelib', vars={'base':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(0, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pythondir in - $am_py_prefix*) - am__strip_prefix=`echo "$am_py_prefix" | sed 's|.|.|g'` - am_cv_python_pythondir=`echo "$am_cv_python_pythondir" | sed "s,^$am__strip_prefix,$PYTHON_PREFIX,"` - ;; - *) - case $am_py_prefix in - /usr|/System*) ;; - *) - am_cv_python_pythondir=$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - ]) - AC_SUBST([pythondir], [$am_cv_python_pythondir]) - - 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. - - AC_SUBST([pkgpythondir], [\${pythondir}/$PACKAGE]) - - dnl pyexecdir -- directory for installing python extension modules - dnl (shared libraries) - dnl Query distutils for this directory. - AC_CACHE_CHECK([for $am_display_PYTHON extension module directory], - [am_cv_python_pyexecdir], - [if test "x$exec_prefix" = xNONE - then - am_py_exec_prefix=$am_py_prefix - else - am_py_exec_prefix=$exec_prefix - fi - am_cv_python_pyexecdir=`$PYTHON -c " -$am_python_setup_sysconfig -if can_use_sysconfig: - sitedir = sysconfig.get_path('platlib', vars={'platbase':'$am_py_prefix'}) -else: - from distutils import sysconfig - sitedir = sysconfig.get_python_lib(1, 0, prefix='$am_py_prefix') -sys.stdout.write(sitedir)"` - case $am_cv_python_pyexecdir in - $am_py_exec_prefix*) - am__strip_prefix=`echo "$am_py_exec_prefix" | sed 's|.|.|g'` - am_cv_python_pyexecdir=`echo "$am_cv_python_pyexecdir" | sed "s,^$am__strip_prefix,$PYTHON_EXEC_PREFIX,"` - ;; - *) - case $am_py_exec_prefix in - /usr|/System*) ;; - *) - am_cv_python_pyexecdir=$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages - ;; - esac - ;; - esac - ]) - AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir]) - - dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE) - - AC_SUBST([pkgpyexecdir], [\${pyexecdir}/$PACKAGE]) - - dnl Run any user-specified action. - $2 - fi - -]) - - -# 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 equivalent (first -# word of sys.version), in order to cope with versions such as 2.2c1. -# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). -AC_DEFUN([AM_PYTHON_CHECK_VERSION], - [prog="import sys -# split strings by '.' and convert to numeric. Append some zeros -# because we need at least 4 digits for the hex conversion. -# map returns an iterator in Python 3.0 and a list in 2.x -minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] -minverhex = 0 -# xrange is not present in Python 3.0 and range returns an iterator -for i in list(range(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/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/runlog.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/runlog.m4 deleted file mode 100644 index b3a668288..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/runlog.m4 +++ /dev/null @@ -1,17 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_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/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/sanity.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/sanity.m4 deleted file mode 100644 index 8ae5560bb..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/sanity.m4 +++ /dev/null @@ -1,82 +0,0 @@ -# Check to make sure that the build environment is sane. -*- Autoconf -*- - -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SANITY_CHECK -# --------------- -AC_DEFUN([AM_SANITY_CHECK], -[AC_MSG_CHECKING([whether build environment is sane]) -# Reject unsafe characters in $srcdir or the absolute working directory -# name. Accept space and tab only in the latter. -am_lf=' -' -case `pwd` in - *[[\\\"\#\$\&\'\`$am_lf]]*) - AC_MSG_ERROR([unsafe absolute working directory name]);; -esac -case $srcdir in - *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; -esac - -# 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 ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then - - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done - 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]) -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi -AC_CONFIG_COMMANDS_PRE( - [AC_MSG_CHECKING([that generated files are newer than configure]) - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - AC_MSG_RESULT([done])]) -rm -f conftest.file -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/silent.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/silent.m4 deleted file mode 100644 index 6fb3c221c..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/silent.m4 +++ /dev/null @@ -1,60 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 2009-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl -AS_HELP_STRING( - [--enable-silent-rules], - [less verbose build output (undo: "make V=1")]) -AS_HELP_STRING( - [--disable-silent-rules], - [verbose build output (undo: "make V=0")])dnl -]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few 'make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/strip.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/strip.m4 deleted file mode 100644 index d0b7c6500..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/strip.m4 +++ /dev/null @@ -1,28 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 2001-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_PROG_INSTALL_STRIP -# --------------------- -# One issue with vendor 'install' (even GNU) is that you can't -# specify the program used to strip binaries. This is especially -# annoying in cross-compiling environments, where the build's strip -# is unlikely to handle the host's binaries. -# Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in "make install-strip", and initialize -# STRIPPROG with the value of the STRIP variable (set by the user). -AC_DEFUN([AM_PROG_INSTALL_STRIP], -[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. -if test "$cross_compiling" != no; then - AC_CHECK_TOOL([STRIP], [strip], :) -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" -AC_SUBST([INSTALL_STRIP_PROGRAM])]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/substnot.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/substnot.m4 deleted file mode 100644 index 52dc5a1b3..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/substnot.m4 +++ /dev/null @@ -1,17 +0,0 @@ -## -*- Autoconf -*- -# Copyright (C) 2006-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_SUBST_NOTMAKE(VARIABLE) -# --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. -# This macro is traced by Automake. -AC_DEFUN([_AM_SUBST_NOTMAKE]) - -# AM_SUBST_NOTMAKE(VARIABLE) -# -------------------------- -# Public sister of _AM_SUBST_NOTMAKE. -AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/tar.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/tar.m4 deleted file mode 100644 index 539aa3a46..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/tar.m4 +++ /dev/null @@ -1,132 +0,0 @@ -# Check how to create a tarball. -*- Autoconf -*- - -# Copyright (C) 2004-2013 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_TAR(FORMAT) -# -------------------- -# Check how to create a tarball in format FORMAT. -# FORMAT should be one of 'v7', 'ustar', or 'pax'. -# -# Substitute a variable $(am__tar) that is a command -# writing to stdout a FORMAT-tarball containing the directory -# $tardir. -# tardir=directory && $(am__tar) > result.tar -# -# Substitute a variable $(am__untar) that extract such -# a tarball read from stdin. -# $(am__untar) < result.tar -# -AC_DEFUN([_AM_PROG_TAR], -[# Always define AMTAR for backward compatibility. Yes, it's still used -# in the wild :-( We should find a proper way to deprecate it ... -AC_SUBST([AMTAR], ['$${TAR-tar}']) - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' - -m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], - - [m4_case([$1], - [ustar], - [# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi - AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi], - - [pax], - [], - - [m4_fatal([Unknown tar format])]) - - AC_MSG_CHECKING([how to create a $1 tar archive]) - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_$1-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi - done - rm -rf conftest.dir - - AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) - AC_MSG_RESULT([$am_cv_prog_tar_$1])]) - -AC_SUBST([am__tar]) -AC_SUBST([am__untar]) -]) # _AM_PROG_TAR diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/upc.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/upc.m4 deleted file mode 100644 index b85fc0274..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/upc.m4 +++ /dev/null @@ -1,20 +0,0 @@ -# Find a compiler for Unified Parallel C. -*- Autoconf -*- - -# Copyright (C) 2006-2013 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. - -AC_DEFUN([AM_PROG_UPC], -[dnl We need OBJEXT and EXEEXT, but Autoconf doesn't offer any public -dnl macro to compute them. Use AC_PROG_CC instead. -AC_REQUIRE([AC_PROG_CC])dnl -AC_ARG_VAR([UPC], [Unified Parallel C compiler command])dnl -AC_ARG_VAR([UPCFLAGS], [Unified Parallel C compiler flags])dnl -AC_CHECK_TOOLS([UPC], [m4_default([$1], [upcc upc])], [:]) -if test "$UPC" = :; then - AC_MSG_ERROR([no Unified Parallel C compiler was found], [77]) -fi -_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([UPC])])dnl -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/vala.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/vala.m4 deleted file mode 100644 index c0104f1b7..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal-1.14/vala.m4 +++ /dev/null @@ -1,37 +0,0 @@ -# Autoconf support for the Vala compiler - -# Copyright (C) 2008-2013 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. - -# Check whether the Vala compiler exists in $PATH. If it is found, the -# variable VALAC is set pointing to its absolute path. Otherwise, it is -# simply set to 'valac'. -# Optionally a minimum release number of the compiler can be requested. -# If the ACTION-IF-FOUND parameter is given, it will be run if a proper -# Vala compiler is found. -# Similarly, if the ACTION-IF-FOUND is given, it will be run if no proper -# Vala compiler is found. It defaults to simply print a warning about the -# situation, but otherwise proceeding with the configuration. -# -# AM_PROG_VALAC([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# -------------------------------------------------------------------------- -AC_DEFUN([AM_PROG_VALAC], - [AC_PATH_PROG([VALAC], [valac], [valac]) - AS_IF([test "$VALAC" != valac && test -n "$1"], - [AC_MSG_CHECKING([whether $VALAC is at least version $1]) - am__vala_version=`$VALAC --version | sed 's/Vala *//'` - AS_VERSION_COMPARE([$1], ["$am__vala_version"], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - VALAC=valac])]) - if test "$VALAC" = valac; then - m4_default([$3], - [AC_MSG_WARN([no proper vala compiler found]) - AC_MSG_WARN([you will not be able to compile vala source files])]) - else - m4_default([$2], [:]) - fi]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/README b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/README deleted file mode 100644 index 7c6f48776..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/README +++ /dev/null @@ -1,9 +0,0 @@ -This directory is where .m4 files providing third-party autoconf -macros can be placed to be automatically found by the aclocal(1) -program. - -The .m4 files placed here could be shared among different versions -of aclocal, so be careful. - -Even if no actual .m4 files are present, this directory is required -in order for aclocal to work properly. Please do not remove it. diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/argz.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/argz.m4 deleted file mode 100644 index d1f4ec5b1..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/argz.m4 +++ /dev/null @@ -1,79 +0,0 @@ -# Portability macros for glibc argz. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. -# Written by Gary V. Vaughan -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 argz.m4 - -AC_DEFUN([gl_FUNC_ARGZ], -[gl_PREREQ_ARGZ - -AC_CHECK_HEADERS([argz.h], [], [], [AC_INCLUDES_DEFAULT]) - -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.]) - AC_DEFINE([__error_t_defined], [1], [Define so that glibc/gnulib argp.h - does not typedef error_t.])], - [#if defined(HAVE_ARGZ_H) -# include -#endif]) - -ARGZ_H= -AC_CHECK_FUNCS([argz_add argz_append argz_count argz_create_sep argz_insert \ - argz_next argz_stringify], [], [ARGZ_H=argz.h; AC_LIBOBJ([argz])]) - -dnl if have system argz functions, allow forced use of -dnl libltdl-supplied implementation (and default to do so -dnl on "known bad" systems). Could use a runtime check, but -dnl (a) detecting malloc issues is notoriously unreliable -dnl (b) only known system that declares argz functions, -dnl provides them, yet they are broken, is cygwin -dnl releases prior to 16-Mar-2007 (1.5.24 and earlier) -dnl So, it's more straightforward simply to special case -dnl this for known bad systems. -AS_IF([test -z "$ARGZ_H"], - [AC_CACHE_CHECK( - [if argz actually works], - [lt_cv_sys_argz_works], - [[case $host_os in #( - *cygwin*) - lt_cv_sys_argz_works=no - if test "$cross_compiling" != no; then - lt_cv_sys_argz_works="guessing no" - else - lt_sed_extract_leading_digits='s/^\([0-9\.]*\).*/\1/' - save_IFS=$IFS - IFS=-. - set x `uname -r | sed -e "$lt_sed_extract_leading_digits"` - IFS=$save_IFS - lt_os_major=${2-0} - lt_os_minor=${3-0} - lt_os_micro=${4-0} - if test "$lt_os_major" -gt 1 \ - || { test "$lt_os_major" -eq 1 \ - && { test "$lt_os_minor" -gt 5 \ - || { test "$lt_os_minor" -eq 5 \ - && test "$lt_os_micro" -gt 24; }; }; }; then - lt_cv_sys_argz_works=yes - fi - fi - ;; #( - *) lt_cv_sys_argz_works=yes ;; - esac]]) - AS_IF([test "$lt_cv_sys_argz_works" = yes], - [AC_DEFINE([HAVE_WORKING_ARGZ], 1, - [This value is set to 1 to indicate that the system argz facility works])], - [ARGZ_H=argz.h - AC_LIBOBJ([argz])])]) - -AC_SUBST([ARGZ_H]) -]) - -# Prerequisites of lib/argz.c. -AC_DEFUN([gl_PREREQ_ARGZ], [:]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/libtool.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/libtool.m4 deleted file mode 100644 index 44e0ecff1..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/libtool.m4 +++ /dev/null @@ -1,7982 +0,0 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# 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. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 57 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - -_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl -dnl -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_WITH_SYSROOT])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl - -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 - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# Backslashify metacharacters that are still active within -# double-quoted strings. -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 delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -]) - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - -## ------------------------------------- ## -## Accumulate code for creating libtool. ## -## ------------------------------------- ## - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - -## ------------------------ ## -## FIXME: Eliminate VARNAME ## -## ------------------------ ## - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$[]1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -_LT_OUTPUT_LIBTOOL_INIT -]) - -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2011 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_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 -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # 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) - - _LT_PROG_REPLACE_SHELLFNS - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Go], [_LT_LANG(GO)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -m4_ifndef([AC_PROG_GO], [ -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_GO. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ -m4_defun([AC_PROG_GO], -[AC_LANG_PUSH(Go)dnl -AC_ARG_VAR([GOC], [Go compiler command])dnl -AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl -_AC_ARG_VAR_LDFLAGS()dnl -AC_CHECK_TOOL(GOC, gccgo) -if test -z "$GOC"; then - if test -n "$ac_tool_prefix"; then - AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) - fi -fi -if test -z "$GOC"; then - AC_CHECK_PROG(GOC, gccgo, gccgo, false) -fi -])#m4_defun -])#m4_ifndef - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([AC_PROG_GO], - [LT_LANG(GO)], - [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - # If there is a non-empty error log, and "single_module" - # appears in it, assume the flag caused a linker warning - if test -s conftest.err && $GREP single_module conftest.err; then - cat conftest.err >&AS_MESSAGE_LOG_FD - # Otherwise, if the output was created with a 0 exit code from - # the compiler, it worked. - elif test -f libconftest.dylib && test $_lt_result -eq 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD - $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -s conftest.err && $GREP force_load conftest.err; then - cat conftest.err >&AS_MESSAGE_LOG_FD - elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES([TAG]) -# --------------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], - [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) -# ---------------------------------- -# 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. -# Store the results from the different compilers for each TAGNAME. -# Allow to override them for all tags through lt_cv_aix_libpath. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], - [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ - lt_aix_libpath_sed='[ - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }]' - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi],[]) - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" - fi - ]) - aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) -fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$[]1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -case "$ECHO" in - printf*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac - -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test "X`printf %s $ECHO`" = "X$ECHO" \ - || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) - -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_WITH_SYSROOT -# ---------------- -AC_DEFUN([_LT_WITH_SYSROOT], -[AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[ --with-sysroot[=DIR] Search for dependent libraries within DIR - (or the compiler's sysroot if not specified).], -[], [with_sysroot=no]) - -dnl lt_sysroot will always be passed unquoted. We quote it here -dnl in case the user passed a directory name. -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - AC_MSG_RESULT([${with_sysroot}]) - AC_MSG_ERROR([The sysroot must be an absolute path.]) - ;; -esac - - AC_MSG_RESULT([${lt_sysroot:-no}]) -_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and in which our libraries should be installed.])]) - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_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 '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - 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 - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|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-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*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-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - 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_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[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 - ;; -*-*solaris*) - # 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 - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) - case $host in - i?86-*-solaris*) - LD="${LD-ld} -m elf_x86_64" - ;; - sparc*-*-solaris*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - # GNU ld 2.21 introduced _sol2 emulations. Use them if available. - if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD="${LD-ld}_sol2" - fi - ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_PROG_AR -# ----------- -m4_defun([_LT_PROG_AR], -[AC_CHECK_TOOLS(AR, [ar], false) -: ${AR=ar} -: ${AR_FLAGS=cru} -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) - -AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], - [lt_cv_ar_at_file=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - ]) - ]) - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi -_LT_DECL([], [archiver_list_spec], [1], - [How to feed a file listing to the archiver]) -])# _LT_PROG_AR - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[_LT_PROG_AR - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $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 other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker 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 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# 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 - teststring="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* | cegcc*) - # 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; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - os2*) - # The test takes a long time on OS/2. - lt_cv_sys_max_cmd_len=8192 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # 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"`env echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # 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` - fi - ;; - 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 -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_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 <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#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 - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 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; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_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* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - 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="-ldld"], - [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="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - 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" - wl=$lt_prog_compiler_wl 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_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 - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_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 -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - 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}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $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:$LINENO: \$? = $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 - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_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 -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_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 -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_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_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; 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 -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -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 -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # 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. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -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" -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 # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$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}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux # correct to gnu/linux during the next big refactor - 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}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - 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}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - 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}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - 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=`func_echo_all "$lib" | $SED '\''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' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$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* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - 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~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - 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}${shared_ext}' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - 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}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH. - 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 - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # 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 - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # 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 - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[23]].*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$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 - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - 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 - case $host_cpu in - ia64*) - shrext_cmds='.so' - 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}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$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 - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - 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}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[[3-9]]*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux # correct to gnu/linux during the next big refactor - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - 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}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # 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 - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # 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}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$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 # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$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' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $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}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - 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" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$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}${shared_ext}$versuffix ${libname}${shared_ext}$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.3*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - 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 # correct to gnu/linux during the next big refactor - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = 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 - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[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]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_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="m4_if([$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 <<_LT_EOF 1>&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 - -_LT_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 -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_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 - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_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])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 $CC]) - 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 pathname 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 variants of GNU ld 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 /dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - 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|DragonFly)/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 - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - 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 - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - 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 - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -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=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - 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 - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` - fi - ;; - esac -fi - -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 - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method = "file_magic"]) -_LT_DECL([], [file_magic_glob], [1], - [How to find potential files when deplibs_check_method = "file_magic"]) -_LT_DECL([], [want_nocaseglob], [1], - [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_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" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - -# _LT_CHECK_SHAREDLIB_FROM_LINKLIB -# -------------------------------- -# how to determine the name of the shared library -# associated with a specific link library. -# -- PORTME fill in with the dynamic library characteristics -m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], -[m4_require([_LT_DECL_EGREP]) -m4_require([_LT_DECL_OBJDUMP]) -m4_require([_LT_DECL_DLLTOOL]) -AC_CACHE_CHECK([how to associate runtime and link libraries], -lt_cv_sharedlib_from_linklib_cmd, -[lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac -]) -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - -_LT_DECL([], [sharedlib_from_linklib_cmd], [1], - [Command to associate shared and link libraries]) -])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB - - -# _LT_PATH_MANIFEST_TOOL -# ---------------------- -# locate the manifest tool -m4_defun([_LT_PATH_MANIFEST_TOOL], -[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], - [lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&AS_MESSAGE_LOG_FD - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest*]) -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi -_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl -])# _LT_PATH_MANIFEST_TOOL - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# 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]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \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\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# 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 - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $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 <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT@&t@_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT@&t@_DLSYM_CONST -#else -# define LT@&t@_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT@&t@_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_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_globsym_save_LIBS - CFLAGS=$lt_globsym_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 -rf 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 - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -_LT_DECL([], [nm_file_list_spec], [1], - [Specify filename containing input files for $NM]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_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_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # 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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # 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). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_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_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_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 - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # 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). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd*) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_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_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_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_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # 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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # 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). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_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_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" - fi - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # 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). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - *Sun\ F* | *Sun*Fortran*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - *Intel*\ [[CF]]*Compiler*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - *Portland\ Group*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac - -AC_CACHE_CHECK([for $compiler option to produce PIC], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - case $host_os in - aix[[4-9]]*) - # 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 - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_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_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) - _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - ;; - esac - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_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_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # 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. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # 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 - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; - *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_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_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, 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 install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&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. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_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_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_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_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - 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 - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_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]].*|aix[[5-9]]*) - 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_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - 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 - : - else - # We have old collect2 - _LT_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_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - 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 - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_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_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # 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. - case $cc_basename in - cl*) - # Native MSVC - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - esac - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $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_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2.*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_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' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - m4_if($1, [], [ - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], - [lt_cv_irix_exported_symbol], - [save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE( - [AC_LANG_SOURCE( - [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], - [C++], [[int foo (void) { return 0; }]], - [Fortran 77], [[ - subroutine foo - end]], - [Fortran], [[ - subroutine foo - end]])])], - [lt_cv_irix_exported_symbol=yes], - [lt_cv_irix_exported_symbol=no]) - LDFLAGS="$save_LDFLAGS"]) - if test "$lt_cv_irix_exported_symbol" = yes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_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_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_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' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_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} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_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_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_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_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM conftest* - echo "$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_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [postlink_cmds], [2], - [Commands necessary for finishing linking programs]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -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_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -## 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... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will 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 - ;; - - aix[[4-9]]*) - 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]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_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_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_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_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $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 -v "^Configured with:" | $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_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - 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]].*|aix[[5-9]]*) - 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_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - 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 - : - else - # We have old collect2 - _LT_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_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - 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 - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_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_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd2.*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - gnu*) - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_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_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_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' - # 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) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${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' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_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' - ;; - 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; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_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_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_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - 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_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.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$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_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_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_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=`func_echo_all "$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; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # 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_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_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::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | 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_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$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 ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_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=`func_echo_all "$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; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_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" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_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 -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_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} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='func_echo_all' - - # 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_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_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_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_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 -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_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 $compiler_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 -v "^Configured with:" | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_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... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_FUNC_STRIPNAME_CNF -# ---------------------- -# func_stripname_cnf prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# -# This function is identical to the (non-XSI) version of func_stripname, -# except this one can be used by m4 code that may be executed by configure, -# rather than the libtool script. -m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl -AC_REQUIRE([_LT_DECL_SED]) -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf -])# _LT_FUNC_STRIPNAME_CNF - -# _LT_SYS_HIDDEN_LIBDEPS([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. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -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... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF -package foo -func foo() { -} -_LT_EOF -]) - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; -esac - -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${F77-"f77"} - CFLAGS=$FFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - 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 - ;; - aix[[4-9]]*) - 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]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_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... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" - CFLAGS="$lt_save_CFLAGS" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${FC-"f95"} - CFLAGS=$FCFLAGS - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - 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 - ;; - aix[[4-9]]*) - 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]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_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... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -CFLAGS=$GCJFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -## 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... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_GO_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Go compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GO_CONFIG], -[AC_REQUIRE([LT_PROG_GO])dnl -AC_LANG_SAVE - -# Source file extension for Go test sources. -ac_ext=go - -# Object file extension for compiled Go test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="package main; func main() { }" - -# Code to be used in simple link tests -lt_simple_link_test_code='package main; func main() { }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GOC-"gccgo"} -CFLAGS=$GOFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# Go did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -## 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... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GO_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -CFLAGS= -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_GO -# ---------- -AC_DEFUN([LT_PROG_GO], -[AC_CHECK_TOOL(GOC, gccgo,) -]) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - -# _LT_DECL_DLLTOOL -# ---------------- -# Ensure DLLTOOL variable is set. -m4_defun([_LT_DECL_DLLTOOL], -[AC_CHECK_TOOL(DLLTOOL, dlltool, false) -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) -AC_SUBST([DLLTOOL]) -]) - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -############################################################ -# 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. # -############################################################ - -m4_defun([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 -IFS=$as_save_IFS -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 && continue - 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_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) -# ------------------------------------------------------ -# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and -# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. -m4_defun([_LT_PROG_FUNCTION_REPLACE], -[dnl { -sed -e '/^$1 ()$/,/^} # $1 /c\ -$1 ()\ -{\ -m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) -} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: -]) - - -# _LT_PROG_REPLACE_SHELLFNS -# ------------------------- -# Replace existing portable implementations of several shell functions with -# equivalent extended shell implementations where those features are available.. -m4_defun([_LT_PROG_REPLACE_SHELLFNS], -[if test x"$xsi_shell" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl - func_split_long_opt_name=${1%%=*} - func_split_long_opt_arg=${1#*=}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) - - _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) - - _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) - - _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) -fi - -if test x"$lt_shell_append" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) - - _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl - func_quote_for_eval "${2}" -dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ - eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) -fi -]) - -# _LT_PATH_CONVERSION_FUNCTIONS -# ----------------------------- -# Determine which file name conversion functions should be used by -# func_to_host_file (and, implicitly, by func_to_host_path). These are needed -# for certain cross-compile configurations and native mingw. -m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_MSG_CHECKING([how to convert $build file names to $host format]) -AC_CACHE_VAL(lt_cv_to_host_file_cmd, -[case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac -]) -to_host_file_cmd=$lt_cv_to_host_file_cmd -AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) -_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], - [0], [convert $build file names to $host format])dnl - -AC_MSG_CHECKING([how to convert $build file names to toolchain format]) -AC_CACHE_VAL(lt_cv_to_tool_file_cmd, -[#assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac -]) -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) -_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], - [0], [convert $build files to toolchain format])dnl -])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltdl.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltdl.m4 deleted file mode 100644 index ea76f4d7b..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltdl.m4 +++ /dev/null @@ -1,817 +0,0 @@ -# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- -# -# Copyright (C) 1999-2006, 2007, 2008, 2011 Free Software Foundation, Inc. -# Written by Thomas Tanner, 1999 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 18 LTDL_INIT - -# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) -# ------------------------------------------ -# DIRECTORY contains the libltdl sources. It is okay to call this -# function multiple times, as long as the same DIRECTORY is always given. -AC_DEFUN([LT_CONFIG_LTDL_DIR], -[AC_BEFORE([$0], [LTDL_INIT]) -_$0($*) -])# LT_CONFIG_LTDL_DIR - -# We break this out into a separate macro, so that we can call it safely -# internally without being caught accidentally by the sed scan in libtoolize. -m4_defun([_LT_CONFIG_LTDL_DIR], -[dnl remove trailing slashes -m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) -m4_case(_LTDL_DIR, - [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply `.' - m4_if(_ARG_DIR, [.], - [], - [m4_define([_LTDL_DIR], _ARG_DIR) - _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], - [m4_if(_ARG_DIR, _LTDL_DIR, - [], - [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])]) -m4_popdef([_ARG_DIR]) -])# _LT_CONFIG_LTDL_DIR - -# Initialise: -m4_define([_LTDL_DIR], []) - - -# _LT_BUILD_PREFIX -# ---------------- -# If Autoconf is new enough, expand to `${top_build_prefix}', otherwise -# to `${top_builddir}/'. -m4_define([_LT_BUILD_PREFIX], -[m4_ifdef([AC_AUTOCONF_VERSION], - [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), - [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], - [${top_build_prefix}], - [${top_builddir}/])], - [${top_build_prefix}])], - [${top_builddir}/])[]dnl -]) - - -# LTDL_CONVENIENCE -# ---------------- -# 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 -# AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with -# '${top_build_prefix}' if available, otherwise 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_build_prefix, top_builddir, and top_srcdir appropriately -# in your Makefiles. -AC_DEFUN([LTDL_CONVENIENCE], -[AC_BEFORE([$0], [LTDL_INIT])dnl -dnl Although the argument is deprecated and no longer documented, -dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one -dnl here make sure it is the same as any other declaration of libltdl's -dnl location! This also ensures lt_ltdl_dir is set when configure.ac is -dnl not yet using an explicit LT_CONFIG_LTDL_DIR. -m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl -_$0() -])# LTDL_CONVENIENCE - -# AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, -# now we have LT_CONFIG_LTDL_DIR: -AU_DEFUN([AC_LIBLTDL_CONVENIENCE], -[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) -_LTDL_CONVENIENCE]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) - - -# _LTDL_CONVENIENCE -# ----------------- -# Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). -m4_defun([_LTDL_CONVENIENCE], -[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='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" -LTDLDEPS=$LIBLTDL -LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" - -AC_SUBST([LIBLTDL]) -AC_SUBST([LTDLDEPS]) -AC_SUBST([LTDLINCL]) - -# For backwards non-gettext consistent compatibility... -INCLTDL="$LTDLINCL" -AC_SUBST([INCLTDL]) -])# _LTDL_CONVENIENCE - - -# LTDL_INSTALLABLE -# ---------------- -# 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 -# AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl -# is not found, LIBLTDL will be prefixed with '${top_build_prefix}' if -# available, otherwise 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_build_prefix, -# top_builddir, and top_srcdir appropriately in your Makefiles. -# In the future, this macro may have to be called after LT_INIT. -AC_DEFUN([LTDL_INSTALLABLE], -[AC_BEFORE([$0], [LTDL_INIT])dnl -dnl Although the argument is deprecated and no longer documented, -dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one -dnl here make sure it is the same as any other declaration of libltdl's -dnl location! This also ensures lt_ltdl_dir is set when configure.ac is -dnl not yet using an explicit LT_CONFIG_LTDL_DIR. -m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl -_$0() -])# LTDL_INSTALLABLE - -# AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, -# now we have LT_CONFIG_LTDL_DIR: -AU_DEFUN([AC_LIBLTDL_INSTALLABLE], -[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) -_LTDL_INSTALLABLE]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) - - -# _LTDL_INSTALLABLE -# ----------------- -# Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). -m4_defun([_LTDL_INSTALLABLE], -[if test -f $prefix/lib/libltdl.la; then - lt_save_LDFLAGS="$LDFLAGS" - LDFLAGS="-L$prefix/lib $LDFLAGS" - AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) - LDFLAGS="$lt_save_LDFLAGS" - if test x"${lt_lib_ltdl-no}" = xyes; then - if test x"$enable_ltdl_install" != xyes; then - # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install - AC_MSG_WARN([not overwriting libltdl at $prefix, force with `--enable-ltdl-install']) - enable_ltdl_install=no - fi - elif test x"$enable_ltdl_install" = xno; then - AC_MSG_WARN([libltdl not installed, but installation disabled]) - fi -fi - -# If configure.ac declared an installable ltdl, and the user didn't override -# with --disable-ltdl-install, we will install the shipped libltdl. -case $enable_ltdl_install in - no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" - LIBLTDL="-lltdl" - LTDLDEPS= - LTDLINCL= - ;; - *) enable_ltdl_install=yes - ac_configure_args="$ac_configure_args --enable-ltdl-install" - LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" - LTDLDEPS=$LIBLTDL - LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" - ;; -esac - -AC_SUBST([LIBLTDL]) -AC_SUBST([LTDLDEPS]) -AC_SUBST([LTDLINCL]) - -# For backwards non-gettext consistent compatibility... -INCLTDL="$LTDLINCL" -AC_SUBST([INCLTDL]) -])# LTDL_INSTALLABLE - - -# _LTDL_MODE_DISPATCH -# ------------------- -m4_define([_LTDL_MODE_DISPATCH], -[dnl If _LTDL_DIR is `.', then we are configuring libltdl itself: -m4_if(_LTDL_DIR, [], - [], - dnl if _LTDL_MODE was not set already, the default value is `subproject': - [m4_case(m4_default(_LTDL_MODE, [subproject]), - [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) - _LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])], - [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"; lt_libobj_prefix="$lt_ltdl_dir/"])], - [recursive], [], - [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl -dnl Be careful not to expand twice: -m4_define([$0], []) -])# _LTDL_MODE_DISPATCH - - -# _LT_LIBOBJ(MODULE_NAME) -# ----------------------- -# Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead -# of into LIBOBJS. -AC_DEFUN([_LT_LIBOBJ], [ - m4_pattern_allow([^_LT_LIBOBJS$]) - _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" -])# _LT_LIBOBJS - - -# LTDL_INIT([OPTIONS]) -# -------------------- -# 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. If the shipped ltdl sources are not in a -# subdirectory named libltdl, the directory name must be given by -# LT_CONFIG_LTDL_DIR. -AC_DEFUN([LTDL_INIT], -[dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -dnl We need to keep our own list of libobjs separate from our parent project, -dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while -dnl we look for our own LIBOBJs. -m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) -m4_pushdef([AC_LIBSOURCES]) - -dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: -m4_if(_LTDL_MODE, [], - [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) - m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], - [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) - -AC_ARG_WITH([included_ltdl], - [AS_HELP_STRING([--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_DECL([lt_dlinterface_register], - [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], - [with_included_ltdl=no], - [with_included_ltdl=yes])], - [with_included_ltdl=yes], - [AC_INCLUDES_DEFAULT - #include ])], - [with_included_ltdl=yes], - [AC_INCLUDES_DEFAULT] - ) -fi - -dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE -dnl was called yet, then for old times' sake, we assume libltdl is in an -dnl eponymous directory: -AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) - -AC_ARG_WITH([ltdl_include], - [AS_HELP_STRING([--with-ltdl-include=DIR], - [use the ltdl headers installed in DIR])]) - -if test -n "$with_ltdl_include"; then - if test -f "$with_ltdl_include/ltdl.h"; then : - else - AC_MSG_ERROR([invalid ltdl include directory: `$with_ltdl_include']) - fi -else - with_ltdl_include=no -fi - -AC_ARG_WITH([ltdl_lib], - [AS_HELP_STRING([--with-ltdl-lib=DIR], - [use the libltdl.la installed in DIR])]) - -if test -n "$with_ltdl_lib"; then - if test -f "$with_ltdl_lib/libltdl.la"; then : - else - AC_MSG_ERROR([invalid ltdl library directory: `$with_ltdl_lib']) - fi -else - with_ltdl_lib=no -fi - -case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in - ,yes,no,no,) - m4_case(m4_default(_LTDL_TYPE, [convenience]), - [convenience], [_LTDL_CONVENIENCE], - [installable], [_LTDL_INSTALLABLE], - [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) - ;; - ,no,no,no,) - # 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 - LTDLDEPS= - LTDLINCL= - ;; - ,no*,no,*) - AC_MSG_ERROR([`--with-ltdl-include' and `--with-ltdl-lib' options must be used together]) - ;; - *) with_included_ltdl=no - LIBLTDL="-L$with_ltdl_lib -lltdl" - LTDLDEPS= - LTDLINCL="-I$with_ltdl_include" - ;; -esac -INCLTDL="$LTDLINCL" - -# Report our decision... -AC_MSG_CHECKING([where to find libltdl headers]) -AC_MSG_RESULT([$LTDLINCL]) -AC_MSG_CHECKING([where to find libltdl library]) -AC_MSG_RESULT([$LIBLTDL]) - -_LTDL_SETUP - -dnl restore autoconf definition. -m4_popdef([AC_LIBOBJ]) -m4_popdef([AC_LIBSOURCES]) - -AC_CONFIG_COMMANDS_PRE([ - _ltdl_libobjs= - _ltdl_ltlibobjs= - if test -n "$_LT_LIBOBJS"; then - # Remove the extension. - _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' - for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do - _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" - _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" - done - fi - AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) - AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) -]) - -# Only expand once: -m4_define([LTDL_INIT]) -])# LTDL_INIT - -# Old names: -AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) -AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) -AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIB_LTDL], []) -dnl AC_DEFUN([AC_WITH_LTDL], []) -dnl AC_DEFUN([LT_WITH_LTDL], []) - - -# _LTDL_SETUP -# ----------- -# Perform all the checks necessary for compilation of the ltdl objects -# -- including compiler checks and header checks. This is a public -# interface mainly for the benefit of libltdl's own configure.ac, most -# other users should call LTDL_INIT instead. -AC_DEFUN([_LTDL_SETUP], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_SYS_MODULE_EXT])dnl -AC_REQUIRE([LT_SYS_MODULE_PATH])dnl -AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl -AC_REQUIRE([LT_LIB_DLLOAD])dnl -AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl -AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl -AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl -AC_REQUIRE([gl_FUNC_ARGZ])dnl - -m4_require([_LT_CHECK_OBJDIR])dnl -m4_require([_LT_HEADER_DLFCN])dnl -m4_require([_LT_CHECK_DLPREOPEN])dnl -m4_require([_LT_DECL_SED])dnl - -dnl Don't require this, or it will be expanded earlier than the code -dnl that sets the variables it relies on: -_LT_ENABLE_INSTALL - -dnl _LTDL_MODE specific code must be called at least once: -_LTDL_MODE_DISPATCH - -# In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS -# the user used. This is so that ltdl.h can pick up the parent projects -# config.h file, The first file in AC_CONFIG_HEADERS must contain the -# definitions required by ltdl.c. -# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). -AC_CONFIG_COMMANDS_PRE([dnl -m4_pattern_allow([^LT_CONFIG_H$])dnl -m4_ifset([AH_HEADER], - [LT_CONFIG_H=AH_HEADER], - [m4_ifset([AC_LIST_HEADERS], - [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`], - [])])]) -AC_SUBST([LT_CONFIG_H]) - -AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], - [], [], [AC_INCLUDES_DEFAULT]) - -AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) -AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) - -m4_pattern_allow([LT_LIBEXT])dnl -AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) - -name= -eval "lt_libprefix=\"$libname_spec\"" -m4_pattern_allow([LT_LIBPREFIX])dnl -AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) - -name=ltdl -eval "LTDLOPEN=\"$libname_spec\"" -AC_SUBST([LTDLOPEN]) -])# _LTDL_SETUP - - -# _LT_ENABLE_INSTALL -# ------------------ -m4_define([_LT_ENABLE_INSTALL], -[AC_ARG_ENABLE([ltdl-install], - [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) - -case ,${enable_ltdl_install},${enable_ltdl_convenience} in - *yes*) ;; - *) enable_ltdl_convenience=yes ;; -esac - -m4_ifdef([AM_CONDITIONAL], -[AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) - AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)]) -])# _LT_ENABLE_INSTALL - - -# LT_SYS_DLOPEN_DEPLIBS -# --------------------- -AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_CACHE_CHECK([whether deplibs are loaded by dlopen], - [lt_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. - lt_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. - lt_cv_sys_dlopen_deplibs=unknown - ;; - aix[[4-9]]*) - lt_cv_sys_dlopen_deplibs=yes - ;; - amigaos*) - case $host_cpu in - powerpc) - lt_cv_sys_dlopen_deplibs=no - ;; - esac - ;; - darwin*) - # Assuming the user has installed a libdl from somewhere, this is true - # If you are looking for one http://www.opendarwin.org/projects/dlcompat - lt_cv_sys_dlopen_deplibs=yes - ;; - freebsd* | dragonfly*) - lt_cv_sys_dlopen_deplibs=yes - ;; - gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) - # GNU and its variants, using gnu ld.so (Glibc) - lt_cv_sys_dlopen_deplibs=yes - ;; - hpux10*|hpux11*) - lt_cv_sys_dlopen_deplibs=yes - ;; - interix*) - lt_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. - lt_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. - lt_cv_sys_dlopen_deplibs=yes - ;; - netbsd*) - lt_cv_sys_dlopen_deplibs=yes - ;; - openbsd*) - lt_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 explicitly say `no'. - lt_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'. - lt_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'. - lt_cv_sys_dlopen_deplibs=yes - ;; - qnx*) - lt_cv_sys_dlopen_deplibs=yes - ;; - solaris*) - lt_cv_sys_dlopen_deplibs=yes - ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - libltdl_cv_sys_dlopen_deplibs=yes - ;; - esac - ]) -if test "$lt_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 -])# LT_SYS_DLOPEN_DEPLIBS - -# Old name: -AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) - - -# LT_SYS_MODULE_EXT -# ----------------- -AC_DEFUN([LT_SYS_MODULE_EXT], -[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl -AC_CACHE_CHECK([which extension is used for runtime loadable modules], - [libltdl_cv_shlibext], -[ -module=yes -eval libltdl_cv_shlibext=$shrext_cmds -module=no -eval libltdl_cv_shrext=$shrext_cmds - ]) -if test -n "$libltdl_cv_shlibext"; then - m4_pattern_allow([LT_MODULE_EXT])dnl - AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], - [Define to the extension used for runtime loadable modules, say, ".so".]) -fi -if test "$libltdl_cv_shrext" != "$libltdl_cv_shlibext"; then - m4_pattern_allow([LT_SHARED_EXT])dnl - AC_DEFINE_UNQUOTED([LT_SHARED_EXT], ["$libltdl_cv_shrext"], - [Define to the shared library suffix, say, ".dylib".]) -fi -])# LT_SYS_MODULE_EXT - -# Old name: -AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) - - -# LT_SYS_MODULE_PATH -# ------------------ -AC_DEFUN([LT_SYS_MODULE_PATH], -[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl -AC_CACHE_CHECK([which variable specifies run-time module search path], - [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"]) -if test -n "$lt_cv_module_path_var"; then - m4_pattern_allow([LT_MODULE_PATH_VAR])dnl - AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], - [Define to the name of the environment variable that determines the run-time module search path.]) -fi -])# LT_SYS_MODULE_PATH - -# Old name: -AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) - - -# LT_SYS_DLSEARCH_PATH -# -------------------- -AC_DEFUN([LT_SYS_DLSEARCH_PATH], -[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl -AC_CACHE_CHECK([for the default library search path], - [lt_cv_sys_dlsearch_path], - [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"]) -if test -n "$lt_cv_sys_dlsearch_path"; then - sys_dlsearch_path= - for dir in $lt_cv_sys_dlsearch_path; do - if test -z "$sys_dlsearch_path"; then - sys_dlsearch_path="$dir" - else - sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" - fi - done - m4_pattern_allow([LT_DLSEARCH_PATH])dnl - AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], - [Define to the system default library search path.]) -fi -])# LT_SYS_DLSEARCH_PATH - -# Old name: -AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) - - -# _LT_CHECK_DLPREOPEN -# ------------------- -m4_defun([_LT_CHECK_DLPREOPEN], -[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -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 -])# _LT_CHECK_DLPREOPEN - - -# LT_LIB_DLLOAD -# ------------- -AC_DEFUN([LT_LIB_DLLOAD], -[m4_pattern_allow([^LT_DLLOADERS$]) -LT_DLLOADERS= -AC_SUBST([LT_DLLOADERS]) - -AC_LANG_PUSH([C]) - -LIBADD_DLOPEN= -AC_SEARCH_LIBS([dlopen], [dl], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - if test "$ac_cv_search_dlopen" != "none required" ; then - LIBADD_DLOPEN="-ldl" - fi - libltdl_cv_lib_dl_dlopen="yes" - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], - [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#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" - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], - [AC_CHECK_LIB([svld], [dlopen], - [AC_DEFINE([HAVE_LIBDL], [1], - [Define if you have the libdl library or equivalent.]) - LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) -if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes -then - lt_save_LIBS="$LIBS" - LIBS="$LIBS $LIBADD_DLOPEN" - AC_CHECK_FUNCS([dlerror]) - LIBS="$lt_save_LIBS" -fi -AC_SUBST([LIBADD_DLOPEN]) - -LIBADD_SHL_LOAD= -AC_CHECK_FUNC([shl_load], - [AC_DEFINE([HAVE_SHL_LOAD], [1], - [Define if you have the shl_load function.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], - [AC_CHECK_LIB([dld], [shl_load], - [AC_DEFINE([HAVE_SHL_LOAD], [1], - [Define if you have the shl_load function.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" - LIBADD_SHL_LOAD="-ldld"])]) -AC_SUBST([LIBADD_SHL_LOAD]) - -case $host_os in -darwin[[1567]].*) -# We only want this for pre-Mac OS X 10.4. - AC_CHECK_FUNC([_dyld_func_lookup], - [AC_DEFINE([HAVE_DYLD], [1], - [Define if you have the _dyld_func_lookup function.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) - ;; -beos*) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" - ;; -cygwin* | mingw* | os2* | pw32*) - AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" - ;; -esac - -AC_CHECK_LIB([dld], [dld_link], - [AC_DEFINE([HAVE_DLD], [1], - [Define if you have the GNU dld library.]) - LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) -AC_SUBST([LIBADD_DLD_LINK]) - -m4_pattern_allow([^LT_DLPREOPEN$]) -LT_DLPREOPEN= -if test -n "$LT_DLLOADERS" -then - for lt_loader in $LT_DLLOADERS; do - LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " - done - AC_DEFINE([HAVE_LIBDLLOADER], [1], - [Define if libdlloader will be built on this platform]) -fi -AC_SUBST([LT_DLPREOPEN]) - -dnl This isn't used anymore, but set it for backwards compatibility -LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" -AC_SUBST([LIBADD_DL]) - -AC_LANG_POP -])# LT_LIB_DLLOAD - -# Old name: -AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_DLLIB], []) - - -# LT_SYS_SYMBOL_USCORE -# -------------------- -# does the compiler prefix global symbols with an underscore? -AC_DEFUN([LT_SYS_SYMBOL_USCORE], -[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -AC_CACHE_CHECK([for _ prefix in compiled symbols], - [lt_cv_sys_symbol_underscore], - [lt_cv_sys_symbol_underscore=no - cat > conftest.$ac_ext <<_LT_EOF -void nm_test_func(){} -int main(){nm_test_func;return 0;} -_LT_EOF - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - ac_nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $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 - lt_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" >&AS_MESSAGE_LOG_FD - fi - fi - else - echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.c >&AS_MESSAGE_LOG_FD - fi - rm -rf conftest* - ]) - sys_symbol_underscore=$lt_cv_sys_symbol_underscore - AC_SUBST([sys_symbol_underscore]) -])# LT_SYS_SYMBOL_USCORE - -# Old name: -AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) - - -# LT_FUNC_DLSYM_USCORE -# -------------------- -AC_DEFUN([LT_FUNC_DLSYM_USCORE], -[AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl -if test x"$lt_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_DLOPEN" - _LT_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 -])# LT_FUNC_DLSYM_USCORE - -# Old name: -AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltoptions.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltoptions.m4 deleted file mode 100644 index 5d9acd8e2..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltoptions.m4 +++ /dev/null @@ -1,384 +0,0 @@ -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 7 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - -## --------------------------------- ## -## Macros to handle LT_INIT options. ## -## --------------------------------- ## - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_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=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_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=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_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=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [lt_p=${PACKAGE-default} - case $withval in - yes|no) pic_mode=$withval ;; - *) - pic_mode=default - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for lt_pkg in $withval; do - IFS="$lt_save_ifs" - if test "X$lt_pkg" = "X$lt_p"; then - pic_mode=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - -## ----------------- ## -## LTDL_INIT Options ## -## ----------------- ## - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltsugar.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltsugar.m4 deleted file mode 100644 index 9000a057d..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltsugar.m4 +++ /dev/null @@ -1,123 +0,0 @@ -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltversion.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltversion.m4 deleted file mode 100644 index 07a8602d4..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/ltversion.m4 +++ /dev/null @@ -1,23 +0,0 @@ -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# 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. - -# @configure_input@ - -# serial 3337 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.4.2]) -m4_define([LT_PACKAGE_REVISION], [1.3337]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.2' -macro_revision='1.3337' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/lt~obsolete.m4 b/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/lt~obsolete.m4 deleted file mode 100644 index c573da90c..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/aclocal/lt~obsolete.m4 +++ /dev/null @@ -1,98 +0,0 @@ -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/third_party/nlbuild-autotools/repo/tools/host/share/autoconf/Autom4te/C4che.pm b/third_party/nlbuild-autotools/repo/tools/host/share/autoconf/Autom4te/C4che.pm deleted file mode 100644 index e6d13c725..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/autoconf/Autom4te/C4che.pm +++ /dev/null @@ -1,242 +0,0 @@ -# autoconf -- create `configure' using m4 macros -# Copyright (C) 2003, 2006, 2009, 2010 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 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -package Autom4te::C4che; - -=head1 NAME - -Autom4te::C4che - a single m4 run request - -=head1 SYNOPSIS - - use Autom4te::C4che; - -=head1 DESCRIPTION - -This Perl module handles the cache of M4 runs used by autom4te. - -=cut - -use Data::Dumper; -use Autom4te::Request; -use Carp; -use strict; - -=over 4 - -=item @request - -List of requests. - -We cannot 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 do not know whether the current behavior -(5.6) is wanted or not. - -=cut - -use vars qw(@request); - -=item C<$req = Autom4te::C4che-Eretrieve (%attr)> - -Find a request with the same path and input. - -=cut - -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; -} - -=item C<$req = Autom4te::C4che-Eregister (%attr)> - -Create and register a request for these path and input. - -=cut - -# $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 = new Autom4te::Request ('path' => $attr{path}, - 'input' => $attr{input}); - push @request, $obj; - - # Assign an id for cache file. - $obj->id ("$#request"); - - return $obj; -} - - -=item C<$req = Autom4te::C4che-Erequest (%request)> - -Get (retrieve or create) a request for the path C<$request{path}> and -the input C<$request{input}>. - -=cut - -# $REQUEST-OBJ -# request($SELF, %REQUEST) -# ------------------------ -sub request ($%) -{ - my ($self, %request) = @_; - - my $req = - Autom4te::C4che->retrieve (%request) - || Autom4te::C4che->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 is 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; -} - - -=item C<$string = Autom4te::C4che-Emarshall ()> - -Serialize all the current requests. - -=cut - - -# marshall($SELF) -# --------------- -sub marshall ($) -{ - my ($caller) = @_; - my $res = ''; - - my $marshall = Data::Dumper->new ([\@request], [qw (*request)]); - $marshall->Indent(2)->Terse(0); - $res = $marshall->Dump . "\n"; - - return $res; -} - - -=item Csave ($file)> - -Save the cache in the C<$file> file object. - -=cut - -# SAVE ($FILE) -# ------------ -sub save ($$) -{ - my ($self, $file) = @_; - - confess "cannot save a single request\n" - if ref ($self); - - $file->seek (0, 0); - $file->truncate (0); - print $file - "# This file was generated.\n", - "# It contains the lists of macros which have been traced.\n", - "# It can be safely removed.\n", - "\n", - $self->marshall; -} - - -=item Cload ($file)> - -Load the cache from the C<$file> file object. - -=cut - -# LOAD ($FILE) -# ------------ -sub load ($$) -{ - my ($self, $file) = @_; - my $fname = $file->name; - - confess "cannot load a single request\n" - if ref ($self); - - my $contents = join "", $file->getlines; - - eval $contents; - - confess "cannot eval $fname: $@\n" if $@; -} - - -=head1 SEE ALSO - -L - -=head1 HISTORY - -Written by Akim Demaille EFE. - -=cut - -1; # for require - -### 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/third_party/nlbuild-autotools/repo/tools/host/share/autoconf/Autom4te/ChannelDefs.pm b/third_party/nlbuild-autotools/repo/tools/host/share/autoconf/Autom4te/ChannelDefs.pm deleted file mode 100644 index c78d91aef..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/autoconf/Autom4te/ChannelDefs.pm +++ /dev/null @@ -1,390 +0,0 @@ -# Copyright (C) 2002, 2003, 2006, 2008, 2009, 2010 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 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -package Autom4te::ChannelDefs; - -use Autom4te::Channels; - -=head1 NAME - -Autom4te::ChannelDefs - channel definitions for Automake and helper functions - -=head1 SYNOPSIS - - use Autom4te::ChannelDefs; - - print Autom4te::ChannelDefs::usage (), "\n"; - prog_error ($MESSAGE, [%OPTIONS]); - error ($WHERE, $MESSAGE, [%OPTIONS]); - error ($MESSAGE); - fatal ($WHERE, $MESSAGE, [%OPTIONS]); - fatal ($MESSAGE); - verb ($MESSAGE, [%OPTIONS]); - switch_warning ($CATEGORY); - parse_WARNINGS (); - parse_warnings ($OPTION, @ARGUMENT); - Autom4te::ChannelDefs::set_strictness ($STRICTNESS_NAME); - -=head1 DESCRIPTION - -This package defines channels that can be used in Automake to -output diagnostics and other messages (via C). It also defines -some helper function to enable or disable these channels, and some -shorthand function to output on specific channels. - -=cut - -use 5.005; -use strict; -use Exporter; - -use vars qw (@ISA @EXPORT); - -@ISA = qw (Exporter); -@EXPORT = qw (&prog_error &error &fatal &verb - &switch_warning &parse_WARNINGS &parse_warnings); - -=head2 CHANNELS - -The following channels can be used as the first argument of -C. For some of them we list a shorthand -function that makes the code more readable. - -=over 4 - -=item C - -Fatal errors. Use C<&fatal> to send messages over this channel. - -=item C - -Common errors. Use C<&error> to send messages over this channel. - -=item C - -Errors related to GNU Standards. - -=item C - -Errors related to GNU Standards that should be warnings in "foreign" mode. - -=item C - -Errors related to GNITS Standards (silent by default). - -=item C - -Internal errors. Use C<&prog_error> to send messages over this channel. - -=item C - -Constructs compromising the cross-compilation of the package. - -=item C - -Warnings related to GNU Coding Standards. - -=item C - -Warnings about obsolete features (silent by default). - -=item C - -Warnings about user redefinitions of Automake rules or -variables (silent by default). - -=item C - -Warnings about non-portable constructs. - -=item C - -Warnings about weird syntax, unused variables, typos ... - -=item C - -Warnings about unsupported (or mis-supported) features. - -=item C - -Messages output in C<--verbose> mode. Use C<&verb> to send such messages. - -=item C - -Informative messages. - -=back - -=cut - -# Initialize our list of error/warning channels. -# Do not forget to update &usage and the manual -# if you add or change a warning channel. - -register_channel 'fatal', type => 'fatal', ordered => 0; -register_channel 'error', type => 'error'; -register_channel 'error-gnu', type => 'error'; -register_channel 'error-gnu/warn', type => 'error'; -register_channel 'error-gnits', type => 'error', silent => 1; -register_channel 'automake', type => 'fatal', backtrace => 1, - header => ("####################\n" . - "## Internal Error ##\n" . - "####################\n"), - footer => "\nPlease contact .", - ordered => 0; - -register_channel 'cross', type => 'warning', silent => 1; -register_channel 'gnu', type => 'warning'; -register_channel 'obsolete', type => 'warning', silent => 1; -register_channel 'override', type => 'warning', silent => 1; -register_channel 'portability', type => 'warning', silent => 1; -register_channel 'syntax', type => 'warning'; -register_channel 'unsupported', type => 'warning'; - -register_channel 'verb', type => 'debug', silent => 1, ordered => 0; -register_channel 'note', type => 'debug', silent => 0; - -=head2 FUNCTIONS - -=over 4 - -=item C - -Return the warning category descriptions. - -=cut - -sub usage () -{ - return "Warning categories include: - `cross' cross compilation issues - `gnu' GNU coding standards (default in gnu and gnits modes) - `obsolete' obsolete features or constructions - `override' user redefinitions of Automake rules or variables - `portability' portability issues (default in gnu and gnits modes) - `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"; -} - -=item C - -Signal a programming error (on channel C), -display C<$MESSAGE>, and exit 1. - -=cut - -sub prog_error ($;%) -{ - my ($msg, %opts) = @_; - msg 'automake', '', $msg, %opts; -} - -=item C - -=item C - -Uncategorized errors. - -=cut - -sub error ($;$%) -{ - my ($where, $msg, %opts) = @_; - msg ('error', $where, $msg, %opts); -} - -=item C - -=item C - -Fatal errors. - -=cut - -sub fatal ($;$%) -{ - my ($where, $msg, %opts) = @_; - msg ('fatal', $where, $msg, %opts); -} - -=item C - -C<--verbose> messages. - -=cut - -sub verb ($;%) -{ - my ($msg, %opts) = @_; - msg 'verb', '', $msg, %opts; -} - -=item C - -If C<$CATEGORY> is C, turn on channel C. -If it is C, turn C off. -Else handle C and C for completeness. - -=cut - -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 => ! $has_no; - } - elsif ($cat eq 'error') - { - $warnings_are_errors = ! $has_no; - # Set exit code if Perl warns about something - # (like uninitialized variables). - $SIG{"__WARN__"} = - $has_no ? 'DEFAULT' : sub { print STDERR @_; $exit_code = 1; }; - } - elsif (channel_type ($cat) eq 'warning') - { - setup_channel $cat, silent => $has_no; - } - else - { - return 1; - } - return 0; -} - -=item C - -Parse the WARNINGS environment variable. - -=cut - -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'})); - } -} - -=item C - -Parse the argument of C<--warning=CATEGORY> or C<-WCATEGORY>. - -C<$OPTIONS> is C<"--warning"> or C<"-W">, C<@ARGUMENT> is a list of -C. - -This can be used as an argument to C. - -=cut - -sub parse_warnings ($@) -{ - my ($opt, @categories) = @_; - - foreach my $cat (map { split ',' } @categories) - { - msg 'unsupported', "unknown warning category `$cat'" - if switch_warning $cat; - } -} - -=item C - -Configure channels for strictness C<$STRICTNESS_NAME>. - -=cut - -sub set_strictness ($) -{ - my ($name) = @_; - - if ($name eq '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 ($name eq '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 ($name eq '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 `$name' not recognized\n"; - } -} - -=back - -=head1 SEE ALSO - -L - -=head1 HISTORY - -Written by Alexandre Duret-Lutz EFE. - -=cut - -### 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/third_party/nlbuild-autotools/repo/tools/host/share/autoconf/Autom4te/Channels.pm b/third_party/nlbuild-autotools/repo/tools/host/share/autoconf/Autom4te/Channels.pm deleted file mode 100644 index 0af4d0089..000000000 --- a/third_party/nlbuild-autotools/repo/tools/host/share/autoconf/Autom4te/Channels.pm +++ /dev/null @@ -1,837 +0,0 @@ -# Copyright (C) 2002, 2004, 2006, 2008, 2010 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, see . - -############################################################### -# The main copy of this file is in Automake's CVS repository. # -# Updates should be sent to automake-patches@gnu.org. # -############################################################### - -package Autom4te::Channels; - -=head1 NAME - -Autom4te::Channels - support functions for error and warning management - -=head1 SYNOPSIS - - use Autom4te::Channels; - - # Register a channel to output warnings about unused variables. - register_channel 'unused', type => 'warning'; - - # Register a channel for system errors. - register_channel 'system', type => 'error', exit_code => 4; - - # Output a message on channel 'unused'. - msg 'unused', "$file:$line", "unused variable `$var'"; - - # Make the 'unused' channel silent. - setup_channel 'unused', silent => 1; - - # Turn on all channels of type 'warning'. - setup_channel_type 'warning', silent => 0; - - # Redirect all channels to push messages on a Thread::Queue using - # the specified serialization key. - setup_channel_queue $queue, $key; - - # Output a message pending in a Thread::Queue. - pop_channel_queue $queue; - - # Treat all warnings as errors. - $warnings_are_errors = 1; - - # Exit with the greatest exit code encountered so far. - exit $exit_code; - -=head1 DESCRIPTION - -This perl module provides support functions for handling diagnostic -channels in programs. Channels can be registered to convey fatal, -error, warning, or debug messages. Each channel has various options -(e.g. is the channel silent, should duplicate messages be removed, -etc.) that can also be overridden on a per-message basis. - -=cut - -use 5.005; -use strict; -use Exporter; -use Carp; -use File::Basename; - -use vars qw (@ISA @EXPORT %channels $me); - -@ISA = qw (Exporter); -@EXPORT = qw ($exit_code $warnings_are_errors - &reset_local_duplicates &reset_global_duplicates - ®ister_channel &msg &exists_channel &channel_type - &setup_channel &setup_channel_type - &dup_channel_setup &drop_channel_setup - &buffer_messages &flush_messages - &setup_channel_queue &pop_channel_queue - US_GLOBAL US_LOCAL - UP_NONE UP_TEXT UP_LOC_TEXT); - -$me = basename $0; - -=head2 Global Variables - -=over 4 - -=item C<$exit_code> - -The greatest exit code seen so far. C<$exit_code> is updated from -the C options of C and C channels. - -=cut - -use vars qw ($exit_code); -$exit_code = 0; - -=item C<$warnings_are_errors> - -Set this variable to 1 if warning messages should be treated as -errors (i.e. if they should update C<$exit_code>). - -=cut - -use vars qw ($warnings_are_errors); -$warnings_are_errors = 0; - -=back - -=head2 Constants - -=over 4 - -=item C, C, C - -Possible values for the C options. This selects the part -of the message that should be considered when filtering out duplicates. -If C is used, the location and the explanation message -are used for filtering. If C is used, only the explanation -message is used (so the same message will be filtered out if it appears -at different locations). C means that duplicate messages -should be output. - -=cut - -use constant UP_NONE => 0; -use constant UP_TEXT => 1; -use constant UP_LOC_TEXT => 2; - -=item C, C - -Possible values for the C options. -Use C for error messages that should be printed only -once during the execution of the program, C for message that -should be printed only once per file. (Actually, C does not -do this now when files are changed, it relies on you calling -C when this happens.) - -=cut - -# possible values for uniq_scope -use constant US_LOCAL => 0; -use constant US_GLOBAL => 1; - -=back - -=head2 Options - -Channels accept the options described below. These options can be -passed as a hash to the C, C, and C -functions. The possible keys, with their default value are: - -=over - -=item C 'warning'> - -The type of the channel. One of C<'debug'>, C<'warning'>, C<'error'>, or -C<'fatal'>. Fatal messages abort the program when they are output. -Error messages update the exit status. Debug and warning messages are -harmless, except that warnings are treated as errors if -C<$warnings_are_errors> is set. - -=item C 1> - -The value to update C<$exit_code> with when a fatal or error message -is emitted. C<$exit_code> is also updated for warnings output -when C<$warnings_are_errors> is set. - -=item C \*STDERR> - -The file where the error should be output. - -=item C 0> - -Whether the channel should be silent. Use this do disable a -category of warning, for instance. - -=item C 1> - -Whether, with multi-threaded execution, the message should be queued -for ordered output. - -=item C UP_LOC_TEXT> - -The part of the message subject to duplicate filtering. See the -documentation for the C, C, and C -constants above. - -C can also be set to an arbitrary string that will be used -instead of the message when considering duplicates. - -=item C US_LOCAL> - -The scope of duplicate filtering. See the documentation for the -C, and C constants above. - -=item C
''> - -A string to prepend to each message emitted through this channel. -With partial messages, only the first part will have C
-prepended. - -=item C