Don't require pkg-config when building from repository.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 May 2014 15:49:13 +0000 (08:49 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 16 May 2014 15:49:13 +0000 (08:49 -0700)
* INSTALL: Prefer './configure FOO=BAR' to 'FOO=BAR ./configure'.
* INSTALL.REPO: pkg-config is no longer required to build from
the repository.
* autogen.sh: Don't check for pkg-config.
(progs): Remove pkg-config.
(pkg_config_min, AUTORECONF_ENV, env_space, ACLOCAL_PATH):
Remove.  All uses removed.
* m4/pkg.m4: New file, built by admin/merge-pkg-config.
* configure.ac: Remove unnecessary m4_pattern_forbid of ^PKG_ and
an AC_ARG_VAR of PKG_CONFIG_PATH.  pkg.m4 does that for us.
(EMACS_CHECK_MODULES): Remove workaround for old pkg-config bug,
as we use pkg.m4 from a newer pkg-config.
* admin/merge-pkg-config: New script.
* admin/notes/copyright: Update for m4/*.m4, in particular m4/pkg.m4.
* etc/NEWS: Prefer './configure FOO=BAR' to 'FOO=BAR ./configure'.
* etc/PROBLEMS (Build-time-problems): Remove pkg-config problem
that is no longer an issue.
* nt/INSTALL: Remove no-longer-needed notes about pkg-config.

14 files changed:
ChangeLog
INSTALL
INSTALL.REPO
admin/ChangeLog
admin/merge-pkg-config [new file with mode: 0755]
admin/notes/copyright
autogen.sh
configure.ac
etc/ChangeLog
etc/NEWS
etc/PROBLEMS
m4/pkg.m4 [new file with mode: 0644]
nt/ChangeLog
nt/INSTALL

index d7c0822..70e7de0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2014-05-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Don't require pkg-config when building from repository.
+       * INSTALL: Prefer './configure FOO=BAR' to 'FOO=BAR ./configure'.
+       * INSTALL.REPO: pkg-config is no longer required to build from
+       the repository.
+       * autogen.sh: Don't check for pkg-config.
+       (progs): Remove pkg-config.
+       (pkg_config_min, AUTORECONF_ENV, env_space, ACLOCAL_PATH):
+       Remove.  All uses removed.
+       * m4/pkg.m4: New file, built by admin/merge-pkg-config.
+       * configure.ac: Remove unnecessary m4_pattern_forbid of ^PKG_ and
+       an AC_ARG_VAR of PKG_CONFIG_PATH.  pkg.m4 does that for us.
+       (EMACS_CHECK_MODULES): Remove workaround for old pkg-config bug,
+       as we use pkg.m4 from a newer pkg-config.
+
 2014-05-15  Jan Djärv  <jan.h.d@swipnet.se>
 
        * configure.ac (LIBPNG): Do not test for libpng if NS_IMPL_COCOA.
diff --git a/INSTALL b/INSTALL
index 3502631..473dc08 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -262,9 +262,9 @@ with the mouse.  You can get fancy 3D-style scroll bars, even without
 Gtk or Motif, if you have the Xaw3d library installed (see
 "Image support libraries" above for Xaw3d availability).
 
-You can tell configure where to search for GTK by specifying
-`--with-pkg-config-prog=PATH' where PATH is the pathname to
-pkg-config.  Note that GTK version 2.6 or newer is required for Emacs.
+You can tell configure where to search for GTK by giving it the
+argument PKG_CONFIG='/full/name/of/pkg-config'.  GTK version 2.6 or
+newer is required for Emacs.
 
 Emacs will autolaunch a D-Bus session bus, when the environment
 variable DISPLAY is set, but no session bus is running.  This might be
@@ -408,10 +408,11 @@ compiler.  By default, gcc is used if available.
 Here's an example of a `configure' invocation, assuming a Bourne-like
 shell such as Bash, which uses these variables:
 
- CPPFLAGS='-I/foo/myinclude' LDFLAGS='-L/bar/mylib' \
-  CFLAGS='-O3' LIBS='-lfoo -lbar' ./configure
+  ./configure \
+    CPPFLAGS='-I/foo/myinclude' LDFLAGS='-L/bar/mylib' \
+    CFLAGS='-O3' LIBS='-lfoo -lbar'
 
-(this is all one long line).  This tells `configure' to instruct the
+(this is all one shell command).  This tells `configure' to instruct the
 preprocessor to look in the `/foo/myinclude' directory for header
 files (in addition to the standard directories), instruct the linker
 to look in `/bar/mylib' for libraries, pass the -O3 optimization
@@ -421,12 +422,11 @@ libraries in addition to the standard ones.
 For some libraries, like Gtk+, fontconfig and ALSA, `configure' uses
 pkg-config to find where those libraries are installed.
 If you want pkg-config to look in special directories, you have to set
-the environment variable PKG_CONFIG_PATH to point to the directories
-where the .pc-files for those libraries are.
-For example:
+PKG_CONFIG_PATH to point to the directories where the .pc-files for
+those libraries are.  For example:
 
PKG_CONFIG_PATH='/usr/local/alsa/lib/pkgconfig:/opt/gtk+-2.8/lib/pkgconfig' \
-   ./configure
 ./configure \
+    PKG_CONFIG_PATH='/usr/local/alsa/lib/pkgconfig:/opt/gtk+-2.8/lib/pkgconfig'
 
 The work of `configure' can be done by editing various files in the
 distribution, but using `configure' is easier.  See the section called
index c1617e7..36ab928 100644 (file)
@@ -12,8 +12,6 @@ autoconf  - at least the version specified near the start of
   configure.ac (in the AC_PREREQ command).
 automake  - at least the version specified near the start of
   configure.ac (in the AM_INIT_AUTOMAKE command).
-pkg-config - at least version specified in the PKG_PROG_PKG_CONFIG
-  command in configure.ac
 makeinfo  - not strictly necessary, but highly recommended, so that
   you can build the manuals.
 
index 5eeec00..0981e0e 100644 (file)
@@ -1,3 +1,9 @@
+2014-05-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Don't require pkg-config when building from repository.
+       * merge-pkg-config: New script.
+       * notes/copyright: Update for m4/*.m4, in particular m4/pkg.m4.
+
 2014-05-13  Paul Eggert  <eggert@cs.ucla.edu>
 
        * merge-gnulib: Defer to autogen.sh for ACLOCAL_PATH computation.
diff --git a/admin/merge-pkg-config b/admin/merge-pkg-config
new file mode 100755 (executable)
index 0000000..fd03a44
--- /dev/null
@@ -0,0 +1,63 @@
+#! /bin/sh
+# Merge pkg-config macros into Emacs sources.
+# Typical usage:
+#
+#      admin/merge-pkg-config
+
+# Copyright 2014 Free Software Foundation, Inc.
+
+# This file is part of GNU Emacs.
+
+# GNU Emacs 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.
+
+# GNU Emacs 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 Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+# written by Paul Eggert
+
+{
+  # Maybe ACLOCAL_PATH is already set-up.
+  oIFS=$IFS
+  IFS=:
+  for dir in $ACLOCAL_PATH ''; do
+    test -n "$dir" && test -r "$dir/pkg.m4" && break
+  done
+  IFS=$oIFS
+
+  test -n "$dir"
+} || {
+  # Use the pkg.m4 installed where aclocal knows about it.
+  # Maybe we are running our own aclocal, which doesn't know where
+  # the standard pkg.m4 is installed, so try running all the
+  # aclocal programs in our PATH.
+  oIFS=$IFS
+  IFS=:
+  for dir in $PATH ''; do
+    if test -n "$dir" && test -x "$dir/aclocal"; then
+      dir=$("$dir/aclocal" --print-ac-dir) && test -r "$dir/pkg.m4" && break
+    fi
+  done
+  IFS=$oIFS
+
+  test -n "$dir"
+} || {
+  echo >&2 "$0: cannot find pkg.m4"
+  exit 1
+}
+
+test -d m4 || {
+  echo >&2 "$0: please run this command in the main source directory"
+  exit 1
+}
+
+echo >&2 "$0: copying $dir/pkg.m4 to m4/pkg.m4"
+
+cp $dir/pkg.m4 m4
index 9b4fd55..ebef063 100644 (file)
@@ -137,7 +137,10 @@ GNUstep/Emacs.base/Resources/Info-gnustep.plist
 aclocal.m4
 configure
 m4/*.m4
- - copyright FSF, with unlimited permission to copy, distribute and modify
+ - These files are copyright FSF, with unlimited permission to copy,
+   distribute and modify, so long as the copyright notice is preserved.
+   Exception: m4/pkg.m4 is copyright Scott James Remnant; it is
+   distributed under the same terms as for the rest of Emacs.
 
 lib/Makefile.in
  - copyright FSF, with MIT-like license
index 32f86ab..48e6d19 100755 (executable)
@@ -32,7 +32,7 @@
 
 ## Tools we need:
 ## Note that we respect the values of AUTOCONF etc, like autoreconf does.
-progs="autoconf automake pkg-config"
+progs="autoconf automake"
 
 ## Minimum versions we need:
 autoconf_min=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.ac`
@@ -41,7 +41,6 @@ autoconf_min=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.ac`
 ## AM_INIT_AUTOMAKE call.
 automake_min=`sed -n 's/^ *AM_INIT_AUTOMAKE(\([0-9\.]*\)).*/\1/p' configure.ac`
 
