1 # configure.ac for GPGME
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
4 # 2009, 2010 g10 Code GmbH
6 # This file is part of GPGME.
8 # GPGME is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU Lesser General Public License as
10 # published by the Free Software Foundation; either version 2.1 of the
11 # License, or (at your option) any later version.
13 # GPGME is distributed in the hope that it will be useful, but WITHOUT
14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
16 # Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with this program; if not, write to the Free Software
20 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22 # (Process this file with autoconf to produce a configure script.)
24 min_automake_version="1.10"
26 # Version number: Remember to change it immediately *after* a release.
27 # Make sure to run "svn up" and "./autogen.sh --force"
28 # before a "make dist". See below for the LT versions.
30 # The SVN version is usually the next intended release version with
31 # the string "-svnNNN" appended. The reason for this is that tests for a
32 # specific feature can already be done under the assumption that the
33 # SVN version is the most recent one in a branch. To disable the SVN
34 # version for the real release, set the my_issvn macro to no.
35 m4_define(my_version, [1.3.1])
36 m4_define(my_issvn, [yes])
38 m4_define([svn_revision], m4_esyscmd([printf "%d" $( (svn info 2>/dev/null \
39 || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
41 [my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision])],
42 [bug-gpgme@gnupg.org])
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)
51 LIBGPGME_LT_CURRENT=18
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.]
55 LIBGPGME_LT_REVISION=0
57 # If the API is changed in an incompatible way: increment the next counter.
58 GPGME_CONFIG_API_VERSION=1
59 ##############################################
62 NEED_LIBASSUAN_VERSION=2.0.0
65 BUILD_REVISION=svn_revision
67 VERSION=$PACKAGE_VERSION
69 AC_CONFIG_SRCDIR(src/gpgme.h.in)
70 dnl FIXME: Enable this with autoconf 2.59.
71 dnl AC_CONFIG_MACRO_DIR(m4)
72 AM_CONFIG_HEADER(config.h)
73 AC_CONFIG_MACRO_DIR([m4])
74 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
78 # Enable GNU extensions on systems that have them.
81 AH_VERBATIM([_REENTRANT],
82 [/* To allow the use of GPGME in multithreaded programs we have to use
83 special features from the library.
84 IMPORTANT: gpgme is not yet fully reentrant and you should use it
85 only from one thread. */
93 AC_SUBST(LIBGPGME_LT_CURRENT)
94 AC_SUBST(LIBGPGME_LT_AGE)
95 AC_SUBST(LIBGPGME_LT_REVISION)
99 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
100 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
102 # Don't default to build static libs.
104 LT_INIT([win32-dll disable-static])
105 LT_LANG([Windows Resource])
107 # For now we hardcode the use of version scripts. It would be better
108 # to write a test for this or even implement this within libtool.
109 have_ld_version_script=no
112 have_ld_version_script=yes
115 have_ld_version_script=yes
118 AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
122 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
128 component_system=None
129 have_dosish_system=no
135 have_w32ce_system=yes
139 *-mingw32ce*|*-mingw32*)
140 # special stuff for Windoze NT
141 have_dosish_system=yes
143 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
144 GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
145 GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
146 G13_DEFAULT='c:\\gnupg\\g13.exe'
147 #component_system='COM+'
150 AC_ARG_ENABLE(w32-glib,
151 AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
152 build_w32_glib=$enableval)
154 # Check disabled, because the qt-dev packages in gpg4win do
155 # not provide any support for cross compilation.
156 # PKG_CHECK_MODULES(QT4_CORE, QtCore)
159 # ./configure --enable-w32-qt QT4_CORE_CFLAGS="..." QT4_CORE_LIBS="..."
160 AC_SUBST(QT4_CORE_CFLAGS)
161 AC_SUBST(QT4_CORE_LIBS)
162 AC_ARG_ENABLE(w32-qt,
163 AC_HELP_STRING([--enable-w32-qt], [build GPGME Qt for W32]),
164 build_w32_qt=$enableval)
167 AC_CHECK_PTH(1.2.0,,,no,have_pth=yes)
168 if test "$have_pth" = yes; then
169 AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.])
171 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
172 if test "$have_pthread" = yes; then
173 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
176 # XXX: Probably use exec-prefix here?
177 # GPG_DEFAULT='/usr/bin/gpg'
178 # GPGSM_DEFAULT='/usr/bin/gpgsm'
179 # GPGCONF_DEFAULT='/usr/bin/gpgconf'
180 # G13_DEFAULT='/usr/bin/g13'
184 if test "$have_dosish_system" = yes; then
185 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
186 [Defined if we run on some of the PCDOS like systems
187 (DOS, Windoze. OS/2) with special properties like
190 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
192 if test "$have_w32_system" = yes; then
193 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
195 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
196 if test "$have_w32ce_system" = yes; then
197 AC_DEFINE(HAVE_W32CE_SYSTEM,1, [Defined if we run on a W32 CE API based system])
199 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
200 AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
201 AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes)
203 AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
204 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
208 # Checks for header files.
209 AC_CHECK_HEADERS([locale.h])
210 AC_CHECK_HEADERS(sys/select.h)
211 AC_CHECK_HEADERS([sys/uio.h])
216 AC_CHECK_SIZEOF(unsigned int)
221 # A simple compile time check in gpgme.h for GNU/Linux systems that
222 # prevents a file offset bits mismatch between gpgme and the application.
223 NEED__FILE_OFFSET_BITS=0
224 case "$ac_cv_sys_file_offset_bits" in
225 "" | no | unknown) ;;
227 NEED__FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
230 AC_SUBST(NEED__FILE_OFFSET_BITS)
233 # Checks for compiler features.
234 if test "$GCC" = yes; then
235 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
236 if test "$have_w32_system" = yes; then
237 CFLAGS="$CFLAGS -mms-bitfields"
241 # Only used for debugging, so no serious test needed (for actual
242 # functionality you have to test libc as well, this only tests the
244 AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
245 AC_COMPILE_IFELSE([__thread int foo;],
246 gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
247 if test "$gpgme_cv_tls_works" = yes; then
248 AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
252 # Checks for library functions.
255 AC_REPLACE_FUNCS(vasprintf)
256 if test "$ac_cv_func_vasprintf" != yes; then
260 # Try to find a thread-safe version of ttyname().
261 AC_REPLACE_FUNCS(ttyname_r)
262 if test "$ac_cv_func_ttyname_r" != yes; then
265 *** ttyname() is not thread-safe and ttyname_r() does not exist
269 # Try to find a thread-safe version of getenv().
270 have_thread_safe_getenv=no
272 if test $GLIBC21 = yes; then
273 have_thread_safe_getenv=yes
275 if test $have_thread_safe_getenv = yes; then
276 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
279 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
280 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
283 *** getenv() is not thread-safe and getenv_r() does not exist
287 # For converting time strings to seconds since Epoch, we need the timegm
289 AC_CHECK_FUNCS(timegm)
290 if test "$ac_cv_func_timegm" != yes; then
293 *** timegm() not available - a non-thread-safe kludge will be used
294 *** and the TZ variable might be changed at runtime.
298 AC_CHECK_FUNCS(setlocale)
300 # Checking for libgpg-error.
301 AM_PATH_GPG_ERROR(1.8,, AC_MSG_ERROR([libgpg-error was not found]))
302 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
303 [The default error source for GPGME.])
307 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
308 have_libassuan=yes, have_libassuan=no)
309 if test "$have_libassuan" = "yes"; then
310 AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
311 [version of the libassuan library])
313 AM_CONDITIONAL(HAVE_ASSUAN, test "$have_libassuan" = "yes")
314 if test "$have_libassuan" = "yes"; then
315 AC_DEFINE(ENABLE_ASSUAN,1,[Whether Assuan support is enabled])
318 # Checks for system services
319 NEED_GPG_VERSION_DEFAULT=1.4.0
320 NEED_GPGSM_VERSION_DEFAULT=1.9.6
321 NEED_GPGCONF_VERSION_DEFAULT=2.0.4
322 NEED_G13_VERSION_DEFAULT=2.1.0
323 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
324 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
325 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
326 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
327 AC_ARG_WITH(gpg-version,
328 AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
329 NEED_GPG_VERSION=$withval)
330 if test "$NEED_GPG_VERSION" = "yes"; then
331 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
333 if test "$NEED_GPG_VERSION" = "no"; then
334 NEED_GPG_VERSION=0.0.0
336 AC_ARG_WITH(gpgsm-version,
337 AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
338 NEED_GPGSM_VERSION=$withval)
339 if test "$NEED_GPGSM_VERSION" = "yes"; then
340 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
342 if test "$NEED_GPGSM_VERSION" = "no"; then
343 NEED_GPGSM_VERSION=0.0.0
345 AC_ARG_WITH(gpgconf-version,
346 AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
347 NEED_GPGCONF_VERSION=$withval)
348 if test "$NEED_GPGCONF_VERSION" = "yes"; then
349 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
351 if test "$NEED_GPGCONF_VERSION" = "no"; then
352 NEED_GPGCONF_VERSION=0.0.0
354 AC_ARG_WITH(g13-version,
355 AC_HELP_STRING([--with-g13-version=VER], [require G13 version VER]),
356 NEED_G13_VERSION=$withval)
357 if test "$NEED_G13_VERSION" = "yes"; then
358 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
360 if test "$NEED_G13_VERSION" = "no"; then
361 NEED_G13_VERSION=0.0.0
364 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
365 [Min. needed GnuPG version.])
366 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
367 [Min. needed GPGSM version.])
368 AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
369 [Min. needed GPGCONF version.])
370 AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
371 [Min. needed G13 version.])
376 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
377 GPG=$withval, NO_OVERRIDE=yes)
378 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
381 if test "$cross_compiling" != "yes"; then
382 AC_PATH_PROG(GPG, gpg)
384 if test -z "$GPG"; then
388 if test "$GPG" = no; then
389 if test "$NO_OVERRIDE" = "yes"; then
390 if test "$cross_compiling" != "yes"; then
393 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
398 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
403 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
406 dnl Check for GnuPG version requirement.
409 if test -z "$GPG" -o "x$GPG" = "xno"; then
412 if test "$cross_compiling" = "yes"; then
413 AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
416 if test ! -x "$GPG"; then
417 AC_MSG_WARN([GnuPG not executable, version check disabled])
422 if test "$ok" = "maybe"; then
423 AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
424 req_major=`echo $NEED_GPG_VERSION | \
425 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
426 req_minor=`echo $NEED_GPG_VERSION | \
427 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
428 req_micro=`echo $NEED_GPG_VERSION | \
429 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
430 GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
431 major=`echo $GPG_VERSION | \
432 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
433 minor=`echo $GPG_VERSION | \
434 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
435 micro=`echo $GPG_VERSION | \
436 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
438 if test "$major" -gt "$req_major"; then
441 if test "$major" -eq "$req_major"; then
442 if test "$minor" -gt "$req_minor"; then
445 if test "$minor" -eq "$req_minor"; then
446 if test "$micro" -ge "$req_micro"; then
453 if test "$ok" = "yes"; then
457 AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
461 AC_ARG_ENABLE(gpg-test,
462 AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
463 run_gpg_test=$enableval)
464 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
469 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
470 GPGSM=$withval, NO_OVERRIDE=yes)
471 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
474 if test "$cross_compiling" != "yes"; then
475 AC_PATH_PROG(GPGSM, gpgsm)
477 if test -z "$GPGSM"; then
478 GPGSM="$GPGSM_DEFAULT"
481 if test "$GPGSM" = no; then
482 if test "$NO_OVERRIDE" = "yes"; then
483 if test "$cross_compiling" != "yes"; then
486 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
491 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
496 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
497 AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
499 AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
502 dnl Check for GPGSM version requirement.
503 GPGSM_VERSION=unknown
505 if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
508 if test "$cross_compiling" = "yes"; then
509 AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
512 if test ! -x "$GPGSM"; then
513 AC_MSG_WARN([GPGSM not executable, version check disabled])
518 if test "$ok" = "maybe"; then
519 AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
520 req_major=`echo $NEED_GPGSM_VERSION | \
521 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
522 req_minor=`echo $NEED_GPGSM_VERSION | \
523 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
524 req_micro=`echo $NEED_GPGSM_VERSION | \
525 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
526 GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
527 major=`echo $GPGSM_VERSION | \
528 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
529 minor=`echo $GPGSM_VERSION | \
530 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
531 micro=`echo $GPGSM_VERSION | \
532 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
534 if test "$major" -gt "$req_major"; then
537 if test "$major" -eq "$req_major"; then
538 if test "$minor" -gt "$req_minor"; then
541 if test "$minor" -eq "$req_minor"; then
542 if test "$micro" -ge "$req_micro"; then
549 if test "$ok" = "yes"; then
553 AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
557 AC_ARG_ENABLE(gpgsm-test,
558 AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
559 run_gpgsm_test=$enableval)
560 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
565 AC_HELP_STRING([--with-gpgconf=PATH],
566 [use gpgconf binary at PATH]),
567 GPGCONF=$withval, NO_OVERRIDE=yes)
568 if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
571 if test "$cross_compiling" != "yes"; then
572 AC_PATH_PROG(GPGCONF, gpgconf)
574 if test -z "$GPGCONF"; then
575 GPGCONF="$GPGCONF_DEFAULT"
578 if test "$GPGCONF" = no; then
579 if test "$NO_OVERRIDE" = "yes"; then
580 if test "$cross_compiling" != "yes"; then
583 *** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
588 *** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
593 AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
594 AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
596 AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
598 dnl Check for GPGCONF version requirement.
599 GPGCONF_VERSION=unknown
601 if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
604 if test "$cross_compiling" = "yes"; then
605 AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
608 if test ! -x "$GPGCONF"; then
609 AC_MSG_WARN([GPGCONF not executable, version check disabled])
614 if test "$ok" = "maybe"; then
615 AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
616 req_major=`echo $NEED_GPGCONF_VERSION | \
617 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
618 req_minor=`echo $NEED_GPGCONF_VERSION | \
619 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
620 req_micro=`echo $NEED_GPGCONF_VERSION | \
621 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
622 GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
623 major=`echo $GPGCONF_VERSION | \
624 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
625 minor=`echo $GPGCONF_VERSION | \
626 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
627 micro=`echo $GPGCONF_VERSION | \
628 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
630 if test "$major" -gt "$req_major"; then
633 if test "$major" -eq "$req_major"; then
634 if test "$minor" -gt "$req_minor"; then
637 if test "$minor" -eq "$req_minor"; then
638 if test "$micro" -ge "$req_micro"; then
645 if test "$ok" = "yes"; then
649 AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
652 run_gpgconf_test="$ok"
653 AC_ARG_ENABLE(gpgconf-test,
654 AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
655 run_gpgconf_test=$enableval)
656 AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
661 AC_HELP_STRING([--with-g13=PATH],
662 [use g13 binary at PATH]),
663 G13=$withval, NO_OVERRIDE=yes)
664 if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
667 if test "$cross_compiling" != "yes"; then
668 AC_PATH_PROG(G13, g13)
670 if test -z "$G13"; then
674 if test "$G13" = no; then
675 if test "$NO_OVERRIDE" = "yes"; then
676 if test "$cross_compiling" != "yes"; then
679 *** Could not find g13, install g13 or use --with-g13=PATH to enable it
684 *** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
689 AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
690 AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
692 AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
694 dnl Check for G13 version requirement.
697 if test -z "$G13" -o "x$G13" = "xno"; then
700 if test "$cross_compiling" = "yes"; then
701 AC_MSG_WARN([G13 version can not be checked when cross compiling])
704 if test ! -x "$G13"; then
705 AC_MSG_WARN([G13 not executable, version check disabled])
710 if test "$ok" = "maybe"; then
711 AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
712 req_major=`echo $NEED_G13_VERSION | \
713 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
714 req_minor=`echo $NEED_G13_VERSION | \
715 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
716 req_micro=`echo $NEED_G13_VERSION | \
717 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
718 G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
719 major=`echo $G13_VERSION | \
720 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
721 minor=`echo $G13_VERSION | \
722 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
723 micro=`echo $G13_VERSION | \
724 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
726 if test "$major" -gt "$req_major"; then
729 if test "$major" -eq "$req_major"; then
730 if test "$minor" -gt "$req_minor"; then
733 if test "$minor" -eq "$req_minor"; then
734 if test "$micro" -ge "$req_micro"; then
741 if test "$ok" = "yes"; then
745 AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
749 AC_ARG_ENABLE(g13-test,
750 AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
751 run_g13_test=$enableval)
752 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
756 AC_CHECK_FUNCS(funopen)
757 if test $ac_cv_func_funopen != yes; then
758 # No funopen but we can implement that in terms of fopencookie.
759 AC_CHECK_FUNCS(fopencookie)
760 if test $ac_cv_func_fopencookie = yes; then
761 AC_REPLACE_FUNCS(funopen)
765 *** No implementation of fopencookie or funopen available
770 # Check for getgid etc
771 AC_CHECK_FUNCS(getgid getegid)
774 # Replacement functions.
775 AC_REPLACE_FUNCS(stpcpy)
776 # Check for unistd.h for setenv replacement function.
777 AC_CHECK_HEADERS([unistd.h sys/time.h sys/types.h sys/stat.h])
778 AC_REPLACE_FUNCS(setenv)
780 # Assuan check for descriptor passing.
781 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
782 [supports_descriptor_passing=yes],
783 [supports_descriptor_passing=no
786 *** Data structure for sending ancillary data missing.
787 *** Descriptor passing won't work.
792 #include <sys/types.h>
793 #include <sys/socket.h>
801 use_descriptor_passing=no
802 AC_ARG_ENABLE(fd-passing,
803 AC_HELP_STRING([--enable-fd-passing], [use FD passing if supported]),
804 use_descriptor_passing=$enableval)
806 if test "$supports_descriptor_passing" != "yes"; then
807 use_descriptor_passing=no
810 if test "$use_descriptor_passing" = "yes"; then
811 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
812 [Defined if descriptor passing is enabled and supported])
815 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
819 if test "$use_descriptor_passing" = "yes" && test "$have_libassuan" = "yes"; then
822 if test "$uiserver" != "no"; then
823 AC_DEFINE(ENABLE_UISERVER, 1,
824 [Defined if we are building with uiserver support.])
826 AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
829 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
831 # Generate values for the DLL version info
832 if test "$have_w32_system" = yes; then
833 BUILD_TIMESTAMP=`date --iso-8601=minutes`
835 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
837 BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}"
839 AC_SUBST(BUILD_REVISION)
840 AC_SUBST(BUILD_TIMESTAMP)
841 AC_SUBST(BUILD_FILEVERSION)
843 # Add a few constants to help porting to W32
844 AH_VERBATIM([SEPCONSTANTS],
846 /* Separators as used in $PATH. */
847 #ifdef HAVE_DOSISH_SYSTEM
848 #define PATHSEP_C ';'
850 #define PATHSEP_C ':'
855 /* Definition of GCC specific attributes. */
857 # define GPGME_GCC_A_PURE __attribute__ ((__pure__))
859 # define GPGME_GCC_A_PURE
862 /* Under WindowsCE we need gpg-error's strerror macro. */
863 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
867 # Substitution used for gpgme-config
868 GPGME_CONFIG_LIBS="-lgpgme"
869 GPGME_CONFIG_CFLAGS=""
870 AC_SUBST(GPGME_CONFIG_API_VERSION)
871 AC_SUBST(GPGME_CONFIG_LIBS)
872 AC_SUBST(GPGME_CONFIG_CFLAGS)
875 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
876 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
879 # Some checks for gpgme-tool
880 AC_CHECK_HEADER([argp.h])
881 AC_CHECK_TYPES([error_t], [],
882 [AC_DEFINE([error_t], [int],
883 [Define to a type to use for `error_t' if it is not otherwise available.])],
884 [#include <errno.h>])
887 # A substitution to set generated files in a Emacs buffer to read-only.
888 AC_SUBST(emacs_local_vars_begin, ['Local Variables:'])
889 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
890 AC_SUBST(emacs_local_vars_end, ['End:'])
895 if test "$have_libassuan" = "no"; then
899 *** You need libassuan to build this program with GPGSM support.
900 *** This library is for example available at
901 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
902 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
906 if test "$die" = "yes"; then
909 *** Required libraries not found. Please consult the above messages
910 *** and install them before running configure again.
916 # Create config files
918 AC_CONFIG_FILES(Makefile src/Makefile
922 tests/opassuan/Makefile
923 doc/Makefile complus/Makefile
926 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
927 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
931 GPGME v${VERSION} has been configured as follows:
934 GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
937 GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
939 GpgConf path: $GPGCONF
940 GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
943 G13 version: $G13_VERSION, min. $NEED_G13_VERSION
945 Assuan version: $libassuan_version, min. $NEED_LIBASSUAN_VERSION
948 FD Passing: $use_descriptor_passing
950 GPGME Pthread: $have_pthread