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