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 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 # 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.
28 # Never do a binary build with the same version number
29 # in another year; this would mess up the build number.
31 # The GIT version is usually the next intended release version with
32 # the string "-gitNNNNNN" appended. The reason for this is that tests
33 # for a specific feature can already be done under the assumption that
34 # the GIT version is the most recent one in a branch. To disable the
35 # GIT version for the real release, set the my_isgit macro to no.
36 m4_define(my_version, [1.3.2])
37 m4_define(my_isgit, [no])
39 m4_define([svn_revision], m4_esyscmd([printf "%d" $( (svn info 2>/dev/null \
40 || echo 'Revision: 0')|sed -n '/^Revision:/ {s/[^0-9]//gp;q;}')]))
41 m4_define([git_revision], m4_esyscmd([git branch -v 2>/dev/null \
42 | awk '/^\* / {printf "%s",$3}']))
43 m4_define([my_full_version], [my_version[]m4_if(my_isgit,[yes],
44 [m4_if(git_revision,[],[-svn[]svn_revision],[-git[]git_revision])])])
46 AC_INIT([gpgme],[my_full_version],[http://bugs.gnupg.org])
48 # LT Version numbers, remember to change them just *before* a release.
49 # (Code changed: REVISION++)
50 # (Interfaces added/removed/changed: CURRENT++, REVISION=0)
51 # (Interfaces added: AGE++)
52 # (Interfaces removed/changed: AGE=0)
54 LIBGPGME_LT_CURRENT=19
55 # Subtract 2 from this value if you want to make the LFS transition an
56 # ABI break. [Note to self: Remove this comment with the next regular break.]
58 LIBGPGME_LT_REVISION=1
60 # If the API is changed in an incompatible way: increment the next counter.
61 GPGME_CONFIG_API_VERSION=1
62 ##############################################
65 NEED_LIBASSUAN_VERSION=2.0.2
68 m4_define([git_brevis],m4_esyscmd(printf "%u" 0x[]m4_substr(git_revision,0,4)))
69 BUILD_REVISION=m4_if(git_revision,[],[svn_revision],[git_brevis])
71 VERSION=$PACKAGE_VERSION
73 AC_CONFIG_SRCDIR(src/gpgme.h.in)
74 AM_CONFIG_HEADER(config.h)
75 AC_CONFIG_MACRO_DIR([m4])
76 AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
80 # Enable GNU extensions on systems that have them.
83 AH_VERBATIM([_REENTRANT],
84 [/* To allow the use of GPGME in multithreaded programs we have to use
85 special features from the library.
86 IMPORTANT: gpgme is not yet fully reentrant and you should use it
87 only from one thread. */
94 AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog,
95 [build-aux/gitlog-to-changelog])
97 AC_SUBST(LIBGPGME_LT_CURRENT)
98 AC_SUBST(LIBGPGME_LT_AGE)
99 AC_SUBST(LIBGPGME_LT_REVISION)
103 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
104 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
106 # Don't default to build static libs.
108 LT_INIT([win32-dll disable-static])
109 LT_LANG([Windows Resource])
111 # For now we hardcode the use of version scripts. It would be better
112 # to write a test for this or even implement this within libtool.
113 have_ld_version_script=no
116 have_ld_version_script=yes
119 have_ld_version_script=yes
122 AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
126 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
132 component_system=None
133 have_dosish_system=no
143 have_w32ce_system=yes
147 *-mingw32ce*|*-mingw32*)
148 have_dosish_system=yes
150 GPG_DEFAULT='c:\\gnupg\\gpg.exe'
151 GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
152 GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
153 G13_DEFAULT='c:\\gnupg\\g13.exe'
154 #component_system='COM+'
157 AC_ARG_ENABLE(w32-glib,
158 AC_HELP_STRING([--enable-w32-glib], [build GPGME Glib for W32]),
159 build_w32_glib=$enableval)
161 # Check disabled, because the qt-dev packages in gpg4win do
162 # not provide any support for cross compilation.
163 # PKG_CHECK_MODULES(QT4_CORE, QtCore)
166 # ./configure --enable-w32-qt QT4_CORE_CFLAGS="..." QT4_CORE_LIBS="..."
167 AC_SUBST(QT4_CORE_CFLAGS)
168 AC_SUBST(QT4_CORE_LIBS)
169 AC_ARG_ENABLE(w32-qt,
170 AC_HELP_STRING([--enable-w32-qt], [build GPGME Qt for W32]),
171 build_w32_qt=$enableval)
174 AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes)
175 if test "$have_pthread" = yes; then
176 AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.])
179 # XXX: Probably use exec-prefix here?
180 # GPG_DEFAULT='/usr/bin/gpg'
181 # GPGSM_DEFAULT='/usr/bin/gpgsm'
182 # GPGCONF_DEFAULT='/usr/bin/gpgconf'
183 # G13_DEFAULT='/usr/bin/g13'
187 if test "$have_dosish_system" = yes; then
188 AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
189 [Defined if we run on some of the PCDOS like systems
190 (DOS, Windoze. OS/2) with special properties like
193 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
195 if test "$have_w32_system" = yes; then
196 AC_DEFINE(HAVE_W32_SYSTEM,1,
197 [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_ONCE([locale.h sys/select.h sys/uio.h argp.h
222 unistd.h sys/time.h sys/types.h sys/stat.h])
227 AC_CHECK_SIZEOF(unsigned int)
232 # A simple compile time check in gpgme.h for GNU/Linux systems that
233 # prevents a file offset bits mismatch between gpgme and the application.
234 NEED__FILE_OFFSET_BITS=0
235 case "$ac_cv_sys_file_offset_bits" in
236 "" | no | unknown) ;;
238 NEED__FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
241 AC_SUBST(NEED__FILE_OFFSET_BITS)
243 # Figure out platform dependent typedefs for gpgme.h
244 if test "$have_w32_system" = yes; then
245 if test "$have_w64_system" = yes; then
246 INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 64 bit W32 API. */
249 typedef __int64 ssize_t;"
251 INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 32 bit W32 API. */
253 typedef long ssize_t;"
256 INSERT__TYPEDEFS_FOR_GPGME_H="#include <sys/types.h>"
258 AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
259 AM_SUBST_NOTMAKE(INSERT__TYPEDEFS_FOR_GPGME_H)
261 # Checks for compiler features.
262 if test "$GCC" = yes; then
263 CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
264 if test "$have_w32_system" = yes; then
265 CFLAGS="$CFLAGS -mms-bitfields"
269 # Only used for debugging, so no serious test needed (for actual
270 # functionality you have to test libc as well, this only tests the
272 AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
273 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([__thread int foo;])],
274 gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
275 if test "$gpgme_cv_tls_works" = yes; then
276 AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
280 # Checks for library functions.
283 AC_REPLACE_FUNCS(vasprintf)
284 if test "$ac_cv_func_vasprintf" != yes; then
288 # Try to find a thread-safe version of ttyname().
289 gnupg_REPLACE_TTYNAME_R
290 if test "$ac_cv_func_ttyname_r" != yes; then
293 *** ttyname() is not thread-safe and ttyname_r() does not exist
297 # Try to find a thread-safe version of getenv().
298 have_thread_safe_getenv=no
300 if test $GLIBC21 = yes; then
301 have_thread_safe_getenv=yes
303 if test $have_thread_safe_getenv = yes; then
304 AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
307 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
308 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
311 *** getenv() is not thread-safe and getenv_r() does not exist
315 # For converting time strings to seconds since Epoch, we need the timegm
317 AC_CHECK_FUNCS(timegm)
318 if test "$ac_cv_func_timegm" != yes; then
321 *** timegm() not available - a non-thread-safe kludge will be used
322 *** and the TZ variable might be changed at runtime.
326 AC_CHECK_FUNCS(setlocale)
328 # Checking for libgpg-error.
329 AM_PATH_GPG_ERROR(1.8,, AC_MSG_ERROR([libgpg-error was not found]))
330 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
331 [The default error source for GPGME.])
335 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
336 have_libassuan=yes, have_libassuan=no)
337 if test "$have_libassuan" = "yes"; then
338 AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
339 [version of the libassuan library])
341 AM_CONDITIONAL(HAVE_ASSUAN, test "$have_libassuan" = "yes")
342 if test "$have_libassuan" = "yes"; then
343 AC_DEFINE(ENABLE_ASSUAN,1,[Whether Assuan support is enabled])
346 # Checks for system services
347 NEED_GPG_VERSION_DEFAULT=1.4.0
348 NEED_GPGSM_VERSION_DEFAULT=1.9.6
349 NEED_GPGCONF_VERSION_DEFAULT=2.0.4
350 NEED_G13_VERSION_DEFAULT=2.1.0
351 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
352 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
353 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
354 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
355 AC_ARG_WITH(gpg-version,
356 AC_HELP_STRING([--with-gpg-version=VER], [require GnuPG version VER]),
357 NEED_GPG_VERSION=$withval)
358 if test "$NEED_GPG_VERSION" = "yes"; then
359 NEED_GPG_VERSION="$NEED_GPG_VERSION_DEFAULT"
361 if test "$NEED_GPG_VERSION" = "no"; then
362 NEED_GPG_VERSION=0.0.0
364 AC_ARG_WITH(gpgsm-version,
365 AC_HELP_STRING([--with-gpgsm-version=VER], [require GPGSM version VER]),
366 NEED_GPGSM_VERSION=$withval)
367 if test "$NEED_GPGSM_VERSION" = "yes"; then
368 NEED_GPGSM_VERSION="$NEED_GPGSM_VERSION_DEFAULT"
370 if test "$NEED_GPGSM_VERSION" = "no"; then
371 NEED_GPGSM_VERSION=0.0.0
373 AC_ARG_WITH(gpgconf-version,
374 AC_HELP_STRING([--with-gpgconf-version=VER], [require GPGCONF version VER]),
375 NEED_GPGCONF_VERSION=$withval)
376 if test "$NEED_GPGCONF_VERSION" = "yes"; then
377 NEED_GPGCONF_VERSION="$NEED_GPGCONF_VERSION_DEFAULT"
379 if test "$NEED_GPGCONF_VERSION" = "no"; then
380 NEED_GPGCONF_VERSION=0.0.0
382 AC_ARG_WITH(g13-version,
383 AC_HELP_STRING([--with-g13-version=VER], [require G13 version VER]),
384 NEED_G13_VERSION=$withval)
385 if test "$NEED_G13_VERSION" = "yes"; then
386 NEED_G13_VERSION="$NEED_G13_VERSION_DEFAULT"
388 if test "$NEED_G13_VERSION" = "no"; then
389 NEED_G13_VERSION=0.0.0
392 AC_DEFINE_UNQUOTED(NEED_GPG_VERSION, "$NEED_GPG_VERSION",
393 [Min. needed GnuPG version.])
394 AC_DEFINE_UNQUOTED(NEED_GPGSM_VERSION, "$NEED_GPGSM_VERSION",
395 [Min. needed GPGSM version.])
396 AC_DEFINE_UNQUOTED(NEED_GPGCONF_VERSION, "$NEED_GPGCONF_VERSION",
397 [Min. needed GPGCONF version.])
398 AC_DEFINE_UNQUOTED(NEED_G13_VERSION, "$NEED_G13_VERSION",
399 [Min. needed G13 version.])
404 AC_HELP_STRING([--with-gpg=PATH], [use GnuPG binary at PATH]),
405 GPG=$withval, NO_OVERRIDE=yes)
406 if test "$NO_OVERRIDE" = "yes" || test "$GPG" = "yes"; then
409 if test "$cross_compiling" != "yes"; then
410 AC_PATH_PROG(GPG, gpg)
412 if test -z "$GPG"; then
416 if test "$GPG" = no; then
417 if test "$NO_OVERRIDE" = "yes"; then
418 if test "$cross_compiling" != "yes"; then
421 *** Could not find GnuPG, install GnuPG or use --with-gpg=PATH to enable it
426 *** Can not determine path to GnuPG when cross-compiling, use --with-gpg=PATH
431 AC_DEFINE_UNQUOTED(GPG_PATH, "$GPG", [Path to the GnuPG binary.])
434 dnl Check for GnuPG version requirement.
437 if test -z "$GPG" -o "x$GPG" = "xno"; then
440 if test "$cross_compiling" = "yes"; then
441 AC_MSG_WARN([GnuPG version can not be checked when cross compiling])
444 if test ! -x "$GPG"; then
445 AC_MSG_WARN([GnuPG not executable, version check disabled])
450 if test "$ok" = "maybe"; then
451 AC_MSG_CHECKING(for GPG >= $NEED_GPG_VERSION)
452 req_major=`echo $NEED_GPG_VERSION | \
453 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
454 req_minor=`echo $NEED_GPG_VERSION | \
455 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
456 req_micro=`echo $NEED_GPG_VERSION | \
457 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
458 GPG_VERSION=`$GPG --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
459 major=`echo $GPG_VERSION | \
460 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
461 minor=`echo $GPG_VERSION | \
462 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
463 micro=`echo $GPG_VERSION | \
464 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
466 if test "$major" -gt "$req_major"; then
469 if test "$major" -eq "$req_major"; then
470 if test "$minor" -gt "$req_minor"; then
473 if test "$minor" -eq "$req_minor"; then
474 if test "$micro" -ge "$req_micro"; then
481 if test "$ok" = "yes"; then
485 AC_MSG_WARN([GPG must be at least version $NEED_GPG_VERSION])
489 AC_ARG_ENABLE(gpg-test,
490 AC_HELP_STRING([--disable-gpg-test], [disable GPG run test]),
491 run_gpg_test=$enableval)
492 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
497 AC_HELP_STRING([--with-gpgsm=PATH], [use GpgSM binary at PATH]),
498 GPGSM=$withval, NO_OVERRIDE=yes)
499 if test "$NO_OVERRIDE" = "yes" || test "$GPGSM" = "yes"; then
502 if test "$cross_compiling" != "yes"; then
503 AC_PATH_PROG(GPGSM, gpgsm)
505 if test -z "$GPGSM"; then
506 GPGSM="$GPGSM_DEFAULT"
509 if test "$GPGSM" = no; then
510 if test "$NO_OVERRIDE" = "yes"; then
511 if test "$cross_compiling" != "yes"; then
514 *** Could not find GpgSM, install GpgSM or use --with-gpgsm=PATH to enable it
519 *** Can not determine path to GpgSM when cross-compiling, use --with-gpgsm=PATH
524 AC_DEFINE_UNQUOTED(GPGSM_PATH, "$GPGSM", [Path to the GPGSM binary.])
525 AC_DEFINE(ENABLE_GPGSM,1,[Whether GPGSM support is enabled])
527 AM_CONDITIONAL(HAVE_GPGSM, test "$GPGSM" != "no")
530 dnl Check for GPGSM version requirement.
531 GPGSM_VERSION=unknown
533 if test -z "$GPGSM" -o "x$GPGSM" = "xno"; then
536 if test "$cross_compiling" = "yes"; then
537 AC_MSG_WARN([GPGSM version can not be checked when cross compiling])
540 if test ! -x "$GPGSM"; then
541 AC_MSG_WARN([GPGSM not executable, version check disabled])
546 if test "$ok" = "maybe"; then
547 AC_MSG_CHECKING(for GPGSM >= $NEED_GPGSM_VERSION)
548 req_major=`echo $NEED_GPGSM_VERSION | \
549 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
550 req_minor=`echo $NEED_GPGSM_VERSION | \
551 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
552 req_micro=`echo $NEED_GPGSM_VERSION | \
553 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
554 GPGSM_VERSION=`$GPGSM --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
555 major=`echo $GPGSM_VERSION | \
556 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
557 minor=`echo $GPGSM_VERSION | \
558 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
559 micro=`echo $GPGSM_VERSION | \
560 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
562 if test "$major" -gt "$req_major"; then
565 if test "$major" -eq "$req_major"; then
566 if test "$minor" -gt "$req_minor"; then
569 if test "$minor" -eq "$req_minor"; then
570 if test "$micro" -ge "$req_micro"; then
577 if test "$ok" = "yes"; then
581 AC_MSG_WARN([GPGSM must be at least version $NEED_GPGSM_VERSION])
585 AC_ARG_ENABLE(gpgsm-test,
586 AC_HELP_STRING([--disable-gpgsm-test], [disable GPGSM run test]),
587 run_gpgsm_test=$enableval)
588 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
593 AC_HELP_STRING([--with-gpgconf=PATH],
594 [use gpgconf binary at PATH]),
595 GPGCONF=$withval, NO_OVERRIDE=yes)
596 if test "$NO_OVERRIDE" = "yes" || test "$GPGCONF" = "yes"; then
599 if test "$cross_compiling" != "yes"; then
600 AC_PATH_PROG(GPGCONF, gpgconf)
602 if test -z "$GPGCONF"; then
603 GPGCONF="$GPGCONF_DEFAULT"
606 if test "$GPGCONF" = no; then
607 if test "$NO_OVERRIDE" = "yes"; then
608 if test "$cross_compiling" != "yes"; then
611 *** Could not find gpgconf, install gpgconf or use --with-gpgconf=PATH to enable it
616 *** Can not determine path to gpgconf when cross-compiling, use --with-gpgconf=PATH
621 AC_DEFINE_UNQUOTED(GPGCONF_PATH, "$GPGCONF", [Path to the GPGCONF binary.])
622 AC_DEFINE(ENABLE_GPGCONF,1,[Whether GPGCONF support is enabled])
624 AM_CONDITIONAL(HAVE_GPGCONF, test "$GPGCONF" != "no")
626 dnl Check for GPGCONF version requirement.
627 GPGCONF_VERSION=unknown
629 if test -z "$GPGCONF" -o "x$GPGCONF" = "xno"; then
632 if test "$cross_compiling" = "yes"; then
633 AC_MSG_WARN([GPGCONF version can not be checked when cross compiling])
636 if test ! -x "$GPGCONF"; then
637 AC_MSG_WARN([GPGCONF not executable, version check disabled])
642 if test "$ok" = "maybe"; then
643 AC_MSG_CHECKING(for GPGCONF >= $NEED_GPGCONF_VERSION)
644 req_major=`echo $NEED_GPGCONF_VERSION | \
645 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
646 req_minor=`echo $NEED_GPGCONF_VERSION | \
647 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
648 req_micro=`echo $NEED_GPGCONF_VERSION | \
649 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
650 GPGCONF_VERSION=`$GPGCONF --version | sed -n '1 s/[[^0-9]]*\(.*\)/\1/p'`
651 major=`echo $GPGCONF_VERSION | \
652 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
653 minor=`echo $GPGCONF_VERSION | \
654 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
655 micro=`echo $GPGCONF_VERSION | \
656 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
658 if test "$major" -gt "$req_major"; then
661 if test "$major" -eq "$req_major"; then
662 if test "$minor" -gt "$req_minor"; then
665 if test "$minor" -eq "$req_minor"; then
666 if test "$micro" -ge "$req_micro"; then
673 if test "$ok" = "yes"; then
677 AC_MSG_WARN([GPGCONF must be at least version $NEED_GPGCONF_VERSION])
680 run_gpgconf_test="$ok"
681 AC_ARG_ENABLE(gpgconf-test,
682 AC_HELP_STRING([--disable-gpgconf-test], [disable GPGCONF run test]),
683 run_gpgconf_test=$enableval)
684 AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
689 AC_HELP_STRING([--with-g13=PATH],
690 [use g13 binary at PATH]),
691 G13=$withval, NO_OVERRIDE=yes)
692 if test "$NO_OVERRIDE" = "yes" || test "$G13" = "yes"; then
695 if test "$cross_compiling" != "yes"; then
696 AC_PATH_PROG(G13, g13)
698 if test -z "$G13"; then
702 if test "$G13" = no; then
703 if test "$NO_OVERRIDE" = "yes"; then
704 if test "$cross_compiling" != "yes"; then
707 *** Could not find g13, install g13 or use --with-g13=PATH to enable it
712 *** Can not determine path to g13 when cross-compiling, use --with-g13=PATH
717 AC_DEFINE_UNQUOTED(G13_PATH, "$G13", [Path to the G13 binary.])
718 AC_DEFINE(ENABLE_G13,1,[Whether G13 support is enabled])
720 AM_CONDITIONAL(HAVE_G13, test "$G13" != "no")
722 dnl Check for G13 version requirement.
725 if test -z "$G13" -o "x$G13" = "xno"; then
728 if test "$cross_compiling" = "yes"; then
729 AC_MSG_WARN([G13 version can not be checked when cross compiling])
732 if test ! -x "$G13"; then
733 AC_MSG_WARN([G13 not executable, version check disabled])
738 if test "$ok" = "maybe"; then
739 AC_MSG_CHECKING(for G13 >= $NEED_G13_VERSION)
740 req_major=`echo $NEED_G13_VERSION | \
741 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
742 req_minor=`echo $NEED_G13_VERSION | \
743 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
744 req_micro=`echo $NEED_G13_VERSION | \
745 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
746 G13_VERSION=`$G13 --version | sed -n '1 s/.*\ \([[0-9]].*\)/\1/p'`
747 major=`echo $G13_VERSION | \
748 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
749 minor=`echo $G13_VERSION | \
750 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
751 micro=`echo $G13_VERSION | \
752 sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
754 if test "$major" -gt "$req_major"; then
757 if test "$major" -eq "$req_major"; then
758 if test "$minor" -gt "$req_minor"; then
761 if test "$minor" -eq "$req_minor"; then
762 if test "$micro" -ge "$req_micro"; then
769 if test "$ok" = "yes"; then
773 AC_MSG_WARN([G13 must be at least version $NEED_G13_VERSION])
777 AC_ARG_ENABLE(g13-test,
778 AC_HELP_STRING([--disable-g13-test], [disable G13 run test]),
779 run_g13_test=$enableval)
780 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
784 AC_CHECK_FUNCS(funopen)
785 if test $ac_cv_func_funopen != yes; then
786 # No funopen but we can implement that in terms of fopencookie.
787 AC_CHECK_FUNCS(fopencookie)
788 if test $ac_cv_func_fopencookie = yes; then
789 AC_REPLACE_FUNCS(funopen)
793 *** No implementation of fopencookie or funopen available
798 # Check for getgid etc
799 AC_CHECK_FUNCS(getgid getegid)
802 # Replacement functions.
803 AC_REPLACE_FUNCS(stpcpy)
804 AC_REPLACE_FUNCS(setenv)
806 # Assuan check for descriptor passing.
807 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
808 [supports_descriptor_passing=yes],
809 [supports_descriptor_passing=no
812 *** Data structure for sending ancillary data missing.
813 *** Descriptor passing won't work.
818 #include <sys/types.h>
819 #include <sys/socket.h>
827 use_descriptor_passing=no
828 AC_ARG_ENABLE(fd-passing,
829 AC_HELP_STRING([--enable-fd-passing], [use FD passing if supported]),
830 use_descriptor_passing=$enableval)
832 if test "$supports_descriptor_passing" != "yes"; then
833 use_descriptor_passing=no
836 if test "$use_descriptor_passing" = "yes"; then
837 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
838 [Defined if descriptor passing is enabled and supported])
841 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
845 if test "$use_descriptor_passing" = "yes" && test "$have_libassuan" = "yes"; then
848 if test "$uiserver" != "no"; then
849 AC_DEFINE(ENABLE_UISERVER, 1,
850 [Defined if we are building with uiserver support.])
852 AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
855 # Generate values for the DLL version info
857 dnl Windows uses an internal build number. We use the last day of the
858 dnl year concatenated with the hour for it. WARNING: You should not
859 dnl do a build with the same version number in another year.
860 if test "$have_w32_system" = yes; then
861 BUILD_TIMESTAMP=`date --iso-8601=minutes`
862 BUILD_NUMBER="$(date -u '+%j%H' | sed 's/^0*\(.*\)/\1/')"
864 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
866 BUILD_FILEVERSION="${BUILD_FILEVERSION}${BUILD_NUMBER}"
868 AC_SUBST(BUILD_NUMBER)
869 AC_SUBST(BUILD_TIMESTAMP)
870 AC_SUBST(BUILD_FILEVERSION)
872 # Add a few constants to help porting to W32
873 AH_VERBATIM([SEPCONSTANTS],
875 /* Separators as used in $PATH. */
876 #ifdef HAVE_DOSISH_SYSTEM
877 #define PATHSEP_C ';'
879 #define PATHSEP_C ':'
884 /* Definition of GCC specific attributes. */
886 # define GPGME_GCC_A_PURE __attribute__ ((__pure__))
888 # define GPGME_GCC_A_PURE
891 /* Under WindowsCE we need gpg-error's strerror macro. */
892 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
896 # Substitution used for gpgme-config
897 GPGME_CONFIG_LIBS="-lgpgme"
898 GPGME_CONFIG_CFLAGS=""
899 GPGME_CONFIG_HOST="$host"
900 AC_SUBST(GPGME_CONFIG_API_VERSION)
901 AC_SUBST(GPGME_CONFIG_LIBS)
902 AC_SUBST(GPGME_CONFIG_CFLAGS)
903 AC_SUBST(GPGME_CONFIG_HOST)
906 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
907 sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
910 # Some checks for gpgme-tool
911 # Done at top: AC_CHECK_HEADER([argp.h])
912 AC_CHECK_TYPES([error_t], [],
913 [AC_DEFINE([error_t], [int],
914 [Define to a type to use for `error_t' if it is not otherwise available.])],
915 [#include <errno.h>])
918 # A substitution to set generated files in a Emacs buffer to read-only.
919 AC_SUBST(emacs_local_vars_begin, ['Local Variables:'])
920 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
921 AC_SUBST(emacs_local_vars_end, ['End:'])
926 if test "$have_libassuan" = "no"; then
930 *** You need libassuan to build this program with GPGSM support.
931 *** This library is for example available at
932 *** ftp://ftp.gnupg.org/gcrypt/libassuan/
933 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
937 if test "$die" = "yes"; then
940 *** Required libraries not found. Please consult the above messages
941 *** and install them before running configure again.
947 # Create config files
949 AC_CONFIG_FILES(Makefile src/Makefile
953 tests/opassuan/Makefile
957 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
958 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
962 GPGME v${VERSION} has been configured as follows:
965 GnuPG version: $GPG_VERSION, min. $NEED_GPG_VERSION
968 GpgSM version: $GPGSM_VERSION, min. $NEED_GPGSM_VERSION
970 GpgConf path: $GPGCONF
971 GpgConf version: $GPGCONF_VERSION, min. $NEED_GPGCONF_VERSION
974 G13 version: $G13_VERSION, min. $NEED_G13_VERSION
976 Assuan version: $libassuan_version, min. $NEED_LIBASSUAN_VERSION
979 FD Passing: $use_descriptor_passing
981 GPGME Pthread: $have_pthread