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