From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93115 invoked by alias); 21 Nov 2016 23:23:57 -0000 Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org Received: (qmail 93083 invoked by uid 89); 21 Nov 2016 23:23:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.1 required=5.0 tests=AWL,BAYES_50,KAM_ASCII_DIVIDERS,KAM_INFOUSMEBIZ,RCVD_IN_DNSWL_LOW,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 spammy=rda, scott, Scott, boston X-Spam-User: qpsmtpd, 2 recipients X-HELO: einhorn.in-berlin.de Received: from einhorn.in-berlin.de (HELO einhorn.in-berlin.de) (192.109.42.8) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Nov 2016 23:23:46 +0000 X-Envelope-From: doko@ubuntu.com Received: from [192.168.178.26] (ip5f5af460.dynamic.kabel-deutschland.de [95.90.244.96]) (authenticated bits=0) by einhorn.in-berlin.de (8.14.4/8.14.4/Debian-8+deb8u1) with ESMTP id uALNNY9S023618 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 22 Nov 2016 00:23:35 +0100 Subject: Re: [PATCH] Delete GCJ To: Rainer Orth , Matthias Klose References: <78f841e7-808b-58d0-7913-3ec0d19630a0@redhat.com> <6DA7C7D0-314E-4A5E-8B35-5A8EA2F74CD8@mentor.com> <2b5de569-1efd-f407-49c2-c9fa84cc5315@ubuntu.com> <4964955d-4de1-618c-de41-835ca19f9932@ubuntu.com> <4FBA6B16-460A-4EBB-8809-0883A84ABEB7@mentor.com> <0bf14402-d4e6-5fb0-8a63-479903ed2141@ubuntu.com> <01B885DF-4340-43C6-A784-21326A9CA8CF@comcast.net> <10704c8f-fd72-8d13-17a1-f522e88345b2@ubuntu.com> <31916070-ce2d-423a-e942-33f0b3ebc227@ubuntu.com> <6747724B-4128-4C55-8625-91AA559A0D98@mentor.com> <885027a6-080b-ec6f-89df-533be4132b36@ubuntu.com> <41C15B32-0659-49F2-A918-8A83623E4BF8@codesourcery.com> <48b62bc3-2870-0113-d165-59057c186e54@ubuntu.com> <58331F83.9080801@codesourcery.com> <5297ad88-69fb-d93f-ea6e-c283136be478@ubuntu.com> Cc: Sandra Loosemore , Iain Sandoe , Mike Stump , Jeff Law , Andrew Haley , GCC Patches , GCJ-patches , Peter Bergner From: Matthias Klose Message-ID: <3e91e449-40fe-1159-cec0-49dcb00d99ab@ubuntu.com> Date: Mon, 21 Nov 2016 23:23:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------7DB5557C80CF989379BD5AFD" X-IsSubscribed: yes X-SW-Source: 2016-q4/txt/msg00033.txt.bz2 This is a multi-part message in MIME format. --------------7DB5557C80CF989379BD5AFD Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Content-length: 1425 On 21.11.2016 18:16, Rainer Orth wrote: > Hi Matthias, > >> ahh, didn't see that :-/ Now fixed, is this clearer now? >> >> The options @option{--with-target-bdw-gc-include} and >> @option{--with-target-bdw-gc-lib} must always specified together for > ^ be thanks to all sorting out the documentation issues. Now attaching the updated diff. Ok to commit? Matthias 2016-11-19 Matthias Klose * Makefile.def: Remove reference to boehm-gc target module. * configure.ac: Include pkg.m4, check for --with-target-bdw-gc options and for the bdw-gc pkg-config module. * configure: Regenerate. * Makefile.in: Regenerate. gcc/ 2016-11-19 Matthias Klose * doc/install.texi: Document configure options --enable-objc-gc and --with-target-bdw-gc. config/ 2016-11-19 Matthias Klose * pkg.m4: New file. libobjc/ 2016-11-19 Matthias Klose * configure.ac (--enable-objc-gc): Allow to configure with a system provided boehm-gc. * configure: Regenerate. * Makefile.in (OBJC_BOEHM_GC_LIBS): Get value from configure. * gc.c: Include system bdw-gc headers. * memory.c: Likewise * objects.c: Likewise boehm-gc/ 2016-11-19 Matthias Klose Remove --------------7DB5557C80CF989379BD5AFD Content-Type: text/x-diff; name="libobjc-bdw-gc.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="libobjc-bdw-gc.diff" Content-length: 49396 2016-11-19 Matthias Klose * Makefile.def: Remove reference to boehm-gc target module. * configure.ac: Include pkg.m4, check for --with-target-bdw-gc options and for the bdw-gc pkg-config module. * configure: Regenerate. * Makefile.in: Regenerate. gcc/ 2016-11-19 Matthias Klose * doc/install.texi: Document configure options --enable-objc-gc and --with-target-bdw-gc. config/ 2016-11-19 Matthias Klose * pkg.m4: New file. libobjc/ 2016-11-19 Matthias Klose * configure.ac (--enable-objc-gc): Allow to configure with a system provided boehm-gc. * configure: Regenerate. * Makefile.in (OBJC_BOEHM_GC_LIBS): Get value from configure. * gc.c: Include system bdw-gc headers. * memory.c: Likewise * objects.c: Likewise boehm-gc/ 2016-11-19 Matthias Klose Remove Index: Makefile.def =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- Makefile.def (revision 242681) +++ Makefile.def (working copy) @@ -166,7 +166,6 @@ target_modules =3D { module=3D libgloss; no_check=3Dtrue; }; target_modules =3D { module=3D libffi; no_install=3Dtrue; }; target_modules =3D { module=3D zlib; }; -target_modules =3D { module=3D boehm-gc; }; target_modules =3D { module=3D rda; }; target_modules =3D { module=3D libada; }; target_modules =3D { module=3D libgomp; bootstrap=3D true; lib_path=3D.lib= s; }; @@ -543,7 +542,6 @@ // a dependency on libgcc for native targets to configure. lang_env_dependencies =3D { module=3Dlibiberty; no_c=3Dtrue; }; =20 -dependencies =3D { module=3Dconfigure-target-boehm-gc; on=3Dall-target-lib= stdc++-v3; }; dependencies =3D { module=3Dconfigure-target-fastjar; on=3Dconfigure-targe= t-zlib; }; dependencies =3D { module=3Dall-target-fastjar; on=3Dall-target-zlib; }; dependencies =3D { module=3Dconfigure-target-libgo; on=3Dconfigure-target-= libffi; }; @@ -551,8 +549,6 @@ dependencies =3D { module=3Dall-target-libgo; on=3Dall-target-libbacktrace= ; }; dependencies =3D { module=3Dall-target-libgo; on=3Dall-target-libffi; }; dependencies =3D { module=3Dall-target-libgo; on=3Dall-target-libatomic; }; -dependencies =3D { module=3Dconfigure-target-libobjc; on=3Dconfigure-targe= t-boehm-gc; }; -dependencies =3D { module=3Dall-target-libobjc; on=3Dall-target-boehm-gc; = }; dependencies =3D { module=3Dconfigure-target-libstdc++-v3; on=3Dconfigure-= target-libgomp; }; dependencies =3D { module=3Dconfigure-target-liboffloadmic; on=3Dconfigure= -target-libgomp; }; dependencies =3D { module=3Dconfigure-target-libsanitizer; on=3Dall-target= -libstdc++-v3; }; Index: config/pkg.m4 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- config/pkg.m4 (nonexistent) +++ config/pkg.m4 (working copy) @@ -0,0 +1,825 @@ +dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +dnl serial 11 (pkg-config-0.29) +dnl +dnl Copyright =C2=A9 2004 Scott James Remnant . +dnl Copyright =C2=A9 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running au= toconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VER= SION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLA= GS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPE= W)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search p= ath]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in sea= rch path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" !=3D "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=3Dm4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG=3D"" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1=3D"$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=3D`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" !=3D "x0" && pkg_failed=3Dyes ], + [pkg_failed=3Dyes]) + else + pkg_failed=3Duntried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=3Dyes +else + _pkg_short_errors_supported=3Dno +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config]= )dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=3Dno +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variabl= es $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed =3D yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported =3D yes; then + $1[]_PKG_ERRORS=3D`$PKG_CONFIG --short-errors --print-errors --cf= lags --libs "$2" 2>&1` + else=20 + $1[]_PKG_ERRORS=3D`$PKG_CONFIG --print-errors --cflags --libs "$2= " 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed =3D untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=3D$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=3D$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=3D$PKG_CONFIG +PKG_CONFIG=3D"$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=3D$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=3D]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@= :>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=3D]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable=3D"][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR +dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +dnl serial 11 (pkg-config-0.29) +dnl +dnl Copyright =C2=A9 2004 Scott James Remnant . +dnl Copyright =C2=A9 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running au= toconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VER= SION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLA= GS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPE= W)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search p= ath]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in sea= rch path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" !=3D "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=3Dm4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG=3D"" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1=3D"$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=3D`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" !=3D "x0" && pkg_failed=3Dyes ], + [pkg_failed=3Dyes]) + else + pkg_failed=3Duntried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=3Dyes +else + _pkg_short_errors_supported=3Dno +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config]= )dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=3Dno +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variabl= es $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed =3D yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported =3D yes; then + $1[]_PKG_ERRORS=3D`$PKG_CONFIG --short-errors --print-errors --cf= lags --libs "$2" 2>&1` + else=20 + $1[]_PKG_ERRORS=3D`$PKG_CONFIG --print-errors --cflags --libs "$2= " 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed =3D untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=3D$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=3D$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=3D$PKG_CONFIG +PKG_CONFIG=3D"$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=3D$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=3D]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@= :>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=3D]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable=3D"][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR +dnl pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +dnl serial 11 (pkg-config-0.29) +dnl +dnl Copyright =C2=A9 2004 Scott James Remnant . +dnl Copyright =C2=A9 2012-2015 Dan Nicholson +dnl +dnl This program is free software; you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception to the GNU General Public License, if you +dnl distribute this file as part of a program that contains a +dnl configuration script generated by Autoconf, you may include it under +dnl the same distribution terms that you use for the rest of that +dnl program. + +dnl PKG_PREREQ(MIN-VERSION) +dnl ----------------------- +dnl Since: 0.29 +dnl +dnl Verify that the version of the pkg-config macros are at least +dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's +dnl installed version of pkg-config, this checks the developer's version +dnl of pkg.m4 when generating configure. +dnl +dnl To ensure that this macro is defined, also add: +dnl m4_ifndef([PKG_PREREQ], +dnl [m4_fatal([must install pkg-config 0.29 or later before running au= toconf/autogen])]) +dnl +dnl See the "Since" comment for each macro you use to see what version +dnl of the macros you require. +m4_defun([PKG_PREREQ], +[m4_define([PKG_MACROS_VERSION], [0.29]) +m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, + [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VER= SION[ found])]) +])dnl PKG_PREREQ + +dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) +dnl ---------------------------------- +dnl Since: 0.16 +dnl +dnl Search for the pkg-config tool and set the PKG_CONFIG variable to +dnl first found in the path. Checks that the version of pkg-config found +dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is +dnl used since that's the first version where most current features of +dnl pkg-config existed. +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLA= GS|LIBS)))?$]) +m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPE= W)$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) +AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search p= ath]) +AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in sea= rch path]) + +if test "x$ac_cv_env_PKG_CONFIG_set" !=3D "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=3Dm4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG=3D"" + fi +fi[]dnl +])dnl PKG_PROG_PKG_CONFIG + +dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------------------------------- +dnl Since: 0.18 +dnl +dnl Check to see whether a particular set of modules exists. Similar to +dnl PKG_CHECK_MODULES(), but does not set variables or print errors. +dnl +dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +dnl only at the first occurence in configure.ac, so if the first place +dnl it's called might be skipped (such as if it is within an "if", you +dnl have to call PKG_CHECK_EXISTS manually +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_default([$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + +dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +dnl --------------------------------------------- +dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting +dnl pkg_failed based on the result. +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1=3D"$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=3D`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` + test "x$?" !=3D "x0" && pkg_failed=3Dyes ], + [pkg_failed=3Dyes]) + else + pkg_failed=3Duntried +fi[]dnl +])dnl _PKG_CONFIG + +dnl _PKG_SHORT_ERRORS_SUPPORTED +dnl --------------------------- +dnl Internal check to see if pkg-config supports short errors. +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=3Dyes +else + _pkg_short_errors_supported=3Dno +fi[]dnl +])dnl _PKG_SHORT_ERRORS_SUPPORTED + + +dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl -------------------------------------------------------------- +dnl Since: 0.4.0 +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES might not happen, you should be sure to include an +dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config]= )dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=3Dno +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variabl= es $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed =3D yes; then + AC_MSG_RESULT([no]) + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported =3D yes; then + $1[]_PKG_ERRORS=3D`$PKG_CONFIG --short-errors --print-errors --cf= lags --libs "$2" 2>&1` + else=20 + $1[]_PKG_ERRORS=3D`$PKG_CONFIG --print-errors --cflags --libs "$2= " 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + m4_default([$4], [AC_MSG_ERROR( +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT])[]dnl + ]) +elif test $pkg_failed =3D untried; then + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])[]dnl + ]) +else + $1[]_CFLAGS=3D$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=3D$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + $3 +fi[]dnl +])dnl PKG_CHECK_MODULES + + +dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +dnl [ACTION-IF-NOT-FOUND]) +dnl --------------------------------------------------------------------- +dnl Since: 0.29 +dnl +dnl Checks for existence of MODULES and gathers its build flags with +dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags +dnl and VARIABLE-PREFIX_LIBS from --libs. +dnl +dnl Note that if there is a possibility the first call to +dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to +dnl include an explicit call to PKG_PROG_PKG_CONFIG in your +dnl configure.ac. +AC_DEFUN([PKG_CHECK_MODULES_STATIC], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +_save_PKG_CONFIG=3D$PKG_CONFIG +PKG_CONFIG=3D"$PKG_CONFIG --static" +PKG_CHECK_MODULES($@) +PKG_CONFIG=3D$_save_PKG_CONFIG[]dnl +])dnl PKG_CHECK_MODULES_STATIC + + +dnl PKG_INSTALLDIR([DIRECTORY]) +dnl ------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable pkgconfigdir as the location where a module +dnl should install pkg-config .pc files. By default the directory is +dnl $libdir/pkgconfig, but the default can be changed by passing +dnl DIRECTORY. The user can override through the --with-pkgconfigdir +dnl parameter. +AC_DEFUN([PKG_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config installation directory @<:@]pkg_default[@:>@]) +AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, + [with_pkgconfigdir=3D]pkg_default) +AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_INSTALLDIR + + +dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) +dnl -------------------------------- +dnl Since: 0.27 +dnl +dnl Substitutes the variable noarch_pkgconfigdir as the location where a +dnl module should install arch-independent pkg-config .pc files. By +dnl default the directory is $datadir/pkgconfig, but the default can be +dnl changed by passing DIRECTORY. The user can override through the +dnl --with-noarch-pkgconfigdir parameter. +AC_DEFUN([PKG_NOARCH_INSTALLDIR], +[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) +m4_pushdef([pkg_description], + [pkg-config arch-independent installation directory @<:@]pkg_default[@= :>@]) +AC_ARG_WITH([noarch-pkgconfigdir], + [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, + [with_noarch_pkgconfigdir=3D]pkg_default) +AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) +m4_popdef([pkg_default]) +m4_popdef([pkg_description]) +])dnl PKG_NOARCH_INSTALLDIR + + +dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, +dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +dnl ------------------------------------------- +dnl Since: 0.28 +dnl +dnl Retrieves the value of the pkg-config variable for the given module. +AC_DEFUN([PKG_CHECK_VAR], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl + +_PKG_CONFIG([$1], [variable=3D"][$3]["], [$2]) +AS_VAR_COPY([$1], [pkg_cv_][$1]) + +AS_VAR_IF([$1], [""], [$5], [$4])dnl +])dnl PKG_CHECK_VAR Index: configure.ac =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- configure.ac (revision 242681) +++ configure.ac (working copy) @@ -29,6 +29,7 @@ m4_include([ltversion.m4]) m4_include([lt~obsolete.m4]) m4_include([config/isl.m4]) +m4_include([config/pkg.m4]) =20 AC_INIT(move-if-change) AC_PREREQ(2.64) @@ -161,7 +162,6 @@ target-libssp \ target-libquadmath \ target-libgfortran \ - target-boehm-gc \ target-libffi \ target-libobjc \ target-libada \ @@ -2060,22 +2060,36 @@ AC_ARG_ENABLE(objc-gc, [AS_HELP_STRING([--enable-objc-gc], [enable use of Boehm's garbage collector with the - GNU Objective-C runtime])], -[case ,${enable_languages},:${enable_objc_gc}:${noconfigdirs} in - *,objc,*:*:yes:*target-boehm-gc*) - AC_MSG_ERROR([Boehm's garbage collector was requested yet not supporte= d in this configuration]) - ;; -esac]) - -# Make sure we only build Boehm's garbage collector if required. -case ,${enable_languages},:${enable_objc_gc} in - *,objc,*:yes) - # Keep target-boehm-gc if requested for Objective-C. - ;; - *) - # Otherwise remove target-boehm-gc. - noconfigdirs=3D"$noconfigdirs target-boehm-gc" - ;; + GNU Objective-C runtime])]) +AC_ARG_WITH([target-bdw-gc], +[AS_HELP_STRING([--with-target-bdw-gc=3DPATHLIST], + [specify prefix directory for installed bdw-gc package. + Equivalent to --with-target-bdw-gc-include=3DPATH/include + plus --with-target-bdw-gc-lib=3DPATH/lib])]) +AC_ARG_WITH([target-bdw-gc-include], +[AS_HELP_STRING([--with-target-bdw-gc-include=3DPATHLIST], + [specify directories for installed bdw-gc include files])]) +AC_ARG_WITH([target-bdw-gc-lib], +[AS_HELP_STRING([--with-target-bdw-gc-lib=3DPATHLIST], + [specify directories for installed bdw-gc library])]) +=09=09=20=20 +case ,${enable_languages},:${enable_objc_gc} in *,objc,*:yes|*,objc,*:auto) + AC_MSG_CHECKING([for bdw garbage collector]) + if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw= _gc_lib" =3D x; then + dnl no bdw-gw options, fall back to the bdw-gc pkg-config module + PKG_CHECK_EXISTS(bdw-gc, + AC_MSG_RESULT([using bdw-gc pkg-config module]), + AC_MSG_ERROR([no --with-target-bdw-gc options and no bdw-gc pkg-conf= ig module found])) + else + dnl bdw-gw options, first error checking, complete checking in libobjc + if test "x$with_target_bdw_gc_include" =3D x && test "x$with_target_bd= w_gc_lib" !=3D x; then + AC_MSG_ERROR([found --with-target-bdw-gc-lib but --with-target-bdw-g= c-include missing]) + elif test "x$with_target_bdw_gc_include" !=3D x && test "x$with_target= _bdw_gc_lib" =3D x; then + AC_MSG_ERROR([found --with-target-bdw-gc-include but --with-target-b= dw-gc-lib missing]) + else + AC_MSG_RESULT([using paths configured with --with-target-bdw-gc opti= ons]) + fi + fi esac =20 # Disable libcilkrts, libitm, libsanitizer, libvtv, liboffloadmic if we're= not building C++ Index: gcc/doc/install.texi =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- gcc/doc/install.texi (revision 242681) +++ gcc/doc/install.texi (working copy) @@ -2143,6 +2143,37 @@ overrides, you can pass a setting for @env{CONFIG_SITE} and set variables in the site file. =20 +@subheading Objective-C-Specific Options + +The following options apply to the build of the Objective-C runtime librar= y. + +@table @code +@item --enable-objc-gc +Specify that an additional variant of the GNU Objective-C runtime library +is built, using an external build of the Boehm-Demers-Weiser garbage +collector (@uref{http://www.hboehm.info/gc/}). This library needs to be +available for each multilib variant, unless configured with +@option{--enable-objc-gc=3D@samp{auto}} in which case the build of the +additional runtime library is skipped when not available and the build +continues. + +@item --with-target-bdw-gc=3D@var{list} +@itemx --with-target-bdw-gc-include=3D@var{list} +@itemx --with-target-bdw-gc-lib=3D@var{list} +Specify search directories for the garbage collector header files and +libraries. @var{list} is a comma separated list of key value pairs of the +form @samp{@var{multilibdir}@=3D@var{path}}, where the default multilib key +is named as @samp{.} (dot), or is omitted (e.g. +@samp{--with-target-bdw-gc=3D/opt/bdw-gc,32=3D/opt-bdw-gc32}). + +The options @option{--with-target-bdw-gc-include} and +@option{--with-target-bdw-gc-lib} must always be specified together +for each multilib variant and they take precedence over +@option{--with-target-bdw-gc}. If none of these options are +specified, the values are taken from the @command{pkg-config} +@samp{bdw-gc} module. +@end table + @html