-pkg_config_min=`sed -n 's/^ *PKG_PROG_PKG_CONFIG(\([0-9\.]*\)).*/\1/p' configure.ac`
 
 ## $1 = program, eg "autoconf".
 ## Echo the version string, eg "2.59".
@@ -205,97 +204,8 @@ EOF
     exit 1
 fi
 
-# If automake is installed in a nonstandard location, find the standard
-# location if possible and append it to ACLOCAL_PATH.  That way, it will
-# find the pkg.m4 that is installed in the standard location.
-echo "Checking for pkg.m4..."
-AUTORECONF_ENV=
-env_space=
-ac_dir=`aclocal --print-ac-dir` || {
-    cat <<EOF
-There was a problem running 'aclocal --print-ac-dir'.
-The aclocal program is part of automake.
-Please check your automake installation.
-EOF
-
-    exit 1
-}
-
-test -n "$ac_dir" && test -r "$ac_dir/pkg.m4" || {
-
-  # Maybe ACLOCAL_PATH is already set-up.
-  if test -n "$ACLOCAL_PATH"; then
-    oIFS=$IFS
-    IFS=:
-    for dir in $ACLOCAL_PATH; do
-      if test -r "$dir/pkg.m4"; then
-       AUTORECONF_ENV="ACLOCAL_PATH='$ACLOCAL_PATH'"
-        env_space=' '
-       break
-      fi
-    done
-    IFS=$oIFS
-  fi
-
-  if test -z "$AUTORECONF_ENV"; then
-    oIFS=$IFS
-    IFS=:
-    before_first_aclocal=true
-    for dir in $PATH; do
-      if test -x "$dir/aclocal"; then
-        if $before_first_aclocal; then
-          before_first_aclocal=false
-        elif ac_dir=`"$dir/aclocal" --print-ac-dir` && test -r "$ac_dir/pkg.m4"
-        then
-          case $ACLOCAL_PATH in
-            '') ACLOCAL_PATH=$ac_dir;;
-            ?*) ACLOCAL_PATH=$ACLOCAL_PATH:$ac_dir;;
-          esac
-          export ACLOCAL_PATH
-          AUTORECONF_ENV="ACLOCAL_PATH='$ACLOCAL_PATH'"
-          env_space=' '
-          break
-        fi
-      fi
-    done
-    IFS=$oIFS
-  fi
-
-  ## OK, maybe pkg-config is in a weird place (eg on hydra).
-  if test -z "$AUTORECONF_ENV"; then
-    oIFS=$IFS
-    IFS=:
-    for dir in $PATH; do
-      if test -x "$dir/pkg-config"; then
-        ac_dir=`echo "$dir" | sed 's|bin$|share/aclocal|'`
-        if test -r "$ac_dir/pkg.m4"; then
-          case $ACLOCAL_PATH in
-            '') ACLOCAL_PATH=$ac_dir;;
-            ?*) ACLOCAL_PATH=$ACLOCAL_PATH:$ac_dir;;
-          esac
-          export ACLOCAL_PATH
-          AUTORECONF_ENV="ACLOCAL_PATH='$ACLOCAL_PATH'"
-          env_space=' '
-          break
-        fi
-      fi
-    done
-    IFS=$oIFS
-  fi
-
-  if test -z "$AUTORECONF_ENV"; then
-    cat <<EOF
-The version of aclocal that you are using cannot find the pkg.m4 file that
-pkg-config provides.  If it is installed in some unusual directory /FOO/BAR,
-set ACLOCAL_PATH='/FOO/BAR' in the environment and run this script again.
-EOF
-    exit 1
-  fi
-}
-echo ok
-
 echo 'Your system has the required tools.'
