configure.ac 20.1 KB
Newer Older
Dan McGee's avatar
Dan McGee committed
1
2
3
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Minimum version of autoconf required
4
AC_PREREQ(2.64)
Dan McGee's avatar
Dan McGee committed
5

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# UPDATING VERSION NUMBERS FOR RELEASES
#
# libalpm:
# current
#   The most recent interface number that this library implements.
# revision
#   The implementation number of the current interface.
# age
#   The difference between the newest and oldest interfaces that this library
#   implements. In other words, the library implements all the interface
#   numbers in the range from number current - age to current.
#
# 1. Start with version information of `0:0:0' for each libtool library.
# 2. Update the version information only immediately before a public release of
#    your software. More frequent updates are unnecessary, and only guarantee
#    that the current interface number gets larger faster.
# 3. If the library source code has changed at all since the last update, then
#    increment revision (`c:r:a' becomes `c:r+1:a').
# 4. If any interfaces have been added, removed, or changed since the last
#    update, increment current, and set revision to 0.
# 5. If any interfaces have been added since the last public release, then
#    increment age.
# 6. If any interfaces have been removed since the last public release, then
#    set age to 0.
#
# pacman:
#   Extreme huge major changes:
#     pacman_version_major += 1
#     pacman_version_minor = 0
#     pacman_version_micro = 0
#
#   Real releases:
#     pacman_version_minor += 1
#     pacman_version_micro = 0
#
#   Bugfix releases:
#     pacman_version_micro += 1

Allan McRae's avatar
Allan McRae committed
44
m4_define([lib_current], [12])
Andrew Gregory's avatar
Andrew Gregory committed
45
m4_define([lib_revision], [2])
Dan McGee's avatar
Dan McGee committed
46
m4_define([lib_age], [0])
47

Allan McRae's avatar
Allan McRae committed
48
m4_define([pacman_version_major], [5])
Allan McRae's avatar
Allan McRae committed
49
m4_define([pacman_version_minor], [2])
Andrew Gregory's avatar
Andrew Gregory committed
50
m4_define([pacman_version_micro], [2])
51
52
53
m4_define([pacman_version],
          [pacman_version_major.pacman_version_minor.pacman_version_micro])

Dan McGee's avatar
Dan McGee committed
54
# Autoconf initialization
55
AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org])
Dan McGee's avatar
Dan McGee committed
56
57
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
58
AC_CONFIG_MACRO_DIR([m4])
59
AC_CONFIG_AUX_DIR([build-aux])
Andrew Gregory's avatar
Andrew Gregory committed
60
AC_REQUIRE_AUX_FILE([tap-driver.sh])
Dan McGee's avatar
Dan McGee committed
61

62
AC_CANONICAL_HOST
Allan McRae's avatar
Allan McRae committed
63
AM_INIT_AUTOMAKE([1.11 foreign])
64
AM_SILENT_RULES([yes])
65

66
LT_INIT
Dan McGee's avatar
Dan McGee committed
67
LIB_VERSION=`expr lib_current - lib_age`.lib_age.lib_revision
68
LIB_VERSION_INFO="lib_current:lib_revision:lib_age"
69

70
# Respect empty CFLAGS during compiler tests
71
if test "x$CFLAGS" = "x"; then
72
73
74
  CFLAGS=""
fi

Morgan Adamiec's avatar
Morgan Adamiec committed
75
# Set substitution values for version stuff in Makefiles and anywhere else,
Dan McGee's avatar
Dan McGee committed
76
# and put LIB_VERSION in config.h
77
78
79
AC_SUBST(LIB_VERSION)
AC_SUBST(LIB_VERSION_INFO)
AC_DEFINE_UNQUOTED([LIB_VERSION], ["$LIB_VERSION"], [libalpm version number])
80

Dan McGee's avatar
Dan McGee committed
81
# Help line for root directory
82
AC_ARG_WITH(root-dir,
83
	AS_HELP_STRING([--with-root-dir=path], [set the location of the root operating directory]),
Andrew Fyfe's avatar
Andrew Fyfe committed
84
	[ROOTDIR=$withval], [ROOTDIR=/])
85

Dan McGee's avatar
Dan McGee committed
86
# Help line for package extension
87
AC_ARG_WITH(pkg-ext,
88
	AS_HELP_STRING([--with-pkg-ext=ext], [set the file extension used by packages]),
Andrew Fyfe's avatar
Andrew Fyfe committed
89
	[PKGEXT=$withval], [PKGEXT=.pkg.tar.gz])
90

91
92
# Help line for source package directory
AC_ARG_WITH(src-ext,
93
	AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]),
Andrew Fyfe's avatar
Andrew Fyfe committed
94
	[SRCEXT=$withval], [SRCEXT=.src.tar.gz])
95

96
97
98
99
100
# Help line for buildscript filename
AC_ARG_WITH(buildscript,
	AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
	[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])

Florian Pritz's avatar
Florian Pritz committed
101
102
103
# Help line for buildscript filename
AC_ARG_WITH(makepkg-template-dir,
	AS_HELP_STRING([--with-makepkg-template-dir=name], [set the template dir used by makepkg-template]),
104
	[TEMPLATE_DIR=$withval], [TEMPLATE_DIR=${datarootdir}/makepkg-template])
Florian Pritz's avatar
Florian Pritz committed
105

106
107
108
109
110
# Help line for debug package suffix
AC_ARG_WITH(debug-suffix,
	AS_HELP_STRING([--with-debug-suffix=name], [set the suffix for split debugging symbol packages used by makepkg]),
	[DEBUGSUFFIX=$withval], [DEBUGSUFFIX=debug])

111
112
113
# Help line for changing shell used to run install scriptlets
AC_ARG_WITH(scriptlet-shell,
	AS_HELP_STRING([--with-scriptlet-shell=shell],
114
115
		[set the full path to the shell used to run install scriptlets]),
	[SCRIPTLET_SHELL=$withval], [SCRIPTLET_SHELL=/bin/sh])
116

117
118
119
120
121
122
# Help line for ldconfig path
AC_ARG_WITH(ldconfig,
	AS_HELP_STRING([--with-ldconfig=path],
		[set the full path to ldconfig]),
	[LDCONFIG=$withval], [LDCONFIG=/sbin/ldconfig])

123
124
125
126
127
128
# Help line for determining whether file is seccomp-enabled
AC_ARG_WITH(file-seccomp,
	AS_HELP_STRING([--with-file-seccomp={yes|no|auto}],
		[determine whether file is seccomp-enabled @<:@default=auto@:>@]),
	[with_file_seccomp=$withval], [with_file_seccomp=auto])

129
130
131
132
133
# Help line for selecting a crypto library
AC_ARG_WITH(crypto,
	AS_HELP_STRING([--with-crypto={openssl|nettle}],
		[select crypto implementation @<:@default=openssl@:>@]),
	[with_crypto=$withval], [with_crypto=openssl])
134

135
136
137
138
139
# Help line for using gpgme
AC_ARG_WITH(gpgme,
	AS_HELP_STRING([--with-gpgme], [use GPGME for PGP signature verification]),
	[], [with_gpgme=check])

140
# Help line for using libcurl
141
AC_ARG_WITH(libcurl,
142
	AS_HELP_STRING([--with-libcurl], [use libcurl for the internal downloader]),
143
	[], [with_libcurl=check])
144

145
146
# Help line for documentation
AC_ARG_ENABLE(doc,
147
148
	AS_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
	[wantdoc=$enableval], [wantdoc=yes])
149

Dan McGee's avatar
Dan McGee committed
150
# Help line for doxygen
151
AC_ARG_ENABLE(doxygen,
152
	AS_HELP_STRING([--enable-doxygen], [build your own API docs via Doxygen]),
153
	[wantdoxygen=$enableval], [wantdoxygen=no])
154

Dan McGee's avatar
Dan McGee committed
155
# Help line for debug
156
AC_ARG_ENABLE(debug,
157
	AS_HELP_STRING([--enable-debug], [enable debugging support]),
Andrew Fyfe's avatar
Andrew Fyfe committed
158
	[debug=$enableval], [debug=no])
159

160
161
162
163
164
# Help line for compiler warning flags
AC_ARG_ENABLE(warningflags,
	AS_HELP_STRING([--enable-warningflags], [enable extra compiler warning flags]),
	[warningflags=$enableval], [warningflags=no])

165
166
167
168
169
170
# 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])

171
172
173
174
# Enable large file support if available (must be enabled before
# testing compilation against gpgme).
AC_SYS_LARGEFILE

175
176
177
178
179
180
181
182
183
# Record large file flags in pkgconfig file
if test "$enable_largefile" != no; then
	if test "$ac_cv_sys_file_offset_bits" != 'no'; then
		LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
	fi
fi
AC_SUBST(LFS_CFLAGS)


Dan McGee's avatar
Dan McGee committed
184
185
# Checks for programs.
AC_PROG_AWK
Dan McGee's avatar
Dan McGee committed
186
AC_PROG_CC_C99
Dan McGee's avatar
Dan McGee committed
187
AC_PROG_INSTALL
Dave Reisner's avatar
Dave Reisner committed
188
AC_CHECK_PROGS([PYTHON], [python3 python], [false])
189
190
AC_PATH_PROGS([BASH_SHELL], [bash bash4], [false])

Florian Pritz's avatar
Florian Pritz committed
191
192
193
194
195
196
197
198
199
200
# check for perl 5.10.1 (needed by makepkg-template)
AC_PATH_PROG([PERL],[perl])
AC_DEFUN([AX_PROG_PERL_VERSION],
	[AC_CACHE_CHECK([for Perl version $1 or later], [ax_cv_prog_perl_version],
		[AS_IF(["$PERL" -e 'require v$1;' >/dev/null 2>&1],
			[ax_cv_prog_perl_version=yes],
			[ax_cv_prog_perl_version=no])])
	AS_IF([test x"$ax_cv_prog_perl_version" = xyes], [$2], [$3])])
AX_PROG_PERL_VERSION([5.10.1], [], [AC_MSG_ERROR([perl is too old])])

201
AS_IF([test "x$BASH_SHELL" = "xfalse"],
202
	AC_MSG_WARN([*** bash >= 4.4.0 is required for pacman scripts]),
203
204
205
206
207
208
	[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
209
	if test "$bash_version_major" -eq 4 && test "$bash_version_minor" -lt 4; then
210
211
212
		ok=no
	fi
	if test "$ok" = "no"; then
213
		AC_MSG_ERROR([*** bash >= 4.4.0 is required for pacman scripts])
214
215
	fi
	unset bash_version_major bash_version_minor ok])
Dan McGee's avatar
Dan McGee committed
216
217

# find installed gettext
218
AM_GNU_GETTEXT([external], [need-ngettext])
Dan McGee's avatar
Dan McGee committed
219
220
AM_GNU_GETTEXT_VERSION(0.13.1)

221
222
223
AC_CHECK_LIB([m], [fabs], ,
	AC_MSG_ERROR([libm is needed to compile pacman!]))

224
PKG_CHECK_VAR(bashcompdir, [bash-completion], [completionsdir], ,
225
	bashcompdir="${datarootdir}/bash-completion/completions")
226

Dan McGee's avatar
Dan McGee committed
227
# Check for libarchive
228
229
PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 3.0.0], ,
	AC_MSG_ERROR([*** libarchive >= 3.0.0 is needed to compile pacman!]))
Dan McGee's avatar
Dan McGee committed
230

231
m4_pattern_forbid([^AX_COMPARE_VERSION$])
232
233
234
235
236
237
238
239
240
241
242
243
# Check file for seccomp
if test "x$with_file_seccomp" = "xauto"; then
	file_version="$(file --version| sed -n 's/^file-\(.*\)/\1/p')"
	AX_COMPARE_VERSION([$file_version], [ge], [5.38], [with_file_seccomp=yes])
fi
if test "x$with_file_seccomp" = "xyes"; then
	FILECMD="file -S"
else
	FILECMD="file"
fi
AC_SUBST(FILECMD)

244
# Check for OpenSSL
245
have_openssl=no
246
have_nettle=no
247
if test "x$with_crypto" = "xnettle"; then
248
	AC_SUBST(pc_crypto, [nettle])
249
250
251
252
253
	PKG_CHECK_MODULES(NETTLE, [nettle],
		[AC_DEFINE(HAVE_LIBNETTLE, 1, [Define whether to use nettle]) have_nettle=yes], have_nettle=no)
	if test "x$have_nettle" = xno -a "x$with_crypto" = xnettle; then
		AC_MSG_ERROR([*** nettle support requested but libraries not found])
	fi
254
else if test "x$with_crypto" = "xopenssl"; then
255
	AC_SUBST(pc_crypto, [libcrypto])
256
	PKG_CHECK_MODULES(LIBSSL, [libcrypto],
257
		[AC_DEFINE(HAVE_LIBSSL, 1, [Define if libcrypto is available]) have_openssl=yes], have_openssl=no)
258
	if test "x$have_openssl" = xno; then
259
260
		AC_MSG_ERROR([*** openssl support requested but libraries not found])
	fi
261
262
else
	AC_MSG_ERROR([*** unknown crypto support library requested - $with_crypto])
263
fi
264
fi
265
266
AM_CONDITIONAL(HAVE_LIBSSL, [test "$have_openssl" = "yes"])
AM_CONDITIONAL(HAVE_LIBNETTLE, [test "$have_nettle" = "yes"])
267

268
269
270
# Check for libcurl
have_libcurl=no
if test "x$with_libcurl" != "xno"; then
271
	PKG_CHECK_MODULES(LIBCURL, [libcurl >= 7.32.0],
272
273
		[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
274
		AC_MSG_ERROR([*** libcurl >= 7.32.0 is required for internal downloader support])
275
276
277
	fi
fi
AM_CONDITIONAL(HAVE_LIBCURL, [test "$have_libcurl" = "yes"])
278
279
280
281
# used to generate libalpm.pc
if test "x$have_libcurl" = xyes; then
	AC_SUBST(pc_libcurl, [libcurl])
fi
282

Dan McGee's avatar
Dan McGee committed
283
# Check for gpgme
284
285
AC_MSG_CHECKING(whether to link with libgpgme)
AS_IF([test "x$with_gpgme" != "xno"],
286
287
288
	[AC_MSG_RESULT([yes])],
	[AC_MSG_RESULT([no])])

289
have_gpgme=no
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
if test "x$with_gpgme" != "xno"; then
	PKG_CHECK_MODULES(GPGME, [gpgme],
		[AC_DEFINE([HAVE_LIBGPGME], [1], [Define if gpgme should be used to provide GPG signature support.])
		AC_SUBST(pc_gpgme, [gpgme])
		have_gpgme=yes],
		[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_SUBST(pc_gpgme_libs, ["$GPGME_LIBS"])],
				[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])])
				)

			LIBS="$LIBS_save"
			CPPFLAGS="$CPPFLAGS_save"
			CFLAGS="$CFLAGS_save"
			unset CPPFLAGS_save
			unset CFLAGS_save],)])
fi
Allan McRae's avatar
Allan McRae committed
327

328
329
330
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"])
Dan McGee's avatar
Dan McGee committed
331

Dan McGee's avatar
Dan McGee committed
332
# Checks for header files.
333
334
AC_CHECK_HEADERS([fcntl.h float.h glob.h langinfo.h libintl.h limits.h \
                  locale.h mntent.h netinet/in.h netinet/tcp.h \
335
                  stddef.h string.h sys/ioctl.h \
336
                  sys/mnttab.h sys/mount.h \
337
338
                  sys/param.h sys/statvfs.h sys/time.h sys/types.h \
                  sys/ucred.h syslog.h termios.h wchar.h])
Dan McGee's avatar
Dan McGee committed
339
340
341

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
342
AC_TYPE_INT64_T
Dan McGee's avatar
Dan McGee committed
343
344
345
346
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
347
AC_TYPE_SSIZE_T
Dan McGee's avatar
Dan McGee committed
348
349
AC_STRUCT_TM
AC_TYPE_UID_T
Dan McGee's avatar
Dan McGee committed
350
AC_STRUCT_DIRENT_D_TYPE
Allan McRae's avatar
Allan McRae committed
351
PATH_MAX_DEFINED
Dan McGee's avatar
Dan McGee committed
352
353
354

# Checks for library functions.
AC_FUNC_FORK
355
AC_FUNC_GETMNTENT
Dan McGee's avatar
Dan McGee committed
356
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
Allan McRae's avatar
Allan McRae committed
357
AC_CHECK_FUNCS([dup2 getcwd getmntinfo gettimeofday memmove memset \
358
                mkdir realpath regcomp rmdir setenv setlocale strcasecmp \
359
360
                strchr strcspn strdup strerror strndup strnlen strrchr \
                strsep strstr strtol swprintf tcflush wcwidth uname])
361
AC_CHECK_MEMBERS([struct stat.st_blksize],,,[[#include <sys/stat.h>]])
362

Dan McGee's avatar
Dan McGee committed
363
364
# For the diskspace code
FS_STATS_TYPE
365
366
367
368
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>]])

369
370
371
# Check if we can use symbol visibility support in GCC
GCC_VISIBILITY_CC

372
# Host-dependant definitions
373
DEFAULT_SEDINPLACEFLAGS=" --follow-symlinks -i"
374
INODECMD="stat -c '%i %n'"
375
376
377
STRIP_BINARIES="--strip-all"
STRIP_SHARED="--strip-unneeded"
STRIP_STATIC="--strip-debug"
378
case "${host_os}" in
379
	*bsd*)
380
		INODECMD="stat -f '%i %N'"
381
		DEFAULT_SEDINPLACEFLAGS=" -i \"\""
382
		;;
383
384
	darwin*)
		host_os_darwin=yes
385
		INODECMD="/usr/bin/stat -f '%i %N'"
386
		DEFAULT_SEDINPLACEFLAGS=" -i ''"
387
388
389
		STRIP_BINARIES=""
		STRIP_SHARED="-S"
		STRIP_STATIC="-S"
390
		;;
391
esac
392
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
393
AC_PATH_PROGS([SEDPATH], [sed], [sed], [/usr/bin$PATH_SEPARATOR/bin] )
394
AC_SUBST(INODECMD)
395
396
397
AC_SUBST(STRIP_BINARIES)
AC_SUBST(STRIP_SHARED)
AC_SUBST(STRIP_STATIC)
398

399
400
401
402
403
404
# Flags for sed in place
if test "${SEDINPLACEFLAGS+set}" != "set"; then
    SEDINPLACEFLAGS="${DEFAULT_SEDINPLACEFLAGS}"
fi
AC_ARG_VAR(SEDINPLACEFLAGS, [flags for sed, overriding the default])

405
406
# Variables plugged into makepkg.conf
CARCH="${host%%-*}"
407
CHOST="${host}"
408
409
AC_SUBST(CARCH)
AC_SUBST(CHOST)
410

411
# Check for documentation support and status
412
AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
413
414
AC_MSG_CHECKING([for building documentation])
if test "x$wantdoc" = "xyes" ; then
415
416
417
418
419
420
	if test $ASCIIDOC ; then
		AC_MSG_RESULT([yes, enabled by configure])
	else
		asciidoc="(warning : asciidoc not installed)"
		AC_MSG_RESULT([yes $asciidoc])
	fi
421
422
	wantdoc=yes
else
423
	AC_MSG_RESULT([no, disabled by configure])
424
425
426
427
	wantdoc=no
