1 # configure.ac - for GnuPG 1.9
2 # Copyright (C) 1998, 1999, 2000, 2001, 2002,
3 # 2003, 2004, 2005, 2006 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 2 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, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 # Process this file with autoconf to produce a configure script.
24 min_automake_version="1.9.3"
26 # Remember to change the version number immediately *after* a release.
27 # Set my_issvn to "yes" for non-released code. Remember to run an
28 # "svn up" and "autogen.sh" right before creating a distribution.
29 m4_define([my_version], [1.9.90])
30 m4_define([my_issvn], [yes])
33 m4_define([svn_revision], m4_esyscmd([echo -n $((svn info 2>/dev/null \
34 || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q}')]))
35 AC_INIT([gnupg], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]),
36 [bug-gnupg@gnupg.org])
37 # Set development_version to yes if the minor number is odd or you
38 # feel that the default check for a development version is not
40 development_version=yes
42 NEED_GPG_ERROR_VERSION=1.4
45 NEED_LIBGCRYPT_VERSION=1.1.94
47 NEED_LIBASSUAN_VERSION=0.9.0
50 NEED_KSBA_VERSION=1.0.0
54 PACKAGE_GT=${PACKAGE_NAME}2
55 VERSION=$PACKAGE_VERSION
57 AC_CONFIG_AUX_DIR(scripts)
58 AC_CONFIG_SRCDIR(sm/gpgsm.c)
59 AM_CONFIG_HEADER(config.h)
61 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
66 # Some status variables.
76 disable_keyserver_path=no
79 GNUPG_BUILD_PROGRAM(gpg, yes)
80 GNUPG_BUILD_PROGRAM(gpgsm, yes)
81 GNUPG_BUILD_PROGRAM(agent, yes)
82 GNUPG_BUILD_PROGRAM(scdaemon, yes)
83 GNUPG_BUILD_PROGRAM(tools, yes)
84 GNUPG_BUILD_PROGRAM(doc, yes)
85 GNUPG_BUILD_PROGRAM(symcryptrun, no)
90 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
91 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
92 [Name of this package for gettext])
93 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
94 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
96 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
97 [Required version of Libgcrypt])
98 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
99 [Required version of Libksba])
103 # The default is to use the modules from this package and the few
104 # other packages in a standard place; i.e where this package gets
105 # installed. With these options it is possible to override these
106 # ${prefix} depended values with fixed paths, which can't be replaced
107 # at make time. See also am/cmacros.am and the defaults in AH_BOTTOM.
108 AC_ARG_WITH(agent-pgm,
109 [ --with-agent-pgm=PATH Use PATH as the default for the agent)],
110 GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
111 AC_SUBST(GNUPG_AGENT_PGM)
112 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
113 show_gnupg_agent_pgm="(default)"
114 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
116 AC_ARG_WITH(pinentry-pgm,
117 [ --with-pinentry-pgm=PATH Use PATH as the default for the pinentry)],
118 GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
119 AC_SUBST(GNUPG_PINENTRY_PGM)
120 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
121 show_gnupg_pinentry_pgm="(default)"
122 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
125 AC_ARG_WITH(scdaemon-pgm,
126 [ --with-scdaemon-pgm=PATH Use PATH as the default for the scdaemon)],
127 GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
128 AC_SUBST(GNUPG_SCDAEMON_PGM)
129 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
130 show_gnupg_scdaemon_pgm="(default)"
131 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
134 AC_ARG_WITH(dirmngr-pgm,
135 [ --with-dirmngr-pgm=PATH Use PATH as the default for the dirmngr)],
136 GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
137 AC_SUBST(GNUPG_DIRMNGR_PGM)
138 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
139 show_gnupg_dirmngr_pgm="(default)"
140 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
142 AC_ARG_WITH(protect-tool-pgm,
143 [ --with-protect-tool-pgm=PATH Use PATH as the default for the protect-tool)],
144 GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
145 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
146 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
147 show_gnupg_protect_tool_pgm="(default)"
148 test -n "$GNUPG_PROTECT_TOOL_PGM" \
149 && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
152 # Some folks want to use only the agent from this packet. Make it
153 # easier for them by providing the configure option
154 # --enable-only-agent.
155 AC_ARG_ENABLE(agent-only,
156 AC_HELP_STRING([--enable-agent-only],[build only the gpg-agent]),
157 build_agent_only=$enableval)
159 # SELinux support includes tracking of sensitive files to avoid
160 # leaking their contents through processing these files by gpg itself
161 AC_MSG_CHECKING([whether SELinux support is requested])
162 AC_ARG_ENABLE(selinux-support,
163 AC_HELP_STRING([--enable-selinux-support],
164 [enable SELinux support]),
165 selinux_support=$enableval, selinux_support=no)
166 AC_MSG_RESULT($selinux_support)
168 # Allow disabling of bzib2 support.
169 # It is defined only after we confirm the library is available later
170 AC_MSG_CHECKING([whether to enable the BZIP2 compression algorithm])
172 AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
173 use_bzip2=$enableval)
174 AC_MSG_RESULT($use_bzip2)
177 # Configure option to allow or disallow execution of external
178 # programs, like a photo viewer.
179 AC_MSG_CHECKING([whether to enable external program execution])
181 AC_HELP_STRING([--disable-exec],[disable all external program execution]),
183 AC_MSG_RESULT($use_exec)
184 if test "$use_exec" = no ; then
185 AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
188 if test "$use_exec" = yes ; then
189 AC_MSG_CHECKING([whether to enable photo ID viewing])
190 AC_ARG_ENABLE(photo-viewers,
191 [ --disable-photo-viewers disable photo ID viewers],
192 [if test "$enableval" = no ; then
193 AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
195 gnupg_cv_enable_photo_viewers=$enableval
196 AC_MSG_RESULT($enableval)
198 if test "$gnupg_cv_enable_photo_viewers" = yes ; then
199 AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
200 AC_ARG_WITH(photo-viewer,
201 [ --with-photo-viewer=FIXED_VIEWER set a fixed photo ID viewer],
202 [if test "$withval" = yes ; then
204 elif test "$withval" != no ; then
205 AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
206 [if set, restrict photo-viewer to this])
208 AC_MSG_RESULT($withval)
211 AC_MSG_CHECKING([whether to enable external keyserver helpers])
212 AC_ARG_ENABLE(keyserver-helpers,
213 [ --disable-keyserver-helpers disable all external keyserver support],
214 [if test "$enableval" = no ; then
215 AC_DEFINE(DISABLE_KEYSERVER_HELPERS,1,
216 [define to disable keyserver helpers])
218 gnupg_cv_enable_keyserver_helpers=$enableval
219 AC_MSG_RESULT($enableval)
221 if test "$gnupg_cv_enable_keyserver_helpers" = yes ; then
222 # LDAP is defined only after we confirm the library is available later
223 AC_MSG_CHECKING([whether LDAP keyserver support is requested])
225 AC_HELP_STRING([--disable-ldap],[disable LDAP keyserver interface only]),
226 try_ldap=$enableval, try_ldap=yes)
227 AC_MSG_RESULT($try_ldap)
229 AC_MSG_CHECKING([whether HKP keyserver support is requested])
231 AC_HELP_STRING([--disable-hkp],[disable HKP keyserver interface only]),
232 try_hkp=$enableval, try_hkp=yes)
233 AC_MSG_RESULT($try_hkp)
235 AC_MSG_CHECKING([whether finger key fetching support is requested])
236 AC_ARG_ENABLE(finger,
237 AC_HELP_STRING([--disable-finger],
238 [disable finger key fetching interface only]),
239 try_finger=$enableval, try_finger=yes)
240 AC_MSG_RESULT($try_finger)
242 AC_MSG_CHECKING([whether generic object key fetching support is requested])
243 AC_ARG_ENABLE(generic,
244 AC_HELP_STRING([--disable-generic],
245 [disable generic object key fetching interface only]),
246 try_generic=$enableval, try_generic=yes)
247 AC_MSG_RESULT($try_generic)
249 AC_MSG_CHECKING([whether email keyserver support is requested])
250 AC_ARG_ENABLE(mailto,
251 AC_HELP_STRING([--enable-mailto],
252 [enable email keyserver interface only]),
253 try_mailto=$enableval, try_mailto=no)
254 AC_MSG_RESULT($try_mailto)
257 AC_MSG_CHECKING([whether keyserver exec-path is enabled])
258 AC_ARG_ENABLE(keyserver-path,
259 AC_HELP_STRING([--disable-keyserver-path],
260 [disable the exec-path option for keyserver helpers]),
261 [if test "$enableval" = no ; then
262 disable_keyserver_path=yes
264 AC_MSG_RESULT($enableval)
269 # Check for the key/uid cache size. This can't be zero, but can be
270 # pretty small on embedded systems. This is used for the gpg part.
272 AC_MSG_CHECKING([for the size of the key and uid cache])
273 AC_ARG_ENABLE(key-cache,
274 AC_HELP_STRING([--enable-key-cache=SIZE],
275 [Set key cache to SIZE (default 4096)]),,enableval=4096)
276 if test "$enableval" = "no"; then
278 elif test "$enableval" = "yes" || test "$enableval" = ""; then
282 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
284 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
285 AC_MSG_ERROR([invalid key-cache size])
287 AC_MSG_RESULT($key_cache_size)
288 AC_DEFINE_UNQUOTED(PK_UID_CACHE_SIZE,$key_cache_size,
289 [Size of the key and UID caches])
294 # Check whether we want to use Linux capabilities
296 AC_MSG_CHECKING([whether use of capabilities is requested])
297 AC_ARG_WITH(capabilities,
298 [ --with-capabilities use linux capabilities [default=no]],
299 [use_capabilities="$withval"],[use_capabilities=no])
300 AC_MSG_RESULT($use_capabilities)
303 # To avoid double inclusion of config.h which might happen at some
304 # places, we add the usual double inclusion protection at the top of
308 #ifndef GNUPG_CONFIG_H_INCLUDED
309 #define GNUPG_CONFIG_H_INCLUDED
313 # Stuff which goes at the bottom of config.h.
316 /* This is the major version number of GnuPG so that
317 source included files can test for this. Note, that
318 we use 2 here even for GnuPG 1.9.x. */
319 #define GNUPG_MAJOR_VERSION 2
321 /* Now to separate file name parts.
322 Please note that the string version must not contain more
323 than one character because the code assumes strlen()==1 */
324 #ifdef HAVE_DOSISH_SYSTEM
325 #define DIRSEP_C '\\'
326 #define DIRSEP_S "\\"
329 #define PATHSEP_C ';'
330 #define PATHSEP_S ";"
331 #define EXEEXT_S ".exe"
337 #define PATHSEP_C ':'
338 #define PATHSEP_S ":"
342 /* This is the same as VERSION, but should be overridden if the
343 platform cannot handle things like dots '.' in filenames. Set
344 SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
345 uses for dots and dashes. */
346 #define SAFE_VERSION VERSION
347 #define SAFE_VERSION_DOT '.'
348 #define SAFE_VERSION_DASH '-'
350 /* Some global constants. */
351 #ifdef HAVE_DRIVE_LETTERS
352 #define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
354 #define GNUPG_DEFAULT_HOMEDIR "/SYS\$LOGIN/gnupg"
356 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
358 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
360 /* For some systems (DOS currently), we hardcode the path here. For
361 POSIX systems the values are constructed by the Makefiles, so that
362 the values may be overridden by the make invocations; this is to
363 comply with the GNU coding standards. */
364 #ifdef HAVE_DRIVE_LETTERS
365 #define GNUPG_BINDIR "c:\\gnupg"
366 #define GNUPG_LIBEXECDIR "c:\\gnupg"
367 #define GNUPG_LIBDIR "c:\\gnupg"
368 #define GNUPG_DATADIR "c:\\gnupg"
371 /* Setup the hardwired names of modules. */
372 #ifndef GNUPG_DEFAULT_AGENT
373 #define GNUPG_DEFAULT_AGENT ( GNUPG_BINDIR DIRSEP_S "gpg-agent" EXEEXT_S )
375 #ifndef GNUPG_DEFAULT_PINENTRY
376 #define GNUPG_DEFAULT_PINENTRY ( GNUPG_BINDIR DIRSEP_S "pinentry" EXEEXT_S )
378 #ifndef GNUPG_DEFAULT_SCDAEMON
379 #define GNUPG_DEFAULT_SCDAEMON ( GNUPG_BINDIR DIRSEP_S "scdaemon" EXEEXT_S )
381 #ifndef GNUPG_DEFAULT_DIRMNGR
382 #define GNUPG_DEFAULT_DIRMNGR ( GNUPG_BINDIR DIRSEP_S "dirmngr" EXEEXT_S )
384 #ifndef GNUPG_DEFAULT_PROTECT_TOOL
385 #define GNUPG_DEFAULT_PROTECT_TOOL \
386 ( GNUPG_LIBEXECDIR DIRSEP_S "gpg-protect-tool" EXEEXT_S )
390 /* Derive some other constants. */
391 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
392 #define EXEC_TEMPFILE_ONLY
396 /* We didn't define endianness above, so get it from OS macros. This
397 is intended for making fat binary builds on OS X. */
398 #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST)
399 #if defined(__BIG_ENDIAN__)
400 #define BIG_ENDIAN_HOST 1
401 #elif defined(__LITTLE_ENDIAN__)
402 #define LITTLE_ENDIAN_HOST 1
404 #error "No endianness found"
409 /* Tell libgcrypt not to use its own libgpg-error implementation. */
410 #define USE_LIBGPG_ERROR 1
412 /* We use jnlib, so tell other modules about it. */
413 #define HAVE_JNLIB_LOGGING 1
415 /* Our HTTP code is used in estream mode. */
416 #define HTTP_USE_ESTREAM 1
418 /* We always include support for the OpenPGP card. */
419 #define ENABLE_CARD_SUPPORT 1
421 /* We don't want the old assuan codes anymore. */
422 #define _ASSUAN_ONLY_GPG_ERRORS 1
424 #endif /*GNUPG_CONFIG_H_INCLUDED*/
430 # Checks for programs.
433 missing_dir=`cd $ac_aux_dir && pwd`
434 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
435 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
436 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
437 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
438 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
445 AC_CHECK_TOOL(AR, ar, :)
446 AC_PATH_PROG(PERL,"perl")
455 have_dosish_system=no
457 use_simple_gettext=no
460 # special stuff for Windoze NT
461 ac_cv_have_dev_random=no
462 AC_DEFINE(USE_ONLY_8DOT3,1,
463 [set this to limit filenames to the 8.3 format])
464 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
465 [defined if we must run on a stupid file system])
466 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
467 [because the Unix gettext has too much overhead on
468 MingW32 systems and these systems lack Posix functions,
469 we use a simplified version of gettext])
470 disable_keyserver_path=yes
471 have_dosish_system=yes
474 use_simple_gettext=yes
476 i?86-emx-os2 | i?86-*-os2*emx )
477 # OS/2 with the EMX environment
478 ac_cv_have_dev_random=no
479 AC_DEFINE(HAVE_DRIVE_LETTERS)
480 have_dosish_system=yes
485 # DOS with the DJGPP environment
486 ac_cv_have_dev_random=no
487 AC_DEFINE(HAVE_DRIVE_LETTERS)
488 have_dosish_system=yes
494 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
495 LDFLAGS="$LDFLAGS -L/usr/local/lib"
499 if test -z "$GCC" ; then
500 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
504 if test -z "$GCC" ; then
505 # Suppress all warnings
506 # to get rid of the unsigned/signed char mismatch warnings.
511 if test -z "$GCC" ; then
512 # Use the newer compiler `-msg_disable ptrmismatch1' to
513 # get rid of the unsigned/signed char mismatch warnings.
514 # Using this may hide other pointer mismatch warnings, but
515 # it at least lets other warning classes through
516 CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
525 if test "$have_dosish_system" = yes; then
526 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
527 [Defined if we run on some of the PCDOS like systems
528 (DOS, Windoze. OS/2) with special properties like
531 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
533 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
535 if test "$have_w32_system" = yes; then
536 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
538 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
540 if test "$disable_keyserver_path" = yes; then
541 AC_DEFINE(DISABLE_KEYSERVER_PATH,1,
542 [Defined to disable exec-path for keyserver helpers])
545 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
546 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
548 if test x"$try_hkp" = xyes ; then
549 AC_SUBST(GPGKEYS_HKP,"gpg2keys_hkp$EXEEXT")
552 if test x"$try_finger" = xyes ; then
553 AC_SUBST(GPGKEYS_FINGER,"gpg2keys_finger$EXEEXT")
559 # Checks for libraries.
564 # libgpg-error is a library with error codes shared between GnuPG
567 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
568 have_gpg_error=yes,have_gpg_error=no)
572 # Libgcrypt is our generic crypto library
574 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
575 have_libgcrypt=yes,have_libgcrypt=no)
579 # libassuan is used for IPC
581 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_VERSION",
582 have_libassuan=yes,have_libassuan=no)
586 # libksba is our X.509 support library
588 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
592 # libusb allows us to use the integrated CCID smartcard reader driver.
594 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
595 AC_CHECK_LIB(usb, usb_bulk_write,
596 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
597 AC_DEFINE(HAVE_LIBUSB,1,
598 [defined if libusb is available])
601 AC_SUBST(LIBUSB_LIBS)
602 AC_CHECK_FUNCS(usb_create_match)
605 # Check wether it is necessary to link against libdl.
608 AC_SEARCH_LIBS(dlopen, c dl,,,)
613 # Checks for symcryptrun:
616 # libutil has openpty() and login_tty().
617 AC_CHECK_LIB(util, openpty,
618 [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
619 AC_DEFINE(HAVE_LIBUTIL,1,
620 [defined if libutil is available])
622 AC_SUBST(LIBUTIL_LIBS)
624 # shred is used to clean temporary plain text files.
625 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
626 AC_DEFINE_UNQUOTED(SHRED,
627 "${SHRED}", [defines the filename of the shred program])
632 # Check whether the GNU Pth library is available
633 # Note, that we include a Pth emulation for W32.
635 AC_ARG_WITH(pth-prefix,
636 AC_HELP_STRING([--with-pth-prefix=PFX],
637 [prefix where GNU Pth is installed (optional)]),
638 pth_config_prefix="$withval", pth_config_prefix="")
639 if test x$pth_config_prefix != x ; then
640 PTH_CONFIG="$pth_config_prefix/bin/pth-config"
642 AC_PATH_PROG(PTH_CONFIG, pth-config, no)
643 if test "$have_w32_system" = no; then
644 if test "$PTH_CONFIG" = "no"; then
647 *** To support concurrent access to the gpg-agent and the SCdaemon
648 *** we need the support of the GNU Portable Threads Library.
649 *** Download it from ftp://ftp.gnu.org/gnu/pth/
650 *** On a Debian GNU/Linux system you might want to try
651 *** apt-get install libpth-dev
654 GNUPG_PTH_VERSION_CHECK(1.3.7)
655 if test $have_pth = yes; then
656 PTH_CFLAGS=`$PTH_CONFIG --cflags`
657 PTH_LIBS=`$PTH_CONFIG --ldflags`
658 PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`"
659 AC_DEFINE(USE_GNU_PTH, 1,
660 [Defined if the GNU Portable Thread Library should be used])
661 AC_DEFINE(HAVE_PTH, 1,
662 [Defined if the GNU Pth is available])
669 AC_DEFINE(USE_GNU_PTH, 1)
670 AC_DEFINE(HAVE_PTH, 1)
677 # Must check for network library requirements before doing link tests
678 # for ldap, for example. If ldap libs are static (or dynamic and without
679 # ELF runtime link paths), then link will fail and LDAP support won't
682 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
683 [NETLIBS="-lnsl $NETLIBS"]))
684 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
685 [NETLIBS="-lsocket $NETLIBS"]))
688 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
690 if test x"$try_hkp" = xyes || test x"$try_http" = xyes ; then
691 AC_ARG_ENABLE(dns-srv,
692 AC_HELP_STRING([--disable-dns-srv],
693 [disable the use of DNS SRV in HKP and HTTP]),
694 use_dns_srv=$enableval,use_dns_srv=yes)
697 AC_ARG_ENABLE(dns-pka,
698 AC_HELP_STRING([--disable-dns-pka],
699 [disable the use of PKA records in DNS]),
700 use_dns_pka=$enableval,use_dns_pka=yes)
702 AC_ARG_ENABLE(dns-cert,
703 AC_HELP_STRING([--disable-dns-cert],
704 [disable the use of CERT records in DNS]),
705 use_dns_cert=$enableval,use_dns_cert=yes)
707 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
708 || test x"$use_dns_cert" = xyes; then
711 # the double underscore thing is a glibc-ism?
712 AC_SEARCH_LIBS(res_query,resolv bind,,
713 AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
714 AC_SEARCH_LIBS(dn_expand,resolv bind,,
715 AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
716 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
717 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
719 if test x"$have_resolver" != xno ; then
721 # Make sure that the BIND 4 resolver interface is workable before
722 # enabling any code that calls it. At some point I'll rewrite the
723 # code to use the BIND 8 resolver API.
725 AC_MSG_CHECKING([whether the resolver is usable])
726 AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
727 #include <netinet/in.h>
728 #include <arpa/nameser.h>
729 #include <resolv.h>],
730 [[unsigned char answer[PACKETSZ];
731 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
733 dn_expand(0,0,0,0,0);
734 ]])],have_resolver=yes,have_resolver=no)
735 AC_MSG_RESULT($have_resolver)
737 # This is Apple-specific and somewhat bizarre as they changed the
738 # define in bind 8 for some reason.
740 if test x"$have_resolver" != xyes ; then
742 [whether I can make the resolver usable with BIND_8_COMPAT])
743 AC_LINK_IFELSE([AC_LANG_PROGRAM([#define BIND_8_COMPAT
744 #include <sys/types.h>
745 #include <netinet/in.h>
746 #include <arpa/nameser.h>
747 #include <resolv.h>],
748 [[unsigned char answer[PACKETSZ];
749 res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
750 dn_skipname(0,0); dn_expand(0,0,0,0,0);
751 ]])],[have_resolver=yes ; need_compat=yes])
752 AC_MSG_RESULT($have_resolver)
756 if test x"$have_resolver" = xyes ; then
759 if test x"$use_dns_srv" = xyes ; then
760 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
763 if test x"$use_dns_pka" = xyes ; then
764 AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
767 if test x"$use_dns_cert" = xyes ; then
768 AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
771 if test x"$need_compat" = xyes ; then
772 AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
785 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
790 if test "$try_ldap" = yes ; then
791 GNUPG_CHECK_LDAP($NETLIBS)
795 # Check for curl. We fake the curl API if libcurl isn't installed.
797 LIBCURL_CHECK_CONFIG([yes],,,[fake_curl=yes])
798 AM_CONDITIONAL(FAKE_CURL,test x"$fake_curl" = xyes)
800 # Generic, for us, means curl
802 if test x"$try_generic" = xyes ; then
803 AC_SUBST(GPGKEYS_CURL,"gpg2keys_curl$EXEEXT")
809 # This isn't necessarily sendmail itself, but anything that gives a
810 # sendmail-ish interface to the outside world. That includes Exim,
811 # Postfix, etc. Basically, anything that can handle "sendmail -t".
812 if test "$try_mailto" = yes ; then
813 AC_ARG_WITH(mailprog,
814 AC_HELP_STRING([--with-mailprog=NAME],
815 [use "NAME -t" for mail transport]),
818 if test x"$with_mailprog" = xyes ; then
819 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
820 if test "$ac_cv_path_SENDMAIL" ; then
821 GPGKEYS_MAILTO="gpg2keys_mailto"
823 elif test x"$with_mailprog" != xno ; then
824 AC_MSG_CHECKING([for a mail transport program])
825 AC_SUBST(SENDMAIL,$with_mailprog)
826 AC_MSG_RESULT($with_mailprog)
827 GPGKEYS_MAILTO="gpg2keys_mailto"
831 AC_SUBST(GPGKEYS_MAILTO)
834 # Construct a printable name of the OS
838 PRINTABLE_OS_NAME="MingW32"
841 PRINTABLE_OS_NAME="Cygwin"
843 i?86-emx-os2 | i?86-*-os2*emx )
844 PRINTABLE_OS_NAME="OS/2"
847 PRINTABLE_OS_NAME="MSDOS/DJGPP"
851 PRINTABLE_OS_NAME="GNU/Linux"
854 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
857 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
858 [A human readable text with the name of the OS])
864 AM_GNU_GETTEXT_VERSION(0.14.1)
865 if test "$try_gettext" = yes; then
866 AM_GNU_GETTEXT(,[need-ngettext])
868 # gettext requires some extra checks. These really should be part of
869 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
870 # function checks to here.
872 AC_CHECK_FUNCS(strchr)
875 USE_INCLUDED_LIBINTL=no
876 BUILD_INCLUDED_LIBINTL=no
878 AC_SUBST(USE_INCLUDED_LIBINTL)
879 AC_SUBST(BUILD_INCLUDED_LIBINTL)
887 if test "$selinux_support" = yes ; then
888 AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
893 # Checks for header files.
896 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h])
897 AC_CHECK_HEADERS([pwd.h inttypes.h])
901 # Checks for typedefs, structures, and compiler characteristics.
911 AC_ARG_ENABLE(endian-check,
912 AC_HELP_STRING([--disable-endian-check],
913 [disable the endian check and trust the OS provided macros]),
914 endiancheck=$enableval,endiancheck=yes)
916 if test x"$endiancheck" = xyes ; then
920 # fixme: we should get rid of the byte type
921 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
922 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
923 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
924 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
925 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
927 AC_CHECK_SIZEOF(unsigned short)
928 AC_CHECK_SIZEOF(unsigned int)
929 AC_CHECK_SIZEOF(unsigned long)
930 AC_CHECK_SIZEOF(unsigned long long)
931 # Ensure that we have UINT64_C before we bother to check for uint64_t
932 # Fixme: really needed in gnupg? I think it is only useful in libcgrypt.
933 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
934 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <inttypes.h>
935 uint64_t foo=UINT64_C(42);]),
936 gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
937 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
938 AC_CHECK_SIZEOF(uint64_t)
941 if test "$ac_cv_sizeof_unsigned_short" = "0" \
942 || test "$ac_cv_sizeof_unsigned_int" = "0" \
943 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
944 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
949 # Checks for library functions.
951 AC_CHECK_DECLS(getpagesize)
955 AC_CHECK_FUNCS([strerror stpcpy strsep strlwr tcgetattr strtoul mmap])
956 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times timegm gmtime_r])
957 AC_CHECK_FUNCS([unsetenv getpwnam getpwuid fcntl ftruncate])
958 AC_CHECK_FUNCS([memmove gettimeofday getrusage setrlimit clock_gettime])
959 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
960 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe stat getaddrinfo])
961 AC_CHECK_FUNCS([ttyname isascii memrchr rand ftello])
963 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
970 gl_MODULES(setenv strsep mkdtemp vasprintf xsize)
975 # These are needed by libjnlib - fixme: we should have macros for them
977 AC_CHECK_FUNCS([memicmp stpcpy strlwr strtoul memmove stricmp strtol])
978 AC_CHECK_FUNCS([getrusage setrlimit stat setlocale])
979 AC_CHECK_FUNCS([flockfile funlockfile fopencookie funopen])
985 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
989 # Sanity check regex. Tests adapted from mutt.
990 # FIXME: We should use the the regex from gnulib
992 AC_MSG_CHECKING([whether regular expression support is requested])
994 AC_HELP_STRING([--disable-regex],
995 [do not handle regular expressions in trust signatures]),
996 use_regex=$enableval, use_regex=yes)
997 AC_MSG_RESULT($use_regex)
999 if test "$use_regex" = yes ; then
1000 AC_MSG_CHECKING([whether the included regex lib is requested])
1001 AC_ARG_WITH(included-regex,
1002 [ --with-included-regex use the included GNU regex library],
1003 [gnupg_cv_included_regex="$withval"],[gnupg_cv_included_regex=no])
1004 AC_MSG_RESULT($gnupg_cv_included_regex)
1006 if test $gnupg_cv_included_regex = no ; then
1007 # Does the system have regex functions at all?
1008 AC_CHECK_FUNC(regcomp,gnupg_cv_included_regex=no,
1009 gnupg_cv_included_regex=yes)
1012 if test $gnupg_cv_included_regex = no ; then
1013 AC_CACHE_CHECK([whether your system's regexp library is broken],
1014 [gnupg_cv_regex_broken],
1018 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); }],
1019 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1021 if test $gnupg_cv_regex_broken = yes ; then
1022 AC_MSG_WARN(your regex is broken - using the included GNU regex instead.)
1023 gnupg_cv_included_regex=yes
1027 if test $gnupg_cv_included_regex = yes; then
1028 AC_DEFINE(USE_INTERNAL_REGEX,1,[ Define if you want to use the included regex lib ])
1031 AC_DEFINE(DISABLE_REGEX,1,[ Define to disable regular expression support ])
1034 AM_CONDITIONAL(USE_INTERNAL_REGEX, test x"$gnupg_cv_included_regex" = xyes)
1039 # Do we have zlib? Must do it here because Solaris failed
1040 # when compiling a conftest (due to the "-lz" from LIBS).
1041 # Note that we combine zlib and bzlib2 in ZLIBS.
1043 _cppflags="${CPPFLAGS}"
1044 _ldflags="${LDFLAGS}"
1046 [ --with-zlib=DIR use libz in DIR],[
1047 if test -d "$withval"; then
1048 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1049 LDFLAGS="${LDFLAGS} -L$withval/lib"
1053 AC_CHECK_HEADER(zlib.h,
1054 AC_CHECK_LIB(z, deflateInit2_,
1056 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1057 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1060 # Check whether we can support bzip2
1062 if test "$use_bzip2" = yes ; then
1063 _cppflags="${CPPFLAGS}"
1064 _ldflags="${LDFLAGS}"
1066 AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1068 if test -d "$withval" ; then
1069 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1070 LDFLAGS="${LDFLAGS} -L$withval/lib"
1074 # Checking alongside stdio.h as an early version of bzip2 (1.0)
1075 # required stdio.h to be included before bzlib.h, and Solaris 9 is
1076 # woefully out of date.
1077 if test "$withval" != no ; then
1078 AC_CHECK_HEADER(bzlib.h,
1079 AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1082 ZLIBS="$ZLIBS -lbz2"
1083 AC_DEFINE(HAVE_BZIP2,1,
1084 [Defined if the bz2 compression library is available])
1086 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1087 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1090 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1094 # Check for readline support
1095 GNUPG_CHECK_READLINE
1097 # See wether we want to run the long test suite.
1098 AC_ARG_WITH(pkits-tests,
1099 AC_HELP_STRING([--with-pkits-tests],[run the PKITS based tests]),
1100 [run_pkits_tests=$withval], [run_pkits_tests=no])
1101 AM_CONDITIONAL(RUN_PKITS_TESTS, test "$run_pkits_tests" = "yes")
1104 # Allow users to append something to the version string without
1105 # flagging it as development version. The user version parts is
1106 # considered everything after a dash.
1108 if test "$development_version" != yes; then
1112 if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
1113 development_version=yes
1116 if test "$development_version" = yes; then
1117 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1118 [Defined if this is not a regular release])
1121 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1125 # Add some extra libs here so that previous tests don't fail for
1126 # mysterious reasons - the final link step should bail out.
1127 if test "$have_w32_system" = yes; then
1136 # Setup gcc specific options
1138 if test "$GCC" = yes; then
1139 # Note that it is okay to use CFLAGS here because this are just
1140 # warning options and the user should have a chance of overriding
1142 if test "$USE_MAINTAINER_MODE" = "yes"; then
1143 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1144 CFLAGS="$CFLAGS -Wno-format-y2k -Wformat-security -Wformat-nonliteral"
1146 CFLAGS="$CFLAGS -Wall"
1149 AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1150 _gcc_cflags_save=$CFLAGS
1151 CFLAGS="-Wno-pointer-sign"
1152 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
1153 AC_MSG_RESULT($_gcc_psign)
1154 CFLAGS=$_gcc_cflags_save;
1155 if test x"$_gcc_psign" = xyes ; then
1156 CFLAGS="$CFLAGS -Wno-pointer-sign"
1162 # This is handy for debugging so the compiler doesn't rearrange
1163 # things and eliminate variables.
1165 AC_ARG_ENABLE(optimization,
1166 AC_HELP_STRING([--disable-optimization],
1167 [disable compiler optimization]),
1168 [if test $enableval = no ; then
1169 CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
1173 # For W32 we need to use our Pth emulation code
1175 if test "$have_w32_system" = yes; then
1176 AC_CONFIG_LINKS(pth.h:jnlib/w32-pth.h)
1181 # Decide what to build
1184 if test $have_ksba = no; then
1189 build_agent_threaded=""
1190 if test "$build_agent" = "yes"; then
1191 if test $have_pth = no; then
1192 build_agent_threaded="(not multi-threaded)"
1197 build_scdaemon_extra=""
1198 if test "$build_scdaemon" = "yes"; then
1200 if test $have_pth = no; then
1201 build_scdaemon_extra="not multi-threaded"
1205 if test $have_libusb = no; then
1206 build_scdaemon_extra="${tmp}without internal CCID driver"
1209 if test -n "$build_scdaemon_extra"; then
1210 build_scdaemon_extra="(${build_scdaemon_extra})"
1215 if test "$build_agent_only" = "yes" ; then
1224 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
1225 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1226 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1227 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1228 AM_CONDITIONAL(BUILD_TOOLS, test "$build_tools" = "yes")
1229 AM_CONDITIONAL(BUILD_DOC, test "$build_doc" = "yes")
1230 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1232 AM_CONDITIONAL(RUN_GPG_TESTS,
1233 test x$cross_compiling = xno -a "$build_gpg" = yes )
1237 # Print errors here so that they are visible all
1238 # together and the user can acquire them all together.
1241 if test "$have_gpg_error" = "no"; then
1245 *** You need libgpg-error to build this program.
1246 ** This library is for example available at
1247 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
1248 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1251 if test "$have_libgcrypt" = "no"; then
1255 *** You need libgcrypt to build this program.
1256 ** This library is for example available at
1257 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1258 *** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API is required.)
1261 if test "$have_libassuan" = "no"; then
1265 *** You need libassuan to build this program.
1266 *** This library is for example available at
1267 *** ftp://ftp.gnupg.org/gcrypt/alpha/libassuan/
1268 *** (at least version $NEED_LIBASSUAN_VERSION is required).
1271 if test "$have_ksba" = "no"; then
1274 *** You need libksba to build this program.
1275 *** This library is for example available at
1276 *** ftp://ftp.gnupg.org/gcrypt/libksba/
1277 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1280 if test "$missing_pth" = "yes"; then
1283 *** It is now required to build with support for the
1284 *** GNU Portable Threads Library (Pth). Please install this
1285 *** library first. The library is for example available at
1286 *** ftp://ftp.gnu.org/gnu/pth/
1287 *** On a Debian GNU/Linux system you can install it using
1288 *** apt-get install libpth-dev
1293 if test "$die" = "yes"; then
1296 *** Required libraries not found. Please consult the above messages
1297 *** and install them before running configure again.
1303 AC_CONFIG_FILES([ m4/Makefile
1317 keyserver/gpgkeys_mailto
1318 keyserver/gpgkeys_test
1323 tests/openpgp/Makefile
1327 #tests/pkits/Makefile
1333 GnuPG v${VERSION} has been configured as follows:
1335 Platform: $PRINTABLE_OS_NAME ($host)
1338 S/MIME: $build_gpgsm
1339 Agent: $build_agent $build_agent_threaded
1340 Smartcard: $build_scdaemon $build_scdaemon_extra
1342 Protect tool: $show_gnupg_protect_tool_pgm
1343 Default agent: $show_gnupg_agent_pgm
1344 Default pinentry: $show_gnupg_pinentry_pgm
1345 Default scdaemon: $show_gnupg_scdaemon_pgm
1346 Default dirmngr: $show_gnupg_dirmngr_pgm
1348 PKITS based tests: $run_pkits_tests