1 # configure.ac - for GnuPG 2.1
2 # Copyright (C) 1998-2012 Free Software Foundation, Inc.
3 # Copyright (C) 1998-2014 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.10"
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], [1])
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 # Note: For automake 1.13 add the option
83 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
89 # Some status variables.
107 dirmngr_auto_start=yes
111 GNUPG_BUILD_PROGRAM(gpg, yes)
112 GNUPG_BUILD_PROGRAM(gpgsm, yes)
113 GNUPG_BUILD_PROGRAM(agent, yes)
114 GNUPG_BUILD_PROGRAM(scdaemon, yes)
115 GNUPG_BUILD_PROGRAM(g13, yes)
116 GNUPG_BUILD_PROGRAM(dirmngr, yes)
117 GNUPG_BUILD_PROGRAM(tools, yes)
118 GNUPG_BUILD_PROGRAM(doc, yes)
119 GNUPG_BUILD_PROGRAM(symcryptrun, no)
120 GNUPG_BUILD_PROGRAM(gpgtar, yes)
125 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
126 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
127 [Name of this package for gettext])
128 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
129 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
130 [Bug report address])
131 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
132 [Required version of Libgcrypt])
133 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
134 [Required version of Libksba])
135 AC_DEFINE_UNQUOTED(NEED_NTBTLS_VERSION, "$NEED_NTBTLS_VERSION",
136 [Required version of NTBTLS])
140 # The default is to use the modules from this package and the few
141 # other packages in a standard place; i.e where this package gets
142 # installed. With these options it is possible to override these
143 # ${prefix} depended values with fixed paths, which can't be replaced
144 # at make time. See also am/cmacros.am and the defaults in AH_BOTTOM.
145 AC_ARG_WITH(agent-pgm,
146 [ --with-agent-pgm=PATH Use PATH as the default for the agent)],
147 GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
148 AC_SUBST(GNUPG_AGENT_PGM)
149 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
150 show_gnupg_agent_pgm="(default)"
151 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
153 AC_ARG_WITH(pinentry-pgm,
154 [ --with-pinentry-pgm=PATH Use PATH as the default for the pinentry)],
155 GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
156 AC_SUBST(GNUPG_PINENTRY_PGM)
157 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
158 show_gnupg_pinentry_pgm="(default)"
159 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
162 AC_ARG_WITH(scdaemon-pgm,
163 [ --with-scdaemon-pgm=PATH Use PATH as the default for the scdaemon)],
164 GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
165 AC_SUBST(GNUPG_SCDAEMON_PGM)
166 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
167 show_gnupg_scdaemon_pgm="(default)"
168 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
171 AC_ARG_WITH(dirmngr-pgm,
172 [ --with-dirmngr-pgm=PATH Use PATH as the default for the dirmngr)],
173 GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
174 AC_SUBST(GNUPG_DIRMNGR_PGM)
175 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
176 show_gnupg_dirmngr_pgm="(default)"
177 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
179 AC_ARG_WITH(protect-tool-pgm,
180 [ --with-protect-tool-pgm=PATH Use PATH as the default for the protect-tool)],
181 GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
182 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
183 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
184 show_gnupg_protect_tool_pgm="(default)"
185 test -n "$GNUPG_PROTECT_TOOL_PGM" \
186 && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
188 AC_ARG_WITH(dirmngr-ldap-pgm,
189 [ --with-dirmngr-ldap-pgm=PATH Use PATH as the default for the dirmnge ldap wrapper)],
190 GNUPG_DIRMNGR_LDAP_PGM="$withval", GNUPG_DIRMNGR_LDAP_PGM="" )
191 AC_SUBST(GNUPG_DIRMNGR_LDAP_PGM)
192 AM_CONDITIONAL(GNUPG_DIRMNGR_LDAP_PGM, test -n "$GNUPG_DIRMNGR_LDAP_PGM")
193 show_gnupg_dirmngr_ldap_pgm="(default)"
194 test -n "$GNUPG_DIRMNGR_LDAP_PGM" \
195 && show_gnupg_dirmngr_ldap_pgm="$GNUPG_DIRMNGR_LDAP_PGM"
198 # On some platforms gpg2 is usually installed as gpg without using a
199 # symlink. For correct operation of gpgconf it needs to know the
200 # installed name of gpg. This option sets "gpg2"'s installed name to
201 # just "gpg". Note that it might be required to rename gpg2 to gpg
202 # manually after the build process.
204 AC_ARG_ENABLE(gpg2-is-gpg,
205 AC_HELP_STRING([--enable-gpg2-is-gpg],[Set installed name of gpg2 to gpg]),
206 gpg2_is_gpg=$enableval)
207 if test "$gpg2_is_gpg" = "yes"; then
208 name_of_installed_gpg=gpg
210 name_of_installed_gpg=gpg2
212 AC_DEFINE_UNQUOTED(NAME_OF_INSTALLED_GPG, "$name_of_installed_gpg",
213 [The name of the installed GPG tool])
216 # SELinux support includes tracking of sensitive files to avoid
217 # leaking their contents through processing these files by gpg itself
218 AC_MSG_CHECKING([whether SELinux support is requested])
219 AC_ARG_ENABLE(selinux-support,
220 AC_HELP_STRING([--enable-selinux-support],
221 [enable SELinux support]),
222 selinux_support=$enableval, selinux_support=no)
223 AC_MSG_RESULT($selinux_support)
226 AC_MSG_CHECKING([whether to allocate extra secure memory])
227 AC_ARG_ENABLE(large-secmem,
228 AC_HELP_STRING([--enable-large-secmem],
229 [allocate extra secure memory]),
230 large_secmem=$enableval, large_secmem=no)
231 AC_MSG_RESULT($large_secmem)
232 if test "$large_secmem" = yes ; then
233 SECMEM_BUFFER_SIZE=65536
235 SECMEM_BUFFER_SIZE=32768
237 AC_DEFINE_UNQUOTED(SECMEM_BUFFER_SIZE,$SECMEM_BUFFER_SIZE,
238 [Size of secure memory buffer])
240 AC_MSG_CHECKING([whether to enable trust models])
241 AC_ARG_ENABLE(trust-models,
242 AC_HELP_STRING([--disable-trust-models],
243 [disable all trust models except "always"]),
244 use_trust_models=$enableval)
245 AC_MSG_RESULT($use_trust_models)
246 if test "$use_trust_models" = no ; then
247 AC_DEFINE(NO_TRUST_MODELS, 1,
248 [Define to include only trust-model always])
253 # Options to disable algorithm
256 GNUPG_GPG_DISABLE_ALGO([rsa],[RSA public key])
257 # Elgamal is a MUST algorithm
258 # DSA is a MUST algorithm
259 GNUPG_GPG_DISABLE_ALGO([ecdh],[ECDH public key])
260 GNUPG_GPG_DISABLE_ALGO([ecdsa],[ECDSA public key])
261 GNUPG_GPG_DISABLE_ALGO([eddsa],[EdDSA public key])
263 GNUPG_GPG_DISABLE_ALGO([idea],[IDEA cipher])
264 # 3DES is a MUST algorithm
265 GNUPG_GPG_DISABLE_ALGO([cast5],[CAST5 cipher])
266 GNUPG_GPG_DISABLE_ALGO([blowfish],[BLOWFISH cipher])
267 GNUPG_GPG_DISABLE_ALGO([aes128],[AES128 cipher])
268 GNUPG_GPG_DISABLE_ALGO([aes192],[AES192 cipher])
269 GNUPG_GPG_DISABLE_ALGO([aes256],[AES256 cipher])
270 GNUPG_GPG_DISABLE_ALGO([twofish],[TWOFISH cipher])
271 GNUPG_GPG_DISABLE_ALGO([camellia128],[CAMELLIA128 cipher])
272 GNUPG_GPG_DISABLE_ALGO([camellia192],[CAMELLIA192 cipher])
273 GNUPG_GPG_DISABLE_ALGO([camellia256],[CAMELLIA256 cipher])
275 GNUPG_GPG_DISABLE_ALGO([md5],[MD5 hash])
276 # SHA1 is a MUST algorithm
277 GNUPG_GPG_DISABLE_ALGO([rmd160],[RIPE-MD160 hash])
278 GNUPG_GPG_DISABLE_ALGO([sha224],[SHA-224 hash])
279 # SHA256 is a MUST algorithm for GnuPG.
280 GNUPG_GPG_DISABLE_ALGO([sha384],[SHA-384 hash])
281 GNUPG_GPG_DISABLE_ALGO([sha512],[SHA-512 hash])
284 # Allow disabling of zip support.
285 # This is in general not a good idea because according to rfc4880 OpenPGP
286 # implementations SHOULD support ZLIB.
287 AC_MSG_CHECKING([whether to enable the ZIP and ZLIB compression algorithm])
289 AC_HELP_STRING([--disable-zip],
290 [disable the ZIP and ZLIB compression algorithm]),
292 AC_MSG_RESULT($use_zip)
294 # Allow disabling of bzib2 support.
295 # It is defined only after we confirm the library is available later
296 AC_MSG_CHECKING([whether to enable the BZIP2 compression algorithm])
298 AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
299 use_bzip2=$enableval)
300 AC_MSG_RESULT($use_bzip2)
302 # Configure option to allow or disallow execution of external
303 # programs, like a photo viewer.
304 AC_MSG_CHECKING([whether to enable external program execution])
306 AC_HELP_STRING([--disable-exec],[disable all external program execution]),
308 AC_MSG_RESULT($use_exec)
309 if test "$use_exec" = no ; then
310 AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
313 if test "$use_exec" = yes ; then
314 AC_MSG_CHECKING([whether to enable photo ID viewing])
315 AC_ARG_ENABLE(photo-viewers,
316 [ --disable-photo-viewers disable photo ID viewers],
317 [if test "$enableval" = no ; then
318 AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
320 gnupg_cv_enable_photo_viewers=$enableval
321 AC_MSG_RESULT($enableval)
323 if test "$gnupg_cv_enable_photo_viewers" = yes ; then
324 AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
325 AC_ARG_WITH(photo-viewer,
326 [ --with-photo-viewer=FIXED_VIEWER set a fixed photo ID viewer],
327 [if test "$withval" = yes ; then
329 elif test "$withval" != no ; then
330 AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
331 [if set, restrict photo-viewer to this])
333 AC_MSG_RESULT($withval)
339 # Check for the key/uid cache size. This can't be zero, but can be
340 # pretty small on embedded systems. This is used for the gpg part.
342 AC_MSG_CHECKING([for the size of the key and uid cache])
343 AC_ARG_ENABLE(key-cache,
344 AC_HELP_STRING([--enable-key-cache=SIZE],
345 [Set key cache to SIZE (default 4096)]),,enableval=4096)
346 if test "$enableval" = "no"; then
348 elif test "$enableval" = "yes" || test "$enableval" = ""; then
352 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
354 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
355 AC_MSG_ERROR([invalid key-cache size])
357 AC_MSG_RESULT($key_cache_size)
358 AC_DEFINE_UNQUOTED(PK_UID_CACHE_SIZE,$key_cache_size,
359 [Size of the key and UID caches])
364 # Check whether we want to use Linux capabilities
366 AC_MSG_CHECKING([whether use of capabilities is requested])
367 AC_ARG_WITH(capabilities,
368 [ --with-capabilities use linux capabilities [default=no]],
369 [use_capabilities="$withval"],[use_capabilities=no])
370 AC_MSG_RESULT($use_capabilities)
373 # Check whether to disable the card support
374 AC_MSG_CHECKING([whether smartcard support is requested])
375 AC_ARG_ENABLE(card-support,
376 AC_HELP_STRING([--disable-card-support],
377 [disable smartcard support]),
378 card_support=$enableval)
379 AC_MSG_RESULT($card_support)
380 if test "$card_support" = yes ; then
381 AC_DEFINE(ENABLE_CARD_SUPPORT,1,[Define to include smartcard support])
387 # Allow disabling of internal CCID support.
388 # It is defined only after we confirm the library is available later
390 AC_MSG_CHECKING([whether to enable the internal CCID driver])
391 AC_ARG_ENABLE(ccid-driver,
392 AC_HELP_STRING([--disable-ccid-driver],
393 [disable the internal CCID driver]),
394 use_ccid_driver=$enableval)
395 AC_MSG_RESULT($use_ccid_driver)
397 AC_MSG_CHECKING([whether to auto start dirmngr])
398 AC_ARG_ENABLE(dirmngr-auto-start,
399 AC_HELP_STRING([--disable-dirmngr-auto-start],
400 [disable auto starting of the dirmngr]),
401 dirmngr_auto_start=$enableval)
402 AC_MSG_RESULT($dirmngr_auto_start)
403 if test "$dirmngr_auto_start" = yes ; then
404 AC_DEFINE(USE_DIRMNGR_AUTO_START,1,
405 [Define to enable auto starting of the dirmngr])
410 # To avoid double inclusion of config.h which might happen at some
411 # places, we add the usual double inclusion protection at the top of
415 #ifndef GNUPG_CONFIG_H_INCLUDED
416 #define GNUPG_CONFIG_H_INCLUDED
420 # Stuff which goes at the bottom of config.h.
423 /* This is the major version number of GnuPG so that
424 source included files can test for this. Note, that
425 we use 2 here even for GnuPG 1.9.x. */
426 #define GNUPG_MAJOR_VERSION 2
428 /* Now to separate file name parts.
429 Please note that the string version must not contain more
430 than one character because the code assumes strlen()==1 */
431 #ifdef HAVE_DOSISH_SYSTEM
432 #define DIRSEP_C '\\'
433 #define DIRSEP_S "\\"
436 #define PATHSEP_C ';'
437 #define PATHSEP_S ";"
438 #define EXEEXT_S ".exe"
444 #define PATHSEP_C ':'
445 #define PATHSEP_S ":"
449 /* This is the same as VERSION, but should be overridden if the
450 platform cannot handle things like dots '.' in filenames. Set
451 SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
452 uses for dots and dashes. */
453 #define SAFE_VERSION VERSION
454 #define SAFE_VERSION_DOT '.'
455 #define SAFE_VERSION_DASH '-'
457 /* Some global constants. */
458 #ifdef HAVE_DOSISH_SYSTEM
459 # ifdef HAVE_DRIVE_LETTERS
460 # define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
462 # define GNUPG_DEFAULT_HOMEDIR "/gnupg"
465 #define GNUPG_DEFAULT_HOMEDIR "/SYS$LOGIN/gnupg"
467 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
469 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
470 #define GNUPG_OPENPGP_REVOC_DIR "openpgp-revocs.d"
472 /* For some systems (DOS currently), we hardcode the path here. For
473 POSIX systems the values are constructed by the Makefiles, so that
474 the values may be overridden by the make invocations; this is to
475 comply with the GNU coding standards. Note that these values are
477 #ifdef HAVE_DOSISH_SYSTEM
478 # ifdef HAVE_DRIVE_LETTERS
479 # define GNUPG_BINDIR "c:\\gnupg"
480 # define GNUPG_LIBEXECDIR "c:\\gnupg"
481 # define GNUPG_LIBDIR "c:\\gnupg"
482 # define GNUPG_DATADIR "c:\\gnupg"
483 # define GNUPG_SYSCONFDIR "c:\\gnupg"
485 # define GNUPG_BINDIR "\\gnupg"
486 # define GNUPG_LIBEXECDIR "\\gnupg"
487 # define GNUPG_LIBDIR "\\gnupg"
488 # define GNUPG_DATADIR "\\gnupg"
489 # define GNUPG_SYSCONFDIR "\\gnupg"
493 /* Derive some other constants. */
494 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
495 #define EXEC_TEMPFILE_ONLY
499 /* We didn't define endianness above, so get it from OS macros. This
500 is intended for making fat binary builds on OS X. */
501 #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST)
502 #if defined(__BIG_ENDIAN__)
503 #define BIG_ENDIAN_HOST 1
504 #elif defined(__LITTLE_ENDIAN__)
505 #define LITTLE_ENDIAN_HOST 1
507 #error "No endianness found"
512 /* Hack used for W32: ldap.m4 also tests for the ASCII version of
513 ldap_start_tls_s because that is the actual symbol used in the
514 library. winldap.h redefines it to our commonly used value,
515 thus we define our usual macro here. */
516 #ifdef HAVE_LDAP_START_TLS_SA
517 # ifndef HAVE_LDAP_START_TLS_S
518 # define HAVE_LDAP_START_TLS_S 1
522 /* Provide the es_ macro for estream. */
523 #define GPGRT_ENABLE_ES_MACROS 1
525 /* Tell libgcrypt not to use its own libgpg-error implementation. */
526 #define USE_LIBGPG_ERROR 1
528 /* Tell Libgcrypt not to include deprecated definitions. */
529 #define GCRYPT_NO_DEPRECATED 1
531 /* We use jnlib, so tell other modules about it. */
532 #define HAVE_JNLIB_LOGGING 1
534 /* Our HTTP code is used in estream mode. */
535 #define HTTP_USE_ESTREAM 1
537 /* Under W32 we do an explicit socket initialization, thus we need to
538 avoid the on-demand initialization which would also install an atexit
540 #define HTTP_NO_WSASTARTUP
542 /* Under Windows we use the gettext code from libgpg-error. */
543 #define GPG_ERR_ENABLE_GETTEXT_MACROS
545 /* Under WindowsCE we use the strerror replacement from libgpg-error. */
546 #define GPG_ERR_ENABLE_ERRNO_MACROS
548 #endif /*GNUPG_CONFIG_H_INCLUDED*/
553 AC_ARG_VAR(SYSROOT,[locate config scripts also below that directory])
555 # Checks for programs.
556 AC_MSG_NOTICE([checking for programs])
559 missing_dir=`cd $ac_aux_dir && pwd`
560 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
561 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
562 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
563 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
564 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
570 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
571 AC_MSG_ERROR([[No C-89 compiler found]])
576 AC_CHECK_TOOL(AR, ar, :)
577 AC_PATH_PROG(PERL,"perl")
578 AC_CHECK_TOOL(WINDRES, windres, :)
583 # We need to compile and run a program on the build machine. A
584 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
585 # the AC archive is broken for autoconf 2.57. Given that there is no
586 # newer version of that macro, we assume that it is also broken for
587 # autoconf 2.61 and thus we use a simple but usually sufficient
589 AC_MSG_CHECKING(for cc for build)
590 if test "$cross_compiling" = "yes"; then
591 CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
593 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
595 AC_MSG_RESULT($CC_FOR_BUILD)
596 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
602 have_dosish_system=no
605 have_android_system=no
607 use_simple_gettext=no
612 # special stuff for Windoze NT
613 ac_cv_have_dev_random=no
614 AC_DEFINE(USE_ONLY_8DOT3,1,
615 [Set this to limit filenames to the 8.3 format])
616 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
617 [Because the Unix gettext has too much overhead on
618 MingW32 systems and these systems lack Posix functions,
619 we use a simplified version of gettext])
620 have_dosish_system=yes
623 use_ldapwrapper=no # Fixme: Do this only for CE.
626 have_w32ce_system=yes
629 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
630 [Defined if the OS supports drive letters.])
634 use_simple_gettext=yes
637 i?86-emx-os2 | i?86-*-os2*emx )
638 # OS/2 with the EMX environment
639 ac_cv_have_dev_random=no
640 AC_DEFINE(HAVE_DRIVE_LETTERS)
641 have_dosish_system=yes
646 # DOS with the DJGPP environment
647 ac_cv_have_dev_random=no
648 AC_DEFINE(HAVE_DRIVE_LETTERS)
649 have_dosish_system=yes
654 if test -z "$GCC" ; then
655 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
659 if test -z "$GCC" ; then
660 # Suppress all warnings
661 # to get rid of the unsigned/signed char mismatch warnings.
666 if test -z "$GCC" ; then
667 # Use the newer compiler `-msg_disable ptrmismatch1' to
668 # get rid of the unsigned/signed char mismatch warnings.
669 # Using this may hide other pointer mismatch warnings, but
670 # it at least lets other warning classes through
671 CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
677 have_android_system=yes
678 # Android is fully utf-8 and we do not want to use iconv to
679 # keeps things simple
687 if test "$have_dosish_system" = yes; then
688 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
689 [Defined if we run on some of the PCDOS like systems
690 (DOS, Windoze. OS/2) with special properties like
691 no file modes, case insensitive file names and preferred
692 use of backslashes as directory name separators.])
694 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
696 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
698 if test "$have_w32_system" = yes; then
699 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
700 if test "$have_w32ce_system" = yes; then
701 AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
704 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
705 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
707 if test "$have_android_system" = yes; then
708 AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
710 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
712 if test "$run_tests" = yes; then
713 AC_DEFINE(RUN_TESTS,1, [Defined if we should run the tests])
715 AM_CONDITIONAL(RUN_TESTS, test "$run_tests" = yes)
718 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
719 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
723 # Checks for libraries.
725 AC_MSG_NOTICE([checking for libraries])
729 # libgpg-error is a library with error codes shared between GnuPG
732 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
733 have_gpg_error=yes,have_gpg_error=no)
737 # Libgcrypt is our generic crypto library
739 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
740 have_libgcrypt=yes,have_libgcrypt=no)
744 # libassuan is used for IPC
746 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
747 have_libassuan=yes,have_libassuan=no)
748 if test "$have_libassuan" = "yes"; then
749 AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
750 [version of the libassuan library])
756 # libksba is our X.509 support library
758 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
762 # libusb allows us to use the integrated CCID smartcard reader driver.
764 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
765 if test "$use_ccid_driver" = yes ; then
766 AC_CHECK_LIB(usb, usb_bulk_write,
767 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
768 AC_DEFINE(HAVE_LIBUSB,1,
769 [defined if libusb is available])
772 AC_CHECK_FUNCS(usb_create_match)
774 AC_SUBST(LIBUSB_LIBS)
777 # Check wether it is necessary to link against libdl.
778 # (For example to load libpcsclite)
780 gnupg_dlopen_save_libs="$LIBS"
782 AC_SEARCH_LIBS(dlopen, c dl,,,)
785 LIBS="$gnupg_dlopen_save_libs"
789 AC_PATH_PROG(ENCFS, encfs, /usr/bin/encfs)
790 AC_DEFINE_UNQUOTED(ENCFS,
791 "${ENCFS}", [defines the filename of the encfs program])
793 AC_PATH_PROG(FUSERMOUNT, fusermount, /usr/bin/fusermount)
794 AC_DEFINE_UNQUOTED(FUSERMOUNT,
795 "${FUSERMOUNT}", [defines the filename of the fusermount program])
802 # Checks for symcryptrun:
805 # libutil has openpty() and login_tty().
806 AC_CHECK_LIB(util, openpty,
807 [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
808 AC_DEFINE(HAVE_LIBUTIL,1,
809 [defined if libutil is available])
811 AC_SUBST(LIBUTIL_LIBS)
813 # shred is used to clean temporary plain text files.
814 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
815 AC_DEFINE_UNQUOTED(SHRED,
816 "${SHRED}", [defines the filename of the shred program])
820 # Check whether the nPth library is available
822 AM_PATH_NPTH("$NEED_NPTH_API:$NEED_NPTH_VERSION",have_npth=yes,have_npth=no)
823 if test "$have_npth" = "yes"; then
824 AC_DEFINE(HAVE_NPTH, 1,
825 [Defined if the New Portable Thread Library is available])
826 AC_DEFINE(USE_NPTH, 1,
827 [Defined if support for nPth is requested and nPth is available])
831 *** To support concurrent access for example in gpg-agent and the SCdaemon
832 *** we need the support of the New Portable Threads Library.
838 # NTBTLS is our TLS library. If it is not available fallback to
841 AC_ARG_ENABLE(ntbtls,
842 AC_HELP_STRING([--disable-ntbtls],
843 [disable the use of NTBTLS as TLS library]),
844 try_ntbtls=$enableval, try_ntbtls=yes)
845 if test x"$try_ntbtls" = xyes ; then
846 AM_PATH_NTBTLS("$NEED_NTBTLS_API:$NEED_NTBTLS_VERSION",
847 [have_ntbtls=yes],[have_ntbtls=no])
849 if test "$have_ntbtls" = yes ; then
850 use_tls_library=ntbtls
851 AC_DEFINE(HTTP_USE_NTBTLS, 1, [Enable NTBTLS support in http.c])
853 AC_ARG_ENABLE(gnutls,
854 AC_HELP_STRING([--disable-gnutls],
855 [disable GNUTLS as fallback TLS library]),
856 try_gnutls=$enableval, try_gnutls=yes)
857 if test x"$try_gnutls" = xyes ; then
858 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= $NEED_GNUTLS_VERSION],
862 if test "$have_gnutls" = "yes"; then
863 AC_SUBST([LIBGNUTLS_CFLAGS])
864 AC_SUBST([LIBGNUTLS_LIBS])
865 use_tls_library=gnutls
866 AC_DEFINE(HTTP_USE_GNUTLS, 1, [Enable GNUTLS support in http.c])
868 tmp=$(echo "$LIBGNUTLS_PKG_ERRORS" | tr '\n' '\v' | sed 's/\v/\n*** /g')
871 *** Building without NTBTLS and GNUTLS - no TLS access to keyservers.
878 AC_MSG_NOTICE([checking for networking options])
881 # Must check for network library requirements before doing link tests
882 # for ldap, for example. If ldap libs are static (or dynamic and without
883 # ELF runtime link paths), then link will fail and LDAP support won't
886 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
887 [NETLIBS="-lnsl $NETLIBS"]))
888 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
889 [NETLIBS="-lsocket $NETLIBS"]))
895 _cppflags="${CPPFLAGS}"
896 _ldflags="${LDFLAGS}"
898 AC_HELP_STRING([--with-adns=DIR],
899 [look for the adns library in DIR]),
900 [if test -d "$withval"; then
901 CPPFLAGS="${CPPFLAGS} -I$withval/include"
902 LDFLAGS="${LDFLAGS} -L$withval/lib"
904 if test "$with_adns" != "no"; then
905 AC_CHECK_HEADERS(adns.h,
906 AC_CHECK_LIB(adns, adns_free,
908 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),
909 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
911 if test "$have_adns" = "yes"; then
917 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
919 AC_ARG_ENABLE(dns-srv,
920 AC_HELP_STRING([--disable-dns-srv],
921 [disable the use of DNS SRV in HKP and HTTP]),
922 use_dns_srv=$enableval,use_dns_srv=yes)
924 AC_ARG_ENABLE(dns-pka,
925 AC_HELP_STRING([--disable-dns-pka],
926 [disable the use of PKA records in DNS]),
927 use_dns_pka=$enableval,use_dns_pka=yes)
929 AC_ARG_ENABLE(dns-cert,
930 AC_HELP_STRING([--disable-dns-cert],
931 [disable the use of CERT records in DNS]),
932 use_dns_cert=$enableval,use_dns_cert=yes)
934 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
935 || test x"$use_dns_cert" = xyes; then
938 # the double underscore thing is a glibc-ism?
939 AC_SEARCH_LIBS(res_query,resolv bind,,
940 AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
941 AC_SEARCH_LIBS(dn_expand,resolv bind,,
942 AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
943 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
944 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
946 if test x"$have_resolver" != xno ; then
948 # Make sure that the BIND 4 resolver interface is workable before
949 # enabling any code that calls it. At some point I'll rewrite the
950 # code to use the BIND 8 resolver API.
951 # We might also want to use adns instead. Problem with ADNS is that
952 # it does not support v6.
954 AC_MSG_CHECKING([whether the resolver is usable])
955 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
956 #include <netinet/in.h>
957 #include <arpa/nameser.h>
958 #include <resolv.h>]],
959 [[unsigned char answer[PACKETSZ];
960 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
962 dn_expand(0,0,0,0,0);
963 ]])],have_resolver=yes,have_resolver=no)
964 AC_MSG_RESULT($have_resolver)
966 # This is Apple-specific and somewhat bizarre as they changed the
967 # define in bind 8 for some reason.
969 if test x"$have_resolver" != xyes ; then
971 [whether I can make the resolver usable with BIND_8_COMPAT])
972 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define BIND_8_COMPAT
973 #include <sys/types.h>
974 #include <netinet/in.h>
975 #include <arpa/nameser.h>
976 #include <resolv.h>]],
977 [[unsigned char answer[PACKETSZ];
978 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
979 dn_skipname(0,0); dn_expand(0,0,0,0,0);
980 ]])],[have_resolver=yes ; need_compat=yes])
981 AC_MSG_RESULT($have_resolver)
985 if test x"$have_resolver" = xyes ; then
988 if test x"$use_dns_srv" = xyes ; then
989 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
992 if test x"$use_dns_pka" = xyes ; then
993 AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
996 if test x"$use_dns_cert" = xyes ; then
997 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1000 if test x"$need_compat" = xyes ; then
1001 AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
1004 # If we have no resolver library but ADNS (e.g. under W32) enable the
1005 # code parts which can be used with ADNS.
1006 if test x"$have_adns" = xyes ; then
1008 AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
1010 if test x"$use_dns_srv" = xyes ; then
1011 AC_DEFINE(USE_DNS_SRV,1)
1014 if test x"$use_dns_pka" = xyes ; then
1015 AC_DEFINE(USE_DNS_PKA,1)
1018 if test x"$use_dns_cert" = xyes ; then
1019 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1028 LIBS=$_dns_save_libs
1033 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
1039 # Note that running the check changes the variable
1040 # gnupg_have_ldap from "n/a" to "no" or "yes".
1043 AC_HELP_STRING([--disable-ldap],[disable LDAP support]),
1044 [if test "$enableval" = "no"; then gnupg_have_ldap=no; fi])
1046 if test "$gnupg_have_ldap" != "no" ; then
1047 if test "$build_dirmngr" = "yes" ; then
1048 GNUPG_CHECK_LDAP($NETLIBS)
1049 AC_CHECK_LIB(lber, ber_free,
1050 [ LBER_LIBS="$LBER_LIBS -llber"
1051 AC_DEFINE(HAVE_LBER,1,
1052 [defined if liblber is available])
1058 if test "$gnupg_have_ldap" = "no"; then
1061 *** Building without LDAP support.
1062 *** No CRL access or X.509 certificate search available.
1066 AM_CONDITIONAL(USE_LDAP, [test "$gnupg_have_ldap" = yes])
1067 if test "$gnupg_have_ldap" = yes ; then
1068 AC_DEFINE(USE_LDAP,1,[Defined if LDAP is support])
1073 if test "$use_ldapwrapper" = yes; then
1074 AC_DEFINE(USE_LDAPWRAPPER,1, [Build dirmngr with LDAP wrapper process])
1076 AM_CONDITIONAL(USE_LDAPWRAPPER, test "$use_ldapwrapper" = yes)
1082 # Check for sendmail
1084 # This isn't necessarily sendmail itself, but anything that gives a
1085 # sendmail-ish interface to the outside world. That includes Exim,
1086 # Postfix, etc. Basically, anything that can handle "sendmail -t".
1087 AC_ARG_WITH(mailprog,
1088 AC_HELP_STRING([--with-mailprog=NAME],
1089 [use "NAME -t" for mail transport]),
1091 if test x"$with_mailprog" = xyes ; then
1092 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
1093 elif test x"$with_mailprog" != xno ; then
1094 AC_MSG_CHECKING([for a mail transport program])
1095 AC_SUBST(SENDMAIL,$with_mailprog)
1096 AC_MSG_RESULT($with_mailprog)
1101 # Construct a printable name of the OS
1105 PRINTABLE_OS_NAME="W32CE"
1108 PRINTABLE_OS_NAME="MingW32"
1111 PRINTABLE_OS_NAME="Cygwin"
1113 i?86-emx-os2 | i?86-*-os2*emx )
1114 PRINTABLE_OS_NAME="OS/2"
1117 PRINTABLE_OS_NAME="MSDOS/DJGPP"
1121 PRINTABLE_OS_NAME="GNU/Linux"
1124 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
1127 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
1128 [A human readable text with the name of the OS])
1132 # Checking for iconv
1134 if test "$require_iconv" = yes; then
1140 AC_SUBST(LTLIBICONV)
1147 # This is "GNU gnupg" - The project-id script from gettext
1150 AC_MSG_NOTICE([checking for gettext])
1152 AM_GNU_GETTEXT_VERSION([0.17])
1153 if test "$try_gettext" = yes; then
1154 AM_GNU_GETTEXT([external],[need-ngettext])
1156 # gettext requires some extra checks. These really should be part of
1157 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
1158 # function checks to here.
1160 AC_CHECK_FUNCS(strchr)
1163 USE_INCLUDED_LIBINTL=no
1164 BUILD_INCLUDED_LIBINTL=no
1167 AC_SUBST(USE_INCLUDED_LIBINTL)
1168 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1172 # We use HAVE_LANGINFO_CODESET in a couple of places.
1175 # Checks required for our use of locales
1182 if test "$selinux_support" = yes ; then
1183 AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1188 # Checks for header files.
1190 AC_MSG_NOTICE([checking for header files])
1192 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
1193 pty.h utmp.h pwd.h inttypes.h signal.h sys/select.h])
1198 # Checks for typedefs, structures, and compiler characteristics.
1200 AC_MSG_NOTICE([checking for system characteristics])
1209 gl_HEADER_SYS_SOCKET
1212 AC_SEARCH_LIBS([inet_addr], [nsl])
1214 AC_ARG_ENABLE(endian-check,
1215 AC_HELP_STRING([--disable-endian-check],
1216 [disable the endian check and trust the OS provided macros]),
1217 endiancheck=$enableval,endiancheck=yes)
1219 if test x"$endiancheck" = xyes ; then
1223 # fixme: we should get rid of the byte type
1224 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
1225 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
1226 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
1227 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
1228 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
1230 AC_CHECK_SIZEOF(unsigned short)
1231 AC_CHECK_SIZEOF(unsigned int)
1232 AC_CHECK_SIZEOF(unsigned long)
1233 AC_CHECK_SIZEOF(unsigned long long)
1235 AC_CHECK_SIZEOF(time_t,,[[
1237 #if TIME_WITH_SYS_TIME
1238 # include <sys/time.h>
1241 # if HAVE_SYS_TIME_H
1242 # include <sys/time.h>
1248 GNUPG_TIME_T_UNSIGNED
1251 if test "$ac_cv_sizeof_unsigned_short" = "0" \
1252 || test "$ac_cv_sizeof_unsigned_int" = "0" \
1253 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
1254 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
1259 # Checks for library functions.
1261 AC_MSG_NOTICE([checking for library functions])
1262 AC_CHECK_DECLS(getpagesize)
1266 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
1267 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
1268 AC_CHECK_FUNCS([setenv unsetenv fcntl ftruncate inet_ntop])
1269 AC_CHECK_FUNCS([canonicalize_file_name])
1270 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
1271 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
1272 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
1273 AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat])
1275 if test "$have_android_system" = yes; then
1276 # On Android ttyname is a stub but prints an error message.
1277 AC_DEFINE(HAVE_BROKEN_TTYNAME,1,
1278 [Defined if ttyname does not work properly])
1281 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1283 # Dirmngr requires mmap on Unix systems.
1284 if test $ac_cv_func_mmap != yes -a $mmap_needed = yes; then
1285 AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]])
1289 # These are needed by the jnlib parts in common.
1290 # Note: We already checked pwd.h.
1291 AC_CHECK_HEADERS([signal.h])
1292 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
1293 memrchr isascii timegm getrusage setrlimit stat setlocale \
1294 flockfile funlockfile fopencookie funopen getpwnam getpwuid \
1295 getenv inet_pton strpbrk])
1302 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1305 # Sanity check regex. Tests adapted from mutt.
1307 AC_MSG_CHECKING([whether regular expression support is requested])
1308 AC_ARG_ENABLE(regex,
1309 AC_HELP_STRING([--disable-regex],
1310 [do not handle regular expressions in trust signatures]),
1311 use_regex=$enableval, use_regex=yes)
1312 AC_MSG_RESULT($use_regex)
1314 if test "$use_regex" = yes ; then
1315 _cppflags="${CPPFLAGS}"
1316 _ldflags="${LDFLAGS}"
1318 AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1320 if test -d "$withval" ; then
1321 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1322 LDFLAGS="${LDFLAGS} -L$withval/lib"
1326 # Does the system have regex functions at all?
1327 AC_SEARCH_LIBS([regcomp], [regex])
1328 AC_CHECK_FUNC(regcomp, gnupg_cv_have_regex=yes, gnupg_cv_have_regex=no)
1330 if test $gnupg_cv_have_regex = no; then
1333 if test x"$cross_compiling" = xyes; then
1334 AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1336 AC_CACHE_CHECK([whether your system's regexp library is broken],
1337 [gnupg_cv_regex_broken],
1341 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); }],
1342 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1344 if test $gnupg_cv_regex_broken = yes; then
1345 AC_MSG_WARN([your regex is broken - disabling regex use])
1350 CPPFLAGS="${_cppflags}"
1351 LDFLAGS="${_ldflags}"
1354 if test "$use_regex" != yes ; then
1355 AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1357 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1362 # Do we have zlib? Must do it here because Solaris failed
1363 # when compiling a conftest (due to the "-lz" from LIBS).
1364 # Note that we combine zlib and bzlib2 in ZLIBS.
1366 if test "$use_zip" = yes ; then
1367 _cppflags="${CPPFLAGS}"
1368 _ldflags="${LDFLAGS}"
1370 [ --with-zlib=DIR use libz in DIR],[
1371 if test -d "$withval"; then
1372 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1373 LDFLAGS="${LDFLAGS} -L$withval/lib"
1377 AC_CHECK_HEADER(zlib.h,
1378 AC_CHECK_LIB(z, deflateInit2_,
1381 AC_DEFINE(HAVE_ZIP,1, [Defined if ZIP and ZLIB are supported])
1383 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1384 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1389 # Check whether we can support bzip2
1391 if test "$use_bzip2" = yes ; then
1392 _cppflags="${CPPFLAGS}"
1393 _ldflags="${LDFLAGS}"
1395 AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1397 if test -d "$withval" ; then
1398 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1399 LDFLAGS="${LDFLAGS} -L$withval/lib"
1403 # Checking alongside stdio.h as an early version of bzip2 (1.0)
1404 # required stdio.h to be included before bzlib.h, and Solaris 9 is
1405 # woefully out of date.
1406 if test "$withval" != no ; then
1407 AC_CHECK_HEADER(bzlib.h,
1408 AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1411 ZLIBS="$ZLIBS -lbz2"
1412 AC_DEFINE(HAVE_BZIP2,1,
1413 [Defined if the bz2 compression library is available])
1415 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1416 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1419 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1423 # Check for readline support
1424 GNUPG_CHECK_READLINE
1427 if test "$development_version" = yes; then
1428 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1429 [Defined if this is not a regular release])
1432 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1436 # Add some extra libs here so that previous tests don't fail for
1437 # mysterious reasons - the final link step should bail out.
1438 # W32SOCKLIBS is also defined so that if can be used for tools not
1439 # requiring any network stuff but linking to code in libcommon which
1440 # tracks in winsock stuff (e.g. init_common_subsystems).
1441 if test "$have_w32_system" = yes; then
1442 if test "$have_w32ce_system" = yes; then
1445 W32SOCKLIBS="-lws2_32"
1447 NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1451 AC_SUBST(W32SOCKLIBS)
1454 # Setup gcc specific options
1456 AC_MSG_NOTICE([checking for cc features])
1457 if test "$GCC" = yes; then
1458 # Check whether gcc does not emit a diagnositc for unknow -Wno-*
1459 # options. This is the case for gcc >= 4.6
1460 AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
1461 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1462 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
1464 #endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
1465 AC_MSG_RESULT($_gcc_silent_wno)
1467 # Note that it is okay to use CFLAGS here because these are just
1468 # warning options and the user should have a chance of overriding
1470 if test "$USE_MAINTAINER_MODE" = "yes"; then
1471 CFLAGS="$CFLAGS -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1472 CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1473 if test x"$_gcc_silent_wno" = xyes ; then
1476 AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1477 _gcc_cflags_save=$CFLAGS
1478 CFLAGS="-Wno-missing-field-initializers"
1479 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1480 [_gcc_wopt=yes],[_gcc_wopt=no])
1481 AC_MSG_RESULT($_gcc_wopt)
1482 CFLAGS=$_gcc_cflags_save;
1484 if test x"$_gcc_wopt" = xyes ; then
1485 CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
1488 AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
1489 _gcc_cflags_save=$CFLAGS
1490 CFLAGS="-Wdeclaration-after-statement"
1491 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1492 AC_MSG_RESULT($_gcc_wopt)
1493 CFLAGS=$_gcc_cflags_save;
1494 if test x"$_gcc_wopt" = xyes ; then
1495 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1498 CFLAGS="$CFLAGS -Wall"
1501 if test x"$_gcc_silent_wno" = xyes ; then
1504 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1505 _gcc_cflags_save=$CFLAGS
1506 CFLAGS="-Wno-pointer-sign"
1507 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1508 [_gcc_psign=yes],[_gcc_psign=no])
1509 AC_MSG_RESULT($_gcc_psign)
1510 CFLAGS=$_gcc_cflags_save;
1512 if test x"$_gcc_psign" = xyes ; then
1513 CFLAGS="$CFLAGS -Wno-pointer-sign"
1516 AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1517 _gcc_cflags_save=$CFLAGS
1518 CFLAGS="-Wpointer-arith"
1519 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
1520 AC_MSG_RESULT($_gcc_psign)
1521 CFLAGS=$_gcc_cflags_save;
1522 if test x"$_gcc_psign" = xyes ; then
1523 CFLAGS="$CFLAGS -Wpointer-arith"
1529 # This is handy for debugging so the compiler doesn't rearrange
1530 # things and eliminate variables.
1532 AC_ARG_ENABLE(optimization,
1533 AC_HELP_STRING([--disable-optimization],
1534 [disable compiler optimization]),
1535 [if test $enableval = no ; then
1536 CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
1540 # Decide what to build
1543 build_scdaemon_extra=""
1544 if test "$build_scdaemon" = "yes"; then
1545 if test $have_libusb = no; then
1546 build_scdaemon_extra="without internal CCID driver"
1548 if test -n "$build_scdaemon_extra"; then
1549 build_scdaemon_extra="(${build_scdaemon_extra})"
1555 # Set variables for use by automake makefiles.
1557 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
1558 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1559 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1560 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1561 AM_CONDITIONAL(BUILD_G13, test "$build_g13" = "yes")
1562 AM_CONDITIONAL(BUILD_DIRMNGR, test "$build_dirmngr" = "yes")
1563 AM_CONDITIONAL(BUILD_TOOLS, test "$build_tools" = "yes")
1564 AM_CONDITIONAL(BUILD_DOC, test "$build_doc" = "yes")
1565 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1566 AM_CONDITIONAL(BUILD_GPGTAR, test "$build_gpgtar" = "yes")
1568 AM_CONDITIONAL(ENABLE_CARD_SUPPORT, test "$card_support" = yes)
1569 AM_CONDITIONAL(NO_TRUST_MODELS, test "$use_trust_models" = no)
1571 AM_CONDITIONAL(RUN_GPG_TESTS,
1572 test x$cross_compiling = xno -a "$build_gpg" = yes )
1575 # Set some defines for use gpgconf.
1577 if test "$build_gpg" = yes ; then
1578 AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build])
1580 if test "$build_gpgsm" = yes ; then
1581 AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build])
1583 if test "$build_agent" = yes ; then
1584 AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build])
1586 if test "$build_scdaemon" = yes ; then
1587 AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build])
1589 if test "$build_dirmngr" = yes ; then
1590 AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build])
1592 if test "$build_g13" = yes ; then
1593 AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build])
1598 # Define Name strings
1600 AC_DEFINE_UNQUOTED(GNUPG_NAME, "GnuPG", [The name of the project])
1602 AC_DEFINE_UNQUOTED(GPG_NAME, "gpg", [The name of the OpenPGP tool])
1603 AC_DEFINE_UNQUOTED(GPG_DISP_NAME, "GnuPG", [The displayed name of gpg])
1605 AC_DEFINE_UNQUOTED(GPGSM_NAME, "gpgsm", [The name of the S/MIME tool])
1606 AC_DEFINE_UNQUOTED(GPGSM_DISP_NAME, "GPGSM", [The displayed name of gpgsm])
1608 AC_DEFINE_UNQUOTED(GPG_AGENT_NAME, "gpg-agent", [The name of the agent])
1609 AC_DEFINE_UNQUOTED(GPG_AGENT_DISP_NAME, "GPG Agent",
1610 [The displayed name of gpg-agent])
1612 AC_DEFINE_UNQUOTED(SCDAEMON_NAME, "scdaemon", [The name of the scdaemon])
1613 AC_DEFINE_UNQUOTED(SCDAEMON_DISP_NAME, "SCDaemon",
1614 [The displayed name of scdaemon])
1616 AC_DEFINE_UNQUOTED(DIRMNGR_NAME, "dirmngr", [The name of the dirmngr])
1617 AC_DEFINE_UNQUOTED(DIRMNGR_DISP_NAME, "DirMngr",
1618 [The displayed name of dirmngr])
1620 AC_DEFINE_UNQUOTED(G13_NAME, "g13", [The name of the g13 tool])
1621 AC_DEFINE_UNQUOTED(G13_DISP_NAME, "G13", [The displayed name of g13])
1623 AC_DEFINE_UNQUOTED(GPGCONF_NAME, "gpgconf", [The name of the gpgconf tool])
1624 AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf",
1625 [The displayed name of gpgconf])
1627 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
1629 AC_DEFINE_UNQUOTED(GPG_AGENT_SOCK_NAME, "S.gpg-agent",
1630 [The name of the agent socket])
1631 AC_DEFINE_UNQUOTED(GPG_AGENT_SSH_SOCK_NAME, "S.gpg-agent.ssh",
1632 [The name of the agent socket for ssh])
1633 AC_DEFINE_UNQUOTED(DIRMNGR_INFO_NAME, "DIRMNGR_INFO",
1634 [The name of the dirmngr info envvar])
1635 AC_DEFINE_UNQUOTED(SCDAEMON_SOCK_NAME, "S.scdaemon",
1636 [The name of the SCdaemon socket])
1637 AC_DEFINE_UNQUOTED(DIRMNGR_SOCK_NAME, "S.dirmngr",
1638 [The name of the dirmngr socket])
1640 AC_DEFINE_UNQUOTED(GPGEXT_GPG, "gpg", [The standard binary file suffix])
1642 if test "$have_w32_system" = yes; then
1643 AC_DEFINE_UNQUOTED(GNUPG_REGISTRY_DIR, "\\\\Software\\\\GNU\\\\GnuPG",
1644 [The directory part of the W32 registry keys])
1649 # Provide information about the build.
1651 BUILD_REVISION="mym4_revision"
1652 AC_SUBST(BUILD_REVISION)
1653 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
1654 [GIT commit id revision used to build this package])
1657 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
1659 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
1660 AC_SUBST(BUILD_FILEVERSION)
1662 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
1663 AC_SUBST(BUILD_TIMESTAMP)
1664 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
1665 [The time this package was configured for a build])
1666 BUILD_HOSTNAME="$ac_hostname"
1667 AC_SUBST(BUILD_HOSTNAME)
1671 # Print errors here so that they are visible all
1672 # together and the user can acquire them all together.
1675 if test "$have_gpg_error" = "no"; then
1679 *** You need libgpg-error to build this program.
1680 ** This library is for example available at
1681 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
1682 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1685 if test "$have_libgcrypt" = "no"; then
1689 *** You need libgcrypt to build this program.
1690 ** This library is for example available at
1691 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1692 *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API) is required.)
1695 if test "$have_libassuan" = "no"; then
1699 *** You need libassuan to build this program.
1700 *** This library is for example available at
1701 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
1702 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1705 if test "$have_ksba" = "no"; then
1709 *** You need libksba to build this program.
1710 *** This library is for example available at
1711 *** ftp://ftp.gnupg.org/gcrypt/libksba/
1712 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1715 if test "$gnupg_have_ldap" = yes; then
1716 if test "$have_w32ce_system" = yes; then
1718 *** Note that CeGCC might be broken, a package fixing this is:
1719 *** http://files.kolab.org/local/windows-ce/
1720 *** source/wldap32_0.1-mingw32ce.orig.tar.gz
1721 *** binary/wldap32-ce-arm-dev_0.1-1_all.deb
1725 if test "$have_npth" = "no"; then
1729 *** It is now required to build with support for the
1730 *** New Portable Threads Library (nPth). Please install this
1731 *** library first. The library is for example available at
1732 *** ftp://ftp.gnupg.org/gcrypt/npth/
1733 *** (at least version $NEED_NPTH_VERSION (API $NEED_NPTH_API) is required).
1737 if test "$require_iconv" = yes; then
1738 if test "$am_func_iconv" != yes; then
1742 *** The system does not provide a working iconv function. Please
1743 *** install a suitable library; for example GNU Libiconv which is
1745 *** http://ftp.gnu.org/gnu/libiconv/
1750 if test "$die" = "yes"; then
1753 *** Required libraries not found. Please consult the above messages
1754 *** and install them before running configure again.
1760 AC_CONFIG_FILES([ m4/Makefile
1776 tests/openpgp/Makefile
1777 tests/pkits/Makefile
1785 GnuPG v${VERSION} has been configured as follows:
1787 Revision: mym4_revision (mym4_revision_dec)
1788 Platform: $PRINTABLE_OS_NAME ($host)
1791 S/MIME: $build_gpgsm
1793 Smartcard: $build_scdaemon $build_scdaemon_extra
1795 Dirmngr: $build_dirmngr
1796 Gpgtar: $build_gpgtar
1798 Protect tool: $show_gnupg_protect_tool_pgm
1799 LDAP wrapper: $show_gnupg_dirmngr_ldap_pgm
1800 Default agent: $show_gnupg_agent_pgm
1801 Default pinentry: $show_gnupg_pinentry_pgm
1802 Default scdaemon: $show_gnupg_scdaemon_pgm
1803 Default dirmngr: $show_gnupg_dirmngr_pgm
1805 Dirmngr auto start: $dirmngr_auto_start
1806 Readline support: $gnupg_cv_have_readline
1807 LDAP support: $gnupg_have_ldap
1808 DNS SRV support: $use_dns_srv
1809 TLS support: $use_tls_library
1811 if test x"$use_regex" != xyes ; then
1813 Warning: No regular expression support available.
1814 OpenPGP trust signatures won't work.
1815 gpg-check-pattern will not be build.
1818 if test "x${gpg_config_script_warn}" != x; then
1820 Warning: Mismatches between the target platform and the
1821 to be used libraries have been detected for:
1822 ${gpg_config_script_warn}
1823 Please check above for more warning messages.