3 # hurray for <http://www.lrde.epita.fr/~adl/autotools.html>
7 m4_esyscmd([misc/git-version-gen .tarball-version]),
8 [http://bugzilla.centerim.org/], [centerim5],
9 [http://www.centerim.org/])
10 # prevent AC_PROG_CC, AC_PROG_CXX from initializing CFLAGS and CXXFLAGS
13 AC_CONFIG_SRCDIR([config.h.in])
14 AC_CONFIG_AUX_DIR([config])
15 AC_CONFIG_HEADER([config.h])
16 AC_CONFIG_MACRO_DIR([m4])
17 AM_INIT_AUTOMAKE([-Wall])
18 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
22 ########################
23 # Checks for programs. #
24 ########################
31 LT_INIT([disable-static])
33 #########################
34 # Checks for libraries. #
35 #########################
37 AM_GNU_GETTEXT([external])
38 AM_GNU_GETTEXT_VERSION([0.17])
41 # v2.7.0 is needed because of purple_account_get_name_for_display(), this
42 # version was released on 2010-05-13 and is available in both Debian Stable
43 # (squeeze) and CentOS 6
44 # find . \( -name \*.cpp -o -name \*.h \) -print0 | xargs -0 sed -n 's/.*\(purple_[^( ]*\)(.*/\1/p' | sort | uniq | less
45 PKG_CHECK_MODULES([PURPLE], [purple >= 2.7.0])
46 AC_SUBST([PURPLE_CFLAGS])
47 AC_SUBST([PURPLE_LIBS])
50 # v2.16.0 is needed because of g_markup_parse_context_get_element_stack(),
51 # this version was released on 2009-03-13
52 # find . \( -name \*.cpp -o -name \*.h \) -print0 | xargs -0 sed -n 's/.*\(g_[^ (]*\)(.*/\1/p' | sort | uniq | less
53 PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.16.0])
54 AC_SUBST([GLIB_CFLAGS])
57 # extaction plugin requires a newer version of glib, check if it's available
58 PKG_CHECK_EXISTS([glib-2.0 >= 2.32.0], [build_extaction=yes],
60 AC_MSG_WARN([cannot find glib version >= 2.32, extaction plugin disabled])])
61 AM_CONDITIONAL(BUILD_EXTACTION, test "x$build_extaction" = xyes)
64 # v2.2.0 was released on 2008-02-22
65 PKG_CHECK_MODULES([SIGC], [sigc++-2.0 >= 2.2.0])
66 AC_SUBST([SIGC_CFLAGS])
71 AC_PATH_LIB([ncursesw], , [ncurses.h], [ncursesw5-config], , , [
73 AC_ERROR([You must have the ncursesw library and developement headers installed to build.])])
75 ############################
76 # Checks for header files. #
77 ############################
79 ##################################################################
80 # Checks for typedefs, structures, and compiler characteristics. #
81 ##################################################################
83 #################################
84 # Checks for library functions. #
85 #################################
87 ###############################
88 # Set default compiler flags. #
89 ###############################
91 AC_ARG_ENABLE([strict], [AC_HELP_STRING([--enable-strict],
92 [enable extra compiler warnings during build])])
94 if test "$GCC" = yes; then
95 AS_IF([test "$enable_strict" = yes],
96 [CFLAGS="-Wall -Wextra -pedantic $CFLAGS"
97 CXXFLAGS="-Wall -Wextra -pedantic -Wno-long-long $CXXFLAGS"])
104 AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug],
105 [compile with debugging support])])
107 # TODO provide correct switches for other compilers too
108 if test "$GCC" = yes; then
109 AS_IF([test "$enable_debug" = yes],
110 [CFLAGS="-ggdb -O0 $CFLAGS"
111 CXXFLAGS="-ggdb -O0 $CXXFLAGS"],
112 [CFLAGS="-O2 $CFLAGS"
113 CXXFLAGS="-O2 $CXXFLAGS"])
118 AS_IF([test "$enable_debug" = yes],
119 [AC_DEFINE([DEBUG], [1], [Define if debugging is enabled.])])
121 # adl_RECURSIVE_EVAL(VALUE, RESULT)
122 # =================================
123 # Interpolate the VALUE in loop until it doesn't change,
124 # and set the result to $RESULT.
125 # WARNING: It's easy to get an infinite loop with some unsane input.
126 AC_DEFUN([adl_RECURSIVE_EVAL],
128 $2=`(test "$prefix" = NONE && prefix="$ac_default_prefix"
129 test "$exec_prefix" = NONE && exec_prefix="$prefix"
131 while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
132 _lcl_receval_old="[$]_lcl_receval"
133 eval _lcl_receval="\"[$]_lcl_receval\""
135 echo "[$]_lcl_receval")`])
137 # Define locale and pkgdir directories. It would be nicer to do this in
138 # Makefile.ams by adding appropriate '-D' compiler options to respective
139 # CPPFLAGS, which is a common solution that can be seen in other projects. In
140 # that case, it isn't needed to resolve the paths at the configure time using
141 # the adl_RECURSIVE_EVAL function. However this solution unfortunately doesn't
142 # work correctly when values of the defines are changed, the source files that
143 # use these defines don't get correctly recompiled. To fix this, the defines
144 # have to be put into the config.h file.
145 adl_RECURSIVE_EVAL([$localedir], [localedir_eval])
146 AC_DEFINE_UNQUOTED([LOCALEDIR], ["$localedir_eval"],
147 [Define to the locale directory.])
149 adl_RECURSIVE_EVAL([$pkglibdir], [pkglibdir_eval])
150 AC_DEFINE_UNQUOTED([PKGLIBDIR], ["$pkglibdir_eval"],
151 [Define to the pkglib directory.])
153 ########################
154 # Create output files. #
155 ########################
156 AC_CONFIG_FILES([Makefile
160 doc/doxygen-cppconsui.conf