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