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