2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([mcabber],[1.0.2-dev],[mcabber@lilotux.net])
7 AC_CONFIG_SRCDIR([mcabber])
8 AC_CONFIG_HEADERS([mcabber/config.h])
9 AC_CONFIG_HEADERS([include/config.h])
14 # Checks for programs.
18 if test "x$GCC" = "xyes"; then
20 AC_MSG_CHECKING([gcc version])
21 gccver=$($CC -dumpversion)
22 gccvermajor=$(echo $gccver | cut -d . -f1)
23 gccverminor=$(echo $gccver | cut -d . -f2)
24 gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
25 AC_MSG_RESULT($gccver)
27 CFLAGS="$CFLAGS -Wall"
28 if test x"$gccvermajor" = x"4" -a x"$gccverminor" = x"2"; then
29 DBGCFLAGS="-fgnu89-inline"
37 # Checks for header files.
39 AC_CHECK_HEADERS([arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h stddef.h \
40 stdlib.h string.h strings.h sys/socket.h sys/time.h \
41 syslog.h termios.h wchar.h wctype.h localcharset.h])
42 AC_CHECK_HEADERS([unistd.h], , AC_MSG_ERROR([Missing header file]))
43 AC_VAR_TIMEZONE_EXTERNALS
45 # Checks for typedefs, structures, and compiler characteristics.
53 # Checks for library functions.
58 AC_FUNC_SELECT_ARGTYPES
62 AC_CHECK_FUNCS([alarm arc4random bzero gethostbyname gethostname inet_ntoa \
63 isascii memmove memset modf select setlocale socket strcasecmp \
64 strchr strdup strncasecmp strrchr strstr strcasestr vsnprintf \
68 AC_CHECK_DECLS([strptime],,,
75 # Check if we must provide a SIGWINCH handler
76 AC_MSG_CHECKING([if we use our own SIGWINCH handler])
77 AC_ARG_ENABLE(sigwinch,
78 AC_HELP_STRING([--enable-sigwinch], [compile with SIGWINCH handler]),
79 [with_sigwinch=$enableval],
80 [with_sigwinch=$with_ext_funcs])
81 if test "$with_sigwinch" = yes; then
82 AC_MSG_RESULT($with_sigwinch)
83 AC_DEFINE([USE_SIGWINCH], [], [Provide own SIGWINCH handler])
88 # Checks for libraries.
90 AC_CHECK_LIB(charset, locale_charset)
92 AC_CHECK_FUNC(initscr,,
95 for lib in ncursesw ncurses
97 AC_CHECK_LIB($lib, waddnwstr,
98 [cf_ncurses="$lib"; cf_ncurses_unicode="yes"; break])
100 AC_CHECK_LIB($cf_ncurses, initscr,
101 [LIBS="$LIBS -l$cf_ncurses"
102 if test "$cf_ncurses" = ncursesw; then
103 AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/panel.h],,
104 [AC_CHECK_HEADERS([ncurses.h panel.h],,
105 AC_MSG_ERROR([Missing header file]))])
107 AC_CHECK_HEADERS([ncurses/ncurses.h ncurses/panel.h],,
108 [AC_CHECK_HEADERS([ncurses.h panel.h],,
109 AC_MSG_ERROR([Missing header file]))])
115 AC_CHECK_LIB([panelw], [new_panel],,
116 AC_CHECK_LIB([panel], [new_panel])
119 if test x"$cf_ncurses_unicode" = x"yes"; then
120 AC_DEFINE([HAVE_UNICODE], [], [Define if ncurses have unicode support])
122 AC_MSG_WARN([Your ncurses installation does not support unicode])
125 AC_CACHE_CHECK([for ESCDELAY variable],
126 [mc_cv_ncurses_escdelay],
131 [mc_cv_ncurses_escdelay=yes],
132 [mc_cv_ncurses_escdelay=no])
134 if test "$mc_cv_ncurses_escdelay" = yes; then
135 AC_DEFINE([HAVE_ESCDELAY], 1,
136 [Define if ncurses has ESCDELAY variable])
139 AC_ARG_ENABLE(modules, AC_HELP_STRING([--disable-modules],
140 [disable dynamic modules loading]),
141 enable_modules=$enableval)
142 if test "x$enable_modules" != "xno"; then
143 AC_DEFINE(MODULES_ENABLE, 1, [Define if you want dynamic modules loading])
144 gmodule_module=gmodule
150 AM_PATH_GLIB_2_0(2.14.0,
151 [AC_DEFINE([HAVE_GLIB_REGEX], 1,
152 [Define if GLib has regex support])],
153 [AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR([glib is required]),
154 [g_list_append], ["$gmodule_module"])],
155 [g_regex_new "$gmodule_module"])
157 # Check for loudmouth
158 PKG_CHECK_MODULES(LOUDMOUTH, loudmouth-1.0 >= 1.4.2)
160 # Check for lm_ssl_set_cipher_list in loudmouth
161 AC_CHECK_LIB(loudmouth-1, lm_ssl_set_cipher_list,
162 AC_DEFINE([HAVE_LM_SSL_CIPHER_LIST], 1,
163 [Define that loudmouth has lm_ssl_cipher_list]
166 # Check for lm_ssl_set_cipher_list in loudmouth
167 AC_CHECK_LIB(loudmouth-1, lm_ssl_set_ca,
168 AC_DEFINE([HAVE_LM_SSL_CA], 1,
169 [Define that loudmouth has lm_ssl_ca]
175 AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
176 [Support IDN (needs GNU Libidn)]),
177 libidn=$withval, libidn=yes)
178 if test "$libidn" != "no" ; then
179 PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
180 if test "$libidn" != "yes" ; then
182 AC_MSG_WARN([Libidn not found])
185 AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want Libidn.])
191 AC_HELP_STRING([--disable-gpgme], [disable GPGME support]),
192 [ if test x"$enableval" = x"no"; then
197 if test x"${enable_gpgme}" != x"no"; then
198 AM_PATH_GPGME(1.0.0, AC_DEFINE([HAVE_GPGME], 1,
199 [Define if you use GPGME to support OpenPGP]))
204 AC_HELP_STRING([--enable-otr],
205 [enable OTR (Off-the-Record) messaging support]),
206 enable_otr=$enableval,
208 if test "x$enable_otr" = "xyes"; then
210 AM_PATH_LIBOTR(4.0.0, [
211 AC_DEFINE([HAVE_LIBOTR], 1, [Define if you use libotr])
213 AM_PATH_LIBOTR(3.1.0, [
214 AC_DEFINE([HAVE_LIBOTR], 1, [Define if you use libotr])
215 AC_DEFINE([HAVE_LIBOTR3], 1, [Define if you use libotr v3])
217 AC_MSG_ERROR(libotr 3.1.0 or newer is required.)
222 # Check for Enchant stuff
223 AC_ARG_ENABLE(enchant,
224 AC_HELP_STRING([--enable-enchant], [enable enchant support]),
225 enable_enchant=$enableval, enchant="")
226 # Check for Aspell stuff
227 AC_ARG_ENABLE(aspell,
228 AC_HELP_STRING([--enable-aspell], [enable aspell support]),
229 enable_aspell=$enableval, aspell="")
231 if test "x$enable_enchant" = "xyes"; then
232 PKG_CHECK_MODULES(ENCHANT, [enchant],
233 AC_DEFINE(WITH_ENCHANT, 1, [Define if you want enchant support])
236 if test "x$enable_aspell" = "xyes"; then
237 AC_CHECK_HEADERS(aspell.h, [ have_aspell_includes=yes ])
238 if test "x$have_aspell_includes" = "xyes"; then
239 AC_CHECK_LIB(aspell, new_aspell_config, [ have_aspell_libs=yes ])
240 if test "x$have_aspell_libs" = "xyes"; then
241 AC_DEFINE([WITH_ASPELL], 1, [Define if you want aspell support])
242 LIBS="$LIBS -laspell"
252 # Export $datadir to the source tree.
253 if test x"${datadir}" != x""; then
254 AC_DEFINE_DIR(DATA_DIR, datadir, [Data files directory])
257 # Export $libexecdir to the source tree
258 AC_DEFINE_DIR(PKGLIB_DIR, "${libdir}/${PACKAGE}", [Modules directory])
261 AC_HELP_STRING([--enable-debug], [add development compilation options]),
262 debug=$enableval, debug="")
263 if test x"${debug}" = x"yes"; then
264 AC_DEFINE_UNQUOTED([ENABLE_DEBUG],[1],[Devel compilation options])
265 if test "x$GCC" = "xyes"; then
266 if test "$gccvernum" -ge "400"; then
267 CFLAGS="$CFLAGS -Wextra"
271 CFLAGS="$CFLAGS -Wno-unused-parameter -pedantic -std=gnu99 $DBGCFLAGS -O0"
278 AC_ARG_ENABLE(hgcset,
279 AC_HELP_STRING([--disable-hgcset], [do not use Mercurial changeset value]),
280 hgcset=$enableval, hgcset="yes")
281 AM_CONDITIONAL(HGCSET, [test x$hgcset = xyes])
282 if test "${hgcset}" = "yes"; then
283 AC_DEFINE([ENABLE_HGCSET], 1, [Use Mercurial changeset])
286 AM_CONDITIONAL([OTR], [test x$libotr_found = xyes])
287 AM_CONDITIONAL([INSTALL_HEADERS], [test x$enable_modules != xno])
289 # Prepare some config.h variables
290 AC_DEFINE([MCABBER_BRANCH], "dev", [Mcabber branch])
291 AC_DEFINE([MCABBER_VERSION], "AC_PACKAGE_VERSION", [Mcabber version string])
293 # We need _GNU_SOURCE for strptime() and strcasestr()
294 CFLAGS="$CFLAGS -D_GNU_SOURCE"
296 AC_CONFIG_FILES([mcabber/Makefile
298 modules/beep/Makefile
299 modules/xttitle/Makefile
300 modules/fifo/Makefile
301 modules/urlregex/Makefile
308 dnl vim: set expandtab cindent cinoptions=>2\:2(0 sw=2 ts=2: For Vim users...