Ready for release 1.0.1
[mcabber.git] / mcabber / configure.ac
blob83b7542c38f1c7b309b3090f498b8f5e2c00800f
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([mcabber],[1.0.1],[mcabber@lilotux.net])
6 XC_AUTOMAKE
7 AC_CONFIG_SRCDIR([mcabber])
8 AC_CONFIG_HEADERS([mcabber/config.h])
9 AC_CONFIG_HEADERS([include/config.h])
11 AC_PROG_LIBTOOL
12 AC_PROG_RANLIB
14 # Checks for programs.
15 AC_PROG_CC
16 AC_PROG_INSTALL
18 if test "x$GCC" = "xyes"; then
19     dnl Get gcc version
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"
30     fi
33 AC_SYS_LARGEFILE
35 PKG_PROG_PKG_CONFIG
37 # Checks for header files.
38 AC_HEADER_STDC
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.
46 AC_HEADER_STDBOOL
47 AC_C_CONST
48 AC_C_INLINE
49 AC_TYPE_SIZE_T
50 AC_HEADER_TIME
51 AC_STRUCT_TM
53 # Checks for library functions.
54 AC_FUNC_ERROR_AT_LINE
55 AC_FUNC_MALLOC
56 AC_FUNC_MEMCMP
57 AC_FUNC_REALLOC
58 AC_FUNC_SELECT_ARGTYPES
59 AC_TYPE_SIGNAL
60 AC_FUNC_STRFTIME
61 AC_FUNC_VPRINTF
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 \
65                 iswblank])
68 AC_CHECK_DECLS([strptime],,,
69 [#define _GNU_SOURCE
70 #include <time.h>])
72 # Check for tm_gmtoff
73 MC_TM_GMTOFF
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])
84 else
85     AC_MSG_RESULT(no)
88 # Checks for libraries.
90 AC_CHECK_LIB(charset, locale_charset)
92 AC_CHECK_FUNC(initscr,,
94     cf_ncurses="ncurses"
95     for lib in ncursesw ncurses
96     do
97         AC_CHECK_LIB($lib, waddnwstr,
98             [cf_ncurses="$lib"; cf_ncurses_unicode="yes"; break])
99     done
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]))])
106          else
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]))])
110          fi
111         ],
112         [CF_CURSES_LIBS])
115 AC_CHECK_LIB([panelw], [new_panel],,
116              AC_CHECK_LIB([panel], [new_panel])
117             )
119 if test x"$cf_ncurses_unicode" = x"yes"; then
120     AC_DEFINE([HAVE_UNICODE], [], [Define if ncurses have unicode support])
121 else
122     AC_MSG_WARN([Your ncurses installation does not support unicode])
125 AC_CACHE_CHECK([for ESCDELAY variable],
126                [mc_cv_ncurses_escdelay],
127                [AC_TRY_LINK([], [
128                             extern int ESCDELAY;
129                             ESCDELAY = 0;
130                             ],
131                             [mc_cv_ncurses_escdelay=yes],
132                             [mc_cv_ncurses_escdelay=no])
133                ])
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
145 else
146   gmodule_module=''
149 # Check for glib
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]
164                         )
165             )
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]
170                         )
171             )
174 # Check for libidn
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
181     libidn=no
182     AC_MSG_WARN([Libidn not found])
183   else
184     libidn=yes
185     AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want Libidn.])
186   fi
189 # Check for gpgme
190 AC_ARG_ENABLE(gpgme,
191     AC_HELP_STRING([--disable-gpgme], [disable GPGME support]),
192     [ if test x"$enableval" = x"no"; then
193         enable_gpgme=no
194       fi
195     ])
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]))
202 # Check for otr
203 AC_ARG_ENABLE(otr,
204     AC_HELP_STRING([--enable-otr],
205                    [enable OTR (Off-the-Record) messaging support]),
206     enable_otr=$enableval,
207     otr="")
208 if test "x$enable_otr" = "xyes"; then
209     # Look for libotr
210     AM_PATH_LIBOTR(4.0.0, [
211         AC_DEFINE([HAVE_LIBOTR], 1, [Define if you use libotr])
212     ], [
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])
216         ], [
217             AC_MSG_ERROR(libotr 3.1.0 or newer is required.)
218         ])
219     ])
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])
235 else
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"
243         else
244             enable_aspell=no
245         fi
246     else
247         enable_aspell=no
248     fi
249  fi
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])
260 AC_ARG_ENABLE(debug,
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"
268         else
269             CFLAGS="$CFLAGS -W"
270         fi
271         CFLAGS="$CFLAGS -Wno-unused-parameter -pedantic -std=gnu99 $DBGCFLAGS -O0"
272     fi # gcc
273     CFLAGS="$CFLAGS -g"
274 else
275     CFLAGS="-O2 $CFLAGS"
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], "1.0.1", [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
297                  modules/Makefile
298                  modules/beep/Makefile
299                  modules/xttitle/Makefile
300                  modules/fifo/Makefile
301                  modules/urlregex/Makefile
302                  doc/Makefile
303                  doc/guide/Makefile
304                  doc/help/Makefile
305                  mcabber.pc
306                  Makefile])
307 AC_OUTPUT
308 dnl vim: set expandtab cindent cinoptions=>2\:2(0 sw=2 ts=2:  For Vim users...