aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2014-05-02 19:18:11 -0400
committerGlenn Morris2014-05-02 19:18:11 -0400
commitb05e08a465dceee25798ac4fd745814cdb1b8b9b (patch)
tree1cc7aeefe222af7a7c2e19075802635e3695452a
parentcd626254b7031392ff12ba2806f0e68b0ccda8e3 (diff)
downloademacs-b05e08a465dceee25798ac4fd745814cdb1b8b9b.tar.gz
emacs-b05e08a465dceee25798ac4fd745814cdb1b8b9b.zip
Use pkg-config's pkg.m4
* configure.ac: Use pkg-config's pkg.m4, rather than reinventing it. Add explicit AC_SUBST's where needed. * autogen.sh (progs): Add pkg-config. (pkg_config_min): New variable. * INSTALL.REPO: Mention pkg-config. * etc/PROBLEMS: Mention a related issue that can occur with a local automake.
-rw-r--r--ChangeLog5
-rw-r--r--INSTALL.REPO2
-rwxr-xr-xautogen.sh3
-rw-r--r--configure.ac65
-rw-r--r--etc/PROBLEMS11
5 files changed, 28 insertions, 58 deletions
diff --git a/ChangeLog b/ChangeLog
index c9ca6bfa9c1..91e51d681d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
12014-05-02 Glenn Morris <rgm@gnu.org> 12014-05-02 Glenn Morris <rgm@gnu.org>
2 2
3 * configure.ac: Use pkg-config's pkg.m4, rather than reinventing it.
4 Add explicit AC_SUBST's where needed.
5 * autogen.sh (progs): Add pkg-config.
6 (pkg_config_min): New variable.
7
3 * configure.ac (AC_CONFIG_MACRO_DIR): Use it. 8 * configure.ac (AC_CONFIG_MACRO_DIR): Use it.
4 9
5 * autogen.sh (get_version): Handle no leading whitespace. 10 * autogen.sh (get_version): Handle no leading whitespace.
diff --git a/INSTALL.REPO b/INSTALL.REPO
index 36ab928673d..c1617e781c1 100644
--- a/INSTALL.REPO
+++ b/INSTALL.REPO
@@ -12,6 +12,8 @@ autoconf - at least the version specified near the start of
12 configure.ac (in the AC_PREREQ command). 12 configure.ac (in the AC_PREREQ command).
13automake - at least the version specified near the start of 13automake - at least the version specified near the start of
14 configure.ac (in the AM_INIT_AUTOMAKE command). 14 configure.ac (in the AM_INIT_AUTOMAKE command).
15pkg-config - at least version specified in the PKG_PROG_PKG_CONFIG
16 command in configure.ac
15makeinfo - not strictly necessary, but highly recommended, so that 17makeinfo - not strictly necessary, but highly recommended, so that
16 you can build the manuals. 18 you can build the manuals.
17 19
diff --git a/autogen.sh b/autogen.sh
index 255a4d75ba6..84230b56016 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -32,7 +32,7 @@
32 32
33## Tools we need: 33## Tools we need:
34## Note that we respect the values of AUTOCONF etc, like autoreconf does. 34## Note that we respect the values of AUTOCONF etc, like autoreconf does.
35progs="autoconf automake" 35progs="autoconf automake pkg-config"
36 36
37## Minimum versions we need: 37## Minimum versions we need:
38autoconf_min=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.ac` 38autoconf_min=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.ac`
@@ -41,6 +41,7 @@ autoconf_min=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.ac`
41## AM_INIT_AUTOMAKE call. 41## AM_INIT_AUTOMAKE call.
42automake_min=`sed -n 's/^ *AM_INIT_AUTOMAKE(\([0-9\.]*\)).*/\1/p' configure.ac` 42automake_min=`sed -n 's/^ *AM_INIT_AUTOMAKE(\([0-9\.]*\)).*/\1/p' configure.ac`
43 43
44pkg_config_min=`sed -n 's/^ *PKG_PROG_PKG_CONFIG(\([0-9\.]*\)).*/\1/p' configure.ac`
44 45
45## $1 = program, eg "autoconf". 46## $1 = program, eg "autoconf".
46## Echo the version string, eg "2.59". 47## Echo the version string, eg "2.59".
diff --git a/configure.ac b/configure.ac
index 837a619d8a6..27312cac3ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1339,65 +1339,12 @@ AC_SUBST(LIB_MATH)
1339AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE", 1339AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
1340 [The type of system you are compiling for; sets `system-type'.]) 1340 [The type of system you are compiling for; sets `system-type'.])
1341 1341
1342m4_pattern_forbid([^PKG_])
1342 1343
1343pre_PKG_CONFIG_CFLAGS=$CFLAGS 1344pre_PKG_CONFIG_CFLAGS=$CFLAGS
1344pre_PKG_CONFIG_LIBS=$LIBS 1345pre_PKG_CONFIG_LIBS=$LIBS
1345 1346
1346AC_PATH_PROG(PKG_CONFIG, pkg-config, no) 1347PKG_PROG_PKG_CONFIG(0.9.0)
1347
1348dnl This function definition taken from Gnome 2.0
1349dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
1350dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
1351dnl also defines GSTUFF_PKG_ERRORS on error
1352AC_DEFUN([PKG_CHECK_MODULES], [
1353 succeeded=no
1354
1355 if test "$PKG_CONFIG" = "no" ; then
1356 ifelse([$4], , [AC_MSG_ERROR([
1357 *** The pkg-config script could not be found. Make sure it is in your path, or give the full name of pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog. Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config.])], [$4])
1358 else
1359 PKG_CONFIG_MIN_VERSION=0.9.0
1360 if "$PKG_CONFIG" --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
1361 AC_MSG_CHECKING(for $2)
1362
1363 if "$PKG_CONFIG" --exists "$2" 2>&AS_MESSAGE_LOG_FD &&
1364 $1_CFLAGS=`"$PKG_CONFIG" --cflags "$2" 2>&AS_MESSAGE_LOG_FD` &&
1365 $1_LIBS=`"$PKG_CONFIG" --libs "$2" 2>&AS_MESSAGE_LOG_FD`; then
1366 edit_cflags="
1367 s,///*,/,g
1368 s/^/ /
1369 s/ -I/ $isystem/g
1370 s/^ //
1371 "
1372 $1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
1373 $1_LIBS=`AS_ECHO(["$$1_LIBS"]) | sed -e 's,///*,/,g'`
1374 AC_MSG_RESULT([yes CFLAGS='$$1_CFLAGS' LIBS='$$1_LIBS'])
1375 succeeded=yes
1376 else
1377 AC_MSG_RESULT(no)
1378 $1_CFLAGS=""
1379 $1_LIBS=""
1380 ## If we have a custom action on failure, don't print errors, but
1381 ## do set a variable so people can do so. Do it in a subshell
1382 ## to capture any diagnostics in invoking pkg-config.
1383 $1_PKG_ERRORS=`("$PKG_CONFIG" --print-errors "$2") 2>&1`
1384 ifelse([$4], ,echo "$$1_PKG_ERRORS",)
1385 fi
1386
1387 AC_SUBST($1_CFLAGS)
1388 AC_SUBST($1_LIBS)
1389 else
1390 echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
1391 echo "*** See http://www.freedesktop.org/software/pkgconfig"
1392 fi
1393 fi
1394
1395 if test $succeeded = yes; then
1396 ifelse([$3], , :, [$3])
1397 else
1398 ifelse([$4], , [AC_MSG_ERROR([Library requirements ($2) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.])], [$4])
1399 fi
1400])
1401 1348
1402HAVE_SOUND=no 1349HAVE_SOUND=no
1403if test "${with_sound}" != "no"; then 1350if test "${with_sound}" != "no"; then
@@ -2415,6 +2362,8 @@ if test "${with_dbus}" = "yes"; then
2415 DBUS_OBJ=dbusbind.o 2362 DBUS_OBJ=dbusbind.o
2416 fi 2363 fi
2417fi 2364fi
2365AC_SUBST(DBUS_CFLAGS)
2366AC_SUBST(DBUS_LIBS)
2418AC_SUBST(DBUS_OBJ) 2367AC_SUBST(DBUS_OBJ)
2419 2368
2420dnl GSettings has been tested under GNU/Linux only. 2369dnl GSettings has been tested under GNU/Linux only.
@@ -3268,7 +3217,6 @@ if test "${HAVE_X11}" = "yes"; then
3268 [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)]) 3217 [AC_CHECK_LIB(Xrandr, XRRGetScreenResources, HAVE_XRANDR=yes)])
3269 if test $HAVE_XRANDR = yes; then 3218 if test $HAVE_XRANDR = yes; then
3270 XRANDR_LIBS=-lXrandr 3219 XRANDR_LIBS=-lXrandr
3271 AC_SUBST(XRANDR_LIBS)
3272 fi 3220 fi
3273 fi 3221 fi
3274 if test $HAVE_XRANDR = yes; then 3222 if test $HAVE_XRANDR = yes; then
@@ -3283,6 +3231,8 @@ if test "${HAVE_X11}" = "yes"; then
3283 AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have the XRandr extension.]) 3231 AC_DEFINE(HAVE_XRANDR, 1, [Define to 1 if you have the XRandr extension.])
3284 fi 3232 fi
3285fi 3233fi
3234AC_SUBST(XRANDR_CFLAGS)
3235AC_SUBST(XRANDR_LIBS)
3286 3236
3287### Use Xinerama (-lXinerama) if available 3237### Use Xinerama (-lXinerama) if available
3288HAVE_XINERAMA=no 3238HAVE_XINERAMA=no
@@ -3297,13 +3247,14 @@ if test "${HAVE_X11}" = "yes"; then
3297 [AC_CHECK_LIB(Xinerama, XineramaQueryExtension, HAVE_XINERAMA=yes)]) 3247 [AC_CHECK_LIB(Xinerama, XineramaQueryExtension, HAVE_XINERAMA=yes)])
3298 if test $HAVE_XINERAMA = yes; then 3248 if test $HAVE_XINERAMA = yes; then
3299 XINERAMA_LIBS=-lXinerama 3249 XINERAMA_LIBS=-lXinerama
3300 AC_SUBST(XINERAMA_LIBS)
3301 fi 3250 fi
3302 fi 3251 fi
3303 if test $HAVE_XINERAMA = yes; then 3252 if test $HAVE_XINERAMA = yes; then
3304 AC_DEFINE(HAVE_XINERAMA, 1, [Define to 1 if you have the Xinerama extension.]) 3253 AC_DEFINE(HAVE_XINERAMA, 1, [Define to 1 if you have the Xinerama extension.])
3305 fi 3254 fi
3306fi 3255fi
3256AC_SUBST(XINERAMA_CFLAGS)
3257AC_SUBST(XINERAMA_LIBS)
3307 3258
3308 3259
3309### Use libxml (-lxml2) if available 3260### Use libxml (-lxml2) if available
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 58c2ceaf68c..3d5349c2793 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -2223,6 +2223,17 @@ If you do, please send it to bug-gnu-emacs@gnu.org so we can list it here.
2223 2223
2224* Build-time problems 2224* Build-time problems
2225 2225
2226** Autogen.sh / Autoreconf
2227
2228*** Running `autogen.sh' or `autoreconf' fails with an error of the form
2229"possibly undefined macro: PKG_CONFIG". This indicates that the version
2230of aclocal that you are using cannot find the pkg.m4 file that
2231pkg-config provides. If you installed your own version of automake in
2232a non-standard location /prefix, then add a line to the
2233/prefix/share/aclocal/dirlist file (create the file if necessary)
2234that gives the location of the directory that contains pkg.m4
2235(e.g. /usr/share/aclocal).
2236
2226** Configuration 2237** Configuration
2227 2238
2228*** `configure' warns ``accepted by the compiler, rejected by the preprocessor''. 2239*** `configure' warns ``accepted by the compiler, rejected by the preprocessor''.