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, 2011, 2012, 2013 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 General Public License
19 # along with this program; if not, see <http://www.gnu.org/licenses/>.
21 # (Process this file with autoconf to produce a configure script.)
23 min_automake_version="1.11"
25 # To build a release you need to create a tag with the version number
26 # (git tag -s gpgme-n.m.k) and run "./autogen.sh --force". Please
27 # bump the version number immediately after the release and do another
28 # commit and push so that the git magic is able to work. See below
29 # for the LT versions.
30 m4_define(mym4_version_major, [1])
31 m4_define(mym4_version_minor, [4])
32 m4_define(mym4_version_micro, [3])
34 # Below is m4 magic to extract and compute the revision number, the
35 # decimalized short revision number, a beta version string, and a flag
36 # indicating a development version (mym4_isgit). Note that the m4
37 # processing is done by autoconf and not during the configure run.
38 m4_define(mym4_version,
39 [mym4_version_major.mym4_version_minor.mym4_version_micro])
40 m4_define([mym4_revision],
41 m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
42 m4_define([mym4_revision_dec],
43 m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
44 m4_define([mym4_betastring],
45 m4_esyscmd_s([git describe --match 'gpgme-[0-9].*[0-9]' --long|\
46 awk -F- '$3!=0{print"-beta"$3}']))
47 m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
48 m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
50 AC_INIT([gpgme],[mym4_full_version],[http://bugs.gnupg.org])
52 # LT Version numbers, remember to change them just *before* a release.
53 # (Code changed: REVISION++)
54 # (Interfaces added/removed/changed: CURRENT++, REVISION=0)
55 # (Interfaces added: AGE++)
56 # (Interfaces removed/changed: AGE=0)
58 LIBGPGME_LT_CURRENT=22
59 # Subtract 2 from this value if you want to make the LFS transition an
60 # ABI break. [Note to self: Remove this comment with the next regular break.]
62 LIBGPGME_LT_REVISION=0
64 # If the API is changed in an incompatible way: increment the next counter.
65 GPGME_CONFIG_API_VERSION=1
66 ##############################################
68 NEED_GPG_ERROR_VERSION=1.8
70 NEED_LIBASSUAN_VERSION=2.0.2
74 VERSION=$PACKAGE_VERSION
76 AC_CONFIG_AUX_DIR([build-aux])
77 AC_CONFIG_MACRO_DIR([m4])
78 AC_CONFIG_SRCDIR(src/gpgme.h.in)
79 AC_CONFIG_HEADER(config.h)
80 # Note: For automake 1.13 add the option
86 # Enable GNU extensions on systems that have them.
89 AH_VERBATIM([_REENTRANT],
90 [/* To allow the use of GPGME in multithreaded programs we have to use
91 special features from the library.
92 IMPORTANT: gpgme is not yet fully reentrant and you should use it
93 only from one thread. */
101 # Note: A suitable gitlog-to-changelog script can be found in GnuPG master.
102 AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog, [gitlog-to-changelog])
104 AC_SUBST(LIBGPGME_LT_CURRENT)
105 AC_SUBST(LIBGPGME_LT_AGE)
106 AC_SUBST(LIBGPGME_LT_REVISION)
110 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
111 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
112 VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \
113 mym4_version_minor mym4_version_micro)
114 AC_SUBST(VERSION_NUMBER)
116 # Don't default to build static libs.
118 LT_INIT([win32-dll disable-static])
119 LT_LANG([Windows Resource])
121 # For now we hardcode the use of version scripts. It would be better
122 # to write a test for this or even implement this within libtool.
123 have_ld_version_script=no
126 have_ld_version_script=yes
129 have_ld_version_script=yes
132 AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
136 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
142 component_system=None
143 have_dosish_system=no
144 have_android_system=no
154 have_w32ce_system=yes
157 have_android_system=yes
161 *-mingw32ce*|*-mingw32*)
162 have_dosish_system=yes
164 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
165 GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
166 GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
167 G13_DEFAULT='c:\\gnupg\\g13.exe'
168 #component_system='COM+'
171 AC_ARG_ENABLE(w32-glib,
172 AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
173 build_w32_glib=$enableval)
175 # Check disabled, because the qt-dev packages in gpg4win do
176 # not provide any support for cross compilation.
177 # PKG_CHECK_MODULES(QT4_CORE, QtCore)
180 # ./configure --enable-w32-qt QT4_CORE_CFLAGS="..." QT4_CORE_LIBS="..."
181 AC_SUBST(QT4_CORE_CFLAGS)
182 AC_SUBST(QT4_CORE_LIBS)
183 AC_ARG_ENABLE(w32-qt,
184 AC_HELP_STRING([--enable-w32-qt], [build GPGME Qt for W32]),
185 build_w32_qt=$enableval)
188 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
189 if test "$have_pthread" = yes; then
190 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
193 # XXX: Probably use exec-prefix here?
194 # GPG_DEFAULT='/usr/bin/gpg'
195 # GPGSM_DEFAULT='/usr/bin/gpgsm'
196 # GPGCONF_DEFAULT='/usr/bin/gpgconf'
197 # G13_DEFAULT='/usr/bin/g13'
201 if test "$have_dosish_system" = yes; then
202 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
203 [Defined if we run on some of the PCDOS like systems
204 (DOS, Windoze. OS/2) with special properties like
207 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
209 if test "$have_w32_system" = yes; then
210 AC_DEFINE(HAVE_W32_SYSTEM,1,
211 [Defined if we run on any kind of W32 API based system])
213 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
215 if test "$have_w64_system" = yes; then
216 AC_DEFINE(HAVE_W64_SYSTEM,1,
217 [Defined if we run on a 64 bit W32 API based system])
219 AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
221 if test "$have_w32ce_system" = yes; then
222 AC_DEFINE(HAVE_W32CE_SYSTEM,1,
223 [Defined if we run on a W32 CE API based system])
225 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
227 if test "$have_android_system" = yes; then
228 AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
230 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
232 AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
233 AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes)
235 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
239 # Provide information about the build.
241 BUILD_REVISION="mym4_revision"
242 AC_SUBST(BUILD_REVISION)
243 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
244 [GIT commit id revision used to build this package])
247 BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
249 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
250 AC_SUBST(BUILD_FILEVERSION)
252 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
253 AC_SUBST(BUILD_TIMESTAMP)
254 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
255 [The time this package was configured for a build])
260 # Checks for header files.
261 AC_CHECK_HEADERS_ONCE([locale.h sys/select.h sys/uio.h argp.h
262 unistd.h sys/time.h sys/types.h sys/stat.h])
267 AC_CHECK_SIZEOF(unsigned int)
272 # A simple compile time check in gpgme.h for GNU/Linux systems that
273 # prevents a file offset bits mismatch between gpgme and the application.
274 NEED__FILE_OFFSET_BITS=0
275 if test "$have_w32_system" != yes; then
276 case "$ac_cv_sys_file_offset_bits" in
277 "" | no | unknown) ;;
279 NEED__FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
283 AC_SUBST(NEED__FILE_OFFSET_BITS)
285 # Figure out platform dependent typedefs for gpgme.h
286 if test "$have_w32_system" = yes; then
287 INSERT__TYPEDEFS_FOR_GPGME_H="
290 typedef int64_t gpgme_off_t;
291 typedef int64_t gpgme_ssize_t;
293 typedef long gpgme_off_t;
294 typedef long gpgme_ssize_t;
296 API__OFF_T="gpgme_off_t"
297 API__SSIZE_T="gpgme_ssize_t"
299 INSERT__TYPEDEFS_FOR_GPGME_H="
300 #include <sys/types.h>
301 typedef off_t gpgme_off_t;
302 typedef ssize_t gpgme_ssize_t;"
304 API__SSIZE_T="ssize_t"
306 AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
307 AM_SUBST_NOTMAKE(INSERT__TYPEDEFS_FOR_GPGME_H)
309 AM_SUBST_NOTMAKE(API__OFF_T)
310 AC_SUBST(API__SSIZE_T)
311 AM_SUBST_NOTMAKE(API__SSIZE_T)
313 # Checks for compiler features.
314 if test "$GCC" = yes; then
315 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
316 if test "$have_w32_system" = yes; then
317 CFLAGS="$CFLAGS -mms-bitfields"
321 # Only used for debugging, so no serious test needed (for actual
322 # functionality you have to test libc as well, this only tests the
324 AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
325 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([__thread int foo;])],
326 gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
327 if test "$gpgme_cv_tls_works" = yes; then
328 AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
332 # Checks for library functions.
333 AC_MSG_NOTICE([checking for libraries])
337 AC_REPLACE_FUNCS(vasprintf)
338 if test "$ac_cv_func_vasprintf" != yes; then
342 # Try to find a thread-safe version of ttyname().
343 gnupg_REPLACE_TTYNAME_R
344 if test "$ac_cv_func_ttyname_r" != yes; then
347 *** ttyname() is not thread-safe and ttyname_r() does not exist
351 # Try to find a thread-safe version of getenv().
352 have_thread_safe_getenv=no
354 if test $GLIBC21 = yes; then
355 have_thread_safe_getenv=yes
357 if test $have_thread_safe_getenv = yes; then
358 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
361 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
362 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
365 *** getenv() is not thread-safe and getenv_r() does not exist
369 # For converting time strings to seconds since Epoch, we need the timegm
371 AC_CHECK_FUNCS(timegm)
372 if test "$ac_cv_func_timegm" != yes; then
375 *** timegm() not available - a non-thread-safe kludge will be used
376 *** and the TZ variable might be changed at runtime.
380 AC_CHECK_FUNCS(setlocale)
382 # Checking for libgpg-error.
384 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
385 have_gpg_error=yes, have_gpg_error=no)
386 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
387 [The default error source for GPGME.])
391 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
392 have_libassuan=yes, have_libassuan=no)
393 if test "$have_libassuan" = "yes"; then
394 AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
395 [version of the libassuan library])
397 AM_CONDITIONAL(HAVE_ASSUAN, test "$have_libassuan" = "yes")
398 if test "$have_libassuan" = "yes"; then
399 AC_DEFINE(ENABLE_ASSUAN,1,[Whether Assuan support is enabled])
402 # Checks for system services
403 NEED_GPG_VERSION_DEFAULT=1.4.0
404 NEED_GPGSM_VERSION_DEFAULT=1.9.6
405 NEED_GPGCONF_VERSION_DEFAULT=2.0.4
406 NEED_G13_VERSION_DEFAULT=2.1.0
407 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
408 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
409 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
410 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
411 AC_ARG_WITH(gpg-version,
412 AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
413 NEED_GPG_VERSION=$withval)
414 if test "$NEED_GPG_VERSION" = "yes"; then
415 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
417 if test "$NEED_GPG_VERSION" = "no"; then
418 NEED_GPG_VERSION=0.0.0
420 AC_ARG_WITH(gpgsm-version,
421 AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
422 NEED_GPGSM_VERSION=$withval)
423 if test "$NEED_GPGSM_VERSION" = "yes"; then
424 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
426 if test "$NEED_GPGSM_VERSION" = "no"; then
427 NEED_GPGSM_VERSION=0.0.0
429 AC_ARG_WITH(gpgconf-version,
430 AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
431 NEED_GPGCONF_VERSION=$withval)
432 if test "$NEED_GPGCONF_VERSION" = "yes"; then
433 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
435 if test "$NEED_GPGCONF_VERSION" = "no"; then
436 NEED_GPGCONF_VERSION=0.0.0
438 AC_ARG_WITH(g13-version,
439 AC_HELP_STRING([--with-g13-version=VER], [require G13 version VER]),
440 NEED_G13_VERSION=$withval)
441 if test "$NEED_G13_VERSION" = "yes"; then
442 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
444 if test "$NEED_G13_VERSION" = "no"; then
445 NEED_G13_VERSION=0.0.0
448 AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
449 [Min. needed GPGCONF version.])
450 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
451 [Min. needed GnuPG version.])
452 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
453 [Min. needed GPGSM version.])
454 AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
455 [Min. needed G13 version.])
460 gpgconf_usable_for_test=no
463 AC_HELP_STRING([--with-gpgconf=PATH],
464 [use gpgconf binary at PATH]),
465 GPGCONF=$withval, NO_OVERRIDE=yes)
466 if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
469 if test "$cross_compiling" != "yes"; then
470 AC_PATH_PROG(GPGCONF, gpgconf)
472 if test -z "$GPGCONF"; then
473 GPGCONF="$GPGCONF_DEFAULT"
476 if test "$GPGCONF" = no; then
477 if test "$NO_OVERRIDE" = "yes"; then
478 if test "$cross_compiling" != "yes"; then
481 *** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
486 *** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
491 AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
492 AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
494 AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
496 dnl Check for GPGCONF version requirement.
497 GPGCONF_VERSION=unknown
499 if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
502 if test "$cross_compiling" = "yes"; then
503 AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
506 if test ! -x "$GPGCONF"; then
507 AC_MSG_WARN([GPGCONF not executable, version check disabled])
512 if test "$ok" = "maybe"; then
513 AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
514 req_major=`echo $NEED_GPGCONF_VERSION | \
515 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
516 req_minor=`echo $NEED_GPGCONF_VERSION | \
517 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
518 req_micro=`echo $NEED_GPGCONF_VERSION | \
519 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
520 GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
521 major=`echo $GPGCONF_VERSION | \
522 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
523 minor=`echo $GPGCONF_VERSION | \
524 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
525 micro=`echo $GPGCONF_VERSION | \
526 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
528 if test "$major" -gt "$req_major"; then
531 if test "$major" -eq "$req_major"; then
532 if test "$minor" -gt "$req_minor"; then
535 if test "$minor" -eq "$req_minor"; then
536 if test "$micro" -ge "$req_micro"; then
543 if test "$ok" = "yes"; then
545 if test "$cross_compiling" != "yes"; then
546 gpgconf_usable_for_test=yes
550 AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
553 run_gpgconf_test="$ok"
554 AC_ARG_ENABLE(gpgconf-test,
555 AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
556 run_gpgconf_test=$enableval)
557 AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
565 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
566 GPG=$withval, NO_OVERRIDE=yes)
567 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
570 if test "$cross_compiling" != "yes"; then
571 if test "$gpgconf_usable_for_test" = "yes"; then
572 GPG="`$GPGCONF --list-components | grep ^gpg: | cut -d: -f 3`"
574 AC_PATH_PROG(GPG, gpg)
577 if test -z "$GPG"; then
581 if test "$GPG" = no; then
582 if test "$NO_OVERRIDE" = "yes"; then
583 if test "$cross_compiling" != "yes"; then
586 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
591 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
596 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
599 dnl Check for GnuPG version requirement.
602 if test -z "$GPG" -o "x$GPG" = "xno"; then
605 if test "$cross_compiling" = "yes"; then
606 AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
609 if test ! -x "$GPG"; then
610 AC_MSG_WARN([GnuPG not executable, version check disabled])
615 if test "$ok" = "maybe"; then
616 AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
617 req_major=`echo $NEED_GPG_VERSION | \
618 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
619 req_minor=`echo $NEED_GPG_VERSION | \
620 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
621 req_micro=`echo $NEED_GPG_VERSION | \
622 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
623 GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
624 major=`echo $GPG_VERSION | \
625 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
626 minor=`echo $GPG_VERSION | \
627 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
628 micro=`echo $GPG_VERSION | \
629 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
631 if test "$major" -gt "$req_major"; then
634 if test "$major" -eq "$req_major"; then
635 if test "$minor" -gt "$req_minor"; then
638 if test "$minor" -eq "$req_minor"; then
639 if test "$micro" -ge "$req_micro"; then
646 if test "$ok" = "yes"; then
650 AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
654 AC_ARG_ENABLE(gpg-test,
655 AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
656 run_gpg_test=$enableval)
657 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
666 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
667 GPGSM=$withval, NO_OVERRIDE=yes)
668 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
671 if test "$cross_compiling" != "yes"; then
672 if test "$gpgconf_usable_for_test" = "yes"; then
673 GPGSM="`$GPGCONF --list-components | grep ^gpgsm: | cut -d: -f 3`"
675 AC_PATH_PROG(GPGSM, gpgsm)
678 if test -z "$GPGSM"; then
679 GPGSM="$GPGSM_DEFAULT"
682 if test "$GPGSM" = no; then
683 if test "$NO_OVERRIDE" = "yes"; then
684 if test "$cross_compiling" != "yes"; then
687 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
692 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
697 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
698 AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
700 AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
703 dnl Check for GPGSM version requirement.
704 GPGSM_VERSION=unknown
706 if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
709 if test "$cross_compiling" = "yes"; then
710 AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
713 if test ! -x "$GPGSM"; then
714 AC_MSG_WARN([GPGSM not executable, version check disabled])
719 if test "$ok" = "maybe"; then
720 AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
721 req_major=`echo $NEED_GPGSM_VERSION | \
722 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
723 req_minor=`echo $NEED_GPGSM_VERSION | \
724 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
725 req_micro=`echo $NEED_GPGSM_VERSION | \
726 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
727 GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
728 major=`echo $GPGSM_VERSION | \
729 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
730 minor=`echo $GPGSM_VERSION | \
731 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
732 micro=`echo $GPGSM_VERSION | \
733 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
735 if test "$major" -gt "$req_major"; then
738 if test "$major" -eq "$req_major"; then
739 if test "$minor" -gt "$req_minor"; then
742 if test "$minor" -eq "$req_minor"; then
743 if test "$micro" -ge "$req_micro"; then
750 if test "$ok" = "yes"; then
754 AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
758 AC_ARG_ENABLE(gpgsm-test,
759 AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
760 run_gpgsm_test=$enableval)
761 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
769 AC_HELP_STRING([--with-g13=PATH],
770 [use g13 binary at PATH]),
771 G13=$withval, NO_OVERRIDE=yes)
772 if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
775 if test "$cross_compiling" != "yes"; then
776 if test "$gpgconf_usable_for_test" = "yes"; then
777 G13="`$GPGCONF --list-components | grep ^g13: | cut -d: -f 3`"
778 if test -z "$G13"; then
779 # Use a hack if gpgconf has no support for g13.
780 G13="`$GPGCONF --list-dirs | grep ^bindir: | cut -d: -f 2`/g13"
783 AC_PATH_PROG(G13, g13)
786 if test -z "$G13"; then
790 if test "$G13" = no; then
791 if test "$NO_OVERRIDE" = "yes"; then
792 if test "$cross_compiling" != "yes"; then
795 *** Could not find g13, install g13 or use --with-g13=PATH to enable it
800 *** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
805 AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
806 AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
808 AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
810 dnl Check for G13 version requirement.
813 if test -z "$G13" -o "x$G13" = "xno"; then
816 if test "$cross_compiling" = "yes"; then
817 AC_MSG_WARN([G13 version can not be checked when cross compiling])
820 if test ! -x "$G13"; then
821 AC_MSG_WARN([G13 not executable, version check disabled])
826 if test "$ok" = "maybe"; then
827 AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
828 req_major=`echo $NEED_G13_VERSION | \
829 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
830 req_minor=`echo $NEED_G13_VERSION | \
831 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
832 req_micro=`echo $NEED_G13_VERSION | \
833 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
834 G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
835 major=`echo $G13_VERSION | \
836 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
837 minor=`echo $G13_VERSION | \
838 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
839 micro=`echo $G13_VERSION | \
840 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
842 if test "$major" -gt "$req_major"; then
845 if test "$major" -eq "$req_major"; then
846 if test "$minor" -gt "$req_minor"; then
849 if test "$minor" -eq "$req_minor"; then
850 if test "$micro" -ge "$req_micro"; then
857 if test "$ok" = "yes"; then
861 AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
865 AC_ARG_ENABLE(g13-test,
866 AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
867 run_g13_test=$enableval)
868 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
876 AC_CHECK_FUNCS(funopen)
877 if test $ac_cv_func_funopen != yes; then
878 # No funopen but we can implement that in terms of fopencookie.
879 AC_CHECK_FUNCS(fopencookie)
880 if test $ac_cv_func_fopencookie = yes; then
881 AC_REPLACE_FUNCS(funopen)
885 *** No implementation of fopencookie or funopen available
890 # Check for getgid etc
891 AC_CHECK_FUNCS(getgid getegid)
894 # Replacement functions.
895 AC_REPLACE_FUNCS(stpcpy)
896 AC_REPLACE_FUNCS(setenv)
898 # Assuan check for descriptor passing.
899 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
900 [supports_descriptor_passing=yes],
901 [supports_descriptor_passing=no
904 *** Data structure for sending ancillary data missing.
905 *** Descriptor passing won't work.
910 #include <sys/types.h>
911 #include <sys/socket.h>
920 dnl There seems to be a problem with Apple and decriptor passing.
921 dnl Until we found a solution we change the default to no.
925 use_descriptor_passing=no
928 use_descriptor_passing=yes
931 AC_ARG_ENABLE(fd-passing,
932 AC_HELP_STRING([--disable-fd-passing], [do not use FD passing]),
933 use_descriptor_passing=$enableval)
935 if test "$supports_descriptor_passing" != "yes"; then
936 use_descriptor_passing=no
939 if test "$use_descriptor_passing" = "yes"; then
940 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
941 [Defined if descriptor passing is enabled and supported])
944 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
948 if test "$use_descriptor_passing" = "yes" && test "$have_libassuan" = "yes"; then
951 if test "$uiserver" != "no"; then
952 AC_DEFINE(ENABLE_UISERVER, 1,
953 [Defined if we are building with uiserver support.])
955 AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
958 # Add a few constants to help porting to W32
959 AH_VERBATIM([SEPCONSTANTS],
961 /* Separators as used in $PATH and file name. */
962 #ifdef HAVE_DOSISH_SYSTEM
963 #define PATHSEP_C ';'
964 #define DIRSEP_C '\\'
965 #define DIRSEP_S "\\"
967 #define PATHSEP_C ':'
974 /* Definition of GCC specific attributes. */
976 # define GPGME_GCC_A_PURE __attribute__ ((__pure__))
978 # define GPGME_GCC_A_PURE
981 /* Under WindowsCE we need gpg-error's strerror macro. */
982 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
984 #define CRIGHTBLURB "Copyright (C) 2000 Werner Koch\n" \
985 "Copyright (C) 2001--2013 g10 Code GmbH\n"
989 # Substitution used for gpgme-config
990 GPGME_CONFIG_LIBS="-lgpgme"
991 GPGME_CONFIG_CFLAGS=""
992 GPGME_CONFIG_HOST="$host"
993 AC_SUBST(GPGME_CONFIG_API_VERSION)
994 AC_SUBST(GPGME_CONFIG_LIBS)
995 AC_SUBST(GPGME_CONFIG_CFLAGS)
996 AC_SUBST(GPGME_CONFIG_HOST)
999 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
1000 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
1003 # Some checks for gpgme-tool
1004 # Done at top: AC_CHECK_HEADER([argp.h])
1005 AC_CHECK_TYPES([error_t], [],
1006 [AC_DEFINE([error_t], [int],
1007 [Define to a type to use for `error_t' if it is not otherwise available.])],
1008 [#include <errno.h>])
1011 # A substitution to set generated files in a Emacs buffer to read-only.
1012 AC_SUBST(emacs_local_vars_begin, [['Local][ ][Variables:']])
1013 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
1014 AC_SUBST(emacs_local_vars_end, ['End:'])
1019 if test "$have_gpg_error" = "no"; then
1023 *** You need libgpg-error to build this program.
1024 ** This library is for example available at
1025 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
1026 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
1029 if test "$have_libassuan" = "no"; then
1033 *** You need libassuan to build this program with GPGSM support.
1034 *** This library is for example available at
1035 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
1036 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
1040 if test "$die" = "yes"; then
1043 *** Required libraries not found. Please consult the above messages
1044 *** and install them before running configure again.
1050 # Create config files
1052 AC_CONFIG_FILES(Makefile src/Makefile
1055 tests/gpgsm/Makefile
1056 tests/opassuan/Makefile
1060 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
1061 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
1065 GPGME v${VERSION} has been configured as follows:
1067 Revision: mym4_revision (mym4_revision_dec)
1070 Gpgconf at: $GPGCONF
1071 Gpgconf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
1073 GPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
1075 Gpgsm version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
1077 G13 version: $G13_VERSION, min. $NEED_G13_VERSION
1079 Assuan version: $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
1081 UI Server: $uiserver
1082 FD Passing: $use_descriptor_passing
1083 GPGME Pthread: $have_pthread