77487b23c36599b4a41272608d2c3569cfce655b
[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], [11])
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.21
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
593 # We need to compile and run a program on the build machine.  A
594 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
595 # the AC archive is broken for autoconf 2.57.  Given that there is no
596 # newer version of that macro, we assume that it is also broken for
597 # autoconf 2.61 and thus we use a simple but usually sufficient
598 # approach.
599 AC_MSG_CHECKING(for cc for build)
600 if test "$cross_compiling" = "yes"; then
601   CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
602 else
603   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
604 fi
605 AC_MSG_RESULT($CC_FOR_BUILD)
606 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
607
608 # We need to call this macro because other pkg-config macros are
609 # not always used.
610 PKG_PROG_PKG_CONFIG
611
612
613 try_gettext=yes
614 require_iconv=yes
615 have_dosish_system=no
616 have_w32_system=no
617 have_w32ce_system=no
618 have_android_system=no
619 run_tests=yes
620 use_simple_gettext=no
621 use_ldapwrapper=yes
622 mmap_needed=yes
623 case "${host}" in
624     *-mingw32*)
625         # special stuff for Windoze NT
626         ac_cv_have_dev_random=no
627         AC_DEFINE(USE_ONLY_8DOT3,1,
628                   [Set this to limit filenames to the 8.3 format])
629         AC_DEFINE(USE_SIMPLE_GETTEXT,1,
630                   [Because the Unix gettext has too much overhead on
631                    MingW32 systems and these systems lack Posix functions,
632                    we use a simplified version of gettext])
633         have_dosish_system=yes
634         have_w32_system=yes
635         run_tests=no
636         use_ldapwrapper=no  # Fixme: Do this only for CE.
637         case "${host}" in
638           *-mingw32ce*)
639             have_w32ce_system=yes
640             ;;
641           *)
642             AC_DEFINE(HAVE_DRIVE_LETTERS,1,
643                       [Defined if the OS supports drive letters.])
644             ;;
645         esac
646         try_gettext="no"
647         use_simple_gettext=yes
648         mmap_needed=no
649         ;;
650     i?86-emx-os2 | i?86-*-os2*emx )
651         # OS/2 with the EMX environment
652         ac_cv_have_dev_random=no
653         AC_DEFINE(HAVE_DRIVE_LETTERS)
654         have_dosish_system=yes
655         try_gettext="no"
656         ;;
657
658     i?86-*-msdosdjgpp*)
659         # DOS with the DJGPP environment
660         ac_cv_have_dev_random=no
661         AC_DEFINE(HAVE_DRIVE_LETTERS)
662         have_dosish_system=yes
663         try_gettext="no"
664         ;;
665
666     *-*-hpux*)
667         if test -z "$GCC" ; then
668             CFLAGS="-Ae -D_HPUX_SOURCE $CFLAGS"
669         fi
670         ;;
671     *-dec-osf4*)
672         if test -z "$GCC" ; then
673             # Suppress all warnings
674             # to get rid of the unsigned/signed char mismatch warnings.
675             CFLAGS="-w $CFLAGS"
676         fi
677         ;;
678     *-dec-osf5*)
679         if test -z "$GCC" ; then
680             # Use the newer compiler `-msg_disable ptrmismatch1' to
681             # get rid of the unsigned/signed char mismatch warnings.
682             # Using this may hide other pointer mismatch warnings, but
683             # it at least lets other warning classes through
684             CFLAGS="-msg_disable ptrmismatch1 $CFLAGS"
685         fi
686         ;;
687     m68k-atari-mint)
688         ;;
689     *-linux-androideabi)
690         have_android_system=yes
691         # Android is fully utf-8 and we do not want to use iconv to
692         # keeps things simple
693         require_iconv=no
694         run_tests=no
695         ;;
696     *)
697        ;;
698 esac
699
700 if test "$have_dosish_system" = yes; then
701    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
702              [Defined if we run on some of the PCDOS like systems
703               (DOS, Windoze. OS/2) with special properties like
704               no file modes, case insensitive file names and preferred
705               use of backslashes as directory name separators.])
706 fi
707 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
708
709 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
710
711 if test "$have_w32_system" = yes; then
712    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
713    if test "$have_w32ce_system" = yes; then
714       AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
715    fi
716 fi
717 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
718 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
719
720 if test "$have_android_system" = yes; then
721    AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
722 fi
723 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
724
725 if test "$run_tests" = yes; then
726    AC_DEFINE(RUN_TESTS,1, [Defined if we should run the tests])
727 fi
728 AM_CONDITIONAL(RUN_TESTS, test "$run_tests" = yes)
729
730
731 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
732 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
733
734
735 #
736 # Checks for libraries.
737 #
738 AC_MSG_NOTICE([checking for libraries])
739
740
741 #
742 # libgpg-error is a library with error codes shared between GnuPG
743 # related projects.
744 #
745 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
746                   have_gpg_error=yes,have_gpg_error=no)
747
748
749 #
750 # Libgcrypt is our generic crypto library
751 #
752 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
753         have_libgcrypt=yes,have_libgcrypt=no)
754
755
756 #
757 # libassuan is used for IPC
758 #
759 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
760                   have_libassuan=yes,have_libassuan=no)
761 if test "$have_libassuan" = "yes"; then
762   AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
763                      [version of the libassuan library])
764   show_tor_support="only .onion"
765 fi
766
767
768 #
769 # libksba is our X.509 support library
770 #
771 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
772
773
774 #
775 # libusb allows us to use the integrated CCID smartcard reader driver.
776 #
777 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
778 if test "$use_ccid_driver" = yes ; then
779   AC_CHECK_LIB(usb, usb_bulk_write,
780                 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
781                   AC_DEFINE(HAVE_LIBUSB,1,
782                            [defined if libusb is available])
783                   have_libusb=yes
784                ])
785   AC_CHECK_FUNCS(usb_create_match)
786 fi
787 AC_SUBST(LIBUSB_LIBS)
788
789 #
790 # Check wether it is necessary to link against libdl.
791 # (For example to load libpcsclite)
792 #
793 gnupg_dlopen_save_libs="$LIBS"
794 LIBS=""
795 AC_SEARCH_LIBS(dlopen, c dl,,,)
796 DL_LIBS=$LIBS
797 AC_SUBST(DL_LIBS)
798 LIBS="$gnupg_dlopen_save_libs"
799
800
801 # Checks for g10
802
803 AC_ARG_ENABLE(sqlite,
804                 AC_HELP_STRING([--disable-sqlite],
805                                [disable the use of SQLITE]),
806               try_sqlite=$enableval, try_sqlite=yes)
807
808 if test x"$use_tofu" = xyes ; then
809   if test x"$try_sqlite" = xyes ; then
810     PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= $NEED_SQLITE_VERSION],
811                                  [have_sqlite=yes],
812                                  [have_sqlite=no])
813   fi
814   if test "$have_sqlite" = "yes"; then
815     :
816     AC_SUBST([SQLITE3_CFLAGS])
817     AC_SUBST([SQLITE3_LIBS])
818   else
819     use_tofu=no
820     tmp=$(echo "$SQLITE3_PKG_ERRORS" | tr '\n' '\v' | sed 's/\v/\n*** /g')
821     AC_MSG_WARN([[
822 ***
823 *** Building without SQLite support - TOFU disabled
824 ***
825 *** $tmp]])
826   fi
827 fi
828
829 AM_CONDITIONAL(SQLITE3, test "$have_sqlite" = "yes")
830
831 if test x"$use_tofu" = xyes ; then
832     AC_DEFINE(USE_TOFU, 1, [Enable to build the TOFU code])
833 fi
834
835
836 # Checks for g13
837
838 AC_PATH_PROG(ENCFS, encfs, /usr/bin/encfs)
839 AC_DEFINE_UNQUOTED(ENCFS,
840         "${ENCFS}", [defines the filename of the encfs program])
841
842 AC_PATH_PROG(FUSERMOUNT, fusermount, /usr/bin/fusermount)
843 AC_DEFINE_UNQUOTED(FUSERMOUNT,
844         "${FUSERMOUNT}", [defines the filename of the fusermount program])
845
846
847 # Checks for dirmngr
848
849
850 #
851 # Checks for symcryptrun:
852 #
853
854 # libutil has openpty() and login_tty().
855 AC_CHECK_LIB(util, openpty,
856               [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
857                 AC_DEFINE(HAVE_LIBUTIL,1,
858                          [defined if libutil is available])
859              ])
860 AC_SUBST(LIBUTIL_LIBS)
861
862 # shred is used to clean temporary plain text files.
863 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
864 AC_DEFINE_UNQUOTED(SHRED,
865         "${SHRED}", [defines the filename of the shred program])
866
867
868 #
869 # Check whether the nPth library is available
870 #
871 AM_PATH_NPTH("$NEED_NPTH_API:$NEED_NPTH_VERSION",have_npth=yes,have_npth=no)
872 if test "$have_npth" = "yes"; then
873   AC_DEFINE(HAVE_NPTH, 1,
874               [Defined if the New Portable Thread Library is available])
875   AC_DEFINE(USE_NPTH, 1,
876               [Defined if support for nPth is requested and nPth is available])
877 else
878   AC_MSG_WARN([[
879 ***
880 *** To support concurrent access for example in gpg-agent and the SCdaemon
881 *** we need the support of the New Portable Threads Library.
882 ***]])
883 fi
884
885
886 #
887 # NTBTLS is our TLS library.  If it is not available fallback to
888 # GNUTLS.
889 #
890 AC_ARG_ENABLE(ntbtls,
891               AC_HELP_STRING([--disable-ntbtls],
892                              [disable the use of NTBTLS as TLS library]),
893               try_ntbtls=$enableval, try_ntbtls=yes)
894 if test x"$try_ntbtls" = xyes ; then
895   AM_PATH_NTBTLS("$NEED_NTBTLS_API:$NEED_NTBTLS_VERSION",
896                  [have_ntbtls=yes],[have_ntbtls=no])
897 fi
898 if test "$have_ntbtls" = yes ; then
899    use_tls_library=ntbtls
900    AC_DEFINE(HTTP_USE_NTBTLS, 1, [Enable NTBTLS support in http.c])
901 else
902   AC_ARG_ENABLE(gnutls,
903                 AC_HELP_STRING([--disable-gnutls],
904                                [disable GNUTLS as fallback TLS library]),
905                 try_gnutls=$enableval, try_gnutls=yes)
906   if test x"$try_gnutls" = xyes ; then
907     PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= $NEED_GNUTLS_VERSION],
908                                    [have_gnutls=yes],
909                                    [have_gnutls=no])
910   fi
911   if test "$have_gnutls" = "yes"; then
912     AC_SUBST([LIBGNUTLS_CFLAGS])
913     AC_SUBST([LIBGNUTLS_LIBS])
914     use_tls_library=gnutls
915     AC_DEFINE(HTTP_USE_GNUTLS, 1, [Enable GNUTLS support in http.c])
916   else
917     tmp=$(echo "$LIBGNUTLS_PKG_ERRORS" | tr '\n' '\v' | sed 's/\v/\n*** /g')
918     AC_MSG_WARN([[
919 ***
920 *** Building without NTBTLS and GNUTLS - no TLS access to keyservers.
921 ***
922 *** $tmp]])
923   fi
924 fi
925
926
927 AC_MSG_NOTICE([checking for networking options])
928
929 #
930 # Must check for network library requirements before doing link tests
931 # for ldap, for example. If ldap libs are static (or dynamic and without
932 # ELF runtime link paths), then link will fail and LDAP support won't
933 # be detected.
934 #
935 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
936         [NETLIBS="-lnsl $NETLIBS"]))
937 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
938         [NETLIBS="-lsocket $NETLIBS"]))
939
940
941 #
942 # Check for ADNS.
943 #
944 _cppflags="${CPPFLAGS}"
945 _ldflags="${LDFLAGS}"
946 AC_ARG_WITH(adns,
947             AC_HELP_STRING([--with-adns=DIR],
948                            [look for the adns library in DIR]),
949             [if test -d "$withval"; then
950                CPPFLAGS="${CPPFLAGS} -I$withval/include"
951                LDFLAGS="${LDFLAGS} -L$withval/lib"
952              fi])
953 if test "$with_adns" != "no"; then
954   AC_CHECK_HEADERS(adns.h,AC_CHECK_LIB(adns, adns_init_strcfg,[have_adns=yes]))
955   AC_CHECK_FUNCS(adns_free)
956   AC_MSG_CHECKING([if adns supports adns_if_tormode])
957   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
958     #include <adns.h>
959     adns_initflags flags = adns_if_tormode;
960   ]],[])],[adns_if_tormode=yes],[adns_if_tormode=no])
961   AC_MSG_RESULT($adns_if_tormode)
962   if test x"$adns_if_tormode" = xyes; then
963     AC_DEFINE(HAVE_ADNS_IF_TORMODE,1,[define if adns_if_tormode is available])
964     if test "$show_tor_support" != "no"; then
965       show_tor_support=yes
966     fi
967   fi
968 fi
969 CPPFLAGS=${_cppflags}
970 LDFLAGS=${_ldflags}
971 if test "$have_adns" = "yes"; then
972   ADNSLIBS="-ladns"
973 fi
974
975
976 #
977 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
978 #
979 AC_ARG_ENABLE(dns-srv,
980               AC_HELP_STRING([--disable-dns-srv],
981                              [disable the use of DNS SRV in HKP and HTTP]),
982               use_dns_srv=$enableval,use_dns_srv=yes)
983
984 AC_ARG_ENABLE(dns-cert,
985    AC_HELP_STRING([--disable-dns-cert],
986         [disable the use of CERT records in DNS]),
987    use_dns_cert=$enableval,use_dns_cert=yes)
988
989 if test x"$use_dns_srv" = xyes || test x"$use_dns_cert" = xyes; then
990   _dns_save_libs=$LIBS
991   LIBS=""
992
993   if test x"$have_adns" = xyes ; then
994     # We prefer ADNS.
995     DNSLIBS="$ADNSLIBS"
996     AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
997
998     if test x"$use_dns_srv" = xyes ; then
999         AC_DEFINE(USE_DNS_SRV,1)
1000     fi
1001
1002     if test x"$use_dns_cert" = xyes ; then
1003         AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1004     fi
1005   else
1006     # With no ADNS find the system resolver.
1007
1008     # the double underscore thing is a glibc-ism?
1009     AC_SEARCH_LIBS(res_query,resolv bind,,
1010                    AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
1011     AC_SEARCH_LIBS(dn_expand,resolv bind,,
1012                    AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
1013     AC_SEARCH_LIBS(dn_skipname,resolv bind,,
1014                    AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
1015
1016     if test x"$have_resolver" != xno ; then
1017
1018       # Make sure that the BIND 4 resolver interface is workable before
1019       # enabling any code that calls it.  At some point I'll rewrite the
1020       # code to use the BIND 8 resolver API.
1021       # We might also want to use adns instead.  Problem with ADNS is that
1022       # it does not support v6.
1023
1024       AC_MSG_CHECKING([whether the resolver is usable])
1025       AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
1026 #include <netinet/in.h>
1027 #include <arpa/nameser.h>
1028 #include <resolv.h>]],
1029 [[unsigned char answer[PACKETSZ];
1030   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
1031   dn_skipname(0,0);
1032   dn_expand(0,0,0,0,0);
1033 ]])],have_resolver=yes,have_resolver=no)
1034       AC_MSG_RESULT($have_resolver)
1035
1036       # This is Apple-specific and somewhat bizarre as they changed the
1037       # define in bind 8 for some reason.
1038
1039       if test x"$have_resolver" != xyes ; then
1040          AC_MSG_CHECKING(
1041              [whether I can make the resolver usable with BIND_8_COMPAT])
1042         AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define BIND_8_COMPAT
1043 #include <sys/types.h>
1044 #include <netinet/in.h>
1045 #include <arpa/nameser.h>
1046 #include <resolv.h>]],
1047 [[unsigned char answer[PACKETSZ];
1048   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
1049   dn_skipname(0,0); dn_expand(0,0,0,0,0);
1050 ]])],[have_resolver=yes ; need_compat=yes])
1051          AC_MSG_RESULT($have_resolver)
1052       fi
1053     fi
1054
1055     if test x"$have_resolver" = xyes ; then
1056       DNSLIBS=$LIBS
1057
1058       if test x"$use_dns_srv" = xyes ; then
1059          AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
1060       fi
1061
1062       if test x"$use_dns_cert" = xyes ; then
1063         AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1064       fi
1065
1066       if test x"$need_compat" = xyes ; then
1067         AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
1068       fi
1069     else
1070       use_dns_srv=no
1071       use_dns_cert=no
1072     fi
1073   fi
1074
1075   LIBS=$_dns_save_libs
1076 fi
1077
1078 AC_SUBST(DNSLIBS)
1079
1080 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
1081
1082
1083 #
1084 # Check for LDAP
1085 #
1086 # Note that running the check changes the variable
1087 # gnupg_have_ldap from "n/a" to "no" or "yes".
1088
1089 AC_ARG_ENABLE(ldap,
1090     AC_HELP_STRING([--disable-ldap],[disable LDAP support]),
1091     [if test "$enableval" = "no"; then gnupg_have_ldap=no; fi])
1092
1093 if test "$gnupg_have_ldap" != "no" ; then
1094   if test "$build_dirmngr" = "yes" ; then
1095      GNUPG_CHECK_LDAP($NETLIBS)
1096      AC_CHECK_LIB(lber, ber_free,
1097                   [ LBER_LIBS="$LBER_LIBS -llber"
1098                     AC_DEFINE(HAVE_LBER,1,
1099                              [defined if liblber is available])
1100                     have_lber=yes
1101                  ])
1102   fi
1103 fi
1104 AC_SUBST(LBER_LIBS)
1105 if test "$gnupg_have_ldap" = "no"; then
1106     AC_MSG_WARN([[
1107 ***
1108 *** Building without LDAP support.
1109 *** No CRL access or X.509 certificate search available.
1110 ***]])
1111 fi
1112
1113 AM_CONDITIONAL(USE_LDAP, [test "$gnupg_have_ldap" = yes])
1114 if test "$gnupg_have_ldap" = yes ; then
1115   AC_DEFINE(USE_LDAP,1,[Defined if LDAP is support])
1116 else
1117  use_ldapwrapper=no
1118 fi
1119
1120 if test "$use_ldapwrapper" = yes; then
1121    AC_DEFINE(USE_LDAPWRAPPER,1, [Build dirmngr with LDAP wrapper process])
1122 fi
1123 AM_CONDITIONAL(USE_LDAPWRAPPER, test "$use_ldapwrapper" = yes)
1124
1125
1126
1127
1128 #
1129 # Check for sendmail
1130 #
1131 # This isn't necessarily sendmail itself, but anything that gives a
1132 # sendmail-ish interface to the outside world.  That includes Exim,
1133 # Postfix, etc.  Basically, anything that can handle "sendmail -t".
1134 AC_ARG_WITH(mailprog,
1135       AC_HELP_STRING([--with-mailprog=NAME],
1136                      [use "NAME -t" for mail transport]),
1137              ,with_mailprog=yes)
1138 if test x"$with_mailprog" = xyes ; then
1139     AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
1140 elif test x"$with_mailprog" != xno ; then
1141     AC_MSG_CHECKING([for a mail transport program])
1142     AC_SUBST(SENDMAIL,$with_mailprog)
1143     AC_MSG_RESULT($with_mailprog)
1144 fi
1145
1146
1147 #
1148 # Construct a printable name of the OS
1149 #
1150 case "${host}" in
1151     *-mingw32ce*)
1152         PRINTABLE_OS_NAME="W32CE"
1153         ;;
1154     *-mingw32*)
1155         PRINTABLE_OS_NAME="MingW32"
1156         ;;
1157     *-*-cygwin*)
1158         PRINTABLE_OS_NAME="Cygwin"
1159         ;;
1160     i?86-emx-os2 | i?86-*-os2*emx )
1161         PRINTABLE_OS_NAME="OS/2"
1162         ;;
1163     i?86-*-msdosdjgpp*)
1164         PRINTABLE_OS_NAME="MSDOS/DJGPP"
1165         try_dynload=no
1166         ;;
1167     *-linux*)
1168         PRINTABLE_OS_NAME="GNU/Linux"
1169         ;;
1170     *)
1171         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
1172         ;;
1173 esac
1174 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
1175                    [A human readable text with the name of the OS])
1176
1177
1178 #
1179 # Checking for iconv
1180 #
1181 if test "$require_iconv" = yes; then
1182   AM_ICONV
1183 else
1184   LIBICONV=
1185   LTLIBICONV=
1186   AC_SUBST(LIBICONV)
1187   AC_SUBST(LTLIBICONV)
1188 fi
1189
1190
1191 #
1192 # Check for gettext
1193 #
1194 # This is "GNU gnupg" - The project-id script from gettext
1195 #                       needs this string
1196 #
1197 AC_MSG_NOTICE([checking for gettext])
1198 AM_PO_SUBDIRS
1199 AM_GNU_GETTEXT_VERSION([0.17])
1200 if test "$try_gettext" = yes; then
1201   AM_GNU_GETTEXT([external],[need-ngettext])
1202
1203   # gettext requires some extra checks.  These really should be part of
1204   # the basic AM_GNU_GETTEXT macro.  TODO: move other gettext-specific
1205   # function checks to here.
1206
1207   AC_CHECK_FUNCS(strchr)
1208 else
1209   USE_NLS=no
1210   USE_INCLUDED_LIBINTL=no
1211   BUILD_INCLUDED_LIBINTL=no
1212   POSUB=po
1213   AC_SUBST(USE_NLS)
1214   AC_SUBST(USE_INCLUDED_LIBINTL)
1215   AC_SUBST(BUILD_INCLUDED_LIBINTL)
1216   AC_SUBST(POSUB)
1217 fi
1218
1219 # We use HAVE_LANGINFO_CODESET in a couple of places.
1220 AM_LANGINFO_CODESET
1221
1222 # Checks required for our use of locales
1223 gt_LC_MESSAGES
1224
1225
1226 #
1227 # SELinux support
1228 #
1229 if test "$selinux_support" = yes ; then
1230   AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1231 fi
1232
1233
1234 #
1235 # Checks for header files.
1236 #
1237 AC_MSG_NOTICE([checking for header files])
1238 AC_HEADER_STDC
1239 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
1240                   pty.h utmp.h pwd.h inttypes.h signal.h sys/select.h     \
1241                   signal.h])
1242 AC_HEADER_TIME
1243
1244
1245 #
1246 # Checks for typedefs, structures, and compiler characteristics.
1247 #
1248 AC_MSG_NOTICE([checking for system characteristics])
1249 AC_C_CONST
1250 AC_C_INLINE
1251 AC_C_VOLATILE
1252 AC_TYPE_SIZE_T
1253 AC_TYPE_MODE_T
1254 AC_TYPE_SIGNAL
1255 AC_DECL_SYS_SIGLIST
1256
1257 gl_HEADER_SYS_SOCKET
1258 gl_TYPE_SOCKLEN_T
1259
1260 AC_SEARCH_LIBS([inet_addr], [nsl])
1261
1262 AC_ARG_ENABLE(endian-check,
1263               AC_HELP_STRING([--disable-endian-check],
1264               [disable the endian check and trust the OS provided macros]),
1265               endiancheck=$enableval,endiancheck=yes)
1266
1267 if test x"$endiancheck" = xyes ; then
1268   GNUPG_CHECK_ENDIAN
1269 fi
1270
1271 # fixme: we should get rid of the byte type
1272 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
1273 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
1274 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
1275 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
1276 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
1277
1278 AC_CHECK_SIZEOF(unsigned short)
1279 AC_CHECK_SIZEOF(unsigned int)
1280 AC_CHECK_SIZEOF(unsigned long)
1281 AC_CHECK_SIZEOF(unsigned long long)
1282 AC_HEADER_TIME
1283 AC_CHECK_SIZEOF(time_t,,[[
1284 #include <stdio.h>
1285 #if TIME_WITH_SYS_TIME
1286 # include <sys/time.h>
1287 # include <time.h>
1288 #else
1289 # if HAVE_SYS_TIME_H
1290 #  include <sys/time.h>
1291 # else
1292 #  include <time.h>
1293 # endif
1294 #endif
1295 ]])
1296 GNUPG_TIME_T_UNSIGNED
1297
1298
1299 if test "$ac_cv_sizeof_unsigned_short" = "0" \
1300    || test "$ac_cv_sizeof_unsigned_int" = "0" \
1301    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
1302     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
1303 fi
1304
1305
1306 #
1307 # Checks for library functions.
1308 #
1309 AC_MSG_NOTICE([checking for library functions])
1310 AC_CHECK_DECLS(getpagesize)
1311 AC_FUNC_FSEEKO
1312 AC_FUNC_VPRINTF
1313 AC_FUNC_FORK
1314 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
1315 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
1316 AC_CHECK_FUNCS([setenv unsetenv fcntl ftruncate inet_ntop])
1317 AC_CHECK_FUNCS([canonicalize_file_name])
1318 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
1319 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
1320 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
1321 AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat])
1322 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
1323                 memrchr isascii timegm getrusage setrlimit stat setlocale   \
1324                 flockfile funlockfile fopencookie funopen getpwnam getpwuid \
1325                 getenv inet_pton strpbrk])
1326
1327 if test "$have_android_system" = yes; then
1328    # On Android ttyname is a stub but prints an error message.
1329    AC_DEFINE(HAVE_BROKEN_TTYNAME,1,
1330              [Defined if ttyname does not work properly])
1331 fi
1332
1333 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1334
1335 # Dirmngr requires mmap on Unix systems.
1336 if test $ac_cv_func_mmap != yes -a $mmap_needed = yes; then
1337   AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]])
1338 fi
1339
1340 #
1341 # W32 specific test
1342 #
1343 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1344
1345 #
1346 # Sanity check regex.  Tests adapted from mutt.
1347 #
1348 AC_MSG_CHECKING([whether regular expression support is requested])
1349 AC_ARG_ENABLE(regex,
1350   AC_HELP_STRING([--disable-regex],
1351     [do not handle regular expressions in trust signatures]),
1352   use_regex=$enableval, use_regex=yes)
1353 AC_MSG_RESULT($use_regex)
1354
1355 if test "$use_regex" = yes ; then
1356   _cppflags="${CPPFLAGS}"
1357   _ldflags="${LDFLAGS}"
1358   AC_ARG_WITH(regex,
1359      AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1360       [
1361       if test -d "$withval" ; then
1362         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1363         LDFLAGS="${LDFLAGS} -L$withval/lib"
1364       fi
1365       ],withval="")
1366
1367   # Does the system have regex functions at all?
1368   AC_SEARCH_LIBS([regcomp], [regex])
1369   AC_CHECK_FUNC(regcomp, gnupg_cv_have_regex=yes, gnupg_cv_have_regex=no)
1370
1371   if test $gnupg_cv_have_regex = no; then
1372     use_regex=no
1373   else
1374     if test x"$cross_compiling" = xyes; then
1375       AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1376     else
1377       AC_CACHE_CHECK([whether your system's regexp library is broken],
1378        [gnupg_cv_regex_broken],
1379        AC_TRY_RUN([
1380 #include <unistd.h>
1381 #include <regex.h>
1382 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); }],
1383        gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1384
1385       if test $gnupg_cv_regex_broken = yes; then
1386         AC_MSG_WARN([your regex is broken - disabling regex use])
1387         use_regex=no
1388       fi
1389     fi
1390   fi
1391   CPPFLAGS="${_cppflags}"
1392   LDFLAGS="${_ldflags}"
1393 fi
1394
1395 if test "$use_regex" != yes ; then
1396   AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1397 fi
1398 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1399
1400
1401
1402 #
1403 # Do we have zlib? Must do it here because Solaris failed
1404 # when compiling a conftest (due to the "-lz" from LIBS).
1405 # Note that we combine zlib and bzlib2 in ZLIBS.
1406 #
1407 if test "$use_zip" = yes ; then
1408   _cppflags="${CPPFLAGS}"
1409   _ldflags="${LDFLAGS}"
1410   AC_ARG_WITH(zlib,
1411     [  --with-zlib=DIR         use libz in DIR],[
1412       if test -d "$withval"; then
1413         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1414         LDFLAGS="${LDFLAGS} -L$withval/lib"
1415       fi
1416     ])
1417
1418   AC_CHECK_HEADER(zlib.h,
1419      AC_CHECK_LIB(z, deflateInit2_,
1420        [
1421        ZLIBS="-lz"
1422        AC_DEFINE(HAVE_ZIP,1, [Defined if ZIP and ZLIB are supported])
1423        ],
1424        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1425        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1426 fi
1427
1428
1429 #
1430 # Check whether we can support bzip2
1431 #
1432 if test "$use_bzip2" = yes ; then
1433   _cppflags="${CPPFLAGS}"
1434   _ldflags="${LDFLAGS}"
1435   AC_ARG_WITH(bzip2,
1436      AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1437       [
1438       if test -d "$withval" ; then
1439         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1440         LDFLAGS="${LDFLAGS} -L$withval/lib"
1441       fi
1442       ],withval="")
1443
1444   # Checking alongside stdio.h as an early version of bzip2 (1.0)
1445   # required stdio.h to be included before bzlib.h, and Solaris 9 is
1446   # woefully out of date.
1447   if test "$withval" != no ; then
1448      AC_CHECK_HEADER(bzlib.h,
1449         AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1450           [
1451           have_bz2=yes
1452           ZLIBS="$ZLIBS -lbz2"
1453           AC_DEFINE(HAVE_BZIP2,1,
1454                   [Defined if the bz2 compression library is available])
1455           ],
1456           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1457           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1458   fi
1459 fi
1460 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1461 AC_SUBST(ZLIBS)
1462
1463
1464 # Check for readline support
1465 GNUPG_CHECK_READLINE
1466
1467
1468 if test "$development_version" = yes; then
1469     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1470             [Defined if this is not a regular release])
1471 fi
1472
1473 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1474
1475 GNUPG_CHECK_GNUMAKE
1476
1477 # Add some extra libs here so that previous tests don't fail for
1478 # mysterious reasons - the final link step should bail out.
1479 # W32SOCKLIBS is also defined so that if can be used for tools not
1480 # requiring any network stuff but linking to code in libcommon which
1481 # tracks in winsock stuff (e.g. init_common_subsystems).
1482 if test "$have_w32_system" = yes; then
1483    if test "$have_w32ce_system" = yes; then
1484      W32SOCKLIBS="-lws2"
1485    else
1486      W32SOCKLIBS="-lws2_32"
1487    fi
1488    NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1489 fi
1490
1491 AC_SUBST(NETLIBS)
1492 AC_SUBST(W32SOCKLIBS)
1493
1494 #
1495 # Setup gcc specific options
1496 #
1497 AC_MSG_NOTICE([checking for cc features])
1498 if test "$GCC" = yes; then
1499     mycflags=
1500     mycflags_save=$CFLAGS
1501
1502     # Check whether gcc does not emit a diagnositc for unknow -Wno-*
1503     # options.  This is the case for gcc >= 4.6
1504     AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
1505     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1506 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
1507 #kickerror
1508 #endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
1509     AC_MSG_RESULT($_gcc_silent_wno)
1510
1511     # Note that it is okay to use CFLAGS here because these are just
1512     # warning options and the user should have a chance of overriding
1513     # them.
1514     if test "$USE_MAINTAINER_MODE" = "yes"; then
1515         mycflags="$mycflags -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1516         mycflags="$mycflags -Wformat -Wno-format-y2k -Wformat-security"
1517         if test x"$_gcc_silent_wno" = xyes ; then
1518           _gcc_wopt=yes
1519         else
1520           AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1521           CFLAGS="-Wno-missing-field-initializers"
1522           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1523                             [_gcc_wopt=yes],[_gcc_wopt=no])
1524           AC_MSG_RESULT($_gcc_wopt)
1525         fi
1526         if test x"$_gcc_wopt" = xyes ; then
1527           mycflags="$mycflags -W -Wno-sign-compare"
1528           mycflags="$mycflags -Wno-missing-field-initializers"
1529         fi
1530
1531         AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
1532         CFLAGS="-Wdeclaration-after-statement"
1533         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1534         AC_MSG_RESULT($_gcc_wopt)
1535         if test x"$_gcc_wopt" = xyes ; then
1536           mycflags="$mycflags -Wdeclaration-after-statement"
1537         fi
1538     else
1539         mycflags="$mycflags -Wall"
1540     fi
1541
1542     if test x"$_gcc_silent_wno" = xyes ; then
1543       _gcc_psign=yes
1544     else
1545       AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1546       CFLAGS="-Wno-pointer-sign"
1547       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1548                         [_gcc_psign=yes],[_gcc_psign=no])
1549       AC_MSG_RESULT($_gcc_psign)
1550     fi
1551     if test x"$_gcc_psign" = xyes ; then
1552        mycflags="$mycflags -Wno-pointer-sign"
1553     fi
1554
1555     AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1556     CFLAGS="-Wpointer-arith"
1557     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
1558     AC_MSG_RESULT($_gcc_psign)
1559     if test x"$_gcc_psign" = xyes ; then
1560        mycflags="$mycflags -Wpointer-arith"
1561     fi
1562
1563     CFLAGS="$mycflags $mycflags_save"
1564 fi
1565
1566
1567 #
1568 # This is handy for debugging so the compiler doesn't rearrange
1569 # things and eliminate variables.
1570 #
1571 AC_ARG_ENABLE(optimization,
1572    AC_HELP_STRING([--disable-optimization],
1573                   [disable compiler optimization]),
1574                   [if test $enableval = no ; then
1575                       CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
1576                    fi])
1577
1578 #
1579 # Decide what to build
1580 #
1581
1582 build_scdaemon_extra=""
1583 if test "$build_scdaemon" = "yes"; then
1584   if test $have_libusb = no; then
1585      build_scdaemon_extra="without internal CCID driver"
1586   fi
1587   if test -n "$build_scdaemon_extra"; then
1588      build_scdaemon_extra="(${build_scdaemon_extra})"
1589   fi
1590 fi
1591
1592
1593 #
1594 # Set variables for use by automake makefiles.
1595 #
1596 AM_CONDITIONAL(BUILD_GPG,         test "$build_gpg" = "yes")
1597 AM_CONDITIONAL(BUILD_GPGSM,       test "$build_gpgsm" = "yes")
1598 AM_CONDITIONAL(BUILD_AGENT,       test "$build_agent" = "yes")
1599 AM_CONDITIONAL(BUILD_SCDAEMON,    test "$build_scdaemon" = "yes")
1600 AM_CONDITIONAL(BUILD_G13,         test "$build_g13" = "yes")
1601 AM_CONDITIONAL(BUILD_DIRMNGR,     test "$build_dirmngr" = "yes")
1602 AM_CONDITIONAL(BUILD_TOOLS,       test "$build_tools" = "yes")
1603 AM_CONDITIONAL(BUILD_DOC,         test "$build_doc" = "yes")
1604 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1605 AM_CONDITIONAL(BUILD_GPGTAR,      test "$build_gpgtar" = "yes")
1606
1607 AM_CONDITIONAL(ENABLE_CARD_SUPPORT, test "$card_support" = yes)
1608 AM_CONDITIONAL(NO_TRUST_MODELS,     test "$use_trust_models" = no)
1609 AM_CONDITIONAL(USE_TOFU,            test "$use_tofu" = yes)
1610
1611 AM_CONDITIONAL(RUN_GPG_TESTS,
1612                test x$cross_compiling = xno -a "$build_gpg" = yes )
1613
1614 #
1615 # Set some defines for use gpgconf.
1616 #
1617 if test "$build_gpg" = yes ; then
1618     AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build])
1619 fi
1620 if test "$build_gpgsm" = yes ; then
1621     AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build])
1622 fi
1623 if test "$build_agent" = yes ; then
1624     AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build])
1625 fi
1626 if test "$build_scdaemon" = yes ; then
1627     AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build])
1628 fi
1629 if test "$build_dirmngr" = yes ; then
1630     AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build])
1631 fi
1632 if test "$build_g13" = yes ; then
1633     AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build])
1634 fi
1635
1636
1637 #
1638 # Define Name strings
1639 #
1640 AC_DEFINE_UNQUOTED(GNUPG_NAME, "GnuPG", [The name of the project])
1641
1642 AC_DEFINE_UNQUOTED(GPG_NAME, "gpg", [The name of the OpenPGP tool])
1643 AC_DEFINE_UNQUOTED(GPG_DISP_NAME, "GnuPG", [The displayed name of gpg])
1644
1645 AC_DEFINE_UNQUOTED(GPGSM_NAME, "gpgsm", [The name of the S/MIME tool])
1646 AC_DEFINE_UNQUOTED(GPGSM_DISP_NAME, "GPGSM", [The displayed name of gpgsm])
1647
1648 AC_DEFINE_UNQUOTED(GPG_AGENT_NAME, "gpg-agent", [The name of the agent])
1649 AC_DEFINE_UNQUOTED(GPG_AGENT_DISP_NAME, "GPG Agent",
1650                                         [The displayed name of gpg-agent])
1651
1652 AC_DEFINE_UNQUOTED(SCDAEMON_NAME, "scdaemon", [The name of the scdaemon])
1653 AC_DEFINE_UNQUOTED(SCDAEMON_DISP_NAME, "SCDaemon",
1654                                        [The displayed name of scdaemon])
1655
1656 AC_DEFINE_UNQUOTED(DIRMNGR_NAME, "dirmngr", [The name of the dirmngr])
1657 AC_DEFINE_UNQUOTED(DIRMNGR_DISP_NAME, "DirMngr",
1658                                       [The displayed name of dirmngr])
1659
1660 AC_DEFINE_UNQUOTED(G13_NAME, "g13", [The name of the g13 tool])
1661 AC_DEFINE_UNQUOTED(G13_DISP_NAME, "G13", [The displayed name of g13])
1662
1663 AC_DEFINE_UNQUOTED(GPGCONF_NAME, "gpgconf", [The name of the gpgconf tool])
1664 AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf",
1665                                       [The displayed name of gpgconf])
1666
1667 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
1668
1669 AC_DEFINE_UNQUOTED(GPG_AGENT_SOCK_NAME, "S.gpg-agent",
1670                    [The name of the agent socket])
1671 AC_DEFINE_UNQUOTED(GPG_AGENT_SSH_SOCK_NAME, "S.gpg-agent.ssh",
1672                    [The name of the agent socket for ssh])
1673 AC_DEFINE_UNQUOTED(DIRMNGR_INFO_NAME, "DIRMNGR_INFO",
1674                    [The name of the dirmngr info envvar])
1675 AC_DEFINE_UNQUOTED(SCDAEMON_SOCK_NAME, "S.scdaemon",
1676                    [The name of the SCdaemon socket])
1677 AC_DEFINE_UNQUOTED(DIRMNGR_SOCK_NAME, "S.dirmngr",
1678                    [The name of the dirmngr socket])
1679
1680 AC_DEFINE_UNQUOTED(GPGEXT_GPG, "gpg", [The standard binary file suffix])
1681
1682 if test "$have_w32_system" = yes; then
1683   AC_DEFINE_UNQUOTED(GNUPG_REGISTRY_DIR, "\\\\Software\\\\GNU\\\\GnuPG",
1684                      [The directory part of the W32 registry keys])
1685 fi
1686
1687
1688 #
1689 # Provide information about the build.
1690 #
1691 BUILD_REVISION="mym4_revision"
1692 AC_SUBST(BUILD_REVISION)
1693 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
1694                    [GIT commit id revision used to build this package])
1695
1696 changequote(,)dnl
1697 BUILD_VERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./'`
1698 changequote([,])dnl
1699 BUILD_VERSION="${BUILD_VERSION}mym4_revision_dec"
1700 BUILD_FILEVERSION=`echo "${BUILD_VERSION}" | tr . ,`
1701 AC_SUBST(BUILD_VERSION)
1702 AC_SUBST(BUILD_FILEVERSION)
1703
1704 AC_ARG_ENABLE([build-timestamp],
1705   AC_HELP_STRING([--enable-build-timestamp],
1706                  [set an explicit build timestamp for reproducibility.
1707                   (default is the current time in ISO-8601 format)]),
1708      [if test "$enableval" = "yes"; then
1709         BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
1710       else
1711         BUILD_TIMESTAMP="$enableval"
1712       fi],
1713      [BUILD_TIMESTAMP="<none>"])
1714 AC_SUBST(BUILD_TIMESTAMP)
1715 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
1716                    [The time this package was configured for a build])
1717 BUILD_HOSTNAME="$ac_hostname"
1718 AC_SUBST(BUILD_HOSTNAME)
1719
1720
1721 #
1722 # Print errors here so that they are visible all
1723 # together and the user can acquire them all together.
1724 #
1725 die=no
1726 if test "$have_gpg_error" = "no"; then
1727    die=yes
1728    AC_MSG_NOTICE([[
1729 ***
1730 *** You need libgpg-error to build this program.
1731 **  This library is for example available at
1732 ***   ftp://ftp.gnupg.org/gcrypt/libgpg-error
1733 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1734 ***]])
1735 fi
1736 if test "$have_libgcrypt" = "no"; then
1737    die=yes
1738    AC_MSG_NOTICE([[
1739 ***
1740 *** You need libgcrypt to build this program.
1741 **  This library is for example available at
1742 ***   ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1743 *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API) is required.)
1744 ***]])
1745 fi
1746 if test "$have_libassuan" = "no"; then
1747    die=yes
1748    AC_MSG_NOTICE([[
1749 ***
1750 *** You need libassuan to build this program.
1751 *** This library is for example available at
1752 ***   ftp://ftp.gnupg.org/gcrypt/libassuan/
1753 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1754 ***]])
1755 fi
1756 if test "$have_ksba" = "no"; then
1757     die=yes
1758     AC_MSG_NOTICE([[
1759 ***
1760 *** You need libksba to build this program.
1761 *** This library is for example available at
1762 ***   ftp://ftp.gnupg.org/gcrypt/libksba/
1763 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1764 ***]])
1765 fi
1766 if test "$gnupg_have_ldap" = yes; then
1767   if test "$have_w32ce_system" = yes; then
1768     AC_MSG_NOTICE([[
1769 *** Note that CeGCC might be broken, a package fixing this is:
1770 ***    http://files.kolab.org/local/windows-ce/
1771 ***                           source/wldap32_0.1-mingw32ce.orig.tar.gz
1772 ***                           binary/wldap32-ce-arm-dev_0.1-1_all.deb
1773 ***]])
1774    fi
1775 fi
1776 if test "$have_npth" = "no"; then
1777     die=yes
1778     AC_MSG_NOTICE([[
1779 ***
1780 *** It is now required to build with support for the
1781 *** New Portable Threads Library (nPth). Please install this
1782 *** library first.  The library is for example available at
1783 ***   ftp://ftp.gnupg.org/gcrypt/npth/
1784 *** (at least version $NEED_NPTH_VERSION (API $NEED_NPTH_API) is required).
1785 ***]])
1786 fi
1787
1788 if test "$require_iconv" = yes; then
1789   if test "$am_func_iconv" != yes; then
1790     die=yes
1791     AC_MSG_NOTICE([[
1792 ***
1793 *** The system does not provide a working iconv function.  Please
1794 *** install a suitable library; for example GNU Libiconv which is
1795 *** available at:
1796 ***   http://ftp.gnu.org/gnu/libiconv/
1797 ***]])
1798   fi
1799 fi
1800
1801 if test "$die" = "yes"; then
1802     AC_MSG_ERROR([[
1803 ***
1804 *** Required libraries not found. Please consult the above messages
1805 *** and install them before running configure again.
1806 ***]])
1807 fi
1808
1809
1810
1811 AC_CONFIG_FILES([ m4/Makefile
1812 Makefile
1813 po/Makefile.in
1814 common/Makefile
1815 common/w32info-rc.h
1816 kbx/Makefile
1817 g10/Makefile
1818 sm/Makefile
1819 agent/Makefile
1820 scd/Makefile
1821 g13/Makefile
1822 dirmngr/Makefile
1823 tools/gpg-zip
1824 tools/Makefile
1825 doc/Makefile
1826 tests/Makefile
1827 tests/openpgp/Makefile
1828 tests/pkits/Makefile
1829 g10/gpg.w32-manifest
1830 ])
1831
1832
1833 AC_OUTPUT
1834
1835
1836 echo "
1837         GnuPG v${VERSION} has been configured as follows:
1838
1839         Revision:  mym4_revision  (mym4_revision_dec)
1840         Platform:  $PRINTABLE_OS_NAME ($host)
1841
1842         OpenPGP:   $build_gpg
1843         S/MIME:    $build_gpgsm
1844         Agent:     $build_agent
1845         Smartcard: $build_scdaemon $build_scdaemon_extra
1846         G13:       $build_g13
1847         Dirmngr:   $build_dirmngr
1848         Gpgtar:    $build_gpgtar
1849
1850         Protect tool:      $show_gnupg_protect_tool_pgm
1851         LDAP wrapper:      $show_gnupg_dirmngr_ldap_pgm
1852         Default agent:     $show_gnupg_agent_pgm
1853         Default pinentry:  $show_gnupg_pinentry_pgm
1854         Default scdaemon:  $show_gnupg_scdaemon_pgm
1855         Default dirmngr:   $show_gnupg_dirmngr_pgm
1856
1857         Dirmngr auto start:  $dirmngr_auto_start
1858         Readline support:    $gnupg_cv_have_readline
1859         LDAP support:        $gnupg_have_ldap
1860         DNS SRV support:     $use_dns_srv
1861         TLS support:         $use_tls_library
1862         TOFU support:        $use_tofu
1863         Tor support:         $show_tor_support
1864 "
1865 if test x"$use_regex" != xyes ; then
1866 echo "
1867         Warning: No regular expression support available.
1868                  OpenPGP trust signatures won't work.
1869                  gpg-check-pattern will not be built.
1870 "
1871 fi
1872 if test "x${gpg_config_script_warn}" != x; then
1873 cat <<G10EOF
1874         Warning: Mismatches between the target platform and the
1875                  to be used libraries have been detected for:
1876                   ${gpg_config_script_warn}
1877                  Please check above for more warning messages.
1878
1879 G10EOF
1880 fi