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 Free Software Foundation, Inc.
5 # This file is part of GnuPG.
7 # GnuPG is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # GnuPG is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, see <http://www.gnu.org/licenses/>.
20 # Process this file with autoconf to produce a configure script.
22 min_automake_version="1.10"
24 # Remember to change the version number immediately *after* a release.
25 # Set my_issvn to "yes" for non-released code. Remember to run an
26 # "svn up" and "autogen.sh" right before creating a distribution.
27 m4_define([my_version], [2.1.0])
28 m4_define([my_issvn], [yes])
30 m4_define([svn_revision], m4_esyscmd([printf "%d" $(svn info 2>/dev/null \
31 | sed -n '/^Revision:/ s/[^0-9]//gp'|head -1)]))
32 m4_define([git_revision], m4_esyscmd([git branch -v 2>/dev/null \
33 | awk '/^\* / {printf "%s",$3}']))
35 [my_version[]m4_if(my_issvn,[yes],
36 [m4_if(git_revision,[],[-svn[]svn_revision],[-git[]git_revision])])],
37 [http://bugs.gnupg.org])
38 # Set development_version to yes if the minor number is odd or you
39 # feel that the default check for a development version is not
41 development_version=no
43 NEED_GPG_ERROR_VERSION=1.8
46 NEED_LIBGCRYPT_VERSION=1.4.6
49 NEED_LIBASSUAN_VERSION=2.0.0
52 NEED_KSBA_VERSION=1.1.0
56 PACKAGE_GT=${PACKAGE_NAME}2
57 VERSION=$PACKAGE_VERSION
59 AC_CONFIG_AUX_DIR(scripts)
60 AC_CONFIG_SRCDIR(sm/gpgsm.c)
61 AM_CONFIG_HEADER(config.h)
62 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
68 # Some status variables.
80 disable_keyserver_path=no
82 use_standard_socket=yes
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(g13, yes)
92 GNUPG_BUILD_PROGRAM(dirmngr, yes)
93 GNUPG_BUILD_PROGRAM(tools, yes)
94 GNUPG_BUILD_PROGRAM(doc, yes)
95 GNUPG_BUILD_PROGRAM(symcryptrun, no)
96 GNUPG_BUILD_PROGRAM(gpgtar, no)
101 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
102 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
103 [Name of this package for gettext])
104 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
105 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
106 [Bug report address])
107 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
108 [Required version of Libgcrypt])
109 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
110 [Required version of Libksba])
114 # The default is to use the modules from this package and the few
115 # other packages in a standard place; i.e where this package gets
116 # installed. With these options it is possible to override these
117 # ${prefix} depended values with fixed paths, which can't be replaced
118 # at make time. See also am/cmacros.am and the defaults in AH_BOTTOM.
119 AC_ARG_WITH(agent-pgm,
120 [ --with-agent-pgm=PATH Use PATH as the default for the agent)],
121 GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
122 AC_SUBST(GNUPG_AGENT_PGM)
123 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
124 show_gnupg_agent_pgm="(default)"
125 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
127 AC_ARG_WITH(pinentry-pgm,
128 [ --with-pinentry-pgm=PATH Use PATH as the default for the pinentry)],
129 GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
130 AC_SUBST(GNUPG_PINENTRY_PGM)
131 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
132 show_gnupg_pinentry_pgm="(default)"
133 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
136 AC_ARG_WITH(scdaemon-pgm,
137 [ --with-scdaemon-pgm=PATH Use PATH as the default for the scdaemon)],
138 GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
139 AC_SUBST(GNUPG_SCDAEMON_PGM)
140 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
141 show_gnupg_scdaemon_pgm="(default)"
142 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
145 AC_ARG_WITH(dirmngr-pgm,
146 [ --with-dirmngr-pgm=PATH Use PATH as the default for the dirmngr)],
147 GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
148 AC_SUBST(GNUPG_DIRMNGR_PGM)
149 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
150 show_gnupg_dirmngr_pgm="(default)"
151 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
153 AC_ARG_WITH(protect-tool-pgm,
154 [ --with-protect-tool-pgm=PATH Use PATH as the default for the protect-tool)],
155 GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
156 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
157 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
158 show_gnupg_protect_tool_pgm="(default)"
159 test -n "$GNUPG_PROTECT_TOOL_PGM" \
160 && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
162 AC_ARG_WITH(dirmngr-ldap-pgm,
163 [ --with-dirmngr-ldap-pgm=PATH Use PATH as the default for the dirmnge ldap wrapper)],
164 GNUPG_DIRMNGR_LDAP_PGM="$withval", GNUPG_DIRMNGR_LDAP_PGM="" )
165 AC_SUBST(GNUPG_DIRMNGR_LDAP_PGM)
166 AM_CONDITIONAL(GNUPG_DIRMNGR_LDAP_PGM, test -n "$GNUPG_DIRMNGR_LDAP_PGM")
167 show_gnupg_dirmngr_ldap_pgm="(default)"
168 test -n "$GNUPG_DIRMNGR_LDAP_PGM" \
169 && show_gnupg_dirmngr_ldap_pgm="$GNUPG_DIRMNGR_LDAP_PGM"
172 # On some platforms gpg2 is usually installed as gpg without using a
173 # symlink. For correct operation of gpgconf it needs to know the
174 # installed name of gpg. This option sets "gpg2"'s installed name to
175 # just "gpg". Note that it might be required to rename gpg2 to gpg
176 # manually after the build process.
178 AC_ARG_ENABLE(gpg2-is-gpg,
179 AC_HELP_STRING([--enable-gpg2-is-gpg],[Set installed name of gpg2 to gpg]),
180 gpg2_is_gpg=$enableval)
181 if test "$gpg2_is_gpg" = "yes"; then
182 name_of_installed_gpg=gpg
184 name_of_installed_gpg=gpg2
186 AC_DEFINE_UNQUOTED(NAME_OF_INSTALLED_GPG, "$name_of_installed_gpg",
187 [The name of the installed GPG tool])
190 # Some folks want to use only the agent from this packet. Make it
191 # easier for them by providing the configure option
192 # --enable-only-agent.
193 AC_ARG_ENABLE(agent-only,
194 AC_HELP_STRING([--enable-agent-only],[build only the gpg-agent]),
195 build_agent_only=$enableval)
197 # SELinux support includes tracking of sensitive files to avoid
198 # leaking their contents through processing these files by gpg itself
199 AC_MSG_CHECKING([whether SELinux support is requested])
200 AC_ARG_ENABLE(selinux-support,
201 AC_HELP_STRING([--enable-selinux-support],
202 [enable SELinux support]),
203 selinux_support=$enableval, selinux_support=no)
204 AC_MSG_RESULT($selinux_support)
206 # Allow disabling of zip support.
207 # This is in general not a good idea because according to rfc4880 OpenPGP
208 # implementations SHOULD support ZLIB.
209 AC_MSG_CHECKING([whether to enable the ZIP and ZLIB compression algorithm])
211 AC_HELP_STRING([--disable-zip],
212 [disable the ZIP and ZLIB compression algorithm]),
214 AC_MSG_RESULT($use_zip)
216 # Allow disabling of bzib2 support.
217 # It is defined only after we confirm the library is available later
218 AC_MSG_CHECKING([whether to enable the BZIP2 compression algorithm])
220 AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
221 use_bzip2=$enableval)
222 AC_MSG_RESULT($use_bzip2)
224 # Configure option to allow or disallow execution of external
225 # programs, like a photo viewer.
226 AC_MSG_CHECKING([whether to enable external program execution])
228 AC_HELP_STRING([--disable-exec],[disable all external program execution]),
230 AC_MSG_RESULT($use_exec)
231 if test "$use_exec" = no ; then
232 AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
235 if test "$use_exec" = yes ; then
236 AC_MSG_CHECKING([whether to enable photo ID viewing])
237 AC_ARG_ENABLE(photo-viewers,
238 [ --disable-photo-viewers disable photo ID viewers],
239 [if test "$enableval" = no ; then
240 AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
242 gnupg_cv_enable_photo_viewers=$enableval
243 AC_MSG_RESULT($enableval)
245 if test "$gnupg_cv_enable_photo_viewers" = yes ; then
246 AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
247 AC_ARG_WITH(photo-viewer,
248 [ --with-photo-viewer=FIXED_VIEWER set a fixed photo ID viewer],
249 [if test "$withval" = yes ; then
251 elif test "$withval" != no ; then
252 AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
253 [if set, restrict photo-viewer to this])
255 AC_MSG_RESULT($withval)
258 AC_MSG_CHECKING([whether to enable external keyserver helpers])
259 AC_ARG_ENABLE(keyserver-helpers,
260 [ --disable-keyserver-helpers disable all external keyserver support],
261 [if test "$enableval" = no ; then
262 AC_DEFINE(DISABLE_KEYSERVER_HELPERS,1,
263 [define to disable keyserver helpers])
265 gnupg_cv_enable_keyserver_helpers=$enableval
266 AC_MSG_RESULT($enableval)
268 if test "$gnupg_cv_enable_keyserver_helpers" = yes ; then
269 # LDAP is defined only after we confirm the library is available later
270 AC_MSG_CHECKING([whether LDAP keyserver support is requested])
272 AC_HELP_STRING([--disable-ldap],[disable LDAP keyserver interface only]),
273 try_ks_ldap=$enableval, try_ks_ldap=yes)
274 AC_MSG_RESULT($try_ks_ldap)
276 AC_MSG_CHECKING([whether HKP keyserver support is requested])
278 AC_HELP_STRING([--disable-hkp],[disable HKP keyserver interface only]),
279 try_hkp=$enableval, try_hkp=yes)
280 AC_MSG_RESULT($try_hkp)
282 AC_MSG_CHECKING([whether finger key fetching support is requested])
283 AC_ARG_ENABLE(finger,
284 AC_HELP_STRING([--disable-finger],
285 [disable finger key fetching interface only]),
286 try_finger=$enableval, try_finger=yes)
287 AC_MSG_RESULT($try_finger)
289 AC_MSG_CHECKING([whether generic object key fetching support is requested])
290 AC_ARG_ENABLE(generic,
291 AC_HELP_STRING([--disable-generic],
292 [disable generic object key fetching interface only]),
293 try_generic=$enableval, try_generic=yes)
294 AC_MSG_RESULT($try_generic)
296 AC_MSG_CHECKING([whether email keyserver support is requested])
297 AC_ARG_ENABLE(mailto,
298 AC_HELP_STRING([--enable-mailto],
299 [enable email keyserver interface only]),
300 try_mailto=$enableval, try_mailto=no)
301 AC_MSG_RESULT($try_mailto)
304 AC_MSG_CHECKING([whether keyserver exec-path is enabled])
305 AC_ARG_ENABLE(keyserver-path,
306 AC_HELP_STRING([--disable-keyserver-path],
307 [disable the exec-path option for keyserver helpers]),
308 [if test "$enableval" = no ; then
309 disable_keyserver_path=yes
311 AC_MSG_RESULT($enableval)
316 # Check for the key/uid cache size. This can't be zero, but can be
317 # pretty small on embedded systems. This is used for the gpg part.
319 AC_MSG_CHECKING([for the size of the key and uid cache])
320 AC_ARG_ENABLE(key-cache,
321 AC_HELP_STRING([--enable-key-cache=SIZE],
322 [Set key cache to SIZE (default 4096)]),,enableval=4096)
323 if test "$enableval" = "no"; then
325 elif test "$enableval" = "yes" || test "$enableval" = ""; then
329 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
331 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
332 AC_MSG_ERROR([invalid key-cache size])
334 AC_MSG_RESULT($key_cache_size)
335 AC_DEFINE_UNQUOTED(PK_UID_CACHE_SIZE,$key_cache_size,
336 [Size of the key and UID caches])
341 # Check whether we want to use Linux capabilities
343 AC_MSG_CHECKING([whether use of capabilities is requested])
344 AC_ARG_WITH(capabilities,
345 [ --with-capabilities use linux capabilities [default=no]],
346 [use_capabilities="$withval"],[use_capabilities=no])
347 AC_MSG_RESULT($use_capabilities)
351 # Allow disabling of internal CCID support.
352 # It is defined only after we confirm the library is available later
354 AC_MSG_CHECKING([whether to enable the internal CCID driver])
355 AC_ARG_ENABLE(ccid-driver,
356 AC_HELP_STRING([--disable-ccid-driver],
357 [disable the internal CCID driver]),
358 use_ccid_driver=$enableval)
359 AC_MSG_RESULT($use_ccid_driver)
362 # Dirmngr is nowadays a system service and thus it usually does no
363 # make sense to start it as needed. However on some systems this is
364 # possible; this option enable the feature.
366 AC_MSG_CHECKING([whether to auto start dirmngr])
367 AC_ARG_ENABLE(dirmngr-auto-start,
368 AC_HELP_STRING([--enable-dirmngr-auto-start],
369 [enable auto starting of the dirmngr]),
370 dirmngr_auto_start=$enableval)
371 AC_MSG_RESULT($dirmngr_auto_start)
372 if test "$dirmngr_auto_start" = yes ; then
373 AC_DEFINE(USE_DIRMNGR_AUTO_START,1,
374 [Define to enable auto starting of the dirmngr])
379 # To avoid double inclusion of config.h which might happen at some
380 # places, we add the usual double inclusion protection at the top of
384 #ifndef GNUPG_CONFIG_H_INCLUDED
385 #define GNUPG_CONFIG_H_INCLUDED
389 # Stuff which goes at the bottom of config.h.
392 /* This is the major version number of GnuPG so that
393 source included files can test for this. Note, that
394 we use 2 here even for GnuPG 1.9.x. */
395 #define GNUPG_MAJOR_VERSION 2
397 /* Now to separate file name parts.
398 Please note that the string version must not contain more
399 than one character because the code assumes strlen()==1 */
400 #ifdef HAVE_DOSISH_SYSTEM
401 #define DIRSEP_C '\\'
402 #define DIRSEP_S "\\"
405 #define PATHSEP_C ';'
406 #define PATHSEP_S ";"
407 #define EXEEXT_S ".exe"
413 #define PATHSEP_C ':'
414 #define PATHSEP_S ":"
418 /* This is the same as VERSION, but should be overridden if the
419 platform cannot handle things like dots '.' in filenames. Set
420 SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
421 uses for dots and dashes. */
422 #define SAFE_VERSION VERSION
423 #define SAFE_VERSION_DOT '.'
424 #define SAFE_VERSION_DASH '-'
426 /* Some global constants. */
427 #ifdef HAVE_DOSISH_SYSTEM
428 # ifdef HAVE_DRIVE_LETTERS
429 # define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
431 # define GNUPG_DEFAULT_HOMEDIR "/gnupg"
434 #define GNUPG_DEFAULT_HOMEDIR "/SYS$LOGIN/gnupg"
436 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
438 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
440 /* For some systems (DOS currently), we hardcode the path here. For
441 POSIX systems the values are constructed by the Makefiles, so that
442 the values may be overridden by the make invocations; this is to
443 comply with the GNU coding standards. Note that these values are
445 #ifdef HAVE_DOSISH_SYSTEM
446 # ifdef HAVE_DRIVE_LETTERS
447 # define GNUPG_BINDIR "c:\\gnupg"
448 # define GNUPG_LIBEXECDIR "c:\\gnupg"
449 # define GNUPG_LIBDIR "c:\\gnupg"
450 # define GNUPG_DATADIR "c:\\gnupg"
451 # define GNUPG_SYSCONFDIR "c:\\gnupg"
453 # define GNUPG_BINDIR "\\gnupg"
454 # define GNUPG_LIBEXECDIR "\\gnupg"
455 # define GNUPG_LIBDIR "\\gnupg"
456 # define GNUPG_DATADIR "\\gnupg"
457 # define GNUPG_SYSCONFDIR "\\gnupg"
461 /* Derive some other constants. */
462 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
463 #define EXEC_TEMPFILE_ONLY
467 /* We didn't define endianness above, so get it from OS macros. This
468 is intended for making fat binary builds on OS X. */
469 #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST)
470 #if defined(__BIG_ENDIAN__)
471 #define BIG_ENDIAN_HOST 1
472 #elif defined(__LITTLE_ENDIAN__)
473 #define LITTLE_ENDIAN_HOST 1
475 #error "No endianness found"
480 /* Hack used for W32: ldap.m4 also tests for the ASCII version of
481 ldap_start_tls_s because that is the actual symbol used in the
482 library. winldap.h redefines it to our commonly used value,
483 thus we define our usual macro here. */
484 #ifdef HAVE_LDAP_START_TLS_SA
485 # ifndef HAVE_LDAP_START_TLS_S
486 # define HAVE_LDAP_START_TLS_S 1
491 /* Tell libgcrypt not to use its own libgpg-error implementation. */
492 #define USE_LIBGPG_ERROR 1
494 /* We use jnlib, so tell other modules about it. */
495 #define HAVE_JNLIB_LOGGING 1
497 /* Our HTTP code is used in estream mode. */
498 #define HTTP_USE_ESTREAM 1
500 /* Under W32 we do an explicit socket initialization, thus we need to
501 avoid the on-demand initialization which would also install an atexit
503 #define HTTP_NO_WSASTARTUP
505 /* We always include support for the OpenPGP card. */
506 #define ENABLE_CARD_SUPPORT 1
508 /* We explicitly need to disable PTH's soft mapping as Debian
509 currently enables it by default for no reason. */
510 #define PTH_SYSCALL_SOFT 0
512 /* We want to use the libgcrypt provided memory allocation for
514 #define _ESTREAM_PRINTF_MALLOC gcry_malloc
515 #define _ESTREAM_PRINTF_FREE gcry_free
516 #define _ESTREAM_PRINTF_EXTRA_INCLUDE "../common/util.h"
518 /* Under Windows we use the gettext code from libgpg-error. */
519 #define GPG_ERR_ENABLE_GETTEXT_MACROS
521 /* Under WindowsCE we use the strerror replacement from libgpg-error. */
522 #define GPG_ERR_ENABLE_ERRNO_MACROS
524 #endif /*GNUPG_CONFIG_H_INCLUDED*/
530 # Checks for programs.
531 AC_MSG_NOTICE([checking for programs])
534 missing_dir=`cd $ac_aux_dir && pwd`
535 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
536 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
537 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
538 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
539 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
544 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
545 AC_MSG_ERROR([[No C-89 compiler found]])
550 AC_CHECK_TOOL(AR, ar, :)
551 AC_PATH_PROG(PERL,"perl")
552 AC_CHECK_TOOL(WINDRES, windres, :)
558 # We need to compile and run a program on the build machine. A
559 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
560 # the AC archive is broken for autoconf 2.57. Given that there is no
561 # newer version of that macro, we assume that it is also broken for
562 # autoconf 2.61 and thus we use a simple but usually sufficient
564 AC_MSG_CHECKING(for cc for build)
565 if test "$cross_compiling" = "yes"; then
566 CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
568 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
570 AC_MSG_RESULT($CC_FOR_BUILD)
571 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
576 have_dosish_system=no
579 use_simple_gettext=no
584 # special stuff for Windoze NT
585 ac_cv_have_dev_random=no
586 AC_DEFINE(USE_ONLY_8DOT3,1,
587 [Set this to limit filenames to the 8.3 format])
588 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
589 [Because the Unix gettext has too much overhead on
590 MingW32 systems and these systems lack Posix functions,
591 we use a simplified version of gettext])
592 disable_keyserver_path=yes
593 have_dosish_system=yes
595 use_ldapwrapper=no # Fixme: Do this only for CE.
598 have_w32ce_system=yes
601 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
602 [Defined if the OS supports drive letters.])
606 use_simple_gettext=yes
609 i?86-emx-os2 | i?86-*-os2*emx )
610 # OS/2 with the EMX environment
611 ac_cv_have_dev_random=no
612 AC_DEFINE(HAVE_DRIVE_LETTERS)
613 have_dosish_system=yes
618 # DOS with the DJGPP environment
619 ac_cv_have_dev_random=no
620 AC_DEFINE(HAVE_DRIVE_LETTERS)
621 have_dosish_system=yes
627 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
628 LDFLAGS="$LDFLAGS -L/usr/local/lib"
632 if test -z "$GCC" ; then
633 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
637 if test -z "$GCC" ; then
638 # Suppress all warnings
639 # to get rid of the unsigned/signed char mismatch warnings.
644 if test -z "$GCC" ; then
645 # Use the newer compiler `-msg_disable ptrmismatch1' to
646 # get rid of the unsigned/signed char mismatch warnings.
647 # Using this may hide other pointer mismatch warnings, but
648 # it at least lets other warning classes through
649 CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
658 if test "$have_dosish_system" = yes; then
659 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
660 [Defined if we run on some of the PCDOS like systems
661 (DOS, Windoze. OS/2) with special properties like
662 no file modes, case insensitive file names and preferred
663 use of backslashes as directory name separators.])
665 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
667 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
669 if test "$have_w32_system" = yes; then
670 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
671 if test "$have_w32ce_system" = yes; then
672 AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
675 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
676 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
678 if test "$use_ldapwrapper" = yes; then
679 AC_DEFINE(USE_LDAPWRAPPER,1, [Build dirmngr with LDAP wrapper process])
681 AM_CONDITIONAL(USE_LDAPWRAPPER, test "$use_ldapwrapper" = yes)
683 if test "$disable_keyserver_path" = yes; then
684 AC_DEFINE(DISABLE_KEYSERVER_PATH,1,
685 [Defined to disable exec-path for keyserver helpers])
689 # Allows enabling the use of a standard socket by default This is
690 # gpg-agent's option --[no-]use-standard-socket. For Windows we force
693 AC_MSG_CHECKING([whether to use a standard socket by default])
694 AC_ARG_ENABLE(standard-socket,
695 AC_HELP_STRING([--disable-standard-socket],
696 [don't use a standard socket by default]),
697 use_standard_socket=$enableval)
699 if test "$use_standard_socket" != yes; then
700 if test "$have_w32_system" = yes; then
701 use_standard_socket=yes
705 AC_MSG_RESULT($use_standard_socket$tmp)
706 if test "$use_standard_socket" = yes; then
707 AC_DEFINE(USE_STANDARD_SOCKET,1,
708 [Use the standard socket for the agent by default])
712 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
713 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
715 if test x"$try_hkp" = xyes ; then
716 AC_SUBST(GPGKEYS_HKP,"gpg2keys_hkp$EXEEXT")
719 if test x"$try_finger" = xyes ; then
720 AC_SUBST(GPGKEYS_FINGER,"gpg2keys_finger$EXEEXT")
726 # Checks for libraries.
728 AC_MSG_NOTICE([checking for libraries])
732 # libgpg-error is a library with error codes shared between GnuPG
735 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
736 have_gpg_error=yes,have_gpg_error=no)
740 # Libgcrypt is our generic crypto library
742 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
743 have_libgcrypt=yes,have_libgcrypt=no)
745 # fixme: We can remove the next two checks if we require libgcrypt 1.5.
746 AC_CACHE_CHECK([whether Libgcrypt support ECDH], gnupg_cv_gcry_pk_ecdh,
747 [ _gnupg_gcry_save_cflags=$CFLAGS
748 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
750 [#include <gcrypt.h>],
751 [ return GCRY_PK_ECDH; ],
752 gnupg_cv_gcry_pk_ecdh=yes,
753 gnupg_cv_gcry_pk_ecdh=no)
754 CFLAGS=$_gnupg_gcry_save_cflags])
755 if test "$gnupg_cv_gcry_pk_ecdh" = yes; then
756 AC_DEFINE([HAVE_GCRY_PK_ECDH], 1,
757 [Define if gcrypt.h has the enum value for ECDH.])
760 AC_CACHE_CHECK([whether Libgcrypt has gcry_pk_get_curve],
761 gnupg_cv_gcry_pk_get_curve,
762 [ _gnupg_gcry_save_cflags=$CFLAGS
763 _gnupg_gcry_save_libs=$LIBS
764 CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS"
765 LIBS="$LIBS $LIBGCRYPT_LIBS"
767 [#include <gcrypt.h>],
768 [ return gcry_pk_get_curve (NULL, 0, NULL); ],
769 gnupg_cv_gcry_pk_get_curve=yes,
770 gnupg_cv_gcry_pk_get_curve=no)
771 LIBS=$_gnupg_gcry_save_libs
772 CFLAGS=$_gnupg_gcry_save_cflags])
773 if test "$gnupg_cv_gcry_pk_get_curve" = yes; then
774 AC_DEFINE([HAVE_GCRY_PK_GET_CURVE], 1,
775 [Define if gcrypt.h has gcry_pk_get_curve.])
780 # libassuan is used for IPC
782 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
783 have_libassuan=yes,have_libassuan=no)
784 if test "$have_libassuan" = "yes"; then
785 AC_DEFINE_UNQUOTED(GNUPG_LIBASSUAN_VERSION, "$libassuan_version",
786 [version of the libassuan library])
792 # libksba is our X.509 support library
794 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
798 # libusb allows us to use the integrated CCID smartcard reader driver.
800 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
801 if test "$use_ccid_driver" = yes ; then
802 AC_CHECK_LIB(usb, usb_bulk_write,
803 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
804 AC_DEFINE(HAVE_LIBUSB,1,
805 [defined if libusb is available])
808 AC_CHECK_FUNCS(usb_create_match)
810 AC_SUBST(LIBUSB_LIBS)
813 # Check wether it is necessary to link against libdl.
815 gnupg_dlopen_save_libs="$LIBS"
817 AC_SEARCH_LIBS(dlopen, c dl,,,)
820 LIBS="$gnupg_dlopen_save_libs"
824 AC_PATH_PROG(ENCFS, encfs, /usr/bin/encfs)
825 AC_DEFINE_UNQUOTED(ENCFS,
826 "${ENCFS}", [defines the filename of the encfs program])
828 AC_PATH_PROG(FUSERMOUNT, fusermount, /usr/bin/fusermount)
829 AC_DEFINE_UNQUOTED(FUSERMOUNT,
830 "${FUSERMOUNT}", [defines the filename of the fusermount program])
837 # Checks for symcryptrun:
840 # libutil has openpty() and login_tty().
841 AC_CHECK_LIB(util, openpty,
842 [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
843 AC_DEFINE(HAVE_LIBUTIL,1,
844 [defined if libutil is available])
846 AC_SUBST(LIBUTIL_LIBS)
848 # shred is used to clean temporary plain text files.
849 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
850 AC_DEFINE_UNQUOTED(SHRED,
851 "${SHRED}", [defines the filename of the shred program])
855 # Check whether the GNU Pth library is available
856 # Note, that we include a Pth emulation for W32.
858 if test "$have_w32_system" = yes; then
859 GNUPG_PATH_PTH([2.0.4])
863 if test "$have_pth" = "yes"; then
864 AC_DEFINE(USE_GNU_PTH, 1,
865 [Defined if the GNU Portable Thread Library should be used])
869 *** To support concurrent access to the gpg-agent and the SCdaemon
870 *** we need the support of the GNU Portable Threads Library.
871 *** Download it from ftp://ftp.gnu.org/gnu/pth/
872 *** On a Debian GNU/Linux system you might want to try
873 *** apt-get install libpth-dev
878 AC_MSG_NOTICE([checking for networking options])
881 # Must check for network library requirements before doing link tests
882 # for ldap, for example. If ldap libs are static (or dynamic and without
883 # ELF runtime link paths), then link will fail and LDAP support won't
886 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
887 [NETLIBS="-lnsl $NETLIBS"]))
888 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
889 [NETLIBS="-lsocket $NETLIBS"]))
895 _cppflags="${CPPFLAGS}"
896 _ldflags="${LDFLAGS}"
898 AC_HELP_STRING([--with-adns=DIR],
899 [look for the adns library in DIR]),
900 [if test -d "$withval"; then
901 CPPFLAGS="${CPPFLAGS} -I$withval/include"
902 LDFLAGS="${LDFLAGS} -L$withval/lib"
904 if test "$with_adns" != "no"; then
905 AC_CHECK_HEADERS(adns.h,
906 AC_CHECK_LIB(adns, adns_init,
908 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}]),
909 [CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}])
911 if test "$have_adns" = "yes"; then
915 # Newer adns versions feature a free function to be used under W32.
916 AC_CHECK_FUNCS(adns_free)
921 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
923 if test x"$try_hkp" = xyes || test x"$try_http" = xyes ; then
924 AC_ARG_ENABLE(dns-srv,
925 AC_HELP_STRING([--disable-dns-srv],
926 [disable the use of DNS SRV in HKP and HTTP]),
927 use_dns_srv=$enableval,use_dns_srv=yes)
930 AC_ARG_ENABLE(dns-pka,
931 AC_HELP_STRING([--disable-dns-pka],
932 [disable the use of PKA records in DNS]),
933 use_dns_pka=$enableval,use_dns_pka=yes)
935 AC_ARG_ENABLE(dns-cert,
936 AC_HELP_STRING([--disable-dns-cert],
937 [disable the use of CERT records in DNS]),
938 use_dns_cert=$enableval,use_dns_cert=yes)
940 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
941 || test x"$use_dns_cert" = xyes; then
944 # the double underscore thing is a glibc-ism?
945 AC_SEARCH_LIBS(res_query,resolv bind,,
946 AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
947 AC_SEARCH_LIBS(dn_expand,resolv bind,,
948 AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
949 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
950 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
952 if test x"$have_resolver" != xno ; then
954 # Make sure that the BIND 4 resolver interface is workable before
955 # enabling any code that calls it. At some point I'll rewrite the
956 # code to use the BIND 8 resolver API.
957 # We might also want to use adns instead. Problem with ADNS is that
958 # it does not support v6.
960 AC_MSG_CHECKING([whether the resolver is usable])
961 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
962 #include <netinet/in.h>
963 #include <arpa/nameser.h>
964 #include <resolv.h>],
965 [[unsigned char answer[PACKETSZ];
966 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
968 dn_expand(0,0,0,0,0);
969 ]])],have_resolver=yes,have_resolver=no)
970 AC_MSG_RESULT($have_resolver)
972 # This is Apple-specific and somewhat bizarre as they changed the
973 # define in bind 8 for some reason.
975 if test x"$have_resolver" != xyes ; then
977 [whether I can make the resolver usable with BIND_8_COMPAT])
978 AC_LINK_IFELSE([AC_LANG_PROGRAM([#define BIND_8_COMPAT
979 #include <sys/types.h>
980 #include <netinet/in.h>
981 #include <arpa/nameser.h>
982 #include <resolv.h>],
983 [[unsigned char answer[PACKETSZ];
984 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
985 dn_skipname(0,0); dn_expand(0,0,0,0,0);
986 ]])],[have_resolver=yes ; need_compat=yes])
987 AC_MSG_RESULT($have_resolver)
991 if test x"$have_resolver" = xyes ; then
994 if test x"$use_dns_srv" = xyes ; then
995 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
998 if test x"$use_dns_pka" = xyes ; then
999 AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
1002 if test x"$use_dns_cert" = xyes ; then
1003 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1006 if test x"$need_compat" = xyes ; then
1007 AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
1010 # If we have no resolver library but ADNS (e.g. under W32) enable the
1011 # code parts which can be used with ADNS.
1012 if test x"$have_adns" = xyes ; then
1014 AC_DEFINE(USE_ADNS,1,[Use ADNS as resolver library.])
1016 if test x"$use_dns_srv" = xyes ; then
1017 AC_DEFINE(USE_DNS_SRV,1)
1020 if test x"$use_dns_pka" = xyes ; then
1021 AC_DEFINE(USE_DNS_PKA,1)
1024 if test x"$use_dns_cert" = xyes ; then
1025 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
1034 LIBS=$_dns_save_libs
1039 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
1045 if test "$try_ks_ldap" = yes || test "$build_dirmngr" = "yes" ; then
1046 GNUPG_CHECK_LDAP($NETLIBS)
1050 # Check for curl. We fake the curl API if libcurl isn't installed.
1051 # We require 7.10 or later as we use curl_version_info().
1053 LIBCURL_CHECK_CONFIG([yes],[7.10],,[fake_curl=yes])
1054 AM_CONDITIONAL(FAKE_CURL,test x"$fake_curl" = xyes)
1056 # Generic, for us, means curl
1058 if test x"$try_generic" = xyes ; then
1059 AC_SUBST(GPGKEYS_CURL,"gpg2keys_curl$EXEEXT")
1063 # Check for sendmail
1065 # This isn't necessarily sendmail itself, but anything that gives a
1066 # sendmail-ish interface to the outside world. That includes Exim,
1067 # Postfix, etc. Basically, anything that can handle "sendmail -t".
1068 if test "$try_mailto" = yes ; then
1069 AC_ARG_WITH(mailprog,
1070 AC_HELP_STRING([--with-mailprog=NAME],
1071 [use "NAME -t" for mail transport]),
1074 if test x"$with_mailprog" = xyes ; then
1075 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
1076 if test "$ac_cv_path_SENDMAIL" ; then
1077 GPGKEYS_MAILTO="gpg2keys_mailto"
1079 elif test x"$with_mailprog" != xno ; then
1080 AC_MSG_CHECKING([for a mail transport program])
1081 AC_SUBST(SENDMAIL,$with_mailprog)
1082 AC_MSG_RESULT($with_mailprog)
1083 GPGKEYS_MAILTO="gpg2keys_mailto"
1087 AC_SUBST(GPGKEYS_MAILTO)
1090 # Construct a printable name of the OS
1094 PRINTABLE_OS_NAME="W32CE"
1097 PRINTABLE_OS_NAME="MingW32"
1100 PRINTABLE_OS_NAME="Cygwin"
1102 i?86-emx-os2 | i?86-*-os2*emx )
1103 PRINTABLE_OS_NAME="OS/2"
1106 PRINTABLE_OS_NAME="MSDOS/DJGPP"
1110 PRINTABLE_OS_NAME="GNU/Linux"
1113 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
1116 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
1117 [A human readable text with the name of the OS])
1121 # Checking for iconv
1129 # This is "GNU gnupg" - The project-id script from gettext
1132 AC_MSG_NOTICE([checking for gettext])
1134 AM_GNU_GETTEXT_VERSION([0.17])
1135 if test "$try_gettext" = yes; then
1136 AM_GNU_GETTEXT([external],[need-ngettext])
1138 # gettext requires some extra checks. These really should be part of
1139 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
1140 # function checks to here.
1142 AC_CHECK_FUNCS(strchr)
1145 USE_INCLUDED_LIBINTL=no
1146 BUILD_INCLUDED_LIBINTL=no
1149 AC_SUBST(USE_INCLUDED_LIBINTL)
1150 AC_SUBST(BUILD_INCLUDED_LIBINTL)
1154 # We use HAVE_LANGINFO_CODESET in a couple of places.
1157 # Checks required for our use locales
1164 if test "$selinux_support" = yes ; then
1165 AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
1170 # Checks for header files.
1172 AC_MSG_NOTICE([checking for header files])
1174 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h \
1175 pty.h pwd.h inttypes.h signal.h])
1180 # Checks for typedefs, structures, and compiler characteristics.
1182 AC_MSG_NOTICE([checking for system characteristics])
1191 gl_HEADER_SYS_SOCKET
1194 AC_ARG_ENABLE(endian-check,
1195 AC_HELP_STRING([--disable-endian-check],
1196 [disable the endian check and trust the OS provided macros]),
1197 endiancheck=$enableval,endiancheck=yes)
1199 if test x"$endiancheck" = xyes ; then
1203 # fixme: we should get rid of the byte type
1204 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
1205 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
1206 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
1207 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
1208 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
1210 AC_CHECK_SIZEOF(unsigned short)
1211 AC_CHECK_SIZEOF(unsigned int)
1212 AC_CHECK_SIZEOF(unsigned long)
1213 AC_CHECK_SIZEOF(unsigned long long)
1215 AC_CHECK_SIZEOF(time_t,,[[
1217 #if TIME_WITH_SYS_TIME
1218 # include <sys/time.h>
1221 # if HAVE_SYS_TIME_H
1222 # include <sys/time.h>
1228 GNUPG_TIME_T_UNSIGNED
1231 # Ensure that we have UINT64_C before we bother to check for uint64_t
1232 # Fixme: really needed in gnupg? I think it is only useful in libcgrypt.
1233 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
1234 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <inttypes.h>
1235 uint64_t foo=UINT64_C(42);]),
1236 gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
1237 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
1238 AC_CHECK_SIZEOF(uint64_t)
1241 if test "$ac_cv_sizeof_unsigned_short" = "0" \
1242 || test "$ac_cv_sizeof_unsigned_int" = "0" \
1243 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
1244 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
1249 # Checks for library functions.
1251 AC_MSG_NOTICE([checking for library functions])
1252 AC_CHECK_DECLS(getpagesize)
1256 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap canonicalize_file_name])
1257 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r strtoull])
1258 AC_CHECK_FUNCS([unsetenv fcntl ftruncate canonicalize_file_name])
1259 AC_CHECK_FUNCS([gettimeofday getrusage getrlimit setrlimit clock_gettime])
1260 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
1261 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe getaddrinfo])
1262 AC_CHECK_FUNCS([ttyname rand ftello fsync stat lstat])
1264 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
1266 # Dirmngr requires mmap on Unix systems.
1267 if test $ac_cv_func_mmap != yes -a $mmap_needed = yes; then
1268 AC_MSG_ERROR([[Sorry, the current implemenation requires mmap.]])
1272 # These are needed by the jnlib parts in common.
1273 # Note: We already checked pwd.h.
1274 AC_CHECK_HEADERS([signal.h])
1275 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol \
1276 memrchr isascii timegm getrusage setrlimit stat setlocale \
1277 flockfile funlockfile fopencookie funopen getpwnam getpwuid \
1286 gl_SOURCE_BASE([gl])
1288 gl_MODULES([setenv mkdtemp xsize strpbrk])
1295 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1298 # Sanity check regex. Tests adapted from mutt.
1300 AC_MSG_CHECKING([whether regular expression support is requested])
1301 AC_ARG_ENABLE(regex,
1302 AC_HELP_STRING([--disable-regex],
1303 [do not handle regular expressions in trust signatures]),
1304 use_regex=$enableval, use_regex=yes)
1305 AC_MSG_RESULT($use_regex)
1307 if test "$use_regex" = yes ; then
1308 _cppflags="${CPPFLAGS}"
1309 _ldflags="${LDFLAGS}"
1311 AC_HELP_STRING([--with-regex=DIR],[look for regex in DIR]),
1313 if test -d "$withval" ; then
1314 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1315 LDFLAGS="${LDFLAGS} -L$withval/lib"
1319 # Does the system have regex functions at all?
1320 AC_SEARCH_LIBS([regcomp], [regex])
1321 AC_CHECK_FUNC(regcomp, gnupg_cv_have_regex=yes, gnupg_cv_have_regex=no)
1323 if test $gnupg_cv_have_regex = no; then
1326 if test x"$cross_compiling" = xyes; then
1327 AC_MSG_WARN([cross compiling; assuming regexp libray is not broken])
1329 AC_CACHE_CHECK([whether your system's regexp library is broken],
1330 [gnupg_cv_regex_broken],
1334 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); }],
1335 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1337 if test $gnupg_cv_regex_broken = yes; then
1338 AC_MSG_WARN([your regex is broken - disabling regex use])
1343 CPPFLAGS="${_cppflags}"
1344 LDFLAGS="${_ldflags}"
1347 if test "$use_regex" != yes ; then
1348 AC_DEFINE(DISABLE_REGEX,1, [Define to disable regular expression support])
1350 AM_CONDITIONAL(DISABLE_REGEX, test x"$use_regex" != xyes)
1355 # Do we have zlib? Must do it here because Solaris failed
1356 # when compiling a conftest (due to the "-lz" from LIBS).
1357 # Note that we combine zlib and bzlib2 in ZLIBS.
1359 if test "$use_zip" = yes ; then
1360 _cppflags="${CPPFLAGS}"
1361 _ldflags="${LDFLAGS}"
1363 [ --with-zlib=DIR use libz in DIR],[
1364 if test -d "$withval"; then
1365 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1366 LDFLAGS="${LDFLAGS} -L$withval/lib"
1370 AC_CHECK_HEADER(zlib.h,
1371 AC_CHECK_LIB(z, deflateInit2_,
1373 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1374 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1376 AC_DEFINE(HAVE_ZIP,1, [Defined if ZIP and ZLIB are supported])
1381 # Check whether we can support bzip2
1383 if test "$use_bzip2" = yes ; then
1384 _cppflags="${CPPFLAGS}"
1385 _ldflags="${LDFLAGS}"
1387 AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1389 if test -d "$withval" ; then
1390 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1391 LDFLAGS="${LDFLAGS} -L$withval/lib"
1395 # Checking alongside stdio.h as an early version of bzip2 (1.0)
1396 # required stdio.h to be included before bzlib.h, and Solaris 9 is
1397 # woefully out of date.
1398 if test "$withval" != no ; then
1399 AC_CHECK_HEADER(bzlib.h,
1400 AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1403 ZLIBS="$ZLIBS -lbz2"
1404 AC_DEFINE(HAVE_BZIP2,1,
1405 [Defined if the bz2 compression library is available])
1407 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1408 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1411 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1415 # Check for readline support
1416 GNUPG_CHECK_READLINE
1419 # Allow users to append something to the version string without
1420 # flagging it as development version. The user version parts is
1421 # considered everything after a dash.
1423 if test "$development_version" != yes; then
1427 if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
1428 development_version=yes
1431 if test "$development_version" = yes; then
1432 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1433 [Defined if this is not a regular release])
1436 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1440 # Add some extra libs here so that previous tests don't fail for
1441 # mysterious reasons - the final link step should bail out.
1442 # W32SOCKLIBS is also defined so that if can be used for tools not
1443 # requiring any network stuff but linking to code in libcommon which
1444 # tracks in winsock stuff (e.g. init_common_subsystems).
1445 if test "$have_w32_system" = yes; then
1446 if test "$have_w32ce_system" = yes; then
1449 W32SOCKLIBS="-lws2_32"
1451 NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1455 AC_SUBST(W32SOCKLIBS)
1458 # Setup gcc specific options
1460 AC_MSG_NOTICE([checking for cc features])
1461 if test "$GCC" = yes; then
1462 # Note that it is okay to use CFLAGS here because this are just
1463 # warning options and the user should have a chance of overriding
1465 if test "$USE_MAINTAINER_MODE" = "yes"; then
1466 CFLAGS="$CFLAGS -O3 -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1467 CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1468 AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
1469 _gcc_cflags_save=$CFLAGS
1470 CFLAGS="-Wno-missing-field-initializers"
1471 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
1472 AC_MSG_RESULT($_gcc_wopt)
1473 CFLAGS=$_gcc_cflags_save;
1474 if test x"$_gcc_wopt" = xyes ; then
1475 CFLAGS="$CFLAGS -W -Wno-sign-compare -Wno-missing-field-initializers"
1477 AC_MSG_CHECKING([if gcc supports -Wdeclaration-after-statement])
1478 _gcc_cflags_save=$CFLAGS
1479 CFLAGS="-Wdeclaration-after-statement"
1480 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
1481 AC_MSG_RESULT($_gcc_wopt)
1482 CFLAGS=$_gcc_cflags_save;
1483 if test x"$_gcc_wopt" = xyes ; then
1484 CFLAGS="$CFLAGS -Wdeclaration-after-statement"
1487 CFLAGS="$CFLAGS -Wall"
1490 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1491 _gcc_cflags_save=$CFLAGS
1492 CFLAGS="-Wno-pointer-sign"
1493 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
1494 AC_MSG_RESULT($_gcc_psign)
1495 CFLAGS=$_gcc_cflags_save;
1496 if test x"$_gcc_psign" = xyes ; then
1497 CFLAGS="$CFLAGS -Wno-pointer-sign"
1500 AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1501 _gcc_cflags_save=$CFLAGS
1502 CFLAGS="-Wpointer-arith"
1503 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
1504 AC_MSG_RESULT($_gcc_psign)
1505 CFLAGS=$_gcc_cflags_save;
1506 if test x"$_gcc_psign" = xyes ; then
1507 CFLAGS="$CFLAGS -Wpointer-arith"
1513 # This is handy for debugging so the compiler doesn't rearrange
1514 # things and eliminate variables.
1516 AC_ARG_ENABLE(optimization,
1517 AC_HELP_STRING([--disable-optimization],
1518 [disable compiler optimization]),
1519 [if test $enableval = no ; then
1520 CFLAGS=`echo $CFLAGS | sed s/-O[[1-9]]\ /-O0\ /g`
1524 # Prepare building of estream
1530 # Decide what to build
1532 if test "$have_adns" = "yes"; then
1533 AC_SUBST(GPGKEYS_KDNS, "gpg2keys_kdns$EXEEXT")
1538 if test $have_ksba = no; then
1543 build_agent_threaded=""
1544 if test "$build_agent" = "yes"; then
1545 if test $have_pth = no; then
1546 build_agent_threaded="(not multi-threaded)"
1551 build_scdaemon_extra=""
1552 if test "$build_scdaemon" = "yes"; then
1554 if test $have_pth = no; then
1555 build_scdaemon_extra="not multi-threaded"
1559 if test $have_libusb = no; then
1560 build_scdaemon_extra="${tmp}without internal CCID driver"
1563 if test -n "$build_scdaemon_extra"; then
1564 build_scdaemon_extra="(${build_scdaemon_extra})"
1569 if test "$build_agent_only" = "yes" ; then
1578 # Set variables for use by th automake makefile.
1580 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
1581 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1582 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1583 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1584 AM_CONDITIONAL(BUILD_G13, test "$build_g13" = "yes")
1585 AM_CONDITIONAL(BUILD_DIRMNGR, test "$build_dirmngr" = "yes")
1586 AM_CONDITIONAL(BUILD_TOOLS, test "$build_tools" = "yes")
1587 AM_CONDITIONAL(BUILD_DOC, test "$build_doc" = "yes")
1588 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1589 AM_CONDITIONAL(BUILD_GPGTAR, test "$build_gpgtar" = "yes")
1591 AM_CONDITIONAL(RUN_GPG_TESTS,
1592 test x$cross_compiling = xno -a "$build_gpg" = yes )
1595 # Set some defines for use gpgconf.
1597 if test "$build_gpg" = yes ; then
1598 AC_DEFINE(BUILD_WITH_GPG,1,[Defined if GPG is to be build])
1600 if test "$build_gpgsm" = yes ; then
1601 AC_DEFINE(BUILD_WITH_GPGSM,1,[Defined if GPGSM is to be build])
1603 if test "$build_agent" = yes ; then
1604 AC_DEFINE(BUILD_WITH_AGENT,1,[Defined if GPG-AGENT is to be build])
1606 if test "$build_scdaemon" = yes ; then
1607 AC_DEFINE(BUILD_WITH_SCDAEMON,1,[Defined if SCDAEMON is to be build])
1609 if test "$build_dirmngr" = yes ; then
1610 AC_DEFINE(BUILD_WITH_DIRMNGR,1,[Defined if SCDAEMON is to be build])
1612 if test "$build_g13" = yes ; then
1613 AC_DEFINE(BUILD_WITH_G13,1,[Defined if G13 is to be build])
1619 # Print errors here so that they are visible all
1620 # together and the user can acquire them all together.
1623 if test "$have_gpg_error" = "no"; then
1627 *** You need libgpg-error to build this program.
1628 ** This library is for example available at
1629 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
1630 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1633 if test "$have_libgcrypt" = "no"; then
1637 *** You need libgcrypt to build this program.
1638 ** This library is for example available at
1639 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1640 *** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API is required.)
1643 if test "$have_libassuan" = "no"; then
1647 *** You need libassuan to build this program.
1648 *** This library is for example available at
1649 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
1650 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1653 if test "$have_ksba" = "no"; then
1656 *** You need libksba to build this program.
1657 *** This library is for example available at
1658 *** ftp://ftp.gnupg.org/gcrypt/libksba/
1659 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1662 if test "$gnupg_have_ldap" = "no"; then
1666 *** You need a LDAP library to build this program.
1668 *** http://www.openldap.org
1669 *** for a suitable implementation.
1671 if test "$have_w32ce_system" = yes; then
1673 *** Note that CeGCC might be broken, a package fixing this is:
1674 *** http://files.kolab.org/local/windows-ce/
1675 *** source/wldap32_0.1-mingw32ce.orig.tar.gz
1676 *** binary/wldap32-ce-arm-dev_0.1-1_all.deb
1680 if test "$missing_pth" = "yes"; then
1683 *** It is now required to build with support for the
1684 *** GNU Portable Threads Library (Pth). Please install this
1685 *** library first. The library is for example available at
1686 *** ftp://ftp.gnu.org/gnu/pth/
1687 *** On a Debian GNU/Linux system you can install it using
1688 *** apt-get install libpth-dev
1689 *** To build GnuPG for Windows you need to use the W32PTH
1690 *** package; available at:
1691 *** ftp://ftp.g10code.com/g10code/w32pth/
1696 if test "$die" = "yes"; then
1699 *** Required libraries not found. Please consult the above messages
1700 *** and install them before running configure again.
1706 AC_CONFIG_FILES([ m4/Makefile
1723 tests/openpgp/Makefile
1724 tests/pkits/Makefile
1727 #keyserver/gpg2keys_mailto
1728 #keyserver/gpg2keys_test
1735 GnuPG v${VERSION} has been configured as follows:
1737 Platform: $PRINTABLE_OS_NAME ($host)
1740 S/MIME: $build_gpgsm
1741 Agent: $build_agent $build_agent_threaded
1742 Smartcard: $build_scdaemon $build_scdaemon_extra
1744 Dirmngr: $build_dirmngr
1745 Gpgtar: $build_gpgtar
1747 Protect tool: $show_gnupg_protect_tool_pgm
1748 LDAP wrapper: $show_gnupg_dirmngr_ldap_pgm
1749 Default agent: $show_gnupg_agent_pgm
1750 Default pinentry: $show_gnupg_pinentry_pgm
1751 Default scdaemon: $show_gnupg_scdaemon_pgm
1752 Default dirmngr: $show_gnupg_dirmngr_pgm
1754 Use standard socket: $use_standard_socket
1755 Dirmngr auto start: $dirmngr_auto_start
1757 if test x"$use_regex" != xyes ; then
1759 Warning: No regular expression support available.
1760 OpenPGP trust signatures won't work.
1761 gpg-check-pattern will not be build.