Imported Upstream version 2.1.0
[platform/upstream/gpg2.git] / configure.ac
1 # configure.ac - for GnuPG 2.1
2 # Copyright (C) 1998-2012 Free Software Foundation, Inc.
3 # Copyright (C) 1998-2014 Werner Koch
4 #
5 # This file is part of GnuPG.
6 #
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.
11 #
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.
16 #
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/>.
19
20 # Process this file with autoconf to produce a configure script.
21 AC_PREREQ(2.61)
22 min_automake_version="1.10"
23
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])
32
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.
38
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])
51
52 NEED_GPG_ERROR_VERSION=1.15
53
54 NEED_LIBGCRYPT_API=1
55 NEED_LIBGCRYPT_VERSION=1.6.0
56
57 NEED_LIBASSUAN_API=2
58 NEED_LIBASSUAN_VERSION=2.1.0
59
60 NEED_KSBA_API=1
61 NEED_KSBA_VERSION=1.2.0
62
63 NEED_NTBTLS_API=1
64 NEED_NTBTLS_VERSION=0.1.0
65
66 NEED_NPTH_API=1
67 NEED_NPTH_VERSION=0.91
68
69
70 NEED_GNUTLS_VERSION=3.0
71
72
73 development_version=mym4_isbeta
74 PACKAGE=$PACKAGE_NAME
75 PACKAGE_GT=${PACKAGE_NAME}2
76 VERSION=$PACKAGE_VERSION
77
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
82 #          serial-tests
83 AM_INIT_AUTOMAKE([dist-bzip2 no-dist-gzip])
84 AC_CANONICAL_HOST
85 AB_INIT
86
87 AC_GNU_SOURCE
88
89 # Some status variables.
90 have_gpg_error=no
91 have_libgcrypt=no
92 have_libassuan=no
93 have_ksba=no
94 have_ntbtls=no
95 have_gnutls=no
96 have_npth=no
97 have_libusb=no
98 have_adns=no
99 gnupg_have_ldap="n/a"
100
101 use_zip=yes
102 use_bzip2=yes
103 use_exec=yes
104 use_trust_models=yes
105 card_support=yes
106 use_ccid_driver=yes
107 dirmngr_auto_start=yes
108 use_tls_library=no
109 large_secmem=no
110
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)
121
122 AC_SUBST(PACKAGE)
123 AC_SUBST(PACKAGE_GT)
124 AC_SUBST(VERSION)
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])
137
138
139
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"
152
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"
160
161
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"
169
170
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"
178
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"
187
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"
196
197 #
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.
203 #
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
209 else
210    name_of_installed_gpg=gpg2
211 fi
212 AC_DEFINE_UNQUOTED(NAME_OF_INSTALLED_GPG, "$name_of_installed_gpg",
213                    [The name of the installed GPG tool])
214
215
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)
224
225
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
234 else
235    SECMEM_BUFFER_SIZE=32768
236 fi
237 AC_DEFINE_UNQUOTED(SECMEM_BUFFER_SIZE,$SECMEM_BUFFER_SIZE,
238                    [Size of secure memory buffer])
239
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])
249 fi
250
251
252 #
253 # Options to disable algorithm
254 #
255
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])
262
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])
274
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])
282
283
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])
288 AC_ARG_ENABLE(zip,
289    AC_HELP_STRING([--disable-zip],
290                   [disable the ZIP and ZLIB compression algorithm]),
291    use_zip=$enableval)
292 AC_MSG_RESULT($use_zip)
293
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])
297 AC_ARG_ENABLE(bzip2,
298    AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
299    use_bzip2=$enableval)
300 AC_MSG_RESULT($use_bzip2)
301
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])
305 AC_ARG_ENABLE(exec,
306     AC_HELP_STRING([--disable-exec],[disable all external program execution]),
307     use_exec=$enableval)
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])
311 fi
312
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])
319       fi],enableval=yes)
320   gnupg_cv_enable_photo_viewers=$enableval
321   AC_MSG_RESULT($enableval)
322
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
328            withval=no
329         elif test "$withval" != no ; then
330            AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
331                             [if set, restrict photo-viewer to this])
332         fi],withval=no)
333     AC_MSG_RESULT($withval)
334   fi
335 fi
336
337
338 #
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.
341 #
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
347    enableval=5
348 elif test "$enableval" = "yes" || test "$enableval" = ""; then
349    enableval=4096
350 fi
351 changequote(,)dnl
352 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
353 changequote([,])dnl
354 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
355    AC_MSG_ERROR([invalid key-cache size])
356 fi
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])
360
361
362
363 #
364 # Check whether we want to use Linux capabilities
365 #
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)
371
372 #
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])
382 else
383   build_scdaemon=no
384 fi
385
386 #
387 # Allow disabling of internal CCID support.
388 # It is defined only after we confirm the library is available later
389 #
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)
396
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])
406 fi
407
408
409 #
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
412 # config.h.
413 #
414 AH_TOP([
415 #ifndef GNUPG_CONFIG_H_INCLUDED
416 #define GNUPG_CONFIG_H_INCLUDED
417 ])
418
419 #
420 # Stuff which goes at the bottom of config.h.
421 #
422 AH_BOTTOM([
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
427
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 "\\"
434 #define EXTSEP_C '.'
435 #define EXTSEP_S "."
436 #define PATHSEP_C ';'
437 #define PATHSEP_S ";"
438 #define EXEEXT_S ".exe"
439 #else
440 #define DIRSEP_C '/'
441 #define DIRSEP_S "/"
442 #define EXTSEP_C '.'
443 #define EXTSEP_S "."
444 #define PATHSEP_C ':'
445 #define PATHSEP_S ":"
446 #define EXEEXT_S ""
447 #endif
448
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 '-'
456
457 /* Some global constants. */
458 #ifdef HAVE_DOSISH_SYSTEM
459 # ifdef HAVE_DRIVE_LETTERS
460 #  define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
461 # else
462 #  define GNUPG_DEFAULT_HOMEDIR "/gnupg"
463 # endif
464 #elif defined(__VMS)
465 #define GNUPG_DEFAULT_HOMEDIR "/SYS$LOGIN/gnupg"
466 #else
467 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
468 #endif
469 #define GNUPG_PRIVATE_KEYS_DIR  "private-keys-v1.d"
470 #define GNUPG_OPENPGP_REVOC_DIR "openpgp-revocs.d"
471
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
476    only defaults.  */
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"
484 # else
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"
490 # endif
491 #endif
492
493 /* Derive some other constants. */
494 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
495 #define EXEC_TEMPFILE_ONLY
496 #endif
497
498
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
506 #else
507 #error "No endianness found"
508 #endif
509 #endif
510
511
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
519 # endif
520 #endif
521
522 /* Provide the es_ macro for estream.  */
523 #define GPGRT_ENABLE_ES_MACROS 1
524
525 /* Tell libgcrypt not to use its own libgpg-error implementation. */
526 #define USE_LIBGPG_ERROR 1
527
528 /* Tell Libgcrypt not to include deprecated definitions.  */
529 #define GCRYPT_NO_DEPRECATED 1
530
531 /* We use jnlib, so tell other modules about it.  */
532 #define HAVE_JNLIB_LOGGING 1
533
534 /* Our HTTP code is used in estream mode.  */
535 #define HTTP_USE_ESTREAM 1
536
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
539    handler.  */
540 #define HTTP_NO_WSASTARTUP
541
542 /* Under Windows we use the gettext code from libgpg-error.  */
543 #define GPG_ERR_ENABLE_GETTEXT_MACROS
544
545 /* Under WindowsCE we use the strerror replacement from libgpg-error.  */
546 #define GPG_ERR_ENABLE_ERRNO_MACROS
547
548 #endif /*GNUPG_CONFIG_H_INCLUDED*/
549 ])
550
551
552 AM_MAINTAINER_MODE
553 AC_ARG_VAR(SYSROOT,[locate config scripts also below that directory])
554
555 # Checks for programs.
556 AC_MSG_NOTICE([checking for programs])
557 AC_PROG_MAKE_SET
558 AM_SANITY_CHECK
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)
565 AM_SILENT_RULES
566 AC_PROG_AWK
567 AC_PROG_CC
568 AC_PROG_CPP
569 AM_PROG_CC_C_O
570 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
571   AC_MSG_ERROR([[No C-89 compiler found]])
572 fi
573 AC_PROG_INSTALL
574 AC_PROG_LN_S
575 AC_PROG_RANLIB
576 AC_CHECK_TOOL(AR, ar, :)
577 AC_PATH_PROG(PERL,"perl")
578 AC_CHECK_TOOL(WINDRES, windres, :)
579 AC_ISC_POSIX
580 gl_EARLY
581 AC_SYS_LARGEFILE
582 GNUPG_CHECK_USTAR
583
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
589 # approach.
590 AC_MSG_CHECKING(for cc for build)
591 if test "$cross_compiling" = "yes"; then
592   CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
593 else
594   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
595 fi
596 AC_MSG_RESULT($CC_FOR_BUILD)
597 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
598
599
600
601 try_gettext=yes
602 require_iconv=yes
603 have_dosish_system=no
604 have_w32_system=no
605 have_w32ce_system=no
606 have_android_system=no
607 run_tests=yes
608 use_simple_gettext=no
609 use_ldapwrapper=yes
610 mmap_needed=yes
611 case "${host}" in
612     *-mingw32*)
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
622         have_w32_system=yes
623         run_tests=no
624         use_ldapwrapper=no  # Fixme: Do this only for CE.
625         case "${host}" in
626           *-mingw32ce*)
627             have_w32ce_system=yes
628             ;;
629           *)
630             AC_DEFINE(HAVE_DRIVE_LETTERS,1,
631                       [Defined if the OS supports drive letters.])
632             ;;
633         esac
634         try_gettext="no"
635         use_simple_gettext=yes
636         mmap_needed=no
637         ;;
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
643         try_gettext="no"
644         ;;
645
646     i?86-*-msdosdjgpp*)
647         # DOS with the DJGPP environment
648         ac_cv_have_dev_random=no
649         AC_DEFINE(HAVE_DRIVE_LETTERS)
650         have_dosish_system=yes
651         try_gettext="no"
652         ;;
653
654     *-*-hpux*)
655         if test -z "$GCC" ; then
656             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
657         fi
658         ;;
659     *-dec-osf4*)
660         if test -z "$GCC" ; then
661             # Suppress all warnings
662             # to get rid of the unsigned/signed char mismatch warnings.
663             CFLAGS="$CFLAGS -w"
664         fi
665         ;;
666     *-dec-osf5*)
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"
673         fi
674         ;;
675     m68k-atari-mint)
676         ;;
677     *-linux-androideabi)
678         have_android_system=yes
679         # Android is fully utf-8 and we do not want to use iconv to
680         # keeps things simple
681         require_iconv=no
682         run_tests=no
683         ;;
684     *)
685        ;;
686 esac
687
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.])
694 fi
695 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
696
697 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
698
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])
703    fi
704 fi
705 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
706 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
707
708 if test "$have_android_system" = yes; then
709    AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
710 fi
711 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
712
713 if test "$run_tests" = yes; then
714    AC_DEFINE(RUN_TESTS,1, [Defined if we should run the tests])
715 fi
716 AM_CONDITIONAL(RUN_TESTS, test "$run_tests" = yes)
717
718
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])
721
722
723 #
724 # Checks for libraries.
725 #
726 AC_MSG_NOTICE([checking for libraries])
727
728
729 #
730 # libgpg-error is a library with error codes shared between GnuPG
731 # related projects.
732 #
733 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
734                   have_gpg_error=yes,have_gpg_error=no)
735
736
737 #
738 # Libgcrypt is our generic crypto library
739 #
740 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
741         have_libgcrypt=yes,have_libgcrypt=no)
742
743
744 #
745 # libassuan is used for IPC
746 #
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])
752 fi
753
754
755
756 #
757 # libksba is our X.509 support library
758 #
759 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
760
761
762 #
763 # libusb allows us to use the integrated CCID smartcard reader driver.
764 #
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])
771                   have_libusb=yes
772                ])
773   AC_CHECK_FUNCS(usb_create_match)
774 fi
775 AC_SUBST(LIBUSB_LIBS)
776
777 #
778 # Check wether it is necessary to link against libdl.
779 # (For example to load libpcsclite)
780 #
781 gnupg_dlopen_save_libs="$LIBS"
782 LIBS=""
783 AC_SEARCH_LIBS(dlopen, c dl,,,)
784 DL_LIBS=$LIBS
785 AC_SUBST(DL_LIBS)
786 LIBS="$gnupg_dlopen_save_libs"
787
788 # Checks for g13
789
790 AC_PATH_PROG(ENCFS, encfs, /usr/bin/encfs)
791 AC_DEFINE_UNQUOTED(ENCFS,
792         "${ENCFS}", [defines the filename of the encfs program])
793
794 AC_PATH_PROG(FUSERMOUNT, fusermount, /usr/bin/fusermount)
795 AC_DEFINE_UNQUOTED(FUSERMOUNT,
796         "${FUSERMOUNT}", [defines the filename of the fusermount program])
797
798
799 # Checks for dirmngr
800
801
802 #
803 # Checks for symcryptrun:
804 #
805
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])
811              ])
812 AC_SUBST(LIBUTIL_LIBS)
813
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])
818
819
820 #
821 # Check whether the nPth library is available
822 #
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])
829 else
830   AC_MSG_WARN([[
831 ***
832 *** To support concurrent access for example in gpg-agent and the SCdaemon
833 *** we need the support of the New Portable Threads Library.
834 ***]])
835 fi
836
837
838 #
839 # NTBTLS is our TLS library.  If it is not available fallback to
840 # GNUTLS.
841 #
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])
849 fi
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])
853 else
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],
860                                    [have_gnutls=yes],
861                                    [have_gnutls=no])
862   fi
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])
868   else
869     tmp=$(echo "$LIBGNUTLS_PKG_ERRORS" | tr '\n' '\v' | sed 's/\v/\n*** /g')
870     AC_MSG_WARN([[
871 ***
872 *** Building without NTBTLS and GNUTLS - no TLS access to keyservers.
873 ***
874 *** $tmp]])
875   fi
876 fi
877
878
879 AC_MSG_NOTICE([checking for networking options])
880
881 #
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
885 # be detected.
886 #
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"]))
891
892
893 #
894 # Check for ADNS.
895 #
896 _cppflags="${CPPFLAGS}"
897 _ldflags="${LDFLAGS}"
898 AC_ARG_WITH(adns,
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"
904              fi])
905 if test "$with_adns" != "no"; then
906   AC_CHECK_HEADERS(adns.h,
907                 AC_CHECK_LIB(adns, adns_init,
908                              [have_adns=yes],
909                              [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),
910                 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
911 fi
912 if test "$have_adns" = "yes"; then
913   ADNSLIBS="-ladns"
914 fi
915 AC_SUBST(ADNSLIBS)
916 # Newer adns versions feature a free function to be used under W32.
917 AC_CHECK_FUNCS(adns_free)
918
919
920
921 #
922 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
923 #
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)
928
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)
933
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)
938
939 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
940    || test x"$use_dns_cert" = xyes; then
941   _dns_save_libs=$LIBS
942   LIBS=""
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))
950
951   if test x"$have_resolver" != xno ; then
952
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.
958
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);
966   dn_skipname(0,0);
967   dn_expand(0,0,0,0,0);
968 ]])],have_resolver=yes,have_resolver=no)
969     AC_MSG_RESULT($have_resolver)
970
971     # This is Apple-specific and somewhat bizarre as they changed the
972     # define in bind 8 for some reason.
973
974     if test x"$have_resolver" != xyes ; then
975        AC_MSG_CHECKING(
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)
987     fi
988   fi
989
990   if test x"$have_resolver" = xyes ; then
991      DNSLIBS=$LIBS
992
993      if test x"$use_dns_srv" = xyes ; then
994         AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
995      fi
996
997      if test x"$use_dns_pka" = xyes ; then
998         AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
999      fi
1000
1001      if test x"$use_dns_cert" = xyes ; then
1002         AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1003      fi
1004
1005      if test x"$need_compat" = xyes ; then
1006         AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
1007      fi
1008   else
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
1012         DNSLIBS="$ADNSLIBS"
1013         AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
1014
1015         if test x"$use_dns_srv" = xyes ; then
1016            AC_DEFINE(USE_DNS_SRV,1)
1017         fi
1018
1019         if test x"$use_dns_pka" = xyes ; then
1020            AC_DEFINE(USE_DNS_PKA,1)
1021         fi
1022
1023         if test x"$use_dns_cert" = xyes ; then
1024            AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1025         fi
1026      else
1027         use_dns_srv=no
1028         use_dns_pka=no
1029         use_dns_cert=no
1030      fi
1031   fi
1032
1033   LIBS=$_dns_save_libs
1034 fi
1035
1036 AC_SUBST(DNSLIBS)
1037
1038 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
1039
1040
1041 #
1042 # Check for LDAP
1043 #
1044 # Note that running the check changes the variable
1045 # gnupg_have_ldap from "n/a" to "no" or "yes".
1046
1047 AC_ARG_ENABLE(ldap,
1048     AC_HELP_STRING([--disable-ldap],[disable LDAP support]),
1049     [if test "$enableval" = "no"; then gnupg_have_ldap=no; fi])
1050
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])
1058                     have_lber=yes
1059                  ])
1060   fi
1061 fi
1062 AC_SUBST(LBER_LIBS)
1063 if test "$gnupg_have_ldap" = "no"; then
1064     AC_MSG_WARN([[
1065 ***
1066 *** Building without LDAP support.
1067 *** No CRL access or X.509 certificate search available.
1068 ***]])
1069 fi
1070
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])
1074 else
1075  use_ldapwrapper=no
1076 fi
1077
1078 if test "$use_ldapwrapper" = yes; then
1079    AC_DEFINE(USE_LDAPWRAPPER,1, [Build dirmngr with LDAP wrapper process])
1080 fi
1081 AM_CONDITIONAL(USE_LDAPWRAPPER, test "$use_ldapwrapper" = yes)
1082
1083
1084
1085
1086 #
1087 # Check for sendmail
1088 #
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]),
1095              ,with_mailprog=yes)
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)
1102 fi
1103
1104
1105 #
1106 # Construct a printable name of the OS
1107 #
1108 case "${host}" in
1109     *-mingw32ce*)
1110         PRINTABLE_OS_NAME="W32CE"
1111         ;;
1112     *-mingw32*)
1113         PRINTABLE_OS_NAME="MingW32"
1114         ;;
1115     *-*-cygwin*)
1116         PRINTABLE_OS_NAME="Cygwin"
1117         ;;
1118     i?86-emx-os2 | i?86-*-os2*emx )
1119         PRINTABLE_OS_NAME="OS/2"
1120         ;;
1121     i?86-*-msdosdjgpp*)
1122         PRINTABLE_OS_NAME="MSDOS/DJGPP"
1123         try_dynload=no
1124         ;;
1125     *-linux*)
1126         PRINTABLE_OS_NAME="GNU/Linux"
1127         ;;
1128     *)
1129         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
1130         ;;
1131 esac
1132 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
1133                    [A human readable text with the name of the OS])
1134
1135
1136 #
1137 # Checking for iconv
1138 #
1139 if test "$require_iconv" = yes; then
1140   AM_ICONV
1141 else
1142   LIBICONV=
1143   LTLIBICONV=
1144   AC_SUBST(LIBICONV)
1145   AC_SUBST(LTLIBICONV)
1146 fi
1147
1148
1149 #
1150 # Check for gettext
1151 #
1152 # This is "GNU gnupg" - The project-id script from gettext
1153 #                       needs this string
1154 #
1155 AC_MSG_NOTICE([checking for gettext])
1156 AM_PO_SUBDIRS
1157 AM_GNU_GETTEXT_VERSION([0.17])
1158 if test "$try_gettext" = yes; then
1159   AM_GNU_GETTEXT([external],[need-ngettext])
1160
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.
1164
1165   AC_CHECK_FUNCS(strchr)
1166 else
1167   USE_NLS=no
1168   USE_INCLUDED_LIBINTL=no
1169   BUILD_INCLUDED_LIBINTL=no
1170   POSUB=po
1171   AC_SUBST(USE_NLS)
1172   AC_SUBST(USE_INCLUDED_LIBINTL)
1173   AC_SUBST(BUILD_INCLUDED_LIBINTL)
1174   AC_SUBST(POSUB)
1175 fi
1176
1177 # We use HAVE_LANGINFO_CODESET in a couple of places.
1178 AM_LANGINFO_CODESET
1179
1180 # Checks required for our use of locales
1181 gt_LC_MESSAGES
1182
1183
1184 #
1185 # SELinux support
1186 #
1187 if test "$selinux_support" = yes ; then
1188   AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1189 fi
1190
1191
1192 #
1193 # Checks for header files.
1194 #
1195 AC_MSG_NOTICE([checking for header files])
1196 AC_HEADER_STDC
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])
1199 AC_HEADER_TIME
1200
1201
1202 #
1203 # Checks for typedefs, structures, and compiler characteristics.
1204 #
1205 AC_MSG_NOTICE([checking for system characteristics])
1206 AC_C_CONST
1207 AC_C_INLINE
1208 AC_C_VOLATILE
1209 AC_TYPE_SIZE_T
1210 AC_TYPE_MODE_T
1211 AC_TYPE_SIGNAL
1212 AC_DECL_SYS_SIGLIST
1213
1214 gl_HEADER_SYS_SOCKET
1215 gl_TYPE_SOCKLEN_T
1216
1217 AC_SEARCH_LIBS([inet_addr], [nsl])
1218
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)
1223
1224 if test x"$endiancheck" = xyes ; then
1225   GNUPG_CHECK_ENDIAN
1226 fi
1227
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)
1234
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)
1239 AC_HEADER_TIME
1240 AC_CHECK_SIZEOF(time_t,,[[
1241 #include <stdio.h>
1242 #if TIME_WITH_SYS_TIME
1243 # include <sys/time.h>
1244 # include <time.h>
1245 #else
1246 # if HAVE_SYS_TIME_H
1247 #  include <sys/time.h>
1248 # else
1249 #  include <time.h>
1250 # endif
1251 #endif
1252 ]])
1253 GNUPG_TIME_T_UNSIGNED
1254
1255
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]);
1260 fi
1261
1262
1263 #
1264 # Checks for library functions.
1265 #
1266 AC_MSG_NOTICE([checking for library functions])
1267 AC_CHECK_DECLS(getpagesize)
1268 AC_FUNC_FSEEKO
1269 AC_FUNC_VPRINTF
1270 AC_FUNC_FORK
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])
1278
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])
1283 fi
1284
1285 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1286
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.]])
1290 fi
1291
1292 #
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 \
1299                 getenv inet_pton])
1300 # end jnlib checks.
1301
1302
1303
1304 #
1305 # gnulib checks
1306 #
1307 gl_SOURCE_BASE([gl])
1308 gl_M4_BASE([gl/m4])
1309 gl_MODULES([setenv mkdtemp xsize strpbrk])
1310 gl_INIT
1311
1312
1313 #
1314 # W32 specific test
1315 #
1316 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1317
1318 #
1319 # Sanity check regex.  Tests adapted from mutt.
1320 #
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)
1327
1328 if test "$use_regex" = yes ; then
1329   _cppflags="${CPPFLAGS}"
1330   _ldflags="${LDFLAGS}"
1331   AC_ARG_WITH(regex,
1332      AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1333       [
1334       if test -d "$withval" ; then
1335         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1336         LDFLAGS="${LDFLAGS} -L$withval/lib"
1337       fi
1338       ],withval="")
1339
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)
1343
1344   if test $gnupg_cv_have_regex = no; then
1345     use_regex=no
1346   else
1347     if test x"$cross_compiling" = xyes; then
1348       AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1349     else
1350       AC_CACHE_CHECK([whether your system's regexp library is broken],
1351        [gnupg_cv_regex_broken],
1352        AC_TRY_RUN([
1353 #include <unistd.h>
1354 #include <regex.h>
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))
1357
1358       if test $gnupg_cv_regex_broken = yes; then
1359         AC_MSG_WARN([your regex is broken - disabling regex use])
1360         use_regex=no
1361       fi
1362     fi
1363   fi
1364   CPPFLAGS="${_cppflags}"
1365   LDFLAGS="${_ldflags}"
1366 fi
1367
1368 if test "$use_regex" != yes ; then
1369   AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1370 fi
1371 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1372
1373
1374
1375 #
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.
1379 #
1380 if test "$use_zip" = yes ; then
1381   _cppflags="${CPPFLAGS}"
1382   _ldflags="${LDFLAGS}"
1383   AC_ARG_WITH(zlib,
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"
1388       fi
1389     ])
1390
1391   AC_CHECK_HEADER(zlib.h,
1392      AC_CHECK_LIB(z, deflateInit2_,
1393        [
1394        ZLIBS="-lz"
1395        AC_DEFINE(HAVE_ZIP,1, [Defined if ZIP and ZLIB are supported])
1396        ],
1397        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1398        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1399 fi
1400
1401
1402 #
1403 # Check whether we can support bzip2
1404 #
1405 if test "$use_bzip2" = yes ; then
1406   _cppflags="${CPPFLAGS}"
1407   _ldflags="${LDFLAGS}"
1408   AC_ARG_WITH(bzip2,
1409      AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1410       [
1411       if test -d "$withval" ; then
1412         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1413         LDFLAGS="${LDFLAGS} -L$withval/lib"
1414       fi
1415       ],withval="")
1416
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,
1423           [
1424           have_bz2=yes
1425           ZLIBS="$ZLIBS -lbz2"
1426           AC_DEFINE(HAVE_BZIP2,1,
1427                   [Defined if the bz2 compression library is available])
1428           ],
1429           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1430           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1431   fi
1432 fi
1433 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1434 AC_SUBST(ZLIBS)
1435
1436
1437 # Check for readline support
1438 GNUPG_CHECK_READLINE
1439
1440
1441 if test "$development_version" = yes; then
1442     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1443             [Defined if this is not a regular release])
1444 fi
1445
1446 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1447
1448 GNUPG_CHECK_GNUMAKE
1449
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
1457      W32SOCKLIBS="-lws2"
1458    else
1459      W32SOCKLIBS="-lws2_32"
1460    fi
1461    NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1462 fi
1463
1464 AC_SUBST(NETLIBS)
1465 AC_SUBST(W32SOCKLIBS)
1466
1467 #
1468 # Setup gcc specific options
1469 #
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 )
1477 #kickerror
1478 #endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
1479     AC_MSG_RESULT($_gcc_silent_wno)
1480
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
1483     # them.
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
1488           _gcc_wopt=yes
1489         else
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;
1497         fi
1498         if test x"$_gcc_wopt" = xyes ; then
1499           CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
1500         fi
1501
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"
1510         fi
1511     else
1512         CFLAGS="$CFLAGS -Wall"
1513     fi
1514
1515     if test x"$_gcc_silent_wno" = xyes ; then
1516       _gcc_psign=yes
1517     else
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;
1525     fi
1526     if test x"$_gcc_psign" = xyes ; then
1527        CFLAGS="$CFLAGS -Wno-pointer-sign"
1528     fi
1529
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"
1538     fi
1539 fi
1540
1541
1542 #
1543 # This is handy for debugging so the compiler doesn't rearrange
1544 # things and eliminate variables.
1545 #
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`
1551                    fi])
1552
1553 #
1554 # Decide what to build
1555 #
1556
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"
1561   fi
1562   if test -n "$build_scdaemon_extra"; then
1563      build_scdaemon_extra="(${build_scdaemon_extra})"
1564   fi
1565 fi
1566
1567
1568 #
1569 # Set variables for use by automake makefiles.
1570 #
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")
1581
1582 AM_CONDITIONAL(ENABLE_CARD_SUPPORT, test "$card_support" = yes)
1583 AM_CONDITIONAL(NO_TRUST_MODELS, test "$use_trust_models" = no)
1584
1585 AM_CONDITIONAL(RUN_GPG_TESTS,
1586                test x$cross_compiling = xno -a "$build_gpg" = yes )
1587
1588 #
1589 # Set some defines for use gpgconf.
1590 #
1591 if test "$build_gpg" = yes ; then
1592     AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build])
1593 fi
1594 if test "$build_gpgsm" = yes ; then
1595     AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build])
1596 fi
1597 if test "$build_agent" = yes ; then
1598     AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build])
1599 fi
1600 if test "$build_scdaemon" = yes ; then
1601     AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build])
1602 fi
1603 if test "$build_dirmngr" = yes ; then
1604     AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build])
1605 fi
1606 if test "$build_g13" = yes ; then
1607     AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build])
1608 fi
1609
1610
1611 #
1612 # Define Name strings
1613 #
1614 AC_DEFINE_UNQUOTED(GNUPG_NAME, "GnuPG", [The name of the project])
1615
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])
1618
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])
1621
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])
1625
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])
1629
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])
1633
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])
1636
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])
1640
1641 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
1642
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])
1653
1654 AC_DEFINE_UNQUOTED(GPGEXT_GPG, "gpg", [The standard binary file suffix])
1655
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])
1659 fi
1660
1661
1662 #
1663 # Provide information about the build.
1664 #
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])
1669
1670 changequote(,)dnl
1671 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
1672 changequote([,])dnl
1673 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
1674 AC_SUBST(BUILD_FILEVERSION)
1675
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)
1682
1683
1684 #
1685 # Print errors here so that they are visible all
1686 # together and the user can acquire them all together.
1687 #
1688 die=no
1689 if test "$have_gpg_error" = "no"; then
1690    die=yes
1691    AC_MSG_NOTICE([[
1692 ***
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.)
1697 ***]])
1698 fi
1699 if test "$have_libgcrypt" = "no"; then
1700    die=yes
1701    AC_MSG_NOTICE([[
1702 ***
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.)
1707 ***]])
1708 fi
1709 if test "$have_libassuan" = "no"; then
1710    die=yes
1711    AC_MSG_NOTICE([[
1712 ***
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).
1717 ***]])
1718 fi
1719 if test "$have_ksba" = "no"; then
1720     die=yes
1721     AC_MSG_NOTICE([[
1722 ***
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).
1727 ***]])
1728 fi
1729 if test "$gnupg_have_ldap" = yes; then
1730   if test "$have_w32ce_system" = yes; then
1731     AC_MSG_NOTICE([[
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
1736 ***]])
1737    fi
1738 fi
1739 if test "$have_npth" = "no"; then
1740     die=yes
1741     AC_MSG_NOTICE([[
1742 ***
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).
1748 ***]])
1749 fi
1750
1751 if test "$require_iconv" = yes; then
1752   if test "$am_func_iconv" != yes; then
1753     die=yes
1754     AC_MSG_NOTICE([[
1755 ***
1756 *** The system does not provide a working iconv function.  Please
1757 *** install a suitable library; for example GNU Libiconv which is
1758 *** available at:
1759 ***   http://ftp.gnu.org/gnu/libiconv/
1760 ***]])
1761   fi
1762 fi
1763
1764 if test "$die" = "yes"; then
1765     AC_MSG_ERROR([[
1766 ***
1767 *** Required libraries not found. Please consult the above messages
1768 *** and install them before running configure again.
1769 ***]])
1770 fi
1771
1772
1773
1774 AC_CONFIG_FILES([ m4/Makefile
1775 Makefile
1776 po/Makefile.in
1777 gl/Makefile
1778 common/Makefile
1779 common/w32info-rc.h
1780 kbx/Makefile
1781 g10/Makefile
1782 sm/Makefile
1783 agent/Makefile
1784 scd/Makefile
1785 g13/Makefile
1786 dirmngr/Makefile
1787 tools/gpg-zip
1788 tools/Makefile
1789 doc/Makefile
1790 tests/Makefile
1791 tests/openpgp/Makefile
1792 tests/pkits/Makefile
1793 ])
1794
1795
1796 AC_OUTPUT
1797
1798
1799 echo "
1800         GnuPG v${VERSION} has been configured as follows:
1801
1802         Revision:  mym4_revision  (mym4_revision_dec)
1803         Platform:  $PRINTABLE_OS_NAME ($host)
1804
1805         OpenPGP:   $build_gpg
1806         S/MIME:    $build_gpgsm
1807         Agent:     $build_agent
1808         Smartcard: $build_scdaemon $build_scdaemon_extra
1809         G13:       $build_g13
1810         Dirmngr:   $build_dirmngr
1811         Gpgtar:    $build_gpgtar
1812
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
1819
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
1825 "
1826 if test x"$use_regex" != xyes ; then
1827 echo "
1828         Warning: No regular expression support available.
1829                  OpenPGP trust signatures won't work.
1830                  gpg-check-pattern will not be build.
1831 "
1832 fi
1833 if test "x${gpg_config_script_warn}" != x; then
1834 cat <<G10EOF
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.
1839
1840 G10EOF
1841 fi