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 # Version number: Remember to change it immediately *after* a release.
24 # Add a "-cvs" prefix for non-released code.
25 AC_INIT(gnupg, 1.9.2-cvs, gnupg-devel@gnupg.org)
26 # Set development_version to yes if the minor number is odd or you
27 # feel that the default check for a development version is not
29 development_version=yes
30 NEED_GPG_ERROR_VERSION=0.4
31 NEED_LIBGCRYPT_VERSION=1.1.43
32 NEED_LIBASSUAN_VERSION=0.6.0
33 NEED_KSBA_VERSION=0.4.6
34 NEED_OPENSC_VERSION=0.8.0
38 VERSION=$PACKAGE_VERSION
40 AM_GNU_GETTEXT_VERSION(0.11.5)
42 AC_CONFIG_AUX_DIR(scripts)
43 AC_CONFIG_SRCDIR(sm/gpgsm.c)
44 AM_CONFIG_HEADER(config.h)
46 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
50 # Some status variables to give feedback at the end of a configure run
58 GNUPG_BUILD_PROGRAM(gpg, yes)
59 GNUPG_BUILD_PROGRAM(gpgsm, yes)
60 GNUPG_BUILD_PROGRAM(agent, yes)
61 GNUPG_BUILD_PROGRAM(scdaemon, yes)
66 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
67 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
68 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
70 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
71 [Required version of Libgcrypt])
72 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
73 [Required version of Libksba])
78 # I know that it is in general not a good idea to evaluate bindir in
79 # the configuration but we want to hard code the defaults into some of
80 # the programs and doing this during a make install is not a good
81 # idea. We also have the problem that 2 of the programs are included
82 # in the package but the others are distributed in other packages.
83 eval my_default_bindir=${exec_prefix}
84 test "x${my_default_bindir}" = xNONE && my_default_bindir=${ac_default_prefix}
85 my_default_bindir=${my_default_bindir}/bin
87 # Same goes for the pkglibdir which is used to call the gpg-protect-tool.
88 eval my_default_pkglibdir=${exec_prefix}
89 test "x${my_default_pkglibdir}" = xNONE && my_default_pkglibdir=${ac_default_prefix}
90 my_default_pkglibdir=${my_default_pkglibdir}/lib/${PACKAGE_NAME}
92 AC_ARG_WITH(agent-pgm,
93 [ --with-agent-pgm=PATH Use PATH as the default for the gpg-agent)],
94 gnupg_agent_pgm="$withval",
95 gnupg_agent_pgm="${my_default_bindir}/gpg-agent" )
96 AC_DEFINE_UNQUOTED(GNUPG_DEFAULT_AGENT, "$gnupg_agent_pgm",
97 [Default location of the gpg-agent program])
98 AC_ARG_WITH(pinentry-pgm,
99 [ --with-pinentry-pgm=PATH Use PATH as the default for the pinentry)],
100 gnupg_pinentry_pgm="$withval", gnupg_pinentry_pgm="" )
101 if test -z "$gnupg_pinentry_pgm"; then
102 gnupg_pinentry_pgm=${my_default_bindir}/pinentry
104 AC_DEFINE_UNQUOTED(GNUPG_DEFAULT_PINENTRY, "$gnupg_pinentry_pgm",
105 [Default location of the pinentry program])
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 if test -z "$gnupg_scdaemon_pgm"; then
110 gnupg_scdaemon_pgm=${my_default_bindir}/scdaemon
112 AC_DEFINE_UNQUOTED(GNUPG_DEFAULT_SCDAEMON, "$gnupg_scdaemon_pgm",
113 [Default location of the scdaemon program])
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 if test -z "$gnupg_dirmngr_pgm"; then
118 gnupg_dirmngr_pgm=${my_default_bindir}/dirmngr
120 AC_DEFINE_UNQUOTED(GNUPG_DEFAULT_DIRMNGR, "$gnupg_dirmngr_pgm",
121 [Default location of the dirmngr program])
123 AC_ARG_WITH(protect-tool,
124 [ --with-protect-tool=PATH Use PATH as the protect-tool)],
125 gnupg_protect_tool="$withval", gnupg_protect_tool="" )
126 if test -z "$gnupg_protect_tool"; then
127 gnupg_protect_tool=${my_default_pkglibdir}/gpg-protect-tool
129 AC_DEFINE_UNQUOTED(GNUPG_PROTECT_TOOL, "$gnupg_protect_tool",
130 [Name of the protect tool program])
134 AC_MSG_CHECKING([whether to enable external program execution])
136 AC_HELP_STRING([--disable-exec],[disable all external program execution]),
138 AC_MSG_RESULT($use_exec)
139 if test "$use_exec" = no ; then
140 AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
143 if test "$use_exec" = yes ; then
144 AC_MSG_CHECKING([whether to enable photo ID viewing])
145 AC_ARG_ENABLE(photo-viewers,
146 [ --disable-photo-viewers disable photo ID viewers],
147 [if test "$enableval" = no ; then
148 AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
150 gnupg_cv_enable_photo_viewers=$enableval
151 AC_MSG_RESULT($enableval)
153 if test "$gnupg_cv_enable_photo_viewers" = yes ; then
154 AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
155 AC_ARG_WITH(photo-viewer,
156 [ --with-photo-viewer=FIXED_VIEWER set a fixed photo ID viewer],
157 [if test "$withval" = yes ; then
159 elif test "$withval" != no ; then
160 AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
161 [if set, restrict photo-viewer to this])
163 AC_MSG_RESULT($withval)
166 AC_MSG_CHECKING([whether to enable external keyserver helpers])
167 AC_ARG_ENABLE(keyserver-helpers,
168 [ --disable-keyserver-helpers disable all external keyserver support],
169 [if test "$enableval" = no ; then
170 AC_DEFINE(DISABLE_KEYSERVER_HELPERS,1,
171 [define to disable keyserver helpers])
173 gnupg_cv_enable_keyserver_helpers=$enableval
174 AC_MSG_RESULT($enableval)
176 if test "$gnupg_cv_enable_keyserver_helpers" = yes ; then
177 AC_MSG_CHECKING([whether LDAP keyserver support is requested])
179 [ --disable-ldap disable LDAP keyserver interface],
180 try_ldap=$enableval, try_ldap=yes)
181 AC_MSG_RESULT($try_ldap)
183 AC_MSG_CHECKING([whether HKP keyserver support is requested])
185 [ --disable-hkp disable HKP keyserver interface],
186 try_hkp=$enableval, try_hkp=yes)
187 AC_MSG_RESULT($try_hkp)
189 if test "$try_hkp" = yes ; then
190 AC_SUBST(GPGKEYS_HKP,"gpgkeys_hkp$EXEEXT")
193 AC_MSG_CHECKING([whether email keyserver support is requested])
194 AC_ARG_ENABLE(mailto,
195 [ --disable-mailto disable email keyserver interface],
196 try_mailto=$enableval, try_mailto=yes)
197 AC_MSG_RESULT($try_mailto)
200 AC_MSG_CHECKING([whether keyserver exec-path is enabled])
201 AC_ARG_ENABLE(keyserver-path,
202 [ --disable-keyserver-path disable the exec-path option for keyserver helpers],
203 [if test "$enableval" = no ; then
204 AC_DEFINE(DISABLE_KEYSERVER_PATH,1,[define to disable exec-path for keyserver helpers])
206 AC_MSG_RESULT($enableval)
209 AC_MSG_CHECKING([whether the included zlib is requested])
210 AC_ARG_WITH(included-zlib,
211 [ --with-included-zlib use the zlib code included here],
212 [g10_force_zlib=yes], [g10_force_zlib=no] )
213 AC_MSG_RESULT($g10_force_zlib)
216 dnl Check whether we want to use Linux capabilities
218 AC_MSG_CHECKING([whether use of capabilities is requested])
219 AC_ARG_WITH(capabilities,
220 [ --with-capabilities use linux capabilities [default=no]],
221 [use_capabilities="$withval"],[use_capabilities=no])
222 AC_MSG_RESULT($use_capabilities)
226 /* Some global constants. */
227 #ifdef HAVE_DRIVE_LETTERS
228 #define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
230 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
232 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
234 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
235 #define EXEC_TEMPFILE_ONLY
238 /* Tell libgcrypt not to use its own libgpg-error implementation. */
239 #define USE_LIBGPG_ERROR 1
241 /* This is the major version number of GnuPG so that
242 source included files can test for this. Note, that\
243 we use 2 here even for GnuPG 1.9.x. */
244 #define GNUPG_MAJOR_VERSION 2
252 # Checks for programs.
255 missing_dir=`cd $ac_aux_dir && pwd`
256 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
257 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
258 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
259 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
260 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
268 AC_CHECK_TOOL(AR, ar, :)
269 AC_PATH_PROG(PERL,"perl")
272 AC_CHECK_PROG(DOCBOOK_TO_MAN, docbook-to-man, yes, no)
273 AM_CONDITIONAL(HAVE_DOCBOOK_TO_MAN, test "$ac_cv_prog_DOCBOOK_TO_MAN" = yes)
275 GNUPG_CHECK_DOCBOOK_TO_TEXI
279 have_dosish_system=no
282 # special stuff for Windoze NT
283 ac_cv_have_dev_random=no
284 AC_DEFINE(USE_ONLY_8DOT3,1,
285 [set this to limit filenames to the 8.3 format])
286 AC_DEFINE(HAVE_DRIVE_LETTERS,1,
287 [defined if we must run on a stupid file system])
288 AC_DEFINE(USE_SIMPLE_GETTEXT,1,
289 [because the Unix gettext has too much overhead on
290 MingW32 systems and these systems lack Posix functions,
291 we use a simplified version of gettext])
292 have_dosish_system=yes
295 i?86-emx-os2 | i?86-*-os2*emx )
296 # OS/2 with the EMX environment
297 ac_cv_have_dev_random=no
298 AC_DEFINE(HAVE_DRIVE_LETTERS)
299 have_dosish_system=yes
304 # DOS with the DJGPP environment
305 ac_cv_have_dev_random=no
306 AC_DEFINE(HAVE_DRIVE_LETTERS)
307 have_dosish_system=yes
313 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
314 LDFLAGS="$LDFLAGS -L/usr/local/lib"
318 if test -z "$GCC" ; then
319 CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
323 if test -z "$GCC" ; then
324 # Suppress all warnings
325 # to get rid of the unsigned/signed char mismatch warnings.
330 if test -z "$GCC" ; then
331 # Use the newer compiler `-msg_disable ptrmismatch' to
332 # get rid of the unsigned/signed char mismatch warnings.
333 # Using this may hide other pointer mismatch warnings, but
334 # it at least lets other warning classes through
335 CFLAGS="$CFLAGS -msg_disable ptrmismatch"
344 if test "$have_dosish_system" = yes; then
345 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
346 [defined if we run on some of the PCDOS like systems
347 (DOS, Windoze. OS/2) with special properties like
350 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
354 # Checks for libraries.
358 # libgpg-error is a library with error codes shared between GnuPG
361 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
362 have_gpg_error=yes,have_gpg_error=no)
366 # Libgcrypt is our generic crypto library
368 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_VERSION",
369 have_libgcrypt=yes,have_libgcrypt=no)
373 # libassuan is used for IPC
375 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_VERSION",
376 have_libassuan=yes,have_libassuan=no)
380 # libksba is our X.509 support library
382 AM_PATH_KSBA("$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
385 # libusb allows us to use the integrated CCID smartcard reader driver.
387 # Note, that we need the CVS version. FIXME: libusb should have a
388 # regular check as the other libraries do.
390 AC_CHECK_LIB(usb, usb_find_device,
391 [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
392 AC_DEFINE(HAVE_LIBUSB,1,
393 [defined if libusb is available])
395 AC_SUBST(LIBUSB_LIBS)
399 # OpenSC is needed by the SCdaemon - if it is not availbale we can only
400 # build a limited SCdaemon
402 AM_PATH_OPENSC("$NEED_OPENSC_VERSION",have_opensc=yes,have_opensc=no)
403 if test $have_opensc = yes; then
404 AC_DEFINE(HAVE_OPENSC,1,
405 [defined if the OpenSC library is available])
410 # Check whether the (highly desirable) GNU Pth library is available
412 AC_ARG_WITH(pth-prefix,
413 AC_HELP_STRING([--with-pth-prefix=PFX],
414 [prefix where GNU Pth is installed (optional)]),
415 pth_config_prefix="$withval", pth_config_prefix="")
416 if test x$pth_config_prefix != x ; then
417 PTH_CONFIG="$pth_config_prefix/bin/pth-config"
419 AC_PATH_PROG(PTH_CONFIG, pth-config, no)
420 if test "$PTH_CONFIG" = "no"; then
423 *** To support concurrent access to the gpg-agent and the SCdaemon
424 *** we need the support of the GNU Portable Threads Library.
425 *** Download it from ftp://ftp.gnu.org/gnu/pth/
426 *** On a Debian GNU/Linux system you might want to try
427 *** apt-get install libpth-dev
430 GNUPG_PTH_VERSION_CHECK(1.3.7)
431 if test $have_pth = yes; then
432 PTH_CFLAGS=`$PTH_CONFIG --cflags`
433 PTH_LIBS=`$PTH_CONFIG --ldflags`
434 PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs`"
435 AC_DEFINE(USE_GNU_PTH, 1,
436 [Defined if the GNU Portable Thread Library should be used])
443 dnl Must check for network library requirements before doing link tests
444 dnl for ldap, for example. If ldap libs are static (or dynamic and without
445 dnl ELF runtime link paths), then link will fail and LDAP support won't
448 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
449 [NETLIBS="-lnsl $NETLIBS"]))
450 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
451 [NETLIBS="-lsocket $NETLIBS"]))
453 dnl Now try for the resolver functions so we can use DNS SRV
455 AC_ARG_ENABLE(dns-srv,
456 AC_HELP_STRING([--disable-dns-srv],[disable the use of DNS SRV in HKP]),
457 use_dns_srv=$enableval,use_dns_srv=yes)
459 if test x"$try_hkp" = xyes && test x"$use_dns_srv" = xyes ; then
462 # the double underscore thing is a glibc-ism?
463 AC_SEARCH_LIBS(res_query,resolv bind,,
464 AC_SEARCH_LIBS(__res_query,resolv bind,,use_dns_srv=no))
465 AC_SEARCH_LIBS(dn_expand,resolv bind,,
466 AC_SEARCH_LIBS(__dn_expand,resolv bind,,use_dns_srv=no))
467 AC_SEARCH_LIBS(dn_skipname,resolv bind,,
468 AC_SEARCH_LIBS(__dn_skipname,resolv bind,,use_dns_srv=no))
470 if test x"$use_dns_srv" = xyes ; then
471 AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
474 AC_MSG_WARN([Resolver functions not found. Disabling DNS SRV.])
481 # Try and link a LDAP test program to weed out unusable LDAP
482 # libraries. -lldap [-llber [-lresolv]] is for OpenLDAP. OpenLDAP in
483 # general is terrible with creating weird dependencies. If all else
484 # fails, the user can play guess-the-dependency by using something
485 # like ./configure LDAPLIBS="-Lfoo -lbar"
487 if test "$try_ldap" = yes ; then
488 for MY_LDAPLIBS in ${LDAPLIBS+"$LDAPLIBS"} "-lldap" "-lldap -llber" "-lldap -llber -lresolv"; do
489 _ldap_save_libs=$LIBS
490 LIBS="$MY_LDAPLIBS $NETLIBS $LIBS"
492 AC_MSG_CHECKING([whether LDAP via \"$MY_LDAPLIBS\" is present and sane])
493 AC_TRY_LINK([#include <ldap.h>],[ldap_open("foobar",1234);],
494 [gnupg_cv_func_ldap_init=yes],[gnupg_cv_func_ldap_init=no])
495 AC_MSG_RESULT([$gnupg_cv_func_ldap_init])
497 if test $gnupg_cv_func_ldap_init = no; then
498 AC_MSG_CHECKING([whether I can make LDAP be sane with lber.h])
499 AC_TRY_LINK([#include <lber.h>
500 #include <ldap.h>],[ldap_open("foobar",1234);],
501 [gnupg_cv_func_ldaplber_init=yes],[gnupg_cv_func_ldaplber_init=no])
502 AC_MSG_RESULT([$gnupg_cv_func_ldaplber_init])
505 if test "$gnupg_cv_func_ldaplber_init" = yes ; then
506 AC_DEFINE(NEED_LBER_H,1,[Define if the LDAP library requires including lber.h before ldap.h])
509 if test "$gnupg_cv_func_ldap_init" = yes || \
510 test "$gnupg_cv_func_ldaplber_init" = yes ; then
511 LDAPLIBS=$MY_LDAPLIBS
512 GPGKEYS_LDAP="gpgkeys_ldap$EXEEXT"
514 AC_MSG_CHECKING([whether LDAP supports ldap_get_option])
516 if test "$gnupg_cv_func_ldap_init" = yes ; then
517 AC_TRY_LINK([#include <ldap.h>],
518 [ldap_get_option((void *)0,0,(void *)0);],
519 [gnupg_cv_func_ldap_get_option=yes],
520 [gnupg_cv_func_ldap_get_option=no])
522 AC_TRY_LINK([#include <lber.h>
523 #include <ldap.h>],[ldap_get_option((void *)0,0,(void *)0);],
524 [gnupg_cv_func_ldap_get_option=yes],
525 [gnupg_cv_func_ldap_get_option=no])
528 AC_MSG_RESULT([$gnupg_cv_func_ldap_get_option])
530 if test "$gnupg_cv_func_ldap_get_option" = yes ; then
531 AC_DEFINE(HAVE_LDAP_GET_OPTION,1,[Define if the LDAP library has ldap_get_option])
533 AC_MSG_CHECKING([whether LDAP supports ld_errno])
535 if test "$gnupg_cv_func_ldap_init" = yes ; then
536 AC_TRY_COMPILE([#include <ldap.h>],
537 [LDAP *ldap; ldap->ld_errno;],
538 [gnupg_cv_func_ldap_ld_errno=yes],
539 [gnupg_cv_func_ldap_ld_errno=no])
541 AC_TRY_LINK([#include <lber.h>
542 #include <ldap.h>],[LDAP *ldap; ldap->ld_errno;],
543 [gnupg_cv_func_ldap_ld_errno=yes],
544 [gnupg_cv_func_ldap_ld_errno=no])
547 AC_MSG_RESULT([$gnupg_cv_func_ldap_ld_errno])
549 if test "$gnupg_cv_func_ldap_ld_errno" = yes ; then
550 AC_DEFINE(HAVE_LDAP_LD_ERRNO,1,[Define if the LDAP library supports ld_errno])
555 LIBS=$_ldap_save_libs
557 if test "$GPGKEYS_LDAP" != "" ; then break; fi
561 AC_SUBST(GPGKEYS_LDAP)
564 dnl This isn't necessarily sendmail itself, but anything that gives a
565 dnl sendmail-ish interface to the outside world. That includes qmail,
566 dnl postfix, etc. Basically, anything that can handle "sendmail -t".
568 if test "$try_mailto" = yes ; then
569 AC_ARG_WITH(mailprog,[ --with-mailprog=NAME use "NAME -t" for mail transport],,with_mailprog=yes)
571 if test "$with_mailprog" = yes ; then
572 AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
573 if test "$ac_cv_path_SENDMAIL" ; then
574 GPGKEYS_MAILTO="gpgkeys_mailto"
576 elif test "$with_mailprog" != no ; then
577 AC_MSG_CHECKING([for a mail transport program])
578 AC_SUBST(SENDMAIL,$with_mailprog)
579 AC_MSG_RESULT($with_mailprog)
580 GPGKEYS_MAILTO="gpgkeys_mailto"
584 AC_SUBST(GPGKEYS_MAILTO)
588 PRINTABLE_OS_NAME="MingW32"
591 PRINTABLE_OS_NAME="Cygwin"
593 i?86-emx-os2 | i?86-*-os2*emx )
594 PRINTABLE_OS_NAME="OS/2"
597 PRINTABLE_OS_NAME="MSDOS/DJGPP"
601 PRINTABLE_OS_NAME="GNU/Linux"
604 PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
607 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
608 [A human readable text with the name of the OS])
611 if test "$try_gettext" = yes; then
612 AM_GNU_GETTEXT(,[need-ngettext])
614 # gettext requires some extra checks. These really should be part of
615 # the basic AM_GNU_GETTEXT macro. TODO: move other gettext-specific
616 # function checks to here.
618 AC_CHECK_FUNCS(strchr)
621 USE_INCLUDED_LIBINTL=no
622 BUILD_INCLUDED_LIBINTL=no
624 AC_SUBST(USE_INCLUDED_LIBINTL)
625 AC_SUBST(BUILD_INCLUDED_LIBINTL)
628 # Checks for header files.
630 AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h)
632 # Checks for typedefs, structures, and compiler characteristics.
641 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
642 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
643 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
644 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
645 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
647 AC_CHECK_SIZEOF(unsigned short)
648 AC_CHECK_SIZEOF(unsigned int)
649 AC_CHECK_SIZEOF(unsigned long)
650 AC_CHECK_SIZEOF(unsigned long long)
651 # Ensure that we have UINT64_C before we bother to check for uint64_t
652 # fixme: really needed in gnupg? I think it is only useful in libcgrypt.
653 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
654 AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <inttypes.h>
655 uint64_t foo=UINT64_C(42);]),gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
656 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
657 AC_CHECK_SIZEOF(uint64_t)
663 if test "$ac_cv_sizeof_unsigned_short" = "0" \
664 || test "$ac_cv_sizeof_unsigned_int" = "0" \
665 || test "$ac_cv_sizeof_unsigned_long" = "0"; then
666 AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
669 dnl Do we have any 64-bit data types?
670 if test "$ac_cv_sizeof_unsigned_int" != "8" \
671 && test "$ac_cv_sizeof_unsigned_long" != "8" \
672 && test "$ac_cv_sizeof_unsigned_long_long" != "8" \
673 && test "$ac_cv_sizeof_uint64_t" != "8"; then
674 AC_MSG_WARN([No 64-bit types. Disabling SHA-384, and SHA-512])
676 if test x"$use_sha512" = xyes ; then
677 AC_SUBST(SHA512_O,sha512.o)
678 AC_DEFINE(USE_SHA512,1,[Define to include the SHA-384 and SHA-512 digests])
682 GNUPG_SYS_SO_PEERCRED
684 # Checks for library functions.
688 AC_CHECK_FUNCS(strerror stpcpy strsep strlwr tcgetattr strtoul mmap)
689 AC_CHECK_FUNCS(strcasecmp strncasecmp ctermid times)
690 AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
691 AC_CHECK_FUNCS(atexit raise getpagesize strftime nl_langinfo setlocale)
692 AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand pipe stat getaddrinfo)
694 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
696 # These are needed by libjnlib - fixme: we should have macros for them
697 AC_CHECK_FUNCS(memicmp stpcpy strlwr strtoul memmove stricmp strtol)
698 AC_CHECK_FUNCS(getrusage setrlimit stat setlocale)
699 AC_CHECK_FUNCS(flockfile funlockfile)
701 AC_REPLACE_FUNCS(vasprintf)
702 AC_REPLACE_FUNCS(fopencookie)
703 AC_REPLACE_FUNCS(mkdtemp)
704 AC_REPLACE_FUNCS(fseeko ftello)
705 AC_REPLACE_FUNCS(isascii)
706 AC_REPLACE_FUNCS(putc_unlocked)
711 # check for gethrtime and run a testprogram to see whether
712 # it is broken. It has been reported that some Solaris and HP UX systems
715 AC_CACHE_CHECK([for gethrtime],
716 [gnupg_cv_func_gethrtime],
717 [AC_TRY_LINK([#include <sys/times.h>],[
721 [gnupg_cv_func_gethrtime=yes],
722 [gnupg_cv_func_gethrtime=no])
724 if test $gnupg_cv_func_gethrtime = yes; then
725 AC_DEFINE([HAVE_GETHRTIME], 1,
726 [Define if you have the `gethrtime(2)' function.])
727 AC_CACHE_CHECK([whether gethrtime is broken],
728 [gnupg_cv_func_broken_gethrtime],
730 #include <sys/times.h>
736 [gnupg_cv_func_broken_gethrtime=no],
737 [gnupg_cv_func_broken_gethrtime=yes],
738 [gnupg_cv_func_broken_gethrtime=assume-no])
740 if test $gnupg_cv_func_broken_gethrtime = yes; then
741 AC_DEFINE([HAVE_BROKEN_GETHRTIME], 1,
742 [Define if `gethrtime(2)' does not work correctly i.e. issues a SIGILL.])
748 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
751 dnl Check whether we can use Linux capabilities as requested
753 if test "$use_capabilities" = "yes" ; then
755 AC_CHECK_HEADERS(sys/capability.h)
756 if test "$ac_cv_header_sys_capability_h" = "yes" ; then
757 AC_CHECK_LIB(cap, cap_init, ac_need_libcap=1)
758 if test "$ac_cv_lib_cap_cap_init" = "yes"; then
759 AC_DEFINE(USE_CAPABILITIES,1,
760 [define if capabilities should be used])
761 AC_SUBST(CAPLIBS,"-lcap")
765 if test "$use_capabilities" = "no" ; then
768 *** The use of capabilities on this system is not possible.
769 *** You need a recent Linux kernel and some patches:
770 *** fcaps-2.2.9-990610.patch (kernel patch for 2.2.9)
771 *** fcap-module-990613.tar.gz (kernel module)
772 *** libcap-1.92.tar.gz (user mode library and utilities)
773 *** And you have to configure the kernel with CONFIG_VFS_CAP_PLUGIN
774 *** set (filesystems menu). Be warned: This code is *really* ALPHA.
780 # Sanity check regex. Tests adapted from mutt.
782 AC_MSG_CHECKING([whether regular expression support is requested])
784 [ --disable-regex do not handle regular expressions in trust sigs],
785 use_regex=$enableval, use_regex=yes)
786 AC_MSG_RESULT($use_regex)
788 if test "$use_regex" = yes ; then
789 AC_MSG_CHECKING([whether the included regex lib is requested])
790 AC_ARG_WITH(included-regex,
791 [ --with-included-regex use the included GNU regex library],
792 [gnupg_cv_included_regex=yes],[gnupg_cv_included_regex=no])
793 AC_MSG_RESULT($gnupg_cv_included_regex)
795 if test $gnupg_cv_included_regex = no ; then
796 # Does the system have regex functions at all?
797 AC_CHECK_FUNC(regcomp,gnupg_cv_included_regex=no,
798 gnupg_cv_included_regex=yes)
801 if test $gnupg_cv_included_regex = no ; then
802 AC_CACHE_CHECK([whether your system's regexp library is broken],
803 [gnupg_cv_regex_broken],
807 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); }],
808 gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
810 if test $gnupg_cv_regex_broken = yes ; then
811 AC_MSG_WARN(your regex is broken - using the included GNU regex instead.)
812 gnupg_cv_included_regex=yes
816 if test $gnupg_cv_included_regex = yes; then
817 AC_DEFINE(USE_GNU_REGEX,1,[ Define if you want to use the included regex lib ])
818 AC_SUBST(REGEX_O,regex.o)
822 AC_DEFINE(DISABLE_REGEX,1,[ Define to disable regular expression support ])
825 dnl Do we have zlib? Must do it here because Solaris failed
826 dnl when compiling a conftest (due to the "-lz" from LIBS).
828 if test "$g10_force_zlib" = "yes"; then
831 _cppflags="${CPPFLAGS}"
832 _ldflags="${LDFLAGS}"
835 [ --with-zlib=DIR use libz in DIR],[
836 if test -d "$withval"; then
837 CPPFLAGS="${CPPFLAGS} -I$withval/include"
838 LDFLAGS="${LDFLAGS} -L$withval/lib"
842 AC_CHECK_HEADER(zlib.h,
843 AC_CHECK_LIB(z, deflateInit2_,
846 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
847 CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
850 if test "$use_local_zlib" = yes ; then
851 AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, true)
852 AC_CONFIG_LINKS(zlib.h:zlib/zlib.h zconf.h:zlib/zconf.h )
853 ZLIBS="../zlib/libzlib.a"
855 AM_CONDITIONAL(ENABLE_LOCAL_ZLIB, false)
860 # Allow users to append something to the version string without
861 # flagging it as development version. The user version parts is
862 # considered everything after a dash.
863 if test "$development_version" != yes; then
867 if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
868 development_version=yes
871 if test "$development_version" = yes; then
872 AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
873 [Defined if this is not a regular release])
876 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
880 # add some extra libs here so that previous tests don't fail for
881 # mysterious reasons - the final link step should bail out.
891 if test "$GCC" = yes; then
892 if test "$USE_MAINTAINER_MODE" = "yes"; then
893 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
895 CFLAGS="$CFLAGS -Wall"
903 # We use jnlib, so tell other modules about it
904 AC_DEFINE(HAVE_JNLIB_LOGGING, 1,
905 [Defined if jnlib style logging fucntions are available])
911 # Print errors here so that they are visible all
912 # together and the user can acquire them all together.
915 if test "$have_gpg_error" = "no"; then
919 *** You need libgpg-error to build this program.
920 ** This library is for example available at
921 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgpg-error
922 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
925 if test "$have_libgcrypt" = "no"; then
929 *** You need libgcrypt to build this program.
930 ** This library is for example available at
931 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libgcrypt/
932 *** (at least version $NEED_LIBGCRYPT_VERSION is required.)
935 if test "$have_libassuan" = "no"; then
939 *** You need libassuan to build this program.
940 *** This library is for example available at
941 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libassuan/
942 *** (at least version $NEED_LIBASSUAN_VERSION is required).
945 if test "$have_ksba" = "no"; then
949 *** You need libksba to build this program.
950 *** This library is for example available at
951 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/aegypten/
952 *** (at least version $NEED_KSBA_VERSION is required).
956 if test "$die" = "yes"; then
959 *** Required libraries not found. Please consult the above messages
960 *** and install them before running configure again.
966 # Decide what to build
968 if test $have_ksba = no; then
973 build_agent_threaded=""
974 if test "$build_agent" = "yes"; then
975 if test $have_pth = no; then
976 build_agent_threaded="(not multi-threaded)"
980 build_scdaemon_extra=""
981 if test "$build_scdaemon" = "yes"; then
983 if test $have_pth = no; then
984 build_scdaemon_extra="not multi-threaded"
987 if test $have_opensc = no; then
988 build_scdaemon_extra="${build_scdaemon_extra}${tmp}no pkcs#15"
991 if test -n "$build_scdaemon_extra"; then
992 build_scdaemon_extra="(${build_scdaemon_extra})"
997 AM_CONDITIONAL(BUILD_GPG, test "$build_gpg" = "yes")
998 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
999 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1000 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1003 AC_CONFIG_COMMANDS(g10defs.h,[[
1004 cat >g10defs.tmp <<G10EOF
1005 /* Generated automatically by configure */
1006 /* FIXME: Shouldn't we replace GNUPG_HOMEDIR by GNUPG_DEFAULT_HOMEDIR
1007 and we propably can get rid of g10defs.h */
1008 #ifdef HAVE_DRIVE_LETTERS
1009 /*#define G10_LOCALEDIR "c:\\\\lib\\\\gnupg\\\\locale"*/
1010 #define GNUPG_LIBDIR "c:\\\\lib\\\\gnupg"
1011 #define GNUPG_LIBEXECDIR "c:\\\\lib\\\\gnupg"
1012 #define GNUPG_DATADIR "c:\\\\lib\\\\gnupg"
1013 #define GNUPG_HOMEDIR "c:\\\\gnupg"
1015 /*#define G10_LOCALEDIR "${datadir}/locale"*/
1016 #define GNUPG_LIBDIR "${libdir}/gnupg"
1017 #define GNUPG_DATADIR "${datadir}/gnupg"
1019 #define GNUPG_HOMEDIR "/SYS\$LOGIN/gnupg"
1021 #define GNUPG_HOMEDIR "~/.gnupg"
1024 /* those are here to be redefined by handcrafted g10defs.h.
1025 Please note that the string version must not contain more
1026 than one character because the using code assumes strlen()==1 */
1027 #ifdef HAVE_DOSISH_SYSTEM
1028 #define DIRSEP_C '\\\\'
1029 #define EXTSEP_C '.'
1030 #define DIRSEP_S "\\\\"
1031 #define EXTSEP_S "."
1033 #define DIRSEP_C '/'
1034 #define EXTSEP_C '.'
1035 #define DIRSEP_S "/"
1036 #define EXTSEP_S "."
1038 /* This is the same as VERSION, but should be overridden if the
1039 platform cannot handle things like dots '.' in filenames. */
1040 #define SAFE_VERSION VERSION
1042 ## Do we really need the following? It defines BYTES_PER-MPI_LIMB
1043 ## cat mpi/mpi-asm-defs.h >>g10defs.tmp
1044 if cmp -s g10defs.h g10defs.tmp 2>/dev/null; then
1045 echo "g10defs.h is unchanged"
1049 mv g10defs.tmp g10defs.h
1050 echo "g10defs.h created"
1054 exec_prefix=$exec_prefix
1056 libexecdir=$libexecdir
1058 DATADIRNAME=$DATADIRNAME
1061 AC_CONFIG_FILES([ m4/Makefile
1079 GnuPG v${VERSION} has been configured as follows:
1081 Platform: $PRINTABLE_OS_NAME ($target)
1084 S/MIME: $build_gpgsm
1085 Agent: $build_agent $build_agent_threaded
1086 Smartcard: $build_scdaemon $build_scdaemon_extra
1088 Protect tool: $gnupg_protect_tool
1089 Default agent: $gnupg_agent_pgm
1090 Default pinentry: $gnupg_pinentry_pgm
1091 Default scdaemon: $gnupg_scdaemon_pgm
1092 Default dirmngr: $gnupg_dirmngr_pgm