1 # configure.ac for libgpg-error
2 # Copyright (C) 2003, 2004, 2006, 2010, 2013 g10 Code GmbH
4 # This file is part of libgpg-error.
6 # libgpg-error is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU Lesser General Public License as
8 # published by the Free Software Foundation; either version 2.1 of the
9 # License, or (at your option) any later version.
11 # libgpg-error is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Lesser General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, see <http://www.gnu.org/licenses/>.
19 # (Process this file with autoconf to produce a configure script.)
20 # The following lines are used by ./autogen.sh.
22 min_automake_version="1.11"
24 # To build a release you need to create a tag with the version number
25 # (git tag -s libgpg-error-n.m) and run "./autogen.sh --force".
26 # Please bump the version number immediately after the release, do
27 # another commit, and a push so that the git magic is able to work.
28 # See below for the LT versions.
29 m4_define([mym4_version_major], [1])
30 m4_define([mym4_version_minor], [13])
32 # Below is m4 magic to extract and compute the revision number, the
33 # decimalized short revision number, a beta version string, and a flag
34 # indicating a development version (mym4_isgit). Note that the m4
35 # processing is done by autoconf and not during the configure run.
36 m4_define([mym4_version], [mym4_version_major.mym4_version_minor])
37 m4_define([mym4_revision],
38 m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
39 m4_define([mym4_revision_dec],
40 m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
41 m4_define([mym4_betastring],
42 m4_esyscmd_s([git describe --match 'libgpg-error-[0-9].*[0-9]' --long|\
43 awk -F- '$4!=0{print"-beta"$4}']))
44 m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
45 m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
47 AC_INIT([libgpg-error],[mym4_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: AGE=0)
53 # Note that added error codes don't constitute an interface change.
54 LIBGPG_ERROR_LT_CURRENT=11
55 LIBGPG_ERROR_LT_AGE=11
56 LIBGPG_ERROR_LT_REVISION=0
57 ################################################
59 AC_SUBST(LIBGPG_ERROR_LT_CURRENT)
60 AC_SUBST(LIBGPG_ERROR_LT_AGE)
61 AC_SUBST(LIBGPG_ERROR_LT_REVISION)
63 VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x00" mym4_version_major \
65 AC_SUBST(VERSION_NUMBER)
67 AC_CONFIG_AUX_DIR([build-aux])
70 AC_CONFIG_SRCDIR([src/err-sources.h.in])
71 AC_CONFIG_HEADER([config.h])
72 AC_CONFIG_MACRO_DIR([m4])
75 # We need to know about the host architecture to avoid spurious
80 # Checks for programs.
85 AC_CHECK_TOOL(AR, ar, :)
88 # Set some internal variables depending on the platform for later use.
109 if test "$have_w32_system" != yes; then
115 LT_INIT([win32-dll disable-static])
116 LT_LANG([Windows Resource])
119 # We need to compile and run a program on the build machine.
120 dnl The AC_PROG_CC_FOR_BUILD macro in the AC archive is broken for
122 dnl AC_PROG_CC_FOR_BUILD
123 AC_MSG_CHECKING(for cc for build)
124 if test "$cross_compiling" = "yes"; then
125 CC_FOR_BUILD="${CC_FOR_BUILD-cc}"
127 CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
129 AC_MSG_RESULT($CC_FOR_BUILD)
130 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
134 /* Force using of NLS for W32 even if no libintl has been found. This is
135 okay because we have our own gettext implementation for W32. */
136 #if defined(HAVE_W32_SYSTEM) && !defined(ENABLE_NLS)
139 /* For building we need to define these macro. */
140 #define GPG_ERR_ENABLE_GETTEXT_MACROS 1
141 #define GPG_ERR_ENABLE_ERRNO_MACROS 1
145 # Note, that autogen.sh greps for the next line.
146 AM_GNU_GETTEXT_VERSION([0.17])
147 AM_GNU_GETTEXT([external])
149 # Checks for header files.
151 AC_CHECK_HEADERS([stdlib.h locale.h])
155 # All versions of Solaris from 2.4 have a thread-safe strerror().
156 # Since Solaris 10, in addition strerror_r() exists.
159 AC_CHECK_FUNC([strerror_r], [],
160 AC_MSG_WARN([[Without strerror_r, gpg_strerror_r might not be thread-safe]]))
164 AC_CHECK_FUNCS([flockfile])
167 # Checks for typedefs, structures, and compiler characteristics.
171 # Check for thread library.
173 # Windows has always thread support; thus we don't bother to test for
174 # it as it may lead to false results when cross building.
175 if test "$have_w32_system" = yes; then
176 AC_DEFINE([USE_WINDOWS_THREADS], [1])
181 THREADLIB_CPPFLAGS=""
182 AC_SUBST([LIBTHREAD])
183 AC_SUBST([LTLIBTHREAD])
184 AC_SUBST([LIBMULTITHREAD])
185 AC_SUBST([LTLIBMULTITHREAD])
188 if test "$gl_threads_api" = posix; then
189 AC_CHECK_SIZEOF(pthread_mutex_t,,[AC_INCLUDES_DEFAULT
190 #include <pthread.h>])
195 # Substitution used for gpg-error-config
196 GPG_ERROR_CONFIG_LIBS="-lgpg-error"
197 if test "x$LIBTHREAD" != x; then
198 GPG_ERROR_CONFIG_LIBS="${GPG_ERROR_CONFIG_LIBS} ${LIBTHREAD}"
200 if test "x$LIBMULTITHREAD" != x; then
201 GPG_ERROR_CONFIG_MT_LIBS="${LIBMULTITHREAD}"
203 GPG_ERROR_CONFIG_MT_LIBS=""
205 GPG_ERROR_CONFIG_CFLAGS=""
206 if test "x$THREADLIB_CPPFLAGS" != x; then
207 GPG_ERROR_CONFIG_MT_CFLAGS="${THREADLIB_CPPFLAGS}"
209 GPG_ERROR_CONFIG_MT_CFLAGS=""
211 GPG_ERROR_CONFIG_ISUBDIRAFTER=""
212 GPG_ERROR_CONFIG_HOST="$host"
213 AC_SUBST(GPG_ERROR_CONFIG_LIBS)
214 AC_SUBST(GPG_ERROR_CONFIG_CFLAGS)
215 AC_SUBST(GPG_ERROR_CONFIG_MT_LIBS)
216 AC_SUBST(GPG_ERROR_CONFIG_MT_CFLAGS)
217 AC_SUBST(GPG_ERROR_CONFIG_ISUBDIRAFTER)
218 AC_SUBST(GPG_ERROR_CONFIG_HOST)
221 # Special defines for certain platforms
222 if test "$have_w32_system" = yes; then
223 AC_DEFINE(HAVE_W32_SYSTEM,1,[Defined if we run on a W32 API based system])
224 if test "$have_w64_system" = yes; then
225 AC_DEFINE(HAVE_W64_SYSTEM,1,[Defined if we run on 64 bit W32 API system])
227 if test "$have_w32ce_system" = yes; then
228 AC_DEFINE(HAVE_W32CE_SYSTEM,1,[Defined if we run on WindowsCE])
229 GPG_ERROR_CONFIG_ISUBDIRAFTER="gpg-extra"
232 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
233 AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
234 AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
235 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
237 AC_DEFINE_UNQUOTED(HOST_TRIPLET_STRING, "$host", [The host triplet])
241 # Provide information about the build.
243 BUILD_REVISION="mym4_revision"
244 AC_SUBST(BUILD_REVISION)
245 AC_DEFINE_UNQUOTED(BUILD_REVISION, "$BUILD_REVISION",
246 [GIT commit id revision used to build this package])
249 BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
251 BUILD_FILEVERSION="${BUILD_FILEVERSION}0,mym4_revision_dec"
252 AC_SUBST(BUILD_FILEVERSION)
254 BUILD_TIMESTAMP=`date -u +%Y-%m-%dT%H:%M+0000 2>/dev/null || date`
255 AC_SUBST(BUILD_TIMESTAMP)
256 AC_DEFINE_UNQUOTED(BUILD_TIMESTAMP, "$BUILD_TIMESTAMP",
257 [The time this package was configured for a build])
261 AC_ARG_ENABLE(languages,
262 [ --disable-languages do not build support for other languages than C])
263 AM_CONDITIONAL([LANGUAGES_SOME], [test "x$enable_languages" != xno])
267 AC_CONFIG_FILES([Makefile])
268 AC_CONFIG_FILES([po/Makefile.in m4/Makefile])
269 AC_CONFIG_FILES([src/Makefile tests/Makefile])
270 AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpg-error.asd])
271 AC_CONFIG_FILES([src/versioninfo.rc])
272 AC_CONFIG_FILES([src/gpg-error-config], [chmod +x src/gpg-error-config])
277 $PACKAGE_NAME-$PACKAGE_VERSION prepared for make
279 Revision: mym4_revision (mym4_revision_dec)