Update package groups
[platform/upstream/libgpg-error.git] / configure.ac
1 # configure.ac for libgpg-error
2 # Copyright (C) 2003, 2004, 2006, 2010, 2013 g10 Code GmbH
3 #
4 # This file is part of libgpg-error.
5 #
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.
10 #
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.
15 #
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/>.
18
19 # (Process this file with autoconf to produce a configure script.)
20 # The following lines are used by ./autogen.sh.
21 AC_PREREQ(2.59)
22 min_automake_version="1.11"
23
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])
31
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])
46
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 ################################################
58
59 AC_SUBST(LIBGPG_ERROR_LT_CURRENT)
60 AC_SUBST(LIBGPG_ERROR_LT_AGE)
61 AC_SUBST(LIBGPG_ERROR_LT_REVISION)
62
63 VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x00" mym4_version_major \
64                           mym4_version_minor)
65 AC_SUBST(VERSION_NUMBER)
66
67 AC_CONFIG_AUX_DIR([build-aux])
68 AM_INIT_AUTOMAKE
69 AM_MAINTAINER_MODE
70 AC_CONFIG_SRCDIR([src/err-sources.h.in])
71 AC_CONFIG_HEADER([config.h])
72 AC_CONFIG_MACRO_DIR([m4])
73 AM_SILENT_RULES
74
75 # We need to know about the host architecture to avoid spurious
76 # warnings.
77 AC_CANONICAL_HOST
78 AB_INIT
79
80 # Checks for programs.
81 AC_PROG_CC
82 AM_PROG_CC_C_O
83 AC_PROG_CPP
84 AC_PROG_AWK
85 AC_CHECK_TOOL(AR, ar, :)
86 AC_GNU_SOURCE
87
88 # Set some internal variables depending on the platform for later use.
89 have_w32_system=no
90 have_w64_system=no
91 have_w32ce_system=no
92 case "${host}" in
93     x86_64-*mingw32*)
94         have_w32_system=yes
95         have_w64_system=yes
96         ;;
97     *-mingw32ce*)
98         have_w32_system=yes
99         have_w32ce_system=yes
100         ;;
101     *-mingw32*)
102         have_w32_system=yes
103         ;;
104     *)
105        ;;
106 esac
107
108
109 if test "$have_w32_system" != yes; then
110   gl_THREADLIB_EARLY
111 fi
112
113
114 LT_PREREQ([2.2.6])
115 LT_INIT([win32-dll disable-static])
116 LT_LANG([Windows Resource])
117
118
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
121 dnl autoconf 2.57.
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}"
126 else
127   CC_FOR_BUILD="${CC_FOR_BUILD-$CC}"
128 fi
129 AC_MSG_RESULT($CC_FOR_BUILD)
130 AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
131
132
133 AH_BOTTOM([
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)
137 #define ENABLE_NLS 1
138 #endif
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
142 ])
143
144
145 # Note, that autogen.sh greps for the next line.
146 AM_GNU_GETTEXT_VERSION([0.17])
147 AM_GNU_GETTEXT([external])
148
149 # Checks for header files.
150 AC_HEADER_STDC
151 AC_CHECK_HEADERS([stdlib.h locale.h])
152 AC_FUNC_STRERROR_R
153 case "${host_os}" in
154      solaris*)
155      # All versions of Solaris from 2.4 have a thread-safe strerror().
156      # Since Solaris 10, in addition strerror_r() exists.
157      ;;
158      *)
159      AC_CHECK_FUNC([strerror_r], [],
160 AC_MSG_WARN([[Without strerror_r, gpg_strerror_r might not be thread-safe]]))
161      ;;
162 esac
163
164 AC_CHECK_FUNCS([flockfile])
165
166
167 # Checks for typedefs, structures, and compiler characteristics.
168 AC_C_CONST
169
170
171 # Check for thread library.
172 #
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])
177   LIBTHREAD=
178   LTLIBTHREAD=
179   LIBMULTITHREAD=
180   LTLIBMULTITHREAD=
181   THREADLIB_CPPFLAGS=""
182   AC_SUBST([LIBTHREAD])
183   AC_SUBST([LTLIBTHREAD])
184   AC_SUBST([LIBMULTITHREAD])
185   AC_SUBST([LTLIBMULTITHREAD])
186 else
187   gl_LOCK
188   if test "$gl_threads_api" = posix; then
189     AC_CHECK_SIZEOF(pthread_mutex_t,,[AC_INCLUDES_DEFAULT
190                                       #include <pthread.h>])
191   fi
192 fi
193
194
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}"
199 fi
200 if test "x$LIBMULTITHREAD" != x; then
201   GPG_ERROR_CONFIG_MT_LIBS="${LIBMULTITHREAD}"
202 else
203   GPG_ERROR_CONFIG_MT_LIBS=""
204 fi
205 GPG_ERROR_CONFIG_CFLAGS=""
206 if test "x$THREADLIB_CPPFLAGS" != x; then
207   GPG_ERROR_CONFIG_MT_CFLAGS="${THREADLIB_CPPFLAGS}"
208 else
209   GPG_ERROR_CONFIG_MT_CFLAGS=""
210 fi
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)
219
220
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])
226     fi
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"
230     fi
231 fi
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)
236
237 AC_DEFINE_UNQUOTED(HOST_TRIPLET_STRING, "$host", [The host triplet])
238
239
240 #
241 # Provide information about the build.
242 #
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])
247
248 changequote(,)dnl
249 BUILD_FILEVERSION=`echo "$PACKAGE_VERSION"|sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
250 changequote([,])dnl
251 BUILD_FILEVERSION="${BUILD_FILEVERSION}0,mym4_revision_dec"
252 AC_SUBST(BUILD_FILEVERSION)
253
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])
258
259
260
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])
264
265
266 # Substitution
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])
273
274 AC_OUTPUT
275
276 echo "
277         $PACKAGE_NAME-$PACKAGE_VERSION prepared for make
278
279         Revision: mym4_revision  (mym4_revision_dec)
280         Platform: $host
281
282 "