Feature #2972823: fail on in-line variable declarations
[siplcs.git] / configure.ac
blob13998d69d396f1e483967d7c3467e6429cfe9e1d
1 dnl ensure recent enough version of Autoconf
2 AC_PREREQ([2.50])
4 dnl Use `VERSION' files to get version.
5 m4_define([SIPE_VERSION_DATA], m4_include([VERSION]))
7 dnl Strip off newline characters.
8 m4_define([SIPE_VERSION],
9           m4_substr(SIPE_VERSION_DATA,
10                     [0], m4_decr(m4_len(SIPE_VERSION_DATA))))
12 dnl homepage
13 m4_define([SIPE_HOMEPAGE], [http://sipe.sourceforge.net/])
15 dnl initialize package name, version, bugtracker & homepage
16 AC_INIT([pidgin-sipe], SIPE_VERSION,
17         [https://sourceforge.net/tracker/?atid=949931&group_id=194563], [],
18         SIPE_HOMEPAGE)
20 dnl setup automake and require recent enough version
21 AM_INIT_AUTOMAKE([1.9 dist-bzip2 no-define tar-ustar])
23 dnl set PACKAGE_URL for autoconf < 2.64
24 if test "x${PACKAGE_URL}" = "x"; then
25         AC_MSG_NOTICE([set PACKAGE_URL for autoconf < 2.64])
26         AC_DEFINE(PACKAGE_URL, "SIPE_HOMEPAGE",
27                   [Define to the home page for this package.])
30 dnl set programming language
31 AC_LANG(C)
32 AM_PROG_CC_C_O
33 AC_HEADER_STDC
35 dnl setup shared library generation
36 LT_INIT([disable-static])
38 dnl checks for tools
39 IT_PROG_INTLTOOL([0.35.0])
40 AC_PROG_INSTALL
41 AC_PROG_RANLIB
43 dnl checks for library functions
44 AC_CHECK_FUNCS([setenv unsetenv])
46 dnl tell pkgconfig to look in the same prefix where we're installing this to,
47 dnl as that is likely where libpurple will be found if it is not in the default
48 dnl pkgconfig path
49 PREFIX=$ac_default_prefix
50 if test "$prefix" != "NONE"; then
51         PREFIX=$prefix
54 PKG_CONFIG_PATH="$PKG_CONFIG_PATH":"$PREFIX/lib/pkgconfig"
55 export PKG_CONFIG_PATH
57 dnl debug mode
58 AC_ARG_ENABLE(debug,
59         [AS_HELP_STRING([--enable-debug],
60                         [compile with debugging support [default=no]])],
61         ,
62         enable_debug="no")
64 if test "$enable_debug" = yes; then
65    AC_DEFINE(DEBUG, 1, [Define if debugging is enabled.])
68 DEBUG_CFLAGS="${DEBUG_CFLAGS}"
69 AC_SUBST(DEBUG_CFLAGS)
71 dnl quality check mode
72 dnl For people who are interested in finding bugs and not hiding them
73 AC_ARG_ENABLE(quality-check,
74         [AS_HELP_STRING([--enable-quality-check],
75                         [compile with compiler checks enabled [default=yes]])],
76         ,
77         enable_quality_check="yes")
79 dnl declaration-after-statement (ISO C90 behaviour, as on Windows & GCC < 3)
80 if test "$enable_quality_check" = yes; then
81         QUALITY_CFLAGS="${QUALITY_CFLAGS} -Werror -Wall -Wextra -Werror=declaration-after-statement"
82 else
83         QUALITY_CFLAGS="${QUALITY_CFLAGS}"
85 AC_SUBST(QUALITY_CFLAGS)
87 dnl Check for pkg-config before using it
88 PKG_PROG_PKG_CONFIG
90 AC_ARG_WITH([krb5],
91         [AC_HELP_STRING([--with-krb5=PREFIX],
92                 [compile sipe plugin with Kerberos 5 support @<:@default=no@:>@])],
93         [test "$withval" = "no" || kerberos="$withval"],
94         [kerberos="no"])
96 dnl check for Kerberos
97 AC_SUBST(KRB5_CFLAGS)
98 AC_SUBST(KRB5_LDFLAGS)
99 AC_SUBST(KRB5_LIBS)
101 AM_CONDITIONAL(SIP_SEC_KRB5, test "$kerberos" != "no")
102 if test "$kerberos" != "no" ; then
103         if test "$kerberos" != "yes" ; then
104                 KRB5_CFLAGS="-I${kerberos}/include"
105                 KRB5_LDFLAGS="-L${kerberos}/lib"
106         fi
107         orig_LDFLAGS="$LDFLAGS"
108         LDFLAGS="$LDFLAGS $KRB5_LDFLAGS"
109         AC_CHECK_LIB(krb5, krb5_rd_req,
110                         [KRB5_LIBS="-lkrb5"],
111                         [AC_CHECK_LIB(krb5, krb5_rd_req,
112                                 [KRB5_LIBS="-lkrb5"],
113                                 [AC_ERROR(Kerberos 5 libraries not found)],
114                                 )],
115                         -lkrb5)
116         AC_CHECK_LIB(gssapi_krb5, gss_krb5_export_lucid_sec_context,
117                         [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
118                         [AC_CHECK_LIB(gssapi, gss_krb5_export_lucid_sec_context,
119                                 [KRB5_LIBS="$KRB5_LIBS -lgssapi_krb5"],
120                                 [AC_ERROR(GSSAPI libraries not found)],
121                                 )],
122                         -lgssapi_krb5)
123         savedLIBS="$LIBS"
124         LIBS="$KRB5_LIBS $LIBS"
125         AC_CHECK_FUNCS([krb5_get_error_message])
126         LIBS="$savedLIBS"
127         AC_DEFINE(HAVE_KERBEROS, 1, [Define if kerberos should be used in sipe.])
130 dnl check for glib
131 PKG_CHECK_MODULES(GLIB, [glib-2.0])
133 dnl check for libxml2
134 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0])
136 dnl assumption check: sizof(uuid_t) must be 16 (see uuid.c)
137 AC_MSG_CHECKING([that sizeof(uuid_t) is 16])
138 ac_save_CFLAGS=$CFLAGS
139 CFLAGS="$GLIB_CFLAGS -Werror -Wall -Wextra"
140 dnl note the [[[ quoting: our code contains []!
141 AC_RUN_IFELSE(
142         AC_LANG_PROGRAM(
143                 [[[
144 #include <glib.h>
145 #include <stdio.h>
147 /* Copied from uuid.c */
148 typedef struct {
149    guint32 time_low;
150    guint16 time_mid;
151    guint16 time_hi_and_version;
152    guint8  clock_seq_hi_and_reserved;
153    guint8  clock_seq_low;
154    guint8  node[6];
155 } uuid_t;
156                 ]]],
157                 [return(sizeof(uuid_t) == 16 ? 0 : 1);]),
158         [AC_MSG_RESULT(yes)],
159         [AC_MSG_RESULT(failed)
160          AC_ERROR(sizeof(uuid_t) is not 16
162 Please notify the SIPE developers and provide the following information:
164  host:     $host
165  build:    $build
166  compiler: $CC
168 CFLAGS=$ac_save_CFLAGS
170 dnl check for libpurple
171 purple="yes"
172 AC_ARG_WITH([purple],
173         [AC_HELP_STRING([--with-purple],
174                 [compile sipe plugin for libpurple clients @<:@default=autodetect@:>@])],
175         [test "$withval" = "yes" || purple="no"],
176         [])
177 if test "$purple" != "no"; then
178         PKG_CHECK_MODULES(PURPLE, [purple >= 2.4.0],
179                 [],
180                 [purple="no"])
183 dnl support for libpurple plugin
184 AM_CONDITIONAL(SIPE_INCLUDE_PURPLE, test "$purple" != "no")
185 if test "$purple" != "no"; then
187         dnl unfortunately PURPLE_MAJOR_VERSION is not exported by purple.m4
188         PURPLE_MAJOR_VERSION=`$PKG_CONFIG --modversion purple | cut -d. -f 1`
189         AC_SUBST(PURPLE_MAJOR_VERSION)
191         dnl let user now if he has a 32- and 64-bit header conflict...
192         AC_MSG_CHECKING([for 32- and 64-bit header conflicts])
193         ac_save_CFLAGS=$CFLAGS
194         CFLAGS="$PURPLE_CFLAGS -Werror -Wall -Wextra"
195         AC_COMPILE_IFELSE(
196                 AC_LANG_PROGRAM(
197                         [
198 #include <glib.h>
199 #include <cipher.h>
201 /* Compile some code that has caused trouble in the past */
202 void testfunc(unsigned long len)
204   PurpleCipherContext *rc4 = NULL;
205   purple_cipher_context_set_option(rc4, "key_len", GUINT_TO_POINTER(len));
207                         ],
208                         [testfunc(16);]),
209                 [AC_MSG_RESULT(none)],
210                 [AC_MSG_RESULT(failed)
211                  AC_ERROR(conflicts found.
213 Check that you have the correct glib/libpurple headers installed for
214 your architecture or set PURPLE_CFLAGS to override the system defaults.
216         CFLAGS=$ac_save_CFLAGS
219 dnl check for telepathy
220 telepathy="yes"
221 AC_ARG_WITH([telepathy],
222         [AC_HELP_STRING([--with-telepathy],
223                 [compile sipe plugin for telepathy clients @<:@default=autodetect@:>@])],
224         [test "$withval" = "yes" || telepathy="no"],
225         [])
226 if test "$telepathy" != "no"; then
227         PKG_CHECK_MODULES(TELEPATHY, [telepathy-glib],
228                 [],
229                 [telepathy="no"])
232 dnl support for telepathy plugin
233 AM_CONDITIONAL(SIPE_INCLUDE_TELEPATHY, test "$telepathy" != "no")
234 dnl NOTHING IMPLEMENTED YET!!!
235 dnl if test "$telepathy" != "no"; then
236 dnl fi
238 dnl sanity check
239 AS_IF([test "$purple" = "no" -a "$telepathy" = "no"],
240         [AC_ERROR(at least one plugin must be selected
242 If you didn't use a --without option then please check that you have
243 the headers for the packages "purple" or "telepathy-glib" installed.
245         [])
247 dnl i18n
248 AC_MSG_CHECKING([locale_CPPFLAGS])
249 LOCALE_CPPFLAGS='-DLOCALEDIR=\"$(prefix)/$(DATADIRNAME)/locale\"'
250 AC_SUBST([LOCALE_CPPFLAGS])
251 AC_MSG_RESULT([$LOCALE_CPPFLAGS])
252 AM_GLIB_GNU_GETTEXT
253 AC_SUBST(GETTEXT_PACKAGE, "${PACKAGE_NAME}")
255 dnl codeset
256 AM_LANGINFO_CODESET
258 dnl substitutions and generated files
259 AC_CONFIG_HEADERS([config.h])
260 AC_CONFIG_FILES([
261         Makefile
262         pixmaps/Makefile
263         m4macros/Makefile
264         po/Makefile.in
265         pixmaps/16/Makefile
266         pixmaps/22/Makefile
267         pixmaps/48/Makefile
268         src/Makefile
269         src/core/Makefile
270         src/api/Makefile
271         src/purple/Makefile
272         src/telepathy/Makefile
273         ])
275 dnl generate files
276 AC_OUTPUT()
278 dnl additional info for the user
279 echo
280 if test "$purple" != "no" ; then
281         echo "Compiling libpurple plugin"
282         echo "PURPLE_CFLAGS  : $PURPLE_CFLAGS"
283         echo "PURPLE_LIBS    : $PURPLE_LIBS"
284 else
285         echo "Skipping libpurple plugin"
288 echo
289 if test "$telepathy" != "no" ; then
290         echo "Compiling telepathy plugin"
291         echo
292         echo "NOTHING IMPLEMENTED YET!!!"
293         echo
294         echo "TELEPATHY_CFLAGS: $TELEPATHY_CFLAGS"
295         echo "TELEPATHY_LIBS  : $TELEPATHY_LIBS"
296 else
297         echo "Skipping telepathy plugin"
299 if test "$kerberos" != "no" ; then
300         echo
301         echo "Compiling with kerberos 5 support"
302         echo "KRB5_CFLAGS    : $KRB5_CFLAGS"
303         echo "KRB5_LDFLAGS   : $KRB5_LDFLAGS"
304         echo "KRB5_LIBS      : $KRB5_LIBS"
307 if test "$enable_debug" != "no"; then
308         echo
309         echo "Compiling with debugging enabled"
310         echo "DEBUG_CFLAGS   : $DEBUG_CFLAGS"
313 if test -n "${QUALITY_CFLAGS}"; then
314         echo
315         echo "Compiling with compiler checks enabled"
316         echo "QUALITY_CFLAGS : $QUALITY_CFLAGS"
319 echo
320 echo "configure complete, now run 'make'"
321 echo
323 dnl The End.