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