gpg: Fix regression in secret key export.
[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   # We define this macro because some code parts require it.
904   AC_DEFINE(USE_NPTH, 1,
905               [Defined if the New Portable Thread Library is available])
906 else
907   AC_MSG_WARN([[
908 ***
909 *** To support concurrent access for example in gpg-agent and the SCdaemon
910 *** we need the support of the New Portable Threads Library.
911 ***]])
912 fi
913
914
915 AC_MSG_NOTICE([checking for networking options])
916
917 #
918 # Must check for network library requirements before doing link tests
919 # for ldap, for example. If ldap libs are static (or dynamic and without
920 # ELF runtime link paths), then link will fail and LDAP support won't
921 # be detected.
922 #
923 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
924         [NETLIBS="-lnsl $NETLIBS"]))
925 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
926         [NETLIBS="-lsocket $NETLIBS"]))
927
928
929 #
930 # Check for ADNS.
931 #
932 _cppflags="${CPPFLAGS}"
933 _ldflags="${LDFLAGS}"
934 AC_ARG_WITH(adns,
935             AC_HELP_STRING([--with-adns=DIR],
936                            [look for the adns library in DIR]),
937             [if test -d "$withval"; then
938                CPPFLAGS="${CPPFLAGS} -I$withval/include"
939                LDFLAGS="${LDFLAGS} -L$withval/lib"
940              fi])
941 if test "$with_adns" != "no"; then
942   AC_CHECK_HEADERS(adns.h,
943                 AC_CHECK_LIB(adns, adns_init,
944                              [have_adns=yes],
945                              [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),
946                 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
947 fi
948 if test "$have_adns" = "yes"; then
949   ADNSLIBS="-ladns"
950 fi
951 AC_SUBST(ADNSLIBS)
952 # Newer adns versions feature a free function to be used under W32.
953 AC_CHECK_FUNCS(adns_free)
954
955
956
957 #
958 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
959 #
960 if test x"$try_hkp" = xyes || test x"$try_http" = xyes ; then
961   AC_ARG_ENABLE(dns-srv,
962      AC_HELP_STRING([--disable-dns-srv],
963                     [disable the use of DNS SRV in HKP and HTTP]),
964                 use_dns_srv=$enableval,use_dns_srv=yes)
965 fi
966
967 AC_ARG_ENABLE(dns-pka,
968    AC_HELP_STRING([--disable-dns-pka],
969         [disable the use of PKA records in DNS]),
970    use_dns_pka=$enableval,use_dns_pka=yes)
971
972 AC_ARG_ENABLE(dns-cert,
973    AC_HELP_STRING([--disable-dns-cert],
974         [disable the use of CERT records in DNS]),
975    use_dns_cert=$enableval,use_dns_cert=yes)
976
977 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
978    || test x"$use_dns_cert" = xyes; then
979   _dns_save_libs=$LIBS
980   LIBS=""
981   # the double underscore thing is a glibc-ism?
982   AC_SEARCH_LIBS(res_query,resolv bind,,
983                  AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
984   AC_SEARCH_LIBS(dn_expand,resolv bind,,
985                  AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
986   AC_SEARCH_LIBS(dn_skipname,resolv bind,,
987                  AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
988
989   if test x"$have_resolver" != xno ; then
990
991     # Make sure that the BIND 4 resolver interface is workable before
992     # enabling any code that calls it.  At some point I'll rewrite the
993     # code to use the BIND 8 resolver API.
994     # We might also want to use adns instead.  Problem with ADNS is that
995     # it does not support v6.
996
997     AC_MSG_CHECKING([whether the resolver is usable])
998     AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
999 #include <netinet/in.h>
1000 #include <arpa/nameser.h>
1001 #include <resolv.h>]],
1002 [[unsigned char answer[PACKETSZ];
1003   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
1004   dn_skipname(0,0);
1005   dn_expand(0,0,0,0,0);
1006 ]])],have_resolver=yes,have_resolver=no)
1007     AC_MSG_RESULT($have_resolver)
1008
1009     # This is Apple-specific and somewhat bizarre as they changed the
1010     # define in bind 8 for some reason.
1011
1012     if test x"$have_resolver" != xyes ; then
1013        AC_MSG_CHECKING(
1014              [whether I can make the resolver usable with BIND_8_COMPAT])
1015        AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define BIND_8_COMPAT
1016 #include <sys/types.h>
1017 #include <netinet/in.h>
1018 #include <arpa/nameser.h>
1019 #include <resolv.h>]],
1020 [[unsigned char answer[PACKETSZ];
1021   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
1022   dn_skipname(0,0); dn_expand(0,0,0,0,0);
1023 ]])],[have_resolver=yes ; need_compat=yes])
1024        AC_MSG_RESULT($have_resolver)
1025     fi
1026   fi
1027
1028   if test x"$have_resolver" = xyes ; then
1029      DNSLIBS=$LIBS
1030
1031      if test x"$use_dns_srv" = xyes ; then
1032         AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
1033      fi
1034
1035      if test x"$use_dns_pka" = xyes ; then
1036         AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
1037      fi
1038
1039      if test x"$use_dns_cert" = xyes ; then
1040         AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1041      fi
1042
1043      if test x"$need_compat" = xyes ; then
1044         AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
1045      fi
1046   else
1047      # If we have no resolver library but ADNS (e.g. under W32) enable the
1048      # code parts which can be used with ADNS.
1049      if test x"$have_adns" = xyes ; then
1050         DNSLIBS="$ADNSLIBS"
1051         AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
1052
1053         if test x"$use_dns_srv" = xyes ; then
1054            AC_DEFINE(USE_DNS_SRV,1)
1055         fi
1056
1057         if test x"$use_dns_pka" = xyes ; then
1058            AC_DEFINE(USE_DNS_PKA,1)
1059         fi
1060
1061         if test x"$use_dns_cert" = xyes ; then
1062            AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1063         fi
1064      else
1065         use_dns_srv=no
1066         use_dns_pka=no
1067         use_dns_cert=no
1068      fi
1069   fi
1070
1071   LIBS=$_dns_save_libs
1072 fi
1073
1074 AC_SUBST(DNSLIBS)
1075
1076 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
1077
1078
1079 #
1080 # Check for LDAP
1081 #
1082 if test "$try_ks_ldap" = yes || test "$build_dirmngr" = "yes" ; then
1083    GNUPG_CHECK_LDAP($NETLIBS)
1084    AC_CHECK_LIB(lber, ber_free,
1085                 [ LBER_LIBS="$LBER_LIBS -llber"
1086                   AC_DEFINE(HAVE_LBER,1,
1087                            [defined if liblber is available])
1088                   have_lber=yes
1089                ])
1090 fi
1091 AC_SUBST(LBER_LIBS)
1092
1093 #
1094 # Check for curl.  We fake the curl API if libcurl isn't installed.
1095 # We require 7.10 or later as we use curl_version_info().
1096 #
1097 LIBCURL_CHECK_CONFIG([yes],[7.10],,[fake_curl=yes])
1098 AM_CONDITIONAL(FAKE_CURL,test x"$fake_curl" = xyes)
1099
1100 # Generic, for us, means curl
1101
1102 if test x"$try_generic" = xyes ; then
1103    AC_SUBST(GPGKEYS_CURL,"gpg2keys_curl$EXEEXT")
1104 fi
1105
1106 #
1107 # Check for sendmail
1108 #
1109 # This isn't necessarily sendmail itself, but anything that gives a
1110 # sendmail-ish interface to the outside world.  That includes Exim,
1111 # Postfix, etc.  Basically, anything that can handle "sendmail -t".
1112 if test "$try_mailto" = yes ; then
1113   AC_ARG_WITH(mailprog,
1114       AC_HELP_STRING([--with-mailprog=NAME],
1115                      [use "NAME -t" for mail transport]),
1116              ,with_mailprog=yes)
1117
1118   if test x"$with_mailprog" = xyes ; then
1119     AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
1120     if test "$ac_cv_path_SENDMAIL" ; then
1121       GPGKEYS_MAILTO="gpg2keys_mailto"
1122     fi
1123   elif test x"$with_mailprog" != xno ; then
1124     AC_MSG_CHECKING([for a mail transport program])
1125     AC_SUBST(SENDMAIL,$with_mailprog)
1126     AC_MSG_RESULT($with_mailprog)
1127     GPGKEYS_MAILTO="gpg2keys_mailto"
1128   fi
1129 fi
1130
1131 AC_SUBST(GPGKEYS_MAILTO)
1132
1133 #
1134 # Construct a printable name of the OS
1135 #
1136 case "${host}" in
1137     *-mingw32ce*)
1138         PRINTABLE_OS_NAME="W32CE"
1139         ;;
1140     *-mingw32*)
1141         PRINTABLE_OS_NAME="MingW32"
1142         ;;
1143     *-*-cygwin*)
1144         PRINTABLE_OS_NAME="Cygwin"
1145         ;;
1146     i?86-emx-os2 | i?86-*-os2*emx )
1147         PRINTABLE_OS_NAME="OS/2"
1148         ;;
1149     i?86-*-msdosdjgpp*)
1150         PRINTABLE_OS_NAME="MSDOS/DJGPP"
1151         try_dynload=no
1152         ;;
1153     *-linux*)
1154         PRINTABLE_OS_NAME="GNU/Linux"
1155         ;;
1156     *)
1157         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
1158         ;;
1159 esac
1160 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
1161                    [A human readable text with the name of the OS])
1162
1163
1164 #
1165 # Checking for iconv
1166 #
1167 if test "$require_iconv" = yes; then
1168   AM_ICONV
1169 else
1170   LIBICONV=
1171   LTLIBICONV=
1172   AC_SUBST(LIBICONV)
1173   AC_SUBST(LTLIBICONV)
1174 fi
1175
1176
1177 #
1178 # Check for gettext
1179 #
1180 # This is "GNU gnupg" - The project-id script from gettext
1181 #                       needs this string
1182 #
1183 AC_MSG_NOTICE([checking for gettext])
1184 AM_PO_SUBDIRS
1185 AM_GNU_GETTEXT_VERSION([0.17])
1186 if test "$try_gettext" = yes; then
1187   AM_GNU_GETTEXT([external],[need-ngettext])
1188
1189   # gettext requires some extra checks.  These really should be part of
1190   # the basic AM_GNU_GETTEXT macro.  TODO: move other gettext-specific
1191   # function checks to here.
1192
1193   AC_CHECK_FUNCS(strchr)
1194 else
1195   USE_NLS=no
1196   USE_INCLUDED_LIBINTL=no
1197   BUILD_INCLUDED_LIBINTL=no
1198   POSUB=po
1199   AC_SUBST(USE_NLS)
1200   AC_SUBST(USE_INCLUDED_LIBINTL)
1201   AC_SUBST(BUILD_INCLUDED_LIBINTL)
1202   AC_SUBST(POSUB)
1203 fi
1204
1205 # We use HAVE_LANGINFO_CODESET in a couple of places.
1206 AM_LANGINFO_CODESET
1207
1208 # Checks required for our use of locales
1209 gt_LC_MESSAGES
1210
1211
1212 #
1213 # SELinux support
1214 #
1215 if test "$selinux_support" = yes ; then
1216   AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1217 fi
1218
1219
1220 #
1221 # Checks for header files.
1222 #
1223 AC_MSG_NOTICE([checking for header files])
1224 AC_HEADER_STDC
1225 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
1226                   pty.h utmp.h pwd.h inttypes.h signal.h])
1227 AC_HEADER_TIME
1228
1229
1230 #
1231 # Checks for typedefs, structures, and compiler characteristics.
1232 #
1233 AC_MSG_NOTICE([checking for system characteristics])
1234 AC_C_CONST
1235 AC_C_INLINE
1236 AC_C_VOLATILE
1237 AC_TYPE_SIZE_T
1238 AC_TYPE_MODE_T
1239 AC_TYPE_SIGNAL
1240 AC_DECL_SYS_SIGLIST
1241
1242 gl_HEADER_SYS_SOCKET
1243 gl_TYPE_SOCKLEN_T
1244
1245 AC_SEARCH_LIBS([inet_addr], [nsl])
1246
1247 AC_ARG_ENABLE(endian-check,
1248               AC_HELP_STRING([--disable-endian-check],
1249               [disable the endian check and trust the OS provided macros]),
1250               endiancheck=$enableval,endiancheck=yes)
1251
1252 if test x"$endiancheck" = xyes ; then
1253   GNUPG_CHECK_ENDIAN
1254 fi
1255
1256 # fixme: we should get rid of the byte type
1257 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
1258 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
1259 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
1260 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
1261 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
1262
1263 AC_CHECK_SIZEOF(unsigned short)
1264 AC_CHECK_SIZEOF(unsigned int)
1265 AC_CHECK_SIZEOF(unsigned long)
1266 AC_CHECK_SIZEOF(unsigned long long)
1267 AC_HEADER_TIME
1268 AC_CHECK_SIZEOF(time_t,,[[
1269 #include <stdio.h>
1270 #if TIME_WITH_SYS_TIME
1271 # include <sys/time.h>
1272 # include <time.h>
1273 #else
1274 # if HAVE_SYS_TIME_H
1275 #  include <sys/time.h>
1276 # else
1277 #  include <time.h>
1278 # endif
1279 #endif
1280 ]])
1281 GNUPG_TIME_T_UNSIGNED
1282
1283
1284 if test "$ac_cv_sizeof_unsigned_short" = "0" \
1285    || test "$ac_cv_sizeof_unsigned_int" = "0" \
1286    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
1287     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
1288 fi
1289
1290
1291 #
1292 # Checks for library functions.
1293 #
1294 AC_MSG_NOTICE([checking for library functions])
1295 AC_CHECK_DECLS(getpagesize)
1296 AC_FUNC_FSEEKO
1297 AC_FUNC_VPRINTF
1298 AC_FUNC_FORK
1299 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
1300 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
1301 AC_CHECK_FUNCS([unsetenv fcntl ftruncate inet_ntop canonicalize_file_name])
1302 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
1303 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
1304 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
1305 AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat])
1306
1307 if test "$have_android_system" = yes; then
1308    # On Android ttyname is a stub but prints an error message.
1309    AC_DEFINE(HAVE_BROKEN_TTYNAME,1,
1310              [Defined if ttyname does not work properly])
1311 fi
1312
1313 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1314
1315 # Dirmngr requires mmap on Unix systems.
1316 if test $ac_cv_func_mmap != yes -a $mmap_needed = yes; then
1317   AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]])
1318 fi
1319
1320 #
1321 # These are needed by the jnlib parts in common.
1322 # Note:  We already checked pwd.h.
1323 AC_CHECK_HEADERS([signal.h])
1324 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
1325                 memrchr isascii timegm getrusage setrlimit stat setlocale   \
1326                 flockfile funlockfile fopencookie funopen getpwnam getpwuid \
1327                 getenv inet_pton])
1328 # end jnlib checks.
1329
1330
1331
1332 #
1333 # gnulib checks
1334 #
1335 gl_SOURCE_BASE([gl])
1336 gl_M4_BASE([gl/m4])
1337 gl_MODULES([setenv mkdtemp xsize strpbrk])
1338 gl_INIT
1339
1340
1341 #
1342 # W32 specific test
1343 #
1344 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1345
1346 #
1347 # Sanity check regex.  Tests adapted from mutt.
1348 #
1349 AC_MSG_CHECKING([whether regular expression support is requested])
1350 AC_ARG_ENABLE(regex,
1351   AC_HELP_STRING([--disable-regex],
1352     [do not handle regular expressions in trust signatures]),
1353   use_regex=$enableval, use_regex=yes)
1354 AC_MSG_RESULT($use_regex)
1355
1356 if test "$use_regex" = yes ; then
1357   _cppflags="${CPPFLAGS}"
1358   _ldflags="${LDFLAGS}"
1359   AC_ARG_WITH(regex,
1360      AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1361       [
1362       if test -d "$withval" ; then
1363         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1364         LDFLAGS="${LDFLAGS} -L$withval/lib"
1365       fi
1366       ],withval="")
1367
1368   # Does the system have regex functions at all?
1369   AC_SEARCH_LIBS([regcomp], [regex])
1370   AC_CHECK_FUNC(regcomp, gnupg_cv_have_regex=yes, gnupg_cv_have_regex=no)
1371
1372   if test $gnupg_cv_have_regex = no; then
1373     use_regex=no
1374   else
1375     if test x"$cross_compiling" = xyes; then
1376       AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1377     else
1378       AC_CACHE_CHECK([whether your system's regexp library is broken],
1379        [gnupg_cv_regex_broken],
1380        AC_TRY_RUN([
1381 #include <unistd.h>
1382 #include <regex.h>
1383 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); }],
1384        gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1385
1386       if test $gnupg_cv_regex_broken = yes; then
1387         AC_MSG_WARN([your regex is broken - disabling regex use])
1388         use_regex=no
1389       fi
1390     fi
1391   fi
1392   CPPFLAGS="${_cppflags}"
1393   LDFLAGS="${_ldflags}"
1394 fi
1395
1396 if test "$use_regex" != yes ; then
1397   AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1398 fi
1399 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1400
1401
1402
1403 #
1404 # Do we have zlib? Must do it here because Solaris failed
1405 # when compiling a conftest (due to the "-lz" from LIBS).
1406 # Note that we combine zlib and bzlib2 in ZLIBS.
1407 #
1408 if test "$use_zip" = yes ; then
1409   _cppflags="${CPPFLAGS}"
1410   _ldflags="${LDFLAGS}"
1411   AC_ARG_WITH(zlib,
1412     [  --with-zlib=DIR         use libz in DIR],[
1413       if test -d "$withval"; then
1414         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1415         LDFLAGS="${LDFLAGS} -L$withval/lib"
1416       fi
1417     ])
1418
1419   AC_CHECK_HEADER(zlib.h,
1420      AC_CHECK_LIB(z, deflateInit2_,
1421        [
1422        ZLIBS="-lz"
1423        AC_DEFINE(HAVE_ZIP,1, [Defined if ZIP and ZLIB are supported])
1424        ],
1425        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1426        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1427 fi
1428
1429
1430 #
1431 # Check whether we can support bzip2
1432 #
1433 if test "$use_bzip2" = yes ; then
1434   _cppflags="${CPPFLAGS}"
1435   _ldflags="${LDFLAGS}"
1436   AC_ARG_WITH(bzip2,
1437      AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1438       [
1439       if test -d "$withval" ; then
1440         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1441         LDFLAGS="${LDFLAGS} -L$withval/lib"
1442       fi
1443       ],withval="")
1444
1445   # Checking alongside stdio.h as an early version of bzip2 (1.0)
1446   # required stdio.h to be included before bzlib.h, and Solaris 9 is
1447   # woefully out of date.
1448   if test "$withval" != no ; then
1449      AC_CHECK_HEADER(bzlib.h,
1450         AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1451           [
1452           have_bz2=yes
1453           ZLIBS="$ZLIBS -lbz2"
1454           AC_DEFINE(HAVE_BZIP2,1,
1455                   [Defined if the bz2 compression library is available])
1456           ],
1457           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1458           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1459   fi
1460 fi
1461 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1462 AC_SUBST(ZLIBS)
1463
1464
1465 # Check for readline support
1466 GNUPG_CHECK_READLINE
1467
1468
1469 if test "$development_version" = yes; then
1470     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1471             [Defined if this is not a regular release])
1472 fi
1473
1474 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1475
1476 GNUPG_CHECK_GNUMAKE
1477
1478 # Add some extra libs here so that previous tests don't fail for
1479 # mysterious reasons - the final link step should bail out.
1480 # W32SOCKLIBS is also defined so that if can be used for tools not
1481 # requiring any network stuff but linking to code in libcommon which
1482 # tracks in winsock stuff (e.g. init_common_subsystems).
1483 if test "$have_w32_system" = yes; then
1484    if test "$have_w32ce_system" = yes; then
1485      W32SOCKLIBS="-lws2"
1486    else
1487      W32SOCKLIBS="-lws2_32"
1488    fi
1489    NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1490 fi
1491
1492 AC_SUBST(NETLIBS)
1493 AC_SUBST(W32SOCKLIBS)
1494
1495 #
1496 # Setup gcc specific options
1497 #
1498 AC_MSG_NOTICE([checking for cc features])
1499 if test "$GCC" = yes; then
1500     # Check whether gcc does not emit a diagnositc for unknow -Wno-*
1501     # options.  This is the case for gcc >= 4.6
1502     AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
1503     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1504 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
1505 #kickerror
1506 #endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
1507     AC_MSG_RESULT($_gcc_silent_wno)
1508
1509     # Note that it is okay to use CFLAGS here because these are just
1510     # warning options and the user should have a chance of overriding
1511     # them.
1512     if test "$USE_MAINTAINER_MODE" = "yes"; then
1513         CFLAGS="$CFLAGS -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1514         CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1515         if test x"$_gcc_silent_wno" = xyes ; then
1516           _gcc_wopt=yes
1517         else
1518           AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1519           _gcc_cflags_save=$CFLAGS
1520           CFLAGS="-Wno-missing-field-initializers"
1521           AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1522                             [_gcc_wopt=yes],[_gcc_wopt=no])
1523           AC_MSG_RESULT($_gcc_wopt)
1524           CFLAGS=$_gcc_cflags_save;
1525         fi
1526         if test x"$_gcc_wopt" = xyes ; then
1527           CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
1528         fi
1529
1530         AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
1531         _gcc_cflags_save=$CFLAGS
1532         CFLAGS="-Wdeclaration-after-statement"
1533         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
1534         AC_MSG_RESULT($_gcc_wopt)
1535         CFLAGS=$_gcc_cflags_save;
1536         if test x"$_gcc_wopt" = xyes ; then
1537           CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1538         fi
1539     else
1540         CFLAGS="$CFLAGS -Wall"
1541     fi
1542
1543     if test x"$_gcc_silent_wno" = xyes ; then
1544       _gcc_psign=yes
1545     else
1546       AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1547       _gcc_cflags_save=$CFLAGS
1548       CFLAGS="-Wno-pointer-sign"
1549       AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1550                         [_gcc_psign=yes],[_gcc_psign=no])
1551       AC_MSG_RESULT($_gcc_psign)
1552       CFLAGS=$_gcc_cflags_save;
1553     fi
1554     if test x"$_gcc_psign" = xyes ; then
1555        CFLAGS="$CFLAGS -Wno-pointer-sign"
1556     fi
1557
1558     AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1559     _gcc_cflags_save=$CFLAGS
1560     CFLAGS="-Wpointer-arith"
1561     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
1562     AC_MSG_RESULT($_gcc_psign)
1563     CFLAGS=$_gcc_cflags_save;
1564     if test x"$_gcc_psign" = xyes ; then
1565        CFLAGS="$CFLAGS -Wpointer-arith"
1566     fi
1567
1568     # The undocumented option -Wno-psabi suppresses the annoying
1569     #   "the ABI of passing union with long double has changed in GCC 4.4"
1570     # which is emitted in estream-printf.c but entirely irrelvant
1571     # because that union is local to the file.
1572     if test x"$_gcc_silent_wno" = xyes ; then
1573        CFLAGS="$CFLAGS -Wno-psabi"
1574     fi
1575 fi
1576
1577
1578 #
1579 # This is handy for debugging so the compiler doesn't rearrange
1580 # things and eliminate variables.
1581 #
1582 AC_ARG_ENABLE(optimization,
1583    AC_HELP_STRING([--disable-optimization],
1584                   [disable compiler optimization]),
1585                   [if test $enableval = no ; then
1586                       CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
1587                    fi])
1588
1589 #
1590 # Prepare building of estream
1591 #
1592 estream_INIT
1593
1594
1595 #
1596 # Decide what to build
1597 #
1598 if test "$have_adns" = "yes"; then
1599   AC_SUBST(GPGKEYS_KDNS, "gpg2keys_kdns$EXEEXT")
1600 fi
1601
1602
1603 build_scdaemon_extra=""
1604 if test "$build_scdaemon" = "yes"; then
1605   if test $have_libusb = no; then
1606      build_scdaemon_extra="without internal CCID driver"
1607   fi
1608   if test -n "$build_scdaemon_extra"; then
1609      build_scdaemon_extra="(${build_scdaemon_extra})"
1610   fi
1611 fi
1612
1613
1614 if test "$build_agent_only" = "yes" ; then
1615   build_gpg=no
1616   build_gpgsm=no
1617   build_scdaemon=no
1618   build_tools=no
1619   build_doc=no
1620 fi
1621
1622 #
1623 # Set variables for use by automake makefiles.
1624 #
1625 AM_CONDITIONAL(BUILD_GPG,         test "$build_gpg" = "yes")
1626 AM_CONDITIONAL(BUILD_GPGSM,       test "$build_gpgsm" = "yes")
1627 AM_CONDITIONAL(BUILD_AGENT,       test "$build_agent" = "yes")
1628 AM_CONDITIONAL(BUILD_SCDAEMON,    test "$build_scdaemon" = "yes")
1629 AM_CONDITIONAL(BUILD_G13,         test "$build_g13" = "yes")
1630 AM_CONDITIONAL(BUILD_DIRMNGR,     test "$build_dirmngr" = "yes")
1631 AM_CONDITIONAL(BUILD_TOOLS,       test "$build_tools" = "yes")
1632 AM_CONDITIONAL(BUILD_DOC,         test "$build_doc" = "yes")
1633 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1634 AM_CONDITIONAL(BUILD_GPGTAR,      test "$build_gpgtar" = "yes")
1635
1636 AM_CONDITIONAL(ENABLE_CARD_SUPPORT, test "$card_support" = yes)
1637 AM_CONDITIONAL(NO_TRUST_MODELS, test "$use_trust_models" = no)
1638
1639 AM_CONDITIONAL(RUN_GPG_TESTS,
1640                test x$cross_compiling = xno -a "$build_gpg" = yes )
1641
1642 #
1643 # Set some defines for use gpgconf.
1644 #
1645 if test "$build_gpg" = yes ; then
1646     AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build])
1647 fi
1648 if test "$build_gpgsm" = yes ; then
1649     AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build])
1650 fi
1651 if test "$build_agent" = yes ; then
1652     AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build])
1653 fi
1654 if test "$build_scdaemon" = yes ; then
1655     AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build])
1656 fi
1657 if test "$build_dirmngr" = yes ; then
1658     AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build])
1659 fi
1660 if test "$build_g13" = yes ; then
1661     AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build])
1662 fi
1663
1664
1665 #
1666 # Define Name strings
1667 #
1668 AC_DEFINE_UNQUOTED(GNUPG_NAME, "GnuPG", [The name of the project])
1669 AC_DEFINE_UNQUOTED(GPG_NAME, "gpg", [The name of the OpenPGP tool])
1670 AC_DEFINE_UNQUOTED(GPGSM_NAME, "gpgsm", [The name of the S/MIME tool])
1671 AC_DEFINE_UNQUOTED(GPG_AGENT_NAME, "gpg-agent", [The name of the agent])
1672 AC_DEFINE_UNQUOTED(SCDAEMON_NAME, "scdaemon", [The name of the scdaemon])
1673 AC_DEFINE_UNQUOTED(DIRMNGR_NAME, "dirmngr", [The name of the dirmngr])
1674 AC_DEFINE_UNQUOTED(G13_NAME, "g13", [The name of the g13 tool])
1675 AC_DEFINE_UNQUOTED(GPGCONF_NAME, "gpgconf", [The name of the gpgconf tool])
1676 AC_DEFINE_UNQUOTED(GPGTAR_NAME, "gpgtar", [The name of the gpgtar tool])
1677
1678 AC_DEFINE_UNQUOTED(GPG_AGENT_INFO_NAME, "GPG_AGENT_INFO",
1679                    [The name of the agent info envvar])
1680 AC_DEFINE_UNQUOTED(GPG_AGENT_SOCK_NAME, "S.gpg-agent",
1681                    [The name of the agent socket])
1682 AC_DEFINE_UNQUOTED(GPG_AGENT_SSH_SOCK_NAME, "S.gpg-agent.ssh",
1683                    [The name of the agent socket for ssh])
1684 AC_DEFINE_UNQUOTED(DIRMNGR_INFO_NAME, "DIRMNGR_INFO",
1685                    [The name of the dirmngr info envvar])
1686 AC_DEFINE_UNQUOTED(DIRMNGR_SOCK_NAME, "S.dirmngr",
1687                    [The name of the dirmngr socket])
1688
1689 AC_DEFINE_UNQUOTED(GPGEXT_GPG, "gpg", [The standard binary file suffix])
1690
1691 if test "$have_w32_system" = yes; then
1692   AC_DEFINE_UNQUOTED(GNUPG_REGISTRY_DIR, "\\\\Software\\\\GNU\\\\GnuPG",
1693                      [The directory part of the W32 registry keys])
1694 fi
1695
1696
1697 #
1698 # Provide information about the build.
1699 #
1700 BUILD_REVISION="mym4_revision"
1701 AC_SUBST(BUILD_REVISION)
1702 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
1703                    [GIT commit id revision used to build this package])
1704
1705 changequote(,)dnl
1706 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
1707 changequote([,])dnl
1708 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
1709 AC_SUBST(BUILD_FILEVERSION)
1710
1711 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
1712 AC_SUBST(BUILD_TIMESTAMP)
1713 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
1714                    [The time this package was configured for a build])
1715 BUILD_HOSTNAME="$ac_hostname"
1716 AC_SUBST(BUILD_HOSTNAME)
1717
1718
1719 #
1720 # Print errors here so that they are visible all
1721 # together and the user can acquire them all together.
1722 #
1723 die=no
1724 if test "$have_gpg_error" = "no"; then
1725    die=yes
1726    AC_MSG_NOTICE([[
1727 ***
1728 *** You need libgpg-error to build this program.
1729 **  This library is for example available at
1730 ***   ftp://ftp.gnupg.org/gcrypt/libgpg-error
1731 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1732 ***]])
1733 fi
1734 if test "$have_libgcrypt" = "no"; then
1735    die=yes
1736    AC_MSG_NOTICE([[
1737 ***
1738 *** You need libgcrypt to build this program.
1739 **  This library is for example available at
1740 ***   ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1741 *** (at least version $NEED_LIBGCRYPT_VERSION (API $NEED_LIBGCRYPT_API) is required.)
1742 ***]])
1743 fi
1744 if test "$have_libassuan" = "no"; then
1745    die=yes
1746    AC_MSG_NOTICE([[
1747 ***
1748 *** You need libassuan to build this program.
1749 *** This library is for example available at
1750 ***   ftp://ftp.gnupg.org/gcrypt/libassuan/
1751 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1752 ***]])
1753 fi
1754 if test "$have_ksba" = "no"; then
1755     die=yes
1756     AC_MSG_NOTICE([[
1757 ***
1758 *** You need libksba to build this program.
1759 *** This library is for example available at
1760 ***   ftp://ftp.gnupg.org/gcrypt/libksba/
1761 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1762 ***]])
1763 fi
1764 if test "$gnupg_have_ldap" = "no"; then
1765     die=yes
1766     AC_MSG_NOTICE([[
1767 ***
1768 *** You need a LDAP library to build this program.
1769 *** Check out
1770 ***    http://www.openldap.org
1771 *** for a suitable implementation.
1772 ***]])
1773    if test "$have_w32ce_system" = yes; then
1774     AC_MSG_NOTICE([[
1775 *** Note that CeGCC might be broken, a package fixing this is:
1776 ***    http://files.kolab.org/local/windows-ce/
1777 ***                           source/wldap32_0.1-mingw32ce.orig.tar.gz
1778 ***                           binary/wldap32-ce-arm-dev_0.1-1_all.deb
1779 ***]])
1780    fi
1781 fi
1782 if test "$have_npth" = "no"; then
1783     die=yes
1784     AC_MSG_NOTICE([[
1785 ***
1786 *** It is now required to build with support for the
1787 *** New Portable Threads Library (nPth). Please install this
1788 *** library first.  The library is for example available at
1789 ***   ftp://ftp.gnupg.org/gcrypt/npth/
1790 *** (at least version $NEED_NPTH_VERSION (API $NEED_NPTH_API) is required).
1791 ***]])
1792 fi
1793
1794 if test "$require_iconv" = yes; then
1795   if test "$am_func_iconv" != yes; then
1796     die=yes
1797     AC_MSG_NOTICE([[
1798 ***
1799 *** The system does not provide a working iconv function.  Please
1800 *** install a suitable library; for example GNU Libiconv which is
1801 *** available at:
1802 ***   http://ftp.gnu.org/gnu/libiconv/
1803 ***]])
1804   fi
1805 fi
1806
1807 if test "$die" = "yes"; then
1808     AC_MSG_ERROR([[
1809 ***
1810 *** Required libraries not found. Please consult the above messages
1811 *** and install them before running configure again.
1812 ***]])
1813 fi
1814
1815
1816
1817 AC_CONFIG_FILES([ m4/Makefile
1818 Makefile
1819 po/Makefile.in
1820 gl/Makefile
1821 common/Makefile
1822 common/w32info-rc.h
1823 kbx/Makefile
1824 g10/Makefile
1825 sm/Makefile
1826 agent/Makefile
1827 scd/Makefile
1828 g13/Makefile
1829 dirmngr/Makefile
1830 tools/gpg-zip
1831 tools/Makefile
1832 doc/Makefile
1833 tests/Makefile
1834 tests/openpgp/Makefile
1835 tests/pkits/Makefile
1836 ])
1837 #keyserver/Makefile
1838 #keyserver/gpg2keys_mailto
1839 #keyserver/gpg2keys_test
1840
1841
1842 AC_OUTPUT
1843
1844
1845 echo "
1846         GnuPG v${VERSION} has been configured as follows:
1847
1848         Revision:  mym4_revision  (mym4_revision_dec)
1849         Platform:  $PRINTABLE_OS_NAME ($host)
1850
1851         OpenPGP:   $build_gpg
1852         S/MIME:    $build_gpgsm
1853         Agent:     $build_agent
1854         Smartcard: $build_scdaemon $build_scdaemon_extra
1855         G13:       $build_g13
1856         Dirmngr:   $build_dirmngr
1857         Gpgtar:    $build_gpgtar
1858
1859         Protect tool:      $show_gnupg_protect_tool_pgm
1860         LDAP wrapper:      $show_gnupg_dirmngr_ldap_pgm
1861         Default agent:     $show_gnupg_agent_pgm
1862         Default pinentry:  $show_gnupg_pinentry_pgm
1863         Default scdaemon:  $show_gnupg_scdaemon_pgm
1864         Default dirmngr:   $show_gnupg_dirmngr_pgm
1865
1866         Use standard socket: $use_standard_socket
1867         Dirmngr auto start:  $dirmngr_auto_start
1868         Readline support:    $gnupg_cv_have_readline
1869 "
1870 if test x"$use_regex" != xyes ; then
1871 echo "
1872         Warning: No regular expression support available.
1873                  OpenPGP trust signatures won't work.
1874                  gpg-check-pattern will not be build.
1875 "
1876 fi