1 # configure.ac - for GnuPG 2.1
2 # Copyright (C) 1998-2012 Free Software Foundation, Inc.
3 # Copyright (C) 1998-2015 Werner Koch
5 # This file is part of GnuPG.
7 # GnuPG is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # GnuPG is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, see <http://www.gnu.org/licenses/>.
20 # Process this file with autoconf to produce a configure script.
22 min_automake_version="1.14"
24 # To build a release you need to create a tag with the version number
25 # (git tag -s gnupg-2.n.m) and run "./autogen.sh --force". Please
26 # bump the version number immediately *after* the release and do
27 # another commit and push so that the git magic is able to work.
28 m4_define([mym4_package],[gnupg])
29 m4_define([mym4_major], [2])
30 m4_define([mym4_minor], [1])
31 m4_define([mym4_micro], [2])
33 # To start a new development series, i.e a new major or minor number
34 # you need to mark an arbitrary commit before the first beta release
35 # with an annotated tag. For example the 2.1 branch starts off with
36 # the tag "gnupg-2.1-base". This is used as the base for counting
37 # beta numbers before the first release of a series.
39 # Below is m4 magic to extract and compute the git revision number,
40 # the decimalized short revision number, a beta version string and a
41 # flag indicating a development version (mym4_isbeta). Note that the
42 # m4 processing is done by autoconf and not during the configure run.
43 m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
44 mym4_package mym4_major mym4_minor mym4_micro),[:]))
45 m4_define([mym4_isbeta], m4_argn(2, mym4_verslist))
46 m4_define([mym4_version], m4_argn(4, mym4_verslist))
47 m4_define([mym4_revision], m4_argn(7, mym4_verslist))
48 m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
49 m4_esyscmd([echo ]mym4_version[>VERSION])
50 AC_INIT([mym4_package],[mym4_version], [http://bugs.gnupg.org])
52 NEED_GPG_ERROR_VERSION=1.16
55 NEED_LIBGCRYPT_VERSION=1.6.0
58 NEED_LIBASSUAN_VERSION=2.1.0
61 NEED_KSBA_VERSION=1.2.0
64 NEED_NTBTLS_VERSION=0.1.0
67 NEED_NPTH_VERSION=0.91
70 NEED_GNUTLS_VERSION=3.0
73 development_version=mym4_isbeta
75 PACKAGE_GT=${PACKAGE_NAME}2
76 VERSION=$PACKAGE_VERSION
78 AC_CONFIG_AUX_DIR([build-aux])
79 AC_CONFIG_SRCDIR([sm/gpgsm.c])
80 AC_CONFIG_HEADER([config.h])
81 AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
87 # Some status variables.
105 dirmngr_auto_start=yes
109 GNUPG_BUILD_PROGRAM(gpg, yes)
110 GNUPG_BUILD_PROGRAM(gpgsm, yes)
111 # The agent is a required part and can't be disabled anymore.
113 GNUPG_BUILD_PROGRAM(scdaemon, yes)
114 GNUPG_BUILD_PROGRAM(g13, yes)
115 GNUPG_BUILD_PROGRAM(dirmngr, yes)
116 GNUPG_BUILD_PROGRAM(tools, yes)
117 GNUPG_BUILD_PROGRAM(doc, yes)
118 GNUPG_BUILD_PROGRAM(symcryptrun, no)
119 GNUPG_BUILD_PROGRAM(gpgtar, yes)
124 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
125 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
126 [Name of this package for gettext])
127 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
128 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
129 [Bug report address])
130 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
131 [Required version of Libgcrypt])
132 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
133 [Required version of Libksba])
134 AC_DEFINE_UNQUOTED(NEED_NTBTLS_VERSION, "$NEED_NTBTLS_VERSION",
135 [Required version of NTBTLS])
139 # The default is to use the modules from this package and the few
140 # other packages in a standard place; i.e where this package gets
141 # installed. With these options it is possible to override these
142 # ${prefix} depended values with fixed paths, which can't be replaced
143 # at make time. See also am/cmacros.am and the defaults in AH_BOTTOM.
144 AC_ARG_WITH(agent-pgm,
145 [ --with-agent-pgm=PATH Use PATH as the default for the agent)],
146 GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
147 AC_SUBST(GNUPG_AGENT_PGM)
148 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
149 show_gnupg_agent_pgm="(default)"
150 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
152 AC_ARG_WITH(pinentry-pgm,
153 [ --with-pinentry-pgm=PATH Use PATH as the default for the pinentry)],
154 GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
155 AC_SUBST(GNUPG_PINENTRY_PGM)
156 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
157 show_gnupg_pinentry_pgm="(default)"
158 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
161 AC_ARG_WITH(scdaemon-pgm,
162 [ --with-scdaemon-pgm=PATH Use PATH as the default for the scdaemon)],
163 GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
164 AC_SUBST(GNUPG_SCDAEMON_PGM)
165 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
166 show_gnupg_scdaemon_pgm="(default)"
167 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
170 AC_ARG_WITH(dirmngr-pgm,
171 [ --with-dirmngr-pgm=PATH Use PATH as the default for the dirmngr)],
172 GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
173 AC_SUBST(GNUPG_DIRMNGR_PGM)
174 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
175 show_gnupg_dirmngr_pgm="(default)"
176 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
178 AC_ARG_WITH(protect-tool-pgm,
179 [ --with-protect-tool-pgm=PATH Use PATH as the default for the protect-tool)],
180 GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
181 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
182 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
183 show_gnupg_protect_tool_pgm="(default)"
184 test -n "$GNUPG_PROTECT_TOOL_PGM" \
185 && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
187 AC_ARG_WITH(dirmngr-ldap-pgm,
188 [ --with-dirmngr-ldap-pgm=PATH Use PATH as the default for the dirmnge ldap wrapper)],
189 GNUPG_DIRMNGR_LDAP_PGM="$withval", GNUPG_DIRMNGR_LDAP_PGM="" )
190 AC_SUBST(GNUPG_DIRMNGR_LDAP_PGM)
191 AM_CONDITIONAL(GNUPG_DIRMNGR_LDAP_PGM, test -n "$GNUPG_DIRMNGR_LDAP_PGM")
192 show_gnupg_dirmngr_ldap_pgm="(default)"
193 test -n "$GNUPG_DIRMNGR_LDAP_PGM" \
194 && show_gnupg_dirmngr_ldap_pgm="$GNUPG_DIRMNGR_LDAP_PGM"
197 # On some platforms gpg2 is usually installed as gpg without using a
198 # symlink. For correct operation of gpgconf it needs to know the
199 # installed name of gpg. This option sets "gpg2"'s installed name to
200 # just "gpg". Note that it might be required to rename gpg2 to gpg
201 # manually after the build process.
203 AC_ARG_ENABLE(gpg2-is-gpg,
204 AC_HELP_STRING([--enable-gpg2-is-gpg],[Set installed name of gpg2 to gpg]),
205 gpg2_is_gpg=$enableval)
206 if test "$gpg2_is_gpg" = "yes"; then
207 name_of_installed_gpg=gpg
209 name_of_installed_gpg=gpg2
211 AC_DEFINE_UNQUOTED(NAME_OF_INSTALLED_GPG, "$name_of_installed_gpg",
212 [The name of the installed GPG tool])
215 # SELinux support includes tracking of sensitive files to avoid
216 # leaking their contents through processing these files by gpg itself
217 AC_MSG_CHECKING([whether SELinux support is requested])
218 AC_ARG_ENABLE(selinux-support,
219 AC_HELP_STRING([--enable-selinux-support],
220 [enable SELinux support]),
221 selinux_support=$enableval, selinux_support=no)
222 AC_MSG_RESULT($selinux_support)
225 AC_MSG_CHECKING([whether to allocate extra secure memory])
226 AC_ARG_ENABLE(large-secmem,
227 AC_HELP_STRING([--enable-large-secmem],
228 [allocate extra secure memory]),
229 large_secmem=$enableval, large_secmem=no)
230 AC_MSG_RESULT($large_secmem)
231 if test "$large_secmem" = yes ; then
232 SECMEM_BUFFER_SIZE=65536
234 SECMEM_BUFFER_SIZE=32768
236 AC_DEFINE_UNQUOTED(SECMEM_BUFFER_SIZE,$SECMEM_BUFFER_SIZE,
237 [Size of secure memory buffer])
239 AC_MSG_CHECKING([whether to enable trust models])
240 AC_ARG_ENABLE(trust-models,
241 AC_HELP_STRING([--disable-trust-models],
242 [disable all trust models except "always"]),
243 use_trust_models=$enableval)
244 AC_MSG_RESULT($use_trust_models)
245 if test "$use_trust_models" = no ; then
246 AC_DEFINE(NO_TRUST_MODELS, 1,
247 [Define to include only trust-model always])
252 # Options to disable algorithm
255 GNUPG_GPG_DISABLE_ALGO([rsa],[RSA public key])
256 # Elgamal is a MUST algorithm
257 # DSA is a MUST algorithm
258 GNUPG_GPG_DISABLE_ALGO([ecdh],[ECDH public key])
259 GNUPG_GPG_DISABLE_ALGO([ecdsa],[ECDSA public key])
260 GNUPG_GPG_DISABLE_ALGO([eddsa],[EdDSA public key])
262 GNUPG_GPG_DISABLE_ALGO([idea],[IDEA cipher])
263 # 3DES is a MUST algorithm
264 GNUPG_GPG_DISABLE_ALGO([cast5],[CAST5 cipher])
265 GNUPG_GPG_DISABLE_ALGO([blowfish],[BLOWFISH cipher])
266 GNUPG_GPG_DISABLE_ALGO([aes128],[AES128 cipher])
267 GNUPG_GPG_DISABLE_ALGO([aes192],[AES192 cipher])
268 GNUPG_GPG_DISABLE_ALGO([aes256],[AES256 cipher])
269 GNUPG_GPG_DISABLE_ALGO([twofish],[TWOFISH cipher])
270 GNUPG_GPG_DISABLE_ALGO([camellia128],[CAMELLIA128 cipher])
271 GNUPG_GPG_DISABLE_ALGO([camellia192],[CAMELLIA192 cipher])
272 GNUPG_GPG_DISABLE_ALGO([camellia256],[CAMELLIA256 cipher])
274 GNUPG_GPG_DISABLE_ALGO([md5],[MD5 hash])
275 # SHA1 is a MUST algorithm
276 GNUPG_GPG_DISABLE_ALGO([rmd160],[RIPE-MD160 hash])
277 GNUPG_GPG_DISABLE_ALGO([sha224],[SHA-224 hash])
278 # SHA256 is a MUST algorithm for GnuPG.
279 GNUPG_GPG_DISABLE_ALGO([sha384],[SHA-384 hash])
280 GNUPG_GPG_DISABLE_ALGO([sha512],[SHA-512 hash])
283 # Allow disabling of zip support.
284 # This is in general not a good idea because according to rfc4880 OpenPGP
285 # implementations SHOULD support ZLIB.
286 AC_MSG_CHECKING([whether to enable the ZIP and ZLIB compression algorithm])
288 AC_HELP_STRING([--disable-zip],
289 [disable the ZIP and ZLIB compression algorithm]),
291 AC_MSG_RESULT($use_zip)
293 # Allow disabling of bzib2 support.
294 # It is defined only after we confirm the library is available later
295 AC_MSG_CHECKING([whether to enable the BZIP2 compression algorithm])
297 AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
298 use_bzip2=$enableval)
299 AC_MSG_RESULT($use_bzip2)
301 # Configure option to allow or disallow execution of external
302 # programs, like a photo viewer.
303 AC_MSG_CHECKING([whether to enable external program execution])
305 AC_HELP_STRING([--disable-exec],[disable all external program execution]),
307 AC_MSG_RESULT($use_exec)
308 if test "$use_exec" = no ; then
309 AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
312 if test "$use_exec" = yes ; then
313 AC_MSG_CHECKING([whether to enable photo ID viewing])
314 AC_ARG_ENABLE(photo-viewers,
315 [ --disable-photo-viewers disable photo ID viewers],
316 [if test "$enableval" = no ; then
317 AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
319 gnupg_cv_enable_photo_viewers=$enableval
320 AC_MSG_RESULT($enableval)
322 if test "$gnupg_cv_enable_photo_viewers" = yes ; then
323 AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
324 AC_ARG_WITH(photo-viewer,
325 [ --with-photo-viewer=FIXED_VIEWER set a fixed photo ID viewer],
326 [if test "$withval" = yes ; then
328 elif test "$withval" != no ; then
329 AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
330 [if set, restrict photo-viewer to this])
332 AC_MSG_RESULT($withval)
338 # Check for the key/uid cache size. This can't be zero, but can be
339 # pretty small on embedded systems. This is used for the gpg part.
341 AC_MSG_CHECKING([for the size of the key and uid cache])
342 AC_ARG_ENABLE(key-cache,
343 AC_HELP_STRING([--enable-key-cache=SIZE],
344 [Set key cache to SIZE (default 4096)]),,enableval=4096)
345 if test "$enableval" = "no"; then
347 elif test "$enableval" = "yes" || test "$enableval" = ""; then
351 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
353 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
354 AC_MSG_ERROR([invalid key-cache size])
356 AC_MSG_RESULT($key_cache_size)
357 AC_DEFINE_UNQUOTED(PK_UID_CACHE_SIZE,$key_cache_size,
358 [Size of the key and UID caches])
363 # Check whether we want to use Linux capabilities
365 AC_MSG_CHECKING([whether use of capabilities is requested])
366 AC_ARG_WITH(capabilities,
367 [ --with-capabilities use linux capabilities [default=no]],
368 [use_capabilities="$withval"],[use_capabilities=no])
369 AC_MSG_RESULT($use_capabilities)
372 # Check whether to disable the card support
373 AC_MSG_CHECKING([whether smartcard support is requested])
374 AC_ARG_ENABLE(card-support,
375 AC_HELP_STRING([--disable-card-support],
376 [disable smartcard support]),
377 card_support=$enableval)
378 AC_MSG_RESULT($card_support)
379 if test "$card_support" = yes ; then
380 AC_DEFINE(ENABLE_CARD_SUPPORT,1,[Define to include smartcard support])
386 # Allow disabling of internal CCID support.
387 # It is defined only after we confirm the library is available later
389 AC_MSG_CHECKING([whether to enable the internal CCID driver])
390 AC_ARG_ENABLE(ccid-driver,
391 AC_HELP_STRING([--disable-ccid-driver],
392 [disable the internal CCID driver]),
393 use_ccid_driver=$enableval)
394 AC_MSG_RESULT($use_ccid_driver)
396 AC_MSG_CHECKING([whether to auto start dirmngr])
397 AC_ARG_ENABLE(dirmngr-auto-start,
398 AC_HELP_STRING([--disable-dirmngr-auto-start],
399 [disable auto starting of the dirmngr]),
400 dirmngr_auto_start=$enableval)
401 AC_MSG_RESULT($dirmngr_auto_start)
402 if test "$dirmngr_auto_start" = yes ; then
403 AC_DEFINE(USE_DIRMNGR_AUTO_START,1,
404 [Define to enable auto starting of the dirmngr])
409 # To avoid double inclusion of config.h which might happen at some
410 # places, we add the usual double inclusion protection at the top of
414 #ifndef GNUPG_CONFIG_H_INCLUDED
415 #define GNUPG_CONFIG_H_INCLUDED
419 # Stuff which goes at the bottom of config.h.
422 /* This is the major version number of GnuPG so that
423 source included files can test for this. Note, that
424 we use 2 here even for GnuPG 1.9.x. */
425 #define GNUPG_MAJOR_VERSION 2
427 /* Now to separate file name parts.
428 Please note that the string version must not contain more
429 than one character because the code assumes strlen()==1 */
430 #ifdef HAVE_DOSISH_SYSTEM
431 #define DIRSEP_C '\\'
432 #define DIRSEP_S "\\"
435 #define PATHSEP_C ';'
436 #define PATHSEP_S ";"
437 #define EXEEXT_S ".exe"
443 #define PATHSEP_C ':'
444 #define PATHSEP_S ":"
448 /* This is the same as VERSION, but should be overridden if the
449 platform cannot handle things like dots '.' in filenames. Set
450 SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
451 uses for dots and dashes. */
452 #define SAFE_VERSION VERSION
453 #define SAFE_VERSION_DOT '.'
454 #define SAFE_VERSION_DASH '-'
456 /* Some global constants. */
457 #ifdef HAVE_DOSISH_SYSTEM
458 # ifdef HAVE_DRIVE_LETTERS
459 # define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
461 # define GNUPG_DEFAULT_HOMEDIR "/gnupg"
464 #define GNUPG_DEFAULT_HOMEDIR "/SYS$LOGIN/gnupg"
466 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
468 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
469 #define GNUPG_OPENPGP_REVOC_DIR "openpgp-revocs.d"
471 /* For some systems (DOS currently), we hardcode the path here. For
472 POSIX systems the values are constructed by the Makefiles, so that
473 the values may be overridden by the make invocations; this is to
474 comply with the GNU coding standards. Note that these values are
476 #ifdef HAVE_DOSISH_SYSTEM
477 # ifdef HAVE_DRIVE_LETTERS
478 # define GNUPG_BINDIR "c:\\gnupg"
479 # define GNUPG_LIBEXECDIR "c:\\gnupg"
480 # define GNUPG_LIBDIR "c:\\gnupg"
481 # define GNUPG_DATADIR "c:\\gnupg"
482 # define GNUPG_SYSCONFDIR "c:\\gnupg"
484 # define GNUPG_BINDIR "\\gnupg"
485 # define GNUPG_LIBEXECDIR "\\gnupg"
486 # define GNUPG_LIBDIR "\\gnupg"
487 # define GNUPG_DATADIR "\\gnupg"
488 # define GNUPG_SYSCONFDIR "\\gnupg"
492 /* Derive some other constants. */
493 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
494 #define EXEC_TEMPFILE_ONLY
498 /* We didn't define endianness above, so get it from OS macros. This
499 is intended for making fat binary builds on OS X. */
500 #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST)
501 #if defined(__BIG_ENDIAN__)
502 #define BIG_ENDIAN_HOST 1
503 #elif defined(__LITTLE_ENDIAN__)
504 #define LITTLE_ENDIAN_HOST 1
506 #error "No endianness found"
511 /* Hack used for W32: ldap.m4 also tests for the ASCII version of
512 ldap_start_tls_s because that is the actual symbol used in the
513 library. winldap.h redefines it to our commonly used value,
514 thus we define our usual macro here. */
515 #ifdef HAVE_LDAP_START_TLS_SA
516 # ifndef HAVE_LDAP_START_TLS_S
517 # define HAVE_LDAP_START_TLS_S 1
521 /* Provide the es_ macro for estream. */
522 #define GPGRT_ENABLE_ES_MACROS 1
524 /* Tell libgcrypt not to use its own libgpg-error implementation. */
525 #define USE_LIBGPG_ERROR 1
527 /* Tell Libgcrypt not to include deprecated definitions. */
528 #define GCRYPT_NO_DEPRECATED 1
530 /* We use jnlib, so tell other modules about it. */
531 #define HAVE_JNLIB_LOGGING 1
533 /* Our HTTP code is used in estream mode. */
534 #define HTTP_USE_ESTREAM 1
536 /* Under W32 we do an explicit socket initialization, thus we need to
537 avoid the on-demand initialization which would also install an atexit
539 #define HTTP_NO_WSASTARTUP
541 /* Under Windows we use the gettext code from libgpg-error. */
542 #define GPG_ERR_ENABLE_GETTEXT_MACROS
544 /* Under WindowsCE we use the strerror replacement from libgpg-error. */
545 #define GPG_ERR_ENABLE_ERRNO_MACROS
547 #endif /*GNUPG_CONFIG_H_INCLUDED*/
552 AC_ARG_VAR(SYSROOT,[locate config scripts also below that directory])
554 # Checks for programs.
555 AC_MSG_NOTICE([checking for programs])
558 missing_dir=`cd $ac_aux_dir && pwd`
559 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
560 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
561 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
562 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
563 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
569 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
570 AC_MSG_ERROR([[No C-89 compiler found]])
575 AC_CHECK_TOOL(AR, ar, :)
576 AC_PATH_PROG(PERL,"perl")
577 AC_CHECK_TOOL(WINDRES, windres, :)
582 # We need to compile and run a program on the build machine. A
583 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
584 # the AC archive is broken for autoconf 2.57. Given that there is no
585 # newer version of that macro, we assume that it is also broken for
586 # autoconf 2.61 and thus we use a simple but usually sufficient
588 AC_MSG_CHECKING(for cc for build)
589 if test "$cross_compiling" = "yes"; then
590 CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
592 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
594 AC_MSG_RESULT($CC_FOR_BUILD)
595 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
601 have_dosish_system=no
604 have_android_system=no
606 use_simple_gettext=no
611 # special stuff for Windoze NT
612 ac_cv_have_dev_random=no
613 AC_DEFINE(USE_ONLY_8DOT3,1,
614 [Set this to limit filenames to the 8.3 format])
615 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
616 [Because the Unix gettext has too much overhead on
617 MingW32 systems and these systems lack Posix functions,
618 we use a simplified version of gettext])
619 have_dosish_system=yes
622 use_ldapwrapper=no # Fixme: Do this only for CE.
625 have_w32ce_system=yes
628 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
629 [Defined if the OS supports drive letters.])
633 use_simple_gettext=yes
636 i?86-emx-os2 | i?86-*-os2*emx )
637 # OS/2 with the EMX environment
638 ac_cv_have_dev_random=no
639 AC_DEFINE(HAVE_DRIVE_LETTERS)
640 have_dosish_system=yes
645 # DOS with the DJGPP environment
646 ac_cv_have_dev_random=no
647 AC_DEFINE(HAVE_DRIVE_LETTERS)
648 have_dosish_system=yes
653 if test -z "$GCC" ; then
654 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
658 if test -z "$GCC" ; then
659 # Suppress all warnings
660 # to get rid of the unsigned/signed char mismatch warnings.
665 if test -z "$GCC" ; then
666 # Use the newer compiler `-msg_disable ptrmismatch1' to
667 # get rid of the unsigned/signed char mismatch warnings.
668 # Using this may hide other pointer mismatch warnings, but
669 # it at least lets other warning classes through
670 CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
676 have_android_system=yes
677 # Android is fully utf-8 and we do not want to use iconv to
678 # keeps things simple
686 if test "$have_dosish_system" = yes; then
687 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
688 [Defined if we run on some of the PCDOS like systems
689 (DOS, Windoze. OS/2) with special properties like
690 no file modes, case insensitive file names and preferred
691 use of backslashes as directory name separators.])
693 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
695 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
697 if test "$have_w32_system" = yes; then
698 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
699 if test "$have_w32ce_system" = yes; then
700 AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
703 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
704 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
706 if test "$have_android_system" = yes; then
707 AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
709 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
711 if test "$run_tests" = yes; then
712 AC_DEFINE(RUN_TESTS,1, [Defined if we should run the tests])
714 AM_CONDITIONAL(RUN_TESTS, test "$run_tests" = yes)
717 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
718 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
722 # Checks for libraries.
724 AC_MSG_NOTICE([checking for libraries])
728 # libgpg-error is a library with error codes shared between GnuPG
731 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
732 have_gpg_error=yes,have_gpg_error=no)
736 # Libgcrypt is our generic crypto library
738 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
739 have_libgcrypt=yes,have_libgcrypt=no)
743 # libassuan is used for IPC
745 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
746 have_libassuan=yes,have_libassuan=no)
747 if test "$have_libassuan" = "yes"; then
748 AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
749 [version of the libassuan library])
755 # libksba is our X.509 support library
757 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
761 # libusb allows us to use the integrated CCID smartcard reader driver.
763 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
764 if test "$use_ccid_driver" = yes ; then
765 AC_CHECK_LIB(usb, usb_bulk_write,
766 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
767 AC_DEFINE(HAVE_LIBUSB,1,
768 [defined if libusb is available])
771 AC_CHECK_FUNCS(usb_create_match)
773 AC_SUBST(LIBUSB_LIBS)
776 # Check wether it is necessary to link against libdl.
777 # (For example to load libpcsclite)
779 gnupg_dlopen_save_libs="$LIBS"
781 AC_SEARCH_LIBS(dlopen, c dl,,,)
784 LIBS="$gnupg_dlopen_save_libs"
788 AC_PATH_PROG(ENCFS, encfs, /usr/bin/encfs)
789 AC_DEFINE_UNQUOTED(ENCFS,
790 "${ENCFS}", [defines the filename of the encfs program])
792 AC_PATH_PROG(FUSERMOUNT, fusermount, /usr/bin/fusermount)
793 AC_DEFINE_UNQUOTED(FUSERMOUNT,
794 "${FUSERMOUNT}", [defines the filename of the fusermount program])
801 # Checks for symcryptrun:
804 # libutil has openpty() and login_tty().
805 AC_CHECK_LIB(util, openpty,
806 [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
807 AC_DEFINE(HAVE_LIBUTIL,1,
808 [defined if libutil is available])
810 AC_SUBST(LIBUTIL_LIBS)
812 # shred is used to clean temporary plain text files.
813 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
814 AC_DEFINE_UNQUOTED(SHRED,
815 "${SHRED}", [defines the filename of the shred program])
819 # Check whether the nPth library is available
821 AM_PATH_NPTH("$NEED_NPTH_API:$NEED_NPTH_VERSION",have_npth=yes,have_npth=no)
822 if test "$have_npth" = "yes"; then
823 AC_DEFINE(HAVE_NPTH, 1,
824 [Defined if the New Portable Thread Library is available])
825 AC_DEFINE(USE_NPTH, 1,
826 [Defined if support for nPth is requested and nPth is available])
830 *** To support concurrent access for example in gpg-agent and the SCdaemon
831 *** we need the support of the New Portable Threads Library.
837 # NTBTLS is our TLS library. If it is not available fallback to
840 AC_ARG_ENABLE(ntbtls,
841 AC_HELP_STRING([--disable-ntbtls],
842 [disable the use of NTBTLS as TLS library]),
843 try_ntbtls=$enableval, try_ntbtls=yes)
844 if test x"$try_ntbtls" = xyes ; then
845 AM_PATH_NTBTLS("$NEED_NTBTLS_API:$NEED_NTBTLS_VERSION",
846 [have_ntbtls=yes],[have_ntbtls=no])
848 if test "$have_ntbtls" = yes ; then
849 use_tls_library=ntbtls
850 AC_DEFINE(HTTP_USE_NTBTLS, 1, [Enable NTBTLS support in http.c])
852 AC_ARG_ENABLE(gnutls,
853 AC_HELP_STRING([--disable-gnutls],
854 [disable GNUTLS as fallback TLS library]),
855 try_gnutls=$enableval, try_gnutls=yes)
856 if test x"$try_gnutls" = xyes ; then
857 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= $NEED_GNUTLS_VERSION],
861 if test "$have_gnutls" = "yes"; then
862 AC_SUBST([LIBGNUTLS_CFLAGS])
863 AC_SUBST([LIBGNUTLS_LIBS])
864 use_tls_library=gnutls
865 AC_DEFINE(HTTP_USE_GNUTLS, 1, [Enable GNUTLS support in http.c])
867 tmp=$(echo "$LIBGNUTLS_PKG_ERRORS" | tr '\n' '\v' | sed 's/\v/\n*** /g')
870 *** Building without NTBTLS and GNUTLS - no TLS access to keyservers.
877 AC_MSG_NOTICE([checking for networking options])
880 # Must check for network library requirements before doing link tests
881 # for ldap, for example. If ldap libs are static (or dynamic and without
882 # ELF runtime link paths), then link will fail and LDAP support won't
885 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
886 [NETLIBS="-lnsl $NETLIBS"]))
887 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
888 [NETLIBS="-lsocket $NETLIBS"]))
894 _cppflags="${CPPFLAGS}"
895 _ldflags="${LDFLAGS}"
897 AC_HELP_STRING([--with-adns=DIR],
898 [look for the adns library in DIR]),
899 [if test -d "$withval"; then
900 CPPFLAGS="${CPPFLAGS} -I$withval/include"
901 LDFLAGS="${LDFLAGS} -L$withval/lib"
903 if test "$with_adns" != "no"; then
904 AC_CHECK_HEADERS(adns.h,
905 AC_CHECK_LIB(adns, adns_free,
907 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),
908 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
910 if test "$have_adns" = "yes"; then
916 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
918 AC_ARG_ENABLE(dns-srv,
919 AC_HELP_STRING([--disable-dns-srv],
920 [disable the use of DNS SRV in HKP and HTTP]),
921 use_dns_srv=$enableval,use_dns_srv=yes)
923 AC_ARG_ENABLE(dns-pka,
924 AC_HELP_STRING([--disable-dns-pka],
925 [disable the use of PKA records in DNS]),
926 use_dns_pka=$enableval,use_dns_pka=yes)
928 AC_ARG_ENABLE(dns-cert,
929 AC_HELP_STRING([--disable-dns-cert],
930 [disable the use of CERT records in DNS]),
931 use_dns_cert=$enableval,use_dns_cert=yes)
933 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
934 || test x"$use_dns_cert" = xyes; then
937 # the double underscore thing is a glibc-ism?
938 AC_SEARCH_LIBS(res_query,resolv bind,,
939 AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
940 AC_SEARCH_LIBS(dn_expand,resolv bind,,
941 AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
942 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
943 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
945 if test x"$have_resolver" != xno ; then
947 # Make sure that the BIND 4 resolver interface is workable before
948 # enabling any code that calls it. At some point I'll rewrite the
949 # code to use the BIND 8 resolver API.
950 # We might also want to use adns instead. Problem with ADNS is that
951 # it does not support v6.
953 AC_MSG_CHECKING([whether the resolver is usable])
954 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
955 #include <netinet/in.h>
956 #include <arpa/nameser.h>
957 #include <resolv.h>]],
958 [[unsigned char answer[PACKETSZ];
959 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
961 dn_expand(0,0,0,0,0);
962 ]])],have_resolver=yes,have_resolver=no)
963 AC_MSG_RESULT($have_resolver)
965 # This is Apple-specific and somewhat bizarre as they changed the
966 # define in bind 8 for some reason.
968 if test x"$have_resolver" != xyes ; then
970 [whether I can make the resolver usable with BIND_8_COMPAT])
971 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define BIND_8_COMPAT
972 #include <sys/types.h>
973 #include <netinet/in.h>
974 #include <arpa/nameser.h>
975 #include <resolv.h>]],
976 [[unsigned char answer[PACKETSZ];
977 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
978 dn_skipname(0,0); dn_expand(0,0,0,0,0);
979 ]])],[have_resolver=yes ; need_compat=yes])
980 AC_MSG_RESULT($have_resolver)
984 if test x"$have_resolver" = xyes ; then
987 if test x"$use_dns_srv" = xyes ; then
988 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
991 if test x"$use_dns_pka" = xyes ; then
992 AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
995 if test x"$use_dns_cert" = xyes ; then
996 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
999 if test x"$need_compat" = xyes ; then
1000 AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
1003 # If we have no resolver library but ADNS (e.g. under W32) enable the
1004 # code parts which can be used with ADNS.
1005 if test x"$have_adns" = xyes ; then
1007 AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
1009 if test x"$use_dns_srv" = xyes ; then
1010 AC_DEFINE(USE_DNS_SRV,1)
1013 if test x"$use_dns_pka" = xyes ; then
1014 AC_DEFINE(USE_DNS_PKA,1)
1017 if test x"$use_dns_cert" = xyes ; then
1018 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1027 LIBS=$_dns_save_libs
1032 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
1038 # Note that running the check changes the variable
1039 # gnupg_have_ldap from "n/a" to "no" or "yes".
1042 AC_HELP_STRING([--disable-ldap],[disable LDAP support]),
1043 [if test "$enableval" = "no"; then gnupg_have_ldap=no; fi])
1045 if test "$gnupg_have_ldap" != "no" ; then
1046 if test "$build_dirmngr" = "yes" ; then
1047 GNUPG_CHECK_LDAP($NETLIBS)
1048 AC_CHECK_LIB(lber, ber_free,
1049 [ LBER_LIBS="$LBER_LIBS -llber"
1050 AC_DEFINE(HAVE_LBER,1,
1051 [defined if liblber is available])
1057 if test "$gnupg_have_ldap" = "no"; then
1060 *** Building without LDAP support.
1061 *** No CRL access or X.509 certificate search available.
1065 AM_CONDITIONAL(USE_LDAP, [test "$gnupg_have_ldap" = yes])
1066 if test "$gnupg_have_ldap" = yes ; then
1067 AC_DEFINE(USE_LDAP,1,[Defined if LDAP is support])
1072 if test "$use_ldapwrapper" = yes; then
1073 AC_DEFINE(USE_LDAPWRAPPER,1, [Build dirmngr with LDAP wrapper process])
1075 AM_CONDITIONAL(USE_LDAPWRAPPER, test "$use_ldapwrapper" = yes)
1081 # Check for sendmail
1083 # This isn't necessarily sendmail itself, but anything that gives a
1084 # sendmail-ish interface to the outside world. That includes Exim,
1085 # Postfix, etc. Basically, anything that can handle "sendmail -t".
1086 AC_ARG_WITH(mailprog,
1087 AC_HELP_STRING([--with-mailprog=NAME],
1088 [use "NAME -t" for mail transport]),
1090 if test x"$with_mailprog" = xyes ; then
1091 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
1092 elif test x"$with_mailprog" != xno ; then
1093 AC_MSG_CHECKING([for a mail transport program])
1094 AC_SUBST(SENDMAIL,$with_mailprog)
1095 AC_MSG_RESULT($with_mailprog)
1100 # Construct a printable name of the OS
1104 PRINTABLE_OS_NAME="W32CE"
1107 PRINTABLE_OS_NAME="MingW32"
1110 PRINTABLE_OS_NAME="Cygwin"
1112 i?86-emx-os2 | i?86-*-os2*emx )
1113 PRINTABLE_OS_NAME="OS/2"
1116 PRINTABLE_OS_NAME="MSDOS/DJGPP"
1120 PRINTABLE_OS_NAME="GNU/Linux"
1123 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
1126 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
1127 [A human readable text with the name of the OS])
1131 # Checking for iconv
1133 if test "$require_iconv" = yes; then
1139 AC_SUBST(LTLIBICONV)
1146 # This is "GNU gnupg" - The project-id script from gettext
1149 AC_MSG_NOTICE([checking for gettext])
1151 AM_GNU_GETTEXT_VERSION([0.17])
1152 if test "$try_gettext" = yes; then
1153 AM_GNU_GETTEXT([external],[need-ngettext])
1155 # gettext requires some extra checks. These really should be part of
1156 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
1157 # function checks to here.
1159 AC_CHECK_FUNCS(strchr)
1162 USE_INCLUDED_LIBINTL=no
1163 BUILD_INCLUDED_LIBINTL=no
1166 AC_SUBST(USE_INCLUDED_LIBINTL)
1167 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1171 # We use HAVE_LANGINFO_CODESET in a couple of places.
1174 # Checks required for our use of locales
1181 if test "$selinux_support" = yes ; then
1182 AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1187 # Checks for header files.
1189 AC_MSG_NOTICE([checking for header files])
1191 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
1192 pty.h utmp.h pwd.h inttypes.h signal.h sys/select.h])
1197 # Checks for typedefs, structures, and compiler characteristics.
1199 AC_MSG_NOTICE([checking for system characteristics])
1208 gl_HEADER_SYS_SOCKET
1211 AC_SEARCH_LIBS([inet_addr], [nsl])
1213 AC_ARG_ENABLE(endian-check,
1214 AC_HELP_STRING([--disable-endian-check],
1215 [disable the endian check and trust the OS provided macros]),
1216 endiancheck=$enableval,endiancheck=yes)
1218 if test x"$endiancheck" = xyes ; then
1222 # fixme: we should get rid of the byte type
1223 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
1224 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
1225 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
1226 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
1227 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
1229 AC_CHECK_SIZEOF(unsigned short)
1230 AC_CHECK_SIZEOF(unsigned int)
1231 AC_CHECK_SIZEOF(unsigned long)
1232 AC_CHECK_SIZEOF(unsigned long long)
1234 AC_CHECK_SIZEOF(time_t,,[[
1236 #if TIME_WITH_SYS_TIME
1237 # include <sys/time.h>
1240 # if HAVE_SYS_TIME_H
1241 # include <sys/time.h>
1247 GNUPG_TIME_T_UNSIGNED
1250 if test "$ac_cv_sizeof_unsigned_short" = "0" \
1251 || test "$ac_cv_sizeof_unsigned_int" = "0" \
1252 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
1253 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
1258 # Checks for library functions.
1260 AC_MSG_NOTICE([checking for library functions])
1261 AC_CHECK_DECLS(getpagesize)
1265 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
1266 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
1267 AC_CHECK_FUNCS([setenv unsetenv fcntl ftruncate inet_ntop])
1268 AC_CHECK_FUNCS([canonicalize_file_name])
1269 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
1270 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
1271 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
1272 AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat])
1274 if test "$have_android_system" = yes; then
1275 # On Android ttyname is a stub but prints an error message.
1276 AC_DEFINE(HAVE_BROKEN_TTYNAME,1,
1277 [Defined if ttyname does not work properly])
1280 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1282 # Dirmngr requires mmap on Unix systems.
1283 if test $ac_cv_func_mmap != yes -a $mmap_needed = yes; then
1284 AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]])
1288 # These are needed by the jnlib parts in common.
1289 # Note: We already checked pwd.h.
1290 AC_CHECK_HEADERS([signal.h])
1291 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
1292 memrchr isascii timegm getrusage setrlimit stat setlocale \
1293 flockfile funlockfile fopencookie funopen getpwnam getpwuid \
1294 getenv inet_pton strpbrk])
1301 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1304 # Sanity check regex. Tests adapted from mutt.
1306 AC_MSG_CHECKING([whether regular expression support is requested])
1307 AC_ARG_ENABLE(regex,
1308 AC_HELP_STRING([--disable-regex],
1309 [do not handle regular expressions in trust signatures]),
1310 use_regex=$enableval, use_regex=yes)
1311 AC_MSG_RESULT($use_regex)
1313 if test "$use_regex" = yes ; then
1314 _cppflags="${CPPFLAGS}"
1315 _ldflags="${LDFLAGS}"
1317 AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1319 if test -d "$withval" ; then
1320 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1321 LDFLAGS="${LDFLAGS} -L$withval/lib"
1325 # Does the system have regex functions at all?
1326 AC_SEARCH_LIBS([regcomp], [regex])
1327 AC_CHECK_FUNC(regcomp, gnupg_cv_have_regex=yes, gnupg_cv_have_regex=no)
1329 if test $gnupg_cv_have_regex = no; then
1332 if test x"$cross_compiling" = xyes; then
1333 AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1335 AC_CACHE_CHECK([whether your system's regexp library is broken],
1336 [gnupg_cv_regex_broken],
1340 main() { regex_t blah ; regmatch_t p; p.rm_eo = p.rm_eo; return regcomp(&blah, "foo.*bar", REG_NOSUB) || regexec (&blah, "foobar", 0, NULL, 0); }],
1341 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1343 if test $gnupg_cv_regex_broken = yes; then
1344 AC_MSG_WARN([your regex is broken - disabling regex use])
1349 CPPFLAGS="${_cppflags}"
1350 LDFLAGS="${_ldflags}"
1353 if test "$use_regex" != yes ; then
1354 AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1356 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1361 # Do we have zlib? Must do it here because Solaris failed
1362 # when compiling a conftest (due to the "-lz" from LIBS).
1363 # Note that we combine zlib and bzlib2 in ZLIBS.
1365 if test "$use_zip" = yes ; then
1366 _cppflags="${CPPFLAGS}"
1367 _ldflags="${LDFLAGS}"
1369 [ --with-zlib=DIR use libz in DIR],[
1370 if test -d "$withval"; then
1371 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1372 LDFLAGS="${LDFLAGS} -L$withval/lib"
1376 AC_CHECK_HEADER(zlib.h,
1377 AC_CHECK_LIB(z, deflateInit2_,
1380 AC_DEFINE(HAVE_ZIP,1, [Defined if ZIP and ZLIB are supported])
1382 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1383 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1388 # Check whether we can support bzip2
1390 if test "$use_bzip2" = yes ; then
1391 _cppflags="${CPPFLAGS}"
1392 _ldflags="${LDFLAGS}"
1394 AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1396 if test -d "$withval" ; then
1397 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1398 LDFLAGS="${LDFLAGS} -L$withval/lib"
1402 # Checking alongside stdio.h as an early version of bzip2 (1.0)
1403 # required stdio.h to be included before bzlib.h, and Solaris 9 is
1404 # woefully out of date.
1405 if test "$withval" != no ; then
1406 AC_CHECK_HEADER(bzlib.h,
1407 AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1410 ZLIBS="$ZLIBS -lbz2"
1411 AC_DEFINE(HAVE_BZIP2,1,
1412 [Defined if the bz2 compression library is available])
1414 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1415 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1418 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1422 # Check for readline support
1423 GNUPG_CHECK_READLINE
1426 if test "$development_version" = yes; then
1427 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1428 [Defined if this is not a regular release])
1431 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1435 # Add some extra libs here so that previous tests don't fail for
1436 # mysterious reasons - the final link step should bail out.
1437 # W32SOCKLIBS is also defined so that if can be used for tools not
1438 # requiring any network stuff but linking to code in libcommon which
1439 # tracks in winsock stuff (e.g. init_common_subsystems).
1440 if test "$have_w32_system" = yes; then
1441 if test "$have_w32ce_system" = yes; then
1444 W32SOCKLIBS="-lws2_32"
1446 NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1450 AC_SUBST(W32SOCKLIBS)
1453 # Setup gcc specific options
1455 AC_MSG_NOTICE([checking for cc features])
1456 if test "$GCC" = yes; then
1457 # Check whether gcc does not emit a diagnositc for unknow -Wno-*
1458 # options. This is the case for gcc >= 4.6
1459 AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
1460 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1461 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
1463 #endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
1464 AC_MSG_RESULT($_gcc_silent_wno)
1466 # Note that it is okay to use CFLAGS here because these are just
1467 # warning options and the user should have a chance of overriding
1469 if test "$USE_MAINTAINER_MODE" = "yes"; then
1470 CFLAGS="$CFLAGS -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1471 CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1472 if test x"$_gcc_silent_wno" = xyes ; then
1475 AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1476 _gcc_cflags_save=$CFLAGS
1477 CFLAGS="-Wno-missing-field-initializers"
1478 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1479 [_gcc_wopt=yes],[_gcc_wopt=no])
1480 AC_MSG_RESULT($_gcc_wopt)
1481 CFLAGS=$_gcc_cflags_save;
1483 if test x"$_gcc_wopt" = xyes ; then
1484 CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
1487 AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
1488 _gcc_cflags_save=$CFLAGS
1489 CFLAGS="-Wdeclaration-after-statement"
1490 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1491 AC_MSG_RESULT($_gcc_wopt)
1492 CFLAGS=$_gcc_cflags_save;
1493 if test x"$_gcc_wopt" = xyes ; then
1494 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1497 CFLAGS="$CFLAGS -Wall"
1500 if test x"$_gcc_silent_wno" = xyes ; then
1503 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1504 _gcc_cflags_save=$CFLAGS
1505 CFLAGS="-Wno-pointer-sign"
1506 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1507 [_gcc_psign=yes],[_gcc_psign=no])
1508 AC_MSG_RESULT($_gcc_psign)
1509 CFLAGS=$_gcc_cflags_save;
1511 if test x"$_gcc_psign" = xyes ; then
1512 CFLAGS="$CFLAGS -Wno-pointer-sign"
1515 AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1516 _gcc_cflags_save=$CFLAGS
1517 CFLAGS="-Wpointer-arith"
1518 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
1519 AC_MSG_RESULT($_gcc_psign)
1520 CFLAGS=$_gcc_cflags_save;
1521 if test x"$_gcc_psign" = xyes ; then
1522 CFLAGS="$CFLAGS -Wpointer-arith"
1528 # This is handy for debugging so the compiler doesn't rearrange
1529 # things and eliminate variables.
1531 AC_ARG_ENABLE(optimization,
1532 AC_HELP_STRING([--disable-optimization],
1533 [disable compiler optimization]),
1534 [if test $enableval = no ; then
1535 CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
1539 # Decide what to build
1542 build_scdaemon_extra=""
1543 if test "$build_scdaemon" = "yes"; then
1544 if test $have_libusb = no; then
1545 build_scdaemon_extra="without internal CCID driver"
1547 if test -n "$build_scdaemon_extra"; then
1548 build_scdaemon_extra="(${build_scdaemon_extra})"
1554 # Set variables for use by automake makefiles.
1556 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
1557 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1558 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1559 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1560 AM_CONDITIONAL(BUILD_G13, test "$build_g13" = "yes")
1561 AM_CONDITIONAL(BUILD_DIRMNGR, test "$build_dirmngr" = "yes")
1562 AM_CONDITIONAL(BUILD_TOOLS, test "$build_tools" = "yes")
1563 AM_CONDITIONAL(BUILD_DOC, test "$build_doc" = "yes")
1564 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1565 AM_CONDITIONAL(BUILD_GPGTAR, test "$build_gpgtar" = "yes")
1567 AM_CONDITIONAL(ENABLE_CARD_SUPPORT, test "$card_support" = yes)
1568 AM_CONDITIONAL(NO_TRUST_MODELS, test "$use_trust_models" = no)
1570 AM_CONDITIONAL(RUN_GPG_TESTS,
1571 test x$cross_compiling = xno -a "$build_gpg" = yes )
1574 # Set some defines for use gpgconf.
1576 if test "$build_gpg" = yes ; then
1577 AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build])
1579 if test "$build_gpgsm" = yes ; then
1580 AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build])
1582 if test "$build_agent" = yes ; then
1583 AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build])
1585 if test "$build_scdaemon" = yes ; then
1586 AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build])
1588 if test "$build_dirmngr" = yes ; then
1589 AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build])
1591 if test "$build_g13" = yes ; then
1592 AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build])
1597 # Define Name strings
1599 AC_DEFINE_UNQUOTED(GNUPG_NAME, "GnuPG", [The name of the project])
1601 AC_DEFINE_UNQUOTED(GPG_NAME, "gpg", [The name of the OpenPGP tool])
1602 AC_DEFINE_UNQUOTED(GPG_DISP_NAME, "GnuPG", [The displayed name of gpg])
1604 AC_DEFINE_UNQUOTED(GPGSM_NAME, "gpgsm", [The name of the S/MIME tool])
1605 AC_DEFINE_UNQUOTED(GPGSM_DISP_NAME, "GPGSM", [The displayed name of gpgsm])
1607 AC_DEFINE_UNQUOTED(GPG_AGENT_NAME, "gpg-agent", [The name of the agent])
1608 AC_DEFINE_UNQUOTED(GPG_AGENT_DISP_NAME, "GPG Agent",
1609 [The displayed name of gpg-agent])
1611 AC_DEFINE_UNQUOTED(SCDAEMON_NAME, "scdaemon", [The name of the scdaemon])
1612 AC_DEFINE_UNQUOTED(SCDAEMON_DISP_NAME, "SCDaemon",
1613 [The displayed name of scdaemon])
1615 AC_DEFINE_UNQUOTED(DIRMNGR_NAME, "dirmngr", [The name of the dirmngr])
1616 AC_DEFINE_UNQUOTED(DIRMNGR_DISP_NAME, "DirMngr",
1617 [The displayed name of dirmngr])
1619 AC_DEFINE_UNQUOTED(G13_NAME, "g13", [The name of the g13 tool])
1620 AC_DEFINE_UNQUOTED(G13_DISP_NAME, "G13", [The displayed name of g13])
1622 AC_DEFINE_UNQUOTED(GPGCONF_NAME, "gpgconf", [The name of the gpgconf tool])
1623 AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf",
1624 [The displayed name of gpgconf])
1626 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
1628 AC_DEFINE_UNQUOTED(GPG_AGENT_SOCK_NAME, "S.gpg-agent",
1629 [The name of the agent socket])
1630 AC_DEFINE_UNQUOTED(GPG_AGENT_SSH_SOCK_NAME, "S.gpg-agent.ssh",
1631 [The name of the agent socket for ssh])
1632 AC_DEFINE_UNQUOTED(DIRMNGR_INFO_NAME, "DIRMNGR_INFO",
1633 [The name of the dirmngr info envvar])
1634 AC_DEFINE_UNQUOTED(SCDAEMON_SOCK_NAME, "S.scdaemon",
1635 [The name of the SCdaemon socket])
1636 AC_DEFINE_UNQUOTED(DIRMNGR_SOCK_NAME, "S.dirmngr",
1637 [The name of the dirmngr socket])
1639 AC_DEFINE_UNQUOTED(GPGEXT_GPG, "gpg", [The standard binary file suffix])
1641 if test "$have_w32_system" = yes; then
1642 AC_DEFINE_UNQUOTED(GNUPG_REGISTRY_DIR, "\\\\Software\\\\GNU\\\\GnuPG",
1643 [The directory part of the W32 registry keys])
1648 # Provide information about the build.
1650 BUILD_REVISION="mym4_revision"
1651 AC_SUBST(BUILD_REVISION)
1652 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
1653 [GIT commit id revision used to build this package])
1656 BUILD_VERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./'`
1658 BUILD_VERSION="${BUILD_VERSION}mym4_revision_dec"
1659 BUILD_FILEVERSION=`echo "${BUILD_VERSION}" | tr . ,`
1660 AC_SUBST(BUILD_VERSION)
1661 AC_SUBST(BUILD_FILEVERSION)
1663 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
1664 AC_SUBST(BUILD_TIMESTAMP)
1665 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
1666 [The time this package was configured for a build])
1667 BUILD_HOSTNAME="$ac_hostname"
1668 AC_SUBST(BUILD_HOSTNAME)
1672 # Print errors here so that they are visible all
1673 # together and the user can acquire them all together.
1676 if test "$have_gpg_error" = "no"; then
1680 *** You need libgpg-error to build this program.
1681 ** This library is for example available at
1682 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
1683 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1686 if test "$have_libgcrypt" = "no"; then
1690 *** You need libgcrypt to build this program.
1691 ** This library is for example available at
1692 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1693 *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API) is required.)
1696 if test "$have_libassuan" = "no"; then
1700 *** You need libassuan to build this program.
1701 *** This library is for example available at
1702 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
1703 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1706 if test "$have_ksba" = "no"; then
1710 *** You need libksba to build this program.
1711 *** This library is for example available at
1712 *** ftp://ftp.gnupg.org/gcrypt/libksba/
1713 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1716 if test "$gnupg_have_ldap" = yes; then
1717 if test "$have_w32ce_system" = yes; then
1719 *** Note that CeGCC might be broken, a package fixing this is:
1720 *** http://files.kolab.org/local/windows-ce/
1721 *** source/wldap32_0.1-mingw32ce.orig.tar.gz
1722 *** binary/wldap32-ce-arm-dev_0.1-1_all.deb
1726 if test "$have_npth" = "no"; then
1730 *** It is now required to build with support for the
1731 *** New Portable Threads Library (nPth). Please install this
1732 *** library first. The library is for example available at
1733 *** ftp://ftp.gnupg.org/gcrypt/npth/
1734 *** (at least version $NEED_NPTH_VERSION (API $NEED_NPTH_API) is required).
1738 if test "$require_iconv" = yes; then
1739 if test "$am_func_iconv" != yes; then
1743 *** The system does not provide a working iconv function. Please
1744 *** install a suitable library; for example GNU Libiconv which is
1746 *** http://ftp.gnu.org/gnu/libiconv/
1751 if test "$die" = "yes"; then
1754 *** Required libraries not found. Please consult the above messages
1755 *** and install them before running configure again.
1761 AC_CONFIG_FILES([ m4/Makefile
1777 tests/openpgp/Makefile
1778 tests/pkits/Makefile
1779 g10/gpg.w32-manifest
1787 GnuPG v${VERSION} has been configured as follows:
1789 Revision: mym4_revision (mym4_revision_dec)
1790 Platform: $PRINTABLE_OS_NAME ($host)
1793 S/MIME: $build_gpgsm
1795 Smartcard: $build_scdaemon $build_scdaemon_extra
1797 Dirmngr: $build_dirmngr
1798 Gpgtar: $build_gpgtar
1800 Protect tool: $show_gnupg_protect_tool_pgm
1801 LDAP wrapper: $show_gnupg_dirmngr_ldap_pgm
1802 Default agent: $show_gnupg_agent_pgm
1803 Default pinentry: $show_gnupg_pinentry_pgm
1804 Default scdaemon: $show_gnupg_scdaemon_pgm
1805 Default dirmngr: $show_gnupg_dirmngr_pgm
1807 Dirmngr auto start: $dirmngr_auto_start
1808 Readline support: $gnupg_cv_have_readline
1809 LDAP support: $gnupg_have_ldap
1810 DNS SRV support: $use_dns_srv
1811 TLS support: $use_tls_library
1813 if test x"$use_regex" != xyes ; then
1815 Warning: No regular expression support available.
1816 OpenPGP trust signatures won't work.
1817 gpg-check-pattern will not be build.
1820 if test "x${gpg_config_script_warn}" != x; then
1822 Warning: Mismatches between the target platform and the
1823 to be used libraries have been detected for:
1824 ${gpg_config_script_warn}
1825 Please check above for more warning messages.