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