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