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