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