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], [0])
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.15
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, :)
584 # We need to compile and run a program on the build machine. A
585 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
586 # the AC archive is broken for autoconf 2.57. Given that there is no
587 # newer version of that macro, we assume that it is also broken for
588 # autoconf 2.61 and thus we use a simple but usually sufficient
590 AC_MSG_CHECKING(for cc for build)
591 if test "$cross_compiling" = "yes"; then
592 CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
594 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
596 AC_MSG_RESULT($CC_FOR_BUILD)
597 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
603 have_dosish_system=no
606 have_android_system=no
608 use_simple_gettext=no
613 # special stuff for Windoze NT
614 ac_cv_have_dev_random=no
615 AC_DEFINE(USE_ONLY_8DOT3,1,
616 [Set this to limit filenames to the 8.3 format])
617 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
618 [Because the Unix gettext has too much overhead on
619 MingW32 systems and these systems lack Posix functions,
620 we use a simplified version of gettext])
621 have_dosish_system=yes
624 use_ldapwrapper=no # Fixme: Do this only for CE.
627 have_w32ce_system=yes
630 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
631 [Defined if the OS supports drive letters.])
635 use_simple_gettext=yes
638 i?86-emx-os2 | i?86-*-os2*emx )
639 # OS/2 with the EMX environment
640 ac_cv_have_dev_random=no
641 AC_DEFINE(HAVE_DRIVE_LETTERS)
642 have_dosish_system=yes
647 # DOS with the DJGPP environment
648 ac_cv_have_dev_random=no
649 AC_DEFINE(HAVE_DRIVE_LETTERS)
650 have_dosish_system=yes
655 if test -z "$GCC" ; then
656 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
660 if test -z "$GCC" ; then
661 # Suppress all warnings
662 # to get rid of the unsigned/signed char mismatch warnings.
667 if test -z "$GCC" ; then
668 # Use the newer compiler `-msg_disable ptrmismatch1' to
669 # get rid of the unsigned/signed char mismatch warnings.
670 # Using this may hide other pointer mismatch warnings, but
671 # it at least lets other warning classes through
672 CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
678 have_android_system=yes
679 # Android is fully utf-8 and we do not want to use iconv to
680 # keeps things simple
688 if test "$have_dosish_system" = yes; then
689 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
690 [Defined if we run on some of the PCDOS like systems
691 (DOS, Windoze. OS/2) with special properties like
692 no file modes, case insensitive file names and preferred
693 use of backslashes as directory name separators.])
695 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
697 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
699 if test "$have_w32_system" = yes; then
700 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
701 if test "$have_w32ce_system" = yes; then
702 AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
705 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
706 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
708 if test "$have_android_system" = yes; then
709 AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
711 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
713 if test "$run_tests" = yes; then
714 AC_DEFINE(RUN_TESTS,1, [Defined if we should run the tests])
716 AM_CONDITIONAL(RUN_TESTS, test "$run_tests" = yes)
719 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
720 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
724 # Checks for libraries.
726 AC_MSG_NOTICE([checking for libraries])
730 # libgpg-error is a library with error codes shared between GnuPG
733 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
734 have_gpg_error=yes,have_gpg_error=no)
738 # Libgcrypt is our generic crypto library
740 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
741 have_libgcrypt=yes,have_libgcrypt=no)
745 # libassuan is used for IPC
747 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
748 have_libassuan=yes,have_libassuan=no)
749 if test "$have_libassuan" = "yes"; then
750 AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
751 [version of the libassuan library])
757 # libksba is our X.509 support library
759 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
763 # libusb allows us to use the integrated CCID smartcard reader driver.
765 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
766 if test "$use_ccid_driver" = yes ; then
767 AC_CHECK_LIB(usb, usb_bulk_write,
768 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
769 AC_DEFINE(HAVE_LIBUSB,1,
770 [defined if libusb is available])
773 AC_CHECK_FUNCS(usb_create_match)
775 AC_SUBST(LIBUSB_LIBS)
778 # Check wether it is necessary to link against libdl.
779 # (For example to load libpcsclite)
781 gnupg_dlopen_save_libs="$LIBS"
783 AC_SEARCH_LIBS(dlopen, c dl,,,)
786 LIBS="$gnupg_dlopen_save_libs"
790 AC_PATH_PROG(ENCFS, encfs, /usr/bin/encfs)
791 AC_DEFINE_UNQUOTED(ENCFS,
792 "${ENCFS}", [defines the filename of the encfs program])
794 AC_PATH_PROG(FUSERMOUNT, fusermount, /usr/bin/fusermount)
795 AC_DEFINE_UNQUOTED(FUSERMOUNT,
796 "${FUSERMOUNT}", [defines the filename of the fusermount program])
803 # Checks for symcryptrun:
806 # libutil has openpty() and login_tty().
807 AC_CHECK_LIB(util, openpty,
808 [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
809 AC_DEFINE(HAVE_LIBUTIL,1,
810 [defined if libutil is available])
812 AC_SUBST(LIBUTIL_LIBS)
814 # shred is used to clean temporary plain text files.
815 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
816 AC_DEFINE_UNQUOTED(SHRED,
817 "${SHRED}", [defines the filename of the shred program])
821 # Check whether the nPth library is available
823 AM_PATH_NPTH("$NEED_NPTH_API:$NEED_NPTH_VERSION",have_npth=yes,have_npth=no)
824 if test "$have_npth" = "yes"; then
825 AC_DEFINE(HAVE_NPTH, 1,
826 [Defined if the New Portable Thread Library is available])
827 AC_DEFINE(USE_NPTH, 1,
828 [Defined if support for nPth is requested and nPth is available])
832 *** To support concurrent access for example in gpg-agent and the SCdaemon
833 *** we need the support of the New Portable Threads Library.
839 # NTBTLS is our TLS library. If it is not available fallback to
842 AC_ARG_ENABLE(ntbtls,
843 AC_HELP_STRING([--disable-ntbtls],
844 [disable the use of NTBTLS as TLS library]),
845 try_ntbtls=$enableval, try_ntbtls=yes)
846 if test x"$try_ntbtls" = xyes ; then
847 AM_PATH_NTBTLS("$NEED_NTBTLS_API:$NEED_NTBTLS_VERSION",
848 [have_ntbtls=yes],[have_ntbtls=no])
850 if test "$have_ntbtls" = yes ; then
851 use_tls_library=ntbtls
852 AC_DEFINE(HTTP_USE_NTBTLS, 1, [Enable NTBTLS support in http.c])
854 AC_ARG_ENABLE(gnutls,
855 AC_HELP_STRING([--disable-gnutls],
856 [disable GNUTLS as fallback TLS library]),
857 try_gnutls=$enableval, try_gnutls=yes)
858 if test x"$try_gnutls" = xyes ; then
859 PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= $NEED_GNUTLS_VERSION],
863 if test "$have_gnutls" = "yes"; then
864 AC_SUBST([LIBGNUTLS_CFLAGS])
865 AC_SUBST([LIBGNUTLS_LIBS])
866 use_tls_library=gnutls
867 AC_DEFINE(HTTP_USE_GNUTLS, 1, [Enable GNUTLS support in http.c])
869 tmp=$(echo "$LIBGNUTLS_PKG_ERRORS" | tr '\n' '\v' | sed 's/\v/\n*** /g')
872 *** Building without NTBTLS and GNUTLS - no TLS access to keyservers.
879 AC_MSG_NOTICE([checking for networking options])
882 # Must check for network library requirements before doing link tests
883 # for ldap, for example. If ldap libs are static (or dynamic and without
884 # ELF runtime link paths), then link will fail and LDAP support won't
887 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
888 [NETLIBS="-lnsl $NETLIBS"]))
889 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
890 [NETLIBS="-lsocket $NETLIBS"]))
896 _cppflags="${CPPFLAGS}"
897 _ldflags="${LDFLAGS}"
899 AC_HELP_STRING([--with-adns=DIR],
900 [look for the adns library in DIR]),
901 [if test -d "$withval"; then
902 CPPFLAGS="${CPPFLAGS} -I$withval/include"
903 LDFLAGS="${LDFLAGS} -L$withval/lib"
905 if test "$with_adns" != "no"; then
906 AC_CHECK_HEADERS(adns.h,
907 AC_CHECK_LIB(adns, adns_init,
909 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),
910 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
912 if test "$have_adns" = "yes"; then
916 # Newer adns versions feature a free function to be used under W32.
917 AC_CHECK_FUNCS(adns_free)
922 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
924 AC_ARG_ENABLE(dns-srv,
925 AC_HELP_STRING([--disable-dns-srv],
926 [disable the use of DNS SRV in HKP and HTTP]),
927 use_dns_srv=$enableval,use_dns_srv=yes)
929 AC_ARG_ENABLE(dns-pka,
930 AC_HELP_STRING([--disable-dns-pka],
931 [disable the use of PKA records in DNS]),
932 use_dns_pka=$enableval,use_dns_pka=yes)
934 AC_ARG_ENABLE(dns-cert,
935 AC_HELP_STRING([--disable-dns-cert],
936 [disable the use of CERT records in DNS]),
937 use_dns_cert=$enableval,use_dns_cert=yes)
939 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
940 || test x"$use_dns_cert" = xyes; then
943 # the double underscore thing is a glibc-ism?
944 AC_SEARCH_LIBS(res_query,resolv bind,,
945 AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
946 AC_SEARCH_LIBS(dn_expand,resolv bind,,
947 AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
948 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
949 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
951 if test x"$have_resolver" != xno ; then
953 # Make sure that the BIND 4 resolver interface is workable before
954 # enabling any code that calls it. At some point I'll rewrite the
955 # code to use the BIND 8 resolver API.
956 # We might also want to use adns instead. Problem with ADNS is that
957 # it does not support v6.
959 AC_MSG_CHECKING([whether the resolver is usable])
960 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
961 #include <netinet/in.h>
962 #include <arpa/nameser.h>
963 #include <resolv.h>]],
964 [[unsigned char answer[PACKETSZ];
965 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
967 dn_expand(0,0,0,0,0);
968 ]])],have_resolver=yes,have_resolver=no)
969 AC_MSG_RESULT($have_resolver)
971 # This is Apple-specific and somewhat bizarre as they changed the
972 # define in bind 8 for some reason.
974 if test x"$have_resolver" != xyes ; then
976 [whether I can make the resolver usable with BIND_8_COMPAT])
977 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define BIND_8_COMPAT
978 #include <sys/types.h>
979 #include <netinet/in.h>
980 #include <arpa/nameser.h>
981 #include <resolv.h>]],
982 [[unsigned char answer[PACKETSZ];
983 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
984 dn_skipname(0,0); dn_expand(0,0,0,0,0);
985 ]])],[have_resolver=yes ; need_compat=yes])
986 AC_MSG_RESULT($have_resolver)
990 if test x"$have_resolver" = xyes ; then
993 if test x"$use_dns_srv" = xyes ; then
994 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
997 if test x"$use_dns_pka" = xyes ; then
998 AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
1001 if test x"$use_dns_cert" = xyes ; then
1002 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1005 if test x"$need_compat" = xyes ; then
1006 AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
1009 # If we have no resolver library but ADNS (e.g. under W32) enable the
1010 # code parts which can be used with ADNS.
1011 if test x"$have_adns" = xyes ; then
1013 AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
1015 if test x"$use_dns_srv" = xyes ; then
1016 AC_DEFINE(USE_DNS_SRV,1)
1019 if test x"$use_dns_pka" = xyes ; then
1020 AC_DEFINE(USE_DNS_PKA,1)
1023 if test x"$use_dns_cert" = xyes ; then
1024 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1033 LIBS=$_dns_save_libs
1038 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
1044 # Note that running the check changes the variable
1045 # gnupg_have_ldap from "n/a" to "no" or "yes".
1048 AC_HELP_STRING([--disable-ldap],[disable LDAP support]),
1049 [if test "$enableval" = "no"; then gnupg_have_ldap=no; fi])
1051 if test "$gnupg_have_ldap" != "no" ; then
1052 if test "$build_dirmngr" = "yes" ; then
1053 GNUPG_CHECK_LDAP($NETLIBS)
1054 AC_CHECK_LIB(lber, ber_free,
1055 [ LBER_LIBS="$LBER_LIBS -llber"
1056 AC_DEFINE(HAVE_LBER,1,
1057 [defined if liblber is available])
1063 if test "$gnupg_have_ldap" = "no"; then
1066 *** Building without LDAP support.
1067 *** No CRL access or X.509 certificate search available.
1071 AM_CONDITIONAL(USE_LDAP, [test "$gnupg_have_ldap" = yes])
1072 if test "$gnupg_have_ldap" = yes ; then
1073 AC_DEFINE(USE_LDAP,1,[Defined if LDAP is support])
1078 if test "$use_ldapwrapper" = yes; then
1079 AC_DEFINE(USE_LDAPWRAPPER,1, [Build dirmngr with LDAP wrapper process])
1081 AM_CONDITIONAL(USE_LDAPWRAPPER, test "$use_ldapwrapper" = yes)
1087 # Check for sendmail
1089 # This isn't necessarily sendmail itself, but anything that gives a
1090 # sendmail-ish interface to the outside world. That includes Exim,
1091 # Postfix, etc. Basically, anything that can handle "sendmail -t".
1092 AC_ARG_WITH(mailprog,
1093 AC_HELP_STRING([--with-mailprog=NAME],
1094 [use "NAME -t" for mail transport]),
1096 if test x"$with_mailprog" = xyes ; then
1097 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
1098 elif test x"$with_mailprog" != xno ; then
1099 AC_MSG_CHECKING([for a mail transport program])
1100 AC_SUBST(SENDMAIL,$with_mailprog)
1101 AC_MSG_RESULT($with_mailprog)
1106 # Construct a printable name of the OS
1110 PRINTABLE_OS_NAME="W32CE"
1113 PRINTABLE_OS_NAME="MingW32"
1116 PRINTABLE_OS_NAME="Cygwin"
1118 i?86-emx-os2 | i?86-*-os2*emx )
1119 PRINTABLE_OS_NAME="OS/2"
1122 PRINTABLE_OS_NAME="MSDOS/DJGPP"
1126 PRINTABLE_OS_NAME="GNU/Linux"
1129 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
1132 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
1133 [A human readable text with the name of the OS])
1137 # Checking for iconv
1139 if test "$require_iconv" = yes; then
1145 AC_SUBST(LTLIBICONV)
1152 # This is "GNU gnupg" - The project-id script from gettext
1155 AC_MSG_NOTICE([checking for gettext])
1157 AM_GNU_GETTEXT_VERSION([0.17])
1158 if test "$try_gettext" = yes; then
1159 AM_GNU_GETTEXT([external],[need-ngettext])
1161 # gettext requires some extra checks. These really should be part of
1162 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
1163 # function checks to here.
1165 AC_CHECK_FUNCS(strchr)
1168 USE_INCLUDED_LIBINTL=no
1169 BUILD_INCLUDED_LIBINTL=no
1172 AC_SUBST(USE_INCLUDED_LIBINTL)
1173 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1177 # We use HAVE_LANGINFO_CODESET in a couple of places.
1180 # Checks required for our use of locales
1187 if test "$selinux_support" = yes ; then
1188 AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1193 # Checks for header files.
1195 AC_MSG_NOTICE([checking for header files])
1197 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
1198 pty.h utmp.h pwd.h inttypes.h signal.h])
1203 # Checks for typedefs, structures, and compiler characteristics.
1205 AC_MSG_NOTICE([checking for system characteristics])
1214 gl_HEADER_SYS_SOCKET
1217 AC_SEARCH_LIBS([inet_addr], [nsl])
1219 AC_ARG_ENABLE(endian-check,
1220 AC_HELP_STRING([--disable-endian-check],
1221 [disable the endian check and trust the OS provided macros]),
1222 endiancheck=$enableval,endiancheck=yes)
1224 if test x"$endiancheck" = xyes ; then
1228 # fixme: we should get rid of the byte type
1229 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
1230 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
1231 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
1232 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
1233 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
1235 AC_CHECK_SIZEOF(unsigned short)
1236 AC_CHECK_SIZEOF(unsigned int)
1237 AC_CHECK_SIZEOF(unsigned long)
1238 AC_CHECK_SIZEOF(unsigned long long)
1240 AC_CHECK_SIZEOF(time_t,,[[
1242 #if TIME_WITH_SYS_TIME
1243 # include <sys/time.h>
1246 # if HAVE_SYS_TIME_H
1247 # include <sys/time.h>
1253 GNUPG_TIME_T_UNSIGNED
1256 if test "$ac_cv_sizeof_unsigned_short" = "0" \
1257 || test "$ac_cv_sizeof_unsigned_int" = "0" \
1258 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
1259 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
1264 # Checks for library functions.
1266 AC_MSG_NOTICE([checking for library functions])
1267 AC_CHECK_DECLS(getpagesize)
1271 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
1272 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
1273 AC_CHECK_FUNCS([unsetenv fcntl ftruncate inet_ntop canonicalize_file_name])
1274 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
1275 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
1276 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
1277 AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat])
1279 if test "$have_android_system" = yes; then
1280 # On Android ttyname is a stub but prints an error message.
1281 AC_DEFINE(HAVE_BROKEN_TTYNAME,1,
1282 [Defined if ttyname does not work properly])
1285 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1287 # Dirmngr requires mmap on Unix systems.
1288 if test $ac_cv_func_mmap != yes -a $mmap_needed = yes; then
1289 AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]])
1293 # These are needed by the jnlib parts in common.
1294 # Note: We already checked pwd.h.
1295 AC_CHECK_HEADERS([signal.h])
1296 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
1297 memrchr isascii timegm getrusage setrlimit stat setlocale \
1298 flockfile funlockfile fopencookie funopen getpwnam getpwuid \
1307 gl_SOURCE_BASE([gl])
1309 gl_MODULES([setenv mkdtemp xsize strpbrk])
1316 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1319 # Sanity check regex. Tests adapted from mutt.
1321 AC_MSG_CHECKING([whether regular expression support is requested])
1322 AC_ARG_ENABLE(regex,
1323 AC_HELP_STRING([--disable-regex],
1324 [do not handle regular expressions in trust signatures]),
1325 use_regex=$enableval, use_regex=yes)
1326 AC_MSG_RESULT($use_regex)
1328 if test "$use_regex" = yes ; then
1329 _cppflags="${CPPFLAGS}"
1330 _ldflags="${LDFLAGS}"
1332 AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1334 if test -d "$withval" ; then
1335 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1336 LDFLAGS="${LDFLAGS} -L$withval/lib"
1340 # Does the system have regex functions at all?
1341 AC_SEARCH_LIBS([regcomp], [regex])
1342 AC_CHECK_FUNC(regcomp, gnupg_cv_have_regex=yes, gnupg_cv_have_regex=no)
1344 if test $gnupg_cv_have_regex = no; then
1347 if test x"$cross_compiling" = xyes; then
1348 AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1350 AC_CACHE_CHECK([whether your system's regexp library is broken],
1351 [gnupg_cv_regex_broken],
1355 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); }],
1356 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1358 if test $gnupg_cv_regex_broken = yes; then
1359 AC_MSG_WARN([your regex is broken - disabling regex use])
1364 CPPFLAGS="${_cppflags}"
1365 LDFLAGS="${_ldflags}"
1368 if test "$use_regex" != yes ; then
1369 AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1371 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1376 # Do we have zlib? Must do it here because Solaris failed
1377 # when compiling a conftest (due to the "-lz" from LIBS).
1378 # Note that we combine zlib and bzlib2 in ZLIBS.
1380 if test "$use_zip" = yes ; then
1381 _cppflags="${CPPFLAGS}"
1382 _ldflags="${LDFLAGS}"
1384 [ --with-zlib=DIR use libz in DIR],[
1385 if test -d "$withval"; then
1386 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1387 LDFLAGS="${LDFLAGS} -L$withval/lib"
1391 AC_CHECK_HEADER(zlib.h,
1392 AC_CHECK_LIB(z, deflateInit2_,
1395 AC_DEFINE(HAVE_ZIP,1, [Defined if ZIP and ZLIB are supported])
1397 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1398 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1403 # Check whether we can support bzip2
1405 if test "$use_bzip2" = yes ; then
1406 _cppflags="${CPPFLAGS}"
1407 _ldflags="${LDFLAGS}"
1409 AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1411 if test -d "$withval" ; then
1412 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1413 LDFLAGS="${LDFLAGS} -L$withval/lib"
1417 # Checking alongside stdio.h as an early version of bzip2 (1.0)
1418 # required stdio.h to be included before bzlib.h, and Solaris 9 is
1419 # woefully out of date.
1420 if test "$withval" != no ; then
1421 AC_CHECK_HEADER(bzlib.h,
1422 AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1425 ZLIBS="$ZLIBS -lbz2"
1426 AC_DEFINE(HAVE_BZIP2,1,
1427 [Defined if the bz2 compression library is available])
1429 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1430 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1433 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1437 # Check for readline support
1438 GNUPG_CHECK_READLINE
1441 if test "$development_version" = yes; then
1442 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1443 [Defined if this is not a regular release])
1446 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1450 # Add some extra libs here so that previous tests don't fail for
1451 # mysterious reasons - the final link step should bail out.
1452 # W32SOCKLIBS is also defined so that if can be used for tools not
1453 # requiring any network stuff but linking to code in libcommon which
1454 # tracks in winsock stuff (e.g. init_common_subsystems).
1455 if test "$have_w32_system" = yes; then
1456 if test "$have_w32ce_system" = yes; then
1459 W32SOCKLIBS="-lws2_32"
1461 NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1465 AC_SUBST(W32SOCKLIBS)
1468 # Setup gcc specific options
1470 AC_MSG_NOTICE([checking for cc features])
1471 if test "$GCC" = yes; then
1472 # Check whether gcc does not emit a diagnositc for unknow -Wno-*
1473 # options. This is the case for gcc >= 4.6
1474 AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
1475 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1476 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
1478 #endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
1479 AC_MSG_RESULT($_gcc_silent_wno)
1481 # Note that it is okay to use CFLAGS here because these are just
1482 # warning options and the user should have a chance of overriding
1484 if test "$USE_MAINTAINER_MODE" = "yes"; then
1485 CFLAGS="$CFLAGS -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1486 CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1487 if test x"$_gcc_silent_wno" = xyes ; then
1490 AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1491 _gcc_cflags_save=$CFLAGS
1492 CFLAGS="-Wno-missing-field-initializers"
1493 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1494 [_gcc_wopt=yes],[_gcc_wopt=no])
1495 AC_MSG_RESULT($_gcc_wopt)
1496 CFLAGS=$_gcc_cflags_save;
1498 if test x"$_gcc_wopt" = xyes ; then
1499 CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
1502 AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
1503 _gcc_cflags_save=$CFLAGS
1504 CFLAGS="-Wdeclaration-after-statement"
1505 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1506 AC_MSG_RESULT($_gcc_wopt)
1507 CFLAGS=$_gcc_cflags_save;
1508 if test x"$_gcc_wopt" = xyes ; then
1509 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1512 CFLAGS="$CFLAGS -Wall"
1515 if test x"$_gcc_silent_wno" = xyes ; then
1518 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1519 _gcc_cflags_save=$CFLAGS
1520 CFLAGS="-Wno-pointer-sign"
1521 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1522 [_gcc_psign=yes],[_gcc_psign=no])
1523 AC_MSG_RESULT($_gcc_psign)
1524 CFLAGS=$_gcc_cflags_save;
1526 if test x"$_gcc_psign" = xyes ; then
1527 CFLAGS="$CFLAGS -Wno-pointer-sign"
1530 AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1531 _gcc_cflags_save=$CFLAGS
1532 CFLAGS="-Wpointer-arith"
1533 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
1534 AC_MSG_RESULT($_gcc_psign)
1535 CFLAGS=$_gcc_cflags_save;
1536 if test x"$_gcc_psign" = xyes ; then
1537 CFLAGS="$CFLAGS -Wpointer-arith"
1543 # This is handy for debugging so the compiler doesn't rearrange
1544 # things and eliminate variables.
1546 AC_ARG_ENABLE(optimization,
1547 AC_HELP_STRING([--disable-optimization],
1548 [disable compiler optimization]),
1549 [if test $enableval = no ; then
1550 CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
1554 # Decide what to build
1557 build_scdaemon_extra=""
1558 if test "$build_scdaemon" = "yes"; then
1559 if test $have_libusb = no; then
1560 build_scdaemon_extra="without internal CCID driver"
1562 if test -n "$build_scdaemon_extra"; then
1563 build_scdaemon_extra="(${build_scdaemon_extra})"
1569 # Set variables for use by automake makefiles.
1571 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
1572 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1573 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1574 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1575 AM_CONDITIONAL(BUILD_G13, test "$build_g13" = "yes")
1576 AM_CONDITIONAL(BUILD_DIRMNGR, test "$build_dirmngr" = "yes")
1577 AM_CONDITIONAL(BUILD_TOOLS, test "$build_tools" = "yes")
1578 AM_CONDITIONAL(BUILD_DOC, test "$build_doc" = "yes")
1579 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1580 AM_CONDITIONAL(BUILD_GPGTAR, test "$build_gpgtar" = "yes")
1582 AM_CONDITIONAL(ENABLE_CARD_SUPPORT, test "$card_support" = yes)
1583 AM_CONDITIONAL(NO_TRUST_MODELS, test "$use_trust_models" = no)
1585 AM_CONDITIONAL(RUN_GPG_TESTS,
1586 test x$cross_compiling = xno -a "$build_gpg" = yes )
1589 # Set some defines for use gpgconf.
1591 if test "$build_gpg" = yes ; then
1592 AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build])
1594 if test "$build_gpgsm" = yes ; then
1595 AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build])
1597 if test "$build_agent" = yes ; then
1598 AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build])
1600 if test "$build_scdaemon" = yes ; then
1601 AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build])
1603 if test "$build_dirmngr" = yes ; then
1604 AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build])
1606 if test "$build_g13" = yes ; then
1607 AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build])
1612 # Define Name strings
1614 AC_DEFINE_UNQUOTED(GNUPG_NAME, "GnuPG", [The name of the project])
1616 AC_DEFINE_UNQUOTED(GPG_NAME, "gpg", [The name of the OpenPGP tool])
1617 AC_DEFINE_UNQUOTED(GPG_DISP_NAME, "GnuPG", [The displayed name of gpg])
1619 AC_DEFINE_UNQUOTED(GPGSM_NAME, "gpgsm", [The name of the S/MIME tool])
1620 AC_DEFINE_UNQUOTED(GPGSM_DISP_NAME, "GPGSM", [The displayed name of gpgsm])
1622 AC_DEFINE_UNQUOTED(GPG_AGENT_NAME, "gpg-agent", [The name of the agent])
1623 AC_DEFINE_UNQUOTED(GPG_AGENT_DISP_NAME, "GPG Agent",
1624 [The displayed name of gpg-agent])
1626 AC_DEFINE_UNQUOTED(SCDAEMON_NAME, "scdaemon", [The name of the scdaemon])
1627 AC_DEFINE_UNQUOTED(SCDAEMON_DISP_NAME, "SCDaemon",
1628 [The displayed name of scdaemon])
1630 AC_DEFINE_UNQUOTED(DIRMNGR_NAME, "dirmngr", [The name of the dirmngr])
1631 AC_DEFINE_UNQUOTED(DIRMNGR_DISP_NAME, "DirMngr",
1632 [The displayed name of dirmngr])
1634 AC_DEFINE_UNQUOTED(G13_NAME, "g13", [The name of the g13 tool])
1635 AC_DEFINE_UNQUOTED(G13_DISP_NAME, "G13", [The displayed name of g13])
1637 AC_DEFINE_UNQUOTED(GPGCONF_NAME, "gpgconf", [The name of the gpgconf tool])
1638 AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf",
1639 [The displayed name of gpgconf])
1641 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
1643 AC_DEFINE_UNQUOTED(GPG_AGENT_SOCK_NAME, "S.gpg-agent",
1644 [The name of the agent socket])
1645 AC_DEFINE_UNQUOTED(GPG_AGENT_SSH_SOCK_NAME, "S.gpg-agent.ssh",
1646 [The name of the agent socket for ssh])
1647 AC_DEFINE_UNQUOTED(DIRMNGR_INFO_NAME, "DIRMNGR_INFO",
1648 [The name of the dirmngr info envvar])
1649 AC_DEFINE_UNQUOTED(SCDAEMON_SOCK_NAME, "S.scdaemon",
1650 [The name of the SCdaemon socket])
1651 AC_DEFINE_UNQUOTED(DIRMNGR_SOCK_NAME, "S.dirmngr",
1652 [The name of the dirmngr socket])
1654 AC_DEFINE_UNQUOTED(GPGEXT_GPG, "gpg", [The standard binary file suffix])
1656 if test "$have_w32_system" = yes; then
1657 AC_DEFINE_UNQUOTED(GNUPG_REGISTRY_DIR, "\\\\Software\\\\GNU\\\\GnuPG",
1658 [The directory part of the W32 registry keys])
1663 # Provide information about the build.
1665 BUILD_REVISION="mym4_revision"
1666 AC_SUBST(BUILD_REVISION)
1667 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
1668 [GIT commit id revision used to build this package])
1671 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
1673 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
1674 AC_SUBST(BUILD_FILEVERSION)
1676 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
1677 AC_SUBST(BUILD_TIMESTAMP)
1678 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
1679 [The time this package was configured for a build])
1680 BUILD_HOSTNAME="$ac_hostname"
1681 AC_SUBST(BUILD_HOSTNAME)
1685 # Print errors here so that they are visible all
1686 # together and the user can acquire them all together.
1689 if test "$have_gpg_error" = "no"; then
1693 *** You need libgpg-error to build this program.
1694 ** This library is for example available at
1695 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
1696 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1699 if test "$have_libgcrypt" = "no"; then
1703 *** You need libgcrypt to build this program.
1704 ** This library is for example available at
1705 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1706 *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API) is required.)
1709 if test "$have_libassuan" = "no"; then
1713 *** You need libassuan to build this program.
1714 *** This library is for example available at
1715 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
1716 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1719 if test "$have_ksba" = "no"; then
1723 *** You need libksba to build this program.
1724 *** This library is for example available at
1725 *** ftp://ftp.gnupg.org/gcrypt/libksba/
1726 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1729 if test "$gnupg_have_ldap" = yes; then
1730 if test "$have_w32ce_system" = yes; then
1732 *** Note that CeGCC might be broken, a package fixing this is:
1733 *** http://files.kolab.org/local/windows-ce/
1734 *** source/wldap32_0.1-mingw32ce.orig.tar.gz
1735 *** binary/wldap32-ce-arm-dev_0.1-1_all.deb
1739 if test "$have_npth" = "no"; then
1743 *** It is now required to build with support for the
1744 *** New Portable Threads Library (nPth). Please install this
1745 *** library first. The library is for example available at
1746 *** ftp://ftp.gnupg.org/gcrypt/npth/
1747 *** (at least version $NEED_NPTH_VERSION (API $NEED_NPTH_API) is required).
1751 if test "$require_iconv" = yes; then
1752 if test "$am_func_iconv" != yes; then
1756 *** The system does not provide a working iconv function. Please
1757 *** install a suitable library; for example GNU Libiconv which is
1759 *** http://ftp.gnu.org/gnu/libiconv/
1764 if test "$die" = "yes"; then
1767 *** Required libraries not found. Please consult the above messages
1768 *** and install them before running configure again.
1774 AC_CONFIG_FILES([ m4/Makefile
1791 tests/openpgp/Makefile
1792 tests/pkits/Makefile
1800 GnuPG v${VERSION} has been configured as follows:
1802 Revision: mym4_revision (mym4_revision_dec)
1803 Platform: $PRINTABLE_OS_NAME ($host)
1806 S/MIME: $build_gpgsm
1808 Smartcard: $build_scdaemon $build_scdaemon_extra
1810 Dirmngr: $build_dirmngr
1811 Gpgtar: $build_gpgtar
1813 Protect tool: $show_gnupg_protect_tool_pgm
1814 LDAP wrapper: $show_gnupg_dirmngr_ldap_pgm
1815 Default agent: $show_gnupg_agent_pgm
1816 Default pinentry: $show_gnupg_pinentry_pgm
1817 Default scdaemon: $show_gnupg_scdaemon_pgm
1818 Default dirmngr: $show_gnupg_dirmngr_pgm
1820 Dirmngr auto start: $dirmngr_auto_start
1821 Readline support: $gnupg_cv_have_readline
1822 LDAP support: $gnupg_have_ldap
1823 DNS SRV support: $use_dns_srv
1824 TLS support: $use_tls_library
1826 if test x"$use_regex" != xyes ; then
1828 Warning: No regular expression support available.
1829 OpenPGP trust signatures won't work.
1830 gpg-check-pattern will not be build.
1833 if test "x${gpg_config_script_warn}" != x; then
1835 Warning: Mismatches between the target platform and the
1836 to be used libraries have been detected for:
1837 ${gpg_config_script_warn}
1838 Please check above for more warning messages.