2006-09-06 Marcus Brinkmann <marcus@g10code.de>
[gnupg.git] / configure.ac
blobbcce906e17c947d476d94befbf0bec5f9d510a9e
1 # configure.ac - for GnuPG 1.9
2 # Copyright (C) 1998, 1999, 2000, 2001, 2002,
3 #               2003, 2004, 2005, 2006 Free Software Foundation, Inc.
4
5 # This file is part of GnuPG.
6
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.
11
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.
16
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
20 # USA.
22 # Process this file with autoconf to produce a configure script.
23 AC_PREREQ(2.52)
24 min_automake_version="1.9.3"
26 # Remember to change the version number immediately *after* a release.
27 # Set my_issvn to "yes" for non-released code.  Remember to run an
28 # "svn up" and "autogen.sh" right before creating a distribution.
29 m4_define([my_version], [1.9.23])
30 m4_define([my_issvn], [yes])
33 m4_define([svn_revision], m4_esyscmd([echo -n $((svn info 2>/dev/null \
34             || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q}')]))
35 AC_INIT([gnupg], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]),
36         [bug-gnupg@gnupg.org])
37 # Set development_version to yes if the minor number is odd or you
38 # feel that the default check for a development version is not
39 # sufficient.
40 development_version=yes
42 NEED_GPG_ERROR_VERSION=1.4
44 NEED_LIBGCRYPT_API=1
45 NEED_LIBGCRYPT_VERSION=1.1.94
47 NEED_LIBASSUAN_VERSION=0.9.0
49 NEED_KSBA_API=1
50 NEED_KSBA_VERSION=1.0.0
53 PACKAGE=$PACKAGE_NAME
54 PACKAGE_GT=${PACKAGE_NAME}2
55 VERSION=$PACKAGE_VERSION
57 AC_CONFIG_AUX_DIR(scripts)
58 AC_CONFIG_SRCDIR(sm/gpgsm.c)
59 AM_CONFIG_HEADER(config.h)
60 AC_CANONICAL_TARGET()
61 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
62 AB_INIT
64 AC_GNU_SOURCE
66 # Some status variables.
67 have_gpg_error=no
68 have_libgcrypt=no 
69 have_libassuan=no
70 have_ksba=no
71 have_pth=no
72 have_libusb=no
74 use_bzip2=yes
75 use_exec=yes
76 disable_keyserver_path=no
79 GNUPG_BUILD_PROGRAM(gpg, no)
80 GNUPG_BUILD_PROGRAM(gpgsm, yes)
81 GNUPG_BUILD_PROGRAM(agent, yes)
82 GNUPG_BUILD_PROGRAM(scdaemon, yes)
83 GNUPG_BUILD_PROGRAM(symcryptrun, no)
85 AC_SUBST(PACKAGE)
86 AC_SUBST(PACKAGE_GT)
87 AC_SUBST(VERSION)
88 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
89 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
90                                 [Name of this package for gettext])
91 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
92 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
93                                         [Bug report address])
94 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
95                                        [Required version of Libgcrypt])
96 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
97                                        [Required version of Libksba])
101 # The default is to use the modules from this package and the few
102 # other packages in a standard place; i.e where this package gets
103 # installed.  With these options it is possible to override these
104 # ${prefix} depended values with fixed paths, which can't be replaced
105 # at make time.  See also am/cmacros.am and the defaults in AH_BOTTOM.
106 AC_ARG_WITH(agent-pgm,
107     [  --with-agent-pgm=PATH  Use PATH as the default for the agent)],
108           GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
109 AC_SUBST(GNUPG_AGENT_PGM)
110 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
111 show_gnupg_agent_pgm="(default)"
112 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
114 AC_ARG_WITH(pinentry-pgm,
115     [  --with-pinentry-pgm=PATH  Use PATH as the default for the pinentry)],
116           GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
117 AC_SUBST(GNUPG_PINENTRY_PGM)
118 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
119 show_gnupg_pinentry_pgm="(default)"
120 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
123 AC_ARG_WITH(scdaemon-pgm,
124     [  --with-scdaemon-pgm=PATH  Use PATH as the default for the scdaemon)],
125           GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
126 AC_SUBST(GNUPG_SCDAEMON_PGM)
127 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
128 show_gnupg_scdaemon_pgm="(default)"
129 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
132 AC_ARG_WITH(dirmngr-pgm,
133     [  --with-dirmngr-pgm=PATH  Use PATH as the default for the dirmngr)],
134           GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
135 AC_SUBST(GNUPG_DIRMNGR_PGM)
136 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
137 show_gnupg_dirmngr_pgm="(default)"
138 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
140 AC_ARG_WITH(protect-tool-pgm,
141     [  --with-protect-tool-pgm=PATH  Use PATH as the default for the protect-tool)],
142           GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
143 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
144 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
145 show_gnupg_protect_tool_pgm="(default)"
146 test -n "$GNUPG_PROTECT_TOOL_PGM" \
147       && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
150 # Some folks want to use only the agent from this packet.  Make it
151 # easier for them by providing the configure option
152 # --enable-only-agent.
153 AC_ARG_ENABLE(agent-only,
154     AC_HELP_STRING([--enable-agent-only],[build only the gpg-agent]),
155     build_agent_only=$enableval)
158 # SELinux support includes tracking of sensitive files to avoid
159 # leaking their contents through processing these files by gpg itself
160 AC_MSG_CHECKING([whether SELinux support is requested])
161 AC_ARG_ENABLE(selinux-support,
162               AC_HELP_STRING([--enable-selinux-support],
163                              [enable SELinux support]),
164               selinux_support=$enableval, selinux_support=no)
165 AC_MSG_RESULT($selinux_support)
167 # Allow disabling of bzib2 support.
168 # It is defined only after we confirm the library is available later
169 AC_MSG_CHECKING([whether to enable the BZIP2 compression algorithm])
170 AC_ARG_ENABLE(bzip2,
171    AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
172    use_bzip2=$enableval)
173 AC_MSG_RESULT($use_bzip2)
176 # Configure option to allow or disallow execution of external
177 # programs, like a photo viewer.
178 AC_MSG_CHECKING([whether to enable external program execution])
179 AC_ARG_ENABLE(exec,
180     AC_HELP_STRING([--disable-exec],[disable all external program execution]),
181     use_exec=$enableval)
182 AC_MSG_RESULT($use_exec)
183 if test "$use_exec" = no ; then
184     AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
187 if test "$use_exec" = yes ; then
188   AC_MSG_CHECKING([whether to enable photo ID viewing])
189   AC_ARG_ENABLE(photo-viewers,
190       [  --disable-photo-viewers disable photo ID viewers],
191       [if test "$enableval" = no ; then
192          AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
193       fi],enableval=yes)
194   gnupg_cv_enable_photo_viewers=$enableval
195   AC_MSG_RESULT($enableval)
197   if test "$gnupg_cv_enable_photo_viewers" = yes ; then
198     AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
199     AC_ARG_WITH(photo-viewer,
200         [  --with-photo-viewer=FIXED_VIEWER  set a fixed photo ID viewer],
201         [if test "$withval" = yes ; then
202            withval=no
203         elif test "$withval" != no ; then
204            AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
205                             [if set, restrict photo-viewer to this])
206         fi],withval=no)
207     AC_MSG_RESULT($withval)
208   fi
210   AC_MSG_CHECKING([whether to enable external keyserver helpers])
211   AC_ARG_ENABLE(keyserver-helpers,
212       [  --disable-keyserver-helpers  disable all external keyserver support],
213       [if test "$enableval" = no ; then
214          AC_DEFINE(DISABLE_KEYSERVER_HELPERS,1,
215                   [define to disable keyserver helpers])
216       fi],enableval=yes)
217   gnupg_cv_enable_keyserver_helpers=$enableval
218   AC_MSG_RESULT($enableval)
220   if test "$gnupg_cv_enable_keyserver_helpers" = yes ; then
221     # LDAP is defined only after we confirm the library is available later
222     AC_MSG_CHECKING([whether LDAP keyserver support is requested])
223     AC_ARG_ENABLE(ldap,
224       AC_HELP_STRING([--disable-ldap],[disable LDAP keyserver interface only]),
225       try_ldap=$enableval, try_ldap=yes)
226     AC_MSG_RESULT($try_ldap)
228     AC_MSG_CHECKING([whether HKP keyserver support is requested])
229     AC_ARG_ENABLE(hkp,
230       AC_HELP_STRING([--disable-hkp],[disable HKP keyserver interface only]),
231       try_hkp=$enableval, try_hkp=yes)
232     AC_MSG_RESULT($try_hkp)
234     AC_MSG_CHECKING([whether finger key fetching support is requested])
235     AC_ARG_ENABLE(finger,
236       AC_HELP_STRING([--disable-finger],
237         [disable finger key fetching interface only]),
238       try_finger=$enableval, try_finger=yes)
239     AC_MSG_RESULT($try_finger)
241     AC_MSG_CHECKING([whether generic object key fetching support is requested])
242     AC_ARG_ENABLE(generic,
243       AC_HELP_STRING([--disable-generic],
244         [disable generic object key fetching interface only]),
245       try_generic=$enableval, try_generic=yes)
246     AC_MSG_RESULT($try_generic)
248     AC_MSG_CHECKING([whether email keyserver support is requested])
249     AC_ARG_ENABLE(mailto,
250       AC_HELP_STRING([--enable-mailto],
251         [enable email keyserver interface only]),
252       try_mailto=$enableval, try_mailto=no)
253     AC_MSG_RESULT($try_mailto)
254     fi
256     AC_MSG_CHECKING([whether keyserver exec-path is enabled])
257     AC_ARG_ENABLE(keyserver-path,
258       AC_HELP_STRING([--disable-keyserver-path],
259         [disable the exec-path option for keyserver helpers]),
260       [if test "$enableval" = no ; then
261          disable_keyserver_path=yes
262       fi],enableval=yes)
263     AC_MSG_RESULT($enableval)
264   fi
268 # Check for the key/uid cache size.  This can't be zero, but can be
269 # pretty small on embedded systems.  This is used for the gpg part.
271 AC_MSG_CHECKING([for the size of the key and uid cache])
272 AC_ARG_ENABLE(key-cache,
273         AC_HELP_STRING([--enable-key-cache=SIZE],
274                        [Set key cache to SIZE (default 4096)]),,enableval=4096)
275 if test "$enableval" = "no"; then
276    enableval=5
277 elif test "$enableval" = "yes" || test "$enableval" = ""; then
278    enableval=4096
280 changequote(,)dnl
281 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
282 changequote([,])dnl
283 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
284    AC_MSG_ERROR([invalid key-cache size])
286 AC_MSG_RESULT($key_cache_size)
287 AC_DEFINE_UNQUOTED(PK_UID_CACHE_SIZE,$key_cache_size,
288                   [Size of the key and UID caches])
293 # Check whether we want to use Linux capabilities
295 AC_MSG_CHECKING([whether use of capabilities is requested])
296 AC_ARG_WITH(capabilities,
297     [  --with-capabilities     use linux capabilities [default=no]],
298 [use_capabilities="$withval"],[use_capabilities=no])
299 AC_MSG_RESULT($use_capabilities)
302 # To avoid double inclusion of config.h which might happen at some
303 # places, we add the usual double inclusion protection at the top of
304 # config.h.
306 AH_TOP([
307 #ifndef GNUPG_CONFIG_H_INCLUDED
308 #define GNUPG_CONFIG_H_INCLUDED
312 # Stuff which goes at the bottom of config.h.
314 AH_BOTTOM([
315 /* This is the major version number of GnuPG so that
316    source included files can test for this.  Note, that
317    we use 2 here even for GnuPG 1.9.x. */
318 #define GNUPG_MAJOR_VERSION 2
320 /* Now to separate file name parts.
321    Please note that the string version must not contain more
322    than one character because the code assumes strlen()==1 */
323 #ifdef HAVE_DOSISH_SYSTEM
324 #define DIRSEP_C '\\'
325 #define DIRSEP_S "\\"
326 #define EXTSEP_C '.'
327 #define EXTSEP_S "."
328 #define PATHSEP_C ';'
329 #define PATHSEP_S ";"
330 #define EXEEXT_S ".exe"
331 #else
332 #define DIRSEP_C '/'
333 #define DIRSEP_S "/"
334 #define EXTSEP_C '.'
335 #define EXTSEP_S "."
336 #define PATHSEP_C ':'
337 #define PATHSEP_S ":"
338 #define EXEEXT_S ""
339 #endif
341 /* This is the same as VERSION, but should be overridden if the
342    platform cannot handle things like dots '.' in filenames. Set
343    SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
344    uses for dots and dashes. */
345 #define SAFE_VERSION VERSION
346 #define SAFE_VERSION_DOT  '.'
347 #define SAFE_VERSION_DASH '-'
349 /* Some global constants. */
350 #ifdef HAVE_DRIVE_LETTERS
351 #define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
352 #elif defined(__VMS)
353 #define GNUPG_DEFAULT_HOMEDIR "/SYS\$LOGIN/gnupg" 
354 #else
355 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
356 #endif 
357 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
359 /* For some systems (DOS currently), we hardcode the path here.  For
360    POSIX systems the values are constructed by the Makefiles, so that
361    the values may be overridden by the make invocations; this is to
362    comply with the GNU coding standards. */
363 #ifdef HAVE_DRIVE_LETTERS
364 #define GNUPG_BINDIR      "c:\\gnupg"
365 #define GNUPG_LIBEXECDIR  "c:\\gnupg"
366 #define GNUPG_LIBDIR      "c:\\gnupg"
367 #define GNUPG_DATADIR     "c:\\gnupg"
368 #endif
370 /* Setup the hardwired names of modules. */
371 #ifndef GNUPG_DEFAULT_AGENT
372 #define GNUPG_DEFAULT_AGENT    ( GNUPG_BINDIR DIRSEP_S "gpg-agent" EXEEXT_S )
373 #endif
374 #ifndef GNUPG_DEFAULT_PINENTRY
375 #define GNUPG_DEFAULT_PINENTRY ( GNUPG_BINDIR DIRSEP_S "pinentry" EXEEXT_S )
376 #endif
377 #ifndef GNUPG_DEFAULT_SCDAEMON
378 #define GNUPG_DEFAULT_SCDAEMON ( GNUPG_BINDIR DIRSEP_S "scdaemon" EXEEXT_S )
379 #endif
380 #ifndef GNUPG_DEFAULT_DIRMNGR
381 #define GNUPG_DEFAULT_DIRMNGR  ( GNUPG_BINDIR DIRSEP_S "dirmngr" EXEEXT_S )
382 #endif
383 #ifndef GNUPG_DEFAULT_PROTECT_TOOL
384 #define GNUPG_DEFAULT_PROTECT_TOOL \
385                     ( GNUPG_LIBEXECDIR DIRSEP_S "gpg-protect-tool" EXEEXT_S )
386 #endif
389 /* Derive some other constants. */
390 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
391 #define EXEC_TEMPFILE_ONLY
392 #endif
395 /* We didn't define endianness above, so get it from OS macros.  This
396    is intended for making fat binary builds on OS X. */
397 #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST)
398 #if defined(__BIG_ENDIAN__)
399 #define BIG_ENDIAN_HOST 1
400 #elif defined(__LITTLE_ENDIAN__)
401 #define LITTLE_ENDIAN_HOST 1
402 #else
403 #error "No endianness found"
404 #endif
405 #endif
408 /* Tell libgcrypt not to use its own libgpg-error implementation. */
409 #define USE_LIBGPG_ERROR 1
411 /* We use jnlib, so tell other modules about it.  */
412 #define HAVE_JNLIB_LOGGING 1
414 /* Our HTTP code is used in estream mode.  */
415 #define HTTP_USE_ESTREAM 1
417 /* We always include support for the OpenPGP card.  */
418 #define ENABLE_CARD_SUPPORT 1
420 /* We don't want the old assuan codes anymore. */
421 #define _ASSUAN_ONLY_GPG_ERRORS 1
423 #endif /*GNUPG_CONFIG_H_INCLUDED*/
427 AM_MAINTAINER_MODE
429 # Checks for programs.
430 AC_PROG_MAKE_SET
431 AM_SANITY_CHECK
432 missing_dir=`cd $ac_aux_dir && pwd`
433 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
434 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
435 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
436 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
437 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
438 AC_PROG_AWK
439 AC_PROG_CC
440 AC_PROG_CPP
441 AC_PROG_INSTALL
442 AC_PROG_LN_S
443 AC_PROG_RANLIB
444 AC_CHECK_TOOL(AR, ar, :)
445 AC_PATH_PROG(PERL,"perl")
446 AC_ISC_POSIX
447 gl_EARLY
448 AC_SYS_LARGEFILE
449 GNUPG_CHECK_FAQPROG
450 GNUPG_CHECK_USTAR
453 try_gettext=yes
454 have_dosish_system=no
455 have_w32_system=no
456 use_simple_gettext=no
457 case "${host}" in
458     *-mingw32*)
459         # special stuff for Windoze NT
460         ac_cv_have_dev_random=no
461         AC_DEFINE(USE_ONLY_8DOT3,1,
462                   [set this to limit filenames to the 8.3 format])
463         AC_DEFINE(HAVE_DRIVE_LETTERS,1,
464                   [defined if we must run on a stupid file system])
465         AC_DEFINE(USE_SIMPLE_GETTEXT,1,
466                   [because the Unix gettext has too much overhead on
467                    MingW32 systems and these systems lack Posix functions,
468                    we use a simplified version of gettext])
469         disable_keyserver_path=yes
470         have_dosish_system=yes
471         have_w32_system=yes
472         try_gettext="no"
473         use_simple_gettext=yes
474         ;;
475     i?86-emx-os2 | i?86-*-os2*emx )
476         # OS/2 with the EMX environment
477         ac_cv_have_dev_random=no
478         AC_DEFINE(HAVE_DRIVE_LETTERS)
479         have_dosish_system=yes
480         try_gettext="no"
481         ;;
483     i?86-*-msdosdjgpp*)
484         # DOS with the DJGPP environment
485         ac_cv_have_dev_random=no
486         AC_DEFINE(HAVE_DRIVE_LETTERS)
487         have_dosish_system=yes
488         try_gettext="no"
489         ;;
491     *-*-freebsd*)
492        # FreeBSD
493        CPPFLAGS="$CPPFLAGS -I/usr/local/include"
494        LDFLAGS="$LDFLAGS -L/usr/local/lib"
495        ;;
497     *-*-hpux*)
498         if test -z "$GCC" ; then
499             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
500         fi
501         ;;
502     *-dec-osf4*)
503         if test -z "$GCC" ; then
504             # Suppress all warnings
505             # to get rid of the unsigned/signed char mismatch warnings.
506             CFLAGS="$CFLAGS -w"
507         fi
508         ;;
509     *-dec-osf5*)
510         if test -z "$GCC" ; then
511             # Use the newer compiler `-msg_disable ptrmismatch1' to
512             # get rid of the unsigned/signed char mismatch warnings.
513             # Using this may hide other pointer mismatch warnings, but
514             # it at least lets other warning classes through
515             CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
516         fi
517         ;;
518     m68k-atari-mint)
519         ;;
520     *)
521        ;;
522 esac
524 if test "$have_dosish_system" = yes; then
525    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
526              [Defined if we run on some of the PCDOS like systems 
527               (DOS, Windoze. OS/2) with special properties like
528               no file modes])
530 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
532 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
534 if test "$have_w32_system" = yes; then
535    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
537 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
539 if test "$disable_keyserver_path" = yes; then
540     AC_DEFINE(DISABLE_KEYSERVER_PATH,1,
541               [Defined to disable exec-path for keyserver helpers])
544 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
545 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
547 if test x"$try_hkp" = xyes ; then
548   AC_SUBST(GPGKEYS_HKP,"gpg2keys_hkp$EXEEXT")
551 if test x"$try_finger" = xyes ; then
552   AC_SUBST(GPGKEYS_FINGER,"gpg2keys_finger$EXEEXT")
558 # Checks for libraries.
563 # libgpg-error is a library with error codes shared between GnuPG
564 # related projects.
566 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
567                   have_gpg_error=yes,have_gpg_error=no)
571 # Libgcrypt is our generic crypto library
573 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
574         have_libgcrypt=yes,have_libgcrypt=no)
578 # libassuan is used for IPC
580 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_VERSION",
581                   have_libassuan=yes,have_libassuan=no)
585 # libksba is our X.509 support library
587 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
591 # libusb allows us to use the integrated CCID smartcard reader driver.
593 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
594 AC_CHECK_LIB(usb, usb_bulk_write,
595               [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
596                 AC_DEFINE(HAVE_LIBUSB,1,
597                          [defined if libusb is available])
598                 have_libusb=yes
599              ])
600 AC_SUBST(LIBUSB_LIBS)
601 AC_CHECK_FUNCS(usb_create_match)
604 # Check wether it is necessary to link against libdl.
606 LIBS=""
607 AC_SEARCH_LIBS(dlopen, c dl,,,)
608 DL_LIBS=$LIBS
609 AC_SUBST(DL_LIBS)
612 # Checks for symcryptrun:
615 # libutil has openpty() and login_tty().
616 AC_CHECK_LIB(util, openpty,
617               [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
618                 AC_DEFINE(HAVE_LIBUTIL,1,
619                          [defined if libutil is available])
620              ])
621 AC_SUBST(LIBUTIL_LIBS)
623 # shred is used to clean temporary plain text files.
624 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
625 AC_DEFINE_UNQUOTED(SHRED,
626         "${SHRED}", [defines the filename of the shred program])
631 # Check whether the GNU Pth library is available
632 # Note, that we include a Pth emulation for W32.
634 AC_ARG_WITH(pth-prefix,
635             AC_HELP_STRING([--with-pth-prefix=PFX],
636                            [prefix where GNU Pth is installed (optional)]),
637      pth_config_prefix="$withval", pth_config_prefix="")
638 if test x$pth_config_prefix != x ; then
639    PTH_CONFIG="$pth_config_prefix/bin/pth-config"
641 AC_PATH_PROG(PTH_CONFIG, pth-config, no)
642 if test "$have_w32_system" = no; then
643  if test "$PTH_CONFIG" = "no"; then
644     AC_MSG_WARN([[
646 *** To support concurrent access to the gpg-agent and the SCdaemon
647 *** we need the support of the GNU Portable Threads Library.
648 *** Download it from ftp://ftp.gnu.org/gnu/pth/
649 *** On a Debian GNU/Linux system you might want to try 
650 ***   apt-get install libpth-dev
651 ***]])
652  else
653   GNUPG_PTH_VERSION_CHECK(1.3.7)
654   if test $have_pth = yes; then      
655      PTH_CFLAGS=`$PTH_CONFIG --cflags`
656      PTH_LIBS=`$PTH_CONFIG --ldflags`
657      PTH_LIBS="$PTH_LIBS `$PTH_CONFIG --libs --all`"
658      AC_DEFINE(USE_GNU_PTH, 1,
659               [Defined if the GNU Portable Thread Library should be used])
660      AC_DEFINE(HAVE_PTH, 1,
661               [Defined if the GNU Pth is available])
662   fi
663  fi
664 else 
665  have_pth=yes
666  PTH_CFLAGS=""
667  PTH_LIBS=""
668  AC_DEFINE(USE_GNU_PTH, 1)
669  AC_DEFINE(HAVE_PTH, 1)
671 AC_SUBST(PTH_CFLAGS)
672 AC_SUBST(PTH_LIBS)
676 # Must check for network library requirements before doing link tests
677 # for ldap, for example. If ldap libs are static (or dynamic and without
678 # ELF runtime link paths), then link will fail and LDAP support won't
679 # be detected.
681 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
682         [NETLIBS="-lnsl $NETLIBS"]))
683 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
684         [NETLIBS="-lsocket $NETLIBS"]))
687 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
689 if test x"$try_hkp" = xyes || test x"$try_http" = xyes ; then
690   AC_ARG_ENABLE(dns-srv,
691      AC_HELP_STRING([--disable-dns-srv],
692                     [disable the use of DNS SRV in HKP and HTTP]),
693                 use_dns_srv=$enableval,use_dns_srv=yes)
696 AC_ARG_ENABLE(dns-pka,
697    AC_HELP_STRING([--disable-dns-pka],
698         [disable the use of PKA records in DNS]),
699    use_dns_pka=$enableval,use_dns_pka=yes)
701 AC_ARG_ENABLE(dns-cert,
702    AC_HELP_STRING([--disable-dns-cert],
703         [disable the use of CERT records in DNS]),
704    use_dns_cert=$enableval,use_dns_cert=yes)
706 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
707    || test x"$use_dns_cert" = xyes; then
708   _dns_save_libs=$LIBS
709   LIBS=""
710   # the double underscore thing is a glibc-ism?
711   AC_SEARCH_LIBS(res_query,resolv bind,,
712                  AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
713   AC_SEARCH_LIBS(dn_expand,resolv bind,,
714                  AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
715   AC_SEARCH_LIBS(dn_skipname,resolv bind,,
716                  AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
718   if test x"$have_resolver" != xno ; then
720     # Make sure that the BIND 4 resolver interface is workable before
721     # enabling any code that calls it.  At some point I'll rewrite the
722     # code to use the BIND 8 resolver API.
724     AC_MSG_CHECKING([whether the resolver is usable])
725     AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
726 #include <netinet/in.h>
727 #include <arpa/nameser.h>
728 #include <resolv.h>],
729 [[unsigned char answer[PACKETSZ];
730   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
731   dn_skipname(0,0); 
732   dn_expand(0,0,0,0,0);
733 ]])],have_resolver=yes,have_resolver=no)
734     AC_MSG_RESULT($have_resolver)
736     # This is Apple-specific and somewhat bizarre as they changed the
737     # define in bind 8 for some reason.
739     if test x"$have_resolver" != xyes ; then
740        AC_MSG_CHECKING(
741              [whether I can make the resolver usable with BIND_8_COMPAT])
742        AC_LINK_IFELSE([AC_LANG_PROGRAM([#define BIND_8_COMPAT
743 #include <sys/types.h>
744 #include <netinet/in.h>
745 #include <arpa/nameser.h>
746 #include <resolv.h>],
747 [[unsigned char answer[PACKETSZ];
748   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
749   dn_skipname(0,0); dn_expand(0,0,0,0,0);
750 ]])],[have_resolver=yes ; need_compat=yes])
751        AC_MSG_RESULT($have_resolver)
752     fi
753   fi
755   if test x"$have_resolver" = xyes ; then
756      DNSLIBS=$LIBS
758      if test x"$use_dns_srv" = xyes ; then
759         AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
760      fi
762      if test x"$use_dns_pka" = xyes ; then
763         AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
764      fi
766      if test x"$use_dns_cert" = xyes ; then
767         AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
768      fi
770      if test x"$need_compat" = xyes ; then
771         AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
772      fi
773   else
774      use_dns_srv=no
775      use_dns_pka=no
776      use_dns_cert=no
777   fi
779   LIBS=$_dns_save_libs
782 AC_SUBST(DNSLIBS)
784 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
787 # Check for LDAP
789 if test "$try_ldap" = yes ; then
790    GNUPG_CHECK_LDAP($NETLIBS)
794 # Check for curl.  We fake the curl API if libcurl isn't installed.
796 LIBCURL_CHECK_CONFIG([yes],,,[fake_curl=yes])
797 AM_CONDITIONAL(FAKE_CURL,test x"$fake_curl" = xyes)
799 # Generic, for us, means curl
801 if test x"$try_generic" = xyes ; then
802    AC_SUBST(GPGKEYS_CURL,"gpg2keys_curl$EXEEXT")
806 # Check for sendmail
808 # This isn't necessarily sendmail itself, but anything that gives a
809 # sendmail-ish interface to the outside world.  That includes Exim,
810 # Postfix, etc.  Basically, anything that can handle "sendmail -t".
811 if test "$try_mailto" = yes ; then
812   AC_ARG_WITH(mailprog,
813       AC_HELP_STRING([--with-mailprog=NAME],
814                      [use "NAME -t" for mail transport]),
815              ,with_mailprog=yes)
817   if test x"$with_mailprog" = xyes ; then
818     AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
819     if test "$ac_cv_path_SENDMAIL" ; then
820       GPGKEYS_MAILTO="gpg2keys_mailto"
821     fi
822   elif test x"$with_mailprog" != xno ; then
823     AC_MSG_CHECKING([for a mail transport program])
824     AC_SUBST(SENDMAIL,$with_mailprog)
825     AC_MSG_RESULT($with_mailprog)
826     GPGKEYS_MAILTO="gpg2keys_mailto"
827   fi
830 AC_SUBST(GPGKEYS_MAILTO)
833 # Construct a printable name of the OS
835 case "${host}" in
836     *-mingw32*)
837         PRINTABLE_OS_NAME="MingW32"
838         ;;
839     *-*-cygwin*)
840         PRINTABLE_OS_NAME="Cygwin"
841         ;;
842     i?86-emx-os2 | i?86-*-os2*emx )
843         PRINTABLE_OS_NAME="OS/2"
844         ;;
845     i?86-*-msdosdjgpp*)
846         PRINTABLE_OS_NAME="MSDOS/DJGPP"
847         try_dynload=no
848         ;;
849     *-linux*)
850         PRINTABLE_OS_NAME="GNU/Linux"
851         ;;
852     *)
853         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
854         ;;
855 esac
856 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
857                    [A human readable text with the name of the OS])
861 # Check for gettext
863 AM_GNU_GETTEXT_VERSION(0.14.1)
864 if test "$try_gettext" = yes; then
865   AM_GNU_GETTEXT(,[need-ngettext])
867   # gettext requires some extra checks.  These really should be part of
868   # the basic AM_GNU_GETTEXT macro.  TODO: move other gettext-specific
869   # function checks to here.
871   AC_CHECK_FUNCS(strchr)
872 else
873   USE_NLS=no
874   USE_INCLUDED_LIBINTL=no
875   BUILD_INCLUDED_LIBINTL=no
876   AC_SUBST(USE_NLS)
877   AC_SUBST(USE_INCLUDED_LIBINTL)
878   AC_SUBST(BUILD_INCLUDED_LIBINTL)
879   AM_PO_SUBDIRS
884 # SELinux support
886 if test "$selinux_support" = yes ; then
887   AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
892 # Checks for header files.
894 AC_HEADER_STDC
895 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h])
896 AC_CHECK_HEADERS([pwd.h inttypes.h])
897 # Note that we do not check for iconv here because this is done anyway
898 # by the gettext checks and thus it allows us to disable the use of
899 # iconv by using --disable-nls.
903 # Checks for typedefs, structures, and compiler characteristics.
905 AC_C_CONST
906 AC_C_INLINE
907 AC_C_VOLATILE
908 AC_TYPE_SIZE_T
909 AC_TYPE_MODE_T
910 AC_TYPE_SIGNAL
911 AC_DECL_SYS_SIGLIST
913 AC_ARG_ENABLE(endian-check,
914               AC_HELP_STRING([--disable-endian-check],
915               [disable the endian check and trust the OS provided macros]),
916               endiancheck=$enableval,endiancheck=yes)
918 if test x"$endiancheck" = xyes ; then
919   GNUPG_CHECK_ENDIAN
922 # fixme: we should get rid of the byte type
923 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
924 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
925 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
926 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
927 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
929 AC_CHECK_SIZEOF(unsigned short)
930 AC_CHECK_SIZEOF(unsigned int)
931 AC_CHECK_SIZEOF(unsigned long)
932 AC_CHECK_SIZEOF(unsigned long long)
933 # Ensure that we have UINT64_C before we bother to check for uint64_t
934 # Fixme: really needed in gnupg?  I think it is only useful in libcgrypt.
935 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
936    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <inttypes.h>
937        uint64_t foo=UINT64_C(42);]),
938      gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
939 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
940    AC_CHECK_SIZEOF(uint64_t)
943 if test "$ac_cv_sizeof_unsigned_short" = "0" \
944    || test "$ac_cv_sizeof_unsigned_int" = "0" \
945    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
946     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
950 # fixme: do we really need this - it should be encapsulated in libassuan
952 GNUPG_SYS_SO_PEERCRED
956 # Checks for library functions.
958 AC_CHECK_DECLS(getpagesize)
959 AC_FUNC_FSEEKO
960 AC_FUNC_VPRINTF
961 AC_FUNC_FORK
962 AC_CHECK_FUNCS([strerror stpcpy strsep strlwr tcgetattr strtoul mmap])
963 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times timegm gmtime_r])
964 AC_CHECK_FUNCS([unsetenv getpwnam getpwuid fcntl ftruncate])
965 AC_CHECK_FUNCS([memmove gettimeofday getrusage setrlimit clock_gettime])
966 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
967 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe stat getaddrinfo])
968 AC_CHECK_FUNCS([ttyname isascii memrchr rand ftello])
970 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
973 # gnulib checks
975 gl_SOURCE_BASE(gl)
976 gl_M4_BASE(gl/m4)
977 gl_MODULES(setenv strsep mkdtemp vasprintf xsize)
978 gl_INIT
982 # These are needed by libjnlib - fixme: we should have macros for them
984 AC_CHECK_FUNCS([memicmp stpcpy strlwr strtoul memmove stricmp strtol])
985 AC_CHECK_FUNCS([getrusage setrlimit stat setlocale])
986 AC_CHECK_FUNCS([flockfile funlockfile fopencookie funopen])
990 # W32 specific test
992 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
996 # Sanity check regex.  Tests adapted from mutt.
997 # FIXME: We should use the the regex from gnulib
999 AC_MSG_CHECKING([whether regular expression support is requested])
1000 AC_ARG_ENABLE(regex,
1001   AC_HELP_STRING([--disable-regex],
1002     [do not handle regular expressions in trust signatures]),
1003   use_regex=$enableval, use_regex=yes)
1004 AC_MSG_RESULT($use_regex)
1006 if test "$use_regex" = yes ; then
1007   AC_MSG_CHECKING([whether the included regex lib is requested])
1008   AC_ARG_WITH(included-regex,
1009       [  --with-included-regex   use the included GNU regex library],
1010       [gnupg_cv_included_regex="$withval"],[gnupg_cv_included_regex=no])
1011   AC_MSG_RESULT($gnupg_cv_included_regex)
1013   if test $gnupg_cv_included_regex = no ; then
1014      # Does the system have regex functions at all?
1015      AC_CHECK_FUNC(regcomp,gnupg_cv_included_regex=no,
1016                            gnupg_cv_included_regex=yes)
1017   fi
1019   if test $gnupg_cv_included_regex = no ; then
1020      AC_CACHE_CHECK([whether your system's regexp library is broken],
1021        [gnupg_cv_regex_broken],
1022        AC_TRY_RUN([
1023 #include <unistd.h>
1024 #include <regex.h>
1025 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); }],
1026        gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1028      if test $gnupg_cv_regex_broken = yes ; then
1029       AC_MSG_WARN(your regex is broken - using the included GNU regex instead.)
1030       gnupg_cv_included_regex=yes
1031      fi
1032   fi
1034   if test $gnupg_cv_included_regex = yes; then
1035      AC_DEFINE(USE_INTERNAL_REGEX,1,[ Define if you want to use the included regex lib ])
1036   fi
1037 else
1038   AC_DEFINE(DISABLE_REGEX,1,[ Define to disable regular expression support ])
1041 AM_CONDITIONAL(USE_INTERNAL_REGEX, test x"$gnupg_cv_included_regex" = xyes)
1046 # Do we have zlib? Must do it here because Solaris failed
1047 # when compiling a conftest (due to the "-lz" from LIBS).
1048 # Note that we combine zlib and bzlib2 in ZLIBS.
1050 _cppflags="${CPPFLAGS}"
1051 _ldflags="${LDFLAGS}"
1052 AC_ARG_WITH(zlib,
1053   [  --with-zlib=DIR         use libz in DIR],[
1054     if test -d "$withval"; then
1055       CPPFLAGS="${CPPFLAGS} -I$withval/include"
1056       LDFLAGS="${LDFLAGS} -L$withval/lib"
1057     fi
1058   ])
1060 AC_CHECK_HEADER(zlib.h,
1061       AC_CHECK_LIB(z, deflateInit2_,
1062        ZLIBS="-lz",
1063        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1064        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1067 # Check whether we can support bzip2
1069 if test "$use_bzip2" = yes ; then
1070   _cppflags="${CPPFLAGS}"
1071   _ldflags="${LDFLAGS}"
1072   AC_ARG_WITH(bzip2,
1073      AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1074       [
1075       if test -d "$withval" ; then
1076         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1077         LDFLAGS="${LDFLAGS} -L$withval/lib"
1078       fi
1079       ],withval="")
1081   # Checking alongside stdio.h as an early version of bzip2 (1.0)
1082   # required stdio.h to be included before bzlib.h, and Solaris 9 is 
1083   # woefully out of date.
1084   if test "$withval" != no ; then
1085      AC_CHECK_HEADER(bzlib.h,
1086         AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1087           [
1088           have_bz2=yes
1089           ZLIBS="$ZLIBS -lbz2"
1090           AC_DEFINE(HAVE_BZIP2,1,
1091                   [Defined if the bz2 compression library is available])
1092           ],
1093           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1094           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1095   fi
1097 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1098 AC_SUBST(ZLIBS)
1101 # Check for readline support
1102 GNUPG_CHECK_READLINE
1104 # See wether we want to run the long test suite.
1105 AC_ARG_WITH(pkits-tests,
1106     AC_HELP_STRING([--with-pkits-tests],[run the PKITS based tests]),
1107     [run_pkits_tests=$withval], [run_pkits_tests=no])
1108 AM_CONDITIONAL(RUN_PKITS_TESTS, test "$run_pkits_tests" = "yes")
1111 # Allow users to append something to the version string without
1112 # flagging it as development version.  The user version parts is
1113 # considered everything after a dash. 
1115 if test "$development_version" != yes; then
1116   changequote(,)dnl
1117   tmp_pat='[a-zA-Z]'
1118   changequote([,])dnl
1119   if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
1120     development_version=yes
1121   fi
1123 if test "$development_version" = yes; then
1124     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1125             [Defined if this is not a regular release])
1128 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1130 GNUPG_CHECK_GNUMAKE
1132 # Add some extra libs here so that previous tests don't fail for
1133 # mysterious reasons - the final link step should bail out. 
1134 if test "$have_w32_system" = yes; then
1135    W32LIBS="-lwsock32"
1138 AC_SUBST(NETLIBS)
1139 AC_SUBST(W32LIBS)
1143 # Setup gcc specific options
1145 if test "$GCC" = yes; then
1146     # Note that it is okay to use CFLAGS here because this are just
1147     # warning options and the user should have a chance of overriding
1148     # them.
1149     if test "$USE_MAINTAINER_MODE" = "yes"; then
1150         CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1151         CFLAGS="$CFLAGS -Wno-format-y2k -Wformat-security -Wformat-nonliteral"
1152     else
1153         CFLAGS="$CFLAGS -Wall"
1154     fi
1156     AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1157     _gcc_cflags_save=$CFLAGS
1158     CFLAGS="-Wno-pointer-sign"
1159     AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
1160     AC_MSG_RESULT($_gcc_psign)
1161     CFLAGS=$_gcc_cflags_save;
1162     if test x"$_gcc_psign" = xyes ; then
1163        CFLAGS="$CFLAGS -Wno-pointer-sign"
1164     fi
1169 # This is handy for debugging so the compiler doesn't rearrange
1170 # things and eliminate variables.
1172 AC_ARG_ENABLE(optimization,
1173    AC_HELP_STRING([--disable-optimization],
1174                   [disable compiler optimization]),
1175                   [if test $enableval = no ; then
1176                       CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
1177                    fi])
1180 # For W32 we need to use our Pth emulation code
1182 if test "$have_w32_system" = yes; then
1183   AC_CONFIG_LINKS(pth.h:jnlib/w32-pth.h)
1188 # Decide what to build
1190 missing_pth=no
1191 if test $have_ksba = no; then
1192   build_gpgsm=no
1193   build_scdaemon=no
1196 build_agent_threaded=""
1197 if test "$build_agent" = "yes"; then
1198   if test $have_pth = no; then
1199      build_agent_threaded="(not multi-threaded)"
1200      missing_pth=yes
1201   fi
1204 build_scdaemon_extra=""
1205 if test "$build_scdaemon" = "yes"; then
1206   tmp=""
1207   if test $have_pth = no; then
1208      build_scdaemon_extra="not multi-threaded"
1209      tmp=", "
1210      missing_pth=yes
1211   fi
1212   if test $have_libusb = no; then
1213      build_scdaemon_extra="${tmp}without internal CCID driver"
1214      tmp=", "
1215   fi
1216   if test -n "$build_scdaemon_extra"; then
1217      build_scdaemon_extra="(${build_scdaemon_extra})"
1218   fi
1222 if test "$build_agent_only" = "yes" ; then
1223   build_gpg=no
1224   build_gpgsm=no
1225   build_scdaemon=no
1229 AM_CONDITIONAL(BUILD_GPG,   test "$build_gpg" = "yes")
1230 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1231 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1232 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1233 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1235 AM_CONDITIONAL(RUN_GPG_TESTS,
1236         test x$cross_compiling = xno -a "$build_gpg" = yes )
1240 # Print errors here so that they are visible all
1241 # together and the user can acquire them all together.
1243 die=no
1244 if test "$have_gpg_error" = "no"; then
1245    die=yes
1246    AC_MSG_NOTICE([[
1247 ***  
1248 *** You need libgpg-error to build this program.
1249 **  This library is for example available at
1250 ***   ftp://ftp.gnupg.org/gcrypt/libgpg-error
1251 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1252 ***]])
1254 if test "$have_libgcrypt" = "no"; then
1255    die=yes
1256    AC_MSG_NOTICE([[
1257 ***  
1258 *** You need libgcrypt to build this program.
1259 **  This library is for example available at
1260 ***   ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1261 *** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API is required.)
1262 ***]])
1264 if test "$have_libassuan" = "no"; then
1265    die=yes
1266    AC_MSG_NOTICE([[
1268 *** You need libassuan to build this program.
1269 *** This library is for example available at
1270 ***   ftp://ftp.gnupg.org/gcrypt/alpha/libassuan/
1271 *** (at least version $NEED_LIBASSUAN_VERSION is required).
1272 ***]])
1274 if test "$have_ksba" = "no"; then
1275     AC_MSG_NOTICE([[
1277 *** You need libksba to build this program.
1278 *** This library is for example available at
1279 ***   ftp://ftp.gnupg.org/gcrypt/libksba/
1280 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1281 ***]])
1283 if test "$missing_pth" = "yes"; then
1284     AC_MSG_NOTICE([[
1286 *** It is now required to build with support for the
1287 *** GNU Portable Threads Library (Pth). Please install this
1288 *** library first.  The library is for example available at
1289 ***   ftp://ftp.gnu.org/gnu/pth/
1290 *** On a Debian GNU/Linux system you can install it using 
1291 ***   apt-get install libpth-dev
1292 ***]])
1293    die=yes
1296 if test "$die" = "yes"; then
1297     AC_MSG_ERROR([[
1299 *** Required libraries not found. Please consult the above messages
1300 *** and install them before running configure again.
1301 ***]])
1306 AC_CONFIG_FILES([ m4/Makefile 
1307 Makefile
1308 po/Makefile.in
1309 intl/Makefile
1310 gl/Makefile
1311 jnlib/Makefile
1312 common/Makefile
1313 kbx/Makefile
1314 g10/Makefile
1315 sm/Makefile
1316 agent/Makefile
1317 scd/Makefile
1318 keyserver/Makefile
1319 keyserver/gpgkeys_mailto
1320 keyserver/gpgkeys_test
1321 tools/gpg-zip
1322 tools/Makefile
1323 doc/Makefile
1324 tests/Makefile
1325 tests/openpgp/Makefile
1327 AC_OUTPUT
1329 #tests/pkits/Makefile
1334 echo "
1335         GnuPG v${VERSION} has been configured as follows:
1336         
1337         Platform:  $PRINTABLE_OS_NAME ($host)
1339         OpenPGP:   $build_gpg
1340         S/MIME:    $build_gpgsm
1341         Agent:     $build_agent $build_agent_threaded
1342         Smartcard: $build_scdaemon $build_scdaemon_extra
1344         Protect tool:      $show_gnupg_protect_tool_pgm
1345         Default agent:     $show_gnupg_agent_pgm
1346         Default pinentry:  $show_gnupg_pinentry_pgm
1347         Default scdaemon:  $show_gnupg_scdaemon_pgm
1348         Default dirmngr:   $show_gnupg_dirmngr_pgm
1350         PKITS based tests: $run_pkits_tests