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