dirmngr: Allow building without LDAP support.
[gnupg.git] / configure.ac
1 # configure.ac - for GnuPG 2.1
2 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
3 #               2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
4 # Copyright (C) 2013, 2014 Werner Koch
5 #
6 # This file is part of GnuPG.
7 #
8 # GnuPG is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # GnuPG is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, see <http://www.gnu.org/licenses/>.
20
21 # Process this file with autoconf to produce a configure script.
22 AC_PREREQ(2.61)
23 min_automake_version="1.10"
24
25 # To build a release you need to create a tag with the version number
26 # (git tag -s gnupg-2.n.m) and run "./autogen.sh --force".  Please
27 # bump the version number immediately *after* the release and do
28 # another commit and push so that the git magic is able to work.
29 m4_define([mym4_package],[gnupg])
30 m4_define([mym4_major], [2])
31 m4_define([mym4_minor], [1])
32 m4_define([mym4_micro], [0])
33
34 # To start a new development series, i.e a new major or minor number
35 # you need to mark an arbitrary commit before the first beta release
36 # with an annotated tag.  For example the 2.1 branch starts off with
37 # the tag "gnupg-2.1-base".  This is used as the base for counting
38 # beta numbers before the first release of a series.
39
40 # Below is m4 magic to extract and compute the git revision number,
41 # the decimalized short revision number, a beta version string and a
42 # flag indicating a development version (mym4_isbeta).  Note that the
43 # m4 processing is done by autoconf and not during the configure run.
44 m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
45                            mym4_package mym4_major mym4_minor mym4_micro),[:]))
46 m4_define([mym4_isbeta],       m4_argn(2, mym4_verslist))
47 m4_define([mym4_version],      m4_argn(4, mym4_verslist))
48 m4_define([mym4_revision],     m4_argn(7, mym4_verslist))
49 m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
50 m4_esyscmd([echo ]mym4_version[>VERSION])
51 AC_INIT([mym4_package],[mym4_version], [http://bugs.gnupg.org])
52
53 NEED_GPG_ERROR_VERSION=1.15
54
55 NEED_LIBGCRYPT_API=1
56 NEED_LIBGCRYPT_VERSION=1.6.0
57
58 NEED_LIBASSUAN_API=2
59 NEED_LIBASSUAN_VERSION=2.1.0
60
61 NEED_KSBA_API=1
62 NEED_KSBA_VERSION=1.2.0
63
64 NEED_NTBTLS_API=1
65 NEED_NTBTLS_VERSION=0.1.0
66
67 NEED_NPTH_API=1
68 NEED_NPTH_VERSION=0.91
69
70
71 NEED_GNUTLS_VERSION=3.0
72
73
74 development_version=mym4_isbeta
75 PACKAGE=$PACKAGE_NAME
76 PACKAGE_GT=${PACKAGE_NAME}2
77 VERSION=$PACKAGE_VERSION
78
79 AC_CONFIG_AUX_DIR([build-aux])
80 AC_CONFIG_SRCDIR([sm/gpgsm.c])
81 AC_CONFIG_HEADER([config.h])
82 # Note: For automake 1.13 add the option
83 #          serial-tests
84 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
85 AC_CANONICAL_HOST
86 AB_INIT
87
88 AC_GNU_SOURCE
89
90 # Some status variables.
91 have_gpg_error=no
92 have_libgcrypt=no
93 have_libassuan=no
94 have_ksba=no
95 have_ntbtls=no
96 have_gnutls=no
97 have_npth=no
98 have_libusb=no
99 have_adns=no
100 gnupg_have_ldap="n/a"
101
102 use_zip=yes
103 use_bzip2=yes
104 use_exec=yes
105 use_trust_models=yes
106 card_support=yes
107 use_ccid_driver=yes
108 dirmngr_auto_start=yes
109 use_tls_library=no
110 large_secmem=no
111
112 GNUPG_BUILD_PROGRAM(gpg, yes)
113 GNUPG_BUILD_PROGRAM(gpgsm, yes)
114 GNUPG_BUILD_PROGRAM(agent, yes)
115 GNUPG_BUILD_PROGRAM(scdaemon, yes)
116 GNUPG_BUILD_PROGRAM(g13, yes)
117 GNUPG_BUILD_PROGRAM(dirmngr, yes)
118 GNUPG_BUILD_PROGRAM(tools, yes)
119 GNUPG_BUILD_PROGRAM(doc, yes)
120 GNUPG_BUILD_PROGRAM(symcryptrun, no)
121 GNUPG_BUILD_PROGRAM(gpgtar, yes)
122
123 AC_SUBST(PACKAGE)
124 AC_SUBST(PACKAGE_GT)
125 AC_SUBST(VERSION)
126 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
127 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
128                                 [Name of this package for gettext])
129 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
130 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
131                                         [Bug report address])
132 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
133                                        [Required version of Libgcrypt])
134 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
135                                        [Required version of Libksba])
136 AC_DEFINE_UNQUOTED(NEED_NTBTLS_VERSION, "$NEED_NTBTLS_VERSION",
137                                        [Required version of NTBTLS])
138
139
140
141 # The default is to use the modules from this package and the few
142 # other packages in a standard place; i.e where this package gets
143 # installed.  With these options it is possible to override these
144 # ${prefix} depended values with fixed paths, which can't be replaced
145 # at make time.  See also am/cmacros.am and the defaults in AH_BOTTOM.
146 AC_ARG_WITH(agent-pgm,
147     [  --with-agent-pgm=PATH  Use PATH as the default for the agent)],
148           GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
149 AC_SUBST(GNUPG_AGENT_PGM)
150 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
151 show_gnupg_agent_pgm="(default)"
152 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
153
154 AC_ARG_WITH(pinentry-pgm,
155     [  --with-pinentry-pgm=PATH  Use PATH as the default for the pinentry)],
156           GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
157 AC_SUBST(GNUPG_PINENTRY_PGM)
158 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
159 show_gnupg_pinentry_pgm="(default)"
160 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
161
162
163 AC_ARG_WITH(scdaemon-pgm,
164     [  --with-scdaemon-pgm=PATH  Use PATH as the default for the scdaemon)],
165           GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
166 AC_SUBST(GNUPG_SCDAEMON_PGM)
167 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
168 show_gnupg_scdaemon_pgm="(default)"
169 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
170
171
172 AC_ARG_WITH(dirmngr-pgm,
173     [  --with-dirmngr-pgm=PATH  Use PATH as the default for the dirmngr)],
174           GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
175 AC_SUBST(GNUPG_DIRMNGR_PGM)
176 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
177 show_gnupg_dirmngr_pgm="(default)"
178 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
179
180 AC_ARG_WITH(protect-tool-pgm,
181     [  --with-protect-tool-pgm=PATH  Use PATH as the default for the protect-tool)],
182           GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
183 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
184 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
185 show_gnupg_protect_tool_pgm="(default)"
186 test -n "$GNUPG_PROTECT_TOOL_PGM" \
187       && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
188
189 AC_ARG_WITH(dirmngr-ldap-pgm,
190     [  --with-dirmngr-ldap-pgm=PATH  Use PATH as the default for the dirmnge ldap wrapper)],
191           GNUPG_DIRMNGR_LDAP_PGM="$withval", GNUPG_DIRMNGR_LDAP_PGM="" )
192 AC_SUBST(GNUPG_DIRMNGR_LDAP_PGM)
193 AM_CONDITIONAL(GNUPG_DIRMNGR_LDAP_PGM, test -n "$GNUPG_DIRMNGR_LDAP_PGM")
194 show_gnupg_dirmngr_ldap_pgm="(default)"
195 test -n "$GNUPG_DIRMNGR_LDAP_PGM" \
196       && show_gnupg_dirmngr_ldap_pgm="$GNUPG_DIRMNGR_LDAP_PGM"
197
198 #
199 # On some platforms gpg2 is usually installed as gpg without using a
200 # symlink.  For correct operation of gpgconf it needs to know the
201 # installed name of gpg.  This option sets "gpg2"'s installed name to
202 # just "gpg".  Note that it might be required to rename gpg2 to gpg
203 # manually after the build process.
204 #
205 AC_ARG_ENABLE(gpg2-is-gpg,
206     AC_HELP_STRING([--enable-gpg2-is-gpg],[Set installed name of gpg2 to gpg]),
207     gpg2_is_gpg=$enableval)
208 if test "$gpg2_is_gpg" = "yes"; then
209    name_of_installed_gpg=gpg
210 else
211    name_of_installed_gpg=gpg2
212 fi
213 AC_DEFINE_UNQUOTED(NAME_OF_INSTALLED_GPG, "$name_of_installed_gpg",
214                    [The name of the installed GPG tool])
215
216
217 # SELinux support includes tracking of sensitive files to avoid
218 # leaking their contents through processing these files by gpg itself
219 AC_MSG_CHECKING([whether SELinux support is requested])
220 AC_ARG_ENABLE(selinux-support,
221               AC_HELP_STRING([--enable-selinux-support],
222                              [enable SELinux support]),
223               selinux_support=$enableval, selinux_support=no)
224 AC_MSG_RESULT($selinux_support)
225
226
227 AC_MSG_CHECKING([whether to allocate extra secure memory])
228 AC_ARG_ENABLE(large-secmem,
229               AC_HELP_STRING([--enable-large-secmem],
230                              [allocate extra secure memory]),
231               large_secmem=$enableval, large_secmem=no)
232 AC_MSG_RESULT($large_secmem)
233 if test "$large_secmem" = yes ; then
234    SECMEM_BUFFER_SIZE=65536
235 else
236    SECMEM_BUFFER_SIZE=32768
237 fi
238 AC_DEFINE_UNQUOTED(SECMEM_BUFFER_SIZE,$SECMEM_BUFFER_SIZE,
239                    [Size of secure memory buffer])
240
241 AC_MSG_CHECKING([whether to enable trust models])
242 AC_ARG_ENABLE(trust-models,
243               AC_HELP_STRING([--disable-trust-models],
244                              [disable all trust models except "always"]),
245               use_trust_models=$enableval)
246 AC_MSG_RESULT($use_trust_models)
247 if test "$use_trust_models" = no ; then
248     AC_DEFINE(NO_TRUST_MODELS, 1,
249              [Define to include only trust-model always])
250 fi
251
252
253 #
254 # Options to disable algorithm
255 #
256
257 GNUPG_GPG_DISABLE_ALGO([rsa],[RSA public key])
258 # Elgamal is a MUST algorithm
259 # DSA is a MUST algorithm
260 GNUPG_GPG_DISABLE_ALGO([ecdh],[ECDH public key])
261 GNUPG_GPG_DISABLE_ALGO([ecdsa],[ECDSA public key])
262 GNUPG_GPG_DISABLE_ALGO([eddsa],[EdDSA public key])
263
264 GNUPG_GPG_DISABLE_ALGO([idea],[IDEA cipher])
265 # 3DES is a MUST algorithm
266 GNUPG_GPG_DISABLE_ALGO([cast5],[CAST5 cipher])
267 GNUPG_GPG_DISABLE_ALGO([blowfish],[BLOWFISH cipher])
268 GNUPG_GPG_DISABLE_ALGO([aes128],[AES128 cipher])
269 GNUPG_GPG_DISABLE_ALGO([aes192],[AES192 cipher])
270 GNUPG_GPG_DISABLE_ALGO([aes256],[AES256 cipher])
271 GNUPG_GPG_DISABLE_ALGO([twofish],[TWOFISH cipher])
272 GNUPG_GPG_DISABLE_ALGO([camellia128],[CAMELLIA128 cipher])
273 GNUPG_GPG_DISABLE_ALGO([camellia192],[CAMELLIA192 cipher])
274 GNUPG_GPG_DISABLE_ALGO([camellia256],[CAMELLIA256 cipher])
275
276 GNUPG_GPG_DISABLE_ALGO([md5],[MD5 hash])
277 # SHA1 is a MUST algorithm
278 GNUPG_GPG_DISABLE_ALGO([rmd160],[RIPE-MD160 hash])
279 GNUPG_GPG_DISABLE_ALGO([sha224],[SHA-224 hash])
280 # SHA256 is a MUST algorithm for GnuPG.
281 GNUPG_GPG_DISABLE_ALGO([sha384],[SHA-384 hash])
282 GNUPG_GPG_DISABLE_ALGO([sha512],[SHA-512 hash])
283
284
285 # Allow disabling of zip support.
286 # This is in general not a good idea because according to rfc4880 OpenPGP
287 # implementations SHOULD support ZLIB.
288 AC_MSG_CHECKING([whether to enable the ZIP and ZLIB compression algorithm])
289 AC_ARG_ENABLE(zip,
290    AC_HELP_STRING([--disable-zip],
291                   [disable the ZIP and ZLIB compression algorithm]),
292    use_zip=$enableval)
293 AC_MSG_RESULT($use_zip)
294
295 # Allow disabling of bzib2 support.
296 # It is defined only after we confirm the library is available later
297 AC_MSG_CHECKING([whether to enable the BZIP2 compression algorithm])
298 AC_ARG_ENABLE(bzip2,
299    AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
300    use_bzip2=$enableval)
301 AC_MSG_RESULT($use_bzip2)
302
303 # Configure option to allow or disallow execution of external
304 # programs, like a photo viewer.
305 AC_MSG_CHECKING([whether to enable external program execution])
306 AC_ARG_ENABLE(exec,
307     AC_HELP_STRING([--disable-exec],[disable all external program execution]),
308     use_exec=$enableval)
309 AC_MSG_RESULT($use_exec)
310 if test "$use_exec" = no ; then
311     AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
312 fi
313
314 if test "$use_exec" = yes ; then
315   AC_MSG_CHECKING([whether to enable photo ID viewing])
316   AC_ARG_ENABLE(photo-viewers,
317       [  --disable-photo-viewers disable photo ID viewers],
318       [if test "$enableval" = no ; then
319          AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
320       fi],enableval=yes)
321   gnupg_cv_enable_photo_viewers=$enableval
322   AC_MSG_RESULT($enableval)
323
324   if test "$gnupg_cv_enable_photo_viewers" = yes ; then
325     AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
326     AC_ARG_WITH(photo-viewer,
327         [  --with-photo-viewer=FIXED_VIEWER  set a fixed photo ID viewer],
328         [if test "$withval" = yes ; then
329            withval=no
330         elif test "$withval" != no ; then
331            AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
332                             [if set, restrict photo-viewer to this])
333         fi],withval=no)
334     AC_MSG_RESULT($withval)
335   fi
336 fi
337
338
339 #
340 # Check for the key/uid cache size.  This can't be zero, but can be
341 # pretty small on embedded systems.  This is used for the gpg part.
342 #
343 AC_MSG_CHECKING([for the size of the key and uid cache])
344 AC_ARG_ENABLE(key-cache,
345         AC_HELP_STRING([--enable-key-cache=SIZE],
346                        [Set key cache to SIZE (default 4096)]),,enableval=4096)
347 if test "$enableval" = "no"; then
348    enableval=5
349 elif test "$enableval" = "yes" || test "$enableval" = ""; then
350    enableval=4096
351 fi
352 changequote(,)dnl
353 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
354 changequote([,])dnl
355 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
356    AC_MSG_ERROR([invalid key-cache size])
357 fi
358 AC_MSG_RESULT($key_cache_size)
359 AC_DEFINE_UNQUOTED(PK_UID_CACHE_SIZE,$key_cache_size,
360                   [Size of the key and UID caches])
361
362
363
364 #
365 # Check whether we want to use Linux capabilities
366 #
367 AC_MSG_CHECKING([whether use of capabilities is requested])
368 AC_ARG_WITH(capabilities,
369     [  --with-capabilities     use linux capabilities [default=no]],
370 [use_capabilities="$withval"],[use_capabilities=no])
371 AC_MSG_RESULT($use_capabilities)
372
373 #
374 # Check whether to disable the card support
375 AC_MSG_CHECKING([whether smartcard support is requested])
376 AC_ARG_ENABLE(card-support,
377               AC_HELP_STRING([--disable-card-support],
378                              [disable smartcard support]),
379               card_support=$enableval)
380 AC_MSG_RESULT($card_support)
381 if test "$card_support" = yes ; then
382   AC_DEFINE(ENABLE_CARD_SUPPORT,1,[Define to include smartcard support])
383 else
384   build_scdaemon=no
385 fi
386
387 #
388 # Allow disabling of internal CCID support.
389 # It is defined only after we confirm the library is available later
390 #
391 AC_MSG_CHECKING([whether to enable the internal CCID driver])
392 AC_ARG_ENABLE(ccid-driver,
393               AC_HELP_STRING([--disable-ccid-driver],
394                              [disable the internal CCID driver]),
395               use_ccid_driver=$enableval)
396 AC_MSG_RESULT($use_ccid_driver)
397
398 AC_MSG_CHECKING([whether to auto start dirmngr])
399 AC_ARG_ENABLE(dirmngr-auto-start,
400               AC_HELP_STRING([--disable-dirmngr-auto-start],
401                              [disable auto starting of the dirmngr]),
402               dirmngr_auto_start=$enableval)
403 AC_MSG_RESULT($dirmngr_auto_start)
404 if test "$dirmngr_auto_start" = yes ; then
405     AC_DEFINE(USE_DIRMNGR_AUTO_START,1,
406               [Define to enable auto starting of the dirmngr])
407 fi
408
409
410 #
411 # To avoid double inclusion of config.h which might happen at some
412 # places, we add the usual double inclusion protection at the top of
413 # config.h.
414 #
415 AH_TOP([
416 #ifndef GNUPG_CONFIG_H_INCLUDED
417 #define GNUPG_CONFIG_H_INCLUDED
418 ])
419
420 #
421 # Stuff which goes at the bottom of config.h.
422 #
423 AH_BOTTOM([
424 /* This is the major version number of GnuPG so that
425    source included files can test for this.  Note, that
426    we use 2 here even for GnuPG 1.9.x. */
427 #define GNUPG_MAJOR_VERSION 2
428
429 /* Now to separate file name parts.
430    Please note that the string version must not contain more
431    than one character because the code assumes strlen()==1 */
432 #ifdef HAVE_DOSISH_SYSTEM
433 #define DIRSEP_C '\\'
434 #define DIRSEP_S "\\"
435 #define EXTSEP_C '.'
436 #define EXTSEP_S "."
437 #define PATHSEP_C ';'
438 #define PATHSEP_S ";"
439 #define EXEEXT_S ".exe"
440 #else
441 #define DIRSEP_C '/'
442 #define DIRSEP_S "/"
443 #define EXTSEP_C '.'
444 #define EXTSEP_S "."
445 #define PATHSEP_C ':'
446 #define PATHSEP_S ":"
447 #define EXEEXT_S ""
448 #endif
449
450 /* This is the same as VERSION, but should be overridden if the
451    platform cannot handle things like dots '.' in filenames. Set
452    SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
453    uses for dots and dashes. */
454 #define SAFE_VERSION VERSION
455 #define SAFE_VERSION_DOT  '.'
456 #define SAFE_VERSION_DASH '-'
457
458 /* Some global constants. */
459 #ifdef HAVE_DOSISH_SYSTEM
460 # ifdef HAVE_DRIVE_LETTERS
461 #  define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
462 # else
463 #  define GNUPG_DEFAULT_HOMEDIR "/gnupg"
464 # endif
465 #elif defined(__VMS)
466 #define GNUPG_DEFAULT_HOMEDIR "/SYS$LOGIN/gnupg"
467 #else
468 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
469 #endif
470 #define GNUPG_PRIVATE_KEYS_DIR  "private-keys-v1.d"
471 #define GNUPG_OPENPGP_REVOC_DIR "openpgp-revocs.d"
472
473 /* For some systems (DOS currently), we hardcode the path here.  For
474    POSIX systems the values are constructed by the Makefiles, so that
475    the values may be overridden by the make invocations; this is to
476    comply with the GNU coding standards.  Note that these values are
477    only defaults.  */
478 #ifdef HAVE_DOSISH_SYSTEM
479 # ifdef HAVE_DRIVE_LETTERS
480 #  define GNUPG_BINDIR      "c:\\gnupg"
481 #  define GNUPG_LIBEXECDIR  "c:\\gnupg"
482 #  define GNUPG_LIBDIR      "c:\\gnupg"
483 #  define GNUPG_DATADIR     "c:\\gnupg"
484 #  define GNUPG_SYSCONFDIR  "c:\\gnupg"
485 # else
486 #  define GNUPG_BINDIR      "\\gnupg"
487 #  define GNUPG_LIBEXECDIR  "\\gnupg"
488 #  define GNUPG_LIBDIR      "\\gnupg"
489 #  define GNUPG_DATADIR     "\\gnupg"
490 #  define GNUPG_SYSCONFDIR  "\\gnupg"
491 # endif
492 #endif
493
494 /* Derive some other constants. */
495 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
496 #define EXEC_TEMPFILE_ONLY
497 #endif
498
499
500 /* We didn't define endianness above, so get it from OS macros.  This
501    is intended for making fat binary builds on OS X. */
502 #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST)
503 #if defined(__BIG_ENDIAN__)
504 #define BIG_ENDIAN_HOST 1
505 #elif defined(__LITTLE_ENDIAN__)
506 #define LITTLE_ENDIAN_HOST 1
507 #else
508 #error "No endianness found"
509 #endif
510 #endif
511
512
513 /* Hack used for W32: ldap.m4 also tests for the ASCII version of
514    ldap_start_tls_s because that is the actual symbol used in the
515    library.  winldap.h redefines it to our commonly used value,
516    thus we define our usual macro here.  */
517 #ifdef HAVE_LDAP_START_TLS_SA
518 # ifndef HAVE_LDAP_START_TLS_S
519 #  define HAVE_LDAP_START_TLS_S 1
520 # endif
521 #endif
522
523 /* Provide the es_ macro for estream.  */
524 #define GPGRT_ENABLE_ES_MACROS 1
525
526 /* Tell libgcrypt not to use its own libgpg-error implementation. */
527 #define USE_LIBGPG_ERROR 1
528
529 /* Tell Libgcrypt not to include deprecated definitions.  */
530 #define GCRYPT_NO_DEPRECATED 1
531
532 /* We use jnlib, so tell other modules about it.  */
533 #define HAVE_JNLIB_LOGGING 1
534
535 /* Our HTTP code is used in estream mode.  */
536 #define HTTP_USE_ESTREAM 1
537
538 /* Under W32 we do an explicit socket initialization, thus we need to
539    avoid the on-demand initialization which would also install an atexit
540    handler.  */
541 #define HTTP_NO_WSASTARTUP
542
543 /* Under Windows we use the gettext code from libgpg-error.  */
544 #define GPG_ERR_ENABLE_GETTEXT_MACROS
545
546 /* Under WindowsCE we use the strerror replacement from libgpg-error.  */
547 #define GPG_ERR_ENABLE_ERRNO_MACROS
548
549 #endif /*GNUPG_CONFIG_H_INCLUDED*/
550 ])
551
552
553 AM_MAINTAINER_MODE
554 AC_ARG_VAR(SYSROOT,[locate config scripts also below that directory])
555
556 # Checks for programs.
557 AC_MSG_NOTICE([checking for programs])
558 AC_PROG_MAKE_SET
559 AM_SANITY_CHECK
560 missing_dir=`cd $ac_aux_dir && pwd`
561 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
562 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
563 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
564 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
565 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
566 AM_SILENT_RULES
567 AC_PROG_AWK
568 AC_PROG_CC
569 AC_PROG_CPP
570 AM_PROG_CC_C_O
571 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
572   AC_MSG_ERROR([[No C-89 compiler found]])
573 fi
574 AC_PROG_INSTALL
575 AC_PROG_LN_S
576 AC_PROG_RANLIB
577 AC_CHECK_TOOL(AR, ar, :)
578 AC_PATH_PROG(PERL,"perl")
579 AC_CHECK_TOOL(WINDRES, windres, :)
580 AC_ISC_POSIX
581 gl_EARLY
582 AC_SYS_LARGEFILE
583 GNUPG_CHECK_USTAR
584
585 # We need to compile and run a program on the build machine.  A
586 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
587 # the AC archive is broken for autoconf 2.57.  Given that there is no
588 # newer version of that macro, we assume that it is also broken for
589 # autoconf 2.61 and thus we use a simple but usually sufficient
590 # approach.
591 AC_MSG_CHECKING(for cc for build)
592 if test "$cross_compiling" = "yes"; then
593   CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
594 else
595   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
596 fi
597 AC_MSG_RESULT($CC_FOR_BUILD)
598 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
599
600
601
602 try_gettext=yes
603 require_iconv=yes
604 have_dosish_system=no
605 have_w32_system=no
606 have_w32ce_system=no
607 have_android_system=no
608 run_tests=yes
609 use_simple_gettext=no
610 use_ldapwrapper=yes
611 mmap_needed=yes
612 case "${host}" in
613     *-mingw32*)
614         # special stuff for Windoze NT
615         ac_cv_have_dev_random=no
616         AC_DEFINE(USE_ONLY_8DOT3,1,
617                   [Set this to limit filenames to the 8.3 format])
618         AC_DEFINE(USE_SIMPLE_GETTEXT,1,
619                   [Because the Unix gettext has too much overhead on
620                    MingW32 systems and these systems lack Posix functions,
621                    we use a simplified version of gettext])
622         have_dosish_system=yes
623         have_w32_system=yes
624         run_tests=no
625         use_ldapwrapper=no  # Fixme: Do this only for CE.
626         case "${host}" in
627           *-mingw32ce*)
628             have_w32ce_system=yes
629             ;;
630           *)
631             AC_DEFINE(HAVE_DRIVE_LETTERS,1,
632                       [Defined if the OS supports drive letters.])
633             ;;
634         esac
635         try_gettext="no"
636         use_simple_gettext=yes
637         mmap_needed=no
638         ;;
639     i?86-emx-os2 | i?86-*-os2*emx )
640         # OS/2 with the EMX environment
641         ac_cv_have_dev_random=no
642         AC_DEFINE(HAVE_DRIVE_LETTERS)
643         have_dosish_system=yes
644         try_gettext="no"
645         ;;
646
647     i?86-*-msdosdjgpp*)
648         # DOS with the DJGPP environment
649         ac_cv_have_dev_random=no
650         AC_DEFINE(HAVE_DRIVE_LETTERS)
651         have_dosish_system=yes
652         try_gettext="no"
653         ;;
654
655     *-*-hpux*)
656         if test -z "$GCC" ; then
657             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
658         fi
659         ;;
660     *-dec-osf4*)
661         if test -z "$GCC" ; then
662             # Suppress all warnings
663             # to get rid of the unsigned/signed char mismatch warnings.
664             CFLAGS="$CFLAGS -w"
665         fi
666         ;;
667     *-dec-osf5*)
668         if test -z "$GCC" ; then
669             # Use the newer compiler `-msg_disable ptrmismatch1' to
670             # get rid of the unsigned/signed char mismatch warnings.
671             # Using this may hide other pointer mismatch warnings, but
672             # it at least lets other warning classes through
673             CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
674         fi
675         ;;
676     m68k-atari-mint)
677         ;;
678     *-linux-androideabi)
679         have_android_system=yes
680         # Android is fully utf-8 and we do not want to use iconv to
681         # keeps things simple
682         require_iconv=no
683         run_tests=no
684         ;;
685     *)
686        ;;
687 esac
688
689 if test "$have_dosish_system" = yes; then
690    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
691              [Defined if we run on some of the PCDOS like systems
692               (DOS, Windoze. OS/2) with special properties like
693               no file modes, case insensitive file names and preferred
694               use of backslashes as directory name separators.])
695 fi
696 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
697
698 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
699
700 if test "$have_w32_system" = yes; then
701    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
702    if test "$have_w32ce_system" = yes; then
703       AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
704    fi
705 fi
706 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
707 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
708
709 if test "$have_android_system" = yes; then
710    AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
711 fi
712 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
713
714 if test "$run_tests" = yes; then
715    AC_DEFINE(RUN_TESTS,1, [Defined if we should run the tests])
716 fi
717 AM_CONDITIONAL(RUN_TESTS, test "$run_tests" = yes)
718
719
720 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
721 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
722
723
724 #
725 # Checks for libraries.
726 #
727 AC_MSG_NOTICE([checking for libraries])
728
729
730 #
731 # libgpg-error is a library with error codes shared between GnuPG
732 # related projects.
733 #
734 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
735                   have_gpg_error=yes,have_gpg_error=no)
736
737
738 #
739 # Libgcrypt is our generic crypto library
740 #
741 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
742         have_libgcrypt=yes,have_libgcrypt=no)
743
744
745 #
746 # libassuan is used for IPC
747 #
748 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
749                   have_libassuan=yes,have_libassuan=no)
750 if test "$have_libassuan" = "yes"; then
751   AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
752                      [version of the libassuan library])
753 fi
754
755
756
757 #
758 # libksba is our X.509 support library
759 #
760 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
761
762
763 #
764 # libusb allows us to use the integrated CCID smartcard reader driver.
765 #
766 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
767 if test "$use_ccid_driver" = yes ; then
768   AC_CHECK_LIB(usb, usb_bulk_write,
769                 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
770                   AC_DEFINE(HAVE_LIBUSB,1,
771                            [defined if libusb is available])
772                   have_libusb=yes
773                ])
774   AC_CHECK_FUNCS(usb_create_match)
775 fi
776 AC_SUBST(LIBUSB_LIBS)
777
778 #
779 # Check wether it is necessary to link against libdl.
780 # (For example to load libpcsclite)
781 #
782 gnupg_dlopen_save_libs="$LIBS"
783 LIBS=""
784 AC_SEARCH_LIBS(dlopen, c dl,,,)
785 DL_LIBS=$LIBS
786 AC_SUBST(DL_LIBS)
787 LIBS="$gnupg_dlopen_save_libs"
788
789 # Checks for g13
790
791 AC_PATH_PROG(ENCFS, encfs, /usr/bin/encfs)
792 AC_DEFINE_UNQUOTED(ENCFS,
793         "${ENCFS}", [defines the filename of the encfs program])
794
795 AC_PATH_PROG(FUSERMOUNT, fusermount, /usr/bin/fusermount)
796 AC_DEFINE_UNQUOTED(FUSERMOUNT,
797         "${FUSERMOUNT}", [defines the filename of the fusermount program])
798
799
800 # Checks for dirmngr
801
802
803 #
804 # Checks for symcryptrun:
805 #
806
807 # libutil has openpty() and login_tty().
808 AC_CHECK_LIB(util, openpty,
809               [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
810                 AC_DEFINE(HAVE_LIBUTIL,1,
811                          [defined if libutil is available])
812              ])
813 AC_SUBST(LIBUTIL_LIBS)
814
815 # shred is used to clean temporary plain text files.
816 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
817 AC_DEFINE_UNQUOTED(SHRED,
818         "${SHRED}", [defines the filename of the shred program])
819
820
821 #
822 # Check whether the nPth library is available
823 #
824 AM_PATH_NPTH("$NEED_NPTH_API:$NEED_NPTH_VERSION",have_npth=yes,have_npth=no)
825 if test "$have_npth" = "yes"; then
826   AC_DEFINE(HAVE_NPTH, 1,
827               [Defined if the New Portable Thread Library is available])
828   AC_DEFINE(USE_NPTH, 1,
829               [Defined if support for nPth is requested and nPth is available])
830 else
831   AC_MSG_WARN([[
832 ***
833 *** To support concurrent access for example in gpg-agent and the SCdaemon
834 *** we need the support of the New Portable Threads Library.
835 ***]])
836 fi
837
838
839 #
840 # NTBTLS is our TLS library.  If it is not available fallback to
841 # GNUTLS.
842 #
843 AC_ARG_ENABLE(ntbtls,
844               AC_HELP_STRING([--disable-ntbtls],
845                              [disable the use of NTBTLS as TLS library]),
846               try_ntbtls=$enableval, try_ntbtls=yes)
847 if test x"$try_ntbtls" = xyes ; then
848   AM_PATH_NTBTLS("$NEED_NTBTLS_API:$NEED_NTBTLS_VERSION",
849                  [have_ntbtls=yes],[have_ntbtls=no])
850 fi
851 if test "$have_ntbtls" = yes ; then
852    use_tls_library=ntbtls
853    AC_DEFINE(HTTP_USE_NTBTLS, 1, [Enable NTBTLS support in http.c])
854 else
855   AC_ARG_ENABLE(gnutls,
856                 AC_HELP_STRING([--disable-gnutls],
857                                [disable GNUTLS as fallback TLS library]),
858                 try_gnutls=$enableval, try_gnutls=yes)
859   if test x"$try_gnutls" = xyes ; then
860     PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= $NEED_GNUTLS_VERSION],
861                                    [have_gnutls=yes],
862                                    [have_gnutls=no])
863   fi
864   if test "$have_gnutls" = "yes"; then
865     AC_SUBST([LIBGNUTLS_CFLAGS])
866     AC_SUBST([LIBGNUTLS_LIBS])
867     use_tls_library=gnutls
868     AC_DEFINE(HTTP_USE_GNUTLS, 1, [Enable GNUTLS support in http.c])
869   else
870     tmp=$(echo "$LIBGNUTLS_PKG_ERRORS" | tr '\n' '\v' | sed 's/\v/\n*** /g')
871     AC_MSG_WARN([[
872 ***
873 *** Building without NTBTLS and GNUTLS - no TLS access to keyservers.
874 ***
875 *** $tmp]])
876   fi
877 fi
878
879
880 AC_MSG_NOTICE([checking for networking options])
881
882 #
883 # Must check for network library requirements before doing link tests
884 # for ldap, for example. If ldap libs are static (or dynamic and without
885 # ELF runtime link paths), then link will fail and LDAP support won't
886 # be detected.
887 #
888 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
889         [NETLIBS="-lnsl $NETLIBS"]))
890 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
891         [NETLIBS="-lsocket $NETLIBS"]))
892
893
894 #
895 # Check for ADNS.
896 #
897 _cppflags="${CPPFLAGS}"
898 _ldflags="${LDFLAGS}"
899 AC_ARG_WITH(adns,
900             AC_HELP_STRING([--with-adns=DIR],
901                            [look for the adns library in DIR]),
902             [if test -d "$withval"; then
903                CPPFLAGS="${CPPFLAGS} -I$withval/include"
904                LDFLAGS="${LDFLAGS} -L$withval/lib"
905              fi])
906 if test "$with_adns" != "no"; then
907   AC_CHECK_HEADERS(adns.h,
908                 AC_CHECK_LIB(adns, adns_init,
909                              [have_adns=yes],
910                              [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),
911                 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
912 fi
913 if test "$have_adns" = "yes"; then
914   ADNSLIBS="-ladns"
915 fi
916 AC_SUBST(ADNSLIBS)
917 # Newer adns versions feature a free function to be used under W32.
918 AC_CHECK_FUNCS(adns_free)
919
920
921
922 #
923 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
924 #
925 AC_ARG_ENABLE(dns-srv,
926               AC_HELP_STRING([--disable-dns-srv],
927                              [disable the use of DNS SRV in HKP and HTTP]),
928               use_dns_srv=$enableval,use_dns_srv=yes)
929
930 AC_ARG_ENABLE(dns-pka,
931    AC_HELP_STRING([--disable-dns-pka],
932         [disable the use of PKA records in DNS]),
933    use_dns_pka=$enableval,use_dns_pka=yes)
934
935 AC_ARG_ENABLE(dns-cert,
936    AC_HELP_STRING([--disable-dns-cert],
937         [disable the use of CERT records in DNS]),
938    use_dns_cert=$enableval,use_dns_cert=yes)
939
940 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
941    || test x"$use_dns_cert" = xyes; then
942   _dns_save_libs=$LIBS
943   LIBS=""
944   # the double underscore thing is a glibc-ism?
945   AC_SEARCH_LIBS(res_query,resolv bind,,
946                  AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
947   AC_SEARCH_LIBS(dn_expand,resolv bind,,
948                  AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
949   AC_SEARCH_LIBS(dn_skipname,resolv bind,,
950                  AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
951
952   if test x"$have_resolver" != xno ; then
953
954     # Make sure that the BIND 4 resolver interface is workable before
955     # enabling any code that calls it.  At some point I'll rewrite the
956     # code to use the BIND 8 resolver API.
957     # We might also want to use adns instead.  Problem with ADNS is that
958     # it does not support v6.
959
960     AC_MSG_CHECKING([whether the resolver is usable])
961     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
962 #include <netinet/in.h>
963 #include <arpa/nameser.h>
964 #include <resolv.h>]],
965 [[unsigned char answer[PACKETSZ];
966   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
967   dn_skipname(0,0);
968   dn_expand(0,0,0,0,0);
969 ]])],have_resolver=yes,have_resolver=no)
970     AC_MSG_RESULT($have_resolver)
971
972     # This is Apple-specific and somewhat bizarre as they changed the
973     # define in bind 8 for some reason.
974
975     if test x"$have_resolver" != xyes ; then
976        AC_MSG_CHECKING(
977              [whether I can make the resolver usable with BIND_8_COMPAT])
978        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define BIND_8_COMPAT
979 #include <sys/types.h>
980 #include <netinet/in.h>
981 #include <arpa/nameser.h>
982 #include <resolv.h>]],
983 [[unsigned char answer[PACKETSZ];
984   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
985   dn_skipname(0,0); dn_expand(0,0,0,0,0);
986 ]])],[have_resolver=yes ; need_compat=yes])
987        AC_MSG_RESULT($have_resolver)
988     fi
989   fi
990
991   if test x"$have_resolver" = xyes ; then
992      DNSLIBS=$LIBS
993
994      if test x"$use_dns_srv" = xyes ; then
995         AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
996      fi
997
998      if test x"$use_dns_pka" = xyes ; then
999         AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
1000      fi
1001
1002      if test x"$use_dns_cert" = xyes ; then
1003         AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1004      fi
1005
1006      if test x"$need_compat" = xyes ; then
1007         AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
1008      fi
1009   else
1010      # If we have no resolver library but ADNS (e.g. under W32) enable the
1011      # code parts which can be used with ADNS.
1012      if test x"$have_adns" = xyes ; then
1013         DNSLIBS="$ADNSLIBS"
1014         AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
1015
1016         if test x"$use_dns_srv" = xyes ; then
1017            AC_DEFINE(USE_DNS_SRV,1)
1018         fi
1019
1020         if test x"$use_dns_pka" = xyes ; then
1021            AC_DEFINE(USE_DNS_PKA,1)
1022         fi
1023
1024         if test x"$use_dns_cert" = xyes ; then
1025            AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1026         fi
1027      else
1028         use_dns_srv=no
1029         use_dns_pka=no
1030         use_dns_cert=no
1031      fi
1032   fi
1033
1034   LIBS=$_dns_save_libs
1035 fi
1036
1037 AC_SUBST(DNSLIBS)
1038
1039 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
1040
1041
1042 #
1043 # Check for LDAP
1044 #
1045 # Note that running the check changes the variable
1046 # gnupg_have_ldap from "n/a" to "no" or "yes".
1047
1048 AC_ARG_ENABLE(ldap,
1049     AC_HELP_STRING([--disable-ldap],[disable LDAP support]),
1050     [if test "$enableval" = "no"; then gnupg_have_ldap=no; fi])
1051
1052 if test "$gnupg_have_ldap" != "no" ; then
1053   if test "$build_dirmngr" = "yes" ; then
1054      GNUPG_CHECK_LDAP($NETLIBS)
1055      AC_CHECK_LIB(lber, ber_free,
1056                   [ LBER_LIBS="$LBER_LIBS -llber"
1057                     AC_DEFINE(HAVE_LBER,1,
1058                              [defined if liblber is available])
1059                     have_lber=yes
1060                  ])
1061   fi
1062 fi
1063 AC_SUBST(LBER_LIBS)
1064 if test "$gnupg_have_ldap" = "no"; then
1065     AC_MSG_WARN([[
1066 ***
1067 *** Building without LDAP support.
1068 *** No CRL access or X.509 certificate search available.
1069 ***]])
1070 fi
1071
1072 AM_CONDITIONAL(USE_LDAP, [test "$gnupg_have_ldap" = yes])
1073 if test "$gnupg_have_ldap" = yes ; then
1074   AC_DEFINE(USE_LDAP,1,[Defined if LDAP is support])
1075 else
1076  use_ldapwrapper=no
1077 fi
1078
1079 if test "$use_ldapwrapper" = yes; then
1080    AC_DEFINE(USE_LDAPWRAPPER,1, [Build dirmngr with LDAP wrapper process])
1081 fi
1082 AM_CONDITIONAL(USE_LDAPWRAPPER, test "$use_ldapwrapper" = yes)
1083
1084
1085
1086
1087 #
1088 # Check for sendmail
1089 #
1090 # This isn't necessarily sendmail itself, but anything that gives a
1091 # sendmail-ish interface to the outside world.  That includes Exim,
1092 # Postfix, etc.  Basically, anything that can handle "sendmail -t".
1093 AC_ARG_WITH(mailprog,
1094       AC_HELP_STRING([--with-mailprog=NAME],
1095                      [use "NAME -t" for mail transport]),
1096              ,with_mailprog=yes)
1097 if test x"$with_mailprog" = xyes ; then
1098     AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
1099 elif test x"$with_mailprog" != xno ; then
1100     AC_MSG_CHECKING([for a mail transport program])
1101     AC_SUBST(SENDMAIL,$with_mailprog)
1102     AC_MSG_RESULT($with_mailprog)
1103 fi
1104
1105
1106 #
1107 # Construct a printable name of the OS
1108 #
1109 case "${host}" in
1110     *-mingw32ce*)
1111         PRINTABLE_OS_NAME="W32CE"
1112         ;;
1113     *-mingw32*)
1114         PRINTABLE_OS_NAME="MingW32"
1115         ;;
1116     *-*-cygwin*)
1117         PRINTABLE_OS_NAME="Cygwin"
1118         ;;
1119     i?86-emx-os2 | i?86-*-os2*emx )
1120         PRINTABLE_OS_NAME="OS/2"
1121         ;;
1122     i?86-*-msdosdjgpp*)
1123         PRINTABLE_OS_NAME="MSDOS/DJGPP"
1124         try_dynload=no
1125         ;;
1126     *-linux*)
1127         PRINTABLE_OS_NAME="GNU/Linux"
1128         ;;
1129     *)
1130         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
1131         ;;
1132 esac
1133 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
1134                    [A human readable text with the name of the OS])
1135
1136
1137 #
1138 # Checking for iconv
1139 #
1140 if test "$require_iconv" = yes; then
1141   AM_ICONV
1142 else
1143   LIBICONV=
1144   LTLIBICONV=
1145   AC_SUBST(LIBICONV)
1146   AC_SUBST(LTLIBICONV)
1147 fi
1148
1149
1150 #
1151 # Check for gettext
1152 #
1153 # This is "GNU gnupg" - The project-id script from gettext
1154 #                       needs this string
1155 #
1156 AC_MSG_NOTICE([checking for gettext])
1157 AM_PO_SUBDIRS
1158 AM_GNU_GETTEXT_VERSION([0.17])
1159 if test "$try_gettext" = yes; then
1160   AM_GNU_GETTEXT([external],[need-ngettext])
1161
1162   # gettext requires some extra checks.  These really should be part of
1163   # the basic AM_GNU_GETTEXT macro.  TODO: move other gettext-specific
1164   # function checks to here.
1165
1166   AC_CHECK_FUNCS(strchr)
1167 else
1168   USE_NLS=no
1169   USE_INCLUDED_LIBINTL=no
1170   BUILD_INCLUDED_LIBINTL=no
1171   POSUB=po
1172   AC_SUBST(USE_NLS)
1173   AC_SUBST(USE_INCLUDED_LIBINTL)
1174   AC_SUBST(BUILD_INCLUDED_LIBINTL)
1175   AC_SUBST(POSUB)
1176 fi
1177
1178 # We use HAVE_LANGINFO_CODESET in a couple of places.
1179 AM_LANGINFO_CODESET
1180
1181 # Checks required for our use of locales
1182 gt_LC_MESSAGES
1183
1184
1185 #
1186 # SELinux support
1187 #
1188 if test "$selinux_support" = yes ; then
1189   AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1190 fi
1191
1192
1193 #
1194 # Checks for header files.
1195 #
1196 AC_MSG_NOTICE([checking for header files])
1197 AC_HEADER_STDC
1198 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
1199                   pty.h utmp.h pwd.h inttypes.h signal.h])
1200 AC_HEADER_TIME
1201
1202
1203 #
1204 # Checks for typedefs, structures, and compiler characteristics.
1205 #
1206 AC_MSG_NOTICE([checking for system characteristics])
1207 AC_C_CONST
1208 AC_C_INLINE
1209 AC_C_VOLATILE
1210 AC_TYPE_SIZE_T
1211 AC_TYPE_MODE_T
1212 AC_TYPE_SIGNAL
1213 AC_DECL_SYS_SIGLIST
1214
1215 gl_HEADER_SYS_SOCKET
1216 gl_TYPE_SOCKLEN_T
1217
1218 AC_SEARCH_LIBS([inet_addr], [nsl])
1219
1220 AC_ARG_ENABLE(endian-check,
1221               AC_HELP_STRING([--disable-endian-check],
1222               [disable the endian check and trust the OS provided macros]),
1223               endiancheck=$enableval,endiancheck=yes)
1224
1225 if test x"$endiancheck" = xyes ; then
1226   GNUPG_CHECK_ENDIAN
1227 fi
1228
1229 # fixme: we should get rid of the byte type
1230 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
1231 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
1232 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
1233 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
1234 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
1235
1236 AC_CHECK_SIZEOF(unsigned short)
1237 AC_CHECK_SIZEOF(unsigned int)
1238 AC_CHECK_SIZEOF(unsigned long)
1239 AC_CHECK_SIZEOF(unsigned long long)
1240 AC_HEADER_TIME
1241 AC_CHECK_SIZEOF(time_t,,[[
1242 #include <stdio.h>
1243 #if TIME_WITH_SYS_TIME
1244 # include <sys/time.h>
1245 # include <time.h>
1246 #else
1247 # if HAVE_SYS_TIME_H
1248 #  include <sys/time.h>
1249 # else
1250 #  include <time.h>
1251 # endif
1252 #endif
1253 ]])
1254 GNUPG_TIME_T_UNSIGNED
1255
1256
1257 if test "$ac_cv_sizeof_unsigned_short" = "0" \
1258    || test "$ac_cv_sizeof_unsigned_int" = "0" \
1259    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
1260     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
1261 fi
1262
1263
1264 #
1265 # Checks for library functions.
1266 #
1267 AC_MSG_NOTICE([checking for library functions])
1268 AC_CHECK_DECLS(getpagesize)
1269 AC_FUNC_FSEEKO
1270 AC_FUNC_VPRINTF
1271 AC_FUNC_FORK
1272 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
1273 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
1274 AC_CHECK_FUNCS([unsetenv fcntl ftruncate inet_ntop canonicalize_file_name])
1275 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
1276 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
1277 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
1278 AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat])
1279
1280 if test "$have_android_system" = yes; then
1281    # On Android ttyname is a stub but prints an error message.
1282    AC_DEFINE(HAVE_BROKEN_TTYNAME,1,
1283              [Defined if ttyname does not work properly])
1284 fi
1285
1286 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1287
1288 # Dirmngr requires mmap on Unix systems.
1289 if test $ac_cv_func_mmap != yes -a $mmap_needed = yes; then
1290   AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]])
1291 fi
1292
1293 #
1294 # These are needed by the jnlib parts in common.
1295 # Note:  We already checked pwd.h.
1296 AC_CHECK_HEADERS([signal.h])
1297 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
1298                 memrchr isascii timegm getrusage setrlimit stat setlocale   \
1299                 flockfile funlockfile fopencookie funopen getpwnam getpwuid \
1300                 getenv inet_pton])
1301 # end jnlib checks.
1302
1303
1304
1305 #
1306 # gnulib checks
1307 #
1308 gl_SOURCE_BASE([gl])
1309 gl_M4_BASE([gl/m4])
1310 gl_MODULES([setenv mkdtemp xsize strpbrk])
1311 gl_INIT
1312
1313
1314 #
1315 # W32 specific test
1316 #
1317 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1318
1319 #
1320 # Sanity check regex.  Tests adapted from mutt.
1321 #
1322 AC_MSG_CHECKING([whether regular expression support is requested])
1323 AC_ARG_ENABLE(regex,
1324   AC_HELP_STRING([--disable-regex],
1325     [do not handle regular expressions in trust signatures]),
1326   use_regex=$enableval, use_regex=yes)
1327 AC_MSG_RESULT($use_regex)
1328
1329 if test "$use_regex" = yes ; then
1330   _cppflags="${CPPFLAGS}"
1331   _ldflags="${LDFLAGS}"
1332   AC_ARG_WITH(regex,
1333      AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1334       [
1335       if test -d "$withval" ; then
1336         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1337         LDFLAGS="${LDFLAGS} -L$withval/lib"
1338       fi
1339       ],withval="")
1340
1341   # Does the system have regex functions at all?
1342   AC_SEARCH_LIBS([regcomp], [regex])
1343   AC_CHECK_FUNC(regcomp, gnupg_cv_have_regex=yes, gnupg_cv_have_regex=no)
1344
1345   if test $gnupg_cv_have_regex = no; then
1346     use_regex=no
1347   else
1348     if test x"$cross_compiling" = xyes; then
1349       AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1350     else
1351       AC_CACHE_CHECK([whether your system's regexp library is broken],
1352        [gnupg_cv_regex_broken],
1353        AC_TRY_RUN([
1354 #include <unistd.h>
1355 #include <regex.h>
1356 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); }],
1357        gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1358
1359       if test $gnupg_cv_regex_broken = yes; then
1360         AC_MSG_WARN([your regex is broken - disabling regex use])
1361         use_regex=no
1362       fi
1363     fi
1364   fi
1365   CPPFLAGS="${_cppflags}"
1366   LDFLAGS="${_ldflags}"
1367 fi
1368
1369 if test "$use_regex" != yes ; then
1370   AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1371 fi
1372 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1373
1374
1375
1376 #
1377 # Do we have zlib? Must do it here because Solaris failed
1378 # when compiling a conftest (due to the "-lz" from LIBS).
1379 # Note that we combine zlib and bzlib2 in ZLIBS.
1380 #
1381 if test "$use_zip" = yes ; then
1382   _cppflags="${CPPFLAGS}"
1383   _ldflags="${LDFLAGS}"
1384   AC_ARG_WITH(zlib,
1385     [  --with-zlib=DIR         use libz in DIR],[
1386       if test -d "$withval"; then
1387         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1388         LDFLAGS="${LDFLAGS} -L$withval/lib"
1389       fi
1390     ])
1391
1392   AC_CHECK_HEADER(zlib.h,
1393      AC_CHECK_LIB(z, deflateInit2_,
1394        [
1395        ZLIBS="-lz"
1396        AC_DEFINE(HAVE_ZIP,1, [Defined if ZIP and ZLIB are supported])
1397        ],
1398        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1399        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1400 fi
1401
1402
1403 #
1404 # Check whether we can support bzip2
1405 #
1406 if test "$use_bzip2" = yes ; then
1407   _cppflags="${CPPFLAGS}"
1408   _ldflags="${LDFLAGS}"
1409   AC_ARG_WITH(bzip2,
1410      AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1411       [
1412       if test -d "$withval" ; then
1413         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1414         LDFLAGS="${LDFLAGS} -L$withval/lib"
1415       fi
1416       ],withval="")
1417
1418   # Checking alongside stdio.h as an early version of bzip2 (1.0)
1419   # required stdio.h to be included before bzlib.h, and Solaris 9 is
1420   # woefully out of date.
1421   if test "$withval" != no ; then
1422      AC_CHECK_HEADER(bzlib.h,
1423         AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1424           [
1425           have_bz2=yes
1426           ZLIBS="$ZLIBS -lbz2"
1427           AC_DEFINE(HAVE_BZIP2,1,
1428                   [Defined if the bz2 compression library is available])
1429           ],
1430           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1431           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1432   fi
1433 fi
1434 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1435 AC_SUBST(ZLIBS)
1436
1437
1438 # Check for readline support
1439 GNUPG_CHECK_READLINE
1440
1441
1442 if test "$development_version" = yes; then
1443     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1444             [Defined if this is not a regular release])
1445 fi
1446
1447 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1448
1449 GNUPG_CHECK_GNUMAKE
1450
1451 # Add some extra libs here so that previous tests don't fail for
1452 # mysterious reasons - the final link step should bail out.
1453 # W32SOCKLIBS is also defined so that if can be used for tools not
1454 # requiring any network stuff but linking to code in libcommon which
1455 # tracks in winsock stuff (e.g. init_common_subsystems).
1456 if test "$have_w32_system" = yes; then
1457    if test "$have_w32ce_system" = yes; then
1458      W32SOCKLIBS="-lws2"
1459    else
1460      W32SOCKLIBS="-lws2_32"
1461    fi
1462    NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1463 fi
1464
1465 AC_SUBST(NETLIBS)
1466 AC_SUBST(W32SOCKLIBS)
1467
1468 #
1469 # Setup gcc specific options
1470 #
1471 AC_MSG_NOTICE([checking for cc features])
1472 if test "$GCC" = yes; then
1473     # Check whether gcc does not emit a diagnositc for unknow -Wno-*
1474     # options.  This is the case for gcc >= 4.6
1475     AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
1476     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1477 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
1478 #kickerror
1479 #endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
1480     AC_MSG_RESULT($_gcc_silent_wno)
1481
1482     # Note that it is okay to use CFLAGS here because these are just
1483     # warning options and the user should have a chance of overriding
1484     # them.
1485     if test "$USE_MAINTAINER_MODE" = "yes"; then
1486         CFLAGS="$CFLAGS -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1487         CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1488         if test x"$_gcc_silent_wno" = xyes ; then
1489           _gcc_wopt=yes
1490         else
1491           AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1492           _gcc_cflags_save=$CFLAGS
1493           CFLAGS="-Wno-missing-field-initializers"
1494           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1495                             [_gcc_wopt=yes],[_gcc_wopt=no])
1496           AC_MSG_RESULT($_gcc_wopt)
1497           CFLAGS=$_gcc_cflags_save;
1498         fi
1499         if test x"$_gcc_wopt" = xyes ; then
1500           CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
1501         fi
1502
1503         AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
1504         _gcc_cflags_save=$CFLAGS
1505         CFLAGS="-Wdeclaration-after-statement"
1506         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1507         AC_MSG_RESULT($_gcc_wopt)
1508         CFLAGS=$_gcc_cflags_save;
1509         if test x"$_gcc_wopt" = xyes ; then
1510           CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1511         fi
1512     else
1513         CFLAGS="$CFLAGS -Wall"
1514     fi
1515
1516     if test x"$_gcc_silent_wno" = xyes ; then
1517       _gcc_psign=yes
1518     else
1519       AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1520       _gcc_cflags_save=$CFLAGS
1521       CFLAGS="-Wno-pointer-sign"
1522       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1523                         [_gcc_psign=yes],[_gcc_psign=no])
1524       AC_MSG_RESULT($_gcc_psign)
1525       CFLAGS=$_gcc_cflags_save;
1526     fi
1527     if test x"$_gcc_psign" = xyes ; then
1528        CFLAGS="$CFLAGS -Wno-pointer-sign"
1529     fi
1530
1531     AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1532     _gcc_cflags_save=$CFLAGS
1533     CFLAGS="-Wpointer-arith"
1534     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
1535     AC_MSG_RESULT($_gcc_psign)
1536     CFLAGS=$_gcc_cflags_save;
1537     if test x"$_gcc_psign" = xyes ; then
1538        CFLAGS="$CFLAGS -Wpointer-arith"
1539     fi
1540 fi
1541
1542
1543 #
1544 # This is handy for debugging so the compiler doesn't rearrange
1545 # things and eliminate variables.
1546 #
1547 AC_ARG_ENABLE(optimization,
1548    AC_HELP_STRING([--disable-optimization],
1549                   [disable compiler optimization]),
1550                   [if test $enableval = no ; then
1551                       CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
1552                    fi])
1553
1554 #
1555 # Decide what to build
1556 #
1557
1558 build_scdaemon_extra=""
1559 if test "$build_scdaemon" = "yes"; then
1560   if test $have_libusb = no; then
1561      build_scdaemon_extra="without internal CCID driver"
1562   fi
1563   if test -n "$build_scdaemon_extra"; then
1564      build_scdaemon_extra="(${build_scdaemon_extra})"
1565   fi
1566 fi
1567
1568
1569 #
1570 # Set variables for use by automake makefiles.
1571 #
1572 AM_CONDITIONAL(BUILD_GPG,         test "$build_gpg" = "yes")
1573 AM_CONDITIONAL(BUILD_GPGSM,       test "$build_gpgsm" = "yes")
1574 AM_CONDITIONAL(BUILD_AGENT,       test "$build_agent" = "yes")
1575 AM_CONDITIONAL(BUILD_SCDAEMON,    test "$build_scdaemon" = "yes")
1576 AM_CONDITIONAL(BUILD_G13,         test "$build_g13" = "yes")
1577 AM_CONDITIONAL(BUILD_DIRMNGR,     test "$build_dirmngr" = "yes")
1578 AM_CONDITIONAL(BUILD_TOOLS,       test "$build_tools" = "yes")
1579 AM_CONDITIONAL(BUILD_DOC,         test "$build_doc" = "yes")
1580 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1581 AM_CONDITIONAL(BUILD_GPGTAR,      test "$build_gpgtar" = "yes")
1582
1583 AM_CONDITIONAL(ENABLE_CARD_SUPPORT, test "$card_support" = yes)
1584 AM_CONDITIONAL(NO_TRUST_MODELS, test "$use_trust_models" = no)
1585
1586 AM_CONDITIONAL(RUN_GPG_TESTS,
1587                test x$cross_compiling = xno -a "$build_gpg" = yes )
1588
1589 #
1590 # Set some defines for use gpgconf.
1591 #
1592 if test "$build_gpg" = yes ; then
1593     AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build])
1594 fi
1595 if test "$build_gpgsm" = yes ; then
1596     AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build])
1597 fi
1598 if test "$build_agent" = yes ; then
1599     AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build])
1600 fi
1601 if test "$build_scdaemon" = yes ; then
1602     AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build])
1603 fi
1604 if test "$build_dirmngr" = yes ; then
1605     AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build])
1606 fi
1607 if test "$build_g13" = yes ; then
1608     AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build])
1609 fi
1610
1611
1612 #
1613 # Define Name strings
1614 #
1615 AC_DEFINE_UNQUOTED(GNUPG_NAME, "GnuPG", [The name of the project])
1616
1617 AC_DEFINE_UNQUOTED(GPG_NAME, "gpg", [The name of the OpenPGP tool])
1618 AC_DEFINE_UNQUOTED(GPG_DISP_NAME, "GnuPG", [The displayed name of gpg])
1619
1620 AC_DEFINE_UNQUOTED(GPGSM_NAME, "gpgsm", [The name of the S/MIME tool])
1621 AC_DEFINE_UNQUOTED(GPGSM_DISP_NAME, "GPGSM", [The displayed name of gpgsm])
1622
1623 AC_DEFINE_UNQUOTED(GPG_AGENT_NAME, "gpg-agent", [The name of the agent])
1624 AC_DEFINE_UNQUOTED(GPG_AGENT_DISP_NAME, "GPG Agent",
1625                                         [The displayed name of gpg-agent])
1626
1627 AC_DEFINE_UNQUOTED(SCDAEMON_NAME, "scdaemon", [The name of the scdaemon])
1628 AC_DEFINE_UNQUOTED(SCDAEMON_DISP_NAME, "SCDaemon",
1629                                        [The displayed name of scdaemon])
1630
1631 AC_DEFINE_UNQUOTED(DIRMNGR_NAME, "dirmngr", [The name of the dirmngr])
1632 AC_DEFINE_UNQUOTED(DIRMNGR_DISP_NAME, "DirMngr",
1633                                       [The displayed name of dirmngr])
1634
1635 AC_DEFINE_UNQUOTED(G13_NAME, "g13", [The name of the g13 tool])
1636 AC_DEFINE_UNQUOTED(G13_DISP_NAME, "G13", [The displayed name of g13])
1637
1638 AC_DEFINE_UNQUOTED(GPGCONF_NAME, "gpgconf", [The name of the gpgconf tool])
1639 AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf",
1640                                       [The displayed name of gpgconf])
1641
1642 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
1643
1644 AC_DEFINE_UNQUOTED(GPG_AGENT_SOCK_NAME, "S.gpg-agent",
1645                    [The name of the agent socket])
1646 AC_DEFINE_UNQUOTED(GPG_AGENT_SSH_SOCK_NAME, "S.gpg-agent.ssh",
1647                    [The name of the agent socket for ssh])
1648 AC_DEFINE_UNQUOTED(DIRMNGR_INFO_NAME, "DIRMNGR_INFO",
1649                    [The name of the dirmngr info envvar])
1650 AC_DEFINE_UNQUOTED(SCDAEMON_SOCK_NAME, "S.scdaemon",
1651                    [The name of the SCdaemon socket])
1652 AC_DEFINE_UNQUOTED(DIRMNGR_SOCK_NAME, "S.dirmngr",
1653                    [The name of the dirmngr socket])
1654
1655 AC_DEFINE_UNQUOTED(GPGEXT_GPG, "gpg", [The standard binary file suffix])
1656
1657 if test "$have_w32_system" = yes; then
1658   AC_DEFINE_UNQUOTED(GNUPG_REGISTRY_DIR, "\\\\Software\\\\GNU\\\\GnuPG",
1659                      [The directory part of the W32 registry keys])
1660 fi
1661
1662
1663 #
1664 # Provide information about the build.
1665 #
1666 BUILD_REVISION="mym4_revision"
1667 AC_SUBST(BUILD_REVISION)
1668 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
1669                    [GIT commit id revision used to build this package])
1670
1671 changequote(,)dnl
1672 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
1673 changequote([,])dnl
1674 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
1675 AC_SUBST(BUILD_FILEVERSION)
1676
1677 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
1678 AC_SUBST(BUILD_TIMESTAMP)
1679 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
1680                    [The time this package was configured for a build])
1681 BUILD_HOSTNAME="$ac_hostname"
1682 AC_SUBST(BUILD_HOSTNAME)
1683
1684
1685 #
1686 # Print errors here so that they are visible all
1687 # together and the user can acquire them all together.
1688 #
1689 die=no
1690 if test "$have_gpg_error" = "no"; then
1691    die=yes
1692    AC_MSG_NOTICE([[
1693 ***
1694 *** You need libgpg-error to build this program.
1695 **  This library is for example available at
1696 ***   ftp://ftp.gnupg.org/gcrypt/libgpg-error
1697 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1698 ***]])
1699 fi
1700 if test "$have_libgcrypt" = "no"; then
1701    die=yes
1702    AC_MSG_NOTICE([[
1703 ***
1704 *** You need libgcrypt to build this program.
1705 **  This library is for example available at
1706 ***   ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1707 *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API) is required.)
1708 ***]])
1709 fi
1710 if test "$have_libassuan" = "no"; then
1711    die=yes
1712    AC_MSG_NOTICE([[
1713 ***
1714 *** You need libassuan to build this program.
1715 *** This library is for example available at
1716 ***   ftp://ftp.gnupg.org/gcrypt/libassuan/
1717 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1718 ***]])
1719 fi
1720 if test "$have_ksba" = "no"; then
1721     die=yes
1722     AC_MSG_NOTICE([[
1723 ***
1724 *** You need libksba to build this program.
1725 *** This library is for example available at
1726 ***   ftp://ftp.gnupg.org/gcrypt/libksba/
1727 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1728 ***]])
1729 fi
1730 if test "$gnupg_have_ldap" = yes; then
1731   if test "$have_w32ce_system" = yes; then
1732     AC_MSG_NOTICE([[
1733 *** Note that CeGCC might be broken, a package fixing this is:
1734 ***    http://files.kolab.org/local/windows-ce/
1735 ***                           source/wldap32_0.1-mingw32ce.orig.tar.gz
1736 ***                           binary/wldap32-ce-arm-dev_0.1-1_all.deb
1737 ***]])
1738    fi
1739 fi
1740 if test "$have_npth" = "no"; then
1741     die=yes
1742     AC_MSG_NOTICE([[
1743 ***
1744 *** It is now required to build with support for the
1745 *** New Portable Threads Library (nPth). Please install this
1746 *** library first.  The library is for example available at
1747 ***   ftp://ftp.gnupg.org/gcrypt/npth/
1748 *** (at least version $NEED_NPTH_VERSION (API $NEED_NPTH_API) is required).
1749 ***]])
1750 fi
1751
1752 if test "$require_iconv" = yes; then
1753   if test "$am_func_iconv" != yes; then
1754     die=yes
1755     AC_MSG_NOTICE([[
1756 ***
1757 *** The system does not provide a working iconv function.  Please
1758 *** install a suitable library; for example GNU Libiconv which is
1759 *** available at:
1760 ***   http://ftp.gnu.org/gnu/libiconv/
1761 ***]])
1762   fi
1763 fi
1764
1765 if test "$die" = "yes"; then
1766     AC_MSG_ERROR([[
1767 ***
1768 *** Required libraries not found. Please consult the above messages
1769 *** and install them before running configure again.
1770 ***]])
1771 fi
1772
1773
1774
1775 AC_CONFIG_FILES([ m4/Makefile
1776 Makefile
1777 po/Makefile.in
1778 gl/Makefile
1779 common/Makefile
1780 common/w32info-rc.h
1781 kbx/Makefile
1782 g10/Makefile
1783 sm/Makefile
1784 agent/Makefile
1785 scd/Makefile
1786 g13/Makefile
1787 dirmngr/Makefile
1788 tools/gpg-zip
1789 tools/Makefile
1790 doc/Makefile
1791 tests/Makefile
1792 tests/openpgp/Makefile
1793 tests/pkits/Makefile
1794 ])
1795
1796
1797 AC_OUTPUT
1798
1799
1800 echo "
1801         GnuPG v${VERSION} has been configured as follows:
1802
1803         Revision:  mym4_revision  (mym4_revision_dec)
1804         Platform:  $PRINTABLE_OS_NAME ($host)
1805
1806         OpenPGP:   $build_gpg
1807         S/MIME:    $build_gpgsm
1808         Agent:     $build_agent
1809         Smartcard: $build_scdaemon $build_scdaemon_extra
1810         G13:       $build_g13
1811         Dirmngr:   $build_dirmngr
1812         Gpgtar:    $build_gpgtar
1813
1814         Protect tool:      $show_gnupg_protect_tool_pgm
1815         LDAP wrapper:      $show_gnupg_dirmngr_ldap_pgm
1816         Default agent:     $show_gnupg_agent_pgm
1817         Default pinentry:  $show_gnupg_pinentry_pgm
1818         Default scdaemon:  $show_gnupg_scdaemon_pgm
1819         Default dirmngr:   $show_gnupg_dirmngr_pgm
1820
1821         Dirmngr auto start:  $dirmngr_auto_start
1822         Readline support:    $gnupg_cv_have_readline
1823         LDAP support:        $gnupg_have_ldap
1824         DNS SRV support:     $use_dns_srv
1825         TLS support:         $use_tls_library
1826 "
1827 if test x"$use_regex" != xyes ; then
1828 echo "
1829         Warning: No regular expression support available.
1830                  OpenPGP trust signatures won't work.
1831                  gpg-check-pattern will not be build.
1832 "
1833 fi
1834 if test "x${gpg_config_script_warn}" != x; then
1835 cat <<G10EOF
1836         Warning: Mismatches between the target platform and the
1837                  to be used libraries have been detected for:
1838                   ${gpg_config_script_warn}
1839                  Please check above for more warning messages.
1840
1841 G10EOF
1842 fi