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