-echo "Running \"$AUTORECONF_ENV${env_space}autoreconf -fi -I m4\" ..."
+echo "Running 'autoreconf -fi -I m4' ..."
 
 
 ## Let autoreconf figure out what, if anything, needs doing.
@@ -306,7 +216,7 @@ autoreconf -fi -I m4 || exit $?
 ## cause 'make' to needlessly run 'autoheader'.
 echo timestamp > src/stamp-h.in || exit
 
-echo "You can now run \"./configure$env_space$AUTORECONF_ENV\"."
+echo "You can now run './configure'."
 
 exit 0
 
index 5e30c49..03b85a5 100644 (file)
@@ -296,7 +296,7 @@ otherwise for the first of `gfile' or `inotify' that is usable.])
 dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html
 OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals])
 
-## This might be a 'configure' arg, e.g., autogen.sh might set it.
+## This might be a 'configure' arg.
 AC_SUBST([ACLOCAL_PATH])
 
 ## Makefile.in needs the cache file name.
@@ -1359,10 +1359,6 @@ AC_SUBST(LIB_MATH)
 AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
   [The type of system you are compiling for; sets `system-type'.])
 
-m4_pattern_forbid([^PKG_])
-
-AC_ARG_VAR(PKG_CONFIG_PATH, [Colon-separated list of directories
-searched by pkg-config])
 
 pre_PKG_CONFIG_CFLAGS=$CFLAGS
 pre_PKG_CONFIG_LIBS=$LIBS
@@ -1372,24 +1368,15 @@ PKG_PROG_PKG_CONFIG(0.9.0)
 dnl EMACS_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4)
 dnl acts like PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4,
 dnl HAVE_GSTUFF=yes, HAVE_GSTUFF=no) -- see pkg-config man page --
-dnl except that it works around older pkg-config bugs and
-dnl it postprocesses CFLAGS as needed for --enable-gcc-warnings.
+dnl except that it postprocesses CFLAGS as needed for --enable-gcc-warnings.
 dnl EMACS_CHECK_MODULES accepts optional 3rd and 4th arguments that
 dnl can take the place of the default HAVE_GSTUFF=yes and HAVE_GSTUFF=no
 dnl actions.
 AC_DEFUN([EMACS_CHECK_MODULES],
-  [dnl pkg-config before 0.26 doesn't check exit status properly; see:
-   dnl https://bugs.freedesktop.org/show_bug.cgi?id=29801
-   dnl Work around the bug by checking the status ourselves.
-   emacs_check_module_ok=false
-   AS_IF([test -n "$PKG_CONFIG" &&
-         { $PKG_CONFIG --atleast-pkgconfig-version 0.26 ||
-           { $PKG_CONFIG --cflags "$2" && $PKG_CONFIG --libs "$2"; }
-         } >/dev/null 2>&AS_MESSAGE_LOG_FD],
-     [PKG_CHECK_MODULES([$1], [$2],
-       [$1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
-        emacs_check_module_ok=:],
-       [:])])
+  [PKG_CHECK_MODULES([$1], [$2],
+     [$1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
+      emacs_check_module_ok=:],
+     [:])
    if $emacs_check_module_ok; then
      m4_default([$3], [HAVE_$1=yes])
    else
index ea0db24..80f3bf5 100644 (file)
@@ -1,3 +1,10 @@
+2014-05-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Don't require pkg-config when building from repository.
+       * NEWS: Prefer './configure FOO=BAR' to 'FOO=BAR ./configure'.
+       * PROBLEMS (Build-time-problems): Remove pkg-config problem
+       that is no longer an issue.
+
 2014-05-13  Dmitry Antipov  <dmantipov@yandex.ru>
 
        * PROBLEMS: Mention potential problems with
index 42f2a87..cfee11e 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -36,7 +36,7 @@ or by sticking with Emacs 24.4.
 
 ---
 ** The configure option `--with-pkg-config-prog' has been removed.
-Use the PKG_CONFIG environment variable instead if you need to.
+Use './configure PKG_CONFIG=/full/name/of/pkg-config' if you need to.
 
 \f
 * Startup Changes in Emacs 24.5
index 6ea6993..1fffe06 100644 (file)
@@ -2237,17 +2237,6 @@ If you do, please send it to bug-gnu-emacs@gnu.org so we can list it here.
 
 * Build-time problems
 
-** Autoreconf
-
-*** autoreconf fails with "possibly undefined macro: PKG_CONFIG".
-This can happen if you installed your own automake in a non-standard
-location /prefix.  The simplest workaround is to run ./autogen.sh
-instead.  If you prefer to run autoreconf directly, then if pkg.m4 is
-in the directory /usr/share/aclocal you can append /usr/share/local to
-your ACLOCAL_PATH environment variable, or you can add a line
-"/usr/share/aclocal" to the file /prefix/share/aclocal/dirlist (create
-the file if necessary).
-
 ** Configuration
 
 *** `configure' warns ``accepted by the compiler, rejected by the preprocessor''.
diff --git a/m4/pkg.m4 b/m4/pkg.m4
new file mode 100644 (file)
index 0000000..c5b26b5
--- /dev/null
+++ b/m4/pkg.m4
@@ -0,0 +1,214 @@
+# pkg.m4 - Macros to locate and utilise pkg-config.            -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
+# 
+# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# PKG_PROG_PKG_CONFIG([MIN-VERSION])
+# ----------------------------------
+AC_DEFUN([PKG_PROG_PKG_CONFIG],
+[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
+m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
+m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
+if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
+       AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+fi
+if test -n "$PKG_CONFIG"; then
+       _pkg_min_version=m4_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=""
+       fi
+fi[]dnl
+])# PKG_PROG_PKG_CONFIG
+
+# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+#
+# Check to see whether a particular set of modules exists.  Similar
+# to PKG_CHECK_MODULES(), but does not set variables or print errors.
+#
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# 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])
+
+# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
+# ---------------------------------------------
+m4_define([_PKG_CONFIG],
+[if test -n "$$1"; then
+    pkg_cv_[]$1="$$1"
+ elif test -n "$PKG_CONFIG"; then
+    PKG_CHECK_EXISTS([$3],
+                     [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
+                     test "x$?" != "x0" && pkg_failed=yes ],
+                    [pkg_failed=yes])
+ else
+    pkg_failed=untried
+fi[]dnl
+])# _PKG_CONFIG
+
+# _PKG_SHORT_ERRORS_SUPPORTED
+# -----------------------------
+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=yes
+else
+        _pkg_short_errors_supported=no
+fi[]dnl
+])# _PKG_SHORT_ERRORS_SUPPORTED
+
+
+# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND],
+# [ACTION-IF-NOT-FOUND])
+#
+#
+# Note that if there is a possibility the first call to
+# PKG_CHECK_MODULES might not happen, you should be sure to include an
+# 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=no
+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 variables $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 = yes; then
+       AC_MSG_RESULT([no])
+        _PKG_SHORT_ERRORS_SUPPORTED
+        if test $_pkg_short_errors_supported = yes; then
+               $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
+        else 
+               $1[]_PKG_ERRORS=`$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 = 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 <http://pkg-config.freedesktop.org/>.])[]dnl
+        ])
+else
+       $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
+       $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
+        AC_MSG_RESULT([yes])
+       $3
+fi[]dnl
+])# PKG_CHECK_MODULES
+
+
+# PKG_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable pkgconfigdir as the location where a module
+# should install pkg-config .pc files. By default the directory is
+# $libdir/pkgconfig, but the default can be changed by passing
+# DIRECTORY. The user can override through the --with-pkgconfigdir
+# 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=]pkg_default)
+AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_INSTALLDIR
+
+
+# PKG_NOARCH_INSTALLDIR(DIRECTORY)
+# -------------------------
+# Substitutes the variable noarch_pkgconfigdir as the location where a
+# module should install arch-independent pkg-config .pc files. By
+# default the directory is $datadir/pkgconfig, but the default can be
+# changed by passing DIRECTORY. The user can override through the
+# --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=]pkg_default)
+AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
+m4_popdef([pkg_default])
+m4_popdef([pkg_description])
+]) dnl PKG_NOARCH_INSTALLDIR
+
+
+# PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE,
+# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -------------------------------------------
+# 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="][$3]["], [$2])
+AS_VAR_COPY([$1], [pkg_cv_][$1])
+
+AS_VAR_IF([$1], [""], [$5], [$4])dnl
+])# PKG_CHECK_VAR
index 16d3e5f..fc1b0a0 100644 (file)
@@ -1,3 +1,8 @@
+2014-05-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Don't require pkg-config when building from repository.
+       * INSTALL: Remove no-longer-needed notes about pkg-config.
+
 2014-05-05  Eli Zaretskii  <eliz@gnu.org>
 
        * INSTALL: Update to the effect that pkg-config is now required
