From c5d951846d6b803909cbd7cfeac643f5feb42911 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 14:26:35 -0400 Subject: buildsys: use pkg-config for openssl detection Signed-off-by: Dave Reisner --- configure.ac | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 18726cfb..2fa7634c 100644 --- a/configure.ac +++ b/configure.ac @@ -157,17 +157,15 @@ 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"]) +have_openssl=no +if test "x$with_openssl" != "xno"; then + PKG_CHECK_MODULES(LIBSSL, [libssl libcrypto], + [AC_DEFINE(HAVE_LIBSSL, 1, [Define if libcrypto is available]) have_openssl=yes], have_openssl=no) + if test "x$have_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 "$have_openssl" = "yes"]) # Check for gpgme AC_MSG_CHECKING(whether to link with libgpgme) @@ -414,7 +412,7 @@ ${PACKAGE_NAME}: preprocessor flags : ${CPPFLAGS} compiler flags : ${CFLAGS} defines : ${DEFS} - library flags : ${LIBS} + library flags : ${LIBS} ${LIBSSL_LIBS} linker flags : ${LDFLAGS} Architecture : ${CARCH} @@ -436,7 +434,7 @@ ${PACKAGE_NAME}: Compilation options: Use libcurl : ${with_libcurl} Use GPGME : ${with_gpgme} - Use OpenSSL : ${with_openssl} + Use OpenSSL : ${have_openssl} Run make in doc/ dir : ${wantdoc} ${asciidoc} Doxygen support : ${usedoxygen} debug support : ${debug} -- cgit v1.2.3-24-g4f1b From 059c572ca5c0f3ac9d90c53f0c0bdc8e4fb0336f Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 14:30:08 -0400 Subject: buildsys: use pkg-config for libarchive detection This also introduces a versioned dependency of >=2.8.0. Signed-off-by: Dave Reisner --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 2fa7634c..1f265cb5 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 have_openssl=no @@ -412,7 +412,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} -- cgit v1.2.3-24-g4f1b From b2226ed11bca158ab32199b5899802a78a42f5aa Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 14:37:06 -0400 Subject: buildsys: use pkg-config for libcurl detection Signed-off-by: Dave Reisner --- configure.ac | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 1f265cb5..ddcf535d 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, @@ -167,6 +169,17 @@ if test "x$with_openssl" != "xno"; then fi AM_CONDITIONAL(HAVE_LIBSSL, [test "$have_openssl" = "yes"]) +# Check for libcurl +have_libcurl=no +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]) have_libcurl=yes], have_libcurl=no) + if test "x$have_libcurl" = xno -a "x$with_libcurl" = xyes; then + AC_MSG_ERROR([*** libcurl >= 7.19.4 is required for internal downloader support]) + fi +fi +AM_CONDITIONAL(HAVE_LIBCURL, [test "$have_libcurl" = "yes"]) + # Check for gpgme AC_MSG_CHECKING(whether to link with libgpgme) AS_IF([test "x$with_gpgme" != "xno"], @@ -412,7 +425,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} @@ -432,7 +445,7 @@ ${PACKAGE_NAME}: build script name : ${BUILDSCRIPT} Compilation options: - Use libcurl : ${with_libcurl} + Use libcurl : ${have_libcurl} Use GPGME : ${with_gpgme} Use OpenSSL : ${have_openssl} Run make in doc/ dir : ${wantdoc} ${asciidoc} -- cgit v1.2.3-24-g4f1b From cb5b66367ddf4af05953a9486bddaaf105fb4f38 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 23:08:31 -0400 Subject: buildsys: cleanup gpgme compile time check - handle gpgme libs and cflags separately rather than appending to CFLAGS and LDFLAGS - be consistent in AC_LINK_IFELSE check for gpgme 1.3.0 (though this is irrelephant since we don't actually run) - be consistent with usage of "have" and "with" variables (this actually ends up reducing SLOC) - when voluntary detection fails, unset GPGME_CFLAGS and GPGME_LIBS - when requested support fails the version check, complain about the min version. Signed-off-by: Dave Reisner --- configure.ac | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index ddcf535d..ac25a9d6 100644 --- a/configure.ac +++ b/configure.ac @@ -186,11 +186,9 @@ AS_IF([test "x$with_gpgme" != "xno"], [AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) -require_gpgme=no +have_gpgme=no AS_IF([test "x$with_gpgme" != "xno"], - [AS_IF([test "x$with_gpgme" = "xyes"], - [require_gpgme=yes]) - AM_PATH_GPGME([1.3.0], + [AM_PATH_GPGME([1.3.0], [LIBS_save="$LIBS" CPPFLAGS_save="$CPPFLAGS" CFLAGS_save="$CFLAGS" @@ -203,23 +201,26 @@ AS_IF([test "x$with_gpgme" != "xno"], AC_LINK_IFELSE( [AC_LANG_PROGRAM( [[#include ]], - [[const char *ver; -ver = gpgme_check_version("1.2.4");]])], + [[return gpgme_check_version("1.3.0");]])], [AC_MSG_RESULT([yes]) - with_gpgme=yes + have_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])]) -AS_IF([test "x$with_gpgme" != "xyes"], - [AS_IF([test "x$require_gpgme" = "xyes"], - [AC_MSG_FAILURE([--with-gpgme was given, but gpgme was not found])]) - with_gpgme=no]) - -AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$with_gpgme" = "xyes"]) + have_gpgme=no + unset GPGME_LIBS + unset GPGME_CFLAGS] + AS_IF([test "x$with_gpgme" = "xyes"], + [AC_MSG_FAILURE([*** gpgme >= 1.3.0 is needed for GPG signature support])]) + )], + [with_gpgme=no])] + [LIBS="$LIBS_save" + CPPFLAGS="$CPPFLAGS_save" + CFLAGS="$CFLAGS_save" + unset CPPFLAGS_save + unset CFLAGS_save]) +AS_IF([test "x$have_gpgme" = xno -a "x$with_gpgme" = xyes], + [AC_MSG_FAILURE([--with-gpgme was given, but gpgme was not found])]) +AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$have_gpgme" = "xyes"]) # Checks for header files. AC_CHECK_HEADERS([fcntl.h float.h glob.h libintl.h limits.h locale.h \ @@ -425,7 +426,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} @@ -446,7 +447,7 @@ ${PACKAGE_NAME}: Compilation options: Use libcurl : ${have_libcurl} - Use GPGME : ${with_gpgme} + Use GPGME : ${have_gpgme} Use OpenSSL : ${have_openssl} Run make in doc/ dir : ${wantdoc} ${asciidoc} Doxygen support : ${usedoxygen} -- cgit v1.2.3-24-g4f1b From 7fcb445f35d70d6dd4fa14e9d7b5de35625b0811 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 23:23:45 -0400 Subject: buildsys: use AC_DEFINE for CYGWIN macro Instead of directly modifying CFLAGS, use config.h for its intended purpose. Signed-off-by: Dave Reisner --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index ac25a9d6..13dddc61 100644 --- a/configure.ac +++ b/configure.ac @@ -280,7 +280,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 -- cgit v1.2.3-24-g4f1b From 793eff37047dbceedaf3443311bc826566685181 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Fri, 30 Mar 2012 23:26:32 -0400 Subject: buildsys: define warning CFLAGS in separate var Continue the trend of not touching the environment CFLAGS, ensuring that the user always has the final say. Signed-off-by: Dave Reisner --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 13dddc61..3c6df0db 100644 --- a/configure.ac +++ b/configure.ac @@ -350,10 +350,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 @@ -424,7 +424,7 @@ ${PACKAGE_NAME}: compiler : ${CC} preprocessor flags : ${CPPFLAGS} - compiler flags : ${CFLAGS} + compiler flags : ${WARNING_CFLAGS} ${CFLAGS} defines : ${DEFS} library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} ${GPGME_LIBS} linker flags : ${LDFLAGS} -- cgit v1.2.3-24-g4f1b From 5f774025774b85c92a7e8ebf69738221d92cd72d Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 31 Mar 2012 15:51:47 -0400 Subject: buildsys: cleanup libtool and autoconf initialization - 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 --- configure.ac | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 3c6df0db..93f8f140 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]) -- cgit v1.2.3-24-g4f1b From 30ca48df4ca51b57ca8bc0e45f78d3eac8c15b40 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 31 Mar 2012 21:52:08 -0400 Subject: buildsys: move autotools bloat to build-aux Signed-off-by: Dave Reisner --- configure.ac | 1 + 1 file changed, 1 insertion(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 93f8f140..98e6af1d 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]) -- cgit v1.2.3-24-g4f1b From b729ed01093312cef7ce48d07b13e225b25446db Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 7 Apr 2012 13:03:41 -0500 Subject: Add a new configure option for excessive compiler warning flags This adds a bunch of warning flags to the list used when compiling. Signed-off-by: Dan McGee --- configure.ac | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 98e6af1d..b31b58a8 100644 --- a/configure.ac +++ b/configure.ac @@ -128,6 +128,11 @@ AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug], [enable debugging support]), [debug=$enableval], [debug=no]) +# Help line for compiler warning flags +AC_ARG_ENABLE(warningflags, + AS_HELP_STRING([--enable-warningflags], [enable extra compiler warning flags]), + [warningflags=$enableval], [warningflags=no]) + # Help line for using git version in pacman version string AC_ARG_ENABLE(git-version, AS_HELP_STRING([--enable-git-version], @@ -354,6 +359,40 @@ else WARNING_CFLAGS="-Wall" fi +# Enable or disable compiler warning flags +AC_MSG_CHECKING(for excessive compiler warning flags) +if test "x$warningflags" = "xyes" ; then + AC_MSG_RESULT(yes) + CFLAGS_ADD([-Wcast-align], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wclobbered], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wempty-body], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wfloat-equal], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wformat-nonliteral], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wformat-security], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wignored-qualifiers], [WARNING_CFLAGS]) + CFLAGS_ADD([-Winit-self], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wlogical-op], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wmissing-declarations], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wmissing-parameter-type], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wmissing-prototypes], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wold-style-declaration], [WARNING_CFLAGS]) + CFLAGS_ADD([-Woverride-init], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wpointer-arith], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wredundant-decls], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wshadow], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wsign-compare], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wstrict-aliasing], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wstrict-overflow=5], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wstrict-prototypes], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wtype-limits], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wuninitialized], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wunused-but-set-parameter], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wunused-parameter], [WARNING_CFLAGS]) + CFLAGS_ADD([-Wwrite-strings], [WARNING_CFLAGS]) +else + AC_MSG_RESULT(no) +fi + # Enable or disable use of git version in pacman version string AC_MSG_CHECKING(whether to use git version if available) if test "x$wantgitver" = "xyes" ; then @@ -450,6 +489,8 @@ ${PACKAGE_NAME}: Run make in doc/ dir : ${wantdoc} ${asciidoc} Doxygen support : ${usedoxygen} debug support : ${debug} + extra warning flags : ${warningflags} + use git version : ${wantgitver} " # vim:set ts=2 sw=2 noet: -- cgit v1.2.3-24-g4f1b