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.23])
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 [gnupg-devel@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
41 NEED_GPG_ERROR_VERSION=1.0
44 NEED_LIBGCRYPT_VERSION=1.1.94
46 NEED_LIBASSUAN_VERSION=0.6.10
48 NEED_KSBA_VERSION=0.9.13
52 PACKAGE_GT=${PACKAGE_NAME}2
53 VERSION=$PACKAGE_VERSION
55 AC_CONFIG_AUX_DIR(scripts)
56 AC_CONFIG_SRCDIR(sm/gpgsm.c)
57 AM_CONFIG_HEADER(config.h)
59 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
64 # Some status variables to give feedback at the end of a configure run
71 GNUPG_BUILD_PROGRAM(gpg, no)
72 GNUPG_BUILD_PROGRAM(gpgsm, yes)
73 GNUPG_BUILD_PROGRAM(agent, yes)
74 GNUPG_BUILD_PROGRAM(scdaemon, yes)
75 GNUPG_BUILD_PROGRAM(symcryptrun, no)
81 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
82 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
83 [Name of this package for gettext])
84 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
85 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
87 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
88 [Required version of Libgcrypt])
89 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
90 [Required version of Libksba])
94 # The default is to use the modules from this package and the few
95 # other packages in a standard place; i.e where this package gets
96 # installed. With these options it is possible to override these
97 # ${prefix} depended values with fixed paths, which can't be replaced
98 # at make time. See also am/cmacros.am and the defaults in AH_BOTTOM.
99 AC_ARG_WITH(agent-pgm,
100 [ --with-agent-pgm=PATH Use PATH as the default for the agent)],
101 GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
102 AC_SUBST(GNUPG_AGENT_PGM)
103 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
104 show_gnupg_agent_pgm="(default)"
105 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
107 AC_ARG_WITH(pinentry-pgm,
108 [ --with-pinentry-pgm=PATH Use PATH as the default for the pinentry)],
109 GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
110 AC_SUBST(GNUPG_PINENTRY_PGM)
111 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
112 show_gnupg_pinentry_pgm="(default)"
113 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
116 AC_ARG_WITH(scdaemon-pgm,
117 [ --with-scdaemon-pgm=PATH Use PATH as the default for the scdaemon)],
118 GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
119 AC_SUBST(GNUPG_SCDAEMON_PGM)
120 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
121 show_gnupg_scdaemon_pgm="(default)"
122 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
125 AC_ARG_WITH(dirmngr-pgm,
126 [ --with-dirmngr-pgm=PATH Use PATH as the default for the dirmngr)],
127 GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
128 AC_SUBST(GNUPG_DIRMNGR_PGM)
129 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
130 show_gnupg_dirmngr_pgm="(default)"
131 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
133 AC_ARG_WITH(protect-tool-pgm,
134 [ --with-protect-tool-pgm=PATH Use PATH as the default for the protect-tool)],
135 GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
136 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
137 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
138 show_gnupg_protect_tool_pgm="(default)"
139 test -n "$GNUPG_PROTECT_TOOL_PGM" \
140 && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
144 # Some folks want to use only the agent form this packet. Make it
145 # easier for them by providing the configure option
146 # --enable-only-agent.
147 AC_ARG_ENABLE(agent-only,
148 AC_HELP_STRING([--enable-agent-only],[build only the gpg-agent]),
149 build_agent_only=$enableval)
152 # Allow disabling of bzib2 support.
153 # It is defined only after we confirm the library is available later
155 AC_MSG_CHECKING([whether to enable the BZIP2 compression algorithm])
157 AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
158 use_bzip2=$enableval)
159 AC_MSG_RESULT($use_bzip2)
162 # Configure option to allow or disallow execution of external
163 # programs, like a photo viewer.
164 AC_MSG_CHECKING([whether to enable external program execution])
166 AC_HELP_STRING([--disable-exec],[disable all external program execution]),
168 AC_MSG_RESULT($use_exec)
169 if test "$use_exec" = no ; then
170 AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
173 if test "$use_exec" = yes ; then
174 AC_MSG_CHECKING([whether to enable photo ID viewing])
175 AC_ARG_ENABLE(photo-viewers,
176 [ --disable-photo-viewers disable photo ID viewers],
177 [if test "$enableval" = no ; then
178 AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
180 gnupg_cv_enable_photo_viewers=$enableval
181 AC_MSG_RESULT($enableval)
183 if test "$gnupg_cv_enable_photo_viewers" = yes ; then
184 AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
185 AC_ARG_WITH(photo-viewer,
186 [ --with-photo-viewer=FIXED_VIEWER set a fixed photo ID viewer],
187 [if test "$withval" = yes ; then
189 elif test "$withval" != no ; then
190 AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
191 [if set, restrict photo-viewer to this])
193 AC_MSG_RESULT($withval)
196 AC_MSG_CHECKING([whether to enable external keyserver helpers])
197 AC_ARG_ENABLE(keyserver-helpers,
198 [ --disable-keyserver-helpers disable all external keyserver support],
199 [if test "$enableval" = no ; then
200 AC_DEFINE(DISABLE_KEYSERVER_HELPERS,1,
201 [define to disable keyserver helpers])
203 gnupg_cv_enable_keyserver_helpers=$enableval
204 AC_MSG_RESULT($enableval)
206 if test "$gnupg_cv_enable_keyserver_helpers" = yes ; then
207 AC_MSG_CHECKING([whether LDAP keyserver support is requested])
209 [ --disable-ldap disable LDAP keyserver interface],
210 try_ldap=$enableval, try_ldap=yes)
211 AC_MSG_RESULT($try_ldap)
213 AC_MSG_CHECKING([whether HKP keyserver support is requested])
215 [ --disable-hkp disable HKP keyserver interface],
216 try_hkp=$enableval, try_hkp=yes)
217 AC_MSG_RESULT($try_hkp)
219 if test "$try_hkp" = yes ; then
220 AC_SUBST(GPGKEYS_HKP,"gpgkeys_hkp$EXEEXT")
223 AC_MSG_CHECKING([whether email keyserver support is requested])
224 AC_ARG_ENABLE(mailto,
225 [ --disable-mailto disable email keyserver interface],
226 try_mailto=$enableval, try_mailto=yes)
227 AC_MSG_RESULT($try_mailto)
230 AC_MSG_CHECKING([whether keyserver exec-path is enabled])
231 AC_ARG_ENABLE(keyserver-path,
232 [ --disable-keyserver-path disable the exec-path option for keyserver helpers],
233 [if test "$enableval" = no ; then
234 AC_DEFINE(DISABLE_KEYSERVER_PATH,1,[define to disable exec-path for keyserver helpers])
236 AC_MSG_RESULT($enableval)
241 dnl Check for the key/uid cache size. This can't be zero, but can be
242 dnl pretty small on embedded systems.
244 AC_MSG_CHECKING([for the size of the key and uid cache])
245 AC_ARG_ENABLE(key-cache,
246 AC_HELP_STRING([--enable-key-cache=SIZE],[Set key cache to SIZE (default 4096)]),,enableval=4096)
248 if test "$enableval" = "no"; then
250 elif test "$enableval" = "yes" || test "$enableval" = ""; then
255 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
258 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
259 AC_MSG_ERROR([invalid key-cache size])
262 AC_MSG_RESULT($key_cache_size)
263 AC_DEFINE_UNQUOTED(PK_UID_CACHE_SIZE,$key_cache_size,[Size of the key and UID caches])
268 dnl Check whether we want to use Linux capabilities
270 AC_MSG_CHECKING([whether use of capabilities is requested])
271 AC_ARG_WITH(capabilities,
272 [ --with-capabilities use linux capabilities [default=no]],
273 [use_capabilities="$withval"],[use_capabilities=no])
274 AC_MSG_RESULT($use_capabilities)
278 /* Some global constants. */
279 #ifdef HAVE_DRIVE_LETTERS
280 #define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
282 #define GNUPG_DEFAULT_HOMEDIR "/SYS\$LOGIN/gnupg"
284 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
286 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
288 /* Tell libgcrypt not to use its own libgpg-error implementation. */
289 #define USE_LIBGPG_ERROR 1
291 /* This is the major version number of GnuPG so that
292 source included files can test for this. Note, that\
293 we use 2 here even for GnuPG 1.9.x. */
294 #define GNUPG_MAJOR_VERSION 2
296 /* Now to separate file name parts.
297 Please note that the string version must not contain more
298 than one character because the code assumes strlen()==1 */
299 #ifdef HAVE_DOSISH_SYSTEM
300 #define DIRSEP_C '\\'
301 #define DIRSEP_S "\\"
304 #define PATHSEP_C ';'
305 #define PATHSEP_S ";"
306 #define EXEEXT_S ".exe"
312 #define PATHSEP_C ':'
313 #define PATHSEP_S ":"
317 /* This is the same as VERSION, but should be overridden if the
318 platform cannot handle things like dots '.' in filenames. Set
319 SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
320 uses for dots and dashes. */
321 #define SAFE_VERSION VERSION
322 #define SAFE_VERSION_DOT '.'
323 #define SAFE_VERSION_DASH '-'
325 /* For some systems (DOS currently), we hardcode the path here. For
326 POSIX systems the values are constructed by the Makefiles, so that
327 the values may be overridden by the make invocations; this is to
328 comply with the GNU coding standards. */
329 #ifdef HAVE_DRIVE_LETTERS
330 #define GNUPG_BINDIR "c:\\gnupg"
331 #define GNUPG_LIBEXECDIR "c:\\gnupg"
332 #define GNUPG_LIBDIR "c:\\gnupg"
333 #define GNUPG_DATADIR "c:\\gnupg"
336 /* Setup the hardwired names of modules. */
337 #ifndef GNUPG_DEFAULT_AGENT
338 #define GNUPG_DEFAULT_AGENT ( GNUPG_BINDIR DIRSEP_S "gpg-agent" EXEEXT_S )
340 #ifndef GNUPG_DEFAULT_PINENTRY
341 #define GNUPG_DEFAULT_PINENTRY ( GNUPG_BINDIR DIRSEP_S "pinentry" EXEEXT_S )
343 #ifndef GNUPG_DEFAULT_SCDAEMON
344 #define GNUPG_DEFAULT_SCDAEMON ( GNUPG_BINDIR DIRSEP_S "scdaemon" EXEEXT_S )
346 #ifndef GNUPG_DEFAULT_DIRMNGR
347 #define GNUPG_DEFAULT_DIRMNGR ( GNUPG_BINDIR DIRSEP_S "dirmngr" EXEEXT_S )
349 #ifndef GNUPG_DEFAULT_PROTECT_TOOL
350 #define GNUPG_DEFAULT_PROTECT_TOOL \
351 ( GNUPG_LIBEXECDIR DIRSEP_S "gpg-protect-tool" EXEEXT_S )
355 /* Derive some other constants. */
356 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
357 #define EXEC_TEMPFILE_ONLY
360 /* Temporary hacks to avoid requring a libgpg-error update. */
361 #if !HAVE_DECL_GPG_ERR_LOCKED
362 #define GPG_ERR_LOCKED 173
369 # Checks for programs.
372 missing_dir=`cd $ac_aux_dir && pwd`
373 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
374 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
375 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
376 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
377 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
385 AC_CHECK_TOOL(AR, ar, :)
386 AC_PATH_PROG(PERL,"perl")
390 AC_CHECK_PROG(DOCBOOK_TO_MAN, docbook-to-man, yes, no)
391 AM_CONDITIONAL(HAVE_DOCBOOK_TO_MAN, test "$ac_cv_prog_DOCBOOK_TO_MAN" = yes)
393 GNUPG_CHECK_DOCBOOK_TO_TEXI
397 have_dosish_system=no
401 # special stuff for Windoze NT
402 ac_cv_have_dev_random=no
403 AC_DEFINE(USE_ONLY_8DOT3,1,
404 [set this to limit filenames to the 8.3 format])
405 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
406 [defined if we must run on a stupid file system])
407 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
408 [because the Unix gettext has too much overhead on
409 MingW32 systems and these systems lack Posix functions,
410 we use a simplified version of gettext])
411 have_dosish_system=yes
415 i?86-emx-os2 | i?86-*-os2*emx )
416 # OS/2 with the EMX environment
417 ac_cv_have_dev_random=no
418 AC_DEFINE(HAVE_DRIVE_LETTERS)
419 have_dosish_system=yes
424 # DOS with the DJGPP environment
425 ac_cv_have_dev_random=no
426 AC_DEFINE(HAVE_DRIVE_LETTERS)
427 have_dosish_system=yes
433 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
434 LDFLAGS="$LDFLAGS -L/usr/local/lib"
438 if test -z "$GCC" ; then
439 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
443 if test -z "$GCC" ; then
444 # Suppress all warnings
445 # to get rid of the unsigned/signed char mismatch warnings.
450 if test -z "$GCC" ; then
451 # Use the newer compiler `-msg_disable ptrmismatch' to
452 # get rid of the unsigned/signed char mismatch warnings.
453 # Using this may hide other pointer mismatch warnings, but
454 # it at least lets other warning classes through
455 CFLAGS="$CFLAGS -msg_disable ptrmismatch"
464 if test "$have_dosish_system" = yes; then
465 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
466 [Defined if we run on some of the PCDOS like systems
467 (DOS, Windoze. OS/2) with special properties like
470 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
472 if test "$have_w32_system" = yes; then
473 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
475 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
477 # These need to go after AC_PROG_CC so that $EXEEXT is defined
478 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
482 # Checks for libraries.
487 # libgpg-error is a library with error codes shared between GnuPG
490 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
491 have_gpg_error=yes,have_gpg_error=no)
492 _tmp_gpg_error_save_cflags="$CFLAGS"
493 CFLAGS="$CFLAGS $GPG_ERROR_CFLAGS"
494 AC_CHECK_DECLS(GPG_ERR_LOCKED,,,[#include <gpg-error.h>])
495 CFLAGS="${_tmp_gpg_error_save_cflags}"
499 # Libgcrypt is our generic crypto library
501 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
502 have_libgcrypt=yes,have_libgcrypt=no)
506 # libassuan is used for IPC
508 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_VERSION",
509 have_libassuan=yes,have_libassuan=no)
513 # libksba is our X.509 support library
515 AM_PATH_KSBA("$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
516 # fixme: Remove the following test and require newer libksba instead.
517 _ksba_save_libs=$LIBS
519 AC_CHECK_FUNCS(ksba_dn_teststr)
520 LIBS=$_ksba_save_libs
523 # libusb allows us to use the integrated CCID smartcard reader driver.
525 AC_CHECK_LIB(usb, usb_bulk_write,
526 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
527 AC_DEFINE(HAVE_LIBUSB,1,
528 [defined if libusb is available])
530 AC_SUBST(LIBUSB_LIBS)
531 AC_CHECK_FUNCS(usb_create_match)
534 # Check wether it is necessary to link against libdl.
537 AC_SEARCH_LIBS(dlopen, c dl,,,)
542 # Checks for symcryptrun:
545 # libutil has openpty() and login_tty().
546 AC_CHECK_LIB(util, openpty,
547 [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
548 AC_DEFINE(HAVE_LIBUTIL,1,
549 [defined if libutil is available])
551 AC_SUBST(LIBUTIL_LIBS)
553 # shred is used to clean temporary plain text files.
554 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
555 AC_DEFINE_UNQUOTED(SHRED,
556 "${SHRED}", [defines the filename of the shred program])
560 # Check whether the (highly desirable) GNU Pth library is available
561 # Note, that we include a Pth emulation for W32.
563 AC_ARG_WITH(pth-prefix,
564 AC_HELP_STRING([--with-pth-prefix=PFX],
565 [prefix where GNU Pth is installed (optional)]),
566 pth_config_prefix="$withval", pth_config_prefix="")
567 if test x$pth_config_prefix != x ; then
568 PTH_CONFIG="$pth_config_prefix/bin/pth-config"
570 AC_PATH_PROG(PTH_CONFIG, pth-config, no)
571 if test "$have_w32_system" = no; then
572 if test "$PTH_CONFIG" = "no"; then
575 *** To support concurrent access to the gpg-agent and the SCdaemon
576 *** we need the support of the GNU Portable Threads Library.
577 *** Download it from ftp://ftp.gnu.org/gnu/pth/
578 *** On a Debian GNU/Linux system you might want to try
579 *** apt-get install libpth-dev
582 GNUPG_PTH_VERSION_CHECK(1.3.7)
583 if test $have_pth = yes; then
584 PTH_CFLAGS=`$PTH_CONFIG --cflags`
585 PTH_LIBS=`$PTH_CONFIG --ldflags`
586 PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`"
587 AC_DEFINE(USE_GNU_PTH, 1,
588 [Defined if the GNU Portable Thread Library should be used])
589 AC_DEFINE(HAVE_PTH, 1,
590 [Defined if the GNU Pth is available])
597 AC_DEFINE(USE_GNU_PTH, 1)
598 AC_DEFINE(HAVE_PTH, 1)
604 dnl Must check for network library requirements before doing link tests
605 dnl for ldap, for example. If ldap libs are static (or dynamic and without
606 dnl ELF runtime link paths), then link will fail and LDAP support won't
609 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
610 [NETLIBS="-lnsl $NETLIBS"]))
611 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
612 [NETLIBS="-lsocket $NETLIBS"]))
614 dnl Now try for the resolver functions so we can use DNS SRV
616 AC_ARG_ENABLE(dns-srv,
617 AC_HELP_STRING([--disable-dns-srv],[disable the use of DNS SRV in HKP]),
618 use_dns_srv=$enableval,use_dns_srv=yes)
620 if test x"$try_hkp" = xyes && test x"$use_dns_srv" = xyes ; then
623 # the double underscore thing is a glibc-ism?
624 AC_SEARCH_LIBS(res_query,resolv bind,,
625 AC_SEARCH_LIBS(__res_query,resolv bind,,use_dns_srv=no))
626 AC_SEARCH_LIBS(dn_expand,resolv bind,,
627 AC_SEARCH_LIBS(__dn_expand,resolv bind,,use_dns_srv=no))
628 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
629 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,use_dns_srv=no))
631 if test x"$use_dns_srv" = xyes ; then
632 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
635 AC_MSG_WARN([Resolver functions not found. Disabling DNS SRV.])
642 # Try and link a LDAP test program to weed out unusable LDAP
643 # libraries. -lldap [-llber [-lresolv]] is for OpenLDAP. OpenLDAP in
644 # general is terrible with creating weird dependencies. If all else
645 # fails, the user can play guess-the-dependency by using something
646 # like ./configure LDAPLIBS="-Lfoo -lbar"
648 if test "$try_ldap" = yes ; then
649 for MY_LDAPLIBS in ${LDAPLIBS+"$LDAPLIBS"} "-lldap" "-lldap -llber" "-lldap -llber -lresolv"; do
650 _ldap_save_libs=$LIBS
651 LIBS="$MY_LDAPLIBS $NETLIBS $LIBS"
653 AC_MSG_CHECKING([whether LDAP via \"$MY_LDAPLIBS\" is present and sane])
654 AC_TRY_LINK([#include <ldap.h>],[ldap_open("foobar",1234);],
655 [gnupg_cv_func_ldap_init=yes],[gnupg_cv_func_ldap_init=no])
656 AC_MSG_RESULT([$gnupg_cv_func_ldap_init])
658 if test $gnupg_cv_func_ldap_init = no; then
659 AC_MSG_CHECKING([whether I can make LDAP be sane with lber.h])
660 AC_TRY_LINK([#include <lber.h>
661 #include <ldap.h>],[ldap_open("foobar",1234);],
662 [gnupg_cv_func_ldaplber_init=yes],[gnupg_cv_func_ldaplber_init=no])
663 AC_MSG_RESULT([$gnupg_cv_func_ldaplber_init])
666 if test "$gnupg_cv_func_ldaplber_init" = yes ; then
667 AC_DEFINE(NEED_LBER_H,1,[Define if the LDAP library requires including lber.h before ldap.h])
670 if test "$gnupg_cv_func_ldap_init" = yes || \
671 test "$gnupg_cv_func_ldaplber_init" = yes ; then
672 LDAPLIBS=$MY_LDAPLIBS
673 GPGKEYS_LDAP="gpgkeys_ldap$EXEEXT"
675 AC_MSG_CHECKING([whether LDAP supports ldap_get_option])
677 if test "$gnupg_cv_func_ldap_init" = yes ; then
678 AC_TRY_LINK([#include <ldap.h>],
679 [ldap_get_option((void *)0,0,(void *)0);],
680 [gnupg_cv_func_ldap_get_option=yes],
681 [gnupg_cv_func_ldap_get_option=no])
683 AC_TRY_LINK([#include <lber.h>
684 #include <ldap.h>],[ldap_get_option((void *)0,0,(void *)0);],
685 [gnupg_cv_func_ldap_get_option=yes],
686 [gnupg_cv_func_ldap_get_option=no])
689 AC_MSG_RESULT([$gnupg_cv_func_ldap_get_option])
691 if test "$gnupg_cv_func_ldap_get_option" = yes ; then
692 AC_DEFINE(HAVE_LDAP_GET_OPTION,1,[Define if the LDAP library has ldap_get_option])
694 AC_MSG_CHECKING([whether LDAP supports ld_errno])
696 if test "$gnupg_cv_func_ldap_init" = yes ; then
697 AC_TRY_COMPILE([#include <ldap.h>],
698 [LDAP *ldap; ldap->ld_errno;],
699 [gnupg_cv_func_ldap_ld_errno=yes],
700 [gnupg_cv_func_ldap_ld_errno=no])
702 AC_TRY_LINK([#include <lber.h>
703 #include <ldap.h>],[LDAP *ldap; ldap->ld_errno;],
704 [gnupg_cv_func_ldap_ld_errno=yes],
705 [gnupg_cv_func_ldap_ld_errno=no])
708 AC_MSG_RESULT([$gnupg_cv_func_ldap_ld_errno])
710 if test "$gnupg_cv_func_ldap_ld_errno" = yes ; then
711 AC_DEFINE(HAVE_LDAP_LD_ERRNO,1,[Define if the LDAP library supports ld_errno])
716 LIBS=$_ldap_save_libs
718 if test "$GPGKEYS_LDAP" != "" ; then break; fi
722 AC_SUBST(GPGKEYS_LDAP)
726 # Check for curl. We fake the curl API if libcurl isn't installed.
728 # fixme: need to add this
729 #LIBCURL_CHECK_CONFIG([yes],,,[fake_curl=yes])
730 #AM_CONDITIONAL(FAKE_CURL,test x"$fake_curl" = xyes)
731 AM_CONDITIONAL(FAKE_CURL,1)
733 # Generic, for us, means curl
735 if test x"$try_generic" = xyes ; then
736 AC_SUBST(GPGKEYS_CURL,"gpgkeys_curl$EXEEXT")
739 dnl This isn't necessarily sendmail itself, but anything that gives a
740 dnl sendmail-ish interface to the outside world. That includes qmail,
741 dnl postfix, etc. Basically, anything that can handle "sendmail -t".
743 if test "$try_mailto" = yes ; then
744 AC_ARG_WITH(mailprog,[ --with-mailprog=NAME use "NAME -t" for mail transport],,with_mailprog=yes)
746 if test "$with_mailprog" = yes ; then
747 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
748 if test "$ac_cv_path_SENDMAIL" ; then
749 GPGKEYS_MAILTO="gpgkeys_mailto"
751 elif test "$with_mailprog" != no ; then
752 AC_MSG_CHECKING([for a mail transport program])
753 AC_SUBST(SENDMAIL,$with_mailprog)
754 AC_MSG_RESULT($with_mailprog)
755 GPGKEYS_MAILTO="gpgkeys_mailto"
759 AC_SUBST(GPGKEYS_MAILTO)
763 PRINTABLE_OS_NAME="MingW32"
766 PRINTABLE_OS_NAME="Cygwin"
768 i?86-emx-os2 | i?86-*-os2*emx )
769 PRINTABLE_OS_NAME="OS/2"
772 PRINTABLE_OS_NAME="MSDOS/DJGPP"
776 PRINTABLE_OS_NAME="GNU/Linux"
779 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
782 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
783 [A human readable text with the name of the OS])
786 AM_GNU_GETTEXT_VERSION(0.14.1)
787 if test "$try_gettext" = yes; then
788 AM_GNU_GETTEXT(,[need-ngettext])
790 # gettext requires some extra checks. These really should be part of
791 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
792 # function checks to here.
794 AC_CHECK_FUNCS(strchr)
797 USE_INCLUDED_LIBINTL=no
798 BUILD_INCLUDED_LIBINTL=no
800 AC_SUBST(USE_INCLUDED_LIBINTL)
801 AC_SUBST(BUILD_INCLUDED_LIBINTL)
804 # Checks for header files.
806 AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h)
808 # Checks for typedefs, structures, and compiler characteristics.
817 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
818 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
819 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
820 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
821 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
823 AC_CHECK_SIZEOF(unsigned short)
824 AC_CHECK_SIZEOF(unsigned int)
825 AC_CHECK_SIZEOF(unsigned long)
826 AC_CHECK_SIZEOF(unsigned long long)
827 # Ensure that we have UINT64_C before we bother to check for uint64_t
828 # fixme: really needed in gnupg? I think it is only useful in libcgrypt.
829 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
830 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <inttypes.h>
831 uint64_t foo=UINT64_C(42);]),gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
832 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
833 AC_CHECK_SIZEOF(uint64_t)
839 if test "$ac_cv_sizeof_unsigned_short" = "0" \
840 || test "$ac_cv_sizeof_unsigned_int" = "0" \
841 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
842 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
845 dnl Do we have any 64-bit data types?
846 if test "$ac_cv_sizeof_unsigned_int" != "8" \
847 && test "$ac_cv_sizeof_unsigned_long" != "8" \
848 && test "$ac_cv_sizeof_unsigned_long_long" != "8" \
849 && test "$ac_cv_sizeof_uint64_t" != "8"; then
850 AC_MSG_WARN([No 64-bit types. Disabling SHA-384, and SHA-512])
852 if test x"$use_sha512" = xyes ; then
853 AC_SUBST(SHA512_O,sha512.o)
854 AC_DEFINE(USE_SHA512,1,[Define to include the SHA-384 and SHA-512 digests])
858 # fixme: do we really need this - it should be encapsulated in libassuan
859 GNUPG_SYS_SO_PEERCRED
861 # Checks for library functions.
865 AC_CHECK_FUNCS(strerror stpcpy strsep strlwr tcgetattr strtoul mmap)
866 AC_CHECK_FUNCS(strcasecmp strncasecmp ctermid times gmtime_r)
867 AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
868 AC_CHECK_FUNCS(atexit raise getpagesize strftime nl_langinfo setlocale)
869 AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand pipe stat getaddrinfo)
870 AC_CHECK_FUNCS(fseeko ftello ttyname isascii)
872 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
877 gl_MODULES(setenv strsep mkdtemp vasprintf xsize)
880 # These are needed by libjnlib - fixme: we should have macros for them
881 AC_CHECK_FUNCS(memicmp stpcpy strlwr strtoul memmove stricmp strtol)
882 AC_CHECK_FUNCS(getrusage setrlimit stat setlocale)
883 AC_CHECK_FUNCS(flockfile funlockfile fopencookie funopen)
887 # check for gethrtime and run a testprogram to see whether
888 # it is broken. It has been reported that some Solaris and HP UX systems
891 # fixme: Do we need this - iirc, this is only used by libgcrypt.
893 AC_CACHE_CHECK([for gethrtime],
894 [gnupg_cv_func_gethrtime],
895 [AC_TRY_LINK([#include <sys/times.h>],[
899 [gnupg_cv_func_gethrtime=yes],
900 [gnupg_cv_func_gethrtime=no])
902 if test $gnupg_cv_func_gethrtime = yes; then
903 AC_DEFINE([HAVE_GETHRTIME], 1,
904 [Define if you have the `gethrtime(2)' function.])
905 AC_CACHE_CHECK([whether gethrtime is broken],
906 [gnupg_cv_func_broken_gethrtime],
908 #include <sys/times.h>
914 [gnupg_cv_func_broken_gethrtime=no],
915 [gnupg_cv_func_broken_gethrtime=yes],
916 [gnupg_cv_func_broken_gethrtime=assume-no])
918 if test $gnupg_cv_func_broken_gethrtime = yes; then
919 AC_DEFINE([HAVE_BROKEN_GETHRTIME], 1,
920 [Define if `gethrtime(2)' does not work correctly i.e. issues a SIGILL.])
926 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
929 dnl Check whether we can use Linux capabilities as requested
931 # fixme: Still required?
933 if test "$use_capabilities" = "yes" ; then
935 AC_CHECK_HEADERS(sys/capability.h)
936 if test "$ac_cv_header_sys_capability_h" = "yes" ; then
937 AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1)
938 if test "$ac_cv_lib_cap_cap_init" = "yes"; then
939 AC_DEFINE(USE_CAPABILITIES,1,
940 [define if capabilities should be used])
941 AC_SUBST(CAPLIBS,"-lcap")
945 if test "$use_capabilities" = "no" ; then
948 *** The use of capabilities on this system is not possible.
949 *** You need a recent Linux kernel and some patches:
950 *** fcaps-2.2.9-990610.patch (kernel patch for 2.2.9)
951 *** fcap-module-990613.tar.gz (kernel module)
952 *** libcap-1.92.tar.gz (user mode library and utilities)
953 *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN
954 *** set (filesystems menu). Be warned: This code is *really* ALPHA.
960 # Sanity check regex. Tests adapted from mutt.
962 AC_MSG_CHECKING([whether regular expression support is requested])
964 [ --disable-regex do not handle regular expressions in trust sigs],
965 use_regex=$enableval, use_regex=yes)
966 AC_MSG_RESULT($use_regex)
968 if test "$use_regex" = yes ; then
969 AC_MSG_CHECKING([whether the included regex lib is requested])
970 AC_ARG_WITH(included-regex,
971 [ --with-included-regex use the included GNU regex library],
972 [gnupg_cv_included_regex="$withval"],[gnupg_cv_included_regex=no])
973 AC_MSG_RESULT($gnupg_cv_included_regex)
975 if test $gnupg_cv_included_regex = no ; then
976 # Does the system have regex functions at all?
977 AC_CHECK_FUNC(regcomp,gnupg_cv_included_regex=no,
978 gnupg_cv_included_regex=yes)
981 if test $gnupg_cv_included_regex = no ; then
982 AC_CACHE_CHECK([whether your system's regexp library is broken],
983 [gnupg_cv_regex_broken],
987 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); }],
988 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
990 if test $gnupg_cv_regex_broken = yes ; then
991 AC_MSG_WARN(your regex is broken - using the included GNU regex instead.)
992 gnupg_cv_included_regex=yes
996 if test $gnupg_cv_included_regex = yes; then
997 AC_DEFINE(USE_GNU_REGEX,1,[ Define if you want to use the included regex lib ])
998 AC_SUBST(REGEX_O,regex.o)
1002 AC_DEFINE(DISABLE_REGEX,1,[ Define to disable regular expression support ])
1006 # Do we have zlib? Must do it here because Solaris failed
1007 # when compiling a conftest (due to the "-lz" from LIBS).
1008 # Note that we combine zlib and bzlib2 in ZLIBS.
1010 _cppflags="${CPPFLAGS}"
1011 _ldflags="${LDFLAGS}"
1013 [ --with-zlib=DIR use libz in DIR],[
1014 if test -d "$withval"; then
1015 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1016 LDFLAGS="${LDFLAGS} -L$withval/lib"
1020 AC_CHECK_HEADER(zlib.h,
1021 AC_CHECK_LIB(z, deflateInit2_,
1023 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1024 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1027 # Check whether we can support bzip2
1029 if test "$use_bzip2" = yes ; then
1030 _cppflags="${CPPFLAGS}"
1031 _ldflags="${LDFLAGS}"
1033 AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1035 if test -d "$withval" ; then
1036 CPPFLAGS="${CPPFLAGS} -I$withval/include"
1037 LDFLAGS="${LDFLAGS} -L$withval/lib"
1041 # Checking alongside stdio.h as an early version of bzip2 (1.0)
1042 # required stdio.h to be included before bzlib.h, and Solaris 9 is
1043 # woefully out of date.
1044 if test "$withval" != no ; then
1045 AC_CHECK_HEADER(bzlib.h,
1046 AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1049 ZLIBS="$ZLIBS -lbz2"
1050 AC_DEFINE(HAVE_BZIP2,1,
1051 [Defined if the bz2 compression library is available])
1053 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1054 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1057 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1061 # See wether we want to run the long test suite.
1062 AC_ARG_WITH(pkits-tests,
1063 AC_HELP_STRING([--with-pkits-tests],[run the PKITS based tests]),
1064 [run_pkits_tests=$withval], [run_pkits_tests=no])
1065 AM_CONDITIONAL(RUN_PKITS_TESTS, test "$run_pkits_tests" = "yes")
1068 # Allow users to append something to the version string without
1069 # flagging it as development version. The user version parts is
1070 # considered everything after a dash.
1071 if test "$development_version" != yes; then
1075 if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
1076 development_version=yes
1079 if test "$development_version" = yes; then
1080 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1081 [Defined if this is not a regular release])
1084 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1088 # Add some extra libs here so that previous tests don't fail for
1089 # mysterious reasons - the final link step should bail out.
1090 if test "$have_w32_system" = yes; then
1095 if test "$GCC" = yes; then
1096 if test "$USE_MAINTAINER_MODE" = "yes"; then
1097 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1098 CFLAGS="$CFLAGS -Wno-format-y2k -Wformat-security"
1100 CFLAGS="$CFLAGS -Wall"
1105 # This is handy for debugging so the compiler doesn't rearrange
1106 # things and eliminate variables.
1108 AC_ARG_ENABLE(optimization,
1109 AC_HELP_STRING([--disable-optimization],
1110 [disable compiler optimization]),
1111 [if test $enableval = no ; then
1112 CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
1122 # We use jnlib, so tell other modules about it
1123 AC_DEFINE(HAVE_JNLIB_LOGGING, 1,
1124 [Defined if jnlib style logging functions are available])
1126 # For W32 we need to use our Pth emulation code
1127 if test "$have_w32_system" = yes; then
1128 AC_CONFIG_LINKS(pth.h:jnlib/w32-pth.h)
1133 # Decide what to build
1136 if test $have_ksba = no; then
1141 build_agent_threaded=""
1142 if test "$build_agent" = "yes"; then
1143 if test $have_pth = no; then
1144 build_agent_threaded="(not multi-threaded)"
1149 build_scdaemon_extra=""
1150 if test "$build_scdaemon" = "yes"; then
1152 if test $have_pth = no; then
1153 build_scdaemon_extra="not multi-threaded"
1157 if test -n "$build_scdaemon_extra"; then
1158 build_scdaemon_extra="(${build_scdaemon_extra})"
1163 if test "$build_agent_only" = "yes" ; then
1170 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
1171 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1172 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1173 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1174 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1179 # Print errors here so that they are visible all
1180 # together and the user can acquire them all together.
1183 if test "$have_gpg_error" = "no"; then
1187 *** You need libgpg-error to build this program.
1188 ** This library is for example available at
1189 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
1190 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1193 if test "$have_libgcrypt" = "no"; then
1197 *** You need libgcrypt to build this program.
1198 ** This library is for example available at
1199 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1200 *** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API) is required.)
1203 if test "$have_libassuan" = "no"; then
1207 *** You need libassuan to build this program.
1208 *** This library is for example available at
1209 *** ftp://ftp.gnupg.org/gcrypt/alpha/libassuan/
1210 *** (at least version $NEED_LIBASSUAN_VERSION is required).
1213 if test "$have_ksba" = "no"; then
1216 *** You need libksba to build this program.
1217 *** This library is for example available at
1218 *** ftp://ftp.gnupg.org/gcrypt/alpha/libksba/
1219 *** (at least version $NEED_KSBA_VERSION is required).
1222 if test "$missing_pth" = "yes"; then
1225 *** It is now required to build with support for the
1226 *** GNU Portable Threads Library (Pth). Please install this
1227 *** library first. The library is for example available at
1228 *** ftp://ftp.gnu.org/gnu/pth/
1229 *** On a Debian GNU/Linux system you can install it using
1230 *** apt-get install libpth-dev
1235 if test "$die" = "yes"; then
1238 *** Required libraries not found. Please consult the above messages
1239 *** and install them before running configure again.
1245 AC_CONFIG_FILES([ m4/Makefile
1263 #./autogen keyserver/Makefile
1264 #tests/pkits/Makefile
1270 GnuPG v${VERSION} has been configured as follows:
1272 Platform: $PRINTABLE_OS_NAME ($host)
1275 S/MIME: $build_gpgsm
1276 Agent: $build_agent $build_agent_threaded
1277 Smartcard: $build_scdaemon $build_scdaemon_extra
1279 Protect tool: $show_gnupg_protect_tool_pgm
1280 Default agent: $show_gnupg_agent_pgm
1281 Default pinentry: $show_gnupg_pinentry_pgm
1282 Default scdaemon: $show_gnupg_scdaemon_pgm
1283 Default dirmngr: $show_gnupg_dirmngr_pgm
1285 PKITS based tests: $run_pkits_tests