Update help files (say_to)
[mcabber.git] / mcabber / configure.ac
blobd57c22628072779b41ed8e900e25e297f65bb3e2
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT([mcabber],[0.10.2-dev],[mcabber@lilotux.net])
6 AM_INIT_AUTOMAKE
7 AC_CONFIG_SRCDIR([mcabber])
8 AM_CONFIG_HEADER(mcabber/config.h)
9 AC_CONFIG_HEADER(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_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,,
91     cf_ncurses="ncurses"
92     for lib in ncursesw ncurses
93     do
94         AC_CHECK_LIB($lib, waddnwstr,
95             [cf_ncurses="$lib"; cf_ncurses_unicode="yes"; break])
96     done
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]))])
103          else
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]))])
107          fi
108         ],
109         [CF_CURSES_LIBS])
112 AC_CHECK_LIB([panelw], [new_panel],,
113              AC_CHECK_LIB([panel], [new_panel])
114             )
116 if test x"$cf_ncurses_unicode" = x"yes"; then
117     AC_DEFINE([HAVE_UNICODE], [], [Define if ncurses have unicode support])
118 else
119     AC_MSG_WARN([Your ncurses installation does not support unicode])
122 AC_CACHE_CHECK([for ESCDELAY variable],
123                [mc_cv_ncurses_escdelay],
124                [AC_TRY_LINK([], [
125                             extern int ESCDELAY;
126                             ESCDELAY = 0;
127                             ],
128                             [mc_cv_ncurses_escdelay=yes],
129                             [mc_cv_ncurses_escdelay=no])
130                ])
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
142 else
143   gmodule_module=''
146 # Check for glib
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)
157 # Check for libidn
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
164     libidn=no
165     AC_MSG_WARN([Libidn not found])
166   else
167     libidn=yes
168     AC_DEFINE(HAVE_LIBIDN, 1, [Define to 1 if you want Libidn.])
169   fi
172 # Check for gpgme
173 AC_ARG_ENABLE(gpgme,
174     AC_HELP_STRING([--disable-gpgme], [disable GPGME support]),
175     [ if test x"$enableval" = x"no"; then
176         enable_gpgme=no
177       fi
178     ])
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]))
185 # Check for otr
186 AC_ARG_ENABLE(otr,
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.)
196   )
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])
212 else
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"
220         else
221             enable_aspell=no
222         fi
223     else
224         enable_aspell=no
225     fi
226  fi
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)]),
240               xep0022=$enableval)
241 if test "${xep0022}" = "yes"; then
242     AC_DEFINE([XEP0022], 1, [Define if you want obsolete Message Events])
245 AC_ARG_ENABLE(debug,
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"
253         else
254             CFLAGS="$CFLAGS -W"
255         fi
256         CFLAGS="$CFLAGS -Wno-unused-parameter -pedantic -std=gnu99 $DBGCFLAGS -O0"
257     fi # gcc
258     CFLAGS="$CFLAGS -g"
259 else
260     CFLAGS="-O2 $CFLAGS"
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
282                  modules/Makefile
283                  modules/beep/Makefile
284                  modules/xttitle/Makefile
285                  modules/fifo/Makefile
286                  modules/urlregex/Makefile
287                  doc/Makefile
288                  doc/guide/Makefile
289                  doc/help/Makefile
290                  mcabber.pc
291                  Makefile])
292 AC_OUTPUT