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