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, [0])
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=20
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)
84 # Enable GNU extensions on systems that have them.
87 AH_VERBATIM([_REENTRANT],
88 [/* To allow the use of GPGME in multithreaded programs we have to use
89 special features from the library.
90 IMPORTANT: gpgme is not yet fully reentrant and you should use it
91 only from one thread. */
99 # Note: A suitable gitlog-to-changelog script can be found in GnuPG master.
100 AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog, [gitlog-to-changelog])
102 AC_SUBST(LIBGPGME_LT_CURRENT)
103 AC_SUBST(LIBGPGME_LT_AGE)
104 AC_SUBST(LIBGPGME_LT_REVISION)
108 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
109 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
110 VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \
111 mym4_version_minor mym4_version_micro)
112 AC_SUBST(VERSION_NUMBER)
114 # Don't default to build static libs.
116 LT_INIT([win32-dll disable-static])
117 LT_LANG([Windows Resource])
119 # For now we hardcode the use of version scripts. It would be better
120 # to write a test for this or even implement this within libtool.
121 have_ld_version_script=no
124 have_ld_version_script=yes
127 have_ld_version_script=yes
130 AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
134 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
140 component_system=None
141 have_dosish_system=no
142 have_android_system=no
152 have_w32ce_system=yes
155 have_android_system=yes
159 *-mingw32ce*|*-mingw32*)
160 have_dosish_system=yes
162 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
163 GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
164 GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
165 G13_DEFAULT='c:\\gnupg\\g13.exe'
166 #component_system='COM+'
169 AC_ARG_ENABLE(w32-glib,
170 AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
171 build_w32_glib=$enableval)
173 # Check disabled, because the qt-dev packages in gpg4win do
174 # not provide any support for cross compilation.
175 # PKG_CHECK_MODULES(QT4_CORE, QtCore)
178 # ./configure --enable-w32-qt QT4_CORE_CFLAGS="..." QT4_CORE_LIBS="..."
179 AC_SUBST(QT4_CORE_CFLAGS)
180 AC_SUBST(QT4_CORE_LIBS)
181 AC_ARG_ENABLE(w32-qt,
182 AC_HELP_STRING([--enable-w32-qt], [build GPGME Qt for W32]),
183 build_w32_qt=$enableval)
186 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
187 if test "$have_pthread" = yes; then
188 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
191 # XXX: Probably use exec-prefix here?
192 # GPG_DEFAULT='/usr/bin/gpg'
193 # GPGSM_DEFAULT='/usr/bin/gpgsm'
194 # GPGCONF_DEFAULT='/usr/bin/gpgconf'
195 # G13_DEFAULT='/usr/bin/g13'
199 if test "$have_dosish_system" = yes; then
200 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
201 [Defined if we run on some of the PCDOS like systems
202 (DOS, Windoze. OS/2) with special properties like
205 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
207 if test "$have_w32_system" = yes; then
208 AC_DEFINE(HAVE_W32_SYSTEM,1,
209 [Defined if we run on any kind of W32 API based system])
211 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
213 if test "$have_w64_system" = yes; then
214 AC_DEFINE(HAVE_W64_SYSTEM,1,
215 [Defined if we run on a 64 bit W32 API based system])
217 AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
219 if test "$have_w32ce_system" = yes; then
220 AC_DEFINE(HAVE_W32CE_SYSTEM,1,
221 [Defined if we run on a W32 CE API based system])
223 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
225 if test "$have_android_system" = yes; then
226 AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
228 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
230 AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
231 AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes)
233 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
237 # Provide information about the build.
239 BUILD_REVISION="mym4_revision"
240 AC_SUBST(BUILD_REVISION)
241 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
242 [GIT commit id revision used to build this package])
245 BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
247 BUILD_FILEVERSION="${BUILD_FILEVERSION}mym4_revision_dec"
248 AC_SUBST(BUILD_FILEVERSION)
250 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
251 AC_SUBST(BUILD_TIMESTAMP)
252 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
253 [The time this package was configured for a build])
258 # Checks for header files.
259 AC_CHECK_HEADERS_ONCE([locale.h sys/select.h sys/uio.h argp.h
260 unistd.h sys/time.h sys/types.h sys/stat.h])
265 AC_CHECK_SIZEOF(unsigned int)
270 # A simple compile time check in gpgme.h for GNU/Linux systems that
271 # prevents a file offset bits mismatch between gpgme and the application.
272 NEED__FILE_OFFSET_BITS=0
273 case "$ac_cv_sys_file_offset_bits" in
274 "" | no | unknown) ;;
276 NEED__FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
279 AC_SUBST(NEED__FILE_OFFSET_BITS)
281 # Figure out platform dependent typedefs for gpgme.h
282 if test "$have_w32_system" = yes; then
283 if test "$have_w64_system" = yes; then
284 INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 64 bit W32 API. */
287 typedef __int64 ssize_t;"
289 INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 32 bit W32 API. */
290 #ifndef _OFF_T_DEFINED /* Defined by newer mingw32 toolkits. */
293 #ifndef _SSIZE_T_DEFINED /* Defined by newer mingw32 toolkits. */
294 typedef long ssize_t;
298 INSERT__TYPEDEFS_FOR_GPGME_H="#include <sys/types.h>"
300 AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
301 AM_SUBST_NOTMAKE(INSERT__TYPEDEFS_FOR_GPGME_H)
303 # Checks for compiler features.
304 if test "$GCC" = yes; then
305 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
306 if test "$have_w32_system" = yes; then
307 CFLAGS="$CFLAGS -mms-bitfields"
311 # Only used for debugging, so no serious test needed (for actual
312 # functionality you have to test libc as well, this only tests the
314 AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
315 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([__thread int foo;])],
316 gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
317 if test "$gpgme_cv_tls_works" = yes; then
318 AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
322 # Checks for library functions.
323 AC_MSG_NOTICE([checking for libraries])
327 AC_REPLACE_FUNCS(vasprintf)
328 if test "$ac_cv_func_vasprintf" != yes; then
332 # Try to find a thread-safe version of ttyname().
333 gnupg_REPLACE_TTYNAME_R
334 if test "$ac_cv_func_ttyname_r" != yes; then
337 *** ttyname() is not thread-safe and ttyname_r() does not exist
341 # Try to find a thread-safe version of getenv().
342 have_thread_safe_getenv=no
344 if test $GLIBC21 = yes; then
345 have_thread_safe_getenv=yes
347 if test $have_thread_safe_getenv = yes; then
348 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
351 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
352 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
355 *** getenv() is not thread-safe and getenv_r() does not exist
359 # For converting time strings to seconds since Epoch, we need the timegm
361 AC_CHECK_FUNCS(timegm)
362 if test "$ac_cv_func_timegm" != yes; then
365 *** timegm() not available - a non-thread-safe kludge will be used
366 *** and the TZ variable might be changed at runtime.
370 AC_CHECK_FUNCS(setlocale)
372 # Checking for libgpg-error.
374 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
375 have_gpg_error=yes, have_gpg_error=no)
376 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
377 [The default error source for GPGME.])
381 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
382 have_libassuan=yes, have_libassuan=no)
383 if test "$have_libassuan" = "yes"; then
384 AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
385 [version of the libassuan library])
387 AM_CONDITIONAL(HAVE_ASSUAN, test "$have_libassuan" = "yes")
388 if test "$have_libassuan" = "yes"; then
389 AC_DEFINE(ENABLE_ASSUAN,1,[Whether Assuan support is enabled])
392 # Checks for system services
393 NEED_GPG_VERSION_DEFAULT=1.4.0
394 NEED_GPGSM_VERSION_DEFAULT=1.9.6
395 NEED_GPGCONF_VERSION_DEFAULT=2.0.4
396 NEED_G13_VERSION_DEFAULT=2.1.0
397 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
398 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
399 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
400 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
401 AC_ARG_WITH(gpg-version,
402 AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
403 NEED_GPG_VERSION=$withval)
404 if test "$NEED_GPG_VERSION" = "yes"; then
405 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
407 if test "$NEED_GPG_VERSION" = "no"; then
408 NEED_GPG_VERSION=0.0.0
410 AC_ARG_WITH(gpgsm-version,
411 AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
412 NEED_GPGSM_VERSION=$withval)
413 if test "$NEED_GPGSM_VERSION" = "yes"; then
414 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
416 if test "$NEED_GPGSM_VERSION" = "no"; then
417 NEED_GPGSM_VERSION=0.0.0
419 AC_ARG_WITH(gpgconf-version,
420 AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
421 NEED_GPGCONF_VERSION=$withval)
422 if test "$NEED_GPGCONF_VERSION" = "yes"; then
423 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
425 if test "$NEED_GPGCONF_VERSION" = "no"; then
426 NEED_GPGCONF_VERSION=0.0.0
428 AC_ARG_WITH(g13-version,
429 AC_HELP_STRING([--with-g13-version=VER], [require G13 version VER]),
430 NEED_G13_VERSION=$withval)
431 if test "$NEED_G13_VERSION" = "yes"; then
432 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
434 if test "$NEED_G13_VERSION" = "no"; then
435 NEED_G13_VERSION=0.0.0
438 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
439 [Min. needed GnuPG version.])
440 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
441 [Min. needed GPGSM version.])
442 AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
443 [Min. needed GPGCONF version.])
444 AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
445 [Min. needed G13 version.])
450 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
451 GPG=$withval, NO_OVERRIDE=yes)
452 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
455 if test "$cross_compiling" != "yes"; then
456 AC_PATH_PROG(GPG, gpg)
458 if test -z "$GPG"; then
462 if test "$GPG" = no; then
463 if test "$NO_OVERRIDE" = "yes"; then
464 if test "$cross_compiling" != "yes"; then
467 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
472 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
477 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
480 dnl Check for GnuPG version requirement.
483 if test -z "$GPG" -o "x$GPG" = "xno"; then
486 if test "$cross_compiling" = "yes"; then
487 AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
490 if test ! -x "$GPG"; then
491 AC_MSG_WARN([GnuPG not executable, version check disabled])
496 if test "$ok" = "maybe"; then
497 AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
498 req_major=`echo $NEED_GPG_VERSION | \
499 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
500 req_minor=`echo $NEED_GPG_VERSION | \
501 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
502 req_micro=`echo $NEED_GPG_VERSION | \
503 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
504 GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
505 major=`echo $GPG_VERSION | \
506 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
507 minor=`echo $GPG_VERSION | \
508 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
509 micro=`echo $GPG_VERSION | \
510 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
512 if test "$major" -gt "$req_major"; then
515 if test "$major" -eq "$req_major"; then
516 if test "$minor" -gt "$req_minor"; then
519 if test "$minor" -eq "$req_minor"; then
520 if test "$micro" -ge "$req_micro"; then
527 if test "$ok" = "yes"; then
531 AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
535 AC_ARG_ENABLE(gpg-test,
536 AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
537 run_gpg_test=$enableval)
538 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
543 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
544 GPGSM=$withval, NO_OVERRIDE=yes)
545 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
548 if test "$cross_compiling" != "yes"; then
549 AC_PATH_PROG(GPGSM, gpgsm)
551 if test -z "$GPGSM"; then
552 GPGSM="$GPGSM_DEFAULT"
555 if test "$GPGSM" = no; then
556 if test "$NO_OVERRIDE" = "yes"; then
557 if test "$cross_compiling" != "yes"; then
560 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
565 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
570 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
571 AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
573 AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
576 dnl Check for GPGSM version requirement.
577 GPGSM_VERSION=unknown
579 if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
582 if test "$cross_compiling" = "yes"; then
583 AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
586 if test ! -x "$GPGSM"; then
587 AC_MSG_WARN([GPGSM not executable, version check disabled])
592 if test "$ok" = "maybe"; then
593 AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
594 req_major=`echo $NEED_GPGSM_VERSION | \
595 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
596 req_minor=`echo $NEED_GPGSM_VERSION | \
597 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
598 req_micro=`echo $NEED_GPGSM_VERSION | \
599 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
600 GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
601 major=`echo $GPGSM_VERSION | \
602 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
603 minor=`echo $GPGSM_VERSION | \
604 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
605 micro=`echo $GPGSM_VERSION | \
606 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
608 if test "$major" -gt "$req_major"; then
611 if test "$major" -eq "$req_major"; then
612 if test "$minor" -gt "$req_minor"; then
615 if test "$minor" -eq "$req_minor"; then
616 if test "$micro" -ge "$req_micro"; then
623 if test "$ok" = "yes"; then
627 AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
631 AC_ARG_ENABLE(gpgsm-test,
632 AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
633 run_gpgsm_test=$enableval)
634 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
639 AC_HELP_STRING([--with-gpgconf=PATH],
640 [use gpgconf binary at PATH]),
641 GPGCONF=$withval, NO_OVERRIDE=yes)
642 if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
645 if test "$cross_compiling" != "yes"; then
646 AC_PATH_PROG(GPGCONF, gpgconf)
648 if test -z "$GPGCONF"; then
649 GPGCONF="$GPGCONF_DEFAULT"
652 if test "$GPGCONF" = no; then
653 if test "$NO_OVERRIDE" = "yes"; then
654 if test "$cross_compiling" != "yes"; then
657 *** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
662 *** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
667 AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
668 AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
670 AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
672 dnl Check for GPGCONF version requirement.
673 GPGCONF_VERSION=unknown
675 if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
678 if test "$cross_compiling" = "yes"; then
679 AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
682 if test ! -x "$GPGCONF"; then
683 AC_MSG_WARN([GPGCONF not executable, version check disabled])
688 if test "$ok" = "maybe"; then
689 AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
690 req_major=`echo $NEED_GPGCONF_VERSION | \
691 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
692 req_minor=`echo $NEED_GPGCONF_VERSION | \
693 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
694 req_micro=`echo $NEED_GPGCONF_VERSION | \
695 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
696 GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
697 major=`echo $GPGCONF_VERSION | \
698 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
699 minor=`echo $GPGCONF_VERSION | \
700 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
701 micro=`echo $GPGCONF_VERSION | \
702 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
704 if test "$major" -gt "$req_major"; then
707 if test "$major" -eq "$req_major"; then
708 if test "$minor" -gt "$req_minor"; then
711 if test "$minor" -eq "$req_minor"; then
712 if test "$micro" -ge "$req_micro"; then
719 if test "$ok" = "yes"; then
723 AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
726 run_gpgconf_test="$ok"
727 AC_ARG_ENABLE(gpgconf-test,
728 AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
729 run_gpgconf_test=$enableval)
730 AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
735 AC_HELP_STRING([--with-g13=PATH],
736 [use g13 binary at PATH]),
737 G13=$withval, NO_OVERRIDE=yes)
738 if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
741 if test "$cross_compiling" != "yes"; then
742 AC_PATH_PROG(G13, g13)
744 if test -z "$G13"; then
748 if test "$G13" = no; then
749 if test "$NO_OVERRIDE" = "yes"; then
750 if test "$cross_compiling" != "yes"; then
753 *** Could not find g13, install g13 or use --with-g13=PATH to enable it
758 *** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
763 AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
764 AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
766 AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
768 dnl Check for G13 version requirement.
771 if test -z "$G13" -o "x$G13" = "xno"; then
774 if test "$cross_compiling" = "yes"; then
775 AC_MSG_WARN([G13 version can not be checked when cross compiling])
778 if test ! -x "$G13"; then
779 AC_MSG_WARN([G13 not executable, version check disabled])
784 if test "$ok" = "maybe"; then
785 AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
786 req_major=`echo $NEED_G13_VERSION | \
787 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
788 req_minor=`echo $NEED_G13_VERSION | \
789 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
790 req_micro=`echo $NEED_G13_VERSION | \
791 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
792 G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
793 major=`echo $G13_VERSION | \
794 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
795 minor=`echo $G13_VERSION | \
796 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
797 micro=`echo $G13_VERSION | \
798 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
800 if test "$major" -gt "$req_major"; then
803 if test "$major" -eq "$req_major"; then
804 if test "$minor" -gt "$req_minor"; then
807 if test "$minor" -eq "$req_minor"; then
808 if test "$micro" -ge "$req_micro"; then
815 if test "$ok" = "yes"; then
819 AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
823 AC_ARG_ENABLE(g13-test,
824 AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
825 run_g13_test=$enableval)
826 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
830 AC_CHECK_FUNCS(funopen)
831 if test $ac_cv_func_funopen != yes; then
832 # No funopen but we can implement that in terms of fopencookie.
833 AC_CHECK_FUNCS(fopencookie)
834 if test $ac_cv_func_fopencookie = yes; then
835 AC_REPLACE_FUNCS(funopen)
839 *** No implementation of fopencookie or funopen available
844 # Check for getgid etc
845 AC_CHECK_FUNCS(getgid getegid)
848 # Replacement functions.
849 AC_REPLACE_FUNCS(stpcpy)
850 AC_REPLACE_FUNCS(setenv)
852 # Assuan check for descriptor passing.
853 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
854 [supports_descriptor_passing=yes],
855 [supports_descriptor_passing=no
858 *** Data structure for sending ancillary data missing.
859 *** Descriptor passing won't work.
864 #include <sys/types.h>
865 #include <sys/socket.h>
873 use_descriptor_passing=yes
874 AC_ARG_ENABLE(fd-passing,
875 AC_HELP_STRING([--disable-fd-passing], [do not use FD passing]),
876 use_descriptor_passing=$enableval)
878 if test "$supports_descriptor_passing" != "yes"; then
879 use_descriptor_passing=no
882 if test "$use_descriptor_passing" = "yes"; then
883 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
884 [Defined if descriptor passing is enabled and supported])
887 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
891 if test "$use_descriptor_passing" = "yes" && test "$have_libassuan" = "yes"; then
894 if test "$uiserver" != "no"; then
895 AC_DEFINE(ENABLE_UISERVER, 1,
896 [Defined if we are building with uiserver support.])
898 AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
901 # Add a few constants to help porting to W32
902 AH_VERBATIM([SEPCONSTANTS],
904 /* Separators as used in $PATH. */
905 #ifdef HAVE_DOSISH_SYSTEM
906 #define PATHSEP_C ';'
908 #define PATHSEP_C ':'
913 /* Definition of GCC specific attributes. */
915 # define GPGME_GCC_A_PURE __attribute__ ((__pure__))
917 # define GPGME_GCC_A_PURE
920 /* Under WindowsCE we need gpg-error's strerror macro. */
921 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
923 #define CRIGHTBLURB "Copyright (C) 2000 Werner Koch\n" \
924 "Copyright (C) 2001--2013 g10 Code GmbH\n"
928 # Substitution used for gpgme-config
929 GPGME_CONFIG_LIBS="-lgpgme"
930 GPGME_CONFIG_CFLAGS=""
931 GPGME_CONFIG_HOST="$host"
932 AC_SUBST(GPGME_CONFIG_API_VERSION)
933 AC_SUBST(GPGME_CONFIG_LIBS)
934 AC_SUBST(GPGME_CONFIG_CFLAGS)
935 AC_SUBST(GPGME_CONFIG_HOST)
938 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
939 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
942 # Some checks for gpgme-tool
943 # Done at top: AC_CHECK_HEADER([argp.h])
944 AC_CHECK_TYPES([error_t], [],
945 [AC_DEFINE([error_t], [int],
946 [Define to a type to use for `error_t' if it is not otherwise available.])],
947 [#include <errno.h>])
950 # A substitution to set generated files in a Emacs buffer to read-only.
951 AC_SUBST(emacs_local_vars_begin, [['Local][ ][Variables:']])
952 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
953 AC_SUBST(emacs_local_vars_end, ['End:'])
958 if test "$have_gpg_error" = "no"; then
962 *** You need libgpg-error to build this program.
963 ** This library is for example available at
964 *** ftp://ftp.gnupg.org/gcrypt/libgpg-error
965 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
968 if test "$have_libassuan" = "no"; then
972 *** You need libassuan to build this program with GPGSM support.
973 *** This library is for example available at
974 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
975 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
979 if test "$die" = "yes"; then
982 *** Required libraries not found. Please consult the above messages
983 *** and install them before running configure again.
989 # Create config files
991 AC_CONFIG_FILES(Makefile src/Makefile
995 tests/opassuan/Makefile
999 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
1000 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
1004 GPGME v${VERSION} has been configured as follows:
1006 Revision: mym4_revision (mym4_revision_dec)
1010 GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
1012 GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
1013 GpgConf path: $GPGCONF
1014 GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
1016 G13 version: $G13_VERSION, min. $NEED_G13_VERSION
1018 Assuan version: $libassuan_config_version, min. $NEED_LIBASSUAN_VERSION
1020 UI Server: $uiserver
1021 FD Passing: $use_descriptor_passing
1022 GPGME Pthread: $have_pthread