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 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.11"
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.
29 # Never do a binary build with the same version number
30 # in another year; this would mess up the build number.
32 # The SVN version is usually the next intended release version with
33 # the string "-svnNNN" appended. The reason for this is that tests for a
34 # specific feature can already be done under the assumption that the
35 # SVN version is the most recent one in a branch. To disable the SVN
36 # version for the real release, set the my_issvn macro to no.
37 m4_define(my_version, [1.3.1])
38 m4_define(my_issvn, [yes])
40 m4_define([svn_revision], m4_esyscmd([printf "%d" $( (svn info 2>/dev/null \
41 || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
42 m4_define([git_revision], m4_esyscmd([git branch -v 2>/dev/null \
43 | awk '/^\* / {printf "%s",$3}']))
44 m4_define([my_full_version], [my_version[]m4_if(my_issvn,[yes],
45 [m4_if(git_revision,[],[-svn[]svn_revision],[-git[]git_revision])])])
47 AC_INIT([gpgme],[my_full_version],[http://bugs.gnupg.org])
49 # LT Version numbers, remember to change them just *before* a release.
50 # (Code changed: REVISION++)
51 # (Interfaces added/removed/changed: CURRENT++, REVISION=0)
52 # (Interfaces added: AGE++)
53 # (Interfaces removed/changed: AGE=0)
55 LIBGPGME_LT_CURRENT=19
56 # Subtract 2 from this value if you want to make the LFS transition an
57 # ABI break. [Note to self: Remove this comment with the next regular break.]
59 LIBGPGME_LT_REVISION=0
61 # If the API is changed in an incompatible way: increment the next counter.
62 GPGME_CONFIG_API_VERSION=1
63 ##############################################
66 NEED_LIBASSUAN_VERSION=2.0.2
69 m4_define([git_brevis],m4_esyscmd(printf "%u" 0x[]m4_substr(git_revision,0,4)))
70 BUILD_REVISION=m4_if(git_revision,[],[svn_revision],[git_brevis])
72 VERSION=$PACKAGE_VERSION
74 AC_CONFIG_SRCDIR(src/gpgme.h.in)
75 AM_CONFIG_HEADER(config.h)
76 AC_CONFIG_MACRO_DIR([m4])
77 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
81 # Enable GNU extensions on systems that have them.
84 AH_VERBATIM([_REENTRANT],
85 [/* To allow the use of GPGME in multithreaded programs we have to use
86 special features from the library.
87 IMPORTANT: gpgme is not yet fully reentrant and you should use it
88 only from one thread. */
96 AC_SUBST(LIBGPGME_LT_CURRENT)
97 AC_SUBST(LIBGPGME_LT_AGE)
98 AC_SUBST(LIBGPGME_LT_REVISION)
102 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
103 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
105 # Don't default to build static libs.
107 LT_INIT([win32-dll disable-static])
108 LT_LANG([Windows Resource])
110 # For now we hardcode the use of version scripts. It would be better
111 # to write a test for this or even implement this within libtool.
112 have_ld_version_script=no
115 have_ld_version_script=yes
118 have_ld_version_script=yes
121 AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
125 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
131 component_system=None
132 have_dosish_system=no
142 have_w32ce_system=yes
146 *-mingw32ce*|*-mingw32*)
147 have_dosish_system=yes
149 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
150 GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
151 GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
152 G13_DEFAULT='c:\\gnupg\\g13.exe'
153 #component_system='COM+'
156 AC_ARG_ENABLE(w32-glib,
157 AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
158 build_w32_glib=$enableval)
160 # Check disabled, because the qt-dev packages in gpg4win do
161 # not provide any support for cross compilation.
162 # PKG_CHECK_MODULES(QT4_CORE, QtCore)
165 # ./configure --enable-w32-qt QT4_CORE_CFLAGS="..." QT4_CORE_LIBS="..."
166 AC_SUBST(QT4_CORE_CFLAGS)
167 AC_SUBST(QT4_CORE_LIBS)
168 AC_ARG_ENABLE(w32-qt,
169 AC_HELP_STRING([--enable-w32-qt], [build GPGME Qt for W32]),
170 build_w32_qt=$enableval)
173 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
174 if test "$have_pthread" = yes; then
175 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
178 # XXX: Probably use exec-prefix here?
179 # GPG_DEFAULT='/usr/bin/gpg'
180 # GPGSM_DEFAULT='/usr/bin/gpgsm'
181 # GPGCONF_DEFAULT='/usr/bin/gpgconf'
182 # G13_DEFAULT='/usr/bin/g13'
186 if test "$have_dosish_system" = yes; then
187 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
188 [Defined if we run on some of the PCDOS like systems
189 (DOS, Windoze. OS/2) with special properties like
192 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
194 if test "$have_w32_system" = yes; then
195 AC_DEFINE(HAVE_W32_SYSTEM,1,
196 [Defined if we run on any kind of W32 API based system])
199 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
201 if test "$have_w64_system" = yes; then
202 AC_DEFINE(HAVE_W64_SYSTEM,1,
203 [Defined if we run on a 64 bit W32 API based system])
205 AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
207 if test "$have_w32ce_system" = yes; then
208 AC_DEFINE(HAVE_W32CE_SYSTEM,1,
209 [Defined if we run on a W32 CE API based system])
211 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
213 AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
214 AM_CONDITIONAL(BUILD_W32_QT, test "$build_w32_qt" = yes)
216 AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes")
220 # Checks for header files.
221 AC_CHECK_HEADERS([locale.h])
222 AC_CHECK_HEADERS(sys/select.h)
223 AC_CHECK_HEADERS([sys/uio.h])
228 AC_CHECK_SIZEOF(unsigned int)
233 # A simple compile time check in gpgme.h for GNU/Linux systems that
234 # prevents a file offset bits mismatch between gpgme and the application.
235 NEED__FILE_OFFSET_BITS=0
236 case "$ac_cv_sys_file_offset_bits" in
237 "" | no | unknown) ;;
239 NEED__FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
242 AC_SUBST(NEED__FILE_OFFSET_BITS)
244 # Figure out platform dependent typedefs for gpgme.h
245 if test "$have_w32_system" = yes; then
246 if test "$have_w64_system" = yes; then
247 INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 64 bit W32 API. */
250 typedef __int64 ssize_t;"
252 INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 32 bit W32 API. */
254 typedef long ssize_t;"
257 INSERT__TYPEDEFS_FOR_GPGME_H="#include <sys/types.h>"
259 AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
260 AM_SUBST_NOTMAKE(INSERT__TYPEDEFS_FOR_GPGME_H)
262 # Checks for compiler features.
263 if test "$GCC" = yes; then
264 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
265 if test "$have_w32_system" = yes; then
266 CFLAGS="$CFLAGS -mms-bitfields"
270 # Only used for debugging, so no serious test needed (for actual
271 # functionality you have to test libc as well, this only tests the
273 AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
274 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([__thread int foo;])],
275 gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
276 if test "$gpgme_cv_tls_works" = yes; then
277 AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
281 # Checks for library functions.
284 AC_REPLACE_FUNCS(vasprintf)
285 if test "$ac_cv_func_vasprintf" != yes; then
289 # Try to find a thread-safe version of ttyname().
290 AC_REPLACE_FUNCS(ttyname_r)
291 if test "$ac_cv_func_ttyname_r" != yes; then
294 *** ttyname() is not thread-safe and ttyname_r() does not exist
298 # Try to find a thread-safe version of getenv().
299 have_thread_safe_getenv=no
301 if test $GLIBC21 = yes; then
302 have_thread_safe_getenv=yes
304 if test $have_thread_safe_getenv = yes; then
305 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
308 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
309 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
312 *** getenv() is not thread-safe and getenv_r() does not exist
316 # For converting time strings to seconds since Epoch, we need the timegm
318 AC_CHECK_FUNCS(timegm)
319 if test "$ac_cv_func_timegm" != yes; then
322 *** timegm() not available - a non-thread-safe kludge will be used
323 *** and the TZ variable might be changed at runtime.
327 AC_CHECK_FUNCS(setlocale)
329 # Checking for libgpg-error.
330 AM_PATH_GPG_ERROR(1.8,, AC_MSG_ERROR([libgpg-error was not found]))
331 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
332 [The default error source for GPGME.])
336 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
337 have_libassuan=yes, have_libassuan=no)
338 if test "$have_libassuan" = "yes"; then
339 AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
340 [version of the libassuan library])
342 AM_CONDITIONAL(HAVE_ASSUAN, test "$have_libassuan" = "yes")
343 if test "$have_libassuan" = "yes"; then
344 AC_DEFINE(ENABLE_ASSUAN,1,[Whether Assuan support is enabled])
347 # Checks for system services
348 NEED_GPG_VERSION_DEFAULT=1.4.0
349 NEED_GPGSM_VERSION_DEFAULT=1.9.6
350 NEED_GPGCONF_VERSION_DEFAULT=2.0.4
351 NEED_G13_VERSION_DEFAULT=2.1.0
352 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
353 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
354 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
355 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
356 AC_ARG_WITH(gpg-version,
357 AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
358 NEED_GPG_VERSION=$withval)
359 if test "$NEED_GPG_VERSION" = "yes"; then
360 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
362 if test "$NEED_GPG_VERSION" = "no"; then
363 NEED_GPG_VERSION=0.0.0
365 AC_ARG_WITH(gpgsm-version,
366 AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
367 NEED_GPGSM_VERSION=$withval)
368 if test "$NEED_GPGSM_VERSION" = "yes"; then
369 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
371 if test "$NEED_GPGSM_VERSION" = "no"; then
372 NEED_GPGSM_VERSION=0.0.0
374 AC_ARG_WITH(gpgconf-version,
375 AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
376 NEED_GPGCONF_VERSION=$withval)
377 if test "$NEED_GPGCONF_VERSION" = "yes"; then
378 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
380 if test "$NEED_GPGCONF_VERSION" = "no"; then
381 NEED_GPGCONF_VERSION=0.0.0
383 AC_ARG_WITH(g13-version,
384 AC_HELP_STRING([--with-g13-version=VER], [require G13 version VER]),
385 NEED_G13_VERSION=$withval)
386 if test "$NEED_G13_VERSION" = "yes"; then
387 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
389 if test "$NEED_G13_VERSION" = "no"; then
390 NEED_G13_VERSION=0.0.0
393 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
394 [Min. needed GnuPG version.])
395 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
396 [Min. needed GPGSM version.])
397 AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
398 [Min. needed GPGCONF version.])
399 AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
400 [Min. needed G13 version.])
405 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
406 GPG=$withval, NO_OVERRIDE=yes)
407 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
410 if test "$cross_compiling" != "yes"; then
411 AC_PATH_PROG(GPG, gpg)
413 if test -z "$GPG"; then
417 if test "$GPG" = no; then
418 if test "$NO_OVERRIDE" = "yes"; then
419 if test "$cross_compiling" != "yes"; then
422 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
427 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
432 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
435 dnl Check for GnuPG version requirement.
438 if test -z "$GPG" -o "x$GPG" = "xno"; then
441 if test "$cross_compiling" = "yes"; then
442 AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
445 if test ! -x "$GPG"; then
446 AC_MSG_WARN([GnuPG not executable, version check disabled])
451 if test "$ok" = "maybe"; then
452 AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
453 req_major=`echo $NEED_GPG_VERSION | \
454 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
455 req_minor=`echo $NEED_GPG_VERSION | \
456 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
457 req_micro=`echo $NEED_GPG_VERSION | \
458 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
459 GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
460 major=`echo $GPG_VERSION | \
461 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
462 minor=`echo $GPG_VERSION | \
463 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
464 micro=`echo $GPG_VERSION | \
465 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
467 if test "$major" -gt "$req_major"; then
470 if test "$major" -eq "$req_major"; then
471 if test "$minor" -gt "$req_minor"; then
474 if test "$minor" -eq "$req_minor"; then
475 if test "$micro" -ge "$req_micro"; then
482 if test "$ok" = "yes"; then
486 AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
490 AC_ARG_ENABLE(gpg-test,
491 AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
492 run_gpg_test=$enableval)
493 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
498 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
499 GPGSM=$withval, NO_OVERRIDE=yes)
500 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
503 if test "$cross_compiling" != "yes"; then
504 AC_PATH_PROG(GPGSM, gpgsm)
506 if test -z "$GPGSM"; then
507 GPGSM="$GPGSM_DEFAULT"
510 if test "$GPGSM" = no; then
511 if test "$NO_OVERRIDE" = "yes"; then
512 if test "$cross_compiling" != "yes"; then
515 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
520 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
525 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
526 AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
528 AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
531 dnl Check for GPGSM version requirement.
532 GPGSM_VERSION=unknown
534 if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
537 if test "$cross_compiling" = "yes"; then
538 AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
541 if test ! -x "$GPGSM"; then
542 AC_MSG_WARN([GPGSM not executable, version check disabled])
547 if test "$ok" = "maybe"; then
548 AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
549 req_major=`echo $NEED_GPGSM_VERSION | \
550 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
551 req_minor=`echo $NEED_GPGSM_VERSION | \
552 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
553 req_micro=`echo $NEED_GPGSM_VERSION | \
554 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
555 GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
556 major=`echo $GPGSM_VERSION | \
557 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
558 minor=`echo $GPGSM_VERSION | \
559 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
560 micro=`echo $GPGSM_VERSION | \
561 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
563 if test "$major" -gt "$req_major"; then
566 if test "$major" -eq "$req_major"; then
567 if test "$minor" -gt "$req_minor"; then
570 if test "$minor" -eq "$req_minor"; then
571 if test "$micro" -ge "$req_micro"; then
578 if test "$ok" = "yes"; then
582 AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
586 AC_ARG_ENABLE(gpgsm-test,
587 AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
588 run_gpgsm_test=$enableval)
589 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
594 AC_HELP_STRING([--with-gpgconf=PATH],
595 [use gpgconf binary at PATH]),
596 GPGCONF=$withval, NO_OVERRIDE=yes)
597 if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
600 if test "$cross_compiling" != "yes"; then
601 AC_PATH_PROG(GPGCONF, gpgconf)
603 if test -z "$GPGCONF"; then
604 GPGCONF="$GPGCONF_DEFAULT"
607 if test "$GPGCONF" = no; then
608 if test "$NO_OVERRIDE" = "yes"; then
609 if test "$cross_compiling" != "yes"; then
612 *** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
617 *** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
622 AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
623 AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
625 AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
627 dnl Check for GPGCONF version requirement.
628 GPGCONF_VERSION=unknown
630 if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
633 if test "$cross_compiling" = "yes"; then
634 AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
637 if test ! -x "$GPGCONF"; then
638 AC_MSG_WARN([GPGCONF not executable, version check disabled])
643 if test "$ok" = "maybe"; then
644 AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
645 req_major=`echo $NEED_GPGCONF_VERSION | \
646 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
647 req_minor=`echo $NEED_GPGCONF_VERSION | \
648 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
649 req_micro=`echo $NEED_GPGCONF_VERSION | \
650 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
651 GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
652 major=`echo $GPGCONF_VERSION | \
653 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
654 minor=`echo $GPGCONF_VERSION | \
655 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
656 micro=`echo $GPGCONF_VERSION | \
657 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
659 if test "$major" -gt "$req_major"; then
662 if test "$major" -eq "$req_major"; then
663 if test "$minor" -gt "$req_minor"; then
666 if test "$minor" -eq "$req_minor"; then
667 if test "$micro" -ge "$req_micro"; then
674 if test "$ok" = "yes"; then
678 AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
681 run_gpgconf_test="$ok"
682 AC_ARG_ENABLE(gpgconf-test,
683 AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
684 run_gpgconf_test=$enableval)
685 AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
690 AC_HELP_STRING([--with-g13=PATH],
691 [use g13 binary at PATH]),
692 G13=$withval, NO_OVERRIDE=yes)
693 if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
696 if test "$cross_compiling" != "yes"; then
697 AC_PATH_PROG(G13, g13)
699 if test -z "$G13"; then
703 if test "$G13" = no; then
704 if test "$NO_OVERRIDE" = "yes"; then
705 if test "$cross_compiling" != "yes"; then
708 *** Could not find g13, install g13 or use --with-g13=PATH to enable it
713 *** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
718 AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
719 AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
721 AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
723 dnl Check for G13 version requirement.
726 if test -z "$G13" -o "x$G13" = "xno"; then
729 if test "$cross_compiling" = "yes"; then
730 AC_MSG_WARN([G13 version can not be checked when cross compiling])
733 if test ! -x "$G13"; then
734 AC_MSG_WARN([G13 not executable, version check disabled])
739 if test "$ok" = "maybe"; then
740 AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
741 req_major=`echo $NEED_G13_VERSION | \
742 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
743 req_minor=`echo $NEED_G13_VERSION | \
744 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
745 req_micro=`echo $NEED_G13_VERSION | \
746 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
747 G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
748 major=`echo $G13_VERSION | \
749 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
750 minor=`echo $G13_VERSION | \
751 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
752 micro=`echo $G13_VERSION | \
753 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
755 if test "$major" -gt "$req_major"; then
758 if test "$major" -eq "$req_major"; then
759 if test "$minor" -gt "$req_minor"; then
762 if test "$minor" -eq "$req_minor"; then
763 if test "$micro" -ge "$req_micro"; then
770 if test "$ok" = "yes"; then
774 AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
778 AC_ARG_ENABLE(g13-test,
779 AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
780 run_g13_test=$enableval)
781 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
785 AC_CHECK_FUNCS(funopen)
786 if test $ac_cv_func_funopen != yes; then
787 # No funopen but we can implement that in terms of fopencookie.
788 AC_CHECK_FUNCS(fopencookie)
789 if test $ac_cv_func_fopencookie = yes; then
790 AC_REPLACE_FUNCS(funopen)
794 *** No implementation of fopencookie or funopen available
799 # Check for getgid etc
800 AC_CHECK_FUNCS(getgid getegid)
803 # Replacement functions.
804 AC_REPLACE_FUNCS(stpcpy)
805 # Check for unistd.h for setenv replacement function.
806 AC_CHECK_HEADERS([unistd.h sys/time.h sys/types.h sys/stat.h])
807 AC_REPLACE_FUNCS(setenv)
809 # Assuan check for descriptor passing.
810 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
811 [supports_descriptor_passing=yes],
812 [supports_descriptor_passing=no
815 *** Data structure for sending ancillary data missing.
816 *** Descriptor passing won't work.
821 #include <sys/types.h>
822 #include <sys/socket.h>
830 use_descriptor_passing=no
831 AC_ARG_ENABLE(fd-passing,
832 AC_HELP_STRING([--enable-fd-passing], [use FD passing if supported]),
833 use_descriptor_passing=$enableval)
835 if test "$supports_descriptor_passing" != "yes"; then
836 use_descriptor_passing=no
839 if test "$use_descriptor_passing" = "yes"; then
840 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
841 [Defined if descriptor passing is enabled and supported])
844 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
848 if test "$use_descriptor_passing" = "yes" && test "$have_libassuan" = "yes"; then
851 if test "$uiserver" != "no"; then
852 AC_DEFINE(ENABLE_UISERVER, 1,
853 [Defined if we are building with uiserver support.])
855 AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
858 # Generate values for the DLL version info
860 dnl Windows uses an internal build number. We use the last day of the
861 dnl year concatenated with the hour for it. WARNING: You should not
862 dnl do a build with the same version number in another year.
863 if test "$have_w32_system" = yes; then
864 BUILD_TIMESTAMP=`date --iso-8601=minutes`
865 BUILD_NUMBER="$(date -u '+%j%H' | sed 's/^0*\(.*\)/\1/')"
867 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
869 BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_NUMBER}"
871 AC_SUBST(BUILD_NUMBER)
872 AC_SUBST(BUILD_TIMESTAMP)
873 AC_SUBST(BUILD_FILEVERSION)
875 # Add a few constants to help porting to W32
876 AH_VERBATIM([SEPCONSTANTS],
878 /* Separators as used in $PATH. */
879 #ifdef HAVE_DOSISH_SYSTEM
880 #define PATHSEP_C ';'
882 #define PATHSEP_C ':'
887 /* Definition of GCC specific attributes. */
889 # define GPGME_GCC_A_PURE __attribute__ ((__pure__))
891 # define GPGME_GCC_A_PURE
894 /* Under WindowsCE we need gpg-error's strerror macro. */
895 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
899 # Substitution used for gpgme-config
900 GPGME_CONFIG_LIBS="-lgpgme"
901 GPGME_CONFIG_CFLAGS=""
902 GPGME_CONFIG_HOST="$host"
903 AC_SUBST(GPGME_CONFIG_API_VERSION)
904 AC_SUBST(GPGME_CONFIG_LIBS)
905 AC_SUBST(GPGME_CONFIG_CFLAGS)
906 AC_SUBST(GPGME_CONFIG_HOST)
909 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
910 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
913 # Some checks for gpgme-tool
914 AC_CHECK_HEADER([argp.h])
915 AC_CHECK_TYPES([error_t], [],
916 [AC_DEFINE([error_t], [int],
917 [Define to a type to use for `error_t' if it is not otherwise available.])],
918 [#include <errno.h>])
921 # A substitution to set generated files in a Emacs buffer to read-only.
922 AC_SUBST(emacs_local_vars_begin, ['Local Variables:'])
923 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
924 AC_SUBST(emacs_local_vars_end, ['End:'])
929 if test "$have_libassuan" = "no"; then
933 *** You need libassuan to build this program with GPGSM support.
934 *** This library is for example available at
935 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
936 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
940 if test "$die" = "yes"; then
943 *** Required libraries not found. Please consult the above messages
944 *** and install them before running configure again.
950 # Create config files
952 AC_CONFIG_FILES(Makefile src/Makefile
956 tests/opassuan/Makefile
960 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
961 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
965 GPGME v${VERSION} has been configured as follows:
968 GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
971 GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
973 GpgConf path: $GPGCONF
974 GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
977 G13 version: $G13_VERSION, min. $NEED_G13_VERSION
979 Assuan version: $libassuan_version, min. $NEED_LIBASSUAN_VERSION
982 FD Passing: $use_descriptor_passing
984 GPGME Pthread: $have_pthread