summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-04-08 21:55:30 -0500
committerDan McGee <dan@archlinux.org>2012-04-08 21:55:30 -0500
commitd158dde30c378acc8e88d5208aa837f92331af9e (patch)
treeb99456c7b765becdb5bab3869af5a2e512026562
parent31091963edaa505d00642aecb9950ce087a40b73 (diff)
parentb729ed01093312cef7ce48d07b13e225b25446db (diff)
downloadpacman-d158dde30c378acc8e88d5208aa837f92331af9e.tar.xz
Merge remote-tracking branch 'dave/buildsys'
Oh god, what are we thinking thinking merging this. Hopefully this works with only a few follow-up patches necessary.
-rwxr-xr-xautoclean.sh24
-rwxr-xr-xbuild-aux/config.guess (renamed from config.guess)0
-rwxr-xr-xbuild-aux/config.rpath (renamed from config.rpath)0
-rwxr-xr-xbuild-aux/config.sub (renamed from config.sub)0
-rwxr-xr-xbuild-aux/depcomp (renamed from depcomp)0
-rwxr-xr-xbuild-aux/install-sh (renamed from install-sh)0
-rw-r--r--build-aux/ltmain.sh (renamed from ltmain.sh)0
-rwxr-xr-xbuild-aux/missing (renamed from missing)0
-rwxr-xr-xbuild-aux/mkinstalldirs (renamed from mkinstalldirs)0
-rw-r--r--configure.ac143
-rw-r--r--lib/libalpm/Makefile.am19
-rw-r--r--lib/libalpm/deps.c10
-rw-r--r--lib/libalpm/trans.c7
-rw-r--r--lib/libalpm/util.c17
-rw-r--r--lib/libalpm/util.h2
-rw-r--r--m4/acinclude.m4 (renamed from acinclude.m4)20
-rw-r--r--m4/libcurl.m4250
-rw-r--r--m4/pkg.m4159
-rw-r--r--src/pacman/Makefile.am2
-rw-r--r--src/pacman/conf.c6
-rw-r--r--src/pacman/pacman.c9
-rw-r--r--src/pacman/sync.c4
-rw-r--r--src/pacman/util.c2
-rw-r--r--src/util/Makefile.am4
24 files changed, 335 insertions, 343 deletions
diff --git a/autoclean.sh b/autoclean.sh
index 8f45d561..900f3536 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 {} +
diff --git a/config.guess b/build-aux/config.guess
index 28523784..28523784 100755
--- a/config.guess
+++ b/build-aux/config.guess
diff --git a/config.rpath b/build-aux/config.rpath
index c492a93b..c492a93b 100755
--- a/config.rpath
+++ b/build-aux/config.rpath
diff --git a/config.sub b/build-aux/config.sub
index 320e3038..320e3038 100755
--- a/config.sub
+++ b/build-aux/config.sub
diff --git a/depcomp b/build-aux/depcomp
index df8eea7e..df8eea7e 100755
--- a/depcomp
+++ b/build-aux/depcomp
diff --git a/install-sh b/build-aux/install-sh
index 3f83ce9b..3f83ce9b 100755
--- a/install-sh
+++ b/build-aux/install-sh
diff --git a/ltmain.sh b/build-aux/ltmain.sh
index 5f505e27..5f505e27 100644
--- a/ltmain.sh
+++ b/build-aux/ltmain.sh
diff --git a/missing b/build-aux/missing
index 28055d2a..28055d2a 100755
--- a/missing
+++ b/build-aux/missing
diff --git a/mkinstalldirs b/build-aux/mkinstalldirs
index 4191a45d..4191a45d 100755
--- a/mkinstalldirs
+++ b/build-aux/mkinstalldirs
diff --git a/configure.ac b/configure.ac
index 18726cfb..b31b58a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,11 +55,14 @@ 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([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"
@@ -105,8 +108,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,
@@ -123,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],
@@ -136,12 +146,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])
@@ -153,21 +158,30 @@ 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, [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)
@@ -175,11 +189,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"
@@ -192,23 +204,26 @@ AS_IF([test "x$with_gpgme" != "xno"],
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <gpgme.h>]],
- [[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 \
@@ -268,7 +283,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
@@ -338,10 +353,44 @@ 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)
+ 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)
- CFLAGS="$CFLAGS -Wall"
fi
# Enable or disable use of git version in pacman version string
@@ -412,9 +461,9 @@ ${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}
@@ -434,12 +483,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:
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index 61dcb877..0781d5d8 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
@@ -63,7 +63,20 @@ libalpm_la_SOURCES += \
base64.h base64.c
endif
-libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO) @LIBCURL@
-libalpm_la_LIBADD = $(LTLIBINTL)
+libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
+
+libalpm_la_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(GPGME_CFLAGS) \
+ $(LIBARCHIVE_CFLAGS) \
+ $(LIBCURL_CFLAGS) \
+ $(LIBSSL_CFLAGS)
+
+libalpm_la_LIBADD = \
+ $(LTLIBINTL) \
+ $(GPGME_LIBS) \
+ $(LIBARCHIVE_LIBS) \
+ $(LIBCURL_LIBS) \
+ $(LIBSSL_LIBS)
# vim:set ts=2 sw=2 noet:
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 6069f5e6..98519bd0 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -158,15 +158,17 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
else if(nextchild->state == -1) {
alpm_pkg_t *vertexpkg = vertex->data;
alpm_pkg_t *childpkg = nextchild->data;
- const char *message;
_alpm_log(handle, ALPM_LOG_WARNING, _("dependency cycle detected:\n"));
if(reverse) {
- message =_("%s will be removed after its %s dependency\n");
+ _alpm_log(handle, ALPM_LOG_WARNING,
+ _("%s will be removed after its %s dependency\n"),
+ vertexpkg->name, childpkg->name);
} else {
- message =_("%s will be installed before its %s dependency\n");
+ _alpm_log(handle, ALPM_LOG_WARNING,
+ _("%s will be installed before its %s dependency\n"),
+ vertexpkg->name, childpkg->name);
}
- _alpm_log(handle, ALPM_LOG_WARNING, message, vertexpkg->name, childpkg->name);
}
}
if(!found) {
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index 4309c07e..08f70dd7 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -276,8 +276,8 @@ static int grep(const char *fn, const char *needle)
int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath,
const char *script, const char *ver, const char *oldver, int is_archive)
{
- char cmdline[PATH_MAX];
- char *argv[] = { SCRIPTLET_SHELL, "-c", cmdline, NULL };
+ char arg0[64], arg1[3], cmdline[PATH_MAX];
+ char *argv[] = { arg0, arg1, cmdline, NULL };
char *tmpdir, *scriptfn = NULL, *scriptpath;
int retval = 0;
size_t len;
@@ -293,6 +293,9 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *filepath,
return 0;
}
+ strcpy(arg0, SCRIPTLET_SHELL);
+ strcpy(arg1, "-c");
+
/* create a directory in $root/tmp/ for copying/extracting the scriptlet */
len = strlen(handle->root) + strlen("tmp/alpm_XXXXXX") + 1;
MALLOC(tmpdir, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 22e9e359..a392c773 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -621,7 +621,9 @@ int _alpm_ldconfig(alpm_handle_t *handle)
if(access(line, F_OK) == 0) {
snprintf(line, PATH_MAX, "%ssbin/ldconfig", handle->root);
if(access(line, X_OK) == 0) {
- char *argv[] = { "ldconfig", NULL };
+ char arg0[32];
+ char *argv[] = { arg0, NULL };
+ strcpy(arg0, "ldconfig");
return _alpm_run_chroot(handle, "/sbin/ldconfig", argv);
}
}
@@ -676,7 +678,8 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle)
{
struct stat buf;
alpm_list_t *i;
- char *cachedir, *tmpdir;
+ char *cachedir;
+ const char *tmpdir;
/* Loop through the cache dirs until we find a usable directory */
for(i = handle->cachedirs; i; i = i->next) {
@@ -995,13 +998,13 @@ int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b)
}
if(needed > b->line_size) {
/* need to realloc + copy data to fit total length */
- char *new;
- CALLOC(new, needed, sizeof(char), b->ret = -ENOMEM; goto cleanup);
- memcpy(new, b->line, b->line_size);
+ char *new_line;
+ CALLOC(new_line, needed, sizeof(char), b->ret = -ENOMEM; goto cleanup);
+ memcpy(new_line, b->line, b->line_size);
b->line_size = needed;
- b->line_offset = new + (b->line_offset - b->line);
+ b->line_offset = new_line + (b->line_offset - b->line);
free(b->line);
- b->line = new;
+ b->line = new_line;
}
}
diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h
index e6747827..e35e35b9 100644
--- a/lib/libalpm/util.h
+++ b/lib/libalpm/util.h
@@ -87,7 +87,7 @@
#endif
#define OPEN(fd, path, flags) do { fd = open(path, flags | O_BINARY); } while(fd == -1 && errno == EINTR)
-#define CLOSE(fd) do { int ret; do { ret = close(fd); } while(ret == -1 && errno == EINTR); } while(0)
+#define CLOSE(fd) do { int _ret; do { _ret = close(fd); } while(_ret == -1 && errno == EINTR); } while(0)
/**
* Used as a buffer/state holder for _alpm_archive_fgets().
diff --git a/acinclude.m4 b/m4/acinclude.m4
index df4f83a4..8ea45973 100644
--- a/acinclude.m4
+++ b/m4/acinclude.m4
@@ -101,6 +101,26 @@ AC_DEFUN([GCC_GNU89_INLINE_CC],[
fi
])
+dnl CFLAGS_ADD(PARAMETER, VARIABLE)
+dnl Adds parameter to VARIABLE if the compiler supports it. For example,
+dnl CFLAGS_ADD([-Wall],[WARN_FLAGS]).
+AC_DEFUN([CFLAGS_ADD],
+[AS_VAR_PUSHDEF([my_cflags], [cflags_cv_warn_$1])dnl
+AC_CACHE_CHECK([whether compiler handles $1], [my_cflags], [
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="${CFLAGS} $1"
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+ [AS_VAR_SET([my_cflags], [yes])],
+ [AS_VAR_SET([my_cflags], [no])])
+ CFLAGS="$save_CFLAGS"
+])
+AS_VAR_PUSHDEF([new_cflags], [[$2]])dnl
+AS_VAR_IF([my_cflags], [yes], [AS_VAR_APPEND([new_cflags], [" $1"])])
+AS_VAR_POPDEF([new_cflags])dnl
+AS_VAR_POPDEF([my_cflags])dnl
+m4_ifval([$2], [AS_LITERAL_IF([$2], [AC_SUBST([$2])], [])])dnl
+])
+
dnl Checks for getmntinfo and determines whether it uses statfs or statvfs
AC_DEFUN([FS_STATS_TYPE],
[AC_CACHE_CHECK([filesystem statistics type], fs_stats_cv_type,
diff --git a/m4/libcurl.m4 b/m4/libcurl.m4
deleted file mode 100644
index 01a0575c..00000000
--- 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
diff --git a/m4/pkg.m4 b/m4/pkg.m4
new file mode 100644
index 00000000..5152a4b1
--- /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
diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am
index 9a92fd6b..c8ce9773 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/pacman/conf.c b/src/pacman/conf.c
index 4c3d063b..2632d18f 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -202,14 +202,14 @@ static int download_with_xfercommand(const char *url, const char *localpath,
cleanup:
/* restore the old cwd if we have it */
if(cwdfd >= 0) {
- int ret;
+ int close_ret;
if(fchdir(cwdfd) != 0) {
pm_printf(ALPM_LOG_ERROR, _("could not restore working directory (%s)\n"),
strerror(errno));
}
do {
- ret = close(cwdfd);
- } while(ret == -1 && errno == EINTR);
+ close_ret = close(cwdfd);
+ } while(close_ret == -1 && errno == EINTR);
}
if(ret == -1) {
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 1e6797c9..73d5be94 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -808,12 +808,13 @@ int main(int argc, char *argv[])
/* we support reading targets from stdin if a cmdline parameter is '-' */
if(!isatty(fileno(stdin)) && alpm_list_find_str(pm_targets, "-")) {
- size_t current_size = PATH_MAX, i = 0;
+ size_t current_size = PATH_MAX;
char *line = malloc(current_size);
/* remove the '-' from the list */
pm_targets = alpm_list_remove_str(pm_targets, "-", NULL);
+ i = 0;
while((line[i] = (char)fgetc(stdin)) != EOF) {
if(isspace((unsigned char)line[i])) {
/* avoid adding zero length arg when multiple spaces separate args */
@@ -885,13 +886,13 @@ int main(int argc, char *argv[])
#endif
if(config->verbose > 0) {
- alpm_list_t *i;
+ alpm_list_t *j;
printf("Root : %s\n", alpm_option_get_root(config->handle));
printf("Conf File : %s\n", config->configfile);
printf("DB Path : %s\n", alpm_option_get_dbpath(config->handle));
printf("Cache Dirs: ");
- for(i = alpm_option_get_cachedirs(config->handle); i; i = alpm_list_next(i)) {
- printf("%s ", (const char *)i->data);
+ for(j = alpm_option_get_cachedirs(config->handle); j; j = alpm_list_next(j)) {
+ printf("%s ", (const char *)j->data);
}
printf("\n");
printf("Lock File : %s\n", alpm_option_get_lockfile(config->handle));
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 5165dca1..9c17f45f 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -307,12 +307,12 @@ static int sync_cleancache(int level)
static int sync_synctree(int level, alpm_list_t *syncs)
{
alpm_list_t *i;
- int success = 0, ret;
+ unsigned int success = 0;
for(i = syncs; i; i = alpm_list_next(i)) {
alpm_db_t *db = i->data;
- ret = alpm_db_update((level < 2 ? 0 : 1), db);
+ int ret = alpm_db_update((level < 2 ? 0 : 1), db);
if(ret < 0) {
pm_printf(ALPM_LOG_ERROR, _("failed to update %s (%s)\n"),
alpm_db_get_name(db), alpm_strerror(alpm_errno(config->handle)));
diff --git a/src/pacman/util.c b/src/pacman/util.c
index f2ab163b..be8fc308 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -258,7 +258,7 @@ void indentprint(const char *str, unsigned short indent, unsigned short cols)
{
wchar_t *wcstr;
const wchar_t *p;
- int len, cidx;
+ size_t len, cidx;
if(!str) {
return;
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index e386d950..463abf7f 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
@@ -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: