repo-remove: remove deltas file if it becomes empty
[pacman-ng.git] / configure.ac
blob18726cfb123bb78b64ef057d8e5c602feae913f7
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3 # Minimum version of autoconf required
4 AC_PREREQ(2.62)
6 # UPDATING VERSION NUMBERS FOR RELEASES
8 # libalpm:
9 # current
10 #   The most recent interface number that this library implements.
11 # revision
12 #   The implementation number of the current interface.
13 # age
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
27 #    increment age.
28 # 6. If any interfaces have been removed since the last public release, then
29 #    set age to 0.
31 # pacman:
32 #   Extreme huge major changes:
33 #     pacman_version_major += 1
34 #     pacman_version_minor = 0
35 #     pacman_version_micro = 0
37 #   Real releases:
38 #     pacman_version_minor += 1
39 #     pacman_version_micro = 0
41 #   Bugfix releases:
42 #     pacman_version_micro += 1
44 m4_define([lib_current], [7])
45 m4_define([lib_revision], [3])
46 m4_define([lib_age], [0])
48 m4_define([pacman_version_major], [4])
49 m4_define([pacman_version_minor], [0])
50 m4_define([pacman_version_micro], [3])
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])
59 AC_CANONICAL_HOST
60 AM_INIT_AUTOMAKE([1.11])
61 AM_SILENT_RULES([yes])
63 LIB_VERSION=`expr lib_current - lib_age`.lib_age.lib_revision
64 LIB_VERSION_INFO="lib_current:lib_revision:lib_age"
66 # Set subsitution values for version stuff in Makefiles and anywhere else,
67 # and put LIB_VERSION in config.h
68 AC_SUBST(LIB_VERSION)
69 AC_SUBST(LIB_VERSION_INFO)
70 AC_DEFINE_UNQUOTED([LIB_VERSION], ["$LIB_VERSION"], [libalpm version number])
72 # Help line for root directory
73 AC_ARG_WITH(root-dir,
74         AS_HELP_STRING([--with-root-dir=path], [set the location of the root operating directory]),
75         [ROOTDIR=$withval], [ROOTDIR=/])
77 # Help line for package extension
78 AC_ARG_WITH(pkg-ext,
79         AS_HELP_STRING([--with-pkg-ext=ext], [set the file extension used by packages]),
80         [PKGEXT=$withval], [PKGEXT=.pkg.tar.gz])
82 # Help line for source package directory
83 AC_ARG_WITH(src-ext,
84         AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]),
85         [SRCEXT=$withval], [SRCEXT=.src.tar.gz])
87 # Help line for buildscript filename
88 AC_ARG_WITH(buildscript,
89         AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
90         [BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
92 # Help line for changing shell used to run install scriptlets
93 AC_ARG_WITH(scriptlet-shell,
94         AS_HELP_STRING([--with-scriptlet-shell=shell],
95                 [set the full path to the shell used to run install scriptlets]),
96         [SCRIPTLET_SHELL=$withval], [SCRIPTLET_SHELL=/bin/sh])
98 # Help line for using OpenSSL
99 AC_ARG_WITH(openssl,
100         AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
101         [], [with_openssl=check])
103 # Help line for using gpgme
104 AC_ARG_WITH(gpgme,
105         AS_HELP_STRING([--with-gpgme], [use GPGME for PGP signature verification]),
106         [], [with_gpgme=check])
108 # Check for useable libcurl
109 LIBCURL_CHECK_CONFIG([yes], [7.19.4], [with_libcurl=yes], [with_libcurl=no])
111 # Help line for documentation
112 AC_ARG_ENABLE(doc,
113         AS_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
114         [wantdoc=$enableval], [wantdoc=yes])
116 # Help line for doxygen
117 AC_ARG_ENABLE(doxygen,
118         AS_HELP_STRING([--enable-doxygen], [build your own API docs via Doxygen]),
119         [wantdoxygen=$enableval], [wantdoxygen=no])
121 # Help line for debug
122 AC_ARG_ENABLE(debug,
123         AS_HELP_STRING([--enable-debug], [enable debugging support]),
124         [debug=$enableval], [debug=no])
126 # Help line for using git version in pacman version string
127 AC_ARG_ENABLE(git-version,
128         AS_HELP_STRING([--enable-git-version],
129                 [enable use of git version in version string if available]),
130         [wantgitver=$enableval], [wantgitver=no])
132 # Enable large file support if available (must be enabled before
133 # testing compilation against gpgme).
134 AC_SYS_LARGEFILE
136 # Checks for programs.
137 AC_PROG_AWK
138 AC_PROG_CC_C99
139 AC_PROG_CXX
140 AC_PROG_INSTALL
141 AC_PROG_LN_S
142 AC_PROG_MAKE_SET
143 AC_PROG_LIBTOOL
144 AC_PROG_RANLIB
145 AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false])
146 AC_PATH_PROGS([BASH_SHELL], [bash bash4 bash3], [false])
148 # find installed gettext
149 AM_GNU_GETTEXT([external], [need-ngettext])
150 AM_GNU_GETTEXT_VERSION(0.13.1)
152 AC_CHECK_LIB([m], [fabs], ,
153         AC_MSG_ERROR([libm is needed to compile pacman!]))
155 # Check for libarchive
156 AC_CHECK_LIB([archive], [archive_read_data], ,
157         AC_MSG_ERROR([libarchive is needed to compile pacman!]))
159 # Check for OpenSSL
160 AC_MSG_CHECKING(whether to link with libssl)
161 AS_IF([test "x$with_openssl" != "xno"],
162         [AC_MSG_RESULT(yes)
163         AC_CHECK_LIB([ssl], [MD5_Final], ,
164         [if test "x$with_openssl" != "xcheck"; then
165                 AC_MSG_FAILURE([--with-openssl was given, but -lssl was not found])
166         fi],
167         [-lcrypto])
168         with_openssl=$ac_cv_lib_ssl_MD5_Final],
169         AC_MSG_RESULT(no))
170 AM_CONDITIONAL([HAVE_LIBSSL], [test "x$with_openssl" = "xyes"])
172 # Check for gpgme
173 AC_MSG_CHECKING(whether to link with libgpgme)
174 AS_IF([test "x$with_gpgme" != "xno"],
175         [AC_MSG_RESULT([yes])],
176         [AC_MSG_RESULT([no])])
178 require_gpgme=no
179 AS_IF([test "x$with_gpgme" != "xno"],
180         [AS_IF([test "x$with_gpgme" = "xyes"],
181                 [require_gpgme=yes])
182         AM_PATH_GPGME([1.3.0],
183                 [LIBS_save="$LIBS"
184                 CPPFLAGS_save="$CPPFLAGS"
185                 CFLAGS_save="$CFLAGS"
187                 LIBS="$LIBS $GPGME_LIBS"
188                 CPPFLAGS="$CPPFLAGS $GPGME_CPPFLAGS"
189                 CFLAGS="$CFLAGS $GPGME_CFLAGS"
191                 AC_MSG_CHECKING([for sane gpgme])
192                 AC_LINK_IFELSE(
193                         [AC_LANG_PROGRAM(
194                                 [[#include <gpgme.h>]],
195                                 [[const char *ver;
196 ver = gpgme_check_version("1.2.4");]])],
197                         [AC_MSG_RESULT([yes])
198                         with_gpgme=yes
199                         AC_DEFINE([HAVE_LIBGPGME], [1], [Define if gpgme should be used to provide GPG signature support.])],
200                         [AC_MSG_RESULT([no])
201                         with_gpgme=no
202                         LIBS="$LIBS_save"
203                         CPPFLAGS="$CPPFLAGS_save"
204                         CFLAGS="$CFLAGS_save"])],
205                 [with_gpgme=no])])
206 AS_IF([test "x$with_gpgme" != "xyes"],
207         [AS_IF([test "x$require_gpgme" = "xyes"],
208                 [AC_MSG_FAILURE([--with-gpgme was given, but gpgme was not found])])
209         with_gpgme=no])
211 AM_CONDITIONAL([HAVE_LIBGPGME], [test "x$with_gpgme" = "xyes"])
213 # Checks for header files.
214 AC_CHECK_HEADERS([fcntl.h float.h glob.h libintl.h limits.h locale.h \
215                   mntent.h netinet/in.h netinet/tcp.h \
216                   stddef.h string.h sys/ioctl.h \
217                   sys/mnttab.h sys/mount.h \
218                   sys/param.h sys/statvfs.h sys/time.h sys/types.h \
219                   sys/ucred.h syslog.h termios.h wchar.h])
221 # Checks for typedefs, structures, and compiler characteristics.
222 AC_C_INLINE
223 AC_TYPE_INT64_T
224 AC_TYPE_MODE_T
225 AC_TYPE_OFF_T
226 AC_TYPE_PID_T
227 AC_TYPE_SIZE_T
228 AC_TYPE_SSIZE_T
229 AC_STRUCT_TM
230 AC_TYPE_UID_T
231 AC_STRUCT_DIRENT_D_TYPE
232 PATH_MAX_DEFINED
234 # Checks for library functions.
235 AC_FUNC_FORK
236 AC_FUNC_GETMNTENT
237 AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
238 AC_FUNC_MALLOC
239 AC_FUNC_MKTIME
240 AC_FUNC_STRCOLL
241 AC_CHECK_FUNCS([dup2 getcwd geteuid getmntinfo gettimeofday memmove memset \
242                 mkdir realpath regcomp rmdir setenv setlocale strcasecmp \
243                 strchr strcspn strdup strerror strndup strrchr strsep strstr \
244                 strtol swprintf tcflush wcwidth uname])
245 AC_CHECK_MEMBERS([struct stat.st_blksize],,,[[#include <sys/stat.h>]])
247 # For the diskspace code
248 FS_STATS_TYPE
249 AC_CHECK_MEMBERS([struct statvfs.f_flag],,,[[#include <sys/statvfs.h>]])
250 AC_CHECK_MEMBERS([struct statfs.f_flags],,,[[#include <sys/param.h>
251                   #include <sys/mount.h>]])
253 # Check if we can use symbol visibility support in GCC
254 GCC_VISIBILITY_CC
255 # Check if we have -fgnu89-inline flag
256 GCC_GNU89_INLINE_CC
258 # Host-dependant definitions
259 SIZECMD="stat -c %s"
260 SEDINPLACE="sed -i"
261 STRIP_BINARIES="--strip-all"
262 STRIP_SHARED="--strip-unneeded"
263 STRIP_STATIC="--strip-debug"
264 case "${host_os}" in
265         *bsd*)
266                 SIZECMD="stat -f %z"
267                 SEDINPLACE="sed -i \"\""
268                 ;;
269         cygwin*)
270                 host_os_cygwin=yes
271                 CFLAGS="$CFLAGS -DCYGWIN"
272                 ;;
273         darwin*)
274                 host_os_darwin=yes
275                 SIZECMD="/usr/bin/stat -f %z"
276                 SEDINPLACE="/usr/bin/sed -i ''"
277                 STRIP_BINARIES=""
278                 STRIP_SHARED="-S"
279                 STRIP_STATIC="-S"
280                 ;;
281 esac
283 AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
284 AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
285 AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
286 AC_SUBST(SIZECMD)
287 AC_SUBST(SEDINPLACE)
288 AC_SUBST(STRIP_BINARIES)
289 AC_SUBST(STRIP_SHARED)
290 AC_SUBST(STRIP_STATIC)
292 # Variables plugged into makepkg.conf
293 CARCH="${host%%-*}"
294 CHOST="${host}"
295 AC_SUBST(CARCH)
296 AC_SUBST(CHOST)
298 # Check for documentation support and status
299 AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
300 AC_MSG_CHECKING([for building documentation])
301 if test "x$wantdoc" = "xyes" ; then
302         if test $ASCIIDOC ; then
303                 AC_MSG_RESULT([yes, enabled by configure])
304         else
305                 asciidoc="(warning : asciidoc not installed)"
306                 AC_MSG_RESULT([yes $asciidoc])
307         fi
308         wantdoc=yes
309 else
310         AC_MSG_RESULT([no, disabled by configure])
311         wantdoc=no
313 AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")
315 # Check for doxygen support and status
316 AC_CHECK_PROGS([DOXYGEN], [doxygen])
317 AC_MSG_CHECKING([for doxygen])
318 if test "x$wantdoxygen" = "xyes" ; then
319         if test $DOXYGEN ; then
320                 AC_MSG_RESULT([yes])
321                 usedoxygen=yes
322         else
323                 AC_MSG_RESULT([no, doxygen missing])
324                 usedoxygen=no
325         fi
326 else
327         AC_MSG_RESULT([no, disabled by configure])
328         usedoxygen=no
330 AM_CONDITIONAL(USE_DOXYGEN, test "x$usedoxygen" = "xyes")
332 # Enable or disable debug code
333 AC_MSG_CHECKING(for debug mode request)
334 if test "x$debug" = "xyes" ; then
335         AC_MSG_RESULT(yes)
336         AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
337         # Check for -fstack-protector availability
338         GCC_STACK_PROTECT_LIB
339         GCC_STACK_PROTECT_CC
340         GCC_FORTIFY_SOURCE_CC
341         CFLAGS="$CFLAGS -g -Wall -Werror"
342 else
343         AC_MSG_RESULT(no)
344         CFLAGS="$CFLAGS -Wall"
347 # Enable or disable use of git version in pacman version string
348 AC_MSG_CHECKING(whether to use git version if available)
349 if test "x$wantgitver" = "xyes" ; then
350         AC_CHECK_PROGS([GIT], [git])
351         AC_CHECK_FILE([.git/], hasgitdir=yes)
352         if test $GIT -a "x$hasgitdir" = "xyes"; then
353                 AC_MSG_RESULT([yes])
354                 usegitver=yes
355                 AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
356         else
357                 AC_MSG_RESULT([no, git or .git dir missing])
358                 usegitver=no
359         fi
360 else
361         AC_MSG_RESULT([no, disabled by configure])
362         usegitver=no
364 AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")
366 # Set root directory
367 AC_SUBST(ROOTDIR)
368 AC_DEFINE_UNQUOTED([ROOTDIR], "$ROOTDIR", [The location of the root operating directory])
369 # Set package file extension
370 AC_SUBST(PKGEXT)
371 AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
372 # Set source package file extension
373 AC_SUBST(SRCEXT)
374 AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages])
375 # Set makepkg build script name
376 AC_SUBST(BUILDSCRIPT)
377 AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
378 # Set shell used by install scriptlets
379 AC_SUBST(SCRIPTLET_SHELL)
380 AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the shell used to run install scriptlets])
382 # Configuration files
383 AC_CONFIG_FILES([
384 lib/libalpm/Makefile
385 lib/libalpm/po/Makefile.in
386 src/pacman/Makefile
387 src/pacman/po/Makefile.in
388 src/util/Makefile
389 scripts/Makefile
390 scripts/po/Makefile.in
391 doc/Makefile
392 etc/Makefile
393 test/pacman/Makefile
394 test/pacman/tests/Makefile
395 test/util/Makefile
396 contrib/Makefile
397 Makefile
399 AC_OUTPUT
401 echo "
402 ${PACKAGE_NAME}:
404   Build information:
405     source code location   : ${srcdir}
406     prefix                 : ${prefix}
407     sysconfdir             : $(eval echo ${sysconfdir})
408        conf file           : $(eval echo ${sysconfdir})/pacman.conf
409     localstatedir          : $(eval echo ${localstatedir})
410        database dir        : $(eval echo ${localstatedir})/lib/pacman/
411        cache dir           : $(eval echo ${localstatedir})/cache/pacman/pkg/
413     compiler               : ${CC}
414     preprocessor flags     : ${CPPFLAGS}
415     compiler flags         : ${CFLAGS}
416     defines                : ${DEFS}
417     library flags          : ${LIBS}
418     linker flags           : ${LDFLAGS}
420     Architecture           : ${CARCH}
421     Host Type              : ${CHOST}
422     Filesize command       : ${SIZECMD}
423     In-place sed command   : ${SEDINPLACE}
425     libalpm version        : ${LIB_VERSION}
426     libalpm version info   : ${LIB_VERSION_INFO}
427     pacman version         : ${PACKAGE_VERSION}
428     using git version      : ${usegitver}
430   Directory and file information:
431     root working directory : ${ROOTDIR}
432     package extension      : ${PKGEXT}
433     source pkg extension   : ${SRCEXT}
434     build script name      : ${BUILDSCRIPT}
436   Compilation options:
437     Use libcurl            : ${with_libcurl}
438     Use GPGME              : ${with_gpgme}
439     Use OpenSSL            : ${with_openssl}
440     Run make in doc/ dir   : ${wantdoc} ${asciidoc}
441     Doxygen support        : ${usedoxygen}
442     debug support          : ${debug}
445 # vim:set ts=2 sw=2 noet: