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