2007-09-07 Marcus Brinkmann <marcus@g10code.de>
[gpgme.git] / configure.ac
1 # configure.ac for GPGME
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 g10 Code GmbH
4
5 # This file is part of GPGME.
6
7 # GPGME is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU Lesser General Public License as
9 # published by the Free Software Foundation; either version 2.1 of the
10 # License, or (at your option) any later version.
11
12 # GPGME is distributed in the hope that it will be useful, but WITHOUT
13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
15 # Public License for more details.
16
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20  
21 # (Process this file with autoconf to produce a configure script.)
22 AC_PREREQ(2.59)
23 min_automake_version="1.9.3"
24
25 # Version number: Remember to change it immediately *after* a release.
26 #                 Make sure to run  "svn up" before a "make dist".
27 #                 See below for the LT versions.
28 #
29 # The CVS version is usually the next intended release version with
30 # the string "-cvs" appended.  The reason for this is that tests for a
31 # specific feature can already be done under the assumption that the
32 # CVS version is the most recent one in a branch.  To disable the CVS
33 # version for the real release, just comment out the my_iscvs macro.
34 # Note, that we are now using Subversion instead of CVS and append the
35 # SVN revision number to the "cvs" suffix.  To make this most useful
36 # for snapshot releases please do an "svn up" right before recreating
37 # the configure script, so that a proper revision number for all files
38 # is available when running a "make distcheck".
39 m4_define(my_version, [1.1.5])
40 m4_define(my_iscvs, yes)
41 AC_INIT([gpgme], my_version[]m4_ifdef([my_iscvs], [-cvs[]m4_translit(
42                [$Revision$],[Ra-z $:])]),
43                [bug-gpgme@gnupg.org])
44
45 # LT Version numbers, remember to change them just *before* a release.
46 #   (Code changed:                      REVISION++)
47 #   (Interfaces added/removed/changed:  CURRENT++, REVISION=0)
48 #   (Interfaces added:                  AGE++)
49 #   (Interfaces removed/changed:        AGE=0)
50 #
51 LIBGPGME_LT_CURRENT=17
52 # Subtract 2 from this value if you want to make the LFS transition an
53 # ABI break.  [Note to self: Remove this comment with the next regular break.]
54 LIBGPGME_LT_AGE=6
55 LIBGPGME_LT_REVISION=4
56
57 # If the API is changed in an incompatible way: increment the next counter.
58 GPGME_CONFIG_API_VERSION=1
59 ##############################################
60
61
62 PACKAGE=$PACKAGE_NAME
63 VERSION=$PACKAGE_VERSION
64
65 AC_CONFIG_SRCDIR(gpgme/gpgme.h)
66 dnl FIXME: Enable this with autoconf 2.59.
67 dnl AC_CONFIG_MACRO_DIR(m4)
68 AM_CONFIG_HEADER(config.h)
69 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
70 AM_MAINTAINER_MODE
71 AC_CANONICAL_HOST
72
73 # Enable GNU extensions on systems that have them.
74 AC_GNU_SOURCE
75
76 AH_VERBATIM([_REENTRANT],
77 [/* To allow the use of GPGME in multithreaded programs we have to use
78   special features from the library.
79   IMPORTANT: gpgme is not yet fully reentrant and you should use it
80   only from one thread.  */
81 #ifndef _REENTRANT
82 # define _REENTRANT 1
83 #endif])
84
85 AC_PROG_CC
86 AC_PROG_CXX
87
88 AC_SUBST(LIBGPGME_LT_CURRENT)
89 AC_SUBST(LIBGPGME_LT_AGE)
90 AC_SUBST(LIBGPGME_LT_REVISION)
91
92 AC_SUBST(PACKAGE)
93 AC_SUBST(VERSION)
94 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
95 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
96
97 # Don't default to build static libs.
98 AC_DISABLE_STATIC
99 AC_LIBTOOL_WIN32_DLL
100 AC_LIBTOOL_RC
101 AC_PROG_LIBTOOL
102
103 # For now we hardcode the use of version scripts.  It would be better
104 # to write a test for this or even implement this within libtool.
105 have_ld_version_script=no
106 case "${host}" in
107     *-*-linux*)
108         have_ld_version_script=yes
109         ;;
110     *-*-gnu*)
111         have_ld_version_script=yes
112         ;;
113 esac
114 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
115
116 GPG_DEFAULT=no
117 GPGSM_DEFAULT=no
118 component_system=None
119 have_dosish_system=no
120 have_w32_system=no
121 case "${host}" in
122     *-mingw32*)
123         # special stuff for Windoze NT
124         have_dosish_system=yes
125         have_w32_system=yes
126         GPG_DEFAULT='c:\\gnupg\\gpg.exe'
127         GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
128         #component_system='COM+'
129         ;;
130     *)
131         AC_CHECK_PTH(1.2.0,,,no,have_pth=yes)
132         if test "$have_pth" = yes; then
133           AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.])
134         fi
135         AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
136         if test "$have_pthread" = yes; then
137           AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
138         fi
139
140         # XXX: Probably use exec-prefix here?
141 #       GPG_DEFAULT='/usr/bin/gpg'
142 #       GPGSM_DEFAULT='/usr/bin/gpgsm'
143         ;;
144 esac
145
146 if test "$have_dosish_system" = yes; then
147    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
148              [Defined if we run on some of the PCDOS like systems 
149               (DOS, Windoze. OS/2) with special properties like
150               no file modes])
151 fi
152 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
153
154 if test "$have_w32_system" = yes; then
155    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
156 fi
157 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
158
159 build_w32_glib=no
160 AM_PATH_GLIB_2_0
161 AC_ARG_ENABLE(w32-glib,
162             AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
163             build_w32_glib=$enableval)
164 AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
165
166 build_w32_qt=no
167 PKG_CHECK_MODULES(QT4_CORE, QtCore)
168 AC_ARG_ENABLE(w32-qt,
169             AC_HELP_STRING([--enable-w32-qt], [build GPGME Qt for W32]),
170             build_w32_qt=$enableval)
171 AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes)
172
173 AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
174 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
175
176
177 # Checks for header files.
178 AC_CHECK_HEADERS(sys/select.h)
179
180
181 # Type checks.
182 AC_C_INLINE
183 AC_CHECK_SIZEOF(unsigned int)
184 AC_SYS_LARGEFILE
185 AC_TYPE_OFF_T
186
187 # Checks for compiler features.
188 if test "$GCC" = yes; then
189     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
190     if test "$have_w32_system" = yes; then
191        CFLAGS="$CFLAGS -mms-bitfields"
192     fi
193 fi
194
195 # Network library fun.
196 AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname,
197         [NETLIBS="-lnsl $NETLIBS"]))
198 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt,
199         [NETLIBS="-lsocket $NETLIBS"]))
200 AC_SUBST(NETLIBS)
201
202 # Checks for library functions.
203 AC_FUNC_FSEEKO
204
205 AC_REPLACE_FUNCS(vasprintf)
206 if test "$ac_cv_func_vasprintf" != yes; then
207   GNUPG_CHECK_VA_COPY
208 fi
209
210 # Try to find a thread-safe version of ttyname().
211 AC_REPLACE_FUNCS(ttyname_r)
212 if test "$ac_cv_func_ttyname_r" != yes; then
213   AC_MSG_WARN([
214 ***
215 *** ttyname() is not thread-safe and ttyname_r() does not exist
216 ***])
217 fi
218
219 # Try to find a thread-safe version of getenv().
220 have_thread_safe_getenv=no
221 jm_GLIBC21
222 if test $GLIBC21 = yes; then
223   have_thread_safe_getenv=yes
224 fi
225 if test $have_thread_safe_getenv = yes; then
226   AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
227 fi
228 have_getenv_r=no
229 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
230 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
231   AC_MSG_WARN([
232 ***
233 *** getenv() is not thread-safe and getenv_r() does not exist
234 ***])
235 fi
236
237 # For converting time strings to seconds since Epoch, we need the timegm
238 # function.
239 AC_CHECK_FUNCS(timegm)
240 if test "$ac_cv_func_timegm" != yes; then
241   AC_MSG_WARN([
242 ***
243 *** timegm() not available - a non-thread-safe kludge will be used
244 *** and the TZ variable might be changed at runtime.
245 ***])
246 fi
247
248 # Checking for libgpg-error.
249 AM_PATH_GPG_ERROR(1.4,, AC_MSG_ERROR([libgpg-error was not found]))
250 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
251           [The default error source for GPGME.])
252
253
254
255 # Checks for system services
256 NEED_GPG_VERSION_DEFAULT=1.3.0
257 NEED_GPGSM_VERSION_DEFAULT=1.9.6
258 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
259 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
260 AC_ARG_WITH(gpg-version,
261             AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
262             NEED_GPG_VERSION=$withval)
263 if test "$NEED_GPG_VERSION" = "yes"; then
264   NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
265 fi
266 if test "$NEED_GPG_VERSION" = "no"; then
267   NEED_GPG_VERSION=0.0.0
268 fi
269 AC_ARG_WITH(gpgsm-version,
270             AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
271             NEED_GPGSM_VERSION=$withval)
272 if test "$NEED_GPGSM_VERSION" = "yes"; then
273   NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
274 fi
275 if test "$NEED_GPGSM_VERSION" = "no"; then
276   NEED_GPGSM_VERSION=0.0.0
277 fi
278
279 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
280                                      [Min. needed GnuPG version.])
281 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
282                                        [Min. needed GPGSM version.])
283
284
285 NO_OVERRIDE=no
286 AC_ARG_WITH(gpg,
287             AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
288             GPG=$withval, NO_OVERRIDE=yes)
289 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
290   GPG=
291   NO_OVERRIDE=yes
292   if test "$cross_compiling" != "yes"; then
293     AC_PATH_PROG(GPG, gpg)
294   fi
295   if test -z "$GPG"; then
296     GPG="$GPG_DEFAULT"
297   fi
298 fi
299 if test "$GPG" = no; then
300   if test "$NO_OVERRIDE" = "yes"; then
301     if test "$cross_compiling" != "yes"; then
302       AC_MSG_WARN([
303 ***
304 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
305 ***])
306     else
307       AC_MSG_ERROR([
308 ***
309 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
310 ***])
311     fi
312   fi
313 else
314   AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
315   AC_SUBST(GPG)
316 fi
317 dnl Check for GnuPG version requirement.
318 GPG_VERSION=unknown
319 ok=maybe
320 if test -z "$GPG" -o "x$GPG" = "xno"; then
321   ok=no
322 else
323   if test "$cross_compiling" = "yes"; then
324     AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
325     ok=no
326   else
327     if test ! -x "$GPG"; then
328       AC_MSG_WARN([GnuPG not executable, version check disabled])
329       ok=no
330     fi
331   fi
332 fi
333 if test "$ok" = "maybe"; then
334   AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
335   req_major=`echo $NEED_GPG_VERSION | \
336              sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
337   req_minor=`echo $NEED_GPG_VERSION | \
338              sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
339   req_micro=`echo $NEED_GPG_VERSION | \
340              sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
341   GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
342   major=`echo $GPG_VERSION | \
343          sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
344   minor=`echo $GPG_VERSION | \
345          sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
346   micro=`echo $GPG_VERSION | \
347          sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
348
349   if test "$major" -gt "$req_major"; then
350     ok=yes
351   else
352     if test "$major" -eq "$req_major"; then
353       if test "$minor" -gt "$req_minor"; then
354         ok=yes
355       else
356         if test "$minor" -eq "$req_minor"; then
357           if test "$micro" -ge "$req_micro"; then
358             ok=yes
359           fi
360         fi
361       fi
362     fi
363   fi
364   if test "$ok" = "yes"; then
365     AC_MSG_RESULT(yes)
366   else
367     AC_MSG_RESULT(no)
368     AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
369   fi
370 fi
371 run_gpg_test="$ok"
372 AC_ARG_ENABLE(gpg-test,
373   AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
374          run_gpg_test=$enableval)
375 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
376 AC_SUBST(GPG_PATH)
377
378 NO_OVERRIDE=no
379 AC_ARG_WITH(gpgsm,
380             AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
381             GPGSM=$withval, NO_OVERRIDE=yes)
382 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
383   GPGSM=
384   NO_OVERRIDE=yes
385   if test "$cross_compiling" != "yes"; then
386     AC_PATH_PROG(GPGSM, gpgsm)
387   fi
388   if test -z "$GPGSM"; then
389     GPGSM="$GPGSM_DEFAULT"
390   fi
391 fi
392 if test "$GPGSM" = no; then
393   if test "$NO_OVERRIDE" = "yes"; then
394     if test "$cross_compiling" != "yes"; then
395       AC_MSG_WARN([
396 ***
397 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
398 ***])
399     else
400       AC_MSG_ERROR([
401 ***
402 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
403 ***])
404     fi
405   fi
406 else
407   AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
408   AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
409 fi
410 AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
411
412
413 dnl Check for GPGSM version requirement.
414 GPGSM_VERSION=unknown
415 ok=maybe
416 if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
417   ok=no
418 else
419   if test "$cross_compiling" = "yes"; then
420     AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
421     ok=no
422   else
423     if test ! -x "$GPGSM"; then
424       AC_MSG_WARN([GPGSM not executable, version check disabled])
425       ok=no
426     fi
427   fi
428 fi
429 if test "$ok" = "maybe"; then
430   AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
431   req_major=`echo $NEED_GPGSM_VERSION | \
432              sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
433   req_minor=`echo $NEED_GPGSM_VERSION | \
434              sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
435   req_micro=`echo $NEED_GPGSM_VERSION | \
436              sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
437   GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
438   major=`echo $GPGSM_VERSION | \
439          sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
440   minor=`echo $GPGSM_VERSION | \
441          sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
442   micro=`echo $GPGSM_VERSION | \
443          sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
444
445   if test "$major" -gt "$req_major"; then
446     ok=yes
447   else
448     if test "$major" -eq "$req_major"; then
449       if test "$minor" -gt "$req_minor"; then
450         ok=yes
451       else
452         if test "$minor" -eq "$req_minor"; then
453           if test "$micro" -ge "$req_micro"; then
454             ok=yes
455           fi
456         fi
457       fi
458     fi
459   fi
460   if test "$ok" = "yes"; then
461     AC_MSG_RESULT(yes)
462   else
463     AC_MSG_RESULT(no)
464     AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
465   fi
466 fi
467 run_gpgsm_test="$ok"
468 AC_ARG_ENABLE(gpgsm-test,
469   AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
470          run_gpgsm_test=$enableval)
471 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
472
473
474 # FIXME: Only build if supported.
475 AM_CONDITIONAL(BUILD_ASSUAN, test "$GPGSM" != "no")
476 if test "$GPGSM" != "no"; then
477   AC_DEFINE(HAVE_ASSUAN_H, 1,
478             [Defined if we are building with assuan support.])
479 fi
480
481 # Check for funopen
482 AC_CHECK_FUNCS(funopen)
483 if test $ac_cv_func_funopen != yes; then
484     # No funopen but we can implement that in terms of fopencookie.
485     AC_CHECK_FUNCS(fopencookie)
486     if test $ac_cv_func_fopencookie = yes; then
487         AC_REPLACE_FUNCS(funopen)
488     else
489         AC_MSG_WARN([
490 ***
491 *** No implementation of fopencookie or funopen available
492 ***])
493     fi
494 fi
495
496 # More assuan replacement functions.
497 AC_REPLACE_FUNCS(isascii)
498 AC_REPLACE_FUNCS(putc_unlocked)
499 AC_REPLACE_FUNCS(memrchr)
500 AC_REPLACE_FUNCS(stpcpy)
501 # Check for unistd.h for setenv replacement function.
502 AC_CHECK_HEADERS(unistd.h)
503 AC_REPLACE_FUNCS(setenv)
504
505 # More assuan checks.
506 AC_CHECK_HEADERS([sys/uio.h])
507
508 # Assuan check for descriptor passing.
509 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
510                 [supports_descriptor_passing=yes],
511                 [supports_descriptor_passing=no
512                  AC_MSG_WARN([
513 ***
514 *** Data structure for sending ancillary data missing.
515 *** Descriptor passing won't work.
516 ***])],[
517 #include <stdlib.h>
518 #include <stddef.h>
519 #include <stdio.h>
520 #include <sys/types.h>
521 #include <sys/socket.h>
522 #include <sys/un.h>
523 #if HAVE_SYS_UIO_H
524 #include <sys/uio.h>
525 #endif
526 #include <unistd.h>
527        ])
528
529 AC_ARG_ENABLE(fd-passing,
530   AC_HELP_STRING([--enable-fd-passing], [use FD passing if supported]),
531   use_descriptor_passing=$enableval)
532
533 if test "$supports_descriptor_passing" != "yes"; then
534   use_descriptor_passing=no
535 fi
536
537 if test "$use_descriptor_passing" = "yes"; then
538 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
539           [Defined if descriptor passing is enabled and supported])
540 fi
541
542 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
543
544 # Assuan check for the getsockopt SO_PEERCRED
545 AC_MSG_CHECKING(for SO_PEERCRED)
546 AC_CACHE_VAL(assuan_cv_sys_so_peercred,
547       [AC_TRY_COMPILE([#include <sys/socket.h>], 
548          [struct ucred cr; 
549           int cl = sizeof cr;
550           getsockopt (1, SOL_SOCKET, SO_PEERCRED, &cr, &cl);],
551           assuan_cv_sys_so_peercred=yes,
552           assuan_cv_sys_so_peercred=no)
553        ])
554 AC_MSG_RESULT($assuan_cv_sys_so_peercred) 
555 if test $assuan_cv_sys_so_peercred = yes; then
556   AC_DEFINE(HAVE_SO_PEERCRED, 1,
557             [Defined if SO_PEERCRED is supported (Linux specific)])
558 fi
559
560 if test "$have_w32_system" = yes; then
561    NETLIBS="-lws2_32 $NETLIBS"
562 fi
563
564 # End of assuan checks.
565
566 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
567
568 # Make the version number in gpgme/gpgme.h the same as the one here.
569 # (this is easier than to have a *.in file just for one substitution)
570 GNUPG_FIX_HDR_VERSION(gpgme/gpgme.h, GPGME_VERSION)
571
572 # Generate values for the DLL version info
573 changequote(,)dnl 
574 BUILD_REVISION="`echo '$Revision$' | sed 's/[^0-9]//g'`"
575 changequote([,])dnl
576 test -z "$BUILD_REVISION" && BUILD_REVISION="0"
577 if test "$have_w32_system" = yes; then
578     BUILD_TIMESTAMP=`date --iso-8601=minutes`
579     changequote(,)dnl 
580     BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
581     changequote([,])dnl
582     BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}"
583 fi
584 AC_SUBST(BUILD_REVISION)
585 AC_SUBST(BUILD_TIMESTAMP)
586 AC_SUBST(BUILD_FILEVERSION)
587
588 # Add a few constants to help porting to W32
589 AH_VERBATIM([SEPCONSTANTS],
590 [
591 /* Separators as used in $PATH.  */
592 #ifdef HAVE_DOSISH_SYSTEM
593 #define PATHSEP_C ';'
594 #else
595 #define PATHSEP_C ':'
596 #endif
597 ])
598
599 AH_BOTTOM([
600 /* Definition of GCC specific attributes.  */
601 #if __GNUC__ > 2 
602 # define GPGME_GCC_A_PURE  __attribute__ ((__pure__))
603 #else
604 # define GPGME_GCC_A_PURE
605 #endif
606 ])
607
608
609 # Substitution used for gpgme-config 
610 GPGME_CONFIG_LIBS="-lgpgme"
611 GPGME_CONFIG_CFLAGS=""
612 AC_SUBST(GPGME_CONFIG_API_VERSION)
613 AC_SUBST(GPGME_CONFIG_LIBS)
614 AC_SUBST(GPGME_CONFIG_CFLAGS)
615
616 # Frob'da Variables
617 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
618            sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
619 AC_SUBST(LTLIBOBJS)
620
621 #
622 # Create config files 
623
624 AC_CONFIG_FILES(Makefile assuan/Makefile gpgme/Makefile
625                 tests/Makefile tests/gpg/Makefile tests/gpgsm/Makefile
626                 doc/Makefile complus/Makefile
627                 gpgme/versioninfo.rc)
628 AC_CONFIG_FILES(gpgme/gpgme-config, chmod +x gpgme/gpgme-config)
629 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
630 AC_OUTPUT
631
632 echo "
633         GPGME v${VERSION} has been configured as follows:
634
635         GnuPG path:    $GPG
636         GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
637
638         GpgSM path:    $GPGSM
639         GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
640
641         GPGME Pthread: $have_pthread
642         GPGME Pth:     $have_pth
643 "