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