1 # configure.ac for GPGME
2 # Copyright (C) 2000 Werner Koch (dd9jn)
3 # Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 g10 Code GmbH
5 # This file is part of GPGME.
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.
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.
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
21 # (Process this file with autoconf to produce a configure script.)
23 min_automake_version="1.10"
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.
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.2.1])
35 m4_define(my_issvn, [yes])
37 m4_define([svn_revision], m4_esyscmd([printf "%d" $( (svn info 2>/dev/null \
38 || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
40 [my_version[]m4_if(my_issvn,[yes],[-svn[]svn_revision])],
41 [bug-gpgme@gnupg.org])
44 # LT Version numbers, remember to change them just *before* a release.
45 # (Code changed: REVISION++)
46 # (Interfaces added/removed/changed: CURRENT++, REVISION=0)
47 # (Interfaces added: AGE++)
48 # (Interfaces removed/changed: AGE=0)
50 LIBGPGME_LT_CURRENT=18
51 # Subtract 2 from this value if you want to make the LFS transition an
52 # ABI break. [Note to self: Remove this comment with the next regular break.]
54 LIBGPGME_LT_REVISION=0
56 # If the API is changed in an incompatible way: increment the next counter.
57 GPGME_CONFIG_API_VERSION=1
58 ##############################################
61 BUILD_REVISION=svn_revision
63 VERSION=$PACKAGE_VERSION
65 AC_CONFIG_SRCDIR(src/gpgme.h.in)
66 dnl FIXME: Enable this with autoconf 2.59.
67 dnl AC_CONFIG_MACRO_DIR(m4)
68 AM_CONFIG_HEADER(config.h)
69 AC_CONFIG_MACRO_DIR([m4])
70 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
74 # Enable GNU extensions on systems that have them.
77 AH_VERBATIM([_REENTRANT],
78 [/* To allow the use of GPGME in multithreaded programs we have to use
79 special features from the library.
80 IMPORTANT: gpgme is not yet fully reentrant and you should use it
81 only from one thread. */
89 AC_SUBST(LIBGPGME_LT_CURRENT)
90 AC_SUBST(LIBGPGME_LT_AGE)
91 AC_SUBST(LIBGPGME_LT_REVISION)
95 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
96 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
98 # Don't default to build static libs.
100 LT_INIT([win32-dll disable-static])
101 LT_LANG([Windows Resource])
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
108 have_ld_version_script=yes
111 have_ld_version_script=yes
114 AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
118 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
124 component_system=None
125 have_dosish_system=no
131 # special stuff for Windoze NT
132 have_dosish_system=yes
134 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
135 GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
136 GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
137 G13_DEFAULT='c:\\gnupg\\g13.exe'
138 #component_system='COM+'
141 AC_ARG_ENABLE(w32-glib,
142 AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
143 build_w32_glib=$enableval)
145 # Check disabled, because the qt-dev packages in gpg4win do
146 # not provide any support for cross compilation.
147 # PKG_CHECK_MODULES(QT4_CORE, QtCore)
150 # ./configure --enable-w32-qt QT4_CORE_CFLAGS="..." QT4_CORE_LIBS="..."
151 AC_SUBST(QT4_CORE_CFLAGS)
152 AC_SUBST(QT4_CORE_LIBS)
153 AC_ARG_ENABLE(w32-qt,
154 AC_HELP_STRING([--enable-w32-qt], [build GPGME Qt for W32]),
155 build_w32_qt=$enableval)
158 AC_CHECK_PTH(1.2.0,,,no,have_pth=yes)
159 if test "$have_pth" = yes; then
160 AC_DEFINE(HAVE_PTH, ,[Define if we have Pth.])
162 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
163 if test "$have_pthread" = yes; then
164 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
167 # XXX: Probably use exec-prefix here?
168 # GPG_DEFAULT='/usr/bin/gpg'
169 # GPGSM_DEFAULT='/usr/bin/gpgsm'
170 # GPGCONF_DEFAULT='/usr/bin/gpgconf'
171 # G13_DEFAULT='/usr/bin/g13'
175 if test "$have_dosish_system" = yes; then
176 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
177 [Defined if we run on some of the PCDOS like systems
178 (DOS, Windoze. OS/2) with special properties like
181 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
183 if test "$have_w32_system" = yes; then
184 AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
186 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
187 AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
188 AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes)
190 AM_CONDITIONAL(HAVE_PTH, test "$have_pth" = "yes")
191 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
195 # Checks for header files.
196 AC_CHECK_HEADERS(sys/select.h)
197 AC_CHECK_HEADERS([sys/uio.h])
202 AC_CHECK_SIZEOF(unsigned int)
207 # A simple compile time check in gpgme.h for GNU/Linux systems that
208 # prevents a file offset bits mismatch between gpgme and the application.
209 NEED__FILE_OFFSET_BITS=0
210 case "$ac_cv_sys_file_offset_bits" in
211 "" | no | unknown) ;;
213 NEED__FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
216 AC_SUBST(NEED__FILE_OFFSET_BITS)
219 # Checks for compiler features.
220 if test "$GCC" = yes; then
221 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
222 if test "$have_w32_system" = yes; then
223 CFLAGS="$CFLAGS -mms-bitfields"
227 # Only used for debugging, so no serious test needed (for actual
228 # functionality you have to test libc as well, this only tests the
230 AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
231 AC_COMPILE_IFELSE([__thread int foo;],
232 gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
233 if test "$gpgme_cv_tls_works" = yes; then
234 AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
238 # Checks for library functions.
241 AC_REPLACE_FUNCS(vasprintf)
242 if test "$ac_cv_func_vasprintf" != yes; then
246 # Try to find a thread-safe version of ttyname().
247 AC_REPLACE_FUNCS(ttyname_r)
248 if test "$ac_cv_func_ttyname_r" != yes; then
251 *** ttyname() is not thread-safe and ttyname_r() does not exist
255 # Try to find a thread-safe version of getenv().
256 have_thread_safe_getenv=no
258 if test $GLIBC21 = yes; then
259 have_thread_safe_getenv=yes
261 if test $have_thread_safe_getenv = yes; then
262 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
265 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
266 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
269 *** getenv() is not thread-safe and getenv_r() does not exist
273 # For converting time strings to seconds since Epoch, we need the timegm
275 AC_CHECK_FUNCS(timegm)
276 if test "$ac_cv_func_timegm" != yes; then
279 *** timegm() not available - a non-thread-safe kludge will be used
280 *** and the TZ variable might be changed at runtime.
284 # Checking for libgpg-error.
285 AM_PATH_GPG_ERROR(1.4,, AC_MSG_ERROR([libgpg-error was not found]))
286 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
287 [The default error source for GPGME.])
290 NEED_LIBASSUAN_VERSION=1.1.0
292 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_VERSION",
293 have_libassuan=yes, have_libassuan=no)
294 AM_CONDITIONAL(HAVE_ASSUAN, test "$have_libassuan" = "yes")
295 if test "$have_libassuan" = "yes"; then
296 AC_DEFINE(ENABLE_ASSUAN,1,[Whether Assuan support is enabled])
299 # Checks for system services
300 NEED_GPG_VERSION_DEFAULT=1.4.0
301 NEED_GPGSM_VERSION_DEFAULT=1.9.6
302 NEED_GPGCONF_VERSION_DEFAULT=2.0.4
303 NEED_G13_VERSION_DEFAULT=2.1.0
304 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
305 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
306 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
307 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
308 AC_ARG_WITH(gpg-version,
309 AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
310 NEED_GPG_VERSION=$withval)
311 if test "$NEED_GPG_VERSION" = "yes"; then
312 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
314 if test "$NEED_GPG_VERSION" = "no"; then
315 NEED_GPG_VERSION=0.0.0
317 AC_ARG_WITH(gpgsm-version,
318 AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
319 NEED_GPGSM_VERSION=$withval)
320 if test "$NEED_GPGSM_VERSION" = "yes"; then
321 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
323 if test "$NEED_GPGSM_VERSION" = "no"; then
324 NEED_GPGSM_VERSION=0.0.0
326 AC_ARG_WITH(gpgconf-version,
327 AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
328 NEED_GPGCONF_VERSION=$withval)
329 if test "$NEED_GPGCONF_VERSION" = "yes"; then
330 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
332 if test "$NEED_GPGCONF_VERSION" = "no"; then
333 NEED_GPGCONF_VERSION=0.0.0
335 AC_ARG_WITH(g13-version,
336 AC_HELP_STRING([--with-g13-version=VER], [require G13 version VER]),
337 NEED_G13_VERSION=$withval)
338 if test "$NEED_G13_VERSION" = "yes"; then
339 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
341 if test "$NEED_G13_VERSION" = "no"; then
342 NEED_G13_VERSION=0.0.0
345 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
346 [Min. needed GnuPG version.])
347 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
348 [Min. needed GPGSM version.])
349 AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
350 [Min. needed GPGCONF version.])
351 AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
352 [Min. needed G13 version.])
357 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
358 GPG=$withval, NO_OVERRIDE=yes)
359 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
362 if test "$cross_compiling" != "yes"; then
363 AC_PATH_PROG(GPG, gpg)
365 if test -z "$GPG"; then
369 if test "$GPG" = no; then
370 if test "$NO_OVERRIDE" = "yes"; then
371 if test "$cross_compiling" != "yes"; then
374 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
379 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
384 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
387 dnl Check for GnuPG version requirement.
390 if test -z "$GPG" -o "x$GPG" = "xno"; then
393 if test "$cross_compiling" = "yes"; then
394 AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
397 if test ! -x "$GPG"; then
398 AC_MSG_WARN([GnuPG not executable, version check disabled])
403 if test "$ok" = "maybe"; then
404 AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
405 req_major=`echo $NEED_GPG_VERSION | \
406 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
407 req_minor=`echo $NEED_GPG_VERSION | \
408 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
409 req_micro=`echo $NEED_GPG_VERSION | \
410 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
411 GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
412 major=`echo $GPG_VERSION | \
413 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
414 minor=`echo $GPG_VERSION | \
415 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
416 micro=`echo $GPG_VERSION | \
417 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
419 if test "$major" -gt "$req_major"; then
422 if test "$major" -eq "$req_major"; then
423 if test "$minor" -gt "$req_minor"; then
426 if test "$minor" -eq "$req_minor"; then
427 if test "$micro" -ge "$req_micro"; then
434 if test "$ok" = "yes"; then
438 AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
442 AC_ARG_ENABLE(gpg-test,
443 AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
444 run_gpg_test=$enableval)
445 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
450 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
451 GPGSM=$withval, NO_OVERRIDE=yes)
452 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
455 if test "$cross_compiling" != "yes"; then
456 AC_PATH_PROG(GPGSM, gpgsm)
458 if test -z "$GPGSM"; then
459 GPGSM="$GPGSM_DEFAULT"
462 if test "$GPGSM" = no; then
463 if test "$NO_OVERRIDE" = "yes"; then
464 if test "$cross_compiling" != "yes"; then
467 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
472 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
477 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
478 AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
480 AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
483 dnl Check for GPGSM version requirement.
484 GPGSM_VERSION=unknown
486 if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
489 if test "$cross_compiling" = "yes"; then
490 AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
493 if test ! -x "$GPGSM"; then
494 AC_MSG_WARN([GPGSM not executable, version check disabled])
499 if test "$ok" = "maybe"; then
500 AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
501 req_major=`echo $NEED_GPGSM_VERSION | \
502 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
503 req_minor=`echo $NEED_GPGSM_VERSION | \
504 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
505 req_micro=`echo $NEED_GPGSM_VERSION | \
506 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
507 GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
508 major=`echo $GPGSM_VERSION | \
509 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
510 minor=`echo $GPGSM_VERSION | \
511 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
512 micro=`echo $GPGSM_VERSION | \
513 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
515 if test "$major" -gt "$req_major"; then
518 if test "$major" -eq "$req_major"; then
519 if test "$minor" -gt "$req_minor"; then
522 if test "$minor" -eq "$req_minor"; then
523 if test "$micro" -ge "$req_micro"; then
530 if test "$ok" = "yes"; then
534 AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
538 AC_ARG_ENABLE(gpgsm-test,
539 AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
540 run_gpgsm_test=$enableval)
541 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
543 # Require libassuan if GPGSM is here.
545 if test "$GPGSM" != "no"; then
546 require_libassuan=yes
548 if test "$G13" != "no"; then
549 require_libassuan=yes
555 AC_HELP_STRING([--with-gpgconf=PATH],
556 [use gpgconf binary at PATH]),
557 GPGCONF=$withval, NO_OVERRIDE=yes)
558 if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
561 if test "$cross_compiling" != "yes"; then
562 AC_PATH_PROG(GPGCONF, gpgconf)
564 if test -z "$GPGCONF"; then
565 GPGCONF="$GPGCONF_DEFAULT"
568 if test "$GPGCONF" = no; then
569 if test "$NO_OVERRIDE" = "yes"; then
570 if test "$cross_compiling" != "yes"; then
573 *** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
578 *** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
583 AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
584 AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
586 AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
588 dnl Check for GPGCONF version requirement.
589 GPGCONF_VERSION=unknown
591 if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
594 if test "$cross_compiling" = "yes"; then
595 AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
598 if test ! -x "$GPGCONF"; then
599 AC_MSG_WARN([GPGCONF not executable, version check disabled])
604 if test "$ok" = "maybe"; then
605 AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
606 req_major=`echo $NEED_GPGCONF_VERSION | \
607 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
608 req_minor=`echo $NEED_GPGCONF_VERSION | \
609 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
610 req_micro=`echo $NEED_GPGCONF_VERSION | \
611 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
612 GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
613 major=`echo $GPGCONF_VERSION | \
614 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
615 minor=`echo $GPGCONF_VERSION | \
616 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
617 micro=`echo $GPGCONF_VERSION | \
618 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
620 if test "$major" -gt "$req_major"; then
623 if test "$major" -eq "$req_major"; then
624 if test "$minor" -gt "$req_minor"; then
627 if test "$minor" -eq "$req_minor"; then
628 if test "$micro" -ge "$req_micro"; then
635 if test "$ok" = "yes"; then
639 AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
642 run_gpgconf_test="$ok"
643 AC_ARG_ENABLE(gpgconf-test,
644 AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
645 run_gpgconf_test=$enableval)
646 AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
651 AC_HELP_STRING([--with-g13=PATH],
652 [use g13 binary at PATH]),
653 G13=$withval, NO_OVERRIDE=yes)
654 if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
657 if test "$cross_compiling" != "yes"; then
658 AC_PATH_PROG(G13, g13)
660 if test -z "$G13"; then
664 if test "$G13" = no; then
665 if test "$NO_OVERRIDE" = "yes"; then
666 if test "$cross_compiling" != "yes"; then
669 *** Could not find g13, install g13 or use --with-g13=PATH to enable it
674 *** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
679 AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
680 AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
682 AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
684 dnl Check for G13 version requirement.
687 if test -z "$G13" -o "x$G13" = "xno"; then
690 if test "$cross_compiling" = "yes"; then
691 AC_MSG_WARN([G13 version can not be checked when cross compiling])
694 if test ! -x "$G13"; then
695 AC_MSG_WARN([G13 not executable, version check disabled])
700 if test "$ok" = "maybe"; then
701 AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
702 req_major=`echo $NEED_G13_VERSION | \
703 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
704 req_minor=`echo $NEED_G13_VERSION | \
705 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
706 req_micro=`echo $NEED_G13_VERSION | \
707 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
708 G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
709 major=`echo $G13_VERSION | \
710 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
711 minor=`echo $G13_VERSION | \
712 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
713 micro=`echo $G13_VERSION | \
714 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
716 if test "$major" -gt "$req_major"; then
719 if test "$major" -eq "$req_major"; then
720 if test "$minor" -gt "$req_minor"; then
723 if test "$minor" -eq "$req_minor"; then
724 if test "$micro" -ge "$req_micro"; then
731 if test "$ok" = "yes"; then
735 AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
739 AC_ARG_ENABLE(g13-test,
740 AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
741 run_g13_test=$enableval)
742 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
746 AC_CHECK_FUNCS(funopen)
747 if test $ac_cv_func_funopen != yes; then
748 # No funopen but we can implement that in terms of fopencookie.
749 AC_CHECK_FUNCS(fopencookie)
750 if test $ac_cv_func_fopencookie = yes; then
751 AC_REPLACE_FUNCS(funopen)
755 *** No implementation of fopencookie or funopen available
760 # Check for getgid etc
761 AC_CHECK_FUNCS(getgid getegid)
764 # Replacement functions.
765 AC_REPLACE_FUNCS(stpcpy)
766 # Check for unistd.h for setenv replacement function.
767 AC_CHECK_HEADERS(unistd.h)
768 AC_REPLACE_FUNCS(setenv)
770 # Assuan check for descriptor passing.
771 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
772 [supports_descriptor_passing=yes],
773 [supports_descriptor_passing=no
776 *** Data structure for sending ancillary data missing.
777 *** Descriptor passing won't work.
782 #include <sys/types.h>
783 #include <sys/socket.h>
791 AC_ARG_ENABLE(fd-passing,
792 AC_HELP_STRING([--enable-fd-passing], [use FD passing if supported]),
793 use_descriptor_passing=$enableval)
795 if test "$supports_descriptor_passing" != "yes"; then
796 use_descriptor_passing=no
799 if test "$use_descriptor_passing" = "yes"; then
800 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
801 [Defined if descriptor passing is enabled and supported])
804 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
808 if test "$use_descriptor_passing" = "yes" && test "$have_libassuan" = "yes"; then
811 if test "$uiserver" != "no"; then
812 AC_DEFINE(ENABLE_UISERVER, 1,
813 [Defined if we are building with uiserver support.])
815 AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
818 AM_CONDITIONAL(BUILD_COMPLUS, test "$component_system" = "COM+")
820 # Generate values for the DLL version info
821 if test "$have_w32_system" = yes; then
822 BUILD_TIMESTAMP=`date --iso-8601=minutes`
824 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
826 BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_REVISION}"
828 AC_SUBST(BUILD_REVISION)
829 AC_SUBST(BUILD_TIMESTAMP)
830 AC_SUBST(BUILD_FILEVERSION)
832 # Add a few constants to help porting to W32
833 AH_VERBATIM([SEPCONSTANTS],
835 /* Separators as used in $PATH. */
836 #ifdef HAVE_DOSISH_SYSTEM
837 #define PATHSEP_C ';'
839 #define PATHSEP_C ':'
844 /* Definition of GCC specific attributes. */
846 # define GPGME_GCC_A_PURE __attribute__ ((__pure__))
848 # define GPGME_GCC_A_PURE
853 # Substitution used for gpgme-config
854 GPGME_CONFIG_LIBS="-lgpgme"
855 GPGME_CONFIG_CFLAGS=""
856 AC_SUBST(GPGME_CONFIG_API_VERSION)
857 AC_SUBST(GPGME_CONFIG_LIBS)
858 AC_SUBST(GPGME_CONFIG_CFLAGS)
861 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
862 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
865 # Some checks for gpgme-tool
866 AC_CHECK_HEADER([argp.h])
867 AC_CHECK_TYPES([error_t], [],
868 [AC_DEFINE([error_t], [int],
869 [Define to a type to use for `error_t' if it is not otherwise available.])],
870 [#include <errno.h>])
875 if test "$require_libassuan" = "no"; then
879 *** You need libassuan to build this program with GPGSM support.
880 *** This library is for example available at
881 *** ftp://ftp.gnupg.org/pub/gcrypt/alpha/libassuan/
882 *** (at least version $NEED_LIBASSUAN_VERSION is required).
886 if test "$die" = "yes"; then
889 *** Required libraries not found. Please consult the above messages
890 *** and install them before running configure again.
896 # Create config files
898 AC_CONFIG_FILES(Makefile src/Makefile
902 tests/opassuan/Makefile
903 doc/Makefile complus/Makefile
906 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
907 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
911 GPGME v${VERSION} has been configured as follows:
914 GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
917 GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
919 GpgConf path: $GPGCONF
920 GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
923 G13 version: $G13_VERSION, min. $NEED_G13_VERSION
925 Assuan version: $LIBASSUAN_VERSION
928 FD Passing: $use_descriptor_passing
930 GPGME Pthread: $have_pthread