2 # Process this file with autoconf to produce a configure script.
3 # Minimum version of autoconf required
6 # UPDATING VERSION NUMBERS FOR RELEASES
10 # The most recent interface number that this library implements.
12 # The implementation number of the current interface.
14 # The difference between the newest and oldest interfaces that this library
15 # implements. In other words, the library implements all the interface
16 # numbers in the range from number current - age to current.
18 # 1. Start with version information of `0:0:0' for each libtool library.
19 # 2. Update the version information only immediately before a public release of
20 # your software. More frequent updates are unnecessary, and only guarantee
21 # that the current interface number gets larger faster.
22 # 3. If the library source code has changed at all since the last update, then
23 # increment revision (`c:r:a' becomes `c:r+1:a').
24 # 4. If any interfaces have been added, removed, or changed since the last
25 # update, increment current, and set revision to 0.
26 # 5. If any interfaces have been added since the last public release, then
28 # 6. If any interfaces have been removed since the last public release, then
32 # Extreme huge major changes:
33 # pacman_version_major += 1
34 # pacman_version_minor = 0
35 # pacman_version_micro = 0
38 # pacman_version_minor += 1
39 # pacman_version_micro = 0
42 # pacman_version_micro += 1
44 m4_define([lib_current], [8])
45 m4_define([lib_revision], [2])
46 m4_define([lib_age], [0])
48 m4_define([pacman_version_major], [4])
49 m4_define([pacman_version_minor], [1])
50 m4_define([pacman_version_micro], [2])
51 m4_define([pacman_version],
52 [pacman_version_major.pacman_version_minor.pacman_version_micro])
54 # Autoconf initialization
55 AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org])
56 AC_CONFIG_SRCDIR([config.h.in])
57 AC_CONFIG_HEADERS([config.h])
58 AC_CONFIG_MACRO_DIR([m4])
59 AC_CONFIG_AUX_DIR([build-aux])
60 AC_REQUIRE_AUX_FILE([tap-driver.sh])
63 AM_INIT_AUTOMAKE([1.11 foreign])
64 AM_SILENT_RULES([yes])
67 LIB_VERSION=`expr lib_current - lib_age`.lib_age.lib_revision
68 LIB_VERSION_INFO="lib_current:lib_revision:lib_age"
70 # Respect empty CFLAGS during compiler tests
71 if test "x$CFLAGS" = "x"; then
75 # Set subsitution values for version stuff in Makefiles and anywhere else,
76 # and put LIB_VERSION in config.h
78 AC_SUBST(LIB_VERSION_INFO)
79 AC_DEFINE_UNQUOTED([LIB_VERSION], ["$LIB_VERSION"], [libalpm version number])
81 # Help line for root directory
83 AS_HELP_STRING([--with-root-dir=path], [set the location of the root operating directory]),
84 [ROOTDIR=$withval], [ROOTDIR=/])
86 # Help line for package extension
88 AS_HELP_STRING([--with-pkg-ext=ext], [set the file extension used by packages]),
89 [PKGEXT=$withval], [PKGEXT=.pkg.tar.gz])
91 # Help line for source package directory
93 AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]),
94 [SRCEXT=$withval], [SRCEXT=.src.tar.gz])
96 # Help line for buildscript filename
97 AC_ARG_WITH(buildscript,
98 AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
99 [BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
101 # Help line for buildscript filename
102 AC_ARG_WITH(makepkg-template-dir,
103 AS_HELP_STRING([--with-makepkg-template-dir=name], [set the template dir used by makepkg-template]),
104 [TEMPLATE_DIR=$withval], [TEMPLATE_DIR=/usr/share/makepkg-template])
106 # Help line for debug package suffix
107 AC_ARG_WITH(debug-suffix,
108 AS_HELP_STRING([--with-debug-suffix=name], [set the suffix for split debugging symbol packages used by makepkg]),
109 [DEBUGSUFFIX=$withval], [DEBUGSUFFIX=debug])
111 # Help line for changing shell used to run install scriptlets
112 AC_ARG_WITH(scriptlet-shell,
113 AS_HELP_STRING([--with-scriptlet-shell=shell],
114 [set the full path to the shell used to run install scriptlets]),
115 [SCRIPTLET_SHELL=$withval], [SCRIPTLET_SHELL=/bin/sh])
117 # Help line for ldconfig path
118 AC_ARG_WITH(ldconfig,
119 AS_HELP_STRING([--with-ldconfig=path],
120 [set the full path to ldconfig]),
121 [LDCONFIG=$withval], [LDCONFIG=/sbin/ldconfig])
123 # Help line for using OpenSSL
125 AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
126 [], [with_openssl=check])
128 # Help line for using gpgme
130 AS_HELP_STRING([--with-gpgme], [use GPGME for PGP signature verification]),
131 [], [with_gpgme=check])
133 # Help line for using libcurl
135 AS_HELP_STRING([--with-libcurl], [use libcurl for the internal downloader]),
136 [], [with_curl=check])
138 # Help line for documentation
140 AS_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
141 [wantdoc=$enableval], [wantdoc=yes])
143 # Help line for doxygen
144 AC_ARG_ENABLE(doxygen,
145 AS_HELP_STRING([--enable-doxygen], [build your own API docs via Doxygen]),
146 [wantdoxygen=$enableval], [wantdoxygen=no])
148 # Help line for debug
150 AS_HELP_STRING([--enable-debug], [enable debugging support]),
151 [debug=$enableval], [debug=no])
153 # Help line for compiler warning flags
154 AC_ARG_ENABLE(warningflags,
155 AS_HELP_STRING([--enable-warningflags], [enable extra compiler warning flags]),
156 [warningflags=$enableval], [warningflags=no])
158 # Help line for using git version in pacman version string
159 AC_ARG_ENABLE(git-version,
160 AS_HELP_STRING([--enable-git-version],
161 [enable use of git version in version string if available]),
162 [wantgitver=$enableval], [wantgitver=no])
164 # Enable large file support if available (must be enabled before
165 # testing compilation against gpgme).
168 # Checks for programs.
172 AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false])
173 AC_PATH_PROGS([BASH_SHELL], [bash bash4], [false])
175 # check for perl 5.10.1 (needed by makepkg-template)
176 AC_PATH_PROG([PERL],[perl])
177 AC_DEFUN([AX_PROG_PERL_VERSION],
178 [AC_CACHE_CHECK([for Perl version $1 or later], [ax_cv_prog_perl_version],
179 [AS_IF(["$PERL" -e 'require v$1;' >/dev/null 2>&1],
180 [ax_cv_prog_perl_version=yes],
181 [ax_cv_prog_perl_version=no])])
182 AS_IF([test x"$ax_cv_prog_perl_version" = xyes], [$2], [$3])])
183 AX_PROG_PERL_VERSION([5.10.1], [], [AC_MSG_ERROR([perl is too old])])
185 AS_IF([test "x$BASH_SHELL" = "xfalse"],
186 AC_MSG_WARN([*** bash >= 4.1.0 is required for pacman scripts]),
187 [bash_version_major=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[0]]}"'`
188 bash_version_minor=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[1]]}"'`
190 if test "$bash_version_major" -lt 4; then
193 if test "$bash_version_major" -eq 4 && test "$bash_version_minor" -lt 1; then
196 if test "$ok" = "no"; then
197 AC_MSG_ERROR([*** bash >= 4.1.0 is required for pacman scripts])
199 unset bash_version_major bash_version_minor ok])
201 # find installed gettext
202 AM_GNU_GETTEXT([external], [need-ngettext])
203 AM_GNU_GETTEXT_VERSION(0.13.1)
205 AC_CHECK_LIB([m], [fabs], ,
206 AC_MSG_ERROR([libm is needed to compile pacman!]))
208 # Check for libarchive
209 PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 2.8.0], ,
210 AC_MSG_ERROR([*** libarchive >= 2.8.0 is needed to compile pacman!]))
214 if test "x$with_openssl" != "xno"; then
215 PKG_CHECK_MODULES(LIBSSL, [libcrypto],
216 [AC_DEFINE(HAVE_LIBSSL, 1, [Define if libcrypto is available]) have_openssl=yes], have_openssl=no)
217 if test "x$have_openssl" = xno -a "x$with_openssl" = xyes; then
218 AC_MSG_ERROR([*** openssl support requested but libraries not found])
221 AM_CONDITIONAL(HAVE_LIBSSL, [test "$have_openssl" = "yes"])
225 if test "x$with_libcurl" != "xno"; then
226 PKG_CHECK_MODULES(LIBCURL, [libcurl >= 7.19.4],
227 [AC_DEFINE(HAVE_LIBCURL, 1, [Define if libcurl is available]) have_libcurl=yes], have_libcurl=no)
228 if test "x$have_libcurl" = xno -a "x$with_libcurl" = xyes; then
229 AC_MSG_ERROR([*** libcurl >= 7.19.4 is required for internal downloader support])
232 AM_CONDITIONAL(HAVE_LIBCURL, [test "$have_libcurl" = "yes"])
235 AC_MSG_CHECKING(whether to link with libgpgme)
236 AS_IF([test "x$with_gpgme" != "xno"],
237 [AC_MSG_RESULT([yes])],
238 [AC_MSG_RESULT([no])])
241 AS_IF([test "x$with_gpgme" != "xno"],
242 [AM_PATH_GPGME([1.3.0],
244 CPPFLAGS_save="$CPPFLAGS"
245 CFLAGS_save="$CFLAGS"
247 LIBS="$LIBS $GPGME_LIBS"
248 CPPFLAGS="$CPPFLAGS $GPGME_CPPFLAGS"
249 CFLAGS="$CFLAGS $GPGME_CFLAGS"
251 AC_MSG_CHECKING([for sane gpgme])
254 [[#include <gpgme.h>]],
255 [[return gpgme_check_version("1.3.0");]])],
256 [AC_MSG_RESULT([yes])
258 AC_DEFINE([HAVE_LIBGPGME], [1], [Define if gpgme should be used to provide GPG signature support.])],
263 AS_IF([test "x$with_gpgme" = "xyes"],
264 [AC_MSG_FAILURE([*** gpgme >= 1.3.0 is needed for GPG signature support])])
268 CPPFLAGS="$CPPFLAGS_save"
269 CFLAGS="$CFLAGS_save"
271 unset CFLAGS_save],)])
273 AS_IF([test "x$have_gpgme" = xno -a "x$with_gpgme" = xyes],
274 [AC_MSG_FAILURE([--with-gpgme was given, but gpgme was not found])])
275 AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$have_gpgme" = "xyes"])
277 # Checks for header files.
278 AC_CHECK_HEADERS([fcntl.h float.h glob.h langinfo.h libintl.h limits.h \
279 locale.h mntent.h netinet/in.h netinet/tcp.h \
280 stddef.h string.h sys/ioctl.h \
281 sys/mnttab.h sys/mount.h \
282 sys/param.h sys/statvfs.h sys/time.h sys/types.h \
283 sys/ucred.h syslog.h termios.h wchar.h])
285 # Checks for typedefs, structures, and compiler characteristics.
295 AC_STRUCT_DIRENT_D_TYPE
298 # Checks for library functions.
301 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
305 AC_CHECK_FUNCS([dup2 getcwd getmntinfo gettimeofday memmove memset \
306 mkdir realpath regcomp rmdir setenv setlocale strcasecmp \
307 strchr strcspn strdup strerror strndup strrchr strsep strstr \
308 strtol swprintf tcflush wcwidth uname])
309 AC_CHECK_MEMBERS([struct stat.st_blksize],,,[[#include <sys/stat.h>]])
311 # For the diskspace code
313 AC_CHECK_MEMBERS([struct statvfs.f_flag],,,[[#include <sys/statvfs.h>]])
314 AC_CHECK_MEMBERS([struct statfs.f_flags],,,[[#include <sys/param.h>
315 #include <sys/mount.h>]])
317 # Check if we can use symbol visibility support in GCC
319 # Check if we have -fgnu89-inline flag
322 # Host-dependant definitions
323 INODECMD="stat -c '%i %n'"
325 SEDINPLACE="sed --follow-symlinks -i"
326 DUFLAGS="-sk --apparent-size"
327 STRIP_BINARIES="--strip-all"
328 STRIP_SHARED="--strip-unneeded"
329 STRIP_STATIC="--strip-debug"
332 INODECMD="stat -f '%i %N'"
334 SEDINPLACE="sed -i \"\""
339 INODECMD="/usr/bin/stat -f '%i %N'"
340 SIZECMD="/usr/bin/stat -f %z"
341 SEDINPLACE="/usr/bin/sed -i ''"
349 AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
350 AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
355 AC_SUBST(STRIP_BINARIES)
356 AC_SUBST(STRIP_SHARED)
357 AC_SUBST(STRIP_STATIC)
359 # Variables plugged into makepkg.conf
365 # Check for documentation support and status
366 AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
367 AC_MSG_CHECKING([for building documentation])
368 if test "x$wantdoc" = "xyes" ; then
369 if test $ASCIIDOC ; then
370 AC_MSG_RESULT([yes, enabled by configure])
372 asciidoc="(warning : asciidoc not installed)"
373 AC_MSG_RESULT([yes $asciidoc])
377 AC_MSG_RESULT([no, disabled by configure])
380 AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")
382 # Check for doxygen support and status
383 AC_CHECK_PROGS([DOXYGEN], [doxygen])
384 AC_MSG_CHECKING([for doxygen])
385 if test "x$wantdoxygen" = "xyes" ; then
386 if test $DOXYGEN ; then
390 AC_MSG_RESULT([no, doxygen missing])
394 AC_MSG_RESULT([no, disabled by configure])
397 AM_CONDITIONAL(USE_DOXYGEN, test "x$usedoxygen" = "xyes")
399 # Enable or disable debug code
400 AC_MSG_CHECKING(for debug mode request)
401 if test "x$debug" = "xyes" ; then
403 AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
404 # Check for -fstack-protector availability
405 GCC_STACK_PROTECT_LIB
407 GCC_FORTIFY_SOURCE_CC
408 WARNING_CFLAGS="-g -Wall -Werror"
411 WARNING_CFLAGS="-Wall"
414 # Enable or disable compiler warning flags
415 AC_MSG_CHECKING(for excessive compiler warning flags)
416 if test "x$warningflags" = "xyes" ; then
418 CFLAGS_ADD([-Wcast-align], [WARNING_CFLAGS])
419 CFLAGS_ADD([-Wclobbered], [WARNING_CFLAGS])
420 CFLAGS_ADD([-Wempty-body], [WARNING_CFLAGS])
421 CFLAGS_ADD([-Wfloat-equal], [WARNING_CFLAGS])
422 CFLAGS_ADD([-Wformat-nonliteral], [WARNING_CFLAGS])
423 CFLAGS_ADD([-Wformat-security], [WARNING_CFLAGS])
424 CFLAGS_ADD([-Wignored-qualifiers], [WARNING_CFLAGS])
425 CFLAGS_ADD([-Winit-self], [WARNING_CFLAGS])
426 CFLAGS_ADD([-Wlogical-op], [WARNING_CFLAGS])
427 CFLAGS_ADD([-Wmissing-declarations], [WARNING_CFLAGS])
428 CFLAGS_ADD([-Wmissing-field-initializers], [WARNING_CFLAGS])
429 CFLAGS_ADD([-Wmissing-parameter-type], [WARNING_CFLAGS])
430 CFLAGS_ADD([-Wmissing-prototypes], [WARNING_CFLAGS])
431 CFLAGS_ADD([-Wold-style-declaration], [WARNING_CFLAGS])
432 CFLAGS_ADD([-Woverride-init], [WARNING_CFLAGS])
433 CFLAGS_ADD([-Wpointer-arith], [WARNING_CFLAGS])
434 CFLAGS_ADD([-Wredundant-decls], [WARNING_CFLAGS])
435 CFLAGS_ADD([-Wshadow], [WARNING_CFLAGS])
436 CFLAGS_ADD([-Wsign-compare], [WARNING_CFLAGS])
437 CFLAGS_ADD([-Wstrict-aliasing], [WARNING_CFLAGS])
438 CFLAGS_ADD([-Wstrict-overflow=5], [WARNING_CFLAGS])
439 CFLAGS_ADD([-Wstrict-prototypes], [WARNING_CFLAGS])
440 CFLAGS_ADD([-Wtype-limits], [WARNING_CFLAGS])
441 CFLAGS_ADD([-Wuninitialized], [WARNING_CFLAGS])
442 CFLAGS_ADD([-Wunused-but-set-parameter], [WARNING_CFLAGS])
443 CFLAGS_ADD([-Wunused-parameter], [WARNING_CFLAGS])
444 CFLAGS_ADD([-Wwrite-strings], [WARNING_CFLAGS])
449 # Enable or disable use of git version in pacman version string
450 AC_MSG_CHECKING(whether to use git version if available)
451 if test "x$wantgitver" = "xyes" ; then
452 AC_CHECK_PROGS([GIT], [git])
453 AC_CHECK_FILE([.git/], hasgitdir=yes)
454 usegitver=$ac_cv_file__git_
455 if test $GIT -a "x$hasgitdir" = "xyes"; then
456 AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
459 AC_MSG_RESULT([no, disabled by configure])
462 AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")
466 AC_DEFINE_UNQUOTED([ROOTDIR], "$ROOTDIR", [The location of the root operating directory])
467 # Set package file extension
469 AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
470 # Set source package file extension
472 AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages])
473 # Set makepkg build script name
474 AC_SUBST(BUILDSCRIPT)
475 AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
476 # Set makepkg-template template directory
477 AC_SUBST(TEMPLATE_DIR)
478 AC_DEFINE_UNQUOTED([TEMPLATE_DIR], "$TEMPLATE_DIR", [The template directory used by makepkg-teplate])
479 # Set makepkg split debugging symbol package suffix
480 AC_SUBST(DEBUGSUFFIX)
481 AC_DEFINE_UNQUOTED([DEBUGSUFFIX], "$DEBUGSUFFIX", [The suffix for debugging symbol packages used by makepkg])
482 # Set shell used by install scriptlets
483 AC_SUBST(SCRIPTLET_SHELL)
484 AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the shell used to run install scriptlets])
487 AC_DEFINE_UNQUOTED([LDCONFIG], "$LDCONFIG", [The full path to ldconfig])
490 # Configuration files
493 lib/libalpm/po/Makefile.in
494 lib/libalpm/libalpm.pc
497 src/pacman/po/Makefile.in
500 scripts/po/Makefile.in
504 test/pacman/tests/Makefile
505 test/scripts/Makefile
516 source code location : ${srcdir}
518 sysconfdir : $(eval echo ${sysconfdir})
519 conf file : $(eval echo ${sysconfdir})/pacman.conf
520 localstatedir : $(eval echo ${localstatedir})
521 database dir : $(eval echo ${localstatedir})/lib/pacman/
522 cache dir : $(eval echo ${localstatedir})/cache/pacman/pkg/
525 preprocessor flags : ${CPPFLAGS}
526 compiler flags : ${WARNING_CFLAGS} ${CFLAGS}
527 library flags : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} ${GPGME_LIBS}
528 linker flags : ${LDFLAGS}
530 Architecture : ${CARCH}
532 File inode command : ${INODECMD}
533 Filesize command : ${SIZECMD}
534 In-place sed command : ${SEDINPLACE}
536 libalpm version : ${LIB_VERSION}
537 libalpm version info : ${LIB_VERSION_INFO}
538 pacman version : ${PACKAGE_VERSION}
539 using git version : ${usegitver}
541 Directory and file information:
542 root working directory : ${ROOTDIR}
543 package extension : ${PKGEXT}
544 source pkg extension : ${SRCEXT}
545 build script name : ${BUILDSCRIPT}
546 template directory : ${TEMPLATE_DIR}
549 Use libcurl : ${have_libcurl}
550 Use GPGME : ${have_gpgme}
551 Use OpenSSL : ${have_openssl}
552 Run make in doc/ dir : ${wantdoc} ${asciidoc}
553 Doxygen support : ${usedoxygen}
554 debug support : ${debug}
555 extra warning flags : ${warningflags}
556 use git version : ${wantgitver}
559 # vim:set ts=2 sw=2 noet: