Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 1bded39a6a60ee1cddc7e84f02979ac8b07cda95 (plain)
1
2
3
4
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# Minimum version of autoconf required
AC_PREREQ(2.62)

# 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

m4_define([lib_current], [7])
m4_define([lib_revision], [3])
m4_define([lib_age], [0])

m4_define([pacman_version_major], [4])
m4_define([pacman_version_minor], [0])
m4_define([pacman_version_micro], [3])
m4_define([pacman_version],
          [pacman_version_major.pacman_version_minor.pacman_version_micro])

# Autoconf initialization
AC_INIT([pacman], [pacman_version], [pacman-dev@archlinux.org])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])

AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([1.11])
AM_SILENT_RULES([yes])

LIB_VERSION=`expr lib_current - lib_age`.lib_age.lib_revision
LIB_VERSION_INFO="lib_current:lib_revision:lib_age"

# Set subsitution values for version stuff in Makefiles and anywhere else,
# and put LIB_VERSION in config.h
AC_SUBST(LIB_VERSION)
AC_SUBST(LIB_VERSION_INFO)
AC_DEFINE_UNQUOTED([LIB_VERSION], ["$LIB_VERSION"], [libalpm version number])

# Help line for root directory
AC_ARG_WITH(root-dir,
	AS_HELP_STRING([--with-root-dir=path], [set the location of the root operating directory]),
	[ROOTDIR=$withval], [ROOTDIR=/])

# Help line for package extension
AC_ARG_WITH(pkg-ext,
	AS_HELP_STRING([--with-pkg-ext=ext], [set the file extension used by packages]),
	[PKGEXT=$withval], [PKGEXT=.pkg.tar.gz])

# Help line for source package directory
AC_ARG_WITH(src-ext,
	AS_HELP_STRING([--with-src-ext=ext], [set the file extension used by source packages]),
	[SRCEXT=$withval], [SRCEXT=.src.tar.gz])

# 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])

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

# Help line for using OpenSSL
AC_ARG_WITH(openssl,
	AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
	[], [with_openssl=check])

# Help line for using gpgme
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 documentation
AC_ARG_ENABLE(doc,
	AS_HELP_STRING([--disable-doc], [prevent make from looking at doc/ dir]),
	[wantdoc=$enableval], [wantdoc=yes])

# Help line for doxygen
AC_ARG_ENABLE(doxygen,
	AS_HELP_STRING([--enable-doxygen], [build your own API docs via Doxygen]),
	[wantdoxygen=$enableval], [wantdoxygen=no])

# Help line for debug
AC_ARG_ENABLE(debug,
	AS_HELP_STRING([--enable-debug], [enable debugging support]),
	[debug=$enableval], [debug=no])

# Help line for using git version in pacman version string
AC_ARG_ENABLE(git-version,
	AS_HELP_STRING([--enable-git-version],
		[enable use of git version in version string if available]),
	[wantgitver=$enableval], [wantgitver=no])

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

# Checks for programs.
AC_PROG_AWK
AC_PROG_CC_C99
AC_PROG_CXX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_PROG_RANLIB
AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false])
AC_PATH_PROGS([BASH_SHELL], [bash bash4 bash3], [false])

# find installed gettext
AM_GNU_GETTEXT([external], [need-ngettext])
AM_GNU_GETTEXT_VERSION(0.13.1)

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!]))

# 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"])

# Check for gpgme
AC_MSG_CHECKING(whether to link with libgpgme)
AS_IF([test "x$with_gpgme" != "xno"],
	[AC_MSG_RESULT([yes])],
	[AC_MSG_RESULT([no])])

require_gpgme=no
AS_IF([test "x$with_gpgme" != "xno"],
	[AS_IF([test "x$with_gpgme" = "xyes"],
		[require_gpgme=yes])
	AM_PATH_GPGME([],
		[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>]],
				[[const char *ver;
ver = gpgme_check_version("1.2.4");]])],
			[AC_MSG_RESULT([yes])
			with_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"])

# Checks for header files.
AC_CHECK_HEADERS([fcntl.h float.h glob.h libintl.h limits.h locale.h \
                  mntent.h netinet/in.h netinet/tcp.h \
                  stddef.h string.h sys/ioctl.h \
                  sys/mnttab.h sys/mount.h \
                  sys/param.h sys/statvfs.h sys/time.h sys/types.h \
                  sys/ucred.h syslog.h termios.h wchar.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_INT64_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_STRUCT_TM
AC_TYPE_UID_T
AC_STRUCT_DIRENT_D_TYPE
PATH_MAX_DEFINED

# Checks for library functions.
AC_FUNC_FORK
AC_FUNC_GETMNTENT
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_STRCOLL
AC_CHECK_FUNCS([dup2 getcwd geteuid getmntinfo gettimeofday memmove memset \
                mkdir realpath regcomp rmdir setenv setlocale strcasecmp \
                strchr strcspn strdup strerror strndup strrchr strsep strstr \
                strtol swprintf tcflush wcwidth uname])
AC_CHECK_MEMBERS([struct stat.st_blksize],,,[[#include <sys/stat.h>]])

# For the diskspace code
FS_STATS_TYPE
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>]])

# Check if we can use symbol visibility support in GCC
GCC_VISIBILITY_CC
# Check if we have -fgnu89-inline flag
GCC_GNU89_INLINE_CC

# Host-dependant definitions
SIZECMD="stat -c %s"
SEDINPLACE="sed -i"
STRIP_BINARIES="--strip-all"
STRIP_SHARED="--strip-unneeded"
STRIP_STATIC="--strip-debug"
case "${host_os}" in
	*bsd*)
		SIZECMD="stat -f %z"
		SEDINPLACE="sed -i \"\""
		;;
	cygwin*)
		host_os_cygwin=yes
		CFLAGS="$CFLAGS -DCYGWIN"
		;;
	darwin*)
		host_os_darwin=yes
		SIZECMD="/usr/bin/stat -f %z"
		SEDINPLACE="/usr/bin/sed -i ''"
		STRIP_BINARIES=""
		STRIP_SHARED="-S"
		STRIP_STATIC="-S"
		;;
esac

AM_CONDITIONAL([CYGWIN], test "x$host_os_cygwin" = "xyes")
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
AC_SUBST(SIZECMD)
AC_SUBST(SEDINPLACE)
AC_SUBST(STRIP_BINARIES)
AC_SUBST(STRIP_SHARED)
AC_SUBST(STRIP_STATIC)

# Variables plugged into makepkg.conf
CARCH="${host%%-*}"
CHOST="${host}"
AC_SUBST(CARCH)
AC_SUBST(CHOST)

# Check for documentation support and status
AC_CHECK_PROGS([ASCIIDOC], [asciidoc])
AC_MSG_CHECKING([for building documentation])
if test "x$wantdoc" = "xyes" ; then
	if test $ASCIIDOC ; then
		AC_MSG_RESULT([yes, enabled by configure])
	else
		asciidoc="(warning : asciidoc not installed)"
		AC_MSG_RESULT([yes $asciidoc])
	fi
	wantdoc=yes
else
	AC_MSG_RESULT([no, disabled by configure])
	wantdoc=no
fi
AM_CONDITIONAL(WANT_DOC, test "x$wantdoc" = "xyes")

# Check for doxygen support and status
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AC_MSG_CHECKING([for doxygen])
if test "x$wantdoxygen" = "xyes" ; then
	if test $DOXYGEN ; then
		AC_MSG_RESULT([yes])
		usedoxygen=yes
	else
		AC_MSG_RESULT([no, doxygen missing])
		usedoxygen=no
	fi
else
	AC_MSG_RESULT([no, disabled by configure])
	usedoxygen=no
fi
AM_CONDITIONAL(USE_DOXYGEN, test "x$usedoxygen" = "xyes")

# Enable or disable debug code
AC_MSG_CHECKING(for debug mode request)
if test "x$debug" = "xyes" ; then
	AC_MSG_RESULT(yes)
	AC_DEFINE([PACMAN_DEBUG], , [Enable debug code])
	# Check for -fstack-protector availability
	GCC_STACK_PROTECT_LIB
	GCC_STACK_PROTECT_CC
	GCC_FORTIFY_SOURCE_CC
	CFLAGS="$CFLAGS -g -Wall -Werror"
else
	AC_MSG_RESULT(no)
	CFLAGS="$CFLAGS -Wall"
fi

# 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
	AC_CHECK_PROGS([GIT], [git])
	AC_CHECK_FILE([.git/], hasgitdir=yes)
	if test $GIT -a "x$hasgitdir" = "xyes"; then
		AC_MSG_RESULT([yes])
		usegitver=yes
		AC_DEFINE([USE_GIT_VERSION], , [Use GIT version in version string])
	else
		AC_MSG_RESULT([no, git or .git dir missing])
		usegitver=no
	fi
else
	AC_MSG_RESULT([no, disabled by configure])
	usegitver=no
fi
AM_CONDITIONAL(USE_GIT_VERSION, test "x$usegitver" = "xyes")

# Set root directory
AC_SUBST(ROOTDIR)
AC_DEFINE_UNQUOTED([ROOTDIR], "$ROOTDIR", [The location of the root operating directory])
# Set package file extension
AC_SUBST(PKGEXT)
AC_DEFINE_UNQUOTED([PKGEXT], "$PKGEXT", [The file extension used by pacman packages])
# Set source package file extension
AC_SUBST(SRCEXT)
AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman source packages])
# Set makepkg build script name
AC_SUBST(BUILDSCRIPT)
AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
# Set shell used by install scriptlets
AC_SUBST(SCRIPTLET_SHELL)
AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the shell used to run install scriptlets])

# Configuration files
AC_CONFIG_FILES([
lib/libalpm/Makefile
lib/libalpm/po/Makefile.in
src/pacman/Makefile
src/pacman/po/Makefile.in
src/util/Makefile
scripts/Makefile
scripts/po/Makefile.in
doc/Makefile
etc/Makefile
test/pacman/Makefile
test/pacman/tests/Makefile
test/util/Makefile
contrib/Makefile
Makefile
])
AC_OUTPUT

echo "
${PACKAGE_NAME}:

  Build information:
    source code location   : ${srcdir}
    prefix                 : ${prefix}
    sysconfdir             : $(eval echo ${sysconfdir})
       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/

    compiler               : ${CC}
    preprocessor flags     : ${CPPFLAGS}
    compiler flags         : ${CFLAGS}
    defines                : ${DEFS}
    library flags          : ${LIBS}
    linker flags           : ${LDFLAGS}

    Architecture           : ${CARCH}
    Host Type              : ${CHOST}
    Filesize command       : ${SIZECMD}
    In-place sed command   : ${SEDINPLACE}

    libalpm version        : ${LIB_VERSION}
    libalpm version info   : ${LIB_VERSION_INFO}
    pacman version         : ${PACKAGE_VERSION}
    using git version      : ${usegitver}

  Directory and file information:
    root working directory : ${ROOTDIR}
    package extension      : ${PKGEXT}
    source pkg extension   : ${SRCEXT}
    build script name      : ${BUILDSCRIPT}

  Compilation options:
    Use libcurl            : ${with_libcurl}
    Use GPGME              : ${with_gpgme}
    Use OpenSSL            : ${with_openssl}
    Run make in doc/ dir   : ${wantdoc} ${asciidoc}
    Doxygen support        : ${usedoxygen}
    debug support          : ${debug}
"

# vim:set ts=2 sw=2 noet: