jnlib/
[gnupg.git] / configure.ac
blobb46c8e33dd2d7fdcda9aa5b24284b19ffd98e584
1 # configure.ac - for GnuPG 2.0
2 # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
3 #               2006, 2007 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.61)
24 min_automake_version="1.10"
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], [2.0.5])
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=no
42 NEED_GPG_ERROR_VERSION=1.4
44 NEED_LIBGCRYPT_API=1
45 NEED_LIBGCRYPT_VERSION=1.2.2
47 NEED_LIBASSUAN_API=1
48 NEED_LIBASSUAN_VERSION=0.9.3
50 NEED_KSBA_API=1
51 NEED_KSBA_VERSION=1.0.0
54 PACKAGE=$PACKAGE_NAME
55 PACKAGE_GT=${PACKAGE_NAME}2
56 VERSION=$PACKAGE_VERSION
58 AC_CONFIG_AUX_DIR(scripts)
59 AC_CONFIG_SRCDIR(sm/gpgsm.c)
60 AM_CONFIG_HEADER(config.h)
61 AC_CANONICAL_TARGET()
62 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
63 AB_INIT
65 AC_GNU_SOURCE
67 # Some status variables.
68 have_gpg_error=no
69 have_libgcrypt=no 
70 have_libassuan=no
71 have_ksba=no
72 have_pth=no
73 have_libusb=no
75 use_bzip2=yes
76 use_exec=yes
77 disable_keyserver_path=no
80 GNUPG_BUILD_PROGRAM(gpg, yes)
81 GNUPG_BUILD_PROGRAM(gpgsm, yes)
82 GNUPG_BUILD_PROGRAM(agent, yes)
83 GNUPG_BUILD_PROGRAM(scdaemon, yes)
84 GNUPG_BUILD_PROGRAM(tools, yes)
85 GNUPG_BUILD_PROGRAM(doc, yes)
86 GNUPG_BUILD_PROGRAM(symcryptrun, no)
88 AC_SUBST(PACKAGE)
89 AC_SUBST(PACKAGE_GT)
90 AC_SUBST(VERSION)
91 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
92 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
93                                 [Name of this package for gettext])
94 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
95 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
96                                         [Bug report address])
97 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
98                                        [Required version of Libgcrypt])
99 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
100                                        [Required version of Libksba])
104 # The default is to use the modules from this package and the few
105 # other packages in a standard place; i.e where this package gets
106 # installed.  With these options it is possible to override these
107 # ${prefix} depended values with fixed paths, which can't be replaced
108 # at make time.  See also am/cmacros.am and the defaults in AH_BOTTOM.
109 AC_ARG_WITH(agent-pgm,
110     [  --with-agent-pgm=PATH  Use PATH as the default for the agent)],
111           GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
112 AC_SUBST(GNUPG_AGENT_PGM)
113 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
114 show_gnupg_agent_pgm="(default)"
115 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
117 AC_ARG_WITH(pinentry-pgm,
118     [  --with-pinentry-pgm=PATH  Use PATH as the default for the pinentry)],
119           GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
120 AC_SUBST(GNUPG_PINENTRY_PGM)
121 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
122 show_gnupg_pinentry_pgm="(default)"
123 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
126 AC_ARG_WITH(scdaemon-pgm,
127     [  --with-scdaemon-pgm=PATH  Use PATH as the default for the scdaemon)],
128           GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
129 AC_SUBST(GNUPG_SCDAEMON_PGM)
130 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
131 show_gnupg_scdaemon_pgm="(default)"
132 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
135 AC_ARG_WITH(dirmngr-pgm,
136     [  --with-dirmngr-pgm=PATH  Use PATH as the default for the dirmngr)],
137           GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
138 AC_SUBST(GNUPG_DIRMNGR_PGM)
139 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
140 show_gnupg_dirmngr_pgm="(default)"
141 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
143 AC_ARG_WITH(protect-tool-pgm,
144     [  --with-protect-tool-pgm=PATH  Use PATH as the default for the protect-tool)],
145           GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
146 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
147 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
148 show_gnupg_protect_tool_pgm="(default)"
149 test -n "$GNUPG_PROTECT_TOOL_PGM" \
150       && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
153 # Some folks want to use only the agent from this packet.  Make it
154 # easier for them by providing the configure option
155 # --enable-only-agent.
156 AC_ARG_ENABLE(agent-only,
157     AC_HELP_STRING([--enable-agent-only],[build only the gpg-agent]),
158     build_agent_only=$enableval)
160 # SELinux support includes tracking of sensitive files to avoid
161 # leaking their contents through processing these files by gpg itself
162 AC_MSG_CHECKING([whether SELinux support is requested])
163 AC_ARG_ENABLE(selinux-support,
164               AC_HELP_STRING([--enable-selinux-support],
165                              [enable SELinux support]),
166               selinux_support=$enableval, selinux_support=no)
167 AC_MSG_RESULT($selinux_support)
169 # Allow disabling of bzib2 support.
170 # It is defined only after we confirm the library is available later
171 AC_MSG_CHECKING([whether to enable the BZIP2 compression algorithm])
172 AC_ARG_ENABLE(bzip2,
173    AC_HELP_STRING([--disable-bzip2],[disable the BZIP2 compression algorithm]),
174    use_bzip2=$enableval)
175 AC_MSG_RESULT($use_bzip2)
178 # Configure option to allow or disallow execution of external
179 # programs, like a photo viewer.
180 AC_MSG_CHECKING([whether to enable external program execution])
181 AC_ARG_ENABLE(exec,
182     AC_HELP_STRING([--disable-exec],[disable all external program execution]),
183     use_exec=$enableval)
184 AC_MSG_RESULT($use_exec)
185 if test "$use_exec" = no ; then
186     AC_DEFINE(NO_EXEC,1,[Define to disable all external program execution])
189 if test "$use_exec" = yes ; then
190   AC_MSG_CHECKING([whether to enable photo ID viewing])
191   AC_ARG_ENABLE(photo-viewers,
192       [  --disable-photo-viewers disable photo ID viewers],
193       [if test "$enableval" = no ; then
194          AC_DEFINE(DISABLE_PHOTO_VIEWER,1,[define to disable photo viewing])
195       fi],enableval=yes)
196   gnupg_cv_enable_photo_viewers=$enableval
197   AC_MSG_RESULT($enableval)
199   if test "$gnupg_cv_enable_photo_viewers" = yes ; then
200     AC_MSG_CHECKING([whether to use a fixed photo ID viewer])
201     AC_ARG_WITH(photo-viewer,
202         [  --with-photo-viewer=FIXED_VIEWER  set a fixed photo ID viewer],
203         [if test "$withval" = yes ; then
204            withval=no
205         elif test "$withval" != no ; then
206            AC_DEFINE_UNQUOTED(FIXED_PHOTO_VIEWER,"$withval",
207                             [if set, restrict photo-viewer to this])
208         fi],withval=no)
209     AC_MSG_RESULT($withval)
210   fi
212   AC_MSG_CHECKING([whether to enable external keyserver helpers])
213   AC_ARG_ENABLE(keyserver-helpers,
214       [  --disable-keyserver-helpers  disable all external keyserver support],
215       [if test "$enableval" = no ; then
216          AC_DEFINE(DISABLE_KEYSERVER_HELPERS,1,
217                   [define to disable keyserver helpers])
218       fi],enableval=yes)
219   gnupg_cv_enable_keyserver_helpers=$enableval
220   AC_MSG_RESULT($enableval)
222   if test "$gnupg_cv_enable_keyserver_helpers" = yes ; then
223     # LDAP is defined only after we confirm the library is available later
224     AC_MSG_CHECKING([whether LDAP keyserver support is requested])
225     AC_ARG_ENABLE(ldap,
226       AC_HELP_STRING([--disable-ldap],[disable LDAP keyserver interface only]),
227       try_ldap=$enableval, try_ldap=yes)
228     AC_MSG_RESULT($try_ldap)
230     AC_MSG_CHECKING([whether HKP keyserver support is requested])
231     AC_ARG_ENABLE(hkp,
232       AC_HELP_STRING([--disable-hkp],[disable HKP keyserver interface only]),
233       try_hkp=$enableval, try_hkp=yes)
234     AC_MSG_RESULT($try_hkp)
236     AC_MSG_CHECKING([whether finger key fetching support is requested])
237     AC_ARG_ENABLE(finger,
238       AC_HELP_STRING([--disable-finger],
239         [disable finger key fetching interface only]),
240       try_finger=$enableval, try_finger=yes)
241     AC_MSG_RESULT($try_finger)
243     AC_MSG_CHECKING([whether generic object key fetching support is requested])
244     AC_ARG_ENABLE(generic,
245       AC_HELP_STRING([--disable-generic],
246         [disable generic object key fetching interface only]),
247       try_generic=$enableval, try_generic=yes)
248     AC_MSG_RESULT($try_generic)
250     AC_MSG_CHECKING([whether email keyserver support is requested])
251     AC_ARG_ENABLE(mailto,
252       AC_HELP_STRING([--enable-mailto],
253         [enable email keyserver interface only]),
254       try_mailto=$enableval, try_mailto=no)
255     AC_MSG_RESULT($try_mailto)
256     fi
258     AC_MSG_CHECKING([whether keyserver exec-path is enabled])
259     AC_ARG_ENABLE(keyserver-path,
260       AC_HELP_STRING([--disable-keyserver-path],
261         [disable the exec-path option for keyserver helpers]),
262       [if test "$enableval" = no ; then
263          disable_keyserver_path=yes
264       fi],enableval=yes)
265     AC_MSG_RESULT($enableval)
266   fi
270 # Check for the key/uid cache size.  This can't be zero, but can be
271 # pretty small on embedded systems.  This is used for the gpg part.
273 AC_MSG_CHECKING([for the size of the key and uid cache])
274 AC_ARG_ENABLE(key-cache,
275         AC_HELP_STRING([--enable-key-cache=SIZE],
276                        [Set key cache to SIZE (default 4096)]),,enableval=4096)
277 if test "$enableval" = "no"; then
278    enableval=5
279 elif test "$enableval" = "yes" || test "$enableval" = ""; then
280    enableval=4096
282 changequote(,)dnl
283 key_cache_size=`echo "$enableval" | sed 's/[A-Za-z]//g'`
284 changequote([,])dnl
285 if test "$enableval" != "$key_cache_size" || test "$key_cache_size" -lt 5; then
286    AC_MSG_ERROR([invalid key-cache size])
288 AC_MSG_RESULT($key_cache_size)
289 AC_DEFINE_UNQUOTED(PK_UID_CACHE_SIZE,$key_cache_size,
290                   [Size of the key and UID caches])
295 # Check whether we want to use Linux capabilities
297 AC_MSG_CHECKING([whether use of capabilities is requested])
298 AC_ARG_WITH(capabilities,
299     [  --with-capabilities     use linux capabilities [default=no]],
300 [use_capabilities="$withval"],[use_capabilities=no])
301 AC_MSG_RESULT($use_capabilities)
304 # To avoid double inclusion of config.h which might happen at some
305 # places, we add the usual double inclusion protection at the top of
306 # config.h.
308 AH_TOP([
309 #ifndef GNUPG_CONFIG_H_INCLUDED
310 #define GNUPG_CONFIG_H_INCLUDED
314 # Stuff which goes at the bottom of config.h.
316 AH_BOTTOM([
317 /* This is the major version number of GnuPG so that
318    source included files can test for this.  Note, that
319    we use 2 here even for GnuPG 1.9.x. */
320 #define GNUPG_MAJOR_VERSION 2
322 /* Now to separate file name parts.
323    Please note that the string version must not contain more
324    than one character because the code assumes strlen()==1 */
325 #ifdef HAVE_DOSISH_SYSTEM
326 #define DIRSEP_C '\\'
327 #define DIRSEP_S "\\"
328 #define EXTSEP_C '.'
329 #define EXTSEP_S "."
330 #define PATHSEP_C ';'
331 #define PATHSEP_S ";"
332 #define EXEEXT_S ".exe"
333 #else
334 #define DIRSEP_C '/'
335 #define DIRSEP_S "/"
336 #define EXTSEP_C '.'
337 #define EXTSEP_S "."
338 #define PATHSEP_C ':'
339 #define PATHSEP_S ":"
340 #define EXEEXT_S ""
341 #endif
343 /* This is the same as VERSION, but should be overridden if the
344    platform cannot handle things like dots '.' in filenames. Set
345    SAFE_VERSION_DOT and SAFE_VERSION_DASH to whatever SAFE_VERSION
346    uses for dots and dashes. */
347 #define SAFE_VERSION VERSION
348 #define SAFE_VERSION_DOT  '.'
349 #define SAFE_VERSION_DASH '-'
351 /* Some global constants. */
352 #ifdef HAVE_DRIVE_LETTERS
353 #define GNUPG_DEFAULT_HOMEDIR "c:/gnupg"
354 #elif defined(__VMS)
355 #define GNUPG_DEFAULT_HOMEDIR "/SYS\$LOGIN/gnupg" 
356 #else
357 #define GNUPG_DEFAULT_HOMEDIR "~/.gnupg"
358 #endif 
359 #define GNUPG_PRIVATE_KEYS_DIR "private-keys-v1.d"
361 /* For some systems (DOS currently), we hardcode the path here.  For
362    POSIX systems the values are constructed by the Makefiles, so that
363    the values may be overridden by the make invocations; this is to
364    comply with the GNU coding standards. */
365 #ifdef HAVE_DRIVE_LETTERS
366  /* FIXME: We need to use a function to determine these values depending 
367     on the actual installation directory. */
368 #define GNUPG_BINDIR      "c:\\gnupg"
369 #define GNUPG_LIBEXECDIR  "c:\\gnupg"
370 #define GNUPG_LIBDIR      "c:\\gnupg"
371 #define GNUPG_DATADIR     "c:\\gnupg"
372 #define GNUPG_SYSCONFDIR  "c:\\gnupg"
373 #endif
375 /* Derive some other constants. */
376 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
377 #define EXEC_TEMPFILE_ONLY
378 #endif
381 /* We didn't define endianness above, so get it from OS macros.  This
382    is intended for making fat binary builds on OS X. */
383 #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST)
384 #if defined(__BIG_ENDIAN__)
385 #define BIG_ENDIAN_HOST 1
386 #elif defined(__LITTLE_ENDIAN__)
387 #define LITTLE_ENDIAN_HOST 1
388 #else
389 #error "No endianness found"
390 #endif
391 #endif
394 /* Tell libgcrypt not to use its own libgpg-error implementation. */
395 #define USE_LIBGPG_ERROR 1
397 /* We use jnlib, so tell other modules about it.  */
398 #define HAVE_JNLIB_LOGGING 1
400 /* Our HTTP code is used in estream mode.  */
401 #define HTTP_USE_ESTREAM 1
403 /* Under W32 we do an explicit socket initialization, thus we need to
404    avoid the on-demand initialization which would also install an atexit
405    handler.  */
406 #define HTTP_NO_WSASTARTUP
408 /* We always include support for the OpenPGP card.  */
409 #define ENABLE_CARD_SUPPORT 1
411 /* We don't want the old assuan codes anymore. */
412 #define _ASSUAN_ONLY_GPG_ERRORS 1
414 /* We explicitly need to disable PTH's soft mapping as Debian
415    currently enables it by default for no reason. */
416 #define PTH_SYSCALL_SOFT 0
418 /* We want to use the libgcrypt provided memory allocation for
419    asprintf.  */
420 #define _ESTREAM_PRINTF_MALLOC        gcry_malloc
421 #define _ESTREAM_PRINTF_FREE          gcry_free
422 #define _ESTREAM_PRINTF_EXTRA_INCLUDE "util.h"
424 #endif /*GNUPG_CONFIG_H_INCLUDED*/
428 AM_MAINTAINER_MODE
430 # Checks for programs.
431 AC_MSG_NOTICE([checking for programs])
432 AC_PROG_MAKE_SET
433 AM_SANITY_CHECK
434 missing_dir=`cd $ac_aux_dir && pwd`
435 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
436 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
437 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
438 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
439 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
440 AC_PROG_AWK
441 AC_PROG_CC
442 AC_PROG_CPP
443 AM_PROG_CC_C_O
444 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
445   AC_MSG_ERROR([[No C-89 compiler found]])
447 AC_PROG_INSTALL
448 AC_PROG_LN_S
449 AC_PROG_RANLIB
450 AC_CHECK_TOOL(AR, ar, :)
451 AC_PATH_PROG(PERL,"perl")
452 AC_CHECK_TOOL(WINDRES, windres, :)
453 AC_ISC_POSIX
454 gl_EARLY
455 AC_SYS_LARGEFILE
456 GNUPG_CHECK_FAQPROG
457 GNUPG_CHECK_USTAR
459 # We need to compile and run a program on the build machine.  A
460 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
461 # the AC archive is broken for autoconf 2.57.  Given that tehre is no
462 # newer version of that macro, we assume that it is also broken for
463 # autoconf 2.61 and thus we use a simple but usually sufficient
464 # approach.
465 AC_MSG_CHECKING(for cc for build)
466 if test "$cross_compiling" = "yes"; then
467   CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
468 else
469   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
471 AC_MSG_RESULT($CC_FOR_BUILD)
472 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
476 try_gettext=yes
477 have_dosish_system=no
478 have_w32_system=no
479 use_simple_gettext=no
480 case "${host}" in
481     *-mingw32*)
482         # special stuff for Windoze NT
483         ac_cv_have_dev_random=no
484         AC_DEFINE(USE_ONLY_8DOT3,1,
485                   [set this to limit filenames to the 8.3 format])
486         AC_DEFINE(HAVE_DRIVE_LETTERS,1,
487                   [defined if we must run on a stupid file system])
488         AC_DEFINE(USE_SIMPLE_GETTEXT,1,
489                   [because the Unix gettext has too much overhead on
490                    MingW32 systems and these systems lack Posix functions,
491                    we use a simplified version of gettext])
492         disable_keyserver_path=yes
493         have_dosish_system=yes
494         have_w32_system=yes
495         try_gettext="no"
496         use_simple_gettext=yes
497         ;;
498     i?86-emx-os2 | i?86-*-os2*emx )
499         # OS/2 with the EMX environment
500         ac_cv_have_dev_random=no
501         AC_DEFINE(HAVE_DRIVE_LETTERS)
502         have_dosish_system=yes
503         try_gettext="no"
504         ;;
506     i?86-*-msdosdjgpp*)
507         # DOS with the DJGPP environment
508         ac_cv_have_dev_random=no
509         AC_DEFINE(HAVE_DRIVE_LETTERS)
510         have_dosish_system=yes
511         try_gettext="no"
512         ;;
514     *-*-freebsd*)
515        # FreeBSD
516        CPPFLAGS="$CPPFLAGS -I/usr/local/include"
517        LDFLAGS="$LDFLAGS -L/usr/local/lib"
518        ;;
520     *-*-hpux*)
521         if test -z "$GCC" ; then
522             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
523         fi
524         ;;
525     *-dec-osf4*)
526         if test -z "$GCC" ; then
527             # Suppress all warnings
528             # to get rid of the unsigned/signed char mismatch warnings.
529             CFLAGS="$CFLAGS -w"
530         fi
531         ;;
532     *-dec-osf5*)
533         if test -z "$GCC" ; then
534             # Use the newer compiler `-msg_disable ptrmismatch1' to
535             # get rid of the unsigned/signed char mismatch warnings.
536             # Using this may hide other pointer mismatch warnings, but
537             # it at least lets other warning classes through
538             CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
539         fi
540         ;;
541     m68k-atari-mint)
542         ;;
543     *)
544        ;;
545 esac
547 if test "$have_dosish_system" = yes; then
548    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
549              [Defined if we run on some of the PCDOS like systems 
550               (DOS, Windoze. OS/2) with special properties like
551               no file modes])
553 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
555 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
557 if test "$have_w32_system" = yes; then
558    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
560 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
562 if test "$disable_keyserver_path" = yes; then
563     AC_DEFINE(DISABLE_KEYSERVER_PATH,1,
564               [Defined to disable exec-path for keyserver helpers])
567 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
568 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
570 if test x"$try_hkp" = xyes ; then
571   AC_SUBST(GPGKEYS_HKP,"gpg2keys_hkp$EXEEXT")
574 if test x"$try_finger" = xyes ; then
575   AC_SUBST(GPGKEYS_FINGER,"gpg2keys_finger$EXEEXT")
581 # Checks for libraries.
583 AC_MSG_NOTICE([checking for libraries])
587 # libgpg-error is a library with error codes shared between GnuPG
588 # related projects.
590 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
591                   have_gpg_error=yes,have_gpg_error=no)
595 # Libgcrypt is our generic crypto library
597 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
598         have_libgcrypt=yes,have_libgcrypt=no)
602 # libassuan is used for IPC
604 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
605                   have_libassuan=yes,have_libassuan=no)
606 if test "$have_libassuan" = "yes"; then
607   have_libassuan=no
608   AM_PATH_LIBASSUAN_PTH("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
609                         have_libassuan=yes,have_libassuan=no)
610   AM_CHECK_LIBASSUAN("$NEED_LIBASSUAN_API:1.0.1",
611        [AC_DEFINE(HAVE_ASSUAN_SET_IO_MONITOR, 1,
612          [Define to 1 if you have the `assuan_set_io_monitor' function.])],)  
618 # libksba is our X.509 support library
620 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
624 # libusb allows us to use the integrated CCID smartcard reader driver.
626 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
627 AC_CHECK_LIB(usb, usb_bulk_write,
628               [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
629                 AC_DEFINE(HAVE_LIBUSB,1,
630                          [defined if libusb is available])
631                 have_libusb=yes
632              ])
633 AC_SUBST(LIBUSB_LIBS)
634 AC_CHECK_FUNCS(usb_create_match)
637 # Check wether it is necessary to link against libdl.
639 gnupg_dlopen_save_libs="$LIBS"
640 LIBS=""
641 AC_SEARCH_LIBS(dlopen, c dl,,,)
642 DL_LIBS=$LIBS
643 AC_SUBST(DL_LIBS)
644 LIBS="$gnupg_dlopen_save_libs"
647 # Checks for symcryptrun:
650 # libutil has openpty() and login_tty().
651 AC_CHECK_LIB(util, openpty,
652               [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
653                 AC_DEFINE(HAVE_LIBUTIL,1,
654                          [defined if libutil is available])
655              ])
656 AC_SUBST(LIBUTIL_LIBS)
658 # shred is used to clean temporary plain text files.
659 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
660 AC_DEFINE_UNQUOTED(SHRED,
661         "${SHRED}", [defines the filename of the shred program])
666 # Check whether the GNU Pth library is available
667 # Note, that we include a Pth emulation for W32.
669 GNUPG_PATH_PTH
670 if test "$have_pth" = "yes"; then
671   AC_DEFINE(USE_GNU_PTH, 1,
672               [Defined if the GNU Portable Thread Library should be used])
673 else
674   AC_MSG_WARN([[
676 *** To support concurrent access to the gpg-agent and the SCdaemon
677 *** we need the support of the GNU Portable Threads Library.
678 *** Download it from ftp://ftp.gnu.org/gnu/pth/
679 *** On a Debian GNU/Linux system you might want to try 
680 ***   apt-get install libpth-dev
681 ***]])
685 AC_MSG_NOTICE([checking for networking options])
688 # Must check for network library requirements before doing link tests
689 # for ldap, for example. If ldap libs are static (or dynamic and without
690 # ELF runtime link paths), then link will fail and LDAP support won't
691 # be detected.
693 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
694         [NETLIBS="-lnsl $NETLIBS"]))
695 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
696         [NETLIBS="-lsocket $NETLIBS"]))
699 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
701 if test x"$try_hkp" = xyes || test x"$try_http" = xyes ; then
702   AC_ARG_ENABLE(dns-srv,
703      AC_HELP_STRING([--disable-dns-srv],
704                     [disable the use of DNS SRV in HKP and HTTP]),
705                 use_dns_srv=$enableval,use_dns_srv=yes)
708 AC_ARG_ENABLE(dns-pka,
709    AC_HELP_STRING([--disable-dns-pka],
710         [disable the use of PKA records in DNS]),
711    use_dns_pka=$enableval,use_dns_pka=yes)
713 AC_ARG_ENABLE(dns-cert,
714    AC_HELP_STRING([--disable-dns-cert],
715         [disable the use of CERT records in DNS]),
716    use_dns_cert=$enableval,use_dns_cert=yes)
718 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
719    || test x"$use_dns_cert" = xyes; then
720   _dns_save_libs=$LIBS
721   LIBS=""
722   # the double underscore thing is a glibc-ism?
723   AC_SEARCH_LIBS(res_query,resolv bind,,
724                  AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
725   AC_SEARCH_LIBS(dn_expand,resolv bind,,
726                  AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
727   AC_SEARCH_LIBS(dn_skipname,resolv bind,,
728                  AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
730   if test x"$have_resolver" != xno ; then
732     # Make sure that the BIND 4 resolver interface is workable before
733     # enabling any code that calls it.  At some point I'll rewrite the
734     # code to use the BIND 8 resolver API.
736     AC_MSG_CHECKING([whether the resolver is usable])
737     AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
738 #include <netinet/in.h>
739 #include <arpa/nameser.h>
740 #include <resolv.h>],
741 [[unsigned char answer[PACKETSZ];
742   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
743   dn_skipname(0,0); 
744   dn_expand(0,0,0,0,0);
745 ]])],have_resolver=yes,have_resolver=no)
746     AC_MSG_RESULT($have_resolver)
748     # This is Apple-specific and somewhat bizarre as they changed the
749     # define in bind 8 for some reason.
751     if test x"$have_resolver" != xyes ; then
752        AC_MSG_CHECKING(
753              [whether I can make the resolver usable with BIND_8_COMPAT])
754        AC_LINK_IFELSE([AC_LANG_PROGRAM([#define BIND_8_COMPAT
755 #include <sys/types.h>
756 #include <netinet/in.h>
757 #include <arpa/nameser.h>
758 #include <resolv.h>],
759 [[unsigned char answer[PACKETSZ];
760   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
761   dn_skipname(0,0); dn_expand(0,0,0,0,0);
762 ]])],[have_resolver=yes ; need_compat=yes])
763        AC_MSG_RESULT($have_resolver)
764     fi
765   fi
767   if test x"$have_resolver" = xyes ; then
768      DNSLIBS=$LIBS
770      if test x"$use_dns_srv" = xyes ; then
771         AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
772      fi
774      if test x"$use_dns_pka" = xyes ; then
775         AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
776      fi
778      if test x"$use_dns_cert" = xyes ; then
779         AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
780      fi
782      if test x"$need_compat" = xyes ; then
783         AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
784      fi
785   else
786      use_dns_srv=no
787      use_dns_pka=no
788      use_dns_cert=no
789   fi
791   LIBS=$_dns_save_libs
794 AC_SUBST(DNSLIBS)
796 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
799 # Check for LDAP
801 if test "$try_ldap" = yes ; then
802    GNUPG_CHECK_LDAP($NETLIBS)
806 # Check for curl.  We fake the curl API if libcurl isn't installed.
808 LIBCURL_CHECK_CONFIG([yes],,,[fake_curl=yes])
809 AM_CONDITIONAL(FAKE_CURL,test x"$fake_curl" = xyes)
811 # Generic, for us, means curl
813 if test x"$try_generic" = xyes ; then
814    AC_SUBST(GPGKEYS_CURL,"gpg2keys_curl$EXEEXT")
818 # Check for sendmail
820 # This isn't necessarily sendmail itself, but anything that gives a
821 # sendmail-ish interface to the outside world.  That includes Exim,
822 # Postfix, etc.  Basically, anything that can handle "sendmail -t".
823 if test "$try_mailto" = yes ; then
824   AC_ARG_WITH(mailprog,
825       AC_HELP_STRING([--with-mailprog=NAME],
826                      [use "NAME -t" for mail transport]),
827              ,with_mailprog=yes)
829   if test x"$with_mailprog" = xyes ; then
830     AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
831     if test "$ac_cv_path_SENDMAIL" ; then
832       GPGKEYS_MAILTO="gpg2keys_mailto"
833     fi
834   elif test x"$with_mailprog" != xno ; then
835     AC_MSG_CHECKING([for a mail transport program])
836     AC_SUBST(SENDMAIL,$with_mailprog)
837     AC_MSG_RESULT($with_mailprog)
838     GPGKEYS_MAILTO="gpg2keys_mailto"
839   fi
842 AC_SUBST(GPGKEYS_MAILTO)
845 # Construct a printable name of the OS
847 case "${host}" in
848     *-mingw32*)
849         PRINTABLE_OS_NAME="MingW32"
850         ;;
851     *-*-cygwin*)
852         PRINTABLE_OS_NAME="Cygwin"
853         ;;
854     i?86-emx-os2 | i?86-*-os2*emx )
855         PRINTABLE_OS_NAME="OS/2"
856         ;;
857     i?86-*-msdosdjgpp*)
858         PRINTABLE_OS_NAME="MSDOS/DJGPP"
859         try_dynload=no
860         ;;
861     *-linux*)
862         PRINTABLE_OS_NAME="GNU/Linux"
863         ;;
864     *)
865         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
866         ;;
867 esac
868 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
869                    [A human readable text with the name of the OS])
873 # Check for gettext
875 AC_MSG_NOTICE([checking for gettext])
876 AM_PO_SUBDIRS
877 AM_GNU_GETTEXT_VERSION([0.16.1])
878 if test "$try_gettext" = yes; then
879   AM_GNU_GETTEXT(,[need-ngettext])
881   # gettext requires some extra checks.  These really should be part of
882   # the basic AM_GNU_GETTEXT macro.  TODO: move other gettext-specific
883   # function checks to here.
885   AC_CHECK_FUNCS(strchr)
886 else
887   USE_NLS=no
888   USE_INCLUDED_LIBINTL=no
889   BUILD_INCLUDED_LIBINTL=no
890   POSUB=po
891   AC_SUBST(USE_NLS)
892   AC_SUBST(USE_INCLUDED_LIBINTL)
893   AC_SUBST(BUILD_INCLUDED_LIBINTL)
894   AC_SUBST(POSUB)
899 # SELinux support
901 if test "$selinux_support" = yes ; then
902   AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
907 # Checks for header files.
909 AC_MSG_NOTICE([checking for header files])
910 AC_HEADER_STDC
911 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h])
912 AC_CHECK_HEADERS([pty.h pwd.h inttypes.h])
913 AC_HEADER_TIME
917 # Checks for typedefs, structures, and compiler characteristics.
919 AC_MSG_NOTICE([checking for system characteristics])
920 AC_C_CONST
921 AC_C_INLINE
922 AC_C_VOLATILE
923 AC_TYPE_SIZE_T
924 AC_TYPE_MODE_T
925 AC_TYPE_SIGNAL
926 AC_DECL_SYS_SIGLIST
928 AC_ARG_ENABLE(endian-check,
929               AC_HELP_STRING([--disable-endian-check],
930               [disable the endian check and trust the OS provided macros]),
931               endiancheck=$enableval,endiancheck=yes)
933 if test x"$endiancheck" = xyes ; then
934   GNUPG_CHECK_ENDIAN
937 # fixme: we should get rid of the byte type
938 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
939 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
940 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
941 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
942 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
944 AC_CHECK_SIZEOF(unsigned short)
945 AC_CHECK_SIZEOF(unsigned int)
946 AC_CHECK_SIZEOF(unsigned long)
947 AC_CHECK_SIZEOF(unsigned long long)
948 AC_CHECK_SIZEOF(time_t,,[[
949 #include <stdio.h>
950 #if TIME_WITH_SYS_TIME
951 # include <sys/time.h>
952 # include <time.h>
953 #else
954 # if HAVE_SYS_TIME_H
955 #  include <sys/time.h>
956 # else
957 #  include <time.h>
958 # endif
959 #endif
963 # Ensure that we have UINT64_C before we bother to check for uint64_t
964 # Fixme: really needed in gnupg?  I think it is only useful in libcgrypt.
965 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
966    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <inttypes.h>
967        uint64_t foo=UINT64_C(42);]),
968      gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
969 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
970    AC_CHECK_SIZEOF(uint64_t)
973 if test "$ac_cv_sizeof_unsigned_short" = "0" \
974    || test "$ac_cv_sizeof_unsigned_int" = "0" \
975    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
976     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
981 # Checks for library functions.
983 AC_MSG_NOTICE([checking for library functions])
984 AC_CHECK_DECLS(getpagesize)
985 AC_FUNC_FSEEKO
986 AC_FUNC_VPRINTF
987 AC_FUNC_FORK
988 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap])
989 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r])
990 AC_CHECK_FUNCS([unsetenv getpwnam getpwuid fcntl ftruncate])
991 AC_CHECK_FUNCS([gettimeofday getrusage setrlimit clock_gettime])
992 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
993 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe stat getaddrinfo])
994 AC_CHECK_FUNCS([ttyname rand ftello])
996 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
999 # These are needed by libjnlib - fixme: we should use a jnlib.m4
1001 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol])
1002 AC_CHECK_FUNCS([memrchr isascii timegm getrusage setrlimit stat setlocale])
1003 AC_CHECK_FUNCS([flockfile funlockfile fopencookie funopen])
1006 # gnulib checks
1008 gl_SOURCE_BASE([gl])
1009 gl_M4_BASE([gl/m4])
1010 gl_MODULES([setenv mkdtemp xsize strpbrk])
1011 gl_INIT
1015 # W32 specific test
1017 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1021 # Sanity check regex.  Tests adapted from mutt.
1022 # FIXME: We should use the the regex from gnulib
1024 AC_MSG_CHECKING([whether regular expression support is requested])
1025 AC_ARG_ENABLE(regex,
1026   AC_HELP_STRING([--disable-regex],
1027     [do not handle regular expressions in trust signatures]),
1028   use_regex=$enableval, use_regex=yes)
1029 AC_MSG_RESULT($use_regex)
1031 if test "$use_regex" = yes ; then
1032   AC_MSG_CHECKING([whether the included regex lib is requested])
1033   AC_ARG_WITH(included-regex,
1034       [  --with-included-regex   use the included GNU regex library],
1035       [gnupg_cv_included_regex="$withval"],[gnupg_cv_included_regex=no])
1036   AC_MSG_RESULT($gnupg_cv_included_regex)
1038   if test $gnupg_cv_included_regex = no ; then
1039      # Does the system have regex functions at all?
1040      AC_CHECK_FUNC(regcomp,gnupg_cv_included_regex=no,
1041                            gnupg_cv_included_regex=yes)
1042   fi
1044   if test $gnupg_cv_included_regex = no ; then
1045      AC_CACHE_CHECK([whether your system's regexp library is broken],
1046        [gnupg_cv_regex_broken],
1047        AC_TRY_RUN([
1048 #include <unistd.h>
1049 #include <regex.h>
1050 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); }],
1051        gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1053      if test $gnupg_cv_regex_broken = yes ; then
1054       AC_MSG_WARN(your regex is broken - using the included GNU regex instead.)
1055       gnupg_cv_included_regex=yes
1056      fi
1057   fi
1059   if test $gnupg_cv_included_regex = yes; then
1060      AC_DEFINE(USE_INTERNAL_REGEX,1,[ Define if you want to use the included regex lib ])
1061   fi
1062 else
1063   AC_DEFINE(DISABLE_REGEX,1,[ Define to disable regular expression support ])
1066 AM_CONDITIONAL(USE_INTERNAL_REGEX, test x"$gnupg_cv_included_regex" = xyes)
1071 # Do we have zlib? Must do it here because Solaris failed
1072 # when compiling a conftest (due to the "-lz" from LIBS).
1073 # Note that we combine zlib and bzlib2 in ZLIBS.
1075 _cppflags="${CPPFLAGS}"
1076 _ldflags="${LDFLAGS}"
1077 AC_ARG_WITH(zlib,
1078   [  --with-zlib=DIR         use libz in DIR],[
1079     if test -d "$withval"; then
1080       CPPFLAGS="${CPPFLAGS} -I$withval/include"
1081       LDFLAGS="${LDFLAGS} -L$withval/lib"
1082     fi
1083   ])
1085 AC_CHECK_HEADER(zlib.h,
1086       AC_CHECK_LIB(z, deflateInit2_,
1087        ZLIBS="-lz",
1088        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1089        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1092 # Check whether we can support bzip2
1094 if test "$use_bzip2" = yes ; then
1095   _cppflags="${CPPFLAGS}"
1096   _ldflags="${LDFLAGS}"
1097   AC_ARG_WITH(bzip2,
1098      AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1099       [
1100       if test -d "$withval" ; then
1101         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1102         LDFLAGS="${LDFLAGS} -L$withval/lib"
1103       fi
1104       ],withval="")
1106   # Checking alongside stdio.h as an early version of bzip2 (1.0)
1107   # required stdio.h to be included before bzlib.h, and Solaris 9 is 
1108   # woefully out of date.
1109   if test "$withval" != no ; then
1110      AC_CHECK_HEADER(bzlib.h,
1111         AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1112           [
1113           have_bz2=yes
1114           ZLIBS="$ZLIBS -lbz2"
1115           AC_DEFINE(HAVE_BZIP2,1,
1116                   [Defined if the bz2 compression library is available])
1117           ],
1118           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1119           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1120   fi
1122 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1123 AC_SUBST(ZLIBS)
1126 # Check for readline support
1127 GNUPG_CHECK_READLINE
1129 # See wether we want to run the long test suite.
1130 AC_ARG_WITH(pkits-tests,
1131     AC_HELP_STRING([--with-pkits-tests],[run the PKITS based tests]),
1132     [run_pkits_tests=$withval], [run_pkits_tests=no])
1133 AM_CONDITIONAL(RUN_PKITS_TESTS, test "$run_pkits_tests" = "yes")
1136 # Allow users to append something to the version string without
1137 # flagging it as development version.  The user version parts is
1138 # considered everything after a dash. 
1140 if test "$development_version" != yes; then
1141   changequote(,)dnl
1142   tmp_pat='[a-zA-Z]'
1143   changequote([,])dnl
1144   if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
1145     development_version=yes
1146   fi
1148 if test "$development_version" = yes; then
1149     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1150             [Defined if this is not a regular release])
1153 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1155 GNUPG_CHECK_GNUMAKE
1157 # Add some extra libs here so that previous tests don't fail for
1158 # mysterious reasons - the final link step should bail out.
1159 # W32SOCKLIBS is also defined so that if can be used for tools not
1160 # requiring any network stuff but linking to code in libcommon which
1161 # tracks in winsock stuff (e.g. init_common_subsystems.
1162 if test "$have_w32_system" = yes; then
1163    W32SOCKLIBS="-lwsock32"
1164    NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1167 AC_SUBST(NETLIBS)
1168 AC_SUBST(W32SOCKLIBS)
1171 # Setup gcc specific options
1173 AC_MSG_NOTICE([checking for cc features])
1174 if test "$GCC" = yes; then
1175     # Note that it is okay to use CFLAGS here because this are just
1176     # warning options and the user should have a chance of overriding
1177     # them.
1178     if test "$USE_MAINTAINER_MODE" = "yes"; then
1179         CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1180         CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1181     else
1182         CFLAGS="$CFLAGS -Wall"
1183     fi
1185     AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1186     _gcc_cflags_save=$CFLAGS
1187     CFLAGS="-Wno-pointer-sign"
1188     AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
1189     AC_MSG_RESULT($_gcc_psign)
1190     CFLAGS=$_gcc_cflags_save;
1191     if test x"$_gcc_psign" = xyes ; then
1192        CFLAGS="$CFLAGS -Wno-pointer-sign"
1193     fi
1195     AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1196     _gcc_cflags_save=$CFLAGS
1197     CFLAGS="-Wpointer-arith"
1198     AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
1199     AC_MSG_RESULT($_gcc_psign)
1200     CFLAGS=$_gcc_cflags_save;
1201     if test x"$_gcc_psign" = xyes ; then
1202        CFLAGS="$CFLAGS -Wpointer-arith"
1203     fi
1208 # This is handy for debugging so the compiler doesn't rearrange
1209 # things and eliminate variables.
1211 AC_ARG_ENABLE(optimization,
1212    AC_HELP_STRING([--disable-optimization],
1213                   [disable compiler optimization]),
1214                   [if test $enableval = no ; then
1215                       CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
1216                    fi])
1219 # Prepare building of estream
1221 estream_INIT
1225 # Decide what to build
1227 missing_pth=no
1228 if test $have_ksba = no; then
1229   build_gpgsm=no
1230   build_scdaemon=no
1233 build_agent_threaded=""
1234 if test "$build_agent" = "yes"; then
1235   if test $have_pth = no; then
1236      build_agent_threaded="(not multi-threaded)"
1237      missing_pth=yes
1238   fi
1241 build_scdaemon_extra=""
1242 if test "$build_scdaemon" = "yes"; then
1243   tmp=""
1244   if test $have_pth = no; then
1245      build_scdaemon_extra="not multi-threaded"
1246      tmp=", "
1247      missing_pth=yes
1248   fi
1249   if test $have_libusb = no; then
1250      build_scdaemon_extra="${tmp}without internal CCID driver"
1251      tmp=", "
1252   fi
1253   if test -n "$build_scdaemon_extra"; then
1254      build_scdaemon_extra="(${build_scdaemon_extra})"
1255   fi
1259 if test "$build_agent_only" = "yes" ; then
1260   build_gpg=no
1261   build_gpgsm=no
1262   build_scdaemon=no
1263   build_tools=no
1264   build_doc=no
1268 AM_CONDITIONAL(BUILD_GPG,   test "$build_gpg" = "yes")
1269 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1270 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1271 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1272 AM_CONDITIONAL(BUILD_TOOLS, test "$build_tools" = "yes")
1273 AM_CONDITIONAL(BUILD_DOC,   test "$build_doc" = "yes")
1274 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1276 AM_CONDITIONAL(RUN_GPG_TESTS,
1277         test x$cross_compiling = xno -a "$build_gpg" = yes )
1281 # Print errors here so that they are visible all
1282 # together and the user can acquire them all together.
1284 die=no
1285 if test "$have_gpg_error" = "no"; then
1286    die=yes
1287    AC_MSG_NOTICE([[
1288 ***  
1289 *** You need libgpg-error to build this program.
1290 **  This library is for example available at
1291 ***   ftp://ftp.gnupg.org/gcrypt/libgpg-error
1292 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1293 ***]])
1295 if test "$have_libgcrypt" = "no"; then
1296    die=yes
1297    AC_MSG_NOTICE([[
1298 ***  
1299 *** You need libgcrypt to build this program.
1300 **  This library is for example available at
1301 ***   ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1302 *** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API is required.)
1303 ***]])
1305 if test "$have_libassuan" = "no"; then
1306    die=yes
1307    AC_MSG_NOTICE([[
1309 *** You need libassuan with Pth support to build this program.
1310 *** This library is for example available at
1311 ***   ftp://ftp.gnupg.org/gcrypt/libassuan/
1312 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1313 ***]])
1315 if test "$have_ksba" = "no"; then
1316     AC_MSG_NOTICE([[
1318 *** You need libksba to build this program.
1319 *** This library is for example available at
1320 ***   ftp://ftp.gnupg.org/gcrypt/libksba/
1321 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1322 ***]])
1324 if test "$missing_pth" = "yes"; then
1325     AC_MSG_NOTICE([[
1327 *** It is now required to build with support for the
1328 *** GNU Portable Threads Library (Pth). Please install this
1329 *** library first.  The library is for example available at
1330 ***   ftp://ftp.gnu.org/gnu/pth/
1331 *** On a Debian GNU/Linux system you can install it using 
1332 ***   apt-get install libpth-dev
1333 *** To build GnuPG for Windows you need to use the W32PTH
1334 *** package; available at:
1335 ***   ftp://ftp.g10code.com/g10code/w32pth/
1336 ***]])
1337    die=yes
1340 if test "$die" = "yes"; then
1341     AC_MSG_ERROR([[
1343 *** Required libraries not found. Please consult the above messages
1344 *** and install them before running configure again.
1345 ***]])
1350 AC_CONFIG_FILES([ m4/Makefile 
1351 Makefile
1352 po/Makefile.in
1353 intl/Makefile
1354 gl/Makefile
1355 include/Makefile
1356 jnlib/Makefile
1357 common/Makefile
1358 kbx/Makefile
1359 g10/Makefile
1360 sm/Makefile
1361 agent/Makefile
1362 scd/Makefile
1363 keyserver/Makefile
1364 keyserver/gpg2keys_mailto
1365 keyserver/gpg2keys_test
1366 tools/gpg-zip
1367 tools/Makefile
1368 doc/Makefile
1369 tests/Makefile
1370 tests/openpgp/Makefile
1372 AC_OUTPUT
1374 #tests/pkits/Makefile
1379 echo "
1380         GnuPG v${VERSION} has been configured as follows:
1381         
1382         Platform:  $PRINTABLE_OS_NAME ($host)
1384         OpenPGP:   $build_gpg
1385         S/MIME:    $build_gpgsm
1386         Agent:     $build_agent $build_agent_threaded
1387         Smartcard: $build_scdaemon $build_scdaemon_extra
1389         Protect tool:      $show_gnupg_protect_tool_pgm
1390         Default agent:     $show_gnupg_agent_pgm
1391         Default pinentry:  $show_gnupg_pinentry_pgm
1392         Default scdaemon:  $show_gnupg_scdaemon_pgm
1393         Default dirmngr:   $show_gnupg_dirmngr_pgm
1395         PKITS based tests: $run_pkits_tests