1 # configure.ac - for GnuPG 1.9
2 # Copyright (C) 1998, 1999, 2000, 2001, 2002,
3 # 2003 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.7.6"
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.7-cvs, 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=0.6
35 NEED_LIBGCRYPT_VERSION=1.1.93
37 NEED_LIBASSUAN_VERSION=0.6.4
39 NEED_KSBA_VERSION=0.9.4
41 NEED_OPENSC_VERSION=0.8.0
46 VERSION=$PACKAGE_VERSION
48 AC_CONFIG_AUX_DIR(scripts)
49 AC_CONFIG_SRCDIR(sm/gpgsm.c)
50 AM_CONFIG_HEADER(config.h)
52 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
56 # Some status variables to give feedback at the end of a configure run
64 GNUPG_BUILD_PROGRAM(gpg, yes)
65 GNUPG_BUILD_PROGRAM(gpgsm, yes)
66 GNUPG_BUILD_PROGRAM(agent, yes)
67 GNUPG_BUILD_PROGRAM(scdaemon, yes)
72 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
73 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
74 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
76 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
77 [Required version of Libgcrypt])
78 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
79 [Required version of Libksba])
83 # The default is to use the modules from this package and the few
84 # other packages in a standard place; i.e where this package gets
85 # installed. With these options it is possible to override these
86 # ${prefix} depended values with fixed paths, which can't be replaced
87 # at make time. See also am/cmacros.am and the defaults in AH_BOTTOM.
88 AC_ARG_WITH(agent-pgm,
89 [ --with-agent-pgm=PATH Use PATH as the default for the agent)],
90 GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
91 AC_SUBST(GNUPG_AGENT_PGM)
92 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
93 show_gnupg_agent_pgm="(default)"
94 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
96 AC_ARG_WITH(pinentry-pgm,
97 [ --with-pinentry-pgm=PATH Use PATH as the default for the pinentry)],
98 GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
99 AC_SUBST(GNUPG_PINENTRY_PGM)
100 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
101 show_gnupg_pinentry_pgm="(default)"
102 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
105 AC_ARG_WITH(scdaemon-pgm,
106 [ --with-scdaemon-pgm=PATH Use PATH as the default for the scdaemon)],
107 GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
108 AC_SUBST(GNUPG_SCDAEMON_PGM)
109 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
110 show_gnupg_scdaemon_pgm="(default)"
111 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
114 AC_ARG_WITH(dirmngr-pgm,
115 [ --with-dirmngr-pgm=PATH Use PATH as the default for the dirmngr)],
116 GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
117 AC_SUBST(GNUPG_DIRMNGR_PGM)
118 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
119 show_gnupg_dirmngr_pgm="(default)"
120 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
122 AC_ARG_WITH(protect-tool-pgm,
123 [ --with-protect-tool-pgm=PATH Use PATH as the default for the protect-tool)],
124 GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
125 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
126 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
127 show_gnupg_protect_tool_pgm="(default)"
128 test -n "$GNUPG_PROTECT_TOOL_PGM" \
129 && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
133 # Configure option to allow ot disallow execution of external
134 # programs, like a photo viewer.
135 AC_MSG_CHECKING([whether to enable external program execution])
137 AC_HELP_STRING([--disable-exec],[disable all external program execution]),
139 AC_MSG_RESULT($use_exec)
140 if test "$use_exec" = no ; then
141 AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
144 if test "$use_exec" = yes ; then
145 AC_MSG_CHECKING([whether to enable photo ID viewing])
146 AC_ARG_ENABLE(photo-viewers,
147 [ --disable-photo-viewers disable photo ID viewers],
148 [if test "$enableval" = no ; then
149 AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
151 gnupg_cv_enable_photo_viewers=$enableval
152 AC_MSG_RESULT($enableval)
154 if test "$gnupg_cv_enable_photo_viewers" = yes ; then
155 AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
156 AC_ARG_WITH(photo-viewer,
157 [ --with-photo-viewer=FIXED_VIEWER set a fixed photo ID viewer],
158 [if test "$withval" = yes ; then
160 elif test "$withval" != no ; then
161 AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
162 [if set, restrict photo-viewer to this])
164 AC_MSG_RESULT($withval)
167 AC_MSG_CHECKING([whether to enable external keyserver helpers])
168 AC_ARG_ENABLE(keyserver-helpers,
169 [ --disable-keyserver-helpers disable all external keyserver support],
170 [if test "$enableval" = no ; then
171 AC_DEFINE(DISABLE_KEYSERVER_HELPERS,1,
172 [define to disable keyserver helpers])
174 gnupg_cv_enable_keyserver_helpers=$enableval
175 AC_MSG_RESULT($enableval)
177 if test "$gnupg_cv_enable_keyserver_helpers" = yes ; then
178 AC_MSG_CHECKING([whether LDAP keyserver support is requested])
180 [ --disable-ldap disable LDAP keyserver interface],
181 try_ldap=$enableval, try_ldap=yes)
182 AC_MSG_RESULT($try_ldap)
184 AC_MSG_CHECKING([whether HKP keyserver support is requested])
186 [ --disable-hkp disable HKP keyserver interface],
187 try_hkp=$enableval, try_hkp=yes)
188 AC_MSG_RESULT($try_hkp)
190 if test "$try_hkp" = yes ; then
191 AC_SUBST(GPGKEYS_HKP,"gpgkeys_hkp$EXEEXT")
194 AC_MSG_CHECKING([whether email keyserver support is requested])
195 AC_ARG_ENABLE(mailto,
196 [ --disable-mailto disable email keyserver interface],
197 try_mailto=$enableval, try_mailto=yes)
198 AC_MSG_RESULT($try_mailto)
201 AC_MSG_CHECKING([whether keyserver exec-path is enabled])
202 AC_ARG_ENABLE(keyserver-path,
203 [ --disable-keyserver-path disable the exec-path option for keyserver helpers],
204 [if test "$enableval" = no ; then
205 AC_DEFINE(DISABLE_KEYSERVER_PATH,1,[define to disable exec-path for keyserver helpers])
207 AC_MSG_RESULT($enableval)
210 AC_MSG_CHECKING([whether the included zlib is requested])
211 AC_ARG_WITH(included-zlib,
212 [ --with-included-zlib use the zlib code included here],
213 [g10_force_zlib=yes], [g10_force_zlib=no] )
214 AC_MSG_RESULT($g10_force_zlib)
217 dnl Check whether we want to use Linux capabilities
219 AC_MSG_CHECKING([whether use of capabilities is requested])
220 AC_ARG_WITH(capabilities,
221 [ --with-capabilities use linux capabilities [default=no]],
222 [use_capabilities="$withval"],[use_capabilities=no])
223 AC_MSG_RESULT($use_capabilities)
227 /* Some global constants. */
228 #ifdef HAVE_DRIVE_LETTERS
229 #define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
231 #define GNUPG_DEFAULT_HOMEDIR "/SYS\$LOGIN/gnupg"
233 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
235 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
237 /* Tell libgcrypt not to use its own libgpg-error implementation. */
238 #define USE_LIBGPG_ERROR 1
240 /* This is the major version number of GnuPG so that
241 source included files can test for this. Note, that\
242 we use 2 here even for GnuPG 1.9.x. */
243 #define GNUPG_MAJOR_VERSION 2
245 /* Now to separate file name parts.
246 Please note that the string version must not contain more
247 than one character because the code assumes strlen()==1 */
248 #ifdef HAVE_DOSISH_SYSTEM
249 #define DIRSEP_C '\\'
251 #define DIRSEP_S "\\"
260 /* This is the same as VERSION, but should be overridden if the
261 platform cannot handle things like dots '.' in filenames. */
262 #define SAFE_VERSION VERSION
264 /* For some systems (DOS currently), we hardcode the path here. For
265 POSIX systems the values are constructed by the Makefiles, so that
266 the values may be overridden by the make invocations; this is to
267 comply with the GNU coding standards. */
268 #ifdef HAVE_DRIVE_LETTERS
269 #define GNUPG_BINDIR "c:\\gnupg"
270 #define GNUPG_LIBEXECDIR "c:\\lib\\gnupg"
271 #define GNUPG_LIBDIR "c:\\lib\\gnupg"
272 #define GNUPG_DATADIR "c:\\lib\\gnupg"
275 /* Setup the hardwired names of modules. */
276 #ifndef GNUPG_DEFAULT_AGENT
277 #define GNUPG_DEFAULT_AGENT ( GNUPG_BINDIR DIRSEP_S "gpg-agent" )
279 #ifndef GNUPG_DEFAULT_PINENTRY
280 #define GNUPG_DEFAULT_PINENTRY ( GNUPG_BINDIR DIRSEP_S "pinentry" )
282 #ifndef GNUPG_DEFAULT_SCDAEMON
283 #define GNUPG_DEFAULT_SCDAEMON ( GNUPG_BINDIR DIRSEP_S "scdaemon" )
285 #ifndef GNUPG_DEFAULT_DIRMNGR
286 #define GNUPG_DEFAULT_DIRMNGR ( GNUPG_BINDIR DIRSEP_S "dirmngr" )
288 #ifndef GNUPG_DEFAULT_PROTECT_TOOL
289 #define GNUPG_DEFAULT_PROTECT_TOOL \
290 ( GNUPG_LIBEXECDIR DIRSEP_S "gpg-protect-tool" )
294 /* Derive some other constants. */
295 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
296 #define EXEC_TEMPFILE_ONLY
303 # Checks for programs.
306 missing_dir=`cd $ac_aux_dir && pwd`
307 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
308 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
309 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
310 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
311 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
319 AC_CHECK_TOOL(AR, ar, :)
320 AC_PATH_PROG(PERL,"perl")
323 AC_CHECK_PROG(DOCBOOK_TO_MAN, docbook-to-man, yes, no)
324 AM_CONDITIONAL(HAVE_DOCBOOK_TO_MAN, test "$ac_cv_prog_DOCBOOK_TO_MAN" = yes)
326 GNUPG_CHECK_DOCBOOK_TO_TEXI
330 have_dosish_system=no
333 # special stuff for Windoze NT
334 ac_cv_have_dev_random=no
335 AC_DEFINE(USE_ONLY_8DOT3,1,
336 [set this to limit filenames to the 8.3 format])
337 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
338 [defined if we must run on a stupid file system])
339 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
340 [because the Unix gettext has too much overhead on
341 MingW32 systems and these systems lack Posix functions,
342 we use a simplified version of gettext])
343 have_dosish_system=yes
346 i?86-emx-os2 | i?86-*-os2*emx )
347 # OS/2 with the EMX environment
348 ac_cv_have_dev_random=no
349 AC_DEFINE(HAVE_DRIVE_LETTERS)
350 have_dosish_system=yes
355 # DOS with the DJGPP environment
356 ac_cv_have_dev_random=no
357 AC_DEFINE(HAVE_DRIVE_LETTERS)
358 have_dosish_system=yes
364 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
365 LDFLAGS="$LDFLAGS -L/usr/local/lib"
369 if test -z "$GCC" ; then
370 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
374 if test -z "$GCC" ; then
375 # Suppress all warnings
376 # to get rid of the unsigned/signed char mismatch warnings.
381 if test -z "$GCC" ; then
382 # Use the newer compiler `-msg_disable ptrmismatch' to
383 # get rid of the unsigned/signed char mismatch warnings.
384 # Using this may hide other pointer mismatch warnings, but
385 # it at least lets other warning classes through
386 CFLAGS="$CFLAGS -msg_disable ptrmismatch"
395 if test "$have_dosish_system" = yes; then
396 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
397 [defined if we run on some of the PCDOS like systems
398 (DOS, Windoze. OS/2) with special properties like
401 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
405 # Checks for libraries.
410 # libgpg-error is a library with error codes shared between GnuPG
413 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
414 have_gpg_error=yes,have_gpg_error=no)
418 # Libgcrypt is our generic crypto library
420 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
421 have_libgcrypt=yes,have_libgcrypt=no)
425 # libassuan is used for IPC
427 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_VERSION",
428 have_libassuan=yes,have_libassuan=no)
432 # libksba is our X.509 support library
434 AM_PATH_KSBA("$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
437 # libusb allows us to use the integrated CCID smartcard reader driver.
439 # Note, that we need the CVS version. FIXME: libusb should have a
440 # regular check as the other libraries do.
442 AC_CHECK_LIB(usb, usb_find_device,
443 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
444 AC_DEFINE(HAVE_LIBUSB,1,
445 [defined if libusb is available])
447 AC_SUBST(LIBUSB_LIBS)
451 # OpenSC is needed by the SCdaemon - if it is not availbale we can only
452 # build a limited SCdaemon
454 AM_PATH_OPENSC("$NEED_OPENSC_VERSION",have_opensc=yes,have_opensc=no)
455 if test $have_opensc = yes; then
456 AC_DEFINE(HAVE_OPENSC,1,
457 [defined if the OpenSC library is available])
461 # Check whether the (highly desirable) GNU Pth library is available
463 AC_ARG_WITH(pth-prefix,
464 AC_HELP_STRING([--with-pth-prefix=PFX],
465 [prefix where GNU Pth is installed (optional)]),
466 pth_config_prefix="$withval", pth_config_prefix="")
467 if test x$pth_config_prefix != x ; then
468 PTH_CONFIG="$pth_config_prefix/bin/pth-config"
470 AC_PATH_PROG(PTH_CONFIG, pth-config, no)
471 if test "$PTH_CONFIG" = "no"; then
474 *** To support concurrent access to the gpg-agent and the SCdaemon
475 *** we need the support of the GNU Portable Threads Library.
476 *** Download it from ftp://ftp.gnu.org/gnu/pth/
477 *** On a Debian GNU/Linux system you might want to try
478 *** apt-get install libpth-dev
481 GNUPG_PTH_VERSION_CHECK(1.3.7)
482 if test $have_pth = yes; then
483 PTH_CFLAGS=`$PTH_CONFIG --cflags`
484 PTH_LIBS=`$PTH_CONFIG --ldflags`
485 PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs`"
486 AC_DEFINE(USE_GNU_PTH, 1,
487 [Defined if the GNU Portable Thread Library should be used])
493 AC_ARG_ENABLE(threads,
494 AC_HELP_STRING([--disable-threads],[allow building without Pth support]);
499 dnl Must check for network library requirements before doing link tests
500 dnl for ldap, for example. If ldap libs are static (or dynamic and without
501 dnl ELF runtime link paths), then link will fail and LDAP support won't
504 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
505 [NETLIBS="-lnsl $NETLIBS"]))
506 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
507 [NETLIBS="-lsocket $NETLIBS"]))
509 dnl Now try for the resolver functions so we can use DNS SRV
511 AC_ARG_ENABLE(dns-srv,
512 AC_HELP_STRING([--disable-dns-srv],[disable the use of DNS SRV in HKP]),
513 use_dns_srv=$enableval,use_dns_srv=yes)
515 if test x"$try_hkp" = xyes && test x"$use_dns_srv" = xyes ; then
518 # the double underscore thing is a glibc-ism?
519 AC_SEARCH_LIBS(res_query,resolv bind,,
520 AC_SEARCH_LIBS(__res_query,resolv bind,,use_dns_srv=no))
521 AC_SEARCH_LIBS(dn_expand,resolv bind,,
522 AC_SEARCH_LIBS(__dn_expand,resolv bind,,use_dns_srv=no))
523 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
524 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,use_dns_srv=no))
526 if test x"$use_dns_srv" = xyes ; then
527 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
530 AC_MSG_WARN([Resolver functions not found. Disabling DNS SRV.])
537 # Try and link a LDAP test program to weed out unusable LDAP
538 # libraries. -lldap [-llber [-lresolv]] is for OpenLDAP. OpenLDAP in
539 # general is terrible with creating weird dependencies. If all else
540 # fails, the user can play guess-the-dependency by using something
541 # like ./configure LDAPLIBS="-Lfoo -lbar"
543 if test "$try_ldap" = yes ; then
544 for MY_LDAPLIBS in ${LDAPLIBS+"$LDAPLIBS"} "-lldap" "-lldap -llber" "-lldap -llber -lresolv"; do
545 _ldap_save_libs=$LIBS
546 LIBS="$MY_LDAPLIBS $NETLIBS $LIBS"
548 AC_MSG_CHECKING([whether LDAP via \"$MY_LDAPLIBS\" is present and sane])
549 AC_TRY_LINK([#include <ldap.h>],[ldap_open("foobar",1234);],
550 [gnupg_cv_func_ldap_init=yes],[gnupg_cv_func_ldap_init=no])
551 AC_MSG_RESULT([$gnupg_cv_func_ldap_init])
553 if test $gnupg_cv_func_ldap_init = no; then
554 AC_MSG_CHECKING([whether I can make LDAP be sane with lber.h])
555 AC_TRY_LINK([#include <lber.h>
556 #include <ldap.h>],[ldap_open("foobar",1234);],
557 [gnupg_cv_func_ldaplber_init=yes],[gnupg_cv_func_ldaplber_init=no])
558 AC_MSG_RESULT([$gnupg_cv_func_ldaplber_init])
561 if test "$gnupg_cv_func_ldaplber_init" = yes ; then
562 AC_DEFINE(NEED_LBER_H,1,[Define if the LDAP library requires including lber.h before ldap.h])
565 if test "$gnupg_cv_func_ldap_init" = yes || \
566 test "$gnupg_cv_func_ldaplber_init" = yes ; then
567 LDAPLIBS=$MY_LDAPLIBS
568 GPGKEYS_LDAP="gpgkeys_ldap$EXEEXT"
570 AC_MSG_CHECKING([whether LDAP supports ldap_get_option])
572 if test "$gnupg_cv_func_ldap_init" = yes ; then
573 AC_TRY_LINK([#include <ldap.h>],
574 [ldap_get_option((void *)0,0,(void *)0);],
575 [gnupg_cv_func_ldap_get_option=yes],
576 [gnupg_cv_func_ldap_get_option=no])
578 AC_TRY_LINK([#include <lber.h>
579 #include <ldap.h>],[ldap_get_option((void *)0,0,(void *)0);],
580 [gnupg_cv_func_ldap_get_option=yes],
581 [gnupg_cv_func_ldap_get_option=no])
584 AC_MSG_RESULT([$gnupg_cv_func_ldap_get_option])
586 if test "$gnupg_cv_func_ldap_get_option" = yes ; then
587 AC_DEFINE(HAVE_LDAP_GET_OPTION,1,[Define if the LDAP library has ldap_get_option])
589 AC_MSG_CHECKING([whether LDAP supports ld_errno])
591 if test "$gnupg_cv_func_ldap_init" = yes ; then
592 AC_TRY_COMPILE([#include <ldap.h>],
593 [LDAP *ldap; ldap->ld_errno;],
594 [gnupg_cv_func_ldap_ld_errno=yes],
595 [gnupg_cv_func_ldap_ld_errno=no])
597 AC_TRY_LINK([#include <lber.h>
598 #include <ldap.h>],[LDAP *ldap; ldap->ld_errno;],
599 [gnupg_cv_func_ldap_ld_errno=yes],
600 [gnupg_cv_func_ldap_ld_errno=no])
603 AC_MSG_RESULT([$gnupg_cv_func_ldap_ld_errno])
605 if test "$gnupg_cv_func_ldap_ld_errno" = yes ; then
606 AC_DEFINE(HAVE_LDAP_LD_ERRNO,1,[Define if the LDAP library supports ld_errno])
611 LIBS=$_ldap_save_libs
613 if test "$GPGKEYS_LDAP" != "" ; then break; fi
617 AC_SUBST(GPGKEYS_LDAP)
620 dnl This isn't necessarily sendmail itself, but anything that gives a
621 dnl sendmail-ish interface to the outside world. That includes qmail,
622 dnl postfix, etc. Basically, anything that can handle "sendmail -t".
624 if test "$try_mailto" = yes ; then
625 AC_ARG_WITH(mailprog,[ --with-mailprog=NAME use "NAME -t" for mail transport],,with_mailprog=yes)
627 if test "$with_mailprog" = yes ; then
628 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
629 if test "$ac_cv_path_SENDMAIL" ; then
630 GPGKEYS_MAILTO="gpgkeys_mailto"
632 elif test "$with_mailprog" != no ; then
633 AC_MSG_CHECKING([for a mail transport program])
634 AC_SUBST(SENDMAIL,$with_mailprog)
635 AC_MSG_RESULT($with_mailprog)
636 GPGKEYS_MAILTO="gpgkeys_mailto"
640 AC_SUBST(GPGKEYS_MAILTO)
644 PRINTABLE_OS_NAME="MingW32"
647 PRINTABLE_OS_NAME="Cygwin"
649 i?86-emx-os2 | i?86-*-os2*emx )
650 PRINTABLE_OS_NAME="OS/2"
653 PRINTABLE_OS_NAME="MSDOS/DJGPP"
657 PRINTABLE_OS_NAME="GNU/Linux"
660 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
663 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
664 [A human readable text with the name of the OS])
667 AM_GNU_GETTEXT_VERSION(0.12.1)
668 if test "$try_gettext" = yes; then
669 AM_GNU_GETTEXT(,[need-ngettext])
671 # gettext requires some extra checks. These really should be part of
672 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
673 # function checks to here.
675 AC_CHECK_FUNCS(strchr)
678 USE_INCLUDED_LIBINTL=no
679 BUILD_INCLUDED_LIBINTL=no
681 AC_SUBST(USE_INCLUDED_LIBINTL)
682 AC_SUBST(BUILD_INCLUDED_LIBINTL)
685 # Checks for header files.
687 AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h)
689 # Checks for typedefs, structures, and compiler characteristics.
698 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
699 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
700 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
701 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
702 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
704 AC_CHECK_SIZEOF(unsigned short)
705 AC_CHECK_SIZEOF(unsigned int)
706 AC_CHECK_SIZEOF(unsigned long)
707 AC_CHECK_SIZEOF(unsigned long long)
708 # Ensure that we have UINT64_C before we bother to check for uint64_t
709 # fixme: really needed in gnupg? I think it is only useful in libcgrypt.
710 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
711 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <inttypes.h>
712 uint64_t foo=UINT64_C(42);]),gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
713 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
714 AC_CHECK_SIZEOF(uint64_t)
720 if test "$ac_cv_sizeof_unsigned_short" = "0" \
721 || test "$ac_cv_sizeof_unsigned_int" = "0" \
722 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
723 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
726 dnl Do we have any 64-bit data types?
727 if test "$ac_cv_sizeof_unsigned_int" != "8" \
728 && test "$ac_cv_sizeof_unsigned_long" != "8" \
729 && test "$ac_cv_sizeof_unsigned_long_long" != "8" \
730 && test "$ac_cv_sizeof_uint64_t" != "8"; then
731 AC_MSG_WARN([No 64-bit types. Disabling SHA-384, and SHA-512])
733 if test x"$use_sha512" = xyes ; then
734 AC_SUBST(SHA512_O,sha512.o)
735 AC_DEFINE(USE_SHA512,1,[Define to include the SHA-384 and SHA-512 digests])
739 GNUPG_SYS_SO_PEERCRED
741 # Checks for library functions.
745 AC_CHECK_FUNCS(strerror stpcpy strsep strlwr tcgetattr strtoul mmap)
746 AC_CHECK_FUNCS(strcasecmp strncasecmp ctermid times gmtime_r)
747 AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
748 AC_CHECK_FUNCS(atexit raise getpagesize strftime nl_langinfo setlocale)
749 AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand pipe stat getaddrinfo)
751 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
753 # These are needed by libjnlib - fixme: we should have macros for them
754 AC_CHECK_FUNCS(memicmp stpcpy strlwr strtoul memmove stricmp strtol)
755 AC_CHECK_FUNCS(getrusage setrlimit stat setlocale)
756 AC_CHECK_FUNCS(flockfile funlockfile fopencookie funopen)
758 AC_REPLACE_FUNCS(vasprintf)
759 AC_REPLACE_FUNCS(fopencookie)
760 AC_REPLACE_FUNCS(mkdtemp)
761 AC_REPLACE_FUNCS(fseeko ftello)
762 AC_REPLACE_FUNCS(isascii)
763 AC_REPLACE_FUNCS(putc_unlocked)
769 # check for gethrtime and run a testprogram to see whether
770 # it is broken. It has been reported that some Solaris and HP UX systems
773 AC_CACHE_CHECK([for gethrtime],
774 [gnupg_cv_func_gethrtime],
775 [AC_TRY_LINK([#include <sys/times.h>],[
779 [gnupg_cv_func_gethrtime=yes],
780 [gnupg_cv_func_gethrtime=no])
782 if test $gnupg_cv_func_gethrtime = yes; then
783 AC_DEFINE([HAVE_GETHRTIME], 1,
784 [Define if you have the `gethrtime(2)' function.])
785 AC_CACHE_CHECK([whether gethrtime is broken],
786 [gnupg_cv_func_broken_gethrtime],
788 #include <sys/times.h>
794 [gnupg_cv_func_broken_gethrtime=no],
795 [gnupg_cv_func_broken_gethrtime=yes],
796 [gnupg_cv_func_broken_gethrtime=assume-no])
798 if test $gnupg_cv_func_broken_gethrtime = yes; then
799 AC_DEFINE([HAVE_BROKEN_GETHRTIME], 1,
800 [Define if `gethrtime(2)' does not work correctly i.e. issues a SIGILL.])
806 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
809 dnl Check whether we can use Linux capabilities as requested
811 if test "$use_capabilities" = "yes" ; then
813 AC_CHECK_HEADERS(sys/capability.h)
814 if test "$ac_cv_header_sys_capability_h" = "yes" ; then
815 AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1)
816 if test "$ac_cv_lib_cap_cap_init" = "yes"; then
817 AC_DEFINE(USE_CAPABILITIES,1,
818 [define if capabilities should be used])
819 AC_SUBST(CAPLIBS,"-lcap")
823 if test "$use_capabilities" = "no" ; then
826 *** The use of capabilities on this system is not possible.
827 *** You need a recent Linux kernel and some patches:
828 *** fcaps-2.2.9-990610.patch (kernel patch for 2.2.9)
829 *** fcap-module-990613.tar.gz (kernel module)
830 *** libcap-1.92.tar.gz (user mode library and utilities)
831 *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN
832 *** set (filesystems menu). Be warned: This code is *really* ALPHA.
838 # Sanity check regex. Tests adapted from mutt.
840 AC_MSG_CHECKING([whether regular expression support is requested])
842 [ --disable-regex do not handle regular expressions in trust sigs],
843 use_regex=$enableval, use_regex=yes)
844 AC_MSG_RESULT($use_regex)
846 if test "$use_regex" = yes ; then
847 AC_MSG_CHECKING([whether the included regex lib is requested])
848 AC_ARG_WITH(included-regex,
849 [ --with-included-regex use the included GNU regex library],
850 [gnupg_cv_included_regex=yes],[gnupg_cv_included_regex=no])
851 AC_MSG_RESULT($gnupg_cv_included_regex)
853 if test $gnupg_cv_included_regex = no ; then
854 # Does the system have regex functions at all?
855 AC_CHECK_FUNC(regcomp,gnupg_cv_included_regex=no,
856 gnupg_cv_included_regex=yes)
859 if test $gnupg_cv_included_regex = no ; then
860 AC_CACHE_CHECK([whether your system's regexp library is broken],
861 [gnupg_cv_regex_broken],
865 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); }],
866 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
868 if test $gnupg_cv_regex_broken = yes ; then
869 AC_MSG_WARN(your regex is broken - using the included GNU regex instead.)
870 gnupg_cv_included_regex=yes
874 if test $gnupg_cv_included_regex = yes; then
875 AC_DEFINE(USE_GNU_REGEX,1,[ Define if you want to use the included regex lib ])
876 AC_SUBST(REGEX_O,regex.o)
880 AC_DEFINE(DISABLE_REGEX,1,[ Define to disable regular expression support ])
883 dnl Do we have zlib? Must do it here because Solaris failed
884 dnl when compiling a conftest (due to the "-lz" from LIBS).
886 if test "$g10_force_zlib" = "yes"; then
889 _cppflags="${CPPFLAGS}"
890 _ldflags="${LDFLAGS}"
893 [ --with-zlib=DIR use libz in DIR],[
894 if test -d "$withval"; then
895 CPPFLAGS="${CPPFLAGS} -I$withval/include"
896 LDFLAGS="${LDFLAGS} -L$withval/lib"
900 AC_CHECK_HEADER(zlib.h,
901 AC_CHECK_LIB(z, deflateInit2_,
904 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
905 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
908 if test "$use_local_zlib" = yes ; then
909 AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
910 AC_CONFIG_LINKS(zlib.h:zlib/zlib.h zconf.h:zlib/zconf.h )
911 ZLIBS="../zlib/libzlib.a"
913 AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
918 # Allow users to append something to the version string without
919 # flagging it as development version. The user version parts is
920 # considered everything after a dash.
921 if test "$development_version" != yes; then
925 if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
926 development_version=yes
929 if test "$development_version" = yes; then
930 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
931 [Defined if this is not a regular release])
934 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
938 # add some extra libs here so that previous tests don't fail for
939 # mysterious reasons - the final link step should bail out.
949 if test "$GCC" = yes; then
950 if test "$USE_MAINTAINER_MODE" = "yes"; then
951 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
952 CFLAGS="$CFLAGS -Wformat-nonliteral"
954 CFLAGS="$CFLAGS -Wall"
962 # We use jnlib, so tell other modules about it
963 AC_DEFINE(HAVE_JNLIB_LOGGING, 1,
964 [Defined if jnlib style logging fucntions are available])
969 # Decide what to build
972 if test $have_ksba = no; then
977 build_agent_threaded=""
978 if test "$build_agent" = "yes"; then
979 if test $have_pth = no; then
980 build_agent_threaded="(not multi-threaded)"
985 build_scdaemon_extra=""
986 if test "$build_scdaemon" = "yes"; then
988 if test $have_pth = no; then
989 build_scdaemon_extra="not multi-threaded"
993 if test $have_opensc = no; then
994 build_scdaemon_extra="${build_scdaemon_extra}${tmp}no pkcs#15"
997 if test -n "$build_scdaemon_extra"; then
998 build_scdaemon_extra="(${build_scdaemon_extra})"
1002 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
1003 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1004 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1005 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1010 # Print errors here so that they are visible all
1011 # together and the user can acquire them all together.
1014 if test "$have_gpg_error" = "no"; then
1018 *** You need libgpg-error to build this program.
1019 ** This library is for example available at
1020 *** ftp://ftp.gnupg.org/gcrypt/alpha/libgpg-error
1021 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1024 if test "$have_libgcrypt" = "no"; then
1028 *** You need libgcrypt to build this program.
1029 ** This library is for example available at
1030 *** ftp://ftp.gnupg.org/gcrypt/alpha/libgcrypt/
1031 *** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API) is required.)
1034 if test "$have_libassuan" = "no"; then
1038 *** You need libassuan to build this program.
1039 *** This library is for example available at
1040 *** ftp://ftp.gnupg.org/gcrypt/alpha/libassuan/
1041 *** (at least version $NEED_LIBASSUAN_VERSION is required).
1044 if test "$have_ksba" = "no"; then
1048 *** You need libksba to build this program.
1049 *** This library is for example available at
1050 *** ftp://ftp.gnupg.org/gcrypt/alpha/libksba/
1051 *** (at least version $NEED_KSBA_VERSION is required).
1054 if test "$missing_pth" = "yes"; then
1057 *** It is strongly suggested to build with support for the
1058 *** GNU Portable Threads Library (Pth). Please install this
1059 *** library first or use --disable-threads to allow building
1060 *** anyway. The library is for example available at
1061 *** ftp://ftp.gnu.org/gnu/pth/
1062 *** On a Debian GNU/Linux system you can install it using
1063 *** apt-get install libpth-dev
1065 if test "$enable_threads" != "no"; then
1070 if test "$die" = "yes"; then
1073 *** Required libraries not found. Please consult the above messages
1074 *** and install them before running configure again.
1080 AC_CONFIG_FILES([ m4/Makefile
1101 GnuPG v${VERSION} has been configured as follows:
1103 Platform: $PRINTABLE_OS_NAME ($target)
1106 S/MIME: $build_gpgsm
1107 Agent: $build_agent $build_agent_threaded
1108 Smartcard: $build_scdaemon $build_scdaemon_extra
1110 Protect tool: $show_gnupg_protect_tool_pgm
1111 Default agent: $show_gnupg_agent_pgm
1112 Default pinentry: $show_gnupg_pinentry_pgm
1113 Default scdaemon: $show_gnupg_scdaemon_pgm
1114 Default dirmngr: $show_gnupg_dirmngr_pgm