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