fi
AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")

428
# Check for doxygen support and status
429
AC_CHECK_PROGS([DOXYGEN], [doxygen])
Dan McGee's avatar
Dan McGee committed
430
AC_MSG_CHECKING([for doxygen])
431
if test "x$wantdoxygen" = "xyes" ; then
Andrew Fyfe's avatar
Andrew Fyfe committed
432
	if test $DOXYGEN ; then
Dan McGee's avatar
Dan McGee committed
433
		AC_MSG_RESULT([yes])
434
		usedoxygen=yes
Andrew Fyfe's avatar
Andrew Fyfe committed
435
	else
Dan McGee's avatar
Dan McGee committed
436
		AC_MSG_RESULT([no, doxygen missing])
437
		usedoxygen=no
Andrew Fyfe's avatar
Andrew Fyfe committed
438
	fi
439
else
Andrew Fyfe's avatar
Andrew Fyfe committed
440
	AC_MSG_RESULT([no, disabled by configure])
441
	usedoxygen=no
442
fi
443
444
AM_CONDITIONAL(USE_DOXYGEN, test "x$usedoxygen" = "xyes")

Dan McGee's avatar
Dan McGee committed
445
# Enable or disable debug code
446
AC_MSG_CHECKING(for debug mode request)
447
if test "x$debug" = "xyes" ; then
Dan McGee's avatar
Dan McGee committed
448
	AC_MSG_RESULT(yes)
449
	AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
450
451
452
	# Check for -fstack-protector availability
	GCC_STACK_PROTECT_LIB
	GCC_STACK_PROTECT_CC
453
	GCC_STACK_CLASH_PROTECTION
Allan McRae's avatar
Allan McRae committed
454
	GCC_FORTIFY_SOURCE_CC
455
	WARNING_CFLAGS="-g -Wall -Werror"
456
else
Andrew Fyfe's avatar
Andrew Fyfe committed
457
	AC_MSG_RESULT(no)
458
	WARNING_CFLAGS="-Wall"
459
460
fi

461
462
463
464
465
466
467
468
469
470
471
# 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])
472
	CFLAGS_ADD([-Wimplicit-fallthrough], [WARNING_CFLAGS])
473
474
475
	CFLAGS_ADD([-Winit-self], [WARNING_CFLAGS])
	CFLAGS_ADD([-Wlogical-op], [WARNING_CFLAGS])
	CFLAGS_ADD([-Wmissing-declarations], [WARNING_CFLAGS])
Allan McRae's avatar
Allan McRae committed
476
	CFLAGS_ADD([-Wmissing-field-initializers], [WARNING_CFLAGS])
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
	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

497
498
499
# 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
500
501
	AC_CHECK_PROGS([GIT], [git])
	AC_CHECK_FILE([.git/], hasgitdir=yes)
502
	usegitver=$ac_cv_file__git_
503
504
505
506
507
508
509
510
511
	if test $GIT -a "x$hasgitdir" = "xyes"; then
		AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
	fi
else
	AC_MSG_RESULT([no, disabled by configure])
	usegitver=no
fi
AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")

Dan McGee's avatar
Dan McGee committed
512
# Set root directory
Andrew Fyfe's avatar
Andrew Fyfe committed
513
AC_SUBST(ROOTDIR)
514
AC_DEFINE_UNQUOTED([ROOTDIR], "$ROOTDIR", [The location of the root operating directory])
Dan McGee's avatar
Dan McGee committed
515
# Set package file extension
Andrew Fyfe's avatar
Andrew Fyfe committed
516
AC_SUBST(PKGEXT)
517
AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
518
519
520
# Set source package file extension
AC_SUBST(SRCEXT)
AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages])
521
522
523
# Set makepkg build script name
AC_SUBST(BUILDSCRIPT)
AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
Florian Pritz's avatar
Florian Pritz committed
524
525
526
# Set makepkg-template template directory
AC_SUBST(TEMPLATE_DIR)
AC_DEFINE_UNQUOTED([TEMPLATE_DIR], "$TEMPLATE_DIR", [The template directory used by makepkg-teplate])
527
528
529
# Set makepkg split debugging symbol package suffix
AC_SUBST(DEBUGSUFFIX)
AC_DEFINE_UNQUOTED([DEBUGSUFFIX], "$DEBUGSUFFIX", [The suffix for debugging symbol packages used by makepkg])
530
531
# Set shell used by install scriptlets
AC_SUBST(SCRIPTLET_SHELL)
532
AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the shell used to run install scriptlets])
533
534
535
536
# Set ldconfig path
AC_SUBST(LDCONFIG)
AC_DEFINE_UNQUOTED([LDCONFIG], "$LDCONFIG", [The full path to ldconfig])

