1 # configure.ac - for GnuPG 1.9
2 # Copyright (C) 1998, 1999, 2000, 2001, 2002,
3 # 2003, 2004, 2005 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21 # Process this file with autoconf to produce a configure script.
23 min_automake_version="1.9.3"
25 # Version number: Remember to change it immediately *after* a release.
26 # Add a "-cvs" prefix for non-released code.
27 AC_INIT(gnupg, 1.9.19, gnupg-devel@gnupg.org)
28 # Set development_version to yes if the minor number is odd or you
29 # feel that the default check for a development version is not
31 development_version=yes
32 NEED_GPG_ERROR_VERSION=1.0
35 NEED_LIBGCRYPT_VERSION=1.1.94
37 NEED_LIBASSUAN_VERSION=0.6.10
39 NEED_KSBA_VERSION=0.9.12
43 PACKAGE_GT=${PACKAGE_NAME}2
44 VERSION=$PACKAGE_VERSION
46 AC_CONFIG_AUX_DIR(scripts)
47 AC_CONFIG_SRCDIR(sm/gpgsm.c)
48 AM_CONFIG_HEADER(config.h)
50 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
54 # Some status variables to give feedback at the end of a configure run
61 GNUPG_BUILD_PROGRAM(gpg, no)
62 GNUPG_BUILD_PROGRAM(gpgsm, yes)
63 GNUPG_BUILD_PROGRAM(agent, yes)
64 GNUPG_BUILD_PROGRAM(scdaemon, yes)
65 GNUPG_BUILD_PROGRAM(symcryptrun, no)
71 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
72 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
73 [Name of this package for gettext])
74 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
75 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
77 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
78 [Required version of Libgcrypt])
79 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
80 [Required version of Libksba])
84 # The default is to use the modules from this package and the few
85 # other packages in a standard place; i.e where this package gets
86 # installed. With these options it is possible to override these
87 # ${prefix} depended values with fixed paths, which can't be replaced
88 # at make time. See also am/cmacros.am and the defaults in AH_BOTTOM.
89 AC_ARG_WITH(agent-pgm,
90 [ --with-agent-pgm=PATH Use PATH as the default for the agent)],
91 GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
92 AC_SUBST(GNUPG_AGENT_PGM)
93 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
94 show_gnupg_agent_pgm="(default)"
95 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
97 AC_ARG_WITH(pinentry-pgm,
98 [ --with-pinentry-pgm=PATH Use PATH as the default for the pinentry)],
99 GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
100 AC_SUBST(GNUPG_PINENTRY_PGM)
101 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
102 show_gnupg_pinentry_pgm="(default)"
103 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
106 AC_ARG_WITH(scdaemon-pgm,
107 [ --with-scdaemon-pgm=PATH Use PATH as the default for the scdaemon)],
108 GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
109 AC_SUBST(GNUPG_SCDAEMON_PGM)
110 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
111 show_gnupg_scdaemon_pgm="(default)"
112 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
115 AC_ARG_WITH(dirmngr-pgm,
116 [ --with-dirmngr-pgm=PATH Use PATH as the default for the dirmngr)],
117 GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
118 AC_SUBST(GNUPG_DIRMNGR_PGM)
119 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
120 show_gnupg_dirmngr_pgm="(default)"
121 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
123 AC_ARG_WITH(protect-tool-pgm,
124 [ --with-protect-tool-pgm=PATH Use PATH as the default for the protect-tool)],
125 GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
126 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
127 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
128 show_gnupg_protect_tool_pgm="(default)"
129 test -n "$GNUPG_PROTECT_TOOL_PGM" \
130 && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
134 # Some folks want to use only the agent form this packet. Make it
135 # easier for them by providing the configure option
136 # --enable-only-agent.
137 AC_ARG_ENABLE(agent-only,
138 AC_HELP_STRING([--enable-agent-only],[build only the gpg-agent]),
139 build_agent_only=$enableval)
142 # Configure option to allow or disallow execution of external
143 # programs, like a photo viewer.
144 AC_MSG_CHECKING([whether to enable external program execution])
146 AC_HELP_STRING([--disable-exec],[disable all external program execution]),
148 AC_MSG_RESULT($use_exec)
149 if test "$use_exec" = no ; then
150 AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
153 if test "$use_exec" = yes ; then
154 AC_MSG_CHECKING([whether to enable photo ID viewing])
155 AC_ARG_ENABLE(photo-viewers,
156 [ --disable-photo-viewers disable photo ID viewers],
157 [if test "$enableval" = no ; then
158 AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
160 gnupg_cv_enable_photo_viewers=$enableval
161 AC_MSG_RESULT($enableval)
163 if test "$gnupg_cv_enable_photo_viewers" = yes ; then
164 AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
165 AC_ARG_WITH(photo-viewer,
166 [ --with-photo-viewer=FIXED_VIEWER set a fixed photo ID viewer],
167 [if test "$withval" = yes ; then
169 elif test "$withval" != no ; then
170 AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
171 [if set, restrict photo-viewer to this])
173 AC_MSG_RESULT($withval)
176 AC_MSG_CHECKING([whether to enable external keyserver helpers])
177 AC_ARG_ENABLE(keyserver-helpers,
178 [ --disable-keyserver-helpers disable all external keyserver support],
179 [if test "$enableval" = no ; then
180 AC_DEFINE(DISABLE_KEYSERVER_HELPERS,1,
181 [define to disable keyserver helpers])
183 gnupg_cv_enable_keyserver_helpers=$enableval
184 AC_MSG_RESULT($enableval)
186 if test "$gnupg_cv_enable_keyserver_helpers" = yes ; then
187 AC_MSG_CHECKING([whether LDAP keyserver support is requested])
189 [ --disable-ldap disable LDAP keyserver interface],
190 try_ldap=$enableval, try_ldap=yes)
191 AC_MSG_RESULT($try_ldap)
193 AC_MSG_CHECKING([whether HKP keyserver support is requested])
195 [ --disable-hkp disable HKP keyserver interface],
196 try_hkp=$enableval, try_hkp=yes)
197 AC_MSG_RESULT($try_hkp)
199 if test "$try_hkp" = yes ; then
200 AC_SUBST(GPGKEYS_HKP,"gpgkeys_hkp$EXEEXT")
203 AC_MSG_CHECKING([whether email keyserver support is requested])
204 AC_ARG_ENABLE(mailto,
205 [ --disable-mailto disable email keyserver interface],
206 try_mailto=$enableval, try_mailto=yes)
207 AC_MSG_RESULT($try_mailto)
210 AC_MSG_CHECKING([whether keyserver exec-path is enabled])
211 AC_ARG_ENABLE(keyserver-path,
212 [ --disable-keyserver-path disable the exec-path option for keyserver helpers],
213 [if test "$enableval" = no ; then
214 AC_DEFINE(DISABLE_KEYSERVER_PATH,1,[define to disable exec-path for keyserver helpers])
216 AC_MSG_RESULT($enableval)
220 dnl Check whether we want to use Linux capabilities
222 AC_MSG_CHECKING([whether use of capabilities is requested])
223 AC_ARG_WITH(capabilities,
224 [ --with-capabilities use linux capabilities [default=no]],
225 [use_capabilities="$withval"],[use_capabilities=no])
226 AC_MSG_RESULT($use_capabilities)
230 /* Some global constants. */
231 #ifdef HAVE_DRIVE_LETTERS
232 #define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
234 #define GNUPG_DEFAULT_HOMEDIR "/SYS\$LOGIN/gnupg"
236 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
238 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
240 /* Tell libgcrypt not to use its own libgpg-error implementation. */
241 #define USE_LIBGPG_ERROR 1
243 /* This is the major version number of GnuPG so that
244 source included files can test for this. Note, that\
245 we use 2 here even for GnuPG 1.9.x. */
246 #define GNUPG_MAJOR_VERSION 2
248 /* Now to separate file name parts.
249 Please note that the string version must not contain more
250 than one character because the code assumes strlen()==1 */
251 #ifdef HAVE_DOSISH_SYSTEM
252 #define DIRSEP_C '\\'
253 #define DIRSEP_S "\\"
256 #define PATHSEP_C ';'
257 #define PATHSEP_S ";"
258 #define EXEEXT_S ".exe"
264 #define PATHSEP_C ':'
265 #define PATHSEP_S ":"
269 /* This is the same as VERSION, but should be overridden if the
270 platform cannot handle things like dots '.' in filenames. Set
271 SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
272 uses for dots and dashes. */
273 #define SAFE_VERSION VERSION
274 #define SAFE_VERSION_DOT '.'
275 #define SAFE_VERSION_DASH '-'
277 /* For some systems (DOS currently), we hardcode the path here. For
278 POSIX systems the values are constructed by the Makefiles, so that
279 the values may be overridden by the make invocations; this is to
280 comply with the GNU coding standards. */
281 #ifdef HAVE_DRIVE_LETTERS
282 #define GNUPG_BINDIR "c:\\gnupg"
283 #define GNUPG_LIBEXECDIR "c:\\gnupg"
284 #define GNUPG_LIBDIR "c:\\gnupg"
285 #define GNUPG_DATADIR "c:\\gnupg"
288 /* Setup the hardwired names of modules. */
289 #ifndef GNUPG_DEFAULT_AGENT
290 #define GNUPG_DEFAULT_AGENT ( GNUPG_BINDIR DIRSEP_S "gpg-agent" EXEEXT_S )
292 #ifndef GNUPG_DEFAULT_PINENTRY
293 #define GNUPG_DEFAULT_PINENTRY ( GNUPG_BINDIR DIRSEP_S "pinentry" EXEEXT_S )
295 #ifndef GNUPG_DEFAULT_SCDAEMON
296 #define GNUPG_DEFAULT_SCDAEMON ( GNUPG_BINDIR DIRSEP_S "scdaemon" EXEEXT_S )
298 #ifndef GNUPG_DEFAULT_DIRMNGR
299 #define GNUPG_DEFAULT_DIRMNGR ( GNUPG_BINDIR DIRSEP_S "dirmngr" EXEEXT_S )
301 #ifndef GNUPG_DEFAULT_PROTECT_TOOL
302 #define GNUPG_DEFAULT_PROTECT_TOOL \
303 ( GNUPG_LIBEXECDIR DIRSEP_S "gpg-protect-tool" EXEEXT_S )
307 /* Derive some other constants. */
308 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
309 #define EXEC_TEMPFILE_ONLY
312 /* Temporary hacks to avoid requring a libgpg-error update. */
313 #if !HAVE_DECL_GPG_ERR_LOCKED
314 #define GPG_ERR_LOCKED 173
321 # Checks for programs.
324 missing_dir=`cd $ac_aux_dir && pwd`
325 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
326 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
327 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
328 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
329 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
337 AC_CHECK_TOOL(AR, ar, :)
338 AC_PATH_PROG(PERL,"perl")
342 AC_CHECK_PROG(DOCBOOK_TO_MAN, docbook-to-man, yes, no)
343 AM_CONDITIONAL(HAVE_DOCBOOK_TO_MAN, test "$ac_cv_prog_DOCBOOK_TO_MAN" = yes)
345 GNUPG_CHECK_DOCBOOK_TO_TEXI
349 have_dosish_system=no
353 # special stuff for Windoze NT
354 ac_cv_have_dev_random=no
355 AC_DEFINE(USE_ONLY_8DOT3,1,
356 [set this to limit filenames to the 8.3 format])
357 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
358 [defined if we must run on a stupid file system])
359 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
360 [because the Unix gettext has too much overhead on
361 MingW32 systems and these systems lack Posix functions,
362 we use a simplified version of gettext])
363 have_dosish_system=yes
367 i?86-emx-os2 | i?86-*-os2*emx )
368 # OS/2 with the EMX environment
369 ac_cv_have_dev_random=no
370 AC_DEFINE(HAVE_DRIVE_LETTERS)
371 have_dosish_system=yes
376 # DOS with the DJGPP environment
377 ac_cv_have_dev_random=no
378 AC_DEFINE(HAVE_DRIVE_LETTERS)
379 have_dosish_system=yes
385 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
386 LDFLAGS="$LDFLAGS -L/usr/local/lib"
390 if test -z "$GCC" ; then
391 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
395 if test -z "$GCC" ; then
396 # Suppress all warnings
397 # to get rid of the unsigned/signed char mismatch warnings.
402 if test -z "$GCC" ; then
403 # Use the newer compiler `-msg_disable ptrmismatch' to
404 # get rid of the unsigned/signed char mismatch warnings.
405 # Using this may hide other pointer mismatch warnings, but
406 # it at least lets other warning classes through
407 CFLAGS="$CFLAGS -msg_disable ptrmismatch"
416 if test "$have_dosish_system" = yes; then
417 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
418 [Defined if we run on some of the PCDOS like systems
419 (DOS, Windoze. OS/2) with special properties like
422 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
424 if test "$have_w32_system" = yes; then
425 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
427 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
432 # Checks for libraries.
437 # libgpg-error is a library with error codes shared between GnuPG
440 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
441 have_gpg_error=yes,have_gpg_error=no)
442 _tmp_gpg_error_save_cflags="$CFLAGS"
443 CFLAGS="$CFLAGS $GPG_ERROR_CFLAGS"
444 AC_CHECK_DECLS(GPG_ERR_LOCKED,,,[#include <gpg-error.h>])
445 CFLAGS="${_tmp_gpg_error_save_cflags}"
449 # Libgcrypt is our generic crypto library
451 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
452 have_libgcrypt=yes,have_libgcrypt=no)
456 # libassuan is used for IPC
458 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_VERSION",
459 have_libassuan=yes,have_libassuan=no)
463 # libksba is our X.509 support library
465 AM_PATH_KSBA("$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
468 # libusb allows us to use the integrated CCID smartcard reader driver.
470 AC_CHECK_LIB(usb, usb_bulk_write,
471 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
472 AC_DEFINE(HAVE_LIBUSB,1,
473 [defined if libusb is available])
475 AC_SUBST(LIBUSB_LIBS)
476 AC_CHECK_FUNCS(usb_create_match)
479 # Check wether it is necessary to link against libdl.
482 AC_SEARCH_LIBS(dlopen, c dl,,,)
487 # Checks for symcryptrun:
490 # libutil has openpty() and login_tty().
491 AC_CHECK_LIB(util, openpty,
492 [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
493 AC_DEFINE(HAVE_LIBUTIL,1,
494 [defined if libutil is available])
496 AC_SUBST(LIBUTIL_LIBS)
498 # shred is used to clean temporary plain text files.
499 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
500 AC_DEFINE_UNQUOTED(SHRED,
501 "${SHRED}", [defines the filename of the shred program])
505 # Check whether the (highly desirable) GNU Pth library is available
506 # Note, that we include a Pth emulation for W32.
508 AC_ARG_WITH(pth-prefix,
509 AC_HELP_STRING([--with-pth-prefix=PFX],
510 [prefix where GNU Pth is installed (optional)]),
511 pth_config_prefix="$withval", pth_config_prefix="")
512 if test x$pth_config_prefix != x ; then
513 PTH_CONFIG="$pth_config_prefix/bin/pth-config"
515 AC_PATH_PROG(PTH_CONFIG, pth-config, no)
516 if test "$have_w32_system" = no; then
517 if test "$PTH_CONFIG" = "no"; then
520 *** To support concurrent access to the gpg-agent and the SCdaemon
521 *** we need the support of the GNU Portable Threads Library.
522 *** Download it from ftp://ftp.gnu.org/gnu/pth/
523 *** On a Debian GNU/Linux system you might want to try
524 *** apt-get install libpth-dev
527 GNUPG_PTH_VERSION_CHECK(1.3.7)
528 if test $have_pth = yes; then
529 PTH_CFLAGS=`$PTH_CONFIG --cflags`
530 PTH_LIBS=`$PTH_CONFIG --ldflags`
531 PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs`"
532 AC_DEFINE(USE_GNU_PTH, 1,
533 [Defined if the GNU Portable Thread Library should be used])
534 AC_DEFINE(HAVE_PTH, 1,
535 [Defined if the GNU Pth is available])
542 AC_DEFINE(USE_GNU_PTH, 1)
543 AC_DEFINE(HAVE_PTH, 1)
549 dnl Must check for network library requirements before doing link tests
550 dnl for ldap, for example. If ldap libs are static (or dynamic and without
551 dnl ELF runtime link paths), then link will fail and LDAP support won't
554 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
555 [NETLIBS="-lnsl $NETLIBS"]))
556 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
557 [NETLIBS="-lsocket $NETLIBS"]))
559 dnl Now try for the resolver functions so we can use DNS SRV
561 AC_ARG_ENABLE(dns-srv,
562 AC_HELP_STRING([--disable-dns-srv],[disable the use of DNS SRV in HKP]),
563 use_dns_srv=$enableval,use_dns_srv=yes)
565 if test x"$try_hkp" = xyes && test x"$use_dns_srv" = xyes ; then
568 # the double underscore thing is a glibc-ism?
569 AC_SEARCH_LIBS(res_query,resolv bind,,
570 AC_SEARCH_LIBS(__res_query,resolv bind,,use_dns_srv=no))
571 AC_SEARCH_LIBS(dn_expand,resolv bind,,
572 AC_SEARCH_LIBS(__dn_expand,resolv bind,,use_dns_srv=no))
573 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
574 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,use_dns_srv=no))
576 if test x"$use_dns_srv" = xyes ; then
577 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
580 AC_MSG_WARN([Resolver functions not found. Disabling DNS SRV.])
587 # Try and link a LDAP test program to weed out unusable LDAP
588 # libraries. -lldap [-llber [-lresolv]] is for OpenLDAP. OpenLDAP in
589 # general is terrible with creating weird dependencies. If all else
590 # fails, the user can play guess-the-dependency by using something
591 # like ./configure LDAPLIBS="-Lfoo -lbar"
593 if test "$try_ldap" = yes ; then
594 for MY_LDAPLIBS in ${LDAPLIBS+"$LDAPLIBS"} "-lldap" "-lldap -llber" "-lldap -llber -lresolv"; do
595 _ldap_save_libs=$LIBS
596 LIBS="$MY_LDAPLIBS $NETLIBS $LIBS"
598 AC_MSG_CHECKING([whether LDAP via \"$MY_LDAPLIBS\" is present and sane])
599 AC_TRY_LINK([#include <ldap.h>],[ldap_open("foobar",1234);],
600 [gnupg_cv_func_ldap_init=yes],[gnupg_cv_func_ldap_init=no])
601 AC_MSG_RESULT([$gnupg_cv_func_ldap_init])
603 if test $gnupg_cv_func_ldap_init = no; then
604 AC_MSG_CHECKING([whether I can make LDAP be sane with lber.h])
605 AC_TRY_LINK([#include <lber.h>
606 #include <ldap.h>],[ldap_open("foobar",1234);],
607 [gnupg_cv_func_ldaplber_init=yes],[gnupg_cv_func_ldaplber_init=no])
608 AC_MSG_RESULT([$gnupg_cv_func_ldaplber_init])
611 if test "$gnupg_cv_func_ldaplber_init" = yes ; then
612 AC_DEFINE(NEED_LBER_H,1,[Define if the LDAP library requires including lber.h before ldap.h])
615 if test "$gnupg_cv_func_ldap_init" = yes || \
616 test "$gnupg_cv_func_ldaplber_init" = yes ; then
617 LDAPLIBS=$MY_LDAPLIBS
618 GPGKEYS_LDAP="gpgkeys_ldap$EXEEXT"
620 AC_MSG_CHECKING([whether LDAP supports ldap_get_option])
622 if test "$gnupg_cv_func_ldap_init" = yes ; then
623 AC_TRY_LINK([#include <ldap.h>],
624 [ldap_get_option((void *)0,0,(void *)0);],
625 [gnupg_cv_func_ldap_get_option=yes],
626 [gnupg_cv_func_ldap_get_option=no])
628 AC_TRY_LINK([#include <lber.h>
629 #include <ldap.h>],[ldap_get_option((void *)0,0,(void *)0);],
630 [gnupg_cv_func_ldap_get_option=yes],
631 [gnupg_cv_func_ldap_get_option=no])
634 AC_MSG_RESULT([$gnupg_cv_func_ldap_get_option])
636 if test "$gnupg_cv_func_ldap_get_option" = yes ; then
637 AC_DEFINE(HAVE_LDAP_GET_OPTION,1,[Define if the LDAP library has ldap_get_option])
639 AC_MSG_CHECKING([whether LDAP supports ld_errno])
641 if test "$gnupg_cv_func_ldap_init" = yes ; then
642 AC_TRY_COMPILE([#include <ldap.h>],
643 [LDAP *ldap; ldap->ld_errno;],
644 [gnupg_cv_func_ldap_ld_errno=yes],
645 [gnupg_cv_func_ldap_ld_errno=no])
647 AC_TRY_LINK([#include <lber.h>
648 #include <ldap.h>],[LDAP *ldap; ldap->ld_errno;],
649 [gnupg_cv_func_ldap_ld_errno=yes],
650 [gnupg_cv_func_ldap_ld_errno=no])
653 AC_MSG_RESULT([$gnupg_cv_func_ldap_ld_errno])
655 if test "$gnupg_cv_func_ldap_ld_errno" = yes ; then
656 AC_DEFINE(HAVE_LDAP_LD_ERRNO,1,[Define if the LDAP library supports ld_errno])
661 LIBS=$_ldap_save_libs
663 if test "$GPGKEYS_LDAP" != "" ; then break; fi
667 AC_SUBST(GPGKEYS_LDAP)
670 dnl This isn't necessarily sendmail itself, but anything that gives a
671 dnl sendmail-ish interface to the outside world. That includes qmail,
672 dnl postfix, etc. Basically, anything that can handle "sendmail -t".
674 if test "$try_mailto" = yes ; then
675 AC_ARG_WITH(mailprog,[ --with-mailprog=NAME use "NAME -t" for mail transport],,with_mailprog=yes)
677 if test "$with_mailprog" = yes ; then
678 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
679 if test "$ac_cv_path_SENDMAIL" ; then
680 GPGKEYS_MAILTO="gpgkeys_mailto"
682 elif test "$with_mailprog" != no ; then
683 AC_MSG_CHECKING([for a mail transport program])
684 AC_SUBST(SENDMAIL,$with_mailprog)
685 AC_MSG_RESULT($with_mailprog)
686 GPGKEYS_MAILTO="gpgkeys_mailto"
690 AC_SUBST(GPGKEYS_MAILTO)
694 PRINTABLE_OS_NAME="MingW32"
697 PRINTABLE_OS_NAME="Cygwin"
699 i?86-emx-os2 | i?86-*-os2*emx )
700 PRINTABLE_OS_NAME="OS/2"
703 PRINTABLE_OS_NAME="MSDOS/DJGPP"
707 PRINTABLE_OS_NAME="GNU/Linux"
710 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
713 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
714 [A human readable text with the name of the OS])
717 AM_GNU_GETTEXT_VERSION(0.14.1)
718 if test "$try_gettext" = yes; then
719 AM_GNU_GETTEXT(,[need-ngettext])
721 # gettext requires some extra checks. These really should be part of
722 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
723 # function checks to here.
725 AC_CHECK_FUNCS(strchr)
728 USE_INCLUDED_LIBINTL=no
729 BUILD_INCLUDED_LIBINTL=no
731 AC_SUBST(USE_INCLUDED_LIBINTL)
732 AC_SUBST(BUILD_INCLUDED_LIBINTL)
735 # Checks for header files.
737 AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h)
739 # Checks for typedefs, structures, and compiler characteristics.
748 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
749 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
750 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
751 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
752 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
754 AC_CHECK_SIZEOF(unsigned short)
755 AC_CHECK_SIZEOF(unsigned int)
756 AC_CHECK_SIZEOF(unsigned long)
757 AC_CHECK_SIZEOF(unsigned long long)
758 # Ensure that we have UINT64_C before we bother to check for uint64_t
759 # fixme: really needed in gnupg? I think it is only useful in libcgrypt.
760 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
761 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <inttypes.h>
762 uint64_t foo=UINT64_C(42);]),gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
763 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
764 AC_CHECK_SIZEOF(uint64_t)
770 if test "$ac_cv_sizeof_unsigned_short" = "0" \
771 || test "$ac_cv_sizeof_unsigned_int" = "0" \
772 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
773 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
776 dnl Do we have any 64-bit data types?
777 if test "$ac_cv_sizeof_unsigned_int" != "8" \
778 && test "$ac_cv_sizeof_unsigned_long" != "8" \
779 && test "$ac_cv_sizeof_unsigned_long_long" != "8" \
780 && test "$ac_cv_sizeof_uint64_t" != "8"; then
781 AC_MSG_WARN([No 64-bit types. Disabling SHA-384, and SHA-512])
783 if test x"$use_sha512" = xyes ; then
784 AC_SUBST(SHA512_O,sha512.o)
785 AC_DEFINE(USE_SHA512,1,[Define to include the SHA-384 and SHA-512 digests])
789 # fixme: do we really need this - it should be encapsulated in libassuan
790 GNUPG_SYS_SO_PEERCRED
792 # Checks for library functions.
796 AC_CHECK_FUNCS(strerror stpcpy strsep strlwr tcgetattr strtoul mmap)
797 AC_CHECK_FUNCS(strcasecmp strncasecmp ctermid times gmtime_r)
798 AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
799 AC_CHECK_FUNCS(atexit raise getpagesize strftime nl_langinfo setlocale)
800 AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand pipe stat getaddrinfo)
801 AC_CHECK_FUNCS(fseeko ftello ttyname isascii)
803 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
808 gl_MODULES(setenv strsep mkdtemp vasprintf xsize)
811 # These are needed by libjnlib - fixme: we should have macros for them
812 AC_CHECK_FUNCS(memicmp stpcpy strlwr strtoul memmove stricmp strtol)
813 AC_CHECK_FUNCS(getrusage setrlimit stat setlocale)
814 AC_CHECK_FUNCS(flockfile funlockfile fopencookie funopen)
818 # check for gethrtime and run a testprogram to see whether
819 # it is broken. It has been reported that some Solaris and HP UX systems
822 # fixme: Do we need this - iirc, this is only used by libgcrypt.
824 AC_CACHE_CHECK([for gethrtime],
825 [gnupg_cv_func_gethrtime],
826 [AC_TRY_LINK([#include <sys/times.h>],[
830 [gnupg_cv_func_gethrtime=yes],
831 [gnupg_cv_func_gethrtime=no])
833 if test $gnupg_cv_func_gethrtime = yes; then
834 AC_DEFINE([HAVE_GETHRTIME], 1,
835 [Define if you have the `gethrtime(2)' function.])
836 AC_CACHE_CHECK([whether gethrtime is broken],
837 [gnupg_cv_func_broken_gethrtime],
839 #include <sys/times.h>
845 [gnupg_cv_func_broken_gethrtime=no],
846 [gnupg_cv_func_broken_gethrtime=yes],
847 [gnupg_cv_func_broken_gethrtime=assume-no])
849 if test $gnupg_cv_func_broken_gethrtime = yes; then
850 AC_DEFINE([HAVE_BROKEN_GETHRTIME], 1,
851 [Define if `gethrtime(2)' does not work correctly i.e. issues a SIGILL.])
857 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
860 dnl Check whether we can use Linux capabilities as requested
862 # fixme: Still required?
864 if test "$use_capabilities" = "yes" ; then
866 AC_CHECK_HEADERS(sys/capability.h)
867 if test "$ac_cv_header_sys_capability_h" = "yes" ; then
868 AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1)
869 if test "$ac_cv_lib_cap_cap_init" = "yes"; then
870 AC_DEFINE(USE_CAPABILITIES,1,
871 [define if capabilities should be used])
872 AC_SUBST(CAPLIBS,"-lcap")
876 if test "$use_capabilities" = "no" ; then
879 *** The use of capabilities on this system is not possible.
880 *** You need a recent Linux kernel and some patches:
881 *** fcaps-2.2.9-990610.patch (kernel patch for 2.2.9)
882 *** fcap-module-990613.tar.gz (kernel module)
883 *** libcap-1.92.tar.gz (user mode library and utilities)
884 *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN
885 *** set (filesystems menu). Be warned: This code is *really* ALPHA.
891 # Sanity check regex. Tests adapted from mutt.
893 AC_MSG_CHECKING([whether regular expression support is requested])
895 [ --disable-regex do not handle regular expressions in trust sigs],
896 use_regex=$enableval, use_regex=yes)
897 AC_MSG_RESULT($use_regex)
899 if test "$use_regex" = yes ; then
900 AC_MSG_CHECKING([whether the included regex lib is requested])
901 AC_ARG_WITH(included-regex,
902 [ --with-included-regex use the included GNU regex library],
903 [gnupg_cv_included_regex="$withval"],[gnupg_cv_included_regex=no])
904 AC_MSG_RESULT($gnupg_cv_included_regex)
906 if test $gnupg_cv_included_regex = no ; then
907 # Does the system have regex functions at all?
908 AC_CHECK_FUNC(regcomp,gnupg_cv_included_regex=no,
909 gnupg_cv_included_regex=yes)
912 if test $gnupg_cv_included_regex = no ; then
913 AC_CACHE_CHECK([whether your system's regexp library is broken],
914 [gnupg_cv_regex_broken],
918 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); }],
919 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
921 if test $gnupg_cv_regex_broken = yes ; then
922 AC_MSG_WARN(your regex is broken - using the included GNU regex instead.)
923 gnupg_cv_included_regex=yes
927 if test $gnupg_cv_included_regex = yes; then
928 AC_DEFINE(USE_GNU_REGEX,1,[ Define if you want to use the included regex lib ])
929 AC_SUBST(REGEX_O,regex.o)
933 AC_DEFINE(DISABLE_REGEX,1,[ Define to disable regular expression support ])
936 dnl Do we have zlib? Must do it here because Solaris failed
937 dnl when compiling a conftest (due to the "-lz" from LIBS).
938 _cppflags="${CPPFLAGS}"
939 _ldflags="${LDFLAGS}"
942 [ --with-zlib=DIR use libz in DIR],[
943 if test -d "$withval"; then
944 CPPFLAGS="${CPPFLAGS} -I$withval/include"
945 LDFLAGS="${LDFLAGS} -L$withval/lib"
949 AC_CHECK_HEADER(zlib.h,
950 AC_CHECK_LIB(z, deflateInit2_,
952 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
953 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
957 # See wether we want to run the long test suite.
958 AC_ARG_WITH(pkits-tests,
959 AC_HELP_STRING([--with-pkits-tests],[run the PKITS based tests]),
960 [run_pkits_tests=$withval], [run_pkits_tests=no])
961 AM_CONDITIONAL(RUN_PKITS_TESTS, test "$run_pkits_tests" = "yes")
964 # Allow users to append something to the version string without
965 # flagging it as development version. The user version parts is
966 # considered everything after a dash.
967 if test "$development_version" != yes; then
971 if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
972 development_version=yes
975 if test "$development_version" = yes; then
976 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
977 [Defined if this is not a regular release])
980 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
984 # Add some extra libs here so that previous tests don't fail for
985 # mysterious reasons - the final link step should bail out.
986 if test "$have_w32_system" = yes; then
991 if test "$GCC" = yes; then
992 if test "$USE_MAINTAINER_MODE" = "yes"; then
993 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
994 CFLAGS="$CFLAGS -Wno-format-y2k -Wformat-security"
996 CFLAGS="$CFLAGS -Wall"
1004 # We use jnlib, so tell other modules about it
1005 AC_DEFINE(HAVE_JNLIB_LOGGING, 1,
1006 [Defined if jnlib style logging functions are available])
1008 # For W32 we need to use our Pth emulation code
1009 if test "$have_w32_system" = yes; then
1010 AC_CONFIG_LINKS(pth.h:jnlib/w32-pth.h)
1015 # Decide what to build
1018 if test $have_ksba = no; then
1023 build_agent_threaded=""
1024 if test "$build_agent" = "yes"; then
1025 if test $have_pth = no; then
1026 build_agent_threaded="(not multi-threaded)"
1031 build_scdaemon_extra=""
1032 if test "$build_scdaemon" = "yes"; then
1034 if test $have_pth = no; then
1035 build_scdaemon_extra="not multi-threaded"
1039 if test -n "$build_scdaemon_extra"; then
1040 build_scdaemon_extra="(${build_scdaemon_extra})"
1045 if test "$build_agent_only" = "yes" ; then
1052 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
1053 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1054 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1055 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1056 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1061 # Print errors here so that they are visible all
1062 # together and the user can acquire them all together.
1065 if test "$have_gpg_error" = "no"; then
1069 *** You need libgpg-error to build this program.
1070 ** This library is for example available at
1071 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
1072 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1075 if test "$have_libgcrypt" = "no"; then
1079 *** You need libgcrypt to build this program.
1080 ** This library is for example available at
1081 *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1082 *** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API) is required.)
1085 if test "$have_libassuan" = "no"; then
1089 *** You need libassuan to build this program.
1090 *** This library is for example available at
1091 *** ftp://ftp.gnupg.org/gcrypt/alpha/libassuan/
1092 *** (at least version $NEED_LIBASSUAN_VERSION is required).
1095 if test "$have_ksba" = "no"; then
1098 *** You need libksba to build this program.
1099 *** This library is for example available at
1100 *** ftp://ftp.gnupg.org/gcrypt/alpha/libksba/
1101 *** (at least version $NEED_KSBA_VERSION is required).
1104 if test "$missing_pth" = "yes"; then
1107 *** It is now required to build with support for the
1108 *** GNU Portable Threads Library (Pth). Please install this
1109 *** library first. The library is for example available at
1110 *** ftp://ftp.gnu.org/gnu/pth/
1111 *** On a Debian GNU/Linux system you can install it using
1112 *** apt-get install libpth-dev
1117 if test "$die" = "yes"; then
1120 *** Required libraries not found. Please consult the above messages
1121 *** and install them before running configure again.
1127 AC_CONFIG_FILES([ m4/Makefile
1145 #tests/pkits/Makefile
1151 GnuPG v${VERSION} has been configured as follows:
1153 Platform: $PRINTABLE_OS_NAME ($host)
1156 S/MIME: $build_gpgsm
1157 Agent: $build_agent $build_agent_threaded
1158 Smartcard: $build_scdaemon $build_scdaemon_extra
1160 Protect tool: $show_gnupg_protect_tool_pgm
1161 Default agent: $show_gnupg_agent_pgm
1162 Default pinentry: $show_gnupg_pinentry_pgm
1163 Default scdaemon: $show_gnupg_scdaemon_pgm
1164 Default dirmngr: $show_gnupg_dirmngr_pgm
1166 PKITS based tests: $run_pkits_tests