2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([mcabber],[1.1.1-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"
103 AC_CHECK_LIB(tinfo, tgetent, [LIBS="$LIBS -ltinfo"])
105 if test "$cf_ncurses" = ncursesw; then
106 AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/panel.h],,
107 [AC_CHECK_HEADERS([ncurses.h panel.h],,
108 AC_MSG_ERROR([Missing header file]))])
110 AC_CHECK_HEADERS([ncurses/ncurses.h ncurses/panel.h],,
111 [AC_CHECK_HEADERS([ncurses.h panel.h],,
112 AC_MSG_ERROR([Missing header file]))])
118 AC_CHECK_LIB([panelw], [new_panel],,
119 AC_CHECK_LIB([panel], [new_panel])
122 if test x"$cf_ncurses_unicode" = x"yes"; then
123 AC_DEFINE([HAVE_UNICODE], [], [Define if ncurses have unicode support])
125 AC_MSG_WARN([Your ncurses installation does not support unicode])
128 AC_CACHE_CHECK([for ESCDELAY variable],
129 [mc_cv_ncurses_escdelay],
134 [mc_cv_ncurses_escdelay=yes],
135 [mc_cv_ncurses_escdelay=no])
137 if test "$mc_cv_ncurses_escdelay" = yes; then
138 AC_DEFINE([HAVE_ESCDELAY], 1,
139 [Define if ncurses has ESCDELAY variable])
142 AC_ARG_ENABLE(modules, AC_HELP_STRING([--disable-modules],
143 [disable dynamic modules loading]),
144 enable_modules=$enableval)
145 if test "x$enable_modules" != "xno"; then
146 AC_DEFINE(MODULES_ENABLE, 1, [Define if you want dynamic modules loading])
147 gmodule_module=gmodule
153 AM_PATH_GLIB_2_0(2.14.0,
154 [AC_DEFINE([HAVE_GLIB_REGEX], 1,
155 [Define if GLib has regex support])],
156 [AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR([glib is required]),
157 [g_list_append], ["$gmodule_module"])],
158 [g_regex_new "$gmodule_module"])
160 # Check for loudmouth
161 PKG_CHECK_MODULES(LOUDMOUTH, loudmouth-1.0 >= 1.4.2)
162 PKG_CHECK_MODULES(LOUDMOUTH_SHA256, [loudmouth-1.0 >= 1.5.3],
163 AC_DEFINE([LOUDMOUTH_USES_SHA256], 1,
164 [loudmouth is now using a new digest]
169 # Check for lm_ssl_set_cipher_list in loudmouth
170 AC_CHECK_LIB(loudmouth-1, lm_ssl_set_cipher_list,
171 AC_DEFINE([HAVE_LM_SSL_CIPHER_LIST], 1,
172 [Define that loudmouth has lm_ssl_cipher_list]
175 # Check for lm_ssl_set_cipher_list in loudmouth
176 AC_CHECK_LIB(loudmouth-1, lm_ssl_set_ca,
177 AC_DEFINE([HAVE_LM_SSL_CA], 1,
178 [Define that loudmouth has lm_ssl_ca]
184 AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
185 [Support IDN (needs GNU Libidn)]),
186 libidn=$withval, libidn=yes)
187 if test "$libidn" != "no" ; then
188 PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
189 if test "$libidn" != "yes" ; then
191 AC_MSG_WARN([Libidn not found])
194 AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want Libidn.])
200 AC_HELP_STRING([--disable-gpgme], [disable GPGME support]),
201 [ if test x"$enableval" = x"no"; then
206 if test x"${enable_gpgme}" != x"no"; then
207 AM_PATH_GPGME(1.0.0, AC_DEFINE([HAVE_GPGME], 1,
208 [Define if you use GPGME to support OpenPGP]))
213 AC_HELP_STRING([--enable-otr],
214 [enable OTR (Off-the-Record) messaging support]),
215 enable_otr=$enableval,
217 if test "x$enable_otr" = "xyes"; then
219 AM_PATH_LIBOTR(4.0.0, [
220 AC_DEFINE([HAVE_LIBOTR], 1, [Define if you use libotr])
222 AM_PATH_LIBOTR(3.1.0, [
223 AC_DEFINE([HAVE_LIBOTR], 1, [Define if you use libotr])
224 AC_DEFINE([HAVE_LIBOTR3], 1, [Define if you use libotr v3])
226 AC_MSG_ERROR(libotr 3.1.0 or newer is required.)
231 # Check for Enchant stuff
232 AC_ARG_ENABLE(enchant,
233 AC_HELP_STRING([--enable-enchant], [enable enchant support]),
234 enable_enchant=$enableval, enchant="")
235 # Check for Aspell stuff
236 AC_ARG_ENABLE(aspell,
237 AC_HELP_STRING([--enable-aspell], [enable aspell support]),
238 enable_aspell=$enableval, aspell="")
240 if test "x$enable_enchant" = "xyes"; then
241 PKG_CHECK_MODULES(ENCHANT, [enchant],
242 AC_DEFINE(WITH_ENCHANT, 1, [Define if you want enchant support])
245 if test "x$enable_aspell" = "xyes"; then
246 AC_CHECK_HEADERS(aspell.h, [ have_aspell_includes=yes ])
247 if test "x$have_aspell_includes" = "xyes"; then
248 AC_CHECK_LIB(aspell, new_aspell_config, [ have_aspell_libs=yes ])
249 if test "x$have_aspell_libs" = "xyes"; then
250 AC_DEFINE([WITH_ASPELL], 1, [Define if you want aspell support])
251 LIBS="$LIBS -laspell"
261 # Export $datadir to the source tree.
262 if test x"${datadir}" != x""; then
263 AC_DEFINE_DIR(DATA_DIR, datadir, [Data files directory])
266 # Export $libexecdir to the source tree
267 pkglibdir=${libdir}/${PACKAGE}
268 AC_DEFINE_DIR(PKGLIB_DIR, pkglibdir, [Modules directory])
271 AC_HELP_STRING([--enable-debug], [add development compilation options]),
272 debug=$enableval, debug="")
273 if test x"${debug}" = x"yes"; then
274 AC_DEFINE_UNQUOTED([ENABLE_DEBUG],[1],[Devel compilation options])
275 if test "x$GCC" = "xyes"; then
276 if test "$gccvernum" -ge "400"; then
277 CFLAGS="$CFLAGS -Wextra"
281 CFLAGS="$CFLAGS -Wno-unused-parameter -pedantic -std=gnu99 $DBGCFLAGS -O0"
288 AC_ARG_ENABLE(hgcset,
289 AC_HELP_STRING([--disable-hgcset], [do not use Mercurial changeset value]),
290 hgcset=$enableval, hgcset="yes")
291 AM_CONDITIONAL(HGCSET, [test x$hgcset = xyes])
292 if test "${hgcset}" = "yes"; then
293 AC_DEFINE([ENABLE_HGCSET], 1, [Use Mercurial changeset])
296 AM_CONDITIONAL([OTR], [test x$libotr_found = xyes])
297 AM_CONDITIONAL([INSTALL_HEADERS], [test x$enable_modules != xno])
299 # Prepare some config.h variables
300 AC_DEFINE([MCABBER_BRANCH], "dev", [Mcabber branch])
301 AC_DEFINE([MCABBER_VERSION], "AC_PACKAGE_VERSION", [Mcabber version string])
303 # We need _GNU_SOURCE for strptime() and strcasestr()
304 CFLAGS="$CFLAGS -D_GNU_SOURCE"
306 AC_CONFIG_FILES([mcabber/Makefile
308 modules/beep/Makefile
309 modules/xttitle/Makefile
310 modules/fifo/Makefile
311 modules/urlregex/Makefile
318 dnl vim: set expandtab cindent cinoptions=>2\:2(0 sw=2 ts=2: For Vim users...