Add colorcli theme
[mcabber.git] / mcabber / configure.ac
blob16e1985d5c932427b1a62632b95a074db0023371
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([mcabber],[1.1.1-dev],[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"
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]))])
109          else
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]))])
113          fi
114         ],
115         [CF_CURSES_LIBS])
118 AC_CHECK_LIB([panelw], [new_panel],,
119              AC_CHECK_LIB([panel], [new_panel])
120             )
122 if test x"$cf_ncurses_unicode" = x"yes"; then
123     AC_DEFINE([HAVE_UNICODE], [], [Define if ncurses have unicode support])
124 else
125     AC_MSG_WARN([Your ncurses installation does not support unicode])
128 AC_CACHE_CHECK([for ESCDELAY variable],
129                [mc_cv_ncurses_escdelay],
130                [AC_TRY_LINK([], [
131                             extern int ESCDELAY;
132                             ESCDELAY = 0;
133                             ],
134                             [mc_cv_ncurses_escdelay=yes],
135                             [mc_cv_ncurses_escdelay=no])
136                ])
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
148 else
149   gmodule_module=''
152 # Check for glib
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]
165                            ),
166                   []
167                  )
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]
173                         )
174             )
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]
179                         )
180             )
183 # Check for libidn
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
190     libidn=no
191     AC_MSG_WARN([Libidn not found])
192   else
193     libidn=yes
194     AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want Libidn.])
195   fi
198 # Check for gpgme
199 AC_ARG_ENABLE(gpgme,
200     AC_HELP_STRING([--disable-gpgme], [disable GPGME support]),
201     [ if test x"$enableval" = x"no"; then
202         enable_gpgme=no
203       fi
204     ])
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]))
211 # Check for otr
212 AC_ARG_ENABLE(otr,
213     AC_HELP_STRING([--enable-otr],
214                    [enable OTR (Off-the-Record) messaging support]),
215     enable_otr=$enableval,
216     otr="")
217 if test "x$enable_otr" = "xyes"; then
218     # Look for libotr
219     AM_PATH_LIBOTR(4.0.0, [
220         AC_DEFINE([HAVE_LIBOTR], 1, [Define if you use libotr])
221     ], [
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])
225         ], [
226             AC_MSG_ERROR(libotr 3.1.0 or newer is required.)
227         ])
228     ])
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])
244 else
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"
252         else
253             enable_aspell=no
254         fi
255     else
256         enable_aspell=no
257     fi
258  fi
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])
270 AC_ARG_ENABLE(debug,
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"
278         else
279             CFLAGS="$CFLAGS -W"
280         fi
281         CFLAGS="$CFLAGS -Wno-unused-parameter -pedantic -std=gnu99 $DBGCFLAGS -O0"
282     fi # gcc
283     CFLAGS="$CFLAGS -g"
284 else
285     CFLAGS="-O2 $CFLAGS"
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
307                  modules/Makefile
308                  modules/beep/Makefile
309                  modules/xttitle/Makefile
310                  modules/fifo/Makefile
311                  modules/urlregex/Makefile
312                  doc/Makefile
313                  doc/guide/Makefile
314                  doc/help/Makefile
315                  mcabber.pc
316                  Makefile])
317 AC_OUTPUT
318 dnl vim: set expandtab cindent cinoptions=>2\:2(0 sw=2 ts=2:  For Vim users...