index 0d54f27..949a4e4 100644 (file)
@@ -115,11 +115,6 @@ Windows 9X as well).
   MSYS Texinfo, after installing it as part of msys-base, invoke the
   command "mingw-get remove msys-texinfo".)
 
-  In addition, building Emacs from the development repository requires
-  pkg-config to be installed.  As the MinGW project does not offer it,
-  you will have to install it from elsewhere; see below (search for
-  "pkg-config").
-
   At this point, you should be ready to configure and build Emacs in
   its basic configuration.  Skip to the "Generating the configure
   script" section for the build instructions.  If you want to build it
@@ -179,9 +174,7 @@ Windows 9X as well).
      Available from http://sourceforge.net/projects/ezwinports/files/.
 
    . pkg-config (invoked by the configure script to look for optional
-     packages; _required_ for building from the development
-     repository, as some components of pkg-config are needed to run
-     the autoconf and aclocal scripts)
+     packages)
 
      Available from http://www.gtk.org/download/win32.php
 
@@ -243,10 +236,10 @@ Windows 9X as well).
   from which you unpack all of the MSYS packages.
 
   After installing Automake and Autoconf, make sure any of the *.m4
-  files you might have in your MinGW installation (e.g., pkg.m4 that
-  comes with pkg-config) also exist in the MSYS installation tree, in
-  the share/aclocal directory.  Those *.m4 files which exist in the
-  MinGW tree, but not in the MSYS tree should be copied there.
+  files you might have in your MinGW installation also exist in the
+  MSYS installation tree, in the share/aclocal directory.  Those *.m4
+  files which exist in the MinGW tree, but not in the MSYS tree should
+  be copied there.
 
   If/when you are confident in your MinGW/MSYS installation, and want
   to speed up the builds, we recommend installing a pre-release
@@ -311,10 +304,6 @@ Windows 9X as well).
      ok
      Checking for automake (need at least version 1.11)...
      ok
-     Checking for pkg-config (need at least version 0.9.0)...
-     ok
-     Checking for pkg.m4...
-     ok
      Your system has the required tools, running autoreconf...
      You can now run `./configure'.