1 # configure.ac - for GnuPG 2.0
2 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3 # 2006, 2007, 2008, 2010, 2011,
4 # 2012 Free Software Foundation, Inc.
6 # This file is part of GnuPG.
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.
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.
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/>.
21 # Process this file with autoconf to produce a configure script.
23 min_automake_version="1.10"
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.0.26])
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])
45 AC_INIT([gnupg],[mym4_full_version], [http://bugs.gnupg.org])
47 NEED_GPG_ERROR_VERSION=1.11
50 NEED_LIBGCRYPT_VERSION=1.4.0
53 NEED_LIBASSUAN_VERSION=2.0.0
56 NEED_KSBA_VERSION=1.0.7
58 development_version=mym4_isgit
60 PACKAGE_GT=${PACKAGE_NAME}2
61 VERSION=$PACKAGE_VERSION
63 AC_CONFIG_AUX_DIR(scripts)
64 AC_CONFIG_SRCDIR(sm/gpgsm.c)
65 AM_CONFIG_HEADER(config.h)
66 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
72 # Some status variables.
83 disable_keyserver_path=no
85 use_standard_socket=no
87 GNUPG_BUILD_PROGRAM(gpg, yes)
88 GNUPG_BUILD_PROGRAM(gpgsm, yes)
89 GNUPG_BUILD_PROGRAM(agent, yes)
90 GNUPG_BUILD_PROGRAM(scdaemon, yes)
91 GNUPG_BUILD_PROGRAM(tools, yes)
92 GNUPG_BUILD_PROGRAM(doc, yes)
93 GNUPG_BUILD_PROGRAM(symcryptrun, no)
94 GNUPG_BUILD_PROGRAM(gpgtar, no)
100 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
101 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
102 [Name of this package for gettext])
103 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
104 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
105 [Bug report address])
106 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
107 [Required version of Libgcrypt])
108 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
109 [Required version of Libksba])
112 # The default is to use the modules from this package and the few
113 # other packages in a standard place; i.e where this package gets
114 # installed. With these options it is possible to override these
115 # ${prefix} depended values with fixed paths, which can't be replaced
116 # at make time. See also am/cmacros.am and the defaults in AH_BOTTOM.
117 AC_ARG_WITH(agent-pgm,
118 [ --with-agent-pgm=PATH Use PATH as the default for the agent)],
119 GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
120 AC_SUBST(GNUPG_AGENT_PGM)
121 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
122 show_gnupg_agent_pgm="(default)"
123 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
125 AC_ARG_WITH(pinentry-pgm,
126 [ --with-pinentry-pgm=PATH Use PATH as the default for the pinentry)],
127 GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
128 AC_SUBST(GNUPG_PINENTRY_PGM)
129 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
130 show_gnupg_pinentry_pgm="(default)"
131 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
134 AC_ARG_WITH(scdaemon-pgm,
135 [ --with-scdaemon-pgm=PATH Use PATH as the default for the scdaemon)],
136 GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
137 AC_SUBST(GNUPG_SCDAEMON_PGM)
138 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
139 show_gnupg_scdaemon_pgm="(default)"
140 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
143 AC_ARG_WITH(dirmngr-pgm,
144 [ --with-dirmngr-pgm=PATH Use PATH as the default for the dirmngr)],
145 GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
146 AC_SUBST(GNUPG_DIRMNGR_PGM)
147 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
148 show_gnupg_dirmngr_pgm="(default)"
149 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
151 AC_ARG_WITH(protect-tool-pgm,
152 [ --with-protect-tool-pgm=PATH Use PATH as the default for the protect-tool)],
153 GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
154 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
155 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
156 show_gnupg_protect_tool_pgm="(default)"
157 test -n "$GNUPG_PROTECT_TOOL_PGM" \
158 && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
161 # Some folks want to use only the agent from this packet. Make it
162 # easier for them by providing the configure option
163 # --enable-only-agent.
164 AC_ARG_ENABLE(agent-only,
165 AC_HELP_STRING([--enable-agent-only],[build only the gpg-agent]),
166 build_agent_only=$enableval)
168 # SELinux support includes tracking of sensitive files to avoid
169 # leaking their contents through processing these files by gpg itself
170 AC_MSG_CHECKING([whether SELinux support is requested])
171 AC_ARG_ENABLE(selinux-support,
172 AC_HELP_STRING([--enable-selinux-support],
173 [enable SELinux support]),
174 selinux_support=$enableval, selinux_support=no)
175 AC_MSG_RESULT($selinux_support)
177 # Allow disabling of bzib2 support.
178 # It is defined only after we confirm the library is available later
179 AC_MSG_CHECKING([whether to enable the BZIP2 compression algorithm])
181 AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
182 use_bzip2=$enableval)
183 AC_MSG_RESULT($use_bzip2)
185 # Configure option to allow or disallow execution of external
186 # programs, like a photo viewer.
187 AC_MSG_CHECKING([whether to enable external program execution])
189 AC_HELP_STRING([--disable-exec],[disable all external program execution]),
191 AC_MSG_RESULT($use_exec)
192 if test "$use_exec" = no ; then
193 AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
196 if test "$use_exec" = yes ; then
197 AC_MSG_CHECKING([whether to enable photo ID viewing])
198 AC_ARG_ENABLE(photo-viewers,
199 [ --disable-photo-viewers disable photo ID viewers],
200 [if test "$enableval" = no ; then
201 AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
203 gnupg_cv_enable_photo_viewers=$enableval
204 AC_MSG_RESULT($enableval)
206 if test "$gnupg_cv_enable_photo_viewers" = yes ; then
207 AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
208 AC_ARG_WITH(photo-viewer,
209 [ --with-photo-viewer=FIXED_VIEWER set a fixed photo ID viewer],
210 [if test "$withval" = yes ; then
212 elif test "$withval" != no ; then
213 AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
214 [if set, restrict photo-viewer to this])
216 AC_MSG_RESULT($withval)
219 AC_MSG_CHECKING([whether to enable external keyserver helpers])
220 AC_ARG_ENABLE(keyserver-helpers,
221 [ --disable-keyserver-helpers disable all external keyserver support],
222 [if test "$enableval" = no ; then
223 AC_DEFINE(DISABLE_KEYSERVER_HELPERS,1,
224 [define to disable keyserver helpers])
226 gnupg_cv_enable_keyserver_helpers=$enableval
227 AC_MSG_RESULT($enableval)
229 if test "$gnupg_cv_enable_keyserver_helpers" = yes ; then
230 # LDAP is defined only after we confirm the library is available later
231 AC_MSG_CHECKING([whether LDAP keyserver support is requested])
233 AC_HELP_STRING([--disable-ldap],[disable LDAP keyserver interface only]),
234 try_ldap=$enableval, try_ldap=yes)
235 AC_MSG_RESULT($try_ldap)
237 AC_MSG_CHECKING([whether HKP keyserver support is requested])
239 AC_HELP_STRING([--disable-hkp],[disable HKP keyserver interface only]),
240 try_hkp=$enableval, try_hkp=yes)
241 AC_MSG_RESULT($try_hkp)
243 AC_MSG_CHECKING([whether finger key fetching support is requested])
244 AC_ARG_ENABLE(finger,
245 AC_HELP_STRING([--disable-finger],
246 [disable finger key fetching interface only]),
247 try_finger=$enableval, try_finger=yes)
248 AC_MSG_RESULT($try_finger)
250 AC_MSG_CHECKING([whether generic object key fetching support is requested])
251 AC_ARG_ENABLE(generic,
252 AC_HELP_STRING([--disable-generic],
253 [disable generic object key fetching interface only]),
254 try_generic=$enableval, try_generic=yes)
255 AC_MSG_RESULT($try_generic)
257 AC_MSG_CHECKING([whether email keyserver support is requested])
258 AC_ARG_ENABLE(mailto,
259 AC_HELP_STRING([--enable-mailto],
260 [enable email keyserver interface only]),
261 try_mailto=$enableval, try_mailto=no)
262 AC_MSG_RESULT($try_mailto)
265 AC_MSG_CHECKING([whether keyserver exec-path is enabled])
266 AC_ARG_ENABLE(keyserver-path,
267 AC_HELP_STRING([--disable-keyserver-path],
268 [disable the exec-path option for keyserver helpers]),
269 [if test "$enableval" = no ; then
270 disable_keyserver_path=yes
272 AC_MSG_RESULT($enableval)
277 # Check for the key/uid cache size. This can't be zero, but can be
278 # pretty small on embedded systems. This is used for the gpg part.
280 AC_MSG_CHECKING([for the size of the key and uid cache])
281 AC_ARG_ENABLE(key-cache,
282 AC_HELP_STRING([--enable-key-cache=SIZE],
283 [Set key cache to SIZE (default 4096)]),,enableval=4096)
284 if test "$enableval" = "no"; then
286 elif test "$enableval" = "yes" || test "$enableval" = ""; then
290 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
292 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
293 AC_MSG_ERROR([invalid key-cache size])
295 AC_MSG_RESULT($key_cache_size)
296 AC_DEFINE_UNQUOTED(PK_UID_CACHE_SIZE,$key_cache_size,
297 [Size of the key and UID caches])
302 # Check whether we want to use Linux capabilities
304 AC_MSG_CHECKING([whether use of capabilities is requested])
305 AC_ARG_WITH(capabilities,
306 [ --with-capabilities use linux capabilities [default=no]],
307 [use_capabilities="$withval"],[use_capabilities=no])
308 AC_MSG_RESULT($use_capabilities)
312 # Allow disabling of internal CCID support.
313 # It is defined only after we confirm the library is available later
315 AC_MSG_CHECKING([whether to enable the internal CCID driver])
316 AC_ARG_ENABLE(ccid-driver,
317 AC_HELP_STRING([--disable-ccid-driver],
318 [disable the internal CCID driver]),
319 use_ccid_driver=$enableval)
320 AC_MSG_RESULT($use_ccid_driver)
324 # To avoid double inclusion of config.h which might happen at some
325 # places, we add the usual double inclusion protection at the top of
329 #ifndef GNUPG_CONFIG_H_INCLUDED
330 #define GNUPG_CONFIG_H_INCLUDED
334 # Stuff which goes at the bottom of config.h.
337 /* This is the major version number of GnuPG so that
338 source included files can test for this. Note, that
339 we use 2 here even for GnuPG 1.9.x. */
340 #define GNUPG_MAJOR_VERSION 2
342 /* Now to separate file name parts.
343 Please note that the string version must not contain more
344 than one character because the code assumes strlen()==1 */
345 #ifdef HAVE_DOSISH_SYSTEM
346 #define DIRSEP_C '\\'
347 #define DIRSEP_S "\\"
350 #define PATHSEP_C ';'
351 #define PATHSEP_S ";"
352 #define EXEEXT_S ".exe"
358 #define PATHSEP_C ':'
359 #define PATHSEP_S ":"
363 /* This is the same as VERSION, but should be overridden if the
364 platform cannot handle things like dots '.' in filenames. Set
365 SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
366 uses for dots and dashes. */
367 #define SAFE_VERSION VERSION
368 #define SAFE_VERSION_DOT '.'
369 #define SAFE_VERSION_DASH '-'
371 /* Some global constants. */
372 #ifdef HAVE_DRIVE_LETTERS
373 #define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
375 #define GNUPG_DEFAULT_HOMEDIR "/SYS\$LOGIN/gnupg"
377 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
379 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
381 /* For some systems (DOS currently), we hardcode the path here. For
382 POSIX systems the values are constructed by the Makefiles, so that
383 the values may be overridden by the make invocations; this is to
384 comply with the GNU coding standards. */
385 #ifdef HAVE_DRIVE_LETTERS
386 /* FIXME: We need to use a function to determine these values depending
387 on the actual installation directory. */
388 #define GNUPG_BINDIR "c:\\gnupg"
389 #define GNUPG_LIBEXECDIR "c:\\gnupg"
390 #define GNUPG_LIBDIR "c:\\gnupg"
391 #define GNUPG_DATADIR "c:\\gnupg"
392 #define GNUPG_SYSCONFDIR "c:\\gnupg"
395 /* Derive some other constants. */
396 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
397 #define EXEC_TEMPFILE_ONLY
401 /* We didn't define endianness above, so get it from OS macros. This
402 is intended for making fat binary builds on OS X. */
403 #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST)
404 #if defined(__BIG_ENDIAN__)
405 #define BIG_ENDIAN_HOST 1
406 #elif defined(__LITTLE_ENDIAN__)
407 #define LITTLE_ENDIAN_HOST 1
409 #error "No endianness found"
414 /* Hack used for W32: ldap.m4 also tests for the ASCII version of
415 ldap_start_tls_s because that is the actual symbol used in the
416 library. winldap.h redefines it to our commonly used value,
417 thus we define our usual macro here. */
418 #ifdef HAVE_LDAP_START_TLS_SA
419 # ifndef HAVE_LDAP_START_TLS_S
420 # define HAVE_LDAP_START_TLS_S 1
425 /* Tell libgcrypt not to use its own libgpg-error implementation. */
426 #define USE_LIBGPG_ERROR 1
428 /* We use jnlib, so tell other modules about it. */
429 #define HAVE_JNLIB_LOGGING 1
431 /* Our HTTP code is used in estream mode. */
432 #define HTTP_USE_ESTREAM 1
434 /* Under W32 we do an explicit socket initialization, thus we need to
435 avoid the on-demand initialization which would also install an atexit
437 #define HTTP_NO_WSASTARTUP
439 /* We always include support for the OpenPGP card. */
440 #define ENABLE_CARD_SUPPORT 1
442 /* We don't want the old assuan codes anymore. */
443 #define _ASSUAN_ONLY_GPG_ERRORS 1
445 /* We don't need any of the old gcrypt functions. */
446 #define GCRYPT_NO_DEPRECATED 1
448 /* We explicitly need to disable PTH's soft mapping as Debian
449 currently enables it by default for no reason. */
450 #define PTH_SYSCALL_SOFT 0
452 /* We want to use the libgcrypt provided memory allocation for
454 #define _ESTREAM_PRINTF_MALLOC gcry_malloc
455 #define _ESTREAM_PRINTF_FREE gcry_free
456 #define _ESTREAM_PRINTF_EXTRA_INCLUDE "util.h"
458 #endif /*GNUPG_CONFIG_H_INCLUDED*/
464 # Checks for programs.
465 AC_MSG_NOTICE([checking for programs])
468 missing_dir=`cd $ac_aux_dir && pwd`
469 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
470 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
471 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
472 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
473 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
478 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
479 AC_MSG_ERROR([[No C-89 compiler found]])
484 AC_CHECK_TOOL(AR, ar, :)
485 AC_PATH_PROG(PERL,"perl")
486 AC_CHECK_TOOL(WINDRES, windres, :)
493 # We need to compile and run a program on the build machine. A
494 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
495 # the AC archive is broken for autoconf 2.57. Given that tehre is no
496 # newer version of that macro, we assume that it is also broken for
497 # autoconf 2.61 and thus we use a simple but usually sufficient
499 AC_MSG_CHECKING(for cc for build)
500 if test "$cross_compiling" = "yes"; then
501 CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
503 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
505 AC_MSG_RESULT($CC_FOR_BUILD)
506 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
511 have_dosish_system=no
513 use_simple_gettext=no
516 # special stuff for Windoze NT
517 ac_cv_have_dev_random=no
518 AC_DEFINE(USE_ONLY_8DOT3,1,
519 [set this to limit filenames to the 8.3 format])
520 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
521 [defined if we must run on a stupid file system])
522 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
523 [because the Unix gettext has too much overhead on
524 MingW32 systems and these systems lack Posix functions,
525 we use a simplified version of gettext])
526 disable_keyserver_path=yes
527 have_dosish_system=yes
530 use_simple_gettext=yes
532 i?86-emx-os2 | i?86-*-os2*emx )
533 # OS/2 with the EMX environment
534 ac_cv_have_dev_random=no
535 AC_DEFINE(HAVE_DRIVE_LETTERS)
536 have_dosish_system=yes
541 # DOS with the DJGPP environment
542 ac_cv_have_dev_random=no
543 AC_DEFINE(HAVE_DRIVE_LETTERS)
544 have_dosish_system=yes
550 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
551 LDFLAGS="$LDFLAGS -L/usr/local/lib"
555 if test -z "$GCC" ; then
556 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
560 if test -z "$GCC" ; then
561 # Suppress all warnings
562 # to get rid of the unsigned/signed char mismatch warnings.
567 if test -z "$GCC" ; then
568 # Use the newer compiler `-msg_disable ptrmismatch1' to
569 # get rid of the unsigned/signed char mismatch warnings.
570 # Using this may hide other pointer mismatch warnings, but
571 # it at least lets other warning classes through
572 CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
581 if test "$have_dosish_system" = yes; then
582 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
583 [Defined if we run on some of the PCDOS like systems
584 (DOS, Windoze. OS/2) with special properties like
587 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
589 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
591 if test "$have_w32_system" = yes; then
592 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
594 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
596 if test "$disable_keyserver_path" = yes; then
597 AC_DEFINE(DISABLE_KEYSERVER_PATH,1,
598 [Defined to disable exec-path for keyserver helpers])
602 # Allows enabling the use of a standard socket by default This is
603 # gpg-agent's option --[no-]use-standard-socket. For Windows we force
606 AC_MSG_CHECKING([whether to use a standard socket by default])
607 AC_ARG_ENABLE(standard-socket,
608 AC_HELP_STRING([--enable-standard-socket],
609 [use a standard socket for the agent by default]),
610 use_standard_socket=$enableval)
612 if test "$use_standard_socket" != yes; then
613 if test "$have_w32_system" = yes; then
614 use_standard_socket=yes
618 AC_MSG_RESULT($use_standard_socket$tmp)
619 if test "$use_standard_socket" = yes; then
620 AC_DEFINE(USE_STANDARD_SOCKET,1,
621 [Use a standard socket for the agent by default])
625 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
626 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
628 if test x"$try_hkp" = xyes ; then
629 AC_SUBST(GPGKEYS_HKP,"gpg2keys_hkp$EXEEXT")
632 if test x"$try_finger" = xyes ; then
633 AC_SUBST(GPGKEYS_FINGER,"gpg2keys_finger$EXEEXT")
639 # Checks for libraries.
641 AC_MSG_NOTICE([checking for libraries])
645 # libgpg-error is a library with error codes shared between GnuPG
648 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
649 have_gpg_error=yes,have_gpg_error=no)
653 # Libgcrypt is our generic crypto library
655 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
656 have_libgcrypt=yes,have_libgcrypt=no)
660 # libassuan is used for IPC
662 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
663 have_libassuan=yes,have_libassuan=no)
664 if test "$have_libassuan" = "yes"; then
665 AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
666 [version of the libbassuan library])
672 # libksba is our X.509 support library
674 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
678 # libusb allows us to use the integrated CCID smartcard reader driver.
680 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
681 if test "$use_ccid_driver" = yes ; then
682 AC_CHECK_LIB(usb, usb_bulk_write,
683 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
684 AC_DEFINE(HAVE_LIBUSB,1,
685 [defined if libusb is available])
688 AC_CHECK_FUNCS(usb_create_match)
690 AC_SUBST(LIBUSB_LIBS)
693 # Check wether it is necessary to link against libdl.
695 gnupg_dlopen_save_libs="$LIBS"
697 AC_SEARCH_LIBS(dlopen, c dl,,,)
700 LIBS="$gnupg_dlopen_save_libs"
703 # Checks for symcryptrun:
706 # libutil has openpty() and login_tty().
707 AC_CHECK_LIB(util, openpty,
708 [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
709 AC_DEFINE(HAVE_LIBUTIL,1,
710 [defined if libutil is available])
712 AC_SUBST(LIBUTIL_LIBS)
714 # shred is used to clean temporary plain text files.
715 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
716 AC_DEFINE_UNQUOTED(SHRED,
717 "${SHRED}", [defines the filename of the shred program])
722 # Check whether the GNU Pth library is available
723 # Note, that we include a Pth emulation for W32.
726 if test "$have_pth" = "yes"; then
727 AC_DEFINE(USE_GNU_PTH, 1,
728 [Defined if the GNU Portable Thread Library should be used])
732 *** To support concurrent access to the gpg-agent and the SCdaemon
733 *** we need the support of the GNU Portable Threads Library.
734 *** Download it from ftp://ftp.gnu.org/gnu/pth/
735 *** On a Debian GNU/Linux system you might want to try
736 *** apt-get install libpth-dev
741 AC_MSG_NOTICE([checking for networking options])
744 # Must check for network library requirements before doing link tests
745 # for ldap, for example. If ldap libs are static (or dynamic and without
746 # ELF runtime link paths), then link will fail and LDAP support won't
749 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
750 [NETLIBS="-lnsl $NETLIBS"]))
751 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
752 [NETLIBS="-lsocket $NETLIBS"]))
758 _cppflags="${CPPFLAGS}"
759 _ldflags="${LDFLAGS}"
761 AC_HELP_STRING([--with-adns=DIR],
762 [look for the adns library in DIR]),
763 [if test -d "$withval"; then
764 CPPFLAGS="${CPPFLAGS} -I$withval/include"
765 LDFLAGS="${LDFLAGS} -L$withval/lib"
767 if test "$with_adns" != "no"; then
768 AC_CHECK_HEADERS(adns.h,
769 AC_CHECK_LIB(adns, adns_init,
771 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),
772 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
774 if test "$have_adns" = "yes"; then
778 # Newer adns versions feature a free function to be used under W32.
779 AC_CHECK_FUNCS(adns_free)
783 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
785 if test x"$try_hkp" = xyes || test x"$try_http" = xyes ; then
786 AC_ARG_ENABLE(dns-srv,
787 AC_HELP_STRING([--disable-dns-srv],
788 [disable the use of DNS SRV in HKP and HTTP]),
789 use_dns_srv=$enableval,use_dns_srv=yes)
792 AC_ARG_ENABLE(dns-pka,
793 AC_HELP_STRING([--disable-dns-pka],
794 [disable the use of PKA records in DNS]),
795 use_dns_pka=$enableval,use_dns_pka=yes)
797 AC_ARG_ENABLE(dns-cert,
798 AC_HELP_STRING([--disable-dns-cert],
799 [disable the use of CERT records in DNS]),
800 use_dns_cert=$enableval,use_dns_cert=yes)
802 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
803 || test x"$use_dns_cert" = xyes; then
806 # the double underscore thing is a glibc-ism?
807 AC_SEARCH_LIBS(res_query,resolv bind,,
808 AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
809 AC_SEARCH_LIBS(dn_expand,resolv bind,,
810 AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
811 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
812 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
814 if test x"$have_resolver" != xno ; then
816 # Make sure that the BIND 4 resolver interface is workable before
817 # enabling any code that calls it. At some point I'll rewrite the
818 # code to use the BIND 8 resolver API.
819 # We might also want to use adns instead. Problem with ADNS is that
820 # it does not support v6.
822 AC_MSG_CHECKING([whether the resolver is usable])
823 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
824 #include <netinet/in.h>
825 #include <arpa/nameser.h>
826 #include <resolv.h>]],
827 [[unsigned char answer[PACKETSZ];
828 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
830 dn_expand(0,0,0,0,0);
831 ]])],have_resolver=yes,have_resolver=no)
832 AC_MSG_RESULT($have_resolver)
834 # This is Apple-specific and somewhat bizarre as they changed the
835 # define in bind 8 for some reason.
837 if test x"$have_resolver" != xyes ; then
839 [whether I can make the resolver usable with BIND_8_COMPAT])
840 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#define BIND_8_COMPAT
841 #include <sys/types.h>
842 #include <netinet/in.h>
843 #include <arpa/nameser.h>
844 #include <resolv.h>]],
845 [[unsigned char answer[PACKETSZ];
846 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
847 dn_skipname(0,0); dn_expand(0,0,0,0,0);
848 ]])],[have_resolver=yes ; need_compat=yes])
849 AC_MSG_RESULT($have_resolver)
853 if test x"$have_resolver" = xyes ; then
856 if test x"$use_dns_srv" = xyes ; then
857 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
860 if test x"$use_dns_pka" = xyes ; then
861 AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
864 if test x"$use_dns_cert" = xyes ; then
865 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
868 if test x"$need_compat" = xyes ; then
869 AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
872 # If we have no resolver library but ADNS (e.g. under W32) enable the
873 # code parts which can be used with ADNS.
874 if test x"$have_adns" = xyes ; then
876 AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
878 if test x"$use_dns_srv" = xyes ; then
879 AC_DEFINE(USE_DNS_SRV,1)
882 if test x"$use_dns_pka" = xyes ; then
883 AC_DEFINE(USE_DNS_PKA,1)
886 if test x"$use_dns_cert" = xyes ; then
887 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
901 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
907 if test "$try_ldap" = yes ; then
908 GNUPG_CHECK_LDAP($NETLIBS)
912 # Check for curl. We fake the curl API if libcurl isn't installed.
913 # We require 7.10 or later as we use curl_version_info().
915 LIBCURL_CHECK_CONFIG([yes],[7.10],,[fake_curl=yes])
916 AM_CONDITIONAL(FAKE_CURL,test x"$fake_curl" = xyes)
918 # Generic, for us, means curl
920 if test x"$try_generic" = xyes ; then
921 AC_SUBST(GPGKEYS_CURL,"gpg2keys_curl$EXEEXT")
927 # This isn't necessarily sendmail itself, but anything that gives a
928 # sendmail-ish interface to the outside world. That includes Exim,
929 # Postfix, etc. Basically, anything that can handle "sendmail -t".
930 if test "$try_mailto" = yes ; then
931 AC_ARG_WITH(mailprog,
932 AC_HELP_STRING([--with-mailprog=NAME],
933 [use "NAME -t" for mail transport]),
936 if test x"$with_mailprog" = xyes ; then
937 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
938 if test "$ac_cv_path_SENDMAIL" ; then
939 GPGKEYS_MAILTO="gpg2keys_mailto"
941 elif test x"$with_mailprog" != xno ; then
942 AC_MSG_CHECKING([for a mail transport program])
943 AC_SUBST(SENDMAIL,$with_mailprog)
944 AC_MSG_RESULT($with_mailprog)
945 GPGKEYS_MAILTO="gpg2keys_mailto"
949 AC_SUBST(GPGKEYS_MAILTO)
952 # Construct a printable name of the OS
956 PRINTABLE_OS_NAME="MingW32"
959 PRINTABLE_OS_NAME="Cygwin"
961 i?86-emx-os2 | i?86-*-os2*emx )
962 PRINTABLE_OS_NAME="OS/2"
965 PRINTABLE_OS_NAME="MSDOS/DJGPP"
969 PRINTABLE_OS_NAME="GNU/Linux"
972 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
975 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
976 [A human readable text with the name of the OS])
984 if test "$am_cv_func_iconv" != yes; then
992 # This is "GNU gnupg" - The project-id script from gettext
995 AC_MSG_NOTICE([checking for gettext])
997 AM_GNU_GETTEXT_VERSION([0.17])
998 if test "$try_gettext" = yes; then
999 AM_GNU_GETTEXT([external],[need-ngettext])
1001 # gettext requires some extra checks. These really should be part of
1002 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
1003 # function checks to here.
1005 AC_CHECK_FUNCS(strchr)
1008 USE_INCLUDED_LIBINTL=no
1009 BUILD_INCLUDED_LIBINTL=no
1012 AC_SUBST(USE_INCLUDED_LIBINTL)
1013 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1017 # We use HAVE_LANGINFO_CODESET in a couple of places.
1020 # Checks required for our use locales
1027 if test "$selinux_support" = yes ; then
1028 AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1033 # Checks for header files.
1035 AC_MSG_NOTICE([checking for header files])
1037 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h])
1038 AC_CHECK_HEADERS([pty.h utmp.h pwd.h inttypes.h])
1043 # Checks for typedefs, structures, and compiler characteristics.
1045 AC_MSG_NOTICE([checking for system characteristics])
1054 gl_HEADER_SYS_SOCKET
1057 AC_ARG_ENABLE(endian-check,
1058 AC_HELP_STRING([--disable-endian-check],
1059 [disable the endian check and trust the OS provided macros]),
1060 endiancheck=$enableval,endiancheck=yes)
1062 if test x"$endiancheck" = xyes ; then
1066 # fixme: we should get rid of the byte type
1067 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
1068 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
1069 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
1070 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
1071 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
1073 AC_CHECK_SIZEOF(unsigned short)
1074 AC_CHECK_SIZEOF(unsigned int)
1075 AC_CHECK_SIZEOF(unsigned long)
1076 AC_CHECK_SIZEOF(unsigned long long)
1077 AC_CHECK_SIZEOF(time_t,,[[
1079 #if TIME_WITH_SYS_TIME
1080 # include <sys/time.h>
1083 # if HAVE_SYS_TIME_H
1084 # include <sys/time.h>
1092 # Ensure that we have UINT64_C before we bother to check for uint64_t
1093 # Fixme: really needed in gnupg? I think it is only useful in libcgrypt.
1094 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
1095 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <inttypes.h>]],
1096 [[uint64_t foo=UINT64_C(42);]])],
1097 [gnupg_cv_uint64_c_works=yes],
1098 [gnupg_cv_uint64_c_works=no] ))
1099 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
1100 AC_CHECK_SIZEOF(uint64_t)
1103 if test "$ac_cv_sizeof_unsigned_short" = "0" \
1104 || test "$ac_cv_sizeof_unsigned_int" = "0" \
1105 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
1106 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
1111 # Checks for library functions.
1113 AC_MSG_NOTICE([checking for library functions])
1114 AC_CHECK_DECLS(getpagesize)
1118 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap])
1119 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r])
1120 AC_CHECK_FUNCS([unsetenv fcntl ftruncate inet_ntop])
1121 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
1122 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
1123 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe stat getaddrinfo])
1124 AC_CHECK_FUNCS([ttyname rand ftello fsync stat])
1126 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1129 # These are needed by libjnlib - fixme: we should use a jnlib.m4
1130 # Note: We already checked pwd.h.
1131 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol])
1132 AC_CHECK_FUNCS([memrchr isascii timegm getrusage setrlimit stat setlocale])
1133 AC_CHECK_FUNCS([flockfile funlockfile fopencookie funopen getpwnam getpwuid])
1138 gl_SOURCE_BASE([gl])
1140 gl_MODULES([setenv mkdtemp xsize strpbrk])
1147 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1150 # Sanity check regex. Tests adapted from mutt.
1152 AC_MSG_CHECKING([whether regular expression support is requested])
1153 AC_ARG_ENABLE(regex,
1154 AC_HELP_STRING([--disable-regex],
1155 [do not handle regular expressions in trust signatures]),
1156 use_regex=$enableval, use_regex=yes)
1157 AC_MSG_RESULT($use_regex)
1159 if test "$use_regex" = yes ; then
1160 _cppflags="${CPPFLAGS}"
1161 _ldflags="${LDFLAGS}"
1163 AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1165 if test -d "$withval" ; then
1166 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1167 LDFLAGS="${LDFLAGS} -L$withval/lib"
1171 # Does the system have regex functions at all?
1172 AC_SEARCH_LIBS([regcomp], [regex])
1173 AC_CHECK_FUNC(regcomp, gnupg_cv_have_regex=yes, gnupg_cv_have_regex=no)
1175 if test $gnupg_cv_have_regex = no; then
1178 if test x"$cross_compiling" = xyes; then
1179 AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1181 AC_CACHE_CHECK([whether your system's regexp library is broken],
1182 [gnupg_cv_regex_broken],
1186 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); }],
1187 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1189 if test $gnupg_cv_regex_broken = yes; then
1190 AC_MSG_WARN([your regex is broken - disabling regex use])
1195 CPPFLAGS="${_cppflags}"
1196 LDFLAGS="${_ldflags}"
1199 if test "$use_regex" != yes ; then
1200 AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1202 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1207 # Do we have zlib? Must do it here because Solaris failed
1208 # when compiling a conftest (due to the "-lz" from LIBS).
1209 # Note that we combine zlib and bzlib2 in ZLIBS.
1211 _cppflags="${CPPFLAGS}"
1212 _ldflags="${LDFLAGS}"
1214 [ --with-zlib=DIR use libz in DIR],[
1215 if test -d "$withval"; then
1216 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1217 LDFLAGS="${LDFLAGS} -L$withval/lib"
1221 AC_CHECK_HEADER(zlib.h,
1222 AC_CHECK_LIB(z, deflateInit2_,
1224 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1225 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1228 # Check whether we can support bzip2
1230 if test "$use_bzip2" = yes ; then
1231 _cppflags="${CPPFLAGS}"
1232 _ldflags="${LDFLAGS}"
1234 AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1236 if test -d "$withval" ; then
1237 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1238 LDFLAGS="${LDFLAGS} -L$withval/lib"
1242 # Checking alongside stdio.h as an early version of bzip2 (1.0)
1243 # required stdio.h to be included before bzlib.h, and Solaris 9 is
1244 # woefully out of date.
1245 if test "$withval" != no ; then
1246 AC_CHECK_HEADER(bzlib.h,
1247 AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1250 ZLIBS="$ZLIBS -lbz2"
1251 AC_DEFINE(HAVE_BZIP2,1,
1252 [Defined if the bz2 compression library is available])
1254 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1255 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1258 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1262 # Check for readline support
1263 GNUPG_CHECK_READLINE
1266 if test "$development_version" = yes; then
1267 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1268 [Defined if this is not a regular release])
1271 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1275 # Add some extra libs here so that previous tests don't fail for
1276 # mysterious reasons - the final link step should bail out.
1277 # W32SOCKLIBS is also defined so that if can be used for tools not
1278 # requiring any network stuff but linking to code in libcommon which
1279 # tracks in winsock stuff (e.g. init_common_subsystems.
1280 if test "$have_w32_system" = yes; then
1281 W32SOCKLIBS="-lws2_32"
1282 NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1286 AC_SUBST(W32SOCKLIBS)
1289 # Setup gcc specific options
1291 AC_MSG_NOTICE([checking for cc features])
1292 if test "$GCC" = yes; then
1293 # Check whether gcc does not emit a diagnositc for unknow -Wno-*
1294 # options. This is the case for gcc >= 4.6
1295 AC_MSG_CHECKING([if gcc ignores unknown -Wno-* options])
1296 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1297 #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6 )
1299 #endif]],[])],[_gcc_silent_wno=yes],[_gcc_silent_wno=no])
1300 AC_MSG_RESULT($_gcc_silent_wno)
1302 # Note that it is okay to use CFLAGS here because this are just
1303 # warning options and the user should have a chance of overriding
1305 if test "$USE_MAINTAINER_MODE" = "yes"; then
1306 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1307 CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1308 if test x"$_gcc_silent_wno" = xyes ; then
1311 AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1312 _gcc_cflags_save=$CFLAGS
1313 CFLAGS="-Wno-missing-field-initializers"
1314 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1315 [_gcc_wopt=yes],[_gcc_wopt=no])
1316 AC_MSG_RESULT($_gcc_wopt)
1317 CFLAGS=$_gcc_cflags_save;
1319 if test x"$_gcc_wopt" = xyes ; then
1320 CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
1323 AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
1324 _gcc_cflags_save=$CFLAGS
1325 CFLAGS="-Wdeclaration-after-statement"
1326 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1327 [_gcc_wopt=yes],[_gcc_wopt=no])
1328 AC_MSG_RESULT($_gcc_wopt)
1329 CFLAGS=$_gcc_cflags_save;
1330 if test x"$_gcc_wopt" = xyes ; then
1331 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1334 CFLAGS="$CFLAGS -Wall"
1337 if test x"$_gcc_silent_wno" = xyes ; then
1340 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1341 _gcc_cflags_save=$CFLAGS
1342 CFLAGS="-Wno-pointer-sign"
1343 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
1344 [_gcc_psign=yes],[_gcc_psign=no])
1345 AC_MSG_RESULT($_gcc_psign)
1346 CFLAGS=$_gcc_cflags_save;
1348 if test x"$_gcc_psign" = xyes ; then
1349 CFLAGS="$CFLAGS -Wno-pointer-sign"
1352 AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1353 _gcc_cflags_save=$CFLAGS
1354 CFLAGS="-Wpointer-arith"
1355 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],[_gcc_psign=yes],[_gcc_psign=no])
1356 AC_MSG_RESULT($_gcc_psign)
1357 CFLAGS=$_gcc_cflags_save;
1358 if test x"$_gcc_psign" = xyes ; then
1359 CFLAGS="$CFLAGS -Wpointer-arith"
1362 # The undocumented option -Wno-psabi suppresses the annoying
1363 # "the ABI of passing union with long double has changed in GCC 4.4"
1364 # which is emitted in estream-printf.c but entirely irrelvant
1365 # because that union is local to the file.
1366 if test x"$_gcc_silent_wno" = xyes ; then
1367 CFLAGS="$CFLAGS -Wno-psabi"
1373 # This is handy for debugging so the compiler doesn't rearrange
1374 # things and eliminate variables.
1376 AC_ARG_ENABLE(optimization,
1377 AC_HELP_STRING([--disable-optimization],
1378 [disable compiler optimization]),
1379 [if test $enableval = no ; then
1380 CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
1384 # Prepare building of estream
1390 # Decide what to build
1392 if test "$have_adns" = "yes"; then
1393 AC_SUBST(GPGKEYS_KDNS, "gpg2keys_kdns$EXEEXT")
1398 if test $have_ksba = no; then
1403 build_agent_threaded=""
1404 if test "$build_agent" = "yes"; then
1405 if test $have_pth = no; then
1406 build_agent_threaded="(not multi-threaded)"
1411 build_scdaemon_extra=""
1412 if test "$build_scdaemon" = "yes"; then
1414 if test $have_pth = no; then
1415 build_scdaemon_extra="not multi-threaded"
1419 if test $have_libusb = no; then
1420 build_scdaemon_extra="${tmp}without internal CCID driver"
1423 if test -n "$build_scdaemon_extra"; then
1424 build_scdaemon_extra="(${build_scdaemon_extra})"
1429 if test "$build_agent_only" = "yes" ; then
1438 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
1439 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1440 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1441 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1442 AM_CONDITIONAL(BUILD_TOOLS, test "$build_tools" = "yes")
1443 AM_CONDITIONAL(BUILD_DOC, test "$build_doc" = "yes")
1444 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1445 AM_CONDITIONAL(BUILD_GPGTAR, test "$build_gpgtar" = "yes")
1447 AM_CONDITIONAL(RUN_GPG_TESTS,
1448 test x$cross_compiling = xno -a "$build_gpg" = yes )
1452 # Provide information about the build.
1454 BUILD_REVISION="mym4_revision"
1455 AC_SUBST(BUILD_REVISION)
1456 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
1457 [GIT commit id revision used to build this package])
1460 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
1462 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
1463 AC_SUBST(BUILD_FILEVERSION)
1465 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
1466 AC_SUBST(BUILD_TIMESTAMP)
1467 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
1468 [The time this package was configured for a build])
1469 BUILD_HOSTNAME="$ac_hostname"
1470 AC_SUBST(BUILD_HOSTNAME)
1474 # Print errors here so that they are visible all
1475 # together and the user can acquire them all together.
1478 if test "$have_gpg_error" = "no"; then
1482 *** You need libgpg-error to build this program.
1483 ** This library is for example available at
1484 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
1485 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1488 if test "$have_libgcrypt" = "no"; then
1492 *** You need libgcrypt to build this program.
1493 ** This library is for example available at
1494 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1495 *** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API is required.)
1498 if test "$have_libassuan" = "no"; then
1502 *** You need libassuan to build this program.
1503 *** This library is for example available at
1504 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
1505 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1508 if test "$have_ksba" = "no"; then
1511 *** You need libksba to build this program.
1512 *** This library is for example available at
1513 *** ftp://ftp.gnupg.org/gcrypt/libksba/
1514 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1517 if test "$missing_pth" = "yes"; then
1520 *** It is now required to build with support for the
1521 *** GNU Portable Threads Library (Pth). Please install this
1522 *** library first. The library is for example available at
1523 *** ftp://ftp.gnu.org/gnu/pth/
1524 *** On a Debian GNU/Linux system you can install it using
1525 *** apt-get install libpth-dev
1526 *** To build GnuPG for Windows you need to use the W32PTH
1527 *** package; available at:
1528 *** ftp://ftp.g10code.com/g10code/w32pth/
1532 if test "$missing_iconv" = "yes"; then
1535 *** It is now required to build with support for iconv
1536 *** Please install a suitable iconv implementation.
1541 if test "$die" = "yes"; then
1544 *** Required libraries not found. Please consult the above messages
1545 *** and install them before running configure again.
1551 AC_CONFIG_FILES([ m4/Makefile
1565 keyserver/gpg2keys_mailto
1566 keyserver/gpg2keys_test
1571 tests/openpgp/Makefile
1572 tests/pkits/Makefile
1578 GnuPG v${VERSION} has been configured as follows:
1580 Revision: mym4_revision (mym4_revision_dec)
1581 Platform: $PRINTABLE_OS_NAME ($host)
1584 S/MIME: $build_gpgsm
1585 Agent: $build_agent $build_agent_threaded
1586 Smartcard: $build_scdaemon $build_scdaemon_extra
1587 Gpgtar: $build_gpgtar
1589 Protect tool: $show_gnupg_protect_tool_pgm
1590 Default agent: $show_gnupg_agent_pgm
1591 Default pinentry: $show_gnupg_pinentry_pgm
1592 Default scdaemon: $show_gnupg_scdaemon_pgm
1593 Default dirmngr: $show_gnupg_dirmngr_pgm
1595 if test x"$use_regex" != xyes ; then
1597 Warning: No regular expression support available.
1598 OpenPGP trust signatures won't work.
1599 gpg-check-pattern will not be build.