"Fossies" - the Fresh Open Source Software Archive

Member "gpgme-1.15.1/configure.ac" (8 Jan 2021, 29670 Bytes) of package /linux/privat/gpgme-1.15.1.tar.bz2:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "configure.ac": 1.15.0_vs_1.15.1.

    1 # configure.ac for GPGME
    2 # Copyright (C) 2000 Werner Koch (dd9jn)
    3 # Copyright (C) 2001-2021 g10 Code GmbH
    4 #
    5 # This file is part of GPGME.
    6 #
    7 # GPGME is free software; you can redistribute it and/or modify it
    8 # under the terms of the GNU Lesser General Public License as
    9 # published by the Free Software Foundation; either version 2.1 of the
   10 # License, or (at your option) any later version.
   11 #
   12 # GPGME is distributed in the hope that it will be useful, but WITHOUT
   13 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   14 # or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
   15 # Public License for more details.
   16 #
   17 # You should have received a copy of the GNU Lesser General Public
   18 # License along with this program; if not, see <https://gnu.org/licenses/>.
   19 # SPDX-License-Identifier: LGPL-2.1-or-later
   20 
   21 # (Process this file with autoconf to produce a configure script.)
   22 AC_PREREQ([2.59])
   23 min_automake_version="1.14"
   24 
   25 # To build a release you need to create a tag with the version number
   26 # "gpgme-n.m.k" and run "./autogen.sh --force".  Please bump the
   27 # version number immediately after the release and do another commit
   28 # and push so that the git magic is able to work.  If you start a new
   29 # series by bumping the minor (m) remember to also create a tag named
   30 # "gpgme-n.m-base" as the start point for beta numbering.  See below
   31 # for the LT versions.
   32 m4_define([mym4_package],[gpgme])
   33 m4_define([mym4_major], [1])
   34 m4_define([mym4_minor], [15])
   35 m4_define([mym4_micro], [1])
   36 
   37 # Below is m4 magic to extract and compute the git revision number,
   38 # the decimalized short revision number, a beta version string and a
   39 # flag indicating a development version (mym4_isbeta).  Note that the
   40 # m4 processing is done by autoconf and not during the configure run.
   41 m4_define([mym4_verslist], m4_split(m4_esyscmd([./autogen.sh --find-version] \
   42                            mym4_package mym4_major mym4_minor mym4_micro),[:]))
   43 m4_define([mym4_isbeta],       m4_argn(2, mym4_verslist))
   44 m4_define([mym4_version],      m4_argn(4, mym4_verslist))
   45 m4_define([mym4_revision],     m4_argn(7, mym4_verslist))
   46 m4_define([mym4_revision_dec], m4_argn(8, mym4_verslist))
   47 m4_esyscmd([echo ]mym4_version[>VERSION])
   48 AC_INIT([mym4_package],[mym4_version],[https://bugs.gnupg.org])
   49 
   50 # LT Version numbers, remember to change them just *before* a release.
   51 #   (Code changed:			REVISION++)
   52 #   (Interfaces added/removed/changed:	CURRENT++, REVISION=0)
   53 #   (Interfaces added:			AGE++)
   54 #   (Interfaces removed:		AGE=0)
   55 #
   56 LIBGPGME_LT_CURRENT=35
   57 LIBGPGME_LT_AGE=24
   58 LIBGPGME_LT_REVISION=1
   59 
   60 # If there is an ABI break in gpgmepp or qgpgme also bump the
   61 # version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in
   62 
   63 LIBGPGMEPP_LT_CURRENT=18
   64 LIBGPGMEPP_LT_AGE=12
   65 LIBGPGMEPP_LT_REVISION=1
   66 
   67 LIBQGPGME_LT_CURRENT=12
   68 LIBQGPGME_LT_AGE=5
   69 LIBQGPGME_LT_REVISION=1
   70 ################################################
   71 
   72 AC_SUBST(LIBGPGME_LT_CURRENT)
   73 AC_SUBST(LIBGPGME_LT_AGE)
   74 AC_SUBST(LIBGPGME_LT_REVISION)
   75 
   76 AC_SUBST(LIBGPGMEPP_LT_CURRENT)
   77 AC_SUBST(LIBGPGMEPP_LT_AGE)
   78 AC_SUBST(LIBGPGMEPP_LT_REVISION)
   79 
   80 AC_SUBST(LIBQGPGME_LT_CURRENT)
   81 AC_SUBST(LIBQGPGME_LT_AGE)
   82 AC_SUBST(LIBQGPGME_LT_REVISION)
   83 
   84 # If the API is changed in an incompatible way: increment the next counter.
   85 GPGME_CONFIG_API_VERSION=1
   86 ##############################################
   87 
   88 NEED_GPG_ERROR_VERSION=1.36
   89 NEED_LIBASSUAN_API=2
   90 NEED_LIBASSUAN_VERSION=2.4.2
   91 
   92 
   93 VERSION_MAJOR=mym4_major
   94 VERSION_MINOR=mym4_minor
   95 VERSION_MICRO=mym4_micro
   96 
   97 AC_CONFIG_AUX_DIR([build-aux])
   98 AC_CONFIG_MACRO_DIR([m4])
   99 AC_CONFIG_SRCDIR(src/gpgme.h.in)
  100 AC_CONFIG_HEADER(conf/config.h)
  101 AM_INIT_AUTOMAKE([serial-tests dist-bzip2 no-dist-gzip])
  102 AM_MAINTAINER_MODE
  103 AC_CANONICAL_HOST
  104 AM_SILENT_RULES
  105 AC_ARG_VAR(SYSROOT,[locate config scripts also below that directory])
  106 
  107 # Enable GNU extensions on systems that have them.
  108 AC_USE_SYSTEM_EXTENSIONS
  109 
  110 # Taken from mpfr-4.0.1, then modified for LDADD_FOR_TESTS_KLUDGE
  111 dnl Under Linux, make sure that the old dtags are used if LD_LIBRARY_PATH
  112 dnl is defined. The issue is that with the new dtags, LD_LIBRARY_PATH has
  113 dnl the precedence over the run path, so that if a compatible MPFR library
  114 dnl is installed in some directory from $LD_LIBRARY_PATH, then the tested
  115 dnl MPFR library will be this library instead of the MPFR library from the
  116 dnl build tree. Other OS with the same issue might be added later.
  117 dnl
  118 dnl References:
  119 dnl   https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=859732
  120 dnl   http://lists.gnu.org/archive/html/libtool/2017-05/msg00000.html
  121 dnl
  122 dnl We need to check whether --disable-new-dtags is supported as alternate
  123 dnl linkers may be used (e.g., with tcc: CC=tcc LD=tcc).
  124 dnl
  125 case $host in
  126   *-*-linux*)
  127     if test -n "$LD_LIBRARY_PATH"; then
  128       saved_LDFLAGS="$LDFLAGS"
  129       LDADD_FOR_TESTS_KLUDGE="-Wl,--disable-new-dtags"
  130       LDFLAGS="$LDFLAGS $LDADD_FOR_TESTS_KLUDGE"
  131       AC_MSG_CHECKING(whether --disable-new-dtags is supported by the linker)
  132       AC_LINK_IFELSE([AC_LANG_SOURCE([[
  133 int main (void) { return 0; }
  134       ]])],
  135       [AC_MSG_RESULT(yes (use it since LD_LIBRARY_PATH is set))],
  136       [AC_MSG_RESULT(no)
  137        LDADD_FOR_TESTS_KLUDGE=""
  138       ])
  139       LDFLAGS="$saved_LDFLAGS"
  140     fi
  141     ;;
  142 esac
  143 AC_SUBST([LDADD_FOR_TESTS_KLUDGE])
  144 
  145 AH_VERBATIM([_REENTRANT],
  146 [/* To allow the use of GPGME in multithreaded programs we have to use
  147   special features from the library.
  148   IMPORTANT: gpgme is not yet fully reentrant and you should use it
  149   only from one thread.  */
  150 #ifndef _REENTRANT
  151 # define _REENTRANT 1
  152 #endif])
  153 
  154 AC_PROG_CC
  155 AC_PROG_CPP
  156 AC_PROG_CXX
  157 
  158 # Note: A suitable gitlog-to-changelog script can be found in GnuPG master.
  159 AC_CHECK_PROGS(GITLOG_TO_CHANGELOG, gitlog-to-changelog, [gitlog-to-changelog])
  160 
  161 AC_SUBST(VERSION_MAJOR)
  162 AC_SUBST(VERSION_MINOR)
  163 AC_SUBST(VERSION_MICRO)
  164 
  165 VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_major \
  166                           mym4_minor mym4_micro)
  167 AC_SUBST(VERSION_NUMBER)
  168 
  169 # We need to compile and run a program on the build machine.  A
  170 # comment in libgpg-error says that the AC_PROG_CC_FOR_BUILD macro in
  171 # the AC archive is broken for autoconf 2.57.  Given that there is no
  172 # newer version of that macro, we assume that it is also broken for
  173 # autoconf 2.61 and thus we use a simple but usually sufficient
  174 # approach.
  175 AC_MSG_CHECKING(for cc for build)
  176 if test "$cross_compiling" = "yes"; then
  177   CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
  178 else
  179   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
  180 fi
  181 AC_MSG_RESULT($CC_FOR_BUILD)
  182 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
  183 
  184 
  185 # Don't default to build static libs.
  186 LT_PREREQ([2.2.6])
  187 LT_INIT([win32-dll disable-static])
  188 LT_LANG([Windows Resource])
  189 
  190 # For now we hardcode the use of version scripts.  It would be better
  191 # to write a test for this or even implement this within libtool.
  192 have_ld_version_script=no
  193 case "${host}" in
  194     *-*-linux*)
  195 	have_ld_version_script=yes
  196         ;;
  197     *-*-gnu*)
  198 	have_ld_version_script=yes
  199         ;;
  200     *-apple-darwin*)
  201         AC_DEFINE(_DARWIN_C_SOURCE, 900000L,
  202                   Expose all libc features (__DARWIN_C_FULL).)
  203         AC_DEFINE(_XOPEN_SOURCE, 500, Activate POSIX interface on MacOS X)
  204         ;;
  205 esac
  206 
  207 AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
  208 
  209 GPG_DEFAULT=no
  210 GPGSM_DEFAULT=no
  211 GPGCONF_DEFAULT=no
  212 G13_DEFAULT=no
  213 component_system=None
  214 have_dosish_system=no
  215 have_android_system=no
  216 have_w32_system=no
  217 have_w64_system=no
  218 have_macos_system=no
  219 build_w32_glib=no
  220 build_w32_qt=no
  221 available_languages="cl cpp python qt"
  222 default_languages="cl cpp python qt"
  223 case "${host}" in
  224     x86_64-*mingw32*)
  225         have_w64_system=yes
  226         ;;
  227     *-linux-androideabi)
  228         have_android_system=yes
  229         ;;
  230     *-apple-darwin*)
  231         have_macos_system=yes
  232         ;;
  233 esac
  234 case "${host}" in
  235     *-mingw32*)
  236 	have_dosish_system=yes
  237         have_w32_system=yes
  238         GPG_DEFAULT='c:\\gnupg\\gpg.exe'
  239 	GPGSM_DEFAULT='c:\\gnupg\\gpgsm.exe'
  240         GPGCONF_DEFAULT='c:\\gnupg\\gpgconf.exe'
  241         G13_DEFAULT='c:\\gnupg\\g13.exe'
  242         #component_system='COM+'
  243 
  244 	AM_PATH_GLIB_2_0
  245 	AC_ARG_ENABLE(w32-glib,
  246 	    AS_HELP_STRING([--enable-w32-glib],[build GPGME Glib for W32]),
  247 	    		   build_w32_glib=$enableval)
  248        ;;
  249     *)
  250 
  251 	# XXX: Probably use exec-prefix here?
  252 #	GPG_DEFAULT='/usr/bin/gpg'
  253 #	GPGSM_DEFAULT='/usr/bin/gpgsm'
  254 #	GPGCONF_DEFAULT='/usr/bin/gpgconf'
  255 #	G13_DEFAULT='/usr/bin/g13'
  256 	;;
  257 esac
  258 
  259 if test "$have_dosish_system" = yes; then
  260    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
  261              [Defined if we run on some of the PCDOS like systems
  262               (DOS, Windoze. OS/2) with special properties like
  263               no file modes])
  264 fi
  265 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
  266 
  267 if test "$have_w32_system" = yes; then
  268    AC_DEFINE(HAVE_W32_SYSTEM,1,
  269              [Defined if we run on any kind of W32 API based system])
  270 fi
  271 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
  272 
  273 if test "$have_w64_system" = yes; then
  274    AC_DEFINE(HAVE_W64_SYSTEM,1,
  275              [Defined if we run on a 64 bit W32 API based system])
  276 fi
  277 AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
  278 
  279 if test "$have_android_system" = yes; then
  280    AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
  281 fi
  282 AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes)
  283 
  284 if test "$have_macos_system" = yes; then
  285    AC_DEFINE(HAVE_MACOS_SYSTEM,1,
  286              [Defined if we build for an MacOS system])
  287 fi
  288 AM_CONDITIONAL(HAVE_MACOS_SYSTEM, test "$have_macos_system" = yes)
  289 
  290 AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes)
  291 
  292 
  293 AC_ARG_ENABLE([fixed-path],
  294               AS_HELP_STRING([--enable-fixed-path=PATH],
  295                              [locate binaries only via this PATH]),
  296               [fixed_search_path="$enableval"],
  297               [fixed_search_path=""])
  298 if test x$fixed_search_path != x ; then
  299   AC_DEFINE_UNQUOTED(FIXED_SEARCH_PATH, "$fixed_search_path",
  300                     [Locate binaries only via this PATH])
  301 fi
  302 
  303 
  304 # Note: You need to declare all possible languages also in
  305 #       lang/Makefile.am's DIST_SUBDIRS.
  306 AC_ARG_ENABLE([languages],
  307               AS_HELP_STRING([--enable-languages=languages],
  308                              [enable only specific language bindings]),
  309                              [enabled_languages=`echo $enableval | \
  310                              tr ',:' '  ' | tr '[A-Z]' '[a-z]' | \
  311                              sed 's/c++/cpp/'`],
  312                              [enabled_languages="maybe"])
  313 if test "x$enabled_languages" = "x" \
  314    -o "$enabled_languages" = "no"; then
  315    enabled_languages=
  316 fi
  317 
  318 # If languages are explicitly set missing requirements
  319 # for the languages are treated as errors otherwise
  320 # there will be a warning.
  321 explicit_languages=1
  322 if test "x$enabled_languages" = "xmaybe"; then
  323     explicit_languages=0
  324     enabled_languages="$default_languages"
  325 fi
  326 
  327 for language in $enabled_languages; do
  328     LIST_MEMBER($language, $available_languages)
  329     if test "$found" = "0"; then
  330        AC_MSG_ERROR([unsupported language binding specified])
  331     fi
  332 done
  333 
  334 
  335 
  336 # Enable C++ 11 if cpp language is requested
  337 LIST_MEMBER("cpp", $enabled_languages)
  338 if test "$found" = "1"; then
  339     AX_CXX_COMPILE_STDCXX(11, noext, optional)
  340     if test "$HAVE_CXX11" != "1"; then
  341         if test "$explicit_languages" = "1"; then
  342             AC_MSG_ERROR([[
  343 ***
  344 *** A compiler with c++11 support is required for the c++ binding.
  345 ***]])
  346         else
  347             enabled_languages=$(echo $enabled_languages | sed 's/cpp//')
  348             enabled_languages=$(echo $enabled_languages | sed 's/qt//')
  349             AC_MSG_WARN([[
  350 ***
  351 *** No c++11 support detected. C++ and Qt bindings will be disabled.
  352 ***]])
  353         fi
  354     fi
  355 fi
  356 
  357 # Check that if qt is enabled cpp also is enabled
  358 LIST_MEMBER("qt", $enabled_languages)
  359 if test "$found" = "1"; then
  360     # We need to ensure that in the language order qt comes after cpp
  361     # so we remove qt first and explicitly add it as last list member.
  362     enabled_languages=$(echo $enabled_languages | sed 's/qt//')
  363     LIST_MEMBER("cpp", $enabled_languages)
  364     if test "$found" = "0"; then
  365         AC_MSG_ERROR([[
  366 ***
  367 *** Qt language binding depends on cpp binding.
  368 ***]])
  369     fi
  370     FIND_QT
  371     if test "$have_qt5_libs" != "yes"; then
  372         if test "$explicit_languages" = "1"; then
  373         AC_MSG_ERROR([[
  374 ***
  375 *** Qt5 (Qt5Core) is required for Qt binding.
  376 ***]])
  377         else
  378            AC_MSG_WARN([[
  379 ***
  380 *** Qt5 (Qt5Core) not found Qt Binding will be disabled.
  381 ***]])
  382         fi
  383     else
  384         enabled_languages=`echo $enabled_languages qt`
  385 
  386         AC_CHECK_PROGS([DOXYGEN], [doxygen])
  387         if test -z "$DOXYGEN";
  388             # This is not highlighted because it's not really important.
  389             then AC_MSG_WARN([Doxygen not found - Qt binding doc will not be built.])
  390         fi
  391         AC_CHECK_PROGS([GRAPHVIZ], [dot])
  392         if test -z "$GRAPHVIZ";
  393             then AC_MSG_WARN([Graphviz not found - Qt binding doc will not have diagrams.])
  394         fi
  395     fi
  396 fi
  397 AM_CONDITIONAL([HAVE_DOXYGEN],
  398                [test -n "$DOXYGEN"])
  399 if test -n "$GRAPHVIZ"; then
  400     HAVE_DOT="YES"
  401 else
  402     HAVE_DOT="NO"
  403 fi
  404 AC_SUBST(HAVE_DOT)
  405 
  406 # Python bindings.
  407 LIST_MEMBER("python", $enabled_languages)
  408 found_py=$found
  409 if test "$found_py" = "1"; then
  410     AX_PKG_SWIG
  411     if test -z "$SWIG"; then
  412         if test "$explicit_languages" = "1"; then
  413             AC_MSG_ERROR([[
  414 ***
  415 *** You need SWIG to build the Python bindings.
  416 ***]])
  417         else
  418             enabled_languages=$(echo $enabled_languages | sed 's/python//')
  419         fi
  420     else
  421         # Reset the version collecting vars.
  422 	PYTHONS=
  423 	PYTHON_VERSIONS=
  424 
  425 	if test "$found_py" = "1" -o "$found_py3" = "1"; then
  426 	  # Reset everything, so that we can look for another Python.
  427           m4_foreach([mym4pythonver],
  428                      [[2.7],[3.4],[3.5],[3.6],[3.7],[3.8],[3.9],[all]],
  429            [unset PYTHON
  430 	    unset PYTHON_VERSION
  431 	    unset PYTHON_CPPFLAGS
  432 	    unset PYTHON_LDFLAGS
  433 	    unset PYTHON_SITE_PKG
  434 	    unset PYTHON_EXTRA_LIBS
  435 	    unset PYTHON_EXTRA_LDFLAGS
  436 	    unset ac_cv_path_PYTHON
  437 	    unset am_cv_pathless_PYTHON
  438 	    unset am_cv_python_version
  439 	    unset am_cv_python_platform
  440 	    unset am_cv_python_pythondir
  441 	    unset am_cv_python_pyexecdir
  442 	    AM_PATH_PYTHON(mym4pythonver, [
  443 		AX_PYTHON_DEVEL
  444 		if test "$PYTHON_VERSION"; then
  445 			PYTHONS="$(echo $PYTHONS $PYTHON)"
  446 			PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS $PYTHON_VERSION)"
  447 		fi
  448 	    ], :, m4_if([mym4pythonver],[all],[],[python]mym4pythonver))
  449            ])
  450 	fi
  451 
  452 	# Recover some values lost in the second attempt to find Python.
  453 	PYTHON="$(echo $PYTHONS | cut -d ' ' -f 1)"
  454 	PYTHON_VERSION="$(echo $PYTHON_VERSIONS | cut -d ' ' -f 1)"
  455 
  456 	# Remove duplicates.
  457 	PYTHONS="$(echo $PYTHONS | tr '[[:space:]]' '\n' | sort | uniq | tr '\n' ' ' | sed -e 's/ $//')"
  458 	PYTHON_VERSIONS="$(echo $PYTHON_VERSIONS | tr '[[:space:]]' '\n' | sort | uniq | tr '\n' ' ' | sed -e 's/ $//')"
  459 
  460 	if test "$PYTHON_VERSIONS"; then
  461 	   enabled_languages_v=$(echo $enabled_languages | sed -Ee "s/python[[23]]?/python ($PYTHON_VERSIONS)/")
  462 	   enabled_languages=$(echo $enabled_languages | sed -Ee "s/python[[23]]?/python/")
  463 	else
  464             if test "$explicit_languages" = "1"; then
  465                 AC_MSG_ERROR([[
  466 ***
  467 *** Please install the python development packages.
  468 ***]])
  469 	    else
  470                 enabled_languages=$(echo $enabled_languages | sed 's/python//')
  471             fi
  472 	fi
  473 
  474 	AC_SUBST(PYTHONS, $PYTHONS)
  475     fi
  476 fi
  477 
  478 AC_SUBST(ENABLED_LANGUAGES, $enabled_languages)
  479 
  480 #
  481 # Provide information about the build.
  482 #
  483 BUILD_REVISION="mym4_revision"
  484 AC_SUBST(BUILD_REVISION)
  485 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
  486                    [GIT commit id revision used to build this package])
  487 
  488 changequote(,)dnl
  489 BUILD_VERSION=`echo "$PACKAGE_VERSION" | sed 's/\([0-9.]*\).*/\1./'`
  490 changequote([,])dnl
  491 BUILD_VERSION="${BUILD_VERSION}mym4_revision_dec"
  492 BUILD_FILEVERSION=`echo "${BUILD_VERSION}" | tr . ,`
  493 AC_SUBST(BUILD_VERSION)
  494 AC_SUBST(BUILD_FILEVERSION)
  495 
  496 AC_ARG_ENABLE([build-timestamp],
  497   AS_HELP_STRING([--enable-build-timestamp],
  498                  [set an explicit build timestamp for reproducibility.
  499                   (default is the current time in ISO-8601 format)]),
  500      [if test "$enableval" = "yes"; then
  501         BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
  502       else
  503         BUILD_TIMESTAMP="$enableval"
  504       fi],
  505      [BUILD_TIMESTAMP="<none>"])
  506 AC_SUBST(BUILD_TIMESTAMP)
  507 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
  508                    [The time this package was configured for a build])
  509 
  510 
  511 #
  512 # Options to disable some regression tests
  513 #
  514 run_gpgconf_test="yes"
  515 AC_ARG_ENABLE(gpgconf-test,
  516   AS_HELP_STRING([--disable-gpgconf-test],[disable GPGCONF regression test]),
  517          run_gpgconf_test=$enableval)
  518 AM_CONDITIONAL(RUN_GPGCONF_TESTS, test "$run_gpgconf_test" = "yes")
  519 
  520 run_gpg_test="yes"
  521 AC_ARG_ENABLE(gpg-test,
  522   AS_HELP_STRING([--disable-gpg-test],[disable GPG regression test]),
  523          run_gpg_test=$enableval)
  524 AM_CONDITIONAL(RUN_GPG_TESTS, test "$run_gpg_test" = "yes")
  525 
  526 run_gpgsm_test="yes"
  527 AC_ARG_ENABLE(gpgsm-test,
  528   AS_HELP_STRING([--disable-gpgsm-test],[disable GPGSM regression test]),
  529          run_gpgsm_test=$enableval)
  530 AM_CONDITIONAL(RUN_GPGSM_TESTS, test "$run_gpgsm_test" = "yes")
  531 
  532 run_g13_test="yes"
  533 AC_ARG_ENABLE(g13-test,
  534   AS_HELP_STRING([--disable-g13-test],[disable G13 regression test]),
  535          run_g13_test=$enableval)
  536 AM_CONDITIONAL(RUN_G13_TESTS, test "$run_g13_test" = "yes")
  537 
  538 
  539 # Checks for header files.
  540 AC_CHECK_HEADERS_ONCE([locale.h sys/select.h sys/uio.h argp.h stdint.h
  541                        unistd.h sys/time.h sys/types.h sys/stat.h])
  542 
  543 
  544 # Type checks.
  545 AC_C_INLINE
  546 AC_CHECK_SIZEOF(unsigned int)
  547 AC_SYS_LARGEFILE
  548 AC_TYPE_OFF_T
  549 AC_TYPE_UINTPTR_T
  550 
  551 # We require uint64_t
  552 if test "$ac_cv_header_stdint_h" != yes; then
  553    AC_MSG_ERROR([[
  554 ***
  555 *** No stdint.h and thus no uint64_t type.  Can't build this library.
  556 ***]])
  557 fi
  558 
  559 
  560 # A simple compile time check in gpgme.h for GNU/Linux systems that
  561 # prevents a file offset bits mismatch between gpgme and the application.
  562 NEED__FILE_OFFSET_BITS=0
  563 if test "$have_w32_system" != yes; then
  564   case "$ac_cv_sys_file_offset_bits" in
  565     "" | no | unknown) ;;
  566     *)
  567     NEED__FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits
  568     ;;
  569   esac
  570 fi
  571 AC_SUBST(NEED__FILE_OFFSET_BITS)
  572 
  573 # Figure out platform dependent typedefs for gpgme.h
  574 if test "$have_w32_system" = yes; then
  575     INSERT__TYPEDEFS_FOR_GPGME_H="
  576 #ifdef _WIN64
  577 # include <stdint.h>
  578   typedef int64_t gpgme_off_t;
  579   typedef int64_t gpgme_ssize_t;
  580 #else /* _WIN32 */
  581   typedef long gpgme_off_t;
  582   typedef long gpgme_ssize_t;
  583 #endif /* _WIN32 */"
  584     API__OFF_T="gpgme_off_t"
  585     API__SSIZE_T="gpgme_ssize_t"
  586 else
  587     INSERT__TYPEDEFS_FOR_GPGME_H="
  588 #include <sys/types.h>
  589 typedef off_t   gpgme_off_t;
  590 typedef ssize_t gpgme_ssize_t;"
  591     API__OFF_T="off_t"
  592     API__SSIZE_T="ssize_t"
  593 fi
  594 AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
  595 AM_SUBST_NOTMAKE(INSERT__TYPEDEFS_FOR_GPGME_H)
  596 AC_SUBST(API__OFF_T)
  597 AM_SUBST_NOTMAKE(API__OFF_T)
  598 AC_SUBST(API__SSIZE_T)
  599 AM_SUBST_NOTMAKE(API__SSIZE_T)
  600 
  601 # Checks for compiler features.
  602 if test "$GCC" = yes; then
  603     CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
  604     CFLAGS="$CFLAGS -Wno-format-y2k"
  605 
  606     # If -Wno-missing-field-initializers is supported we can expect a
  607     # a larger set of warning options.
  608     AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
  609     _gcc_cflags_save=$CFLAGS
  610     CFLAGS="-Wno-missing-field-initializers"
  611     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
  612     AC_MSG_RESULT($_gcc_wopt)
  613     CFLAGS=$_gcc_cflags_save;
  614     if test x"$_gcc_wopt" = xyes ; then
  615       CFLAGS="$CFLAGS -Wno-missing-field-initializers"
  616       CFLAGS="$CFLAGS -Wno-sign-compare"
  617       CFLAGS="$CFLAGS -Wno-format-zero-length"
  618       CFLAGS="$CFLAGS -Wno-format-truncation"
  619       CFLAGS="$CFLAGS -Wno-sizeof-pointer-div"
  620     fi
  621     if test "$USE_MAINTAINER_MODE" = "yes"; then
  622         if test x"$_gcc_wopt" = xyes ; then
  623           CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast"
  624           CFLAGS="$CFLAGS -Wwrite-strings"
  625           CFLAGS="$CFLAGS -Wdeclaration-after-statement"
  626         fi
  627         CFLAGS="$CFLAGS -Wformat -Wformat-security"
  628         CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wno-shadow"
  629 
  630         AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
  631         _gcc_cflags_save=$CFLAGS
  632         CFLAGS="-Wpointer-arith"
  633         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_wopt=yes,_gcc_wopt=no)
  634         AC_MSG_RESULT($_gcc_wopt)
  635         CFLAGS=$_gcc_cflags_save;
  636         if test x"$_gcc_wopt" = xyes ; then
  637           CFLAGS="$CFLAGS -Wpointer-arith"
  638         fi
  639     fi
  640     if test "$have_w32_system" = yes; then
  641        CFLAGS="$CFLAGS -mms-bitfields"
  642     fi
  643 fi
  644 
  645 # Only used for debugging, so no serious test needed (for actual
  646 # functionality you have to test libc as well, this only tests the
  647 # compiler).
  648 AC_CACHE_CHECK([for __thread],[gpgme_cv_tls_works],
  649    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([__thread int foo;])],
  650                      gpgme_cv_tls_works=yes,gpgme_cv_tls_works=no))
  651 if test "$gpgme_cv_tls_works" = yes; then
  652   AC_DEFINE(HAVE_TLS, [1], [Define if __thread is supported])
  653 fi
  654 
  655 
  656 # Checks for library functions.
  657 AC_MSG_NOTICE([checking for libraries])
  658 
  659 AC_FUNC_FSEEKO
  660 
  661 # Try to find a thread-safe version of ttyname().
  662 gnupg_REPLACE_TTYNAME_R
  663 if test "$ac_cv_func_ttyname_r" != yes; then
  664   AC_MSG_WARN([
  665 ***
  666 *** ttyname() is not thread-safe and ttyname_r() does not exist
  667 ***])
  668 fi
  669 
  670 # Try to find a thread-safe version of getenv().
  671 have_thread_safe_getenv=no
  672 jm_GLIBC21
  673 if test $GLIBC21 = yes -o $have_w32_system = yes; then
  674   have_thread_safe_getenv=yes
  675 fi
  676 if test $have_thread_safe_getenv = yes; then
  677   AC_DEFINE(HAVE_THREAD_SAFE_GETENV, [1], [Define if getenv() is thread-safe])
  678 fi
  679 have_getenv_r=no
  680 AC_CHECK_FUNCS(getenv_r, have_getenv_r=yes)
  681 if test $have_getenv_r = no && test $have_thread_safe_getenv = no; then
  682   AC_MSG_WARN([
  683 ***
  684 *** getenv() is not thread-safe and getenv_r() does not exist
  685 ***])
  686 fi
  687 
  688 # For converting time strings to seconds since Epoch, we need the timegm
  689 # function.
  690 AC_CHECK_FUNCS(timegm)
  691 if test "$ac_cv_func_timegm" != yes; then
  692   AC_MSG_WARN([
  693 ***
  694 *** timegm() not available - a non-thread-safe kludge will be used
  695 *** and the TZ variable might be changed at runtime.
  696 ***])
  697 fi
  698 
  699 AC_CHECK_FUNCS(setlocale)
  700 
  701 # Checking for libgpg-error.
  702 have_gpg_error=no
  703 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
  704                   have_gpg_error=yes, have_gpg_error=no)
  705 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_GPGME,
  706           [The default error source for GPGME.])
  707 
  708 # And for libassuan.
  709 have_libassuan=no
  710 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
  711                   have_libassuan=yes, have_libassuan=no)
  712 if test "$have_libassuan" = "yes"; then
  713   AC_DEFINE_UNQUOTED(GPGME_LIBASSUAN_VERSION, "$libassuan_version",
  714                      [version of the libassuan library])
  715 fi
  716 
  717 
  718 #
  719 # Other checks
  720 #
  721 
  722 # Check for getgid etc
  723 AC_CHECK_FUNCS(getgid getegid closefrom)
  724 
  725 
  726 # Replacement functions.
  727 AC_REPLACE_FUNCS(stpcpy)
  728 AC_REPLACE_FUNCS(setenv)
  729 
  730 # Assuan check for descriptor passing.
  731 AC_CHECK_MEMBER(struct cmsghdr.cmsg_len,
  732                 [supports_descriptor_passing=yes],
  733                 [supports_descriptor_passing=no
  734                  AC_MSG_WARN([
  735 ***
  736 *** Data structure for sending ancillary data missing.
  737 *** Descriptor passing won't work.
  738 ***])],[
  739 #include <stdlib.h>
  740 #include <stddef.h>
  741 #include <stdio.h>
  742 #include <sys/types.h>
  743 #include <sys/socket.h>
  744 #include <sys/un.h>
  745 #if HAVE_SYS_UIO_H
  746 #include <sys/uio.h>
  747 #endif
  748 #include <unistd.h>
  749        ])
  750 
  751 use_descriptor_passing=yes
  752 AC_ARG_ENABLE(fd-passing,
  753   AS_HELP_STRING([--disable-fd-passing],[do not use FD passing]),
  754   use_descriptor_passing=$enableval)
  755 
  756 if test "$supports_descriptor_passing" != "yes"; then
  757   use_descriptor_passing=no
  758 fi
  759 
  760 if test "$use_descriptor_passing" = "yes"; then
  761 AC_DEFINE(USE_DESCRIPTOR_PASSING,1,
  762           [Defined if descriptor passing is enabled and supported])
  763 fi
  764 
  765 AM_CONDITIONAL(USE_DESCRIPTOR_PASSING, test "$use_descriptor_passing" = "yes")
  766 
  767 
  768 uiserver=no
  769 if test "$use_descriptor_passing" = "yes" && test "$have_libassuan" = "yes"; then
  770   uiserver=yes
  771 fi
  772 if test "$uiserver" != "no"; then
  773   AC_DEFINE(ENABLE_UISERVER, 1,
  774             [Defined if we are building with uiserver support.])
  775 fi
  776 AM_CONDITIONAL(HAVE_UISERVER, test "$uiserver" != "no")
  777 
  778 
  779 # Option --disable-linux-getdents
  780 #
  781 # By default we use SYS_getdents on Linux to optimize fd closing
  782 # before an exec.  This option allows to switch this optimization off.
  783 use_linux_getdents=yes
  784 AC_ARG_ENABLE(linux-getdents,
  785               AS_HELP_STRING([--disable-linux-getdents],
  786                              [do not use SYS_getdents on Linux]),
  787               use_linux_getdents=$enableval)
  788 if test "$use_linux_getdents" = "yes"; then
  789     case "${host}" in
  790         *-*-linux*)
  791            AC_DEFINE(USE_LINUX_GETDENTS,1,
  792                      [Defined if SYS_getdents can be used on Linux])
  793            ;;
  794     esac
  795 fi
  796 
  797 
  798 #
  799 # Add a few constants to help porting to W32
  800 #
  801 AH_VERBATIM([SEPCONSTANTS],
  802 [
  803 /* Separators as used in $PATH and file name.  */
  804 #ifdef HAVE_DOSISH_SYSTEM
  805 #define PATHSEP_C ';'
  806 #define DIRSEP_C '\\'
  807 #define DIRSEP_S "\\"
  808 #else
  809 #define PATHSEP_C ':'
  810 #define DIRSEP_C '/'
  811 #define DIRSEP_S "/"
  812 #endif
  813 ])
  814 
  815 AH_BOTTOM([
  816 /* Definition of GCC specific attributes.  */
  817 #if __GNUC__ > 2
  818 # define GPGME_GCC_A_PURE  __attribute__ ((__pure__))
  819 #else
  820 # define GPGME_GCC_A_PURE
  821 #endif
  822 
  823 /* Under WindowsCE we need gpg-error's strerror macro.  */
  824 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
  825 
  826 #define CRIGHTBLURB "Copyright (C) 2000 Werner Koch\n" \
  827                     "Copyright (C) 2001--2021 g10 Code GmbH\n"
  828 ])
  829 
  830 
  831 # Substitution used for gpgme-config
  832 GPGME_CONFIG_LIBS="-lgpgme"
  833 GPGME_CONFIG_CFLAGS=""
  834 GPGME_CONFIG_HOST="$host"
  835 GPGME_CONFIG_AVAIL_LANG="$enabled_languages"
  836 AC_SUBST(GPGME_CONFIG_API_VERSION)
  837 AC_SUBST(GPGME_CONFIG_LIBS)
  838 AC_SUBST(GPGME_CONFIG_CFLAGS)
  839 AC_SUBST(GPGME_CONFIG_HOST)
  840 AC_SUBST(GPGME_CONFIG_AVAIL_LANG)
  841 
  842 # Frob'da Variables
  843 LTLIBOBJS=`echo "$LIB@&t@OBJS" |
  844            sed 's,\.[[^.]]* ,.lo ,g;s,\.[[^.]]*$,.lo,'`
  845 AC_SUBST(LTLIBOBJS)
  846 
  847 # Some checks for gpgme-tool
  848 # Done at top: AC_CHECK_HEADER([argp.h])
  849 AC_CHECK_TYPES([error_t], [],
  850    [AC_DEFINE([error_t], [int],
  851    [Define to a type to use for `error_t' if it is not otherwise available.])],
  852    [#include <errno.h>])
  853 
  854 
  855 # A substitution to set generated files in a Emacs buffer to read-only.
  856 AC_SUBST(emacs_local_vars_begin, [['Local][ ][Variables:']])
  857 AC_SUBST(emacs_local_vars_read_only, ['buffer-read-only: t'])
  858 AC_SUBST(emacs_local_vars_end, ['End:'])
  859 
  860 # Last check.
  861 die=no
  862 if test "$have_gpg_error" = "no"; then
  863    die=yes
  864    AC_MSG_NOTICE([[
  865 ***
  866 *** You need libgpg-error to build this program.
  867 **  This library is for example available at
  868 ***   https://www.gnupg.org/ftp/gcrypt/libgpg-error/
  869 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
  870 ***]])
  871 fi
  872 if test "$have_libassuan" = "no"; then
  873    die=yes
  874    AC_MSG_NOTICE([[
  875 ***
  876 *** You need libassuan to build this program.
  877 *** This library is for example available at
  878 ***   https://www.gnupg.org/ftp/gcrypt/libassuan/
  879 *** (at least version $NEED_LIBASSUAN_VERSION (API $NEED_LIBASSUAN_API) is required).
  880 ***]])
  881 fi
  882 
  883 if test "$die" = "yes"; then
  884     AC_MSG_ERROR([[
  885 ***
  886 *** Required libraries not found. Please consult the above messages
  887 *** and install them before running configure again.
  888 ***]])
  889 fi
  890 
  891 
  892 #
  893 # Create config files
  894 
  895 AC_CONFIG_FILES(Makefile src/Makefile
  896 		tests/Makefile
  897                 tests/gpg/Makefile
  898                 tests/gpgsm/Makefile
  899                 tests/opassuan/Makefile
  900                 tests/json/Makefile
  901 		doc/Makefile
  902                 src/versioninfo.rc
  903                 src/gpgme.pc
  904                 src/gpgme-glib.pc
  905                 src/gpgme.h)
  906 AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config)
  907 AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile)
  908 AC_CONFIG_FILES(lang/cpp/tests/Makefile)
  909 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in)
  910 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig.cmake.in)
  911 AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfigVersion.cmake)
  912 AC_CONFIG_FILES(lang/cpp/src/gpgmepp_version.h)
  913 AC_CONFIG_FILES(lang/qt/Makefile lang/qt/src/Makefile)
  914 AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig-w32.cmake.in)
  915 AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig.cmake.in)
  916 AC_CONFIG_FILES(lang/qt/src/QGpgmeConfigVersion.cmake)
  917 AC_CONFIG_FILES(lang/qt/tests/Makefile)
  918 AC_CONFIG_FILES(lang/qt/src/qgpgme_version.h)
  919 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd])
  920 AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([lang/qt/doc/Doxyfile])])
  921 AC_CONFIG_FILES([lang/js/Makefile lang/js/src/Makefile
  922                  lang/js/BrowserTestExtension/Makefile
  923                  lang/js/DemoExtension/Makefile])
  924 AC_CONFIG_FILES(lang/qt/doc/Makefile)
  925 AC_CONFIG_FILES([lang/python/Makefile
  926 		 lang/python/version.py
  927 		 lang/python/tests/Makefile
  928 		 lang/python/src/Makefile
  929 		 lang/python/examples/Makefile
  930 		 lang/python/doc/Makefile])
  931 AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py])
  932 AC_OUTPUT
  933 
  934 echo "
  935         GPGME v${VERSION} has been configured as follows:
  936 
  937         Revision:          mym4_revision  (mym4_revision_dec)
  938         Platform:          $host
  939 
  940         UI Server:         $uiserver
  941         FD Passing:        $use_descriptor_passing
  942 
  943         Language bindings: ${enabled_languages_v:-$enabled_languages}
  944 "
  945 if test "x${gpg_config_script_warn}" != x; then
  946 cat <<G10EOF
  947         Mismatches between the target platform and the to
  948         be used libraries have been been detected for:
  949          ${gpg_config_script_warn}
  950         Please check above for warning messages.
  951 
  952 G10EOF
  953 fi