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