doc: Minor fix.
[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_gnutls=no
97 have_npth=no
98 have_libusb=no
99 have_adns=no
100 gnupg_have_ldap="n/a"
101
102 use_zip=yes
103 use_bzip2=yes
104 use_exec=yes
105 use_trust_models=yes
106 card_support=yes
107 use_ccid_driver=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 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
711 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
712
713
714 #
715 # Checks for libraries.
716 #
717 AC_MSG_NOTICE([checking for libraries])
718
719
720 #
721 # libgpg-error is a library with error codes shared between GnuPG
722 # related projects.
723 #
724 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
725                   have_gpg_error=yes,have_gpg_error=no)
726
727
728 #
729 # Libgcrypt is our generic crypto library
730 #
731 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
732         have_libgcrypt=yes,have_libgcrypt=no)
733
734
735 #
736 # libassuan is used for IPC
737 #
738 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
739                   have_libassuan=yes,have_libassuan=no)
740 if test "$have_libassuan" = "yes"; then
741   AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
742                      [version of the libassuan library])
743 fi
744
745
746
747 #
748 # libksba is our X.509 support library
749 #
750 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
751
752
753 #
754 # libusb allows us to use the integrated CCID smartcard reader driver.
755 #
756 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
757 if test "$use_ccid_driver" = yes ; then
758   AC_CHECK_LIB(usb, usb_bulk_write,
759                 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
760                   AC_DEFINE(HAVE_LIBUSB,1,
761                            [defined if libusb is available])
762                   have_libusb=yes
763                ])
764   AC_CHECK_FUNCS(usb_create_match)
765 fi
766 AC_SUBST(LIBUSB_LIBS)
767
768 #
769 # Check wether it is necessary to link against libdl.
770 # (For example to load libpcsclite)
771 #
772 gnupg_dlopen_save_libs="$LIBS"
773 LIBS=""
774 AC_SEARCH_LIBS(dlopen, c dl,,,)
775 DL_LIBS=$LIBS
776 AC_SUBST(DL_LIBS)
777 LIBS="$gnupg_dlopen_save_libs"
778
779 # Checks for g13
780
781 AC_PATH_PROG(ENCFS, encfs, /usr/bin/encfs)
782 AC_DEFINE_UNQUOTED(ENCFS,
783         "${ENCFS}", [defines the filename of the encfs program])
784
785 AC_PATH_PROG(FUSERMOUNT, fusermount, /usr/bin/fusermount)
786 AC_DEFINE_UNQUOTED(FUSERMOUNT,
787         "${FUSERMOUNT}", [defines the filename of the fusermount program])
788
789
790 # Checks for dirmngr
791
792
793 #
794 # Checks for symcryptrun:
795 #
796
797 # libutil has openpty() and login_tty().
798 AC_CHECK_LIB(util, openpty,
799               [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
800                 AC_DEFINE(HAVE_LIBUTIL,1,
801                          [defined if libutil is available])
802              ])
803 AC_SUBST(LIBUTIL_LIBS)
804
805 # shred is used to clean temporary plain text files.
806 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
807 AC_DEFINE_UNQUOTED(SHRED,
808         "${SHRED}", [defines the filename of the shred program])
809
810
811 #
812 # Check whether the nPth library is available
813 #
814 AM_PATH_NPTH("$NEED_NPTH_API:$NEED_NPTH_VERSION",have_npth=yes,have_npth=no)
815 if test "$have_npth" = "yes"; then
816   AC_DEFINE(HAVE_NPTH, 1,
817               [Defined if the New Portable Thread Library is available])
818   AC_DEFINE(USE_NPTH, 1,
819               [Defined if support for nPth is requested and nPth is available])
820 else
821   AC_MSG_WARN([[
822 ***
823 *** To support concurrent access for example in gpg-agent and the SCdaemon
824 *** we need the support of the New Portable Threads Library.
825 ***]])
826 fi
827
828
829 #
830 # NTBTLS is our TLS library.  If it is not available fallback to
831 # GNUTLS.
832 #
833 AC_ARG_ENABLE(ntbtls,
834               AC_HELP_STRING([--disable-ntbtls],
835                              [disable the use of NTBTLS as TLS library]),
836               try_ntbtls=$enableval, try_ntbtls=yes)
837 if test x"$try_ntbtls" = xyes ; then
838   AM_PATH_NTBTLS("$NEED_NTBTLS_API:$NEED_NTBTLS_VERSION",
839                  [have_ntbtls=yes],[have_ntbtls=no])
840 fi
841 if test "$have_ntbtls" = yes ; then
842    use_tls_library=ntbtls
843    AC_DEFINE(HTTP_USE_NTBTLS, 1, [Enable NTBTLS support in http.c])
844 else
845   AC_ARG_ENABLE(gnutls,
846                 AC_HELP_STRING([--disable-gnutls],
847                                [disable GNUTLS as fallback TLS library]),
848                 try_gnutls=$enableval, try_gnutls=yes)
849   if test x"$try_gnutls" = xyes ; then
850     PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= $NEED_GNUTLS_VERSION],
851                                    [have_gnutls=yes],
852                                    [have_gnutls=no])
853   fi
854   if test "$have_gnutls" = "yes"; then
855     AC_SUBST([LIBGNUTLS_CFLAGS])
856     AC_SUBST([LIBGNUTLS_LIBS])
857     use_tls_library=gnutls
858     AC_DEFINE(HTTP_USE_GNUTLS, 1, [Enable GNUTLS support in http.c])
859   else
860     tmp=$(echo "$LIBGNUTLS_PKG_ERRORS" | tr '\n' '\v' | sed 's/\v/\n*** /g')
861     AC_MSG_WARN([[
862 ***
863 *** Building without NTBTLS and GNUTLS - no TLS access to keyservers.
864 ***
865 *** $tmp]])
866   fi
867 fi
868
869
870 AC_MSG_NOTICE([checking for networking options])
871
872 #
873 # Must check for network library requirements before doing link tests
874 # for ldap, for example. If ldap libs are static (or dynamic and without
875 # ELF runtime link paths), then link will fail and LDAP support won't
876 # be detected.
877 #
878 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
879         [NETLIBS="-lnsl $NETLIBS"]))
880 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
881         [NETLIBS="-lsocket $NETLIBS"]))
882
883
884 #
885 # Check for ADNS.
886 #
887 _cppflags="${CPPFLAGS}"
888 _ldflags="${LDFLAGS}"
889 AC_ARG_WITH(adns,
890             AC_HELP_STRING([--with-adns=DIR],
891                            [look for the adns library in DIR]),
892             [if test -d "$withval"; then
893                CPPFLAGS="${CPPFLAGS} -I$withval/include"
894                LDFLAGS="${LDFLAGS} -L$withval/lib"
895              fi])
896 if test "$with_adns" != "no"; then
897   AC_CHECK_HEADERS(adns.h,
898                 AC_CHECK_LIB(adns, adns_init,
899                              [have_adns=yes],
900                              [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),
901                 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
902 fi
903 if test "$have_adns" = "yes"; then
904   ADNSLIBS="-ladns"
905 fi
906 AC_SUBST(ADNSLIBS)
907 # Newer adns versions feature a free function to be used under W32.
908 AC_CHECK_FUNCS(adns_free)
909
910
911
912 #
913 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
914 #
915 AC_ARG_ENABLE(dns-srv,
916               AC_HELP_STRING([--disable-dns-srv],
917                              [disable the use of DNS SRV in HKP and HTTP]),
918               use_dns_srv=$enableval,use_dns_srv=yes)
919
920 AC_ARG_ENABLE(dns-pka,
921    AC_HELP_STRING([--disable-dns-pka],
922         [disable the use of PKA records in DNS]),
923    use_dns_pka=$enableval,use_dns_pka=yes)
924
925 AC_ARG_ENABLE(dns-cert,
926    AC_HELP_STRING([--disable-dns-cert],
927         [disable the use of CERT records in DNS]),
928    use_dns_cert=$enableval,use_dns_cert=yes)
929
930 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
931    || test x"$use_dns_cert" = xyes; then
932   _dns_save_libs=$LIBS
933   LIBS=""
934   # the double underscore thing is a glibc-ism?
935   AC_SEARCH_LIBS(res_query,resolv bind,,
936                  AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
937   AC_SEARCH_LIBS(dn_expand,resolv bind,,
938                  AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
939   AC_SEARCH_LIBS(dn_skipname,resolv bind,,
940                  AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
941
942   if test x"$have_resolver" != xno ; then
943
944     # Make sure that the BIND 4 resolver interface is workable before
945     # enabling any code that calls it.  At some point I'll rewrite the
946     # code to use the BIND 8 resolver API.
947     # We might also want to use adns instead.  Problem with ADNS is that
948     # it does not support v6.
949
950     AC_MSG_CHECKING([whether the resolver is usable])
951     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
952 #include <netinet/in.h>
953 #include <arpa/nameser.h>
954 #include <resolv.h>]],
955 [[unsigned char answer[PACKETSZ];
956   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
957   dn_skipname(0,0);
958   dn_expand(0,0,0,0,0);
959 ]])],have_resolver=yes,have_resolver=no)
960     AC_MSG_RESULT($have_resolver)
961
962     # This is Apple-specific and somewhat bizarre as they changed the
963     # define in bind 8 for some reason.
964
965     if test x"$have_resolver" != xyes ; then
966        AC_MSG_CHECKING(
967              [whether I can make the resolver usable with BIND_8_COMPAT])
968        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define BIND_8_COMPAT
969 #include <sys/types.h>
970 #include <netinet/in.h>
971 #include <arpa/nameser.h>
972 #include <resolv.h>]],
973 [[unsigned char answer[PACKETSZ];
974   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
975   dn_skipname(0,0); dn_expand(0,0,0,0,0);
976 ]])],[have_resolver=yes ; need_compat=yes])
977        AC_MSG_RESULT($have_resolver)
978     fi
979   fi
980
981   if test x"$have_resolver" = xyes ; then
982      DNSLIBS=$LIBS
983
984      if test x"$use_dns_srv" = xyes ; then
985         AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
986      fi
987
988      if test x"$use_dns_pka" = xyes ; then
989         AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
990      fi
991
992      if test x"$use_dns_cert" = xyes ; then
993         AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
994      fi
995
996      if test x"$need_compat" = xyes ; then
997         AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
998      fi
999   else
1000      # If we have no resolver library but ADNS (e.g. under W32) enable the
1001      # code parts which can be used with ADNS.
1002      if test x"$have_adns" = xyes ; then
1003         DNSLIBS="$ADNSLIBS"
1004         AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
1005
1006         if test x"$use_dns_srv" = xyes ; then
1007            AC_DEFINE(USE_DNS_SRV,1)
1008         fi
1009
1010         if test x"$use_dns_pka" = xyes ; then
1011            AC_DEFINE(USE_DNS_PKA,1)
1012         fi
1013
1014         if test x"$use_dns_cert" = xyes ; then
1015            AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1016         fi
1017      else
1018         use_dns_srv=no
1019         use_dns_pka=no
1020         use_dns_cert=no
1021      fi
1022   fi
1023
1024   LIBS=$_dns_save_libs
1025 fi
1026
1027 AC_SUBST(DNSLIBS)
1028
1029 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
1030
1031
1032 #
1033 # Check for LDAP
1034 #
1035 # Note that running the check changes the variable
1036 # gnupg_have_ldap from "n/a" to "no" or "yes".
1037 if test "$build_dirmngr" = "yes" ; then
1038    GNUPG_CHECK_LDAP($NETLIBS)
1039    AC_CHECK_LIB(lber, ber_free,
1040                 [ LBER_LIBS="$LBER_LIBS -llber"
1041                   AC_DEFINE(HAVE_LBER,1,
1042                            [defined if liblber is available])
1043                   have_lber=yes
1044                ])
1045 fi
1046 AC_SUBST(LBER_LIBS)
1047
1048 #
1049 # Check for sendmail
1050 #
1051 # This isn't necessarily sendmail itself, but anything that gives a
1052 # sendmail-ish interface to the outside world.  That includes Exim,
1053 # Postfix, etc.  Basically, anything that can handle "sendmail -t".
1054 AC_ARG_WITH(mailprog,
1055       AC_HELP_STRING([--with-mailprog=NAME],
1056                      [use "NAME -t" for mail transport]),
1057              ,with_mailprog=yes)
1058 if test x"$with_mailprog" = xyes ; then
1059     AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
1060 elif test x"$with_mailprog" != xno ; then
1061     AC_MSG_CHECKING([for a mail transport program])
1062     AC_SUBST(SENDMAIL,$with_mailprog)
1063     AC_MSG_RESULT($with_mailprog)
1064 fi
1065
1066
1067 #
1068 # Construct a printable name of the OS
1069 #
1070 case "${host}" in
1071     *-mingw32ce*)
1072         PRINTABLE_OS_NAME="W32CE"
1073         ;;
1074     *-mingw32*)
1075         PRINTABLE_OS_NAME="MingW32"
1076         ;;
1077     *-*-cygwin*)
1078         PRINTABLE_OS_NAME="Cygwin"
1079         ;;
1080     i?86-emx-os2 | i?86-*-os2*emx )
1081         PRINTABLE_OS_NAME="OS/2"
1082         ;;
1083     i?86-*-msdosdjgpp*)
1084         PRINTABLE_OS_NAME="MSDOS/DJGPP"
1085         try_dynload=no
1086         ;;
1087     *-linux*)
1088         PRINTABLE_OS_NAME="GNU/Linux"
1089         ;;
1090     *)
1091         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
1092         ;;
1093 esac
1094 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
1095                    [A human readable text with the name of the OS])
1096
1097
1098 #
1099 # Checking for iconv
1100 #
1101 if test "$require_iconv" = yes; then
1102   AM_ICONV
1103 else
1104   LIBICONV=
1105   LTLIBICONV=
1106   AC_SUBST(LIBICONV)
1107   AC_SUBST(LTLIBICONV)
1108 fi
1109
1110
1111 #
1112 # Check for gettext
1113 #
1114 # This is "GNU gnupg" - The project-id script from gettext
1115 #                       needs this string
1116 #
1117 AC_MSG_NOTICE([checking for gettext])
1118 AM_PO_SUBDIRS
1119 AM_GNU_GETTEXT_VERSION([0.17])
1120 if test "$try_gettext" = yes; then
1121   AM_GNU_GETTEXT([external],[need-ngettext])
1122
1123   # gettext requires some extra checks.  These really should be part of
1124   # the basic AM_GNU_GETTEXT macro.  TODO: move other gettext-specific
1125   # function checks to here.
1126
1127   AC_CHECK_FUNCS(strchr)
1128 else
1129   USE_NLS=no
1130   USE_INCLUDED_LIBINTL=no
1131   BUILD_INCLUDED_LIBINTL=no
1132   POSUB=po
1133   AC_SUBST(USE_NLS)
1134   AC_SUBST(USE_INCLUDED_LIBINTL)
1135   AC_SUBST(BUILD_INCLUDED_LIBINTL)
1136   AC_SUBST(POSUB)
1137 fi
1138
1139 # We use HAVE_LANGINFO_CODESET in a couple of places.
1140 AM_LANGINFO_CODESET
1141
1142 # Checks required for our use of locales
1143 gt_LC_MESSAGES
1144
1145
1146 #
1147 # SELinux support
1148 #
1149 if test "$selinux_support" = yes ; then
1150   AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1151 fi
1152
1153
1154 #
1155 # Checks for header files.
1156 #
1157 AC_MSG_NOTICE([checking for header files])
1158 AC_HEADER_STDC
1159 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
1160                   pty.h utmp.h pwd.h inttypes.h signal.h])
1161 AC_HEADER_TIME
1162
1163
1164 #
1165 # Checks for typedefs, structures, and compiler characteristics.
1166 #
1167 AC_MSG_NOTICE([checking for system characteristics])
1168 AC_C_CONST
1169 AC_C_INLINE
1170 AC_C_VOLATILE
1171 AC_TYPE_SIZE_T
1172 AC_TYPE_MODE_T
1173 AC_TYPE_SIGNAL
1174 AC_DECL_SYS_SIGLIST
1175
1176 gl_HEADER_SYS_SOCKET
1177 gl_TYPE_SOCKLEN_T
1178
1179 AC_SEARCH_LIBS([inet_addr], [nsl])
1180
1181 AC_ARG_ENABLE(endian-check,
1182               AC_HELP_STRING([--disable-endian-check],
1183               [disable the endian check and trust the OS provided macros]),
1184               endiancheck=$enableval,endiancheck=yes)
1185
1186 if test x"$endiancheck" = xyes ; then
1187   GNUPG_CHECK_ENDIAN
1188 fi
1189
1190 # fixme: we should get rid of the byte type
1191 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
1192 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
1193 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
1194 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
1195 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
1196
1197 AC_CHECK_SIZEOF(unsigned short)
1198 AC_CHECK_SIZEOF(unsigned int)
1199 AC_CHECK_SIZEOF(unsigned long)
1200 AC_CHECK_SIZEOF(unsigned long long)
1201 AC_HEADER_TIME
1202 AC_CHECK_SIZEOF(time_t,,[[
1203 #include <stdio.h>
1204 #if TIME_WITH_SYS_TIME
1205 # include <sys/time.h>
1206 # include <time.h>
1207 #else
1208 # if HAVE_SYS_TIME_H
1209 #  include <sys/time.h>
1210 # else
1211 #  include <time.h>
1212 # endif
1213 #endif
1214 ]])
1215 GNUPG_TIME_T_UNSIGNED
1216
1217
1218 if test "$ac_cv_sizeof_unsigned_short" = "0" \
1219    || test "$ac_cv_sizeof_unsigned_int" = "0" \
1220    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
1221     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
1222 fi
1223
1224
1225 #
1226 # Checks for library functions.
1227 #
1228 AC_MSG_NOTICE([checking for library functions])
1229 AC_CHECK_DECLS(getpagesize)
1230 AC_FUNC_FSEEKO
1231 AC_FUNC_VPRINTF
1232 AC_FUNC_FORK
1233 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
1234 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
1235 AC_CHECK_FUNCS([unsetenv fcntl ftruncate inet_ntop canonicalize_file_name])
1236 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
1237 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
1238 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
1239 AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat])
1240
1241 if test "$have_android_system" = yes; then
1242    # On Android ttyname is a stub but prints an error message.
1243    AC_DEFINE(HAVE_BROKEN_TTYNAME,1,
1244              [Defined if ttyname does not work properly])
1245 fi
1246
1247 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1248
1249 # Dirmngr requires mmap on Unix systems.
1250 if test $ac_cv_func_mmap != yes -a $mmap_needed = yes; then
1251   AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]])
1252 fi
1253
1254 #
1255 # These are needed by the jnlib parts in common.
1256 # Note:  We already checked pwd.h.
1257 AC_CHECK_HEADERS([signal.h])
1258 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
1259                 memrchr isascii timegm getrusage setrlimit stat setlocale   \
1260                 flockfile funlockfile fopencookie funopen getpwnam getpwuid \
1261                 getenv inet_pton])
1262 # end jnlib checks.
1263
1264
1265
1266 #
1267 # gnulib checks
1268 #
1269 gl_SOURCE_BASE([gl])
1270 gl_M4_BASE([gl/m4])
1271 gl_MODULES([setenv mkdtemp xsize strpbrk])
1272 gl_INIT
1273
1274
1275 #
1276 # W32 specific test
1277 #
1278 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1279
1280 #
1281 # Sanity check regex.  Tests adapted from mutt.
1282 #
1283 AC_MSG_CHECKING([whether regular expression support is requested])
1284 AC_ARG_ENABLE(regex,
1285   AC_HELP_STRING([--disable-regex],
1286     [do not handle regular expressions in trust signatures]),
1287   use_regex=$enableval, use_regex=yes)
1288 AC_MSG_RESULT($use_regex)
1289
1290 if test "$use_regex" = yes ; then
1291   _cppflags="${CPPFLAGS}"
1292   _ldflags="${LDFLAGS}"
1293   AC_ARG_WITH(regex,
1294      AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1295       [
1296       if test -d "$withval" ; then
1297         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1298         LDFLAGS="${LDFLAGS} -L$withval/lib"
1299       fi
1300       ],withval="")
1301
1302   # Does the system have regex functions at all?
1303   AC_SEARCH_LIBS([regcomp], [regex])
1304   AC_CHECK_FUNC(regcomp, gnupg_cv_have_regex=yes, gnupg_cv_have_regex=no)
1305
1306   if test $gnupg_cv_have_regex = no; then
1307     use_regex=no
1308   else
1309     if test x"$cross_compiling" = xyes; then
1310       AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1311     else
1312       AC_CACHE_CHECK([whether your system's regexp library is broken],
1313        [gnupg_cv_regex_broken],
1314        AC_TRY_RUN([
1315 #include <unistd.h>
1316 #include <regex.h>
1317 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); }],
1318        gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1319
1320       if test $gnupg_cv_regex_broken = yes; then
1321         AC_MSG_WARN([your regex is broken - disabling regex use])
1322         use_regex=no
1323       fi
1324     fi
1325   fi
1326   CPPFLAGS="${_cppflags}"
1327   LDFLAGS="${_ldflags}"
1328 fi
1329
1330 if test "$use_regex" != yes ; then
1331   AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1332 fi
1333 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1334
1335
1336
1337 #
1338 # Do we have zlib? Must do it here because Solaris failed
1339 # when compiling a conftest (due to the "-lz" from LIBS).
1340 # Note that we combine zlib and bzlib2 in ZLIBS.
1341 #
1342 if test "$use_zip" = yes ; then
1343   _cppflags="${CPPFLAGS}"
1344   _ldflags="${LDFLAGS}"
1345   AC_ARG_WITH(zlib,
1346     [  --with-zlib=DIR         use libz in DIR],[
1347       if test -d "$withval"; then
1348         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1349         LDFLAGS="${LDFLAGS} -L$withval/lib"
1350       fi
1351     ])
1352
1353   AC_CHECK_HEADER(zlib.h,
1354      AC_CHECK_LIB(z, deflateInit2_,
1355        [
1356        ZLIBS="-lz"
1357        AC_DEFINE(HAVE_ZIP,1, [Defined if ZIP and ZLIB are supported])
1358        ],
1359        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1360        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1361 fi
1362
1363
1364 #
1365 # Check whether we can support bzip2
1366 #
1367 if test "$use_bzip2" = yes ; then
1368   _cppflags="${CPPFLAGS}"
1369   _ldflags="${LDFLAGS}"
1370   AC_ARG_WITH(bzip2,
1371      AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1372       [
1373       if test -d "$withval" ; then
1374         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1375         LDFLAGS="${LDFLAGS} -L$withval/lib"
1376       fi
1377       ],withval="")
1378
1379   # Checking alongside stdio.h as an early version of bzip2 (1.0)
1380   # required stdio.h to be included before bzlib.h, and Solaris 9 is
1381   # woefully out of date.
1382   if test "$withval" != no ; then
1383      AC_CHECK_HEADER(bzlib.h,
1384         AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1385           [
1386           have_bz2=yes
1387           ZLIBS="$ZLIBS -lbz2"
1388           AC_DEFINE(HAVE_BZIP2,1,
1389                   [Defined if the bz2 compression library is available])
1390           ],
1391           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1392           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1393   fi
1394 fi
1395 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1396 AC_SUBST(ZLIBS)
1397
1398
1399 # Check for readline support
1400 GNUPG_CHECK_READLINE
1401
1402
1403 if test "$development_version" = yes; then
1404     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1405             [Defined if this is not a regular release])
1406 fi
1407
1408 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1409
1410 GNUPG_CHECK_GNUMAKE
1411
1412 # Add some extra libs here so that previous tests don't fail for
1413 # mysterious reasons - the final link step should bail out.
1414 # W32SOCKLIBS is also defined so that if can be used for tools not
1415 # requiring any network stuff but linking to code in libcommon which
1416 # tracks in winsock stuff (e.g. init_common_subsystems).
1417 if test "$have_w32_system" = yes; then
1418    if test "$have_w32ce_system" = yes; then
1419      W32SOCKLIBS="-lws2"
1420    else
1421      W32SOCKLIBS="-lws2_32"
1422    fi
1423    NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1424 fi
1425
1426 AC_SUBST(NETLIBS)
1427 AC_SUBST(W32SOCKLIBS)
1428
1429 #
1430 # Setup gcc specific options
1431 #
1432 AC_MSG_NOTICE([checking for cc features])
1433 if test "$GCC" = yes; then
1434     # Check whether gcc does not emit a diagnositc for unknow -Wno-*
1435     # options.  This is the case for gcc >= 4.6
1436     AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
1437     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1438 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
1439 #kickerror
1440 #endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
1441     AC_MSG_RESULT($_gcc_silent_wno)
1442
1443     # Note that it is okay to use CFLAGS here because these are just
1444     # warning options and the user should have a chance of overriding
1445     # them.
1446     if test "$USE_MAINTAINER_MODE" = "yes"; then
1447         CFLAGS="$CFLAGS -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1448         CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1449         if test x"$_gcc_silent_wno" = xyes ; then
1450           _gcc_wopt=yes
1451         else
1452           AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1453           _gcc_cflags_save=$CFLAGS
1454           CFLAGS="-Wno-missing-field-initializers"
1455           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1456                             [_gcc_wopt=yes],[_gcc_wopt=no])
1457           AC_MSG_RESULT($_gcc_wopt)
1458           CFLAGS=$_gcc_cflags_save;
1459         fi
1460         if test x"$_gcc_wopt" = xyes ; then
1461           CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
1462         fi
1463
1464         AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
1465         _gcc_cflags_save=$CFLAGS
1466         CFLAGS="-Wdeclaration-after-statement"
1467         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1468         AC_MSG_RESULT($_gcc_wopt)
1469         CFLAGS=$_gcc_cflags_save;
1470         if test x"$_gcc_wopt" = xyes ; then
1471           CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1472         fi
1473     else
1474         CFLAGS="$CFLAGS -Wall"
1475     fi
1476
1477     if test x"$_gcc_silent_wno" = xyes ; then
1478       _gcc_psign=yes
1479     else
1480       AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1481       _gcc_cflags_save=$CFLAGS
1482       CFLAGS="-Wno-pointer-sign"
1483       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1484                         [_gcc_psign=yes],[_gcc_psign=no])
1485       AC_MSG_RESULT($_gcc_psign)
1486       CFLAGS=$_gcc_cflags_save;
1487     fi
1488     if test x"$_gcc_psign" = xyes ; then
1489        CFLAGS="$CFLAGS -Wno-pointer-sign"
1490     fi
1491
1492     AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1493     _gcc_cflags_save=$CFLAGS
1494     CFLAGS="-Wpointer-arith"
1495     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
1496     AC_MSG_RESULT($_gcc_psign)
1497     CFLAGS=$_gcc_cflags_save;
1498     if test x"$_gcc_psign" = xyes ; then
1499        CFLAGS="$CFLAGS -Wpointer-arith"
1500     fi
1501 fi
1502
1503
1504 #
1505 # This is handy for debugging so the compiler doesn't rearrange
1506 # things and eliminate variables.
1507 #
1508 AC_ARG_ENABLE(optimization,
1509    AC_HELP_STRING([--disable-optimization],
1510                   [disable compiler optimization]),
1511                   [if test $enableval = no ; then
1512                       CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
1513                    fi])
1514
1515 #
1516 # Decide what to build
1517 #
1518
1519 build_scdaemon_extra=""
1520 if test "$build_scdaemon" = "yes"; then
1521   if test $have_libusb = no; then
1522      build_scdaemon_extra="without internal CCID driver"
1523   fi
1524   if test -n "$build_scdaemon_extra"; then
1525      build_scdaemon_extra="(${build_scdaemon_extra})"
1526   fi
1527 fi
1528
1529
1530 #
1531 # Set variables for use by automake makefiles.
1532 #
1533 AM_CONDITIONAL(BUILD_GPG,         test "$build_gpg" = "yes")
1534 AM_CONDITIONAL(BUILD_GPGSM,       test "$build_gpgsm" = "yes")
1535 AM_CONDITIONAL(BUILD_AGENT,       test "$build_agent" = "yes")
1536 AM_CONDITIONAL(BUILD_SCDAEMON,    test "$build_scdaemon" = "yes")
1537 AM_CONDITIONAL(BUILD_G13,         test "$build_g13" = "yes")
1538 AM_CONDITIONAL(BUILD_DIRMNGR,     test "$build_dirmngr" = "yes")
1539 AM_CONDITIONAL(BUILD_TOOLS,       test "$build_tools" = "yes")
1540 AM_CONDITIONAL(BUILD_DOC,         test "$build_doc" = "yes")
1541 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1542 AM_CONDITIONAL(BUILD_GPGTAR,      test "$build_gpgtar" = "yes")
1543
1544 AM_CONDITIONAL(ENABLE_CARD_SUPPORT, test "$card_support" = yes)
1545 AM_CONDITIONAL(NO_TRUST_MODELS, test "$use_trust_models" = no)
1546
1547 AM_CONDITIONAL(RUN_GPG_TESTS,
1548                test x$cross_compiling = xno -a "$build_gpg" = yes )
1549
1550 #
1551 # Set some defines for use gpgconf.
1552 #
1553 if test "$build_gpg" = yes ; then
1554     AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build])
1555 fi
1556 if test "$build_gpgsm" = yes ; then
1557     AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build])
1558 fi
1559 if test "$build_agent" = yes ; then
1560     AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build])
1561 fi
1562 if test "$build_scdaemon" = yes ; then
1563     AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build])
1564 fi
1565 if test "$build_dirmngr" = yes ; then
1566     AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build])
1567 fi
1568 if test "$build_g13" = yes ; then
1569     AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build])
1570 fi
1571
1572
1573 #
1574 # Define Name strings
1575 #
1576 AC_DEFINE_UNQUOTED(GNUPG_NAME, "GnuPG", [The name of the project])
1577
1578 AC_DEFINE_UNQUOTED(GPG_NAME, "gpg", [The name of the OpenPGP tool])
1579 AC_DEFINE_UNQUOTED(GPG_DISP_NAME, "GnuPG", [The displayed name of gpg])
1580
1581 AC_DEFINE_UNQUOTED(GPGSM_NAME, "gpgsm", [The name of the S/MIME tool])
1582 AC_DEFINE_UNQUOTED(GPGSM_DISP_NAME, "GPGSM", [The displayed name of gpgsm])
1583
1584 AC_DEFINE_UNQUOTED(GPG_AGENT_NAME, "gpg-agent", [The name of the agent])
1585 AC_DEFINE_UNQUOTED(GPG_AGENT_DISP_NAME, "GPG Agent",
1586                                         [The displayed name of gpg-agent])
1587
1588 AC_DEFINE_UNQUOTED(SCDAEMON_NAME, "scdaemon", [The name of the scdaemon])
1589 AC_DEFINE_UNQUOTED(SCDAEMON_DISP_NAME, "SCDaemon",
1590                                        [The displayed name of scdaemon])
1591
1592 AC_DEFINE_UNQUOTED(DIRMNGR_NAME, "dirmngr", [The name of the dirmngr])
1593 AC_DEFINE_UNQUOTED(DIRMNGR_DISP_NAME, "DirMngr",
1594                                       [The displayed name of dirmngr])
1595
1596 AC_DEFINE_UNQUOTED(G13_NAME, "g13", [The name of the g13 tool])
1597 AC_DEFINE_UNQUOTED(G13_DISP_NAME, "G13", [The displayed name of g13])
1598
1599 AC_DEFINE_UNQUOTED(GPGCONF_NAME, "gpgconf", [The name of the gpgconf tool])
1600 AC_DEFINE_UNQUOTED(GPGCONF_DISP_NAME, "GPGConf",
1601                                       [The displayed name of gpgconf])
1602
1603 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
1604
1605 AC_DEFINE_UNQUOTED(GPG_AGENT_SOCK_NAME, "S.gpg-agent",
1606                    [The name of the agent socket])
1607 AC_DEFINE_UNQUOTED(GPG_AGENT_SSH_SOCK_NAME, "S.gpg-agent.ssh",
1608                    [The name of the agent socket for ssh])
1609 AC_DEFINE_UNQUOTED(DIRMNGR_INFO_NAME, "DIRMNGR_INFO",
1610                    [The name of the dirmngr info envvar])
1611 AC_DEFINE_UNQUOTED(SCDAEMON_SOCK_NAME, "S.scdaemon",
1612                    [The name of the SCdaemon socket])
1613 AC_DEFINE_UNQUOTED(DIRMNGR_SOCK_NAME, "S.dirmngr",
1614                    [The name of the dirmngr socket])
1615
1616 AC_DEFINE_UNQUOTED(GPGEXT_GPG, "gpg", [The standard binary file suffix])
1617
1618 if test "$have_w32_system" = yes; then
1619   AC_DEFINE_UNQUOTED(GNUPG_REGISTRY_DIR, "\\\\Software\\\\GNU\\\\GnuPG",
1620                      [The directory part of the W32 registry keys])
1621 fi
1622
1623
1624 #
1625 # Provide information about the build.
1626 #
1627 BUILD_REVISION="mym4_revision"
1628 AC_SUBST(BUILD_REVISION)
1629 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
1630                    [GIT commit id revision used to build this package])
1631
1632 changequote(,)dnl
1633 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
1634 changequote([,])dnl
1635 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
1636 AC_SUBST(BUILD_FILEVERSION)
1637
1638 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
1639 AC_SUBST(BUILD_TIMESTAMP)
1640 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
1641                    [The time this package was configured for a build])
1642 BUILD_HOSTNAME="$ac_hostname"
1643 AC_SUBST(BUILD_HOSTNAME)
1644
1645
1646 #
1647 # Print errors here so that they are visible all
1648 # together and the user can acquire them all together.
1649 #
1650 die=no
1651 if test "$have_gpg_error" = "no"; then
1652    die=yes
1653    AC_MSG_NOTICE([[
1654 ***
1655 *** You need libgpg-error to build this program.
1656 **  This library is for example available at
1657 ***   ftp://ftp.gnupg.org/gcrypt/libgpg-error
1658 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1659 ***]])
1660 fi
1661 if test "$have_libgcrypt" = "no"; then
1662    die=yes
1663    AC_MSG_NOTICE([[
1664 ***
1665 *** You need libgcrypt to build this program.
1666 **  This library is for example available at
1667 ***   ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1668 *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API) is required.)
1669 ***]])
1670 fi
1671 if test "$have_libassuan" = "no"; then
1672    die=yes
1673    AC_MSG_NOTICE([[
1674 ***
1675 *** You need libassuan to build this program.
1676 *** This library is for example available at
1677 ***   ftp://ftp.gnupg.org/gcrypt/libassuan/
1678 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1679 ***]])
1680 fi
1681 if test "$have_ksba" = "no"; then
1682     die=yes
1683     AC_MSG_NOTICE([[
1684 ***
1685 *** You need libksba to build this program.
1686 *** This library is for example available at
1687 ***   ftp://ftp.gnupg.org/gcrypt/libksba/
1688 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1689 ***]])
1690 fi
1691 if test "$gnupg_have_ldap" = "no"; then
1692     die=yes
1693     AC_MSG_NOTICE([[
1694 ***
1695 *** The Dirmngr part requires an LDAP library
1696 *** Check out
1697 ***    http://www.openldap.org
1698 *** for a suitable implementation.
1699 ***]])
1700    if test "$have_w32ce_system" = yes; then
1701     AC_MSG_NOTICE([[
1702 *** Note that CeGCC might be broken, a package fixing this is:
1703 ***    http://files.kolab.org/local/windows-ce/
1704 ***                           source/wldap32_0.1-mingw32ce.orig.tar.gz
1705 ***                           binary/wldap32-ce-arm-dev_0.1-1_all.deb
1706 ***]])
1707    fi
1708 fi
1709 if test "$have_npth" = "no"; then
1710     die=yes
1711     AC_MSG_NOTICE([[
1712 ***
1713 *** It is now required to build with support for the
1714 *** New Portable Threads Library (nPth). Please install this
1715 *** library first.  The library is for example available at
1716 ***   ftp://ftp.gnupg.org/gcrypt/npth/
1717 *** (at least version $NEED_NPTH_VERSION (API $NEED_NPTH_API) is required).
1718 ***]])
1719 fi
1720
1721 if test "$require_iconv" = yes; then
1722   if test "$am_func_iconv" != yes; then
1723     die=yes
1724     AC_MSG_NOTICE([[
1725 ***
1726 *** The system does not provide a working iconv function.  Please
1727 *** install a suitable library; for example GNU Libiconv which is
1728 *** available at:
1729 ***   http://ftp.gnu.org/gnu/libiconv/
1730 ***]])
1731   fi
1732 fi
1733
1734 if test "$die" = "yes"; then
1735     AC_MSG_ERROR([[
1736 ***
1737 *** Required libraries not found. Please consult the above messages
1738 *** and install them before running configure again.
1739 ***]])
1740 fi
1741
1742
1743
1744 AC_CONFIG_FILES([ m4/Makefile
1745 Makefile
1746 po/Makefile.in
1747 gl/Makefile
1748 common/Makefile
1749 common/w32info-rc.h
1750 kbx/Makefile
1751 g10/Makefile
1752 sm/Makefile
1753 agent/Makefile
1754 scd/Makefile
1755 g13/Makefile
1756 dirmngr/Makefile
1757 tools/gpg-zip
1758 tools/Makefile
1759 doc/Makefile
1760 tests/Makefile
1761 tests/openpgp/Makefile
1762 tests/pkits/Makefile
1763 ])
1764
1765
1766 AC_OUTPUT
1767
1768
1769 echo "
1770         GnuPG v${VERSION} has been configured as follows:
1771
1772         Revision:  mym4_revision  (mym4_revision_dec)
1773         Platform:  $PRINTABLE_OS_NAME ($host)
1774
1775         OpenPGP:   $build_gpg
1776         S/MIME:    $build_gpgsm
1777         Agent:     $build_agent
1778         Smartcard: $build_scdaemon $build_scdaemon_extra
1779         G13:       $build_g13
1780         Dirmngr:   $build_dirmngr
1781         Gpgtar:    $build_gpgtar
1782
1783         Protect tool:      $show_gnupg_protect_tool_pgm
1784         LDAP wrapper:      $show_gnupg_dirmngr_ldap_pgm
1785         Default agent:     $show_gnupg_agent_pgm
1786         Default pinentry:  $show_gnupg_pinentry_pgm
1787         Default scdaemon:  $show_gnupg_scdaemon_pgm
1788         Default dirmngr:   $show_gnupg_dirmngr_pgm
1789
1790         Dirmngr auto start:  $dirmngr_auto_start
1791         Readline support:    $gnupg_cv_have_readline
1792         DNS SRV support:     $use_dns_srv
1793         TLS support:         $use_tls_library
1794 "
1795 if test x"$use_regex" != xyes ; then
1796 echo "
1797         Warning: No regular expression support available.
1798                  OpenPGP trust signatures won't work.
1799                  gpg-check-pattern will not be build.
1800 "
1801 fi
1802 if test "x${gpg_config_script_warn}" != x; then
1803 cat <<G10EOF
1804         Warning: Mismatches between the target platform and the
1805                  to be used libraries have been detected for:
1806                   ${gpg_config_script_warn}
1807                  Please check above for more warning messages.
1808
1809 G10EOF
1810 fi