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