537

Dan McGee's avatar
Dan McGee committed
538
539
# Configuration files
AC_CONFIG_FILES([
540
lib/libalpm/Makefile
Judd Vinet's avatar
Judd Vinet committed
541
lib/libalpm/po/Makefile.in
Dave Reisner's avatar
Dave Reisner committed
542
lib/libalpm/libalpm.pc
543
src/common/Makefile
544
src/pacman/Makefile
545
src/pacman/po/Makefile.in
546
547
src/util/Makefile
scripts/Makefile
548
scripts/po/Makefile.in
549
doc/Makefile
550
etc/Makefile
Allan McRae's avatar
Allan McRae committed
551
552
test/pacman/Makefile
test/pacman/tests/Makefile
553
test/scripts/Makefile
554
test/util/Makefile
555
556
Makefile
])
Dan McGee's avatar
Dan McGee committed
557
AC_OUTPUT
558
559

echo "
560
${PACKAGE_NAME}:
561

562
563
  Build information:
    source code location   : ${srcdir}
564
    prefix                 : ${prefix}
565
    sysconfdir             : $(eval echo ${sysconfdir})
566
567
568
569
       conf file           : $(eval echo ${sysconfdir})/pacman.conf
    localstatedir          : $(eval echo ${localstatedir})
       database dir        : $(eval echo ${localstatedir})/lib/pacman/
       cache dir           : $(eval echo ${localstatedir})/cache/pacman/pkg/
570

571
    compiler               : ${CC}
572
    preprocessor flags     : ${CPPFLAGS}
573
    compiler flags         : ${WARNING_CFLAGS} ${CFLAGS}
574
    library flags          : ${LIBS} ${LIBSSL_LIBS} ${NETTLE_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} ${GPGME_LIBS}
575
    linker flags           : ${LDFLAGS}
576

577
578
    Architecture           : ${CARCH}
    Host Type              : ${CHOST}
579
    File inode command     : ${INODECMD}
580
    In-place sed command   : ${SEDPATH} ${SEDINPLACEFLAGS}
581
    File seccomp command   : ${FILECMD}
582

583
    libalpm version        : ${LIB_VERSION}
Dan McGee's avatar
Dan McGee committed
584
    libalpm version info   : ${LIB_VERSION_INFO}
585
    pacman version         : ${PACKAGE_VERSION}
586
    using git version      : ${usegitver}
587

588
  Directory and file information:
589
    root working directory : ${ROOTDIR}
590
    package extension      : ${PKGEXT}
591
    source pkg extension   : ${SRCEXT}
592
    build script name      : ${BUILDSCRIPT}
Florian Pritz's avatar
Florian Pritz committed
593
    template directory     : ${TEMPLATE_DIR}
594
595

  Compilation options:
596
    Use libcurl            : ${have_libcurl}
597
    Use GPGME              : ${have_gpgme}
598
    Use OpenSSL            : ${have_openssl}
599
    Use nettle             : ${have_nettle}
600
    Run make in doc/ dir   : ${wantdoc} ${asciidoc}
601
602
    Doxygen support        : ${usedoxygen}
    debug support          : ${debug}
603
604
    extra warning flags    : ${warningflags}
    use git version        : ${wantgitver}
605
"