2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([mcabber],[0.10.0-dev],[mcabber@lilotux.net])
7 AC_CONFIG_SRCDIR([mcabber])
8 AM_CONFIG_HEADER(mcabber/config.h)
9 AC_CONFIG_HEADER(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"
35 # Checks for header files.
37 AC_CHECK_HEADERS([arpa/inet.h fcntl.h locale.h netdb.h netinet/in.h stddef.h \
38 stdlib.h string.h strings.h sys/socket.h sys/time.h \
39 syslog.h termios.h wchar.h wctype.h localcharset.h])
40 AC_CHECK_HEADERS([unistd.h], , AC_MSG_ERROR([Missing header file]))
41 AC_VAR_TIMEZONE_EXTERNALS
43 # Checks for typedefs, structures, and compiler characteristics.
51 # Checks for library functions.
56 AC_FUNC_SELECT_ARGTYPES
60 AC_CHECK_FUNCS([alarm arc4random bzero gethostbyname gethostname inet_ntoa \
61 isascii memmove memset modf select setlocale socket strcasecmp \
62 strchr strdup strncasecmp strrchr strstr strcasestr vsnprintf \
66 AC_CHECK_DECLS([strptime],,,
73 # Check if we must provide a SIGWINCH handler
74 AC_ARG_ENABLE(sigwinch,
75 [ --enable-sigwinch compile with SIGWINCH handler],
76 [with_sigwinch=$enableval],
77 [with_sigwinch=$with_ext_funcs])
78 AC_MSG_RESULT($with_sigwinch)
79 if test "$with_sigwinch" = yes; then
80 AC_DEFINE([USE_SIGWINCH], [], [Provide own SIGWINCH handler])
83 # Checks for libraries.
85 AC_CHECK_LIB(charset, locale_charset)
87 AC_CHECK_FUNC(initscr,,
90 for lib in ncursesw ncurses
92 AC_CHECK_LIB($lib, waddnwstr,
93 [cf_ncurses="$lib"; cf_ncurses_unicode="yes"; break])
95 AC_CHECK_LIB($cf_ncurses, initscr,
96 [LIBS="$LIBS -l$cf_ncurses"
97 if test "$cf_ncurses" = ncursesw; then
98 AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/panel.h],,
99 [AC_CHECK_HEADERS([ncurses.h panel.h],,
100 AC_MSG_ERROR([Missing header file]))])
102 AC_CHECK_HEADERS([ncurses/ncurses.h ncurses/panel.h],,
103 [AC_CHECK_HEADERS([ncurses.h panel.h],,
104 AC_MSG_ERROR([Missing header file]))])
110 AC_CHECK_LIB([panelw], [new_panel],,
111 AC_CHECK_LIB([panel], [new_panel])
114 if test x"$cf_ncurses_unicode" = x"yes"; then
115 AC_DEFINE([HAVE_UNICODE], [], [Define if ncurses have unicode support])
117 AC_MSG_WARN([Your ncurses installation does not support unicode])
120 AC_CACHE_CHECK([for ESCDELAY variable],
121 [mc_cv_ncurses_escdelay],
126 [mc_cv_ncurses_escdelay=yes],
127 [mc_cv_ncurses_escdelay=no])
129 if test "$mc_cv_ncurses_escdelay" = yes; then
130 AC_DEFINE([HAVE_ESCDELAY], 1,
131 [Define if ncurses has ESCDELAY variable])
134 AC_ARG_ENABLE(modules, [ --enable-modules enable dynamic modules loading],
135 enable_modules=$enableval)
136 if test "x$enable_modules" = "xyes"; then
137 AC_DEFINE(MODULES_ENABLE, 1, [Define if you want dynamic modules loading])
138 gmodule_module=gmodule
144 AM_PATH_GLIB_2_0(2.14.0,
145 [AC_DEFINE([HAVE_GLIB_REGEX], 1,
146 [Define if GLib has regex support])],
147 [AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR([glib is required]),
148 [g_list_append], ["$gmodule_module"])],
149 [g_regex_new "$gmodule_module"])
151 # Check for loudmouth
152 PKG_CHECK_MODULES(LOUDMOUTH, loudmouth-1.0 >= 1.4.2)
153 AC_SUBST(LOUDMOUTH_CFLAGS)
154 AC_SUBST(LOUDMOUTH_LIBS)
157 AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
158 [Support IDN (needs GNU Libidn)]),
159 libidn=$withval, libidn=yes)
160 if test "$libidn" != "no" ; then
161 PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
162 if test "$libidn" != "yes" ; then
164 AC_MSG_WARN([Libidn not found])
167 AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want Libidn.])
172 AC_ARG_ENABLE(gpgme, AC_HELP_STRING([--disable-gpgme], [disable GPGME support]),
173 [ if test x"$enableval" = x"no"; then
178 if test x"${enable_gpgme}" != x"no"; then
179 AM_PATH_GPGME(1.0.0, AC_DEFINE([HAVE_GPGME], 1,
180 [Define if you use GPGME to support OpenPGP]))
184 AC_ARG_ENABLE(otr, [ --enable-otr enable OTR (Off-the-Record) messaging support],
185 enable_otr=$enableval, otr="")
186 if test "x$enable_otr" = "xyes"; then
187 # Look for libgcrypt and libotr
188 AM_PATH_LIBGCRYPT(1.2.2, [
189 AM_PATH_LIBOTR(3.1.0, ,
190 AC_MSG_ERROR(libotr 3.1.0 or newer is required.))
191 ], AC_MSG_ERROR(libgcrypt 1.2.2 or newer is required.)
195 # Check for Enchant stuff
196 AC_ARG_ENABLE(enchant, [ --enable-enchant enable enchant support],
197 enable_enchant=$enableval, enchant="")
198 # Check for Aspell stuff
199 AC_ARG_ENABLE(aspell, [ --enable-aspell enable aspell support],
200 enable_aspell=$enableval, aspell="")
202 if test "x$enable_enchant" = "xyes"; then
203 PKG_CHECK_MODULES(ENCHANT, [enchant],
204 AC_DEFINE(WITH_ENCHANT, 1, [Define if you want enchant support])
207 if test "x$enable_aspell" = "xyes"; then
208 AC_CHECK_HEADERS(aspell.h, [ have_aspell_includes=yes ])
209 if test "x$have_aspell_includes" = "xyes"; then
210 AC_CHECK_LIB(aspell, new_aspell_config, [ have_aspell_libs=yes ])
211 if test "x$have_aspell_libs" = "xyes"; then
212 AC_DEFINE([WITH_ASPELL], 1, [Define if you want aspell support])
213 LIBS="$LIBS -laspell"
223 AC_DEFINE([BUILD_JABBER], 1, [build with jabber support])
225 # Export $datadir to the source tree.
226 if test x"${datadir}" != x""; then
227 AC_DEFINE_DIR(DATA_DIR, datadir, [Data files directory])
230 # Export $libexecdir to the source tree
231 AC_DEFINE_DIR(PKGLIB_DIR, "${libdir}/${PACKAGE}", [Modules directory])
234 [AC_HELP_STRING(--enable-debug, add development compilation options)],
235 debug=$enableval, debug="")
236 if test x"${debug}" = x"yes"; then
237 AC_DEFINE_UNQUOTED([ENABLE_DEBUG],[1],[Devel compilation options])
238 if test "x$GCC" = "xyes"; then
239 if test "$gccvernum" -ge "400"; then
240 CFLAGS="$CFLAGS -Wextra"
244 CFLAGS="$CFLAGS -Wno-unused-parameter -pedantic -std=gnu99 $DBGCFLAGS -O0"
251 AC_ARG_ENABLE(hgcset,
252 [AC_HELP_STRING(--disable-hgcset, do not use Mercurial changeset value)],
253 hgcset=$enableval, hgcset="yes")
254 AM_CONDITIONAL(HGCSET, [test x$hgcset = xyes])
255 if test "${hgcset}" = "yes"; then
256 AC_DEFINE([ENABLE_HGCSET], 1, [Use Mercurial changeset])
259 AM_CONDITIONAL([OTR], [test x$libotr_found = xyes])
260 AM_CONDITIONAL([INSTALL_HEADERS], [test x$enable_modules = xyes])
262 # We need _GNU_SOURCE for strptime() and strcasestr()
263 CFLAGS="$CFLAGS -D_GNU_SOURCE"
265 AC_CONFIG_FILES([mcabber/Makefile
267 modules/beep/Makefile