2007-07-05 Marcus Brinkmann <marcus@g10code.de>
[gnupg.git] / configure.ac
blob2bbca080a121dd318fd0b88caae7de57af2db8cf
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 3 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, see <http://www.gnu.org/licenses/>.
20 # Process this file with autoconf to produce a configure script.
21 AC_PREREQ(2.61)
22 min_automake_version="1.10"
24 # Remember to change the version number immediately *after* a release.
25 # Set my_issvn to "yes" for non-released code.  Remember to run an
26 # "svn up" and "autogen.sh" right before creating a distribution.
27 m4_define([my_version], [2.0.5])
28 m4_define([my_issvn], [yes])
31 m4_define([svn_revision], m4_esyscmd([echo -n $( (svn info 2>/dev/null \
32             || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
33 AC_INIT([gnupg], my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision]),
34         [bug-gnupg@gnupg.org])
35 # Set development_version to yes if the minor number is odd or you
36 # feel that the default check for a development version is not
37 # sufficient.
38 development_version=no
40 NEED_GPG_ERROR_VERSION=1.4
42 NEED_LIBGCRYPT_API=1
43 NEED_LIBGCRYPT_VERSION=1.2.2
45 NEED_LIBASSUAN_API=1
46 NEED_LIBASSUAN_VERSION=0.9.3
48 NEED_KSBA_API=1
49 NEED_KSBA_VERSION=1.0.2
52 PACKAGE=$PACKAGE_NAME
53 PACKAGE_GT=${PACKAGE_NAME}2
54 VERSION=$PACKAGE_VERSION
56 AC_CONFIG_AUX_DIR(scripts)
57 AC_CONFIG_SRCDIR(sm/gpgsm.c)
58 AM_CONFIG_HEADER(config.h)
59 AC_CANONICAL_TARGET()
60 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
61 AB_INIT
63 AC_GNU_SOURCE
65 # Some status variables.
66 have_gpg_error=no
67 have_libgcrypt=no 
68 have_libassuan=no
69 have_ksba=no
70 have_pth=no
71 have_libusb=no
73 use_bzip2=yes
74 use_exec=yes
75 disable_keyserver_path=no
78 GNUPG_BUILD_PROGRAM(gpg, yes)
79 GNUPG_BUILD_PROGRAM(gpgsm, yes)
80 GNUPG_BUILD_PROGRAM(agent, yes)
81 GNUPG_BUILD_PROGRAM(scdaemon, yes)
82 GNUPG_BUILD_PROGRAM(tools, yes)
83 GNUPG_BUILD_PROGRAM(doc, yes)
84 GNUPG_BUILD_PROGRAM(symcryptrun, no)
86 AC_SUBST(PACKAGE)
87 AC_SUBST(PACKAGE_GT)
88 AC_SUBST(VERSION)
89 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
90 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
91                                 [Name of this package for gettext])
92 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
93 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
94                                         [Bug report address])
95 AC_DEFINE_UNQUOTED(NEED_LIBGCRYPT_VERSION, "$NEED_LIBGCRYPT_VERSION",
96                                        [Required version of Libgcrypt])
97 AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION",
98                                        [Required version of Libksba])
102 # The default is to use the modules from this package and the few
103 # other packages in a standard place; i.e where this package gets
104 # installed.  With these options it is possible to override these
105 # ${prefix} depended values with fixed paths, which can't be replaced
106 # at make time.  See also am/cmacros.am and the defaults in AH_BOTTOM.
107 AC_ARG_WITH(agent-pgm,
108     [  --with-agent-pgm=PATH  Use PATH as the default for the agent)],
109           GNUPG_AGENT_PGM="$withval", GNUPG_AGENT_PGM="" )
110 AC_SUBST(GNUPG_AGENT_PGM)
111 AM_CONDITIONAL(GNUPG_AGENT_PGM, test -n "$GNUPG_AGENT_PGM")
112 show_gnupg_agent_pgm="(default)"
113 test -n "$GNUPG_AGENT_PGM" && show_gnupg_agent_pgm="$GNUPG_AGENT_PGM"
115 AC_ARG_WITH(pinentry-pgm,
116     [  --with-pinentry-pgm=PATH  Use PATH as the default for the pinentry)],
117           GNUPG_PINENTRY_PGM="$withval", GNUPG_PINENTRY_PGM="" )
118 AC_SUBST(GNUPG_PINENTRY_PGM)
119 AM_CONDITIONAL(GNUPG_PINENTRY_PGM, test -n "$GNUPG_PINENTRY_PGM")
120 show_gnupg_pinentry_pgm="(default)"
121 test -n "$GNUPG_PINENTRY_PGM" && show_gnupg_pinentry_pgm="$GNUPG_PINENTRY_PGM"
124 AC_ARG_WITH(scdaemon-pgm,
125     [  --with-scdaemon-pgm=PATH  Use PATH as the default for the scdaemon)],
126           GNUPG_SCDAEMON_PGM="$withval", GNUPG_SCDAEMON_PGM="" )
127 AC_SUBST(GNUPG_SCDAEMON_PGM)
128 AM_CONDITIONAL(GNUPG_SCDAEMON_PGM, test -n "$GNUPG_SCDAEMON_PGM")
129 show_gnupg_scdaemon_pgm="(default)"
130 test -n "$GNUPG_SCDAEMON_PGM" && show_gnupg_scdaemon_pgm="$GNUPG_SCDAEMON_PGM"
133 AC_ARG_WITH(dirmngr-pgm,
134     [  --with-dirmngr-pgm=PATH  Use PATH as the default for the dirmngr)],
135           GNUPG_DIRMNGR_PGM="$withval", GNUPG_DIRMNGR_PGM="" )
136 AC_SUBST(GNUPG_DIRMNGR_PGM)
137 AM_CONDITIONAL(GNUPG_DIRMNGR_PGM, test -n "$GNUPG_DIRMNGR_PGM")
138 show_gnupg_dirmngr_pgm="(default)"
139 test -n "$GNUPG_DIRMNGR_PGM" && show_gnupg_dirmngr_pgm="$GNUPG_DIRMNGR_PGM"
141 AC_ARG_WITH(protect-tool-pgm,
142     [  --with-protect-tool-pgm=PATH  Use PATH as the default for the protect-tool)],
143           GNUPG_PROTECT_TOOL_PGM="$withval", GNUPG_PROTECT_TOOL_PGM="" )
144 AC_SUBST(GNUPG_PROTECT_TOOL_PGM)
145 AM_CONDITIONAL(GNUPG_PROTECT_TOOL_PGM, test -n "$GNUPG_PROTECT_TOOL_PGM")
146 show_gnupg_protect_tool_pgm="(default)"
147 test -n "$GNUPG_PROTECT_TOOL_PGM" \
148       && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM"
151 # Some folks want to use only the agent from this packet.  Make it
152 # easier for them by providing the configure option
153 # --enable-only-agent.
154 AC_ARG_ENABLE(agent-only,
155     AC_HELP_STRING([--enable-agent-only],[build only the gpg-agent]),
156     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  /* FIXME: We need to use a function to determine these values depending 
365     on the actual installation directory. */
366 #define GNUPG_BINDIR      "c:\\gnupg"
367 #define GNUPG_LIBEXECDIR  "c:\\gnupg"
368 #define GNUPG_LIBDIR      "c:\\gnupg"
369 #define GNUPG_DATADIR     "c:\\gnupg"
370 #define GNUPG_SYSCONFDIR  "c:\\gnupg"
371 #endif
373 /* Derive some other constants. */
374 #if !(defined(HAVE_FORK) && defined(HAVE_PIPE) && defined(HAVE_WAITPID))
375 #define EXEC_TEMPFILE_ONLY
376 #endif
379 /* We didn't define endianness above, so get it from OS macros.  This
380    is intended for making fat binary builds on OS X. */
381 #if !defined(BIG_ENDIAN_HOST) && !defined(LITTLE_ENDIAN_HOST)
382 #if defined(__BIG_ENDIAN__)
383 #define BIG_ENDIAN_HOST 1
384 #elif defined(__LITTLE_ENDIAN__)
385 #define LITTLE_ENDIAN_HOST 1
386 #else
387 #error "No endianness found"
388 #endif
389 #endif
392 /* Tell libgcrypt not to use its own libgpg-error implementation. */
393 #define USE_LIBGPG_ERROR 1
395 /* We use jnlib, so tell other modules about it.  */
396 #define HAVE_JNLIB_LOGGING 1
398 /* Our HTTP code is used in estream mode.  */
399 #define HTTP_USE_ESTREAM 1
401 /* Under W32 we do an explicit socket initialization, thus we need to
402    avoid the on-demand initialization which would also install an atexit
403    handler.  */
404 #define HTTP_NO_WSASTARTUP
406 /* We always include support for the OpenPGP card.  */
407 #define ENABLE_CARD_SUPPORT 1
409 /* We don't want the old assuan codes anymore. */
410 #define _ASSUAN_ONLY_GPG_ERRORS 1
412 /* We explicitly need to disable PTH's soft mapping as Debian
413    currently enables it by default for no reason. */
414 #define PTH_SYSCALL_SOFT 0
416 /* We want to use the libgcrypt provided memory allocation for
417    asprintf.  */
418 #define _ESTREAM_PRINTF_MALLOC        gcry_malloc
419 #define _ESTREAM_PRINTF_FREE          gcry_free
420 #define _ESTREAM_PRINTF_EXTRA_INCLUDE "util.h"
422 #endif /*GNUPG_CONFIG_H_INCLUDED*/
426 AM_MAINTAINER_MODE
428 # Checks for programs.
429 AC_MSG_NOTICE([checking 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 AM_PROG_CC_C_O
442 if test "x$ac_cv_prog_cc_c89" = "xno" ; then
443   AC_MSG_ERROR([[No C-89 compiler found]])
445 AC_PROG_INSTALL
446 AC_PROG_LN_S
447 AC_PROG_RANLIB
448 AC_CHECK_TOOL(AR, ar, :)
449 AC_PATH_PROG(PERL,"perl")
450 AC_CHECK_TOOL(WINDRES, windres, :)
451 AC_ISC_POSIX
452 gl_EARLY
453 AC_SYS_LARGEFILE
454 GNUPG_CHECK_FAQPROG
455 GNUPG_CHECK_USTAR
457 # We need to compile and run a program on the build machine.  A
458 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
459 # the AC archive is broken for autoconf 2.57.  Given that tehre is no
460 # newer version of that macro, we assume that it is also broken for
461 # autoconf 2.61 and thus we use a simple but usually sufficient
462 # approach.
463 AC_MSG_CHECKING(for cc for build)
464 if test "$cross_compiling" = "yes"; then
465   CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
466 else
467   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
469 AC_MSG_RESULT($CC_FOR_BUILD)
470 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
474 try_gettext=yes
475 have_dosish_system=no
476 have_w32_system=no
477 use_simple_gettext=no
478 case "${host}" in
479     *-mingw32*)
480         # special stuff for Windoze NT
481         ac_cv_have_dev_random=no
482         AC_DEFINE(USE_ONLY_8DOT3,1,
483                   [set this to limit filenames to the 8.3 format])
484         AC_DEFINE(HAVE_DRIVE_LETTERS,1,
485                   [defined if we must run on a stupid file system])
486         AC_DEFINE(USE_SIMPLE_GETTEXT,1,
487                   [because the Unix gettext has too much overhead on
488                    MingW32 systems and these systems lack Posix functions,
489                    we use a simplified version of gettext])
490         disable_keyserver_path=yes
491         have_dosish_system=yes
492         have_w32_system=yes
493         try_gettext="no"
494         use_simple_gettext=yes
495         ;;
496     i?86-emx-os2 | i?86-*-os2*emx )
497         # OS/2 with the EMX environment
498         ac_cv_have_dev_random=no
499         AC_DEFINE(HAVE_DRIVE_LETTERS)
500         have_dosish_system=yes
501         try_gettext="no"
502         ;;
504     i?86-*-msdosdjgpp*)
505         # DOS with the DJGPP environment
506         ac_cv_have_dev_random=no
507         AC_DEFINE(HAVE_DRIVE_LETTERS)
508         have_dosish_system=yes
509         try_gettext="no"
510         ;;
512     *-*-freebsd*)
513        # FreeBSD
514        CPPFLAGS="$CPPFLAGS -I/usr/local/include"
515        LDFLAGS="$LDFLAGS -L/usr/local/lib"
516        ;;
518     *-*-hpux*)
519         if test -z "$GCC" ; then
520             CFLAGS="$CFLAGS -Ae -D_HPUX_SOURCE"
521         fi
522         ;;
523     *-dec-osf4*)
524         if test -z "$GCC" ; then
525             # Suppress all warnings
526             # to get rid of the unsigned/signed char mismatch warnings.
527             CFLAGS="$CFLAGS -w"
528         fi
529         ;;
530     *-dec-osf5*)
531         if test -z "$GCC" ; then
532             # Use the newer compiler `-msg_disable ptrmismatch1' to
533             # get rid of the unsigned/signed char mismatch warnings.
534             # Using this may hide other pointer mismatch warnings, but
535             # it at least lets other warning classes through
536             CFLAGS="$CFLAGS -msg_disable ptrmismatch1"
537         fi
538         ;;
539     m68k-atari-mint)
540         ;;
541     *)
542        ;;
543 esac
545 if test "$have_dosish_system" = yes; then
546    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
547              [Defined if we run on some of the PCDOS like systems 
548               (DOS, Windoze. OS/2) with special properties like
549               no file modes])
551 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
553 AM_CONDITIONAL(USE_SIMPLE_GETTEXT, test x"$use_simple_gettext" = xyes)
555 if test "$have_w32_system" = yes; then
556    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
558 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
560 if test "$disable_keyserver_path" = yes; then
561     AC_DEFINE(DISABLE_KEYSERVER_PATH,1,
562               [Defined to disable exec-path for keyserver helpers])
565 # (These need to go after AC_PROG_CC so that $EXEEXT is defined)
566 AC_DEFINE_UNQUOTED(EXEEXT,"$EXEEXT",[The executable file extension, if any])
568 if test x"$try_hkp" = xyes ; then
569   AC_SUBST(GPGKEYS_HKP,"gpg2keys_hkp$EXEEXT")
572 if test x"$try_finger" = xyes ; then
573   AC_SUBST(GPGKEYS_FINGER,"gpg2keys_finger$EXEEXT")
579 # Checks for libraries.
581 AC_MSG_NOTICE([checking for libraries])
585 # libgpg-error is a library with error codes shared between GnuPG
586 # related projects.
588 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
589                   have_gpg_error=yes,have_gpg_error=no)
593 # Libgcrypt is our generic crypto library
595 AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION",
596         have_libgcrypt=yes,have_libgcrypt=no)
600 # libassuan is used for IPC
602 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
603                   have_libassuan=yes,have_libassuan=no)
604 if test "$have_libassuan" = "yes"; then
605   have_libassuan=no
606   AM_PATH_LIBASSUAN_PTH("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
607                         have_libassuan=yes,have_libassuan=no)
608   AM_CHECK_LIBASSUAN("$NEED_LIBASSUAN_API:1.0.1",
609        [AC_DEFINE(HAVE_ASSUAN_SET_IO_MONITOR, 1,
610          [Define to 1 if you have the `assuan_set_io_monitor' function.])],)  
616 # libksba is our X.509 support library
618 AM_PATH_KSBA("$NEED_KSBA_API:$NEED_KSBA_VERSION",have_ksba=yes,have_ksba=no)
622 # libusb allows us to use the integrated CCID smartcard reader driver.
624 # FiXME: Use GNUPG_CHECK_LIBUSB and modify to use separate AC_SUBSTs.
625 AC_CHECK_LIB(usb, usb_bulk_write,
626               [ LIBUSB_LIBS="$LIBUSB_LIBS -lusb"
627                 AC_DEFINE(HAVE_LIBUSB,1,
628                          [defined if libusb is available])
629                 have_libusb=yes
630              ])
631 AC_SUBST(LIBUSB_LIBS)
632 AC_CHECK_FUNCS(usb_create_match)
635 # Check wether it is necessary to link against libdl.
637 gnupg_dlopen_save_libs="$LIBS"
638 LIBS=""
639 AC_SEARCH_LIBS(dlopen, c dl,,,)
640 DL_LIBS=$LIBS
641 AC_SUBST(DL_LIBS)
642 LIBS="$gnupg_dlopen_save_libs"
645 # Checks for symcryptrun:
648 # libutil has openpty() and login_tty().
649 AC_CHECK_LIB(util, openpty,
650               [ LIBUTIL_LIBS="$LIBUTIL_LIBS -lutil"
651                 AC_DEFINE(HAVE_LIBUTIL,1,
652                          [defined if libutil is available])
653              ])
654 AC_SUBST(LIBUTIL_LIBS)
656 # shred is used to clean temporary plain text files.
657 AC_PATH_PROG(SHRED, shred, /usr/bin/shred)
658 AC_DEFINE_UNQUOTED(SHRED,
659         "${SHRED}", [defines the filename of the shred program])
664 # Check whether the GNU Pth library is available
665 # Note, that we include a Pth emulation for W32.
667 GNUPG_PATH_PTH
668 if test "$have_pth" = "yes"; then
669   AC_DEFINE(USE_GNU_PTH, 1,
670               [Defined if the GNU Portable Thread Library should be used])
671 else
672   AC_MSG_WARN([[
674 *** To support concurrent access to the gpg-agent and the SCdaemon
675 *** we need the support of the GNU Portable Threads Library.
676 *** Download it from ftp://ftp.gnu.org/gnu/pth/
677 *** On a Debian GNU/Linux system you might want to try 
678 ***   apt-get install libpth-dev
679 ***]])
683 AC_MSG_NOTICE([checking for networking options])
686 # Must check for network library requirements before doing link tests
687 # for ldap, for example. If ldap libs are static (or dynamic and without
688 # ELF runtime link paths), then link will fail and LDAP support won't
689 # be detected.
691 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
692         [NETLIBS="-lnsl $NETLIBS"]))
693 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
694         [NETLIBS="-lsocket $NETLIBS"]))
697 # Now try for the resolver functions so we can use DNS for SRV, PA and CERT.
699 if test x"$try_hkp" = xyes || test x"$try_http" = xyes ; then
700   AC_ARG_ENABLE(dns-srv,
701      AC_HELP_STRING([--disable-dns-srv],
702                     [disable the use of DNS SRV in HKP and HTTP]),
703                 use_dns_srv=$enableval,use_dns_srv=yes)
706 AC_ARG_ENABLE(dns-pka,
707    AC_HELP_STRING([--disable-dns-pka],
708         [disable the use of PKA records in DNS]),
709    use_dns_pka=$enableval,use_dns_pka=yes)
711 AC_ARG_ENABLE(dns-cert,
712    AC_HELP_STRING([--disable-dns-cert],
713         [disable the use of CERT records in DNS]),
714    use_dns_cert=$enableval,use_dns_cert=yes)
716 if test x"$use_dns_pka" = xyes || test x"$use_dns_srv" = xyes \
717    || test x"$use_dns_cert" = xyes; then
718   _dns_save_libs=$LIBS
719   LIBS=""
720   # the double underscore thing is a glibc-ism?
721   AC_SEARCH_LIBS(res_query,resolv bind,,
722                  AC_SEARCH_LIBS(__res_query,resolv bind,,have_resolver=no))
723   AC_SEARCH_LIBS(dn_expand,resolv bind,,
724                  AC_SEARCH_LIBS(__dn_expand,resolv bind,,have_resolver=no))
725   AC_SEARCH_LIBS(dn_skipname,resolv bind,,
726                  AC_SEARCH_LIBS(__dn_skipname,resolv bind,,have_resolver=no))
728   if test x"$have_resolver" != xno ; then
730     # Make sure that the BIND 4 resolver interface is workable before
731     # enabling any code that calls it.  At some point I'll rewrite the
732     # code to use the BIND 8 resolver API.
734     AC_MSG_CHECKING([whether the resolver is usable])
735     AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <sys/types.h>
736 #include <netinet/in.h>
737 #include <arpa/nameser.h>
738 #include <resolv.h>],
739 [[unsigned char answer[PACKETSZ];
740   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
741   dn_skipname(0,0); 
742   dn_expand(0,0,0,0,0);
743 ]])],have_resolver=yes,have_resolver=no)
744     AC_MSG_RESULT($have_resolver)
746     # This is Apple-specific and somewhat bizarre as they changed the
747     # define in bind 8 for some reason.
749     if test x"$have_resolver" != xyes ; then
750        AC_MSG_CHECKING(
751              [whether I can make the resolver usable with BIND_8_COMPAT])
752        AC_LINK_IFELSE([AC_LANG_PROGRAM([#define BIND_8_COMPAT
753 #include <sys/types.h>
754 #include <netinet/in.h>
755 #include <arpa/nameser.h>
756 #include <resolv.h>],
757 [[unsigned char answer[PACKETSZ];
758   res_query("foo.bar",C_IN,T_A,answer,PACKETSZ);
759   dn_skipname(0,0); dn_expand(0,0,0,0,0);
760 ]])],[have_resolver=yes ; need_compat=yes])
761        AC_MSG_RESULT($have_resolver)
762     fi
763   fi
765   if test x"$have_resolver" = xyes ; then
766      DNSLIBS=$LIBS
768      if test x"$use_dns_srv" = xyes ; then
769         AC_DEFINE(USE_DNS_SRV,1,[define to use DNS SRV])
770      fi
772      if test x"$use_dns_pka" = xyes ; then
773         AC_DEFINE(USE_DNS_PKA,1,[define to use our experimental DNS PKA])
774      fi
776      if test x"$use_dns_cert" = xyes ; then
777         AC_DEFINE(USE_DNS_CERT,1,[define to use DNS CERT])
778      fi
780      if test x"$need_compat" = xyes ; then
781         AC_DEFINE(BIND_8_COMPAT,1,[an Apple OSXism])
782      fi
783   else
784      use_dns_srv=no
785      use_dns_pka=no
786      use_dns_cert=no
787   fi
789   LIBS=$_dns_save_libs
792 AC_SUBST(DNSLIBS)
794 AM_CONDITIONAL(USE_DNS_SRV, test x"$use_dns_srv" = xyes)
797 # Check for LDAP
799 if test "$try_ldap" = yes ; then
800    GNUPG_CHECK_LDAP($NETLIBS)
804 # Check for curl.  We fake the curl API if libcurl isn't installed.
806 LIBCURL_CHECK_CONFIG([yes],,,[fake_curl=yes])
807 AM_CONDITIONAL(FAKE_CURL,test x"$fake_curl" = xyes)
809 # Generic, for us, means curl
811 if test x"$try_generic" = xyes ; then
812    AC_SUBST(GPGKEYS_CURL,"gpg2keys_curl$EXEEXT")
816 # Check for sendmail
818 # This isn't necessarily sendmail itself, but anything that gives a
819 # sendmail-ish interface to the outside world.  That includes Exim,
820 # Postfix, etc.  Basically, anything that can handle "sendmail -t".
821 if test "$try_mailto" = yes ; then
822   AC_ARG_WITH(mailprog,
823       AC_HELP_STRING([--with-mailprog=NAME],
824                      [use "NAME -t" for mail transport]),
825              ,with_mailprog=yes)
827   if test x"$with_mailprog" = xyes ; then
828     AC_PATH_PROG(SENDMAIL,sendmail,,$PATH:/usr/sbin:/usr/libexec:/usr/lib)
829     if test "$ac_cv_path_SENDMAIL" ; then
830       GPGKEYS_MAILTO="gpg2keys_mailto"
831     fi
832   elif test x"$with_mailprog" != xno ; then
833     AC_MSG_CHECKING([for a mail transport program])
834     AC_SUBST(SENDMAIL,$with_mailprog)
835     AC_MSG_RESULT($with_mailprog)
836     GPGKEYS_MAILTO="gpg2keys_mailto"
837   fi
840 AC_SUBST(GPGKEYS_MAILTO)
843 # Construct a printable name of the OS
845 case "${host}" in
846     *-mingw32*)
847         PRINTABLE_OS_NAME="MingW32"
848         ;;
849     *-*-cygwin*)
850         PRINTABLE_OS_NAME="Cygwin"
851         ;;
852     i?86-emx-os2 | i?86-*-os2*emx )
853         PRINTABLE_OS_NAME="OS/2"
854         ;;
855     i?86-*-msdosdjgpp*)
856         PRINTABLE_OS_NAME="MSDOS/DJGPP"
857         try_dynload=no
858         ;;
859     *-linux*)
860         PRINTABLE_OS_NAME="GNU/Linux"
861         ;;
862     *)
863         PRINTABLE_OS_NAME=`uname -s || echo "Unknown"`
864         ;;
865 esac
866 AC_DEFINE_UNQUOTED(PRINTABLE_OS_NAME, "$PRINTABLE_OS_NAME",
867                    [A human readable text with the name of the OS])
871 # Check for gettext
873 AC_MSG_NOTICE([checking for gettext])
874 AM_PO_SUBDIRS
875 AM_GNU_GETTEXT_VERSION([0.16.1])
876 if test "$try_gettext" = yes; then
877   AM_ICONV
878   AM_GNU_GETTEXT([external],[need-ngettext])
880   # gettext requires some extra checks.  These really should be part of
881   # the basic AM_GNU_GETTEXT macro.  TODO: move other gettext-specific
882   # function checks to here.
884   AC_CHECK_FUNCS(strchr)
885 else
886   USE_NLS=no
887   USE_INCLUDED_LIBINTL=no
888   BUILD_INCLUDED_LIBINTL=no
889   POSUB=po
890   AC_SUBST(USE_NLS)
891   AC_SUBST(USE_INCLUDED_LIBINTL)
892   AC_SUBST(BUILD_INCLUDED_LIBINTL)
893   AC_SUBST(POSUB)
898 # SELinux support
900 if test "$selinux_support" = yes ; then
901   AC_DEFINE(ENABLE_SELINUX_HACKS,1,[Define to enable SELinux support])
906 # Checks for header files.
908 AC_MSG_NOTICE([checking for header files])
909 AC_HEADER_STDC
910 AC_CHECK_HEADERS([string.h unistd.h langinfo.h termio.h locale.h getopt.h])
911 AC_CHECK_HEADERS([pty.h pwd.h inttypes.h])
912 AC_HEADER_TIME
916 # Checks for typedefs, structures, and compiler characteristics.
918 AC_MSG_NOTICE([checking for system characteristics])
919 AC_C_CONST
920 AC_C_INLINE
921 AC_C_VOLATILE
922 AC_TYPE_SIZE_T
923 AC_TYPE_MODE_T
924 AC_TYPE_SIGNAL
925 AC_DECL_SYS_SIGLIST
927 AC_ARG_ENABLE(endian-check,
928               AC_HELP_STRING([--disable-endian-check],
929               [disable the endian check and trust the OS provided macros]),
930               endiancheck=$enableval,endiancheck=yes)
932 if test x"$endiancheck" = xyes ; then
933   GNUPG_CHECK_ENDIAN
936 # fixme: we should get rid of the byte type
937 GNUPG_CHECK_TYPEDEF(byte, HAVE_BYTE_TYPEDEF)
938 GNUPG_CHECK_TYPEDEF(ushort, HAVE_USHORT_TYPEDEF)
939 GNUPG_CHECK_TYPEDEF(ulong, HAVE_ULONG_TYPEDEF)
940 GNUPG_CHECK_TYPEDEF(u16, HAVE_U16_TYPEDEF)
941 GNUPG_CHECK_TYPEDEF(u32, HAVE_U32_TYPEDEF)
943 AC_CHECK_SIZEOF(unsigned short)
944 AC_CHECK_SIZEOF(unsigned int)
945 AC_CHECK_SIZEOF(unsigned long)
946 AC_CHECK_SIZEOF(unsigned long long)
947 AC_CHECK_SIZEOF(time_t,,[[
948 #include <stdio.h>
949 #if TIME_WITH_SYS_TIME
950 # include <sys/time.h>
951 # include <time.h>
952 #else
953 # if HAVE_SYS_TIME_H
954 #  include <sys/time.h>
955 # else
956 #  include <time.h>
957 # endif
958 #endif
962 # Ensure that we have UINT64_C before we bother to check for uint64_t
963 # Fixme: really needed in gnupg?  I think it is only useful in libcgrypt.
964 AC_CACHE_CHECK([for UINT64_C],[gnupg_cv_uint64_c_works],
965    AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include <inttypes.h>
966        uint64_t foo=UINT64_C(42);]),
967      gnupg_cv_uint64_c_works=yes,gnupg_cv_uint64_c_works=no))
968 if test "$gnupg_cv_uint64_c_works" = "yes" ; then
969    AC_CHECK_SIZEOF(uint64_t)
972 if test "$ac_cv_sizeof_unsigned_short" = "0" \
973    || test "$ac_cv_sizeof_unsigned_int" = "0" \
974    || test "$ac_cv_sizeof_unsigned_long" = "0"; then
975     AC_MSG_WARN([Hmmm, something is wrong with the sizes - using defaults]);
980 # Checks for library functions.
982 AC_MSG_NOTICE([checking for library functions])
983 AC_CHECK_DECLS(getpagesize)
984 AC_FUNC_FSEEKO
985 AC_FUNC_VPRINTF
986 AC_FUNC_FORK
987 AC_CHECK_FUNCS([strerror strlwr tcgetattr mmap])
988 AC_CHECK_FUNCS([strcasecmp strncasecmp ctermid times gmtime_r])
989 AC_CHECK_FUNCS([unsetenv getpwnam getpwuid fcntl ftruncate])
990 AC_CHECK_FUNCS([gettimeofday getrusage setrlimit clock_gettime])
991 AC_CHECK_FUNCS([atexit raise getpagesize strftime nl_langinfo setlocale])
992 AC_CHECK_FUNCS([waitpid wait4 sigaction sigprocmask pipe stat getaddrinfo])
993 AC_CHECK_FUNCS([ttyname rand ftello])
995 AC_CHECK_TYPES([struct sigaction, sigset_t],,,[#include <signal.h>])
998 # These are needed by libjnlib - fixme: we should use a jnlib.m4
1000 AC_CHECK_FUNCS([memicmp stpcpy strsep strlwr strtoul memmove stricmp strtol])
1001 AC_CHECK_FUNCS([memrchr isascii timegm getrusage setrlimit stat setlocale])
1002 AC_CHECK_FUNCS([flockfile funlockfile fopencookie funopen])
1005 # gnulib checks
1007 gl_SOURCE_BASE([gl])
1008 gl_M4_BASE([gl/m4])
1009 gl_MODULES([setenv mkdtemp xsize strpbrk])
1010 gl_INIT
1014 # W32 specific test
1016 GNUPG_FUNC_MKDIR_TAKES_ONE_ARG
1020 # Sanity check regex.  Tests adapted from mutt.
1021 # FIXME: We should use the the regex from gnulib
1023 AC_MSG_CHECKING([whether regular expression support is requested])
1024 AC_ARG_ENABLE(regex,
1025   AC_HELP_STRING([--disable-regex],
1026     [do not handle regular expressions in trust signatures]),
1027   use_regex=$enableval, use_regex=yes)
1028 AC_MSG_RESULT($use_regex)
1030 if test "$use_regex" = yes ; then
1031   AC_MSG_CHECKING([whether the included regex lib is requested])
1032   AC_ARG_WITH(included-regex,
1033       [  --with-included-regex   use the included GNU regex library],
1034       [gnupg_cv_included_regex="$withval"],[gnupg_cv_included_regex=no])
1035   AC_MSG_RESULT($gnupg_cv_included_regex)
1037   if test $gnupg_cv_included_regex = no ; then
1038      # Does the system have regex functions at all?
1039      AC_CHECK_FUNC(regcomp,gnupg_cv_included_regex=no,
1040                            gnupg_cv_included_regex=yes)
1041   fi
1043   if test $gnupg_cv_included_regex = no ; then
1044      AC_CACHE_CHECK([whether your system's regexp library is broken],
1045        [gnupg_cv_regex_broken],
1046        AC_TRY_RUN([
1047 #include <unistd.h>
1048 #include <regex.h>
1049 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); }],
1050        gnupg_cv_regex_broken=no, gnupg_cv_regex_broken=yes, gnupg_cv_regex_broken=yes))
1052      if test $gnupg_cv_regex_broken = yes ; then
1053       AC_MSG_WARN(your regex is broken - using the included GNU regex instead.)
1054       gnupg_cv_included_regex=yes
1055      fi
1056   fi
1058   if test $gnupg_cv_included_regex = yes; then
1059      AC_DEFINE(USE_INTERNAL_REGEX,1,[ Define if you want to use the included regex lib ])
1060   fi
1061 else
1062   AC_DEFINE(DISABLE_REGEX,1,[ Define to disable regular expression support ])
1065 AM_CONDITIONAL(USE_INTERNAL_REGEX, test x"$gnupg_cv_included_regex" = xyes)
1070 # Do we have zlib? Must do it here because Solaris failed
1071 # when compiling a conftest (due to the "-lz" from LIBS).
1072 # Note that we combine zlib and bzlib2 in ZLIBS.
1074 _cppflags="${CPPFLAGS}"
1075 _ldflags="${LDFLAGS}"
1076 AC_ARG_WITH(zlib,
1077   [  --with-zlib=DIR         use libz in DIR],[
1078     if test -d "$withval"; then
1079       CPPFLAGS="${CPPFLAGS} -I$withval/include"
1080       LDFLAGS="${LDFLAGS} -L$withval/lib"
1081     fi
1082   ])
1084 AC_CHECK_HEADER(zlib.h,
1085       AC_CHECK_LIB(z, deflateInit2_,
1086        ZLIBS="-lz",
1087        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1088        CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags})
1091 # Check whether we can support bzip2
1093 if test "$use_bzip2" = yes ; then
1094   _cppflags="${CPPFLAGS}"
1095   _ldflags="${LDFLAGS}"
1096   AC_ARG_WITH(bzip2,
1097      AC_HELP_STRING([--with-bzip2=DIR],[look for bzip2 in DIR]),
1098       [
1099       if test -d "$withval" ; then
1100         CPPFLAGS="${CPPFLAGS} -I$withval/include"
1101         LDFLAGS="${LDFLAGS} -L$withval/lib"
1102       fi
1103       ],withval="")
1105   # Checking alongside stdio.h as an early version of bzip2 (1.0)
1106   # required stdio.h to be included before bzlib.h, and Solaris 9 is 
1107   # woefully out of date.
1108   if test "$withval" != no ; then
1109      AC_CHECK_HEADER(bzlib.h,
1110         AC_CHECK_LIB(bz2,BZ2_bzCompressInit,
1111           [
1112           have_bz2=yes
1113           ZLIBS="$ZLIBS -lbz2"
1114           AC_DEFINE(HAVE_BZIP2,1,
1115                   [Defined if the bz2 compression library is available])
1116           ],
1117           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags}),
1118           CPPFLAGS=${_cppflags} LDFLAGS=${_ldflags},[#include <stdio.h>])
1119   fi
1121 AM_CONDITIONAL(ENABLE_BZIP2_SUPPORT,test x"$have_bz2" = "xyes")
1122 AC_SUBST(ZLIBS)
1125 # Check for readline support
1126 GNUPG_CHECK_READLINE
1128 # See wether we want to run the long test suite.
1129 AC_ARG_WITH(pkits-tests,
1130     AC_HELP_STRING([--with-pkits-tests],[run the PKITS based tests]),
1131     [run_pkits_tests=$withval], [run_pkits_tests=no])
1132 AM_CONDITIONAL(RUN_PKITS_TESTS, test "$run_pkits_tests" = "yes")
1135 # Allow users to append something to the version string without
1136 # flagging it as development version.  The user version parts is
1137 # considered everything after a dash. 
1139 if test "$development_version" != yes; then
1140   changequote(,)dnl
1141   tmp_pat='[a-zA-Z]'
1142   changequote([,])dnl
1143   if echo "$VERSION" | sed 's/-.*//' | grep "$tmp_pat" >/dev/null ; then
1144     development_version=yes
1145   fi
1147 if test "$development_version" = yes; then
1148     AC_DEFINE(IS_DEVELOPMENT_VERSION,1,
1149             [Defined if this is not a regular release])
1152 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
1154 GNUPG_CHECK_GNUMAKE
1156 # Add some extra libs here so that previous tests don't fail for
1157 # mysterious reasons - the final link step should bail out.
1158 # W32SOCKLIBS is also defined so that if can be used for tools not
1159 # requiring any network stuff but linking to code in libcommon which
1160 # tracks in winsock stuff (e.g. init_common_subsystems.
1161 if test "$have_w32_system" = yes; then
1162    W32SOCKLIBS="-lws2_32"
1163    NETLIBS="${NETLIBS} ${W32SOCKLIBS}"
1166 AC_SUBST(NETLIBS)
1167 AC_SUBST(W32SOCKLIBS)
1170 # Setup gcc specific options
1172 AC_MSG_NOTICE([checking for cc features])
1173 if test "$GCC" = yes; then
1174     # Note that it is okay to use CFLAGS here because this are just
1175     # warning options and the user should have a chance of overriding
1176     # them.
1177     if test "$USE_MAINTAINER_MODE" = "yes"; then
1178         CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
1179         CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
1180     else
1181         CFLAGS="$CFLAGS -Wall"
1182     fi
1184     AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
1185     _gcc_cflags_save=$CFLAGS
1186     CFLAGS="-Wno-pointer-sign"
1187     AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
1188     AC_MSG_RESULT($_gcc_psign)
1189     CFLAGS=$_gcc_cflags_save;
1190     if test x"$_gcc_psign" = xyes ; then
1191        CFLAGS="$CFLAGS -Wno-pointer-sign"
1192     fi
1194     AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
1195     _gcc_cflags_save=$CFLAGS
1196     CFLAGS="-Wpointer-arith"
1197     AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_psign=yes,_gcc_psign=no)
1198     AC_MSG_RESULT($_gcc_psign)
1199     CFLAGS=$_gcc_cflags_save;
1200     if test x"$_gcc_psign" = xyes ; then
1201        CFLAGS="$CFLAGS -Wpointer-arith"
1202     fi
1207 # This is handy for debugging so the compiler doesn't rearrange
1208 # things and eliminate variables.
1210 AC_ARG_ENABLE(optimization,
1211    AC_HELP_STRING([--disable-optimization],
1212                   [disable compiler optimization]),
1213                   [if test $enableval = no ; then
1214                       CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
1215                    fi])
1218 # Prepare building of estream
1220 estream_INIT
1224 # Decide what to build
1226 missing_pth=no
1227 if test $have_ksba = no; then
1228   build_gpgsm=no
1229   build_scdaemon=no
1232 build_agent_threaded=""
1233 if test "$build_agent" = "yes"; then
1234   if test $have_pth = no; then
1235      build_agent_threaded="(not multi-threaded)"
1236      missing_pth=yes
1237   fi
1240 build_scdaemon_extra=""
1241 if test "$build_scdaemon" = "yes"; then
1242   tmp=""
1243   if test $have_pth = no; then
1244      build_scdaemon_extra="not multi-threaded"
1245      tmp=", "
1246      missing_pth=yes
1247   fi
1248   if test $have_libusb = no; then
1249      build_scdaemon_extra="${tmp}without internal CCID driver"
1250      tmp=", "
1251   fi
1252   if test -n "$build_scdaemon_extra"; then
1253      build_scdaemon_extra="(${build_scdaemon_extra})"
1254   fi
1258 if test "$build_agent_only" = "yes" ; then
1259   build_gpg=no
1260   build_gpgsm=no
1261   build_scdaemon=no
1262   build_tools=no
1263   build_doc=no
1267 AM_CONDITIONAL(BUILD_GPG,   test "$build_gpg" = "yes")
1268 AM_CONDITIONAL(BUILD_GPGSM, test "$build_gpgsm" = "yes")
1269 AM_CONDITIONAL(BUILD_AGENT, test "$build_agent" = "yes")
1270 AM_CONDITIONAL(BUILD_SCDAEMON, test "$build_scdaemon" = "yes")
1271 AM_CONDITIONAL(BUILD_TOOLS, test "$build_tools" = "yes")
1272 AM_CONDITIONAL(BUILD_DOC,   test "$build_doc" = "yes")
1273 AM_CONDITIONAL(BUILD_SYMCRYPTRUN, test "$build_symcryptrun" = "yes")
1275 AM_CONDITIONAL(RUN_GPG_TESTS,
1276         test x$cross_compiling = xno -a "$build_gpg" = yes )
1280 # Print errors here so that they are visible all
1281 # together and the user can acquire them all together.
1283 die=no
1284 if test "$have_gpg_error" = "no"; then
1285    die=yes
1286    AC_MSG_NOTICE([[
1287 ***  
1288 *** You need libgpg-error to build this program.
1289 **  This library is for example available at
1290 ***   ftp://ftp.gnupg.org/gcrypt/libgpg-error
1291 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1292 ***]])
1294 if test "$have_libgcrypt" = "no"; then
1295    die=yes
1296    AC_MSG_NOTICE([[
1297 ***  
1298 *** You need libgcrypt to build this program.
1299 **  This library is for example available at
1300 ***   ftp://ftp.gnupg.org/gcrypt/libgcrypt/
1301 *** (at least version $NEED_LIBGCRYPT_VERSION using API $NEED_LIBGCRYPT_API is required.)
1302 ***]])
1304 if test "$have_libassuan" = "no"; then
1305    die=yes
1306    AC_MSG_NOTICE([[
1308 *** You need libassuan with Pth support to build this program.
1309 *** This library is for example available at
1310 ***   ftp://ftp.gnupg.org/gcrypt/libassuan/
1311 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1312 ***]])
1314 if test "$have_ksba" = "no"; then
1315     AC_MSG_NOTICE([[
1317 *** You need libksba to build this program.
1318 *** This library is for example available at
1319 ***   ftp://ftp.gnupg.org/gcrypt/libksba/
1320 *** (at least version $NEED_KSBA_VERSION using API $NEED_KSBA_API is required).
1321 ***]])
1323 if test "$missing_pth" = "yes"; then
1324     AC_MSG_NOTICE([[
1326 *** It is now required to build with support for the
1327 *** GNU Portable Threads Library (Pth). Please install this
1328 *** library first.  The library is for example available at
1329 ***   ftp://ftp.gnu.org/gnu/pth/
1330 *** On a Debian GNU/Linux system you can install it using 
1331 ***   apt-get install libpth-dev
1332 *** To build GnuPG for Windows you need to use the W32PTH
1333 *** package; available at:
1334 ***   ftp://ftp.g10code.com/g10code/w32pth/
1335 ***]])
1336    die=yes
1339 if test "$die" = "yes"; then
1340     AC_MSG_ERROR([[
1342 *** Required libraries not found. Please consult the above messages
1343 *** and install them before running configure again.
1344 ***]])
1349 AC_CONFIG_FILES([ m4/Makefile 
1350 Makefile
1351 po/Makefile.in
1352 gl/Makefile
1353 include/Makefile
1354 jnlib/Makefile
1355 common/Makefile
1356 kbx/Makefile
1357 g10/Makefile
1358 sm/Makefile
1359 agent/Makefile
1360 scd/Makefile
1361 keyserver/Makefile
1362 keyserver/gpg2keys_mailto
1363 keyserver/gpg2keys_test
1364 tools/gpg-zip
1365 tools/Makefile
1366 doc/Makefile
1367 tests/Makefile
1368 tests/openpgp/Makefile
1370 AC_OUTPUT
1372 #tests/pkits/Makefile
1377 echo "
1378         GnuPG v${VERSION} has been configured as follows:
1379         
1380         Platform:  $PRINTABLE_OS_NAME ($host)
1382         OpenPGP:   $build_gpg
1383         S/MIME:    $build_gpgsm
1384         Agent:     $build_agent $build_agent_threaded
1385         Smartcard: $build_scdaemon $build_scdaemon_extra
1387         Protect tool:      $show_gnupg_protect_tool_pgm
1388         Default agent:     $show_gnupg_agent_pgm
1389         Default pinentry:  $show_gnupg_pinentry_pgm
1390         Default scdaemon:  $show_gnupg_scdaemon_pgm
1391         Default dirmngr:   $show_gnupg_dirmngr_pgm
1393         PKITS based tests: $run_pkits_tests