summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac207
1 files changed, 163 insertions, 44 deletions
diff --git a/configure.ac b/configure.ac
index 240d1c4c..7fe696a9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,13 +55,22 @@ 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_CONFIG_AUX_DIR([build-aux])
AC_CANONICAL_HOST
-AM_INIT_AUTOMAKE
+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"
+# Respect empty CFLAGS during compiler tests
+if test "x$CFLAGS" != "x"; then
+ CFLAGS=""
+fi
+
# Set subsitution values for version stuff in Makefiles and anywhere else,
# and put LIB_VERSION in config.h
AC_SUBST(LIB_VERSION)
@@ -88,6 +97,12 @@ AC_ARG_WITH(buildscript,
AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
+# Help line for changing shell used to run install scriptlets
+AC_ARG_WITH(scriptlet-shell,
+ AS_HELP_STRING([--with-scriptlet-shell=shell],
+ [set the full path to the shell used to run install scriptlets]),
+ [SCRIPTLET_SHELL=$withval], [SCRIPTLET_SHELL=/bin/sh])
+
# Help line for using OpenSSL
AC_ARG_WITH(openssl,
AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
@@ -98,8 +113,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,
@@ -116,23 +133,43 @@ 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],
[enable use of git version in version string if available]),
[wantgitver=$enableval], [wantgitver=no])
+# Enable large file support if available (must be enabled before
+# testing compilation against gpgme).
+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])
+AC_PATH_PROGS([BASH_SHELL], [bash bash4], [false])
+
+AS_IF([test "x$BASH_SHELL" = "xfalse"],
+ AC_MSG_WARN([*** bash >= 4.1.0 is required for pacman scripts]),
+ [bash_version_major=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[0]]}"'`
+ bash_version_minor=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[1]]}"'`
+ ok=yes
+ if test "$bash_version_major" -lt 4; then
+ ok=no
+ fi
+ if test "$bash_version_major" -eq 4 && test "$bash_version_minor" -lt 1; then
+ ok=no
+ fi
+ if test "$ok" = "no"; then
+ AC_MSG_ERROR([*** bash >= 4.1.0 is required for pacman scripts])
+ fi
+ unset bash_version_major bash_version_minor ok])
# find installed gettext
AM_GNU_GETTEXT([external], [need-ngettext])
@@ -142,34 +179,72 @@ 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
-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, [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 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"],
- [AC_MSG_RESULT(yes)
- AC_CHECK_LIB([gpgme], [gpgme_check_version], ,
- [if test "x$with_gpgme" != "xcheck"; then
- AC_MSG_FAILURE([--with-ggpme was given, but -lgpgme was not found])
- fi],
- [-lgpgme])
- with_gpgme=$ac_cv_lib_gpgme_gpgme_check_version],
- AC_MSG_RESULT(no))
-AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$with_gpgme" = "xyes"])
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])])
+
+have_gpgme=no
+AS_IF([test "x$with_gpgme" != "xno"],
+ [AM_PATH_GPGME([1.3.0],
+ [LIBS_save="$LIBS"
+ CPPFLAGS_save="$CPPFLAGS"
+ CFLAGS_save="$CFLAGS"
+
+ LIBS="$LIBS $GPGME_LIBS"
+ CPPFLAGS="$CPPFLAGS $GPGME_CPPFLAGS"
+ CFLAGS="$CFLAGS $GPGME_CFLAGS"
+
+ AC_MSG_CHECKING([for sane gpgme])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <gpgme.h>]],
+ [[return gpgme_check_version("1.3.0");]])],
+ [AC_MSG_RESULT([yes])
+ have_gpgme=yes
+ AC_DEFINE([HAVE_LIBGPGME], [1], [Define if gpgme should be used to provide GPG signature support.])],
+ [AC_MSG_RESULT([no])
+ 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 \
@@ -203,6 +278,7 @@ AC_CHECK_FUNCS([dup2 getcwd geteuid getmntinfo gettimeofday memmove memset \
mkdir realpath regcomp rmdir setenv setlocale strcasecmp \
strchr strcspn strdup strerror strndup strrchr strsep strstr \
strtol swprintf tcflush wcwidth uname])
+AC_CHECK_MEMBERS([struct stat.st_blksize],,,[[#include <sys/stat.h>]])
# For the diskspace code
FS_STATS_TYPE
@@ -210,15 +286,13 @@ AC_CHECK_MEMBERS([struct statvfs.f_flag],,,[[#include <sys/statvfs.h>]])
AC_CHECK_MEMBERS([struct statfs.f_flags],,,[[#include <sys/param.h>
#include <sys/mount.h>]])
-# Enable large file support if available
-AC_SYS_LARGEFILE
-
# Check if we can use symbol visibility support in GCC
GCC_VISIBILITY_CC
# Check if we have -fgnu89-inline flag
GCC_GNU89_INLINE_CC
# Host-dependant definitions
+INODECMD="stat -c '%i %n'"
SIZECMD="stat -c %s"
SEDINPLACE="sed -i"
STRIP_BINARIES="--strip-all"
@@ -226,15 +300,17 @@ STRIP_SHARED="--strip-unneeded"
STRIP_STATIC="--strip-debug"
case "${host_os}" in
*bsd*)
+ INODECMD="stat -f '%i %n'"
SIZECMD="stat -f %z"
SEDINPLACE="sed -i \"\""
;;
cygwin*)
host_os_cygwin=yes
- CFLAGS="$CFLAGS -DCYGWIN"
+ AC_DEFINE([CYGWIN], [1], [Define if host OS is cygwin])
;;
darwin*)
host_os_darwin=yes
+ INODECMD="/usr/bin/stat -f '%i %n'"
SIZECMD="/usr/bin/stat -f %z"
SEDINPLACE="/usr/bin/sed -i ''"
STRIP_BINARIES=""
@@ -246,6 +322,7 @@ esac
AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
+AC_SUBST(INODECMD)
AC_SUBST(SIZECMD)
AC_SUBST(SEDINPLACE)
AC_SUBST(STRIP_BINARIES)
@@ -297,16 +374,49 @@ AC_MSG_CHECKING(for debug mode request)
if test "x$debug" = "xyes" ; then
AC_MSG_RESULT(yes)
AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
- # Check for mcheck
- AC_CHECK_HEADERS([mcheck.h])
# Check for -fstack-protector availability
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)
+ 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-field-initializers], [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)
- CFLAGS="$CFLAGS -Wall"
fi
# Enable or disable use of git version in pacman version string
@@ -330,6 +440,7 @@ AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")
# Set root directory
AC_SUBST(ROOTDIR)
+AC_DEFINE_UNQUOTED([ROOTDIR], "$ROOTDIR", [The location of the root operating directory])
# Set package file extension
AC_SUBST(PKGEXT)
AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
@@ -339,11 +450,15 @@ AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman sourc
# Set makepkg build script name
AC_SUBST(BUILDSCRIPT)
AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
+# Set shell used by install scriptlets
+AC_SUBST(SCRIPTLET_SHELL)
+AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the shell used to run install scriptlets])
# Configuration files
AC_CONFIG_FILES([
lib/libalpm/Makefile
lib/libalpm/po/Makefile.in
+lib/libalpm/libalpm.pc
src/pacman/Makefile
src/pacman/po/Makefile.in
src/util/Makefile
@@ -353,6 +468,7 @@ doc/Makefile
etc/Makefile
test/pacman/Makefile
test/pacman/tests/Makefile
+test/scripts/Makefile
test/util/Makefile
contrib/Makefile
Makefile
@@ -373,13 +489,14 @@ ${PACKAGE_NAME}:
compiler : ${CC}
preprocessor flags : ${CPPFLAGS}
- compiler flags : ${CFLAGS}
+ compiler flags : ${WARNING_CFLAGS} ${CFLAGS}
defines : ${DEFS}
- library flags : ${LIBS}
+ library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} ${GPGME_LIBS}
linker flags : ${LDFLAGS}
Architecture : ${CARCH}
Host Type : ${CHOST}
+ File inode command : ${INODECMD}
Filesize command : ${SIZECMD}
In-place sed command : ${SEDINPLACE}
@@ -395,12 +512,14 @@ ${PACKAGE_NAME}:
build script name : ${BUILDSCRIPT}
Compilation options:
- Use libcurl : ${with_libcurl}
- Use GPGME : ${with_gpgme}
- Use OpenSSL : ${with_openssl}
+ Use libcurl : ${have_libcurl}
+ Use GPGME : ${have_gpgme}
+ Use OpenSSL : ${have_openssl}
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: