[pacman-dev] [PATCH 00/11] autofool cleanup
I've been working on sorting out some crappiness in our build system, in part evidenced by an Ubuntu user attempting to compile pacman. This sort of snowballed and I took the liberty of cleaning up a few other things as well. Basically, the changes fall into a few categories: * use pkg-config for more accurate library detection * avoid touching LDFLAGS, CFLAGS, and CPPFLAGS * move files out of the repo root The last patch is none of the above, but it's good juju anyways. I definitely won't call myself an autotools guru and will point out that what I've done here is based on what I've gleaned from some other autotools-based projects. That said, I think these changes all make sense, and the Ubuntu user was certainly happy that the configure script was doing a better job of library autodetection. Dave Reisner (11): buildsys: add pkg-config m4 macros buildsys: use pkg-config for openssl detection buildsys: use pkg-config for libarchive detection buildsys: use pkg-config for libcurl detection buildsys: handle gpgme libs and cflags separately buildsys: use AC_DEFINE for CYGWIN macro buildsys: define warning CFLAGS in separate var buildsys: cleanup libtool and autoconf initialization buildsys: move acinclude.m4 to m4/ buildsys: move autotools bloat to build-aux autoclean.sh: abide by POSIX shebang autoclean.sh | 24 +-- config.guess => build-aux/config.guess | 0 config.rpath => build-aux/config.rpath | 0 config.sub => build-aux/config.sub | 0 depcomp => build-aux/depcomp | 0 install-sh => build-aux/install-sh | 0 ltmain.sh => build-aux/ltmain.sh | 0 missing => build-aux/missing | 0 mkinstalldirs => build-aux/mkinstalldirs | 0 configure.ac | 63 ++++---- lib/libalpm/Makefile.am | 19 ++- acinclude.m4 => m4/acinclude.m4 | 0 m4/libcurl.m4 | 250 ------------------------------ m4/pkg.m4 | 159 +++++++++++++++++++ src/pacman/Makefile.am | 2 +- src/util/Makefile.am | 4 +- 16 files changed, 220 insertions(+), 301 deletions(-) rename config.guess => build-aux/config.guess (100%) rename config.rpath => build-aux/config.rpath (100%) rename config.sub => build-aux/config.sub (100%) rename depcomp => build-aux/depcomp (100%) rename install-sh => build-aux/install-sh (100%) rename ltmain.sh => build-aux/ltmain.sh (100%) rename missing => build-aux/missing (100%) rename mkinstalldirs => build-aux/mkinstalldirs (100%) rename acinclude.m4 => m4/acinclude.m4 (100%) delete mode 100644 m4/libcurl.m4 create mode 100644 m4/pkg.m4 -- 1.7.9.5
We'll need these for a small revamp to library detection. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- m4/pkg.m4 | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 159 insertions(+) create mode 100644 m4/pkg.m4 diff --git a/m4/pkg.m4 b/m4/pkg.m4 new file mode 100644 index 0000000..5152a4b --- /dev/null +++ b/m4/pkg.m4 @@ -0,0 +1,159 @@ +# 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 -- 1.7.9.5
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- configure.ac | 21 +++++++++------------ lib/libalpm/Makefile.am | 9 ++++++++- src/util/Makefile.am | 2 +- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index 12a6e65..824241d 100644 --- a/configure.ac +++ b/configure.ac @@ -157,17 +157,14 @@ AC_CHECK_LIB([archive], [archive_read_data], , AC_MSG_ERROR([libarchive is needed to compile pacman!])) # Check for OpenSSL -AC_MSG_CHECKING(whether to link with libssl) -AS_IF([test "x$with_openssl" != "xno"], - [AC_MSG_RESULT(yes) - AC_CHECK_LIB([ssl], [MD5_Final], , - [if test "x$with_openssl" != "xcheck"; then - AC_MSG_FAILURE([--with-openssl was given, but -lssl was not found]) - fi], - [-lcrypto]) - with_openssl=$ac_cv_lib_ssl_MD5_Final], - AC_MSG_RESULT(no)) -AM_CONDITIONAL([HAVE_LIBSSL], [test "x$with_openssl" = "xyes"]) +if test "x$with_openssl" != "xno"; then + PKG_CHECK_MODULES(LIBSSL, [libssl libcrypto], + [AC_DEFINE(HAVE_LIBSSL, 1, [Define if libcrypto is available]) with_openssl=yes], with_openssl=no) + if test "x$with_openssl" = xno -a "x$with_openssl" = xyes; then + AC_MSG_ERROR([*** openssl support requested but libraries not found]) + fi +fi +AM_CONDITIONAL(HAVE_LIBSSL, [test "$with_openssl" = "yes"]) # Check for gpgme AC_MSG_CHECKING(whether to link with libgpgme) @@ -413,7 +410,7 @@ ${PACKAGE_NAME}: preprocessor flags : ${CPPFLAGS} compiler flags : ${CFLAGS} defines : ${DEFS} - library flags : ${LIBS} + library flags : ${LIBS} ${LIBSSL_LIBS} linker flags : ${LDFLAGS} Architecture : ${CARCH} diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 61dcb87..8d1be90 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -64,6 +64,13 @@ libalpm_la_SOURCES += \ endif libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@ -libalpm_la_LIBADD = $(LTLIBINTL) + +libalpm_la_CFLAGS = \ + $(AM_CFLAGS) \ + $(LIBSSL_CFLAGS) + +libalpm_la_LIBADD = \ + $(LTLIBINTL) \ + $(LIBSSL_LIBS) # vim:set ts=2 sw=2 noet: diff --git a/src/util/Makefile.am b/src/util/Makefile.am index e386d95..1465407 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -35,6 +35,6 @@ testpkg_SOURCES = testpkg.c testpkg_LDADD = $(top_builddir)/lib/libalpm/.libs/libalpm.la vercmp_SOURCES = vercmp.c -vercmp_LDADD = $(top_builddir)/lib/libalpm/version.lo +vercmp_LDADD = $(top_builddir)/lib/libalpm/libalpm_la-version.lo # vim:set ts=2 sw=2 noet: -- 1.7.9.5
This also introduces a versioned dependency of >=3.0.0. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- configure.ac | 6 +++--- lib/libalpm/Makefile.am | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 824241d..30a20f7 100644 --- a/configure.ac +++ b/configure.ac @@ -153,8 +153,8 @@ AC_CHECK_LIB([m], [fabs], , AC_MSG_ERROR([libm is needed to compile pacman!])) # Check for libarchive -AC_CHECK_LIB([archive], [archive_read_data], , - AC_MSG_ERROR([libarchive is needed to compile pacman!])) +PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 2.8.0], , + AC_MSG_ERROR([*** libarchive >= 2.8.0 is needed to compile pacman!])) # Check for OpenSSL if test "x$with_openssl" != "xno"; then @@ -410,7 +410,7 @@ ${PACKAGE_NAME}: preprocessor flags : ${CPPFLAGS} compiler flags : ${CFLAGS} defines : ${DEFS} - library flags : ${LIBS} ${LIBSSL_LIBS} + library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} linker flags : ${LDFLAGS} Architecture : ${CARCH} diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 8d1be90..3aa3e4f 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -67,10 +67,12 @@ libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@ libalpm_la_CFLAGS = \ $(AM_CFLAGS) \ + $(LIBARCHIVE_CFLAGS) \ $(LIBSSL_CFLAGS) libalpm_la_LIBADD = \ $(LTLIBINTL) \ - $(LIBSSL_LIBS) + $(LIBSSL_LIBS) \ + $(LIBARCHIVE_LIBS) \ # vim:set ts=2 sw=2 noet: -- 1.7.9.5
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- configure.ac | 18 +++- lib/libalpm/Makefile.am | 4 +- m4/libcurl.m4 | 250 ----------------------------------------------- 3 files changed, 18 insertions(+), 254 deletions(-) delete mode 100644 m4/libcurl.m4 diff --git a/configure.ac b/configure.ac index 30a20f7..573cda3 100644 --- a/configure.ac +++ b/configure.ac @@ -105,8 +105,10 @@ AC_ARG_WITH(gpgme, AS_HELP_STRING([--with-gpgme], [use GPGME for PGP signature verification]), [], [with_gpgme=check]) -# Check for useable libcurl -LIBCURL_CHECK_CONFIG([yes], [7.19.4], [with_libcurl=yes], [with_libcurl=no]) +# Help line for using libcurl +AC_ARG_WITH(curl, + AS_HELP_STRING([--with-libcurl], [use libcurl for the internal downloader]), + [], [with_curl=check]) # Help line for documentation AC_ARG_ENABLE(doc, @@ -166,6 +168,16 @@ if test "x$with_openssl" != "xno"; then fi AM_CONDITIONAL(HAVE_LIBSSL, [test "$with_openssl" = "yes"]) +# Check for libcurl +if test "x$with_libcurl" != "xno"; then + PKG_CHECK_MODULES(LIBCURL, [libcurl >= 7.19.4], + [AC_DEFINE(HAVE_LIBCURL, 1, [Define if libcurl is available]) with_libcurl=yes], with_libcurl=no) + if test "x$with_libcurl" = xno -a "x$with_libcurl" = xyes; then + AC_MSG_ERROR([*** libcurl support requested but libraries not found]) + fi +fi +AM_CONDITIONAL(HAVE_LIBCURL, [test "$with_libcurl" = "yes"]) + # Check for gpgme AC_MSG_CHECKING(whether to link with libgpgme) AS_IF([test "x$with_gpgme" != "xno"], @@ -410,7 +422,7 @@ ${PACKAGE_NAME}: preprocessor flags : ${CPPFLAGS} compiler flags : ${CFLAGS} defines : ${DEFS} - library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} + library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} linker flags : ${LDFLAGS} Architecture : ${CARCH} diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index 3aa3e4f..e2e5dc4 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -63,16 +63,18 @@ libalpm_la_SOURCES += \ base64.h base64.c endif -libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@ +libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) libalpm_la_CFLAGS = \ $(AM_CFLAGS) \ $(LIBARCHIVE_CFLAGS) \ + $(LIBCURL_CFLAGS) \ $(LIBSSL_CFLAGS) libalpm_la_LIBADD = \ $(LTLIBINTL) \ $(LIBSSL_LIBS) \ $(LIBARCHIVE_LIBS) \ + $(LIBCURL_LIBS) \ # vim:set ts=2 sw=2 noet: diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 deleted file mode 100644 index 01a0575..0000000 --- a/m4/libcurl.m4 +++ /dev/null @@ -1,250 +0,0 @@ -# LIBCURL_CHECK_CONFIG ([DEFAULT-ACTION], [MINIMUM-VERSION], -# [ACTION-IF-YES], [ACTION-IF-NO]) -# ---------------------------------------------------------- -# David Shaw <dshaw@jabberwocky.com> May-09-2006 -# -# Checks for libcurl. DEFAULT-ACTION is the string yes or no to -# specify whether to default to --with-libcurl or --without-libcurl. -# If not supplied, DEFAULT-ACTION is yes. MINIMUM-VERSION is the -# minimum version of libcurl to accept. Pass the version as a regular -# version number like 7.10.1. If not supplied, any version is -# accepted. ACTION-IF-YES is a list of shell commands to run if -# libcurl was successfully found and passed the various tests. -# ACTION-IF-NO is a list of shell commands that are run otherwise. -# Note that using --without-libcurl does run ACTION-IF-NO. -# -# This macro #defines HAVE_LIBCURL if a working libcurl setup is -# found, and sets @LIBCURL@ and @LIBCURL_CPPFLAGS@ to the necessary -# values. Other useful defines are LIBCURL_FEATURE_xxx where xxx are -# the various features supported by libcurl, and LIBCURL_PROTOCOL_yyy -# where yyy are the various protocols supported by libcurl. Both xxx -# and yyy are capitalized. See the list of AH_TEMPLATEs at the top of -# the macro for the complete list of possible defines. Shell -# variables $libcurl_feature_xxx and $libcurl_protocol_yyy are also -# defined to 'yes' for those features and protocols that were found. -# Note that xxx and yyy keep the same capitalization as in the -# curl-config list (e.g. it's "HTTP" and not "http"). -# -# Users may override the detected values by doing something like: -# LIBCURL="-lcurl" LIBCURL_CPPFLAGS="-I/usr/myinclude" ./configure -# -# For the sake of sanity, this macro assumes that any libcurl that is -# found is after version 7.7.2, the first version that included the -# curl-config script. Note that it is very important for people -# packaging binary versions of libcurl to include this script! -# Without curl-config, we can only guess what protocols are available, -# or use curl_version_info to figure it out at runtime. - -AC_DEFUN([LIBCURL_CHECK_CONFIG], -[ - AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL]) - AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4]) - AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6]) - AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz]) - AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS]) - AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN]) - AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI]) - AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM]) - - AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS]) - AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS]) - AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE]) - AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET]) - AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) - AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_RTSP],[Defined if libcurl supports RTSP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_POP3],[Defined if libcurl supports POP3]) - AH_TEMPLATE([LIBCURL_PROTOCOL_IMAP],[Defined if libcurl supports IMAP]) - AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP]) - - AC_ARG_WITH(libcurl, - AC_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), - [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) - - if test "$_libcurl_with" != "no" ; then - - AC_PROG_AWK - - _libcurl_version_parse="eval $AWK '{split(\$NF,A,\".\"); X=256*256*A[[1]]+256*A[[2]]+A[[3]]; print X;}'" - - _libcurl_try_link=yes - - if test -d "$_libcurl_with" ; then - LIBCURL_CPPFLAGS="-I$withval/include" - _libcurl_ldflags="-L$withval/lib" - AC_PATH_PROG([_libcurl_config],[curl-config],[], - ["$withval/bin"]) - else - AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH]) - fi - - if test x$_libcurl_config != "x" ; then - AC_CACHE_CHECK([for the version of libcurl], - [libcurl_cv_lib_curl_version], - [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`]) - - _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` - _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse` - - if test $_libcurl_wanted -gt 0 ; then - AC_CACHE_CHECK([for libcurl >= version $2], - [libcurl_cv_lib_version_ok], - [ - if test $_libcurl_version -ge $_libcurl_wanted ; then - libcurl_cv_lib_version_ok=yes - else - libcurl_cv_lib_version_ok=no - fi - ]) - fi - - if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then - if test x"$LIBCURL_CPPFLAGS" = "x" ; then - LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` - fi - if test x"$LIBCURL" = "x" ; then - LIBCURL=`$_libcurl_config --libs` - - # This is so silly, but Apple actually has a bug in their - # curl-config script. Fixed in Tiger, but there are still - # lots of Panther installs around. - case "${host}" in - powerpc-apple-darwin7*) - LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` - ;; - esac - fi - - # All curl-config scripts support --feature - _libcurl_features=`$_libcurl_config --feature` - - # Is it modern enough to have --protocols? (7.12.4) - if test $_libcurl_version -ge 461828 ; then - _libcurl_protocols=`$_libcurl_config --protocols` - fi - else - _libcurl_try_link=no - fi - - unset _libcurl_wanted - fi - - if test $_libcurl_try_link = yes ; then - - # we didn't find curl-config, so let's see if the user-supplied - # link line (or failing that, "-lcurl") is enough. - LIBCURL=${LIBCURL-"$_libcurl_ldflags -lcurl"} - - AC_CACHE_CHECK([whether libcurl is usable], - [libcurl_cv_lib_curl_usable], - [ - _libcurl_save_cppflags=$CPPFLAGS - CPPFLAGS="$LIBCURL_CPPFLAGS $CPPFLAGS" - _libcurl_save_libs=$LIBS - LIBS="$LIBCURL $LIBS" - - AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <curl/curl.h>],[ -/* Try and use a few common options to force a failure if we are - missing symbols or can't link. */ -int x; -curl_easy_setopt(NULL,CURLOPT_URL,NULL); -x=CURL_ERROR_SIZE; -x=CURLOPT_WRITEFUNCTION; -x=CURLOPT_FILE; -x=CURLOPT_ERRORBUFFER; -x=CURLOPT_STDERR; -x=CURLOPT_VERBOSE; -])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) - - CPPFLAGS=$_libcurl_save_cppflags - LIBS=$_libcurl_save_libs - unset _libcurl_save_cppflags - unset _libcurl_save_libs - ]) - - if test $libcurl_cv_lib_curl_usable = yes ; then - - # Does curl_free() exist in this version of libcurl? - # If not, fake it with free() - - _libcurl_save_cppflags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" - _libcurl_save_libs=$LIBS - LIBS="$LIBS $LIBCURL" - - AC_CHECK_FUNC(curl_free,, - AC_DEFINE(curl_free,free, - [Define curl_free() as free() if our version of curl lacks curl_free.])) - - CPPFLAGS=$_libcurl_save_cppflags - LIBS=$_libcurl_save_libs - unset _libcurl_save_cppflags - unset _libcurl_save_libs - - AC_DEFINE(HAVE_LIBCURL,1, - [Define to 1 if you have a functional curl library.]) - AC_SUBST(LIBCURL_CPPFLAGS) - AC_SUBST(LIBCURL) - - for _libcurl_feature in $_libcurl_features ; do - AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1]) - eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes - done - - if test "x$_libcurl_protocols" = "x" ; then - - # We don't have --protocols, so just assume that all - # protocols are available - _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" - - if test x$libcurl_feature_SSL = xyes ; then - _libcurl_protocols="$_libcurl_protocols HTTPS" - - # FTPS wasn't standards-compliant until version - # 7.11.0 (0x070b00 == 461568) - if test $_libcurl_version -ge 461568; then - _libcurl_protocols="$_libcurl_protocols FTPS" - fi - fi - - # RTSP, IMAP, POP3 and SMTP were added in - # 7.20.0 (0x071400 == 463872) - if test $_libcurl_version -ge 463872; then - _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP" - fi - fi - - for _libcurl_protocol in $_libcurl_protocols ; do - AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) - eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes - done - else - unset LIBCURL - unset LIBCURL_CPPFLAGS - fi - fi - - unset _libcurl_try_link - unset _libcurl_version_parse - unset _libcurl_config - unset _libcurl_feature - unset _libcurl_features - unset _libcurl_protocol - unset _libcurl_protocols - unset _libcurl_version - unset _libcurl_ldflags - fi - - if test x$_libcurl_with = xno || test x$libcurl_cv_lib_curl_usable != xyes ; then - # This is the IF-NO path - ifelse([$4],,:,[$4]) - else - # This is the IF-YES path - ifelse([$3],,:,[$3]) - fi - - unset _libcurl_with -])dnl -- 1.7.9.5
We should not attempt to modify the CFLAGS or LDFLAGS passed into the environment. In the case of gpgme detection being wanted and successful, use the variables defined by gpgme's m4 macro. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- configure.ac | 10 +++++----- lib/libalpm/Makefile.am | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 573cda3..1b95211 100644 --- a/configure.ac +++ b/configure.ac @@ -203,14 +203,14 @@ AS_IF([test "x$with_gpgme" != "xno"], [[#include <gpgme.h>]], [[const char *ver; ver = gpgme_check_version("1.2.4");]])], + LIBS="$LIBS_save" + CPPFLAGS="$CPPFLAGS_save" + CFLAGS="$CFLAGS_save" [AC_MSG_RESULT([yes]) with_gpgme=yes AC_DEFINE([HAVE_LIBGPGME], [1], [Define if gpgme should be used to provide GPG signature support.])], [AC_MSG_RESULT([no]) - with_gpgme=no - LIBS="$LIBS_save" - CPPFLAGS="$CPPFLAGS_save" - CFLAGS="$CFLAGS_save"])], + with_gpgme=no])], [with_gpgme=no])]) AS_IF([test "x$with_gpgme" != "xyes"], [AS_IF([test "x$require_gpgme" = "xyes"], @@ -422,7 +422,7 @@ ${PACKAGE_NAME}: preprocessor flags : ${CPPFLAGS} compiler flags : ${CFLAGS} defines : ${DEFS} - library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} + library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} ${GPGME_LIBS} linker flags : ${LDFLAGS} Architecture : ${CARCH} diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index e2e5dc4..c316fca 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -67,6 +67,7 @@ libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) libalpm_la_CFLAGS = \ $(AM_CFLAGS) \ + $(GPGME_CFLAGS) \ $(LIBARCHIVE_CFLAGS) \ $(LIBCURL_CFLAGS) \ $(LIBSSL_CFLAGS) @@ -76,5 +77,6 @@ libalpm_la_LIBADD = \ $(LIBSSL_LIBS) \ $(LIBARCHIVE_LIBS) \ $(LIBCURL_LIBS) \ + $(GPGME_LIBS) # vim:set ts=2 sw=2 noet: -- 1.7.9.5
Instead of directly modifying CFLAGS, use config.h for its intended purpose. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1b95211..7590d9d 100644 --- a/configure.ac +++ b/configure.ac @@ -277,7 +277,7 @@ case "${host_os}" in ;; cygwin*) host_os_cygwin=yes - CFLAGS="$CFLAGS -DCYGWIN" + AC_DEFINE([CYGWIN], [1], [Define if host OS is cygwin]) ;; darwin*) host_os_darwin=yes -- 1.7.9.5
Continue the trend of not touching the environment CFLAGS, ensuring that the user always has the final say. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- configure.ac | 4 ++-- lib/libalpm/Makefile.am | 2 +- src/pacman/Makefile.am | 2 +- src/util/Makefile.am | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 7590d9d..9725ba0 100644 --- a/configure.ac +++ b/configure.ac @@ -346,10 +346,10 @@ if test "x$debug" = "xyes" ; then GCC_STACK_PROTECT_LIB GCC_STACK_PROTECT_CC GCC_FORTIFY_SOURCE_CC - CFLAGS="$CFLAGS -g -Wall -Werror" + WARNING_CFLAGS="-g -Wall -Werror" else AC_MSG_RESULT(no) - CFLAGS="$CFLAGS -Wall" + WARNING_CFLAGS="-Wall" fi # Enable or disable use of git version in pacman version string diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am index c316fca..672a7a5 100644 --- a/lib/libalpm/Makefile.am +++ b/lib/libalpm/Makefile.am @@ -10,7 +10,7 @@ DEFS = -DLOCALEDIR=\"@localedir@\" @DEFS@ AM_CPPFLAGS = \ -imacros $(top_builddir)/config.h -AM_CFLAGS = -pedantic -D_GNU_SOURCE +AM_CFLAGS = -pedantic -D_GNU_SOURCE $(WARNING_CFLAGS) if ENABLE_VISIBILITY_CC if DARWIN diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am index 9a92fd6..c8ce977 100644 --- a/src/pacman/Makefile.am +++ b/src/pacman/Makefile.am @@ -21,7 +21,7 @@ AM_CPPFLAGS = \ -imacros $(top_builddir)/config.h \ -I$(top_srcdir)/lib/libalpm -AM_CFLAGS = -pedantic -D_GNU_SOURCE +AM_CFLAGS = -pedantic -D_GNU_SOURCE $(WARNING_CFLAGS) if USE_GIT_VERSION GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//') diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 1465407..463abf7 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -17,7 +17,7 @@ AM_CPPFLAGS = \ -imacros $(top_builddir)/config.h \ -I$(top_srcdir)/lib/libalpm -AM_CFLAGS = -pedantic -D_GNU_SOURCE +AM_CFLAGS = -pedantic -D_GNU_SOURCE $(WARNING_CFLAGS) cleanupdelta_SOURCES = cleanupdelta.c cleanupdelta_LDADD = $(top_builddir)/lib/libalpm/.libs/libalpm.la -- 1.7.9.5
- Use LT_INIT over AC_PROG_LIBTOOL, as the latter is a deprecated alias for the former. - Remove redundant macros which are called implicitly by LT_INIT. - Remove unneeded AC_PROG_CXX call (we don't use c++ anywhere) - Add AC_CONFIG_MACRO_DIR([m4]) -- not strictly necessary, but added for consistency with autogen.sh and Makefile.am ref: http://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- configure.ac | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 9725ba0..3c01966 100644 --- a/configure.ac +++ b/configure.ac @@ -55,11 +55,13 @@ m4_define([pacman_version], AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) AC_CANONICAL_HOST AM_INIT_AUTOMAKE([1.11]) AM_SILENT_RULES([yes]) +LT_INIT LIB_VERSION=`expr lib_current - lib_age`.lib_age.lib_revision LIB_VERSION_INFO="lib_current:lib_revision:lib_age" @@ -138,12 +140,7 @@ AC_SYS_LARGEFILE # Checks for programs. AC_PROG_AWK AC_PROG_CC_C99 -AC_PROG_CXX AC_PROG_INSTALL -AC_PROG_LN_S -AC_PROG_MAKE_SET -AC_PROG_LIBTOOL -AC_PROG_RANLIB AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false]) AC_PATH_PROGS([BASH_SHELL], [bash bash4 bash3], [false]) -- 1.7.9.5
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- acinclude.m4 => m4/acinclude.m4 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename acinclude.m4 => m4/acinclude.m4 (100%) diff --git a/acinclude.m4 b/m4/acinclude.m4 similarity index 100% rename from acinclude.m4 rename to m4/acinclude.m4 -- 1.7.9.5
Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- config.guess => build-aux/config.guess | 0 config.rpath => build-aux/config.rpath | 0 config.sub => build-aux/config.sub | 0 depcomp => build-aux/depcomp | 0 install-sh => build-aux/install-sh | 0 ltmain.sh => build-aux/ltmain.sh | 0 missing => build-aux/missing | 0 mkinstalldirs => build-aux/mkinstalldirs | 0 configure.ac | 1 + 9 files changed, 1 insertion(+) rename config.guess => build-aux/config.guess (100%) rename config.rpath => build-aux/config.rpath (100%) rename config.sub => build-aux/config.sub (100%) rename depcomp => build-aux/depcomp (100%) rename install-sh => build-aux/install-sh (100%) rename ltmain.sh => build-aux/ltmain.sh (100%) rename missing => build-aux/missing (100%) rename mkinstalldirs => build-aux/mkinstalldirs (100%) diff --git a/config.guess b/build-aux/config.guess similarity index 100% rename from config.guess rename to build-aux/config.guess diff --git a/config.rpath b/build-aux/config.rpath similarity index 100% rename from config.rpath rename to build-aux/config.rpath diff --git a/config.sub b/build-aux/config.sub similarity index 100% rename from config.sub rename to build-aux/config.sub diff --git a/depcomp b/build-aux/depcomp similarity index 100% rename from depcomp rename to build-aux/depcomp diff --git a/install-sh b/build-aux/install-sh similarity index 100% rename from install-sh rename to build-aux/install-sh diff --git a/ltmain.sh b/build-aux/ltmain.sh similarity index 100% rename from ltmain.sh rename to build-aux/ltmain.sh diff --git a/missing b/build-aux/missing similarity index 100% rename from missing rename to build-aux/missing diff --git a/mkinstalldirs b/build-aux/mkinstalldirs similarity index 100% rename from mkinstalldirs rename to build-aux/mkinstalldirs diff --git a/configure.ac b/configure.ac index 3c01966..d701713 100644 --- a/configure.ac +++ b/configure.ac @@ -56,6 +56,7 @@ AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org]) AC_CONFIG_SRCDIR([config.h.in]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([build-aux]) AC_CANONICAL_HOST AM_INIT_AUTOMAKE([1.11]) -- 1.7.9.5
Avoid non-POSIX brace expansion and rely on find to locate and destroy files outside the root. Signed-off-by: Dave Reisner <dreisner@archlinux.org> --- autoclean.sh | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/autoclean.sh b/autoclean.sh index 8f45d56..900f353 100755 --- a/autoclean.sh +++ b/autoclean.sh @@ -1,9 +1,9 @@ #!/bin/sh -xu [ -f Makefile ] && make distclean + rm -rf autom4te.cache -rm -f {Makefile.in,Makefile} -rm -f {config.h.in,config.h} +rm -f config.h.in config.h rm -f config.status rm -f configure rm -f stamp* @@ -11,22 +11,12 @@ rm -f aclocal.m4 rm -f compile rm -f libtool -rm -f lib/libalpm/{Makefile.in,Makefile} -rm -f src/util/{Makefile.in,Makefile} -rm -f src/pacman/{Makefile.in,Makefile} -rm -f scripts/{Makefile.in,Makefile} -rm -f etc/{Makefile.in,Makefile} -rm -f etc/pacman.d/{Makefile.in,Makefile} -rm -f etc/abs/{Makefile.in,Makefile} -rm -f test/{pacman,util}{,/tests}/{Makefile.in,Makefile} -rm -f contrib/{Makefile.in,Makefile} -rm -f doc/{Makefile.in,Makefile} - rm -f test/pacman/*.pyc rm -f doc/html/*.html rm -f doc/man3/*.3 -rm -f {lib/libalpm,scripts,src/pacman}/po/{Makefile.in,Makefile} -rm -f {lib/libalpm,scripts,src/pacman}/po/POTFILES -rm -f {lib/libalpm,scripts,src/pacman}/po/stamp-po -rm -f {lib/libalpm,scripts,src/pacman}/po/*.gmo +find . \( -name 'Makefile' -o \ + -name 'Makefile.in' -o \ + -path '*/po/POTFILES' -o \ + -path '*/po/stamp-po' -o \ + -path '*/po/*.gmo' \) -exec rm -f {} + -- 1.7.9.5
participants (1)
-
Dave Reisner