Post release version bump
[gpgol.git] / configure.ac
1 # configure.ac - for GpgOL
2 # Copyright (C) 2005, 2006, 2007, 2008, 2011 g10 Code GmbH
3 #
4 # This file is free software; as a special exception the author gives
5 # unlimited permission to copy and/or distribute it, with or without
6 # modifications, as long as this notice is preserved.
7 #
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
10 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
12 # Process this file with autoconf to produce a configure script.
13 AC_PREREQ(2.59)
14 min_automake_version="1.14"
15
16 # To build a release you need to create a tag with the version number
17 # (git tag -s gpgol-k.n.m) and run "./autogen.sh --force".  Please
18 # bump the version number immediately *after* the release and do
19 # another commit and push so that the git magic is able to work.
20 m4_define([mym4_version], [2.0.3])
21
22 # Below is m4 magic to extract and compute the git revision number,
23 # the decimalized short revision number, a beta version string and a
24 # flag indicating a development version (mym4_isgit).  Note that the
25 # m4 processing is done by autoconf and not during the configure run.
26 m4_define([mym4_revision],
27           m4_esyscmd([git rev-parse --short HEAD | tr -d '\n\r']))
28 m4_define([mym4_revision_dec],
29           m4_esyscmd_s([echo $((0x$(echo ]mym4_revision[|head -c 4)))]))
30 m4_define([mym4_betastring],
31           m4_esyscmd_s([git describe --match 'gpgol-[0-9].[0-9].*[0-9]' \
32                          --long | awk -F- '$3!=0{print"-beta"$3}']))
33 m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes]))
34 m4_define([mym4_full_version],[mym4_version[]mym4_betastring])
35
36 AC_INIT([gpgol],[mym4_full_version], [http://bugs.gnupg.org])
37
38 # Bump up this value if you changed any form.
39 GPGOL_FORMS_REVISION=335
40
41 NEED_GPG_ERROR_VERSION=1.9
42 NEED_GPGME_API=1
43 NEED_GPGME_VERSION=1.9.0
44 NEED_LIBASSUAN_API=2
45 NEED_LIBASSUAN_VERSION=2.0.0
46
47
48 GIT_COMMIT=0x[]mym4_revision
49 GIT_COMMIT_DECIMAL=0x[]mym4_revision_dec
50 PACKAGE=$PACKAGE_NAME
51 PACKAGE_GT=${PACKAGE_NAME}
52 VERSION=$PACKAGE_VERSION
53
54 AC_CONFIG_AUX_DIR([build-aux])
55 AC_CONFIG_SRCDIR(src/gpgol.def)
56 AM_CONFIG_HEADER(config.h)
57 AC_CANONICAL_TARGET()
58 AM_INIT_AUTOMAKE
59
60 AC_GNU_SOURCE
61
62 have_gpg_error=no
63 have_libassuan=no
64
65 AC_SUBST(PACKAGE)
66 AC_SUBST(PACKAGE_GT)
67 AC_SUBST(VERSION)
68 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
69 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
70                                 [Name of this package for gettext])
71 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
72 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
73                                         [Bug report address])
74 AC_DEFINE_UNQUOTED(NEED_GPGME_VERSION, "$NEED_GPGME_VERSION",
75                                        [Required version of GPGME])
76 AC_DEFINE_UNQUOTED(GIT_COMMIT, ${GIT_COMMIT}, [Current GIT commit])
77 AC_DEFINE_UNQUOTED(GPGOL_FORMS_REVISION, ${GPGOL_FORMS_REVISION},
78                                           [Current Forms revision])
79
80
81 BUILD_TIMESTAMP=`date --iso-8601=minutes`
82 AC_SUBST(BUILD_TIMESTAMP)
83 changequote(,)dnl
84 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
85 changequote([,])dnl
86 BUILD_FILEVERSION="${BUILD_FILEVERSION}${GIT_COMMIT_DECIMAL}"
87 AC_SUBST(BUILD_FILEVERSION)
88
89
90 AH_BOTTOM([
91 /* Some global constants. */
92
93 /* Force using of NLS for W32 even if no libintl has been found.  This is
94    okay because we have our own gettext implementation for W32.  */
95 #if defined(HAVE_W32_SYSTEM) && !defined(ENABLE_NLS)
96 #define ENABLE_NLS 1
97 #endif
98 ])
99
100 AM_MAINTAINER_MODE
101
102 # Checks for programs.
103 AC_PROG_MAKE_SET
104 AM_SANITY_CHECK
105 missing_dir=`cd $ac_aux_dir && pwd`
106 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
107 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
108 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
109 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
110 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
111 AC_PROG_AWK
112 AC_PROG_CC
113 AC_PROG_CPP
114 AC_PROG_CXX
115 AC_PROG_INSTALL
116 AC_PROG_LN_S
117 AC_PROG_MAKE_SET
118 AC_PROG_RANLIB
119 AC_CHECK_TOOL(AR, ar, :)
120 AC_CHECK_TOOL(DLLTOOL, dlltool, :)
121 AC_CHECK_TOOL(WINDRES, windres, :)
122
123
124 have_dosish_system=no
125 have_w32_system=no
126 case "${host}" in
127     *-mingw32*)
128         # special stuff for Windoze NT
129         ac_cv_have_dev_random=no
130         AC_DEFINE(USE_ONLY_8DOT3,1,
131                   [set this to limit filenames to the 8.3 format])
132         AC_DEFINE(HAVE_DRIVE_LETTERS,1,
133                   [defined if we must run on a stupid file system])
134         have_dosish_system=yes
135         have_w32_system=yes
136         ;;
137     *)
138     AC_MSG_NOTICE([[
139 ***
140 *** This software is only useful for W32 systems.  Use
141 ***     ./autogen.sh --build-w32
142 *** to prepare it for such a build.
143 ***
144 *** For your current host only tests will be built!
145 ***]])
146        ;;
147 esac
148
149 if test "$have_dosish_system" = yes; then
150    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
151              [Defined if we run on some of the PCDOS like systems
152               (DOS, Windoze. OS/2) with special properties like
153               no file modes])
154 fi
155 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
156
157 if test "$have_w32_system" = yes; then
158    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
159 fi
160 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
161
162 AM_CONDITIONAL(BUILD_W64, test "$host" = "x86_64-w64-mingw32")
163
164 #
165 # Checks for libraries.
166 #
167
168
169 AM_PATH_GPGME("$NEED_GPGME_API:$NEED_GPGME_VERSION",
170                have_gpgme=yes,have_gpgme=no)
171 AM_PATH_GPGMEPP(have_gpgmepp=yes,have_gpgmepp=no)
172 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
173                   have_gpg_error=yes,have_gpg_error=no)
174 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_USER_2,
175           [The default error source for GpgOL.])
176 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
177                   have_libassuan=yes,have_libassuan=no)
178
179
180 # Note, that autogen.sh greps for the next line.
181 AM_GNU_GETTEXT_VERSION([0.12.1])
182 AM_GNU_GETTEXT([external])
183 # We always want NLs, despite what the above macro figures out.
184 USE_NLS=yes
185
186 # Checks for header files.
187 AC_HEADER_STDC
188 AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h)
189
190 # Check for functions
191 AC_REPLACE_FUNCS(stpcpy)
192
193 # Checks for typedefs, structures, and compiler characteristics.
194 AC_C_CONST
195 AC_C_INLINE
196 AC_TYPE_SIZE_T
197 AC_TYPE_SIGNAL
198
199 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
200
201 # Add some extra libs here so that previous tests don't fail for
202 # mysterious reasons - the final link step should bail out.
203 if test "$have_w32_system" = yes; then
204    W32LIBS="-lwsock32"
205 fi
206
207 if test "$GCC" = yes; then
208     CFLAGS="$CFLAGS -Wall -mms-bitfields -fno-strict-aliasing"
209     CXXFLAGS="$CXXFLAGS -Wall -mms-bitfields -fno-strict-aliasing"
210     # Hardening flags
211     # Stack protection
212     # -fstack-protector-all -Wstack-protector --param ssp-buffer-size=4
213     # causes gpgol not to be loaded by Outlook due to a runtime error.
214     # This needs to be analysed but could be an incompatibility between
215     # gcc's stack protection and COM / Outlook system calls.
216     if test "$have_w32_system" = yes; then
217         HARDENING="-Wl,--dynamicbase -Wl,--nxcompat -fno-exceptions -D_FORTIFY_SOURCE=2 -O0"
218     else
219         HARDENING="-fPIC"
220     fi
221     CFLAGS="$CFLAGS $HARDENING"
222     CXXFLAGS="$CXXFLAGS $HARDENING"
223
224     if test "$USE_MAINTAINER_MODE" = "yes"; then
225         CFLAGS="$CFLAGS -Werror -Wcast-align -Wshadow -Wstrict-prototypes"
226         CFLAGS="$CFLAGS -Wformat-security"
227         CFLAGS="$CFLAGS -W -Wno-sign-compare"
228         CXXFLAGS="$CXXFLAGS -Werror -Wcast-align -Wshadow"
229         CXXFLAGS="$CXXFLAGS -Wformat-security"
230         CXXFLAGS="$CXXFLAGS -W -Wno-sign-compare"
231     fi
232
233     AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
234     _gcc_cflags_save=$CFLAGS
235     CFLAGS="-Wno-pointer-sign"
236     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
237     AC_MSG_RESULT($_gcc_psign)
238     CFLAGS=$_gcc_cflags_save;
239     if test x"$_gcc_psign" = xyes ; then
240        CFLAGS="$CFLAGS -Wno-pointer-sign"
241     fi
242
243
244 fi
245
246 AC_SUBST(W32LIBS)
247
248 #
249 # This should be a temporary option that will eventually become the
250 # default.
251 #
252 AC_ARG_ENABLE(mime-send,
253             AC_HELP_STRING([--enable-mime-send], [Enable experimental send support for mime messages]),
254             mime_send=$enableval, mime_send=no)
255 if test "$mime_send" != "no"; then
256   AC_DEFINE(MIME_SEND, 1,
257    [Sending Mime messages will be supported.])
258 fi
259
260 #
261 # Print errors here so that they are visible all
262 # together and the user can acquire them all together.
263 #
264 die=no
265 if test "$have_gpg_error" = "no"; then
266    die=yes
267    AC_MSG_NOTICE([[
268 ***
269 *** You need libgpg-error to build this program.
270 **  This library is for example available at
271 ***   ftp://ftp.gnupg.org/pub/gcrypt/libgpg-error
272 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
273 ***]])
274 fi
275 if test "$have_gpgme" = "no"; then
276    die=yes
277    AC_MSG_NOTICE([[
278 ***
279 *** You need gpgme to build this program.
280 **  This library is for example available at
281 ***   ftp://ftp.gnupg.org/gcrypt/gpgme/
282 *** (at least version $NEED_GPGME_VERSION is required.)
283 ***]])
284 fi
285 if test "$have_gpgmepp" = "no"; then
286    die=yes
287    AC_MSG_NOTICE([[
288 ***
289 *** You need the C++ language binding for gpgme to build this program.
290 ** Ensure that GPGME was compiled with --enabled-languages=cpp
291 ***]])
292 fi
293 if test "$have_libassuan" = "no"; then
294    die=yes
295    AC_MSG_NOTICE([[
296 ***
297 *** You need libassuan to build this program.
298 *** This library is for example available at
299 ***   ftp://ftp.gnupg.org/pub/gcrypt/libassuan/
300 *** (at least version $NEED_LIBASSUAN_VERSION is required).
301 ***]])
302 fi
303 if test "$die" = "yes"; then
304     AC_MSG_ERROR([[
305 ***
306 *** Required libraries not found. Please consult the above messages
307 *** and install them before running configure again.
308 ***]])
309 fi
310
311
312 AC_CONFIG_FILES([ Makefile
313 src/Makefile
314 src/icons/Makefile
315 src/versioninfo.rc
316 forms/Makefile
317 doc/Makefile
318 po/Makefile.in
319 m4/Makefile
320 tests/Makefile
321 ])
322
323 AC_OUTPUT