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