Make mime-send UI support optional.
[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.9.4"
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], [1.2.2])
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.1.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_SRCDIR(src/gpgol.def)
55 AM_CONFIG_HEADER(config.h)
56 AC_CANONICAL_TARGET()
57 AM_INIT_AUTOMAKE
58
59 AC_GNU_SOURCE
60
61 have_gpg_error=no
62 have_libassuan=no
63
64 AC_SUBST(PACKAGE)
65 AC_SUBST(PACKAGE_GT)
66 AC_SUBST(VERSION)
67 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package])
68 AC_DEFINE_UNQUOTED(PACKAGE_GT, "$PACKAGE_GT",
69                                 [Name of this package for gettext])
70 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package])
71 AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "$PACKAGE_BUGREPORT",
72                                         [Bug report address])
73 AC_DEFINE_UNQUOTED(NEED_GPGME_VERSION, "$NEED_GPGME_VERSION",
74                                        [Required version of GPGME])
75 AC_DEFINE_UNQUOTED(GIT_COMMIT, ${GIT_COMMIT}, [Current GIT commit])
76 AC_DEFINE_UNQUOTED(GPGOL_FORMS_REVISION, ${GPGOL_FORMS_REVISION},
77                                           [Current Forms revision])
78
79
80 BUILD_TIMESTAMP=`date --iso-8601=minutes`
81 AC_SUBST(BUILD_TIMESTAMP)
82 changequote(,)dnl
83 BUILD_FILEVERSION=`echo "$VERSION" | sed 's/\([0-9.]*\).*/\1./;s/\./,/g'`
84 changequote([,])dnl
85 BUILD_FILEVERSION="${BUILD_FILEVERSION}${GIT_COMMIT_DECIMAL}"
86 AC_SUBST(BUILD_FILEVERSION)
87
88
89 AH_BOTTOM([
90 /* Some global constants. */
91
92 /* Force using of NLS for W32 even if no libintl has been found.  This is
93    okay because we have our own gettext implementation for W32.  */
94 #if defined(HAVE_W32_SYSTEM) && !defined(ENABLE_NLS)
95 #define ENABLE_NLS 1
96 #endif
97 ])
98
99 AM_MAINTAINER_MODE
100
101 # Checks for programs.
102 AC_PROG_MAKE_SET
103 AM_SANITY_CHECK
104 missing_dir=`cd $ac_aux_dir && pwd`
105 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
106 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
107 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
108 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
109 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
110 AC_PROG_AWK
111 AC_PROG_CC
112 AC_PROG_CPP
113 AC_PROG_CXX
114 AC_PROG_INSTALL
115 AC_PROG_LN_S
116 AC_PROG_MAKE_SET
117 AC_PROG_RANLIB
118 AC_CHECK_TOOL(AR, ar, :)
119 AC_CHECK_TOOL(DLLTOOL, dlltool, :)
120 AC_CHECK_TOOL(WINDRES, windres, :)
121
122
123 have_dosish_system=no
124 have_w32_system=no
125 case "${host}" in
126     *-mingw32*)
127         # special stuff for Windoze NT
128         ac_cv_have_dev_random=no
129         AC_DEFINE(USE_ONLY_8DOT3,1,
130                   [set this to limit filenames to the 8.3 format])
131         AC_DEFINE(HAVE_DRIVE_LETTERS,1,
132                   [defined if we must run on a stupid file system])
133         have_dosish_system=yes
134         have_w32_system=yes
135         ;;
136     *)
137     AC_MSG_ERROR([[
138 ***
139 *** This software my only be build for W32 systems.  Use
140 ***     ./autogen.sh --build-w32
141 *** to prepare it for such a build.
142 ***]])
143        ;;
144 esac
145
146 if test "$have_dosish_system" = yes; then
147    AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
148              [Defined if we run on some of the PCDOS like systems
149               (DOS, Windoze. OS/2) with special properties like
150               no file modes])
151 fi
152 AM_CONDITIONAL(HAVE_DOSISH_SYSTEM, test "$have_dosish_system" = yes)
153
154 if test "$have_w32_system" = yes; then
155    AC_DEFINE(HAVE_W32_SYSTEM,1, [Defined if we run on a W32 API based system])
156 fi
157 AM_CONDITIONAL(HAVE_W32_SYSTEM, test "$have_w32_system" = yes)
158
159
160
161 #
162 # Checks for libraries.
163 #
164
165
166 AM_PATH_GPGME("$NEED_GPGME_API:$NEED_GPGME_VERSION",
167                have_gpgme=yes,have_gpgme=no)
168 AM_PATH_GPG_ERROR("$NEED_GPG_ERROR_VERSION",
169                   have_gpg_error=yes,have_gpg_error=no)
170 AC_DEFINE(GPG_ERR_SOURCE_DEFAULT, GPG_ERR_SOURCE_USER_2,
171           [The default error source for GpgOL.])
172 AM_PATH_LIBASSUAN("$NEED_LIBASSUAN_API:$NEED_LIBASSUAN_VERSION",
173                   have_libassuan=yes,have_libassuan=no)
174
175
176 # Note, that autogen.sh greps for the next line.
177 AM_GNU_GETTEXT_VERSION(0.12.1)
178 AM_GNU_GETTEXT([external])
179 # We always want NLs, despite what the above macro figures out.
180 USE_NLS=yes
181
182 # Checks for header files.
183 AC_HEADER_STDC
184 AC_CHECK_HEADERS(string.h unistd.h langinfo.h termio.h locale.h)
185
186 # Checks for typedefs, structures, and compiler characteristics.
187 AC_C_CONST
188 AC_C_INLINE
189 AC_TYPE_SIZE_T
190 AC_TYPE_SIGNAL
191
192 AM_CONDITIONAL(CROSS_COMPILING, test x$cross_compiling = xyes)
193
194 # Add some extra libs here so that previous tests don't fail for
195 # mysterious reasons - the final link step should bail out.
196 if test "$have_w32_system" = yes; then
197    W32LIBS="-lwsock32"
198 fi
199
200 if test "$GCC" = yes; then
201     CFLAGS="$CFLAGS -Wall -mms-bitfields -fno-strict-aliasing"
202     CXXFLAGS="$CXXFLAGS -Wall -mms-bitfields -fno-strict-aliasing"
203     if test "$USE_MAINTAINER_MODE" = "yes"; then
204         CFLAGS="$CFLAGS -Werror -Wcast-align -Wshadow -Wstrict-prototypes"
205         CFLAGS="$CFLAGS -Wno-format-y2k -Wformat-security"
206         CFLAGS="$CFLAGS -W -Wno-sign-compare"
207         CXXFLAGS="$CXXFLAGS -Werror -Wcast-align -Wshadow"
208         CXXFLAGS="$CXXFLAGS -Wno-format-y2k -Wformat-security"
209         CXXFLAGS="$CXXFLAGS -W -Wno-sign-compare"
210         AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
211         _gcc_cflags_save=$CFLAGS
212         CFLAGS="-Wno-missing-field-initializers"
213         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_mfi=yes,_gcc_mfi=no)
214         AC_MSG_RESULT($_gcc_mfi)
215         CFLAGS=$_gcc_cflags_save;
216         if test x"$_gcc_mfi" = xyes ; then
217           CFLAGS="$CFLAGS -Wno-missing-field-initializers"
218           CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers"
219         fi
220     fi
221
222     AC_MSG_CHECKING([if gcc supports -Wno-pointer-sign])
223     _gcc_cflags_save=$CFLAGS
224     CFLAGS="-Wno-pointer-sign"
225     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],_gcc_psign=yes,_gcc_psign=no)
226     AC_MSG_RESULT($_gcc_psign)
227     CFLAGS=$_gcc_cflags_save;
228     if test x"$_gcc_psign" = xyes ; then
229        CFLAGS="$CFLAGS -Wno-pointer-sign"
230     fi
231
232
233 fi
234
235 AC_SUBST(W32LIBS)
236
237 #
238 # This should be a temporary option that will eventually become the
239 # default.
240 #
241 AC_ARG_ENABLE(mime-send,
242             AC_HELP_STRING([--enable-mime-send], [Enable experimental send support for mime messages]),
243             mime_send=$enableval, mime_send=no)
244 if test "$mime_send" != "no"; then
245   AC_DEFINE(MIME_SEND, 1,
246    [Sending Mime messages will be supported.])
247 fi
248
249 #
250 # Print errors here so that they are visible all
251 # together and the user can acquire them all together.
252 #
253 die=no
254 if test "$have_gpg_error" = "no"; then
255    die=yes
256    AC_MSG_NOTICE([[
257 ***
258 *** You need libgpg-error to build this program.
259 **  This library is for example available at
260 ***   ftp://ftp.gnupg.org/pub/gcrypt/libgpg-error
261 *** (at least version $NEED_GPG_ERROR_VERSION is required.)
262 ***]])
263 fi
264 if test "$have_gpgme" = "no"; then
265    die=yes
266    AC_MSG_NOTICE([[
267 ***
268 *** You need gpgme to build this program.
269 **  This library is for example available at
270 ***   ftp://ftp.gnupg.org/gcrypt/gpgme/
271 *** (at least version $NEED_GPGME_VERSION is required.)
272 ***]])
273 fi
274 if test "$have_libassuan" = "no"; then
275    die=yes
276    AC_MSG_NOTICE([[
277 ***
278 *** You need libassuan to build this program.
279 *** This library is for example available at
280 ***   ftp://ftp.gnupg.org/pub/gcrypt/libassuan/
281 *** (at least version $NEED_LIBASSUAN_VERSION is required).
282 ***]])
283 fi
284 if test "$die" = "yes"; then
285     AC_MSG_ERROR([[
286 ***
287 *** Required libraries not found. Please consult the above messages
288 *** and install them before running configure again.
289 ***]])
290 fi
291
292
293 AC_CONFIG_FILES([ Makefile
294 src/Makefile
295 src/versioninfo.rc
296 forms/Makefile
297 doc/Makefile
298 po/Makefile.in
299 m4/Makefile
300 ])
301 AC_OUTPUT