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