Index: libobjc/Makefile.in =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libobjc/Makefile.in (revision 242681) +++ libobjc/Makefile.in (working copy) @@ -47,8 +47,6 @@ =20 top_builddir =3D . =20 --include ../boehm-gc/threads.mk - libdir =3D $(exec_prefix)/lib libsubdir =3D $(libdir)/gcc/$(target_noncanonical)/$(gcc_version) =20 @@ -95,7 +93,7 @@ OBJC_GCFLAGS=3D@OBJC_GCFLAGS@ OBJC_BOEHM_GC=3D@OBJC_BOEHM_GC@ OBJC_BOEHM_GC_INCLUDES=3D@OBJC_BOEHM_GC_INCLUDES@ -OBJC_BOEHM_GC_LIBS=3D../boehm-gc/libgcjgc_convenience.la $(thread_libs_and= _flags) +OBJC_BOEHM_GC_LIBS=3D@OBJC_BOEHM_GC_LIBS@ =20 INCLUDES =3D -I$(srcdir)/$(MULTISRCTOP)../gcc \ -I$(srcdir)/$(MULTISRCTOP)../gcc/config \ Index: libobjc/configure.ac =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libobjc/configure.ac (revision 242681) +++ libobjc/configure.ac (working copy) @@ -18,6 +18,8 @@ #along with GCC; see the file COPYING3. If not see #. =20 +m4_include([../config/pkg.m4]) + AC_PREREQ(2.64) AC_INIT(package-unused, version-unused,, libobjc) AC_CONFIG_SRCDIR([objc/objc.h]) @@ -57,26 +59,6 @@ [version_specific_libs=3Dno]) AC_MSG_RESULT($version_specific_libs) =20 -AC_ARG_ENABLE(objc-gc, -[ --enable-objc-gc enable the use of Boehm's garbage collector with - the GNU Objective-C runtime.], -[case $enable_objc_gc in - no) - OBJC_GCFLAGS=3D'' - OBJC_BOEHM_GC=3D'' - OBJC_BOEHM_GC_INCLUDES=3D'' - ;; - *) - OBJC_GCFLAGS=3D'-DOBJC_WITH_GC=3D1' - OBJC_BOEHM_GC=3D'libobjc_gc$(libsuffix).la' - OBJC_BOEHM_GC_INCLUDES=3D'-I$(top_srcdir)/../boehm-gc/include -I../boe= hm-gc/include' - ;; -esac], -[OBJC_GCFLAGS=3D''; OBJC_BOEHM_GC=3D''; OBJC_BOEHM_GC_INCLUDES=3D'']) -AC_SUBST(OBJC_GCFLAGS) -AC_SUBST(OBJC_BOEHM_GC) -AC_SUBST(OBJC_BOEHM_GC_INCLUDES) - # ----------- # Directories # ----------- @@ -214,6 +196,163 @@ =20 gt_BITFIELD_TYPE_MATTERS =20 +# ----------- +# boehm-gc +# ----------- + +AC_ARG_ENABLE(objc-gc, +[AS_HELP_STRING([--enable-objc-gc], + [enable use of Boehm's garbage collector with the + GNU Objective-C runtime])]) +AC_ARG_WITH([target-bdw-gc], +[AS_HELP_STRING([--with-target-bdw-gc=3DPATHLIST], + [specify prefix directory for installed bdw-gc package. + Equivalent to --with-target-bdw-gc-include=3DPATH/include + plus --with-target-bdw-gc-lib=3DPATH/lib])]) +AC_ARG_WITH([target-bdw-gc-include], +[AS_HELP_STRING([--with-target-bdw-gc-include=3DPATHLIST], + [specify directories for installed bdw-gc include files])]) +AC_ARG_WITH([target-bdw-gc-lib], +[AS_HELP_STRING([--with-target-bdw-gc-lib=3DPATHLIST], + [specify directories for installed bdw-gc library])]) +=09=09=20=20 +case "$enable_objc_gc" in +no) + use_bdw_gc=3Dno + ;; +*) + AC_MSG_CHECKING([for bdw garbage collector]) + if test "x$with_target_bdw_gc$with_target_bdw_gc_include$with_target_bdw= _gc_lib" =3D x; then + dnl no bdw-gw options, fall back to the bdw-gc pkg-config module + PKG_CHECK_EXISTS(bdw-gc, + AC_MSG_RESULT([using bdw-gc pkg-config module]), + AC_MSG_ERROR([no --with-target-bdw-gc options and no bdw-gc pkg-conf= ig module found])) + else + dnl bdw-gw options, first error checking, complete checking in libobjc + if test "x$with_target_bdw_gc_include" =3D x && test "x$with_target_bd= w_gc_lib" !=3D x; then + AC_MSG_ERROR([found --with-target-bdw-gc-lib but --with-target-bdw-g= c-include missing]) + elif test "x$with_target_bdw_gc_include" !=3D x && test "x$with_target= _bdw_gc_lib" =3D x; then + AC_MSG_ERROR([found --with-target-bdw-gc-include but --with-target-b= dw-gc-lib missing]) + else + AC_MSG_RESULT([using paths configured with --with-target-bdw-gc opti= ons]) + fi + fi + mldir=3D`${CC-gcc} --print-multi-directory 2>/dev/null` + bdw_val=3D + if test "x$with_target_bdw_gc" !=3D x; then + for i in `echo $with_target_bdw_gc | tr ',' ' '`; do + case "$i" in + *=3D*) sd=3D${i%%=3D*}; d=3D${i#*=3D} ;; + *) sd=3D.; d=3D$i ;; + esac + if test "$mldir" =3D "$sd"; then + bdw_val=3D$d + fi + done + if test "x$bdw_val" =3D x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-g= c]) + fi + bdw_inc_dir=3D"$bdw_val/include" + bdw_lib_dir=3D"$bdw_val/lib" + fi + bdw_val=3D + if test "x$with_target_bdw_gc_include" !=3D x; then + for i in `echo $with_target_bdw_gc_include | tr ',' ' '`; do + case "$i" in + *=3D*) sd=3D${i%%=3D*}; d=3D${i#*=3D} ;; + *) sd=3D.; d=3D$i ;; + esac + if test "$mldir" =3D "$sd"; then + bdw_val=3D$d + fi + done + if test "x$bdw_val" =3D x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-g= c-include]) + fi + bdw_inc_dir=3D"$bdw_val" + fi + bdw_val=3D + if test "x$with_target_bdw_gc_lib" !=3D x; then + for i in `echo $with_target_bdw_gc_lib | tr ',' ' '`; do + case "$i" in + *=3D*) sd=3D${i%%=3D*}; d=3D${i#*=3D} ;; + *) sd=3D.; d=3D$i ;; + esac + if test "$mldir" =3D "$sd"; then + bdw_val=3D$d + fi + done + if test "x$bdw_val" =3D x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-g= c-lib]) + fi + bdw_lib_dir=3D"$bdw_val" + fi + if test "x$bdw_inc_dir" =3D x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-= include]) + fi + if test "x$bdw_lib_dir" =3D x; then + AC_MSG_ERROR([no multilib path ($mldir) found in --with-target-bdw-gc-= lib]) + fi + BDW_GC_CFLAGS=3D"-I$bdw_inc_dir" + BDW_GC_LIBS=3D"-L$bdw_lib_dir -lgc" + AC_MSG_RESULT([found]) + use_bdw_gc=3Dmaybe +esac + +if test "$use_bdw_gc" =3D maybe; then + AC_MSG_CHECKING([for system boehm-gc]) + save_CFLAGS=3D$CFLAGS + save_LIBS=3D$LIBS + CFLAGS=3D"$CFLAGS $BDW_GC_CFLAGS" + LIBS=3D"$LIBS $BDW_GC_LIBS" + dnl the link test is not good enough for ARM32 multilib detection, + dnl first check to link, then to run + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([#include ],[GC_init()])], + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ + #include + int main() { + GC_init(); + return 0; + } + ]])], + [system_bdw_gc_found=3Dyes], + [system_bdw_gc_found=3Dno], + dnl assume no system boehm-gc for cross builds ... + [system_bdw_gc_found=3Dno] + ) + ], + [system_bdw_gc_found=3Dno]) + CFLAGS=3D$save_CFLAGS + LIBS=3D$save_LIBS + if test x$enable_objc_gc =3D xauto && test x$system_bdw_gc_found =3D xno= ; then + AC_MSG_WARN([system bdw-gc not found, not building libobjc_gc]) + use_bdw_gc=3Dno + elif test x$enable_objc_gc =3D xyes && test x$system_bdw_gc_found =3D xn= o; then + AC_MSG_ERROR([system bdw-gc required but not found]) + else + use_bdw_gc=3Dyes + AC_MSG_RESULT([found]) + fi +fi + +if test "$use_bdw_gc" =3D no; then + OBJC_GCFLAGS=3D'' + OBJC_BOEHM_GC=3D'' + OBJC_BOEHM_GC_INCLUDES=3D'' + OBJC_BOEHM_GC_LIBS=3D'' +else + OBJC_GCFLAGS=3D'-DOBJC_WITH_GC=3D1' + OBJC_BOEHM_GC=3D'libobjc_gc$(libsuffix).la' + OBJC_BOEHM_GC_INCLUDES=3D$BDW_GC_CFLAGS + OBJC_BOEHM_GC_LIBS=3D$BDW_GC_LIBS +fi +AC_SUBST(OBJC_GCFLAGS) +AC_SUBST(OBJC_BOEHM_GC) +AC_SUBST(OBJC_BOEHM_GC_INCLUDES) +AC_SUBST(OBJC_BOEHM_GC_LIBS) + # ------ # Output # ------ Index: libobjc/gc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libobjc/gc.c (revision 242681) +++ libobjc/gc.c (working copy) @@ -36,7 +36,7 @@ #include "objc/runtime.h" #include "objc-private/module-abi-8.h" =20 -#include +#include #include =20 /* gc_typed.h uses the following but doesn't declare them */ @@ -44,7 +44,7 @@ typedef GC_signed_word signed_word; #define BITS_PER_WORD (CHAR_BIT * sizeof (word)) =20 -#include +#include =20 /* The following functions set up in `mask` the corresponding pointers. The offset is incremented with the size of the type. */ Index: libobjc/memory.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libobjc/memory.c (revision 242681) +++ libobjc/memory.c (working copy) @@ -41,7 +41,7 @@ #include "objc/runtime.h" =20 #if OBJC_WITH_GC -#include +#include =20 void * objc_malloc (size_t size) Index: libobjc/objects.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- libobjc/objects.c (revision 242681) +++ libobjc/objects.c (working copy) @@ -31,8 +31,8 @@ #include /* For memcpy() */ =20 #if OBJC_WITH_GC -# include -# include +# include +# include #endif =20 /* FIXME: The semantics of extraBytes are not really clear. */ --------------7DB5557C80CF989379BD5AFD--