2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([mcabber],[0.10.2-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"
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_ARG_ENABLE(sigwinch,
77 AC_HELP_STRING([--enable-sigwinch], [compile with SIGWINCH handler]),
78 [with_sigwinch=$enableval],
79 [with_sigwinch=$with_ext_funcs])
80 AC_MSG_RESULT($with_sigwinch)
81 if test "$with_sigwinch" = yes; then
82 AC_DEFINE([USE_SIGWINCH], [], [Provide own SIGWINCH handler])
85 # Checks for libraries.
87 AC_CHECK_LIB(charset, locale_charset)
89 AC_CHECK_FUNC(initscr,,
92 for lib in ncursesw ncurses
94 AC_CHECK_LIB($lib, waddnwstr,
95 [cf_ncurses="$lib"; cf_ncurses_unicode="yes"; break])
97 AC_CHECK_LIB($cf_ncurses, initscr,
98 [LIBS="$LIBS -l$cf_ncurses"
99 if test "$cf_ncurses" = ncursesw; then
100 AC_CHECK_HEADERS([ncursesw/ncurses.h ncursesw/panel.h],,
101 [AC_CHECK_HEADERS([ncurses.h panel.h],,
102 AC_MSG_ERROR([Missing header file]))])
104 AC_CHECK_HEADERS([ncurses/ncurses.h ncurses/panel.h],,
105 [AC_CHECK_HEADERS([ncurses.h panel.h],,
106 AC_MSG_ERROR([Missing header file]))])
112 AC_CHECK_LIB([panelw], [new_panel],,
113 AC_CHECK_LIB([panel], [new_panel])
116 if test x"$cf_ncurses_unicode" = x"yes"; then
117 AC_DEFINE([HAVE_UNICODE], [], [Define if ncurses have unicode support])
119 AC_MSG_WARN([Your ncurses installation does not support unicode])
122 AC_CACHE_CHECK([for ESCDELAY variable],
123 [mc_cv_ncurses_escdelay],
128 [mc_cv_ncurses_escdelay=yes],
129 [mc_cv_ncurses_escdelay=no])
131 if test "$mc_cv_ncurses_escdelay" = yes; then
132 AC_DEFINE([HAVE_ESCDELAY], 1,
133 [Define if ncurses has ESCDELAY variable])
136 AC_ARG_ENABLE(modules, AC_HELP_STRING([--disable-modules],
137 [disable dynamic modules loading]),
138 enable_modules=$enableval)
139 if test "x$enable_modules" != "xno"; then
140 AC_DEFINE(MODULES_ENABLE, 1, [Define if you want dynamic modules loading])
141 gmodule_module=gmodule
147 AM_PATH_GLIB_2_0(2.14.0,
148 [AC_DEFINE([HAVE_GLIB_REGEX], 1,
149 [Define if GLib has regex support])],
150 [AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR([glib is required]),
151 [g_list_append], ["$gmodule_module"])],
152 [g_regex_new "$gmodule_module"])
154 # Check for loudmouth
155 PKG_CHECK_MODULES(LOUDMOUTH, loudmouth-1.0 >= 1.4.2)
158 AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
159 [Support IDN (needs GNU Libidn)]),
160 libidn=$withval, libidn=yes)
161 if test "$libidn" != "no" ; then
162 PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
163 if test "$libidn" != "yes" ; then
165 AC_MSG_WARN([Libidn not found])
168 AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want Libidn.])
174 AC_HELP_STRING([--disable-gpgme], [disable GPGME support]),
175 [ if test x"$enableval" = x"no"; then
180 if test x"${enable_gpgme}" != x"no"; then
181 AM_PATH_GPGME(1.0.0, AC_DEFINE([HAVE_GPGME], 1,
182 [Define if you use GPGME to support OpenPGP]))
187 AC_HELP_STRING([--enable-otr],
188 [enable OTR (Off-the-Record) messaging support]),
189 enable_otr=$enableval, otr="")
190 if test "x$enable_otr" = "xyes"; then
191 # Look for libgcrypt and libotr
192 AM_PATH_LIBGCRYPT(1.2.2, [
193 AM_PATH_LIBOTR(3.1.0, ,
194 AC_MSG_ERROR(libotr 3.1.0 or newer is required.))
195 ], AC_MSG_ERROR(libgcrypt 1.2.2 or newer is required.)
199 # Check for Enchant stuff
200 AC_ARG_ENABLE(enchant,
201 AC_HELP_STRING([--enable-enchant], [enable enchant support]),
202 enable_enchant=$enableval, enchant="")
203 # Check for Aspell stuff
204 AC_ARG_ENABLE(aspell,
205 AC_HELP_STRING([--enable-aspell], [enable aspell support]),
206 enable_aspell=$enableval, aspell="")
208 if test "x$enable_enchant" = "xyes"; then
209 PKG_CHECK_MODULES(ENCHANT, [enchant],
210 AC_DEFINE(WITH_ENCHANT, 1, [Define if you want enchant support])
213 if test "x$enable_aspell" = "xyes"; then
214 AC_CHECK_HEADERS(aspell.h, [ have_aspell_includes=yes ])
215 if test "x$have_aspell_includes" = "xyes"; then
216 AC_CHECK_LIB(aspell, new_aspell_config, [ have_aspell_libs=yes ])
217 if test "x$have_aspell_libs" = "xyes"; then
218 AC_DEFINE([WITH_ASPELL], 1, [Define if you want aspell support])
219 LIBS="$LIBS -laspell"
229 # Export $datadir to the source tree.
230 if test x"${datadir}" != x""; then
231 AC_DEFINE_DIR(DATA_DIR, datadir, [Data files directory])
234 # Export $libexecdir to the source tree
235 AC_DEFINE_DIR(PKGLIB_DIR, "${libdir}/${PACKAGE}", [Modules directory])
237 AC_ARG_ENABLE(xep0022,
238 AC_HELP_STRING([--enable-xep0022],
239 [enable obsolete Message Events (XEP-0022)]),
241 if test "${xep0022}" = "yes"; then
242 AC_DEFINE([XEP0022], 1, [Define if you want obsolete Message Events])
246 AC_HELP_STRING([--enable-debug], [add development compilation options]),
247 debug=$enableval, debug="")
248 if test x"${debug}" = x"yes"; then
249 AC_DEFINE_UNQUOTED([ENABLE_DEBUG],[1],[Devel compilation options])
250 if test "x$GCC" = "xyes"; then
251 if test "$gccvernum" -ge "400"; then
252 CFLAGS="$CFLAGS -Wextra"
256 CFLAGS="$CFLAGS -Wno-unused-parameter -pedantic -std=gnu99 $DBGCFLAGS -O0"
263 AC_ARG_ENABLE(hgcset,
264 AC_HELP_STRING([--disable-hgcset], [do not use Mercurial changeset value]),
265 hgcset=$enableval, hgcset="yes")
266 AM_CONDITIONAL(HGCSET, [test x$hgcset = xyes])
267 if test "${hgcset}" = "yes"; then
268 AC_DEFINE([ENABLE_HGCSET], 1, [Use Mercurial changeset])
271 AM_CONDITIONAL([OTR], [test x$libotr_found = xyes])
272 AM_CONDITIONAL([INSTALL_HEADERS], [test x$enable_modules != xno])
274 # Prepare some config.h variables
275 AC_DEFINE([MCABBER_BRANCH], "dev", [Mcabber branch])
276 AC_DEFINE([MCABBER_VERSION], "AC_PACKAGE_VERSION", [Mcabber version string])
278 # We need _GNU_SOURCE for strptime() and strcasestr()
279 CFLAGS="$CFLAGS -D_GNU_SOURCE"
281 AC_CONFIG_FILES([mcabber/Makefile
283 modules/beep/Makefile
284 modules/xttitle/Makefile
285 modules/fifo/Makefile
286 modules/urlregex/Makefile